8-Bit Software Online Conversion
Scan Disc DFS - Listing
10 REM Scan drive [,drive]
20 MODE6
30 HIMEM=HIMEM-&A00
40 OSRDCH=&FFE0
50 OSASCI=&FFE3
60 OSWORD=&FFF1
70 buffer=&70
80 FORI%=0 TO 3 STEP 3
90 P%=&900
100 [OPTI%
110 .scan
120 LDY #0
130 .findend
140 LDA(&F2),Y:INY:CMP#13:BEQhelp:CMP#
32:BNE findend:BEQ findd1
150 .help
160 JSR print
170 EQUB10
180 EQUS"DFS Scandisk "
190 EQUW&0A0D
200 EQUS"*Scan drive [,drive]"
210 EQUW&0A0D
220 EQUB0
230 RTS ½ Retur
n to Basic
310 .findd1
320 LDA(&F2),Y:CMP #32:BNE gck1
330 .skip1
340 INY:LDA(&F2),Y:CMP #32:BEQ skip1
350 .gck1
360 CMP#13:BNE clrbuf1:JMP help
370 .clrbuf1
380 LDA #32:LDX #16
390 .clr1
400 DEX:STA buffer,X:BNE clr1
410 .getd1
420 LDA (&F2),Y:STA buffer,X
430 INY:INX
440 CMP #13:BNE getd1
450
460 .loop
470 LDX xstore
480 LDA buffer,X:INX:STX xstore
490 CMP #13:BEQ end
500 CMP #32:BEQ loop
510 CMP #44:BEQ loop
520 JSR do:JMP loop
530 .end
540 LDA #13:JSR OSASCI
550 RTS ½ Retur
n to Basic
560
570 .do
580 SEC:SBC #48:CMP #4:BMI valid:JMP h
elp
590 .valid
600 STA drive
610 JSR print
620 EQUB&0D
630 EQUS"Scanning :"
640 EQUB0
650 LDA drive:CLC:ADC #48:JSR OSASCI
660 LDY #0:STY track
670 LDA #46:JSR OSASCI:JSR pdecimal
672 LDA #48:STA errcnt
680 JSR osword
690 LDA ern:BEQ ok1:JSR doerror ½ er
ror check
700 .ok1
710 LDX HIMEM+&106:AND #&0F ½ No.
sectors hibyte
720 LDA #40:CPX #1:BEQ t40:ASL A
730 .t40
740 STA count:DEC count
750 .loop2
760 INC track
770 JSR pdecimal
780 JSR osword
790 LDA ern:BEQ ok2
½ error check
800 JSR doerror:BCS out
810 .ok2
820 DEC count:BNE loop2
830 LDA errcnt:CMP #48:BNE out
840 JSR print
850 EQUW&0909
860 EQUW&0909
870 EQUS"ok"
880 EQUB0
890 RTS
900 .out
910 JSR print
920 EQUW&0909
930 EQUW&0909
940 .errcnt EQUB 48
950 EQUS" errors"
960 EQUB0
970 RTS
980
990 .doerror
992 INC errcnt
994 LDA errcnt:CMP #57:BCS errend
1000 LDA #10:JSR OSASCI
1002 .errend
1010 RTS
1020
1030 .pdecimal
1040 LDY track:STY &81
1050 LDA #&30
1060 STA &80
1070 LDA #0
1080 LDX &81
1090 BEQ zero
1100 SED
1110 CLC
1120 .back
1130 ADC #1
1140 BCC nocarry
1150 INC &80
1160 CLC
1170 .nocarry
1180 DEX
1190 BNE back
1200 CLD
1210 .zero
1220 TAY
1230 ½ LDA &80 ½ hundreds
1240 ½ JSR OSASCI
1250 ½ TYA
1260 LSR A
1270 LSR A
1280 LSR A
1290 LSR A
1300 CLC
1310 ADC #&30
1320 JSR OSASCI
1330 TYA
1340 AND #&0F
1350 ADC #&30
1360 JSR OSASCI
1370 LDA #8:JSR OSASCI:JSR OSASCI ½ J
SR OSASCI
1380 RTS
1390
1400 .print
1410 LDY #0:PLA:STA pr1+2:PLA:STA pr1+3
1420 .pr1
1430 INY:LDA &FFFF,Y ½DUMMY
1440 JSR OSASCI:BNE pr1
1450 TYA:CLC:ADC pr1+2:TAX:BCC pr2:INC
pr1+3
1460 .pr2
1470 LDA pr1+3:PHA:TXA:PHA:RTS
1480 .osword
1490 LDA #&7F:LDX #drive MOD &100:LDY #
drive DIV &100:JSR OSWORD:RTS
1500 .drive EQUB 0
1510 EQUB HIMEM MOD &100
1520 EQUB HIMEM DIV &100
1530 EQUB 0
1540 EQUB 0
1550 EQUB 3
1560 EQUB &53
1570 .track EQUB 0
1580 EQUB 0
1590 EQUB &20+10
1600 .ern EQUB 0
1610 .xstore EQUB 0
1620 .count EQUB 0
1640 ]
1650 NEXT
1660 PRINT'" *SAVE SCAN "STR$÷scan" "ST
R$÷P%