<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Fri, 02 Sep 1994 14:05:47 WET DST
From   : Bonfield James <jkb@...>
Subject: Re: UNDEFINED 6502 OPCODES

Chris Lam writes:

>for the purposes of 6502 emulation, is it really necessary to 
>investigate these so-called undefined opcodes? i find it
>difficult to believe that commercial software would dare use these.
>of course, i'm quite ready to be proven wrong.

I can remember seeing some software protection that executed invalid opcodes.
As far as I was aware they actually did nothing. It just appeared to be
someones exercise in insanity. The code was infact two sets of code, but
interleaved. For instance, and LDA #&8D:EOR &02,X is:

0      A9
1      8D
2      55
3      02

Now if we enter at offset 1 instead of 0, we get STA &255 - which corresponds
to the keyboard auto repeat delay.

Now such nasty code overlaying is in practise extremely contrived and hard to
do. Making use of invalid opcodes serves two purposes. 1) It makes this task
easier. 2) It serves to confuse the purpose of the program - especially as 99%
of disassemblers do not take note of the length of these 'nop' instructions.

However, there's only one program (I can't remember which) that I saw doing
this. And as far as I could see, it was assuming the undefined opcodes were
NOPs. In later machines (eg Master) this code wouldn't work anyway if it
happened to be using the wrong opcodes (ie ones the 65C02 had implemented) or
it'd assumed they did undocument things (in the 65C02, all unused opcodes are
defined to be NOPs - but I don't know if it defines their lengths).

       James
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>