H89 Emulator - The Virtual H89 All-in-One Computer

This page covers my Heathkit H89 emulator written in C++. There is a second online H89 emulator written in JavaScript.

This project is currently under develop. Source has been released on github: VirtualH89.

Video clip of the Emulator

A quick little clip of the emulator running the snake game:

A longer clip of the emulator captured directly on the computer, showing the boot process and a short game of gravitron:

Goals

  • To work with both CP/M, HDOS, and UCSD Pascal.
  • Clock accurate emulation of the entire system. (Be able to play fast-action graphic games). Option to run emulator at 'max speed'.
  • Emulation of the H19 Terminal functions (including accurate character and graphic representation). Accurate baud rate between the computer and terminal.
  • Be able to select hardware options of the system, i.e. amount of memory, which ROM, which controllers, add-on disk drive systems.
  • Portable to a wide-range of the platforms (Windows, Linux, Mac, etc.).
  • Written in C++.

Status - First release of source has been uploaded to GitHub - VirtualH89

 Virtual H89 Operating System Status Table

OS Status Comments
HDOS 1.0
(Issue #50.00.00 890-1)
Does not Boot This initial release of HDOS appears to be hard-coded for the H8's 8251 UART. Since the H89 does not use an 8251 for the console port or even the same address as the H8, the H89 emulator will not support this initial release of Version 1.0.
HDOS 1.0
(Issue #50.03.00 890-1-3)
Boots This release of version 1.0 supports the 8250 serial port and currently boots on the emulator. No obvious problems.
HDOS 1.5
(Issue #50.04.00 890-1-4)
Boots No obvious problems.
HDOS 1.6
(Issue #50.05.00 890-1-5)
Boots No obvious problems.
HDOS 2.0
(Issue #50.06.00 890-64)
Boots No obvious problems. Writing works. INIT is now working.
HDOS 3.02
(Issue #50.07.00)
Boots A hard-sectored HDOS 3.02 boot disk was located by Les Bird. This disk image boots without any obvious problems.
CP/M 2.2.02 Boots No obvious problems. Writing appears to work. DUP works. FORMAT works. SYSGEN appears to work.
CP/M 2.2.03 Boots The CONFIGUR.COM program now correctly auto-detects the virtual floppy drives, there was 2 flags in the H17 status register that needed to be set. FORMAT works.
CP/M 2.2.04 Boots Configur.com and the extra 'Setup' Disk correctly detects the virtual disk drives, but when generating the boot disk, it adds support for the H47. Need to determine why. DUP works. FORMAT works. SYSGEN appears to work.
UCSD Pascal Boots The image I have only supports 2 floppies, so I had to modify the source to have only 2 disks, to allow it to boot.

 

H89 Screen dump

H89 Screen dump

H89 Screen dump

More screenshots below.

  • Z80 Emulation selection (done)
    • Examined both z80pack and yaze-ag. Both are good, but z80pack provides the option to run at a given speed.
    • Started with z80pack.
      • Encapsulated the Z80 emulation into a new C++ class (done - but may need further refinement).
      • Added support for interrupt mode 0 (done - only supports RST xx instructions).
      • Updated the code to have accurate flag handling on some of the rarely used instructions. (done - documented behavior appears complete and accurate)
      • Abstracted the memory / address bus (done)
      • Adding support for more 'undocumented' opcodes as defined in "The Undocumented Z80 Documented". (done)
  • Phase 1 (Done)
    • Support for both ROM and RAM objects are implemented(done)
      • The Monitor ROM (MTR-90-1) is running.
    • 2 ms timer works (done).
      • Changed the way the accurate clock emulation was coded, it now uses an interval timer instead of sleep() calls. (The existing code did not appear to take into account the amount of time executing instructions. Although on a current computer, this time was < 3% with the generic CP/M system z80pack provides. This could be a problem on slower systems or as more code is added for the emulator.)
      • Interrupts are working. 
      • A 2 mSec timer works on Linux and Leopard (10.5.x), but not on Tiger (10.4.x) (done).
        • A redesign would be needed to work on systems that only support a 10 mSec timer, this currently is low priority and may not be implemented. (may not implement).
    • Basic 8250 Serial port support (done).
      • Very rudimentary support for the 8250 is complete. Input and output of characters work. But further work is needed to fully implement the 8250 into a C++ class.
      • Add support for baud rate selection/detection, mismatches between terminal/computer and the 'spaces' baud selection in HDOS(Done)
  • Phases 2/3 (In progress)
    • Implementing the H-88-1 (Hard-sectored controller). Found the H17 ROM listing, which helps.
      • The Disk rotational speed test (Go 7372) is working(done)
      • Boot (done)
        • HDOS (done).
          • V.1.0 - one of two 1.0 versions is working.
            • 890-1 Version only supported the 8251 serial port, which an H89 does not have. I expect that this version will only work on an H8 with an H-8-5 Serial/Cassette Interface board.
            • 890-1-3 Version supporting 8250 serial port working
          • V. 1.5 working
          • V. 1.6 working
          • V. 2.0 working
          • V. 3.02 working
        • CP/M (done)
          • 2.2.02 working
          • 2.2.03 working
          • 2.2.04 working
      • Writing(done)
        • Writing to images that have already been FORMATed (CP/M) or INITed (HDOS) is working.
          • the changes to the disk  last while the program is running, and are written out to a new file. 
        • FORMAT(cp/m) and INIT(hdos) are now working. 
      • Saving Disk Images(done)
        • Currently saving disk image to a new file - working.
    • The Z-89-37 - soft-sectored controller (working)
    • The Z-89-47 - 8" controller (likely to be delayed to a later phase)
    • The Z-89-67 - Winchester controller (likely to be delayed to a later phase)
    • Working on H19 emulation from phase 3.
      • accurate font (imported from ROM - done)
      • accurate speed - 9600 baud (done)
      • rendered in OpenGL, basic rendering, graphic symbols, reverse video (done
      • Design H19 class to emulate terminal (done)
      • Complete emulation of Serial Port 8250 chip (partially done).
      • Complete H19 processing of all Heathkit ESC sequences (in progress)
      • Handling of ANSI ESC Sequences (delayed to a later phase)
      • H19 emulation will likely change from implementing ESC sequences in C++ to fully emulate the H19, with a Z80 and ROM.
  • Phase 4+ (Not yet started)

Plan

  • Start with an existing Z80 Emulator (z80pack appears to be a good option - it includes interrupts and the ability to run the Z80 at a specific speed).
  • Phase 1 - get it to the "H:" prompt, i.e. have it work with the Monitor ROM.
    • Configure the memory to support some mappable ROM images below 8k.
    • Add a 2 ms timer (hopefully host OSes will allow this resolution).
    • Add support for very basic I/O including the 8250 serial chip that communicates to the built-in terminal.
  • Phase 2 - add support for disk systems.
    • Add support for H17 (H-88-1 controller - top priority).
    • Add support for H37 (Z-89-37 controller)  (likely to be pushed out to a later phase).
    • Add support for H47 (8" Floppy Disks - Z-89-47 controller - likely to be pushed out to a later phase).
    • Add support for H67 (8" Winchester 10M drive - Z-89-67 controller - likely to be pushed out to a later phase).
  • Phase 2.5 - update to a more full featured SDK.
    • GLUT doesn't provide a lot of overall program functionality, looking at other SDK, like Qt or wxwidget, to rewrite some of the overall logic.
  • Phase 3 - work on H19 emulation. 
    • Accurate speed (9600 baud).
    • Accurate graphic characters.
    • Accurate text characters
    • Accurate handling of all the escape sequences (Heath).
    • Complete emulation of 8250 serial port chip.
    • Accurate handling of the ANSI mode (likely to be pushed out to a later phase).
    • Consider if H19 should be 'emulated' with it's Z80 just like the CPU board is doing, instead of re-implementing all the features of the H19 directly in C++.
  • Phase 4 - options to select system configuration - to be implemented with a better SDK than plain GLUT.
    • Selectable disk controller(s)
    • Selectable drives - H-17-1 (SS 48tpi) or H-17-4/5(DS 96tpi) or Generic DS 48 tpi.
    • Selectable amount of RAM - 16k, 32k, 48k, or 64k.
    • Selectable Monitor ROM
      • MTR-88
      • MTR-89
      • MTR-90
      • MTR-90-1
    • Selectable screen color
      • White
      • Amber
      • Green
      • User selectable.
  • Phase 5 -Add-on cards
    • Full support for HA-88-3 Serial card.
      • Connect a port to a physical USB->Serial on host.
      • Connect to other virtual devices (other virtual H89s, Votrax Talk-n-type, printer, modem, etc). 
    • Support for Z-89-11 Parallel card
    • Add real floppy drive sounds for seek and read/write operations.
    • Support H-88-5 Cassette Interface card/Virtual tape drive
      • (real tape sound - be able to read/write audio files).
    • Third-party add-in cards
      • Graphics
        • Cleveland Codonics
        • New Orleans General Data Services (NOGDS).
        • Northwest Digital Systems - Graphics Plus GP-19.
        • SigmaSoft
      • Sound
      • Memory >64k (memory banks)
        • Magnolia Microsystems 128K RAM
        • DG Super 89 (Up to 256k)
        • CDR 1M add-on card
    • Peripherals 
      • Printers - write to PDF file or directly to a printer
        • H14 Printer, accurate symbols
        • H25
      • Modems
        • WH13
        • WH23
        • WH33
        • Be able to connect to the host computer to transfer files.
        • Selectable baud rates.
      • Votrax Talk-n-Type
      • Sweet-P Plotter
  • Phase 6 - graphic front-end
    • Option to make it look like you are sitting in front of a real H89 system.
    • Option for accurate screen - flicker, curved tube, tube persistence.. 
  • Phase x - anything that has been pushed out.
  • Phase y - Emulate an H8 computer
    • H9 Terminal
    • H10 Paper Tape
    • Cassette Tape storage
    • H19 Terminal (should be very little change from the H89 code)
    • H29 Terminal
    • H17 Floppy (should be very little change from the H89 code)

Additional Screen dumps of CP/M booting on the virtual H89. All CP/M versions are now correctly autodetecting the 3 (virtual) disk drives.

H89 Screen dump - CP/M 2.2.02

H89 Screen dump - CP/M 2.2.03

H89 Screen dump - CP/M 2.2.04

H89 Screen dump - CP/M Setup Disk

Last updated: 09/09/2016.

Last Modified: Saturday, 24-Sep-2016 19:38:09 PDT

Contact Details

Mark Garlanger

Email: mark [at] garlanger [dot] com
Website: www.garlanger.com

Social

About

This site is dedicated to preserving the history of the original Heathkit computers. They were initially release in 1977 and included the 8-bit H-8 and 16-bit H-11 systems. The H89 was released in 1979.