I want to make a routine that reads data from a "string" or "array" in the data segment and prints text on the screen (very advanced stuff, I know).
I think I can do
.segment "DATA"
.word $11, $0E, $15, $15, $18
where the numbers are the tile indexes for "hello", set $2006 to $21CD or something and then load these values into a register and store them in $2007 one after the other. But
1. How do I access the string? I don't know the address. Do I just put a label up like @hellostring: .word $11, $0E etc, or what?
2. Is there an elegant way of making the routine return after it has printed the string without knowing its length beforehand? I was thinking of ending the string with a zero or $FF or something (kind of like in C) and then return upon detecting 0 (or whichever value represents the end of a string). Is there a better way?
3. I've seen code examples where people write .word "Hello", but no explanation as to how these letters are translated into tile indexes. The compiler doesn't know where in my tileset my characters are located by itself. Is there a way I could tell it? Or do people use their own scripts to replace strings with sequences of hex numbers before compiling?
I think I can do
.segment "DATA"
.word $11, $0E, $15, $15, $18
where the numbers are the tile indexes for "hello", set $2006 to $21CD or something and then load these values into a register and store them in $2007 one after the other. But
1. How do I access the string? I don't know the address. Do I just put a label up like @hellostring: .word $11, $0E etc, or what?
2. Is there an elegant way of making the routine return after it has printed the string without knowing its length beforehand? I was thinking of ending the string with a zero or $FF or something (kind of like in C) and then return upon detecting 0 (or whichever value represents the end of a string). Is there a better way?
3. I've seen code examples where people write .word "Hello", but no explanation as to how these letters are translated into tile indexes. The compiler doesn't know where in my tileset my characters are located by itself. Is there a way I could tell it? Or do people use their own scripts to replace strings with sequences of hex numbers before compiling?