I suppose TI has a routine they use, but i don't know if we have access to it.
Basically, here's how i store my text:
text1:
.db "This is a sample of how i store my text. One long string.",$FF
Then when there is no more space to draw a new word, i call newLine to jump down to the next line. The routine also handles the box that is drawn around it and i am currently writing in a menu routine so that you can do something like this:
.db "You are at the store. Do you want to",$FD,"go in",$FD,"go out",$FD,"don't care",$FF
which would create a small menu sort of thing with three options to choose. It should be finished before soon and i'll upload a picture (i like screenshots!).
Before the text routine was a little cleaner, but i needed to break it up a bit, at least for now, because i may not always want to draw a box around the text (like the dice rolls). I'll show you some sample code snips:
Here's what happens when you land on or pass go, the most simple textbox, one string:
- Code: Select all
passedGo:
push af
call drawTextTop
ld hl,textGO
call drawText
call drawTextBottom
pop af
ret
Here's the chance part:
- Code: Select all
landChance:
call drawTextTop
ld hl,textChance
call drawText
call newLine
ld hl,chanceDeck
call drawCard ;ici draw != dessiner mais "prendre"
call drawText
call drawTextBottom
ret
and lastly, landing on a property:
- Code: Select all
landProperty:
call drawTextTop
push hl
ld hl,textLandedOn
call drawText
pop hl
push hl
ld a,(hl)
inc hl
ld h,(hl)
ld l,a
call drawText
call newLine
ld hl,textPropertyPrice
call drawText
pop hl
inc hl
inc hl
ld l,(hl) ;the mortgage value
ld h,0
add hl,hl ;the price is 2*mortgage
call dispNumber
call newLine
ld hl,textBuy
call drawText
call drawTextBottom
ret
So first, you draw the top border of the box, then what ever texts you want drawn inside the box (the drawText routine draws the side border), then lastly we draw the bottom border, which uses the final coordinates to know which row to draw to (short texts have shorter boxes, long texts have longer boxes).