[sebhc] Dave Dunfield's H8 emulator

Dave Dunfield dave04a at dunfield.com
Thu May 13 04:18:12 CDT 2004

At 20:05 12/05/2004 -0500, you wrote:
>is in the 'emulators' directory. First attempts in a DOS window on my
>W2K machine dump me back to the command prompt when I hit the 'go' key.
>I loaded hangman and h8demo with the same results - setting PC to
>040.000 worked fine, then boom. I'll go try it on my real DOS machine
>next. I'll read the instructions too.

I have found the cause of this:

When 040.000 is the monitors RAM area. It just happens that at 040.003
there is $C9(311) which is a RET instruction.

PAM-8 is setting the virtual 8080 stack pointer to $FFFF (top of RAM)
when it launches the code, which causes the emulation engine to try
and retrieve a 16 bit value from FFFF,0000 wrapping a segment register,
and causing a processor exception.

This will not happen in normal operation (unless you normally wrap the
stack into the ROM space). I can fix it, however since I use SI for the
virtual 8080 PC, I cannot easily do this in two 8-bit operations, so it
would slow down the emulator - the same is true of pushing/poping the
other register pairs over the FFFF:0000 boundary.

I see three options:

 1 - do nothing - the emulator will crash under these conditions, however
     it will operate at it's highest speed

 2 - split all 16 bit accesses into 2 8-bit accesses, this will slow it down,
     but it will crash the virtual 8080 only - just like the real H8.

 3 - Perform a test and halt the simulation (eventually into the debugger) if
     a stack wrap occurs.


dave04a (at)    Dave Dunfield
dunfield (dot)  Firmware development services & tools: www.dunfield.com
com             Vintage computing equipment collector.

Delivered by the SEBHC Mailing List

More information about the Sebhc mailing list