-
Notifications
You must be signed in to change notification settings - Fork 22
/
c65-rom-annotations.txt
697 lines (668 loc) · 25.3 KB
/
c65-rom-annotations.txt
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
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
# C128 memory map with info from http://www.zimmers.net/anonftp/pub/cbm/manuals/anthology/p124.jpg
2D point to start of BASIC program (bank 0?)
2E point to start of BASIC program (bank 0?), high byte
2F pointer to start of variables (bank 1?)
30 pointer to start of variables (bank 1?), high byte
31 pointer to start of arrays
32 pointer to start of arrays, high byte
33 pointer to end of arrays
34 pointer to end of arrays, high byte
35 pointer to string storage (moving down)
36 pointer to string storage (moving down), high byte
3D pointer to basic work string, low byte
3E pointer to basic work string, high byte
84 Bank number for sta_far and friends
86 Previous CPU speed ($00 = 1MHz, $40 = 3.5MHz)
D7 bit7 of $D7 set indicates 40 column mode
E0 pointer to screen line
E1 pointer to screen line, high byte
E2 pointer to colour ram for screen line
E3 pointer to colour ram for screen line, high byte
E4 screen bottom margin
E5 screen top margin
E6 screen left margin
E7 screen right margin
F4 bit7 of $F4 set indicates reverse video
1103 PAL($FF)/NTSC($00) flag
1104 C65 INIT STATUS byte (bit7 low=full init of IO, bit6 low=full init of screen editor)
02F7 jmp USR ;USR vector (must be set by application)
02FC esc_fn_vec ;Escape Function vector
02FE graphic_vector ;Graphic Kernel vector
0300 ierror ;indirect error (output error in .x)
0302 imain ;indirect main (system direct loop)
0304 icrnch ;indirect crunch (tokenization routine)
0306 iqplop ;indirect list (char list)
0308 igone ;indirect gone (char dispatch)
030A ieval ;indirect eval (symbol evaluation)
030C iesclk ;escape token crunch
030E iescpr ;escape token list
0310 iescex ;escape token execute
02FA iAutoScroll ;AutoScroll used by BASIC, Monitor, Editor
0312 itime ;(unused)
0314 iirq ;IRQ
0316 ibrk ;BRK
0318 inmi ;NMI
031A iopen
031C iclose
031E ichkin
0320 ickout
0322 iclrch
0324 ibasin
0326 ibsout
0328 istop
032A igetin
032C iclall
032E exmon ;Monitor command indirect
0330 iload
0332 isave
0334 ctlvec ;'contrl' characters
0336 shfvec ;'shiftd' characters
0338 escvec ;'escape' characters
033A keyvec ;post keyscan, pre-evaluation of keys
033C keychk ;post-evaluation, pre-buffering of keys
033E decode ;vectors to 6 keyboard matrix decode tables
1100 Vector: BASIC entry point
1102 Canary value (#$A5 after clearing ZP and stack, and setting basic entry point vectors at $110x)
1108 Vector: (points to BASIC entry point on boot)
110A Vector: (points to BASIC entry point on boot)
1127 Page number for start of screen RAM
2000 C65 BASIC vector table
2003 BASIC Warm Start?
2025 BASIC Cold Start?
2196 Print BASIC startup messages
text 2199 21b4
text 21b8 21ce
text 21d2 2202
text 2206 221a
text 221e 222e
text 2232 226c
text 2270 227f
text 2283 228f
text 2293 22d3
22F9 CHRGET routine
22FB CHRGOT routine
237e Store byte to bank held in $0084
24a4 BASIC keywords
text 24a4 27fd
text 2d02 2d08
text 2ec5 2ecb
text 2ee0 2ee8
2EF3 execute_a_line routine
233B LDA ($3D),Y from bank number loaded from $0084 (probably RAM bank $00 or $01)
2E36 BASIC error #$28
2E39 BASIC error #$11 (UNDEF'D STATEMENT?)
2E3C BASIC error #$10 (OUT OF MEMORY?)
2E3F BASIC error #$14 (DIVISION BY ZERO?)
2E42 BASIC error #$0F (OVERFLOW?)
2E45 BASIC error #$0B (SYNTAX ERROR?)
2E48 BASIC error #$80 (?? FILE NOT FOUND?)
@2F5D Execute some BASIC related(?) DMA copy.
@2F78 Select normal DMAgic COPY instruction
@2F6E DMA copy source and destination bank the same from $84
text 30d0 30e1
3101 RETURN/ENTER has been typed
3380 @ high byte of $24A4 (BASIC keyword list)
3382 @ low byte of $24A4 (BASIC keyword list)
342F @ Copy byte from $03CF to $2000
3433 @ Copy byte from $03D0 to $2001
3437 @ Copy byte from $03D1 to $2002
34A4 Put $002D-$002E into $003D-$003E
378d Print CR+LF
text 3951 3962
text 39a2 39b1
3B0B Set bit 5 in $7E
3B0E Clear bit 5 in $7E
text 42ab 42b5
4754 Do something to SID voice
47A4 Restore CPU speed to before call to $47A4
47AA Switch to 1MHz and remember whether CPU was 1MHz or 3.5MHz
text 48f2 490f
48f2 Gets copied to $1290 at $2148
text 4910 4919
4910 Gets copied to $12B8 at $2156
text 491a 491b
491a SID voice offsets from $d400?
text 62f7 62fb
661A Try to load AUTOBOOT.C65?
661C @ Select drive zero
661F @ Check if FDC is busy
6622 @ Loop while floppy controller busy
6629 @ Take branch if no disk in drive
6666 Filename "AUTOBOOT.C65*"
66C5 @ LOAD or VERIFY file?
66C8 @ LOAD or VERIFY file
66CF @ LOAD file
text 670c 6710
text 6814 6817
6814 Copied to $0124 at $3480
6F8B Preparing to LOAD BASIC program?
text 6666 6673
text 70af 70b6
data 7201 7207
7201 Some FAC value
7208 do something with a FAC
720A do something with a FAC
720C do something with a FAC
747C AND with contents of $007F, if non-zero branch to $2E45 (BASIC error #$0B)
7488 some vector table?
word 7488 74D7
74d8 Some preparation for file access?
text 76a6 76b4
data 770c 771b
770c single bit climb and descend
771c BASIC entry point from $2006 vector
text 7970 7975
text 798b 798d
text 79c2 79c4
data c0bb c7ff
c800 C65 RESET entry point
c808 @ Map ROM from $32000-$3FFFF at $2000-$FFFF, except for $C000-$DFFF
c809 @ Set 6502-like CPU state
c814 @ Mark all sub-systems as uninitialised
C81E @Take branch if stop key down
c820 @Is Commodore key down? If so ...
c825 @Neither STOP and Commodore pressed, so normal start up
c827 @STOP key is down, so check if $1102=#$A5
c829 @if $1102=#$A5, ZP, stack and basic entry point have already been set, so ...
c82c @...skip clearing memory
c845 @If STOP key is down start ML monitor
c848 Presumably start BASIC 10 ($1100)=$2000
c892 RAM Expansion is not present
c870 @ Is RAM expansion present?
c872 @ If not, then take branch
text c881 c88F
text c895 c898
CE71 Read sector from internal drive (apparently not used?)
CEE2 Wait for FDC busy flag to clear
CEE8 Enter ML monitorq
CABE read debounced value from $DD00
CAA0 Clear bit 4 in $DD00
CAA6 Set bit 4 in $DD00
CAAC Clear bit 5 in $DD00
CAB2 Set bit 5 in $DD00
CAB8 Clear bit 3 in $DD00
CAC8 Disable IRQs and switch to 3.5MHz mode?
CADB Switch to 1Mhz mode and enable IRQs?
CAF4 wait CIA1 serial port?
CB36 Delay for A raster lines
CB47 Setup user port for UART operation?
CBEB @ check UART?
CCF7 Switch to C65 DOS memory configuration
CD19 @ Map RAM @ $10000-$11FFF @ $0000-$1FFF (C65 DOS buffers)
CD1D @ Map ROM @ $20000-$203FFF @ $8000-$BFFF (C65 DOS ROMs)
CD38 Map C65 Kernel and graphics ROMs
CD9A Initialise DOS
CDA3 @ Unmap 2nd KB of colour RAM @ $DC00-$DFFF (make CIAs etc visible)
CDA8 @ Allow interrupts again, which have been blocked since switching to DOS memory map
d000 memory mapped IO
data d000 dfff
data e033 e07a
E034 low byte of offset to start of 80-column screen lines
E04C high byte of offset to start of 80-column screen lines
E065 vectors for $0334 - $033D
word e065 e06e
E06F vectors for 6 keyboard decode tables
word e06f e07a
E07b initialise editor and screen
e109 @ copy $ED6F-$EDC4 to $1000-$1065
e114 @ mark screen editor as initialised
e11a Clear screen, used by chr$($93/147)
E123 @ Are we at the last line of the screen?
E126 @ If not, then repeat for next line of screen
E128 Reset to first line of screen
E134 calculate address of current line on screen?
E136 calculate address of line X on screen ram (store in $E0/E1) and colour ram (store in $E2/E3)
E139 @ Skip over shift if in 80 column mode
E13C @ 40 column mode, so shift value right to divide by two, because 80/40=2.
E15B editor_irq ;IRQ entry
E177 get a key from IRQ buffer into .a
E19B BASIC input loop
E1A7 @ BASIC wait for keyboard input loop.
E1B7 RETURN has been pressed, so prepare to execute command
E1DF get a chr from screen line into .a
E1FE Parse line from screen?
E23D check for quote mark ($22), and toggle quote mode if required
E35F Copy colour RAM line
E35F @set memory address $Fxxx
E367 @set memory bank 1
E377 Copy screen RAM line
E38F Use DMAgic to clear current line of screen
E3B0
E406 scan keyboard subroutine
E4F9 repeat key logic & CKIT2 to store decoded key
E5A6 blink cursor?
E5FF install/remove mouse driver
data e625 e62c
e625 byte values with exactly one bit set
E614 disable mouse sprite
E62D C65 Kernel raster interrupt (scan keyboard etc?)
E6B5 A=$00 and RTS
E6B8 print character in .a
E819 Reverse OFF
E81C Reverse ON
e8bb Test if ($0354+(Y>>3)) AND (1<<(Y&7)) non-zero
E97F execute escape function using chr in .a
E9DF set top left or bottom right (.c) of window
EADF Read character from current position on screen?
EBAF display character in .a, color in .x
EBD0 get size of window (rows,cols) in .x, .y
EC03 read or set (.c) cursor position in .x, .y
EC41 redefine a programmable function key
ECCD 40/80 mode change
ED18 turn on or off (.c) soft cursor
data ed4c ed53
ed4c bytes with single bit set from $80 downto $01
data ED6F EDC6
ED6F initial values of OS variables for copying to $1000-$1065
data edde ef49
ED83 default function key strings
EDDE keyboard decode table 1
EE27 keyboard decode table 2
EE70 keyboard decode table 3
EEB9 keyboard decode table 4
EF02 keyboard decode table 6
text ED83 EDCD
data EDCE EDDD
F000 Copy Kernel IO vectors to $0314
F005 @ IF C=1, save Kernel IO vectors, else load list from $FF09
F026 @ Do something to the floppy controller
F02B @ Set DOS vectors to point to internal 1581 DOS
F037 Set DOS vectors to point to IEC routines
f043 Clear ZP, stack, and set BASIC10 entry vectors
F043 @ clear memory at $0000-$01FF
F04D @ high-byte of BASIC10 entry point
F04F @ low-byte of BASIC10 entry point
F051 @ Write basic entry point into $1100-$1101
F067 initialise far memory access routines at $0380-$03E5 (copy from $F204-$F269)
0380 (kernel routine copied from F204: Call routine in any memory context, and return in C65 ROM context?)
F204 Call routine in any memory context, and return in C65 ROM context?
039E (kernel routine copied from F222: Call routine in any memory context?)
F222 Call routine in any memory context?
03C4 (kernel routine copied from F248: map C65 ROMs)
F248 Map C65 roms
f252 DMAgic command lists that gets copied to $03CE - $03E5
data F252 f269
f255 @ DMA count of bytes
word f255 f256
word f257 f258
f257 @ DMA source address
f259 @ DMA source bank
word f259 f25a
f25a @ DMA destination address
f25b @ DMA destination bank
word f25c f25d
f25c @ DMA address modulus
f26a Use DMA controller to load memory in any bank
f28e Use DMA controller to store memory in any bank
f2b5 Use DMAgic to compare memory locations in any bank
F073 setup IO
f0c1 PAL/NTSC test: looks for the existence of raster $108
f0c6 @ Take branch if on raster $000-$0FF, i.e., wait for raster $100
f0c8 @ There are <$108 rasters on NTSC
f0cd @ take branch if on raster $108+ (i.e., a PAL machine)
f0cf @ We know we are on raster $008-$0FF or $108+, so work out which
f0d2 @ Take branch if raster $100+ to keep looking for raster $108+
f0d4 @ We never saw raster $108, so we are NTSC ($00 goes into $1103)
f0d5 @ Set PAL/NTSC flag byte
F0Eb @ Set VIC-III registers
F0F6 @ Set VIC-III to H640 + 8-bit character attributes, 1MHz CPU
F11F @ Zero left and right SID registers (1MHz clock set at $F0F6)
F12C @ Set VIC-III to H640 + 8-bit character attributes, 1MHz CPU
f133 @ Enable raster interrupts
F14E initialize VIC palette
f17b "CBM"
text f17b f17d
f17e default VIC-III register values
data f17e f1ac
f1ad VIC-III palette red
f1bd VIC-III palette green
f1cd VIC-III palette blue
data f1ad f1dc
f1dd GO64: switch to C64 mode and start C64 kernel in C64-only mode
f1eb GO64 routine (gets copied to $0002)
f921 Check for (bucky?) keys down? (same effect as $F6BC in C64 Kernel)
F9F7 load/store vector at $110A-$110B
F9FF X -> $110A, Y -> $110B
FA06 load/store vector at $1108-$1109
FA0E X -> $1108, Y -> $1109
FA37 Print immediate (print text message immediately following JSR to this routine)
fa88 C65 Kernel IRQ handler
faa9 C65 Kernel NMI entry point
fab1 C65 Kernel IRQ entry point
fabb @ read pushed processor flags for checking B flag
fabf @ filter so that only B flag remains
fac1 @ if B flag is set, then use BRK entry, else use IRQ entry
data FD99 FEFF
FF00 Unused (contains remnant portion of VIC-III IO mode select)
data FF00 FF08
word FF09 FF4C
FF09 nirq ;IRQ handler
FF0B monitor_brk ;BRK handler (Monitor)
FF0D nnmi ;NMI handler
FF0F nopen ;open
FF11 nclose ;close
FF13 nchkin ;chkin
FF15 nckout ;ckout
FF17 nclrch ;clrch
FF19 nbasin ;basin
FF1B nbsout ;bsout
FF1D nstop ;stop key scan
FF1F ngetin ;getin
FF21 nclall ;clall
FF23 monitor_parser ;monitor command parser
FF25 nload ;load
FF27 nsave ;save
FF29 talk ;Low level serial bus routines
FF2B listen
FF2D talksa
FF2F second
FF31 acptr
FF33 ciout
FF35 untalk
FF37 unlisten
FF39 DOS_talk ;newDOS routines
FF3B DOS_listen
FF3D DOS_talksa
FF3F DOS_second
FF41 DOS_acptr
FF43 DOS_ciout
FF45 DOS_untalk
FF47 DOS_unlisten
FF49 Get_DOS
FF4B Leave_DOS
FF4D jmp spin_spout ;setup fast serial port for input or output
FF50 jmp close_all ;close all logical files for a given device
FF53 jmp c64mode ;reconfigure system as a c/64 (no return!)
FF56 jmp monitor_call ;map in Monitor & call it
FF59 jmp bootsys ;boot alternate system from disk
FF5C jmp phoenix ;call cold start routines, disk boot loader
FF5F jmp lkupla ;search tables for given la
FF62 jmp lkupsa ;search tables for given sa
FF65 jmp swapper ;swap to alternate display device
FF68 jmp pfkey ;program function key
FF6B jmp setbnk ;set bank for load/save/verify/open
FF6E jmp jsr_far ;JSR to any bank, RTS to calling bank
FF71 jmp jmp_far ;JMP to any bank
FF74 jmp lda_far ;LDA (X),Y from bank Z
FF77 jmp sta_far :STA (X),Y to bank Z
FF7A jmp cmp_far ;CMP (X),Y to bank Z
FF7D jmp primm ;print immediate (always JSR to this routine!)
FF80 <FF> ;release number of C65 Kernel ($FF=not released)
FF81 jmp cint ;init screen editor & display chips
FF84 jmp ioinit ;init I/O devices (ports, timers, etc.)
FF87 jmp ramtas ;initialize RAM for system
FF8A jmp restor ;restore vectors to initial system
FF8D jmp vector ;change vectors for user
FF90 jmp setmsg ;control OS messages
FF93 jmp (isecond) ;send sa after listen
FF96 jmp (italksa) ;send sa after talk
FF99 jmp memtop ;set/read top of memory
FF9C jmp membot ;set/read bottom of memory
FF9F jmp key ;scan keyboard
FFA2 jmp settmo ;old IEEE set timeout value
FFA5 jmp (iacptr) ;read a byte from active serial bus talker
FFA8 jmp (iciout) ;send a byte to active serial bus listener
FFAB jmp (iuntalk) ;command serial bus device to stop talking
FFAE jmp (iunlisten) ;command serial bus device to stop listening
FFB1 jmp (ilisten) ;command serial bus device to listen
FFB4 jmp (italk) ;command serial bus device to talk
FFB7 jmp readss ;return I/O status byte
FFBA jmp setlfs ;set la, fa, sa
FFBD jmp setnam ;set length and fn adr
FFC0 jmp (iopen) ;open logical file
FFC3 jmp (iclose) ;close logical file
FFC6 jmp (ichkin) ;open channel in
FFC9 jmp (ickout) ;open channel out
FFCC jmp (iclrch) ;close I/O channel
FFCF jmp (ibasin) ;input from channel
FFD2 jmp (ibsout) ;output to channel
FFD5 jmp load ;load from file
FFD8 jmp save ;save to file
FFDB jmp Set Time ;set internal clock
FFDE jmp Read Time :read internal clock
FFE1 jmp (istop) ;scan stop key
FFE4 jmp (igetin) ;get char from queue
FFE7 jmp (iclall) ;clear all logical files (see close all)
FFEA jmp ScanStopKey ;(was increment clock) & scan stop key
FFED jmp scrorg ;return current screen window size
FFF0 jmp plot ;read/set x,y coord
FFF3 jmp iobase ;return I/O base
word fff6 ffff
FFF6 c65mode ;C64/C65 interface
FFF8 c65mode
FFFA nmi ;processor hardware vectors
FFFC reset
FFFE irq_kernel
E000 cint ;initialize editor & screen
E003 disply ;display character in .a, color in .x
E006 lp2 ;get a key from IRQ buffer into .a
E009 loopS ;get a chr from screen line into .a
E00C print ;print character in .a
E00F scrorg ;get size of window (rows,cols) in .x, .y
E012 keyboard_scan ;scan keyboard subroutine
E015 repeat ;repeat key logic & CKIT2 to store decoded key
E018 plot ;read or set (.c) cursor position in .x, .y
E01B mouse_cmd ;install/remove mouse driver
E01E escape ;execute escape function using chr in .a
E021 keyset ;redefine a programmable function key
E024 editor_irq ;IRQ entry
E027 palette_init ;initialize VIC palette
E02A swap ;40/80 mode change
E02D window ;set top left or bottom right (.c) of window
E030 cursor ;turn on or off (.c) soft cursor
7F00 ayint ;convert floating point to integer
7F03 givayf ;convert integer to floating point.
7F06 fout ;convert floating point to ASCII string
7F09 val_1 ;convert ASCII string to floating point
7F0C getadr ;convert floating point to an address
7F0F floatc ;convert address to floating point
7F12 fsub ;MEM - FACC
7F15 fsubt ;ARG - FACC
7F18 fadd ;MEM + FACC
7F1B faddt ;ARG - FACC
7F1E fmult ;MEM * FACC
7F21 fmultt ;ARG * FACC
7F24 fdiv ;MEM / FACC
7F27 fdivt ;ARG / FACC
7F2A log ;compute natural log of FACC
7F2D int ;perform BASIC INT() on FACC
7F30 sqr ;compute square root of FACC
7F33 negop ;negate FACC
7F36 fpwr ;raise ARG to the MEM power
7F39 fpwrt ;raise ARG to the FACC power
7F3C exp ;compute EXP of FACC
7F3F cos ;compute COS of FACC
7F42 sin ;compute SIN of FACC
7F45 tan ;compute TAN of FACC
7F48 atn ;compute ATN of FACC
7F4B round ;round FACC
7F4E abs ;absolute value of FACC
7F51 sign ;test sign of FACC
7F54 fcomp ;compare FACC with MEM
7F57 rnd_0 ;generate random floating point number
7F5A conupk ;move RAM MEM to ARG
7F5D romupk ;move ROM MEM to ARG
7F60 movfrm :move RAM MEM to FACC
7F63 movfm :move ROM MEM to FACC
7F66 movmf :move FACC to MEM
7F69 movfa ;move ARG to FACC
7F6C movaf ;move FACC to ARG
7F6F run
7F72 runc
7F75 clear
7F78 new
7F7B link_program
7F7E crunch
7F81 FindLine
7F84 newstt
7F87 eval
7F8A frmevl
7F8D run_a_program
7F90 setexc
7F93 linget
7F96 garba2
7F99 execute_a_line
7F9C chrget
7F9F chrgot
7FA2 chkcom
7FAS frmnum
7FA8 getadr
7FAB getnum
7FAE getbyt
7FB1 plsv
; Graphic Jump Table (not relevant in this memory context
;
;8000 init ;Graphics BASIC init (same as command=0)
;8002 parse ;Graphics BASIC command parser
;8003 start ;0 commands
;8006 screendef ;1
;8008 screenopen ;2
;800A screenclose ;3
;800C screenclear ;4
;800E screen ;5
;8010 setpen ;6
;8012 setpalette ;7
;8014 setdmode ;8
;8016 setdpat ;9
;8018 line ;10
;801A box ;11
;801C circle ;12
;801E polygon ;13
;8020 ellipse ;14
;8022 viewpclr ;15
;8024 copy ;16
;8026 cut ;17
;8028 paste ;18
;802A load ;19
;802C char ;20
;802E viewportdef ;21
; Internal DOS
word 8000 8015
8000 @Call vector: Initialise internal DOS
8002 @Call vector: Reset DOS status
8004 @Call vector: 1581 DOS unused (just an RTS)
8006 @Call vector: 1581 DOS Send talk address
8008 @Call vector: 1581 DOS Send listen address
800A @Call vector: 1581 DOS Send secondary address (talk)
800C @Call vector: 1581 DOS Send secondary address after listen
800E @Call vector: 1581 DOS Input on serial bus
8010 @Call vector: 1581 DOS Output on serial bus
8012 @Call vector: 1581 DOS Send untalk
8014 @Call vector: 1581 DOS Send unlisten
text 8016 801C
8016 C65 ROM version
801D Initialise DOS
8024 Return DOS status?
803D Empty routine
82AF Read from $00BD or $00BD+(#$13 + $FB)
data 8634 864F
8634 Ascending byte values from $02-$1D
90C6 Read then write some sector? (not used?)
975B Read a sector from disk
9761 @ command byte: read sector from disk.
976B @ Take branch and abort if RNF (read not found) bit set
9770 @ Take branch and keep waiting if sector not yet found (RDREQ bit
clear)
9798 @ Branch taken if read failed
979E Write a sector to disk
97AA @ Read 512-byte physical sector ready for re-writing
97B7 @ Advance sector buffer offset if writing an odd-numbered sector
97C1 @ Copy 256-byte logical sector into FDC buffer
97C9 @ Read one byte at a time from FDC buffer until EQ flag is asserted
97D3 @ keep reading until EQ flag asserted
97D5 @ Issue write sector command to FDC
97E1 @ Make sure that written sector can be read back from disk
9872 @ return if failed
9873 Format a track? (uses unbuffered formatting)
9890 @ check FDC busy flag
9893 @ Return if FDC not busy
98A7 @ check FDC busy flag
98AA @ Return if FDC not busy
98C1 @ check FDC busy flag
98C4 @ Return if FDC not busy
98D1 @ check FDC busy flag
98D4 @ Return if FDC not busy
98E6 @ check FDC busy flag
98E9 @ Return if FDC not busy
9A2A Values used to select SIDE bit of FDC status register ($D080) based on contents of FDC Side register ($D086)
9A2C Set FDC track, sector and side register from $1FB4?
9A34 @ Read logical track number (1 - 80)
9A37 @ Decrement by one to obtain physical track number (0 to 79)
9A38 @ Store physical track number in FDC register
9A3B @ Read logical sector number (0 - 39 ?)
9A3E @ Set carry flag if sector number is >=20
9A42 @ Set A to 1 if sector number >=20, or 0 if sector number <20
9A43 @ Store physical side number in FDC register
9A46 @ Take branch if sector is one side 0 (A will be $FF)
9A48 @ Load A with 20, which will be subtracted from logical sector number
9A4A @ Calculate 2's complement of A, so will be either 0 (front sector) or -20 (rear sector)
9A4B @ With C flag, A will be either $FF if sector is on front side, or ($FF-20) if on back side
9A4C @ Now add logical sector number. Result will be 0 for sector 0, through to 19 for sector 39.
9A4F @ shift sector number right one bit since physical sectors are 512bytes, not 256. Sector number will now be 0 through 9
9A50 @ Add one to sector number, since physical sectors apparently start at 1, not 0. Result will be between 1 and 10.
9A51 @ Store sector number into FDC register
9A73 Select drive 2, set FDC status register to A, wait for BUSY to clear.
9A79 @ Select F011 drive 2?
9A88 @ wait for FDC busy flag to clear
9A91 Execute FDC command from A, and wait for completion.
9A96 Read byte from FDC when available, return byte in A.
9A9D @ Read byte from FDC without checking if available.
9AA1 Write byte to FDC.
9AA5 Routine that does something based on which FDC drive selected?
9AA8 @ clear FDC IRQ?
data 9A2A 9A2B
9AC2 Test if drive ready and not write-protected
9ACA @ If not drive 2, then do something
9ACE Test whether sector read or write succeeded
9AD4 @ Check if RNF or CRC bits set, which would indicate a disk error
9AD6 @ Return success if neither bit set
9ADA @ CRC error, so return IO Error #9
9ADC @ Sector not found, so return IO Error #2
9ADE @ Else return IO Error #5
9AE7 @ Return IO Error #7
9AEA @ Return IO Error #8
9AF9 @ Set C and RTS
9AFB @ Clear C and RTS
9B40 reset drive and step to track 0 ?
9B67 @ reset FDC buffer pointer
9B98 Seek to track number in $010F,X
9BAB Step to next higher track
9BB2 Step to next lower track
9CB7 Send talk address to internal drive?
9C5B Send listen address to internal drive?
9CCD Send secondary address (talk or listen) to internal drive?
9D26 Input from internal drive?
9D4A Input from internal drive?
9DA0 Send untalk to internal drive?
9D87 Send unlisten to internal drive?
A642 Load $bb8f into $0E/$0F ZP vector
A642 @ low byte of vector $bb8f
A644 @ high byte of vector $bb8f
data af17 af18
AF17 Two bytes $80, $40
BAD5 Load $1E00 into $4D/$4E ZP vector (sector buffer?)
data bb8f bbb4
bb8f some vector for DOS with some data?
BA1D Clear $0000-$019C and $0200-$1FFF
BAD5 Some 1581 DOS routine
8A2E @ ... and clear page $02 ...
8A37 @ ... and clear the rest of the 8KB DOS memory
data 99b6 9a2b
99b6 unknown data
; b652 onwards - dos messages and vectors? need to decode as text and data
fb09 @ Drive LED and motor on, select back side of disk
fb22 If disk present, load boot sector to $0400 and JSR.
fb57 @ Make sure first byte of boot sector is JMP (opcode $4c)
fb91 Read byte from FDC buffer when available
fb9c Wait for FDC BUSY status to clear
D080 @ FDC Status register
D081 @ FDC Command register
D082 @ FDC Status byte 1
D083 @ FDC Status byte 2
D084 @ FDC Track number
D085 @ FDC Sector number
D086 @ FDC Side number
D087 @ FDC Data register
D088 @ FDC Clock register
D089 @ FDC Step timer register
D08A @ FDC Copy proection code register