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
Celius
Posts: 2159 Joined: Sun Jun 05, 2005 2:04 pm
Location: Minneapolis, Minnesota, United States
Contact:
Post
by Celius » Mon Jun 25, 2007 1:26 pm
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?
dXtr
Posts: 375 Joined: Tue Sep 21, 2004 12:11 am
Location: Karlshamn (Sweden)
Post
by dXtr » Mon Jun 25, 2007 3:16 pm
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 ^^
dXtr
Posts: 375 Joined: Tue Sep 21, 2004 12:11 am
Location: Karlshamn (Sweden)
Post
by dXtr » Mon Jun 25, 2007 3:22 pm
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 ^^
tokumaru
Posts: 12106 Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil
Post
by tokumaru » Mon Jun 25, 2007 3:45 pm
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...
Disch
Posts: 1848 Joined: Wed Nov 10, 2004 6:47 pm
Post
by Disch » Mon Jun 25, 2007 3:51 pm
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
tokumaru
Posts: 12106 Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil
Post
by tokumaru » Mon Jun 25, 2007 5:46 pm
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 » Mon Jun 25, 2007 7:28 pm
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.