Copyright © 2018 by Thomas E. Dickey
The VT420 (and VT5200 series) support a couple of features which compute checksums for the terminal's state:
- Request Checksum of Rectangular Area
- Memory Checksum
The available documentation gives the format of the controls and responses, but leaves out some useful information, i.e., how the terminal computes the checksum.
I noticed this in 2012, when I was improving the implementation of rectangle operations in xterm by making those take into account the left/right margin settings supported in VT420. At the time I was using evaluation copies of a couple of well-known terminal emulators to cross-check against the documentation. Neither implemented this feature properly (one did not respond correctly and the other always computed zero), though both claimed to emulate VT420.
As a minor, rarely used feature, it was “good enough” to just return the sum of the data from the screen. That was xterm patch #279 (May 2012).
A few years later, George Nachman found a use for the checksum feature, and sent a bug report pointing out that an identifier-parameter (sent by the application and part of the response) was parsed at the wrong position. That problem existed in both of the checksum features, and I saw only one (because the parameter numbering differs between the two). The memory checksum (unused!) was fixed in xterm patch #315 (March 2015). A few years (more!) passed, before I decided to investigate his application which used this feature.
Besides my belated fix for the response of
DECRQCRA, I suggested other improvements to
Nachman's scripts, which he split-out as a separate project
prehistory is buried in iTerm2). As part of
that, I decided to modify the logic for
eliminate an xterm-specific feature. That was xterm patch #335 (August
Meanwhile, I had begun vetting a few other (commercial)
terminal emulators to gauge their usefulness for cross-checking
some terminal descriptions. While discussing some issues I had
found, Markus Schmidt (one of the developers) commented that he
had access to a DEC VT520. His feedback (and screenshots) were
helpful in determining the checksum algorithm used by the DEC
terminal. I factored out the differences between xterm #335 and
the VT520 as configurable extensions (the
checksumExtension resource), leaving the default
DECRQCRA matching the hardware terminal
Doing the analysis required some experimentation. A successful test will match these screenshots exactly (with the same highlighting and use of bold, underline shown).