TV_Text format question
Quick question today about the tv_text object.
When the first output to the TV screen is sent without using any locations information, the text appear at the top line of the screen. eg:
However, when I specify a screen location it is one line below this physical spot. eg:
Also the compiler complains when I try to enter a "0" for the line top.
If anyone has the answer, I do appreciate it!
Paul
When the first output to the TV screen is sent without using any locations information, the text appear at the top line of the screen. eg:
tv.str(string("This is at the top of the screen")
However, when I specify a screen location it is one line below this physical spot. eg:
tv.str(string($A,5,$B,1)) 'set screen position indent to the 5th column and 1st row.
tv.str(string("This comes up on the second line"))
Also the compiler complains when I try to enter a "0" for the line top.
If anyone has the answer, I do appreciate it!
Paul
Comments
However a funny convention lent from C requires a text (!) string to be terminated by 0, which has nothing to do with the former convention.
The directive string(...) is aware of the latter convention but not of the former one
So no wonder you get confused. You have to use TV.OUT when zeroes are concerned..
Post Edited (deSilva) : 9/7/2007 8:48:07 PM GMT
This works:
tv.out($0A) ' set position on the Zero line at about center scren tv.out(19) tv.out($0B) tv.out(0) tv.str(string("On the Top Line!"))
Gracias!
Paul
I should like to use this opportunity to discuss another rarely used technique:
Using a "mask" in the DAT section.
DAT myString BYTE 10,19,11 theLine BYTE 1 BYTE "Not on the Top Line", 0
The usage is:
theLine:= 1 tv.str(@myString)
Note there still is no cheating with the terminating zero: tv.str will merciless stop at any 0!
But you can make your own tv_str:
PRI tv_str(sAddr) ' stringterminator 255 rather than 0 REPEAT WHILE BYTE[noparse][[/noparse]sAddr]<>255 tv.out(BYTE[noparse][[/noparse]sAddr++])
Post Edited (deSilva) : 9/7/2007 9:58:58 PM GMT
$0A: col := c // cols $0B: row := c // rows
So without changing any code at all you could write:
tv.str(STRING(10, tv#cols, 11, tv#rows, "Upper Left Corner"))
Post Edited (deSilva) : 9/7/2007 10:47:24 PM GMT