``` 在2026年使用1978年的终端机(DEC VT-100) ```
Using a 1978 terminal in 2026 (DEC VT-100)

原始链接: https://nikhiljha.com/posts/vt100/

受技术历史的吸引,作者最近创建了一个编码代理,并决定在1978年的数字设备公司VT-100终端上测试它——这是一个与现代终端出人意料的相关祖先。该项目源于一种愿望,即看看为今天系统设计的软件是否能在原始硬件上运行。 VT-100拥有3KB的RAM和独特的CRT啸叫声,通过简单的字节流和ANSI转义序列来控制光标和显示文本。使其工作涉及克服几个障碍:错误的串行电缆、通过Linux虚拟机启用流控制(macOS缺乏支持),以及优化应用程序以避免由于终端的9600波特速率而导致的缓慢的全屏重绘。Unicode和OSC序列的兼容性问题也需要实现仅ASCII模式。 尽管面临挑战,作者发现使用这款老式终端出人意料地令人愉快,强调了旧技术和新技术之间令人满意的对比。这次经历强调了计算的持久原则,甚至促使一位企业客户提出了仅ASCII模式的功能请求!

一个黑客新闻的讨论围绕着在2026年使用1978年的DEC VT-100终端。用户分享了使用MAME模拟这些终端的资源,包括ROM和文档链接。一些评论者回忆起他们使用老式终端的经历——有人将VT320用作“家庭控制系统”来娱乐,而另一个人则回忆起用交叉电线在房间之间创建一个简单的通信系统。 讨论还涉及VT520等老型号的实用性(更快的波特率),但指出一个现代问题:许多程序现在忽略终端功能(termcap),需要像tmux这样的解决方法。一位怀旧的用户甚至怀念老式阴极射线管电子枪的独特气味。最后,帖子还包含了一个Y Combinator 2026年夏季项目的申请公告。
相关文章

原文

I spent the last few weeks making a coding agent for the terminal. This strikes me as anachronistic: the terminal is technology from before my lifetime, and I’m using it as the interface to exhilarating, terrifying, cutting-edge, trillion dollar modern day research.

I find the juxtaposition nice. It’s a reminder that I build on what came before me, and others will build on what I leave behind.

All modern terminals are (roughly) emulations of a single terminal released in 1978: the Digital Equipment Corporation VT-100. In theory, I could take the app that I built and run it on the VT-100. If my software ran there, would it run everywhere?

To find out, I bought a VT-100 and decided to use it as my main terminal. Here’s what I learned.

What is a VT-100?

A VT-100 is a terminal: a screen and a keyboard that you plug into a computer. It’s roughly analogous to the Terminal or Console or Command Prompt app on your computer today. It is not a computer itself. The VT-100’s protocol (i.e. ANSI escape sequences, more on this later) are used today by all modern terminals.

Vim running on the VT-100

The VT100 has a CRT display and a keyboard.

You power it on from a stick switch near the power supply. After flipping the switch it makes a startup beep noise. While on there’s an high-pitch whine from the CRT. The pitch is high enough that a couple of my friends can’t hear it at all.

The VT-100 has Intel inside (there’s an 8080 in there) and 3 KB RAM. This is less than you need to get to the moon (4 KB, Apollo 11).

The keyboard I have is from a VT120, and it is unfortunately awful: the keys are mushy, don’t register without a deep press, and are placed awkwardly for modern usage. We have innovated on keyboard design since then.

Inside the VT-100

How do terminals work?

On the terminal end it is pretty simple. There is one stream of bytes going into the VT-100, and one stream of bytes coming out of the VT-100. When you send bytes in via a computer, they show up on the VT-100’s screen. When you type on the keyboard, bytes come out.

How do interactive apps like vim work? Special sequences of text called “ANSI escape sequences” can be used to move the VT100’s cursor around. For example, ^[D moves the cursor left. Similar sequences are used for colors, italics, bolding, and other visual features. By moving the cursor around and writing formatted text, programmers can build interactive apps.

The computer end is surprisingly complicated. On Linux and MacOS, there are ttys (teletypewriters) and ptys (pseudoterminals) that exist as files in /dev.

A pty has two sides, the host and the client, where the host is controlled by your terminal. The client side is a tty. This is how virtualized (i.e. non-hardware / modern) terminals work.

The kernel tty subsystem is remarkably complicated for legacy reasons. It has a raw mode and a cooked mode (chat… it’s cooked) (this isn’t a joke that’s actually what it’s called). If you’re bored you can put your terminal into cooked mode by running stty cooked.

In cooked mode, the kernel handles “line discipline”, which handles more than I expected: echoing characters you type to the screen, generating SIGTERM on Control + C, flow control, and even line editing (the kernel can natively handle ^W and ^U, try running cat and typing).

If you want full control over the terminal you need to uncook the terminal from userspace first (raw mode). This lets application developers decide what happens when keys are pressed without the kernel getting in the way.

The raw and cooked modes are shorthand for a particular list of configuration flags that the kernel’s TTY subsystem has. There are options that are not set in either mode, such as IXON for flow control. But nobody needs flow control in 2026 (foreshadowing).

How do you use a VT-100?

The VT-100 speaks the RS-232 standard, which is in common use today. You can go to the store and buy a cable that plugs into the VT-100, and it’ll show up under /dev/ttyUSB0.

I had a mild skill issue plugging it in. I bought a wrongly keyed cable, so I had to run jumper wires instead of using the connector properly. I looked at the wiring diagram and tried wiring the TX, RX, and ground to the cable and tried to send bytes to it via echo foo > /dev/ttyUSB0 but it didn’t work. I then brought out the oscilloscope and noticed that it was sending in both directions. RX and TX were flipped. Classic.

Was that enough to run my app on the VT-100?

Unfortunately, that’s where the ease ended. Nobody today uses an external terminal over a USB connection. Why would you want to do that? USB devices have metadata associated with them that tells Linux the device on the other end is a printer or something, not an external terminal.

Oscilloscope trace

Issue #1: Flow control

At this point I could echo a couple of bytes into the tty device and see them on the VT-100, or cat bytes out of the device and see them on my Mac. However, if I tried to run my shell pointed at the tty device it blew up and half the characters would drop.

The issue was that the VT-100 has inline flow control that expects the host (i.e. the computer) to stop sending bytes if it is overwhelmed. It appears that this feature either never existed in MacOS or was removed at some point. We tried forcing it via stty but it just didn’t work.

We ended up running a Linux VM and setting the same option, which immediately worked.

This is enough to get bash and vim and other simple apps working.

Issue #2: Full terminal redraws are painful

The VT-100 is slow. It runs at 9600 baud. That might sound like a lot, but text that contains a lot of ANSI escape sequences quickly exceeds this budget. The VT-100 doesn’t even support sending at the full 9600 baud continuously with any escape sequences. Text containing escape sequences is limited to even less than 9600.

At this speed, full screen redraws are slow. The solution to this is a “differential renderer”: a renderer that keeps track of the screen state and makes the minimal edit to minimize flicker. We thought we were doing this in our app but it turned out there were a few cases where we were redrawing and should not have been.

Issue #3: Assuming too much escape sequence compatibility

Our app was emitting escape sequences that the VT-100 didn’t understand. Normally the terminal ignores incorrect escape sequences, but there were a few hard blockers.

First, Unicode: the modern standard for computer text. The VT-100 only supports ASCII characters. Our interface was mostly ASCII already, but a few characters looked nicer with Unicode, e.g. box drawing characters and loading spinners. We solved this by adding an ASCII-only mode.

Fun fact: one of our enterprise customers later requested ASCII-mode as a feature because their terminals didn’t have Unicode either. We got to tell them we have it already :)

Second, OSC sequences. The VT100 safely throws away standard ANSI escapes it doesn’t understand, but OSCs are a new format that it doesn’t understand at all. If you emit one, it prints the raw text of the OSC to the screen. I added a special “legacy” mode where the app never emits an OSC.

Impressions

After getting it working, using the VT-100 in person was delightful! I basically only need vim and my app to work, so except for the keyboard it is very usable. I think everyone who came by to check it out appreciated the contrast of old vs new technology.

I would like to try more things, so let me know if there’s something you want to see running on the VT-100!

联系我们 contact @ memedata.com