Wla byte defining

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

Post Reply
Celius
Posts: 2159
Joined: Sun Jun 05, 2005 2:04 pm
Location: Minneapolis, Minnesota, United States
Contact:

Wla byte defining

Post by Celius »

For my game, I really need to do something like this:

.db #<Lable, #>Lable

#>Lable: High address of Lable
#<Lable: Low address of Lable

But WLA doesn't seem to support that. Is there a way to define bytes as the High/Low addresses of a lable?
User avatar
dXtr
Posts: 375
Joined: Tue Sep 21, 2004 12:11 am
Location: Karlshamn (Sweden)

Post by dXtr »

according to the docs it do support < and >
The following operators are valid:

(, ), | (or), & (and), ^ (power), << (shift left), >> (shift right), +, -,
# (modulo), ~ (xor), *, /, < (get the low byte) and > (get the high byte).
Sorry for misspellings, I'm from Sweden ^^
User avatar
dXtr
Posts: 375
Joined: Tue Sep 21, 2004 12:11 am
Location: Karlshamn (Sweden)

Post by dXtr »

edit:
I checked some old SNES code I got, it looks like your not supposed to add the "#".
Sorry for misspellings, I'm from Sweden ^^
User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Wla byte defining

Post by tokumaru »

Celius wrote:.db #<Lable, #>Lable
The "#" should only be used for immediate addressing, not for defining bytes. AFAIK it is like this in every 6502 assembler, not only WLA...
User avatar
Disch
Posts: 1848
Joined: Wed Nov 10, 2004 6:47 pm

Post by Disch »

Also, if there's a .db that does bytes, there's probably a .dw that does words

.dw label

is simpler than

.db <label, >label
User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru »

Disch wrote:.dw label

is simpler than

.db <label, >label
In this case, it would seem so. But sometimes it really is better to break lists of 16-bit values into 2 lists of 8-bit values (list of high bytes, list o low bytes), because of indexing. I'm sure everyone knows that, but I'm just pointing it out.
Celius
Posts: 2159
Joined: Sun Jun 05, 2005 2:04 pm
Location: Minneapolis, Minnesota, United States
Contact:

Post by Celius »

Okay, yeah, I have it working now. I didn't need the '#'. I never really thought about that, I guess. Thank you for telling me. :)
Post Reply