[BBC-Micro] 65C02 instructions
rick at rs432.net
Sun Jun 21 18:49:11 BST 2009
Jonathan Graham Harston wrote:
> No, your emulator should execute them as NOPs or as the combined
> effects that they perform on actual hardware.
The problem, which isn't a great one, is that everybody says the 65C02
undefined instructions are NOPs. They aren't. They are instructions that
have no effect. Subtle difference, but one which allows for the
instruction to be between 1 and 3 bytes in length...
> A physical 6502 CPU never causes an message to be displayed when
> executed undefined opcodes,
I think that's more because there was no mechanism for the 6502 to be
"bing!" and have an error message floating in the middle of the room. :-)
Even with the later models, there is still no trap or vector for
undefined instructions - the program would either work anyway in the
unlikely event that the effects would be irrelevant, or would risk
corrupting data or even stiffing the machine. Furthermore using such
codes on purpose meant that different models behaved in different ways -
the NMOS effects vs CMOS effects being the most noticable; but then
different (NMOS) 6502s from different manufacturers may implement
undefined ops in various incompatible ways...
> an emulated 6502 shouldn't either.
For what it is worth, I got an Aleph1 386 podule for PC-related stuff
because the software emulator used to pop up all sorts of messages when
using TurboPascal. I later got a clue and switched to TurboC. :-)
The FileStore 'emulator' is part emulator and part simulator. For
example, there will be functionality to alter flags and registers in the
hardware, tweak memory... a lot of which is not really possible using
real hardware (imagine what it would take to arbitrarily alter the VIA's
DDRB while in-situ in a Beeb). For this reason, and ESPECIALLY given
that the Rockwell instructions may not be implemented on Acorn hardware,
I think popping up a message is a good thing - better find out about it
when running a hacked version of the firmware on the emulation than run
into problems when executing on the real hardware!
Rick Murray, irregular internet access at local library.
BBC B: ANFS, 2 x 5.25" floppies, EPROM prog, Acorn TTX
E01S FileStore, A3000/A5000/RiscPC/various PCs/blahblah...
More information about the bbc-micro