1 /* i7094_dat.h: IBM 7094 data conversion tables
2 
3    Copyright (c) 2003-2008, Robert M. Supnik
4 
5    Permission is hereby granted, free of charge, to any person obtaining a
6    copy of this software and associated documentation files (the "Software"),
7    to deal in the Software without restriction, including without limitation
8    the rights to use, copy, modify, merge, publish, distribute, sublicense,
9    and/or sell copies of the Software, and to permit persons to whom the
10    Software is furnished to do so, subject to the following conditions:
11 
12    The above copyright notice and this permission notice shall be included in
13    all copies or substantial portions of the Software.
14 
15    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18    ROBERT M SUPNIK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19    IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20    CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 
22    Except as contained in this notice, the name of Robert M Supnik shall not be
23    used in advertising or otherwise to promote the sale, use or other dealings
24    in this Software without prior written authorization from Robert M Supnik.
25 */
26 
27 /* Nine-code to ASCII conversion */
28 
29 const char nine_to_ascii_a[64] = {
30     '0', '1', '2', '3', '4', '5', '6', '7',
31     '8', '9', '^', '#', '@', ':', '>', '{',
32     '&', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
33     'H', 'I', '?', '.', ')', '[', '<', '}',
34     '-', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
35     'Q', 'R', '!', '$', '*', ']', ';', '_',
36     ' ', '/', 'S', 'T', 'U', 'V', 'W', 'X',
37     'Y', 'Z', '|', ',', '%', '~', '\\', '"',
38     };
39 
40 const char nine_to_ascii_h[64] = {
41     '0', '1', '2', '3', '4', '5', '6', '7',
42     '8', '9', '^', '=', '\'', ':', '>', '{',
43     '+', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
44     'H', 'I', '?', '.', ')', '[', '<', '}',
45     '-', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
46     'Q', 'R', '!', '$', '*', ']', ';', '_',
47     ' ', '/', 'S', 'T', 'U', 'V', 'W', 'X',
48     'Y', 'Z', '|', ',', '(', '~', '\\', '"',
49     };
50 
51 /* ASCII to nine-code conversion */
52 
53 const char ascii_to_nine[128] = {
54     060, 060, 060, 060, 060, 060, 060, 060,             /* 000 - 037 */
55     060, 060, 060, 060, 060, 060, 060, 060,
56     060, 060, 060, 060, 060, 060, 060, 060,
57     060, 060, 060, 060, 060, 060, 060, 060,
58     060, 052, 077, 013, 053, 074, 020, 014,             /* 040 - 077 */
59     074, 034, 054, 020, 073, 040, 033, 061,
60     000, 001, 002, 003, 004, 005, 006, 007,
61     010, 011, 015, 056, 036, 013, 016, 032,
62     014, 021, 022, 023, 024, 025, 026, 027,             /* 100 - 137 */
63     030, 031, 041, 042, 043, 044, 045, 046,
64     047, 050, 051, 062, 063, 064, 065, 066,
65     067, 070, 071, 035, 076, 055, 012, 057,
66     060, 021, 022, 023, 024, 025, 026, 027,             /* 140 - 177 */
67     030, 031, 041, 042, 043, 044, 045, 046,
68     047, 050, 051, 062, 063, 064, 065, 066,
69     067, 070, 071, 017, 072, 037, 075, 060
70     };
71 
72 /* ASCII to BCD conversion */
73 
74 const char ascii_to_bcd[128] = {
75     000, 000, 000, 000, 000, 000, 000, 000,             /* 000 - 037 */
76     000, 000, 000, 000, 000, 000, 000, 000,
77     000, 000, 000, 000, 000, 000, 000, 000,
78     000, 000, 000, 000, 000, 000, 000, 000,
79     000, 052, 037, 013, 053, 074, 060, 014,             /* 040 - 077 */
80     034, 074, 054, 060, 033, 040, 073, 021,
81     020, 001, 002, 003, 004, 005, 006, 007,
82     010, 011, 015, 056, 076, 013, 016, 072,
83     014, 061, 062, 063, 064, 065, 066, 067,             /* 100 - 137 */
84     070, 071, 041, 042, 043, 044, 045, 046,
85     047, 050, 051, 022, 023, 024, 025, 026,
86     027, 030, 031, 075, 036, 055, 012, 057,
87     000, 061, 062, 063, 064, 065, 066, 067,             /* 140 - 177 */
88     070, 071, 041, 042, 043, 044, 045, 046,
89     047, 050, 051, 022, 023, 024, 025, 026,
90     027, 030, 031, 017, 032, 077, 035, 000
91     };
92 
93 /* BCD to ASCII conversion */
94 
95 const char bcd_to_ascii_a[64] = {
96     ' ', '1', '2', '3', '4', '5', '6', '7',
97     '8', '9', '^', '#', '@', ':', '>', '{',
98     '0', '/', 'S', 'T', 'U', 'V', 'W', 'X',
99     'Y', 'Z', '|', ',', '%', '~', '\\', '"',
100     '-', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
101     'Q', 'R', '!', '$', '*', ']', ';', '_',
102     '&', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
103     'H', 'I', '?', '.', ')', '[', '<', '}'
104     };
105 
106 const char bcd_to_ascii_h[64] = {
107     ' ', '1', '2', '3', '4', '5', '6', '7',
108     '8', '9', '^', '=', '\'', ':', '>', '{',
109     '0', '/', 'S', 'T', 'U', 'V', 'W', 'X',
110     'Y', 'Z', '|', ',', '(', '~', '\\', '"',
111     '-', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
112     'Q', 'R', '!', '$', '*', ']', ';', '_',
113     '+', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
114     'H', 'I', '?', '.', ')', '[', '<', '}'
115     };
116 
117 /* BCD to ASCII 48 character print chains */
118 
119 const char bcd_to_pca[64] = {
120     ' ', '1', '2', '3', '4', '5', '6', '7',
121     '8', '9', ' ', '#', '@', ' ', ' ', ' ',
122     '0', '/', 'S', 'T', 'U', 'V', 'W', 'X',
123     'Y', 'Z', ' ', ',', '%', ' ', ' ', ' ',
124     '-', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
125     'Q', 'R', '-', '$', '*', ' ', ' ', ' ',
126     '&', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
127     'H', 'I', '&', '.', ')', ' ', ' ', ' '
128     };
129 
130 const char bcd_to_pch[64] = {
131     ' ', '1', '2', '3', '4', '5', '6', '7',
132     '8', '9', ' ', '=', '\'', ' ', ' ', ' ',
133     '0', '/', 'S', 'T', 'U', 'V', 'W', 'X',
134     'Y', 'Z', ' ', ',', '(', ' ', ' ', ' ',
135     '-', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
136     'Q', 'R', '-', '$', '*', ' ', ' ', ' ',
137     '&', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
138     'H', 'I', '&', '.', ')', ' ', ' ', ' '
139     };
140 
141 /* BCD to column binary conversion */
142 
143 const uint32 bcd_to_colbin[64] = {
144     00000, 00400, 00200, 00100, 00040, 00020, 00010, 00004,
145     00002, 00001, 00202, 00102, 00042, 00022, 00012, 00006,
146     01000, 01400, 01200, 01100, 01040, 01020, 01010, 01004,
147     01002, 01001, 01202, 01102, 01042, 01022, 01012, 01006,
148     02000, 02400, 02200, 02100, 02040, 02020, 02010, 02004,
149     02002, 02001, 02202, 02102, 02042, 02022, 02012, 02006,
150     04000, 04400, 04200, 04100, 04040, 04020, 04010, 04004,
151     04002, 04001, 04202, 04102, 04042, 04022, 04012, 04006
152     };
153