Real VT102 Emulation with MAME
zork.net
zork.net
It will lead to another problem that you have also with real terminals connected to UNIX. The tty driver will buffer lots of data (or worse, the chain of ssh connections will do it). This can be annoying: hold PageDown in an editor, then hold PageUp. Ideally, you should instantly see the top of the file, but instead you have to put up with potentially minutes of buffered data going by.
The editor should output only the latest screen contents when there is type-ahead. But it has to defeat the output buffer to do this properly. The text editor JOE does it: it does not feed data faster than the baud rate to avoid buffering. This allows it to detect type-ahead and only output the most recent screen contents.
I have thought about this problem off and on. Usually the conclusion I come to is that we need a new tty interface. The old tty interface has too much legacy baggage. For example l, in addition to the buffering problem, there is also the key input problem. Ideally, a newer interface would provide scan codes instead of the escape sequences. Not having to deal with ‘escape’ like we do today would simplify things.
While I agree the Unix tty model is crufty and old, this particular feature doesn't require any changes to it. The later models of the real DEC terminals introduced a mode called DECPCTERM to send PC compatible keyboard scan codes, with escape sequences to enable/disable it. Terminal emulators very rarely implement it, but there is no reason why they couldn't. And there is no change the Unix tty subsystem design required to support it.
[1] https://www.npmjs.com/package/serial-cat [2] https://github.com/pyserial/pyserial
> In applications using continuous 19,200 baud communication, occasional data errors may occur.
In my experience, setting the emulated VT102 to use 19,200 makes every keypress generate a data error. Even if it worked, though, the VT102 still runs at 6MHz and it still takes just as long to scroll the screen, and my host PC is still ~infinitely fast, so I think it would just make the problem worse.
That's what Ctrl-O is for, right?
I used to use that all the time on my 1200 bps modem. Usually followed by a Ctrl-L to repaint since discarding some of the buffered data can leave the screen in a weird state.
A mosh(1) client reading at 9600 baud will just receive fewer, likely-full-screen batches, where each batch has likely seen many full overwrites of its buffer before emission. Sort of like a VoIP client over a slow connection will just receive a low-FPS series of keyframes, with I-frames being unlikely.
https://www.youtube.com/watch?v=n5c27-y5tm4&t=154s
https://www.aliexpress.com/item/33014937190.html
https://github.com/fdivitto/FabGL
Which has been further refined into VT132:
Trinitron tubes are easier to mimic that way, but I don't remember any terminal fancy enough to use one.
If that's not enough, there are slightly fewer million work hours invested in other GUI technologies, from the first ones all the way to Electron
IIRC when I had a real terminal hooked up to my first Linux machine, via a serial cable, whoever was using that terminal was presented with a login prompt, and not the shell. I think that used getty.
TERM=vt102 LC_ALL=C COLUMNS=80 LINES=24 /bin/sh </dev/pts/10 >/dev/pts/10 2>/dev/pts/10
Can you run this instead?
TERM=vt102 LC_ALL=C COLUMNS=80 LINES=24 /sbin/agetty </dev/pts/10 >/dev/pts/10 2>/dev/pts/10
- agetty would inherit the controlling terminal of the shell it launched from, and it doesn't know how to dissociate itself, so it would still need a tool like setsid
- agetty launches login, which needs root permissions, so you'd still need sudo
- agetty/login reset the environment for the new session, so setting those environment variables would have to effect
- not a semantic problem, just a syntactic one, but agetty manages the TTY named on its command line, it doesn't pay attention to its stdin/out/err, so the redirections wouldn't help
Taking all those changes into account, you get the command line from the "no job control" section at the end of the article.
> Unfortunately, the emulated VT102 is not connected through a real serial port, it’s connected through a PTY which (at least compared to what the VT102 expects) is basically infinitely fast.
A quick and hacky solution might be two USB to RS-232 converters and a loopback cable.
I'd previously wished for a virtual serial driver which slowed stuff down based on baud rate, implemented all the RTS/CTS/DCD/RI etc signals, etc. Someone with sufficient time, inclination and kernel development skills could build one. Given it is such an esoteric wish, probably not going to happen.
You could probably tunnel to get SSH working.