-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathatascii.py
138 lines (136 loc) · 9.46 KB
/
atascii.py
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
# From https://github.com/kenjennings/Atari-Font-To-Code/blob/master/E000.c
# Wikipedia shows chars in more conventional order, which we'll also use
# https://en.wikipedia.org/wiki/ATASCII
atascii = bytes([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # 0x00: SPACE */
0x00, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x00, # 0x01: ! */
0x00, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, # 0x02: " */
0x00, 0x66, 0xff, 0x66, 0x66, 0xff, 0x66, 0x00, # 0x03: # */
0x18, 0x3e, 0x60, 0x3c, 0x06, 0x7c, 0x18, 0x00, # 0x04: $ */
0x00, 0x66, 0x6c, 0x18, 0x30, 0x66, 0x46, 0x00, # 0x05: % */
0x1c, 0x36, 0x1c, 0x38, 0x6f, 0x66, 0x3b, 0x00, # 0x06: & */
0x00, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, # 0x07: ' */
0x00, 0x0e, 0x1c, 0x18, 0x18, 0x1c, 0x0e, 0x00, # 0x08: ( */
0x00, 0x70, 0x38, 0x18, 0x18, 0x38, 0x70, 0x00, # 0x09: ) */
0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00, # 0x0a: * */
0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, # 0x0b: + */
0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, # 0x0c: , */
0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, # 0x0d: - */
0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, # 0x0e: . */
0x00, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x40, 0x00, # 0x0f: / */
0x00, 0x3c, 0x66, 0x6e, 0x76, 0x66, 0x3c, 0x00, # 0x10: 0 */
0x00, 0x18, 0x38, 0x18, 0x18, 0x18, 0x7e, 0x00, # 0x11: 1 */
0x00, 0x3c, 0x66, 0x0c, 0x18, 0x30, 0x7e, 0x00, # 0x12: 2 */
0x00, 0x7e, 0x0c, 0x18, 0x0c, 0x66, 0x3c, 0x00, # 0x13: 3 */
0x00, 0x0c, 0x1c, 0x3c, 0x6c, 0x7e, 0x0c, 0x00, # 0x14: 4 */
0x00, 0x7e, 0x60, 0x7c, 0x06, 0x66, 0x3c, 0x00, # 0x15: 5 */
0x00, 0x3c, 0x60, 0x7c, 0x66, 0x66, 0x3c, 0x00, # 0x16: 6 */
0x00, 0x7e, 0x06, 0x0c, 0x18, 0x30, 0x30, 0x00, # 0x17: 7 */
0x00, 0x3c, 0x66, 0x3c, 0x66, 0x66, 0x3c, 0x00, # 0x18: 8 */
0x00, 0x3c, 0x66, 0x3e, 0x06, 0x0c, 0x38, 0x00, # 0x19: 9 */
0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, # 0x1a: : */
0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x30, # 0x1b: ; */
0x06, 0x0c, 0x18, 0x30, 0x18, 0x0c, 0x06, 0x00, # 0x1c: < */
0x00, 0x00, 0x7e, 0x00, 0x00, 0x7e, 0x00, 0x00, # 0x1d: = */
0x60, 0x30, 0x18, 0x0c, 0x18, 0x30, 0x60, 0x00, # 0x1e: > */
0x00, 0x3c, 0x66, 0x0c, 0x18, 0x00, 0x18, 0x00, # 0x1f: ? */
0x00, 0x3c, 0x66, 0x6e, 0x6e, 0x60, 0x3e, 0x00, # 0x20: @ */
0x00, 0x18, 0x3c, 0x66, 0x66, 0x7e, 0x66, 0x00, # 0x21: A */
0x00, 0x7c, 0x66, 0x7c, 0x66, 0x66, 0x7c, 0x00, # 0x22: B */
0x00, 0x3c, 0x66, 0x60, 0x60, 0x66, 0x3c, 0x00, # 0x23: C */
0x00, 0x78, 0x6c, 0x66, 0x66, 0x6c, 0x78, 0x00, # 0x24: D */
0x00, 0x7e, 0x60, 0x7c, 0x60, 0x60, 0x7e, 0x00, # 0x25: E */
0x00, 0x7e, 0x60, 0x7c, 0x60, 0x60, 0x60, 0x00, # 0x26: F */
0x00, 0x3e, 0x60, 0x60, 0x6e, 0x66, 0x3e, 0x00, # 0x27: G */
0x00, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00, # 0x28: H */
0x00, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x00, # 0x29: I */
0x00, 0x06, 0x06, 0x06, 0x06, 0x66, 0x3c, 0x00, # 0x2a: J */
0x00, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0x00, # 0x2b: K */
0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7e, 0x00, # 0x2c: L */
0x00, 0x63, 0x77, 0x7f, 0x6b, 0x63, 0x63, 0x00, # 0x2d: M */
0x00, 0x66, 0x76, 0x7e, 0x7e, 0x6e, 0x66, 0x00, # 0x2e: N */
0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, # 0x2f: O */
0x00, 0x7c, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x00, # 0x30: P */
0x00, 0x3c, 0x66, 0x66, 0x66, 0x6c, 0x36, 0x00, # 0x31: Q */
0x00, 0x7c, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x00, # 0x32: R */
0x00, 0x3c, 0x60, 0x3c, 0x06, 0x06, 0x3c, 0x00, # 0x33: S */
0x00, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, # 0x34: T */
0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7e, 0x00, # 0x35: U */
0x00, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, # 0x36: V */
0x00, 0x63, 0x63, 0x6b, 0x7f, 0x77, 0x63, 0x00, # 0x37: W */
0x00, 0x66, 0x66, 0x3c, 0x3c, 0x66, 0x66, 0x00, # 0x38: X */
0x00, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x00, # 0x39: Y */
0x00, 0x7e, 0x0c, 0x18, 0x30, 0x60, 0x7e, 0x00, # 0x3a: Z */
0x00, 0x1e, 0x18, 0x18, 0x18, 0x18, 0x1e, 0x00, # 0x3b: [ */
0x00, 0x40, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x00, # 0x3c: \ */
0x00, 0x78, 0x18, 0x18, 0x18, 0x18, 0x78, 0x00, # 0x3d: ] */
0x00, 0x08, 0x1c, 0x36, 0x63, 0x00, 0x00, 0x00, # 0x3e: ^ */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, # 0x3f: _ */
0x00, 0x36, 0x7f, 0x7f, 0x3e, 0x1c, 0x08, 0x00, # 0x40: ctrl-, */
0x18, 0x18, 0x18, 0x1f, 0x1f, 0x18, 0x18, 0x18, # 0x41: ctrl-A */
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, # 0x42: ctrl-B */
0x18, 0x18, 0x18, 0xf8, 0xf8, 0x00, 0x00, 0x00, # 0x43: ctrl-C */
0x18, 0x18, 0x18, 0xf8, 0xf8, 0x18, 0x18, 0x18, # 0x44: ctrl-D */
0x00, 0x00, 0x00, 0xf8, 0xf8, 0x18, 0x18, 0x18, # 0x45: ctrl-E */
0x03, 0x07, 0x0e, 0x1c, 0x38, 0x70, 0xe0, 0xc0, # 0x46: ctrl-F */
0xc0, 0xe0, 0x70, 0x38, 0x1c, 0x0e, 0x07, 0x03, # 0x47: ctrl-G */
0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff, # 0x48: ctrl-H */
0x00, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x0f, 0x0f, # 0x49: ctrl-I */
0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff, # 0x4a: ctrl-J */
0x0f, 0x0f, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x00, # 0x4b: ctrl-K */
0xf0, 0xf0, 0xf0, 0xf0, 0x00, 0x00, 0x00, 0x00, # 0x4c: ctrl-L */
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, # 0x4d: ctrl-M */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, # 0x4e: ctrl-N */
0x00, 0x00, 0x00, 0x00, 0xf0, 0xf0, 0xf0, 0xf0, # 0x4f: ctrl-O */
0x00, 0x1c, 0x1c, 0x77, 0x77, 0x08, 0x1c, 0x00, # 0x50: ctrl-P */
0x00, 0x00, 0x00, 0x1f, 0x1f, 0x18, 0x18, 0x18, # 0x51: ctrl-Q */
0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, # 0x52: ctrl-R */
0x18, 0x18, 0x18, 0xff, 0xff, 0x18, 0x18, 0x18, # 0x53: ctrl-S */
0x00, 0x00, 0x3c, 0x7e, 0x7e, 0x7e, 0x3c, 0x00, # 0x54: ctrl-T */
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, # 0x55: ctrl-U */
0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, # 0x56: ctrl-V */
0x00, 0x00, 0x00, 0xff, 0xff, 0x18, 0x18, 0x18, # 0x57: ctrl-W */
0x18, 0x18, 0x18, 0xff, 0xff, 0x00, 0x00, 0x00, # 0x58: ctrl-X */
0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, # 0x59: ctrl-Y */
0x18, 0x18, 0x18, 0x1f, 0x1f, 0x00, 0x00, 0x00, # 0x5a: ctrl-Z */
0x78, 0x60, 0x78, 0x60, 0x7e, 0x18, 0x1e, 0x00, # 0x5b: ESCAPE */
0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x00, # 0x5c: UP */
0x00, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, # 0x5d: DOWN */
0x00, 0x18, 0x30, 0x7e, 0x30, 0x18, 0x00, 0x00, # 0x5e: LEFT */
0x00, 0x18, 0x0c, 0x7e, 0x0c, 0x18, 0x00, 0x00, # 0x5f: RIGHT */
0x00, 0x18, 0x3c, 0x7e, 0x7e, 0x3c, 0x18, 0x00, # 0x60: ctrl-. */
0x00, 0x00, 0x3c, 0x06, 0x3e, 0x66, 0x3e, 0x00, # 0x61: a */
0x00, 0x60, 0x60, 0x7c, 0x66, 0x66, 0x7c, 0x00, # 0x62: b */
0x00, 0x00, 0x3c, 0x60, 0x60, 0x60, 0x3c, 0x00, # 0x63: c */
0x00, 0x06, 0x06, 0x3e, 0x66, 0x66, 0x3e, 0x00, # 0x64: d */
0x00, 0x00, 0x3c, 0x66, 0x7e, 0x60, 0x3c, 0x00, # 0x65: e */
0x00, 0x0e, 0x18, 0x3e, 0x18, 0x18, 0x18, 0x00, # 0x66: f */
0x00, 0x00, 0x3e, 0x66, 0x66, 0x3e, 0x06, 0x7c, # 0x67: g */
0x00, 0x60, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x00, # 0x68: h */
0x00, 0x18, 0x00, 0x38, 0x18, 0x18, 0x3c, 0x00, # 0x69: i */
0x00, 0x06, 0x00, 0x06, 0x06, 0x06, 0x06, 0x3c, # 0x6a: j */
0x00, 0x60, 0x60, 0x6c, 0x78, 0x6c, 0x66, 0x00, # 0x6b: k */
0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, # 0x6c: l */
0x00, 0x00, 0x66, 0x7f, 0x7f, 0x6b, 0x63, 0x00, # 0x6d: m */
0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x00, # 0x6e: n */
0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x00, # 0x6f: o */
0x00, 0x00, 0x7c, 0x66, 0x66, 0x7c, 0x60, 0x60, # 0x70: p */
0x00, 0x00, 0x3e, 0x66, 0x66, 0x3e, 0x06, 0x06, # 0x71: q */
0x00, 0x00, 0x7c, 0x66, 0x60, 0x60, 0x60, 0x00, # 0x72: r */
0x00, 0x00, 0x3e, 0x60, 0x3c, 0x06, 0x7c, 0x00, # 0x73: s */
0x00, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x0e, 0x00, # 0x74: t */
0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x00, # 0x75: u */
0x00, 0x00, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, # 0x76: v */
0x00, 0x00, 0x63, 0x6b, 0x7f, 0x3e, 0x36, 0x00, # 0x77: w */
0x00, 0x00, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0x00, # 0x78: x */
0x00, 0x00, 0x66, 0x66, 0x66, 0x3e, 0x0c, 0x78, # 0x79: y */
0x00, 0x00, 0x7e, 0x0c, 0x18, 0x30, 0x7e, 0x00, # 0x7a: z */
0x00, 0x18, 0x3c, 0x7e, 0x7e, 0x18, 0x3c, 0x00, # 0x7b: ctrl-; */
0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, # 0x7c: | */
0x00, 0x7e, 0x78, 0x7c, 0x6e, 0x66, 0x06, 0x00, # 0x7d: CLEAR */
0x08, 0x18, 0x38, 0x78, 0x38, 0x18, 0x08, 0x00, # 0x7e: DELETE */
0x10, 0x18, 0x1c, 0x1e, 0x1c, 0x18, 0x10, 0x00, # 0x7f: TAB */
])
atascii = atascii[0x200:0x300] + atascii[:0x200] + atascii[0x300:]
open('atascii.dat', 'wb').write(atascii)
print(len(atascii))