<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Tue, 02 Apr 1991 18:54:45 GMT
From   : vax5.cit.cornell.edu!asfy@cu-arpa.cs.cornell.edu
Subject: Re: CP/M Emulators

In article <9163@mentor.cc.purdue.edu>,
wilker@gauss.math.purdue.edu (Clarence Wilkerson) writes:
> The main hassles in writing a 8080 emulator ( or worse, Z80 emulator)
> are getting the condition codes (flags) exactly right. Another
> slowdown is if the host machine for the emulator has a different
> byte order than the 8080 for words. To my knowledge, this stacks
> up as
> 8080, 80X86, VAX, 32032?? ....LITTLE_ENDIAN
> 680X0, RS6000, SPARC    BIG_ENDIAN.
> But the flags are a major slowdown, and more if you include
> parity, half parity, and so on.
> In C ,one has to do extra arithmetic to compute the flags, such
> as carrying more digits to detect overflows. In assembler,
> you can try to match your host CPU flags to the 8080/Z80 flags,
> but there are lots of gotchas there. Later versions of Joan Riff's
[...]
> Clarence

There's a sneaky way around this that should do wonders:  If
you're on a big enough machine with enough memory, you
precalculate all possible 8-bit adds and subtracts, with and
without carries, and a couple of basic logical operations.  You
end up with a small pile of 128k tables-- which is just fine in
this day of 4 MB SIMM modules.  The entire addition or
subtraction, complete with flags register, is reduced to a table
lookup.

All this to emulate a 64k machine running an 8k operating
system...

Are you the person responsible for the Japanese CP/M emulator
running on the Sun at math.purdue.edu?  Do you know where I can
get the source to that thing?  I'm occasionally working on my own
emulator :) and I like to see what other people have done.

  --jh

<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>