forked from MEGA65/mega65-user-guide
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appendix-petsciicodes.tex
532 lines (492 loc) · 19 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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
\chapter{Special Keyboard Controls and Sequences}
\section{PETSCII Codes and CHR\$}
\label{appendix:asciicodes}
In BASIC, \screentext{PRINT CHR\$(X)} can be used to print a character from a PETSCII code.
Below is the full table of PETSCII codes you can print by index. For example, while in the default uppercase/graphics mode, by
using index 65 from the table below as: \screentext{PRINT CHR\$(65)} you will
print the letter \screentext{A}. You can read more about {\bf CHR\$} on page \pageref{chrcommand}.
You can also do the reverse with the ASC statement. For example:
\screentext{PRINT ASC("A")} will output \screentext{65}, which matches the
code in the table.
\underline{Note}: Function key (F1-F14 + HELP) values in this table are not intended to be printed via \screentext{CHR\$()},
but rather to allow function-key input to be assessed in BASIC programs via the GET / GETKEY commands.
\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$}
\item [96] \graphicsymbol{C}
\item [97] \graphicsymbol{A}
\item [98] \graphicsymbol{B}
\item [99] \graphicsymbol{C}
\item [100] \graphicsymbol{D}
\item [101] \graphicsymbol{E}
\item [102] \graphicsymbol{F}
\item [103] \graphicsymbol{G}
\item [104] \graphicsymbol{H}
\item [105] \graphicsymbol{I}
\item [106] \graphicsymbol{J}
\item [107] \graphicsymbol{K}
\item [108] \graphicsymbol{L}
\item [109] \graphicsymbol{M}
\item [110] \graphicsymbol{N}
\item [111] \graphicsymbol{O}
\item [112] \graphicsymbol{P}
\item [113] \graphicsymbol{Q}
\item [114] \graphicsymbol{R}
\item [115] \graphicsymbol{S}
\item [116] \graphicsymbol{T}
\item [117] \graphicsymbol{U}
\item [118] \graphicsymbol{V}
\item [119] \graphicsymbol{W}
\item [120] \graphicsymbol{X}
\item [121] \graphicsymbol{Y}
\item [122] \graphicsymbol{Z}
\item [123] \graphicsymbol{+}
\item [124] \graphicsymbol{-}
\item [125] \graphicsymbol{B}
\item [126] \graphicsymbol{\textbackslash}
\item [127] \graphicsymbol{]}
\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{v}
\item [171] \graphicsymbol{q}
\item [172] \graphicsymbol{d}
\item [173] \graphicsymbol{z}
\item [174] \graphicsymbol{s}
\item [175] \graphicsymbol{n}
\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{p}
\item [186] \graphicsymbol{\{}
\item [187] \graphicsymbol{f}
\item [188] \graphicsymbol{c}
\item [189] \graphicsymbol{x}
\item [190] \graphicsymbol{v}
\item [191] \graphicsymbol{b}
\end{description}
\end{multicols}
\end{adjustwidth}
\underline{Note 1}: Codes from 192 to 223 are equal to 96 to 127. Codes from 224 to 254 are equal to 160 to 190,
and code 255 is equal to 126.
\underline{Note 2}: 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.
\end{itemize}
\section{Control codes}
\label{appendix:controlcodes}
\index{Keyboard!CTRL}
\begin{center}
\setlength{\def\arraystretch{1.5}\tabcolsep}{6pt}
\begin{longtable}{c|L{5.5cm}}
\textbf{Keyboard Control} & \textbf{Function}\\
\hhline{==}
\endhead
\multicolumn{2}{l}{\textbf{Colours}} \\
\hhline{==}
\specialkey{CTRL} + \megakey{1} to \megakey{8} &
Choose from the first range of colours. More information on the colours
available is under the BASIC {\bf BACKGROUND} command on page \pageref{colourtable}.\\
\hline
\megasymbolkey + \megakey{1} to \megakey{8} &
Choose from the second range of colours. \\
\hline
\specialkey{CTRL} + \megakey{E} &
Restores the colour of the cursor back to the default (white).\\
\hline
\specialkey{CTRL} + \megakey{D} &
Switches the VIC-IV to colour range 0-15 (default colours). These colours can be accessed with \specialkey{CTRL} and keys \megakey{1} to \megakey{8} (for the first 8 colours), or \megasymbolkey and keys \megakey{1} to \megakey{8} (for the remaining 8 colours).\\
\hline
\specialkey{CTRL} + \megakey{A} &
Switches the VIC-IV to colour range 16-31 (alternate/rainbow colours). These colours can be accessed with \specialkey{CTRL} and keys \megakey{1} to \megakey{8} (for the first 8 colours), or \megasymbolkey and keys \megakey{1} to \megakey{8} (for the remaining 8 colours).\\
\hhline{==}
\multicolumn{2}{l}{\textbf{Tabs}} \\
\hhline{==}
\specialkey{CTRL} + \megakey{Z} &
Tabs the cursor to the left. If there are no tab positions remaining, the cursor will remain at the start of the line.\\
\hline
\specialkey{CTRL} + \megakey{I} &
Tabs the cursor to the right. If there are no tab positions remaining, the cursor will remain at the end of the line.\\
\hline
\specialkey{CTRL} + \megakey{X} &
Sets or clears the current screen column as a tab position.
Use \specialkey{CTRL} +\megakey{Z} and \megakey{I} to jump back and forth to all positions set with \megakey{X}.\\
\hhline{==}
\multicolumn{2}{l}{\textbf{Movement}} \\
\hhline{==}
\specialkey{CTRL} + \megakey{Q} &
Moves the cursor down one line at a time. Equivalent to \megakey{$\downarrow$}.\\
\hline
\specialkey{CTRL} + \megakey{J} &
Moves the cursor down a position. If you are on a long line of BASIC code that has extended to two lines, then the cursor will move down two rows to be on the next line.\\
\hline
\specialkey{CTRL} + \megakey{]} &
Equivalent to \megakey{$\rightarrow$}.\\
\hline
\specialkey{CTRL} + \megakey{T} &
Backspace the character immediately to the left and to shift all rightmost characters one position to the left. This is equivalent to \specialkey{INST DEL}.\\
\hline
\specialkey{CTRL} + \megakey{M} &
Performs a carriage return, equivalent to \specialkey{RETURN}.\\
\hhline{==}
\multicolumn{2}{l}{\textbf{Word movement}} \\
\hhline{==}
\specialkey{CTRL} + \megakey{U} &
Moves the cursor back to the start of the previous word. If there are no words
between the current cursor position and the start of the line, the cursor will move to the first column of the current line.\\
\hline
\specialkey{CTRL} + \megakey{W} &
Advances the cursor forward to the start of the next word. If there are no words between the cursor and the end of the line,
the cursor will move to the first column of the next line.\\
\hhline{==}
\multicolumn{2}{l}{\textbf{Scrolling}} \\
\hhline{==}
\specialkey{CTRL} + \megakey{P} &
Scroll BASIC listing down one line. Equivalent to \megakey{F9}.\\
\hline
\specialkey{CTRL} + \megakey{V} &
Scroll BASIC listing up one line. Equivalent to \megakey{F11}.\\
\hline
\specialkey{CTRL} + \megakey{S} &
Equivalent to \specialkey{NO\\SCROLL}.\\
\hhline{==}
\multicolumn{2}{l}{\textbf{Formatting}} \\
\hhline{==}
\specialkey{CTRL} + \megakey{B} &
Enables underline text mode. You can disable underline mode by pressing \specialkey{ESC}, then \megakey{O}.\\
\hline
\specialkey{CTRL} + \megakey{O} &
Enables flashing text mode. You can disable flashing mode by pressing \specialkey{ESC}, then \megakey{O}.\\
\hline
\hhline{==}
\multicolumn{2}{l}{\textbf{Casing}} \\
\hhline{==}
\specialkey{CTRL} + \megakey{N} &
Changes the text case mode from uppercase to lowercase.\\
\hline
\specialkey{CTRL} + \megakey{K} &
Locks the uppercase/lowercase mode switch usually performed with \megasymbolkey + \specialkey{SHIFT}.\\
\hline
\specialkey{CTRL} + \megakey{L} &
Enables the uppercase/lowercase mode switch that is performed with the \megasymbolkey + \specialkey{SHIFT}.\\
\hhline{==}
\multicolumn{2}{l}{\textbf{Miscellaneous}} \\
\hhline{==}
\specialkey{CTRL} + \megakey{G} &
Produces a bell tone.\\
\hline
\specialkey{CTRL} + \megakey{[} &
Equivalent to pressing \specialkey{ESC}.\\
\hline
\specialkey{CTRL} + \megakey{*} &
Enters the Matrix Mode Debugger.\\
\hline
\end{longtable}
\end{center}
\section{Shifted codes}
\label{appendix:shiftedcodes}
\index{Keyboard!Shift Keys}
\begin{center}
\setlength{\def\arraystretch{1.5}\tabcolsep}{6pt}
\begin{longtable}{c|L{5.5cm}}
\textbf{Keyboard Control} & \textbf{Function}\\
\hhline{==}
\endhead
\specialkey{SHIFT} + \specialkey{INST DEL} &
Insert a character at the current cursor position and move all characters to the right by one position.\\
\hline
\specialkey{SHIFT} + \specialkey{HOME} &
Clear home, clear the entire screen, and move the cursor to the home position.\\
\hline
\end{longtable}
\end{center}
\section{Escape Sequences}
\label{escape-sequences}
\index{Keyboard!Escape Sequences}
To perform an Escape Sequence, press and release \specialkey{ESC},
then press one of the following keys to perform the sequence:
\begin{center}
\setlength{\def\arraystretch{1.5}\tabcolsep}{6pt}
\begin{longtable}{c|L{5.5cm}}
\textbf{Key} & \textbf{Sequence}\\
\hhline{==}
\endhead
\multicolumn{2}{l}{\textbf{Editor behaviour}} \\
\hhline{==}
\specialkey{ESC} \megakey{X} &
Clears the screen and toggles between 40 $\times$ 25 and 80 $\times$ 25 text modes.\\
\hline
\specialkey{ESC} \megakey{4} &
Clears the screen and switches to 40 $\times$ 25 text mode.\\
\hline
\specialkey{ESC} \megakey{8} &
Clears the screen and switches to 80 $\times$ 25 text mode.\\
\hline
\specialkey{ESC} \megakey{5} &
Switches to 80 $\times$ 50 text mode.\\
\hline
\multicolumn{2}{L{7cm}}{
Note that some programs expect to be started in 80 $\times$ 25 mode,
and may not behave correctly when started in 80 $\times$ 50 mode.} \\
\hline
\specialkey{ESC} \megakey{@} &
%TODO the megakey with @ shows the label far smaller than any other key.
% Perhaps it needs more styling?
Clears a region of the screen, starting from the current cursor position, to the end of the screen.\\
\hline
\specialkey{ESC} \megakey{O} &
Cancels the quote, reverse, underline, and flash modes.\\
\hhline{==}
\multicolumn{2}{l}{\textbf{Scrolling}} \\
\hhline{==}
% TODO for some reason this doesn't leave enough space (the keys overlap with the hhline)
\specialkey{ESC} \megakey{V} &
Scrolls the entire screen up one line.\\
\hline
\specialkey{ESC} \megakey{W} &
Scrolls the entire screen down one line.\\
\hline
\specialkey{ESC} \megakey{L} &
Enables scrolling when \megakey{$\downarrow$} is pressed at the bottom of the screen.\\
\hline
\specialkey{ESC} \megakey{M} &
Disables scrolling. When pressing \megakey{$\downarrow$} at the bottom of the screen, the cursor will move to the top of the
screen. However, when pressing \megakey{$\uparrow$} at the top of the screen, the cursor will remain on the first line.\\
\hhline{==}
\multicolumn{2}{l}{\textbf{Insertion and deletion}} \\
\hhline{==}
\specialkey{ESC} \megakey{I} &
Inserts an empty line at the current cursor position and moves all subsequent lines down one position.\\
\hline
\specialkey{ESC} \megakey{D} &
Deletes the current line and moves lines below the cursor up one position.\\
\hline
\specialkey{ESC} \megakey{P} &
Erases all characters from the cursor to the start of the current line.\\
\hline
\specialkey{ESC} \megakey{Q} &
Erases all characters from the cursor to the end of the current line.\\
\hhline{==}
\multicolumn{2}{l}{\textbf{Movement}} \\
\hhline{==}
\specialkey{ESC} \megakey{J} &
Moves the cursor to the start of the current line.\\
\hline
\specialkey{ESC} \megakey{K} &
Moves the cursor to the last non-whitespace character on the current line.\\
\hline
\specialkey{ESC} \megakeywhite{$\uparrow$} &
\index{Keyboard!Cursor Keys}
Saves the current cursor position. Use \specialkey{ESC} \megakeywhite{$\leftarrow$} (next to \megakey{1}) to move it
back
to the saved position. Note that the \megakeywhite{$\uparrow$} used here is next to \widekey{RESTORE}.\\
\hline
\specialkey{ESC} \megakeywhite{$\leftarrow$} &
Restores the cursor position to the position stored via a prior a press of the \specialkey{ESC}
\megakeywhite{$\uparrow$}
(next to \widekey{RESTORE}) key sequence. Note that the \megakeywhite{$\leftarrow$} used here is next to \megakey{1}.\\
\hline
\specialkey{ESC} \specialkey{HOME} &
Restores the cursor position to the position stored via a prior a press of \specialkey{HOME}.\\
\hhline{==}
\multicolumn{2}{l}{\textbf{Windowing}} \\
\hhline{==}
\specialkey{ESC} \megakey{T} &
Sets the top-left corner of the windowed area.
All typed characters and screen activity will be restricted to the area. Also see \specialkey{ESC} \megakey{B}.
Windowed mode can be disabled by pressing \specialkey{CLR HOME} twice. \\
\hline
\specialkey{ESC} \megakey{B} &
Sets the bottom right corner of the windowed area.
All typed characters and screen activity will be restricted to the area. Also see \specialkey{ESC} \megakey{T}.
Windowed mode can be disabled by pressing \specialkey{CLR HOME} twice.\\
\hhline{==}
\multicolumn{2}{l}{\textbf{Cursor behaviour}} \\
\hhline{==}
\specialkey{ESC} \megakey{A} &
Enables auto-insert mode. Any keys pressed will be inserted at the current cursor position, shifting all characters
on the current line after the cursor to the right by one position.\\
\hline
\specialkey{ESC} \megakey{C} &
Disables auto-insert mode, reverting back to overwrite mode.\\
\hline
\specialkey{ESC} \megakey{E} &
Sets the cursor to non-flashing mode.\\
\hline
\specialkey{ESC} \megakey{F} &
Sets the cursor to regular flashing mode.\\
\hhline{==}
\multicolumn{2}{l}{\textbf{Bell behaviour}} \\
\hhline{==}
\specialkey{ESC} \megakey{G} &
Enables the bell which can be sounded using \specialkey{CTRL} and \megakey{G}.\\
\hline
\specialkey{ESC} \megakey{H} &
Disable the bell so that pressing \specialkey{CTRL} and \megakey{G} will have no effect.\\
\hhline{==}
\multicolumn{2}{l}{\textbf{Colours}} \\
\hhline{==}
\specialkey{ESC} \megakey{U} &
\label{appendix:escape-colours}
Switches the VIC-IV to colour range 0-15 (default colours). These colours can be accessed with \specialkey{CTRL} and keys \megakey{1} to \megakey{8} (for the first 8 colours), or \megasymbolkey and keys \megakey{1} to \megakey{8} (for the remaining colours).\\
\hline
\specialkey{ESC} \megakey{S} &
Switches the VIC-IV to colour range 16-31 (alternate/rainbow colours). These colours can be accessed with \specialkey{CTRL} and keys \megakey{1} to \megakey{8} (for the first 8 colours), or \megasymbolkey and keys \megakey{1} to \megakey{8} (for the remaining colours).\\
\hline
\hhline{==}
\multicolumn{2}{l}{\textbf{Tabs}} \\
\hhline{==}
\specialkey{ESC} \megakey{Y} &
Set the default tab stops (every 8 spaces) for the entire screen.\\
\hline
\specialkey{ESC} \megakey{Z} &
Clears all tab stops. Any tabbing with \specialkey{CTRL} and \megakey{I} will move the cursor to the end of the line.\\
\hline
\end{longtable}
\end{center}