[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Mockingboard emulator (was: Late night musings...)
- Subject: Re: Mockingboard emulator (was: Late night musings...)
- From: jefbla@bconnex.net (Jeff Blakeney)
- Date: 1996/09/04
- Newsgroups: comp.sys.apple2
- Organization: Barrie Connex newsserver
- References: <50b1lc$bh6@news.bconnex.net> <50dd18$coe@pith.uoregon.edu> <50fglc$m3s@news.bconnex.net> <50fv64$tp@pith.uoregon.edu>
nparker@cie-2.uoregon.edu (Neil Parker) wrote:
>In article <50fglc$m3s@news.bconnex.net> jefbla@bconnex.net (Jeff Blakeney)
>writes:
>>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).
I was thinking along the lines of "dissassembling" the code opcode by
opcode and checking to see if that instruction will cause an access to
a special area, such as the slots or softswitches, or is a branch or
jump instruction. If the instruction is NOT one of the above, it
would be placed into an "execution" buffer and the next instruction
would be checked. If the instruction IS one of the above, then it is
left out of the execution buffer, a return from subroutine is placed
at the end of the execution buffer and the buffer gets executed.
Geoff Weiss also brought up another snag. If the instruction uses
indirect addressing then I would either have to treat that as a
special case instruction like those described in the previous
paragraph, or double check the code in the execution buffer to be
certain that it does not modify the address that is accessed by the
indirect instruction.
Execution speed wise, and definitely from the point of view of
programming the emulator, it would probably be best to treat indirect
instructions as special cases.
I'm now thinking that I will have to develop three different emulators
concurrently until I can declare one an absolute winner in the
execution speed department. That way I don't need to keep guessing.