[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mockingboard emulator (was: Late night musings...)



In article <50fglc$m3s@news.bconnex.net> jefbla@bconnex.net (Jeff Blakeney)
writes:
>[...]
>>The other way is to do it like the very first Apple II ROM does for the
>>monitor Step and Trace commands.  It decodes each instruction only far
>>enough to figure out how many bytes long the instruction is, and to
>>recognize a few instructions that it has to handle as special cases.
>>Then it copies the instruction to a three-byte buffer on page zero (if the
>>instruction isn't thee bytes long, the buffer is padded with NOPs), and
>>jumps to it.  At the end of the buffer is a jump back to the step/trace
>>code.  (I recommend reading the monitor ROM listings in the original Apple
>>II hardware reference manual.)
>
>This is approximately what I described in another message.  The
>difference being that I would decode instructions until I reached a
>branch, jump or an instruction that dealt with a special area then
>execute that entire section of code then deal with the branch, jump or
>special instruction.

Ahh, but then an important question arises:  How do you define "section of
code" in the above?  If you're planning to let a lengthy chunk of emulated
code run "native," you run into the problem of determining what's safe to
run "native" and what isn't.  The only way to decide that is to
"pre-interpret" the code, which is actually worse than the methods we've
already discussed, because you're executing everything *twice* (and Heaven
help you if the machine conditions aren't identical the second time
around).

If, on the other hand, "section of code" refers to the emulator's special-
hardware-simulating subroutine, there's nothing to worry about except my
nagging suspicion that *any* kind of emulation will be painfully slow, even
on an accellerated IIGS.

               - Neil Parker
-- 
Neil Parker, nparker@{cie-2,cie}.uoregon.edu, http://cie-2.uoregon.edu/~nparker

     "I was going to be a neo-deconstructivist but Mom wouldn't let me."
                                     -- Calvin and Hobbes, 7/13/1995