[A83] Re: Defining custom vars


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

[A83] Re: Defining custom vars




Yes, they're called Labels.

you define them like this:  (NOT TABBED)

Xpos = saferam2
Ypos = Xpos + 1

Then put them in parenthesis if you want the value at that location:

  ld a,(Xpos)  ;<-- Parentheis!  this means the value at Xpos

and if you want the offset of that label:

  ld hl,Xpos  ;<-- No parenthesis, hl = the address of xpos

when you have the offset of a label, you can move the offset around and get 
the bytes next to it.

  ld hl,Xpos
  inc hl      ;hl got moved up 1, so it now points one byte ahead.
  ld a,(hl)   ;a now contains the byte ahead of Xpos

_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com




Follow-Ups: