Right now in my code, I have a simple method of writing strings which are stored under various labels. Here's an example of one I used:
That particular one writes the word "Second" on the screen. X is set to 6 as it's characters long. Note that I have +9, which tells it to start at index 9 of that memory location. If not, it would write the string "First ".
My question is, can I use this method but with a variable index? I've tried using Y, but that won't even compile. When I use a variable (something like: (FirstOrSecond + Blah), I get very random output.
Any tips? And no, Blah wouldn't be the real variable name I'd use.
Code:
LDA #low (FirstOrSecond + 9)
STA <StringHolder
LDA #high (FirstOrSecond + 9)
STA <StringHolder + 1
LDX #6
JSR WriteString
STA <StringHolder
LDA #high (FirstOrSecond + 9)
STA <StringHolder + 1
LDX #6
JSR WriteString
That particular one writes the word "Second" on the screen. X is set to 6 as it's characters long. Note that I have +9, which tells it to start at index 9 of that memory location. If not, it would write the string "First ".
My question is, can I use this method but with a variable index? I've tried using Y, but that won't even compile. When I use a variable (something like: (FirstOrSecond + Blah), I get very random output.
Any tips? And no, Blah wouldn't be the real variable name I'd use.