jbs30000, on Sat Dec 3, 2011 3:43 AM, said:
Well, I've read through all of the tutorials, and I'm very slowly trying my own code now, but you make an excellent point. Even if I could initialize it, it would get wiped out with the reset code.
It depends where you initialise it

. If its before the RAM clearing macro it'll be set to $00 by the time you read it. If its after the RAM clearing macro it will remain at that value (providing nothing else touches it) until you power off the console.
Quote
But I am still curious. The wording for DS says it fills the memory location with a default of 0. That makes it sound like you can intialize a DS variable to something else. So if you can, then how?
Just checked the DASM manual (I don't use that assembler) and the DS assembler directive takes the following form :-
[label] ds[.bwl] exp[,filler]
To have a value of 8 in ROM you would use :-
ds.b 1, 8
More commonly you'd use dc (declare constant) :-
dc.b 8