[A83] Re: $


[Prev][Next][Index][Thread]

[A83] Re: $




Since the $ represents the current mem address the program is on, you can 
jump to skip one command.  Say you have a menu with 3 options, so a can be 
0,1,2.  This will reset to 0 if ou go above two:

ld a,(option)
inc a
cp 3
jr nz,$+3
xor a
ld (option),a

Why $+3 you ask?  Well jr is two bytes and xor a is one!  so it skips three 
bytes and goes to the ld (option),a

-joel




Follow-Ups: