Files
app/docs/terminals.md
T
NeoandClaude 93febb3790 Draw the retro terminals in their machines' own fonts (#46)
The BBS and home computer terminal types now draw with their machines'
character ROM fonts, SyncTERM's copies of them from Synchronet's ciolib
(LGPL-2.0-or-later), instead of Unscii's lookalikes: the IBM VGA's code
page 437, RIPterm's 8x8, the C64's and C128's, the Atari 8-bit's, the
Amiga's Topaz, Prestel's and the Atari ST's.

- tools/gen_rom_fonts.py writes RomFonts.kt from allfonts.c; RomFont
  keeps a ROM in its machine's code order and doubles or halves it.
- MachineFonts reads each ROM in its machine's set, so a cell's code
  point gets the glyph its machine drew; what a ROM hasn't got comes
  from Unscii.
- ANSI-BBS takes SyncTERM's font selection (CSI 0 ; n SP D) for the
  fonts here, including the Amiga scene fonts.


Claude-Session: https://claude.ai/code/session_01B82eRSyCmXjaURxSYoHxCY

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-12 04:33:26 -08:00

9.6 KiB

Terminal types

The terminal (Android and iOS) can be any of the terminals below. Pick one in Settings, or give a directory entry its own. The choice sets what the screen understands, how it answers the remote's identity requests, what SSH sends as TERM and Telnet as TERMINAL-TYPE, the screen's size, its character set and glyphs, and the key bar.

All of them live in shared/src/commonMain/kotlin/org/dmodem/app/terminal/: a TerminalProfile subclass for each type (TerminalProfile.kt, Commodore.kt, Atari.kt, Videotex.kt, Minitel.kt, Tektronix.kt) and the interpreter it makes (VtInterpreter, Vt420Interpreter, AnsiBbsInterpreter, ByteControlInterpreter and its subclasses, TektronixInterpreter). ReGIS is Regis.kt, sixel Sixel.kt, and both graphics terminals draw through Raster.kt.

Type Id TERM / Telnet type Screen What it is
xterm xterm xterm-256color / XTERM-256COLOR any The default: a VT220 with 256 and 24-bit colour, sixel, the mouse, titles, and Tek mode
ANSI-BBS (PC) ansi-bbs ansi / ANSI 80x25 A PC's BBS terminal, as SyncTERM is: CP437 in a VGA font, iCE colours, ANSI music, doorway mode
RIPscrip rip rip / ANSI 80x43 text over 640x350 graphics RIPscrip 1.54 over ANSI-BBS: `!
Avatar (AVT/0+) avatar avatar / ANSI 80x25 ANSI-BBS with FidoNet's Avatar codes: ^L, ^Y repeat, ^V's attributes, moves and AVT/0+'s area scrolls, clears, fills and pattern repeat
Amiga ANSI amiga amiga / ANSI 80x25 ANSI-BBS in Latin-1 in Topaz, with colours from the Amiga's 12-bit palette
DEC VT52 vt52 vt52 / DEC-VT52 80x24 The VT52's own escape codes and graphics
DEC VT100 vt100 vt100 / DEC-VT100 80/132x24 ANSI codes at level 1: no colour; double-size lines; VT52 mode
DEC VT102 vt102 vt102 / DEC-VT102 80/132x24 Adds character and line insert and delete, and a printer port
DEC VT220 vt220 vt220 / DEC-VT220 80/132x24 Level 2: G0-G3 character sets, 8-bit controls, soft fonts, user-defined keys, selective erase
DEC VT320 vt320 vt320 / DEC-VT320 80/132x24 Level 3: DEC Technical, the state reports, a status line
DEC VT340 vt340 vt340 / DEC-VT340 80/132x24 A VT320 with graphics: sixel and ReGIS in 16 shared colour registers, and Tek mode
DEC VT420 vt420 vt420 / DEC-VT420 80/132x24+ Level 4: left and right margins, rectangle operations, six pages
DEC VT510, VT520 vt510, vt520 vt510 / DEC-VT510, … 80/132x24+ Level 5: the display extent report, bell volumes
DEC VT525 vt525 vt525 / DEC-VT525 80/132x24+ A VT520 in colour, with its colour table
Commodore 64, 128 (40 and 80), Plus/4, VIC-20, PET (40 and 80) c64, c128, c128-80, plus4, vic20, pet, pet80 petscii / PETSCII 40x25 (VIC-20: 22x23; 80 for the C128's VDC and the 8032) PETSCII as CCGMS and Novaterm do it, each in its machine's palette
Atari 8-bit atari, atari-intl atascii / ATASCII 40x24 ATASCII and the screen editor's controls; the XL's international set as a second type
Atari ST atari-st, atari-st-low st52 / VT52 80x25 in 4 colours, or 40x25 in 16 TOS's VT52 with its colours (ESC b, ESC c), reverse, wrap, cursor save and on/off, more erases, line insert and delete, in the ST's character set
Viewdata (Prestel) viewdata viewdata / VIEWDATA 40x24 Teletext Level 1 attributes and mosaics; # sends
Minitel minitel minitel / MINITEL 40x25 Teletel videotex with the status row, the protocol commands, Mixte (80 columns) and Téléinformatique (a VT100)
Tektronix 4014 tek4014 tek4014 / TEK4014 4096x3120 tube Vectors, points, incremental plots and alpha text on a storage tube

Fonts

Each retro type draws with its machine's own character ROM font, SyncTERM's copies of them (RomFonts.kt, written by tools/gen_rom_fonts.py), read in the machine's own character set (MachineFonts.kt):

Types Font
ANSI-BBS, Avatar IBM VGA 8x16, code page 437
RIPscrip RIPterm's 8x8, code page 437
Amiga ANSI Topaz (Kickstart 1's), 8x8
C64, Plus/4, VIC-20, PET The C64's character ROM, both sets
C128 (40 and 80) The C128's character ROM, both sets
Atari 8-bit The Atari's character ROM (the XL's international letters from Unscii)
Atari ST The ST's 8x8 (its colour modes')
Viewdata Prestel's teletext characters, 8x16

A BBS can change the ANSI-BBS types' font with SyncTERM's ESC [ 0 ; n SP D. The font is drawn at the profile's height and read as the session's octets, as SyncTERM does. These are here:

n Font
0 IBM VGA (code page 437)
26 Code page 437, thin
32, 33 Commodore 64, upper and lower case
34, 35 Commodore 128, upper and lower case
36 Atari 8-bit
37 P0T-NOoDLE (Amiga)
38 mO'sOul (Amiga)
39 MicroKnight Plus (Amiga)
40 Topaz Plus (Amiga)
41 MicroKnight (Amiga)
42 Topaz (Amiga)
43 Prestel
44 Atari ST (its mono mode's 8x16)

Its own number, RIS or another terminal type puts the profile's font back. The other code page fonts (1-31) aren't here, and are ignored.

A VT510's and later screen size can change at the host's request (DECSNLS, DECSLPP, DECSCPP). xterm and ANSI-BBS fit the view.

Graphics

Sixel images are cells of an image that scroll with the text. ReGIS and the Tektronix draw a picture over the whole screen instead. It is kept the screen's size in pixels, and only the cells it has drawn in show it. Resizing the screen starts the picture again, as on a storage tube.

  • Sixel: xterm, ANSI-BBS and the VT340. On the VT340 the images share ReGIS's 16 colour registers.
  • ReGIS (ESC P p … ESC \, VT340 only):
    • The screen is 800x480. Positions can be absolute or relative, and use the position stack and pixel vectors.
    • Commands: P, V, C (circles, arcs, closed and open curves), F, T, W, S, R, L and macrographs (@).
    • Commands are run as they become whole, so a drawing sent over many reads shows as it comes. ESC P 1 p starts afresh, and ESC P p carries on from where the last one left off.
  • Tektronix 4014: its own terminal type, and Tek mode on xterm and the VT340.
    • ESC [ ? 38 h switches to the alternate screen, and ESC ETX goes back to the text.

Testing

Each sequence has unit tests in shared/src/commonTest. Run them with ./gradlew :shared:jvmTest :shared:linuxX64Test.

ProfileRenderTest in app/src/test draws a screen on every terminal type through the real Android view and keeps it as app/build/profiles/<id>.png. Run it with ./gradlew :app:testDebugUnitTest --tests '*ProfileRenderTest*' and look at the pictures after a change to drawing.

vttest

To run vttest, open the app's Linux shell and install it (apk add vttest, or the distro's equivalent). Set the terminal type in Settings, then run vttest.

What to expect, menu by menu, from the unit tests and the code. These haven't yet been checked against a vttest run on a device: update the table when they are.

vttest menu Profiles Expect
1 Cursor movements all DEC, xterm passes
2 Screen features (132 columns, scrolling regions, origin mode) all DEC, xterm passes. Smooth scrolling (DECSCLM) is drawn as jump scrolling
3 Character sets VT100 and later passes. NRCS needs a VT220 or later
4 Double-sized characters VT100 and later passes
5 Keyboard all the LEDs and auto-repeat can't be checked on a phone. Use the key bar for the keypad and function keys
6 Terminal reports all passes. The answerback message is empty
7 VT52 mode VT100 and later passes
8 VT102 features VT102 and later passes
9 Known bugs all n/a
10 Reset and self-test all the self-test (DECTST) does nothing
11 Non-VT100 terminals by level VT220: passes. VT320: passes. VT420: passes except the locator (no mouse reports on a DEC type). VT520: passes except the keyboard's own settings (bell volumes and key click are accepted and ignored). xterm: its own menus

What isn't done

ReGIS

  • Text is drawn upright in any direction: the string moves the way it's told, but the glyphs don't turn.
  • Italics (T(I)) and the hard copy and scrolling of S are accepted and ignored.
  • R(M) (macrograph storage) isn't answered.
  • A colour register changed after drawing doesn't recolour what's already drawn.

RIPscrip

  • Icons (1I, 1W) and scenes (1R) from the host's files aren't loaded.
  • Text variables (…) aren't expanded.
  • The stroke fonts are drawn with the PC's bitmap font at their size.
  • Vertical text runs down, but its glyphs don't turn.

Tektronix

  • No graphic input (GIN) cross-hair.
  • No write-through or defocused modes.

Viewdata and Minitel

  • Double height and double size are drawn single.
  • The Minitel draws its text in the app's font, not its own ROM's.

Fonts

  • Fonts 1-3 of ESC [ Ps1 ; n SP D (the ones SyncTERM draws bright and blinking text in) aren't kept: only font 0 changes.
  • The DEC types, the Tektronix and the Minitel use the app's font: no ROM fonts of theirs are here.
  • The VIC-20, Plus/4 and PET draw with the C64's ROM, which is nearly theirs.

DEC

  • No locator (DECELR), and no answerback message.

iOS

  • The picture and image drawing is built but not yet compiled in Xcode (the bridge's imageRuns and imagePixels).