Forum unknown
· Programming
#Opening Screens Quietly
3 messages in this thread
That's not just for copy protection, that's a widely known and practiced
method for calling a routine withoiut having to set up the accumulator
first. Though the 6502 designers probably never thought of doing so, they
provided the programmers with a nice handy "trick".
Many machines have their idiosyncracies, and the programmer who
understands them can often capitalize on them for speed or size savings. A
perfect example even exists in the 360/370 assembler. In the early days of
the model 30, most of them had either 32 or 64K, 64K being the maximum size
of core storage. To save space, a programmer would often use a neat little
trick to swap two areas of memory without using a third temporary area. The
idea was to use three exclusive OR instructions…
EOR A,B
EOR B,A
EOR A,B
At the end of this, the two memory areas would be swapped. Slower, but less
memory hungry.
Regards, Larry.
That isn't the type of thing I'm describing. What I'm refering to
is two completely seperate and independent routines with no common code
that are "woven" together so that the bytes making up the opcodes for one
routine are the data bytes for the second. The bytes making up the second
routines opcodes are the first routines data bytes. Something like this:
r1 lda #$a9 ; entry for first routine
nop r2 equ r1 + 1 ; entry for second routine
If this is routine is run at r1 on exit a is $a9. If run at r2 (the $a9
data byte for the lda) a is a $ea on exit. The routine I was talking about
used this technique to hook one of the game routines to one of the cp
routines. The total size was something like 1K. What a mess.
That isn't the type of thing I'm describing. What I'm refering to
is two completely seperate and independent routines with no common code
that are "woven" together so that the bytes making up the opcodes for one
routine are the data bytes for the second. The bytes making up the second
routines opcodes are the first routines data bytes. Something like this:
r1 lda #$a9 ; entry for first routine
nop r2 equ r1 + 1 ; entry for second routine
If this is routine is run at r1 on exit a is $a9. If run at r2 (the $a9
data byte for the lda) a is a $ea on exit. The routine I was talking about
used this technique to hook one of the game routines to one of the cp
routines. The total size was something like 1K. What a mess.