Shop OBEX P1 Docs P2 Docs Learn Events
? on using TV_TEXT object — Parallax Forums

? on using TV_TEXT object

I don't understand how to set the column/line using the out method of TV_TEXT
PUB out(c) | i, k

'' Output a character
''
''     $00 = clear screen                     
''     $01 = home
''     $08 = backspace
''     $09 = tab (8 spaces per)
''     $0A = set X position (X follows)   
''     $0B = set Y position (Y follows)      HOW TO DO THIS???
''     $0C = set color (color follows)
''     $0D = return
''  others = printable characters

I.E.
$0A = set X position (X follows)

I've tried comma separating, parenthesis , you name it and can't figure it out.
What would be the instruction line in the top object for setting the column to 5 ? example please

Thanks
Aaron

Comments

  • Hello Aaron.

    It is the same as the vga_text i used a lot of time:

    text.str(string($A,5,$B,11,$C,8,"Your tekst"))

    Greeting Abraham Vreugdenhil
  • Remember that you can't embed a zero byte in a string (because a zero marks the end of the string). If you want to set the X or Y position to zero, use "text.out($0A)" or "text.out($0B)" followed by "text.out(0)"
  • What I was trying to do is add a method (easy to remember and type for a non typist) to the TV_TEXT object.

    I did a similar thing in the LCD Spin Driver like this
    PUB Move(Line, Column)
    {{
       Moves the cursor position to row,column
       Parameters: column = first(1), last(40)
                   line   = top(1) or bottom(2)
       example usage: LCD.Move(2,1) moves cursor to line 2 column 1
    }}
    
      Send(((Column - 1) + ((Line - 1) * 64) & %0111_0000) | %1000_0000)
    
    I can't seem to figure out how to do it in TV_TEXT though
  • There's a similar method in PST.
    PUB Position(x, y)
    {{Position cursor at column x, row y (from top-left).}}
      
      Char(PC)
      Char(x)
      Char(y)
    
  • You'd use

    out($0A)
    out(x)
    out($0B)
    out(y)

    These are all functionally equivalent: out, tx, char. They send a single byte to the device involved. It would have been nice to use the same name for the same functionality, but they're what we have. I've often modified various display drivers to include an out method in addition to whatever was provided ... for my own convenience.
  • Thanks Mike
    That's what I wanted. "They send a single byte to the device involved" I was trying to send more than one byte at a time.
    Aaron
Sign In or Register to comment.