TellyMate - User Guide - Control Sequences

Control Sequences

The following tables document the sequences understood by the device.

Control Codes

ASCII characters from 0 to 31 are considered to be 'Control Codes', but only those in the table below have any meaning for this adapter. If they're not in the table, they have no effect.

Control codes are executed immediately, no matter where they appear in the character stream. The only exception is when the control code is prefixed by a <DLE> code - in this case, the control character's glyph is output to the screen.

In the descriptions below, it is assumed that the row and column numbering is zero-based, e.g. there are 38 columns, from 0 to 37.

Mnemonic Code (Hex) Name Comments
<NUL> 00 Null Never affects the device. <NUL> codes are always ignored wherever they appear in the character stream.
<BEL> 07 Bell Not currently implemented
<BS> 08 Backspace Moves the cursor one position to the left. No characters are overwritten. If the cursor is already at column 0, there is no effect.
<TAB> 09 Tab Moves the cursor to the next tab position. Tab positions are every 4 columns (0, 3, 7 etc.). If the cursor is already at a tab position, it is moved to the next. If the cursor is beyond the last tab position (column 35), there is no effect.
<LF> 0A Linefeed cursor down one row, scrolling the screen if it's already on the last row. The cursor's column is unchanged unless the Auto CR option is set.
<FF> 0C Formfeed This clears the screen and places the cursor in column 0 of the bottom row.
<CR> 0D Carriage Return This moves the cursor to column 0 of the current row. No Linefeed occurs unless the Auto LF option is set.
<DLE> 10 Data Link Escape This code supresses any interpretation of the next character. The next character's glyph is output to the screen, regardless of its normal meaning. Note: The <NUL> is an exception, which is always ignored. This code is used to output otherwise non-printable glyphs to the screen.
<CAN> 18 Cancel This code immediately cancels any current escape sequence. Any already-processed effect of that escape sequence will remain (see <ESC>Y for an example).
<ESC> 1B Escape This code initiates an escape sequence. See the 'Escape Sequences' table, below for further details.

Escape Sequences

These are mainly VT52 and Heathkit-19 (a.k.a. Zenith-19) sequences.

This device has output abilities vaguely similar to these terminals, hence they seem logical sequences to use. VT100 was deliberately avoided for a couple of reasons a) This display lacks character-specific attributes (colour, inversed video etc.) and b) VT100 sequences require longer parameter sequences, meaning more memory is required. Memory on the device is in short supply.

Sequence Parameter(s) Standard Name Comments
<ESC>A VT52 Cursor Up Moves the cursor up. If the cursor is already on the top line, there is no effect.
<ESC>B VT52 Cursor Down Moves the cursor down. If the cursor is already on the bottom line, there is no effect.
<ESC>C VT52 Cursor Right Moves the cursor right. If the cursor is already at the right-hand-side, there is no effect.
<ESC>D VT52 Cursor Left Moves the cursor left. If the cursor is already at the left-hand-side, there is no effect.
<ESC>E H19 Clear Screen and Home Home is row 0, column 0.
<ESC>H VT52 Cursor Home Home is row 0, column 0. Nothing is cleared.
<ESC>I VT52 Reverse Line Feed Also known as 'Reverse Index'
<ESC>J VT52 Clear to end-of-screen Clears from the cursor (inclusive) to the end of the screen. The cursor is not moved.
<ESC>K VT52 Clear to end-of-line Clears from the cursor (inclusive) to the end of the line. The cursor is not moved.
<ESC>Q TellyMate Diagnostic Information

Clears the screen and outputs diagnostic details about the terminal. This sequence takes a few tens of scanlines to complete. This may cause a brief glitch in the video output.

A delay of 2ms should be observed before further characters are sent.

Note: The 'Serial: jumpers' line shows the current state of the jumpers. There may be discrepancies between the baud rate selected by jumpers and the actual baud rate being used. This is because the 16Mhz clock cannot be accurately divided to the requested speed.

<ESC>R fs TellyMate Program Fontbank Section

Reprograms a section of the specified fontbank.

  • f is the ascii character of 32 + the fontbank (0-10) to program
  • s is the ascii character of 32 + the section (0-5) of the fontbank to program

To program a whole fontbank, 6 individual calls to 'program fontbank' are required - one per section. The data to write into the fontbank is taken from the display screen. The screen should be filled with 24 rows of 32 lower-case hex characters. These represent 24*16 = 384 bytes of the fontbank data.

  • row 0 contains bytes 0-15.
  • row 1 contains bytes 16-31
  • ...
  • row 23 contains bytes 368-383

Note that the screen should not have been scrolled. Executing an <ESC>E prior to filling the screen with data is recommended.

For details of the arrangement of data in the fontbank, see the 'Data' section of the TellyMate design article.

[Available from 1.0.14]

<ESC>S hh Batsocks Read Character Definition

This sequence transmits a single byte of data from a character definition.

Each character definition is made from 9 bytes of data - one byte per slice of character (from top to bottom).

Three pieces of information are needed; Character, slice and fontbank. These are specified as follows:

  • Character: The two parameters, hh are lower-case hex digits that represent the ASCII value of the character
  • Slice: The cursor's current row
  • Fontbank: The cursor's current column

e.g. to read slice 3 from character N in fontbank 0;

  • move the cursor to row 3, column 0 (<ESC>Y#<SPACE>)
  • <ESC>S4e

Transmission must be enabled using <ESC>~~~~ prior to using this sequence.

Note: If you have a M328p based TellyMate, the top 64 characters of fontbank 0 will read the user-defined characters.

[Available from 1.1.00 (only on transmit-capable TellyMates)]

<ESC>T cc<data> Batsocks Redefine Character

Redefines a single character.

The first two parameters, cc are the lower-case hex value that specifies the character to redefine. The remaining 18 parameters (yes, 18!) are 9 pairs of lower-case hex values. Each pair represents a byte that defines the pixels of a (horizontal) slice of the character. The first byte is the top slice of the character.

64 characters are available to redefine : 192-255 in fontbank 0.
At switch-on or after a reset, the user-defined characters are initialised to match those of fontbank 0.

e.g. to define character 192 (c0hex) as a stick-man...

binary hex
00010000 10
00111000 38
00010000 10
01111100 7c
00010000 10
00010000 10
00101000 28
01000100 44
00000000 00

Use the following sequence: <ESC>Tc01038107c1010284400.

[Available from 1.1.00  (only on M328p based TellyMates)]

<ESC>Y rc VT52 Direct Cursor Addressing

Moves the cursor to the specified row and column.

  • r is the ascii character of 32 + the desired row.
  • c is the ascii character of 32 + the desired column.

e.g.
to position the cursor at row 5, column 7, ascii characters 37 and 39 should be sent (% and ').
to position the cursor at row 0, column 0, two ascii characters 32 (<SPACE>) should be sent.

If this sequence is cancelled (by receipt of a <CAN> code) after the row parameter has been received, it's effect remains - Cancelling the sequence does not undo any actions already completed. This method can be used to solely set the cursor's row.

If a supplied parameter would lead to an off-the-screen cursor position, then that parameter is quietly ignored. This feature can be used to change just the cursor's row or column.

<ESC>^ n TellyMate Send Data

Transmits one or two bytes of information back, Depending on the parameter character, n:

value meaning
0 Cursor column (1 byte)
1 Cursor row (1 byte)
2 Firmware major version (1 byte)
3 Firmware minor version (1 byte)
4 Firmware revision (1 byte)
5 Signal format (1 byte). 0=NTSC, 1=PAL.
6 Cursor position (2 bytes; row, column).
7 Number of available fontbanks (1 byte)[Available from 1.1.00]
8 Number of user-defined characters (1 byte)[Available from 1.1.00]

Transmission must be enabled using <ESC>~~~~ prior to using this sequence.

[Available from 1.0.10 (only on transmit-capable TellyMates)]

<ESC>_ n TellyMate Set Row Attributes

n can be one of the following characters:

value meaning
0 single width, single height
1 double width, single height
2 single width, double height (top half)
3 single width, double height (bottom half)
4 double width, double height (top half)
5 double width, double height (bottom half)
6 Use Fontbank 0[Available from 1.0.14]
7 Use Fontbank 1 (if available)[Available from 1.0.14]
8 Use Fontbank 2 (if available)[Available from 1.0.14]
9 Use Fontbank 3 (if available)[Available from 1.0.14]
: Use Fontbank 4 (if available)[Available from 1.0.14]
; Use Fontbank 5 (if available)[Available from 1.0.14]
< Use Fontbank 6 (if available)[Available from 1.0.14]
= Use Fontbank 7 (if available)[Available from 1.0.14]
> Use Fontbank 8 (if available)[Available from 1.0.14]
? Use Fontbank 9 (if available)[Available from 1.0.14]
@ Use Fontbank 10 (if available)[Available from 1.0.14]

<ESC>` rc TellyMate Send Character At

Transmits the character at the specified row and column (without affecting the cursor).

  • r is the ascii character of 32 + the desired row.
  • c is the ascii character of 32 + the desired column.

If the requested position is not on screen, a 0 (<NUL>) is transmitted. The character at the cursor position can be read using the slightly shorter <ESC>| sequence.

Transmission must be enabled using <ESC>~~~~ prior to using this sequence.

[Available from 1.0.10 (only on transmit-capable TellyMates)]

<ESC>b H19 Erase to start-of-screen Clears from the cursor (inclusive) to the start of the screen. The cursor is not moved.
<ESC>e GEM Cursor ON This is equivalent to <ESC>y5
<ESC>f GEM Cursor OFF This is equivalent to <ESC>x5
<ESC>j H19 Save Cursor The current row/column is stored. Only another 'Save Cursor' or 'Reset' will overwrite it.
<ESC>k H19 Restore Cursor If the cursor has not previously been saved, (0,0) is used.
<ESC>l H19 Clear line Clears the current row and moves the cursor to column 0.
<ESC>o H19 Clear to start-of-line Clears from the cursor (inclusive) to column 0 on the current row. The cursor is not moved.
<ESC>q nm TellyMate Aux pins - control direction Control the direction (input/output) of the Aux pins.

The first parameter character, n represents one of the following options:

n meaning
0 Set Aux pin m direction to 0, indicating input.
1 Set Aux pin m direction to 1, indicating output.
2 Read direction of Aux pin m. Transmits <SPACE> for input, ! for output.
3 Set direction of all 4 Aux pins. The second parameter indicates the state of the pins:
m Aux4 Aux3 Aux2 Aux1
<SPACE> 0 0 0 0
! 0 0 0 1
" 0 0 1 0
# 0 0 1 1
$ 0 1 0 0
% 0 1 0 1
& 0 1 1 0
' 0 1 1 1
( 1 0 0 0
) 1 0 0 1
* 1 0 1 0
+ 1 0 1 1
, 1 1 0 0
- 1 1 0 1
. 1 1 1 0
/ 1 1 1 1
where 0 is input, 1 is output.
4 Read direction of all 4 Aux pins.

Note: There is no second parameter to this sequence

Transmits the state of the 4 pins. This is as shown in the 'Set direction' sequence, above.

Note: Transmission must be enabled using <ESC>~~~~ prior to using a 'read' sequence.

[Available from 1.1.02 (It's only sensible to use these sequences on TellyMates which have Aux pins available.)]

<ESC>r nm TellyMate Aux pins - control output Control the output state of the Aux pins (if available).

For output pins, this determines a low or high output.
For input pins, this determines whether the pullup resistor is enabled.

The first parameter character, n represents one of the following options:

n meaning
0 Set Aux pin m state to 0 (low | pullup-resistor-disabled)
1 Set Aux pin m state to 1 (high | pullup-resistor-enabled)
2 Read direction of Aux pin m. Transmits <SPACE> for 0, ! for 1.
3 Set output state of all 4 Aux pins. The second parameter indicates the output state of the pins, as per the table in the <ESC>r above, where 0 indicates low | pullup-resistor-disabled, and 1 indicates high | pullup-resistor-enabled.
4 Read direction of all 4 Aux pins.

Note: There is no second parameter to this sequence

Transmits the state of the 4 pins. This is encoded as per the 'Aux pins - control direction' sequence, above.

Note: Transmission must be enabled using <ESC>~~~~ prior to using a 'read' sequence.

[Available from 1.1.02 (It's only sensible to use these sequences on TellyMates which have Aux pins available.)]

<ESC>s nm TellyMate Aux pins - read input Read the input on the Aux pins (if available)

The first parameter character, n represents one of the following options:

n meaning
0 No effect. The second parameter, m is still consumed.
1 No effect. The second parameter, m is still consumed.
2 Read input state of Aux pin m. Transmits <SPACE> for 0, ! for 1.
3 No effect. The second parameter, m is still consumed.
4 Read input state of all 4 Aux pins.

Note: There is no second parameter to this sequence

Transmits the state of the 4 pins. This is encoded as per the 'Aux pins - control direction' sequence, above.

Note: Transmission must be enabled using <ESC>~~~~ prior to using a 'read' sequence.

[Available from 1.1.02 (It's only sensible to use these sequences on TellyMates which have Aux pins available.)]

<ESC>v H19 Line overflow ON When Line Overflow is enabled, any character output to column 37 (the last column) will cause the cursor to be moved to the begining of the next row.
<ESC>w H19 Line overflow OFF When Line Overflow is disabled, any character output to column 37 will not cause the cursor to be moved. The next character will be output to the same position.
<ESC>x n H19 Enable an option

The character n represents one of the following options:

value meaning
4 Block Cursor
5 Hide Cursor
8 Auto LF (on receipt of CR)
9 Auto CR (on receipt of LF)
: Hide Display (all black output). [Available from 1.0.8]
; Suppress Output (no output signal at all). [Available from 1.0.11]
< Alternative Cursor Advance. [Available from 1.0.14]
= PAL output. [Available from 1.1.00]
> Invert output (black on white background). [Available from 1.1.02]

Alternative cursor advance moves the cursor downwards after a character is output (rather than to the right). It does not scroll the screen, and is not affected by the 'Line Overflow' options. It is used to make drawing vertical runs of characters more efficient.

<ESC>y n H19 Disable an option

n is as per the 'Enable an Option'. The effect of disabling each option is as follows:

value meaning
4 Underline Cursor
5 Show Cursor
8 Disable Auto LF
9 Disable Auto CR
: Show Display. [Available from 1.0.8]
; Disable output supression. [Available from 1.0.11]
< Normal Cursor Advance. [Available from 1.0.14]
= NTSC output. [Available from 1.1.00]
> Normal output (white on black background). [Available from 1.1.02]

<ESC>z H19 Reset

Resets the device to power-on equivalent.

Note: If Autobauding is indicated by the jumper settings, the device will (re)enter the autobauding process.

<ESC>| TellyMate Send Character

Transmits the ascii code of the character under the cursor.

Note: Transmission must be enabled using <ESC>~~~~ prior to using this sequence.

[Available from 1.0.19 (only on transmit-capable TellyMates)]

<ESC>~~~~ TellyMate Transmit-enable

Enables the transmit circuitry.

Note: If the sequence of 4 ~ characters is not completed, transmission is disabled and the control sequence terminated.
e.g. <ESC>~x disables transmission, as does <ESC>~~~Z or <ESC>~~Q

Note: Arduino users should read the 'Retrieving data from the TellyMate' section to prevent possible verification errors whilst uploading sketches containing the transmit-enable code sequence.

[Available from 1.0.9 (only on transmit-capable TellyMates)]