floppyrom.a65.full
1:
2: .setcpu "6502"
3:
4:
5: ASM_JMP = $4C
6: ASM_BIT2 = $24
7: ASM_BIT3 = $2C
8:
9:
10: A6502_FLAGS_N = $80
11: A6502_FLAGS_V = $40
12: A6502_FLAGS_R = $20
13: A6502_FLAGS_B = $10
14: A6502_FLAGS_D = $08
15: A6502_FLAGS_I = $04
16: A6502_FLAGS_Z = $02
17: A6502_FLAGS_C = $01
18:
19:
20:
21: .macro htasc str
22: .repeat .strlen(str)-1,I
23: .byte .strat(str,I)
24: .endrep
25: .byte .strat(str,.strlen(str)-1) | $80
26: .endmacro
27:
28: .macro htasc_floppy_error str
29: .byte .strat(str,0) | $80
30: .repeat .strlen(str)-2,I
31: .byte .strat(str,I + 1)
32: .endrep
33: .byte .strat(str,.strlen(str)-1) | $80
34: .endmacro
35:
36:
37:
38:
39: .macro init_token_tables
40: .segment "VECTORS"
41: TOKEN_ADDRESS_TABLE:
42: .segment "KEYWORDS"
43: TOKEN_NAME_TABLE:
44: .segment "DUMMY"
45: DUMMY_START:
46: .endmacro
47:
48:
49:
50: .macro define_token token
51: .segment "DUMMY"
52: .ifnblank token
53: token := <(*-DUMMY_START)+$80
54: .endif
55: .res 1
56: .endmacro
57:
58:
59: .macro keyword key, token
60: .segment "KEYWORDS"
61: htasc key
62: define_token token
63: .endmacro
64:
65:
66:
67: .macro keyword_rts key, vec, token
68: .segment "VECTORS"
69: .word vec-1
70: keyword key, token
71: .endmacro
72:
73:
74:
75: .macro keyword_addr key, vec, token
76: .segment "VECTORS"
77: .addr vec
78: keyword key, token
79: .endmacro
80:
81: .macro count_tokens
82: .segment "DUMMY"
83: NUM_TOKENS := <(*-DUMMY_START)
84: .endmacro
85:
86: .macro init_error_table
87: .segment "DUMMY"
88: DUMMY_START_ERROR:
89:
90: .segment "ERROR"
91: ERROR_MESSAGES:
92: .endmacro
93:
94: .ifdef CBM2_EXT_FILE_ERRORS
95: .macro define_error_token token
96: .segment "DUMMY"
97: .ifnblank token
98: token := <(*-DUMMY_START_ERROR + 1)
99: .endif
100: .res 1
101: .endmacro
102:
103: .macro define_error error, msg, addr
104: .segment "ERROR"
105: addr := *
106: htasc msg
107: define_error_token error
108: .endmacro
109:
110: .else
111: .macro define_error error, msg, addr
112: .segment "ERROR"
113: error := <(*-ERROR_MESSAGES)
114: htasc msg
115: .endmacro
116:
117: .endif
118:
119:
120:
121: .macro asc80 str
122: .repeat .strlen(str),I
123: .byte .strat(str,I)+$80
124: .endrep
125: .endmacro
126:
127:
128: ASC_LF = $0A
129: ASC_CR = $0D
130: ASC_RVS = $12
131: ASC_HOME = $13
132: ASC_INSDEL = $14
133:
134: ASC_LOWERCASE = $0E
135: ASC_UPPERCASE = $8E
136: ASC_DISALLOW_LOWERCASE = $08
137: ASC_ALLOW_LOWERCASE = $09
138:
139: ASC_CURSORLEFTRIGHT = $1D
140: ASC_CURSORUPDOWN = $11
141:
142: .if .defined(C64JAPAN)
143: ASC_PI = $B0
144: .else
145: ASC_PI = $DE
146: .endif
147:
148: KEY_NONE = $40
149: KEY_STOP = $03
150:
151: PETSCII_CRSR_RIGHT = $1D
152:
153:
154:
155: DRIVE_UNKNOWN=0
156:
157: DRIVE_2031=DRIVE_UNKNOWN + $10
158: DRIVE_2031_01=DRIVE_2031 + 1
159:
160: DRIVE_1540=DRIVE_2031 + $10
161: DRIVE_1540_01=DRIVE_1540 + 1
162:
163: DRIVE_1541=DRIVE_1540 + $10
164: DRIVE_1541_01=DRIVE_1541 + 1
165: DRIVE_1541_02=DRIVE_1541 + 2
166: DRIVE_1541_03=DRIVE_1541 + 3
167: DRIVE_1541_05=DRIVE_1541 + 5
168: DRIVE_1541_06AA=DRIVE_1541 + 6
169:
170: DRIVE_1541C=DRIVE_1541 + $10
171: DRIVE_1541C_01=DRIVE_1541C + 1
172: DRIVE_1541C_02=DRIVE_1541C + 2
173: DRIVE_1541C_03=DRIVE_1541C + 3
174:
175: DRIVE_1570=DRIVE_1541C + $10
176: DRIVE_1570_01=DRIVE_1570 + 1
177:
178: DRIVE_1571=DRIVE_1570 + $10
179: DRIVE_1571_03=DRIVE_1571 + 3
180: DRIVE_1571_05=DRIVE_1571 + 5
181:
182: DRIVE_1571CR=DRIVE_1571 + $10
183: DRIVE_1571CR_01=DRIVE_1571CR + 1
184:
185: .ifdef v2031
186: .ifdef CompileDrive
187: .error "Only one drive type can be compiled at a time!"
188: .endif
189: CompileDrive=DRIVE_2031 + v2031
190: .endif
191:
192: .ifdef v1540
193: .ifdef CompileDrive
194: .error "Only one drive type can be compiled at a time!"
195: .endif
196: CompileDrive=DRIVE_1540 + v1540
197: .endif
198:
199: .ifdef v1541
200: .ifdef CompileDrive
201: .error "Only one drive type can be compiled at a time!"
202: .endif
203: CompileDrive=DRIVE_1541 + v1541
204: .endif
205:
206: .ifdef v1541aa
207: .ifdef CompileDrive
208: .error "Only one drive type can be compiled at a time!"
209: .endif
210: .if v1541aa = 06
211: CompileDrive=DRIVE_1541_06AA
212: .else
213: .error "Unknown 1541 AA type used!"
214: .endif
215: .endif
216:
217: .ifdef v1541c
218: .ifdef CompileDrive
219: .error "Only one drive type can be compiled at a time!"
220: .endif
221: CompileDrive=DRIVE_1541C + v1541c
222: .endif
223:
224: .ifdef v1570
225: .ifdef CompileDrive
226: .error "Only one drive type can be compiled at a time!"
227: .endif
228: CompileDrive=DRIVE_1570 + v1570
229: .endif
230:
231: .ifdef v1571
232: .ifdef CompileDrive
233: .error "Only one drive type can be compiled at a time!"
234: .endif
235: CompileDrive=DRIVE_1571 + v1571
236: .endif
237:
238: .ifdef v1571cr
239: .ifdef CompileDrive
240: .error "Only one drive type can be compiled at a time!"
241: .endif
242: CompileDrive=DRIVE_1571CR + v1571cr
243: .endif
244:
245: .ifndef CompileDrive
246: .error "Please define one of v2031, v1540, v1541, v1541c, v1570, v1571, or v1571cr!"
247: .endif
248:
249: .if CompileDrive=DRIVE_2031_01
250: DRIVE_CHKSUM_C000=$B7
251: DRIVE_CHKSUM_FEE6=$FA
252: INTRA_SECTOR_GAP=$08
253: DRIVEFILLER=$AA
254: MAXTRACK_ADJUSTED=MaxTrack1541
255: MAXTRACK_SINGLESIDED=35
256: MAXTRACK_DOUBLESIDED=MAXTRACK_SINGLESIDED
257: .elseif CompileDrive=DRIVE_1540_01
258: DRIVE_CHKSUM_C000=$97
259: DRIVE_CHKSUM_FEE6=$60
260: INTRA_SECTOR_GAP=$08
261: DRIVEFILLER=$AA
262: MAXTRACK_ADJUSTED=MaxTrack1541
263: MAXTRACK_SINGLESIDED=35
264: MAXTRACK_DOUBLESIDED=MAXTRACK_SINGLESIDED
265: .elseif CompileDrive=DRIVE_1541_01
266: DRIVE_CHKSUM_C000=$97
267: DRIVE_CHKSUM_FEE6=$FD
268: INTRA_SECTOR_GAP=$08
269: DRIVEFILLER=$AA
270: MAXTRACK_ADJUSTED=MaxTrack1541
271: MAXTRACK_SINGLESIDED=35
272: MAXTRACK_DOUBLESIDED=MAXTRACK_SINGLESIDED
273: .elseif CompileDrive=DRIVE_1541_02
274: DRIVE_CHKSUM_C000=$97
275: DRIVE_CHKSUM_FEE6=$10
276: INTRA_SECTOR_GAP=$08
277: DRIVEFILLER=$AA
278: MAXTRACK_ADJUSTED=MaxTrack1541
279: MAXTRACK_SINGLESIDED=35
280: MAXTRACK_DOUBLESIDED=MAXTRACK_SINGLESIDED
281: .elseif CompileDrive=DRIVE_1541_03
282: DRIVE_CHKSUM_C000=$97
283: DRIVE_CHKSUM_FEE6=$0E
284: INTRA_SECTOR_GAP=$09
285: DRIVEFILLER=$AA
286: MAXTRACK_ADJUSTED=MaxTrack1541
287: MAXTRACK_SINGLESIDED=35
288: MAXTRACK_DOUBLESIDED=MAXTRACK_SINGLESIDED
289: .elseif CompileDrive=DRIVE_1541_05
290: DRIVE_CHKSUM_C000=$97
291: DRIVE_CHKSUM_FEE6=$3E
292: INTRA_SECTOR_GAP=$09
293: DRIVEFILLER=$AA
294: MAXTRACK_ADJUSTED=MaxTrack1541
295: MAXTRACK_SINGLESIDED=35
296: MAXTRACK_DOUBLESIDED=MAXTRACK_SINGLESIDED
297: .elseif CompileDrive=DRIVE_1541_06AA
298: DRIVE_CHKSUM_C000=$97
299: DRIVE_CHKSUM_FEE6=$EC
300: INTRA_SECTOR_GAP=$09
301: DRIVEFILLER=$AA
302: MAXTRACK_ADJUSTED=MaxTrack1541
303: MAXTRACK_SINGLESIDED=35
304: MAXTRACK_DOUBLESIDED=MAXTRACK_SINGLESIDED
305: .elseif CompileDrive=DRIVE_1541C_01
306: DRIVE_CHKSUM_C000=$97
307: DRIVE_CHKSUM_FEE6=$79
308: INTRA_SECTOR_GAP=$09
309: DRIVEFILLER=$AA
310: MAXTRACK_ADJUSTED=MaxTrack1541
311: MAXTRACK_SINGLESIDED=35
312: MAXTRACK_DOUBLESIDED=MAXTRACK_SINGLESIDED
313: .elseif CompileDrive=DRIVE_1541C_02
314: DRIVE_CHKSUM_C000=$97
315: DRIVE_CHKSUM_C001=$46
316: DRIVE_CHKSUM_FEE6=$79
317: DRIVE_CHKSUM_FFE5=$CA
318: INTRA_SECTOR_GAP=$09
319: DRIVEFILLER=$AA
320: MAXTRACK_ADJUSTED=MaxTrack1541
321: MAXTRACK_SINGLESIDED=35
322: MAXTRACK_DOUBLESIDED=MAXTRACK_SINGLESIDED
323: .elseif CompileDrive=DRIVE_1541C_03
324: DRIVE_CHKSUM_C000=$97
325: DRIVE_CHKSUM_C001=$e0
326: DRIVE_CHKSUM_FEE6=$79
327: DRIVE_CHKSUM_FFE5=$EB
328: INTRA_SECTOR_GAP=$09
329: DRIVEFILLER=$AA
330: MAXTRACK_ADJUSTED=MaxTrack1541
331: MAXTRACK_SINGLESIDED=35
332: MAXTRACK_DOUBLESIDED=MAXTRACK_SINGLESIDED
333: .elseif CompileDrive=DRIVE_1570_01
334: DRIVE_CHKSUM_C000=$51
335: DRIVE_CHKSUM_FEE6=$ff
336: INTRA_SECTOR_GAP=$09
337: DRIVEFILLER=$FF
338: DRIVE_8000=$75
339: DRIVE_8001=$98
340: MAXTRACK_ADJUSTED=MaxTrack1541
341: MAXTRACK_SINGLESIDED=35
342: MAXTRACK_DOUBLESIDED=MAXTRACK_SINGLESIDED * 2
343: .elseif CompileDrive=DRIVE_1571_03
344: DRIVE_CHKSUM_C000=$42
345: DRIVE_CHKSUM_FEE6=$ff
346: INTRA_SECTOR_GAP=$09
347: DRIVEFILLER=$FF
348: DRIVE_8000=$92
349: DRIVE_8001=$25
350: MAXTRACK_ADJUSTED=MAXTRK1571
351: MAXTRACK_SINGLESIDED=35
352: MAXTRACK_DOUBLESIDED=MAXTRACK_SINGLESIDED * 2
353: .elseif CompileDrive=DRIVE_1571_05
354: DRIVE_CHKSUM_C000=$38
355: DRIVE_CHKSUM_FEE6=$ff
356: INTRA_SECTOR_GAP=$09
357: DRIVEFILLER=$FF
358: DRIVE_8000=$F2
359: DRIVE_8001=$68
360: MAXTRACK_ADJUSTED=MAXTRK1571
361: MAXTRACK_SINGLESIDED=35
362: MAXTRACK_DOUBLESIDED=MAXTRACK_SINGLESIDED * 2
363: .elseif CompileDrive=DRIVE_1571CR_01
364: DRIVE_CHKSUM_C000=$84
365: DRIVE_CHKSUM_FEE6=$ff
366: INTRA_SECTOR_GAP=$09
367: DRIVEFILLER=$FF
368: DRIVE_8000=$02
369: DRIVE_8001=$44
370: MAXTRACK_ADJUSTED=MAXTRK1571
371: MAXTRACK_SINGLESIDED=35
372: MAXTRACK_DOUBLESIDED=MAXTRACK_SINGLESIDED * 2
373: .endif
374:
375: .macro FillCount count,filler
376: .repeat count
377: .ifblank filler
378: .byte DRIVEFILLER
379: .else
380: .byte filler
381: .endif
382: .endrep
383: .endmacro
384:
385: .macro FillUntil address,filler
386: FillCount address-*,filler
387: .endmacro
388:
389: .macro FillNOP count
390: FillCount count,$EA
391: .endmacro
392:
393:
394: MASK_PA = $0F
395:
396: MASK_SA = $0F
397:
398: IEC_COMMAND_ERROR_CHANNEL = $0F
399:
400:
401: JOBS0 := $0000
402: JOBS1 := $0001
403: JOBS2 := $0002
404: JOBS3 := $0003
405: JOBS4 := $0004
406: JOBS5 := $0005
407: TRACK0 := $0006
408: SECTOR0 := $0007
409: TRACK1 := $0008
410: SECTOR1 := $0009
411: TRACK2 := $000A
412: SECTOR2 := $000B
413: TRACK3 := $000C
414: SECTOR3 := $000D
415: TRACK4 := $000E
416: SECTOR4 := $000F
417: TRACK5 := $0010
418: SECTOR5 := $0011
419: DiskID0 := $0012
420: DiskID1 := $0014
421: HEADER := $0016
422: ACTJOB := $001B
423: WPSW := $001C
424: LWPT := $001E
425: DRVST := $0020
426: DRVTRK := $0022
427: STAB := $0024
428: SAVPNT := $002E
429: BUFPNT := $0030
430: HDRPNT := $0032
431: GCRPNT := $0034
432: GCRERR := $0035
433: BYTCNT := $0036
434: BITCNT := $0037
435: BID := $0038
436: HBID := $0039
437: CHKSUM := $003A
438: HINIB := $003B
439: BYTE := $003C
440: DRIVE := $003D
441: CDRIVE := $003E
442: JOBN := $003F
443: TRACC := $0040
444: NXTJOB := $0041
445: NXTRK := $0042
446: SECTR := $0043
447: WORK := $0044
448: JOB := $0045
449: CTRACK := $0046
450: DBID := $0047
451: ACLTIM := $0048
452: SAVSP := $0049
453: STEPS := $004A
454: TMP := $004B
455: CSECT := $004C
456: NEXTS := $004D
457: NXTBF := $004E
458: NXTPNT := $004F
459: GCRFLG := $0050
460: FTNUM := $0051
461: BTAB := $0052
462: GTAB := $0056
463: AS := $005E
464: AF := $005F
465: ACLSTP := $0060
466: RSTEPS := $0061
467: NXTST := $0062
468: MINSTP := $0064
469: VNMI := $0065
470: NMIFLG := $0067
471: AUTOFG := $0068
472: SECINC := $0069
473: REVCNT := $006A
474: USRJMP := $006B
475: BMPNT := $006D
476: T0 := $006F
477: T1 := $0070
478: T2 := $0071
479: T3 := $0072
480: T4 := $0073
481: T5 := $0074
482: IP := $0075
483: LSNADR := $0077
484: TLKADR := $0078
485: LSNACT := $0079
486: TLKACT := $007A
487: ADRSED := $007B
488: ATNPND := $007C
489: ATNMOD := $007D
490: PRGTRK := $007E
491: DRVNUM := $007F
492: TRACK := $0080
493: SECTOR := $0081
494: LINDX := $0082
495: SA := $0083
496: ORGSA := $0084
497: DATA := $0085
498: R0 := $0086
499: R1 := $0087
500: R2 := $0088
501: R3 := $0089
502: R4 := $008A
503: RESULT := $008B
504: ACCUM := $008F
505: DIRBUF := $0094
506: ICMD := $0096
507: MYPA := $0097
508:
509: BUFFERS_COUNT := 5
510:
511: CONT := $0098
512: BUFTAB0 := $0099
513: BUFTAB1 := $009B
514: BUFTAB2 := $009D
515: BUFTAB3 := $009F
516: BUFTAB4 := $00A1
517: BUFTABCMD := $00A3
518: BUFTABERR := $00A5
519: BUF0 := $00A7
520: BUF1 := $00AE
521: RECL := $00B5
522: RECH := $00BB
523: NR := $00C1
524: RS := $00C7
525: SS := $00CD
526: F1PTR := $00D3
527: RECPTR := $00D4
528: SSNUM := $00D5
529: SSIND := $00D6
530: RELPTR := $00D7
531: ENTSEC := $00D8
532: ENTIND := $00DD
533: FILDRV := $00E2
534: PATTYP := $00E7
535: PATTYP_WILDCARD := $80
536: FILTYP := $00EC
537: CHNRDY := $00F2
538: EIOFLG := $00F8
539: JOBNUM := $00F9
540: LRUTBL := $00FA
541: NODRV := $00FF
542: DSKVER := $0101
543: ZPEND := $0103
544:
545: L0104 := $0104
546: L0146 := $0146
547: L0147 := $0147
548: L0148 := $0148
549: L01AF := $01AF
550: L01B0 := $01B0
551: L01B1 := $01B1
552: L01B2 := $01B2
553: L01B3 := $01B3
554: L01B4 := $01B4
555: L01B5 := $01B5
556: .if CompileDrive >= DRIVE_1571CR
557: L01B6 := $01B6
558: .elseif CompileDrive >= DRIVE_1571
559: L01B6 := $01B4
560: .endif
561:
562: L01BB := $01BB
563:
564: SP_END := $0145
565:
566: CMDBUF := $0200
567: CMDBUF_End := $0228
568: CMDBUF_End2 := $022A
569: CMDNUM := $022A
570: LINTAB := $022B
571: CHNDAT := $022E
572: LINTAB_End := $0239
573: L023A := $023A
574: L023B := $023B
575: L023C := $023C
576: L023D := $023D
577: L023E := $023E
578:
579: L0243 := $0243
580: LSTCHR := $0244
581: TYPE := $024A
582: STRSIZ := $024B
583: TEMPSA := $024C
584: CMD := $024D
585: LSTSEC := $024E
586: BUFUSE := $024F
587: MDIRTY := $0251
588: ENTFND := $0253
589: DIRLST := $0254
590: CMDWAT := $0255
591: LINUSE := $0256
592: LBUSED := $0257
593: REC := $0258
594: TRKSS := $0259
595: SECSS := $025A
596: LSTJOB := $025B
597: DSEC := $0260
598: DIND := $0266
599: ERWORD := $026C
600: ERLED := $026D
601: PRGDRV := $026E
602: PRGSEC := $026F
603: WLINDX := $0270
604: RLINDX := $0271
605: NBTEMP := $0272
606: CMDSIZ := $0274
607: CHAR := $0275
608: LIMIT := $0276
609: F1CNT := $0277
610: F2CNT := $0278
611: F2PTR := $0279
612: FILTBL := $027A
613: FILTRK := $0280
614: FILSEC := $0285
615: PATFLG := $028A
616:
617:
618: PATFLG_WILDCARD := $80
619: IMAGE := $028B
620: DRVCNT := $028C
621: DRVFLG := $028D
622: LSTDRV := $028E
623: FOUND := $028F
624: DIRSEC := $0290
625: DELSEC := $0291
626: DELIND := $0292
627: LSTBUF := $0293
628: INDEX := $0294
629: FILCNT := $0295
630: TYPFLG := $0296
631: MODE := $0297
632: JOBRTN := $0298
633: EPTR := $0299
634: TOFF := $029A
635: UBAM := $029B
636: TBAM := $029D
637: BAM := $02A1
638: VIRQJOB1570 := $02A9
639: CNTMOTOR1570 := $02AB
640: MAXTRK1571 := $02AC
641: TMP1570 := $02AD
642: FLGMODE1570 := $02AF
643: L02B0 := $02B0
644: NAMBUF := $02B1
645: ERRBUF := $02D5
646: WBAM := $02F9
647: NDBL := $02FA
648: NDBH := $02FC
649: PHASE := $02FE
650: BUFFER0 := $0300
651: BUFFER1 := $0400
652: BUFFER2 := $0500
653: BUFFER3 := $0600
654: BUFFER4 := $0700
655:
656: RAM_PAGE1 := $0100
657: RAM_END := $07FF
658:
659:
660:
661:
662: VIA_O_PB := 0
663: VIA_O_PA := 1
664: VIA_O_DDRB := 2
665: VIA_O_DDRA := 3
666: VIA_O_T1CL := 4
667: VIA_O_T1CH := 5
668: VIA_O_T1CLL := 6
669: VIA_O_T1CHL := 7
670: VIA_O_T2CL := 8
671: VIA_O_T2CH := 9
672: VIA_O_SR := 10
673: VIA_O_ACR := 11
674: VIA_O_PCR := 12
675: VIA_O_IFR := 13
676: VIA_O_IEC := 14
677: VIA_O_PA_NO_HS := 15
678:
679: VIA_IFR_B_CA2 := $01
680: VIA_IFR_B_CA1 := $02
681: VIA_IFR_B_SR := $04
682: VIA_IFR_B_CB2 := $08
683: VIA_IFR_B_CB1 := $10
684: VIA_IFR_B_T2 := $20
685: VIA_IFR_B_T1 := $40
686: VIA_IFR_B_ANY := $80
687:
688: VIA_IER_B_CA2 := VIA_IFR_B_CA2
689: VIA_IER_B_CA1 := VIA_IFR_B_CA1
690: VIA_IER_B_SR := VIA_IFR_B_SR
691: VIA_IER_B_CB2 := VIA_IFR_B_CB2
692: VIA_IER_B_CB1 := VIA_IFR_B_CB1
693: VIA_IER_B_T2 := VIA_IFR_B_T2
694: VIA_IER_B_T1 := VIA_IFR_B_T1
695: VIA_IER_BW_SET := $80
696: VIA_IER_BW_UNSET := $00
697:
698: VIA_PCR_B_CA1_INPUT_POS_EDGE := $01
699: VIA_PCR_B_CA2_MASK := $0E
700: VIA_PCR_B_CA2_INPUT_NEG_CLEAR_ON_READ := $00
701: VIA_PCR_B_CA2_INPUT_NEG := $02
702: VIA_PCR_B_CA2_INPUT_POS_CLEAR_ON_READ := $04
703: VIA_PCR_B_CA2_INPUT_POS := $06
704: VIA_PCR_B_CA2_OUTPUT_HANDSHAKE := $08
705: VIA_PCR_B_CA2_OUTPUT_PULSE := $0A
706: VIA_PCR_B_CA2_OUTPUT_LOW := $0C
707: VIA_PCR_B_CA2_OUTPUT_HIGH := $0E
708: VIA_PCR_B_CB1_INPUT_POS_EDGE := $10
709: VIA_PCR_B_CB2_MASK := $E0
710: VIA_PCR_B_CB2_INPUT_NEG_CLEAR_ON_READ := $00
711: VIA_PCR_B_CB2_INPUT_NEG := $20
712: VIA_PCR_B_CB2_INPUT_POS_CLEAR_ON_READ := $40
713: VIA_PCR_B_CB2_INPUT_POS := $60
714: VIA_PCR_B_CB2_OUTPUT_HANDSHAKE := $80
715: VIA_PCR_B_CB2_OUTPUT_PULSE := $A0
716: VIA_PCR_B_CB2_OUTPUT_LOW := $C0
717: VIA_PCR_B_CB2_OUTPUT_HIGH := $E0
718:
719: VIA_ACR_B_PA_LATCH_ENABLE := $01
720: VIA_ACR_B_PB_LATCH_ENABLE := $02
721: VIA_ACR_B_SHIFT_MASK := $1C
722: VIA_ACR_B_SHIFT_DISABLED := $00
723: VIA_ACR_B_SHIFT_IN_T2 := $04
724: VIA_ACR_B_SHIFT_IN_PHI2 := $08
725: VIA_ACR_B_SHIFT_IN_EXTCLOCK_CB1 := $0C
726: VIA_ACR_B_SHIFT_FREERUNNING_T2 := $10
727: VIA_ACR_B_SHIFT_OUT_T2 := $14
728: VIA_ACR_B_SHIFT_OUT_PHI2 := $18
729: VIA_ACR_B_SHIFT_OUT_EXTCLOCK_CB1 := $1C
730: VIA_ACR_B_T2_CONTROL_PB6 := $20
731: VIA_ACR_B_T1_CONTROL_MASK := $C0
732: VIA_ACR_B_T1_CONTROL_ONESHOT := $00
733: VIA_ACR_B_T1_CONTROL_FREERUN := $40
734: VIA_ACR_B_T1_CONTROL_ONESHOT_PB7 := $80
735: VIA_ACR_B_T1_CONTROL_FREERUN_PB7 := $C0
736:
737:
738: VIA_ACR_B_T1_CONTROL_ONETIME := $40
739: VIA_ACR_B_T1_CONTROL_PB7_OUTPUT := $80
740:
741: VBC := $1800
742: VBC_PB1 := VBC + VIA_O_PB
743:
744: .if CompileDrive >= DRIVE_1540
745:
746: VBC_PA1_01 := $01
747: VBC_PA1_02 := $02
748: VBC_PA1_04 := $04
749: VBC_PA1_20 := $20
750: VBC_PA1_80 := $80
751:
752: VBC_PB1_1540_DATAIN := $01
753: VBC_PB1_1540_DATAOUT := $02
754: VBC_PB1_1540_CLOCKIN := $04
755: VBC_PB1_1540_CLOCKOUT := $08
756: VBC_PB1_1540_ATNA := $10
757: VBC_PB1_1540_DEVICENO0 := $20
758: VBC_PB1_1540_DEVICENO1 := $40
759: VBC_PB1_1540_ATNIN := $80
760:
761: .else
762:
763: VBC_PB1_2031_DEVICENO0 := VBC_PB1_2031_ATNA
764: VBC_PB1_2031_DEVICENO1 := VBC_PB1_2031_NRFD
765: VBC_PB1_2031_ATNA := $01
766: VBC_PB1_2031_NRFD := $02
767: VBC_PB1_2031_NDAC := $04
768: VBC_PB1_2031_EOI := $08
769: VBC_PB1_2031_TE := $10
770: VBC_PB1_2031_HDSEL := $20
771: VBC_PB1_2031_DAV := $40
772: VBC_PB1_2031_NATN := $80
773:
774:
775:
776:
777:
778:
779:
780:
781: .endif
782:
783: VBC_PA1 := VBC + VIA_O_PA
784: VBC_DDRB1 := VBC + VIA_O_DDRB
785: VBC_DDRA1 := VBC + VIA_O_DDRA
786: VBC_T1LC1 := VBC + VIA_O_T1CL
787: VBC_T1HC1 := VBC + VIA_O_T1CH
788: VBC_T1LL1 := VBC + VIA_O_T1CLL
789: VBC_T1HL1 := VBC + VIA_O_T1CHL
790: VBC_T2LC1 := VBC + VIA_O_T2CL
791: VBC_T2HC1 := VBC + VIA_O_T2CH
792: VBC_SR1 := VBC + VIA_O_SR
793: VBC_ACR1 := VBC + VIA_O_ACR
794: VBC_PCR1 := VBC + VIA_O_PCR
795: VBC_IFR1 := VBC + VIA_O_IFR
796: VBC_IER1 := VBC + VIA_O_IEC
797: VBC_PAUNBUF1 := VBC + VIA_O_PA_NO_HS
798:
799: VDC := $1C00
800:
801:
802:
803:
804: VDC_PB2 := VDC + VIA_O_PB
805: VDC_PB2_STEPPER0 := $01
806: VDC_PB2_STEPPER1 := $02
807: VDC_PB2_DRIVE0MOTOR := $04
808: VDC_PB2_DRIVE0LED := $08
809: VDC_PB2_DRIVE1LED := $00
810: VDC_PB2_WRITEPROTECT:= $10
811: VDC_PB2_BITRATE0 := $20
812: VDC_PB2_BITRATE1 := $40
813: VDC_PB2_SYNC := $80
814:
815: VDC_PB2_STEPPER := VDC_PB2_STEPPER0 | VDC_PB2_STEPPER1
816: VDC_PB2_DRIVELEDS := VDC_PB2_DRIVE0LED | VDC_PB2_DRIVE1LED
817: VDC_PB2_BITRATE := VDC_PB2_BITRATE0 | VDC_PB2_BITRATE1
818: VDC_PA2 := VDC + VIA_O_PA
819: VDC_DDRB2 := VDC + VIA_O_DDRB
820: VDC_DDRA2 := VDC + VIA_O_DDRA
821: VDC_T1LC2 := VDC + VIA_O_T1CL
822: VDC_T1HC2 := VDC + VIA_O_T1CH
823: VDC_T1LL2 := VDC + VIA_O_T1CLL
824: VDC_T1HL2 := VDC + VIA_O_T1CHL
825: VDC_T2LC2 := VDC + VIA_O_T2CL
826: VDC_T2HC2 := VDC + VIA_O_T2CH
827: VDC_SR2 := VDC + VIA_O_SR
828: VDC_ACR2 := VDC + VIA_O_ACR
829: VDC_PCR2 := VDC + VIA_O_PCR
830: VDC_IFR2 := VDC + VIA_O_IFR
831: VDC_IER2 := VDC + VIA_O_IEC
832: VDC_PAUNBUF2 := VDC + VIA_O_PA_NO_HS
833:
834:
835: .if CompileDrive >= DRIVE_1570
836:
837:
838: WD177x_O_COMMAND := 0
839: WD177x_O_STATUS := WD177x_O_COMMAND
840: WD177x_O_TRACK := 1
841: WD177x_O_SECTOR := 2
842: WD177x_O_DATA := 3
843:
844: WD177x := $2000
845: WD177x_COMMAND := WD177x + WD177x_O_COMMAND
846: WD177x_STATUS := WD177x + WD177x_O_STATUS
847: WD177x_TRACK := WD177x + WD177x_O_TRACK
848: WD177x_SECTOR := WD177x + WD177x_O_SECTOR
849: WD177x_DATA := WD177x + WD177x_O_DATA
850:
851:
852: CIA_O_PA := 0
853: CIA_O_PB := 1
854: CIA_O_DDRA := 2
855: CIA_O_DDRB := 3
856: CIA_O_TALO := 4
857: CIA_O_TAHI := 5
858: CIA_O_TBLO := 6
859: CIA_O_TBHI := 7
860: CIA_O_TOD10THS := 8
861: CIA_O_TODSEC := 9
862: CIA_O_TODMIN := 10
863: CIA_O_TODHR := 11
864: CIA_O_SDR := 12
865: CIA_O_ICR := 13
866: CIA_O_CRA := 14
867: CIA_O_CRB := 15
868:
869: CIA_ICR_B_TA := $01
870: CIA_ICR_B_TB := $02
871: CIA_ICR_B_TOD := $04
872: CIA_ICR_B_SP := $08
873: CIA_ICR_B_FLAG := $10
874: CIA_ICR_B_UNUSED := $60
875: CIA_ICR_BR_IR := $80
876: CIA_ICR_BW_SET := $80
877: CIA_ICR_BW_UNSET := $00
878:
879: CIA_CRA_B_START := $01
880: CIA_CRA_B_PBON := $02
881: CIA_CRA_B_TOGGLE := $04
882: CIA_CRA_B_ONESHOT := $08
883: CIA_CRA_B_FORCE_LOAD := $10
884: CIA_CRA_B_COUNT_CNT := $20
885: CIA_CRA_B_SP_OUTPUT := $40
886: CIA_CRA_B_50HZ := $80
887:
888: CIA_CRB_B_START := $01
889: CIA_CRB_B_PBON := $02
890: CIA_CRB_B_TOGGLE := $04
891: CIA_CRB_B_ONESHOT := $08
892: CIA_CRB_B_FORCE_LOAD := $10
893: CIA_CRB_B_TOD_ALARM := $80
894:
895: CIA_CRB_B_MODE_MASK := $60
896: CIA_CRB_B_MODE_PHI2 := $00
897: CIA_CRB_B_MODE_CNT := $20
898: CIA_CRB_B_MODE_TA_ := $40
899: CIA_CRB_B_MODE_TA_WITH_CNT := $60
900:
901: CIA := $4000
902: CIA_TALO := CIA + CIA_O_TALO
903: CIA_TAHI := CIA + CIA_O_TAHI
904: CIA_SDR := CIA + CIA_O_SDR
905: CIA_ICR := CIA + CIA_O_ICR
906: CIA_CRA := CIA + CIA_O_CRA
907: CIA_CRB := CIA + CIA_O_CRB
908:
909: .endif
910:
911: .if CompileDrive >= DRIVE_1571CR
912: CSG5710_4 := WD177x_COMMAND + 4
913: CSG5710_5 := WD177x_COMMAND + 5
914:
915: CSG5710_4010 := $4010
916:
917: .endif
918:
919: .if CompileDrive >= DRIVE_1570
920: INIT_VBC_DDRA1 = $66
921: .elseif CompileDrive >= DRIVE_1541C_01 .AND CompileDrive <> DRIVE_1541C_03
922: INIT_VBC_DDRA1 = $FE
923: .else
924: INIT_VBC_DDRA1 = $FF
925: .endif
926:
927: IEC_LISTEN := $20
928: IEC_TALK := $40
929:
930: IEEE_LISTEN := IEC_LISTEN
931: IEEE_TALK := IEC_TALK
932: IEEE_OPEN := $60
933:
934:
935: ERRORCODE_00_OK = $00
936: ERRORCODE_01_FILES_SCRATCHED = $01
937: ERRORCODE_20_READ_ERROR = $20
938: ERRORCODE_21_READ_ERROR = $21
939: ERRORCODE_22_READ_ERROR = $22
940: ERRORCODE_23_READ_ERROR = $23
941: ERRORCODE_24_READ_ERROR = $24
942: ERRORCODE_25_WRITE_ERROR = $25
943: ERRORCODE_26_WRITE_PROTECT_ON = $26
944: ERRORCODE_27_READ_ERROR = $27
945: ERRORCODE_28_WRITE_ERROR = $28
946: ERRORCODE_29_DISK_ID_MISMATCH = $29
947: ERRORCODE_30_SYNTAX_ERROR = $30
948: ERRORCODE_31_SYNTAX_ERROR = $31
949: ERRORCODE_32_SYNTAX_ERROR = $32
950: ERRORCODE_33_SYNTAX_ERROR = $33
951: ERRORCODE_34_SYNTAX_ERROR = $34
952: ERRORCODE_39_FILE_NOT_FOUND = $39
953: ERRORCODE_50_RECORD_NOT_PRESENT = $50
954: ERRORCODE_51_OVERFLOW_IN_RECORD = $51
955: ERRORCODE_52_FILE_TOO_LARGE = $52
956: ERRORCODE_60_WRITE_FILE_OPEN = $60
957: ERRORCODE_61_FILE_NOT_OPEN = $61
958: ERRORCODE_62_FILE_NOT_FOUND = $62
959: ERRORCODE_63_FILE_EXISTS = $63
960: ERRORCODE_64_FILE_TYPE_MISMATCH = $64
961: ERRORCODE_65_NO_BLOCK = $65
962: ERRORCODE_66_ILLEGAL_TRACK_OR_SECTOR = $66
963: ERRORCODE_67_ILLEGAL_TRACK_OR_SECTOR = $67
964: ERRORCODE_70_NO_CHANNEL = $70
965: ERRORCODE_71_DIR_ERROR = $71
966: ERRORCODE_72_DISK_FULL = $72
967: ERRORCODE_73_IDENTIFY = $73
968: ERRORCODE_74_DRIVE_NOT_READY = $74
969:
970: ERRORCODE_03_FILE = $03
971: ERRORCODE_04_OPEN = $04
972: ERRORCODE_05_MISMATCH = $05
973: ERRORCODE_06_NOT = $06
974: ERRORCODE_07_FOUND = $07
975: ERRORCODE_08_DISK = $08
976: ERRORCODE_09_ERROR = $09
977: ERRORCODE_0A_WRITE = $0A
978: ERRORCODE_0B_RECORD = $0B
979:
980:
981: ERRORCODE_NO_PSEUDO = ERRORCODE_20_READ_ERROR
982:
983:
984: .macro SET_WPSW_DIRTY_NO_CR
985: .if CompileDrive >= DRIVE_1571_05
986: jsr PATCH_WPSW
987: nop
988: .else
989: lda #$01
990: sta WPSW
991: .endif
992: .endmacro
993:
994: .macro SET_WPSW_DIRTY
995: .if CompileDrive >= DRIVE_1571_05 .AND CompileDrive < DRIVE_1571CR
996: jsr PATCH_WPSW
997: nop
998: .else
999: lda #$01
1000: sta WPSW
1001: .endif
1002: .endmacro
1003:
1004:
1005:
1006:
1007:
1008:
1009:
1010:
1011:
1012: .macro CONVERT_BIN_TO_BCD_PARTIAL
1013: @Next:
1014: cpx #$00
1015: beq @Done
1016: clc
1017: adc #$01
1018: dex
1019: jmp @Next
1020: @Done:
1021: .endmacro
1022:
1023: .macro CONVERT_BIN_TO_BCD
1024: lda #$00
1025: sed
1026: CONVERT_BIN_TO_BCD_PARTIAL
1027: .endmacro
1028:
1029: .if CompileDrive >= DRIVE_1570
1030: * = $8000
1031:
1032: L8000:
1033: .byte DRIVE_8000
1034: L8001:
1035: .byte DRIVE_8001
1036:
1037: L8002:
1038: .if CompileDrive >= DRIVE_1571CR_01
1039: .byte "S/W BY DAVID G SIRACUSA",$0D
1040: .byte "5710 BY C. HAUCK",$0D
1041: .byte "1986",$0D
1042: .else
1043: .byte "S/W - DAVID G SIRACUSA",$0D
1044: .byte "H/W - GREG BERLIN",$0D
1045: .byte "1985",$0D
1046: .endif
1047:
1048: U0CommandPatch157x:
1049: lda CMDSIZ
1050: cmp #$03
1051: bcc @OriginalUxCommand
1052: lda CMDBUF + 2
1053: sta HINIB
1054: and #$1F
1055: tax
1056: asl a
1057: tay
1058: lda L808E,y
1059: sta IP
1060: lda L808E + 1,y
1061: sta IP + 1
1062: cpx #$1E
1063: beq @L8056
1064: lda VBC_PAUNBUF1
1065: and #VBC_PA1_20
1066: beq @OriginalUxCommand
1067: @L8056:
1068: lda BITCNT
1069: and #$EB
1070: sta BITCNT
1071: lda L806E,x
1072: sta CMDBUF + 2
1073: .if CompileDrive >= DRIVE_1571_05
1074: jmp LAAE7
1075: .else
1076: jmp (IP)
1077: .endif
1078: @OriginalUxCommand:
1079: lda #<AddressesUxCommands
1080: sta USRJMP
1081: lda #>AddressesUxCommands
1082: sta USRJMP + 1
1083: L806D:
1084: rts
1085:
1086: L806E:
1087: .byte $80,$81,$90,$91,$B0,$B1,$F0,$F1
1088: .byte $00,$01,$B0,$01,$00,$01,$00,$01
1089: .byte $80,$81,$90,$91,$B0,$B1,$F0,$F1
1090: .byte $00,$01,$B0,$01,$00,$01,$00,$80
1091:
1092: L808E:
1093: .addr L8371
1094: .addr L837F
1095: .addr L83EC
1096: .addr L83F8
1097: .addr L848B
1098: .addr L837F
1099: .addr L84B7
1100: .addr L84B7
1101: .addr L84F1
1102: .addr L84F1
1103: .addr L8517
1104: .addr L837F
1105: .addr L856B
1106: .addr L837F
1107: .addr L85A5
1108: .addr L85A5
1109: .addr L8371
1110: .addr L837F
1111: .addr L83EC
1112: .addr L83F8
1113: .addr L848B
1114: .addr L837F
1115: .addr L84B7
1116: .addr L84B7
1117: .addr L806D
1118: .addr L806D
1119: .addr L8517
1120: .addr L837F
1121: .addr L806D
1122: .addr L806D
1123: .addr L8FE5
1124: .addr L9080
1125: L80CE:
1126: sei
1127: lda #$00
1128: sta ATNPND
1129: sta LSNACT
1130: sta TLKACT
1131: ldx #$45
1132: txs
1133: jsr L81B2
1134: lda #$80
1135: sta EIOFLG
1136: sta ATNMOD
1137: jsr ClearClockOut
1138: jsr SetDataOut
1139: lda VBC_PB1
1140: ora #VBC_PB1_1540_ATNA
1141: sta VBC_PB1
1142: L80F1:
1143: lda VBC_PB1
1144: bpl L815A
1145: and #VBC_PB1_1540_CLOCKIN
1146: bne L80F1
1147: L80FA:
1148: jsr L82CA
1149: cmp #$3F
1150: bne L810D
1151: lda BITCNT
1152: and #$BF
1153: sta BITCNT
1154: lda #$00
1155: sta LSNACT
1156: beq L811B
1157: L810D:
1158: cmp #$5F
1159: bne L811E
1160: lda BITCNT
1161: and #$BF
1162: sta BITCNT
1163: lda #$00
1164: sta TLKACT
1165: L811B:
1166: jmp L8192
1167: L811E:
1168: cmp TLKADR
1169: bne L812C
1170: lda #$01
1171: sta TLKACT
1172: lda #$00
1173: sta LSNACT
1174: beq L8155
1175: L812C:
1176: cmp LSNADR
1177: bne L813A
1178: lda #$01
1179: sta LSNACT
1180: lda #$00
1181: sta TLKACT
1182: beq L8155
1183: L813A:
1184: tax
1185: and #$60
1186: cmp #$60
1187: bne L818D
1188: txa
1189: sta ORGSA
1190: and #$0F
1191: sta SA
1192: lda ORGSA
1193: and #$F0
1194: cmp #$E0
1195: bne L8192
1196: cli
1197: jsr LDAC0
1198: sei
1199: L8155:
1200: bit VBC_PB1
1201: bmi L80FA
1202: L815A:
1203: lda #$00
1204: sta ATNMOD
1205: lda VBC_PB1
1206: and # ~ VBC_PB1_1540_ATNA
1207: sta VBC_PB1
1208: lda LSNACT
1209: beq L8177
1210: bit BITCNT
1211: bvc L8171
1212: jsr L8199
1213: L8171:
1214: jsr L8342
1215: jmp MainLoopEntry1570
1216: L8177:
1217: lda TLKACT
1218: beq L818A
1219: jsr ClearDataOut
1220: jsr SetClockOut
1221: jsr LA483
1222: jsr L81EA
1223: jsr LA483
1224: L818A:
1225: jmp L8366
1226: L818D:
1227: lda #VBC_PB1_1540_ATNA
1228: sta VBC_PB1
1229: L8192:
1230: bit VBC_PB1
1231: bpl L815A
1232: bmi L8192
1233: L8199:
1234: jsr TestATN
1235: jsr ReadIecBusIn
1236: and #VBC_PB1_1540_CLOCKIN
1237: bne L8199
1238: jsr L81CE
1239: lda #$00
1240: sta CIA_SDR
1241: lda #CIA_ICR_B_SP
1242: L81AD:
1243: bit CIA_ICR
1244: beq L81AD
1245:
1246: L81B2:
1247: php
1248: sei
1249: lda CIA_CRA
1250: and # ~ CIA_CRA_B_SP_OUTPUT
1251: sta CIA_CRA
1252:
1253: lda VBC_PAUNBUF1
1254: and # ~ VBC_PA1_02
1255: sta VBC_PAUNBUF1
1256:
1257: .if CompileDrive >= DRIVE_1571_05
1258: lda #CIA_ICR_BW_SET | CIA_ICR_B_SP
1259: .else
1260: lda #CIA_ICR_BW_SET | CIA_ICR_B_TOD
1261: .endif
1262: sta CIA_ICR
1263: bit CIA_ICR
1264: plp
1265: rts
1266:
1267: L81CE:
1268: php
1269: sei
1270: lda VBC_PAUNBUF1
1271: ora #VBC_PA1_02
1272: sta VBC_PAUNBUF1
1273: lda CIA_CRA
1274: ora #CIA_CRA_B_SP_OUTPUT
1275: sta CIA_CRA
1276: lda #CIA_ICR_B_SP
1277: sta CIA_ICR
1278: bit CIA_ICR
1279: plp
1280: rts
1281: L81EA:
1282: sei
1283: jsr LD0EB
1284: bcs L81F6
1285: L81F0:
1286: ldx LINDX
1287: lda CHNRDY,x
1288: bmi L81F7
1289: L81F6:
1290: rts
1291: L81F7:
1292: jsr TestATN
1293: jsr ReadIecBusIn
1294: and #VBC_PB1_1540_DATAIN
1295: php
1296: jsr ClearClockOut
1297: plp
1298: beq L8218
1299: L8206:
1300: jsr TestATN
1301: jsr ReadIecBusIn
1302: and #VBC_PB1_1540_DATAIN
1303: bne L8206
1304: ldx LINDX
1305: lda CHNRDY,x
1306: and #$08
1307: bne L822C
1308: L8218:
1309: jsr TestATN
1310: jsr ReadIecBusIn
1311: and #VBC_PB1_1540_DATAIN
1312: bne L8218
1313: L8222:
1314: jsr TestATN
1315: jsr ReadIecBusIn
1316: and #VBC_PB1_1540_DATAIN
1317: beq L8222
1318: L822C:
1319: jsr SetClockOut
1320: jsr TestATN
1321: jsr ReadIecBusIn
1322: and #VBC_PB1_1540_DATAIN
1323: bne L822C
1324: bit BITCNT
1325: bvc L8276
1326: lda VBC_PAUNBUF1
1327: ora #VBC_PA1_02
1328: sta VBC_PAUNBUF1
1329: lda CIA_CRA
1330: ora #CIA_CRA_B_SP_OUTPUT
1331: sta CIA_CRA
1332: bit CIA_ICR
1333: ldx LINDX
1334: lda L023E,x
1335: sta CIA_SDR
1336: L8258:
1337: lda CIA_ICR
1338: and #$08
1339: beq L8258
1340: lda CIA_CRA
1341: and # ~ CIA_CRA_B_SP_OUTPUT
1342: sta CIA_CRA
1343: lda VBC_PAUNBUF1
1344: and # ~ VBC_PA1_02
1345: sta VBC_PAUNBUF1
1346: .if CompileDrive >= DRIVE_1571_05
1347: lda #CIA_ICR_BW_SET | CIA_ICR_B_SP
1348: .else
1349: lda #CIA_ICR_BW_SET | CIA_ICR_B_TOD
1350: .endif
1351: sta CIA_ICR
1352: bne L82B2
1353: L8276:
1354: lda #$08
1355: sta CONT
1356: L827A:
1357: jsr ReadIecBusIn
1358: and #VBC_PB1_1540_DATAIN
1359: bne L82C4
1360: L8281:
1361: ldx LINDX
1362: lda L023E,x
1363: ror a
1364: sta L023E,x
1365: bcs L8291
1366: jsr SetDataOut
1367: bne L8294
1368: L8291:
1369: jsr ClearDataOut
1370: L8294:
1371: jsr LA47E
1372: lda DRVTRK + 1
1373: .if CompileDrive >= DRIVE_1571_05
1374: bne L829E
1375: .else
1376: bne L8281
1377: .endif
1378: jsr LA483
1379: L829E:
1380: jsr ClearClockOut
1381: jsr LA47E
1382: lda DRVTRK + 1
1383: bne L82AB
1384: jsr LA483
1385: L82AB:
1386: jsr LFEFB
1387: dec CONT
1388: bne L827A
1389: L82B2:
1390: jsr TestATN
1391: jsr ReadIecBusIn
1392: and #VBC_PB1_1540_DATAIN
1393: beq L82B2
1394: cli
1395: jsr LD3AA
1396: sei
1397: jmp L81F0
1398: L82C4:
1399: jmp L8362
1400: L82C7:
1401: bit CIA_ICR
1402: L82CA:
1403: lda #$08
1404: sta CONT
1405: L82CE:
1406: jsr TestATN
1407: jsr ReadIecBusIn
1408: and #VBC_PB1_1540_CLOCKIN
1409: bne L82CE
1410: jsr ClearDataOut
1411: lda #$01
1412: L82DD:
1413: bit VBC_PB1
1414: bne L82DD
1415: .if CompileDrive >= DRIVE_1571_05
1416: jsr LAA76
1417: .else
1418: sta VBC_T1HC1
1419: .endif
1420: L82E5:
1421: jsr TestATN
1422: lda VBC_IFR1
1423: and #$40
1424: bne L82F8
1425: jsr ReadIecBusIn
1426: and #VBC_PB1_1540_CLOCKIN
1427: beq L82E5
1428: bne L8311
1429: L82F8:
1430: jsr SetDataOut
1431: ldx #$18
1432: L82FD:
1433: dex
1434: bne L82FD
1435: jsr ClearDataOut
1436: L8303:
1437: jsr TestATN
1438: jsr ReadIecBusIn
1439: and #VBC_PB1_1540_CLOCKIN
1440: beq L8303
1441: lda #$00
1442: sta EIOFLG
1443: L8311:
1444: lda VBC_PB1
1445: eor #VBC_PB1_1540_DATAIN
1446: tax
1447: lda CIA_ICR
1448: and #CIA_ICR_B_SP
1449: beq L8326
1450: lda CIA_SDR
1451: sta DATA
1452: jmp L833C
1453: L8326:
1454: txa
1455: lsr a
1456: and #$02
1457: bne L8311
1458: ror DATA
1459: L832E:
1460: jsr TestATN
1461: jsr ReadIecBusIn
1462: and #VBC_PB1_1540_CLOCKIN
1463: beq L832E
1464: dec CONT
1465: bne L8311
1466: L833C:
1467: jsr SetDataOut
1468: lda DATA
1469: rts
1470: L8342:
1471: sei
1472: jsr LD107
1473: bcs L834D
1474: lda CHNRDY,x
1475: ror a
1476: bcs L8358
1477: L834D:
1478: lda ORGSA
1479: and #$F0
1480: cmp #$F0
1481: beq L8358
1482: jmp L8366
1483: L8358:
1484: jsr L82C7
1485: cli
1486: jsr LCFB7
1487: jmp L8342
1488: L8362:
1489: lda #$00
1490: sta BITCNT
1491: L8366:
1492: lda #0
1493: sta VBC_PB1
1494: MainLoopEntry1570:
1495: jsr L81B2
1496: jmp MainLoopEntry
1497: L8371:
1498: sta CMD
1499: sta AF
1500: lda VBC_IFR1
1501: lsr a
1502: bcc L8394
1503: ldx #$0B
1504: .byte ASM_BIT3
1505: L837F:
1506: ldx #$4F
1507: L8381:
1508: jsr L85E9
1509: L8384:
1510: jsr L8581
1511: L8387:
1512: cpx #$02
1513: bcs L838C
1514: rts
1515: L838C:
1516: txa
1517: and #$0F
1518: ldx #$00
1519: jmp LE60A
1520: L8394:
1521: jsr L81CE
1522: bit AS
1523: bpl L83A0
1524: lda #$09
1525: jmp L86E6
1526: L83A0:
1527: jsr LC63D
1528: L83A3:
1529: cli
1530: lda HINIB
1531: and #$20
1532: bne L83D0
1533: lda CMDBUF + 3
1534: sta TRACK0
1535: lda CMDBUF + 4
1536: sta SECTOR0
1537: ldx #$00
1538: lda AF
1539: sta JOBS0,x
1540: jsr L865E
1541: sei
1542: jsr L85E9
1543: bit HINIB
1544: bvs L83C9
1545: cpx #$02
1546: bcs L8381
1547: L83C9:
1548: jsr L85F9
1549: lda HINIB
1550: bmi L83DD
1551: L83D0:
1552: ldy #$00
1553: L83D2:
1554: lda BUFFER0,y
1555: sta CTRACK
1556: jsr L85F9
1557: iny
1558: bne L83D2
1559: L83DD:
1560: dec CMDBUF + 5
1561: beq L83E8
1562: jsr L861E
1563: jmp L83A3
1564: L83E8:
1565: cli
1566: jmp L85AF
1567: L83EC:
1568: sta CMD
1569: lda VBC_IFR1
1570: lsr a
1571: bcc L8402
1572: ldx #$0B
1573: .byte ASM_BIT3
1574: L83F8:
1575: ldx #$4F
1576: stx CTRACK
1577: lda HINIB
1578: ora #$08
1579: sta HINIB
1580: L8402:
1581: bit AS
1582: bpl L840B
1583: lda #$0A
1584: jmp L86E6
1585: L840B:
1586: jsr LC63D
1587: lda HINIB
1588: bmi L843B
1589: L8412:
1590: sei
1591: ldy #$00
1592: L8415:
1593: lda VBC_PB1
1594: eor #VBC_PB1_1540_CLOCKOUT
1595: bit CIA_ICR
1596: sta VBC_PB1
1597: L8420:
1598: lda VBC_PB1
1599: bpl L8428
1600: jsr TestATN
1601: L8428:
1602: lda CIA_ICR
1603: and #CIA_ICR_B_SP
1604: beq L8420
1605: lda CIA_SDR
1606: sta BUFFER0,y
1607: iny
1608: bne L8415
1609: jsr ClearClockOut
1610: L843B:
1611: cli
1612: lda HINIB
1613: and #$20
1614: bne L8479
1615: lda HINIB
1616: and #$08
1617: beq L844D
1618: ldx CTRACK
1619: jmp L8381
1620: L844D:
1621: lda CMDBUF + 3
1622: sta TRACK0
1623: lda CMDBUF + 4
1624: sta SECTOR0
1625: ldx #$00
1626: lda #$90
1627: sta JOBS0,x
1628: jsr L865E
1629: sei
1630: jsr L81CE
1631: jsr L85E9
1632: jsr L85F9
1633: jsr L86A0
1634: jsr L81B2
1635: cli
1636: bit HINIB
1637: bvs L8479
1638: cpx #$02
1639: bcs L8484
1640: L8479:
1641: dec CMDBUF + 5
1642: beq L8487
1643: jsr L861E
1644: jmp L8412
1645: L8484:
1646: jmp L838C
1647: L8487:
1648: cli
1649: jmp L85AF
1650: L848B:
1651: lda CMDBUF + 2
1652: and #$01
1653: bne L84B2
1654: lda #$01
1655: sta VBC_IFR1
1656: lda #$05
1657: jsr L86E6
1658: ldx L01B0
1659: cpx #$02
1660: bcc L84B4
1661: ldx #$00
1662: stx AS
1663: lda #$B0
1664: .if CompileDrive >= DRIVE_1571_05
1665: jsr LC075
1666: .else
1667: sta CMD
1668: .endif
1669: sta JOBS0,x
1670: jsr L865E
1671: .byte ASM_BIT3
1672: L84B2:
1673: ldx #$4F
1674: L84B4:
1675: jmp L8381
1676: L84B7:
1677: lda CMDBUF + 2
1678: and #$01
1679: bne L84E9
1680: lda CMDBUF + 3
1681: bpl L84C8
1682: lda #$08
1683: jmp L86E6
1684: L84C8:
1685: lda #$00
1686: sta AS
1687: sta NODRV
1688: lda CMDBUF + 4
1689: sta DiskID0
1690: lda CMDBUF + 5
1691: sta DiskID0 + 1
1692: jsr LD307
1693: lda #$01
1694: sta TRACK
1695: lda #$FF
1696: sta JOBRTN
1697: .if CompileDrive = DRIVE_1571_03
1698: jsr LA989
1699: .else
1700: jsr LAA4D
1701: .endif
1702: tax
1703: .byte ASM_BIT3
1704: L84E9:
1705: ldx #$4F
1706: jsr L85E9
1707: jmp L8387
1708: L84F1:
1709: sei
1710: bit HINIB
1711: bpl L8500
1712: jsr L81CE
1713: lda BYTE
1714: sta CTRACK
1715: jmp L85F9
1716: L8500:
1717: ldx CMDSIZ
1718: cpx #$04
1719: bcs L8511
1720: ldx #$0E
1721: jsr L85E9
1722: lda #ERRORCODE_31_SYNTAX_ERROR
1723: jmp GenerateErrorMessage
1724:
1725:
1726: L8511:
1727: lda CMDBUF + 3
1728: sta BYTE
1729: rts
1730: L8517:
1731: jsr L848B
1732: bit AS
1733: bpl L8566
1734: lda #$0D
1735: jsr L86E6
1736: ldx L01B0
1737: cpx #$02
1738: bcs L8532
1739: jsr L8961
1740: jsr L8986
1741: txa
1742: pha
1743: L8532:
1744: sei
1745: jsr L81CE
1746: lda AS
1747: sta CTRACK
1748: jsr L85F9
1749: ldx L01B0
1750: cpx #$02
1751: bcs L8567
1752: lda MYPA
1753: sta CTRACK
1754: jsr L85F9
1755: lda NMIFLG
1756: sta CTRACK
1757: jsr L85F9
1758: lda ACLSTP
1759: sta CTRACK
1760: jsr L85F9
1761: lda RSTEPS
1762: sta CTRACK
1763: jsr L85F9
1764: pla
1765: sta CTRACK
1766: .if CompileDrive >= DRIVE_1571_05
1767: jmp LAAC5
1768: .else
1769: jsr L85F9
1770: .endif
1771: L8566:
1772: rts
1773: L8567:
1774: pla
1775: jmp L838C
1776: L856B:
1777: bit HINIB
1778: bpl L8596
1779: bit HINIB
1780: bvc L8581
1781: lda VBC_IFR1
1782: lsr a
1783: bcc L8581
1784: lda AS
1785: and #$F0
1786: ora #$0B
1787: sta AS
1788: L8581:
1789: sei
1790: jsr L81CE
1791: lda AS
1792: sta CTRACK
1793: jsr L85F9
1794: lda #ERRORCODE_00_OK
1795: sta ERWORD
1796: jsr L81B2
1797: cli
1798: rts
1799: L8596:
1800: lda CMDBUF + 3
1801: sta AS
1802: bit HINIB
1803: bvc L85A4
1804: lda #$01
1805: sta VBC_IFR1
1806: L85A4:
1807: rts
1808: L85A5:
1809: ldx #$0E
1810: jsr L85E9
1811: lda #ERRORCODE_31_SYNTAX_ERROR
1812: jmp GenerateErrorMessage
1813:
1814:
1815: L85AF:
1816: lda CMDSIZ
1817: cmp #$07
1818: bcc L85E8
1819: lda TRACK0
1820: tay
1821: sbc #$01
1822: asl a
1823: sta MINSTP
1824: cpy #$24
1825: php
1826: ldy CMDBUF + 6
1827: sty DRVTRK
1828: dey
1829: sty NMIFLG
1830: cpy #$23
1831: ror a
1832: plp
1833: and #$80
1834: bcc L85DC
1835: bmi L85E5
1836: clc
1837: lda NMIFLG
1838: adc #$23
1839: sta NMIFLG
1840: bmi L85E5
1841: L85DC:
1842: bpl L85E5
1843: sec
1844: lda NMIFLG
1845: sbc #$23
1846: sta NMIFLG
1847: L85E5:
1848: jmp L87BA
1849: L85E8:
1850: rts
1851: L85E9:
1852: stx CTRACK
1853: lda AS
1854: and #$F0
1855: ora CTRACK
1856: sta AS
1857: sta CTRACK
1858: rts
1859: L85F6:
1860: jsr TestATN
1861: L85F9:
1862: lda VBC_PB1
1863: cmp VBC_PB1
1864: bne L85F9
1865: and #$FF
1866: bmi L85F6
1867: eor BITCNT
1868: and #$04
1869: beq L85F9
1870: lda CTRACK
1871: .if CompileDrive >= DRIVE_1571_05
1872: jmp LAB10
1873: .else
1874: sta CIA_SDR
1875: .endif
1876: lda BITCNT
1877: eor #$04
1878: sta BITCNT
1879: lda #CIA_ICR_B_SP
1880: L8618:
1881: bit CIA_ICR
1882: beq L8618
1883: rts
1884:
1885: L861E:
1886: lda CMDBUF + 3
1887: cmp #$24
1888: bcc L8627
1889: sbc #$23
1890: L8627:
1891: tax
1892: lda L9409 + 34,x
1893: tax
1894: dex
1895: stx CTRACK
1896: clc
1897: lda CMDBUF + 4
1898: adc BYTE
1899: cmp CTRACK
1900: bcc L8643
1901: sbc CTRACK
1902: beq L8641
1903: sec
1904: sbc #$01
1905: .byte ASM_BIT3
1906: L8641:
1907: lda CTRACK
1908: L8643:
1909: sta CMDBUF + 4
1910: lda #$88
1911: sta AF
1912: rts
1913: L864B:
1914: ldx JOBNUM
1915: php
1916: cli
1917: jsr L9FB6
1918: cmp #$02
1919: bcc L865B
1920: jsr L8683
1921: lda JOBS0,x
1922: L865B:
1923: tax
1924: plp
1925: rts
1926: L865E:
1927: ldx #$00
1928: php
1929: sei
1930: lda VDC_PB2
1931: ora #VDC_PB2_DRIVE0LED
1932: sta VDC_PB2
1933: cli
1934: jsr L9FB6
1935: cmp #$02
1936: bcc L8675
1937: jsr L8683
1938: L8675:
1939: sei
1940: lda VDC_PB2
1941: and # ~ VDC_PB2_DRIVELEDS
1942: sta VDC_PB2
1943: lda JOBS0,x
1944: tax
1945: plp
1946: rts
1947: L8683:
1948: lda #$FF
1949: sta JOBRTN
1950: stx JOBNUM
1951: lda CMDBUF + 2
1952: sta AF
1953: sta CMD
1954: sta LSTJOB,x
1955: .if CompileDrive >= DRIVE_1571_05
1956: sta JOBS0,x
1957: .else
1958: sta JOBS0
1959: .endif
1960: jsr L9FB6
1961: jmp LD599
1962: L869D:
1963: jsr TestATN
1964: L86A0:
1965: lda VBC_PB1
1966: cmp VBC_PB1
1967: bne L86A0
1968: and #$FF
1969: bmi L869D
1970: eor BITCNT
1971: and #$04
1972: beq L86A0
1973: lda BITCNT
1974: eor #$04
1975: sta BITCNT
1976: rts
1977: L86B9:
1978: .byte $00,$15,$00,$00,$00,$15,$00,$BC
1979: .byte $34,$DE,$FE,$DC,$15,$15,$00
1980: L86C8:
1981: .addr L89EC
1982: .addr L89EF
1983: .addr L89FD
1984: .addr L8A03
1985: .addr L8A08
1986: .addr L8A09
1987: .addr L87BA
1988: .addr L8A86
1989: .addr L8C57
1990: .addr L8D67
1991: .addr L8DF6
1992: .if CompileDrive >= DRIVE_1571CR
1993: .addr LACC7
1994: .addr LAD2E
1995: .addr LAD93
1996: .else
1997: .addr L8EC6
1998: .addr L8F18
1999: .addr L8F5F
2000: .endif
2001: .addr L89B3
2002:
2003: L86E6:
2004: sei
2005: pha
2006: tax
2007: lda L86B9,x
2008: sta ACTJOB
2009: lda AS
2010: ora #$80
2011: sta AS
2012: asl ACTJOB
2013: bcc L86FD
2014: lda CMDBUF + 3
2015: sta NMIFLG
2016: L86FD:
2017: asl ACTJOB
2018: bcc L8706
2019: lda CMDBUF + 4
2020: sta SECTR
2021: L8706:
2022: asl ACTJOB
2023: bcc L871B
2024: lda VDC_PB2
2025: and #VDC_PB2_WRITEPROTECT
2026: bne L871B
2027: lda HINIB
2028: ora #$08
2029: sta HINIB
2030: ldx #$08
2031: stx CTRACK
2032: L871B:
2033: asl ACTJOB
2034: bcc L8722
2035: jsr L8794
2036: L8722:
2037: asl ACTJOB
2038: bcc L8729
2039: jsr L87BA
2040: L8729:
2041: asl ACTJOB
2042: bcc L8730
2043: jsr L87B0
2044: L8730:
2045: jsr L8954
2046: asl ACTJOB
2047: bcc L873A
2048: jsr L892A
2049: L873A:
2050: lda #$00
2051: pla
2052: asl a
2053: tax
2054: lda L86C8,x
2055: sta T0
2056: lda L86C8 + 1,x
2057: sta T1
2058: .if CompileDrive >= DRIVE_1571CR_01
2059: jsr L877C
2060: .endif
2061: jsr L8761
2062: jsr LF98F
2063: .if CompileDrive >= DRIVE_1571CR_01
2064: jsr L8788
2065: .endif
2066: ldx L01B0
2067: cpx #$02
2068: php
2069: asl ACTJOB
2070: bcs L875F
2071: plp
2072: bcc L8760
2073: jmp L838C
2074: L875F:
2075: plp
2076: L8760:
2077: rts
2078:
2079: L8761:
2080: jmp (T0)
2081:
2082: L8764:
2083: php
2084: sei
2085: lda VDC_PB2
2086: ora #VDC_PB2_DRIVE0MOTOR
2087: sta VDC_PB2
2088: plp
2089: rts
2090: L8770:
2091: php
2092: sei
2093: lda VDC_PB2
2094: and # ~ VDC_PB2_DRIVE0MOTOR
2095: sta VDC_PB2
2096: plp
2097: rts
2098: L877C:
2099: php
2100: sei
2101: lda VDC_PB2
2102: ora #VDC_PB2_DRIVE0LED
2103: sta VDC_PB2
2104: plp
2105: rts
2106: L8788:
2107: php
2108: sei
2109: lda VDC_PB2
2110: and # ~ VDC_PB2_DRIVELEDS
2111: sta VDC_PB2
2112: plp
2113: rts
2114: L8794:
2115: php
2116: sei
2117: lda DRVST
2118: .if CompileDrive >= DRIVE_1571_05
2119: bmi L87A2
2120: and #$30
2121: beq L87A4
2122: lda #$20
2123: .else
2124: cmp #$20
2125: beq L87AA
2126: lda CMDBUF + 2
2127: and #$01
2128: sta CDRIVE
2129: jsr L8764
2130: lda #$A0
2131: .endif
2132: sta DRVST
2133:
2134: .if CompileDrive >= DRIVE_1571_05
2135: L87A2:
2136: plp
2137: .else
2138: L87AA:
2139: lda #$32
2140: sta ACLTIM
2141: plp
2142: .endif
2143: rts
2144: .if CompileDrive >= DRIVE_1571_05
2145: L87A4:
2146: plp
2147: sta CDRIVE
2148: jmp LF97E
2149: .if CompileDrive >= DRIVE_1571CR_01
2150: .else
2151: FillNOP 6
2152: .endif
2153: .endif
2154: L87B0:
2155: php
2156: cli
2157: L87B2:
2158: lda DRVST
2159: cmp #$20
2160: bne L87B2
2161: plp
2162: rts
2163: L87BA:
2164: php
2165: cli
2166: lda NMIFLG
2167: asl a
2168: cmp MINSTP
2169: beq L87DD
2170: L87C3:
2171: lda NMIFLG
2172: asl a
2173: cmp MINSTP
2174: beq L87D8
2175: bcs L87D2
2176: jsr L87E7
2177: jmp L87C3
2178: L87D2:
2179: jsr L87DF
2180: jmp L87C3
2181: L87D8:
2182: .if CompileDrive >= DRIVE_1571 .AND CompileDrive < DRIVE_1571CR
2183: ldy #$10
2184: .else
2185: ldy #$12
2186: .endif
2187: jsr L8829
2188: L87DD:
2189: plp
2190: rts
2191: L87DF:
2192: lda MINSTP
2193: clc
2194: adc #$01
2195: jmp L8814
2196: L87E7:
2197: ldy #$63
2198: L87E9:
2199: lda VBC_PAUNBUF1
2200: ror a
2201: php
2202: lda VBC_PAUNBUF1
2203: ror a
2204: ror a
2205: plp
2206: and #$80
2207: bcc L87FC
2208: bpl L880F
2209: bmi L87FE
2210: L87FC:
2211: bmi L880F
2212: L87FE:
2213: dey
2214: bne L87E9
2215: bcs L880F
2216: lda VDC_PB2
2217: and #VDC_PB2_STEPPER
2218: bne L880F
2219: lda #$00
2220: sta MINSTP
2221: rts
2222: L880F:
2223: lda MINSTP
2224: sec
2225: sbc #$01
2226: L8814:
2227: sta MINSTP
2228: and #$03
2229: sta T0
2230: php
2231: sei
2232: lda VDC_PB2
2233: and # ~ VDC_PB2_STEPPER
2234: ora T0
2235: sta VDC_PB2
2236: plp
2237: .if CompileDrive >= DRIVE_1571CR
2238: ldy #$05
2239: .elseif CompileDrive >= DRIVE_1571
2240: ldy #$06
2241: .else
2242: ldy #$08
2243: .endif
2244: L8829:
2245: jsr L8830
2246: dey
2247: bne L8829
2248: rts
2249: L8830:
2250: ldx #$02
2251: .if CompileDrive >= DRIVE_1571_05
2252: lda #$6F
2253: .else
2254: lda #$00
2255: .endif
2256: L8834:
2257: adc #$01
2258: bne L8834
2259: dex
2260: bne L8834
2261: rts
2262:
2263: .if CompileDrive >= DRIVE_1571CR
2264: .else
2265:
2266: L883C:
2267: nop
2268: lda WD177x_STATUS
2269: lsr a
2270: lsr a
2271: lsr a
2272: and #$03
2273: tax
2274: lda L8A82,x
2275: sta L01B0
2276: tax
2277: rts
2278: L884E:
2279: pha
2280: jsr L877C
2281: pla
2282: sta WD177x_COMMAND
2283: lda #$01
2284: nop
2285: L8859:
2286: bit WD177x_STATUS
2287: beq L8859
2288: jmp LA47E
2289: L8861:
2290: jsr L8788
2291: lda #$01
2292: L8866:
2293: bit WD177x_STATUS
2294: bne L8866
2295: rts
2296: .endif
2297:
2298: L886C:
2299: lda ACLSTP
2300: sec
2301: sbc #$01
2302: sta CTRACK
2303: lda CMDBUF + 4
2304: clc
2305: adc BYTE
2306: cmp RSTEPS
2307: beq L8884
2308: bcc L8884
2309: sbc RSTEPS
2310: clc
2311: adc CTRACK
2312: L8884:
2313: sta CMDBUF + 4
2314: rts
2315: L8888:
2316: ldy #$00
2317: ldx #$00
2318: lda CMDBUF + 3
2319: and #$3F
2320: sta CMDBUF + 3
2321: sta ACLSTP
2322: pha
2323: lda CMDBUF + 7
2324: pha
2325: inc CMDBUF + 4
2326: L889E:
2327: lda CMDBUF + 3
2328: sta CMDBUF + 11,y
2329: inc CMDBUF + 3
2330: inx
2331: tya
2332: clc
2333: adc CMDBUF + 4
2334: tay
2335: cpy #$20
2336: bcs L88BE
2337: cpy CMDBUF + 7
2338: bcc L88D1
2339: bne L88CB
2340: cpx CMDBUF + 7
2341: beq L88CB
2342: L88BE:
2343: dec CMDBUF + 4
2344: pla
2345: sta CMDBUF + 7
2346: pla
2347: sta CMDBUF + 3
2348: sec
2349: rts
2350: L88CB:
2351: tya
2352: sec
2353: sbc CMDBUF + 7
2354: tay
2355: L88D1:
2356: cpx CMDBUF + 7
2357: bne L889E
2358: stx MYPA
2359: dex
2360: txa
2361: clc
2362: adc ACLSTP
2363: sta RSTEPS
2364: cmp ACLSTP
2365: bcc L88BE
2366: pla
2367: sta CMDBUF + 7
2368: pla
2369: sta CMDBUF + 3
2370: dec CMDBUF + 4
2371: clc
2372: rts
2373: L88F0:
2374: lda L01B0
2375: pha
2376: ldy #$00
2377: .if CompileDrive >= DRIVE_1571CR
2378: L88F8:
2379: lda CMDBUF + 11,y
2380: sta SECTR
2381: tya
2382: pha
2383: jsr LAD2E
2384: pla
2385: tay
2386: .else
2387: sty STAB
2388: L88F8:
2389: ldy STAB
2390: lda CMDBUF + 11,y
2391: sta WD177x_SECTOR
2392: jsr L8F18
2393: .endif
2394: ldx L01B0
2395: cpx #$02
2396: bcs L8915
2397: .if CompileDrive >= DRIVE_1571CR
2398: iny
2399: .else
2400: inc STAB
2401: ldy STAB
2402: .endif
2403: cpy CMDBUF + 7
2404: bne L88F8
2405: clc
2406: .byte ASM_BIT2
2407: L8915:
2408: sec
2409: pla
2410: sta L01B0
2411: L891A:
2412: rts
2413: L891B:
2414: lda CMDSIZ
2415: cmp #$07
2416: bcc L891A
2417: lda CMDBUF + 6
2418: sta NMIFLG
2419: jmp L87BA
2420: L892A:
2421: lda L01B0
2422: pha
2423: .if CompileDrive >= DRIVE_1571CR
2424: lda REVCNT
2425: asl a
2426: sta TMP
2427: L88FF:
2428: jsr L89E8
2429: .else
2430: jsr L8A27
2431: .endif
2432: ldx L01B0
2433: cpx #$02
2434: .if CompileDrive >= DRIVE_1571CR
2435: bcc L8923
2436: dec TMP
2437: bne L88FF
2438: jsr L89EF
2439: lda REVCNT
2440: asl a
2441: sta TMP
2442: L8915_CR:
2443: jsr L89E8
2444: .else
2445: bcc L8945
2446: jsr L89EF
2447: jsr L8A27
2448: .endif
2449: ldx L01B0
2450: cpx #$02
2451: .if CompileDrive >= DRIVE_1571CR
2452: bcc L8923
2453: dec TMP
2454: bne L8915_CR
2455: .else
2456: bcs L894F
2457: .endif
2458: L8923:
2459: L8945:
2460: lda NMIFLG
2461: asl a
2462: cmp MINSTP
2463: beq L894F
2464: jsr L87BA
2465: L894F:
2466: pla
2467: sta L01B0
2468: rts
2469: L8954:
2470: php
2471: sei
2472: lda HINIB
2473: and #$10
2474: cmp #$10
2475: jsr L93F3
2476: plp
2477: rts
2478: L8961:
2479: ldy MYPA
2480: dey
2481: lda #$FF
2482: L8966:
2483: cmp CMDBUF + 11,y
2484: bcc L896E
2485: lda CMDBUF + 11,y
2486: L896E:
2487: dey
2488: bpl L8966
2489: sta ACLSTP
2490: ldy MYPA
2491: dey
2492: lda #$00
2493: L8978:
2494: cmp CMDBUF + 11,y
2495: bcs L8980
2496: lda CMDBUF + 11,y
2497: L8980:
2498: dey
2499: bpl L8978
2500: sta RSTEPS
2501: rts
2502: L8986:
2503: ldx MYPA
2504: ldy #$00
2505: L898A:
2506: lda CMDBUF + 11,y
2507: cmp ACLSTP
2508: beq L8996
2509: iny
2510: cpy MYPA
2511: bne L898A
2512: L8996:
2513: sty AF
2514: lda ACLSTP
2515: clc
2516: adc #$01
2517: sta CTRACK
2518: ldx #$FF
2519: L89A1:
2520: lda CMDBUF + 11,y
2521: cmp CTRACK
2522: beq L89B2
2523: inx
2524: iny
2525: cpy MYPA
2526: bne L89A1
2527: ldy #$00
2528: beq L89A1
2529: L89B2:
2530: rts
2531:
2532: L89B3:
2533: lda T0
2534: pha
2535: php
2536: sei
2537: .if CompileDrive >= DRIVE_1571CR
2538: .else
2539: lda WD177x_TRACK
2540: sta WD177x_DATA
2541: lda #$18
2542: jsr L884E
2543: jsr L8861
2544: .endif
2545: ldx #$00
2546: ldy #$80
2547: lda WD177x_STATUS
2548: .if CompileDrive >= DRIVE_1571CR
2549: and #$40
2550: .else
2551: and #$02
2552: .endif
2553: sta T0
2554: L89D1:
2555: lda WD177x_STATUS
2556: .if CompileDrive >= DRIVE_1571CR
2557: and #$40
2558: .else
2559: and #$02
2560: .endif
2561: cmp T0
2562: beq L89DE
2563: plp
2564: jmp L89E7
2565: L89DE:
2566: dex
2567: bne L89D1
2568: dey
2569: bne L89D1
2570: plp
2571: sec
2572: .byte ASM_BIT2
2573: L89E7:
2574: clc
2575: pla
2576: sta T0
2577: rts
2578:
2579: L89EC:
2580: jmp RESET
2581:
2582: L89EF:
2583: lda #$B4
2584: sta MINSTP
2585: lda #$00
2586: .if CompileDrive >= DRIVE_1571CR
2587: .else
2588: sta WD177x_TRACK
2589: .endif
2590: sta NMIFLG
2591: jmp L87BA
2592: L89FD:
2593: lda VDC_PB2
2594: and #VDC_PB2_WRITEPROTECT
2595: rts
2596: L8A03:
2597: sty NMIFLG
2598: stx MINSTP
2599: rts
2600: L8A08:
2601: rts
2602: L8A09:
2603: jsr L89EF
2604:
2605: .if CompileDrive >= DRIVE_1571CR
2606: jsr L89E8
2607: lda L8A7E,x
2608: .else
2609: jsr L89B3
2610: bcs L8A20
2611: jsr L8A27
2612: lda L8A7E,x
2613: .endif
2614:
2615: sta MYPA
2616: sta RSTEPS
2617: lda #$01
2618: sta ACLSTP
2619: rts
2620:
2621: .if CompileDrive >= DRIVE_1571CR
2622: L89E8:
2623: jsr LABEC
2624: .else
2625: L8A20:
2626: lda #$0D
2627: sta L01B0
2628: bne L8A65
2629: L8A27:
2630: lda #$00
2631: sta RLINDX
2632: sta WORK
2633: lda #$C8
2634: jsr L884E
2635: ldx #$00
2636: ldy #$06
2637: L8A37:
2638: lda WD177x_STATUS
2639: and #$03
2640: lsr a
2641: bcc L8A4A
2642: beq L8A37
2643: lda WD177x_DATA
2644: sta STAB,x
2645: inx
2646: dey
2647: bne L8A37
2648: L8A4A:
2649: jsr L8861
2650: jsr L883C
2651: .endif
2652:
2653: lda STAB
2654: asl a
2655: sta MINSTP
2656: lda STAB + 3
2657: L8A57:
2658: and #$03
2659: tax
2660: lda L8A72,x
2661: sta RLINDX
2662: lda L8A76,x
2663: sta WORK
2664: L8A65:
2665: lda AS
2666: and #$80
2667: ora L01B0
2668: ora L8A7A,x
2669: sta AS
2670: .if CompileDrive >= DRIVE_1571CR
2671: stx L01B5
2672: .endif
2673: rts
2674: L8A72:
2675: .byte $7F,$FF,$FF,$FF
2676: L8A76:
2677: .byte $01,$01,$02,$04
2678: L8A7A:
2679: .byte $00,$10,$20,$30
2680: L8A7E:
2681: .byte $1A,$10,$09,$05
2682:
2683: .if CompileDrive >= DRIVE_1571CR
2684: .else
2685: L8A82:
2686: .byte $01,$09,$02,$03
2687: .endif
2688:
2689: L8A86:
2690:
2691: .if CompileDrive >= DRIVE_1571CR
2692: bit WD177x_STATUS
2693: bvc L8A86
2694: L8A25_CR:
2695: bit WD177x_STATUS
2696: bvs L8A25_CR
2697: bit L01B4
2698: bmi L8A32
2699: lda #$28
2700: .byte ASM_BIT3
2701: L8A32:
2702: lda #$29
2703: sta WD177x_COMMAND
2704: lda WD177x_STATUS
2705: ora #$02
2706: sta WD177x_COMMAND
2707: lda #$4E
2708: sta WD177x_SECTOR
2709: .else
2710: lda #$F8
2711: jsr L884E
2712: .endif
2713: bit HINIB
2714: bvc L8AF1
2715: ldx #$50
2716: .if CompileDrive >= DRIVE_1571CR
2717: .else
2718: L8A91:
2719: lda WD177x_STATUS
2720: and #$03
2721: lsr a
2722: bcc L8AF9
2723: beq L8A91
2724: .endif
2725: lda #$4E
2726: .if CompileDrive >= DRIVE_1571CR
2727: L8A91:
2728: bit WD177x_STATUS
2729: bpl L8A91
2730: sta WD177x_SECTOR
2731: .else
2732: sta WD177x_DATA
2733: .endif
2734: dex
2735: bne L8A91
2736: ldx #$0C
2737: L8AA5:
2738: .if CompileDrive >= DRIVE_1571CR
2739: .else
2740: lda WD177x_STATUS
2741: and #$03
2742: lsr a
2743: bcc L8AF9
2744: beq L8AA5
2745: .endif
2746: lda #$00
2747: .if CompileDrive >= DRIVE_1571CR
2748: L8A5B:
2749: bit WD177x_STATUS
2750: bpl L8A5B
2751: sta WD177x_SECTOR
2752: .else
2753: sta WD177x_DATA
2754: .endif
2755: dex
2756: .if CompileDrive >= DRIVE_1571CR
2757: bne L8A5B
2758: lda WD177x_TRACK
2759: and #$F8
2760: ora CSG5710_4010 + 3
2761: sta WD177x_TRACK
2762:
2763: lda CSG5710_4010 + 1
2764: L8A74:
2765: bit WD177x_STATUS
2766: bpl L8A74
2767: sta WD177x_SECTOR
2768: lda WD177x_STATUS
2769: ora #$04
2770: sta WD177x_COMMAND
2771: ldx #$02
2772:
2773: lda CSG5710_4010 + 1
2774: L8A89:
2775: bit WD177x_STATUS
2776: bpl L8A89
2777: sta WD177x_SECTOR
2778: .else
2779: bne L8AA5
2780: ldx #$03
2781: L8AB9:
2782: lda WD177x_STATUS
2783: and #$03
2784: lsr a
2785: bcc L8AF9
2786: beq L8AB9
2787: lda #$F6
2788: sta WD177x_DATA
2789: .endif
2790: dex
2791:
2792: .if CompileDrive >= DRIVE_1571CR
2793: bne L8A89
2794: .else
2795: bne L8AB9
2796: L8ACB:
2797: lda WD177x_STATUS
2798: and #$03
2799: lsr a
2800: bcc L8AF9
2801: beq L8ACB
2802: .endif
2803: lda #$FC
2804: .if CompileDrive >= DRIVE_1571CR
2805: L8A96:
2806: bit WD177x_STATUS
2807: bpl L8A96
2808: sta WD177x_SECTOR
2809: lda WD177x_STATUS
2810: and #$FB
2811: sta WD177x_COMMAND
2812: .else
2813: sta WD177x_DATA
2814: .endif
2815:
2816: ldx #$32
2817:
2818: .if CompileDrive >= DRIVE_1571CR
2819: .else
2820: nop
2821: L8ADD:
2822: lda WD177x_STATUS
2823: and #$03
2824: lsr a
2825: bcc L8AF9
2826: beq L8ADD
2827: .endif
2828: lda #$4E
2829:
2830: .if CompileDrive >= DRIVE_1571CR
2831: L8AAA:
2832: bit WD177x_STATUS
2833: bpl L8AAA
2834: sta WD177x_SECTOR
2835: .else
2836: sta WD177x_DATA
2837: .endif
2838: dex
2839: .if CompileDrive >= DRIVE_1571CR
2840: bne L8AAA
2841: beq L8AC6
2842: L8AF1:
2843: ldx #$3C
2844: .else
2845: bne L8ADD
2846: beq L8B05
2847: L8AF1:
2848: ldx #$3C
2849: L8AF3:
2850: lda WD177x_STATUS
2851: and #$03
2852: lsr a
2853: L8AF9:
2854: bcc L8B23
2855: beq L8AF3
2856: .endif
2857: lda #$4E
2858: .if CompileDrive >= DRIVE_1571CR
2859: L8ABB:
2860: bit WD177x_STATUS
2861: bpl L8ABB
2862: sta WD177x_SECTOR
2863: .else
2864: sta WD177x_DATA
2865: .endif
2866: dex
2867:
2868: .if CompileDrive >= DRIVE_1571CR
2869: bne L8ABB
2870: L8AC6:
2871: ldy #$01
2872: L8AC8:
2873: .else
2874: bne L8AF3
2875: L8B05:
2876: ldy #$01
2877: L8B07:
2878: ldx #$0C
2879: L8B09:
2880: lda WD177x_STATUS
2881: and #$03
2882: lsr a
2883: bcc L8B23
2884: beq L8B09
2885: .endif
2886: lda #$00
2887: .if CompileDrive >= DRIVE_1571CR
2888: ldx #$0C
2889: L8ACC:
2890: bit WD177x_STATUS
2891: bpl L8ACC
2892: sta WD177x_SECTOR
2893: .else
2894: sta WD177x_DATA
2895: .endif
2896: dex
2897: .if CompileDrive >= DRIVE_1571CR
2898: bne L8ACC
2899: lda CSG5710_4010 + 0
2900: L8ADA:
2901: bit WD177x_STATUS
2902: bpl L8ADA
2903: sta WD177x_SECTOR
2904: lda WD177x_STATUS
2905: ora #$14
2906: sta WD177x_COMMAND
2907: lda WD177x_TRACK
2908: and #$F8
2909: ora CSG5710_4010 + 2
2910: sta WD177x_TRACK
2911: ldx #$02
2912: lda CSG5710_4010 + 0
2913: L8AFA:
2914: bit WD177x_STATUS
2915: bpl L8AFA
2916: sta WD177x_SECTOR
2917: .else
2918: bne L8B09
2919: ldx #$03
2920: L8B1D:
2921: lda WD177x_STATUS
2922: and #$03
2923: lsr a
2924: L8B23:
2925: bcc L8B7C
2926: beq L8B1D
2927: lda #$F5
2928: sta WD177x_DATA
2929: .endif
2930: dex
2931:
2932: .if CompileDrive >= DRIVE_1571CR
2933: bne L8AFA
2934: lda CSG5710_4010 + 5
2935: L8B08:
2936: bit WD177x_STATUS
2937: bpl L8B08
2938: sta WD177x_SECTOR
2939: lda WD177x_STATUS
2940: and #$FB
2941: sta WD177x_COMMAND
2942: .else
2943: bne L8B1D
2944: L8B2F:
2945: lda WD177x_STATUS
2946: and #$03
2947: lsr a
2948: bcc L8B7C
2949: beq L8B2F
2950: lda #$FE
2951: sta WD177x_DATA
2952: L8B3E:
2953: lda WD177x_STATUS
2954: and #$03
2955: lsr a
2956: bcc L8B7C
2957: beq L8B3E
2958: .endif
2959:
2960: lda L01B0
2961:
2962: .if CompileDrive >= DRIVE_1571CR
2963: L8B1B:
2964: bit WD177x_STATUS
2965: bpl L8B1B
2966: sta WD177x_SECTOR
2967: .else
2968: sta WD177x_DATA
2969: L8B4E:
2970: lda WD177x_STATUS
2971: and #$03
2972: lsr a
2973: bcc L8B7C
2974: beq L8B4E
2975: .endif
2976:
2977: lda HINIB
2978: and #$10
2979: bne L8B61
2980: lda #$00
2981: .byte ASM_BIT3
2982: L8B61:
2983: lda #$01
2984: .if CompileDrive >= DRIVE_1571CR
2985: L8B2E:
2986: bit WD177x_STATUS
2987: bpl L8B2E
2988: sta WD177x_SECTOR
2989: .else
2990: sta WD177x_DATA
2991: L8B66:
2992: lda WD177x_STATUS
2993: and #$03
2994: lsr a
2995: bcc L8B7C
2996: beq L8B66
2997: .endif
2998:
2999: lda CMDBUF + 10,y
3000:
3001: .if CompileDrive >= DRIVE_1571CR
3002: L8B39:
3003: bit WD177x_STATUS
3004: bpl L8B39
3005: sta WD177x_SECTOR
3006: .else
3007: sta WD177x_DATA
3008: L8B76:
3009: lda WD177x_STATUS
3010: and #$03
3011: lsr a
3012: L8B7C:
3013: bcc L8BB1
3014: beq L8B76
3015: .endif
3016:
3017: lda CMDBUF + 5
3018:
3019: .if CompileDrive >= DRIVE_1571CR
3020: L8B44:
3021: bit WD177x_STATUS
3022: bpl L8B44
3023: sta WD177x_SECTOR
3024: L8B4C:
3025: bit WD177x_STATUS
3026: bpl L8B4C
3027: sta WD177x_SECTOR
3028: lda WD177x_STATUS
3029: and #$F7
3030: sta WD177x_COMMAND
3031: L8B5C:
3032: bit WD177x_STATUS
3033: bpl L8B5C
3034: sta WD177x_SECTOR
3035: .else
3036: sta WD177x_DATA
3037: L8B86:
3038: lda WD177x_STATUS
3039: and #$03
3040: lsr a
3041: bcc L8BB1
3042: beq L8B86
3043: lda #$F7
3044: sta WD177x_DATA
3045: ldx #$16
3046: L8B97:
3047: lda WD177x_STATUS
3048: and #$03
3049: lsr a
3050: bcc L8BB1
3051: beq L8B97
3052: .endif
3053:
3054: lda #$4E
3055:
3056: .if CompileDrive >= DRIVE_1571CR
3057: L8B66_CR:
3058: bit WD177x_STATUS
3059: bpl L8B66_CR
3060: sta WD177x_SECTOR
3061: lda WD177x_STATUS
3062: ora #$08
3063: sta WD177x_COMMAND
3064: lda #$4E
3065: L8B78:
3066: bit WD177x_STATUS
3067: bpl L8B78
3068: sta WD177x_SECTOR
3069: lda WD177x_STATUS
3070: and #$EF
3071: sta WD177x_COMMAND
3072: ldx #$14
3073: lda #$4E
3074: L8B8C:
3075: bit WD177x_STATUS
3076: bpl L8B8C
3077: sta WD177x_SECTOR
3078: .else
3079: sta WD177x_DATA
3080: .endif
3081:
3082: dex
3083: .if CompileDrive >= DRIVE_1571CR
3084: bne L8B8C
3085: .else
3086: bne L8B97
3087: .endif
3088:
3089: ldx #$0C
3090:
3091: .if CompileDrive >= DRIVE_1571CR
3092: .else
3093: L8BAB:
3094: lda WD177x_STATUS
3095: and #$03
3096: lsr a
3097: L8BB1:
3098: bcc L8BEB
3099: beq L8BAB
3100: .endif
3101: lda #$00
3102: .if CompileDrive >= DRIVE_1571CR
3103: L8B9B:
3104: bit WD177x_STATUS
3105: bpl L8B9B
3106: sta WD177x_SECTOR
3107: .else
3108: sta WD177x_DATA
3109: .endif
3110: dex
3111:
3112: .if CompileDrive >= DRIVE_1571CR
3113: bne L8B9B
3114: lda CSG5710_4010 + 0
3115: L8BA9:
3116: bit WD177x_STATUS
3117: bpl L8BA9
3118: sta WD177x_SECTOR
3119: lda WD177x_STATUS
3120: ora #$14
3121: sta WD177x_COMMAND
3122: ldx #$02
3123: lda CSG5710_4010 + 0
3124: L8BBE:
3125: bit WD177x_STATUS
3126: bpl L8BBE
3127: sta WD177x_SECTOR
3128: .else
3129: bne L8BAB
3130: ldx #$03
3131: L8BBF:
3132: lda WD177x_STATUS
3133: and #$03
3134: lsr a
3135: bcc L8BEB
3136: beq L8BBF
3137: lda #$F5
3138: sta WD177x_DATA
3139: .endif
3140: dex
3141:
3142: .if CompileDrive >= DRIVE_1571CR
3143: bne L8BBE
3144: lda CSG5710_4010 + 4
3145: L8BCC:
3146: bit WD177x_STATUS
3147: bpl L8BCC
3148: sta WD177x_SECTOR
3149: .else
3150: bne L8BBF
3151: L8BD1:
3152: lda WD177x_STATUS
3153: and #$03
3154: lsr a
3155: bcc L8BEB
3156: beq L8BD1
3157: lda #$FB
3158: sta WD177x_DATA
3159: .endif
3160: sty T0
3161:
3162: .if CompileDrive >= DRIVE_1571CR
3163: lda WD177x_STATUS
3164: and #$FB
3165: sta WD177x_COMMAND
3166: .endif
3167: ldy WORK
3168:
3169: .if CompileDrive >= DRIVE_1571CR
3170: .else
3171: nop
3172: L8BE5:
3173: lda WD177x_STATUS
3174: and #$03
3175: lsr a
3176: L8BEB:
3177: bcc L8C4D
3178: beq L8BE5
3179: .endif
3180:
3181: lda CMDBUF + 10
3182:
3183: .if CompileDrive >= DRIVE_1571CR
3184: L8BE5:
3185: bit WD177x_STATUS
3186: bpl L8BE5
3187: sta WD177x_SECTOR
3188: .else
3189: sta WD177x_DATA
3190: .endif
3191: cpx RLINDX
3192: beq L8BFE
3193: inx
3194: jmp L8BE5
3195: L8BFE:
3196: inx
3197: dey
3198:
3199: .if CompileDrive >= DRIVE_1571CR
3200: bne L8BE5
3201: L8BF8:
3202: bit WD177x_STATUS
3203: bpl L8BF8
3204: sta WD177x_SECTOR
3205: lda WD177x_STATUS
3206: and #$F7
3207: sta WD177x_COMMAND
3208: L8C08:
3209: bit WD177x_STATUS
3210: bpl L8C08
3211: sta WD177x_SECTOR
3212: lda #$4E
3213: L8C12:
3214: bit WD177x_STATUS
3215: bpl L8C12
3216: sta WD177x_SECTOR
3217: lda WD177x_STATUS
3218: ora #$08
3219: sta WD177x_COMMAND
3220: lda #$4E
3221: L8C24:
3222: bit WD177x_STATUS
3223: bpl L8C24
3224: sta WD177x_SECTOR
3225: lda WD177x_STATUS
3226: and #$EF
3227: sta WD177x_COMMAND
3228: .else
3229: bne L8BE5
3230: L8C02:
3231: lda WD177x_STATUS
3232: and #$03
3233: lsr a
3234: bcc L8C4D
3235: beq L8C02
3236: lda #$F7
3237: sta WD177x_DATA
3238: .endif
3239:
3240: ldy CMDBUF + 5
3241: lda L8C4F,y
3242: ldy T0
3243: tax
3244: .if CompileDrive >= DRIVE_1571CR
3245: dex
3246: .else
3247: L8C1A:
3248: lda WD177x_STATUS
3249: and #$03
3250: lsr a
3251: bcc L8C4D
3252: beq L8C1A
3253: .endif
3254: lda #$4E
3255: .if CompileDrive >= DRIVE_1571CR
3256: L8C1A:
3257: bit WD177x_STATUS
3258: bpl L8C1A
3259: sta WD177x_SECTOR
3260: .else
3261: sta WD177x_DATA
3262: .endif
3263: dex
3264: bne L8C1A
3265: cpy CMDBUF + 7
3266: .if CompileDrive >= DRIVE_1571CR
3267:
3268: beq L8C54
3269: iny
3270: jmp L8AC8
3271:
3272: L8C54:
3273: bit WD177x_STATUS
3274: bpl L8C54
3275: sta WD177x_SECTOR
3276: bit WD177x_STATUS
3277: bvc L8C67
3278: dey
3279: bne L8C54
3280: dex
3281: bne L8C54
3282: L8C67:
3283: lda WD177x_STATUS
3284: and #$DD
3285: sta WD177x_COMMAND
3286: ldy #$02
3287: jmp L8829
3288:
3289: .else
3290:
3291: beq L8C35
3292: iny
3293: jmp L8B07
3294: L8C35:
3295: lda WD177x_STATUS
3296: and #$03
3297: lsr a
3298: bcc L8C48
3299: beq L8C35
3300: clc
3301: lda #$4E
3302: sta WD177x_DATA
3303: jmp L8C35
3304: L8C48:
3305: jsr L8861
3306: clc
3307: .byte ASM_BIT2
3308: L8C4D:
3309: sec
3310: rts
3311: .endif
3312:
3313: L8C4F:
3314: .byte $07,$0C,$17,$2C
3315: L8C53:
3316: .byte $1A,$10,$09,$05
3317:
3318: L8C57:
3319: lda HINIB
3320: and #$08
3321: beq L8C64
3322: ldx CTRACK
3323: stx L01B0
3324: sec
3325: rts
3326: L8C64:
3327: jsr LD307
3328: lda CMDSIZ
3329: sec
3330: sbc #$04
3331: tay
3332: beq L8C90
3333: dey
3334: beq L8C95
3335: lda #$00
3336: sta L01B0
3337: lda CMDBUF + 5
3338: jsr L8A57
3339: dey
3340: beq L8CA2
3341: dey
3342: beq L8CA7
3343: dey
3344: beq L8CAD
3345: dey
3346: beq L8CB5
3347: dey
3348: beq L8CBA
3349: jmp L8CBF
3350: L8C90:
3351: lda #$00
3352: sta CMDBUF + 4
3353: L8C95:
3354: lda #$00
3355: sta L01B0
3356: lda #$01
3357: sta CMDBUF + 5
3358: jsr L8A57
3359: L8CA2:
3360: lda #$27
3361: sta CMDBUF + 6
3362: L8CA7:
3363: lda L8C53,x
3364: sta CMDBUF + 7
3365: L8CAD:
3366: lda #$00
3367: sta CMDBUF + 8
3368: .if CompileDrive >= DRIVE_1571CR
3369: .else
3370: sta WD177x_TRACK
3371: .endif
3372: L8CB5:
3373: lda #$00
3374: sta CMDBUF + 9
3375: L8CBA:
3376: lda #$E5
3377: sta CMDBUF + 10
3378: L8CBF:
3379: jsr L8CDE
3380: lda L01B0
3381: cpx #$02
3382: bcs L8CDB
3383: lda HINIB
3384: and #$20
3385: beq L8CDB
3386: lda HINIB
3387: ora #$10
3388: sta HINIB
3389: jsr L8954
3390: jsr L8CDE
3391: L8CDB:
3392: jmp L89EF
3393: L8CDE:
3394: jsr L89B3
3395: bcs L8D5F
3396: .if CompileDrive >= DRIVE_1571CR
3397: .else
3398: lda #$01
3399: sta VBC_IFR1
3400: .endif
3401: jsr L89EF
3402: lda CMDBUF + 8
3403: sta L01B0
3404: .if CompileDrive >= DRIVE_1571CR
3405: .else
3406: sta WD177x_TRACK
3407: .endif
3408: bit CMDBUF + 3
3409: bvs L8CFE
3410: jsr L8888
3411: bcs L8D5F
3412: L8CFE:
3413: lda CMDBUF + 9
3414: and #$7F
3415: beq L8D0D
3416: clc
3417: adc NMIFLG
3418: sta NMIFLG
3419: jsr L87BA
3420: L8D0D:
3421: sei
3422: .if CompileDrive >= DRIVE_1571CR
3423: jsr L8A86
3424: jsr L88F0
3425: bcs L8D5F
3426: .else
3427: lda VBC_IFR1
3428: lsr a
3429: bcs L8D5F
3430: jsr L8A86
3431: bcs L8D5F
3432: lda VBC_IFR1
3433: lsr a
3434: bcs L8D5F
3435: jsr L88F0
3436: bcs L8D5F
3437: lda VBC_IFR1
3438: lsr a
3439: bcs L8D5F
3440: .endif
3441: lda L01B0
3442: cmp CMDBUF + 6
3443: beq L8D40
3444: inc NMIFLG
3445: .if CompileDrive >= DRIVE_1571CR
3446: .else
3447: inc WD177x_TRACK
3448: .endif
3449: inc L01B0
3450: jsr L87BA
3451: jmp L8D0D
3452: L8D40:
3453: bit HINIB
3454: bpl L8D5C
3455: sec
3456: lda CMDBUF + 6
3457: sbc CMDBUF + 8
3458: cmp #$27
3459: bcs L8D5C
3460: inc NMIFLG
3461: jsr L87BA
3462: ldx #$1C
3463: .if CompileDrive >= DRIVE_1571_05
3464: jsr LC07F
3465: FillNOP 3
3466: .else
3467: jsr L9D63
3468: jsr LFE00
3469: .endif
3470: L8D5C:
3471: ldx #$00
3472: .byte ASM_BIT3
3473: L8D5F:
3474: ldx #$06
3475: stx L01B0
3476: jmp L85E9
3477: L8D67:
3478: lda HINIB
3479: and #$20
3480: bne L8DC6
3481: .if CompileDrive >= DRIVE_1571CR
3482: lda REVCNT
3483: asl a
3484: sta TMP
3485: L8D75:
3486: jsr L8EC6
3487: jsr LAC9C
3488: bcs L8DD1
3489: jsr LAC38
3490: bcs L8DC8
3491: .else
3492: lda #$03
3493: sta BUFPNT + 1
3494: .endif
3495: ldy #$00
3496: .if CompileDrive >= DRIVE_1571CR
3497: .else
3498: sty BUFPNT
3499: .endif
3500: ldx WORK
3501: .if CompileDrive >= DRIVE_1571CR
3502: L8D89:
3503: bit WD177x_TRACK
3504: bpl L8D89
3505: lda WD177x_SECTOR
3506: .else
3507: lda CMDBUF + 3
3508: sta WD177x_TRACK
3509: lda CMDBUF + 4
3510: sta WD177x_SECTOR
3511: lda #$88
3512: jsr L884E
3513: nop
3514: L8D89:
3515: lda WD177x_STATUS
3516: and #$03
3517: lsr a
3518: bcc L8DAB
3519: and #$01
3520: beq L8D89
3521: lda WD177x_DATA
3522: .endif
3523: sta (BUFPNT),y
3524: cpy RLINDX
3525: beq L8DA2
3526: iny
3527: bne L8D89
3528: L8DA2:
3529: iny
3530: dex
3531: beq L8DAB
3532: inc BUFPNT + 1
3533: jmp L8D89
3534:
3535: .if CompileDrive >= DRIVE_1571CR
3536: L8DAB:
3537: bit WD177x_TRACK
3538: bpl L8DAB
3539: lda WD177x_SECTOR
3540: L8DA9:
3541: bit WD177x_TRACK
3542: bpl L8DA9
3543: lda WD177x_SECTOR
3544: lda #$18
3545: sta WD177x_TRACK
3546: L8DB6:
3547: bit WD177x_TRACK
3548: bpl L8DB6
3549: lda WD177x_SECTOR
3550: lda WD177x_TRACK
3551: and #$20
3552: beq L8DCF
3553: ldx #$05
3554: .byte ASM_BIT3
3555: L8DC8:
3556: ldx #$03
3557: dec TMP
3558: bne L8D75
3559: .byte ASM_BIT3
3560: L8DCF:
3561: ldx #$00
3562: L8DD1:
3563: jsr L85E9
3564:
3565: .else
3566:
3567: L8DAB:
3568: jsr L8861
3569: jsr L883C
3570: jsr L85E9
3571: bit HINIB
3572: bvs L8DBF
3573: .endif
3574: cpx #$02
3575: bcc L8DBF
3576: .if CompileDrive >= DRIVE_1571CR
3577: bit HINIB
3578: bvs L8DBF
3579: .endif
3580: jmp L8384
3581: L8DBF:
3582: jsr L85F9
3583: lda HINIB
3584:
3585: .if CompileDrive >= DRIVE_1571CR
3586: bmi L8DE8
3587: L8DC6:
3588: jsr L8EC6
3589: .else
3590: bmi L8DE8
3591: L8DC6:
3592: lda #$03
3593: sta BUFPNT + 1
3594: ldy #$00
3595: sty BUFPNT
3596: ldx WORK
3597: .endif
3598: L8DD0:
3599: lda (BUFPNT),y
3600: sta CTRACK
3601: jsr L85F9
3602: cpy RLINDX
3603: beq L8DDF
3604: iny
3605: bne L8DD0
3606: L8DDF:
3607: iny
3608: dex
3609: beq L8DE8
3610: inc BUFPNT + 1
3611: jmp L8DD0
3612: L8DE8:
3613: dec CMDBUF + 5
3614: beq L8DF3
3615: jsr L886C
3616: jmp L8D67
3617: L8DF3:
3618: jmp L891B
3619: L8DF6:
3620: .if CompileDrive >= DRIVE_1571CR
3621: jsr L8EC6
3622: .else
3623: lda #$03
3624: sta BUFPNT + 1
3625: ldy #$00
3626: sty BUFPNT
3627: ldx WORK
3628: .endif
3629: lda HINIB
3630: bmi L8E34
3631: L8E04:
3632: lda VBC_PB1
3633: eor #VBC_PB1_1540_CLOCKOUT
3634: bit CIA_ICR
3635: sta VBC_PB1
3636: L8E0F:
3637: lda VBC_PB1
3638: bpl L8E17
3639: jsr TestATN
3640: L8E17:
3641: lda CIA_ICR
3642: and #CIA_ICR_B_SP
3643: beq L8E0F
3644: lda CIA_SDR
3645: sta (BUFPNT),y
3646: cpy RLINDX
3647: beq L8E2B
3648: iny
3649: bne L8E04
3650: L8E2B:
3651: iny
3652: dex
3653: beq L8E34
3654: inc BUFPNT + 1
3655: jmp L8E04
3656: L8E34:
3657: lda HINIB
3658: and #$20
3659:
3660: .if CompileDrive >= DRIVE_1571CR
3661: beq L8E4F
3662: jmp L8EB7
3663: L8E4F:
3664: .else
3665: bne L8EB7
3666: .endif
3667: lda HINIB
3668: and #$08
3669: beq L8E45
3670: ldx CTRACK
3671: jmp L8381
3672: L8E45:
3673: .if CompileDrive >= DRIVE_1571CR
3674: jsr L8EC6
3675: jsr LAC9C
3676: bcc L8E65
3677: jmp L8F41
3678: L8E65:
3679: jsr LACB9
3680: bit L01B4
3681: bmi L8E70
3682: lda #$28
3683: .byte ASM_BIT3
3684: L8E70:
3685: lda #$29
3686: sta WD177x_COMMAND
3687: lda #$00
3688: sta WD177x_SECTOR
3689: lda WD177x_STATUS
3690: ora #$02
3691: sta WD177x_COMMAND
3692: ldx #$0C
3693: L8E84:
3694: lda #$00
3695: L8E86:
3696: bit WD177x_STATUS
3697: bpl L8E86
3698: sta WD177x_SECTOR
3699: dex
3700: bne L8E84
3701: lda CSG5710_4010 + 0
3702: L8E94:
3703: bit WD177x_STATUS
3704: bpl L8E94
3705: sta WD177x_SECTOR
3706: lda WD177x_STATUS
3707: ora #$14
3708: sta WD177x_COMMAND
3709: lda WD177x_TRACK
3710: and #$F8
3711: ora CSG5710_4010 + 2
3712: sta WD177x_TRACK
3713: ldx #$02
3714: lda CSG5710_4010 + 0
3715: L8EB4:
3716: bit WD177x_STATUS
3717: bpl L8EB4
3718: sta WD177x_SECTOR
3719: dex
3720: bne L8EB4
3721: lda CSG5710_4010 + 4
3722: L8EC2_CR:
3723: bit WD177x_STATUS
3724: bpl L8EC2_CR
3725: sta WD177x_SECTOR
3726: lda WD177x_STATUS
3727: and #$FB
3728: sta WD177x_COMMAND
3729: .else
3730: lda #$03
3731: sta BUFPNT + 1
3732: .endif
3733: ldy #$00
3734: .if CompileDrive >= DRIVE_1571CR
3735: .else
3736: sty BUFPNT
3737: .endif
3738: ldx WORK
3739: .if CompileDrive >= DRIVE_1571CR
3740: L8E66:
3741: lda (BUFPNT),y
3742: L8ED8:
3743: bit WD177x_STATUS
3744: bpl L8ED8
3745: .else
3746: lda CMDBUF + 3
3747: sta WD177x_TRACK
3748: lda CMDBUF + 4
3749: .endif
3750: sta WD177x_SECTOR
3751:
3752: .if CompileDrive >= DRIVE_1571CR
3753: .else
3754: lda VBC_IFR1
3755: lsr a
3756: bcs L8E93
3757: lda #$A8
3758: jsr L884E
3759: L8E66:
3760: lda WD177x_STATUS
3761: and #$03
3762: lsr a
3763: bcc L8E93
3764: and #$01
3765: beq L8E66
3766: lda (BUFPNT),y
3767: sta WD177x_DATA
3768: .endif
3769:
3770: cpy RLINDX
3771: beq L8E7F
3772: iny
3773: bne L8E66
3774: L8E7F:
3775: iny
3776: dex
3777: beq L8E88
3778: inc BUFPNT + 1
3779: jmp L8E66
3780: .if CompileDrive >= DRIVE_1571CR
3781: L8E88:
3782: bit WD177x_STATUS
3783: bpl L8E88
3784: sta WD177x_SECTOR
3785: lda WD177x_STATUS
3786: and #$F7
3787: sta WD177x_COMMAND
3788: L8F01:
3789: bit WD177x_STATUS
3790: bpl L8F01
3791: sta WD177x_SECTOR
3792: L8F09:
3793: bit WD177x_STATUS
3794: bpl L8F09
3795: sta WD177x_SECTOR
3796: L8F11:
3797: bit WD177x_STATUS
3798: bpl L8F11
3799: sta WD177x_SECTOR
3800: lda WD177x_STATUS
3801: and #$EF
3802: sta WD177x_COMMAND
3803: L8F21:
3804: bit WD177x_STATUS
3805: bpl L8F21
3806: sta WD177x_SECTOR
3807: lda WD177x_STATUS
3808: and #$CD
3809: sta WD177x_COMMAND
3810: ldy #$02
3811: jsr L8829
3812: ldx #$00
3813: bit L01B4
3814: bvs L8F43_CR
3815: jsr LACC7
3816: .byte ASM_BIT3
3817: L8F41:
3818: ldx #$07
3819: L8F43_CR:
3820: stx L01B0
3821: jsr L81CE
3822: .else
3823: L8E88:
3824: lda VBC_IFR1
3825: lsr a
3826: bcs L8E93
3827: .if CompileDrive >= DRIVE_1571_05
3828: jsr PATCH_INIT_CSG5710
3829: .else
3830: jsr L8EC6
3831: .endif
3832: bcc L8E9A
3833: L8E93:
3834: jsr L81CE
3835: ldx #$07
3836: bne L8EA0
3837: L8E9A:
3838: jsr L81CE
3839: jsr L883C
3840: L8EA0:
3841: stx L01B0
3842: .endif
3843: jsr L85E9
3844: jsr L85F9
3845: jsr L86A0
3846: jsr L81B2
3847: bit HINIB
3848: bvs L8EB7
3849: cpx #$02
3850: bcs L8EC5
3851: L8EB7:
3852: dec CMDBUF + 5
3853: beq L8EC2
3854: jsr L886C
3855: jmp L8DF6
3856: L8EC2:
3857: jmp L891B
3858: L8EC5:
3859: rts
3860: L8EC6:
3861: lda #$03
3862: sta BUFPNT + 1
3863: ldy #$00
3864: sty BUFPNT
3865: .if CompileDrive >= DRIVE_1571CR
3866: .else
3867: ldx WORK
3868: .endif
3869: lda CMDBUF + 3
3870: .if CompileDrive >= DRIVE_1571CR
3871: sta NMIFLG
3872: .else
3873: sta WD177x_TRACK
3874: .endif
3875: lda CMDBUF + 4
3876:
3877: .if CompileDrive >= DRIVE_1571CR
3878: sta SECTR
3879: eor #$FF
3880: sta STAB + 2
3881: .else
3882: sta WD177x_SECTOR
3883: lda #$88
3884: jsr L884E
3885: L8EE1:
3886: lda WD177x_STATUS
3887: and #$03
3888: lsr a
3889: bcc L8F05
3890: and #$01
3891: beq L8EE1
3892: lda WD177x_DATA
3893: cmp (BUFPNT),y
3894: bne L8F05
3895: cpy RLINDX
3896: beq L8EFC
3897: iny
3898: bne L8EE1
3899: L8EFC:
3900: iny
3901: dex
3902: beq L8F10
3903: inc BUFPNT + 1
3904: jmp L8EE1
3905: L8F05:
3906: lda #$D0
3907: sta WD177x_COMMAND
3908: jsr LA483
3909: ldx #$07
3910: .byte ASM_BIT3
3911: L8F10:
3912: ldx #$00
3913: stx L01B0
3914: jmp L8861
3915: L8F18:
3916: lda #$03
3917: sta BUFPNT + 1
3918: ldy #$00
3919: sty BUFPNT
3920: .endif
3921:
3922: ldx WORK
3923:
3924: .if CompileDrive >= DRIVE_1571CR
3925: .else
3926: .if CompileDrive >= DRIVE_1571_05
3927: .else
3928: ldy RLINDX
3929: .endif
3930: lda #$88
3931: jsr L884E
3932: L8F2A:
3933: lda WD177x_STATUS
3934: and #$03
3935: lsr a
3936: bcc L8F4C
3937: and #$01
3938: beq L8F2A
3939: lda WD177x_DATA
3940: cmp CMDBUF + 10
3941: bne L8F4C
3942: .if CompileDrive >= DRIVE_1571_05
3943: cpy RLINDX
3944: beq L8F43
3945: iny
3946: bne L8F2A
3947: L8F43:
3948: iny
3949: .else
3950: dey
3951: bpl L8F2A
3952: .endif
3953: dex
3954: beq L8F57
3955: .if CompileDrive >= DRIVE_1571_05
3956: .else
3957: ldy RLINDX
3958: .endif
3959: inc BUFPNT + 1
3960: jmp L8F2A
3961: L8F4C:
3962: lda #$D0
3963: sta WD177x_COMMAND
3964: jsr LA483
3965: ldx #$07
3966: .byte ASM_BIT3
3967: L8F57:
3968: ldx #$00
3969: stx L01B0
3970: jmp L8861
3971: L8F5F:
3972: php
3973: sei
3974: jsr L89EF
3975: bit HINIB
3976: bpl L8F70
3977: lda CMDBUF + 3
3978: sta NMIFLG
3979: jsr L87BA
3980: L8F70:
3981: lda #$00
3982: sta MYPA
3983: jsr L8A27
3984: ldx L01B0
3985: cpx #$02
3986: bcs L8F9D
3987: lda STAB + 2
3988: sta ICMD
3989: L8F82:
3990: jsr L8A27
3991: lda STAB + 2
3992: ldy MYPA
3993: sta CMDBUF + 11,y
3994: inc MYPA
3995: cpy #$1F
3996: bcs L8F9D
3997: cmp ICMD
3998: bne L8F82
3999: lda STAB
4000: sta NMIFLG
4001: ldx #$00
4002: .byte ASM_BIT3
4003: L8F9D:
4004: ldx #$02
4005: stx L01B0
4006: plp
4007: .endif
4008: rts
4009:
4010: FillUntil $8FA4
4011:
4012: L8FA4:
4013: lda CMDBUF + 4
4014: sta SECINC
4015: rts
4016: L8FAA:
4017: lda CMDBUF + 4
4018: sta REVCNT
4019: rts
4020: L8FB0:
4021: jmp L924E
4022: L8FB3:
4023: sei
4024: lda VBC_PAUNBUF1
4025: and #VBC_PA1_20
4026: bne L9021
4027: lda CMDBUF + 4
4028: cmp #$31
4029: beq L8FD4
4030: cmp #$30
4031: bne L9021
4032: lda VBC_PAUNBUF1
4033: and # ~ VBC_PA1_04
4034: sta VBC_PAUNBUF1
4035: cli
4036: bit HINIB
4037: bpl L8FE1
4038: rts
4039: L8FD4:
4040: .if CompileDrive >= DRIVE_1571
4041: lda VBC_PAUNBUF1
4042: .else
4043: jmp L9021
4044: .endif
4045: ora #VBC_PA1_04
4046: sta VBC_PAUNBUF1
4047: cli
4048: bit HINIB
4049: bmi L8FE4
4050: L8FE1:
4051: jmp LD042
4052: L8FE4:
4053: rts
4054: L8FE5:
4055: ldx CMDSIZ
4056: cpx #$04
4057: bcc L9021
4058: lda CMDBUF + 3
4059: cmp #$53
4060: beq L8FA4
4061: cmp #$52
4062: beq L8FAA
4063: cmp #$54
4064: beq L8FB0
4065: cmp #$4D
4066: beq L9026
4067: cmp #$48
4068: beq L8FB3
4069: .if CompileDrive >= DRIVE_1571CR
4070: jmp LABA7
4071: .elseif CompileDrive >= DRIVE_1571_05
4072: jmp LAA86
4073: .else
4074: tay
4075: cpy #$04
4076: .endif
4077: L9006:
4078: bcc L9021
4079: cpy #$1F
4080: bcs L9021
4081: lda #$40
4082: sta TLKADR
4083: lda #$20
4084: sta LSNADR
4085: tya
4086: clc
4087: adc TLKADR
4088: sta TLKADR
4089: tya
4090: clc
4091: adc LSNADR
4092: sta LSNADR
4093: rts
4094: L9021:
4095: lda #ERRORCODE_31_SYNTAX_ERROR
4096: jmp GenerateErrorMessage
4097:
4098:
4099: L9026:
4100: sei
4101: lda CMDBUF + 4
4102: cmp #$31
4103: beq L904E
4104: cmp #$30
4105: bne L9021
4106: lda VBC_PAUNBUF1
4107: and # ~ VBC_PA1_20
4108: sta VBC_PAUNBUF1
4109: jsr LA483
4110: jsr LFF82
4111: lda FLGMODE1570
4112: ora #$80
4113: sta FLGMODE1570
4114: cli
4115: bit HINIB
4116: bpl L907C
4117: rts
4118: L904E:
4119: lda VBC_PAUNBUF1
4120: ora #VBC_PA1_20
4121: sta VBC_PAUNBUF1
4122: jsr LA483
4123: lda #$DE
4124: sta VIRQJOB1570
4125: lda #$9D
4126: sta VIRQJOB1570 + 1
4127: lda #$40
4128: sta VDC_T1HL2
4129: sta VDC_T1HC2
4130: lda FLGMODE1570
4131: and #$7F
4132: sta FLGMODE1570
4133: lda #$00
4134: sta NXTST
4135: cli
4136: bit HINIB
4137: bmi L907F
4138: L907C:
4139: jmp LD042
4140: L907F:
4141: rts
4142: L9080:
4143: jsr L81CE
4144: jsr L91EA
4145: bcs L90E7
4146: jsr LC63D
4147: lda NODRV
4148: bne L90E7
4149: lda BITCNT
4150: ora #$81
4151: sta BITCNT
4152: jsr L91CA
4153: lda CMDBUF
4154: cmp #$2A
4155: bne L90AE
4156: lda PRGTRK
4157: beq L90AE
4158: pha
4159: lda PRGSEC
4160: sta FILSEC
4161: pla
4162: jmp L90EC
4163: L90AE:
4164: lda #$00
4165: tay
4166: tax
4167: sta LSTDRV
4168: sta FILTBL
4169: jsr LC312
4170: lda F2CNT
4171: pha
4172: lda #$01
4173: sta F2CNT
4174: lda #$FF
4175: sta R0
4176: jsr LC44F
4177: pla
4178: sta F2CNT
4179: lda BITCNT
4180: and #$7F
4181: sta BITCNT
4182: bit HINIB
4183: bmi L90DF
4184: .if CompileDrive >= DRIVE_1571_05
4185: jsr LAA5B
4186: FillNOP 1
4187: .elseif CompileDrive >= DRIVE_1571
4188: lda PATTYP
4189: cmp #$02
4190: .else
4191: jsr LAA5B
4192: FillNOP 1
4193: .endif
4194: bne L90E4
4195: L90DF:
4196: lda FILTRK
4197: bne L90EC
4198: L90E4:
4199: ldx #$02
4200: .byte ASM_BIT3
4201: L90E7:
4202: ldx #$0F
4203: jmp L91AD
4204: L90EC:
4205: sta PRGTRK
4206: pha
4207: jsr L91DA
4208: pla
4209: ldx L02B0
4210: sta TRACK0,x
4211: lda FILSEC
4212: sta PRGSEC
4213: sta SECTOR0,x
4214: lda #$80
4215: sta CMDBUF + 2
4216: sta AF
4217: L9107:
4218: cli
4219: ldx JOBNUM
4220: lda AF
4221: sta JOBS0,x
4222: jsr L864B
4223: cpx #$02
4224: bcc L9118
4225: jmp L9199
4226: L9118:
4227: sei
4228: ldy #$00
4229: lda (DIRBUF),y
4230: beq L914E
4231: lda BITCNT
4232: and #$FE
4233: sta BITCNT
4234: jsr L9228
4235: ldy #$02
4236: L912A:
4237: lda (DIRBUF),y
4238: tax
4239: jsr L9228
4240: iny
4241: bne L912A
4242: ldx L02B0
4243: lda (DIRBUF),y
4244: cmp TRACK0,x
4245: beq L913F
4246: ldy #$80
4247: .byte ASM_BIT3
4248: L913F:
4249: ldy #$88
4250: sty AF
4251: sta TRACK0,x
4252: ldy #$01
4253: lda (DIRBUF),y
4254: sta SECTOR0,x
4255: jmp L9107
4256: L914E:
4257: ldx #$1F
4258: jsr L9228
4259: lda #$01
4260: bit BITCNT
4261: beq L9177
4262: tay
4263: lda (DIRBUF),y
4264: sec
4265: sbc #$03
4266: sta CTRACK
4267: tax
4268: jsr L9228
4269: iny
4270: lda (DIRBUF),y
4271: tax
4272: jsr L9228
4273: iny
4274: lda (DIRBUF),y
4275: tax
4276: jsr L9228
4277: ldy #$04
4278: bne L9184
4279: L9177:
4280: ldy #$01
4281: lda (DIRBUF),y
4282: tax
4283: dex
4284: stx CTRACK
4285: jsr L9228
4286: ldy #$02
4287: L9184:
4288: lda (DIRBUF),y
4289: tax
4290: jsr L9228
4291: iny
4292: dec CTRACK
4293: bne L9184
4294: lda #$00
4295: sta SA
4296: jsr LDAC0
4297: jmp CommandEnd
4298: L9199:
4299: sei
4300: stx CTRACK
4301: jsr L9228
4302: lda #$00
4303: sta SA
4304: jsr LDAC0
4305: ldx JOBNUM
4306: lda CTRACK
4307: jmp LE60A
4308: L91AD:
4309: sei
4310: stx CTRACK
4311: ldx #$02
4312: jsr L9228
4313: lda #$00
4314: sta SA
4315: jsr LDAC0
4316: lda CTRACK
4317: cmp #$02
4318: beq L91C5
4319: lda #$74
4320: .byte ASM_BIT3
4321: L91C5:
4322: lda #ERRORCODE_62_FILE_NOT_FOUND
4323: jmp GenerateErrorMessage
4324:
4325:
4326: L91CA:
4327: lda #$00
4328: sta SA
4329: lda #$01
4330: jsr LD1E2
4331: tax
4332: lda TableHighBytesOfBuffers,x
4333: sta DIRBUF + 1
4334: rts
4335: L91DA:
4336: lda DIRBUF + 1
4337: sec
4338: sbc #$03
4339: sta JOBNUM
4340: asl a
4341: sta L02B0
4342: lda #$00
4343: sta DIRBUF
4344: rts
4345: L91EA:
4346: ldy #$03
4347: lda CMDSIZ
4348: sec
4349: sbc #$03
4350: sta CMDSIZ
4351: lda CMDBUF + 4
4352: cmp #$3A
4353: bne L920A
4354: lda CMDBUF + 3
4355: tax
4356: and #$30
4357: cmp #$30
4358: bne L920A
4359: cpx #$31
4360: beq L9226
4361: L920A:
4362: lda CMDBUF + 3
4363: cmp #$3A
4364: bne L9215
4365: dec CMDSIZ
4366: iny
4367: L9215:
4368: ldx #$00
4369: L9217:
4370: lda CMDBUF,y
4371: sta CMDBUF,x
4372: iny
4373: inx
4374: cpx CMDSIZ
4375: bne L9217
4376: clc
4377: .byte ASM_BIT2
4378: L9226:
4379: sec
4380: rts
4381: L9228:
4382: lda VBC_PB1
4383: cmp VBC_PB1
4384: bne L9228
4385: and #$FF
4386: bmi L924B
4387: eor BITCNT
4388: and #$04
4389: beq L9228
4390: stx CIA_SDR
4391: lda BITCNT
4392: eor #$04
4393: sta BITCNT
4394: lda #CIA_ICR_B_SP
4395: L9245:
4396: bit CIA_ICR
4397: beq L9245
4398: rts
4399:
4400: L924B:
4401: jmp ProcessBus1570
4402:
4403: L924E:
4404: php
4405: sei
4406: ldx #$00
4407: stx JOBS0
4408: stx JOBS1
4409: lda #$03
4410: sta IP
4411: tay
4412: lda #$80
4413: sta IP + 1
4414: L925F:
4415: lda (IP),y
4416: sta JOBS2
4417: ldx #$08
4418: L9265:
4419: lda JOBS2
4420: and #$01
4421: sta JOBS3
4422: lda JOBS1
4423: bpl L9271
4424: inc JOBS3
4425: L9271:
4426: ror a
4427: bcc L9276
4428: inc JOBS3
4429: L9276:
4430: ror a
4431: ror a
4432: ror a
4433: bcc L927D
4434: inc JOBS3
4435: L927D:
4436: lda JOBS0
4437: rol a
4438: rol a
4439: bcc L9285
4440: inc JOBS3
4441: L9285:
4442: ror JOBS3
4443: rol JOBS0
4444: rol JOBS1
4445: ror JOBS2
4446: dex
4447: bne L9265
4448: inc IP
4449: bne L925F
4450: inc IP + 1
4451: bne L925F
4452: dey
4453: dey
4454: dey
4455: lda JOBS0
4456: cmp L8000
4457: bne L92B3
4458: lda JOBS1
4459: cmp L8001
4460: bne L92B3
4461: sty JOBS0
4462: sty JOBS1
4463: sty JOBS2
4464: sty JOBS3
4465: plp
4466: rts
4467: L92B3:
4468: ldx #$03
4469: stx T0
4470: jmp PostFailError
4471: L92BA:
4472: tsx
4473: stx SAVSP
4474: bit VDC_T1LC2
4475: lda VDC_PCR2
4476: ora #$0E
4477: sta VDC_PCR2
4478: L92C8:
4479: ldy #$05
4480: L92CA:
4481: lda JOBS0,y
4482: bmi L92D5
4483: dey
4484: bpl L92CA
4485: jmp L99CA
4486: L92D5:
4487: cmp #$88
4488: bne L92DC
4489: jmp L960D
4490: L92DC:
4491: cmp #$D0
4492: bne L92E3
4493: jmp L93A2
4494: L92E3:
4495: and #$01
4496: beq L92EE
4497: sty JOBN
4498: lda #$0F
4499: jmp L99B5
4500: L92EE:
4501: tax
4502: cmp CDRIVE
4503: beq L92FB
4504: sta CDRIVE
4505: jsr LF97E
4506: jmp L99CA
4507: L92FB:
4508: lda DRVST
4509: bmi L9302
4510: asl a
4511: bpl L9305
4512: L9302:
4513: jmp L99CA
4514: L9305:
4515: lda #$20
4516: sta DRVST
4517: ldy #$05
4518: sty JOBN
4519: L930D:
4520: jsr L93D1
4521: bmi L932C
4522: L9312:
4523: dec JOBN
4524: bpl L930D
4525: ldy NXTJOB
4526: jsr L93D3
4527: lda NXTRK
4528: sta STEPS
4529: asl STEPS
4530: lda #$60
4531: sta DRVST
4532: lda (HDRPNT),y
4533: sta DRVTRK
4534: jmp L99CA
4535: L932C:
4536: and #$01
4537: cmp CDRIVE
4538: bne L9312
4539: lda DRVTRK
4540: beq L9368
4541: lda DRVTRK
4542: cmp #$24
4543: php
4544: lda (HDRPNT),y
4545: cmp #$24
4546: ror a
4547: plp
4548: and #$80
4549: bcc L9350
4550: bmi L9358
4551: lda DRVTRK
4552: sbc #$23
4553: sta DRVTRK
4554: jmp L9358
4555: L9350:
4556: bpl L9358
4557: lda DRVTRK
4558: adc #$23
4559: sta DRVTRK
4560: L9358:
4561: sec
4562: lda (HDRPNT),y
4563: sbc DRVTRK
4564: beq L9368
4565: sta NXTRK
4566: lda JOBN
4567: sta NXTJOB
4568: jmp L9312
4569: L9368:
4570: ldx #$04
4571: lda (HDRPNT),y
4572: sta TRACC
4573: cmp #$24
4574: tay
4575: jsr L93F3
4576: tya
4577: bcc L9379
4578: sbc #$23
4579: L9379:
4580: tax
4581: .if CompileDrive >= DRIVE_1571_05
4582: lda LC04C - 1,x
4583: .else
4584: lda L9408,x
4585: .endif
4586: sta SECTR
4587: lda VDC_PB2
4588: and # ~ VDC_PB2_BITRATE
4589: ora SECTR
4590: sta VDC_PB2
4591: lda L9409 + 34,x
4592: sta SECTR
4593: lda JOB
4594: cmp #$40
4595: beq L93B0
4596: cmp #$60
4597: beq L93A2
4598: cmp #$70
4599: beq L939F
4600: jmp L944F
4601: L939F:
4602: jmp L9B29
4603: L93A2:
4604: lda JOBN
4605: clc
4606: adc #$03
4607: sta BUFPNT + 1
4608: lda #$00
4609: sta BUFPNT
4610: jmp (BUFPNT)
4611: L93B0:
4612: lda #$60
4613: sta DRVST
4614: lda VDC_PB2
4615: and # ~ VDC_PB2_STEPPER
4616: sta VDC_PB2
4617: lda #$A4
4618: sta STEPS
4619: lda L01B1
4620: bmi L93C8
4621: lda #$01
4622: .byte ASM_BIT3
4623: L93C8:
4624: lda #$24
4625: sta DRVTRK
4626: lda #$01
4627: jmp L99B5
4628: L93D1:
4629: ldy JOBN
4630: L93D3:
4631: lda JOBS0,y
4632: pha
4633: bpl L93ED
4634: and #$78
4635: sta JOB
4636: tya
4637: asl a
4638: adc #$06
4639: sta HDRPNT
4640: lda #$00
4641: sta HDRPNT + 1
4642: tya
4643: clc
4644: adc #$03
4645: sta BUFPNT + 1
4646: L93ED:
4647: ldy #$00
4648: sty BUFPNT
4649: pla
4650: rts
4651: L93F3:
4652: bcs L93F8
4653: lda #$00
4654: .byte ASM_BIT3
4655: L93F8:
4656: lda #$84
4657: sta L01B1
4658: lda VBC_PAUNBUF1
4659: and # ~ VBC_PA1_04
4660: ora L01B1
4661: sta VBC_PAUNBUF1
4662: L9408:
4663: rts
4664: L9409:
4665: .byte $60,$60,$60,$60,$60,$60,$60,$60
4666: .byte $60,$60,$60,$60,$60,$60,$60,$60
4667: .byte $60,$40,$40,$40,$40,$40,$40,$40
4668: .byte $20,$20,$20,$20,$20,$20,$00,$00
4669: .byte $00,$00,$00
4670: L942C:
4671: .byte $15,$15,$15,$15,$15,$15,$15,$15
4672: .byte $15,$15,$15,$15,$15,$15,$15,$15
4673: .byte $15,$13,$13,$13,$13,$13,$13,$13
4674: .byte $12,$12,$12,$12,$12,$12,$11,$11
4675: .byte $11,$11,$11
4676: L944F:
4677: lda #$5A
4678: sta TMP
4679: L9453:
4680: jsr L9754
4681: L9456:
4682: bit VBC_PAUNBUF1
4683: bmi L9456
4684: lda VDC_PA2
4685: cmp #$52
4686: bne L94A0
4687: sta STAB,y
4688: iny
4689: L9466:
4690: bit VBC_PAUNBUF1
4691: bmi L9466
4692: lda VDC_PA2
4693: sta STAB,y
4694: iny
4695: cpy #$08
4696: bne L9466
4697: jsr L952F
4698: ldy #$04
4699: lda #$00
4700: L947D:
4701: eor HEADER,y
4702: dey
4703: bpl L947D
4704: cmp #$00
4705: bne L94B7
4706: lda HEADER + 2
4707: sta DRVTRK
4708: lda JOB
4709: cmp #$30
4710: beq L94A9
4711: lda DiskID0
4712: cmp HEADER
4713: bne L94B4
4714: lda DiskID0 + 1
4715: cmp HEADER + 1
4716: bne L94B4
4717: jmp L94BC
4718: L94A0:
4719: dec TMP
4720: bne L9453
4721: lda #$02
4722: jsr L99B5
4723: L94A9:
4724: lda HEADER
4725: sta DiskID0
4726: lda HEADER + 1
4727: sta DiskID0 + 1
4728: L94B1:
4729: lda #$01
4730: .byte ASM_BIT3
4731: L94B4:
4732: lda #$0B
4733: .byte ASM_BIT3
4734: L94B7:
4735: lda #$09
4736: jmp L99B5
4737: L94BC:
4738: lda #$7F
4739: sta CSECT
4740: lda HEADER + 3
4741: clc
4742: adc #$02
4743: cmp SECTR
4744: bcc L94CB
4745: sbc SECTR
4746: L94CB:
4747: sta NEXTS
4748: ldx #$05
4749: stx JOBN
4750: ldx #$FF
4751: L94D3:
4752: jsr L93D1
4753: bpl L951B
4754: and #$01
4755: cmp CDRIVE
4756: bne L951B
4757: ldy #$00
4758: lda (HDRPNT),y
4759: cmp TRACC
4760: bne L951B
4761: lda JOB
4762: cmp #$60
4763: beq L94F8
4764: ldy #$01
4765: sec
4766: lda (HDRPNT),y
4767: sbc NEXTS
4768: bpl L94F8
4769: clc
4770: adc SECTR
4771: L94F8:
4772: cmp CSECT
4773: bcs L951B
4774: pha
4775: lda JOB
4776: beq L9516
4777: pla
4778: .if CompileDrive >= DRIVE_1571_05
4779: cmp #$04
4780: .else
4781: cmp #$09
4782: .endif
4783: bcc L951B
4784: .if CompileDrive >= DRIVE_1571_05
4785: cmp #$08
4786: .else
4787: cmp #$0C
4788: .endif
4789: bcs L951B
4790: L950A:
4791: sta CSECT
4792: lda JOBN
4793: tax
4794: clc
4795: adc #$03
4796: sta BUFPNT + 1
4797: bne L951B
4798: L9516:
4799: pla
4800: cmp #$06
4801: bcc L950A
4802: L951B:
4803: dec JOBN
4804: bpl L94D3
4805: txa
4806: bpl L9525
4807: jmp L99CA
4808: L9525:
4809: stx JOBN
4810: jsr L93D1
4811: lda JOB
4812: jmp L9606
4813: L952F:
4814: lda BUFPNT
4815: pha
4816: lda BUFPNT + 1
4817: pha
4818: lda #$24
4819: sta BUFPNT
4820: lda #$00
4821: sta BUFPNT + 1
4822: lda #$00
4823: sta GCRPNT
4824: jsr L98D9
4825: lda BTAB + 3
4826: sta HEADER + 2
4827: lda BTAB + 2
4828: sta HEADER + 3
4829: lda BTAB + 1
4830: sta HEADER + 4
4831: jsr L98D9
4832: lda BTAB
4833: sta HEADER + 1
4834: lda BTAB + 1
4835: sta HEADER
4836: pla
4837: sta BUFPNT + 1
4838: pla
4839: sta BUFPNT
4840: rts
4841: empty9562:
4842:
4843: FillUntil $9600
4844:
4845: L9600:
4846: jsr L970F
4847: jmp L9754
4848: L9606:
4849: cmp #$00
4850: beq L960D
4851: jmp L976E
4852: L960D:
4853: jsr L9600
4854: L9610:
4855: bit VBC_PAUNBUF1
4856: bmi L9610
4857: lda VDC_PA2
4858: tax
4859: lda LA00D,x
4860: sta BTAB
4861: txa
4862: and #$07
4863: sta BTAB + 1
4864: L9623:
4865: bit VBC_PAUNBUF1
4866: bmi L9623
4867: lda VDC_PA2
4868: sta BTAB + 2
4869: and #$C0
4870: ora BTAB + 1
4871: tax
4872: lda L9F0D,x
4873: ora BTAB
4874: pha
4875: jmp L9667
4876: L963B:
4877: bit VBC_PAUNBUF1
4878: bmi L963B
4879: lda VDC_PA2
4880: tax
4881: lda LA00D,x
4882: sta BTAB
4883: txa
4884: and #$07
4885: sta BTAB + 1
4886: L964E:
4887: bit VBC_PAUNBUF1
4888: bmi L964E
4889: lda VDC_PA2
4890: sta BTAB + 2
4891: and #$C0
4892: ora BTAB + 1
4893: tax
4894: lda L9F0D,x
4895: ora BTAB
4896: sta (BUFPNT),y
4897: iny
4898: beq L96D7
4899: L9667:
4900: lda BTAB + 2
4901: tax
4902: lda LA10D,x
4903: sta BTAB
4904: txa
4905: and #$01
4906: sta BTAB + 2
4907: L9674:
4908: bit VBC_PAUNBUF1
4909: bmi L9674
4910: lda VDC_PA2
4911: sta BTAB + 3
4912: and #$F0
4913: ora BTAB + 2
4914: tax
4915: lda L9F0D + 2,x
4916: ora BTAB
4917: sta (BUFPNT),y
4918: iny
4919: lda BTAB + 3
4920: and #$0F
4921: sta BTAB + 3
4922: L9691:
4923: bit VBC_PAUNBUF1
4924: bmi L9691
4925: lda VDC_PA2
4926: sta CHKSUM
4927: and #$80
4928: ora BTAB + 3
4929: tax
4930: lda L9F0D + 16,x
4931: sta BTAB
4932: lda CHKSUM
4933: tax
4934: lda LA20D,x
4935: ora BTAB
4936: sta (BUFPNT),y
4937: iny
4938: txa
4939: and #$03
4940: sta CHKSUM
4941: L96B5:
4942: bit VBC_PAUNBUF1
4943: bmi L96B5
4944: lda VDC_PA2
4945: sta BTAB + 1
4946: and #$E0
4947: ora CHKSUM
4948: tax
4949: lda L9F0D + 29,x
4950: sta BTAB
4951: lda BTAB + 1
4952: tax
4953: lda LA30D,x
4954: ora BTAB
4955: sta (BUFPNT),y
4956: iny
4957: jmp L963B
4958: L96D7:
4959: lda BTAB + 2
4960: tax
4961: lda LA10D,x
4962: sta BTAB
4963: txa
4964: and #$01
4965: sta BTAB + 2
4966: L96E4:
4967: bit VBC_PAUNBUF1
4968: bmi L96E4
4969: lda VDC_PA2
4970: and #$F0
4971: ora BTAB + 2
4972: tax
4973: lda L9F0D + 2,x
4974: ora BTAB
4975: sta BTAB + 1
4976: pla
4977: cmp DBID
4978: bne L9707
4979: jsr LF5E9
4980: cmp BTAB + 1
4981: beq L970A
4982: lda #$05
4983: .byte ASM_BIT3
4984: L9707:
4985: lda #$04
4986: .byte ASM_BIT3
4987: L970A:
4988: lda #$01
4989: jmp L99B5
4990: L970F:
4991: lda DiskID0
4992: sta HEADER
4993: lda DiskID0 + 1
4994: sta HEADER + 1
4995: ldy #$00
4996: lda (HDRPNT),y
4997: sta HEADER + 2
4998: iny
4999: lda (HDRPNT),y
5000: sta HEADER + 3
5001: lda #$00
5002: eor HEADER
5003: eor HEADER + 1
5004: eor HEADER + 2
5005: eor HEADER + 3
5006: sta HEADER + 4
5007: jsr LF934
5008: lda #$5A
5009: sta TMP
5010: L9735:
5011: jsr L9754
5012: L9738:
5013: lda STAB,y
5014: L973B:
5015: bit VBC_PAUNBUF1
5016: bmi L973B
5017: cmp VDC_PA2
5018: bne L974B
5019: iny
5020: cpy #$08
5021: bne L9738
5022: rts
5023: L974B:
5024: dec TMP
5025: bne L9735
5026: lda #$02
5027: jmp L99B5
5028: L9754:
5029: ldx #$0F
5030: ldy #$00
5031: L9758:
5032: bit VDC_PB2
5033: bpl L9768
5034: dey
5035: bne L9758
5036: dex
5037: bne L9758
5038: lda #$03
5039: jmp L99B5
5040: L9768:
5041: lda VDC_PA2
5042: ldy #$00
5043: rts
5044: L976E:
5045: cmp #$10
5046: beq L9775
5047: jmp L9898
5048: L9775:
5049: jsr LF5E9
5050: sta CHKSUM
5051: lda VDC_PB2
5052: and #VDC_PB2_WRITEPROTECT
5053: bne L9786
5054: lda #$08
5055: jmp L99B5
5056: L9786:
5057: jsr LF78F
5058: jsr L970F
5059: ldy #$09
5060: L978E:
5061: bit VBC_PAUNBUF1
5062: bmi L978E
5063: bit VDC_PB2
5064: dey
5065: bne L978E
5066: lda #$FF
5067: sta VDC_DDRA2
5068: lda VDC_PCR2
5069: and #$1F
5070: ora #$C0
5071: sta VDC_PCR2
5072: lda #$FF
5073: ldy #$05
5074: sta VDC_PA2
5075: L97AF:
5076: bit VBC_PAUNBUF1
5077: bmi L97AF
5078: bit VDC_PB2
5079: dey
5080: bne L97AF
5081: ldy #$BB
5082: L97BC:
5083: lda NODRV + 1,y
5084: L97BF:
5085: bit VBC_PAUNBUF1
5086: bmi L97BF
5087: sta VDC_PA2
5088: iny
5089: bne L97BC
5090: L97CA:
5091: lda (BUFPNT),y
5092: L97CC:
5093: bit VBC_PAUNBUF1
5094: bmi L97CC
5095: sta VDC_PA2
5096: iny
5097: bne L97CA
5098: L97D7:
5099: bit VBC_PAUNBUF1
5100: bmi L97D7
5101: lda VDC_PCR2
5102: ora #$E0
5103: sta VDC_PCR2
5104: lda #$00
5105: sta VDC_DDRA2
5106: jsr L97F9
5107: ldy JOBN
5108: .if CompileDrive >= DRIVE_1571_05
5109: jmp LAAAD
5110: .else
5111: lda JOBS0,y
5112: .endif
5113: eor #$30
5114: sta JOBS0,y
5115: jmp L944F
5116: L97F9:
5117: lda #$00
5118: sta SAVPNT
5119: sta BUFPNT
5120: sta NXTPNT
5121: lda BUFPNT + 1
5122: sta NXTBF
5123: lda #$01
5124: sta BUFPNT + 1
5125: sta SAVPNT + 1
5126: lda #$BB
5127: sta GCRPNT
5128: sta BYTCNT
5129: jsr L98D9
5130: lda BTAB
5131: sta BID
5132: ldy BYTCNT
5133: lda BTAB + 1
5134: sta (SAVPNT),y
5135: iny
5136: lda BTAB + 2
5137: sta (SAVPNT),y
5138: iny
5139: lda BTAB + 3
5140: sta (SAVPNT),y
5141: iny
5142: sty BYTCNT
5143: L982B:
5144: jsr L98D9
5145: ldy BYTCNT
5146: lda BTAB
5147: sta (SAVPNT),y
5148: iny
5149: lda BTAB + 1
5150: sta (SAVPNT),y
5151: iny
5152: beq L984A
5153: lda BTAB + 2
5154: sta (SAVPNT),y
5155: iny
5156: lda BTAB + 3
5157: sta (SAVPNT),y
5158: iny
5159: sty BYTCNT
5160: bne L982B
5161: L984A:
5162: lda BTAB + 2
5163: sta (BUFPNT),y
5164: iny
5165: lda BTAB + 3
5166: sta (BUFPNT),y
5167: iny
5168: sty BYTCNT
5169: L9856:
5170: jsr L98D9
5171: ldy BYTCNT
5172: lda BTAB
5173: sta (BUFPNT),y
5174: iny
5175: lda BTAB + 1
5176: sta (BUFPNT),y
5177: iny
5178: lda BTAB + 2
5179: sta (BUFPNT),y
5180: iny
5181: lda BTAB + 3
5182: sta (BUFPNT),y
5183: iny
5184: sty BYTCNT
5185: cpy #$BB
5186: bcc L9856
5187: lda #$45
5188: sta SAVPNT
5189: lda BUFPNT + 1
5190: sta SAVPNT + 1
5191: ldy #$BA
5192: L987F:
5193: lda (BUFPNT),y
5194: sta (SAVPNT),y
5195: dey
5196: bne L987F
5197: lda (BUFPNT),y
5198: sta (SAVPNT),y
5199: ldx #$BB
5200: L988C:
5201: lda NODRV + 1,x
5202: sta (BUFPNT),y
5203: iny
5204: inx
5205: bne L988C
5206: stx GCRFLG
5207: rts
5208: L9898:
5209: cmp #$20
5210: beq L989E
5211: bne L98CE
5212: L989E:
5213: jsr LF5E9
5214: sta CHKSUM
5215: jsr LF78F
5216: jsr L9600
5217: ldy #$BB
5218: L98AB:
5219: lda NODRV + 1,y
5220: L98AE:
5221: bit VBC_PAUNBUF1
5222: bmi L98AE
5223: eor VDC_PA2
5224: bne L98D4
5225: iny
5226: bne L98AB
5227: L98BB:
5228: lda (BUFPNT),y
5229: L98BD:
5230: bit VBC_PAUNBUF1
5231: bmi L98BD
5232: eor VDC_PA2
5233: bne L98D4
5234: iny
5235: cpy #$FD
5236: bne L98BB
5237: beq L98D1
5238: L98CE:
5239: jsr L970F
5240: L98D1:
5241: lda #$01
5242: .byte ASM_BIT3
5243: L98D4:
5244: lda #$07
5245: jmp L99B5
5246: L98D9:
5247: ldy GCRPNT
5248: lda (BUFPNT),y
5249: sta GTAB
5250: and #$07
5251: sta GTAB + 1
5252: iny
5253: bne L98EC
5254: lda NXTBF
5255: sta BUFPNT + 1
5256: ldy NXTPNT
5257: L98EC:
5258: lda (BUFPNT),y
5259: sta GTAB + 2
5260: and #$C0
5261: ora GTAB + 1
5262: sta GTAB + 1
5263: lda GTAB + 2
5264: and #$01
5265: sta GTAB + 3
5266: iny
5267: lda (BUFPNT),y
5268: tax
5269: and #$F0
5270: ora GTAB + 3
5271: sta GTAB + 3
5272: txa
5273: and #$0F
5274: sta GTAB + 4
5275: iny
5276: lda (BUFPNT),y
5277: sta GTAB + 5
5278: and #$80
5279: ora GTAB + 4
5280: sta GTAB + 4
5281: lda GTAB + 5
5282: and #$03
5283: sta GTAB + 6
5284: iny
5285: bne L9927
5286: lda NXTBF
5287: sta BUFPNT + 1
5288: ldy NXTPNT
5289: sty BUFPNT
5290: L9927:
5291: lda (BUFPNT),y
5292: sta GTAB + 7
5293: and #$E0
5294: ora GTAB + 6
5295: sta GTAB + 6
5296: iny
5297: sty GCRPNT
5298: ldx GTAB
5299: lda LA00D,x
5300: ldx GTAB + 1
5301: ora L9F0D,x
5302: sta BTAB
5303: ldx GTAB + 2
5304: lda LA10D,x
5305: ldx GTAB + 3
5306: ora L9F0D + 2,x
5307: sta BTAB + 1
5308: ldx GTAB + 4
5309: lda L9F0D + 16,x
5310: ldx GTAB + 5
5311: ora LA20D,x
5312: sta BTAB + 2
5313: ldx GTAB + 6
5314: lda L9F0D + 29,x
5315: ldx GTAB + 7
5316: ora LA30D,x
5317: sta BTAB + 3
5318: rts
5319: L9965:
5320: lda #$00
5321: sta GCRPNT
5322: sta SAVPNT
5323: sta BYTCNT
5324: lda #$01
5325: sta NXTBF
5326: lda #$BA
5327: sta NXTPNT
5328: lda BUFPNT + 1
5329: sta SAVPNT + 1
5330: jsr L98D9
5331: lda BTAB
5332: sta BID
5333: ldy BYTCNT
5334: lda BTAB + 1
5335: sta (SAVPNT),y
5336: iny
5337: lda BTAB + 2
5338: sta (SAVPNT),y
5339: iny
5340: lda BTAB + 3
5341: sta (SAVPNT),y
5342: iny
5343: L9991:
5344: sty BYTCNT
5345: jsr L98D9
5346: ldy BYTCNT
5347: lda BTAB
5348: sta (SAVPNT),y
5349: iny
5350: beq L99B0
5351: lda BTAB + 1
5352: sta (SAVPNT),y
5353: iny
5354: lda BTAB + 2
5355: sta (SAVPNT),y
5356: iny
5357: lda BTAB + 3
5358: sta (SAVPNT),y
5359: iny
5360: bne L9991
5361: L99B0:
5362: lda SAVPNT + 1
5363: sta BUFPNT + 1
5364: rts
5365: L99B5:
5366: ldy JOBN
5367: sta JOBS0,y
5368: lda GCRFLG
5369: beq L99C1
5370: jsr L97F9
5371: L99C1:
5372: jsr LF98F
5373: ldx SAVSP
5374: txs
5375: jmp L92C8
5376: L99CA:
5377: lda VDC_T1HL2
5378: sta VDC_T1HC2
5379: lda VDC_PB2
5380: and #VDC_PB2_WRITEPROTECT
5381: cmp LWPT
5382: sta LWPT
5383: bne L99E2
5384: lda CNTMOTOR1570
5385: bne L99F0
5386: beq L99FE
5387: L99E2:
5388: lda #$FF
5389: sta CNTMOTOR1570
5390: jsr L8764
5391:
5392: SET_WPSW_DIRTY_NO_CR
5393:
5394: bne L99FE
5395: L99F0:
5396: dec CNTMOTOR1570
5397: bne L99FE
5398: lda DRVST
5399: cmp #$00
5400: bne L99FE
5401: jsr L8770
5402: L99FE:
5403: lda PHASE
5404: beq L9A18
5405: cmp #$02
5406: bne L9A0E
5407: lda #$00
5408: sta PHASE
5409: beq L9A18
5410: L9A0E:
5411: sta STEPS
5412: lda #$02
5413: sta PHASE
5414: jmp L9A56
5415: L9A18:
5416: ldx CDRIVE
5417: bmi L9A23
5418: lda DRVST
5419: tay
5420: cmp #$20
5421: bne L9A26
5422: L9A23:
5423: .if CompileDrive >= DRIVE_1571_05
5424: jmp L9AC6
5425: .else
5426: jmp L9AC9
5427: .endif
5428: L9A26:
5429: dec ACLTIM
5430: bne L9A46
5431: tya
5432: bpl L9A31
5433: and #$7F
5434: sta DRVST
5435: L9A31:
5436: and #$10
5437: beq L9A46
5438: dec GCRERR
5439: bne L9A46
5440: jsr L8770
5441: lda #$FF
5442: sta CDRIVE
5443: lda #$00
5444: sta DRVST
5445: beq L9A23
5446: L9A46:
5447: tya
5448: and #$40
5449: bne L9A4E
5450: .if CompileDrive >= DRIVE_1571_05
5451: jmp L9AC6
5452: .else
5453: jmp L9AC9
5454: .endif
5455: L9A4E:
5456: lda NXTST
5457: bne L9AA2
5458: lda STEPS
5459: beq L9A99
5460: L9A56:
5461: lda STEPS
5462: bpl L9AB3
5463: tya
5464: pha
5465: ldy #$63
5466: L9A5E:
5467: lda VBC_PAUNBUF1
5468: ror a
5469: php
5470: lda VBC_PAUNBUF1
5471: ror a
5472: ror a
5473: plp
5474: and #$80
5475: bcc L9A71
5476: bpl L9A8C
5477: bmi L9A73
5478: L9A71:
5479: bmi L9A8C
5480: L9A73:
5481: dey
5482: bne L9A5E
5483: bcs L9A8C
5484: lda ADRSED
5485: bne L9A8C
5486: lda VDC_PB2
5487: and #VDC_PB2_STEPPER
5488: bne L9A8C
5489: pla
5490: tay
5491: lda #$00
5492: sta STEPS
5493: .if CompileDrive >= DRIVE_1571_05
5494: jmp L9AC6
5495: .else
5496: jmp L9AC9
5497: .endif
5498: L9A8C:
5499: pla
5500: tay
5501: inc STEPS
5502: lda VDC_PB2
5503: sec
5504: sbc #$01
5505: jmp L9ABB
5506: L9A99:
5507: lda #$02
5508: sta ACLTIM
5509: sta NXTST
5510: .if CompileDrive >= DRIVE_1571_05
5511: jmp L9AC6
5512: .else
5513: jmp L9AC9
5514: .endif
5515: L9AA2:
5516: dec ACLTIM
5517: .if CompileDrive >= DRIVE_1571_05
5518: bne L9AC6
5519: .else
5520: bne L9AC9
5521: .endif
5522: lda DRVST
5523: and #$BF
5524: sta DRVST
5525: lda #$00
5526: sta NXTST
5527: .if CompileDrive >= DRIVE_1571_05
5528: jmp L9AC6
5529: .else
5530: jmp L9AC9
5531: .endif
5532: L9AB3:
5533: dec STEPS
5534: lda VDC_PB2
5535: clc
5536: adc #$01
5537: L9ABB:
5538: and #$03
5539: sta TMP
5540: lda VDC_PB2
5541: .if CompileDrive >= DRIVE_1571_05
5542: jmp LC038
5543: nop
5544: L9AC6:
5545: jmp LC03F
5546: .else
5547: and # ~ VDC_PB2_STEPPER
5548: ora TMP
5549: sta VDC_PB2
5550: .endif
5551: L9AC9:
5552: rts
5553: L9ACA:
5554: .byte $21,$22,$23,$24,$25,$26,$27,$28,$29
5555: L9AD3:
5556: .byte $02,$02,$04,$06,$08,$08,$0B,$13,$16
5557: L9ADC:
5558: ldy #$00
5559: ldx #$1C
5560: jsr L9D63
5561: jsr L9B73
5562: jsr LFE00
5563: ldy #$FF
5564: L9AEB:
5565: ldx #$FF
5566: L9AED:
5567: bit VDC_PB2
5568: bpl L9AFD
5569: dex
5570: bne L9AED
5571: dey
5572: bne L9AEB
5573: L9AF8:
5574: lda #$02
5575: jmp L9D59
5576: L9AFD:
5577: ldy #$00
5578: ldx #$00
5579: L9B01:
5580: bit VDC_PB2
5581: bpl L9B01
5582: L9B06:
5583: lda VDC_PB2
5584: iny
5585: bne L9B0D
5586: inx
5587: L9B0D:
5588: and #VDC_PB2_SYNC
5589: bne L9B06
5590: lda #$00
5591: sta HINIB
5592: txa
5593: ldx #$08
5594: L9B18:
5595: cmp L9ACA,x
5596: beq L9B22
5597: dex
5598: bpl L9B18
5599: bmi L9AF8
5600: L9B22:
5601: lda L9AD3,x
5602: sta BUFFER3 + 38
5603: rts
5604: L9B29:
5605: lda FTNUM
5606: bpl L9B58
5607: lda #$60
5608: sta DRVST
5609: lda L01B2
5610: bne L9B39
5611: lda #$01
5612: .byte ASM_BIT3
5613: L9B39:
5614: lda #$24
5615: sta DRVTRK
5616: sta FTNUM
5617: cmp #$24
5618: jsr L93F3
5619: lda #$A4
5620: sta STEPS
5621: lda VDC_PB2
5622: and # ~ VDC_PB2_STEPPER
5623: sta VDC_PB2
5624: lda #$0A
5625: sta BUFFER3 + 32
5626: jmp L99CA
5627: L9B58:
5628: ldy #$00
5629: lda (HDRPNT),y
5630: cmp FTNUM
5631: beq L9B67
5632: lda FTNUM
5633: sta (HDRPNT),y
5634: jmp L99CA
5635: L9B67:
5636: lda VDC_PB2
5637: and #VDC_PB2_WRITEPROTECT
5638: bne L9B89
5639: lda #$08
5640: jmp L9D51
5641: L9B73:
5642: ldx #$14
5643: lda #$FF
5644: L9B77:
5645: bit VBC_PAUNBUF1
5646: bmi L9B77
5647: sta VDC_PA2
5648: bit VDC_PB2
5649: dey
5650: bne L9B77
5651: dex
5652: bne L9B77
5653: rts
5654: L9B89:
5655: lda HINIB
5656: bpl L9B90
5657: jsr L9ADC
5658: L9B90:
5659: lda BUFFER3 + 38
5660: clc
5661: lda #$03
5662: sta HDRPNT + 1
5663: lda #$00
5664: sta HDRPNT
5665: sta BUFFER3 + 40
5666: ldy #$00
5667: L9BA1:
5668: lda HBID
5669: sta (HDRPNT),y
5670: iny
5671: lda #$00
5672: sta (HDRPNT),y
5673: iny
5674: lda BUFFER3 + 40
5675: sta (HDRPNT),y
5676: iny
5677: lda FTNUM
5678: sta (HDRPNT),y
5679: iny
5680: lda DiskID0 + 1
5681: sta (HDRPNT),y
5682: iny
5683: lda DiskID0
5684: sta (HDRPNT),y
5685: iny
5686: lda #$0F
5687: sta (HDRPNT),y
5688: iny
5689: sta (HDRPNT),y
5690: iny
5691: tya
5692: pha
5693: ldx #$07
5694: lda #$00
5695: sta CHKSUM
5696: L9BD0:
5697: dey
5698: lda (HDRPNT),y
5699: eor CHKSUM
5700: sta CHKSUM
5701: dex
5702: bne L9BD0
5703: sta (HDRPNT),y
5704: pla
5705: tay
5706: inc BUFFER3 + 40
5707: lda BUFFER3 + 40
5708: cmp SECTR
5709: bcc L9BA1
5710: lda #$03
5711: sta BUFPNT + 1
5712: jsr LFE30
5713: ldy #$BA
5714: L9BF1:
5715: lda (HDRPNT),y
5716: ldx #$45
5717: stx HDRPNT
5718: sta (HDRPNT),y
5719: ldx #$00
5720: stx HDRPNT
5721: dey
5722: cpy #$FF
5723: bne L9BF1
5724: ldy #$44
5725: L9C04:
5726: lda L01BB,y
5727: sta (HDRPNT),y
5728: dey
5729: bpl L9C04
5730: clc
5731: lda #$03
5732: adc #$02
5733: sta BUFPNT + 1
5734: lda #$00
5735: tay
5736: L9C16:
5737: sta (BUFPNT),y
5738: iny
5739: bne L9C16
5740: jsr LF5E9
5741: sta CHKSUM
5742: jsr LF78F
5743: lda #$00
5744: sta ACTJOB
5745: ldx #$06
5746: jsr L9D63
5747: L9C2C:
5748: ldy #$05
5749: L9C2E:
5750: bit VBC_PAUNBUF1
5751: bmi L9C2E
5752: lda #$FF
5753: sta VDC_PA2
5754: bit VDC_PB2
5755: dey
5756: bne L9C2E
5757: ldx #$0A
5758: ldy ACTJOB
5759: L9C42:
5760: bit VBC_PAUNBUF1
5761: bmi L9C42
5762: lda (HDRPNT),y
5763: sta VDC_PA2
5764: bit VDC_PB2
5765: iny
5766: dex
5767: bne L9C42
5768: ldy #$09
5769: L9C55:
5770: bit VBC_PAUNBUF1
5771: bmi L9C55
5772: lda #$55
5773: sta VDC_PA2
5774: bit VDC_PB2
5775: dey
5776: bne L9C55
5777: lda #$FF
5778: ldy #$05
5779: L9C69:
5780: bit VBC_PAUNBUF1
5781: bmi L9C69
5782: sta VDC_PA2
5783: bit VDC_PB2
5784: dey
5785: bne L9C69
5786: ldy #$BB
5787: L9C79:
5788: bit VBC_PAUNBUF1
5789: bmi L9C79
5790: lda NODRV + 1,y
5791: sta VDC_PA2
5792: bit VDC_PB2
5793: iny
5794: bne L9C79
5795: L9C8A:
5796: bit VBC_PAUNBUF1
5797: bmi L9C8A
5798: lda (BUFPNT),y
5799: sta VDC_PA2
5800: bit VDC_PB2
5801: iny
5802: bne L9C8A
5803: lda #$55
5804: ldy BUFFER3 + 38
5805: L9C9F:
5806: bit VBC_PAUNBUF1
5807: bmi L9C9F
5808: sta VDC_PA2
5809: bit VDC_PB2
5810: dey
5811: bne L9C9F
5812: lda ACTJOB
5813: clc
5814: adc #$0A
5815: sta ACTJOB
5816: dec BUFFER3 + 40
5817: beq L9CBC
5818: jmp L9C2C
5819: L9CBC:
5820: bit VBC_PAUNBUF1
5821: bmi L9CBC
5822: bit VDC_PB2
5823: L9CC4:
5824: bit VBC_PAUNBUF1
5825: bmi L9CC4
5826: bit VDC_PB2
5827: jsr LFE00
5828: lda #$C8
5829: sta BUFFER3 + 35
5830: L9CD4:
5831: lda #$00
5832: sta ACTJOB
5833: lda SECTR
5834: sta BUFFER3 + 40
5835: L9CDD:
5836: jsr L9754
5837: ldx #$0A
5838: ldy ACTJOB
5839: L9CE4:
5840: lda (HDRPNT),y
5841: L9CE6:
5842: bit VBC_PAUNBUF1
5843: bmi L9CE6
5844: cmp VDC_PA2
5845: bne L9CFE
5846: iny
5847: dex
5848: bne L9CE4
5849: clc
5850: lda ACTJOB
5851: adc #$0A
5852: sta ACTJOB
5853: jmp L9D08
5854: L9CFE:
5855: dec BUFFER3 + 35
5856: bne L9CD4
5857: lda #$06
5858: jmp L9D51
5859: L9D08:
5860: jsr L9754
5861: ldy #$BB
5862: L9D0D:
5863: lda NODRV + 1,y
5864: L9D10:
5865: bit VBC_PAUNBUF1
5866: bmi L9D10
5867: cmp VDC_PA2
5868: bne L9CFE
5869: iny
5870: bne L9D0D
5871: L9D1D:
5872: lda (BUFPNT),y
5873: L9D1F:
5874: bit VBC_PAUNBUF1
5875: bmi L9D1F
5876: cmp VDC_PA2
5877: bne L9CFE
5878: iny
5879: bne L9D1D
5880: dec BUFFER3 + 40
5881: bne L9CDD
5882: inc FTNUM
5883: lda FTNUM
5884: bit L01B1
5885: bmi L9D3D
5886: cmp #$24
5887: .byte ASM_BIT3
5888: L9D3D:
5889: cmp #$47
5890: bcs L9D44
5891: jmp L99CA
5892: L9D44:
5893: lda #$FF
5894: sta FTNUM
5895: lda #$00
5896: sta GCRFLG
5897: lda #$01
5898: jmp L99B5
5899: L9D51:
5900: dec BUFFER3 + 32
5901: beq L9D59
5902: jmp L99CA
5903: L9D59:
5904: ldy #$FF
5905: sty FTNUM
5906: iny
5907: sty GCRFLG
5908: jmp L99B5
5909: L9D63:
5910: lda VDC_PCR2
5911: and #$1F
5912: ora #$C0
5913: sta VDC_PCR2
5914: lda #$FF
5915: sta VDC_DDRA2
5916: lda #$55
5917: ldy #$00
5918: L9D76:
5919: bit VBC_PAUNBUF1
5920: bmi L9D76
5921: bit VDC_PB2
5922: sta VDC_PA2
5923: dey
5924: bne L9D76
5925: dex
5926: bne L9D76
5927: rts
5928: L9D88:
5929: pha
5930: txa
5931: pha
5932: tya
5933: pha
5934: lda CIA_ICR
5935: and #CIA_ICR_B_SP
5936: beq L9DBA
5937: bit FLGMODE1570
5938: bmi L9DBA
5939: lda VBC_PAUNBUF1
5940: ora #VBC_PA1_20
5941: sta VBC_PAUNBUF1
5942: lda #$DE
5943: sta VIRQJOB1570
5944: lda #$9D
5945: sta VIRQJOB1570 + 1
5946: lda #$40
5947: sta VDC_T1HL2
5948: sta VDC_T1HC2
5949: lda #$00
5950: sta NXTST
5951: jmp L9DEA
5952: L9DBA:
5953: lda VBC_IFR1
5954: and #$02
5955: beq L9DC4
5956: jsr SetATNPending
5957: L9DC4:
5958: lda VDC_IFR2
5959: asl a
5960: bpl L9DCD
5961: jsr LF2B0
5962: L9DCD:
5963: tsx
5964: lda L0104,x
5965: and #$10
5966: beq L9DD8
5967: jsr LF2B0
5968: L9DD8:
5969: pla
5970: tay
5971: pla
5972: tax
5973: pla
5974: rti
5975: L9DDE:
5976: pha
5977: txa
5978: pha
5979: tya
5980: pha
5981: lda CIA_ICR
5982: and #CIA_ICR_B_SP
5983: beq L9DF2
5984: L9DEA:
5985: lda BITCNT
5986: ora #$40
5987: sta BITCNT
5988: bne L9E14
5989: L9DF2:
5990: lda VBC_IFR1
5991: and #$02
5992: beq L9E00
5993: bit VBC_PA1
5994: lda #$01
5995: sta ATNPND
5996: L9E00:
5997: tsx
5998: lda L0104,x
5999: and #$10
6000: beq L9E0B
6001: jsr L92BA
6002: L9E0B:
6003: lda VDC_IFR2
6004: asl a
6005: bpl L9E14
6006: jsr L92BA
6007: L9E14:
6008: pla
6009: tay
6010: pla
6011: tax
6012: pla
6013: rti
6014: empty9e1a:
6015:
6016: FillUntil $9F09
6017:
6018: .byte $08,$00,$01,$FF
6019:
6020: L9F0D:
6021: .byte $0C,$04,$05,$FF,$FF,$02,$03,$FF
6022: .byte $0F,$06,$07,$FF,$09,$0A,$0B,$FF
6023: .byte $0D,$0E,$80,$FF,$00,$00,$10,$40
6024: .byte $FF,$20,$C0,$60,$40,$A0,$50,$E0
6025: .byte $FF,$FF,$FF,$02,$20,$08,$30,$FF
6026: .byte $FF,$00,$F0,$FF,$60,$01,$70,$FF
6027: .byte $FF,$FF,$90,$03,$A0,$0C,$B0,$FF
6028: .byte $FF,$04,$D0,$FF,$E0,$05,$80,$FF
6029: .byte $90,$FF,$08,$0C,$FF,$0F,$09,$0D
6030: .byte $80,$02,$FF,$FF,$FF,$03,$FF,$FF
6031: .byte $00,$FF,$FF,$0F,$FF,$0F,$FF,$FF
6032: .byte $10,$06,$FF,$FF,$FF,$07,$00,$20
6033: .byte $A0,$FF,$FF,$06,$FF,$09,$FF,$FF
6034: .byte $C0,$0A,$FF,$FF,$FF,$0B,$FF,$FF
6035: .byte $40,$FF,$FF,$07,$FF,$0D,$FF,$FF
6036: .byte $50,$0E,$FF,$FF,$FF,$FF,$10,$30
6037: .byte $B0,$FF,$00,$04,$02,$06,$0A,$0E
6038: .byte $80,$FF,$FF,$FF,$FF,$FF,$FF,$FF
6039: .byte $20,$FF,$08,$09,$80,$10,$C0,$50
6040: .byte $30,$30,$F0,$70,$90,$B0,$D0,$FF
6041: .byte $FF,$FF,$00,$0A,$FF,$FF,$FF,$FF
6042: .byte $F0
6043: L9FB6:
6044: brk
6045: nop
6046: L9FB8:
6047: lda JOBS0,x
6048: bmi L9FB8
6049: rts
6050:
6051: L9FBD:
6052: .byte $60,$FF,$01,$0B,$FF,$FF,$FF,$FF
6053: .byte $70,$FF,$FF,$FF,$FF,$FF,$C0,$F0
6054: .byte $D0,$FF,$01,$05,$03,$07,$0B,$FF
6055: .byte $90,$FF,$FF,$FF,$FF,$FF,$FF,$FF
6056: .byte $A0,$FF,$0C,$0D,$FF,$FF,$FF,$FF
6057: .byte $B0,$FF,$FF,$FF,$FF,$FF,$40,$60
6058: .byte $E0,$FF,$04,$0E,$FF,$FF,$FF,$FF
6059: .byte $D0,$FF,$FF,$FF,$FF,$FF,$FF,$FF
6060: .byte $E0,$FF,$05,$FF,$FF,$FF,$FF,$FF
6061: .byte $FF,$FF,$FF,$FF,$FF,$FF,$50,$70
6062: LA00D:
6063: .byte $0C,$04,$05,$FF,$FF,$02,$03,$FF
6064: .byte $0F,$06,$07,$FF,$09,$0A,$0B,$FF
6065: .byte $0D,$0E,$80,$FF,$00,$00,$10,$40
6066: .byte $FF,$20,$C0,$60,$40,$A0,$50,$E0
6067: .byte $FF,$FF,$FF,$02,$20,$08,$30,$30
6068: .byte $30,$00,$F0,$FF,$60,$01,$70,$FF
6069: .byte $FF,$FF,$90,$03,$A0,$0C,$B0,$FF
6070: .byte $FF,$04,$D0,$FF,$E0,$05,$80,$FF
6071: .byte $90,$FF,$08,$0C,$FF,$0F,$09,$0D
6072: .byte $80,$80,$80,$80,$80,$80,$80,$80
6073: .byte $00,$00,$00,$00,$00,$00,$00,$00
6074: .byte $10,$10,$10,$10,$10,$10,$10,$10
6075: .byte $A0,$FF,$FF,$06,$FF,$09,$FF,$FF
6076: .byte $C0,$C0,$C0,$C0,$C0,$C0,$C0,$C0
6077: .byte $40,$40,$40,$40,$40,$40,$40,$40
6078: .byte $50,$50,$50,$50,$50,$50,$50,$50
6079: .byte $B0,$FF,$00,$04,$02,$06,$0A,$0E
6080: .byte $80,$80,$80,$80,$80,$80,$80,$80
6081: .byte $20,$20,$20,$20,$20,$20,$20,$20
6082: .byte $30,$30,$30,$30,$30,$30,$30,$30
6083: .byte $FF,$FF,$00,$0A,$0A,$0A,$0A,$0A
6084: .byte $F0,$F0,$F0,$F0,$F0,$F0,$F0,$F0
6085: .byte $60,$60,$60,$60,$60,$60,$60,$60
6086: .byte $70,$70,$70,$70,$70,$70,$70,$70
6087: .byte $D0,$FF,$01,$05,$03,$07,$0B,$FF
6088: .byte $90,$90,$90,$90,$90,$90,$90,$90
6089: .byte $A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0
6090: .byte $B0,$B0,$B0,$B0,$B0,$B0,$B0,$B0
6091: .byte $E0,$FF,$04,$0E,$FF,$FF,$FF,$FF
6092: .byte $D0,$D0,$D0,$D0,$D0,$D0,$D0,$D0
6093: .byte $E0,$E0,$E0,$E0,$E0,$E0,$E0,$E0
6094: .byte $05,$05,$05,$05,$05,$05,$50,$70
6095:
6096: LA10D:
6097: .byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
6098: .byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
6099: .byte $FF,$FF,$80,$80,$00,$00,$10,$10
6100: .byte $FF,$FF,$C0,$C0,$40,$40,$50,$50
6101: .byte $FF,$FF,$FF,$FF,$20,$20,$30,$30
6102: .byte $FF,$FF,$F0,$F0,$60,$60,$70,$70
6103: .byte $FF,$FF,$90,$90,$A0,$A0,$B0,$B0
6104: .byte $FF,$FF,$D0,$D0,$E0,$E0,$FF,$FF
6105: .byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
6106: .byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
6107: .byte $FF,$FF,$80,$80,$00,$00,$10,$10
6108: .byte $FF,$FF,$C0,$C0,$40,$40,$50,$50
6109: .byte $FF,$FF,$FF,$FF,$20,$20,$30,$30
6110: .byte $FF,$FF,$F0,$F0,$60,$60,$70,$70
6111: .byte $FF,$FF,$90,$90,$A0,$A0,$B0,$B0
6112: .byte $FF,$FF,$D0,$D0,$E0,$E0,$FF,$FF
6113: .byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
6114: .byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
6115: .byte $FF,$FF,$80,$80,$00,$00,$10,$10
6116: .byte $FF,$FF,$C0,$C0,$40,$40,$50,$50
6117: .byte $FF,$FF,$FF,$FF,$20,$20,$30,$30
6118: .byte $FF,$FF,$F0,$F0,$60,$60,$70,$70
6119: .byte $FF,$FF,$90,$90,$A0,$A0,$B0,$B0
6120: .byte $FF,$FF,$D0,$D0,$E0,$E0,$FF,$FF
6121: .byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
6122: .byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
6123: .byte $FF,$FF,$80,$80,$00,$00,$10,$10
6124: .byte $FF,$FF,$C0,$C0,$40,$40,$50,$50
6125: .byte $FF,$FF,$FF,$FF,$20,$20,$30,$30
6126: .byte $FF,$FF,$F0,$F0,$60,$60,$70,$70
6127: .byte $FF,$FF,$90,$90,$A0,$A0,$B0,$B0
6128: .byte $FF,$FF,$D0,$D0,$E0,$E0,$FF,$FF
6129:
6130: LA20D:
6131: .byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
6132: .byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
6133: .byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
6134: .byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
6135: .byte $FF,$FF,$FF,$FF,$08,$08,$08,$08
6136: .byte $00,$00,$00,$00,$01,$01,$01,$01
6137: .byte $FF,$FF,$FF,$FF,$0C,$0C,$0C,$0C
6138: .byte $04,$04,$04,$04,$05,$05,$05,$05
6139: .byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
6140: .byte $02,$02,$02,$02,$03,$03,$03,$03
6141: .byte $FF,$FF,$FF,$FF,$0F,$0F,$0F,$0F
6142: .byte $06,$06,$06,$06,$07,$07,$07,$07
6143: .byte $FF,$FF,$FF,$FF,$09,$09,$09,$09
6144: .byte $0A,$0A,$0A,$0A,$0B,$0B,$0B,$0B
6145: .byte $FF,$FF,$FF,$FF,$0D,$0D,$0D,$0D
6146: .byte $0E,$0E,$0E,$0E,$FF,$FF,$FF,$FF
6147: .byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
6148: .byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
6149: .byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
6150: .byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
6151: .byte $FF,$FF,$FF,$FF,$08,$08,$08,$08
6152: .byte $00,$00,$00,$00,$01,$01,$01,$01
6153: .byte $FF,$FF,$FF,$FF,$0C,$0C,$0C,$0C
6154: .byte $04,$04,$04,$04,$05,$05,$05,$05
6155: .byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
6156: .byte $02,$02,$02,$02,$03,$03,$03,$03
6157: .byte $FF,$FF,$FF,$FF,$0F,$0F,$0F,$0F
6158: .byte $06,$06,$06,$06,$07,$07,$07,$07
6159: .byte $FF,$FF,$FF,$FF,$09,$09,$09,$09
6160: .byte $0A,$0A,$0A,$0A,$0B,$0B,$0B,$0B
6161: .byte $FF,$FF,$FF,$FF,$0D,$0D,$0D,$0D
6162: .byte $0E,$0E,$0E,$0E,$FF,$FF,$FF,$FF
6163:
6164: LA30D:
6165: .byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
6166: .byte $FF,$08,$00,$01,$FF,$0C,$04,$05
6167: .byte $FF,$FF,$02,$03,$FF,$0F,$06,$07
6168: .byte $FF,$09,$0A,$0B,$FF,$0D,$0E,$FF
6169: .byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
6170: .byte $FF,$08,$00,$01,$FF,$0C,$04,$05
6171: .byte $FF,$FF,$02,$03,$FF,$0F,$06,$07
6172: .byte $FF,$09,$0A,$0B,$FF,$0D,$0E,$FF
6173: .byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
6174: .byte $FF,$08,$00,$01,$FF,$0C,$04,$05
6175: .byte $FF,$FF,$02,$03,$FF,$0F,$06,$07
6176: .byte $FF,$09,$0A,$0B,$FF,$0D,$0E,$FF
6177: .byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
6178: .byte $FF,$08,$00,$01,$FF,$0C,$04,$05
6179: .byte $FF,$FF,$02,$03,$FF,$0F,$06,$07
6180: .byte $FF,$09,$0A,$0B,$FF,$0D,$0E,$FF
6181: .byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
6182: .byte $FF,$08,$00,$01,$FF,$0C,$04,$05
6183: .byte $FF,$FF,$02,$03,$FF,$0F,$06,$07
6184: .byte $FF,$09,$0A,$0B,$FF,$0D,$0E,$FF
6185: .byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
6186: .byte $FF,$08,$00,$01,$FF,$0C,$04,$05
6187: .byte $FF,$FF,$02,$03,$FF,$0F,$06,$07
6188: .byte $FF,$09,$0A,$0B,$FF,$0D,$0E,$FF
6189: .byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
6190: .byte $FF,$08,$00,$01,$FF,$0C,$04,$05
6191: .byte $FF,$FF,$02,$03,$FF,$0F,$06,$07
6192: .byte $FF,$09,$0A,$0B,$FF,$0D,$0E,$FF
6193: .byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
6194: .byte $FF,$08,$00,$01,$FF,$0C,$04,$05
6195: .byte $FF,$FF,$02,$03,$FF,$0F,$06,$07
6196: .byte $FF,$09,$0A,$0B,$FF,$0D,$0E,$FF
6197:
6198: LA40D:
6199: lda #MAXTRACK_DOUBLESIDED + 1
6200: sta MAXTRACK_ADJUSTED
6201: lda #$03
6202: jsr LD6D3
6203: ldx #$03
6204: lda #$00
6205: sta L01B2
6206: lda #$F0
6207: sta HINIB
6208: sta JOBS0,x
6209: jsr L9FB6
6210: cmp #$02
6211: bcs LA470
6212: ldy #$03
6213: LA42D:
6214: lda #$01
6215: sta TRACK3
6216: lda #$00
6217: sta SECTOR3
6218: lda #$80
6219: sta JOBS0,x
6220: jsr L9FB6
6221: cmp #$02
6222: bcc LA445
6223: dey
6224: bpl LA42D
6225: bcs LA470
6226: LA445:
6227: .if CompileDrive >= DRIVE_1571
6228: lda #$01
6229: .else
6230: rts
6231: nop
6232: .endif
6233: sta L01B2
6234: lda #$F0
6235: sta HINIB
6236: sta JOBS0,x
6237: jsr L9FB6
6238: cmp #$02
6239: bcs LA470
6240: ldy #$03
6241: LA459:
6242: lda #$24
6243: sta TRACK3
6244: lda #$00
6245: sta SECTOR3
6246: lda #$80
6247: sta JOBS0,x
6248: jsr L9FB6
6249: cmp #$02
6250: bcs LA46D
6251: rts
6252: LA46D:
6253: dey
6254: bpl LA459
6255: LA470:
6256: ldx #$00
6257: bit JOBRTN
6258: stx JOBRTN
6259: bpl LA47B
6260: rts
6261: LA47B:
6262: jmp LE60A
6263: LA47E:
6264: txa
6265: ldx #$05
6266: bne LA486
6267: LA483:
6268: txa
6269: ldx #$0D
6270: LA486:
6271: dex
6272: bne LA486
6273: tax
6274: rts
6275: LA48B:
6276: lda BMPNT
6277: sta TMP1570
6278: lda BMPNT + 1
6279: sta TMP1570 + 1
6280: rts
6281:
6282: LA496:
6283: lda TMP1570
6284: sta BMPNT
6285: lda TMP1570 + 1
6286: sta BMPNT + 1
6287: rts
6288:
6289:
6290: LA4A1:
6291: ldx DRVNUM
6292:
6293: lda a:NODRV,x
6294: beq LA4AD
6295: lda #ERRORCODE_74_DRIVE_NOT_READY
6296: .if CompileDrive >= DRIVE_1571_05
6297: jsr LE645
6298: .else
6299: jsr LE648
6300: .endif
6301: LA4AD:
6302: jsr LF119
6303: jsr LF0DF
6304: .if CompileDrive >= DRIVE_1571_05
6305: jmp LA4C2
6306: .else
6307: lda WBAM
6308: .endif
6309: beq LA4BF
6310: ora #$80
6311: sta WBAM
6312: bne LA4C2
6313: LA4BF:
6314: jsr LA58D
6315: LA4C2:
6316: jsr LA48B
6317: jsr LA534
6318: lda TRACK
6319: sec
6320: sbc #$24
6321: tay
6322: lda (BMPNT),y
6323: pha
6324: jsr LA496
6325: pla
6326: rts
6327: .if CompileDrive >= DRIVE_1571_05
6328: .byte "DAVID G. SIRACUSA"
6329: .elseif CompileDrive >= DRIVE_1571
6330: .else
6331: FillUntil $A4DD
6332: .byte "STEVE LAM",$0D
6333: .endif
6334:
6335: FillUntil $A4E7
6336:
6337: LA4E7:
6338: lda TRACK
6339: sec
6340: sbc #$24
6341: tay
6342: lda SECTOR
6343: lsr a
6344: lsr a
6345: lsr a
6346: clc
6347: adc LA5DB,y
6348: tay
6349: lda SECTOR
6350: and #$07
6351: tax
6352: lda L0146,y
6353: and LEFE9,x
6354: php
6355: lda L0146,y
6356: plp
6357: rts
6358: LA508:
6359: jsr LA48B
6360: jsr LA534
6361: lda TRACK
6362: sec
6363: sbc #$24
6364: tay
6365: clc
6366: lda (BMPNT),y
6367: adc #$01
6368: sta (BMPNT),y
6369: jmp LA496
6370: LA51E:
6371: jsr LA48B
6372: jsr LA534
6373: lda TRACK
6374: sec
6375: sbc #$24
6376: tay
6377: sec
6378: lda (BMPNT),y
6379: sbc #$01
6380: sta (BMPNT),y
6381: jmp LA496
6382: LA534:
6383: ldx #$0D
6384: lda BUF0,x
6385: and #$0F
6386: tax
6387: lda TableHighBytesOfBuffers,x
6388: sta BMPNT + 1
6389: lda #$DD
6390: sta BMPNT
6391: rts
6392: LA545:
6393: lda T0
6394: pha
6395: .if CompileDrive >= DRIVE_1571_05 .AND CompileDrive < DRIVE_1571CR
6396: jsr LAB8D
6397: .endif
6398: lda TRACK
6399: sec
6400: sbc #$24
6401: tay
6402: pha
6403: .if CompileDrive >= DRIVE_1571_05 .AND CompileDrive < DRIVE_1571CR
6404: .else
6405: jsr LA48B
6406: .endif
6407: jsr LA534
6408: lda (BMPNT),y
6409: pha
6410: lda #$00
6411: sta T0
6412: lda #$01
6413: sta BMPNT + 1
6414: lda LA5DB,y
6415: clc
6416: adc #$46
6417: sta BMPNT
6418: ldy #$02
6419: LA56A:
6420: ldx #$07
6421: LA56C:
6422: lda (BMPNT),y
6423: and LEFE9,x
6424: beq LA575
6425: inc T0
6426: LA575:
6427: dex
6428: bpl LA56C
6429: dey
6430: bpl LA56A
6431: pla
6432: cmp T0
6433: beq LA585
6434: lda #ERRORCODE_71_DIR_ERROR
6435: jsr LE645
6436: LA585:
6437: pla
6438: tay
6439: pla
6440: sta T0
6441: jmp LA496
6442: LA58D:
6443: lda VBC_PAUNBUF1
6444: and #VBC_PA1_20
6445: bne LA597
6446: LA594:
6447: jmp LD58A
6448: LA597:
6449: lda MAXTRACK_ADJUSTED
6450: cmp #MAXTRACK_SINGLESIDED + 2
6451: bcc LA594
6452: ldx JOBNUM
6453: lda LSTJOB,x
6454: pha
6455: jsr LD58A
6456: jsr LA48B
6457: jsr LEF3A
6458: jsr LF008
6459: lda JOBNUM
6460: asl a
6461: tax
6462: lda #$35
6463: sta TRACK0,x
6464: ldy #$68
6465: LA5BA:
6466: lda L0146,y
6467: sta (BMPNT),y
6468: dey
6469: bpl LA5BA
6470: jsr LA496
6471: jsr LD58A
6472: lda JOBNUM
6473: asl a
6474: tax
6475: lda LFE85
6476: sta TRACK0,x
6477: jsr LD586
6478: pla
6479: ldx JOBNUM
6480: sta LSTJOB,x
6481: rts
6482: LA5DB:
6483: .byte $00,$03,$06,$09,$0C,$0F,$12,$15
6484: .byte $18,$1B,$1E,$21,$24,$27,$2A,$2D
6485: .byte $30,$33,$36,$39,$3C,$3F,$42,$45
6486: .byte $48,$4B,$4E,$51,$54,$57,$5A,$5D
6487: .byte $60,$63,$66
6488: LA5FE:
6489: lda VBC_PAUNBUF1
6490: and #VBC_PA1_20
6491: beq LA614
6492: ldy #$00
6493: ldx #$00
6494: lda #$01
6495: sta FILTBL
6496: jsr LC312
6497: jmp LE7A8
6498: LA614:
6499: lda #$8D
6500: jsr SearchInCmdline
6501: jmp LE7A8
6502:
6503: Patch1570CallToParseCommandBufferAndExecuteCommand:
6504: jsr ParseCommandBufferAndExecuteCommand
6505: jsr L81B2
6506: lda BITCNT
6507: and #$7F
6508: sta BITCNT
6509: jmp END_Patch1570CallToParseCommandBufferAndExecuteCommand
6510:
6511:
6512: LA62B:
6513: lda #$FF
6514: sta ACLTIM
6515: lda #$06
6516: sta GCRERR
6517: rts
6518: LA634:
6519: bne LA63D
6520: lda CNTMOTOR1570
6521: bne LA64B
6522: beq LA657
6523: LA63D:
6524: lda #$FF
6525: sta CNTMOTOR1570
6526: jsr L8764
6527: SET_WPSW_DIRTY
6528: bne LA657
6529: LA64B:
6530: dec CNTMOTOR1570
6531: bne LA657
6532: lda DRVST
6533: bne LA657
6534: jsr L8770
6535: LA657:
6536: jmp LF9B1
6537:
6538: PATCH_INIT_BC_1570:
6539: lda #VBC_PB1_1540_DATAOUT
6540: sta VBC_PB1
6541: lda #VBC_PA1_20
6542: sta VBC_PA1
6543: .if CompileDrive >= DRIVE_1571CR
6544: jmp PATCH_INIT_CSG5710
6545: .else
6546: jmp PATCH_INIT_BC_1570_END
6547: .endif
6548:
6549:
6550: LA667:
6551: lda VBC_PAUNBUF1
6552: and #VBC_PA1_20
6553: bne LA671
6554: LA66E:
6555: jmp LD586
6556:
6557:
6558: LA671:
6559: lda MAXTRACK_ADJUSTED
6560: cmp #MAXTRACK_SINGLESIDED + 2
6561: bcc LA66E
6562: jsr LA48B
6563: lda #$00
6564: sta BMPNT
6565: ldx JOBNUM
6566: lda TableHighBytesOfBuffers,x
6567: sta BMPNT + 1
6568: lda #$FF
6569: .if CompileDrive >= DRIVE_1571_05
6570: jmp PATCH_LAB72
6571: PATCH_LAB72_END:
6572:
6573: .else
6574: sta JOBRTN
6575: .endif
6576: lda JOBNUM
6577: asl a
6578: tax
6579: lda #$35
6580: sta TRACK0,x
6581: jsr LD586
6582: cmp #$02
6583: ror a
6584: and #$80
6585: eor #$80
6586: sta L01AF
6587: bpl LA6AC
6588: ldy #$68
6589: LA6A4:
6590: lda (BMPNT),y
6591: sta L0146,y
6592: dey
6593: bpl LA6A4
6594: LA6AC:
6595: lda #$FF
6596: sta JOBRTN
6597:
6598: LA6B1:
6599: lda JOBNUM
6600: asl a
6601: tax
6602: lda LFE85
6603: sta TRACK0,x
6604: jsr LD586
6605: cmp #$02
6606: bcc LA6D1
6607: tax
6608: lda #MAXTRACK_SINGLESIDED + 1
6609: sta MAXTRACK_ADJUSTED
6610: jsr LA496
6611: txa
6612: jsr LE60A
6613: jmp LD644
6614: LA6D1:
6615: ldy #$03
6616: lda (BMPNT),y
6617: and L01AF
6618: bmi LA6DD
6619: lda #$24
6620: .byte ASM_BIT3
6621: LA6DD:
6622: lda #MAXTRACK_DOUBLESIDED + 1
6623: sta MAXTRACK_ADJUSTED
6624:
6625: .if CompileDrive >= DRIVE_1571_05 .AND CompileDrive < DRIVE_1571CR
6626: jmp LAB24
6627: .else
6628: jmp LA496
6629: .endif
6630: LA6E5:
6631: jsr LD58C
6632: pha
6633: cmp #$02
6634: bcs LA736
6635: lda VBC_PAUNBUF1
6636: and #VBC_PA1_20
6637: beq LA736
6638: lda #MAXTRACK_DOUBLESIDED + 1
6639: sta MAXTRACK_ADJUSTED
6640: lda #$FF
6641: sta JOBRTN
6642: lda HEADER
6643: pha
6644: lda HEADER + 1
6645: pha
6646: lda JOBNUM
6647: asl a
6648: tax
6649: lda #$35
6650: sta TRACK0,x
6651: lda #$B0
6652: .if CompileDrive >= DRIVE_1571_05
6653: jsr LAADE
6654: .else
6655: jsr LD58C
6656: .endif
6657: cmp #$02
6658: pla
6659: tay
6660: pla
6661: tax
6662: bcs LA724
6663: cpx HEADER
6664: bne LA724
6665: cpy HEADER + 1
6666: bne LA724
6667: lda #$47
6668: .byte ASM_BIT3
6669: LA724:
6670: lda #MAXTRACK_SINGLESIDED + 1
6671: sta MAXTRACK_ADJUSTED
6672: sty HEADER + 1
6673: stx HEADER
6674: lda JOBNUM
6675: asl a
6676: tax
6677: lda LFE85
6678: sta TRACK0,x
6679: LA736:
6680: pla
6681: rts
6682: LA738:
6683: jsr LEF3A
6684: lda VBC_PAUNBUF1
6685: and #VBC_PA1_20
6686: beq LA74C
6687: lda #$00
6688: ldy #$68
6689: LA746:
6690: sta L0146,y
6691: dey
6692: bpl LA746
6693: LA74C:
6694: jmp LF008
6695: LA74F:
6696: pha
6697: lda VBC_PAUNBUF1
6698: and #VBC_PA1_20
6699: beq LA75F
6700: pla
6701: cmp #$24
6702: bcc LA760
6703: sbc #$23
6704: .byte ASM_BIT2
6705: LA75F:
6706: pla
6707: LA760:
6708: ldx LFED6
6709: rts
6710:
6711: LA764:
6712: jsr LF005
6713: lda VBC_PAUNBUF1
6714: and #VBC_PA1_20
6715: bne LA771
6716: lda #$24
6717: .byte ASM_BIT3
6718: LA771:
6719: lda #MAXTRACK_DOUBLESIDED + 1
6720: sta MAXTRACK_ADJUSTED
6721:
6722: jmp LEE43
6723: LA779:
6724: lda VBC_PAUNBUF1
6725: and #VBC_PA1_20
6726: bne LA783
6727: jmp LC8C6
6728: LA783:
6729: jmp LA40D
6730:
6731: LA786:
6732: lda VBC_PA1
6733: and # ~ VBC_PA1_20
6734: sta VBC_PA1
6735:
6736: jsr LA483
6737:
6738:
6739:
6740: lda #CIA_ICR_BW_UNSET | ~ CIA_ICR_BW_SET
6741: sta CIA_ICR
6742:
6743: .if CompileDrive >= DRIVE_1571CR
6744: .else
6745: lda #CIA_CRA_B_ONESHOT
6746: sta CIA_CRA
6747:
6748: sta CIA_CRB
6749: lda #>$0006
6750: sta CIA_TAHI
6751: lda #<$0006
6752: sta CIA_TALO
6753:
6754: lda #CIA_CRA_B_START
6755: sta CIA_CRA
6756: .endif
6757:
6758: jsr L81B2
6759: jmp TestATN
6760:
6761: FillUntil $A7B3
6762:
6763: ProcessBus1570:
6764: .if CompileDrive = DRIVE_1571_03
6765: lda VBC_PAUNBUF1
6766: .else
6767: jsr LAA62
6768: .endif
6769: and #VBC_PA1_20
6770: beq LA7BD
6771: jmp L80CE
6772: LA7BD:
6773: jmp ProcessBus
6774:
6775: PATCH_ShortReset:
6776:
6777: sei
6778:
6779: ldx #<SP_END
6780: txs
6781:
6782: jmp PATCH_ShortReset_END
6783:
6784: LA7C7:
6785: .if CompileDrive >= DRIVE_1571
6786: lda VBC_PAUNBUF1
6787: .else
6788: jmp LA7CE
6789: .endif
6790: and #VBC_PA1_20
6791: LA7CC:
6792: bne LA7D7
6793: LA7CE:
6794: ldy #$03
6795: lda #$00
6796: sta (BMPNT),y
6797: jmp LEEB7
6798: LA7D7:
6799: lda MAXTRACK_ADJUSTED
6800: cmp #MAXTRACK_SINGLESIDED + 2
6801: bcc LA7CE
6802: ldy #$01
6803: ldx #$00
6804: LA7E2:
6805: cpy #$12
6806: beq LA81A
6807: txa
6808: pha
6809: lda #$00
6810: sta T0
6811: sta T1
6812: sta T2
6813: lda L9409 + 34,y
6814: tax
6815: LA7F4:
6816: sec
6817: rol T0
6818: rol T1
6819: rol T2
6820: dex
6821: bne LA7F4
6822: pla
6823: tax
6824: lda T0
6825: sta L0146,x
6826: lda T1
6827: sta L0147,x
6828: lda T2
6829: sta L0148,x
6830: inx
6831: inx
6832: inx
6833: cpx #$33
6834: bne LA81A
6835: inx
6836: inx
6837: inx
6838: iny
6839: LA81A:
6840: iny
6841: cpy #$24
6842: bcc LA7E2
6843: jsr LEEB7
6844: ldy #$03
6845: lda #$80
6846: sta (BMPNT),y
6847: ldy #$FF
6848: ldx #$22
6849: LA82C:
6850: lda L942C,x
6851: sta (BMPNT),y
6852: dey
6853: dex
6854: bpl LA82C
6855: ldy #$EE
6856: lda #$00
6857: sta (BMPNT),y
6858: jmp LD075
6859: LA83E:
6860: lda VBC_PAUNBUF1
6861: and #VBC_PA1_20
6862: bne LA84B
6863: LA845:
6864: jsr LEFCF
6865: jmp LEF62
6866: LA84B:
6867: lda TRACK
6868: cmp #$24
6869: bcc LA845
6870: jsr LA4A1
6871: jsr LA4E7
6872: bne LA872
6873: ora LEFE9,x
6874: sta L0146,y
6875: jsr LEF88
6876: jsr LA508
6877: lda TRACK
6878: cmp #$35
6879: beq LA873
6880: lda DRVNUM
6881: asl a
6882: tax
6883: jmp LEF7F
6884: LA872:
6885: sec
6886: LA873:
6887: rts
6888: LA874:
6889: lda VBC_PAUNBUF1
6890: and #VBC_PA1_20
6891: bne LA881
6892: LA87B:
6893: jsr LEFCF
6894: jmp LEF96
6895: LA881:
6896: lda TRACK
6897: cmp #$24
6898: bcc LA87B
6899: jsr LA4A1
6900: jsr LA4E7
6901: beq LA8A8
6902: eor LEFE9,x
6903: sta L0146,y
6904: jsr LEF88
6905: jsr LA51E
6906: lda TRACK
6907: cmp #$35
6908: beq LA8A8
6909: lda DRVNUM
6910: asl a
6911: tax
6912: jmp LEFB2
6913: LA8A8:
6914: rts
6915: LA8A9:
6916: lda VBC_PAUNBUF1
6917: and #VBC_PA1_20
6918: bne LA8B6
6919: LA8B0:
6920: jsr LF011
6921: jmp LF1FD
6922: LA8B6:
6923: lda TRACK
6924: cmp #$24
6925: bcc LA8B0
6926: jsr LA4A1
6927: jsr LA545
6928: lda L942C,y
6929: sta LSTSEC
6930: LA8C8:
6931: lda SECTOR
6932: cmp LSTSEC
6933: bcs LA8D8
6934: jsr LA4E7
6935: bne LA8DA
6936: inc SECTOR
6937: bne LA8C8
6938: LA8D8:
6939: lda #$00
6940: LA8DA:
6941: rts
6942: LA8DB:
6943: lda VBC_PAUNBUF1
6944: and #VBC_PA1_20
6945: bne LA8E8
6946: LA8E2:
6947: lda T0
6948: pha
6949: jmp LF130
6950: LA8E8:
6951: lda TRACK
6952: cmp #$24
6953: bcc LA8E2
6954: cmp #$35
6955: beq LA900
6956: lda T0
6957: pha
6958: jsr LA4A1
6959: tay
6960: pla
6961: sta T0
6962: tya
6963: jmp LF138
6964: LA900:
6965: lda #$00
6966: jmp LF138
6967: LA905:
6968: lda VBC_PAUNBUF1
6969: and #VBC_PA1_20
6970: bne LA912
6971: LA90C:
6972: jsr LF011
6973: jmp LF1C7
6974: LA912:
6975: lda TRACK
6976: cmp #$24
6977: bcc LA90C
6978: jsr LA4A1
6979: jmp LF1C9
6980: LA91E:
6981: lda VBC_PAUNBUF1
6982: and #VBC_PA1_20
6983: bne LA92B
6984: LA925:
6985: jsr LF011
6986: jmp LF1E2
6987: LA92B:
6988: lda TRACK
6989: cmp #$24
6990: bcc LA925
6991: jsr LA4A1
6992: jmp LF1E4
6993: LA937:
6994: lda VBC_PAUNBUF1
6995: and #VBC_PA1_20
6996: bne LA941
6997: LA93E:
6998: jmp LF220
6999: LA941:
7000: lda MAXTRACK_ADJUSTED
7001: cmp #MAXTRACK_SINGLESIDED + 2
7002: bcc LA93E
7003: lda TRACK
7004: cmp #$24
7005: bcc LA93E
7006: jmp LA545
7007: LA951:
7008: sta NDBL,x
7009: lda VBC_PAUNBUF1
7010: and #VBC_PA1_20
7011: beq LA97E
7012: lda MAXTRACK_ADJUSTED
7013: cmp #MAXTRACK_SINGLESIDED + 2
7014: bcc LA97E
7015: jsr LA48B
7016: jsr LA534
7017: ldy #$22
7018: lda NDBL
7019: LA96D:
7020: clc
7021: adc (BMPNT),y
7022: sta NDBL
7023: bcc LA978
7024: inc NDBH
7025: LA978:
7026: dey
7027: bpl LA96D
7028: jmp LA496
7029: LA97E:
7030: rts
7031: LA97F:
7032: sta RECL,x
7033: sta RECH,x
7034: lda #$00
7035: sta LSTCHR,x
7036: rts
7037: LA989:
7038: jsr LA40D
7039: ldy #$00
7040: sty JOBRTN
7041: rts
7042:
7043: emptya992:
7044: FillUntil $A99D
7045:
7046: LA99D:
7047: lda #$00
7048: sta a:NODRV,x
7049: jmp LC1B7
7050: LA9A5:
7051: tya
7052: sta a:NODRV,x
7053: jmp LC664
7054: LA9AC:
7055: lda VBC_PAUNBUF1
7056: and #VBC_PA1_20
7057: beq LA9B6
7058: jmp L815A
7059: LA9B6:
7060: jmp LE8D7
7061: LA9B9:
7062: pha
7063: stx JOBNUM
7064: lda VBC_PAUNBUF1
7065: and #VBC_PA1_20
7066: beq LA9D2
7067: bit BITCNT
7068: bpl LA9D2
7069: lda BITCNT
7070: and #$7F
7071: sta BITCNT
7072: pla
7073: tax
7074: jmp L9199
7075: LA9D2:
7076: jmp LE60D
7077:
7078: LA9D5:
7079: pha
7080: lda VBC_PAUNBUF1
7081: and #VBC_PA1_20
7082: beq @LA9F4
7083: bit BITCNT
7084: bpl @LA9F4
7085: lda BITCNT
7086: and #$7F
7087: sta BITCNT
7088: sei
7089: ldx #$02
7090: jsr L9228
7091: lda #$00
7092: sta SA
7093: jsr LDAC0
7094: @LA9F4:
7095: pla
7096: jmp LE645
7097: LA9F8:
7098: lda #$00
7099: sta DRVST
7100: lda VDC_PCR2
7101: jmp LF266
7102:
7103: READ_CMDBUF_BUT_SPECIAL_CASE_U0:
7104:
7105: lda CMDBUF
7106: cmp #'U'
7107: bne @NoU0
7108: lda CMDBUF + 1
7109: cmp #'0'
7110: beq @ReturnAsc_NUL
7111: @NoU0:
7112:
7113: lda CMDBUF,y
7114:
7115: .byte ASM_BIT3
7116:
7117: @ReturnAsc_NUL:
7118: lda #$00
7119: rts
7120:
7121: LAA17:
7122: ldx DRVNUM
7123: lda a:NODRV,x
7124: rts
7125: LAA1D:
7126: sta WPSW,x
7127: sta a:NODRV,x
7128: jmp LD075
7129: LAA25:
7130: ldx DRVNUM
7131: lda a:NODRV,x
7132: jmp LF01B
7133:
7134:
7135:
7136:
7137:
7138:
7139:
7140:
7141:
7142:
7143: Patch1570ExecutionOfUCommand:
7144:
7145:
7146:
7147: lda IP
7148: cmp #<IRQ
7149: bne @NoIRQVector
7150: lda IP + 1
7151: cmp #>IRQ
7152: bne @NoIRQVector
7153:
7154:
7155:
7156: brk
7157: nop
7158:
7159: rts
7160:
7161: @NoIRQVector:
7162: jmp (IP)
7163:
7164:
7165: .if CompileDrive >= DRIVE_1571_05
7166: LAA3F:
7167: cmp #$02
7168: bcc LAA4A
7169: cmp #$0F
7170: beq LAA4A
7171: jmp LD36B
7172: LAA4A:
7173: jmp LD373
7174: LAA4D:
7175: sta FTNUM
7176: jsr L877C
7177: jsr LA989
7178: pha
7179: jsr L8788
7180: pla
7181: rts
7182: LAA5B:
7183: lda PATTYP
7184: and #$07
7185: cmp #$02
7186: rts
7187: LAA62:
7188: lda VBC_PAUNBUF1
7189: bit VBC_PA1
7190: rts
7191: LAA69:
7192: lda VBC_PAUNBUF1
7193: and #VBC_PA1_20
7194: bne LAA73
7195: jmp LEEB7
7196: LAA73:
7197: jmp LA7CC
7198: LAA76:
7199: lda #$02
7200: sta VBC_T1HC1
7201: rts
7202:
7203: PATCH_INIT_CSG5710:
7204: .if CompileDrive >= DRIVE_1571CR
7205: lda #$FB
7206: sta CSG5710_4010 + 4
7207: lda #$FE
7208: sta CSG5710_4010 + 5
7209: lda #$A1
7210: sta CSG5710_4010 + 0
7211: lda #$C2
7212: sta CSG5710_4010 + 1
7213: lda #$0A
7214: sta CSG5710_4010 + 6
7215: lda #$14
7216: sta CSG5710_4010 + 7
7217: lda #$02
7218: sta CSG5710_4010 + 2
7219: lda #$03
7220: sta CSG5710_4010 + 3
7221: lda #$40
7222: sta L01B4
7223: jmp PATCH_INIT_BC_1570_END
7224: LAAAD:
7225: lda L01B3
7226: bne LAAB6
7227: .else
7228: lda L01B3
7229: bne LAA84
7230: jmp L8EC6
7231: LAA84:
7232: clc
7233: rts
7234:
7235: LAA86:
7236: tay
7237: cmp #$56
7238: bne LAAA8
7239: sei
7240: lda VBC_PAUNBUF1
7241: and #VBC_PA1_20
7242: bne LAA96
7243: LAA93:
7244: jmp L9021
7245: LAA96:
7246: lda CMDBUF + 4
7247: cmp #$31
7248: beq LAAA1
7249: cmp #$30
7250: bne LAA93
7251: LAAA1:
7252: and #$CF
7253: sta L01B3
7254: cli
7255: rts
7256: LAAA8:
7257: cpy #$04
7258: jmp L9006
7259: LAAAD:
7260: lda L01B3
7261: bne LAAB6
7262: .endif
7263: lda JOBS0,y
7264: .byte ASM_BIT3
7265: LAAB6:
7266: lda #$30
7267: eor #$30
7268: sta JOBS0,y
7269: bne LAAC2
7270: jmp L99B5
7271: LAAC2:
7272: jmp L944F
7273: LAAC5:
7274: jsr L85F9
7275: lda #$20
7276: bit HINIB
7277: beq LAADD
7278: ldy #$00
7279: LAAD0:
7280: lda CMDBUF + 11,y
7281: sta CTRACK
7282: jsr L85F9
7283: iny
7284: cpy MYPA
7285: bne LAAD0
7286: LAADD:
7287: rts
7288: LAADE:
7289: ldx JOBNUM
7290: ora #$08
7291: sta JOBS0,x
7292: jmp L9FB6
7293: LAAE7:
7294: jsr LAAED
7295: jmp CommandEnd
7296: LAAED:
7297: jmp (IP)
7298: LAAF0:
7299: cmp #$03
7300: bcs LAAF9
7301: lda #ERRORCODE_72_DISK_FULL
7302: jsr SetErrorCode
7303: LAAF9:
7304: lda #$01
7305: rts
7306: Convert_Bin_To_BCD_Patch_157x:
7307: php
7308: sei
7309:
7310: CONVERT_BIN_TO_BCD
7311:
7312: plp
7313: jmp OutputBCDIntoBUFTABERR
7314:
7315: LAB10:
7316: php
7317: sei
7318: sta CIA_SDR
7319: lda BITCNT
7320: eor #$04
7321: sta BITCNT
7322: lda #CIA_ICR_B_SP
7323: LAB1D:
7324: bit CIA_ICR
7325: beq LAB1D
7326: plp
7327: rts
7328:
7329: LAB24:
7330: lda BAM + 11
7331: cmp #$25
7332: bcc LAB6F
7333: lda T0
7334: pha
7335: lda TRACK
7336: pha
7337: ldy #$00
7338: sty TRACK
7339: LAB35:
7340: lda #$00
7341: sta T0
7342: lda #$01
7343: sta BMPNT + 1
7344: lda LA5DB,y
7345: clc
7346: adc #$46
7347: sta BMPNT
7348: ldy #$02
7349: LAB47:
7350: ldx #$07
7351: LAB49:
7352: lda (BMPNT),y
7353: and LEFE9,x
7354: beq LAB52
7355: inc T0
7356: LAB52:
7357: dex
7358: bpl LAB49
7359: dey
7360: bpl LAB47
7361: jsr LA534
7362: lda T0
7363: ldy TRACK
7364: sta (BMPNT),y
7365: inc TRACK
7366: ldy TRACK
7367: cpy #$23
7368: bcc LAB35
7369: pla
7370: sta TRACK
7371: pla
7372: sta T0
7373: LAB6F:
7374: jmp LA496
7375:
7376:
7377: PATCH_LAB72:
7378: sta JOBRTN
7379: pha
7380: lda L01B6
7381: beq LAB84
7382: lda #$00
7383: sta L01B6
7384: pla
7385: jmp PATCH_LAB72_END
7386:
7387:
7388: LAB84:
7389: lda #$80
7390: sta L01AF
7391: pla
7392: jmp LA6B1
7393:
7394:
7395: LAB8D:
7396: jsr LA48B
7397: jsr LAB24
7398: jmp LA48B
7399:
7400: PATCH_WPSW:
7401: lda #$01
7402: sta WPSW
7403: sta L01B6
7404: rts
7405:
7406: .if CompileDrive >= DRIVE_1571CR
7407: .else
7408: LA667_PATCH:
7409: lda #$01
7410: sta L01B6
7411: jmp LA667
7412:
7413: .endif
7414:
7415: LABA6:
7416: lda #$01
7417: sta WPSW
7418: sta L01B6
7419: jmp LD042
7420:
7421: .if CompileDrive >= DRIVE_1571CR
7422:
7423: LABA7:
7424: tay
7425: cmp #$56
7426: bne LABDF
7427: sei
7428: lda VBC_PAUNBUF1
7429: and #VBC_PA1_20
7430: bne LABB7
7431: LABB4:
7432: jmp L9021
7433: LABB7:
7434: lda CMDBUF + 4
7435: cmp #$31
7436: beq LABC2
7437: cmp #$30
7438: bne LABB4
7439: LABC2:
7440: and #$CF
7441: sta L01B3
7442: pha
7443: lda L01B4
7444: and #$BF
7445: sta L01B4
7446: pla
7447: asl a
7448: asl a
7449: asl a
7450: asl a
7451: asl a
7452: asl a
7453: ora L01B4
7454: sta L01B4
7455: cli
7456: rts
7457: LABDF:
7458: cpy #$04
7459: jmp L9006
7460:
7461: LA667_PATCH:
7462: lda #$01
7463: sta L01B6
7464: jmp LA667
7465:
7466:
7467: LABEC:
7468: lda #$5A
7469: LABEE:
7470: pha
7471: jsr LAC38
7472: pla
7473: tay
7474: bcs LAC02
7475: lda WD177x_SECTOR
7476: cmp CSG5710_4010 + 5
7477: beq LAC0C
7478: dey
7479: tya
7480: bne LABEE
7481: LAC02:
7482: ldx #$03
7483: .byte ASM_BIT3
7484: LAC05:
7485: ldx #$09
7486: stx L01B0
7487: sec
7488: rts
7489: LAC0C:
7490: ldx #$00
7491: LAC0E:
7492: bit WD177x_TRACK
7493: bpl LAC0E
7494: lda WD177x_SECTOR
7495: sta STAB,x
7496: inx
7497: cpx #$06
7498: bcc LAC0E
7499: lda #$18
7500: sta WD177x_TRACK
7501: LAC22:
7502: bit WD177x_TRACK
7503: bpl LAC22
7504: lda WD177x_SECTOR
7505: lda WD177x_TRACK
7506: and #$20
7507: bne LAC05
7508: ldx #$00
7509: stx L01B0
7510: clc
7511: rts
7512: LAC38:
7513: lda CSG5710_5
7514: and #$7F
7515: sta CSG5710_5
7516: lda L01B4
7517: and #$20
7518: asl a
7519: asl a
7520: ora CSG5710_5
7521: sta CSG5710_5
7522: lda #$00
7523: sta WD177x_TRACK
7524: lda CSG5710_4010 + 0
7525: sta CSG5710_4
7526: lda CSG5710_4010 + 6
7527: sta WD177x_DATA
7528: lda #$10
7529: sta WD177x_TRACK
7530: lda WD177x_SECTOR
7531: nop
7532: nop
7533: nop
7534: ldx #$00
7535: ldy #$32
7536: LAC6D:
7537: bit WD177x_TRACK
7538: bvs LAC7A
7539: dex
7540: bne LAC6D
7541: dey
7542: bne LAC6D
7543: sec
7544: rts
7545: LAC7A:
7546: ldy #$00
7547: nop
7548: nop
7549: nop
7550: nop
7551: nop
7552: nop
7553: lda WD177x_SECTOR
7554: nop
7555: nop
7556: nop
7557: nop
7558: nop
7559: nop
7560: LAC8B:
7561: bit WD177x_TRACK
7562: bpl LAC8B
7563: lda WD177x_SECTOR
7564: iny
7565: bvs LAC8B
7566: cpy #$03
7567: bne LAC38
7568: clc
7569: rts
7570: LAC9C:
7571: lda #$B4
7572: LAC9E:
7573: pha
7574: jsr LABEC
7575: pla
7576: tay
7577: php
7578: lda STAB + 2
7579: cmp SECTR
7580: beq LACB7
7581: plp
7582: dey
7583: tya
7584: bne LAC9E
7585: ldx #$02
7586: stx L01B0
7587: sec
7588: rts
7589: LACB7:
7590: plp
7591: rts
7592: LACB9:
7593: ldx #$16
7594: LACBB:
7595: bit WD177x_TRACK
7596: bpl LACBB
7597: lda WD177x_SECTOR
7598: dex
7599: bne LACBB
7600: rts
7601: LACC7:
7602: lda REVCNT
7603: asl a
7604: sta TMP
7605: LACCC:
7606: jsr L8EC6
7607: jsr LAC9C
7608: bcs LAD21
7609: jsr LAC38
7610: bcs LAD21
7611: ldy #$00
7612: ldx WORK
7613: LACDD:
7614: bit WD177x_TRACK
7615: bpl LACDD
7616: lda WD177x_SECTOR
7617: cmp (BUFPNT),y
7618: bne LAD21
7619: cpy RLINDX
7620: beq LACF1
7621: iny
7622: bne LACDD
7623: LACF1:
7624: iny
7625: dex
7626: beq LACFA
7627: inc BUFPNT + 1
7628: jmp LACDD
7629: LACFA:
7630: bit WD177x_TRACK
7631: bpl LACFA
7632: lda WD177x_SECTOR
7633: LAD02:
7634: bit WD177x_TRACK
7635: bpl LAD02
7636: lda WD177x_SECTOR
7637: lda #$18
7638: sta WD177x_TRACK
7639: LAD0F:
7640: bit WD177x_TRACK
7641: bpl LAD0F
7642: lda WD177x_SECTOR
7643: lda WD177x_TRACK
7644: and #$20
7645: beq LAD28
7646: ldx #$05
7647: .byte ASM_BIT3
7648: LAD21:
7649: ldx #$07
7650: dec TMP
7651: bne LACCC
7652: .byte ASM_BIT3
7653: LAD28:
7654: ldx #$00
7655: stx L01B0
7656: rts
7657: LAD2E:
7658: lda REVCNT
7659: asl a
7660: sta TMP
7661: LAD33:
7662: jsr LAC9C
7663: bcs LAD86
7664: jsr LAC38
7665: bcs LAD86
7666: ldy #$00
7667: ldx WORK
7668: LAD41:
7669: bit WD177x_TRACK
7670: bpl LAD41
7671: lda WD177x_SECTOR
7672: cmp CMDBUF + 10
7673: bne LAD86
7674: cpy RLINDX
7675: beq LAD56
7676: iny
7677: bne LAD41
7678: LAD56:
7679: iny
7680: dex
7681: beq LAD5F
7682: inc BUFPNT + 1
7683: jmp LAD41
7684: LAD5F:
7685: bit WD177x_TRACK
7686: bpl LAD5F
7687: lda WD177x_SECTOR
7688: LAD67:
7689: bit WD177x_TRACK
7690: bpl LAD67
7691: lda WD177x_SECTOR
7692: lda #$18
7693: sta WD177x_TRACK
7694: LAD74:
7695: bit WD177x_TRACK
7696: bpl LAD74
7697: lda WD177x_SECTOR
7698: lda WD177x_TRACK
7699: and #$20
7700: beq LAD8D
7701: ldx #$05
7702: .byte ASM_BIT3
7703: LAD86:
7704: ldx #$07
7705: dec TMP
7706: bne LAD33
7707: .byte ASM_BIT3
7708: LAD8D:
7709: ldx #$00
7710: stx L01B0
7711: rts
7712: LAD93:
7713: php
7714: sei
7715: jsr L89EF
7716: bit HINIB
7717: bpl LADA4
7718: lda CMDBUF + 3
7719: sta NMIFLG
7720: jsr L87BA
7721: LADA4:
7722: lda #$00
7723: sta MYPA
7724: jsr L89E8
7725: ldx L01B0
7726: cpx #$02
7727: bcs LADD1
7728: lda STAB + 2
7729: sta ICMD
7730: LADB6:
7731: jsr L89E8
7732: lda STAB + 2
7733: ldy MYPA
7734: sta CMDBUF + 11,y
7735: inc MYPA
7736: cpy #$1F
7737: bcs LADD1
7738: cmp ICMD
7739: bne LADB6
7740: lda STAB
7741: sta NMIFLG
7742: ldx #$00
7743: .byte ASM_BIT3
7744: LADD1:
7745: ldx #$02
7746: stx L01B0
7747: plp
7748: rts
7749: .endif
7750: .elseif CompileDrive >= DRIVE_1571
7751: .else
7752: LAA3F:
7753: cmp #$02
7754: bcc LAA4A
7755: cmp #$0F
7756: beq LAA4A
7757: jmp LD36B
7758: LAA4A:
7759: jmp LD373
7760: LAA4D:
7761: sta FTNUM
7762: jsr L877C
7763: jsr LA989
7764: pha
7765: jsr L8788
7766: pla
7767: rts
7768: LAA5B:
7769: lda PATTYP
7770: and #$07
7771: cmp #$02
7772: rts
7773: LAA62:
7774: lda VBC_PAUNBUF1
7775: bit VBC_PA1
7776: rts
7777: .endif
7778:
7779: FillUntil $BF00
7780:
7781: jmp L9D88
7782: jmp L9DDE
7783: jmp LF2B0
7784: jmp L92BA
7785: jmp LF393
7786: jmp L93D1
7787: jmp LF969
7788: jmp L99B5
7789: jmp LFE00
7790: jmp LF934
7791: jmp LF556
7792: jmp L9754
7793: jmp LF8E0
7794: jmp L9965
7795: jmp LF5E9
7796: jmp LF7E6
7797: jmp L98D9
7798: jmp LA483
7799: jmp LFEF3
7800: jmp LA47E
7801: jmp LF005
7802: jmp LF0D1
7803: jmp ParseCommandBufferAndExecuteCommand
7804: jmp SearchInCmdline
7805: jmp LC2B3
7806: jmp LC2DC
7807: jmp L86E6
7808: jmp L8764
7809: jmp L8770
7810: .if CompileDrive >= DRIVE_1571_05
7811: lda L808E
7812: .else
7813: jmp L808E
7814: .endif
7815: jmp LCF1E
7816: jmp LD7B4
7817: jmp LDAC0
7818: jmp LE60A
7819: jmp L9080
7820: jmp L924E
7821: jmp LF259
7822: jmp LF99C
7823: jmp L99CA
7824:
7825:
7826:
7827:
7828: .if CompileDrive >= DRIVE_1571_05
7829: lda $FE95
7830: .else
7831: jmp $FE95
7832: .endif
7833:
7834: emptybf78:
7835:
7836: FillUntil $bf96
7837: .byte $C8,$86
7838: FillUntil $C000
7839:
7840: .else
7841: * = $C000
7842: .endif
7843:
7844: .macro WRITE_55_TIMES times
7845: lda VDC_PCR2
7846: and # ~ VIA_PCR_B_CB2_MASK
7847: ora #VIA_PCR_B_CB2_OUTPUT_LOW
7848: sta VDC_PCR2
7849:
7850: lda #$FF
7851: sta VDC_DDRA2
7852:
7853: lda #$55
7854: sta VDC_PA2
7855:
7856: ldx #>times
7857: ldy #<times
7858: :
7859: bvc :-
7860: clv
7861: dey
7862: bne :-
7863: dex
7864: bne :-
7865: .endmacro
7866:
7867: LC000:
7868: .byte DRIVE_CHKSUM_C000
7869:
7870: .if CompileDrive >= DRIVE_1571_05
7871:
7872: .byte "(C)1985 COMMODORE ELECTRONICS LTD., "
7873: .byte "ALL RIGHTS RESERVED"
7874:
7875: LC038:
7876: and # ~ VDC_PB2_STEPPER
7877: ora TMP
7878: sta VDC_PB2
7879: LC03F:
7880: lda VDC_PCR2
7881: and # ~ VIA_PCR_B_CA2_INPUT_NEG
7882: sta VDC_PCR2
7883: rts
7884:
7885: LC048:
7886: .byte $29,$1F,$19,$12
7887:
7888: LC04C:
7889: FillCount 17,$60
7890: FillCount 7,'@'
7891: .byte " "
7892: FillCount 11,0
7893:
7894: LC075:
7895: sta CMD
7896: pha
7897: lda #$01
7898: sta TRACK0,x
7899: pla
7900: rts
7901:
7902:
7903: LC07F:
7904: sei
7905: lda VDC_PCR2
7906: ora #VIA_PCR_B_CA2_OUTPUT_HIGH
7907: sta VDC_PCR2
7908: jsr L9D63
7909: jsr LFE00
7910: lda VDC_PCR2
7911: and # ~ VIA_PCR_B_CA2_OUTPUT_HIGH
7912: sta VDC_PCR2
7913: cli
7914: rts
7915:
7916: .elseif CompileDrive >= DRIVE_1541C_02 .AND CompileDrive < DRIVE_1570
7917:
7918: .byte DRIVE_CHKSUM_C001
7919:
7920: .if CompileDrive = DRIVE_1541C_03
7921: .byte "COPYRIGHT (C)1982,1985,1987 COMMODORE ELECTRONICS, LTD.",$0D
7922: .byte "ALL RIGHTS RESERVED",$0D
7923: .endif
7924:
7925: LC002:
7926: WRITE_55_TIMES $0300
7927: rts
7928:
7929:
7930:
7931: LC024:
7932: ldy LINDX
7933: .if CompileDrive >= DRIVE_1541C_03
7934: jmp LD3EE
7935: .else
7936: jmp LD3DE
7937: .endif
7938: LC029:
7939: sta RECL,x
7940: sta RECH,x
7941: lda #$00
7942: sta LSTCHR,x
7943: rts
7944: Convert_Bin_To_BCD_Patch_154x:
7945: php
7946: sei
7947:
7948: CONVERT_BIN_TO_BCD
7949:
7950: plp
7951: jmp OutputBCDIntoBUFTABERR
7952:
7953: LC047:
7954: cmp #$03
7955: bcs LC050
7956: lda #ERRORCODE_72_DISK_FULL
7957: jsr SetErrorCode
7958: LC050:
7959: lda #$01
7960: LC052:
7961: rts
7962:
7963: .if CompileDrive = DRIVE_1541C_02
7964:
7965: LC048:
7966: .byte $29,$1F,$19,$12
7967:
7968: .byte "COPYRIGHT (C)1985 COMMODORE ELECTRONICS, LTD.",$0D
7969: .byte "ALL RIGHTS RESERVED",$0D
7970: .endif
7971:
7972: .endif
7973:
7974: FillUntil $C100
7975:
7976: LC100:
7977: sei
7978: lda # ~ VDC_PB2_DRIVELEDS
7979: and VDC_PB2
7980: pha
7981: lda DRVNUM
7982: beq @IsDrive0
7983:
7984:
7985:
7986:
7987: pla
7988: ora #VDC_PB2_DRIVE1LED
7989: bne @StoreLedState
7990:
7991: @IsDrive0:
7992: pla
7993: ora #VDC_PB2_DRIVE0LED
7994: @StoreLedState:
7995: sta VDC_PB2
7996: cli
7997: rts
7998:
7999:
8000:
8001:
8002:
8003: sei
8004: lda #VDC_PB2_DRIVE0LED
8005: ora VDC_PB2
8006: sta VDC_PB2
8007: cli
8008: rts
8009:
8010:
8011: LC123:
8012: lda #ERRORCODE_00_OK
8013: sta ERWORD
8014: sta ERLED
8015: rts
8016:
8017: LC12C:
8018: sei
8019: txa
8020: pha
8021: lda #ERRORCODE_50_RECORD_NOT_PRESENT
8022: sta ERWORD
8023: ldx #$00
8024: lda DriveLEDMasks,x
8025: sta ERLED
8026: ora VDC_PB2
8027: sta VDC_PB2
8028: pla
8029: tax
8030: cli
8031: rts
8032:
8033:
8034:
8035:
8036:
8037: ParseCommandBufferAndExecuteCommand:
8038:
8039:
8040:
8041: lda #$00
8042: sta WBAM
8043: lda LSTDRV
8044: sta DRVNUM
8045:
8046: jsr SetNoError
8047:
8048:
8049:
8050:
8051: lda ORGSA
8052: bpl @IsCommand
8053:
8054:
8055:
8056:
8057: and #MASK_SA
8058: cmp #IEC_COMMAND_ERROR_CHANNEL
8059: beq @IsCommand
8060: jmp LD7B4
8061:
8062:
8063: @IsCommand:
8064: jsr LC2B3
8065:
8066:
8067:
8068: lda (BUFTABCMD),y
8069: sta CHAR
8070:
8071:
8072: ldx #CmdChars_END - CmdChars - 1
8073: @TestNextCommand:
8074: lda CmdChars,x
8075: cmp CHAR
8076: beq @FoundCommand
8077: dex
8078: bpl @TestNextCommand
8079:
8080:
8081: lda #ERRORCODE_31_SYNTAX_ERROR
8082: jmp GenerateErrorMessage
8083:
8084:
8085: @FoundCommand:
8086: stx CMDNUM
8087:
8088: cpx #CmdChars_With2Files - CmdChars + 1
8089: bcc @ExecuteCommand
8090:
8091: jsr LC1EE
8092:
8093: @ExecuteCommand:
8094:
8095: ldx CMDNUM
8096:
8097:
8098: lda CmdAddresses_Low,x
8099: sta T0
8100: lda CmdAddresses_High,x
8101: sta T1
8102:
8103:
8104: jmp (T0)
8105:
8106:
8107:
8108:
8109:
8110:
8111: CommandEnd:
8112: lda #$00
8113: sta WBAM
8114: LC199:
8115: lda ERWORD
8116: bne GenerateErrorMessage
8117: ldy #$00
8118: tya
8119: sty TRACK
8120: LC1A3:
8121: sty SECTOR
8122: sty BUFTABCMD
8123: jsr SetErrorCode
8124: jsr LC123
8125: LC1AD:
8126: lda DRVNUM
8127: sta LSTDRV
8128: tax
8129: .if CompileDrive >= DRIVE_1570
8130: jmp LA99D
8131: FillNOP 1
8132: .elseif CompileDrive >= DRIVE_1541C_02
8133: jmp LFFB8
8134: FillNOP 1
8135: .else
8136: lda #$00
8137: sta NODRV,x
8138: .endif
8139:
8140: LC1B7:
8141: jsr ClearCMDBUF
8142: jmp LD4DA
8143:
8144:
8145:
8146:
8147:
8148: ClearCMDBUF:
8149: ldy #CMDBUF_End - CMDBUF
8150: lda #0
8151: :
8152: sta CMDBUF,y
8153: dey
8154: bpl :-
8155: rts
8156:
8157:
8158:
8159:
8160:
8161:
8162: GenerateErrorMessage:
8163: ldy #$00
8164: sty TRACK
8165: sty SECTOR
8166: .if CompileDrive >= DRIVE_1570
8167: jmp LA9D5
8168:
8169: .else
8170: jmp LE645
8171: .endif
8172:
8173:
8174: LC1D1:
8175: ldx #$00
8176: stx FILTBL
8177: lda #$3A
8178: jsr SearchInCmdline
8179: beq LC1E2
8180: dey
8181: dey
8182: sty FILTBL
8183: LC1E2:
8184: jmp LC368
8185:
8186:
8187: LC1E5:
8188: ldy #$00
8189: ldx #$00
8190: lda #$3A
8191: jmp SearchInCmdline
8192:
8193:
8194: LC1EE:
8195: jsr LC1E5
8196: bne LC1F8
8197: LC1F3:
8198: lda #ERRORCODE_34_SYNTAX_ERROR
8199: jmp GenerateErrorMessage
8200:
8201:
8202: LC1F8:
8203: dey
8204: dey
8205: sty FILTBL
8206: txa
8207: bne LC1F3
8208: LC200:
8209: lda #$3D
8210: jsr SearchInCmdline
8211: txa
8212: beq LC20A
8213: lda #$40
8214: LC20A:
8215: ora #$21
8216: sta IMAGE
8217: inx
8218: stx F1CNT
8219: stx F2CNT
8220: lda PATFLG
8221: beq LC228
8222: lda #$80
8223: ora IMAGE
8224: sta IMAGE
8225: lda #$00
8226: sta PATFLG
8227: LC228:
8228: tya
8229: beq LC254
8230: sta FILTBL,x
8231: lda F1CNT
8232: sta F2PTR
8233: lda #$8D
8234: jsr SearchInCmdline
8235: inx
8236: stx F2CNT
8237: dex
8238: lda PATFLG
8239: beq LC245
8240: lda #$08
8241: LC245:
8242: cpx F1CNT
8243: beq LC24C
8244: ora #$04
8245: LC24C:
8246: ora #$03
8247: eor IMAGE
8248: sta IMAGE
8249: LC254:
8250: lda IMAGE
8251: ldx CMDNUM
8252: and CmdSyntaxFlags - 8,x
8253: bne LC260
8254: rts
8255: LC260:
8256: sta ERWORD
8257: lda #ERRORCODE_30_SYNTAX_ERROR
8258: jmp GenerateErrorMessage
8259:
8260:
8261:
8262:
8263:
8264:
8265:
8266:
8267:
8268:
8269:
8270:
8271:
8272:
8273: SearchInCmdline:
8274: sta CHAR
8275: @SearchLoop:
8276: cpy CMDSIZ
8277: bcs @BufferExceeded
8278:
8279: lda (BUFTABCMD),y
8280: iny
8281: cmp CHAR
8282: beq @FoundChar
8283:
8284: cmp #'*'
8285: beq @FoundWildcard
8286: cmp #'?'
8287: bne @NoWildcard
8288: @FoundWildcard:
8289: inc PATFLG
8290: @NoWildcard:
8291: cmp #','
8292: bne @SearchLoop
8293:
8294:
8295: tya
8296: sta FILTBL + 1,x
8297:
8298: lda PATFLG
8299: and # ~ PATTYP_WILDCARD
8300: beq @NoWildcardYet
8301:
8302: lda #PATTYP_WILDCARD
8303: sta PATTYP,x
8304: sta PATFLG
8305:
8306: @NoWildcardYet:
8307: inx
8308: cpx #$04
8309: bcc @SearchLoop
8310:
8311:
8312:
8313:
8314:
8315: @BufferExceeded:
8316: ldy #$00
8317:
8318: @FoundChar:
8319: lda CMDSIZ
8320: sta FILTBL + 1,x
8321:
8322: lda PATFLG
8323: and # ~ PATTYP_WILDCARD
8324: beq @DidNotHaveWildcards
8325:
8326: lda #PATTYP_WILDCARD
8327: sta PATTYP,x
8328:
8329: @DidNotHaveWildcards:
8330: tya
8331:
8332: rts
8333:
8334: LC2B3:
8335:
8336:
8337: ldy BUFTABCMD
8338: beq QuitRemovingTrailingCR
8339: dey
8340: beq @QuitUndoDecrement
8341:
8342:
8343:
8344: .if CompileDrive >= DRIVE_1570
8345:
8346: jsr READ_CMDBUF_BUT_SPECIAL_CASE_U0
8347: .else
8348: lda CMDBUF,y
8349: .endif
8350: cmp #ASC_CR
8351: beq QuitRemovingTrailingCR
8352:
8353:
8354: dey
8355:
8356:
8357:
8358: .if CompileDrive >= DRIVE_1570
8359:
8360: jsr READ_CMDBUF_BUT_SPECIAL_CASE_U0
8361: .else
8362: lda CMDBUF,y
8363: .endif
8364: cmp #ASC_CR
8365: beq QuitRemovingTrailingCR
8366:
8367: iny
8368: @QuitUndoDecrement:
8369: iny
8370: QuitRemovingTrailingCR:
8371: sty CMDSIZ
8372:
8373: cpy #CMDBUF_End2 - CMDBUF
8374: ldy #$FF
8375:
8376: bcc LC2DC
8377:
8378: sty CMDNUM
8379:
8380:
8381:
8382:
8383: lda #ERRORCODE_32_SYNTAX_ERROR
8384: jmp GenerateErrorMessage
8385:
8386:
8387:
8388:
8389: LC2DC:
8390: ldy #$00
8391: tya
8392: sta BUFTABCMD
8393: sta REC
8394: sta TYPE
8395: sta TYPFLG
8396: sta F1PTR
8397: sta F2PTR
8398: sta F1CNT
8399: sta F2CNT
8400: sta PATFLG
8401: sta ERWORD
8402: ldx #$05
8403: @LC2FD:
8404: sta F2PTR,x
8405: sta RELPTR,x
8406: sta ENTSEC + 4,x
8407: sta ENTIND + 4,x
8408: sta FILDRV + 4,x
8409: sta FILTBL + 5,x
8410: sta FILTRK + 4,x
8411: dex
8412: bne @LC2FD
8413: rts
8414:
8415: LC312:
8416: lda F2CNT
8417: sta F1CNT
8418: lda #$01
8419: sta F2CNT
8420: sta F2PTR
8421: LC320:
8422: ldy LSTDRV
8423: ldx #$00
8424: @LC325:
8425: stx F1PTR
8426: lda FILTBL,x
8427: jsr @LC33C
8428: ldx F1PTR
8429: sta FILTBL,x
8430: tya
8431: sta FILDRV,x
8432: inx
8433: cpx F2CNT
8434: bcc @LC325
8435: rts
8436: @LC33C:
8437: tax
8438: ldy #$00
8439: lda #$3A
8440: cmp CMDBUF + 1,x
8441: beq @LC352
8442: cmp CMDBUF,x
8443: bne @LC361
8444: inx
8445: @LC34C:
8446: tya
8447: @LC34D:
8448: and #$01
8449: @LC34F:
8450: tay
8451: txa
8452: rts
8453: @LC352:
8454: lda CMDBUF,x
8455: inx
8456: inx
8457: cmp #$30
8458: beq @LC34D
8459: cmp #$31
8460: beq @LC34D
8461: bne @LC34C
8462: @LC361:
8463: tya
8464: ora #$80
8465: and #$81
8466: bne @LC34F
8467: LC368:
8468: lda #$00
8469: sta IMAGE
8470: ldy FILTBL
8471: @LC370:
8472: lda (BUFTABCMD),y
8473: jsr CheckForValidDriveNumber
8474: bpl @LC388
8475: iny
8476: cpy CMDSIZ
8477: bcs @LC383
8478: ldy CMDSIZ
8479: dey
8480: bne @LC370
8481: @LC383:
8482: dec IMAGE
8483: lda #$00
8484: @LC388:
8485: and #$01
8486: sta DRVNUM
8487: jmp LC100
8488:
8489:
8490: LC38F:
8491: lda DRVNUM
8492: eor #$01
8493: and #$01
8494: sta DRVNUM
8495: rts
8496:
8497:
8498: LC398:
8499: ldy #$00
8500: lda F1CNT
8501: cmp F2CNT
8502: beq @LC3B8
8503: dec F2CNT
8504: ldy F2CNT
8505: lda FILTBL,y
8506: tay
8507: lda (BUFTABCMD),y
8508: ldy #$04
8509: @LC3B0:
8510: cmp LFEBB,y
8511: beq @LC3B8
8512: dey
8513: bne @LC3B0
8514: @LC3B8:
8515: tya
8516: sta TYPFLG
8517: rts
8518:
8519:
8520:
8521:
8522:
8523:
8524:
8525:
8526:
8527:
8528:
8529:
8530:
8531:
8532: CheckForValidDriveNumber:
8533: cmp #'0'
8534: beq @ValidDriveNumber
8535: cmp #'1'
8536: beq @ValidDriveNumber
8537: ora #$80
8538: @ValidDriveNumber:
8539: and #$81
8540: rts
8541:
8542:
8543: LC3CA:
8544: lda #$00
8545: sta T0
8546: sta DRVFLG
8547: pha
8548: ldx F2CNT
8549: @LC3D5:
8550: pla
8551: ora T0
8552: pha
8553: lda #$01
8554: sta T0
8555: dex
8556: bmi @LC3EF
8557: lda FILDRV,x
8558: bpl @LC3E8
8559: asl T0
8560: asl T0
8561: @LC3E8:
8562: lsr a
8563: bcc @LC3D5
8564: asl T0
8565: bne @LC3D5
8566: @LC3EF:
8567: pla
8568: tax
8569: lda LC440 - 1,x
8570: pha
8571: and #$03
8572: sta DRVCNT
8573: pla
8574: asl a
8575: bpl @LC43C
8576: lda FILDRV
8577: @LC400:
8578: and #$01
8579: sta DRVNUM
8580: lda DRVCNT
8581: beq @LC434
8582: jsr LC63D
8583: beq @LC420
8584: jsr LC38F
8585: lda #$00
8586: sta DRVCNT
8587: jsr LC63D
8588: beq @LC439
8589: @LC41B:
8590: lda #ERRORCODE_74_DRIVE_NOT_READY
8591: jsr GenerateErrorMessage
8592:
8593: @LC420:
8594: jsr LC38F
8595: jsr LC63D
8596: php
8597: jsr LC38F
8598: plp
8599: beq @LC439
8600: lda #$00
8601: sta DRVCNT
8602: beq @LC439
8603: @LC434:
8604: jsr LC63D
8605: bne @LC41B
8606: @LC439:
8607: jmp LC100
8608: @LC43C:
8609: rol a
8610: jmp @LC400
8611:
8612:
8613: LC440:
8614: .byte $00,$80,$41,$01,$01,$01,$01,$81
8615: .byte $81,$81,$81,$42,$42,$42,$42
8616:
8617: LC44F:
8618: jsr LC3CA
8619: @LC452:
8620: lda #$00
8621: sta DELIND
8622: jsr LC5AC
8623: bne @LC475
8624: @LC45C:
8625: dec DRVCNT
8626: bpl @LC462
8627: rts
8628:
8629: @LC462:
8630: lda #$01
8631: sta DRVFLG
8632: jsr LC38F
8633: jsr LC100
8634: jmp @LC452
8635: @LC470:
8636: jsr LC617
8637: beq @LC485
8638: @LC475:
8639: jsr LC4D8
8640: lda FOUND
8641: beq @LC47E
8642: rts
8643: @LC47E:
8644: lda ENTFND
8645: bmi @LC470
8646: bpl @LC475
8647: @LC485:
8648: lda FOUND
8649: beq @LC45C
8650: rts
8651:
8652:
8653: LC48B:
8654: jsr LC604
8655: beq LC4AA
8656: bne LC4BA
8657: LC492:
8658: lda #$01
8659: sta DRVFLG
8660: jsr LC38F
8661: jsr LC100
8662: LC49D:
8663: lda #$00
8664: sta DELIND
8665: jsr LC5AC
8666: bne LC4BA
8667: sta FOUND
8668: LC4AA:
8669: lda FOUND
8670: bne LC4D7
8671: dec DRVCNT
8672: bpl LC492
8673: rts
8674:
8675:
8676: LC4B5:
8677: jsr LC617
8678: beq LC4AA
8679: LC4BA:
8680: jsr LC4D8
8681: ldx ENTFND
8682: bpl @LC4C9
8683: lda FOUND
8684: beq LC4B5
8685: bne LC4D7
8686: @LC4C9:
8687: lda TYPFLG
8688: beq LC4D7
8689: lda PATTYP,x
8690: and #$07
8691: cmp TYPFLG
8692: bne LC4B5
8693: LC4D7:
8694: rts
8695:
8696:
8697: LC4D8:
8698: ldx #$FF
8699: stx ENTFND
8700: inx
8701: stx PATFLG
8702: jsr LC589
8703: beq LC4EC
8704: LC4E6:
8705: rts
8706: LC4E7:
8707: jsr LC594
8708: bne LC4E6
8709: LC4EC:
8710: lda DRVNUM
8711: eor FILDRV,x
8712: lsr a
8713: bcc @LC4FE
8714: and #$40
8715: beq LC4E7
8716: lda #$02
8717: cmp DRVCNT
8718: beq LC4E7
8719: @LC4FE:
8720: lda FILTBL,x
8721: tax
8722: jsr LC6A6
8723: ldy #$03
8724: jmp @LC51D
8725: @LC50A:
8726: lda CMDBUF,x
8727: cmp (DIRBUF),y
8728: beq @LC51B
8729: cmp #$3F
8730: bne LC4E7
8731: lda (DIRBUF),y
8732: cmp #$A0
8733: beq LC4E7
8734: @LC51B:
8735: inx
8736: iny
8737: @LC51D:
8738: cpx LIMIT
8739: bcs @LC52B
8740: lda CMDBUF,x
8741: cmp #$2A
8742: beq @LC535
8743: bne @LC50A
8744: @LC52B:
8745: cpy #$13
8746: bcs @LC535
8747: lda (DIRBUF),y
8748: cmp #$A0
8749: bne LC4E7
8750: @LC535:
8751: ldx F2PTR
8752: stx ENTFND
8753: lda PATTYP,x
8754: and #$80
8755: sta PATFLG
8756: lda INDEX
8757: sta ENTIND,x
8758: lda SECTOR
8759: sta ENTSEC,x
8760: ldy #$00
8761: lda (DIRBUF),y
8762: iny
8763: pha
8764: and #$40
8765: sta T0
8766: pla
8767: and # ~ $20
8768: bmi @LC55C
8769: ora #$20
8770: @LC55C:
8771: and #$27
8772: ora T0
8773: sta T0
8774: lda #$80
8775: and PATTYP,x
8776: ora T0
8777: sta PATTYP,x
8778: lda FILDRV,x
8779: and #$80
8780: ora DRVNUM
8781: sta FILDRV,x
8782: lda (DIRBUF),y
8783: sta FILTRK,x
8784: iny
8785: lda (DIRBUF),y
8786: sta FILSEC,x
8787: lda REC
8788: bne LC589
8789: ldy #$15
8790: lda (DIRBUF),y
8791: sta REC
8792:
8793: LC589:
8794: lda #$FF
8795: sta FOUND
8796: lda F2CNT
8797: sta F2PTR
8798: LC594:
8799: dec F2PTR
8800: bpl @LC59A
8801: rts
8802:
8803: @LC59A:
8804: ldx F2PTR
8805: lda PATTYP,x
8806: bmi @LC5A6
8807: lda FILTRK,x
8808: bne LC594
8809: @LC5A6:
8810: lda #$00
8811: sta FOUND
8812: rts
8813:
8814:
8815: LC5AC:
8816: ldy #$00
8817: sty DELSEC
8818: dey
8819: sty ENTFND
8820: lda LFE85
8821: sta TRACK
8822: lda #$01
8823: sta SECTOR
8824: sta LSTBUF
8825: jsr LD475
8826: LC5C4:
8827: lda LSTBUF
8828: bne @LC5CA
8829: rts
8830: @LC5CA:
8831: lda #$07
8832: sta FILCNT
8833: lda #$00
8834: jsr LD4F6
8835: sta LSTBUF
8836: LC5D7:
8837: jsr LD4E8
8838: dec FILCNT
8839: ldy #$00
8840: lda (DIRBUF),y
8841: bne @LC5FB
8842: lda DELSEC
8843: bne LC617
8844: jsr LDE3B
8845: lda SECTOR
8846: sta DELSEC
8847: lda DIRBUF
8848: ldx DELIND
8849: sta DELIND
8850: beq LC617
8851: rts
8852:
8853:
8854: @LC5FB:
8855: ldx #$01
8856: cpx DELIND
8857: bne LC62F
8858: beq LC617
8859: LC604:
8860: lda LFE85
8861: sta TRACK
8862: lda DIRSEC
8863: sta SECTOR
8864: jsr LD475
8865: lda INDEX
8866: jsr LD4C8
8867: LC617:
8868: lda #$FF
8869: sta ENTFND
8870: lda FILCNT
8871: bmi @LC629
8872: lda #$20
8873: jsr LD1C6
8874: jmp LC5D7
8875:
8876:
8877: @LC629:
8878: jsr LD44D
8879: jmp LC5C4
8880: LC62F:
8881: lda DIRBUF
8882: sta INDEX
8883: jsr LDE3B
8884: lda SECTOR
8885: sta DIRSEC
8886: rts
8887:
8888:
8889: LC63D:
8890: lda AUTOFG
8891: bne LC669
8892: ldx DRVNUM
8893: lsr WPSW,x
8894: bcc LC669
8895: lda #$FF
8896: sta JOBRTN
8897: jsr LD00E
8898: ldy #$FF
8899: cmp #$02
8900: beq @LC65F
8901: cmp #$03
8902: beq @LC65F
8903: cmp #$0F
8904: beq @LC65F
8905: ldy #$00
8906: @LC65F:
8907: ldx DRVNUM
8908: .if CompileDrive >= DRIVE_1570
8909: jmp LA9A5
8910: .elseif CompileDrive >= DRIVE_1541C_02
8911: jmp LFFC0
8912: .else
8913: tya
8914: sta NODRV,x
8915: .endif
8916:
8917: LC664:
8918: bne LC669
8919: jsr LD042
8920: LC669:
8921: ldx DRVNUM
8922: .if CompileDrive >= DRIVE_1570
8923: jmp LAA17
8924: .elseif CompileDrive >= DRIVE_1541C_02
8925: jmp LFFAC
8926: .else
8927: lda NODRV,x
8928: rts
8929: .endif
8930:
8931: LC66E:
8932: pha
8933: jsr LC6A6
8934: jsr @LC688
8935: pla
8936: sec
8937: sbc STRSIZ
8938: tax
8939: beq @LC687
8940: bcc @LC687
8941: lda #$A0
8942: @LC681:
8943: sta (DIRBUF),y
8944: iny
8945: dex
8946: bne @LC681
8947: @LC687:
8948: rts
8949:
8950:
8951: @LC688:
8952: tya
8953: asl a
8954: tay
8955: lda BUFTAB0,y
8956: sta DIRBUF
8957: lda BUFTAB0 + 1,y
8958: sta DIRBUF + 1
8959: ldy #$00
8960: @LC697:
8961: lda CMDBUF,x
8962: sta (DIRBUF),y
8963: iny
8964: beq @LC6A5
8965: inx
8966: cpx LIMIT
8967: bcc @LC697
8968: @LC6A5:
8969: rts
8970:
8971:
8972: LC6A6:
8973: lda #$00
8974: sta STRSIZ
8975: txa
8976: pha
8977: @LC6AD:
8978: lda CMDBUF,x
8979: cmp #','
8980: beq @LC6C8
8981: cmp #'='
8982: beq @LC6C8
8983: inc STRSIZ
8984: inx
8985: lda #$0F
8986: cmp STRSIZ
8987: bcc @LC6C8
8988: cpx CMDSIZ
8989: bcc @LC6AD
8990: @LC6C8:
8991: stx LIMIT
8992: pla
8993: tax
8994: rts
8995:
8996:
8997: LC6CE:
8998: lda SA
8999: pha
9000: lda LINDX
9001: pha
9002: jsr @LC6DE
9003: pla
9004: sta LINDX
9005: pla
9006: sta SA
9007: rts
9008:
9009:
9010: @LC6DE:
9011: lda #$11
9012: sta SA
9013: jsr LD0EB
9014: jsr LD4E8
9015: lda ENTFND
9016: bpl @LC6F7
9017: lda DRVFLG
9018: bne @LC6FC
9019: jsr LC806
9020: clc
9021: rts
9022:
9023: @LC6F7:
9024: lda DRVFLG
9025: beq @LC71B
9026: @LC6FC:
9027: dec DRVFLG
9028: bne @LC70E
9029: dec DRVFLG
9030: jsr LC38F
9031: jsr LC806
9032: sec
9033: jmp LC38F
9034: @LC70E:
9035: lda #$00
9036: sta NBTEMP + 1
9037: sta DRVFLG
9038: jsr LC7B7
9039: sec
9040: rts
9041:
9042:
9043: @LC71B:
9044: ldx #$18
9045: ldy #$1D
9046: lda (DIRBUF),y
9047: sta NBTEMP + 1
9048: beq @LC728
9049: ldx #$16
9050: @LC728:
9051: dey
9052: lda (DIRBUF),y
9053: sta NBTEMP
9054: cpx #$16
9055: beq @LC73C
9056: cmp #$0A
9057: bcc @LC73C
9058: dex
9059: cmp #$64
9060: bcc @LC73C
9061: dex
9062: @LC73C:
9063: jsr LC7AC
9064: lda (DIRBUF),y
9065: pha
9066: asl a
9067: bpl @LC74A
9068: lda #$3C
9069: sta NAMBUF + 1,x
9070: @LC74A:
9071: pla
9072: and #$0F
9073: tay
9074: lda LFEC5,y
9075: sta NAMBUF,x
9076: dex
9077: lda LFEC0,y
9078: sta NAMBUF,x
9079: dex
9080: lda LFEBB,y
9081: sta NAMBUF,x
9082: dex
9083: dex
9084: bcs @LC76B
9085: lda #$2A
9086: sta NAMBUF + 1,x
9087: @LC76B:
9088: lda #$A0
9089: sta NAMBUF,x
9090: dex
9091: ldy #$12
9092: @LC773:
9093: lda (DIRBUF),y
9094: sta NAMBUF,x
9095: dex
9096: dey
9097: cpy #$03
9098: bcs @LC773
9099: lda #$22
9100: sta NAMBUF,x
9101: @LC783:
9102: inx
9103: cpx #$20
9104: bcs @LC793
9105: lda NAMBUF,x
9106: cmp #$22
9107: beq @LC793
9108: cmp #$A0
9109: bne @LC783
9110: @LC793:
9111: lda #$22
9112: sta NAMBUF,x
9113: @LC798:
9114: inx
9115: cpx #$20
9116: bcs @LC7A7
9117: lda #$7F
9118: and NAMBUF,x
9119: sta NAMBUF,x
9120: bpl @LC798
9121: @LC7A7:
9122: jsr LC4B5
9123: sec
9124: rts
9125:
9126:
9127: LC7AC:
9128: ldy #$1B
9129: lda #$20
9130: @LC7B0:
9131: sta L02B0,y
9132: dey
9133: bne @LC7B0
9134: rts
9135:
9136:
9137: LC7B7:
9138: jsr LF119
9139: jsr LF0DF
9140: jsr LC7AC
9141: lda #$FF
9142: sta T0
9143: ldx DRVNUM
9144: stx NBTEMP
9145: lda #$00
9146: sta NBTEMP + 1
9147: ldx JOBNUM
9148: lda TableHighBytesOfBuffers,x
9149: sta DIRBUF + 1
9150: lda LFE85 + 3
9151: sta DIRBUF
9152: ldy #$16
9153: lda (DIRBUF),y
9154: cmp #$A0
9155: bne @LC7ED
9156: lda #$31
9157: .byte ASM_BIT3
9158: @LC7E5:
9159: lda (DIRBUF),y
9160: cmp #$A0
9161: bne @LC7ED
9162: lda #$20
9163: @LC7ED:
9164: sta NAMBUF + 2,y
9165: dey
9166: bpl @LC7E5
9167: lda #$12
9168: sta NAMBUF
9169: lda #$22
9170: sta NAMBUF + 1
9171: sta NAMBUF + 18
9172: lda #$20
9173: sta NAMBUF + 19
9174: rts
9175:
9176:
9177: LC806:
9178: jsr LC7AC
9179: ldy #$0B
9180: @LC80B:
9181: lda TextBlocksFree,y
9182: sta NAMBUF,y
9183: dey
9184: bpl @LC80B
9185: jmp LEF4D
9186:
9187:
9188: TextBlocksFree:
9189: .byte "BLOCKS FREE."
9190:
9191: cmd_scratch:
9192: jsr LC398
9193: jsr LC320
9194: jsr LC3CA
9195: lda #$00
9196: sta R0
9197: jsr LC49D
9198: bmi @LC872
9199: @LC835:
9200: jsr LDDB7
9201: bcc @LC86D
9202: ldy #$00
9203: lda (DIRBUF),y
9204: and #$40
9205: bne @LC86D
9206: jsr LC8B6
9207: ldy #$13
9208: lda (DIRBUF),y
9209: beq @LC855
9210: sta TRACK
9211: iny
9212: lda (DIRBUF),y
9213: sta SECTOR
9214: jsr LC87D
9215: @LC855:
9216: ldx ENTFND
9217: lda #$20
9218: and PATTYP,x
9219: bne @LC86B
9220: lda FILTRK,x
9221: sta TRACK
9222: lda FILSEC,x
9223: sta SECTOR
9224: jsr LC87D
9225: @LC86B:
9226: inc R0
9227: @LC86D:
9228: jsr LC48B
9229: bpl @LC835
9230: @LC872:
9231: lda R0
9232: sta TRACK
9233: lda #ERRORCODE_01_FILES_SCRATCHED
9234: ldy #$00
9235: jmp LC1A3
9236:
9237:
9238: LC87D:
9239: jsr LEF5F
9240: jsr LD475
9241: jsr LF119
9242: lda BUF0,x
9243: cmp #$FF
9244: beq @LC894
9245: lda WBAM
9246: ora #$40
9247: sta WBAM
9248: @LC894:
9249: lda #$00
9250: jsr LD4C8
9251: jsr LD156
9252: sta TRACK
9253: jsr LD156
9254: sta SECTOR
9255: lda TRACK
9256: bne @LC8AD
9257: jsr LEEF4
9258: jmp LD227
9259: @LC8AD:
9260: jsr LEF5F
9261: jsr LD44D
9262: jmp @LC894
9263:
9264:
9265: LC8B6:
9266: ldy #$00
9267: tya
9268: sta (DIRBUF),y
9269: jsr LDE5E
9270: jmp LD599
9271:
9272:
9273: cmd_duplicate:
9274: Error31SyntaxError:
9275: lda #ERRORCODE_31_SYNTAX_ERROR
9276: jmp GenerateErrorMessage
9277:
9278:
9279: LC8C6:
9280: lda #ASM_JMP
9281: sta BUFFER3
9282: lda #<LFAC7
9283: sta BUFFER3 + 1
9284: lda #>LFAC7
9285: sta BUFFER3 + 2
9286: lda #$03
9287: jsr LD6D3
9288: lda DRVNUM
9289: ora #$E0
9290: sta JOBS3
9291: @LC8E0:
9292: lda JOBS3
9293: bmi @LC8E0
9294: cmp #$02
9295: bcc @LC8EF
9296: lda #$03
9297: ldx #$00
9298: jmp LE60A
9299: @LC8EF:
9300: rts
9301:
9302:
9303: cmd_copy:
9304: lda #$E0
9305: sta BUFUSE
9306: jsr LF0D1
9307: jsr LF119
9308: lda #$FF
9309: sta BUF0,x
9310: lda #$0F
9311: sta LINUSE
9312: jsr LC1E5
9313: bne @LC90C
9314: jmp Error31SyntaxError
9315: @LC90C:
9316: jsr LC1F8
9317: jsr LC320
9318: lda IMAGE
9319: and #'U'
9320: bne LC928
9321: ldx FILTBL
9322: lda CMDBUF,x
9323: cmp #'*'
9324: bne LC928
9325:
9326: Error30SyntaxError:
9327: lda #ERRORCODE_30_SYNTAX_ERROR
9328: jmp GenerateErrorMessage
9329:
9330:
9331: LC928:
9332: lda IMAGE
9333: and #$D9
9334: bne Error30SyntaxError
9335: jmp @LC952
9336: lda #$00
9337: sta REC
9338: sta DRVCNT
9339: sta FILTRK
9340: sta FILTRK + 1
9341: lda FILDRV + 1
9342: and #$01
9343: sta DRVNUM
9344: ora #$01
9345: sta DELSEC
9346: lda FILTBL + 1
9347: sta FILTBL
9348: rts
9349:
9350:
9351: @LC952:
9352: jsr LC44F
9353: lda F2CNT
9354: cmp #$03
9355: bcc @LC9A1
9356: lda FILDRV
9357: cmp FILDRV + 1
9358: bne @LC9A1
9359: lda ENTIND
9360: cmp ENTIND + 1
9361: bne @LC9A1
9362: lda ENTSEC
9363: cmp ENTSEC + 1
9364: bne @LC9A1
9365: jsr LCACC
9366: lda #$01
9367: sta F2PTR
9368: jsr LC9FA
9369: jsr LD125
9370: beq @LC982
9371: cmp #$02
9372: bne @LC987
9373: @LC982:
9374: lda #ERRORCODE_64_FILE_TYPE_MISMATCH
9375: jsr GenerateErrorMessage
9376: @LC987:
9377: lda #$12
9378: sta SA
9379: lda L023C
9380: sta L023D
9381: lda #$FF
9382: sta L023C
9383: jsr LDA2A
9384: ldx #$02
9385: jsr @LC9B9
9386: jmp CommandEnd
9387: @LC9A1:
9388: jsr @LC9A7
9389: jmp CommandEnd
9390:
9391:
9392: @LC9A7:
9393: jsr LCAE7
9394: lda FILDRV
9395: and #$01
9396: sta DRVNUM
9397: jsr LD486
9398: jsr LD6E4
9399: ldx F1CNT
9400: @LC9B9:
9401: stx F2PTR
9402: jsr LC9FA
9403: lda #$11
9404: sta SA
9405: jsr LD0EB
9406: jsr LD125
9407: bne @LC9CE
9408: jsr LCA53
9409: @LC9CE:
9410: lda #$08
9411: sta EIOFLG
9412: jmp @LC9D8
9413: @LC9D5:
9414: jsr LCF9B
9415: @LC9D8:
9416: jsr LCA35
9417: lda #$80
9418: jsr LDDA6
9419: beq @LC9D5
9420: jsr LD125
9421: beq @LC9EA
9422: jsr LCF9B
9423: @LC9EA:
9424: ldx F2PTR
9425: inx
9426: cpx F2CNT
9427: bcc @LC9B9
9428: lda #$12
9429: sta SA
9430: jmp LDB02
9431:
9432:
9433: LC9FA:
9434: ldx F2PTR
9435: lda FILDRV,x
9436: and #$01
9437: sta DRVNUM
9438: lda LFE85
9439: sta TRACK
9440: lda ENTSEC,x
9441: sta SECTOR
9442: jsr LD475
9443: ldx F2PTR
9444: lda ENTIND,x
9445: jsr LD4C8
9446: ldx F2PTR
9447: lda PATTYP,x
9448: and #$07
9449: sta TYPE
9450: lda #$00
9451: sta REC
9452: jsr LD9A0
9453: ldy #$01
9454: jsr LD125
9455: beq @LCA31
9456: iny
9457: @LCA31:
9458: tya
9459: jmp LD4C8
9460:
9461:
9462: LCA35:
9463: lda #$11
9464: sta SA
9465:
9466: LCA39:
9467: jsr LD39B
9468: sta DATA
9469: ldx LINDX
9470: lda CHNRDY,x
9471: and #$08
9472: sta EIOFLG
9473: bne @Rts
9474: jsr LD125
9475: beq @Rts
9476: lda #$80
9477: jsr LDD97
9478: @Rts:
9479: rts
9480:
9481:
9482: LCA53:
9483: jsr LD1D3
9484: jsr LE1CB
9485: lda SSIND
9486: pha
9487: lda SSNUM
9488: pha
9489: lda #$12
9490: sta SA
9491: jsr LD107
9492: jsr LD1D3
9493: jsr LE1CB
9494: jsr LE29C
9495: lda SSIND
9496: sta R1
9497: lda SSNUM
9498: sta R0
9499: lda #$00
9500: sta R2
9501: sta RECPTR
9502: sta RELPTR
9503: pla
9504: sta SSNUM
9505: pla
9506: sta SSIND
9507: jmp LE33B
9508:
9509:
9510: cmd_rename:
9511: jsr LC320
9512: lda FILDRV + 1
9513: and #$01
9514: sta FILDRV + 1
9515: cmp FILDRV
9516: beq @LCA97
9517: ora #$80
9518: @LCA97:
9519: sta FILDRV
9520: jsr LC44F
9521: jsr LCAE7
9522: lda FILDRV + 1
9523: and #$01
9524: sta DRVNUM
9525: lda ENTSEC + 1
9526: sta SECTOR
9527: jsr LDE57
9528: jsr LD599
9529: lda ENTIND + 1
9530: clc
9531: adc #$03
9532: jsr LD4C8
9533: jsr LDF93
9534: tay
9535: ldx FILTBL
9536: lda #$10
9537: jsr LC66E
9538: jsr LDE5E
9539: jsr LD599
9540: jmp CommandEnd
9541:
9542:
9543: LCACC:
9544: lda PATTYP + 1
9545: and #$07
9546: sta TYPE
9547: ldx F2CNT
9548: @LCAD6:
9549: dex
9550: cpx F1CNT
9551: bcc @Rts
9552: lda FILTRK,x
9553: bne @LCAD6
9554: lda #ERRORCODE_62_FILE_NOT_FOUND
9555: jmp GenerateErrorMessage
9556:
9557:
9558: @Rts:
9559: rts
9560:
9561:
9562: LCAE7:
9563: jsr LCACC
9564: @LCAEA:
9565: lda FILTRK,x
9566: beq @LCAF4
9567: lda #ERRORCODE_63_FILE_EXISTS
9568: jmp GenerateErrorMessage
9569:
9570:
9571: @LCAF4:
9572: dex
9573: bpl @LCAEA
9574: rts
9575:
9576:
9577:
9578:
9579:
9580:
9581:
9582:
9583:
9584:
9585:
9586:
9587: cmd_memory:
9588:
9589: lda CMDBUF + 1
9590: cmp #'-'
9591: bne @Error31SyntaxError
9592:
9593:
9594: lda CMDBUF + 3
9595: sta T0
9596: lda CMDBUF + 4
9597: sta T0+1
9598:
9599:
9600:
9601: ldy #$00
9602: lda CMDBUF + 2
9603:
9604:
9605: cmp #'R'
9606: beq @cmd_memory_read
9607:
9608: jsr NoOp
9609:
9610:
9611: cmp #'W'
9612: beq @cmd_memory_write
9613:
9614:
9615: cmp #'E'
9616: bne @Error31SyntaxError
9617:
9618:
9619: jmp (T0)
9620:
9621: @cmd_memory_read:
9622: lda (T0),y
9623: sta DATA
9624:
9625: lda CMDSIZ
9626: cmp #$06
9627: bcc @OnlyOneByte
9628:
9629: ldx CMDBUF + 5
9630: dex
9631: beq @OnlyOneByte
9632:
9633:
9634:
9635:
9636:
9637:
9638:
9639:
9640:
9641:
9642:
9643:
9644:
9645:
9646: txa
9647: clc
9648: adc T0
9649: inc T0
9650: sta LSTCHR + 5
9651:
9652: lda T0
9653: sta BUFTABERR
9654: lda T0+1
9655: sta BUFTABERR + 1
9656: jmp LD443
9657:
9658:
9659: @OnlyOneByte:
9660: jsr LD0EB
9661: jmp LD43A
9662:
9663:
9664: @Error31SyntaxError:
9665: lda #ERRORCODE_31_SYNTAX_ERROR
9666: jmp GenerateErrorMessage
9667:
9668:
9669: @cmd_memory_write:
9670:
9671:
9672:
9673:
9674:
9675: lda CMDBUF + 6,y
9676: sta (T0),y
9677: iny
9678: cpy CMDBUF + 5
9679: bcc @cmd_memory_write
9680: rts
9681:
9682:
9683:
9684:
9685:
9686:
9687:
9688:
9689:
9690:
9691:
9692:
9693:
9694:
9695:
9696:
9697:
9698:
9699:
9700:
9701:
9702:
9703:
9704: cmd_user:
9705: ldy CMDBUF + 1
9706: cpy #'0'
9707: bne NoU0Command
9708:
9709:
9710:
9711:
9712:
9713:
9714:
9715:
9716: InitJumpTableForUxCommands:
9717:
9718: .if CompileDrive >= DRIVE_1570
9719:
9720:
9721:
9722:
9723:
9724:
9725: jmp U0CommandPatch157x
9726:
9727:
9728: FillNOP 6
9729:
9730: .else
9731:
9732: lda #<AddressesUxCommands
9733: sta USRJMP
9734: lda #>AddressesUxCommands
9735: sta USRJMP + 1
9736: rts
9737:
9738: .endif
9739:
9740: NoU0Command:
9741: jsr @ExecuteUxCommand
9742: jmp CommandEnd
9743:
9744:
9745: @ExecuteUxCommand:
9746:
9747:
9748:
9749:
9750:
9751:
9752:
9753:
9754:
9755:
9756:
9757:
9758:
9759:
9760:
9761:
9762:
9763: dey
9764: tya
9765: and #$0F
9766: asl a
9767: tay
9768:
9769:
9770: lda (USRJMP),y
9771: sta IP
9772: iny
9773: lda (USRJMP),y
9774: sta IP + 1
9775:
9776: .if CompileDrive >= DRIVE_1570
9777:
9778:
9779: jmp Patch1570ExecutionOfUCommand
9780: .else
9781:
9782: jmp (IP)
9783: .endif
9784:
9785: LCB84:
9786: lda LSTDRV
9787: sta DRVNUM
9788: lda SA
9789: pha
9790: jsr LC63D
9791: pla
9792: sta SA
9793: ldx CMDSIZ
9794: dex
9795: bne LCBA5
9796: lda #$01
9797: jsr LD1E2
9798: jmp LCBF1
9799:
9800: Error70:
9801: lda #ERRORCODE_70_NO_CHANNEL
9802: jmp GenerateErrorMessage
9803:
9804:
9805: LCBA5:
9806: ldy #$01
9807: jsr CheckForAndSkipWhitespace
9808: ldx FILSEC
9809: cpx #$05
9810: bcs Error70
9811: lda #$00
9812: sta T0
9813: sta T1
9814: sec
9815: @LCBB8:
9816: rol T0
9817: rol T1
9818: dex
9819: bpl @LCBB8
9820: lda T0
9821: and BUFUSE
9822: bne Error70
9823: lda T1
9824: and BUFUSE + 1
9825: bne Error70
9826: lda T0
9827: ora BUFUSE
9828: sta BUFUSE
9829: lda T1
9830: ora BUFUSE + 1
9831: sta BUFUSE + 1
9832: lda #$00
9833: jsr LD1E2
9834: ldx LINDX
9835: lda FILSEC
9836: sta BUF0,x
9837: tax
9838: lda DRVNUM
9839: sta JOBS0,x
9840: sta LSTJOB,x
9841: LCBF1:
9842: ldx SA
9843: lda LINTAB,x
9844: ora #$40
9845: sta LINTAB,x
9846: ldy LINDX
9847: lda #$FF
9848: sta LSTCHR,y
9849: lda #$89
9850: sta CHNRDY,y
9851: lda BUF0,y
9852: sta L023E,y
9853: asl a
9854: tax
9855: lda #$01
9856: sta BUFTAB0,x
9857: lda #$0E
9858: sta FILTYP,y
9859: jmp CommandEnd
9860:
9861:
9862:
9863:
9864:
9865:
9866:
9867:
9868:
9869:
9870:
9871:
9872: cmd_block:
9873: ldy #$00
9874: ldx #$00
9875: lda #'-'
9876: jsr SearchInCmdline
9877: bne cmd_block_found_dash
9878:
9879:
9880:
9881: Error31SyntaxError_2:
9882: lda #ERRORCODE_31_SYNTAX_ERROR
9883: jmp GenerateErrorMessage
9884:
9885:
9886: Error30SyntaxError_2:
9887: lda #ERRORCODE_30_SYNTAX_ERROR
9888: jmp GenerateErrorMessage
9889:
9890:
9891: cmd_block_found_dash:
9892: txa
9893: bne Error30SyntaxError_2
9894:
9895:
9896: ldx #@CommandCharsTable_End - @CommandCharsTable - 1
9897: lda CMDBUF,y
9898: @SearchCommandChar:
9899: cmp @CommandCharsTable,x
9900: beq @FoundChar
9901: dex
9902: bpl @SearchCommandChar
9903: bmi Error31SyntaxError_2
9904:
9905:
9906: @FoundChar:
9907: txa
9908: ora #$80
9909: sta CMDNUM
9910: jsr ReadUpTo4NumericalParameter
9911:
9912: lda CMDNUM
9913: asl a
9914: tax
9915: lda @CommandAddress + 1,x
9916: sta T1
9917: lda @CommandAddress,x
9918: sta T0
9919: jmp (T0)
9920:
9921:
9922:
9923:
9924: @CommandCharsTable:
9925: .byte 'A','F','R','W','E','P'
9926: @CommandCharsTable_End:
9927:
9928:
9929: @CommandAddress:
9930: .addr cmd_block_allocate
9931: .addr cmd_block_free
9932: .addr cmd_block_read
9933: .addr cmd_block_write
9934: .addr cmd_block_execute
9935: .addr cmd_buffer_pointer
9936:
9937:
9938:
9939:
9940:
9941:
9942:
9943:
9944:
9945: ReadUpTo4NumericalParameter:
9946: ldy #$00
9947: ldx #$00
9948: lda #':'
9949: jsr SearchInCmdline
9950: bne CheckForAndSkipWhitespace
9951:
9952:
9953: ldy #$03
9954:
9955: CheckForAndSkipWhitespace:
9956: lda CMDBUF,y
9957: cmp #' '
9958: beq @SkipWhiteSpace
9959: cmp #PETSCII_CRSR_RIGHT
9960: beq @SkipWhiteSpace
9961: cmp #','
9962: bne @NoMoreWhiteSpace
9963:
9964: @SkipWhiteSpace:
9965: iny
9966: cpy CMDSIZ
9967: bcc CheckForAndSkipWhitespace
9968: rts
9969:
9970:
9971: @NoMoreWhiteSpace:
9972: jsr @ConvertParameterToBinary
9973: inc F1CNT
9974: ldy F2PTR
9975: cpx #$04
9976: bcc @SkipWhiteSpace
9977: bcs Error30SyntaxError_2
9978:
9979:
9980: @ConvertParameterToBinary:
9981: lda #$00
9982: sta T0
9983: sta T1
9984:
9985: sta T3
9986:
9987: ldx #-1
9988:
9989: @ReadInCharacter:
9990: lda CMDBUF,y
9991:
9992:
9993:
9994: cmp #'?' + 1
9995: bcs @NoDigit
9996: cmp #'0'
9997: bcc @NoDigit
9998: and #$0F
9999:
10000:
10001:
10002:
10003:
10004: pha
10005: lda T1
10006: sta T2
10007: lda T0
10008: sta T1
10009: pla
10010: sta T0
10011:
10012: iny
10013: cpy CMDSIZ
10014: bcc @ReadInCharacter
10015:
10016: @NoDigit:
10017: sty F2PTR
10018:
10019: clc
10020: lda #$00
10021:
10022:
10023:
10024:
10025: @NextDigit:
10026: inx
10027: cpx #3
10028: bcs @ConversionDone
10029:
10030: ldy T0,x
10031:
10032:
10033: @AddPowerOf10:
10034: dey
10035: bmi @NextDigit
10036: adc @PowersOf10,x
10037: bcc @AddPowerOf10
10038:
10039:
10040: clc
10041: inc T3
10042: bne @AddPowerOf10
10043:
10044:
10045: @ConversionDone:
10046:
10047:
10048: pha
10049: ldx F1CNT
10050: lda T3
10051: sta FILTRK,x
10052: pla
10053: sta FILSEC,x
10054: rts
10055:
10056:
10057: @PowersOf10:
10058: .byte 1, 10, 100
10059:
10060:
10061: cmd_block_free:
10062: jsr LCDF5
10063: jsr LEF5F
10064: jmp CommandEnd
10065: lda #$01
10066: sta WBAM
10067:
10068:
10069: cmd_block_allocate:
10070: jsr LCDF5
10071: lda SECTOR
10072: pha
10073: jsr LF1FA
10074: beq @LCD19
10075: pla
10076: cmp SECTOR
10077: bne @LCD2C
10078: jsr LEF90
10079: jmp CommandEnd
10080: @LCD19:
10081: pla
10082: @LCD1A:
10083: lda #$00
10084: sta SECTOR
10085: inc TRACK
10086: lda TRACK
10087: cmp MAXTRACK_ADJUSTED
10088: bcs Error65
10089: jsr LF1FA
10090: beq @LCD1A
10091: @LCD2C:
10092: lda #ERRORCODE_65_NO_BLOCK
10093: jsr LE645
10094:
10095: Error65:
10096: lda #ERRORCODE_65_NO_BLOCK
10097: jsr GenerateErrorMessage
10098: LCD36:
10099: jsr LCDF2
10100: jmp LD460
10101:
10102:
10103: LCD3C:
10104: jsr LD12F
10105: lda (BUFTAB0,x)
10106: rts
10107:
10108:
10109: LCD42:
10110: jsr LCD36
10111: lda #$00
10112: jsr LD4C8
10113: jsr LCD3C
10114: sta LSTCHR,y
10115: lda #$89
10116: sta CHNRDY,y
10117: rts
10118:
10119: cmd_block_read:
10120: jsr LCD42
10121: jsr LD3EC
10122: jmp CommandEnd
10123:
10124: CMD_U1:
10125: jsr ReadUpTo4NumericalParameter
10126: jsr LCD42
10127: lda LSTCHR,y
10128: sta L023E,y
10129: lda #$FF
10130: sta LSTCHR,y
10131: jmp CommandEnd
10132:
10133: cmd_block_write:
10134: jsr LCDF2
10135: jsr LD4E8
10136: tay
10137: dey
10138: cmp #$02
10139: bcs @LCD81
10140: ldy #$01
10141: @LCD81:
10142: lda #$00
10143: jsr LD4C8
10144: tya
10145: jsr LCFF1
10146: txa
10147: pha
10148: jsr LD464
10149: pla
10150: tax
10151: .if CompileDrive >= DRIVE_1570
10152: jsr LFFAE
10153: .elseif CompileDrive >= DRIVE_1541C_02
10154: jsr LC024
10155: .else
10156: jsr LD3EE
10157: .endif
10158: jmp CommandEnd
10159:
10160: CMD_U2:
10161: jsr ReadUpTo4NumericalParameter
10162: jsr LCDF2
10163: jsr LD464
10164: jmp CommandEnd
10165:
10166:
10167: cmd_block_execute:
10168: jsr NoOp
10169: jsr LCD36
10170:
10171: lda #$00
10172: sta T0
10173: ldx JOBNUM
10174: lda TableHighBytesOfBuffers,x
10175: sta T0+1
10176: jsr @Execute
10177: jmp CommandEnd
10178:
10179:
10180: @Execute:
10181: jmp (T0)
10182:
10183:
10184: cmd_buffer_pointer:
10185: jsr LCDD2
10186: lda JOBNUM
10187: asl a
10188: tax
10189: lda FILSEC + 1
10190: sta BUFTAB0,x
10191: jsr LD12F
10192: jsr LD3EE
10193: jmp CommandEnd
10194:
10195:
10196: LCDD2:
10197: ldx F1PTR
10198: inc F1PTR
10199: lda FILSEC,x
10200: tay
10201: dey
10202: dey
10203: cpy #$0C
10204: bcc @LCDE5
10205: @Err70NoChannel:
10206: lda #ERRORCODE_70_NO_CHANNEL
10207: jmp GenerateErrorMessage
10208:
10209:
10210: @LCDE5:
10211: sta SA
10212: jsr LD0EB
10213: bcs @Err70NoChannel
10214: jsr LDF93
10215: sta JOBNUM
10216: rts
10217:
10218:
10219: LCDF2:
10220: jsr LCDD2
10221: LCDF5:
10222: ldx F1PTR
10223: lda FILSEC,x
10224: and #$01
10225: sta DRVNUM
10226: lda FILSEC + 2,x
10227: sta SECTOR
10228: lda FILSEC + 1,x
10229: sta TRACK
10230: jsr LD55F
10231: jmp LC100
10232:
10233:
10234: LCE0E:
10235: jsr @LCE2C
10236: jsr LCE6E
10237: lda ACCUM + 1
10238: sta RELPTR
10239: jsr LCE71
10240: inc RELPTR
10241: inc RELPTR
10242: lda RESULT
10243: sta SSNUM
10244: lda ACCUM + 1
10245: asl a
10246: clc
10247: adc #$10
10248: sta SSIND
10249: rts
10250:
10251:
10252: @LCE2C:
10253: jsr LCED9
10254: sta ACCUM + 3
10255: ldx LINDX
10256: lda RECL,x
10257: sta ACCUM + 1
10258: lda RECH,x
10259: sta ACCUM + 2
10260: bne @LCE41
10261: lda ACCUM + 1
10262: beq @LCE4C
10263: @LCE41:
10264: lda ACCUM + 1
10265: sec
10266: sbc #$01
10267: sta ACCUM + 1
10268: bcs @LCE4C
10269: dec ACCUM + 2
10270: @LCE4C:
10271: lda RS,x
10272: sta T0
10273: @LCE50:
10274: lsr T0
10275: bcc @LCE57
10276: jsr LCEED
10277: @LCE57:
10278: jsr LCEE5
10279: lda T0
10280: bne @LCE50
10281: lda RECPTR
10282: clc
10283: adc RESULT
10284: sta RESULT
10285: bcc @LCE6D
10286: inc RESULT + 1
10287: bne @LCE6D
10288: inc RESULT + 2
10289: @LCE6D:
10290: rts
10291:
10292:
10293: LCE6E:
10294: lda #$FE
10295: .byte ASM_BIT3
10296: LCE71:
10297: lda #$78
10298: sta T0
10299: ldx #$03
10300: @LCE77:
10301: lda ACCUM,x
10302: pha
10303: lda R4,x
10304: sta ACCUM,x
10305: pla
10306: sta R4,x
10307: dex
10308: bne @LCE77
10309: jsr LCED9
10310: @LCE87:
10311: ldx #$00
10312: @LCE89:
10313: lda ACCUM + 1,x
10314: sta ACCUM,x
10315: inx
10316: cpx #$04
10317: bcc @LCE89
10318: lda #$00
10319: sta ACCUM + 3
10320: bit T0
10321: bmi @LCEA3
10322: asl ACCUM
10323: php
10324: lsr ACCUM
10325: plp
10326: jsr LCEE6
10327: @LCEA3:
10328: jsr LCEED
10329: jsr LCEE5
10330: bit T0
10331: bmi @LCEB0
10332: jsr LCEE2
10333: @LCEB0:
10334: lda ACCUM
10335: clc
10336: adc ACCUM + 1
10337: sta ACCUM + 1
10338: bcc @LCEBF
10339: inc ACCUM + 2
10340: bne @LCEBF
10341: inc ACCUM + 3
10342: @LCEBF:
10343: lda ACCUM + 3
10344: ora ACCUM + 2
10345: bne @LCE87
10346: lda ACCUM + 1
10347: sec
10348: sbc T0
10349: bcc @LCED8
10350: inc RESULT
10351: bne @LCED6
10352: inc RESULT + 1
10353: bne @LCED6
10354: inc RESULT + 2
10355: @LCED6:
10356: sta ACCUM + 1
10357: @LCED8:
10358: rts
10359:
10360:
10361: LCED9:
10362: lda #$00
10363: sta RESULT
10364: sta RESULT + 1
10365: sta RESULT + 2
10366: rts
10367:
10368:
10369: LCEE2:
10370: jsr LCEE5
10371: LCEE5:
10372: clc
10373: LCEE6:
10374: rol ACCUM + 1
10375: rol ACCUM + 2
10376: rol ACCUM + 3
10377: rts
10378:
10379:
10380: LCEED:
10381: clc
10382: ldx #$FD
10383: @LCEF0:
10384: lda RESULT + 3,x
10385: adc ACCUM + 4,x
10386: sta RESULT + 3,x
10387: inx
10388: bne @LCEF0
10389: rts
10390:
10391: LCEFA:
10392: ldx #$00
10393: :
10394: txa
10395: sta LRUTBL,x
10396: inx
10397: cpx #$04
10398: bne :-
10399: lda #$06
10400: sta LRUTBL,x
10401: rts
10402:
10403:
10404: LCF09:
10405: ldy #$04
10406: ldx LINDX
10407: @LCF0D:
10408: lda LRUTBL,y
10409: stx LRUTBL,y
10410: cmp LINDX
10411: beq @Rts
10412: dey
10413: bmi LCEFA
10414: tax
10415: jmp @LCF0D
10416:
10417:
10418: @Rts:
10419: rts
10420:
10421:
10422: LCF1E:
10423: jsr LCF09
10424: jsr LDFB7
10425: bne @LCF6C
10426: jsr LD1D3
10427: jsr LD28E
10428: bmi Error70_2
10429: jsr LDFC2
10430: lda TRACK
10431: pha
10432: lda SECTOR
10433: pha
10434: lda #$01
10435: jsr LD4F6
10436: sta SECTOR
10437: lda #$00
10438: jsr LD4F6
10439: sta TRACK
10440: beq @LCF66
10441: jsr LD125
10442: beq @LCF57
10443: jsr LDDAB
10444: bne @LCF57
10445: jsr LCF8C
10446: jmp @LCF5D
10447:
10448:
10449: @LCF57:
10450: jsr LCF8C
10451: jsr LDE57
10452: @LCF5D:
10453: pla
10454: sta SECTOR
10455: pla
10456: sta TRACK
10457: jmp @LCF6F
10458:
10459:
10460: @LCF66:
10461: pla
10462: sta SECTOR
10463: pla
10464: sta TRACK
10465: @LCF6C:
10466: jsr LCF8C
10467: @LCF6F:
10468: jsr LDF93
10469: tax
10470: jmp LD599
10471:
10472:
10473: Error70_2:
10474: lda #ERRORCODE_70_NO_CHANNEL
10475: jmp GenerateErrorMessage
10476:
10477:
10478: LCF7B:
10479: jsr LCF09
10480: jsr LDFB7
10481: bne @Rts
10482: jsr LD28E
10483: bmi Error70_2
10484: jsr LDFC2
10485: @Rts:
10486: rts
10487:
10488:
10489: LCF8C:
10490: ldx LINDX
10491: lda BUF0,x
10492: eor #$80
10493: sta BUF0,x
10494: lda BUF1,x
10495: eor #$80
10496: sta BUF1,x
10497: rts
10498:
10499:
10500: LCF9B:
10501: ldx #$12
10502: stx SA
10503: jsr LD107
10504: jsr LC100
10505: jsr LD125
10506: bcc @LCFAF
10507: lda #$20
10508: jsr LDD9D
10509: @LCFAF:
10510: lda SA
10511: cmp #$0F
10512: beq LCFD8
10513: bne LCFBF
10514:
10515:
10516: LCFB7:
10517: lda ORGSA
10518: and #$8F
10519: cmp #$0F
10520: bcs LCFD8
10521: LCFBF:
10522: jsr LD125
10523: bcs @LCFC9
10524: lda DATA
10525: jmp LD19D
10526:
10527:
10528: @LCFC9:
10529: bne @LCFCE
10530: jmp LE0AB
10531:
10532:
10533: @LCFCE:
10534: lda DATA
10535: jsr LCFF1
10536: ldy LINDX
10537: jmp LD3EE
10538:
10539:
10540: LCFD8:
10541: lda #$04
10542: sta LINDX
10543: jsr LD4E8
10544: cmp #$2A
10545: beq @LCFE8
10546: lda DATA
10547: jsr LCFF1
10548: @LCFE8:
10549: lda EIOFLG
10550: beq @LCFED
10551: rts
10552:
10553:
10554: @LCFED:
10555: inc CMDWAT
10556: rts
10557:
10558:
10559:
10560: LCFF1:
10561: pha
10562: jsr LDF93
10563: bpl LCFFD
10564: pla
10565: lda #ERRORCODE_61_FILE_NOT_OPEN
10566: jmp GenerateErrorMessage
10567:
10568:
10569: LCFFD:
10570: asl a
10571: tax
10572: pla
10573: sta (BUFTAB0,x)
10574: inc BUFTAB0,x
10575: rts
10576:
10577:
10578: cmd_init:
10579: jsr LC1D1
10580: .if CompileDrive >= DRIVE_1571_05
10581: jsr LABA6
10582: .else
10583: jsr LD042
10584: .endif
10585: jmp CommandEnd
10586:
10587:
10588: LD00E:
10589: jsr LF10F
10590: tay
10591: ldx BUF0,y
10592: cpx #$FF
10593: bne @LD02C
10594: pha
10595: jsr LD28E
10596: tax
10597: bpl @LD024
10598: lda #ERRORCODE_70_NO_CHANNEL
10599: .if CompileDrive >= DRIVE_1571_05
10600: jsr LE645
10601: .else
10602: jsr LE648
10603: .endif
10604:
10605: @LD024:
10606: pla
10607: tay
10608: txa
10609: ora #$80
10610: sta BUF0,y
10611: @LD02C:
10612: txa
10613: and #$0F
10614: sta JOBNUM
10615: ldx #$00
10616: stx SECTOR
10617: ldx LFE85
10618: stx TRACK
10619: jsr LD6D3
10620: lda #$B0
10621:
10622: .if CompileDrive >= DRIVE_1571
10623: jmp LA6E5
10624: .else
10625: jmp LD58C
10626: .endif
10627:
10628:
10629: LD042:
10630: jsr LF0D1
10631: jsr LD313
10632: jsr LD00E
10633: ldx DRVNUM
10634: lda #$00
10635: sta MDIRTY,x
10636: txa
10637: asl a
10638: tax
10639: lda HEADER
10640: sta DiskID0,x
10641: lda HEADER + 1
10642: sta DiskID0 + 1,x
10643: .if CompileDrive >= DRIVE_1571_05
10644: jsr LA667_PATCH
10645: .elseif CompileDrive >= DRIVE_1571
10646: jsr LA667
10647: .else
10648: jsr LD586
10649: .endif
10650: lda JOBNUM
10651: asl a
10652: tax
10653: lda #$02
10654: sta BUFTAB0,x
10655: lda (BUFTAB0,x)
10656: ldx DRVNUM
10657: sta DSKVER,x
10658: lda #$00
10659: .if CompileDrive >= DRIVE_1570
10660: jmp LAA1D
10661: FillNOP 1
10662: .elseif CompileDrive >= DRIVE_1541C_02
10663: jmp LFFC7
10664: FillNOP 1
10665: .else
10666: sta WPSW,x
10667: sta NODRV,x
10668: .endif
10669: LD075:
10670: jsr LEF3A
10671: ldy #$04
10672: lda #$00
10673: tax
10674: LD07D:
10675: clc
10676: adc (BMPNT),y
10677: bcc LD083
10678: inx
10679: LD083:
10680: iny
10681: iny
10682: iny
10683: iny
10684: cpy #$48
10685: beq LD083
10686: cpy #$90
10687: bne LD07D
10688: pha
10689: txa
10690: ldx DRVNUM
10691: sta NDBH,x
10692: pla
10693: .if CompileDrive >= DRIVE_1571
10694: jmp LA951
10695: .else
10696: sta NDBL,x
10697: .endif
10698: rts
10699: LD09B:
10700: jsr LD6D0
10701: jsr LD0C3
10702: jsr LD599
10703: jsr LD137
10704: sta TRACK
10705: jsr LD137
10706: sta SECTOR
10707: rts
10708: LD0AF:
10709: jsr LD09B
10710: lda TRACK
10711: bne LD0B7
10712: rts
10713: LD0B7:
10714: jsr LCF1E
10715: jsr LD6D0
10716: jsr LD0C3
10717: jmp LCF1E
10718: LD0C3:
10719: lda #$80
10720: bne LD0C9
10721: LD0C7:
10722: lda #$90
10723: LD0C9:
10724: sta CMD
10725: jsr LDF93
10726: tax
10727: jsr LD506
10728: txa
10729: pha
10730: asl a
10731: tax
10732: lda #$00
10733: sta BUFTAB0,x
10734: jsr LD125
10735: cmp #$04
10736: bcs LD0E8
10737: inc RECL,x
10738: bne LD0E8
10739: inc RECH,x
10740: LD0E8:
10741: pla
10742: tax
10743: rts
10744: LD0EB:
10745: lda SA
10746: cmp #$13
10747: bcc LD0F3
10748: and #$0F
10749: LD0F3:
10750: cmp #$0F
10751: bne LD0F9
10752: lda #$10
10753: LD0F9:
10754: tax
10755: sec
10756: lda LINTAB,x
10757: bmi LD106
10758: and #$0F
10759: sta LINDX
10760: tax
10761: clc
10762: LD106:
10763: rts
10764: LD107:
10765: lda SA
10766: cmp #$13
10767: bcc LD10F
10768: and #$0F
10769: LD10F:
10770: tax
10771: lda LINTAB,x
10772: tay
10773: asl a
10774: bcc LD121
10775: bmi LD123
10776: LD119:
10777: tya
10778: and #$0F
10779: sta LINDX
10780: tax
10781: clc
10782: rts
10783: LD121:
10784: bmi LD119
10785: LD123:
10786: sec
10787: rts
10788: LD125:
10789: ldx LINDX
10790: lda FILTYP,x
10791: lsr a
10792: and #$07
10793: cmp #$04
10794: rts
10795: LD12F:
10796: jsr LDF93
10797: asl a
10798: tax
10799: ldy LINDX
10800: rts
10801: LD137:
10802: jsr LD12F
10803: lda LSTCHR,y
10804: beq LD151
10805: lda (BUFTAB0,x)
10806: pha
10807: lda BUFTAB0,x
10808: cmp LSTCHR,y
10809: bne LD14D
10810: lda #$FF
10811: sta BUFTAB0,x
10812: LD14D:
10813: pla
10814: inc BUFTAB0,x
10815: rts
10816: LD151:
10817: lda (BUFTAB0,x)
10818: inc BUFTAB0,x
10819: rts
10820: LD156:
10821: jsr LD137
10822: bne LD191
10823: sta DATA
10824: lda LSTCHR,y
10825: beq LD16A
10826: lda #$80
10827: sta CHNRDY,y
10828: lda DATA
10829: rts
10830: LD16A:
10831: jsr LCF1E
10832: lda #$00
10833: jsr LD4C8
10834: jsr LD137
10835: cmp #$00
10836: beq LD192
10837: sta TRACK
10838: jsr LD137
10839: sta SECTOR
10840: jsr LCF1E
10841: jsr LD1D3
10842: jsr LD6D0
10843: jsr LD0C3
10844: jsr LCF1E
10845: lda DATA
10846: LD191:
10847: rts
10848: LD192:
10849: jsr LD137
10850: ldy LINDX
10851: sta LSTCHR,y
10852: lda DATA
10853: rts
10854: LD19D:
10855: jsr LCFF1
10856: beq LD1A3
10857: rts
10858: LD1A3:
10859: jsr LD1D3
10860: jsr LF11E
10861: lda #$00
10862: jsr LD4C8
10863: lda TRACK
10864: jsr LCFF1
10865: lda SECTOR
10866: jsr LCFF1
10867: jsr LD0C7
10868: jsr LCF1E
10869: jsr LD6D0
10870: lda #$02
10871: jmp LD4C8
10872: LD1C6:
10873: sta T0
10874: jsr LD4E8
10875: clc
10876: adc T0
10877: sta BUFTAB0,x
10878: sta DIRBUF
10879: rts
10880: LD1D3:
10881: jsr LDF93
10882: tax
10883: lda LSTJOB,x
10884: and #$01
10885: sta DRVNUM
10886: rts
10887: LD1DF:
10888: sec
10889: bcs LD1E3
10890: LD1E2:
10891: clc
10892: LD1E3:
10893: php
10894: sta T0
10895: jsr LD227
10896: jsr LD37F
10897: sta LINDX
10898: ldx SA
10899: plp
10900: bcc LD1F5
10901: ora #$80
10902: LD1F5:
10903: sta LINTAB,x
10904: and #$3F
10905: tay
10906: lda #$FF
10907: sta BUF0,y
10908: sta BUF1,y
10909: sta SS,y
10910: dec T0
10911: bmi LD226
10912: jsr LD28E
10913: bpl LD217
10914: LD20F:
10915: jsr LD25A
10916: lda #ERRORCODE_70_NO_CHANNEL
10917: jmp GenerateErrorMessage
10918:
10919:
10920: LD217:
10921: sta BUF0,y
10922: dec T0
10923: bmi LD226
10924: jsr LD28E
10925: bmi LD20F
10926: sta BUF1,y
10927: LD226:
10928: rts
10929: LD227:
10930: lda SA
10931: cmp #$0F
10932: bne LD22E
10933: rts
10934: LD22E:
10935: ldx SA
10936: lda LINTAB,x
10937: cmp #$FF
10938: beq @LD259
10939: and #$3F
10940: sta LINDX
10941: lda #$FF
10942: sta LINTAB,x
10943: ldx LINDX
10944: lda #$00
10945: sta CHNRDY,x
10946: jsr LD25A
10947: ldx LINDX
10948: lda #$01
10949: @LD24D:
10950: dex
10951: bmi @LD253
10952: asl a
10953: bne @LD24D
10954: @LD253:
10955: ora LINUSE
10956: sta LINUSE
10957: @LD259:
10958: rts
10959:
10960:
10961: LD25A:
10962: ldx LINDX
10963: lda BUF0,x
10964: cmp #$FF
10965: beq @LD26B
10966: pha
10967: lda #$FF
10968: sta BUF0,x
10969: pla
10970: jsr LD2F3
10971: @LD26B:
10972: ldx LINDX
10973: lda BUF1,x
10974: cmp #$FF
10975: beq @LD27C
10976: pha
10977: lda #$FF
10978: sta BUF1,x
10979: pla
10980: jsr LD2F3
10981: @LD27C:
10982: ldx LINDX
10983: lda SS,x
10984: cmp #$FF
10985: beq @LD28D
10986: pha
10987: lda #$FF
10988: sta SS,x
10989: pla
10990: jsr LD2F3
10991: @LD28D:
10992: rts
10993:
10994:
10995: LD28E:
10996: tya
10997: pha
10998: ldy #$01
10999: jsr LD2BA
11000: bpl LD2A3
11001: dey
11002: jsr LD2BA
11003: bpl LD2A3
11004: jsr LD339
11005: tax
11006: bmi LD2B6
11007: LD2A3:
11008: lda JOBS0,x
11009: bmi LD2A3
11010: lda DRVNUM
11011: sta JOBS0,x
11012: sta LSTJOB,x
11013: txa
11014: asl a
11015: tay
11016: lda #$02
11017: sta BUFTAB0,y
11018: LD2B6:
11019: pla
11020: tay
11021: txa
11022: rts
11023: LD2BA:
11024: ldx #$07
11025: LD2BC:
11026: lda BUFUSE,y
11027: and LEFE9,x
11028: beq LD2C8
11029: dex
11030: bpl LD2BC
11031: rts
11032: LD2C8:
11033: lda BUFUSE,y
11034: eor LEFE9,x
11035: sta BUFUSE,y
11036: txa
11037: dey
11038: bmi LD2D8
11039: clc
11040: adc #$08
11041: LD2D8:
11042: tax
11043: LD2D9:
11044: rts
11045: LD2DA:
11046: ldx LINDX
11047: lda BUF0,x
11048: bmi LD2E9
11049: txa
11050: clc
11051: adc #$07
11052: tax
11053: lda BUF0,x
11054: bpl LD2D9
11055: LD2E9:
11056: cmp #$FF
11057: beq LD2D9
11058: pha
11059: lda #$FF
11060: sta BUF0,x
11061: pla
11062:
11063: LD2F3:
11064: and #$0F
11065: tay
11066: iny
11067: ldx #$10
11068: LD2F9:
11069: ror BUFUSE + 1
11070: ror BUFUSE
11071: dey
11072: bne LD303
11073: clc
11074: LD303:
11075: dex
11076: bpl LD2F9
11077: rts
11078: LD307:
11079: lda #$0E
11080: sta SA
11081: LD30B:
11082: jsr LD227
11083: dec SA
11084: bne LD30B
11085: rts
11086:
11087: LD313:
11088: lda #$0E
11089: sta SA
11090: LD317:
11091: ldx SA
11092: lda LINTAB,x
11093: cmp #$FF
11094: beq LD334
11095: and #$3F
11096: sta LINDX
11097: jsr LDF93
11098: tax
11099: lda LSTJOB,x
11100: and #$01
11101: cmp DRVNUM
11102: bne LD334
11103: jsr LD227
11104: LD334:
11105: dec SA
11106: bpl LD317
11107: rts
11108: LD339:
11109: lda T0
11110: pha
11111: ldy #$00
11112: LD33E:
11113: ldx LRUTBL,y
11114: lda BUF0,x
11115: bpl LD348
11116: cmp #$FF
11117: bne LD35E
11118: LD348:
11119: txa
11120: clc
11121: adc #$07
11122: tax
11123: lda BUF0,x
11124: bpl LD355
11125: cmp #$FF
11126: bne LD35E
11127: LD355:
11128: iny
11129: cpy #$05
11130: bcc LD33E
11131: ldx #$FF
11132: bne LD37A
11133: LD35E:
11134: stx T0
11135: and #$3F
11136: tax
11137: LD363:
11138: lda JOBS0,x
11139: bmi LD363
11140: .if CompileDrive >= DRIVE_1571_05
11141: jmp LAA3F
11142: FillNOP 1
11143: .elseif CompileDrive >= DRIVE_1571
11144: cmp #$02
11145: bcc LD373
11146: .elseif CompileDrive >= DRIVE_1570
11147: jmp LAA3F
11148: FillNOP 1
11149: .elseif CompileDrive >= DRIVE_1541C_02
11150: jmp LFF91
11151: FillNOP 1
11152: .else
11153: cmp #$02
11154: bcc LD373
11155: .endif
11156: LD36B:
11157: ldx T0
11158: cpx #$07
11159: bcc LD348
11160: bcs LD355
11161: LD373:
11162: ldy T0
11163: lda #$FF
11164: sta BUF0,y
11165: LD37A:
11166: pla
11167: sta T0
11168: txa
11169: rts
11170: LD37F:
11171: ldy #$00
11172: lda #$01
11173: LD383:
11174: bit LINUSE
11175: bne LD391
11176: iny
11177: asl a
11178: bne LD383
11179: lda #ERRORCODE_70_NO_CHANNEL
11180: jmp GenerateErrorMessage
11181:
11182:
11183: LD391:
11184: eor #$FF
11185: and LINUSE
11186: sta LINUSE
11187: tya
11188: rts
11189: LD39B:
11190: jsr LD0EB
11191: jsr LC100
11192: jsr LD3AA
11193: ldx LINDX
11194: lda L023E,x
11195: rts
11196: LD3AA:
11197: ldx LINDX
11198: jsr LD125
11199: bne LD3B4
11200: jmp LE120
11201: LD3B4:
11202: lda SA
11203: cmp #$0F
11204: beq LD414
11205: lda CHNRDY,x
11206: and #$08
11207: bne LD3D3
11208: jsr LD125
11209: cmp #$07
11210: bne LD3CE
11211: lda #$89
11212: sta CHNRDY,x
11213: jmp LD3DE
11214: LD3CE:
11215: lda #$00
11216: sta CHNRDY,x
11217: rts
11218: LD3D3:
11219: lda SA
11220: beq LD409
11221: jsr LD125
11222: cmp #$04
11223: bcc LD400
11224: LD3DE:
11225: jsr LD12F
11226: lda BUFTAB0,x
11227: cmp LSTCHR,y
11228: bne LD3EC
11229: lda #$00
11230: sta BUFTAB0,x
11231: LD3EC:
11232: inc BUFTAB0,x
11233: LD3EE:
11234: lda (BUFTAB0,x)
11235: sta L023E,y
11236: lda BUFTAB0,x
11237: cmp LSTCHR,y
11238: bne LD3FF
11239: lda #$81
11240: sta CHNRDY,y
11241: LD3FF:
11242: rts
11243: LD400:
11244: jsr LD156
11245: LD403:
11246: ldx LINDX
11247: sta L023E,x
11248: rts
11249: LD409:
11250: lda DIRLST
11251: beq LD400
11252: jsr LED67
11253: jmp LD403
11254: LD414:
11255: jsr LD4E8
11256: cmp #<(ERRBUF - 1)
11257: bne LD433
11258: lda DIRBUF + 1
11259: cmp #>(ERRBUF - 1)
11260: bne LD433
11261: lda #$0D
11262: sta DATA
11263: jsr LC123
11264: lda #ERRORCODE_00_OK
11265: jsr SetErrorCodeNoTS
11266: dec BUFTABERR
11267: lda #$80
11268: bne LD445
11269: LD433:
11270: jsr LD137
11271: sta DATA
11272: bne LD443
11273: LD43A:
11274: lda #<(ERRBUF - 1)
11275: jsr LD4C8
11276: lda #$02
11277: sta BUFTAB0 + 1,x
11278: LD443:
11279: lda #$88
11280: LD445:
11281: sta CHNRDY + 5
11282: lda DATA
11283: sta L0243
11284: rts
11285: LD44D:
11286: jsr LDF93
11287: asl a
11288: tax
11289: lda #$00
11290: sta BUFTAB0,x
11291: lda (BUFTAB0,x)
11292: beq LD45F
11293: dec BUFTAB0,x
11294: jmp LD156
11295: LD45F:
11296: rts
11297: LD460:
11298: lda #$80
11299: bne LD466
11300: LD464:
11301: lda #$90
11302: LD466:
11303: ora DRVNUM
11304: sta CMD
11305: lda JOBNUM
11306: jsr LD6D3
11307: ldx JOBNUM
11308: jmp LD593
11309: LD475:
11310: lda #$01
11311: LD477:
11312: sta TYPE
11313: lda #$11
11314: sta SA
11315: jsr LDC46
11316: lda #$02
11317: jmp LD4C8
11318: LD486:
11319: lda #$12
11320: sta SA
11321: jmp LDCDA
11322: LD48D:
11323: jsr LDE3B
11324: lda #$01
11325: sta T0
11326: lda SECINC
11327: pha
11328: lda #$03
11329: sta SECINC
11330: jsr LF12D
11331: pla
11332: sta SECINC
11333: lda #$00
11334: jsr LD4C8
11335: lda TRACK
11336: jsr LCFF1
11337: lda SECTOR
11338: jsr LCFF1
11339: jsr LD0C7
11340: jsr LD599
11341: lda #$00
11342: jsr LD4C8
11343: LD4BB:
11344: jsr LCFF1
11345: bne LD4BB
11346: jsr LCFF1
11347: lda #$FF
11348: jmp LCFF1
11349: LD4C8:
11350: sta T0
11351: jsr LDF93
11352: asl a
11353: tax
11354: lda BUFTAB0 + 1,x
11355: sta DIRBUF + 1
11356: lda T0
11357: sta BUFTAB0,x
11358: sta DIRBUF
11359: rts
11360: LD4DA:
11361: lda #$11
11362: sta SA
11363: jsr LD227
11364: lda #$12
11365: sta SA
11366: jmp LD227
11367:
11368: LD4E8:
11369: jsr LDF93
11370: LD4EB:
11371: asl a
11372: tax
11373: lda BUFTAB0 + 1,x
11374: sta DIRBUF + 1
11375: lda BUFTAB0,x
11376: sta DIRBUF
11377: rts
11378: LD4F6:
11379: sta T2
11380: jsr LDF93
11381: tax
11382: lda TableHighBytesOfBuffers,x
11383: sta T3
11384: ldy #$00
11385: lda (T2),y
11386: rts
11387: LD506:
11388: lda LSTJOB,x
11389: and #$01
11390: ora CMD
11391: LD50E:
11392: pha
11393: stx JOBNUM
11394: txa
11395: asl a
11396: tax
11397: lda SECTOR0,x
11398: sta CMD
11399: lda TRACK0,x
11400: beq LD54A
11401: cmp MAXTRACK_ADJUSTED
11402: bcs LD54A
11403: tax
11404: pla
11405: pha
11406: and #$F0
11407: cmp #$90
11408: bne LD57A
11409: pla
11410: pha
11411: lsr a
11412: bcs LD535
11413: lda DSKVER
11414: bcc LD538
11415: LD535:
11416: lda DSKVER + 1
11417: LD538:
11418: beq LD53F
11419: cmp LFED5
11420: bne LD572
11421: LD53F:
11422: txa
11423: jsr LF24B
11424: cmp CMD
11425: beq LD54A
11426: bcs LD57A
11427: LD54A:
11428: jsr LD552
11429: LD54D:
11430: lda #ERRORCODE_66_ILLEGAL_TRACK_OR_SECTOR
11431: jmp LE645
11432: LD552:
11433: lda JOBNUM
11434: asl a
11435: tax
11436: lda TRACK0,x
11437: sta TRACK
11438: lda SECTOR0,x
11439: sta SECTOR
11440: rts
11441: LD55F:
11442: lda TRACK
11443: beq LD54D
11444: cmp MAXTRACK_ADJUSTED
11445: bcs LD54D
11446: jsr LF24B
11447: cmp SECTOR
11448: beq LD54D
11449: bcc LD54D
11450: rts
11451: LD572:
11452: jsr LD552
11453: lda #ERRORCODE_73_IDENTIFY
11454: jmp LE645
11455: LD57A:
11456: ldx JOBNUM
11457: pla
11458: sta CMD
11459: sta JOBS0,x
11460: sta LSTJOB,x
11461: rts
11462: LD586:
11463: lda #$80
11464: bne LD58C
11465: LD58A:
11466: lda #$90
11467: LD58C:
11468: ora DRVNUM
11469: ldx JOBNUM
11470: LD590:
11471: sta CMD
11472: LD593:
11473: lda CMD
11474: jsr LD50E
11475: LD599:
11476: jsr LD5A6
11477: bcs LD599
11478: pha
11479: lda #$00
11480: sta JOBRTN
11481: pla
11482: rts
11483: LD5A6:
11484: lda JOBS0,x
11485: bmi LD5C4
11486: cmp #$02
11487: bcc LD5C2
11488: cmp #$08
11489: beq LD5BA
11490: cmp #$0B
11491: beq LD5BA
11492: cmp #$0F
11493: bne LD5C6
11494: LD5BA:
11495: bit JOBRTN
11496: bmi LD5C2
11497: jmp LD63F
11498: LD5C2:
11499: clc
11500: rts
11501: LD5C4:
11502: sec
11503: rts
11504: LD5C6:
11505: tya
11506: pha
11507: lda DRVNUM
11508: pha
11509: lda LSTJOB,x
11510: and #$01
11511: sta DRVNUM
11512: tay
11513: lda DriveLEDMasks,y
11514: sta ERLED
11515: jsr LD6A6
11516: cmp #$02
11517: bcs LD5E3
11518: jmp LD66D
11519: LD5E3:
11520: lda LSTJOB,x
11521: and #$F0
11522: pha
11523: cmp #$90
11524: bne LD5F4
11525: lda DRVNUM
11526: ora #$B8
11527: sta LSTJOB,x
11528: LD5F4:
11529: bit REVCNT
11530: bvs LD631
11531: lda #$00
11532: sta EPTR
11533: sta TOFF
11534: LD600:
11535: ldy EPTR
11536: lda TOFF
11537: sec
11538: sbc LFEDB,y
11539: sta TOFF
11540: lda LFEDB,y
11541: .if CompileDrive >= DRIVE_1570
11542: jsr LFFA1
11543: .elseif CompileDrive = DRIVE_1541C_02
11544: jsr LFF84
11545: .else
11546: jsr LD676
11547: .endif
11548: inc EPTR
11549: jsr LD6A6
11550: cmp #$02
11551: bcc LD625
11552: ldy EPTR
11553: lda LFEDB,y
11554: bne LD600
11555: LD625:
11556: lda TOFF
11557: .if CompileDrive >= DRIVE_1570
11558: jsr LFFA6
11559: .elseif CompileDrive = DRIVE_1541C_02
11560: jsr LFF89
11561: .else
11562: jsr LD676
11563: .endif
11564: lda JOBS0,x
11565: cmp #$02
11566: bcc LD65C
11567: LD631:
11568: bit REVCNT
11569: bpl LD644
11570: LD635:
11571: pla
11572: cmp #$90
11573: bne LD63F
11574: ora DRVNUM
11575: sta LSTJOB,x
11576: LD63F:
11577: lda JOBS0,x
11578: jsr LE60A
11579: LD644:
11580: pla
11581: bit JOBRTN
11582: bmi LD66D
11583: pha
11584: lda #$C0
11585: ora DRVNUM
11586: sta JOBS0,x
11587: LD651:
11588: .if CompileDrive >= DRIVE_1570
11589: jsr L9FB6
11590: FillNOP 1
11591: .else
11592: lda JOBS0,x
11593: bmi LD651
11594: .endif
11595: jsr LD6A6
11596: cmp #$02
11597: bcs LD635
11598: LD65C:
11599: pla
11600: cmp #$90
11601: bne LD66D
11602: ora DRVNUM
11603: sta LSTJOB,x
11604: jsr LD6A6
11605: cmp #$02
11606: bcs LD63F
11607: LD66D:
11608: pla
11609: sta DRVNUM
11610: pla
11611: tay
11612: lda JOBS0,x
11613: clc
11614: rts
11615: LD676:
11616: cmp #$00
11617: beq LD692
11618: bmi LD688
11619: LD67C:
11620: ldy #$01
11621: jsr LD693
11622: sec
11623: sbc #$01
11624: bne LD67C
11625: beq LD692
11626: LD688:
11627: ldy #$FF
11628: jsr LD693
11629: clc
11630: adc #$01
11631: bne LD688
11632: LD692:
11633: rts
11634: LD693:
11635: pha
11636: tya
11637: ldy DRVNUM
11638: sta PHASE,y
11639: LD69A:
11640: cmp PHASE,y
11641: beq LD69A
11642: lda #$00
11643: sta PHASE,y
11644: pla
11645: rts
11646: LD6A6:
11647: lda REVCNT
11648: and #$3F
11649: tay
11650: LD6AB:
11651: lda ERLED
11652: eor VDC_PB2
11653: sta VDC_PB2
11654: lda LSTJOB,x
11655: sta JOBS0,x
11656: LD6B9:
11657: .if CompileDrive >= DRIVE_1570
11658: jsr L9FB6
11659: FillNOP 1
11660: .else
11661: lda JOBS0,x
11662: bmi LD6B9
11663: .endif
11664: cmp #$02
11665: bcc LD6C4
11666: dey
11667: bne LD6AB
11668: LD6C4:
11669: pha
11670: lda ERLED
11671: ora VDC_PB2
11672: sta VDC_PB2
11673: pla
11674: rts
11675: LD6D0:
11676: jsr LDF93
11677: LD6D3:
11678: asl a
11679: tay
11680: lda TRACK
11681: sta TRACK0,y
11682: lda SECTOR
11683: sta SECTOR0,y
11684: lda DRVNUM
11685: asl a
11686: tax
11687: rts
11688: LD6E4:
11689: lda SA
11690: pha
11691: lda LINDX
11692: pha
11693: lda SECTOR
11694: pha
11695: lda TRACK
11696: pha
11697: lda #$11
11698: sta SA
11699: jsr LDE3B
11700: lda TYPE
11701: pha
11702: lda FILDRV
11703: and #$01
11704: sta DRVNUM
11705: ldx JOBNUM
11706: eor LSTJOB,x
11707: lsr a
11708: bcc LD715
11709: ldx #$01
11710: stx DELIND
11711: jsr LC5AC
11712: beq LD730
11713: bne LD73D
11714: LD715:
11715: lda DELSEC
11716: beq LD726
11717: cmp SECTOR
11718: beq LD73D
11719: sta SECTOR
11720: jsr LD460
11721: jmp LD73D
11722: LD726:
11723: lda #$01
11724: sta DELIND
11725: jsr LC617
11726: bne LD73D
11727: LD730:
11728: jsr LD48D
11729: lda SECTOR
11730: sta DELSEC
11731: lda #$02
11732: sta DELIND
11733: LD73D:
11734: lda DELIND
11735: jsr LD4C8
11736: pla
11737: sta TYPE
11738: cmp #$04
11739: bne LD74D
11740: ora #$80
11741: LD74D:
11742: jsr LCFF1
11743: pla
11744: sta FILTRK
11745: jsr LCFF1
11746: pla
11747: sta FILSEC
11748: jsr LCFF1
11749: jsr LDF93
11750: tay
11751: lda FILTBL
11752: tax
11753: lda #$10
11754: jsr LC66E
11755: ldy #$10
11756: lda #$00
11757: LD76F:
11758: sta (DIRBUF),y
11759: iny
11760: cpy #$1B
11761: bcc LD76F
11762: lda TYPE
11763: cmp #$04
11764: bne LD790
11765: ldy #$10
11766: lda TRKSS
11767: sta (DIRBUF),y
11768: iny
11769: lda SECSS
11770: sta (DIRBUF),y
11771: iny
11772: lda REC
11773: sta (DIRBUF),y
11774: LD790:
11775: jsr LD464
11776: pla
11777: sta LINDX
11778: tax
11779: pla
11780: sta SA
11781: lda DELSEC
11782: sta ENTSEC
11783: sta DSEC,x
11784: lda DELIND
11785: sta ENTIND
11786: sta DIND,x
11787: lda TYPE
11788: sta PATTYP
11789: lda DRVNUM
11790: sta FILDRV
11791: rts
11792:
11793:
11794: LD7B4:
11795: lda SA
11796: sta TEMPSA
11797: jsr LC2B3
11798: stx CMDNUM
11799: ldx CMDBUF
11800: lda TEMPSA
11801: bne LD7F3
11802: cpx #$2A
11803: bne LD7F3
11804: lda PRGTRK
11805: beq LD81C
11806: sta TRACK
11807: lda PRGDRV
11808: sta DRVNUM
11809: sta FILDRV
11810: lda #$02
11811: sta PATTYP
11812: lda PRGSEC
11813: sta SECTOR
11814: jsr LC100
11815: jsr LDC46
11816: lda #$04
11817: ora DRVNUM
11818: LD7EB:
11819: ldx LINDX
11820: sta FILTYP,y
11821: jmp CommandEnd
11822: LD7F3:
11823: cpx #$24
11824: bne LD815
11825: lda TEMPSA
11826: bne LD7FF
11827: jmp LDA55
11828: LD7FF:
11829: jsr LC1D1
11830: lda LFE85
11831: sta TRACK
11832: lda #$00
11833: sta SECTOR
11834: jsr LDC46
11835: lda DRVNUM
11836: ora #$02
11837: jmp LD7EB
11838: LD815:
11839: cpx #$23
11840: bne LD82B
11841: jmp LCB84
11842:
11843:
11844: LD81C:
11845: lda #$02
11846: sta TYPFLG
11847: lda #$00
11848: sta DRVNUM
11849: sta LSTDRV
11850: jsr LD042
11851: LD82B:
11852: jsr LC1E5
11853: bne LD834
11854: ldx #$00
11855: beq LD840
11856: LD834:
11857: txa
11858: beq LD83C
11859: lda #ERRORCODE_30_SYNTAX_ERROR
11860: jmp GenerateErrorMessage
11861:
11862:
11863: LD83C:
11864: dey
11865: beq LD840
11866: dey
11867: LD840:
11868: sty FILTBL
11869: lda #$8D
11870: jsr SearchInCmdline
11871: inx
11872: stx F2CNT
11873: jsr LC312
11874: jsr LC3CA
11875: jsr LC49D
11876: ldx #$00
11877: stx REC
11878: stx MODE
11879: stx TYPE
11880: inx
11881: cpx F1CNT
11882: bcs LD876
11883: jsr LDA09
11884: inx
11885: cpx F1CNT
11886: bcs LD876
11887: cpy #$04
11888: beq LD8B1
11889: jsr LDA09
11890: LD876:
11891: ldx TEMPSA
11892: stx SA
11893: cpx #$02
11894: bcs LD891
11895: stx MODE
11896: lda #$40
11897: sta WBAM
11898: lda TYPE
11899: bne LD8A7
11900: lda #$02
11901: sta TYPE
11902: LD891:
11903: lda TYPE
11904: bne LD8A7
11905: lda PATTYP
11906: and #$07
11907: sta TYPE
11908: lda FILTRK
11909: bne LD8A7
11910: lda #$01
11911: sta TYPE
11912: LD8A7:
11913: lda MODE
11914: cmp #$01
11915: beq LD8C6
11916: jmp LD940
11917: LD8B1:
11918: ldy FILTBL,x
11919: lda CMDBUF,y
11920: sta REC
11921: lda FILTRK
11922: bne LD876
11923: lda #$01
11924: sta MODE
11925: bne LD876
11926: LD8C6:
11927: lda PATTYP
11928: and #$80
11929: tax
11930: bne LD8E1
11931: lda #$20
11932: bit PATTYP
11933: beq LD8D9
11934: jsr LC8B6
11935: jmp LD9E3
11936: LD8D9:
11937: lda FILTRK
11938: bne LD8E1
11939: jmp LD9E3
11940: LD8E1:
11941: lda CMDBUF
11942: cmp #$40
11943: beq LD8F5
11944: txa
11945: bne Error33
11946: lda #ERRORCODE_63_FILE_EXISTS
11947: jmp GenerateErrorMessage
11948:
11949:
11950: Error33:
11951: lda #ERRORCODE_33_SYNTAX_ERROR
11952: jmp GenerateErrorMessage
11953:
11954:
11955: LD8F5:
11956: lda PATTYP
11957: and #$07
11958: cmp TYPE
11959: bne Error64
11960: cmp #$04
11961: beq Error64
11962: jsr LDCDA
11963: lda LINDX
11964: sta WLINDX
11965: lda #$11
11966: sta SA
11967: jsr LD0EB
11968: lda INDEX
11969: jsr LD4C8
11970: ldy #$00
11971: lda (DIRBUF),y
11972: ora #$20
11973: sta (DIRBUF),y
11974: ldy #$1A
11975: lda TRACK
11976: sta (DIRBUF),y
11977: iny
11978: lda SECTOR
11979: sta (DIRBUF),y
11980: ldx WLINDX
11981: lda ENTSEC
11982: sta DSEC,x
11983: lda ENTIND
11984: sta DIND,x
11985: jsr LDE3B
11986: jsr LD464
11987: jmp LD9EF
11988: LD940:
11989: lda FILTRK
11990: bne LD94A
11991: lda #ERRORCODE_62_FILE_NOT_FOUND
11992: jmp GenerateErrorMessage
11993:
11994:
11995: LD94A:
11996: lda MODE
11997: cmp #$03
11998: beq LD95C
11999: lda #$20
12000: bit PATTYP
12001: beq LD95C
12002: lda #ERRORCODE_60_WRITE_FILE_OPEN
12003: jmp GenerateErrorMessage
12004:
12005:
12006: LD95C:
12007: lda PATTYP
12008: and #$07
12009: cmp TYPE
12010: beq LD96A
12011: Error64:
12012: lda #ERRORCODE_64_FILE_TYPE_MISMATCH
12013: jmp GenerateErrorMessage
12014:
12015:
12016: LD96A:
12017: ldy #$00
12018: sty F2PTR
12019: ldx MODE
12020: cpx #$02
12021: bne LD990
12022: cmp #$04
12023: beq Error64
12024: lda (DIRBUF),y
12025: and #$4F
12026: sta (DIRBUF),y
12027: lda SA
12028: pha
12029: lda #$11
12030: sta SA
12031: jsr LDE3B
12032: jsr LD464
12033: pla
12034: sta SA
12035: LD990:
12036: jsr LD9A0
12037: lda MODE
12038: cmp #$02
12039: bne LD9EF
12040: jsr LDA2A
12041: jmp CommandEnd
12042: LD9A0:
12043: ldy #$13
12044: lda (DIRBUF),y
12045: sta TRKSS
12046: iny
12047: lda (DIRBUF),y
12048: sta SECSS
12049: iny
12050: lda (DIRBUF),y
12051: ldx REC
12052: sta REC
12053: txa
12054: beq LD9C3
12055: cmp REC
12056: beq LD9C3
12057: lda #ERRORCODE_50_RECORD_NOT_PRESENT
12058: jsr GenerateErrorMessage
12059: LD9C3:
12060: ldx F2PTR
12061: lda FILTRK,x
12062: sta TRACK
12063: lda FILSEC,x
12064: sta SECTOR
12065: jsr LDC46
12066: ldy LINDX
12067: ldx F2PTR
12068: lda ENTSEC,x
12069: sta DSEC,y
12070: lda ENTIND,x
12071: sta DIND,y
12072: rts
12073: LD9E3:
12074: lda FILDRV
12075: and #$01
12076: sta DRVNUM
12077: jsr LDCDA
12078: jsr LD6E4
12079: LD9EF:
12080: lda SA
12081: cmp #$02
12082: bcs LDA06
12083: jsr LDE3E
12084: lda TRACK
12085: sta PRGTRK
12086: lda DRVNUM
12087: sta PRGDRV
12088: lda SECTOR
12089: sta PRGSEC
12090: LDA06:
12091: jmp LC199
12092: LDA09:
12093: ldy FILTBL,x
12094: lda CMDBUF,y
12095: ldy #$04
12096: LDA11:
12097: dey
12098: bmi LDA1C
12099: cmp LFEB2,y
12100: bne LDA11
12101: sty MODE
12102: LDA1C:
12103: ldy #$05
12104: LDA1E:
12105: dey
12106: bmi LDA29
12107: cmp LFEB6,y
12108: bne LDA1E
12109: sty TYPE
12110: LDA29:
12111: rts
12112: LDA2A:
12113: jsr LCA39
12114: lda #$80
12115: jsr LDDA6
12116: beq LDA2A
12117: jsr LDE95
12118: ldx SECTOR
12119: inx
12120: txa
12121: bne LDA42
12122: jsr LD1A3
12123: lda #$02
12124: LDA42:
12125: jsr LD4C8
12126: ldx LINDX
12127: lda #$01
12128: sta CHNRDY,x
12129: lda #$80
12130: ora LINDX
12131: ldx SA
12132: sta LINTAB,x
12133: rts
12134: LDA55:
12135: lda #$0C
12136: sta CMDNUM
12137: lda #$00
12138: ldx CMDSIZ
12139: dex
12140: beq LDA6D
12141: dex
12142: bne LDA86
12143: lda CMDBUF + 1
12144: jsr CheckForValidDriveNumber
12145: bmi LDA86
12146: LDA6D:
12147: sta FILDRV
12148: inc F1CNT
12149: inc F2CNT
12150: inc FILTBL
12151: lda #$80
12152: sta PATTYP
12153: lda #$2A
12154: sta CMDBUF
12155: sta CMDBUF + 1
12156: bne LDA9E
12157: LDA86:
12158: jsr LC1E5
12159: bne LDA90
12160: jsr LC2DC
12161: ldy #$03
12162: LDA90:
12163: dey
12164: dey
12165: sty FILTBL
12166: jsr LC200
12167: jsr LC398
12168: jsr LC320
12169: LDA9E:
12170: jsr LC3CA
12171: jsr LC7B7
12172: jsr LC49D
12173: jsr LEC9E
12174: jsr LD137
12175: ldx LINDX
12176: sta L023E,x
12177: lda DRVNUM
12178: sta LSTDRV
12179: ora #$04
12180: sta FILTYP,x
12181: lda #$00
12182: sta BUFTABCMD
12183: rts
12184: LDAC0:
12185: lda #$00
12186: sta WBAM
12187: lda SA
12188: bne LDAD4
12189: lda #$00
12190: sta DIRLST
12191: jsr LD227
12192: LDAD1:
12193: jmp LD4DA
12194: LDAD4:
12195: cmp #$0F
12196: beq LDAEC
12197: jsr LDB02
12198: lda SA
12199: cmp #$02
12200: bcc LDAD1
12201: lda ERWORD
12202: bne LDAE9
12203: jmp CommandEnd
12204: LDAE9:
12205: jmp LC1AD
12206: LDAEC:
12207: lda #$0E
12208: sta SA
12209: LDAF0:
12210: jsr LDB02
12211: dec SA
12212: bpl LDAF0
12213: lda ERWORD
12214: bne LDAFF
12215: jmp CommandEnd
12216: LDAFF:
12217: jmp LC1AD
12218: LDB02:
12219: ldx SA
12220: lda LINTAB,x
12221: cmp #$FF
12222: bne LDB0C
12223: rts
12224: LDB0C:
12225: and #$0F
12226: sta LINDX
12227: jsr LD125
12228: cmp #$07
12229: beq LDB26
12230: cmp #$04
12231: beq LDB2C
12232: jsr LD107
12233: bcs LDB29
12234: jsr LDB62
12235: jsr LDBA5
12236: LDB26:
12237: jsr LEEF4
12238: LDB29:
12239: jmp LD227
12240: LDB2C:
12241: jsr LDDF1
12242: jsr LCF1E
12243: jsr LE1CB
12244: ldx SSNUM
12245: stx T4
12246: inc T4
12247: lda #$00
12248: sta T1
12249: sta T2
12250: lda SSIND
12251: sec
12252: sbc #$0E
12253: sta T3
12254: jsr LDF51
12255: ldx LINDX
12256: lda T1
12257: sta RECL,x
12258: lda T2
12259: sta RECH,x
12260: lda #$40
12261: jsr LDDA6
12262: beq LDB5F
12263: jsr LDBA5
12264: LDB5F:
12265: jmp LD227
12266: LDB62:
12267: ldx LINDX
12268: lda RECL,x
12269: ora RECH,x
12270: bne LDB76
12271: jsr LD4E8
12272: cmp #$02
12273: bne LDB76
12274: lda #$0D
12275: jsr LCFF1
12276: LDB76:
12277: jsr LD4E8
12278: cmp #$02
12279: bne LDB8C
12280: jsr LCF1E
12281: ldx LINDX
12282: lda RECL,x
12283: bne LDB88
12284: dec RECH,x
12285: LDB88:
12286: dec RECL,x
12287: lda #$00
12288: LDB8C:
12289: sec
12290: sbc #$01
12291: pha
12292: lda #$00
12293: jsr LD4C8
12294: jsr LCFF1
12295: pla
12296: jsr LCFF1
12297: jsr LD0C7
12298: jsr LD599
12299: jmp LCF1E
12300: LDBA5:
12301: ldx LINDX
12302: stx WLINDX
12303: lda SA
12304: pha
12305: lda DSEC,x
12306: sta SECTOR
12307: lda DIND,x
12308: sta INDEX
12309: lda FILTYP,x
12310: and #$01
12311: sta DRVNUM
12312: lda LFE85
12313: sta TRACK
12314: jsr LDF93
12315: pha
12316: sta JOBNUM
12317: jsr LD460
12318: ldy #$00
12319: lda TableHighBytesOfBuffers,x
12320: sta R1
12321: lda INDEX
12322: sta R0
12323: lda (R0),y
12324: and #$20
12325: beq LDC21
12326: jsr LD125
12327: cmp #$04
12328: beq LDC29
12329: lda (R0),y
12330: and #$8F
12331: sta (R0),y
12332: iny
12333: lda (R0),y
12334: sta TRACK
12335: sty T2
12336: ldy #$1B
12337: lda (R0),y
12338: pha
12339: dey
12340: lda (R0),y
12341: bne LDC06
12342: sta TRACK
12343: pla
12344: sta SECTOR
12345: lda #ERRORCODE_67_ILLEGAL_TRACK_OR_SECTOR
12346: jsr LE645
12347: LDC06:
12348: pha
12349: lda #$00
12350: sta (R0),y
12351: iny
12352: sta (R0),y
12353: pla
12354: ldy T2
12355: sta (R0),y
12356: iny
12357: lda (R0),y
12358: sta SECTOR
12359: pla
12360: sta (R0),y
12361: jsr LC87D
12362: jmp LDC29
12363: LDC21:
12364: lda (R0),y
12365: and #$0F
12366: ora #$80
12367: sta (R0),y
12368: LDC29:
12369: ldx WLINDX
12370: ldy #$1C
12371: lda RECL,x
12372: sta (R0),y
12373: iny
12374: lda RECH,x
12375: sta (R0),y
12376: pla
12377: tax
12378: lda #$90
12379: ora DRVNUM
12380: jsr LD590
12381: pla
12382: sta SA
12383: jmp LD107
12384: LDC46:
12385: lda #$01
12386: jsr LD1E2
12387: jsr LDCB6
12388: lda TYPE
12389: pha
12390: asl a
12391: ora DRVNUM
12392: sta FILTYP,x
12393: jsr LD09B
12394: ldx LINDX
12395: lda TRACK
12396: bne LDC65
12397: lda SECTOR
12398: sta LSTCHR,x
12399: LDC65:
12400: pla
12401: cmp #$04
12402: bne LDCA9
12403: ldy SA
12404: lda LINTAB,y
12405: ora #$40
12406: sta LINTAB,y
12407: lda REC
12408: sta RS,x
12409: jsr LD28E
12410: bpl LDC81
12411: jmp LD20F
12412: LDC81:
12413: ldx LINDX
12414: sta SS,x
12415: ldy TRKSS
12416: sty TRACK
12417: ldy SECSS
12418: sty SECTOR
12419: jsr LD6D3
12420: jsr LDE73
12421: jsr LD599
12422: LDC98:
12423: ldx LINDX
12424: lda #$02
12425: sta NR,x
12426: lda #$00
12427: jsr LD4C8
12428: jsr LE153
12429: jmp LDE3E
12430: LDCA9:
12431: jsr LD156
12432: ldx LINDX
12433: sta L023E,x
12434: lda #$88
12435: sta CHNRDY,x
12436: rts
12437: LDCB6:
12438: ldx LINDX
12439: lda BUF0,x
12440: asl a
12441: .if CompileDrive >= DRIVE_1570 .OR CompileDrive >= DRIVE_1541C_02
12442: bmi LDCC3
12443: .endif
12444: tay
12445: lda #$02
12446: sta BUFTAB0,y
12447: LDCC3:
12448: lda BUF1,x
12449: ora #$80
12450: sta BUF1,x
12451: asl a
12452: .if CompileDrive >= DRIVE_1570 .OR CompileDrive >= DRIVE_1541C_02
12453: bmi LDCD2
12454: .endif
12455: tay
12456: lda #$02
12457: sta BUFTAB0,y
12458: LDCD2:
12459: lda #$00
12460: sta RECL,x
12461: .if CompileDrive >= DRIVE_1570
12462: jmp LA97F
12463: FillNOP 1
12464: .elseif CompileDrive >= DRIVE_1541C_02
12465: jmp LC029
12466: FillNOP 1
12467: .else
12468: sta RECH,x
12469: lda #$00
12470: sta LSTCHR,x
12471: rts
12472: .endif
12473: LDCDA:
12474: jsr LF1A9
12475: lda #$01
12476: jsr LD1DF
12477: jsr LD6D0
12478: jsr LDCB6
12479: ldx LINDX
12480: lda TYPE
12481: pha
12482: asl a
12483: ora DRVNUM
12484: sta FILTYP,x
12485: pla
12486: cmp #$04
12487: beq LDCFD
12488: lda #$01
12489: sta CHNRDY,x
12490: rts
12491: LDCFD:
12492: ldy SA
12493: lda LINTAB,y
12494: and #$3F
12495: ora #$40
12496: sta LINTAB,y
12497: lda REC
12498: sta RS,x
12499: jsr LD28E
12500: bpl LDD16
12501: jmp LD20F
12502: LDD16:
12503: ldx LINDX
12504: sta SS,x
12505: jsr LDEC1
12506: jsr LF11E
12507: lda TRACK
12508: sta TRKSS
12509: lda SECTOR
12510: sta SECSS
12511: ldx LINDX
12512: lda SS,x
12513: jsr LD6D3
12514: lda #$00
12515: jsr LDEE9
12516: lda #$00
12517: jsr LDD8D
12518: lda #$11
12519: jsr LDD8D
12520: lda #$00
12521: jsr LDD8D
12522: lda REC
12523: jsr LDD8D
12524: lda TRACK
12525: jsr LDD8D
12526: lda SECTOR
12527: jsr LDD8D
12528: lda #$10
12529: jsr LDEE9
12530: jsr LDE3E
12531: lda TRACK
12532: jsr LDD8D
12533: lda SECTOR
12534: jsr LDD8D
12535: jsr LDE6C
12536: jsr LD599
12537: lda #$02
12538: jsr LD4C8
12539: ldx LINDX
12540: sec
12541: lda #$00
12542: sbc RS,x
12543: sta NR,x
12544: jsr LE2E2
12545: jsr LDE19
12546: jsr LDE5E
12547: jsr LD599
12548: jsr LEEF4
12549: jmp LDC98
12550: LDD8D:
12551: pha
12552: ldx LINDX
12553: lda SS,x
12554: jmp LCFFD
12555: bcc LDD9D
12556: LDD97:
12557: ldx LINDX
12558: ora FILTYP,x
12559: bne LDDA3
12560: LDD9D:
12561: ldx LINDX
12562: eor #$FF
12563: and FILTYP,x
12564: LDDA3:
12565: sta FILTYP,x
12566: rts
12567: LDDA6:
12568: ldx LINDX
12569: and FILTYP,x
12570: rts
12571: LDDAB:
12572: jsr LDF93
12573: tax
12574: lda LSTJOB,x
12575: and #$F0
12576: cmp #$90
12577: rts
12578: LDDB7:
12579: ldx #$00
12580: LDDB9:
12581: stx T2
12582: lda LINTAB,x
12583: cmp #$FF
12584: bne LDDCA
12585: LDDC2:
12586: ldx T2
12587: inx
12588: cpx #$10
12589: bcc LDDB9
12590: rts
12591: LDDCA:
12592: stx T2
12593: and #$3F
12594: tay
12595: lda FILTYP,y
12596: and #$01
12597: sta T1
12598: ldx ENTFND
12599: lda FILDRV,x
12600: and #$01
12601: cmp T1
12602: bne LDDC2
12603: lda DSEC,y
12604: cmp ENTSEC,x
12605: bne LDDC2
12606: lda DIND,y
12607: cmp ENTIND,x
12608: bne LDDC2
12609: clc
12610: rts
12611:
12612: LDDF1:
12613: jsr LDF9E
12614: bvc LDDFC
12615: jsr LDE5E
12616: jsr LD599
12617: LDDFC:
12618: rts
12619: LDDFD:
12620: jsr LDE2B
12621: lda TRACK
12622: sta (DIRBUF),y
12623: iny
12624: lda SECTOR
12625: sta (DIRBUF),y
12626: jmp LE105
12627: LDE0C:
12628: jsr LDE2B
12629: lda (DIRBUF),y
12630: sta TRACK
12631: iny
12632: lda (DIRBUF),y
12633: sta SECTOR
12634: rts
12635: LDE19:
12636: jsr LDE2B
12637: lda #$00
12638: sta (DIRBUF),y
12639: iny
12640: ldx LINDX
12641: lda NR,x
12642: tax
12643: dex
12644: txa
12645: sta (DIRBUF),y
12646: rts
12647: LDE2B:
12648: jsr LDF93
12649: asl a
12650: tax
12651: lda BUFTAB0 + 1,x
12652: sta DIRBUF + 1
12653: lda #$00
12654: sta DIRBUF
12655: ldy #$00
12656: rts
12657: LDE3B:
12658: jsr LD0EB
12659: LDE3E:
12660: jsr LDF93
12661: sta JOBNUM
12662: asl a
12663: tay
12664: lda TRACK0,y
12665: sta TRACK
12666: lda SECTOR0,y
12667: sta SECTOR
12668: rts
12669: LDE50:
12670: lda #$90
12671: sta CMD
12672: bne LDE7F
12673: LDE57:
12674: lda #$80
12675: sta CMD
12676: bne LDE7F
12677: LDE5E:
12678: lda #$90
12679: sta CMD
12680: bne LDE8B
12681: lda #$80
12682: sta CMD
12683: bne LDE8B
12684: LDE6C:
12685: lda #$90
12686: sta CMD
12687: bne LDE75
12688: LDE73:
12689: lda #$80
12690: LDE75:
12691: sta CMD
12692: ldx LINDX
12693: lda SS,x
12694: tax
12695: bpl LDE92
12696: LDE7F:
12697: jsr LD6D0
12698: jsr LDF93
12699: tax
12700: lda DRVNUM
12701: sta LSTJOB,x
12702: LDE8B:
12703: jsr LE115
12704: jsr LDF93
12705: tax
12706: LDE92:
12707: jmp LD506
12708: LDE95:
12709: lda #$00
12710: jsr LD4C8
12711: jsr LD137
12712: sta TRACK
12713: jsr LD137
12714: sta SECTOR
12715: rts
12716: LDEA5:
12717: pha
12718: lda #$00
12719: sta T0
12720: sta T2
12721: lda TableHighBytesOfBuffers,y
12722: sta T1
12723: lda TableHighBytesOfBuffers,x
12724: sta T3
12725: pla
12726: tay
12727: dey
12728: LDEB9:
12729: lda (T0),y
12730: sta (T2),y
12731: dey
12732: bpl LDEB9
12733: rts
12734: LDEC1:
12735: tay
12736: lda TableHighBytesOfBuffers,y
12737: sta T1
12738: lda #$00
12739: sta T0
12740: tay
12741: LDECC:
12742: sta (T0),y
12743: iny
12744: bne LDECC
12745: rts
12746: LDED2:
12747: lda #$00
12748: jsr LDEDC
12749: ldy #$02
12750: lda (DIRBUF),y
12751: rts
12752: LDEDC:
12753: sta DIRBUF
12754: ldx LINDX
12755: lda SS,x
12756: tax
12757: lda TableHighBytesOfBuffers,x
12758: sta DIRBUF + 1
12759: rts
12760: LDEE9:
12761: pha
12762: jsr LDEDC
12763: pha
12764: txa
12765: asl a
12766: tax
12767: pla
12768: sta BUFTAB0 + 1,x
12769: pla
12770: sta BUFTAB0,x
12771: rts
12772: LDEF8:
12773: jsr LDF66
12774: bmi LDF0B
12775: bvc LDF12
12776: ldx LINDX
12777: lda SS,x
12778: jsr LDF1B
12779: jsr LDF66
12780: bpl LDF12
12781: LDF0B:
12782: jsr LE1CB
12783: bit LFECE
12784: rts
12785: LDF12:
12786: lda SSIND
12787: jsr LDEE9
12788: bit LFECD
12789: rts
12790: LDF1B:
12791: sta JOBNUM
12792: lda #$80
12793: bne LDF25
12794: sta JOBNUM
12795: lda #$90
12796: LDF25:
12797: pha
12798: lda FILTYP,x
12799: and #$01
12800: sta DRVNUM
12801: pla
12802: ora DRVNUM
12803: sta CMD
12804: lda (DIRBUF),y
12805: sta TRACK
12806: iny
12807: lda (DIRBUF),y
12808: sta SECTOR
12809: lda JOBNUM
12810: jsr LD6D3
12811: ldx JOBNUM
12812: jmp LD593
12813: LDF45:
12814: ldx LINDX
12815: lda SS,x
12816: jmp LD4EB
12817: LDF4C:
12818: lda #$78
12819: jsr LDF5C
12820: LDF51:
12821: dex
12822: bpl LDF4C
12823: lda T3
12824: lsr a
12825: jsr LDF5C
12826: lda T4
12827: LDF5C:
12828: clc
12829: adc T1
12830: sta T1
12831: bcc LDF65
12832: inc T2
12833: LDF65:
12834: rts
12835: LDF66:
12836: jsr LDED2
12837: cmp SSNUM
12838: bne LDF7B
12839: ldy SSIND
12840: lda (DIRBUF),y
12841: beq LDF77
12842: bit LFECD
12843: rts
12844: LDF77:
12845: bit LFECF
12846: rts
12847: LDF7B:
12848: lda SSNUM
12849: cmp #$06
12850: bcs LDF8B
12851: asl a
12852: tay
12853: lda #$04
12854: sta DIRBUF
12855: lda (DIRBUF),y
12856: bne LDF8F
12857: LDF8B:
12858: bit LFED0
12859: rts
12860: LDF8F:
12861: bit LFECE
12862: rts
12863: LDF93:
12864: ldx LINDX
12865: lda BUF0,x
12866: bpl @LDF9B
12867: lda BUF1,x
12868: @LDF9B:
12869: and # ~ $40
12870: rts
12871:
12872:
12873: LDF9E:
12874: ldx LINDX
12875: stx LBUSED
12876: lda BUF0,x
12877: bpl @LDFB0
12878: txa
12879: clc
12880: adc #$07
12881: sta LBUSED
12882: lda BUF1,x
12883: @LDFB0:
12884: sta T1
12885: and #$1F
12886: bit T1
12887: rts
12888:
12889:
12890: LDFB7:
12891: ldx LINDX
12892: lda BUF0,x
12893: bmi @LDFBF
12894: lda BUF1,x
12895: @LDFBF:
12896: cmp #$FF
12897: rts
12898:
12899:
12900: LDFC2:
12901: ldx LINDX
12902: ora #$80
12903: ldy BUF0,x
12904: bpl @LDFCD
12905: sta BUF0,x
12906: rts
12907:
12908: @LDFCD:
12909: sta BUF1,x
12910: rts
12911:
12912:
12913: LDFD0:
12914: lda #$20
12915: jsr LDD9D
12916: lda #$80
12917: jsr LDDA6
12918: bne LE01D
12919: ldx LINDX
12920: inc RECL,x
12921: bne @LDFE4
12922: inc RECH,x
12923: @LDFE4:
12924: ldx LINDX
12925: lda NR,x
12926: beq LE018
12927: jsr LD4E8
12928: ldx LINDX
12929: cmp NR,x
12930: bcc @LDFF6
12931: jsr LE03C
12932: @LDFF6:
12933: ldx LINDX
12934: lda NR,x
12935: jsr LD4C8
12936: lda (BUFTAB0,x)
12937: sta DATA
12938: lda #$20
12939: jsr LDD9D
12940: jsr LE304
12941:
12942: LE009:
12943: pha
12944: bcc LE034
12945: lda #$00
12946: jsr LD4F6
12947: bne LE034
12948: pla
12949: cmp #$02
12950: beq LE02A
12951: LE018:
12952: lda #$80
12953: jsr LDD97
12954: LE01D:
12955: jsr LD12F
12956: lda BUFTAB0,x
12957: sta LSTCHR,y
12958: lda #$0D
12959: sta DATA
12960: rts
12961:
12962:
12963: LE02A:
12964: jsr LE035
12965: ldx LINDX
12966: lda #$00
12967: sta NR,x
12968: rts
12969: LE034:
12970: pla
12971: LE035:
12972: ldx LINDX
12973: sta NR,x
12974: jmp LE16E
12975: LE03C:
12976: jsr LD1D3
12977: jsr LDE95
12978: jsr LDF9E
12979: bvc @LE05D
12980: jsr LDE5E
12981: jsr LCF1E
12982: lda #$02
12983: jsr LD4C8
12984: jsr LDDAB
12985: bne @LE07B
12986: jsr LDE57
12987: jmp LD599
12988:
12989: @LE05D:
12990: jsr LCF1E
12991: jsr LDDAB
12992: bne @LE06B
12993: jsr LDE57
12994: jsr LD599
12995: @LE06B:
12996: jsr LDE95
12997: lda TRACK
12998: beq @LE07B
12999: jsr LCF1E
13000: jsr LDE57
13001: jsr LCF1E
13002: @LE07B:
13003: rts
13004:
13005:
13006: LE07C:
13007: jsr LE105
13008: jsr LDF93
13009: asl a
13010: tax
13011: lda DATA
13012: sta (BUFTAB0,x)
13013: ldy BUFTAB0,x
13014: iny
13015: bne @LE096
13016: ldy LINDX
13017: lda NR,y
13018: beq @LE09E
13019: ldy #$02
13020: @LE096:
13021: tya
13022: ldy LINDX
13023: cmp NR,y
13024: bne @LE0A3
13025: @LE09E:
13026: lda #$20
13027: jmp LDD97
13028: @LE0A3:
13029: inc BUFTAB0,x
13030: bne @LE0AA
13031: jsr LE03C
13032: @LE0AA:
13033: rts
13034:
13035:
13036: LE0AB:
13037: lda #$A0
13038: jsr LDDA6
13039: bne LE0D9
13040: LE0B2:
13041: lda DATA
13042: jsr LE07C
13043: lda EIOFLG
13044: beq LE0C8
13045: rts
13046: LE0BC:
13047: lda #$20
13048: jsr LDDA6
13049: beq LE0C8
13050: lda #ERRORCODE_51_OVERFLOW_IN_RECORD
13051: sta ERWORD
13052: LE0C8:
13053: jsr LE0F3
13054: jsr LE153
13055: lda ERWORD
13056: beq @LE0D6
13057: jmp GenerateErrorMessage
13058:
13059:
13060: @LE0D6:
13061: jmp SetNoError
13062:
13063:
13064: LE0D9:
13065: and #$80
13066: bne LE0E2
13067: lda EIOFLG
13068: beq LE0BC
13069: rts
13070: LE0E2:
13071: lda DATA
13072: pha
13073: jsr LE31C
13074: pla
13075: sta DATA
13076: lda #$80
13077: jsr LDD9D
13078: jmp LE0B2
13079: LE0F3:
13080: lda #$20
13081: jsr LDDA6
13082: bne @LE104
13083: lda #$00
13084: sta DATA
13085: jsr LE07C
13086: jmp LE0F3
13087: @LE104:
13088: rts
13089: LE105:
13090: lda #$40
13091: jsr LDD97
13092: jsr LDF9E
13093: ora #$40
13094: ldx LBUSED
13095: sta BUF0,x
13096: rts
13097: LE115:
13098: jsr LDF9E
13099: and #$BF
13100: ldx LBUSED
13101: sta BUF0,x
13102: rts
13103: LE120:
13104: lda #$80
13105: jsr LDDA6
13106: bne LE15E
13107: jsr LD12F
13108: lda BUFTAB0,x
13109: cmp LSTCHR,y
13110: beq LE153
13111: inc BUFTAB0,x
13112: bne LE13B
13113: jsr LE03C
13114: LE138:
13115: jsr LD12F
13116: LE13B:
13117: lda (BUFTAB0,x)
13118: LE13D:
13119: sta L023E,y
13120: lda #$89
13121: sta CHNRDY,y
13122: lda BUFTAB0,x
13123: cmp LSTCHR,y
13124: beq LE14D
13125: rts
13126: LE14D:
13127: lda #$81
13128: sta CHNRDY,y
13129: rts
13130: LE153:
13131: jsr LDFD0
13132: jsr LD12F
13133: lda DATA
13134: jmp LE13D
13135: LE15E:
13136: ldx LINDX
13137: lda #$0D
13138: sta L023E,x
13139: lda #$81
13140: sta CHNRDY,x
13141: lda #ERRORCODE_50_RECORD_NOT_PRESENT
13142: jsr GenerateErrorMessage
13143: LE16E:
13144: ldx LINDX
13145: lda NR,x
13146: sta R1
13147: dec R1
13148: cmp #$02
13149: bne LE17E
13150: lda #$FF
13151: sta R1
13152: LE17E:
13153: lda RS,x
13154: sta R2
13155: jsr LD4E8
13156: ldx LINDX
13157: cmp R1
13158: bcc LE1A4
13159: beq LE1A4
13160: jsr LCF1E
13161: jsr LE1B2
13162: bcc LE19D
13163: ldx LINDX
13164: sta LSTCHR,x
13165: jmp LCF1E
13166: LE19D:
13167: jsr LCF1E
13168: lda #$FF
13169: sta R1
13170: LE1A4:
13171: jsr LE1B2
13172: bcs LE1AC
13173: jsr LD4E8
13174: LE1AC:
13175: ldx LINDX
13176: sta LSTCHR,x
13177: rts
13178: LE1B2:
13179: jsr LDE2B
13180: ldy R1
13181: LE1B7:
13182: lda (DIRBUF),y
13183: bne LE1C8
13184: dey
13185: cpy #$02
13186: bcc LE1C4
13187: dec R2
13188: bne LE1B7
13189: LE1C4:
13190: dec R2
13191: clc
13192: rts
13193: LE1C8:
13194: tya
13195: sec
13196: rts
13197: LE1CB:
13198: jsr LDED2
13199: sta SSNUM
13200: lda #$04
13201: sta DIRBUF
13202: ldy #$0A
13203: bne LE1DC
13204: LE1D8:
13205: dey
13206: dey
13207: bmi LE202
13208: LE1DC:
13209: lda (DIRBUF),y
13210: beq LE1D8
13211: tya
13212: lsr a
13213: cmp SSNUM
13214: beq LE1EF
13215: sta SSNUM
13216: ldx LINDX
13217: lda SS,x
13218: jsr LDF1B
13219: LE1EF:
13220: ldy #$00
13221: sty DIRBUF
13222: lda (DIRBUF),y
13223: bne LE202
13224: iny
13225: lda (DIRBUF),y
13226: tay
13227: dey
13228: sty SSIND
13229: tya
13230: jmp LDEE9
13231: LE202:
13232: lda #ERRORCODE_67_ILLEGAL_TRACK_OR_SECTOR
13233: jsr LE645
13234: cmd_position:
13235: jsr LC2B3
13236: lda CMDBUF + 1
13237: sta SA
13238: jsr LD0EB
13239: bcc LE219
13240: lda #ERRORCODE_70_NO_CHANNEL
13241: jsr GenerateErrorMessage
13242: LE219:
13243: lda #$A0
13244: jsr LDD9D
13245: jsr LD125
13246: beq LE228
13247: lda #ERRORCODE_64_FILE_TYPE_MISMATCH
13248: jsr GenerateErrorMessage
13249: LE228:
13250: lda FILTYP,x
13251: and #$01
13252: sta DRVNUM
13253: lda CMDBUF + 2
13254: sta RECL,x
13255: lda CMDBUF + 3
13256: sta RECH,x
13257: ldx LINDX
13258: lda #$89
13259: sta CHNRDY,x
13260: lda CMDBUF + 4
13261: beq LE253
13262: sec
13263: sbc #$01
13264: beq LE253
13265: cmp RS,x
13266: bcc LE253
13267: lda #ERRORCODE_51_OVERFLOW_IN_RECORD
13268: sta ERWORD
13269: lda #$00
13270: LE253:
13271: sta RECPTR
13272: jsr LCE0E
13273: jsr LDEF8
13274: bvc LE265
13275: lda #$80
13276: jsr LDD97
13277: jmp LE15E
13278: LE265:
13279: jsr LE275
13280: lda #$80
13281: jsr LDDA6
13282: beq LE272
13283: jmp LE15E
13284: LE272:
13285: jmp CommandEnd
13286: LE275:
13287: jsr LE29C
13288: lda RELPTR
13289: jsr LD4C8
13290: ldx LINDX
13291: lda RS,x
13292: sec
13293: sbc RECPTR
13294: bcs LE289
13295: jmp LE202
13296: LE289:
13297: clc
13298: adc RELPTR
13299: bcc LE291
13300: adc #$01
13301: sec
13302: LE291:
13303: jsr LE009
13304: jmp LE138
13305: lda #ERRORCODE_51_OVERFLOW_IN_RECORD
13306: jsr GenerateErrorMessage
13307: LE29C:
13308: lda DIRBUF
13309: sta R3
13310: lda DIRBUF + 1
13311: sta R4
13312: jsr LE2D0
13313: bne LE2AA
13314: rts
13315: LE2AA:
13316: jsr LDDF1
13317: jsr LDE0C
13318: lda TRACK
13319: beq LE2C2
13320: jsr LE2D3
13321: bne LE2BF
13322: jsr LCF1E
13323: jmp LD2DA
13324: LE2BF:
13325: jsr LD2DA
13326: LE2C2:
13327: ldy #$00
13328: lda (R3),y
13329: sta TRACK
13330: iny
13331: lda (R3),y
13332: sta SECTOR
13333: jmp LD0AF
13334: LE2D0:
13335: jsr LDE3E
13336: LE2D3:
13337: ldy #$00
13338: lda (R3),y
13339: cmp TRACK
13340: beq LE2DC
13341: rts
13342: LE2DC:
13343: iny
13344: lda (R3),y
13345: cmp SECTOR
13346: rts
13347: LE2E2:
13348: jsr LDE2B
13349: ldy #$02
13350: lda #$00
13351: LE2E9:
13352: sta (DIRBUF),y
13353: iny
13354: bne LE2E9
13355: jsr LE304
13356: LE2F1:
13357: sta NR,x
13358: tay
13359: lda #$FF
13360: sta (DIRBUF),y
13361: jsr LE304
13362: bcc LE2F1
13363: bne LE303
13364: lda #$00
13365: sta NR,x
13366: LE303:
13367: rts
13368: LE304:
13369: ldx LINDX
13370: lda NR,x
13371: sec
13372: beq LE318
13373: clc
13374: adc RS,x
13375: bcc LE31B
13376: bne LE318
13377: lda #$02
13378: bit LFECC
13379: rts
13380: LE318:
13381: adc #$01
13382: sec
13383: LE31B:
13384: rts
13385: LE31C:
13386: jsr LD1D3
13387: jsr LE1CB
13388: jsr LE29C
13389: jsr LCF7B
13390: lda SSIND
13391: sta R1
13392: lda SSNUM
13393: sta R0
13394: lda #$00
13395: sta R2
13396: lda #$00
13397: sta RECPTR
13398: jsr LCE0E
13399: LE33B:
13400: jsr LEF4D
13401: ldy LINDX
13402: ldx RS,y
13403: dex
13404: txa
13405: clc
13406: adc RELPTR
13407: bcc LE355
13408: inc SSIND
13409: inc SSIND
13410: bne LE355
13411: inc SSNUM
13412: lda #$10
13413: sta SSIND
13414: LE355:
13415: lda R1
13416: clc
13417: adc #$02
13418: jsr LDEE9
13419: lda SSNUM
13420: cmp #$06
13421: bcc LE368
13422: LE363:
13423: lda #ERRORCODE_52_FILE_TOO_LARGE
13424: jsr GenerateErrorMessage
13425: LE368:
13426: lda SSIND
13427: sec
13428: sbc R1
13429: bcs LE372
13430: sbc #$0F
13431: clc
13432: LE372:
13433: sta T3
13434: lda SSNUM
13435: sbc R0
13436: sta T4
13437: ldx #$00
13438: stx T1
13439: stx T2
13440: tax
13441: jsr LDF51
13442: lda T2
13443: bne LE38F
13444: ldx T1
13445: dex
13446: bne LE38F
13447: inc R2
13448: LE38F:
13449: cmp NBTEMP + 1
13450: bcc LE39D
13451: bne LE363
13452: lda NBTEMP
13453: cmp T1
13454: bcc LE363
13455: LE39D:
13456: lda #$01
13457: jsr LD4F6
13458: clc
13459: adc #$01
13460: ldx LINDX
13461: sta NR,x
13462: jsr LF11E
13463: jsr LDDFD
13464: lda R2
13465: bne LE3C8
13466: jsr LDE5E
13467: LE3B6:
13468: jsr LCF1E
13469: jsr LD6D0
13470: jsr LF11E
13471: jsr LDDFD
13472: jsr LE2E2
13473: jmp LE3D4
13474: LE3C8:
13475: jsr LCF1E
13476: jsr LD6D0
13477: jsr LE2E2
13478: jsr LDE19
13479: LE3D4:
13480: jsr LDE5E
13481: jsr LDE0C
13482: lda TRACK
13483: pha
13484: lda SECTOR
13485: pha
13486: jsr LDE3E
13487: lda SECTOR
13488: pha
13489: lda TRACK
13490: pha
13491: jsr LDF45
13492: tax
13493: bne LE3F9
13494: jsr LE44E
13495: lda #$10
13496: jsr LDEE9
13497: inc R0
13498: LE3F9:
13499: pla
13500: jsr LDD8D
13501: pla
13502: jsr LDD8D
13503: pla
13504: sta SECTOR
13505: pla
13506: sta TRACK
13507: beq LE418
13508: lda R0
13509: cmp SSNUM
13510: bne LE3B6
13511: jsr LDF45
13512: cmp SSIND
13513: bcc LE3B6
13514: beq LE3C8
13515: LE418:
13516: jsr LDF45
13517: pha
13518: lda #$00
13519: jsr LDEDC
13520: lda #$00
13521: tay
13522: sta (DIRBUF),y
13523: iny
13524: pla
13525: sec
13526: sbc #$01
13527: sta (DIRBUF),y
13528: jsr LDE6C
13529: jsr LD599
13530: jsr LEEF4
13531: jsr LCE0E
13532: jsr LCF1E
13533: jsr LDEF8
13534: bvs LE444
13535: jmp LE275
13536: LE444:
13537: lda #$80
13538: jsr LDD97
13539: lda #ERRORCODE_50_RECORD_NOT_PRESENT
13540: jsr GenerateErrorMessage
13541: LE44E:
13542: jsr LF11E
13543: jsr LCF1E
13544: jsr LDDF1
13545: jsr LDF93
13546: pha
13547: jsr LDEC1
13548: ldx LINDX
13549: lda SS,x
13550: tay
13551: pla
13552: tax
13553: lda #$10
13554: jsr LDEA5
13555: lda #$00
13556: jsr LDEDC
13557: ldy #$02
13558: lda (DIRBUF),y
13559: pha
13560: lda #$00
13561: jsr LD4C8
13562: pla
13563: clc
13564: adc #$01
13565: sta (DIRBUF),y
13566: asl a
13567: adc #$04
13568: sta R3
13569: tay
13570: sec
13571: sbc #$02
13572: sta R4
13573: lda TRACK
13574: sta R1
13575: sta (DIRBUF),y
13576: iny
13577: lda SECTOR
13578: sta R2
13579: sta (DIRBUF),y
13580: ldy #$00
13581: tya
13582: sta (DIRBUF),y
13583: iny
13584: lda #$11
13585: sta (DIRBUF),y
13586: lda #$10
13587: jsr LD4C8
13588: jsr LDE50
13589: jsr LD599
13590: ldx LINDX
13591: lda SS,x
13592: pha
13593: jsr LDF9E
13594: ldx LINDX
13595: sta SS,x
13596: pla
13597: ldx LBUSED
13598: sta BUF0,x
13599: lda #$00
13600: jsr LD4C8
13601: ldy #$00
13602: lda TRACK
13603: sta (DIRBUF),y
13604: iny
13605: lda SECTOR
13606: sta (DIRBUF),y
13607: jmp LE4DE
13608: LE4D1:
13609: jsr LDF93
13610: ldx LINDX
13611: jsr LDF1B
13612: lda #$00
13613: jsr LD4C8
13614: LE4DE:
13615: dec R4
13616: dec R4
13617: ldy R3
13618: lda R1
13619: sta (DIRBUF),y
13620: iny
13621: lda R2
13622: sta (DIRBUF),y
13623: jsr LDE5E
13624: jsr LD599
13625: ldy R4
13626: cpy #$03
13627: bcs LE4D1
13628: jmp LCF1E
13629:
13630: ErrorCodeTable:
13631: .byte ERRORCODE_00_OK
13632: htasc_floppy_error " OK"
13633:
13634: .byte ERRORCODE_20_READ_ERROR
13635: .byte ERRORCODE_21_READ_ERROR
13636: .byte ERRORCODE_22_READ_ERROR
13637: .byte ERRORCODE_23_READ_ERROR
13638: .byte ERRORCODE_24_READ_ERROR
13639: .byte ERRORCODE_27_READ_ERROR
13640: htasc_floppy_error .sprintf("READ%c", ERRORCODE_09_ERROR)
13641:
13642: .byte ERRORCODE_52_FILE_TOO_LARGE
13643: htasc_floppy_error .sprintf("%c TOO LARGE", ERRORCODE_03_FILE)
13644:
13645: .byte ERRORCODE_50_RECORD_NOT_PRESENT
13646: htasc_floppy_error .sprintf("%c%c PRESENT", ERRORCODE_0B_RECORD, ERRORCODE_06_NOT)
13647:
13648: .byte ERRORCODE_51_OVERFLOW_IN_RECORD
13649: htasc_floppy_error .sprintf("OVERFLOW IN%c", ERRORCODE_0B_RECORD)
13650:
13651: .byte ERRORCODE_25_WRITE_ERROR
13652: .byte ERRORCODE_28_WRITE_ERROR
13653: htasc_floppy_error .sprintf("%c%c", ERRORCODE_0A_WRITE, ERRORCODE_09_ERROR)
13654:
13655: .byte ERRORCODE_26_WRITE_PROTECT_ON
13656: htasc_floppy_error .sprintf("%c PROTECT ON", ERRORCODE_0A_WRITE)
13657:
13658: .byte ERRORCODE_29_DISK_ID_MISMATCH
13659: htasc_floppy_error .sprintf("%c ID%c", ERRORCODE_08_DISK, ERRORCODE_05_MISMATCH)
13660:
13661: .byte ERRORCODE_30_SYNTAX_ERROR
13662: .byte ERRORCODE_31_SYNTAX_ERROR
13663: .byte ERRORCODE_32_SYNTAX_ERROR
13664: .byte ERRORCODE_33_SYNTAX_ERROR
13665: .byte ERRORCODE_34_SYNTAX_ERROR
13666: htasc_floppy_error .sprintf("SYNTAX%c", ERRORCODE_09_ERROR)
13667:
13668: .byte ERRORCODE_60_WRITE_FILE_OPEN
13669: htasc_floppy_error .sprintf("%c%c%c", ERRORCODE_0A_WRITE, ERRORCODE_03_FILE, ERRORCODE_04_OPEN)
13670:
13671: .byte ERRORCODE_63_FILE_EXISTS
13672: htasc_floppy_error .sprintf("%c EXISTS", ERRORCODE_03_FILE)
13673:
13674: .byte ERRORCODE_64_FILE_TYPE_MISMATCH
13675: htasc_floppy_error .sprintf("%c TYPE%c", ERRORCODE_03_FILE, ERRORCODE_05_MISMATCH)
13676:
13677: .byte ERRORCODE_65_NO_BLOCK
13678: htasc_floppy_error "NO BLOCK"
13679:
13680: .byte ERRORCODE_66_ILLEGAL_TRACK_OR_SECTOR
13681: .byte ERRORCODE_67_ILLEGAL_TRACK_OR_SECTOR
13682: htasc_floppy_error "ILLEGAL TRACK OR SECTOR"
13683:
13684: .byte ERRORCODE_61_FILE_NOT_OPEN
13685: htasc_floppy_error .sprintf("%c%c%c", ERRORCODE_03_FILE, ERRORCODE_06_NOT, ERRORCODE_04_OPEN)
13686:
13687: .byte ERRORCODE_39_FILE_NOT_FOUND
13688: .byte ERRORCODE_62_FILE_NOT_FOUND
13689: htasc_floppy_error .sprintf("%c%c%c", ERRORCODE_03_FILE, ERRORCODE_06_NOT, ERRORCODE_07_FOUND)
13690:
13691: .byte ERRORCODE_01_FILES_SCRATCHED
13692: htasc_floppy_error .sprintf("%cS SCRATCHED", ERRORCODE_03_FILE)
13693:
13694: .byte ERRORCODE_70_NO_CHANNEL
13695: htasc_floppy_error "NO CHANNEL"
13696:
13697: .byte ERRORCODE_71_DIR_ERROR
13698: htasc_floppy_error .sprintf("DIR%c", ERRORCODE_09_ERROR)
13699:
13700: .byte ERRORCODE_72_DISK_FULL
13701: htasc_floppy_error .sprintf("%c FULL", ERRORCODE_08_DISK)
13702:
13703: .byte ERRORCODE_73_IDENTIFY
13704: .if CompileDrive >= DRIVE_1571CR
13705: htasc_floppy_error "CBM DOS V3.1 1571"
13706: .elseif CompileDrive >= DRIVE_1571
13707: htasc_floppy_error "CBM DOS V3.0 1571"
13708: .elseif CompileDrive >= DRIVE_1570
13709: htasc_floppy_error "CBM DOS V3.0 1570"
13710: .elseif CompileDrive >= DRIVE_1541
13711: htasc_floppy_error "CBM DOS V2.6 1541"
13712: .elseif CompileDrive >= DRIVE_1540
13713: htasc_floppy_error "CBM DOS V2.6 V170"
13714: .else
13715: htasc_floppy_error "CBM DOS V2.6 2031"
13716: .endif
13717:
13718: .byte ERRORCODE_74_DRIVE_NOT_READY
13719: htasc_floppy_error .sprintf("DRIVE%c READY", ERRORCODE_06_NOT)
13720:
13721:
13722:
13723: .byte ERRORCODE_09_ERROR
13724: htasc_floppy_error "ERROR"
13725:
13726: .byte ERRORCODE_0A_WRITE
13727: htasc_floppy_error "WRITE"
13728:
13729: .byte ERRORCODE_03_FILE
13730: htasc_floppy_error "FILE"
13731:
13732: .byte ERRORCODE_04_OPEN
13733: htasc_floppy_error "OPEN"
13734:
13735: .byte ERRORCODE_05_MISMATCH
13736: htasc_floppy_error "MISMATCH"
13737:
13738: .byte ERRORCODE_06_NOT
13739: htasc_floppy_error "NOT"
13740:
13741: .byte ERRORCODE_07_FOUND
13742: htasc_floppy_error "FOUND"
13743:
13744: .byte ERRORCODE_08_DISK
13745: htasc_floppy_error "DISK"
13746:
13747: .byte ERRORCODE_0B_RECORD
13748: htasc_floppy_error "RECORD"
13749:
13750: ErrorCodeTable_End:
13751:
13752: LE60A:
13753: .if CompileDrive >= DRIVE_1570
13754: jmp LA9B9
13755: .else
13756: pha
13757: stx JOBNUM
13758: .endif
13759:
13760: LE60D:
13761: txa
13762: asl a
13763: tax
13764: lda TRACK0,x
13765: sta TRACK
13766: lda SECTOR0,x
13767: sta SECTOR
13768: pla
13769:
13770:
13771:
13772:
13773:
13774: and #$0F
13775: beq @LE625
13776: cmp #$0F
13777: bne @LE627
13778: lda #ERRORCODE_74_DRIVE_NOT_READY
13779: bne @LE62D
13780: @LE625:
13781: lda #(ERRORCODE_24_READ_ERROR + 2) ^ ERRORCODE_20_READ_ERROR
13782: @LE627:
13783: ora #ERRORCODE_20_READ_ERROR
13784: tax
13785: dex
13786: dex
13787: txa
13788: @LE62D:
13789: pha
13790: lda CMDNUM
13791: cmp #$00
13792: bne @LE644
13793: lda #$FF
13794: sta CMDNUM
13795: pla
13796: jsr SetErrorCode
13797: jsr LD042
13798: jmp LE648
13799: @LE644:
13800: pla
13801:
13802: LE645:
13803: jsr SetErrorCode
13804: LE648:
13805: jsr ClearCMDBUF
13806: lda #$00
13807: sta WBAM
13808: jsr LC12C
13809: jsr LD4DA
13810: lda #$00
13811: sta BUFTABCMD
13812: ldx #<SP_END
13813: txs
13814: lda ORGSA
13815: and #$0F
13816: sta SA
13817: cmp #$0F
13818: beq LE698
13819: sei
13820: lda LSNACT
13821: bne LE688
13822: lda TLKACT
13823: bne LE680
13824: ldx SA
13825: lda LINTAB,x
13826: cmp #$FF
13827: beq LE698
13828: and #$0F
13829: sta LINDX
13830: jmp LE68E
13831: LE680:
13832: jsr LD0EB
13833: .if CompileDrive >= DRIVE_1541_05
13834: FillNOP 3
13835: .elseif CompileDrive >= DRIVE_1540
13836: jsr LEA4E
13837: .else
13838: jsr LEA7C
13839: .endif
13840: bne LE68E
13841: LE688:
13842: jsr LD107
13843: .if CompileDrive >= DRIVE_1541_05
13844: FillNOP 3
13845: .elseif CompileDrive >= DRIVE_1540
13846: jsr LEA4E
13847: .else
13848: jsr LEA85
13849: .endif
13850: LE68E:
13851: jsr LD125
13852: cmp #$04
13853: bcs LE698
13854: jsr LD227
13855: LE698:
13856: .if CompileDrive >= DRIVE_1570
13857: jmp MainLoopEntry1570
13858:
13859: .else
13860: jmp MainLoopEntry
13861:
13862: .endif
13863:
13864: OutputBinIntoBUFTABERR:
13865:
13866: tax
13867:
13868:
13869:
13870:
13871:
13872:
13873:
13874:
13875:
13876: .if CompileDrive >= DRIVE_1571_05
13877:
13878: jmp Convert_Bin_To_BCD_Patch_157x
13879: CONVERT_BIN_TO_BCD_PARTIAL
13880:
13881: .elseif CompileDrive >= DRIVE_1541C_02 .AND CompileDrive < DRIVE_1570
13882:
13883: jmp Convert_Bin_To_BCD_Patch_154x
13884: CONVERT_BIN_TO_BCD_PARTIAL
13885:
13886: .else
13887: CONVERT_BIN_TO_BCD
13888: .endif
13889:
13890:
13891:
13892: OutputBCDIntoBUFTABERR:
13893: cld
13894:
13895:
13896:
13897:
13898: OutputBCDIntoBUFTABERR_NoCLD:
13899: tax
13900:
13901:
13902: lsr a
13903: lsr a
13904: lsr a
13905: lsr a
13906:
13907:
13908: jsr @OutputBCDDigitInA
13909:
13910:
13911: txa
13912:
13913: @OutputBCDDigitInA:
13914: and #$0F
13915: ora #'0'
13916:
13917:
13918: sta (BUFTABERR),y
13919: iny
13920:
13921: rts
13922:
13923:
13924: SetNoError:
13925: jsr LC123
13926:
13927: lda #$00
13928:
13929: SetErrorCodeNoTS:
13930: ldy #$00
13931: sty TRACK
13932: sty SECTOR
13933:
13934: SetErrorCode:
13935:
13936: ldy #$00
13937: ldx #<ERRBUF
13938: stx BUFTABERR
13939: ldx #>ERRBUF
13940: stx BUFTABERR + 1
13941:
13942:
13943: jsr OutputBCDIntoBUFTABERR_NoCLD
13944:
13945:
13946: lda #','
13947: sta (BUFTABERR),y
13948: iny
13949:
13950:
13951: lda ERRBUF
13952: sta L0243
13953:
13954:
13955:
13956: txa
13957:
13958:
13959: jsr OutputErrorText
13960:
13961:
13962: lda #','
13963: sta (BUFTABERR),y
13964: iny
13965:
13966:
13967: lda TRACK
13968: jsr OutputBinIntoBUFTABERR
13969:
13970:
13971: lda #','
13972: sta (BUFTABERR),y
13973: iny
13974:
13975:
13976: lda SECTOR
13977: jsr OutputBinIntoBUFTABERR
13978:
13979:
13980: dey
13981: tya
13982: clc
13983: adc #<ERRBUF
13984:
13985:
13986:
13987:
13988: sta LSTCHR + 5
13989: inc BUFTABERR
13990:
13991:
13992: lda #$88
13993: sta CHNRDY + 5
13994: rts
13995:
13996:
13997:
13998:
13999:
14000:
14001:
14002: OutputErrorText:
14003: tax
14004:
14005:
14006: lda R0
14007: pha
14008: lda R0+1
14009: pha
14010:
14011:
14012: lda #<ErrorCodeTable
14013: sta R0
14014: lda #>ErrorCodeTable
14015: sta R0+1
14016: txa
14017:
14018: ldx #$00
14019:
14020: @CompareErrorCode:
14021: cmp (R0,x)
14022: beq @Found
14023:
14024: pha
14025:
14026: jsr ReadCurrentByteFromErrorTableAndIncrementAfterwards
14027: bcc @RetryTestIfNotEndOfTable
14028:
14029:
14030:
14031:
14032: @SkipErrorText:
14033: jsr ReadCurrentByteFromErrorTableAndIncrementAfterwards
14034: bcc @SkipErrorText
14035:
14036: @RetryTestIfNotEndOfTable:
14037:
14038:
14039: lda R0+1
14040: cmp #>ErrorCodeTable_End
14041: bcc @CheckNextErrorCode
14042:
14043: bne @ErrorTableExhausted
14044:
14045: lda #<ErrorCodeTable_End
14046: cmp R0
14047: bcc @ErrorTableExhausted
14048:
14049: @CheckNextErrorCode:
14050: pla
14051: jmp @CompareErrorCode
14052:
14053: @ErrorTableExhausted:
14054: pla
14055: jmp @RestoreFromStackAndExit
14056:
14057:
14058: @Found:
14059:
14060:
14061:
14062:
14063: @SkipOtherErrorCodes:
14064: jsr ReadNextByteFromErrorTable
14065: bcc @SkipOtherErrorCodes
14066:
14067: @OutputNextCharacter:
14068: jsr @OutputCharacterOrPseudoError
14069: jsr ReadNextByteFromErrorTable
14070: bcc @OutputNextCharacter
14071: jsr @OutputCharacterOrPseudoError
14072:
14073: @RestoreFromStackAndExit:
14074:
14075: pla
14076: sta R0+1
14077: pla
14078: sta R0
14079: rts
14080:
14081:
14082: @OutputCharacterOrPseudoError:
14083: cmp #ERRORCODE_NO_PSEUDO
14084: bcs @StoreCharacter
14085:
14086:
14087:
14088:
14089: tax
14090:
14091: lda #' '
14092: sta (BUFTABERR),y
14093: iny
14094:
14095: txa
14096: jsr OutputErrorText
14097:
14098: rts
14099:
14100: @StoreCharacter:
14101: sta (BUFTABERR),y
14102: iny
14103: rts
14104:
14105:
14106:
14107:
14108:
14109:
14110:
14111: ReadNextByteFromErrorTable:
14112: inc R0
14113: bne ReadCurrentByteFromErrorTable
14114: inc R0+1
14115:
14116:
14117:
14118:
14119:
14120:
14121: ReadCurrentByteFromErrorTable:
14122: lda (R0,x)
14123: asl a
14124: lda (R0,x)
14125: and #$7F
14126: rts
14127:
14128: ReadCurrentByteFromErrorTableAndIncrementAfterwards:
14129: jsr ReadCurrentByteFromErrorTable
14130: inc R0
14131: bne @LE77E
14132: inc R0+1
14133: @LE77E:
14134: rts
14135:
14136:
14137: LE77F:
14138:
14139: .if CompileDrive >= DRIVE_1540
14140: .else
14141:
14142:
14143:
14144: lda VBC_PB1
14145: ora #VBC_PB1_2031_DAV
14146: sta VBC_PB1
14147: lda VBC_DDRB1
14148: and # ~ VBC_PB1_2031_DAV
14149: sta VBC_DDRB1
14150:
14151: .endif
14152: rts
14153:
14154: CheckAutostart:
14155:
14156: .if CompileDrive = DRIVE_1541C_03
14157: FillNOP 34
14158: rts
14159: .elseif CompileDrive >= DRIVE_1541C_02 .AND CompileDrive < DRIVE_1570
14160: jmp TestATN
14161: FillNOP 31
14162: rts
14163: .elseif CompileDrive >= DRIVE_1541_05
14164: rts
14165: FillNOP 33
14166: rts
14167: .elseif CompileDrive >= DRIVE_1540
14168: lda VBC_PB1
14169: tax
14170: and #VBC_PB1_1540_CLOCKIN
14171: beq LE77F
14172: txa
14173: and #VBC_PB1_1540_DATAIN
14174: beq LE77F
14175: cli
14176: LE78E:
14177: lda VBC_PB1
14178: and #VBC_PB1_1540_DATAIN | VBC_PB1_1540_CLOCKIN
14179: bne LE78E
14180: inc F2CNT
14181: inc CMDSIZ
14182: lda #$2A
14183: sta CMDBUF
14184: jmp LE7A8
14185:
14186: .else
14187: lda VBC_PA1
14188: bne LE77F
14189:
14190: lda VBC_DDRB1
14191: ora #VBC_PB1_2031_DAV
14192: sta VBC_DDRB1
14193: lda VBC_PB1
14194: ora #VBC_PB1_2031_DAV
14195: sta VBC_PB1
14196: lda VBC_PB1
14197: and #VBC_PB1_2031_NRFD
14198: beq LE77F
14199: lda VBC_PB1
14200: and # ~ VBC_PB1_2031_DAV
14201: sta VBC_PB1
14202: lda VBC_PB1
14203: and #VBC_PB1_2031_NRFD
14204: bne LE77F
14205: LE7BB:
14206: lda VBC_PA1
14207: beq LE7BB
14208: inc F2CNT
14209: inc CMDSIZ
14210: lda #$2A
14211: sta CMDBUF
14212: jsr LE77F
14213: jmp LE7A8
14214:
14215: .endif
14216:
14217: cmd_ampersand:
14218:
14219: .if CompileDrive >= DRIVE_1570
14220: jmp LA5FE
14221: FillNOP 2
14222: .else
14223: lda #$8D
14224: jsr SearchInCmdline
14225: .endif
14226:
14227: LE7A8:
14228: jsr NoOp
14229: lda F2CNT
14230: pha
14231: lda #$01
14232: sta F2CNT
14233: lda #$FF
14234: sta R0
14235: jsr LC44F
14236: lda FILTRK
14237: bne @LE7C5
14238: lda #ERRORCODE_39_FILE_NOT_FOUND
14239: jsr GenerateErrorMessage
14240: @LE7C5:
14241: pla
14242: sta F2CNT
14243: lda FILTRK
14244: sta TRACK
14245: lda FILSEC
14246: sta SECTOR
14247: lda #$03
14248: jsr LD477
14249: @LE7D8:
14250: lda #$00
14251: sta R1
14252: jsr @LE839
14253: sta R2
14254: jsr @LE84B
14255: jsr @LE839
14256: sta R3
14257: jsr @LE84B
14258: lda R0
14259: beq @LE7FA
14260: lda R2
14261: pha
14262: lda R3
14263: pha
14264: lda #$00
14265: sta R0
14266: @LE7FA:
14267: jsr @LE839
14268: sta R4
14269: jsr @LE84B
14270: @LE802:
14271: jsr @LE839
14272: ldy #$00
14273: sta (R2),y
14274: jsr @LE84B
14275: lda R2
14276: clc
14277: adc #$01
14278: sta R2
14279: bcc @LE817
14280: inc R3
14281: @LE817:
14282: dec R4
14283: bne @LE802
14284: jsr LCA35
14285: lda DATA
14286: cmp R1
14287: beq @LE82C
14288: jsr LDE3E
14289: lda #ERRORCODE_50_RECORD_NOT_PRESENT
14290: jsr LE645
14291: @LE82C:
14292: lda EIOFLG
14293: bne @LE7D8
14294: pla
14295: sta R3
14296: pla
14297: sta R2
14298: jmp (R2)
14299: @LE839:
14300: jsr LCA35
14301: lda EIOFLG
14302: bne @LE848
14303: jsr LDE3E
14304: lda #ERRORCODE_51_OVERFLOW_IN_RECORD
14305: jsr LE645
14306: @LE848:
14307: lda DATA
14308: rts
14309:
14310: @LE84B:
14311: clc
14312: adc R1
14313: adc #$00
14314: sta R1
14315: rts
14316:
14317:
14318:
14319: SetATNPending:
14320: lda VBC_PA1
14321:
14322:
14323:
14324: lda #$01
14325: sta ATNPND
14326: rts
14327:
14328:
14329:
14330:
14331:
14332: ProcessBus:
14333:
14334: sei
14335:
14336:
14337:
14338: lda #$00
14339: sta ATNPND
14340:
14341: .if CompileDrive >= DRIVE_1540
14342:
14343: sta LSNACT
14344: sta TLKACT
14345:
14346: .endif
14347:
14348:
14349:
14350:
14351: ldx #<SP_END
14352: txs
14353:
14354: .if CompileDrive >= DRIVE_1540
14355:
14356: lda #$80
14357: sta EIOFLG
14358: sta ATNMOD
14359: jsr ClearClockOut
14360: jsr SetDataOut
14361:
14362:
14363: lda VBC_PB1
14364: ora #VBC_PB1_1540_ATNA
14365: sta VBC_PB1
14366:
14367: @LE87B:
14368: lda VBC_PB1
14369: bpl LE8D7
14370: and #VBC_PB1_1540_CLOCKIN
14371: bne @LE87B
14372:
14373: @LE884:
14374: jsr LE9C9
14375: cmp #$3F
14376: bne @LE891
14377: lda #$00
14378: sta LSNACT
14379: beq LE902
14380: @LE891:
14381: cmp #$5F
14382: bne @LE89B
14383: lda #$00
14384: sta TLKACT
14385: beq LE902
14386: @LE89B:
14387: cmp TLKADR
14388: bne @LE8A9
14389: lda #$01
14390: sta TLKACT
14391: lda #$00
14392: sta LSNACT
14393: beq @LE8D2
14394: @LE8A9:
14395: cmp LSNADR
14396: bne @LE8B7
14397: lda #$01
14398: sta LSNACT
14399: lda #$00
14400: sta TLKACT
14401: beq @LE8D2
14402: @LE8B7:
14403: tax
14404: and #$60
14405: cmp #$60
14406: bne LE8FD
14407: txa
14408: sta ORGSA
14409: and #$0F
14410: sta SA
14411: lda ORGSA
14412: and #$F0
14413: cmp #$E0
14414: bne LE902
14415: cli
14416: jsr LDAC0
14417: sei
14418: @LE8D2:
14419: bit VBC_PB1
14420: bmi @LE884
14421:
14422: LE8D7:
14423: lda #$00
14424: sta ATNMOD
14425: lda VBC_PB1
14426: and # ~ VBC_PB1_1540_ATNA
14427: sta VBC_PB1
14428: lda LSNACT
14429: beq LE8ED
14430: jsr LEA2E
14431: .if CompileDrive >= DRIVE_1570
14432: jmp MainLoopEntry1570
14433:
14434: .else
14435: jmp MainLoopEntry
14436:
14437: .endif
14438:
14439: LE8ED:
14440: lda TLKACT
14441: beq LE8FA
14442: jsr ClearDataOut
14443: jsr SetClockOut
14444: jsr LE909
14445: LE8FA:
14446: jmp LEA4E
14447: LE8FD:
14448: lda #VBC_PB1_1540_ATNA
14449: sta VBC_PB1
14450: LE902:
14451: bit VBC_PB1
14452: bpl LE8D7
14453: bmi LE902
14454: LE909:
14455: sei
14456: jsr LD0EB
14457: bcs LE915
14458: LE90F:
14459: ldx LINDX
14460: lda CHNRDY,x
14461: bmi LE916
14462: LE915:
14463: rts
14464:
14465:
14466: LE916:
14467: jsr TestATN
14468: jsr ReadIecBusIn
14469: and #VBC_PB1_1540_DATAIN
14470: php
14471: jsr ClearClockOut
14472: plp
14473: beq @LE937
14474:
14475: @LE925:
14476: jsr TestATN
14477: jsr ReadIecBusIn
14478: and #VBC_PB1_1540_DATAIN
14479: bne @LE925
14480: ldx LINDX
14481: lda CHNRDY,x
14482: and #$08
14483: bne @LE94B
14484: @LE937:
14485: jsr TestATN
14486: jsr ReadIecBusIn
14487: and #VBC_PB1_1540_DATAIN
14488: bne @LE937
14489: @LE941:
14490: jsr TestATN
14491: jsr ReadIecBusIn
14492: and #VBC_PB1_1540_DATAIN
14493: beq @LE941
14494: @LE94B:
14495: jsr SetClockOut
14496: jsr TestATN
14497: jsr ReadIecBusIn
14498: and #VBC_PB1_1540_DATAIN
14499: bne @LE94B
14500: lda #$08
14501: sta CONT
14502: @LE95C:
14503: jsr ReadIecBusIn
14504: and #VBC_PB1_1540_DATAIN
14505: bne @LE999
14506: ldx LINDX
14507: lda L023E,x
14508: ror a
14509: sta L023E,x
14510: bcs @LE973
14511: jsr SetDataOut
14512: bne @LE976
14513: @LE973:
14514: jsr ClearDataOut
14515: @LE976:
14516: jsr ClearClockOut
14517: .if CompileDrive >= DRIVE_1541_01
14518: lda DRVTRK + 1
14519: bne @LE980
14520: jsr LFEF3
14521: @LE980:
14522: jsr LFEFB
14523: .else
14524: FillNOP 4
14525: jsr SetClockOut
14526: jsr ClearDataOut
14527: .endif
14528: dec CONT
14529: bne @LE95C
14530: @LE987:
14531: jsr TestATN
14532: jsr ReadIecBusIn
14533: and #VBC_PB1_1540_DATAIN
14534: beq @LE987
14535: cli
14536: jsr LD3AA
14537: sei
14538: jmp LE90F
14539:
14540: @LE999:
14541: jmp LEA4E
14542:
14543:
14544: ClearDataOut:
14545: lda VBC_PB1
14546: and # ~ VBC_PB1_1540_DATAOUT
14547: sta VBC_PB1
14548: rts
14549:
14550:
14551: SetDataOut:
14552: lda VBC_PB1
14553: ora #VBC_PB1_1540_DATAOUT
14554: sta VBC_PB1
14555: rts
14556:
14557:
14558: SetClockOut:
14559: lda VBC_PB1
14560: ora #VBC_PB1_1540_CLOCKOUT
14561: sta VBC_PB1
14562: rts
14563:
14564:
14565: ClearClockOut:
14566: lda VBC_PB1
14567: and # ~ VBC_PB1_1540_CLOCKOUT
14568: sta VBC_PB1
14569: rts
14570:
14571:
14572: ReadIecBusIn:
14573: lda VBC_PB1
14574: cmp VBC_PB1
14575: bne ReadIecBusIn
14576: rts
14577:
14578:
14579: LE9C9:
14580: lda #$08
14581: sta CONT
14582: @LE9CD:
14583: jsr TestATN
14584: jsr ReadIecBusIn
14585: and #VBC_PB1_1540_CLOCKIN
14586: bne @LE9CD
14587:
14588: jsr ClearDataOut
14589:
14590: lda #>$0100
14591: .if CompileDrive >= DRIVE_1541_05
14592: jmp LFF20
14593: .else
14594: sta VBC_T1HC1
14595: .endif
14596: LE9DF:
14597: jsr TestATN
14598: lda VBC_IFR1
14599: and #VIA_IFR_B_T1
14600: bne @LE9F2
14601: jsr ReadIecBusIn
14602: and #VBC_PB1_1540_CLOCKIN
14603: beq LE9DF
14604: bne @LEA0B
14605:
14606:
14607: @LE9F2:
14608: jsr SetDataOut
14609: ldx #$0A
14610: @LE9F7:
14611: dex
14612: bne @LE9F7
14613: jsr ClearDataOut
14614: @LE9FD:
14615: jsr TestATN
14616: jsr ReadIecBusIn
14617: and #VBC_PB1_1540_CLOCKIN
14618: beq @LE9FD
14619: lda #$00
14620: sta EIOFLG
14621: @LEA0B:
14622: lda VBC_PB1
14623: .if CompileDrive >= DRIVE_1541_02
14624: eor #VBC_PB1_1540_DATAIN
14625: lsr a
14626: and #VBC_PB1_1540_CLOCKIN / 2
14627: bne @LEA0B
14628: FillNOP 3
14629: .else
14630: and #VBC_PB1_1540_CLOCKIN
14631: bne @LEA0B
14632: lda VBC_PB1
14633: eor #VBC_PB1_1540_DATAIN
14634: lsr a
14635: .endif
14636: ror DATA
14637: @LEA1A:
14638: jsr TestATN
14639: jsr ReadIecBusIn
14640: and #VBC_PB1_1540_CLOCKIN
14641: beq @LEA1A
14642: dec CONT
14643: bne @LEA0B
14644: jsr SetDataOut
14645: lda DATA
14646: rts
14647:
14648:
14649: LEA2E:
14650: sei
14651: jsr LD107
14652: bcs @LEA39
14653: lda CHNRDY,x
14654: ror a
14655: bcs @LEA44
14656: @LEA39:
14657: lda ORGSA
14658: and #$F0
14659: cmp #$F0
14660: beq @LEA44
14661: jmp LEA4E
14662: @LEA44:
14663: jsr LE9C9
14664: cli
14665: jsr LCFB7
14666: jmp LEA2E
14667:
14668:
14669: LEA4E:
14670: lda #0
14671: sta VBC_PB1
14672: .if CompileDrive >= DRIVE_1570
14673: jmp MainLoopEntry1570
14674:
14675: .else
14676: jmp MainLoopEntry
14677:
14678: .endif
14679:
14680:
14681: jmp ProcessBus
14682:
14683:
14684: TSTATN:
14685: TestATN:
14686: lda ATNMOD
14687: beq @LEA63
14688: lda VBC_PB1
14689: bpl @LEA6B
14690: @LEA62:
14691: rts
14692: @LEA63:
14693: lda VBC_PB1
14694: bpl @LEA62
14695:
14696: .if CompileDrive >= DRIVE_1570
14697: jmp ProcessBus1570
14698: .elseif CompileDrive >= DRIVE_1541C_02
14699: jmp Patch_ClearPALatch_ProcessBus
14700: .else
14701: jmp ProcessBus
14702: .endif
14703:
14704: @LEA6B:
14705:
14706: .if CompileDrive >= DRIVE_1570
14707: jmp LA9AC
14708: .else
14709: jmp LE8D7
14710: .endif
14711:
14712: .else
14713:
14714:
14715:
14716: lda #VBC_PB1_2031_DAV | VBC_PB1_2031_EOI |VBC_PB1_2031_NDAC
14717: ora VBC_PB1
14718: and # ~ (VBC_PB1_2031_TE | VBC_PB1_2031_NRFD)
14719: sta VBC_PB1
14720:
14721: lda #$00
14722: sta VBC_DDRA1
14723:
14724: lda #VBC_PB1_2031_ATNA | VBC_PB1_2031_NRFD | VBC_PB1_2031_NDAC | VBC_PB1_2031_TE
14725: sta VBC_DDRB1
14726:
14727: lda #$FF
14728: sta VBC_PA1
14729:
14730: LE8AA:
14731: lda VBC_PB1
14732: and # ~ VBC_PB1_2031_NDAC
14733: ora #VBC_PB1_2031_NRFD | VBC_PB1_2031_ATNA
14734: sta VBC_PB1
14735:
14736: @LE8B4:
14737: bit VBC_PB1
14738: bvc @LE8BD
14739: bmi @LE8B4
14740: bpl @LE93A
14741:
14742:
14743: @LE8BD:
14744: lda # ~ VBC_PB1_2031_NRFD
14745: and VBC_PB1
14746: sta VBC_PB1
14747: and #VBC_PB1_2031_EOI
14748: sta EIOFLG
14749: lda VBC_PA1
14750: eor #$FF
14751: sta ICMD
14752: lda #VBC_PB1_2031_NDAC
14753: ora VBC_PB1
14754: sta VBC_PB1
14755: ldy #$00
14756: lda ICMD
14757: and #IEEE_LISTEN | IEEE_TALK
14758: cmp #IEEE_TALK
14759: beq @LE90B
14760: cmp #IEEE_LISTEN
14761: beq @LE8EC
14762: cmp #IEEE_OPEN
14763: beq @LE919
14764: bne @LE932
14765:
14766:
14767: @LE8EC:
14768: lda ICMD
14769: cmp LSNADR
14770: beq @LE8FD
14771: cmp #$3F
14772: bne @LE8F8
14773: sty LSNACT
14774: @LE8F8:
14775: sty ADRSED
14776: jmp @LE932
14777:
14778: @LE8FD:
14779: sta LSNACT
14780: sty TLKACT
14781: @LE901:
14782: lda #$20
14783: sta SA
14784: sta ORGSA
14785: sta ADRSED
14786: bne @LE932
14787: @LE90B:
14788: sty TLKACT
14789: lda ICMD
14790: cmp TLKADR
14791: bne @LE8F8
14792: sta TLKACT
14793: sty LSNACT
14794: beq @LE901
14795: @LE919:
14796: lda ADRSED
14797: beq @LE932
14798: lda ICMD
14799: sta ORGSA
14800: pha
14801: and #$0F
14802: sta SA
14803: pla
14804: and #$F0
14805: cmp #$E0
14806: bne @LE932
14807: cli
14808: jsr LDAC0
14809: sei
14810: @LE932:
14811: bit VBC_PB1
14812: bvc @LE932
14813: jmp LE8AA
14814: @LE93A:
14815: lda LSNACT
14816: beq @LE94C
14817: lda # ~ (VBC_PB1_2031_ATNA | VBC_PB1_2031_NRFD)
14818: and VBC_PB1
14819: sta VBC_PB1
14820: jsr LE960
14821: jmp MainLoopEntry
14822:
14823:
14824: @LE94C:
14825: lda # ~ (VBC_PB1_2031_ATNA | VBC_PB1_2031_NDAC)
14826: and VBC_PB1
14827: ora #VBC_PB1_2031_NDAC
14828: sta VBC_PB1
14829: lda TLKACT
14830: beq @LE95D
14831: jsr LEA0A
14832: @LE95D:
14833: jmp MainLoopEntry
14834:
14835:
14836: LE960:
14837: sei
14838: lda #VBC_PB1_2031_NRFD
14839: ora VBC_PB1
14840: sta VBC_PB1
14841: @LE969:
14842: bit VBC_PB1
14843: bmi LE998
14844: bvs @LE969
14845: jsr LD107
14846: bcs @LE97A
14847: lda CHNRDY,x
14848: ror a
14849: bcs LE9CD
14850: @LE97A:
14851: lda ORGSA
14852: and #$F0
14853: cmp #$F0
14854: beq LE9CD
14855: lda SA
14856: cmp #$01
14857: beq LE99B
14858: @LE988:
14859: bit VBC_PB1
14860: bmi LE998
14861: bvc @LE988
14862: lda # ~ VBC_PB1_2031_NDAC
14863: and VBC_PB1
14864: sta VBC_PB1
14865: rts
14866: LE998:
14867: jmp ProcessBus
14868:
14869:
14870: LE99B:
14871: sei
14872: lda # ~ VBC_PB1_2031_NRFD
14873: and VBC_PB1
14874: sta VBC_PB1
14875: lda #VBC_PB1_2031_NDAC
14876: ora VBC_PB1
14877: sta VBC_PB1
14878: @LE9AC:
14879: bit VBC_PB1
14880: bmi LE998
14881: bvc @LE9AC
14882: lda VBC_PB1
14883: and # ~ VBC_PB1_2031_NDAC
14884: sta VBC_PB1
14885: lda #VBC_PB1_2031_NRFD
14886: ora VBC_PB1
14887: sta VBC_PB1
14888: @LE9C3:
14889: bit VBC_PB1
14890: bmi LE998
14891: bvc @LE9C3
14892: jmp LE99B
14893:
14894:
14895: LE9CD:
14896: lda # ~ VBC_PB1_2031_NRFD
14897: and VBC_PB1
14898: sta VBC_PB1
14899: and #VBC_PB1_2031_EOI
14900: sta EIOFLG
14901: lda VBC_PA1
14902: eor #$FF
14903: sta DATA
14904: sei
14905: lda #VBC_PB1_2031_NDAC
14906: ora VBC_PB1
14907: sta VBC_PB1
14908: LE9E9:
14909: bit VBC_PB1
14910: bmi LE998
14911: bvc LE9E9
14912: lda # ~ VBC_PB1_2031_NDAC
14913: and VBC_PB1
14914: sta VBC_PB1
14915: cli
14916: jsr LCFB7
14917: jmp LE960
14918:
14919: LE9FF:
14920: lda #VBC_PB1_2031_DAV | VBC_PB1_2031_EOI
14921: ora VBC_PB1
14922: sta VBC_PB1
14923: jmp MainLoopEntry
14924:
14925: LEA0A:
14926: sei
14927: jsr LD0EB
14928: bcs LEA16
14929: LEA10:
14930: ldx LINDX
14931: lda CHNRDY,x
14932: bmi LEA17
14933: LEA16:
14934: rts
14935: LEA17:
14936: lda #VBC_PB1_2031_DAV | VBC_PB1_2031_TE | VBC_PB1_2031_EOI | VBC_PB1_2031_ATNA
14937: sta VBC_DDRB1
14938: lda #$FF
14939: sta VBC_DDRA1
14940: lda VBC_PB1
14941: ora #VBC_PB1_2031_TE
14942: sta VBC_PB1
14943: lda #VBC_PB1_2031_NRFD
14944: LEA2B:
14945: bit VBC_PB1
14946: bmi LEA79
14947: beq LEA2B
14948: lda L023E,x
14949: eor #$FF
14950: sta VBC_PA1
14951: lda CHNRDY,x
14952: ora # ~ (VBC_PB1_2031_DAV | VBC_PB1_2031_EOI)
14953: and VBC_PB1
14954: sta VBC_PB1
14955: LEA44:
14956: lda VBC_PB1
14957: bmi LEA79
14958: and #VBC_PB1_2031_NRFD | VBC_PB1_2031_NDAC
14959: cmp #VBC_PB1_2031_NRFD | VBC_PB1_2031_NDAC
14960: beq LE9FF
14961: and #VBC_PB1_2031_NRFD
14962: bne LEA44
14963: cli
14964: jsr LD3AA
14965: sei
14966: lda #VBC_PB1_2031_NDAC
14967: LEA5A:
14968: bit VBC_PB1
14969: bmi LEA79
14970: beq LEA5A
14971: lda #$FF
14972: sta VBC_PA1
14973: lda #VBC_PB1_2031_DAV | VBC_PB1_2031_EOI
14974: ora VBC_PB1
14975: sta VBC_PB1
14976: lda #VBC_PB1_2031_NDAC
14977: LEA70:
14978: bit VBC_PB1
14979: bmi LEA79
14980: bne LEA70
14981: beq LEA10
14982:
14983:
14984: LEA79:
14985: jmp ProcessBus
14986: LEA7C:
14987: lda VBC_PB1
14988: ora #VBC_PB1_2031_DAV
14989: sta VBC_PB1
14990: rts
14991: LEA85:
14992: lda #VBC_PB1_2031_NRFD
14993: ora VBC_PB1
14994: and # ~ VBC_PB1_2031_ATNA
14995: sta VBC_PB1
14996: rts
14997: .endif
14998:
14999:
15000:
15001:
15002:
15003:
15004:
15005:
15006: PostFailErrorZP:
15007: ldx #$00
15008: .byte ASM_BIT3
15009:
15010:
15011:
15012:
15013:
15014: PostFailError:
15015: ldx T0
15016:
15017: txs
15018:
15019:
15020: PostFailErrorRestartSequence:
15021: tsx
15022:
15023: PostFailErrorLoop:
15024:
15025:
15026:
15027: lda #VDC_PB2_DRIVE0LED
15028: ora VDC_PB2
15029:
15030: .macro PATCH_POSTFAILERROR
15031: sta VDC_PB2
15032: sta VDC_DDRB2
15033: .endmacro
15034:
15035: .if CompileDrive >= DRIVE_1540
15036: jmp PATCH_PostFailError
15037: .else
15038: PATCH_POSTFAILERROR
15039: .endif
15040:
15041: PATCH_PostFailError_END:
15042: tya
15043:
15044:
15045:
15046: @DelayOuter:
15047: clc
15048:
15049: @DelayInner:
15050: adc #$01
15051: bne @DelayInner
15052:
15053: dey
15054: bne @DelayOuter
15055:
15056:
15057:
15058: lda VDC_PB2
15059: and # ~ VDC_PB2_DRIVELEDS
15060: sta VDC_PB2
15061:
15062: @AdditionalEndDelay:
15063: tya
15064:
15065:
15066:
15067: @DelayOuter2:
15068: clc
15069: @DelayInner2:
15070: adc #$01
15071: bne @DelayInner2
15072:
15073: dey
15074: bne @DelayOuter2
15075:
15076:
15077:
15078:
15079: dex
15080: bpl PostFailErrorLoop
15081:
15082:
15083:
15084:
15085: cpx #-4
15086: bne @AdditionalEndDelay
15087: beq PostFailErrorRestartSequence
15088:
15089:
15090:
15091:
15092:
15093: RESET:
15094: sei
15095: cld
15096:
15097:
15098:
15099: ldx #INIT_VBC_DDRA1
15100:
15101: .if CompileDrive < DRIVE_1540
15102:
15103:
15104:
15105: stx VBC_PA1
15106: .endif
15107:
15108: .if CompileDrive >= DRIVE_1541_05
15109: jmp PATCH_INIT_BC
15110:
15111: .else
15112: stx VBC_DDRA1
15113: .endif
15114:
15115: PATCH_INIT_BC_END:
15116: inx
15117:
15118: .if CompileDrive < DRIVE_1540
15119:
15120:
15121:
15122: lda #VBC_PB1_2031_NATN | VBC_PB1_2031_DAV | VBC_PB1_2031_EOI | VBC_PB1_2031_NDAC | VBC_PB1_2031_NRFD
15123: sta VBC_PB1
15124:
15125:
15126:
15127: lda #VBC_PB1_2031_ATNA | VBC_PB1_2031_TE | VBC_PB1_2031_HDSEL
15128: sta VBC_DDRB1
15129: .endif
15130:
15131:
15132:
15133:
15134:
15135:
15136:
15137:
15138:
15139: ldy #$00
15140: ldx #$00
15141: @PresetZPLocations:
15142: txa
15143: sta $0,x
15144: inx
15145: bne @PresetZPLocations
15146:
15147:
15148: @CheckZPLocation:
15149: txa
15150: cmp $0,x
15151: bne PostFailErrorZP
15152:
15153:
15154: @Inc256Times:
15155: inc $0,x
15156: iny
15157: bne @Inc256Times
15158:
15159:
15160: cmp $0,x
15161: bne PostFailErrorZP
15162:
15163: sty $0,x
15164: lda $0,x
15165: bne PostFailErrorZP
15166:
15167: inx
15168: bne @CheckZPLocation
15169:
15170:
15171:
15172:
15173:
15174:
15175:
15176:
15177:
15178:
15179:
15180:
15181:
15182:
15183:
15184: @CheckNextROM:
15185: inc T0
15186:
15187:
15188:
15189: .if CompileDrive >= DRIVE_1571_05
15190: ldx #$7F
15191: .elseif CompileDrive >= DRIVE_1570
15192: ldx #$80
15193:
15194:
15195: .else
15196:
15197: .endif
15198: stx IP + 1
15199:
15200: .if CompileDrive >= DRIVE_1571_05
15201: inx
15202:
15203:
15204: .endif
15205:
15206: lda #$00
15207: sta IP
15208:
15209: .if CompileDrive >= DRIVE_1570
15210: ldy #<L8002
15211: .else
15212:
15213:
15214: tay
15215:
15216: ldx #>$2000
15217: .endif
15218:
15219: clc
15220:
15221: @NextPage:
15222:
15223: .if CompileDrive >= DRIVE_1570
15224:
15225:
15226: inc IP + 1
15227: .else
15228:
15229: dec IP + 1
15230: .endif
15231:
15232: @AddNextValue:
15233: adc (IP),y
15234: iny
15235: bne @AddNextValue
15236:
15237: dex
15238: bne @NextPage
15239:
15240: .if CompileDrive >= DRIVE_1570
15241: adc #$FF
15242: sta IP + 1
15243:
15244: .else
15245: adc #$00
15246: tax
15247:
15248: cmp IP + 1
15249: .endif
15250: bne @PostFailError
15251:
15252:
15253:
15254:
15255: .if CompileDrive >= DRIVE_1571_05
15256: FillNOP 3
15257: .elseif CompileDrive >= DRIVE_1570
15258: FillNOP 4
15259: .else
15260: cpx #>LC000
15261: bne @CheckNextROM
15262: .endif
15263:
15264:
15265:
15266:
15267: lda #>RAM_PAGE1
15268: sta IP + 1
15269:
15270: inc T0
15271:
15272:
15273:
15274:
15275:
15276:
15277:
15278:
15279:
15280:
15281: ldx #>(RAM_END - RAM_PAGE1 + 1)
15282:
15283:
15284: @RAMPresetValue:
15285:
15286:
15287: tya
15288: clc
15289: adc IP + 1
15290: sta (IP),y
15291: iny
15292: bne @RAMPresetValue
15293:
15294: inc IP + 1
15295: dex
15296: bne @RAMPresetValue
15297:
15298:
15299:
15300: ldx #>(RAM_END - RAM_PAGE1 + 1)
15301:
15302:
15303:
15304: @RAMCheckPreviousPage:
15305: dec IP + 1
15306:
15307: @RAMCheckPageContents:
15308: dey
15309:
15310: tya
15311: clc
15312: adc IP + 1
15313: cmp (IP),y
15314:
15315: bne @PostFailError
15316:
15317: eor #$FF
15318: sta (IP),y
15319:
15320: eor (IP),y
15321: sta (IP),y
15322: bne @PostFailError
15323:
15324: tya
15325: bne @RAMCheckPageContents
15326:
15327: dex
15328: bne @RAMCheckPreviousPage
15329:
15330: beq ShortReset
15331:
15332:
15333: @PostFailError:
15334: jmp PostFailError
15335:
15336:
15337:
15338:
15339: ShortReset:
15340:
15341: .if CompileDrive >= DRIVE_1541C_02
15342: jmp PATCH_ShortReset
15343: .else
15344: ldx #<SP_END
15345: txs
15346: .endif
15347:
15348: PATCH_ShortReset_END:
15349:
15350:
15351:
15352: lda VDC_PB2
15353: and # ~ VDC_PB2_DRIVELEDS
15354: sta VDC_PB2
15355:
15356: .if CompileDrive >= DRIVE_1570
15357: lda #VIA_PCR_B_CA1_INPUT_POS_EDGE | VIA_PCR_B_CA2_INPUT_NEG
15358: .else
15359: lda #VIA_PCR_B_CA1_INPUT_POS_EDGE
15360: .endif
15361: sta VBC_PCR1
15362: lda #VIA_IER_BW_SET | VIA_IER_B_CA1
15363: sta VBC_IFR1
15364: sta VBC_IER1
15365:
15366: .if CompileDrive >= DRIVE_1540
15367:
15368:
15369:
15370: lda VBC_PB1
15371: and #VBC_PB1_1540_DEVICENO0 | VBC_PB1_1540_DEVICENO1
15372:
15373: asl a
15374: rol a
15375: rol a
15376: rol a
15377:
15378: .else
15379:
15380:
15381: lda VBC_PB1
15382: ora #VBC_PB1_2031_TE
15383: sta VBC_PB1
15384:
15385:
15386: lda VBC_PCR1
15387: ora #VIA_PCR_B_CA2_OUTPUT_LOW
15388: and #~VIA_PCR_B_CA2_INPUT_NEG
15389: sta VBC_PCR1
15390:
15391:
15392: lda VBC_DDRB1
15393: and # ~ VBC_PB1_2031_DEVICENO0
15394: sta VBC_DDRB1
15395:
15396: lda VBC_PB1
15397: and #VBC_PB1_2031_DEVICENO0 | VBC_PB1_2031_DEVICENO1
15398: .endif
15399:
15400: ora #IEC_TALK | 8
15401: sta TLKADR
15402:
15403: eor #IEC_TALK | IEC_LISTEN
15404: sta LSNADR
15405:
15406: .if CompileDrive >= DRIVE_1540
15407: .else
15408:
15409: lda VBC_PCR1
15410: ora #VIA_PCR_B_CA2_INPUT_NEG
15411: sta VBC_PCR1
15412:
15413:
15414: lda VBC_PB1
15415: and # ~ ( VBC_PB1_2031_TE | VBC_PB1_2031_ATNA )
15416: sta VBC_PB1
15417:
15418: lda VBC_DDRB1
15419: ora #VBC_PB1_2031_DEVICENO0
15420: sta VBC_DDRB1
15421: .endif
15422:
15423:
15424:
15425:
15426: ldx #0
15427: ldy #0
15428:
15429: :
15430: lda #0
15431: sta BUFTAB0,x
15432: inx
15433: lda TableHighBytesOfBuffers,y
15434: sta BUFTAB0,x
15435: inx
15436: iny
15437: cpy #BUFFERS_COUNT
15438: bne :-
15439:
15440:
15441: lda #<CMDBUF
15442: sta BUFTAB0,x
15443: inx
15444: lda #>CMDBUF
15445: sta BUFTAB0,x
15446: inx
15447:
15448:
15449: lda #<ERRBUF
15450: sta BUFTAB0,x
15451: inx
15452: lda #>ERRBUF
15453: sta BUFTAB0,x
15454:
15455:
15456:
15457: lda #$FF
15458: ldx #$12
15459: :
15460: sta LINTAB,x
15461: dex
15462: bpl :-
15463:
15464: ldx #BUFFERS_COUNT
15465: :
15466: sta BUF0,x
15467: sta BUF1,x
15468: sta SS,x
15469: dex
15470: bpl :-
15471:
15472: lda #>BUFFER2
15473: sta BUF0 + 4
15474: lda #>BUFFER3
15475: sta BUF0 + 5
15476:
15477:
15478: lda #<$FFFF
15479: sta BUF0 + 6
15480:
15481: sta BUF1 + 6
15482:
15483:
15484: lda #$05
15485: sta L023B
15486:
15487:
15488: lda #$84
15489: sta L023A
15490: lda #$0F
15491: sta LINUSE
15492: lda #$01
15493: sta CHNRDY + 4
15494: lda #$88
15495: sta CHNRDY + 5
15496: lda #$E0
15497: sta BUFUSE
15498: lda #$FF
15499: sta BUFUSE + 1
15500:
15501: SET_WPSW_DIRTY_NO_CR
15502:
15503: sta WPSW + 1
15504:
15505: jsr InitJumpTableForUxCommands
15506: jsr LCEFA
15507:
15508:
15509: .if CompileDrive >= DRIVE_1570
15510: jsr LFF82
15511: .elseif CompileDrive >= DRIVE_1541C_01 .AND CompileDrive <> DRIVE_1541C_03
15512: jsr LFF6F
15513: .else
15514: jsr LF259
15515: .endif
15516:
15517:
15518: lda #<ShortReset
15519: sta VNMI
15520: lda #>ShortReset
15521: sta VNMI + 1
15522:
15523: .if CompileDrive >= DRIVE_1570
15524: lda #$06
15525: .else
15526: lda #$0A
15527: .endif
15528: sta SECINC
15529:
15530:
15531:
15532: lda #$05
15533: sta REVCNT
15534:
15535: lda #ERRORCODE_73_IDENTIFY
15536: jsr SetErrorCodeNoTS
15537:
15538:
15539:
15540:
15541: .if CompileDrive >= DRIVE_1541_05
15542:
15543:
15544: lda #0
15545: sta VBC_PB1
15546:
15547:
15548: lda #VBC_PB1_1540_DATAOUT | VBC_PB1_1540_CLOCKOUT | VBC_PB1_1540_ATNA
15549: sta VBC_DDRB1
15550:
15551: .elseif CompileDrive >= DRIVE_1540
15552:
15553:
15554:
15555:
15556:
15557:
15558:
15559:
15560:
15561: lda #VBC_PB1_1540_DATAOUT | VBC_PB1_1540_CLOCKOUT | VBC_PB1_1540_ATNA
15562: sta VBC_DDRB1
15563:
15564: lda #0
15565: sta VBC_PB1
15566:
15567: .endif
15568:
15569: .if CompileDrive >= DRIVE_1570
15570: jsr LA786
15571: .else
15572: jsr CheckAutostart
15573: .endif
15574:
15575:
15576:
15577:
15578:
15579: MainLoopEntry:
15580: cli
15581:
15582: .if CompileDrive >= DRIVE_1540
15583:
15584:
15585:
15586: lda VBC_PB1
15587: and # ~ (VBC_PB1_1540_DATAOUT | VBC_PB1_1540_CLOCKOUT | VBC_PB1_1540_ATNA)
15588: sta VBC_PB1
15589: .endif
15590:
15591:
15592:
15593: lda CMDWAT
15594: beq MainLoop
15595:
15596: lda #$00
15597: sta CMDWAT
15598:
15599:
15600:
15601: .if CompileDrive >= DRIVE_1570
15602: FillNOP 2
15603: jmp Patch1570CallToParseCommandBufferAndExecuteCommand
15604: .else
15605: sta NMIFLG
15606: jsr ParseCommandBufferAndExecuteCommand
15607: .endif
15608:
15609: END_Patch1570CallToParseCommandBufferAndExecuteCommand:
15610:
15611: MainLoop:
15612: cli
15613:
15614: lda ATNPND
15615: beq @SkipBusProcessing
15616:
15617:
15618:
15619:
15620: .if CompileDrive >= DRIVE_1570
15621: jmp ProcessBus1570
15622: .elseif CompileDrive >= DRIVE_1541C_02
15623: jmp Patch_ClearPALatch_ProcessBus
15624: .else
15625: jmp ProcessBus
15626: .endif
15627:
15628: @SkipBusProcessing:
15629:
15630: cli
15631:
15632:
15633:
15634:
15635:
15636: lda #LINTAB_End - LINTAB
15637: sta T3
15638:
15639: lda #$00
15640: sta T0
15641: sta T1
15642:
15643:
15644:
15645: @CheckNextChannel:
15646: ldx T3
15647: lda LINTAB,x
15648: cmp #$FF
15649: beq @NoChannelActivity
15650:
15651: and #$3F
15652: sta LINDX
15653: jsr LDF93
15654: tax
15655:
15656: lda LSTJOB,x
15657: and #$01
15658: tax
15659: inc T0,x
15660:
15661: @NoChannelActivity:
15662: dec T3
15663: bpl @CheckNextChannel
15664:
15665:
15666:
15667: ldy #JOBS4 - JOBS0
15668: @CheckNextJob:
15669: lda JOBS0,y
15670: bpl @NoJob
15671: and #$01
15672: tax
15673: inc T0,x
15674: @NoJob:
15675: dey
15676: bpl @CheckNextJob
15677:
15678:
15679:
15680:
15681:
15682: sei
15683:
15684: lda VDC_PB2
15685: and # ~ VDC_PB2_DRIVELEDS
15686: pha
15687:
15688:
15689: lda DRVNUM
15690: sta R0
15691:
15692:
15693: lda #$00
15694: sta DRVNUM
15695:
15696:
15697: lda T0
15698: beq @NoJobForDrive0
15699:
15700:
15701: lda WPSW
15702: beq @SkipInitDrive0
15703:
15704: jsr LD313
15705:
15706: @SkipInitDrive0:
15707:
15708:
15709: pla
15710: ora #VDC_PB2_DRIVE0LED
15711: pha
15712:
15713: @NoJobForDrive0:
15714:
15715:
15716: inc DRVNUM
15717:
15718:
15719: lda T1
15720: beq @NoJobForDrive1
15721:
15722:
15723: lda WPSW + 1
15724: beq @SkipInitDrive1
15725:
15726: jsr LD313
15727:
15728: @SkipInitDrive1:
15729:
15730:
15731: pla
15732: ora #VDC_PB2_DRIVE1LED
15733: pha
15734:
15735:
15736: @NoJobForDrive1:
15737:
15738:
15739: lda R0
15740: sta DRVNUM
15741:
15742:
15743: pla
15744:
15745:
15746: ldx ERWORD
15747: beq @SwitchOnLEDs
15748:
15749: lda VDC_PB2
15750: cpx #$80
15751: bne @LEC81
15752: jmp @LEC8B
15753: @LEC81:
15754: ldx VBC_T1HC1
15755: bmi @SwitchOnLEDs
15756: ldx #$A0
15757: stx VBC_T1HC1
15758: @LEC8B:
15759: dec ERWORD
15760: bne @SwitchOnLEDs
15761: eor ERLED
15762: ldx #$10
15763: stx ERWORD
15764:
15765: @SwitchOnLEDs:
15766: sta VDC_PB2
15767: jmp MainLoop
15768:
15769:
15770:
15771: LEC9E:
15772: lda #$00
15773: sta SA
15774: lda #$01
15775: jsr LD1E2
15776: lda #$00
15777: jsr LD4C8
15778: ldx LINDX
15779: lda #$00
15780: sta LSTCHR,x
15781: jsr LDF93
15782: tax
15783: lda DRVNUM
15784: sta LSTJOB,x
15785: lda #$01
15786: jsr LCFF1
15787: lda #$04
15788: jsr LCFF1
15789: lda #$01
15790: jsr LCFF1
15791: jsr LCFF1
15792: lda NBTEMP
15793: jsr LCFF1
15794: lda #$00
15795: jsr LCFF1
15796: jsr LED59
15797: jsr LDF93
15798: asl a
15799: tax
15800: dec BUFTAB0,x
15801: dec BUFTAB0,x
15802: lda #$00
15803: jsr LCFF1
15804: LECEA:
15805: lda #$01
15806: jsr LCFF1
15807: jsr LCFF1
15808: jsr LC6CE
15809: bcc LED23
15810: lda NBTEMP
15811: jsr LCFF1
15812: lda NBTEMP + 1
15813: jsr LCFF1
15814: jsr LED59
15815: lda #$00
15816: jsr LCFF1
15817: bne LECEA
15818: LED0D:
15819: jsr LDF93
15820: asl a
15821: tax
15822: lda #$00
15823: sta BUFTAB0,x
15824: lda #$88
15825: ldy LINDX
15826: sta DIRLST
15827: sta CHNRDY,y
15828: lda DATA
15829: rts
15830:
15831: LED23:
15832: lda NBTEMP
15833: jsr LCFF1
15834: lda NBTEMP + 1
15835: jsr LCFF1
15836: jsr LED59
15837: jsr LDF93
15838: asl a
15839: tax
15840: dec BUFTAB0,x
15841: dec BUFTAB0,x
15842: lda #$00
15843: jsr LCFF1
15844: jsr LCFF1
15845: jsr LCFF1
15846: jsr LDF93
15847: asl a
15848: tay
15849: lda BUFTAB0,y
15850: ldx LINDX
15851: sta LSTCHR,x
15852: dec LSTCHR,x
15853: jmp LED0D
15854: LED59:
15855: ldy #$00
15856: LED5B:
15857: lda NAMBUF,y
15858: jsr LCFF1
15859: iny
15860: cpy #$1B
15861: bne LED5B
15862: rts
15863: LED67:
15864: jsr LD137
15865: beq LED6D
15866: rts
15867: LED6D:
15868: sta DATA
15869: ldy LINDX
15870: lda LSTCHR,y
15871: beq LED7E
15872: lda #$80
15873: sta CHNRDY,y
15874: lda DATA
15875: rts
15876: LED7E:
15877: pha
15878: jsr LECEA
15879: pla
15880: rts
15881: cmd_validate:
15882: jsr LC1D1
15883: jsr LD042
15884: lda #$40
15885: sta WBAM
15886: .if CompileDrive >= DRIVE_1571_05
15887: jsr LAA69
15888: .elseif CompileDrive >= DRIVE_1571
15889: jsr LA7C7
15890: .else
15891: jsr LEEB7
15892: .endif
15893: lda #$00
15894: sta DELIND
15895: jsr LC5AC
15896: bne LEDD9
15897: LED9C:
15898: lda #$00
15899: sta SECTOR
15900: lda LFE85
15901: sta TRACK
15902: jsr LEDE5
15903: lda #$00
15904: sta WBAM
15905: jsr LEEFF
15906: jmp CommandEnd
15907: LEDB3:
15908: iny
15909: lda (DIRBUF),y
15910: pha
15911: iny
15912: lda (DIRBUF),y
15913: pha
15914: ldy #$13
15915: lda (DIRBUF),y
15916: beq LEDCB
15917: sta TRACK
15918: iny
15919: lda (DIRBUF),y
15920: sta SECTOR
15921: jsr LEDE5
15922: LEDCB:
15923: pla
15924: sta SECTOR
15925: pla
15926: sta TRACK
15927: jsr LEDE5
15928: LEDD4:
15929: jsr LC604
15930: beq LED9C
15931: LEDD9:
15932: ldy #$00
15933: lda (DIRBUF),y
15934: bmi LEDB3
15935: jsr LC8B6
15936: jmp LEDD4
15937: LEDE5:
15938: jsr LD55F
15939: jsr LEF90
15940: jsr LD475
15941: LEDEE:
15942: lda #$00
15943: jsr LD4C8
15944: jsr LD137
15945: sta TRACK
15946: jsr LD137
15947: sta SECTOR
15948: lda TRACK
15949: bne LEE04
15950: jmp LD227
15951: LEE04:
15952: jsr LEF90
15953: jsr LD44D
15954: jmp LEDEE
15955: cmd_new:jsr LC312
15956: lda FILDRV
15957: bpl LEE19
15958: lda #ERRORCODE_33_SYNTAX_ERROR
15959: jmp GenerateErrorMessage
15960:
15961:
15962: LEE19:
15963: and #$01
15964: sta DRVNUM
15965: .if CompileDrive >= DRIVE_1570
15966: jsr LFF9C
15967: .elseif CompileDrive >= DRIVE_1541C_02
15968: jsr LFF7F
15969: .else
15970: jsr LC100
15971: .endif
15972: lda DRVNUM
15973: asl a
15974: tax
15975: ldy FILTBL + 1
15976: cpy CMDSIZ
15977: beq LEE46
15978: lda CMDBUF,y
15979: sta DiskID0,x
15980: lda CMDBUF + 1,y
15981: sta DiskID0 + 1,x
15982: jsr LD307
15983: lda #$01
15984: sta TRACK
15985: .if CompileDrive >= DRIVE_1541C_01 .or CompileDrive = DRIVE_1541_06AA
15986: jsr LFF2F
15987: .else
15988: jsr LC8C6
15989: .endif
15990:
15991: .if CompileDrive >= DRIVE_1571
15992: jmp LA764
15993: .else
15994: jsr LF005
15995: .endif
15996: LEE43:
15997: jmp LEE56
15998: LEE46:
15999: jsr LD042
16000: ldx DRVNUM
16001: lda DSKVER,x
16002: cmp LFED5
16003: beq LEE56
16004: jmp LD572
16005: LEE56:
16006: .if CompileDrive >= DRIVE_1570
16007: jsr LA7C7
16008: .else
16009: jsr LEEB7
16010: .endif
16011: lda JOBNUM
16012: tay
16013: asl a
16014: tax
16015: lda LFE85 + 3
16016: sta BUFTAB0,x
16017: ldx FILTBL
16018: lda #$1B
16019: jsr LC66E
16020: ldy #$12
16021: ldx DRVNUM
16022: lda LFED5
16023: sta DSKVER,x
16024: txa
16025: asl a
16026: tax
16027: lda DiskID0,x
16028: sta (DIRBUF),y
16029: iny
16030: lda DiskID0 + 1,x
16031: sta (DIRBUF),y
16032: iny
16033: iny
16034: lda #$32
16035: sta (DIRBUF),y
16036: iny
16037: lda LFED5
16038: sta (DIRBUF),y
16039: ldy #$02
16040: sta (BMPNT),y
16041: lda LFE85
16042: sta TRACK
16043: jsr LEF93
16044: lda #$01
16045: sta SECTOR
16046: jsr LEF93
16047: jsr LEEFF
16048: jsr LF005
16049: ldy #$01
16050: lda #$FF
16051: sta (BMPNT),y
16052: jsr LD464
16053: dec SECTOR
16054: .if CompileDrive >= DRIVE_1571
16055: jsr LD042
16056: .else
16057: jsr LD460
16058: .endif
16059: jmp CommandEnd
16060: LEEB7:
16061: jsr LF0D1
16062: ldy #$00
16063: lda #$12
16064: sta (BMPNT),y
16065: iny
16066: tya
16067: sta (BMPNT),y
16068: iny
16069: iny
16070: iny
16071: LEEC7:
16072: lda #$00
16073: sta T0
16074: sta T1
16075: sta T2
16076: tya
16077: lsr a
16078: lsr a
16079: jsr LF24B
16080: sta (BMPNT),y
16081: iny
16082: tax
16083: LEED9:
16084: sec
16085: rol T0
16086: rol T1
16087: rol T2
16088: dex
16089: bne LEED9
16090: LEEE3:
16091: lda T0,x
16092: sta (BMPNT),y
16093: iny
16094: inx
16095: cpx #$03
16096: bcc LEEE3
16097: cpy #$90
16098: bcc LEEC7
16099: jmp LD075
16100: LEEF4:
16101: jsr LDF93
16102: tax
16103: lda LSTJOB,x
16104: and #$01
16105: sta DRVNUM
16106: LEEFF:
16107: ldy DRVNUM
16108: lda MDIRTY,y
16109: bne LEF07
16110: rts
16111: LEF07:
16112: lda #$00
16113: sta MDIRTY,y
16114: jsr LEF3A
16115: lda DRVNUM
16116: asl a
16117: pha
16118: jsr LF0A5
16119: pla
16120: clc
16121: adc #$01
16122: jsr LF0A5
16123: lda TRACK
16124: pha
16125: lda #$01
16126: sta TRACK
16127: LEF24:
16128: asl a
16129: asl a
16130: sta BMPNT
16131: .if CompileDrive >= DRIVE_1571
16132: jsr LA937
16133: .else
16134: jsr LF220
16135: .endif
16136: inc TRACK
16137: lda TRACK
16138: cmp MAXTRACK_ADJUSTED
16139: bcc LEF24
16140: pla
16141: sta TRACK
16142: .if CompileDrive >= DRIVE_1571
16143: jmp LA58D
16144: .else
16145: jmp LD58A
16146: .endif
16147: LEF3A:
16148: jsr LF10F
16149: tax
16150: jsr LF0DF
16151: ldx JOBNUM
16152: lda TableHighBytesOfBuffers,x
16153: sta BMPNT + 1
16154: lda #$00
16155: sta BMPNT
16156: rts
16157: LEF4D:
16158: ldx DRVNUM
16159: lda NDBL,x
16160: sta NBTEMP
16161: lda NDBH,x
16162: sta NBTEMP + 1
16163: rts
16164: jsr LEFF1
16165: LEF5F:
16166: .if CompileDrive >= DRIVE_1571
16167: jmp LA83E
16168: .else
16169: jsr LEFCF
16170: .endif
16171: LEF62:
16172: sec
16173: bne LEF87
16174: lda (BMPNT),y
16175: ora LEFE9,x
16176: sta (BMPNT),y
16177: jsr LEF88
16178: ldy T0
16179: clc
16180: lda (BMPNT),y
16181: adc #$01
16182: sta (BMPNT),y
16183: lda TRACK
16184: cmp LFE85
16185: beq LEFBA
16186: LEF7F:
16187: inc NDBL,x
16188: bne LEF87
16189: inc NDBH,x
16190: LEF87:
16191: rts
16192: LEF88:
16193: ldx DRVNUM
16194: lda #$01
16195: sta MDIRTY,x
16196: rts
16197: LEF90:
16198: jsr LEFF1
16199: LEF93:
16200: .if CompileDrive >= DRIVE_1571
16201: jmp LA874
16202: .else
16203: jsr LEFCF
16204: .endif
16205: LEF96:
16206: beq LEFCE
16207: lda (BMPNT),y
16208: eor LEFE9,x
16209: sta (BMPNT),y
16210: jsr LEF88
16211: ldy T0
16212: lda (BMPNT),y
16213: sec
16214: sbc #$01
16215: sta (BMPNT),y
16216: lda TRACK
16217: cmp LFE85
16218: beq LEFBD
16219: LEFB2:
16220: lda NDBL,x
16221: bne LEFBA
16222: dec NDBH,x
16223: LEFBA:
16224: dec NDBL,x
16225: LEFBD:
16226: lda NDBH,x
16227: bne LEFCE
16228: lda NDBL,x
16229: .if CompileDrive >= DRIVE_1571_05
16230: jmp LAAF0
16231: FillNOP 1
16232: .elseif CompileDrive >= DRIVE_1541C_02 .AND CompileDrive < DRIVE_1570
16233: jmp LC047
16234: FillNOP 1
16235: .else
16236: cmp #$03
16237: bcs LEFCE
16238: .endif
16239:
16240: lda #ERRORCODE_72_DISK_FULL
16241: jsr SetErrorCode
16242: LEFCE:
16243: rts
16244: LEFCF:
16245: jsr LF011
16246: tya
16247: sta T0
16248: LEFD5:
16249: lda SECTOR
16250: lsr a
16251: lsr a
16252: lsr a
16253: sec
16254: adc T0
16255: tay
16256: lda SECTOR
16257: and #$07
16258: tax
16259: lda (BMPNT),y
16260: and LEFE9,x
16261: rts
16262: LEFE9:
16263: .byte $01,$02,$04,$08,$10,$20,$40,$80
16264: LEFF1:
16265: lda #$FF
16266: bit WBAM
16267: beq LF004
16268: bpl LF004
16269: bvs LF004
16270: lda #$00
16271: sta WBAM
16272: .if CompileDrive >= DRIVE_1571
16273: jmp LA58D
16274: .else
16275: jmp LD58A
16276: .endif
16277: LF004:
16278: rts
16279: LF005:
16280: .if CompileDrive >= DRIVE_1571
16281: jmp LA738
16282: .else
16283: jsr LEF3A
16284: .endif
16285: LF008:
16286: ldy #$00
16287: tya
16288: LF00B:
16289: sta (BMPNT),y
16290: iny
16291: bne LF00B
16292: rts
16293: LF011:
16294: lda T0
16295: pha
16296: lda T1
16297: pha
16298: .if CompileDrive >= DRIVE_1570
16299: jmp LAA25
16300: FillNOP 1
16301: .elseif CompileDrive >= DRIVE_1541C_02
16302: jmp LFFB0
16303: FillNOP 1
16304: .else
16305: ldx DRVNUM
16306: lda NODRV,x
16307: .endif
16308: LF01B:
16309: beq LF022
16310: lda #ERRORCODE_74_DRIVE_NOT_READY
16311: .if CompileDrive >= DRIVE_1571_05
16312: jsr LE645
16313: .else
16314: jsr LE648
16315: .endif
16316: LF022:
16317: jsr LF10F
16318: sta T0
16319: txa
16320: asl a
16321: sta T1
16322: tax
16323: lda TRACK
16324: cmp TBAM,x
16325: beq LF03E
16326: inx
16327: stx T1
16328: cmp TBAM,x
16329: beq LF03E
16330: jsr LF05B
16331: LF03E:
16332: lda T1
16333: ldx DRVNUM
16334: sta UBAM,x
16335: asl a
16336: asl a
16337: clc
16338: adc #$A1
16339: sta BMPNT
16340: lda #$02
16341: adc #$00
16342: sta BMPNT + 1
16343: ldy #$00
16344: pla
16345: sta T1
16346: pla
16347: sta T0
16348: rts
16349: LF05B:
16350: ldx T0
16351: jsr LF0DF
16352: lda DRVNUM
16353: tax
16354: asl a
16355: ora UBAM,x
16356: eor #$01
16357: and #$03
16358: sta T1
16359: jsr LF0A5
16360: lda JOBNUM
16361: asl a
16362: tax
16363: lda TRACK
16364: asl a
16365: asl a
16366: sta BUFTAB0,x
16367: lda T1
16368: asl a
16369: asl a
16370: tay
16371: LF07F:
16372: lda (BUFTAB0,x)
16373: sta BAM,y
16374: lda #$00
16375: sta (BUFTAB0,x)
16376: inc BUFTAB0,x
16377: iny
16378: tya
16379: and #$03
16380: bne LF07F
16381: ldx T1
16382: lda TRACK
16383: sta TBAM,x
16384: lda WBAM
16385: bne LF09F
16386: .if CompileDrive >= DRIVE_1571
16387: jmp LA58D
16388: .else
16389: jmp LD58A
16390: .endif
16391: LF09F:
16392: ora #$80
16393: sta WBAM
16394: rts
16395: LF0A5:
16396: tay
16397: lda TBAM,y
16398: beq LF0D0
16399: pha
16400: lda #$00
16401: sta TBAM,y
16402: lda JOBNUM
16403: asl a
16404: tax
16405: pla
16406: asl a
16407: asl a
16408: sta BUFTAB0,x
16409: tya
16410: asl a
16411: asl a
16412: tay
16413: LF0BE:
16414: lda BAM,y
16415: sta (BUFTAB0,x)
16416: lda #$00
16417: sta BAM,y
16418: inc BUFTAB0,x
16419: iny
16420: tya
16421: and #$03
16422: bne LF0BE
16423: LF0D0:
16424: rts
16425: LF0D1:
16426: lda DRVNUM
16427: asl a
16428: tax
16429: lda #$00
16430: sta TBAM,x
16431: inx
16432: sta TBAM,x
16433: rts
16434: LF0DF:
16435: lda BUF0,x
16436: cmp #$FF
16437: bne LF10A
16438: txa
16439: pha
16440: jsr LD28E
16441: tax
16442: bpl LF0F2
16443: lda #ERRORCODE_70_NO_CHANNEL
16444: jsr GenerateErrorMessage
16445: LF0F2:
16446: stx JOBNUM
16447: pla
16448: tay
16449: txa
16450: ora #$80
16451: sta BUF0,y
16452: asl a
16453: tax
16454: lda LFE85
16455: sta TRACK0,x
16456: lda #$00
16457: sta SECTOR0,x
16458: .if CompileDrive >= DRIVE_1571
16459: jmp LA667
16460: .else
16461: jmp LD586
16462: .endif
16463: LF10A:
16464: and #$0F
16465: sta JOBNUM
16466: rts
16467: LF10F:
16468: lda #$06
16469: ldx DRVNUM
16470: bne LF118
16471: clc
16472: adc #$07
16473: LF118:
16474: rts
16475: LF119:
16476: jsr LF10F
16477: tax
16478: rts
16479: LF11E:
16480: jsr LDE3E
16481: lda #$03
16482: sta T0
16483: lda #$01
16484: ora WBAM
16485: sta WBAM
16486: LF12D:
16487: .if CompileDrive >= DRIVE_1571
16488: jmp LA8DB
16489: .else
16490: lda T0
16491: pha
16492: .endif
16493: LF130:
16494: jsr LF011
16495: pla
16496: sta T0
16497: lda (BMPNT),y
16498: LF138:
16499: bne LF173
16500: lda TRACK
16501: cmp LFE85
16502: beq LF15A
16503: bcc LF15F
16504: inc TRACK
16505: lda TRACK
16506: cmp MAXTRACK_ADJUSTED
16507: bne LF12D
16508: ldx LFE85
16509: dex
16510: stx TRACK
16511: lda #$00
16512: sta SECTOR
16513: dec T0
16514: bne LF12D
16515: LF15A:
16516: lda #ERRORCODE_72_DISK_FULL
16517: jsr GenerateErrorMessage
16518: LF15F:
16519: dec TRACK
16520: bne LF12D
16521: ldx LFE85
16522: inx
16523: stx TRACK
16524: lda #$00
16525: sta SECTOR
16526: dec T0
16527: bne LF12D
16528: beq LF15A
16529: LF173:
16530: lda SECTOR
16531: clc
16532: adc SECINC
16533: sta SECTOR
16534: lda TRACK
16535: jsr LF24B
16536: sta LSTSEC
16537: sta CMD
16538: cmp SECTOR
16539: bcs LF195
16540: sec
16541: lda SECTOR
16542: sbc LSTSEC
16543: sta SECTOR
16544: beq LF195
16545: dec SECTOR
16546: LF195:
16547: jsr LF1FA
16548: beq LF19D
16549: LF19A:
16550: jmp LEF90
16551: LF19D:
16552: lda #$00
16553: sta SECTOR
16554: jsr LF1FA
16555: bne LF19A
16556: jmp LF1F5
16557: LF1A9:
16558: lda #$01
16559: ora WBAM
16560: sta WBAM
16561: lda R0
16562: pha
16563: lda #$01
16564: sta R0
16565: LF1B8:
16566: lda LFE85
16567: sec
16568: sbc R0
16569: sta TRACK
16570: bcc LF1CB
16571: beq LF1CB
16572: .if CompileDrive >= DRIVE_1571
16573: jmp LA905
16574: .else
16575: jsr LF011
16576: .endif
16577: LF1C7:
16578: lda (BMPNT),y
16579: LF1C9:
16580: bne LF1E6
16581: LF1CB:
16582: lda LFE85
16583: clc
16584: adc R0
16585: sta TRACK
16586: inc R0
16587: cmp MAXTRACK_ADJUSTED
16588: bcc LF1DF
16589: lda #ERRORCODE_67_ILLEGAL_TRACK_OR_SECTOR
16590: jsr LE645
16591: LF1DF:
16592: .if CompileDrive >= DRIVE_1571
16593: jmp LA91E
16594: .else
16595: jsr LF011
16596: .endif
16597: LF1E2:
16598: lda (BMPNT),y
16599: LF1E4:
16600: beq LF1B8
16601: LF1E6:
16602: pla
16603: sta R0
16604: lda #$00
16605: sta SECTOR
16606: jsr LF1FA
16607: beq LF1F5
16608: jmp LEF90
16609: LF1F5:
16610: lda #ERRORCODE_71_DIR_ERROR
16611: jsr LE645
16612: LF1FA:
16613: .if CompileDrive >= DRIVE_1571
16614: jmp LA8A9
16615: .else
16616: jsr LF011
16617: .endif
16618: LF1FD:
16619: tya
16620: pha
16621: jsr LF220
16622: lda TRACK
16623: jsr LF24B
16624: sta LSTSEC
16625: pla
16626: sta T0
16627: LF20D:
16628: lda SECTOR
16629: cmp LSTSEC
16630: bcs LF21D
16631: jsr LEFD5
16632: bne LF21F
16633: inc SECTOR
16634: bne LF20D
16635: LF21D:
16636: lda #$00
16637: LF21F:
16638: rts
16639: LF220:
16640: lda T0
16641: pha
16642: lda #$00
16643: sta T0
16644: ldy LFE85 + 1
16645: dey
16646: LF22B:
16647: ldx #$07
16648: LF22D:
16649: lda (BMPNT),y
16650: and LEFE9,x
16651: beq LF236
16652: inc T0
16653: LF236:
16654: dex
16655: bpl LF22D
16656: dey
16657: bne LF22B
16658: lda (BMPNT),y
16659: cmp T0
16660: bne LF246
16661: pla
16662: sta T0
16663: rts
16664: LF246:
16665: lda #ERRORCODE_71_DIR_ERROR
16666: jsr LE645
16667: LF24B:
16668: .if CompileDrive >= DRIVE_1571
16669: jsr LA74F
16670: .else
16671: ldx LFED6
16672: .endif
16673: LF24E:
16674: cmp SpeedZoneChange - 1,x
16675: dex
16676: bcs LF24E
16677: lda LFED1,x
16678: rts
16679:
16680: NoOp:
16681: rts
16682:
16683: LF259:
16684: lda #VDC_PB2_STEPPER | VDC_PB2_DRIVE0MOTOR | VDC_PB2_DRIVELEDS | VDC_PB2_BITRATE
16685: sta VDC_DDRB2
16686: and # ~ (VDC_PB2_STEPPER | VDC_PB2_DRIVE0MOTOR | VDC_PB2_DRIVELEDS)
16687: sta VDC_PB2
16688: .if CompileDrive >= DRIVE_1570
16689: jmp LA9F8
16690: .else
16691: lda VDC_PCR2
16692: .endif
16693:
16694: LF266:
16695: and # ~ VIA_PCR_B_CA1_INPUT_POS_EDGE
16696: ora #VIA_PCR_B_CA2_OUTPUT_HIGH
16697: ora #VIA_PCR_B_CB2_OUTPUT_HIGH
16698: sta VDC_PCR2
16699: lda #VIA_ACR_B_T1_CONTROL_FREERUN | VIA_ACR_B_PA_LATCH_ENABLE
16700: sta VDC_ACR2
16701: lda #$00
16702: sta VDC_T1LL2
16703: .if CompileDrive = DRIVE_1541C_01 .OR (CompileDrive >= DRIVE_1570 .AND CompileDrive < DRIVE_1571_05)
16704: lda #$20
16705: .else
16706: lda #$3A
16707: .endif
16708: sta VDC_T1HL2
16709: sta VDC_T1HC2
16710:
16711: lda #VIA_IER_BW_UNSET | ~ VIA_IER_BW_SET
16712: sta VDC_IER2
16713:
16714: lda #VIA_IER_B_T1 | VIA_IER_BW_SET
16715: sta VDC_IFR2
16716: sta VDC_IER2
16717:
16718: lda #$FF
16719: sta CDRIVE
16720: sta FTNUM
16721: lda #$08
16722: sta HBID
16723: lda #$07
16724: sta DBID
16725: lda #<LFA05
16726: sta NXTST
16727: lda #>LFA05
16728: sta NXTST + 1
16729: lda #$C8
16730: sta MINSTP
16731: lda #$04
16732: sta AS
16733: lda #$04
16734: sta AF
16735: LF2B0:
16736: tsx
16737: stx SAVSP
16738: lda VDC_T1LC2
16739: lda VDC_PCR2
16740: ora #VIA_PCR_B_CA2_OUTPUT_HIGH
16741: sta VDC_PCR2
16742:
16743: LF2BE:
16744: ldy #$05
16745: LF2C0:
16746: lda JOBS0,y
16747: bpl LF2F3
16748: cmp #$D0
16749: bne LF2CD
16750: tya
16751: jmp LF370
16752: LF2CD:
16753: and #$01
16754: beq LF2D8
16755: sty JOBN
16756: lda #$0F
16757: jmp LF969
16758: LF2D8:
16759: tax
16760: sta DRIVE
16761: cmp CDRIVE
16762: beq LF2E9
16763: jsr LF97E
16764: lda DRIVE
16765: sta CDRIVE
16766: jmp LF99C
16767: LF2E9:
16768: lda DRVST
16769: bmi LF2F0
16770: asl a
16771: bpl LF2F9
16772: LF2F0:
16773: jmp LF99C
16774: LF2F3:
16775: dey
16776: bpl LF2C0
16777: jmp LF99C
16778: LF2F9:
16779: lda #$20
16780: sta DRVST
16781: ldy #$05
16782: sty JOBN
16783: LF301:
16784: jsr LF393
16785: bmi LF320
16786: LF306:
16787: dec JOBN
16788: bpl LF301
16789: ldy NXTJOB
16790: jsr LF395
16791: lda NXTRK
16792: sta STEPS
16793: asl STEPS
16794: lda #$60
16795: sta DRVST
16796: lda (HDRPNT),y
16797: sta DRVTRK
16798: jmp LF99C
16799: LF320:
16800: and #$01
16801: cmp DRIVE
16802: bne LF306
16803: lda DRVTRK
16804: beq LF33C
16805: sec
16806: sbc (HDRPNT),y
16807: beq LF33C
16808: eor #$FF
16809: sta NXTRK
16810: inc NXTRK
16811: lda JOBN
16812: sta NXTJOB
16813: jmp LF306
16814: LF33C:
16815: ldx #$04
16816: lda (HDRPNT),y
16817: sta TRACC
16818: LF342:
16819: .if CompileDrive >= DRIVE_1571_05 .OR CompileDrive = DRIVE_1541C_02
16820: cmp LC048 - 1,x
16821: .else
16822: cmp SpeedZoneChange - 1,x
16823: .endif
16824: dex
16825: bcs LF342
16826: lda LFED1,x
16827: sta SECTR
16828: txa
16829: asl a
16830: asl a
16831: asl a
16832: asl a
16833: asl a
16834: sta WORK
16835: lda VDC_PB2
16836: and #VDC_PB2_STEPPER | VDC_PB2_DRIVE0MOTOR | VDC_PB2_DRIVELEDS | VDC_PB2_WRITEPROTECT | VDC_PB2_SYNC
16837: ora WORK
16838: sta VDC_PB2
16839: ldx DRIVE
16840: lda JOB
16841: cmp #$40
16842: beq LF37C
16843: cmp #$60
16844: beq LF36E
16845: jmp LF3B1
16846: LF36E:
16847: lda JOBN
16848: LF370:
16849: clc
16850: adc #$03
16851: sta BUFPNT + 1
16852: lda #$00
16853: sta BUFPNT
16854: jmp (BUFPNT)
16855: LF37C:
16856: lda #$60
16857: sta DRVST
16858: lda VDC_PB2
16859: and # ~ VDC_PB2_STEPPER
16860: sta VDC_PB2
16861: lda #$A4
16862: sta STEPS
16863: lda #$01
16864: sta DRVTRK
16865: jmp LF969
16866: LF393:
16867: ldy JOBN
16868: LF395:
16869: lda JOBS0,y
16870: pha
16871: bpl LF3AB
16872: and #$78
16873: sta JOB
16874: tya
16875: asl a
16876: adc #$06
16877: sta HDRPNT
16878: tya
16879: clc
16880: adc #$03
16881: sta BUFPNT + 1
16882: LF3AB:
16883: ldy #$00
16884: sty BUFPNT
16885: pla
16886: rts
16887: LF3B1:
16888: ldx #$5A
16889: stx TMP
16890: ldx #$00
16891: lda #$52
16892: sta STAB
16893: LF3BB:
16894: jsr LF556
16895: LF3BE:
16896: bvc LF3BE
16897: clv
16898: lda VDC_PA2
16899: cmp STAB
16900: bne LF407
16901: LF3C8:
16902: bvc LF3C8
16903: clv
16904: lda VDC_PA2
16905: sta STAB + 1,x
16906: inx
16907: cpx #$07
16908: bne LF3C8
16909: jsr LF497
16910: ldy #$04
16911: lda #$00
16912: LF3DC:
16913: eor HEADER,y
16914: dey
16915: bpl LF3DC
16916: cmp #$00
16917: bne LF41E
16918: ldx CDRIVE
16919: lda HEADER + 2
16920: sta DRVTRK,x
16921: lda JOB
16922: cmp #$30
16923: beq LF410
16924: lda CDRIVE
16925: asl a
16926: tay
16927: lda DiskID0,y
16928: cmp HEADER
16929: bne LF41B
16930: lda DiskID0 + 1,y
16931: cmp HEADER + 1
16932: bne LF41B
16933: jmp LF423
16934: LF407:
16935: dec TMP
16936: bne LF3BB
16937: lda #$02
16938: jsr LF969
16939: LF410:
16940: lda HEADER
16941: sta DiskID0
16942: lda HEADER + 1
16943: sta DiskID0 + 1
16944: LF418:
16945: lda #$01
16946: .byte ASM_BIT3
16947: LF41B:
16948: lda #$0B
16949: .byte ASM_BIT3
16950: LF41E:
16951: lda #$09
16952: jmp LF969
16953: LF423:
16954: lda #$7F
16955: sta CSECT
16956: lda HEADER + 3
16957: clc
16958: adc #$02
16959: cmp SECTR
16960: bcc LF432
16961: sbc SECTR
16962: LF432:
16963: sta NEXTS
16964: ldx #$05
16965: stx JOBN
16966: ldx #$FF
16967: LF43A:
16968: jsr LF393
16969: bpl LF483
16970: sta WORK
16971: and #$01
16972: cmp CDRIVE
16973: bne LF483
16974: ldy #$00
16975: lda (HDRPNT),y
16976: cmp TRACC
16977: bne LF483
16978: lda JOB
16979: cmp #$60
16980: beq LF461
16981: ldy #$01
16982: sec
16983: lda (HDRPNT),y
16984: sbc NEXTS
16985: bpl LF461
16986: clc
16987: adc SECTR
16988: LF461:
16989: cmp CSECT
16990: bcs LF483
16991: pha
16992: lda JOB
16993: beq LF47E
16994: pla
16995: .if CompileDrive >= DRIVE_1571_05
16996: cmp #$04
16997: .else
16998: cmp #$09
16999: .endif
17000: bcc LF483
17001: .if CompileDrive >= DRIVE_1571_05
17002: cmp #$08
17003: .else
17004: cmp #$0C
17005: .endif
17006: bcs LF483
17007: LF473:
17008: sta CSECT
17009: lda JOBN
17010: tax
17011: adc #$03
17012: sta BUFPNT + 1
17013: bne LF483
17014: LF47E:
17015: pla
17016: cmp #$06
17017: bcc LF473
17018: LF483:
17019: dec JOBN
17020: bpl LF43A
17021: txa
17022: bpl LF48D
17023: jmp LF99C
17024: LF48D:
17025: stx JOBN
17026: jsr LF393
17027: lda JOB
17028: jmp LF4CA
17029: LF497:
17030: lda BUFPNT
17031: pha
17032: lda BUFPNT + 1
17033: pha
17034: lda #$24
17035: sta BUFPNT
17036: lda #$00
17037: sta BUFPNT + 1
17038: lda #$00
17039: sta GCRPNT
17040: jsr LF7E6
17041: lda BTAB + 3
17042: sta HEADER + 2
17043: lda BTAB + 2
17044: sta HEADER + 3
17045: lda BTAB + 1
17046: sta HEADER + 4
17047: jsr LF7E6
17048: lda BTAB
17049: sta HEADER + 1
17050: lda BTAB + 1
17051: sta HEADER
17052: pla
17053: sta BUFPNT + 1
17054: pla
17055: sta BUFPNT
17056: rts
17057: LF4CA:
17058: cmp #$00
17059: beq LF4D1
17060: jmp LF56E
17061: LF4D1:
17062: jsr LF50A
17063: LF4D4:
17064: bvc LF4D4
17065: clv
17066: lda VDC_PA2
17067: sta (BUFPNT),y
17068: iny
17069: bne LF4D4
17070: ldy #$BA
17071: LF4E1:
17072: bvc LF4E1
17073: clv
17074: lda VDC_PA2
17075: sta NODRV + 1,y
17076: iny
17077: bne LF4E1
17078: jsr LF8E0
17079: lda BID
17080: cmp DBID
17081: beq LF4FB
17082: lda #$04
17083: jmp LF969
17084: LF4FB:
17085: jsr LF5E9
17086: cmp CHKSUM
17087: beq LF505
17088: lda #$05
17089: .byte ASM_BIT3
17090: LF505:
17091: lda #$01
17092: jmp LF969
17093: LF50A:
17094: jsr LF510
17095: jmp LF556
17096: LF510:
17097: lda DRIVE
17098: asl a
17099: tax
17100: lda DiskID0,x
17101: sta HEADER
17102: lda DiskID0 + 1,x
17103: sta HEADER + 1
17104: ldy #$00
17105: lda (HDRPNT),y
17106: sta HEADER + 2
17107: iny
17108: lda (HDRPNT),y
17109: sta HEADER + 3
17110: lda #$00
17111: eor HEADER
17112: eor HEADER + 1
17113: eor HEADER + 2
17114: eor HEADER + 3
17115: sta HEADER + 4
17116: jsr LF934
17117: ldx #$5A
17118: LF538:
17119: jsr LF556
17120: ldy #$00
17121: LF53D:
17122: bvc LF53D
17123: clv
17124: lda VDC_PA2
17125: cmp STAB,y
17126: bne LF54E
17127: iny
17128: cpy #$08
17129: bne LF53D
17130: rts
17131: LF54E:
17132: dex
17133: bne LF538
17134: lda #$02
17135: LF553:
17136: jmp LF969
17137: LF556:
17138: lda #$D0
17139: sta VBC_T1HC1
17140: lda #$03
17141: LF55D:
17142: bit VBC_T1HC1
17143: bpl LF553
17144: bit VDC_PB2
17145: bmi LF55D
17146: lda VDC_PA2
17147: clv
17148: ldy #$00
17149: rts
17150: LF56E:
17151: cmp #$10
17152: beq LF575
17153: jmp LF691
17154: LF575:
17155: jsr LF5E9
17156: sta CHKSUM
17157: lda VDC_PB2
17158: and #VDC_PB2_WRITEPROTECT
17159: bne LF586
17160: lda #$08
17161: jmp LF969
17162: LF586:
17163: jsr LF78F
17164: jsr LF510
17165: ldx #INTRA_SECTOR_GAP
17166: LF58E:
17167: bvc LF58E
17168: clv
17169: dex
17170: bne LF58E
17171: lda #$FF
17172: sta VDC_DDRA2
17173: lda VDC_PCR2
17174: and #$1F
17175: ora #$C0
17176: sta VDC_PCR2
17177: lda #$FF
17178: ldx #$05
17179: sta VDC_PA2
17180: clv
17181: LF5AB:
17182: bvc LF5AB
17183: clv
17184: dex
17185: bne LF5AB
17186: ldy #$BB
17187: LF5B3:
17188: lda NODRV + 1,y
17189: LF5B6:
17190: bvc LF5B6
17191: clv
17192: sta VDC_PA2
17193: iny
17194: bne LF5B3
17195: LF5BF:
17196: lda (BUFPNT),y
17197: LF5C1:
17198: bvc LF5C1
17199: clv
17200: sta VDC_PA2
17201: iny
17202: bne LF5BF
17203: LF5CA:
17204: bvc LF5CA
17205: lda VDC_PCR2
17206: ora #$E0
17207: sta VDC_PCR2
17208: lda #$00
17209: sta VDC_DDRA2
17210: jsr LF5F2
17211: ldy JOBN
17212: lda JOBS0,y
17213: eor #$30
17214: sta JOBS0,y
17215: jmp LF3B1
17216: LF5E9:
17217: lda #$00
17218: tay
17219: LF5EC:
17220: eor (BUFPNT),y
17221: iny
17222: bne LF5EC
17223: rts
17224: LF5F2:
17225: lda #$00
17226: sta SAVPNT
17227: sta BUFPNT
17228: sta NXTPNT
17229: lda BUFPNT + 1
17230: sta NXTBF
17231: lda #$01
17232: sta BUFPNT + 1
17233: sta SAVPNT + 1
17234: lda #$BB
17235: sta GCRPNT
17236: sta BYTCNT
17237: jsr LF7E6
17238: lda BTAB
17239: sta BID
17240: ldy BYTCNT
17241: lda BTAB + 1
17242: sta (SAVPNT),y
17243: iny
17244: lda BTAB + 2
17245: sta (SAVPNT),y
17246: iny
17247: lda BTAB + 3
17248: sta (SAVPNT),y
17249: iny
17250: sty BYTCNT
17251: LF624:
17252: jsr LF7E6
17253: ldy BYTCNT
17254: lda BTAB
17255: sta (SAVPNT),y
17256: iny
17257: lda BTAB + 1
17258: sta (SAVPNT),y
17259: iny
17260: beq LF643
17261: lda BTAB + 2
17262: sta (SAVPNT),y
17263: iny
17264: lda BTAB + 3
17265: sta (SAVPNT),y
17266: iny
17267: sty BYTCNT
17268: bne LF624
17269: LF643:
17270: lda BTAB + 2
17271: sta (BUFPNT),y
17272: iny
17273: lda BTAB + 3
17274: sta (BUFPNT),y
17275: iny
17276: sty BYTCNT
17277: LF64F:
17278: jsr LF7E6
17279: ldy BYTCNT
17280: lda BTAB
17281: sta (BUFPNT),y
17282: iny
17283: lda BTAB + 1
17284: sta (BUFPNT),y
17285: iny
17286: lda BTAB + 2
17287: sta (BUFPNT),y
17288: iny
17289: lda BTAB + 3
17290: sta (BUFPNT),y
17291: iny
17292: sty BYTCNT
17293: cpy #$BB
17294: bcc LF64F
17295: lda #$45
17296: sta SAVPNT
17297: lda BUFPNT + 1
17298: sta SAVPNT + 1
17299: ldy #$BA
17300: LF678:
17301: lda (BUFPNT),y
17302: sta (SAVPNT),y
17303: dey
17304: bne LF678
17305: lda (BUFPNT),y
17306: sta (SAVPNT),y
17307: ldx #$BB
17308: LF685:
17309: lda NODRV + 1,x
17310: sta (BUFPNT),y
17311: iny
17312: inx
17313: bne LF685
17314: stx GCRFLG
17315: rts
17316: LF691:
17317: cmp #$20
17318: beq LF698
17319: jmp LF6CA
17320: LF698:
17321: jsr LF5E9
17322: sta CHKSUM
17323: jsr LF78F
17324: jsr LF50A
17325: ldy #$BB
17326: LF6A5:
17327: lda NODRV + 1,y
17328: LF6A8:
17329: bvc LF6A8
17330: clv
17331: eor VDC_PA2
17332: bne LF6C5
17333: iny
17334: bne LF6A5
17335: LF6B3:
17336: lda (BUFPNT),y
17337: LF6B5:
17338: bvc LF6B5
17339: clv
17340: eor VDC_PA2
17341: bne LF6C5
17342: iny
17343: cpy #$FD
17344: bne LF6B3
17345: jmp LF418
17346: LF6C5:
17347: lda #$07
17348: jmp LF969
17349: LF6CA:
17350: jsr LF510
17351: jmp LF418
17352: LF6D0:
17353: lda #$00
17354: sta GTAB + 1
17355: sta GTAB + 4
17356: ldy GCRPNT
17357: lda BTAB
17358: and #$F0
17359: lsr a
17360: lsr a
17361: lsr a
17362: lsr a
17363: tax
17364: lda LF77F,x
17365: asl a
17366: asl a
17367: asl a
17368: sta GTAB
17369: lda BTAB
17370: and #$0F
17371: tax
17372: lda LF77F,x
17373: ror a
17374: ror GTAB + 1
17375: ror a
17376: ror GTAB + 1
17377: and #$07
17378: ora GTAB
17379: sta (BUFPNT),y
17380: iny
17381: lda BTAB + 1
17382: and #$F0
17383: lsr a
17384: lsr a
17385: lsr a
17386: lsr a
17387: tax
17388: lda LF77F,x
17389: asl a
17390: ora GTAB + 1
17391: sta GTAB + 1
17392: lda BTAB + 1
17393: and #$0F
17394: tax
17395: lda LF77F,x
17396: rol a
17397: rol a
17398: rol a
17399: rol a
17400: sta GTAB + 2
17401: rol a
17402: and #$01
17403: ora GTAB + 1
17404: sta (BUFPNT),y
17405: iny
17406: lda BTAB + 2
17407: and #$F0
17408: lsr a
17409: lsr a
17410: lsr a
17411: lsr a
17412: tax
17413: lda LF77F,x
17414: clc
17415: ror a
17416: ora GTAB + 2
17417: sta (BUFPNT),y
17418: iny
17419: ror a
17420: and #$80
17421: sta GTAB + 3
17422: lda BTAB + 2
17423: and #$0F
17424: tax
17425: lda LF77F,x
17426: asl a
17427: asl a
17428: and #$7C
17429: ora GTAB + 3
17430: sta GTAB + 3
17431: lda BTAB + 3
17432: and #$F0
17433: lsr a
17434: lsr a
17435: lsr a
17436: lsr a
17437: tax
17438: lda LF77F,x
17439: ror a
17440: ror GTAB + 4
17441: ror a
17442: ror GTAB + 4
17443: ror a
17444: ror GTAB + 4
17445: and #$03
17446: ora GTAB + 3
17447: sta (BUFPNT),y
17448: iny
17449: bne LF76F
17450: lda SAVPNT + 1
17451: sta BUFPNT + 1
17452: LF76F:
17453: lda BTAB + 3
17454: and #$0F
17455: tax
17456: lda LF77F,x
17457: ora GTAB + 4
17458: sta (BUFPNT),y
17459: iny
17460: sty GCRPNT
17461: rts
17462: LF77F:
17463: .byte $0A,$0B,$12,$13,$0E,$0F,$16,$17
17464: .byte $09,$19,$1A,$1B,$0D,$1D,$1E,$15
17465: LF78F:
17466: lda #$00
17467: sta BUFPNT
17468: sta SAVPNT
17469: sta BYTCNT
17470: lda #$BB
17471: sta GCRPNT
17472: sta GCRFLG
17473: lda BUFPNT + 1
17474: sta SAVPNT + 1
17475: lda #$01
17476: sta BUFPNT + 1
17477: lda DBID
17478: sta BTAB
17479: ldy BYTCNT
17480: lda (SAVPNT),y
17481: sta BTAB + 1
17482: iny
17483: lda (SAVPNT),y
17484: sta BTAB + 2
17485: iny
17486: lda (SAVPNT),y
17487: sta BTAB + 3
17488: iny
17489: LF7BA:
17490: sty BYTCNT
17491: jsr LF6D0
17492: ldy BYTCNT
17493: lda (SAVPNT),y
17494: sta BTAB
17495: iny
17496: beq LF7D9
17497: lda (SAVPNT),y
17498: sta BTAB + 1
17499: iny
17500: lda (SAVPNT),y
17501: sta BTAB + 2
17502: iny
17503: lda (SAVPNT),y
17504: sta BTAB + 3
17505: iny
17506: bne LF7BA
17507: LF7D9:
17508: lda CHKSUM
17509: sta BTAB + 1
17510: lda #$00
17511: sta BTAB + 2
17512: sta BTAB + 3
17513: jmp LF6D0
17514: LF7E6:
17515: ldy GCRPNT
17516: lda (BUFPNT),y
17517: and #$F8
17518: lsr a
17519: lsr a
17520: lsr a
17521: sta GTAB
17522: lda (BUFPNT),y
17523: and #$07
17524: asl a
17525: asl a
17526: sta GTAB + 1
17527: iny
17528: bne LF802
17529: lda NXTBF
17530: sta BUFPNT + 1
17531: ldy NXTPNT
17532: LF802:
17533: lda (BUFPNT),y
17534: and #$C0
17535: rol a
17536: rol a
17537: rol a
17538: ora GTAB + 1
17539: sta GTAB + 1
17540: lda (BUFPNT),y
17541: and #$3E
17542: lsr a
17543: sta GTAB + 2
17544: lda (BUFPNT),y
17545: and #$01
17546: asl a
17547: asl a
17548: asl a
17549: asl a
17550: sta GTAB + 3
17551: iny
17552: lda (BUFPNT),y
17553: and #$F0
17554: lsr a
17555: lsr a
17556: lsr a
17557: lsr a
17558: ora GTAB + 3
17559: sta GTAB + 3
17560: lda (BUFPNT),y
17561: and #$0F
17562: asl a
17563: sta GTAB + 4
17564: iny
17565: lda (BUFPNT),y
17566: and #$80
17567: clc
17568: rol a
17569: rol a
17570: and #$01
17571: ora GTAB + 4
17572: sta GTAB + 4
17573: lda (BUFPNT),y
17574: and #$7C
17575: lsr a
17576: lsr a
17577: sta GTAB + 5
17578: lda (BUFPNT),y
17579: and #$03
17580: asl a
17581: asl a
17582: asl a
17583: sta GTAB + 6
17584: iny
17585: bne LF85A
17586: lda NXTBF
17587: sta BUFPNT + 1
17588: ldy NXTPNT
17589: LF85A:
17590: lda (BUFPNT),y
17591: and #$E0
17592: rol a
17593: rol a
17594: rol a
17595: rol a
17596: ora GTAB + 6
17597: sta GTAB + 6
17598: lda (BUFPNT),y
17599: and #$1F
17600: sta GTAB + 7
17601: iny
17602: sty GCRPNT
17603: ldx GTAB
17604: lda LF8A0,x
17605: ldx GTAB + 1
17606: ora LF8C0,x
17607: sta BTAB
17608: ldx GTAB + 2
17609: lda LF8A0,x
17610: ldx GTAB + 3
17611: ora LF8C0,x
17612: sta BTAB + 1
17613: ldx GTAB + 4
17614: lda LF8A0,x
17615: ldx GTAB + 5
17616: ora LF8C0,x
17617: sta BTAB + 2
17618: ldx GTAB + 6
17619: lda LF8A0,x
17620: ldx GTAB + 7
17621: ora LF8C0,x
17622: sta BTAB + 3
17623: rts
17624: LF8A0:
17625: .byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
17626: .byte $FF,$80,$00,$10,$FF,$C0,$40,$50
17627: .byte $FF,$FF,$20,$30,$FF,$F0,$60,$70
17628: .byte $FF,$90,$A0,$B0,$FF,$D0,$E0,$FF
17629: LF8C0:
17630: .byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
17631: .byte $FF,$08,$00,$01,$FF,$0C,$04,$05
17632: .byte $FF,$FF,$02,$03,$FF,$0F,$06,$07
17633: .byte $FF,$09,$0A,$0B,$FF,$0D,$0E,$FF
17634: LF8E0:
17635: lda #$00
17636: sta GCRPNT
17637: sta SAVPNT
17638: sta BYTCNT
17639: lda #$01
17640: sta NXTBF
17641: lda #$BA
17642: sta NXTPNT
17643: lda BUFPNT + 1
17644: sta SAVPNT + 1
17645: jsr LF7E6
17646: lda BTAB
17647: sta BID
17648: ldy BYTCNT
17649: lda BTAB + 1
17650: sta (SAVPNT),y
17651: iny
17652: lda BTAB + 2
17653: sta (SAVPNT),y
17654: iny
17655: lda BTAB + 3
17656: sta (SAVPNT),y
17657: iny
17658: LF90C:
17659: sty BYTCNT
17660: jsr LF7E6
17661: ldy BYTCNT
17662: lda BTAB
17663: sta (SAVPNT),y
17664: iny
17665: beq LF92B
17666: lda BTAB + 1
17667: sta (SAVPNT),y
17668: iny
17669: lda BTAB + 2
17670: sta (SAVPNT),y
17671: iny
17672: lda BTAB + 3
17673: sta (SAVPNT),y
17674: iny
17675: bne LF90C
17676: LF92B:
17677: lda BTAB + 1
17678: sta CHKSUM
17679: lda SAVPNT + 1
17680: sta BUFPNT + 1
17681: rts
17682: LF934:
17683: lda BUFPNT + 1
17684: sta SAVPNT + 1
17685: lda #$00
17686: sta BUFPNT + 1
17687: lda #$24
17688: sta GCRPNT
17689: lda HBID
17690: sta BTAB
17691: lda HEADER + 4
17692: sta BTAB + 1
17693: lda HEADER + 3
17694: sta BTAB + 2
17695: lda HEADER + 2
17696: sta BTAB + 3
17697: jsr LF6D0
17698: lda HEADER + 1
17699: sta BTAB
17700: lda HEADER
17701: sta BTAB + 1
17702: lda #$00
17703: sta BTAB + 2
17704: sta BTAB + 3
17705: jsr LF6D0
17706: lda SAVPNT + 1
17707: sta BUFPNT + 1
17708: rts
17709: LF969:
17710: ldy JOBN
17711: sta JOBS0,y
17712: lda GCRFLG
17713: beq LF975
17714: jsr LF5F2
17715: LF975:
17716: jsr LF98F
17717: ldx SAVSP
17718: txs
17719: jmp LF2BE
17720: LF97E:
17721: lda #$A0
17722: sta DRVST
17723: lda VDC_PB2
17724: ora #VDC_PB2_DRIVE0MOTOR
17725: sta VDC_PB2
17726: .if CompileDrive >= DRIVE_1571
17727: lda #$32
17728: .elseif CompileDrive >= DRIVE_1570
17729: lda #$7D
17730: .else
17731: lda #$3C
17732: .endif
17733: sta ACLTIM
17734: rts
17735: LF98F:
17736: ldx CDRIVE
17737: lda DRVST
17738: ora #$10
17739: sta DRVST
17740: .if CompileDrive >= DRIVE_1570
17741: jmp LA62B
17742: FillNOP 2
17743: .else
17744: lda #$FF
17745: sta ACLTIM
17746: rts
17747: .endif
17748: LF99C:
17749: lda VDC_T1HL2
17750: sta VDC_T1HC2
17751: lda VDC_PB2
17752: and #VDC_PB2_WRITEPROTECT
17753: cmp LWPT
17754: sta LWPT
17755: .if CompileDrive >= DRIVE_1570
17756: jmp LA634
17757: FillNOP 3
17758: .else
17759: beq LF9B1
17760: lda #$01
17761: sta WPSW
17762: .endif
17763: LF9B1:
17764: lda PHASE
17765: beq LF9CB
17766: cmp #$02
17767: bne LF9C1
17768: lda #$00
17769: sta PHASE
17770: beq LF9CB
17771: LF9C1:
17772: sta STEPS
17773: lda #$02
17774: sta PHASE
17775: jmp LFA2E
17776: LF9CB:
17777: ldx CDRIVE
17778: bmi LF9D6
17779: lda DRVST
17780: tay
17781: cmp #$20
17782: bne LF9D9
17783: LF9D6:
17784: jmp LFABE
17785: LF9D9:
17786: dec ACLTIM
17787: bne LF9FA
17788: tya
17789: bpl LF9E4
17790: and #$7F
17791: sta DRVST
17792: LF9E4:
17793: and #$10
17794: beq LF9FA
17795: .if CompileDrive >= DRIVE_1570
17796: dec GCRERR
17797: bne LF9FA
17798: nop
17799: jsr L8770
17800: .else
17801: lda VDC_PB2
17802: and # ~ VDC_PB2_DRIVE0MOTOR
17803: sta VDC_PB2
17804: .endif
17805: lda #$FF
17806: sta CDRIVE
17807: lda #$00
17808: sta DRVST
17809: beq LF9D6
17810: LF9FA:
17811: tya
17812: and #$40
17813: bne LFA02
17814: jmp LFABE
17815: LFA02:
17816: jmp (NXTST)
17817: LFA05:
17818: lda STEPS
17819: bpl LFA0E
17820: eor #$FF
17821: clc
17822: adc #$01
17823: LFA0E:
17824: cmp MINSTP
17825: bcs LFA1C
17826: lda #<LFA3B
17827: sta NXTST
17828: lda #>LFA3B
17829: sta NXTST + 1
17830: bne LFA2E
17831: LFA1C:
17832: sbc AS
17833: sbc AS
17834: sta RSTEPS
17835: lda AS
17836: sta ACLSTP
17837: lda #<LFA7B
17838: sta NXTST
17839: lda #>LFA7B
17840: sta NXTST + 1
17841: LFA2E:
17842: lda STEPS
17843: bpl LFA63
17844: .if CompileDrive >= DRIVE_1541C_01 .AND CompileDrive <> DRIVE_1541C_03
17845: .if CompileDrive >= DRIVE_1570
17846: jmp LFF45
17847: .else
17848: jmp LFF36
17849: .endif
17850: FillNOP 3
17851: LFA38:
17852: jmp LFA69
17853:
17854: .else
17855:
17856: inc STEPS
17857: ldx VDC_PB2
17858: dex
17859: jmp LFA69
17860: .endif
17861:
17862: LFA3B:
17863: lda STEPS
17864: bne LFA2E
17865: lda #<LFA4E
17866: sta NXTST
17867: lda #>LFA4E
17868: sta NXTST + 1
17869: lda #$05
17870: sta ACLSTP
17871: jmp LFABE
17872: LFA4E:
17873: dec ACLSTP
17874: bne LFABE
17875: lda DRVST
17876: and #$BF
17877: sta DRVST
17878: lda #<LFA05
17879: sta NXTST
17880: lda #>LFA05
17881: sta NXTST + 1
17882: jmp LFABE
17883: LFA63:
17884: dec STEPS
17885: ldx VDC_PB2
17886: inx
17887: LFA69:
17888: txa
17889: and #VDC_PB2_STEPPER
17890: sta TMP
17891: lda VDC_PB2
17892: and # ~ VDC_PB2_STEPPER
17893: ora TMP
17894: sta VDC_PB2
17895: jmp LFABE
17896: LFA7B:
17897: sec
17898: lda VDC_T1HL2
17899: sbc AF
17900: sta VDC_T1HC2
17901: dec ACLSTP
17902: bne LFA94
17903: lda AS
17904: sta ACLSTP
17905: lda #<LFA97
17906: sta NXTST
17907: lda #>LFA97
17908: sta NXTST + 1
17909: LFA94:
17910: jmp LFA2E
17911: LFA97:
17912: dec RSTEPS
17913: bne LFA94
17914: lda #<LFAA5
17915: sta NXTST
17916: lda #>LFAA5
17917: sta NXTST + 1
17918: bne LFA94
17919: LFAA5:
17920: lda VDC_T1HL2
17921: clc
17922: adc AF
17923: sta VDC_T1HC2
17924: dec ACLSTP
17925: bne LFA94
17926: lda #<LFA4E
17927: sta NXTST
17928: lda #>LFA4E
17929: sta NXTST + 1
17930: lda #$05
17931: sta ACLSTP
17932: LFABE:
17933: lda VDC_PCR2
17934: and #$FD
17935: sta VDC_PCR2
17936: rts
17937: LFAC7:
17938: lda FTNUM
17939: bpl LFAF5
17940: ldx DRIVE
17941: lda #$60
17942: sta DRVST,x
17943: lda #$01
17944: sta DRVTRK,x
17945: sta FTNUM
17946: lda #$A4
17947: sta STEPS
17948: lda VDC_PB2
17949: and # ~ VDC_PB2_STEPPER
17950: sta VDC_PB2
17951: lda #$0A
17952: sta BUFFER3 + 32
17953: lda #$A0
17954: sta BUFFER3 + 33
17955: lda #$0F
17956: sta BUFFER3 + 34
17957: jmp LF99C
17958: LFAF5:
17959: ldy #$00
17960: cmp (HDRPNT),y
17961: beq LFB00
17962: sta (HDRPNT),y
17963: jmp LF99C
17964: LFB00:
17965: lda VDC_PB2
17966: and #VDC_PB2_WRITEPROTECT
17967: bne LFB0C
17968: lda #$08
17969: jmp LFDD3
17970: LFB0C:
17971: jsr LFDA3
17972: jsr LFDC3
17973: lda #$55
17974: sta VDC_PA2
17975: jsr LFDC3
17976: jsr LFE00
17977: jsr LF556
17978: lda #$40
17979: ora VBC_ACR1
17980: sta VBC_ACR1
17981: lda #$62
17982: sta VBC_T1LL1
17983: lda #$00
17984: sta VBC_T1HL1
17985: sta VBC_T1HC1
17986: ldy #$00
17987: ldx #$00
17988: LFB39:
17989: bit VDC_PB2
17990: bmi LFB39
17991: LFB3E:
17992: bit VDC_PB2
17993: bpl LFB3E
17994: LFB43:
17995: lda VBC_T1LC1
17996: LFB46:
17997: bit VDC_PB2
17998: bpl LFB5C
17999: lda VBC_IFR1
18000: asl a
18001: bpl LFB46
18002: inx
18003: bne LFB43
18004: iny
18005: bne LFB43
18006: lda #$02
18007: jmp LFDD3
18008: LFB5C:
18009: stx T2
18010: sty T3
18011: ldx #$00
18012: ldy #$00
18013: LFB64:
18014: lda VBC_T1LC1
18015: LFB67:
18016: bit VDC_PB2
18017: bmi LFB7D
18018: lda VBC_IFR1
18019: asl a
18020: bpl LFB67
18021: inx
18022: bne LFB64
18023: iny
18024: bne LFB64
18025: lda #$02
18026: jmp LFDD3
18027: LFB7D:
18028: sec
18029: txa
18030: sbc T2
18031: tax
18032: sta T1
18033: tya
18034: sbc T3
18035: tay
18036: sta T2
18037: bpl LFB97
18038: eor #$FF
18039: tay
18040: txa
18041: eor #$FF
18042: tax
18043: inx
18044: bne LFB97
18045: iny
18046: LFB97:
18047: tya
18048: bne LFB9E
18049: cpx #$04
18050: bcc LFBB6
18051: LFB9E:
18052: asl T1
18053: rol T2
18054: clc
18055: lda T1
18056: adc BUFFER3 + 33
18057: sta BUFFER3 + 33
18058: lda T2
18059: adc BUFFER3 + 34
18060: sta BUFFER3 + 34
18061: jmp LFB0C
18062: LFBB6:
18063: ldx #$00
18064: ldy #$00
18065: clv
18066: LFBBB:
18067: lda VDC_PB2
18068: bpl LFBCE
18069: bvc LFBBB
18070: clv
18071: inx
18072: bne LFBBB
18073: iny
18074: bne LFBBB
18075: lda #$03
18076: jmp LFDD3
18077: LFBCE:
18078: txa
18079: asl a
18080: sta BUFFER3 + 37
18081: tya
18082: rol a
18083: sta BUFFER3 + 36
18084: lda #$BF
18085: and VBC_ACR1
18086: sta VBC_ACR1
18087: lda #$66
18088: sta BUFFER3 + 38
18089: ldx SECTR
18090: ldy #$00
18091: tya
18092: LFBEA:
18093: clc
18094: adc BUFFER3 + 38
18095: bcc LFBF1
18096: iny
18097: LFBF1:
18098: iny
18099: dex
18100: bne LFBEA
18101: eor #$FF
18102: sec
18103: adc #$00
18104: clc
18105: adc BUFFER3 + 37
18106: bcs LFC03
18107: dec BUFFER3 + 36
18108: LFC03:
18109: tax
18110: tya
18111: eor #$FF
18112: sec
18113: adc #$00
18114: clc
18115: adc BUFFER3 + 36
18116: bpl LFC15
18117: lda #$04
18118: jmp LFDD3
18119: LFC15:
18120: tay
18121: txa
18122: ldx #$00
18123: LFC19:
18124: sec
18125: sbc SECTR
18126: bcs LFC21
18127: dey
18128: bmi LFC24
18129: LFC21:
18130: inx
18131: bne LFC19
18132: LFC24:
18133: stx BUFFER3 + 38
18134: .if CompileDrive = DRIVE_1541C_02
18135: cpx #$02
18136: .else
18137: cpx #$04
18138: .endif
18139: bcs LFC30
18140: lda #$05
18141: jmp LFDD3
18142: LFC30:
18143: clc
18144: adc SECTR
18145: sta BUFFER3 + 39
18146: lda #$00
18147: sta BUFFER3 + 40
18148: ldy #$00
18149: ldx DRIVE
18150: LFC3F:
18151: lda HBID
18152: sta BUFFER0,y
18153: iny
18154: iny
18155: lda BUFFER3 + 40
18156: sta BUFFER0,y
18157: iny
18158: lda FTNUM
18159: sta BUFFER0,y
18160: iny
18161: lda DiskID0 + 1,x
18162: sta BUFFER0,y
18163: iny
18164: lda DiskID0,x
18165: sta BUFFER0,y
18166: iny
18167: lda #$0F
18168: sta BUFFER0,y
18169: iny
18170: sta BUFFER0,y
18171: iny
18172: lda #$00
18173: eor NDBL,y
18174: eor NDBL + 1,y
18175: eor NDBH,y
18176: eor NDBH + 1,y
18177: sta WBAM,y
18178: inc BUFFER3 + 40
18179: lda BUFFER3 + 40
18180: cmp SECTR
18181: bcc LFC3F
18182: tya
18183: pha
18184: .if CompileDrive >= DRIVE_1541_01
18185: inx
18186: .elseif CompileDrive >= DRIVE_1540
18187: nop
18188: .else
18189: ldx #$00
18190: .endif
18191: txa
18192: LFC88:
18193: sta BUFFER2,x
18194: inx
18195: bne LFC88
18196: lda #$03
18197: sta BUFPNT + 1
18198: jsr LFE30
18199: pla
18200: tay
18201: dey
18202: jsr LFDE5
18203: jsr LFDF5
18204: lda #$05
18205: sta BUFPNT + 1
18206: jsr LF5E9
18207: sta CHKSUM
18208: jsr LF78F
18209: lda #$00
18210: sta HDRPNT
18211: .if CompileDrive >= DRIVE_1541C_02 .AND CompileDrive < DRIVE_1570
18212: jsr LC002
18213: .else
18214: jsr LFE0E
18215: .endif
18216:
18217: LFCB1:
18218: lda #$FF
18219: sta VDC_PA2
18220: ldx #$05
18221: LFCB8:
18222: bvc LFCB8
18223: clv
18224: dex
18225: bne LFCB8
18226: ldx #$0A
18227: ldy HDRPNT
18228: LFCC2:
18229: bvc LFCC2
18230: clv
18231: lda BUFFER0,y
18232: sta VDC_PA2
18233: iny
18234: dex
18235: bne LFCC2
18236: ldx #INTRA_SECTOR_GAP
18237: LFCD1:
18238: bvc LFCD1
18239: clv
18240: lda #$55
18241: sta VDC_PA2
18242: dex
18243: bne LFCD1
18244: lda #$FF
18245: ldx #$05
18246: LFCE0:
18247: bvc LFCE0
18248: clv
18249: sta VDC_PA2
18250: dex
18251: bne LFCE0
18252: ldx #$BB
18253: LFCEB:
18254: bvc LFCEB
18255: clv
18256: lda NODRV + 1,x
18257: sta VDC_PA2
18258: inx
18259: bne LFCEB
18260: ldy #$00
18261: LFCF9:
18262: bvc LFCF9
18263: clv
18264: lda (BUFPNT),y
18265: sta VDC_PA2
18266: iny
18267: bne LFCF9
18268: lda #$55
18269: ldx BUFFER3 + 38
18270: LFD09:
18271: bvc LFD09
18272: clv
18273: sta VDC_PA2
18274: dex
18275: bne LFD09
18276: lda HDRPNT
18277: clc
18278: adc #$0A
18279: sta HDRPNT
18280: dec BUFFER3 + 40
18281: bne LFCB1
18282: LFD1E:
18283: bvc LFD1E
18284: clv
18285: LFD21:
18286: bvc LFD21
18287: clv
18288: jsr LFE00
18289: lda #$C8
18290: sta BUFFER3 + 35
18291: LFD2C:
18292: lda #$00
18293: sta BUFPNT
18294: lda #$03
18295: sta BUFPNT + 1
18296: lda SECTR
18297: sta BUFFER3 + 40
18298: LFD39:
18299: jsr LF556
18300: ldx #$0A
18301: ldy #$00
18302: LFD40:
18303: bvc LFD40
18304: clv
18305: lda VDC_PA2
18306: cmp (BUFPNT),y
18307: bne LFD58
18308: iny
18309: dex
18310: bne LFD40
18311: clc
18312: lda BUFPNT
18313: adc #$0A
18314: sta BUFPNT
18315: jmp LFD62
18316: LFD58:
18317: dec BUFFER3 + 35
18318: bne LFD2C
18319: lda #$06
18320: jmp LFDD3
18321: LFD62:
18322: jsr LF556
18323: ldy #$BB
18324: LFD67:
18325: bvc LFD67
18326: clv
18327: lda VDC_PA2
18328: cmp NODRV + 1,y
18329: bne LFD58
18330: iny
18331: bne LFD67
18332: ldx #$FC
18333: LFD77:
18334: bvc LFD77
18335: clv
18336: lda VDC_PA2
18337: cmp BUFFER2,y
18338: bne LFD58
18339: iny
18340: dex
18341: bne LFD77
18342: dec BUFFER3 + 40
18343: bne LFD39
18344: inc FTNUM
18345: lda FTNUM
18346: cmp #$24
18347: bcs LFD96
18348: jmp LF99C
18349: LFD96:
18350: lda #$FF
18351: sta FTNUM
18352: lda #$00
18353: sta GCRFLG
18354: lda #$01
18355: jmp LF969
18356: LFDA3:
18357: lda VDC_PCR2
18358: and #$1F
18359: ora #$C0
18360: sta VDC_PCR2
18361: lda #$FF
18362: sta VDC_DDRA2
18363: sta VDC_PA2
18364: ldx #$28
18365: ldy #$00
18366: LFDB9:
18367: bvc LFDB9
18368: clv
18369: dey
18370: bne LFDB9
18371: dex
18372: bne LFDB9
18373: rts
18374: LFDC3:
18375: ldx BUFFER3 + 33
18376: ldy BUFFER3 + 34
18377: LFDC9:
18378: bvc LFDC9
18379: clv
18380: dex
18381: bne LFDC9
18382: dey
18383: bpl LFDC9
18384: rts
18385: LFDD3:
18386: dec BUFFER3 + 32
18387: beq LFDDB
18388: jmp LF99C
18389: LFDDB:
18390: ldy #$FF
18391: sty FTNUM
18392: iny
18393: sty GCRFLG
18394: jmp LF969
18395: LFDE5:
18396: lda BUFFER0,y
18397: sta BUFFER0 + 69,y
18398: dey
18399: bne LFDE5
18400: lda BUFFER0
18401: sta BUFFER0 + 69
18402: rts
18403: LFDF5:
18404: ldy #$44
18405: LFDF7:
18406: lda L01BB,y
18407: sta (BUFPNT),y
18408: dey
18409: bpl LFDF7
18410: rts
18411: LFE00:
18412: lda VDC_PCR2
18413: ora #$E0
18414: sta VDC_PCR2
18415: lda #$00
18416: sta VDC_DDRA2
18417: rts
18418:
18419: LFE0E:
18420: WRITE_55_TIMES $2800
18421: rts
18422:
18423:
18424: LFE30:
18425: lda #$00
18426: sta BUFPNT
18427: sta SAVPNT
18428: sta BYTCNT
18429: lda #$BB
18430: sta GCRPNT
18431: lda BUFPNT + 1
18432: sta SAVPNT + 1
18433: lda #$01
18434: sta BUFPNT + 1
18435: LFE44:
18436: ldy BYTCNT
18437: lda (SAVPNT),y
18438: sta BTAB
18439: iny
18440: lda (SAVPNT),y
18441: sta BTAB + 1
18442: iny
18443: lda (SAVPNT),y
18444: sta BTAB + 2
18445: iny
18446: lda (SAVPNT),y
18447: sta BTAB + 3
18448: iny
18449: beq LFE64
18450: sty BYTCNT
18451: jsr LF6D0
18452: jmp LFE44
18453: LFE64:
18454: jmp LF6D0
18455:
18456: IRQ:
18457: .if CompileDrive >= DRIVE_1570
18458: jmp (VIRQJOB1570)
18459: .else
18460: pha
18461: txa
18462: pha
18463: .endif
18464: tya
18465: pha
18466: lda VBC_IFR1
18467: and #$02
18468: beq LFE76
18469: jsr SetATNPending
18470: LFE76:
18471: lda VDC_IFR2
18472: asl a
18473: bpl LFE7F
18474: jsr LF2B0
18475: LFE7F:
18476: pla
18477: tay
18478: pla
18479: tax
18480: pla
18481: rti
18482: LFE85:
18483: .byte $12,$04,$04,$90
18484:
18485: CmdChars:
18486: .byte "VIDMBUP&"
18487: CmdChars_With2Files:
18488: .byte "CRSN"
18489: CmdChars_END:
18490:
18491: CmdAddresses_Low:
18492: .byte <cmd_validate,<cmd_init,<cmd_duplicate,<cmd_memory,<cmd_block,<cmd_user
18493: .byte <cmd_position,<cmd_ampersand,<cmd_copy,<cmd_rename,<cmd_scratch,<cmd_new
18494:
18495: CmdAddresses_High:
18496: .byte >cmd_validate,>cmd_init,>cmd_duplicate,>cmd_memory,>cmd_block,>cmd_user
18497: .byte >cmd_position,>cmd_ampersand,>cmd_copy,>cmd_rename,>cmd_scratch,>cmd_new
18498:
18499: CmdSyntaxFlags:
18500:
18501: .byte $51,$DD,$1C,$9E,$1C
18502:
18503: LFEB2:
18504: .byte "RWAM"
18505: LFEB6:
18506: .byte "DSPUL"
18507: LFEBB:
18508: .byte "DSPUR"
18509: LFEC0:
18510: .byte "EERSE"
18511: LFEC5:
18512: .byte "LQGRL"
18513:
18514: DriveLEDMasks:
18515: .byte VDC_PB2_DRIVE0LED, VDC_PB2_DRIVE1LED
18516:
18517: LFECC:
18518: .byte $00
18519: LFECD:
18520: .byte $3F
18521: LFECE:
18522: .byte $7F
18523: LFECF:
18524: .byte $BF
18525: LFED0:
18526: .byte $FF
18527: LFED1:
18528: .byte $11,$12,$13,$15
18529: LFED5:
18530: .byte $41
18531: LFED6:
18532: .byte $04
18533:
18534: MaxTrack1541:
18535: SpeedZoneChange:
18536: .byte 36, 31, 25, 18
18537:
18538: LFEDB:
18539: .byte $01,$FF,$FF,$01,$00
18540: TableHighBytesOfBuffers:
18541: .byte $03,$04,$05,$06,$07,$07
18542:
18543: LFEE6:
18544: .byte DRIVE_CHKSUM_FEE6
18545: LFEE7:
18546: jmp (VNMI)
18547:
18548: .if CompileDrive >= DRIVE_1540
18549: PATCH_PostFailError:
18550: PATCH_POSTFAILERROR
18551: jmp PATCH_PostFailError_END
18552: .else
18553: FillCount 9
18554: .endif
18555:
18556: .if CompileDrive >= DRIVE_1541_01
18557: LFEF3:
18558: txa
18559: ldx #$05
18560: LFEF6:
18561: dex
18562: bne LFEF6
18563: tax
18564: rts
18565:
18566: LFEFB:
18567: jsr SetClockOut
18568: jmp ClearDataOut
18569: LFF01:
18570: lda CMDBUF + 2
18571: cmp #'-'
18572: beq LFF0D
18573: sec
18574: sbc #'+'
18575: bne LFEE7
18576: LFF0D:
18577: sta DRVTRK + 1
18578: rts
18579: .endif
18580:
18581: .if CompileDrive >= DRIVE_1541_05
18582: FillUntil $FF10
18583:
18584:
18585:
18586:
18587: PATCH_INIT_BC:
18588: stx VBC_DDRA1
18589:
18590:
18591: lda #VBC_PB1_1540_DATAOUT
18592: .if CompileDrive >= DRIVE_1570
18593: jmp PATCH_INIT_BC_1570
18594: .else
18595: sta VBC_PB1
18596: .endif
18597: PATCH_INIT_BC_1570_END:
18598: lda #VBC_PB1_1540_DATAOUT | VBC_PB1_1540_CLOCKOUT | VBC_PB1_1540_ATNA
18599: sta VBC_DDRB1
18600: jmp PATCH_INIT_BC_END
18601:
18602: LFF20:
18603: lda VBC_PB1
18604: and #VBC_PB1_1540_DATAIN
18605: bne LFF20
18606: lda #>$0100
18607: sta VBC_T1HC1
18608: jmp LE9DF
18609: .endif
18610:
18611: LFF2F:
18612: .if CompileDrive = DRIVE_1541_06AA
18613: lda #$FF
18614: sta FTNUM
18615: jmp LC8C6
18616: .endif
18617:
18618: .if CompileDrive >= DRIVE_1541C_01
18619: lda #$FF
18620: sta FTNUM
18621:
18622: .if CompileDrive >= DRIVE_1570
18623: lda VBC_PAUNBUF1
18624: and #VBC_PA1_20
18625: bne LFF3D
18626: lda #$24
18627: .byte ASM_BIT3
18628: LFF3D:
18629: lda #MAXTRACK_DOUBLESIDED + 1
18630: sta MAXTRACK_ADJUSTED
18631: jmp LA779
18632: LFF45:
18633: tya
18634: pha
18635: ldy #$64
18636: LFF49:
18637: lda VBC_PAUNBUF1
18638: ror a
18639: php
18640: lda VBC_PAUNBUF1
18641: ror a
18642: ror a
18643: plp
18644: and #$80
18645: bcc LFF5C
18646: bpl LFF77
18647: bmi LFF5E
18648: LFF5C:
18649: bmi LFF77
18650: LFF5E:
18651: dey
18652: bne LFF49
18653: bcs LFF77
18654: lda VDC_PB2
18655: and #VDC_PB2_STEPPER
18656: bne LFF77
18657: lda ADRSED
18658: bne LFF77
18659: pla
18660: tay
18661: lda #$00
18662: sta STEPS
18663: jmp LFABE
18664: LFF77:
18665: pla
18666: tay
18667: inc STEPS
18668: ldx VDC_PB2
18669: dex
18670: jmp LFA38
18671:
18672: LFF82:
18673: jsr LF259
18674: lda #$05
18675: sta BYTE
18676: lda #$88
18677: sta VIRQJOB1570
18678: lda #$9D
18679: sta VIRQJOB1570 + 1
18680: lda #MAXTRACK_SINGLESIDED + 1
18681: sta MAXTRACK_ADJUSTED
18682: clc
18683: jmp L93F3
18684:
18685:
18686: LFF9C:
18687: sta NODRV
18688: jmp LC100
18689: LFFA1:
18690: sta ADRSED
18691: jmp LD676
18692:
18693:
18694: LFFA6:
18695: jsr LD676
18696: lda #$00
18697: sta ADRSED
18698: rts
18699: LFFAE:
18700: ldy LINDX
18701: jmp LD3DE
18702:
18703: .else
18704: jmp LC8C6
18705: .if CompileDrive <> DRIVE_1541C_03
18706: LFF36:
18707: txa
18708: pha
18709: tya
18710: pha
18711: ldx #$01
18712: LFF3C:
18713: ldy #$64
18714:
18715: LFF3E:
18716: lda VBC_PAUNBUF1
18717: cmp VBC_PAUNBUF1
18718: bne LFF62
18719: dey
18720: bne LFF3E
18721: dex
18722: bne LFF3C
18723: and #VBC_PA1_01
18724: beq LFF62
18725: lda VDC_PB2
18726: and #VDC_PB2_STEPPER
18727: bne LFF62
18728: .if CompileDrive >= DRIVE_1541C_02 .AND CompileDrive < DRIVE_1570
18729: lda ADRSED
18730: bne LFF62
18731: .endif
18732: pla
18733: tay
18734: pla
18735: tax
18736: lda #$00
18737: sta STEPS
18738: jmp LFABE
18739: LFF62:
18740: pla
18741: tay
18742: pla
18743: tax
18744: inc STEPS
18745: ldx VDC_PB2
18746: dex
18747: jmp LFA38
18748: LFF6F:
18749: jsr LF259
18750: lda #$01
18751: sta TRACK0
18752: lda #$C0
18753: sta JOBS0
18754: rts
18755:
18756:
18757: .endif
18758:
18759: .if CompileDrive >= DRIVE_1541C_02 .AND CompileDrive < DRIVE_1570
18760:
18761: LFF7F:
18762: sta NODRV
18763: jmp LC100
18764: .if CompileDrive <> DRIVE_1541C_03
18765: LFF84:
18766: sta ADRSED
18767: jmp LD676
18768: LFF89:
18769: jsr LD676
18770: lda #$00
18771: sta ADRSED
18772: rts
18773: .endif
18774: LFF91:
18775: cmp #$02
18776: bcc LFF9C
18777: cmp #$0F
18778: beq LFF9C
18779: jmp LD36B
18780: LFF9C:
18781: jmp LD373
18782:
18783: PATCH_ShortReset:
18784: sei
18785:
18786: ldx #<SP_END
18787: txs
18788:
18789: jmp PATCH_ShortReset_END
18790:
18791: Patch_ClearPALatch_ProcessBus:
18792: bit VBC_PA1
18793: jmp ProcessBus
18794:
18795: LFFAC:
18796: lda a:NODRV,x
18797: rts
18798: LFFB0:
18799: ldx DRVNUM
18800: lda a:NODRV,x
18801: jmp LF01B
18802: LFFB8:
18803: lda #$00
18804: sta a:NODRV,x
18805: jmp LC1B7
18806: LFFC0:
18807: tya
18808: sta a:NODRV,x
18809: jmp LC664
18810: LFFC7:
18811: sta WPSW,x
18812: sta a:NODRV,x
18813: jmp LD075
18814:
18815: .endif
18816: .endif
18817: .endif
18818:
18819: .if (CompileDrive >= DRIVE_1541_02) .AND (CompileDrive <= DRIVE_1541_03)
18820: FillUntil $FFE2
18821:
18822: .byte "RSR"
18823: .endif
18824:
18825: .if CompileDrive >= DRIVE_1541C_02 .AND CompileDrive < DRIVE_1570
18826:
18827: FillUntil $FFE5
18828: .byte DRIVE_CHKSUM_FFE5
18829:
18830: .endif
18831:
18832: FillUntil $FFE6
18833:
18834: .if CompileDrive >= DRIVE_1540
18835: .addr LC8C6
18836: .else
18837: .addr LFAC7
18838: .endif
18839: .addr LF98F
18840:
18841:
18842:
18843: AddressesUxCommands:
18844: .addr CMD_U1
18845: .addr CMD_U2
18846: .addr BUFFER2
18847: .addr BUFFER2 + 3
18848: .addr BUFFER2 + 6
18849: .addr BUFFER2 + 9
18850: .addr BUFFER2 + 12
18851: .addr BUFFER2 + 15
18852:
18853: .if CompileDrive >= DRIVE_1541_01
18854: .addr LFF01
18855: .else
18856: .addr LFEE7
18857: .endif
18858: .addr RESET
18859: .addr IRQ
18860:
18861:
18862:
18863:
18864:
18865:
18866:
18867:
18868:
18869:
floppyrom.a65.full.html; generated on Fri Sep 18 21:44:53 2015 by ca65html
uz@cc65.org