-
Notifications
You must be signed in to change notification settings - Fork 50
/
appendix-petsciicodes.tex
233 lines (222 loc) · 8.04 KB
/
appendix-petsciicodes.tex
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
\chapter{PETSCII Codes}
\section{PETSCII Codes}
PETSCII is the character data encoding used by Commodore 8-bit computers. It includes printable characters such as letters, numbers, punctuation, and graphical symbols, control codes to change display parameters and manipulate the cursor of the screen editor, and representations of keystrokes that can be input by the keyboard. A program can use PETSCII codes for screen output, keyboard input, or for reading and writing character data in files or serial communication.
In BASIC, the \textbf{CHR\$()} function accepts a PETSCII code and evaluates to that code in a string. For example, \texttt{PRINT CHR\$(65)} will print the letter \screentext{A}. The \textbf{ASC()} function accepts a one-character string and evaluates to the number for the PETSCII code. The \textbf{GET} and \textbf{GETKEY} commands read a keystroke entered by the keyboard and return the corresponding PETSCII code.
Machine code programs can use the GETIN KERNAL routine or the PETSCIIKEY hardware register to read keyboard input as PETSCII codes.
\index{Keyboard!PETSCII Codes and CHR\$}
\begin{adjustwidth}{}{-2cm}
\begin{multicols}{4}
\begin{description}[align=left,labelwidth=0.2cm]
\item [0]
\item [1] \small{ALTERNATE PALETTE}
\item [2] \small{UNDERLINE ON}
\item [3]
\item [4] \small{DEFAULT PALETTE}
\item [5] \small{WHITE}
\item [6]
\item [7] \small{BELL}
\item [8]
\item [9] \specialkey{TAB}
\item [10] \small{LINEFEED}
% \item [11] \footnotesize{DISABLE \specialkey{SHIFT}\megasymbolkey}
\item [11] DISABLE \\ \specialkey{SHIFT}\megasymbolkey
% \item [12] \footnotesize{ENABLE \specialkey{SHIFT}\megasymbolkey}
\item [12] ENABLE \\ \specialkey{SHIFT}\megasymbolkey
\item [13] \specialkey{RETURN}
\item [14] \small{LOWER CASE}
\item [15] \small{BLINK/FLASH ON}
\item [16] F9
\item [17] \megakey{$\downarrow$}
\item [18] \specialkey{RVS ON}
\item [19] \specialkey{CLR\\HOME}
\item [20] \specialkey{INST\\DEL}
\item [21] F10 / BACK WORD
\item [22] F11
\item [23] F12 / NEXT WORD
\item [24] SET/CLEAR TAB
\item [25] F13
\item [26] F14 / BACK TAB
\item [27] \small{ESCAPE}
\item [28] \small{RED}
\item [29] \megakey{$\rightarrow$}
\item [30] \small{GREEN}
\item [31] \small{BLUE}
\item [32] \megakey{SPACE}
\item [33] !
\item [34] "
\item [35] \#
\item [36] \$
\item [37] \%
\item [38] \&
\item [39] '
\item [40] (
\item [41] )
\item [42] *
\item [43] +
\item [44] ,
\item [45] -
\item [46] .
\item [47] /
\item [48] 0
\item [49] 1
\item [50] 2
\item [51] 3
\item [52] 4
\item [53] 5
\item [54] 6
\item [55] 7
\item [56] 8
\item [57] 9
\item [58] :
\item [59] ;
\item [60] <
\item [61] =
\item [62] >
\item [63] ?
\item [64] @
\item [65] A
\item [66] B
\item [67] C
\item [68] D
\item [69] E
\item [70] F
\item [71] G
\item [72] H
\item [73] I
\item [74] J
\item [75] K
\item [76] L
\item [77] M
\item [78] N
\item [79] O
\item [80] P
\item [81] Q
\item [82] R
\item [83] S
\item [84] T
\item [85] U
\item [86] V
\item [87] W
\item [88] X
\item [89] Y
\item [90] Z
\item [91] [
\item [92] \pounds
\item [93] ]
\item [94] \megakeywhite{$\uparrow$}
\item [95] \megakeywhite{$\leftarrow$}
\end{description}
\end{multicols}
\end{adjustwidth}
Codes 96 to 127 will print similar characters to codes 192 to 223. They are not returned as keyboard input.
\begin{adjustwidth}{}{-2cm}
\begin{multicols}{4}
\begin{description}[align=left,labelwidth=0.2cm]
\item [128]
\item [129] \small{ORANGE}
\item [130] \small{UNDERLINE OFF}
\item [131] \specialkey{SHIFT}\specialkey{RUN\\STOP}
\item [132] HELP
\item [133] F1
\item [134] F3
\item [135] F5
\item [136] F7
\item [137] F2
\item [138] F4
\item [139] F6
\item [140] F8
\item [141] \specialkey{SHIFT}\specialkey{RETURN}
\item [142] \small{UPPERCASE}
\item [143] \small{BLINK/FLASH OFF}
\item [144] \small{BLACK}
\item [145] \megakey{$\uparrow$}
\item [146] \specialkey{RVS OFF}
\item [147] \specialkey{SHIFT}\specialkey{CLR\\HOME}
\item [148] \specialkey{SHIFT}\specialkey{INST\\DEL}
\item [149] \small{BROWN}
\item [150] \small{LT. RED (PINK)}
\item [151] \small{DK. GREY}
\item [152] \small{GREY}
\item [153] \small{LT. GREEN}
\item [154] \small{LT. BLUE}
\item [155] \small{LT. GREY}
\item [156] \small{PURPLE}
\item [157] \megakey{$\leftarrow$}
\item [158] \small{YELLOW}
\item [159] \small{CYAN}
\item [160] \megakey{SPACE}
\item [161] \graphicsymbol{k}
\item [162] \graphicsymbol{i}
\item [163] \graphicsymbol{t}
\item [164] \graphicsymbol{[}
\item [165] \graphicsymbol{g}
\item [166] \graphicsymbol{<}
\item [167] \graphicsymbol{m}
\item [168] \graphicsymbol{/}
\item [169] \graphicsymbol{?}
\item [170] \graphicsymbol{m}
\item [171] \graphicsymbol{q}
\item [172] \graphicsymbol{d}
\item [173] \graphicsymbol{z}
\item [174] \graphicsymbol{s}
\item [175] \graphicsymbol{p}
\item [176] \graphicsymbol{a}
\item [177] \graphicsymbol{e}
\item [178] \graphicsymbol{r}
\item [179] \graphicsymbol{w}
\item [180] \graphicsymbol{h}
\item [181] \graphicsymbol{j}
\item [182] \graphicsymbol{l}
\item [183] \graphicsymbol{y}
\item [184] \graphicsymbol{u}
\item [185] \graphicsymbol{o}
\item [186] \graphicsymbol{\{}
\item [187] \graphicsymbol{f}
\item [188] \graphicsymbol{c}
\item [189] \graphicsymbol{x}
\item [190] \graphicsymbol{v}
\item [191] \graphicsymbol{b}
\item [192] \graphicsymbol{C}
\item [193] \graphicsymbol{A}
\item [194] \graphicsymbol{B}
\item [195] \graphicsymbol{C}
\item [196] \graphicsymbol{D}
\item [197] \graphicsymbol{E}
\item [198] \graphicsymbol{F}
\item [199] \graphicsymbol{G}
\item [200] \graphicsymbol{H}
\item [201] \graphicsymbol{I}
\item [202] \graphicsymbol{J}
\item [203] \graphicsymbol{K}
\item [204] \graphicsymbol{L}
\item [205] \graphicsymbol{M}
\item [206] \graphicsymbol{N}
\item [207] \graphicsymbol{O}
\item [208] \graphicsymbol{P}
\item [209] \graphicsymbol{Q}
\item [210] \graphicsymbol{R}
\item [211] \graphicsymbol{S}
\item [212] \graphicsymbol{T}
\item [213] \graphicsymbol{U}
\item [214] \graphicsymbol{V}
\item [215] \graphicsymbol{W}
\item [216] \graphicsymbol{X}
\item [217] \graphicsymbol{Y}
\item [218] \graphicsymbol{Z}
\item [219] \graphicsymbol{+}
\item [220] \graphicsymbol{-}
\item [221] \graphicsymbol{B}
\item [222] \graphicsymbol{\textbackslash}
\item [223] \graphicsymbol{]}
\end{description}
\end{multicols}
\end{adjustwidth}
Codes from 224 to 254 print similar characters to codes 160 to 190. They are not returned as keyboard input.
Codes 126, 222, and 255 all print as the pi symbol (\graphicsymbol{\textbackslash}). When this character is typed, the keyboard input code is 222.
While using lowercase/uppercase mode (by pressing \megasymbolkey + \specialkey{SHIFT}), be aware that:
\begin{itemize}
\item The uppercase letters in region 65-90 of the above table are replaced with lowercase letters.
\item The graphical characters in region 97-122 of the above table are replaced with uppercase letters.
\item PETSCII's lowercase (65-90) and uppercase (97-122) letters are in ASCII's uppercase (65-90) and lowercase (97-122) letter regions.
\item Several symbols have alternate symbols in the lowercase/uppercase typeface, notably PETSCII codes 126, 127, 168, and 183.
\end{itemize}