[A83] Re: SMC
[Prev][Next][Index][Thread]
[A83] Re: SMC
In this case, SMC means self modifying code. It's where you overwrite code
with new bytes to change what the code does. The simplest usage is to
change a line between a nop and a ret.
Some_Routine:
ld a,4
ChangeThis:
ret
ld b,5
ret
Changer:
ld a,0
ld (changethis),a
ret
when you call changer, it changes the ret to a nop, so it will run the rest
of the code. Changes are _permanent_, so don't forget to change stuff back.
another example:
SetSomething:
ld a,4
ret
Changer:
ld a,255
ld (setsomething+1),a
ret
this one changes SetSomething to store 255 into a instead of 4.
_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail