Search code examples
terminalconsoleserial-portvt100

Strange column number " :0 " in VT100 terminal protocol


I am interpreting some output from a serial port. The output is in VT100 protocol. VT100 terminal protocol use some control character sequence to set the cursor location on screen. The control sequence looks like this:

ESC[row;columnH

For example,

ESC[01;01H means set cursor to row 1, column 1.

But I see the following sequence when column number exceed 2-digit number.

ESC[10;:0H

Note the extra ":" after the semicolon. This control sequence comes after ESC[10;99H, which means row 10, column 99.

My understanding is :0 = 100. But what if the column number is 200?


Solution

  • I don't think that's actually valid or, if it is, it's entirely by accident. The arguments passed to the CUP (cursor position) command (and many others involved in screen coordinates) is limited to one or two digits.

    In the ASCII table, the digit 9 is followed by : so, where 99 would represent 9 * 10 + 9, :0 may represent 10 * 10 + 0 or 100:

    enter image description here

    Assuming the bug holds up for higher numbers (something I'm not confident of), you're looking for 200, which would be 20 * 10 + 0 or probably D0 (D being the character ten higher than : in the ASCII table).