# 4 Column ASCII Table

00  01  10  11             00  01  10  11
--------------------------+--------------------------
NUL  SPA  @   `  __00000 | DLE   0   P   p  __10000
SOH   !   A   a  __00001 | DC1   1   Q   q  __10001
STX   "   B   b  __10010 | DC2   2   R   r  __10010
ETX   #   C   c  __00011 | DC3   3   S   s  __10011
EOT   \$   D   d  __00100 | DC4   4   T   t  __10100
ENQ   %   E   e  __00101 | NAK   5   U   u  __10101
ACK   &   F   f  __00110 | SYN   6   V   v  __10110
BEL   '   G   g  __00111 | ETB   7   W   w  __10111
BS   (   H   h  __01000 | CAN   8   X   x  __11000
TAB   )   I   i  __01001 |  EM   9   Y   y  __11001
LF   *   J   j  __01010 | SUB   :   Z   z  __11010
VT   +   K   k  __01011 | ESC   ;   [   {  __11011
FF   ,   L   l  __01100 |  FS   <   \   |  __11100
CR   -   M   m  __01101 |  GS   =   ]   }  __11101
SO   .   N   n  __01110 |  RS   >   ^   ~  __11110
SI   /   O   o  __01111 |  US   ?   _  DEL __11111

Cue card sized four column ASCII table. Really helps explain why they picked the values they did. It enables trivial manipulation for routine operations:

• Lower Case: val |= 0b0100000
• Upper Case: val &= 0b1011111
• Toggle Case: val ^= 0b0100000
• Char → Int: val &= 0b0001111
• Ctrl Char: val &= 0b0011111

That last one's why things like Ctrl+D closes the terminal, Ctrl+I tab completes things, Ctrl-L clears the screen, and you can backspace using Ctrl+H. If you've seen your editor add ^M to the end of lines that's because it's the control code representation of CR. Same goes for ^[ that you may have seen if you've played with ANSI escape codes. Obviously these bit operations only work given a fairly narrow set of preconditions but they were pretty cost effective in their day.

Why is DEL last? Did you notice it's 0b1111111? On a punch tap, if you want to delete a character, you could punch it out entirely to indicate you deleted the symbol. At least that's what Wikipedia says. Cool, huh?

If you didn't catch it, Char → Int means you can read ASCII numbers directly from their binary form. If you see a 0b011____, you can just read the digit from the end.