On 7 Feb 2012 at 22:47, Eric Smith wrote:
Chuck Guzis wrote:
So, if SWEET16 is emulating something, what is it
emulating?
It's emulating a virtual machine.
Certainly one can't plausibly claim that a chunk of Sweet16 code is
native 6502 code.
I suppose it depends upon how you look at it. There are plenty of
machines out there with incomplete (i.e. not all instructions present
in hardware), where execution of the unimplemented instruction causes
a trap to a subroutine that performs the deisred operation. I would
not, as a whole, call programs running on those machines, "emulated",
even if they use some emulation facilities. Put on the appropriate
fully-implemented hardware, nothing is emulated.
Whle you could claim that 6502 SWEET16 is an emulator of sorts,
really, the difference between a subroutine call with a variable
number of arguments and SWEET16 code is vanishingly small. Both are
activated by a JSR and control eventually returns to the calling
program.
So, back to the original premise, operations that take several bytes
on an 8080 could be reduced considerably by resorting to a SWEET16
sort of implementation--i.e. an RST byte followed by an opcode byte,
followe by operands, if any. So long as control returns to the
calling code, that code, as a whole is not being emulated.
Contrast this with P-code implementations, or CPU emulatons, where
the program never gets control of the real P-counter--it's always
being managed by the P-code interpreter or the emulation package.
--Chuck