I was looking at a hex dump of the ROM BASIC from the original IBM PC and found some byte strings like this (ASCII dump is on the right):
50 52 49 4e d4 9d 4c 49 53 d4 9e 50 4f d3 1b 45 PRIN..LIS..PO..E
With a closer look, I saw that 50 52 49 4e d4
is "PRINT" but with the highest bit of the last byte set--presumably to indicate the end of the string. We see the same pattern immediately afterward with 4c 49 53 d4
corresponding to "LIST". (Oddly, this convention is not used throughout the ROM; there are some plain old NUL-terminated strings in there as well.)
We even see this in the boot sector from the IBM PC-DOS 1.00 floppy disk:
0a 4e 6f 6e 2d 53 79 73 74 65 6d 20 64 69 73 6b .Non-System disk
20 6f 72 20 64 69 73 6b 20 65 72 72 6f f2 0d 0a or disk erro...
Right after "erro" there is the byte 0xf2
. If you zero its high-order bit you get 0x72
--the expected ASCII "r" to complete the word.
I have never seen this way of terminating a string anywhere else, and the only information I could find about it online was in the Tiny Basic design notes:
Commonly, one uses a special character (NUL = OOH for example) to indicate the end [of a string]. This costs one byte per string but is easy to check. A better way depends upon the fact that ASCII code does not use the high order bit; normally it is used for parity on transmission. We can use it to indicate the end (that is, last character) of a string. When we process the characters we must AND the character with 07FH to scrub off the flag bit.
This still leaves me wondering... Where did this practice come from? Where else was it used? And why use it for some strings in a program and not others?