-
Notifications
You must be signed in to change notification settings - Fork 1
/
ramdos128.asm
3355 lines (3354 loc) · 43.3 KB
/
ramdos128.asm
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
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
; This is from COMPUTE, I think. And is included for completeness.
; It is the assembly source for the C128 version of the REU filesystem
; driver that Zelch uses to store program files for quick-swapping.
*=$2300
JMP $3D9D
JMP $3DE2
JMP $3DA1
JMP $3DE6
JMP $230F
LDX #$00
TXA
PHA
LDA $2321,X
JSR $C00C
PLA
TAX
INX
CPX #$45
BNE $2311
RTS
ORA $4328
AND #$20
AND ($39),Y
SEC
ROL $20,X
EOR
EOR $4F4D
MVP
EOR $20
EOR $4C
EOR $43
MVN
LSR $4349
EOR
JSR $544C
MVP
ORA $2020
JSR $2020
JSR $2020
EOR ($4C,X)
JMP $5220
EOR #$47
PHA
MVN
EOR
EOR
EOR
EOR $44
ROL $0D20
BRK
EOR
PHK
BRK
ORA ($46,X)
EOR #$4C
EOR $53
JSR $4353
EOR
MVN
EOR $44
BRK
ORA $4F44
EOR
EOR
LSR $5546
EOR
MVP
EOR
LSR $4154
CLI
JSR $5245
EOR
EOR
ORA
EOR
LSR $4154
CLI
JSR $5245
EOR
EOR
JSR $5953
LSR $4154
CLI
JSR $5245
EOR
EOR
AND ($53,X)
EOR $544E,Y
EOR ($58,X)
JSR $5245
EOR
EOR
JSR
EOR
LSR $4154
CLI
JSR $5245
EOR
EOR
AND
EOR $43
EOR
EOR
JSR $4F4E
MVN
EOR
EOR
LSR $0054
AND
LSR $45,X
EOR
JMP $574F
JSR $4E49
JSR $4552
EOR
EOR
BRK
BIT $46,X
EOR #$4C
EOR $20
MVN
JSR $414C
EOR
EOR $00
BIT $4946,X
JMP $2045
EOR
BVC $2464
LSR $3D00
LSR $49
JMP $2045
LSR $544F
JSR $504F
EOR $4E
BRK
ROL $4946,X
JMP $2045
LSR $544F
JSR $4F46
EOR $4E,X
MVP
LSR $49
JMP $2045
EOR $58
EOR #$53
MVN
RTI
LSR $49
JMP $2045
MVN
EOR $20
EOR $5349
EOR $5441
EOR
BRK
WDM
JMP $454C
EOR
JMP $5420
EOR
EOR
JSR $4E41
MVP
EOR $43
MVN
BRK
LSR $4E
EOR
JSR $4843
EOR ($4E,X)
LSR $4C45
BRK
PHA
MVP
PHK
JSR $5546
JMP $004C
EOR #$43
WDM
JSR $4F44
EOR
LSR $34,X
ROL $2034
AND ($37),Y
AND $30,X
BRK
BRK
WDM
MVP
EOR
EOR
EOR
LSR $4D55
WDM
EOR
CLC
ADC $2169
STA $2169
RTS
LDX $2169
CPX $216A
BCC $24D4
JSR $255F
CLC
JMP $3999
LDA #$A8
LDX #$24
STA $2109
STX $210A
LDA #$37
LDX #$01
CLC
ADC $2169
BCC $24E9
INX
STA $DF04
STX $DF05
LDA #$00
STA $DF06
LDA $216A
SEC
SBC $2169
LDX $22F5
LDY $22F6
SEC
JMP $3AF9
STA $216B
STX $216C
LDY #$01
JSR $2580
LDA #$00
STA $216F
LDA #$10
LDX #$27
JSR $2523
LDA #$E8
LDX #$03
JSR $2523
LDA #$64
LDX #$00
JSR $2523
LDA $216B
JSR $25A6
JSR $25D4
LDA #$00
JMP $25A6
STA $216D
STX $216E
LDA $216F
AND #$F0
STA $216F
LDA $216B
SEC
SBC $216D
TAX
LDA $216C
SBC $216E
BCC $2568
STA $216C
STX $216B
LDA $216F
ADC #$00
ORA #$30
STA $216F
BNE $2546
LDA $216F
BEQ $2570
JSR $25D6
RTS
LDY #$49
BIT $00A0
LDA #$00
TAX
JMP $256E
TAY
LDA $210F
LDX $2110
JSR $2580
LDA $2135
JSR $25A6
JSR $25D4
LDA $2136
JMP $25A6
STY $2134
STX $2135
STA $2136
LDA #$00
STA $2169
STA $216A
LDA $2134
JSR $25A6
JSR $25D4
LDA #$20
JSR $25D6
JSR $25EA
JSR $25D4
RTS
CMP #$64
BCC $25D5
CMP #$C8
BCC $25CB
SBC #$C8
PHA
LDA #$02
JMP $25BC
SEC
SBC #$64
PHA
LDA #$01
JSR $25D1
PLA
LDX #$FF
INX
SEC
SBC #$0A
BCS $25D7
PHA
TXA
JSR $25D1
PLA
CLC
ADC #$0A
ORA #$30
BIT $2CA9
LDX $216A
STA $2137,X
CPX #$30
BEQ $25F8
INC $216A
LDA #$00
STA $2138,X
CLC
RTS
LDA #$66
LDX #$23
STA $FE
STX $FF
LDA $2134
LDX #$00
CMP ($FE,X)
BEQ $2615
JSR $260D
BNE $2607
JSR $2612
BEQ $2620
JSR $25D6
JMP $2600
CLC
RTS
JSR $2612
BNE $2622
INC $FE
BNE $262D
INC $FF
LDX #$00
LDA ($FE,X)
RTS
LDX #$10
TXA
JSR $263F
JSR $262D
LDX $2108
DEX
BPL $2634
RTS
LDX #$0F
LDA #$00
STA $210B,X
DEX
BPL $2646
RTS
LDA $B9
AND #$0F
BIT $10A9
CMP $2108
BEQ $2685
PHA
LDA #$0B
LDX #$21
STA $DF02
STX $DF03
LDA $2107
STA $DF06
LDA #$10
LDX #$00
STA $DF07
STX $DF08
LDA $2108
LDY #$B0
JSR $2678
PLA
STA $2108
LDY #$B1
JSR $2678
LDA $2108
LDX $210B
CLC
RTS
ASL
TAX
LDA $268D,X
STA $DF04
LDA $268E,X
ADC $2106
STA $DF05
STY $DF01
RTS
BRK
BRK
BPL $26A6
JSR $3000
BRK
RTI
BRK
BVC $26AE
RTS
BRK
BVS $26B2
BRA $26B4
BCC $26B6
LDY #$00
BCS $26BA
CPY #$00
BNE $26BE
CPX #$00
BEQ $26C2
BRK
ORA ($8D,X)
ORA
AND ($8E,X)
BPL $26EE
LDA $210F
LDX $2110
CPX $211C
BNE $26DB
CMP $211B
BEQ $2703
PHA
TXA
PHA
JSR $26D7
PLA
TAX
PLA
STA $211B
STX $211C
LDY #$B1
BIT $B0A0
JSR $26ED
LDA $211B
LDX $211C
STA $DF05
STX $DF06
STY $DF01
CLC
RTS
LDX #$0A
LDA $26F9,X
STA $DF02,X
DEX
BPL $2707
RTS
BRK
JSR $0000
BRK
BRK
ORA ($00,X)
BRK
BRK
BRK
JSR $2638
CMP #$0F
BNE $2726
JMP $24B0
CPX #$00
BNE $2733
LDA #$46
STA $90
LDA #$46
JMP $3996
CPX #$24
BNE $2752
JMP $3458
TAY
BEQ $2751
CLC
ADC $210E
STA $210E
BCC $274E
INC $210F
BNE $274E
INC $2110
JSR $26D4
RTS
LDA $210B
CMP #$52
BEQ $2769
CMP #$46
BEQ $2769
CMP #$4C
BNE $2764
JMP $2A0E
LDA #$3C
JMP $3996
SEC
LDA $2111
SBC $210E
TAY
LDA $2112
SBC $210F
TAX
LDA $2113
SBC $2110
BCS $2783
JMP $398D
BNE $2788
TXA
BEQ $278A
LDY #$FF
TYA
PHA
JSR $26D7
PLA
TAY
BNE $2798
LDA #$40
STA $90
INY
LDA #$22
LDX #$27
SEC
JMP $3ADE
JSR $2638
CMP #$0F
BNE $27AA
JMP $3184
CPX #$57
BEQ $27F2
CPX #$46
BEQ $27F2
CPX #$4C
BNE $27B9
JMP $2A43
LDA #$46
JMP $3996
TAY
BEQ $27EF
DEY
TYA
CLC
ADC $210E
STA $210E
LDX $2110
CPX $2113
BNE $27D8
LDX $210F
CPX $2112
BNE $27E2
CMP $2111
BCC $27E2
STA $2111
INC $210E
BNE $27EF
INC $210F
BNE $27EF
INC $2110
JMP $26D4
JSR $27FB
BCS $2802
LDA #$00
SEC
SBC $210E
CMP #$00
BNE $2805
CLC
JMP $39A7
PHA
JSR $26D7
PLA
TAY
LDA #$A6
LDX #$27
CLC
JMP $3ADE
LDA $2113
CMP $2110
BNE $2829
LDA $2112
CMP $210F
BNE $2829
LDA $2111
CMP $210E
BCS $2887
LDA $2111
CMP #$FF
BNE $2870
LDA $210F
LDX $2110
PHA
TXA
PHA
LDA $2112
LDX $2113
CLC
ADC #$01
BCC $2847
INX
JSR $2B1A
TAY
PLA
TAX
PLA
STA $210F
STX $2110
TYA
BCS $28A1
INC $2112
BNE $285F
INC $2113
LDA $210C
LDX $210D
JSR $26BB
INC $2000
BNE $2870
INC $2001
INC $2111
LDA $2112
LDX $2113
JSR $26BB
LDA #$FF
LDY $2111
STA $2000,Y
JMP $27FB
JSR $26B5
LDY $210E
LDA $2120
STA $2000,Y
INC $210E
BNE $28A0
INC $210F
BNE $28A0
INC $2110
CLC
RTS
CLC
LDA #$1A
ADC $2114
STA $210E
LDA #$00
LDX #$00
ADC $210C
PHA
TXA
ADC $210D
TAX
PLA
STA $210F
STX $2110
LDY $210B
CPY #$46
BNE $28DC
CLC
ADC $2115
PHA
TXA
ADC $2116
TAX
PLA
BCS $28D9
STA $210F
STX $2110
LDA #$34
RTS
LDA #$00
STA $2172
LDA $2115
LDX $2116
STA $2170
STX $2171
LDA $211A
LSR
PHA
BCC $2910
CLC
LDA $2170
ADC $210E
STA $210E
LDA $2171
ADC $210F
STA $210F
LDA $2172
ADC $2110
STA $2110
ASL $2170
ROL $2171
ROL $2172
PLA
BNE $28F0
LDA #$32
LDX $2116
CPX $2119
BNE $292C
LDX $2115
CPX $2118
RTS
LDA $2115
LDX $2116
PHA
TXA
PHA
LDA $2114
PHA
LDA $2120
PHA
JSR $2940
BCS $2944
CLC
TAY
PLA
STA $2120
PLA
STA $2114
PLA
TAX
PLA
STA $2115
STX $2116
TYA
RTS
LDA $2118
LDX $2119
CPX #$FF
BNE $2964
CMP #$FF
BCS $298F
STA $2115
STX $2116
LDA #$00
STA $2114
JSR $288A
LDA #$FF
STA $2120
JSR $27FB
BCS $298E
INC $2114
JSR $297B
BCS $298E
INC $2118
BNE $298E
INC $2119
RTS
LDA #$34
SEC
RTS
LDA $2114
CMP $211A
BCS $29AA
LDA #$00
STA $2120
JSR $27FB
BCS $29AB
INC $2114
BNE $2993
CLC
RTS
LDA $2114
PHA
LDA #$00
STA $2114
STA $2117
JSR $288A
BCS $29EE
LDA $2114
CMP $211A
BCS $29E8
JSR $26B5
LDY $210E
LDA $2000,Y
BEQ $29D6
LDA $2114
STA $2117
INC $210E
BNE $29E3
INC $210F
BNE $29E3
INC $2110
INC $2114
BNE $29BD
PLA
STA $2114
CLC
RTS
TAY
PLA
TYA
RTS
JSR $288A
BCS $2A01
JSR $26B5
LDX $210E
LDA $2000,X
CLC
RTS
JSR $2A04
JSR $288A
JSR $297B
BCS $2A1A
INC $2115
BNE $2A15
INC $2116
LDA #$00
STA $2114
CLC
RTS
CLC
ADC $2114
STA $2114
JMP $26D4
LDA #$04
LDX #$2A
STA $2109
STX $210A
JSR $2994
BCS $2A45
JSR $288A
SEC
LDA $2117
SBC $2114
BEQ $2A48
SEC
JMP $2A7F
JMP $3996
JSR $29DA
LDX #$00
STX $2114
INC $2115
BNE $2A58
INC $2116
JMP $399E
CLC
JSR $2AA1
BNE $2A81
LDA #$EA
LDX #$29
STA $2109
STX $210A
LDX $2116
CPX $2119
BNE $2A79
LDX $2115
CPX $2118
BCC $2A86
JSR $2915
BCC $2A6B
BIT $33A9
JMP $3996
LDA $211A
SEC
SBC $2114
BCC $2A81
BEQ $2A81
PHA
JSR $2AA1
PLA
CLC
PHP
PHA
JSR $288A
JSR $26B5
JSR $26D7
LDA $210E
STA $DF04
LDA $210F
LDX $2110
STA $DF05
STX $DF06
PLA
PLP
JMP $3AF9
LDA $2121
STA $FF
LDA #$01
STA $FE
LDY #$00
LDA ($FE),Y
BCC $2ACB
ROL
STA ($FE),Y
RTS
JSR $2D58
BCS $2B2B
TYA
AND #$0F
JSR $263F
LDA $210B
CMP #$46
BEQ $2AE2
CMP #$4C
BNE $2B28
JSR $2D58
TYA
BCS $2B2B
STA $2115
JSR $2D58
TYA
BCS $2B2B
STA $2116
LDA #$00
STA $2114
JSR $2D58
TYA
BCS $2B15
LDY $210B
CPY #$46
BEQ $2B12
CMP #$00
BEQ $2B15
TAY
DEY
TYA
CMP $211A
BCS $2B2E
STA $2114
LDA $2115
BNE $2B22
LDA $2116
BEQ $2B25
DEC $2116
DEC $2115
JMP $288A
LDA #$46
BIT $1EA9
BIT $33A9
SEC
RTS
STA $2173
STX $2174
LDA $2102
LDX $2103
CLC
ADC #$01
BNE $2B44
INX
CPX $2105
BNE $2B4C
CMP $2104
BCC $2B51
LDA #$48
RTS
LDA #$01
LDX #$00
JSR $2B74
LDA $2173
LDX $2174
JSR $26BB
INC $2173
BNE $2B69
INC $2174
JSR $26ED
LDA $2173
LDX $2174
STA $DF05
STX $DF06
CPX $2103
BNE $2B80
CMP $2102
BCS $2B8A
LDA #$B2
STA $DF01
JMP $2B49
CLC
RTS
STA $2175
STX $2176
LDA $2108
PHA
LDX #$10
TXA
JSR $263F
LDA $210B
BEQ $2BCE
LDA $2112
LDX $2113
JSR $2BD1
STA $2112
STX $2113
LDA $210F
LDX $2110
JSR $2BD1
STA $210F
STX $2110
LDA $210C
LDX $210D
JSR $2BD1
STA $210C
STX $210D
LDX $2108
DEX
BPL $2B98