summaryrefslogtreecommitdiff
path: root/info/ascii-chart/ascii.tex
blob: c581cb8567b1e792b845a725626ececa058a9e10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                                                                    %%
%%                     A S C I I    wall chart                        %%
%%                                                                    %%
%% by Victor Eijkhout                                                 %%
%% victor@eijkhout.net                                                %%
%%                                                                    %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Copyright 2009 Victor Eijkhout
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
% 
% The Current Maintainer of this work is Victor Eijkhout.
%
% This work consists of this file.
%
%% Choose your favourite format:
%
\nopagenumbers %% 2 lines
\vsize=28cm    %% for PLAIN TeX
%\documentstyle{article}            %% 4 lines for LaTeX
%\begin{document}                   %% not that it matters anything,
%\pagestyle{empty}                  %% rest of the document
%\setlength{\textheight}{28cm}      %% is 'pure' TeX.
%%%%%% and don't forget the \bye / \end{document} at the end!! %%%%%%%
%% fonts
\font\bitfont=cmr7 \fontdimen3\bitfont=3mm
\font\codefont=cmr5
\font\namefont=cmss10 scaled 1200
\font\titlefont=cmss10 scaled 1440
\font\commentfont=cmss10
%% counts and dimens
\newdimen\thinlinewidth \thinlinewidth=.25mm
\newdimen\fatlinewidth \fatlinewidth=.5mm
\newdimen\rowheight \rowheight=1cm
\newdimen\colwidth  \colwidth=1.6cm
\newdimen\Colwidth \Colwidth=2\colwidth
  \advance\Colwidth by \thinlinewidth
\newdimen\topwhite \topwhite=2pt
\newdimen\botwhite \botwhite=3pt
\newdimen\leftwhite \leftwhite=2pt
\newdimen\rightwhite \rightwhite=2pt
\newcount\rowcount \rowcount=-1 %% note!
\newcount\colcount \colcount=0
\newcount\thenumber
%% tidbits
\def\\{$\backslash$}
\def\thinline{\vrule width \thinlinewidth}
\def\fatline{\vrule width \fatlinewidth}
\tolerance=10000
\vbadness=10000
%% code conversion
\def\calcnumber{{\multiply\colcount by 16
                 \advance\colcount by \rowcount
                 \global\thenumber=\colcount}}
\def\deccode{\number\thenumber}
\def\octcode{{\ifnum\thenumber>63
                            \advance\thenumber by -64
                            \count0=\thenumber \divide\count0 by 8
                            1\number\count0
              \else         \count0=\thenumber \divide\count0 by 8
                            \ifnum\count0>0 \number\count0 \fi\fi
              \multiply\count0 by 8
              \advance\thenumber by -\count0
              \number\thenumber}}
\def\hexdigit#1{\ifcase#1 0\or 1\or 2\or 3\or 4\or 5\or 6\or 7\or
                          8\or 9\or A\or B\or C\or D\or E\or F\or
                          \edef\tmp{\message{illegal hex digit
                                        \number#1}}\tmp
                          \fi}
\def\hexcode{{\count0=\thenumber \divide\count0 by 16
              \ifnum\count0>0 \hexdigit{\count0}\fi
              \multiply\count0 by 16
              \advance\thenumber by -\count0 \count0=\thenumber
              \hexdigit{\count0}}}
%% the heading
\def\threebit#1#2#3{\vbox to 1.2\rowheight{\bitfont
                      \vskip\topwhite
                      \hbox to \colwidth{\hskip\leftwhite#1\hfil}
                      \vfil
                      \hbox to \colwidth{\hfil#2\hfil}
                      \vfil
                      \hbox to \colwidth{\hfil#3\hskip\rightwhite}
                      \vskip\botwhite}}
\def\comment#1{\vbox to \colwidth{\hrule height 0mm depth .25mm
                      \vfil
                      \hbox to \Colwidth{\commentfont\hfil#1\hfil}
                      \vfil}}
\def\dcomment#1#2{\vbox to \colwidth{\hrule height 0mm depth .25mm
                      \vfil
                      \hbox to \Colwidth{\commentfont\hfil#1\hfil}
                      \vskip \botwhite
                      \hbox to \Colwidth{\commentfont\hfil#2\hfil}
                      \vfil}}
\def\bithead{\vbox to \colwidth{\hsize=1.5\colwidth
                   \vskip\topwhite
                   \hbox to \hsize{\commentfont\hfil BITS\hfil}
                   \vfil
                   \hbox to \hsize{\bitfont\ b4 b3 b2 b1 }
                   \vskip\botwhite}}
%% routines for single chars
\def\fourbit#1\fb{\vbox to \rowheight{
                     \vfil
                     \hbox to 1.5\colwidth{\bitfont #1\ }
                     \vfil}%
                  \global\advance\rowcount by 1
                  \global\colcount=0}
\def\asc#1\ii{\calcnumber
              \vbox to \rowheight{\offinterlineskip
                     \vskip\topwhite
                     \hbox to \colwidth{\codefont
                                        \hskip\leftwhite
                                        \deccode\hfil}
                     \vfil
                     \hbox to \colwidth{\vrule width 0cm
                                              height 10pt depth 2pt
                                        \namefont
                                        \hfil#1\hfil}
                     \vfil
                     \hbox to \colwidth{\codefont
                                        \hskip\leftwhite
                                        \hexcode\hfil\octcode
                                        \hskip\rightwhite}
                     \vskip\botwhite}%
              \global\advance\colcount by 1}
%%%%%%%%%%%%%%%%% and now the table itself %%%%%%%%%%%%%%%%%%%%%%%%%
\vbox{
\halign{\fourbit#\fb&\fatline\asc#\ii&\thinline\asc#\ii&
                     \fatline\asc#\ii&\thinline\asc#\ii&
                     \fatline\asc#\ii&\thinline\asc#\ii&
                     \fatline\asc#\ii&\thinline\asc#\ii\fatline\cr
          \omit&\multispan8 \hskip\thinlinewidth
                            \titlefont ASCII CONTROL CODE CHART\hfil\cr
    \noalign{\vskip3mm \hrule}
          \omit\hfil\threebit{b7}{b6}{b5}
                 &\omit\fatline\threebit000&\omit\thinline\threebit001%
                 &\omit\fatline\threebit010&\omit\thinline\threebit011%
                 &\omit\fatline\threebit100&\omit\thinline\threebit101%
                 &\omit\fatline\threebit110&\omit\thinline\threebit111%
                                                 \fatline\cr
    \noalign{\vskip-.5mm} %brute force
          \omit\bithead
                 &\omit\fatline\comment{CONTROL}\span\omit
                 &\omit\fatline\dcomment{SYMBOLS}{NUMBERS}\span\omit
                 &\omit\fatline\comment{UPPER CASE}\span\omit
                 &\omit\fatline\comment{LOWER CASE}\span\omit\hfil\fatline\cr
    \noalign{\hrule}
      {} 0 0 0 0&NUL&DLE&SP     &0  &@  &P       &` &p  \cr\noalign{\hrule}
      {} 0 0 0 1&SOH&DC1&!      &1  &A  &Q       &a &q  \cr\noalign{\hrule}
      {} 0 0 1 0&STX&DC2&"      &2  &B  &R       &b &r  \cr\noalign{\hrule}
      {} 0 0 1 1&ETX&DC3&\#     &3  &C  &S       &c &s  \cr\noalign{\hrule}
      {} 0 1 0 0&EOT&DC4&\$     &4  &D  &T       &d &t  \cr\noalign{\hrule}
      {} 0 1 0 1&ENQ&NAK&\%     &5  &E  &U       &e &u  \cr\noalign{\hrule}
      {} 0 1 1 0&ACK&SYN&\&     &6  &F  &V       &f &v  \cr\noalign{\hrule}
      {} 0 1 1 1&BEL&ETB&'      &7  &G  &W       &g &w  \cr\noalign{\hrule}
      {} 1 0 0 0&BS &CAN&(      &8  &H  &X       &h &x  \cr\noalign{\hrule}
      {} 1 0 0 1&HT &EM &)      &9  &I  &Y       &i &y  \cr\noalign{\hrule}
      {} 1 0 1 0&LF &SUB&*      &:  &J  &Z       &j &z  \cr\noalign{\hrule}
      {} 1 0 1 1&VT &ESC&+      &;  &K  &[       &k &$\{$\cr  \noalign{\hrule}
      {} 1 1 0 0&FF &FS &,      &$<$&L  &\\      &l &$|$ \cr  \noalign{\hrule}
      {} 1 1 0 1&CR &GS &$-$    &=  &M  &]       &m &$\}$\cr  \noalign{\hrule}
      {} 1 1 1 0&SO &RS &.      &$>$&N  &\char94 &n &\char126\cr
                    \noalign{\hrule}
      {} 1 1 1 1&SI &US &/      &?  &O  &\_$\!$\_&o &DEL\cr\noalign{\hrule}
   \noalign{\vskip2mm}
          \omit&\omit\namefont \hfil LEGEND:\hfil \span\omit
          &\multispan4\hskip\fatlinewidth
            \vtop{\vskip-10pt\hbox{\vrule
             \vbox to \rowheight{
                 \offinterlineskip
                 \hrule\vskip \topwhite
                 \hbox to \colwidth{\codefont\hskip\leftwhite
                                       dec\hfil}
                 \vfil
                 \hbox to \colwidth{\namefont\hfil CHAR\hfil}
                 \vfil
                 \hbox to \colwidth{\codefont\hskip\leftwhite
                                       hex\hfil oct
                                       \hskip\rightwhite}
                 \vskip\botwhite
                 \hrule                               }%
                                  \vrule}}
                      \hfil
          &\multispan2\bitfont \hskip\fatlinewidth
                      \vtop{\vskip-8pt\baselineskip=8.5pt
                            \hbox{Victor Eijkhout}
                            \rlap{Dept. of Comp. Sci.}
                            \rlap{University of Tennessee}
                            \rlap{Knoxville TN 37996, USA}
                            }\hfil\cr
          }
}
%%%%%%%%%%%%%%%%%%%%%%% and that's it folks! %%%%%%%%%%%%%%%%%%%%%%%%%%

\bye          %% PLAIN TeX
%\end{document} %% LaTeX