Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!batcomputer!cornell!vax5.cit.cornell.edu!asfy From: asfy@vax5.cit.cornell.edu Newsgroups: comp.os.cpm Subject: Re: CP/M Emulators Message-ID: <1991Apr2.145445.3810@vax5.cit.cornell.edu> Date: 2 Apr 91 14:54:45 EDT References: <9103310818.AA10937@ucbvax.Berkeley.EDU> <1991Mar31.142550.9466@dru Distribution: comp Organization: CIT, Cornell University Lines: 36 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