nesasm c-style defines?

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
djcouchycouch
Posts: 97
Joined: Sat May 28, 2011 10:30 am

nesasm c-style defines?

Post by djcouchycouch »

Totally simple thing I'm sure I've missed, but is there a way to do c-style #defines for declaring constant values with nesasm?

Thanks!
djcc
Last edited by djcouchycouch on Thu Sep 19, 2013 11:33 am, edited 1 time in total.
User avatar
Dwedit
Posts: 4470
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Post by Dwedit »

Have you tried .equ or = ?
It varies from assembler to assembler, but in many, you can use .equ or = to declare a label, such as

MyVariable .equ $0123

or

MyVariable = $0123
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
djcouchycouch
Posts: 97
Joined: Sat May 28, 2011 10:30 am

Post by djcouchycouch »

I'll try that, thanks!
3gengames
Formerly 65024U
Posts: 2281
Joined: Sat Mar 27, 2010 12:57 pm

Post by 3gengames »

RandomValue:
.dw $0000
RandomVales:
.dw $0000,$0000
RandomBytes:
.db $00,$00

I am pretty sure that's how to do it.
Last edited by 3gengames on Fri Jun 03, 2011 3:38 pm, edited 1 time in total.
mic_
Posts: 922
Joined: Thu Oct 05, 2006 6:29 am

Post by mic_ »

NAME = value works fine with nesasm, and so does NAME EQU value (note: no dot in front of EQU).
djcouchycouch
Posts: 97
Joined: Sat May 28, 2011 10:30 am

Post by djcouchycouch »

Yep, it works! Thanks!
Post Reply