8-Bit Software Online Conversion
Quick Format DFS - Listing
10 REM QFORM drive [,drive]
20 MODE6
30 HIMEM=HIMEM-&200
40 OSRDCH=&FFE0
50 OSASCI=&FFE3
60 OSWORD=&FFF1
70 buffer=&70
90 FORI%=0 TO 3 STEP 3
100 P%=&900
110 [OPTI%
120 .form
130 LDY #0
140 .findend
150 LDA(&F2),Y:INY:CMP#13:BEQhelp:CMP#
32:BNE findend:BEQ findd1
160 .help
170 JSR print
180 EQUB10
190 EQUS"DFS quick format "
200 EQUW&0A0D
210 EQUS"*QFORM drive [,drive]"
220 EQUW&0A0D
230 EQUB0
240 RTS ½ Retur
n to Basic
250 .error
260 JSR print
270 EQUW&0A0D
280 EQUS"Disc error"
290 EQUW&0A0D
300 EQUB0
310 RTS ½ Retur
n to Basic
320 .findd1
330 LDA(&F2),Y:CMP #32:BNE gck1
340 .skip1
350 INY:LDA(&F2),Y:CMP #32:BEQ skip1
360 .gck1
370 CMP#13:BNE clrbuf1:JMP help
380 .clrbuf1
390 LDA #32:LDX #16
400 .clr1
410 DEX:STA buffer,X:BNE clr1
420 .getd1
430 LDA (&F2),Y:STA buffer,X
440 INY:INX
450 CMP #13:BNE getd1
460
470 JSR print
480 EQUB10
490 EQUS"Press any key when ready"
500 EQUW&0A0D
510 EQUB0
520 JSR OSRDCH
530 .loop
540 LDX xstore
550 LDA buffer,X:INX:STX xstore
560 CMP #13:BEQ end
570 CMP #32:BEQ loop
580 CMP #44:BEQ loop
590 JSR do:JMP loop
600 .end
610 RTS ½ Retur
n to Basic
620 .do
630 SEC:SBC #48:CMP #4:BMI valid:JMP h
elp
640 .valid
650 STA drive
660 LDA #&53:STA command:JSR osword
670 LDA ern:BEQ ok1:JMP error ½ erro
r check
680 .ok1
690 LDA HIMEM+&106:AND #&0F:STA hisize
700 LDA HIMEM+&107:STA losize
710
720 JSR resetdir ½ Set up directory
730 LDA #&4B:STA command:JSR osword
740 LDA ern:BEQ ok2:JMP error ½ erro
r check
750 .ok2
760 RTS
770
780 .resetdir
790 LDA #0:TAY:TAX
800 .DLP1
810 STA HIMEM,X
820 STA HIMEM+&100,X
830 INX:DEY:BNE DLP1
840 LDA hisize:STA HIMEM+&106
850 LDA losize:STA HIMEM+&107
860 RTS
870 .print
880 LDY #0:PLA:STA pr1+2:PLA:STA pr1+3
890 .pr1
900 INY:LDA &FFFF,Y ½DUMMY
910 JSR &FFE3:BNE pr1
920 TYA:CLC:ADC pr1+2:TAX:BCC pr2:INC
pr1+3
930 .pr2
940 LDA pr1+3:PHA:TXA:PHA:RTS
950 .osword
960 LDA #&7F:LDX #drive MOD &100:LDY #
drive DIV &100:JSR OSWORD:RTS
970 .drive
980 EQUB 0
990 EQUB HIMEM MOD &100
1000 EQUB HIMEM DIV &100
1010 EQUB 0
1020 EQUB 0
1030 EQUB 3
1040 .command
1050 EQUB 0
1060 EQUB 0
1070 EQUB 0
1080 EQUB &22
1090 .ern
1100 EQUB 0
1110 .losize EQUB0
1120 .hisize EQUB0
1130 .xstore EQUB0
1140 ]
1150 NEXT
1160 PRINT'" *SAVE QFORM "STR$÷form" "S
TR$÷P%