Barry Margolin <barmar@genuity.net> wrote:
+---------------
| Erik Naggum <erik@naggum.net> wrote:
| >| 6-bit ASCII is only usable if you're willing to forego lowercase.
| >
| > Actually, there is no such thing as 6-bit ASCII. SIXBIT has no
| > control codes and is completely useless except in extremely
| > well-controlled settings.
|
| You're right, it's wrong to call it ASCII, it's just a 6-bit character set
+---------------
"Right" or "wrong", DEC SIXBIT (mandated for filenames in PDP-10 system
calls [UUOs], among other things) *was* a strict subset of 7-bit ASCII,
with one bit inverted. Or to say it another way, the 7-bit ASCII characters
at codepoints #o40 through #o137 *were* the SIXBIT characters with values
0 through #o77.
To convert from ASCII to SIXBIT, you first upcased any alphabetics, then
complemented the #x20 (#o40) bit, and the low six bits of the result was
your SIXBIT character. In C, it would probably be something gross like:
char6 = (((char7 < 0140) ? char7 : (char7 - 040)) ^ 040) & 077;
If memory serves, it was only three lines of PDP-10 assembler, using
those wonderful combined test-under-mask-and-modify-and-conditionally-skip
instructions:
; here with a 7-bit ASCII character in t0
TRZE t0, 100 ; if alpha (and clear 7th bit unconditionally)
TRZ t0, 40 ; upcase (zero) it
TRC t0, 40 ; and in either case, complement
; t0 now has the corresponding SIXBIT char
-Rob
-----
Rob Warnock, 30-3-510 <rpw3@sgi.com>
SGI Network Engineering <http://www.rpw3.org/>
1600 Amphitheatre Pkwy. Phone: 650-933-1673
Mountain View, CA 94043 PP-ASEL-IA
[Note: aaanalyst@sgi.com and zedwatch@sgi.com aren't for humans ]