Just to clarify a few more things. Displaying text in assembly isn't such a menial task. We're lucky that we can use TI's routines, but it's worth knowing what exactly those routines do (or what you would do if you didn't want to use TI's routines).

Basically, every character, ever letter that gets drawn, is actually a sprite. You load the address where the text is stored into hl, then pass hl to the routine. The routine then reads each byte one by one (until it reads a 0) starting from the address in HL. Once it has the value ($01-$FF) of the character to display, it calculates the offset to the correct sprite, then draws that sprite. So, in your example it would read the character "Y" from the address stored at HL. We'll say each sprite takes up 7 bytes and the character "Y" is the $59th (that's in hex) sprite. You'll jump to the $59th sprite by jumping to the $59*7th byte, then print that sprite. Once that sprite is printed, you increment hl and do the exact same thing for the rest of the characters. So really, they are getting drawn one by one, it just happens so quickly you can't really notice it.

In short, hl starts at the address pointed to by txtSomeText, reads the hex value stored at that address (the characters are essentially hex values, you can write .db "Y" or .db $59), draws the sprite corresponding to the character, increments to the next byte, and repeats until it reaches 0.

Now for your other question, if you want to use _NewLine for the small text, you just need to update penCol/penRow manually. Note that they are actually right next to each other in memory and that each one is one byte, so you can update both of them with one 2-byte register:

Code:
ld hl,$0005    ;l = $05, h = $00 (little endian, smaller part of number stored in the first byte, larger part stored in the second byte)
ld (penCol),hl   ;l -> (penCol), h -> (penRow) (again, little endian)

To move down a row, just set penCol to 0 and add 6 to penRow. I'll leave that bit to you Smile
Thanks for those excellent points of clarification, chickendude; a very informative post. You're right that for new programmers to become expert programmers, they need to understand the nitty-gritty of what's going on underneath. Especially since when Quargzon inevitably finds something he wants to do that the OS can't help him with, these are the sort of details he'll need to apply to writing his own code.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 2 of 2
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement