[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Apple IIe + ProDOS = Headache
In article <cbgupr$2d7f$1@merope.saaf.se>,
pausch@saaf.se (Paul Schlyter) wrote:
> The important difference here is the way the 65C02 and the 6502
> behaved when encountering illegal instructions: the 65C02 treated all
> illegal instructions as a NOP (no operation), while the 6502 had some
> undocumented behaviour when encountering such an operation; the
> undocumented behaviour was of course different for different illegal
> instructions. That's why the illegal instruction could damage a disk
> if executed on a 6502 rather than a 65C02.
The fun part was that, if you were careful, you could use some of those
"illegal" 6502 instructions to "take shortcuts" on certain chips. Some
of the 6502s that were out there would actually execute these "illegals"
consistently, and depending on the instruction and its exact behavior,
they could be useful for anything from padding out timing loops
(critical for disk-writes - LOTS of code that writes to the disk relied
on precisely calculated (As in "23 CPU cycles is good, 22 or 24 cycles
will result in a hosed disk" precise) loops to do its job correctly) to
array-walking. The trouble hit when you took that code to a computer
with a 6502 made by a different manufacturer, where the same "illegal"
instruction did something COMPLETELY different, took a different amount
of time/number of cycles to execute, set different condition flags,
altered different registers, accessed a different location in memory, or
otherwise behaved differently from the same instruction on the chip you
developed the code on. *ALL KINDS* of weirdness could result from such
code, and most of it wasn't any fun to cope with.
--
Don Bruder - dakidd@sonic.net - New Email policy in effect as of Feb. 21, 2004.
I respond to Email as quick as humanly possible. If you Email me and get no
response, see <http://www.sonic.net/~dakidd/main/contact.html> Short
form: I'm trashing EVERYTHING that doesn't contain a password in the subject.