8-Bit Software Online Conversion

Quick Format ADFS - Listing

10 REM QFORMAT drive [,drive] 20 MODE6 30 HIMEM=HIMEM-&700 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 .format 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"ADFS quick format " 190 EQUW&0A0D 200 EQUS"*QFORMAT drive [,drive]" 210 EQUW&0A0D 220 EQUB0 230 RTS ½ Retur n to Basic 240 .error 250 JSR print 260 EQUW&0A0D 270 EQUS"Disc error" 280 EQUW&0A0D 290 EQUB0 300 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 JSR print 470 EQUB10 480 EQUS"Press any key when ready" 490 EQUW&0A0D 500 EQUB0 510 JSR OSRDCH 520 .loop 530 LDX xstore 540 LDA buffer,X:INX:STX xstore 550 CMP #13:BEQ end 560 CMP #32:BEQ loop 570 CMP #44:BEQ loop 580 JSR do:JMP loop 590 .end 600 RTS ½ Retur n to Basic 610 .do 620 SEC:SBC #48:CMP #6:BMI valid:JMP h elp 630 .valid 640 ASL A:ASL A:ASL A:ASL A:ASL A 650 STA drive 660 LDA #&08:STA command:JSR osword 670 LDA block:BEQ ok1:JMP error ½ er ror check 680 .ok1 690 LDA HIMEM+&FD:STA hisize 700 LDA HIMEM+&FC:STA losize 710 720 JSR resetdir ½ Set up directory 730 LDA #&0A:STA command:JSR osword 740 LDA block:BEQ ok2:JMP error ½ er ror 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 STA HIMEM+&200,X 840 STA HIMEM+&300,X 850 STA HIMEM+&400,X 860 STA HIMEM+&500,X 870 STA HIMEM+&600,X 880 INX:DEY:BNE DLP1 890 CLC 900 LDA #7:STA HIMEM ½ start sector of first free space 910 LDX hisize:STX HIMEM+&0FD 920 ADC hisize ½ sectors on disc 930 LDX losize:STX HIMEM+&0FC 940 ADC losize 950 STA HIMEM+&0FF ½ check sum 960 LDA #&F9:STA HIMEM+&100 ½ length of first free space 970 LDA #&09:STA HIMEM+&101 ½ in sectors 980 LDA #&AD:STA HIMEM+&1FB ½ disc ID 990 LDA #&55:STA HIMEM+&1FC ½ disc ID 1000 LDA #&03:STA HIMEM+&1FE ½ pointer to end of free space list 1010 LDA #&08:STA HIMEM+&1FF ½ check sum 1020 LDA #&48:STA HIMEM+&201 ½ H 1030 LDA #&75:STA HIMEM+&202 ½ u 1040 LDA #&67:STA HIMEM+&203 ½ g 1050 LDA #&6F:STA HIMEM+&204 ½ o 1060 LDA #&24 1070 STA HIMEM+&6CC:STA HIMEM+&6D9 ½ $ directory name & title 1080 LDA #&0D 1090 STA HIMEM+&6CD:STA HIMEM+&6DA 1100 LDA #&02:STA HIMEM+&6D6 ½ start sector of parent directory 1110 LDA #&48:STA HIMEM+&6FB ½ H 1120 LDA #&75:STA HIMEM+&6FC ½ u 1130 LDA #&67:STA HIMEM+&6FD ½ g 1140 LDA #&6F:STA HIMEM+&6FE ½ o 1150 RTS 1160 .print 1170 LDY #0:PLA:STA pr1+2:PLA:STA pr1+3 1180 .pr1 1190 INY:LDA &FFFF,Y ½DUMMY 1200 JSR &FFE3:BNE pr1 1210 TYA:CLC:ADC pr1+2:TAX:BCC pr2:INC pr1+3 1220 .pr2 1230 LDA pr1+3:PHA:TXA:PHA:RTS 1240 .osword 1250 LDA #&72:LDX #block MOD &100:LDY # block DIV &100:JSR OSWORD:RTS 1260 .block 1270 EQUB 0 1280 EQUB HIMEM MOD &100 1290 EQUB HIMEM DIV &100 1300 EQUB 0 1310 EQUB 0 1320 .command 1330 EQUB 0 1340 .drive 1350 EQUB 0 1360 EQUB 0 1370 EQUB 0 1380 EQUB 7 1390 EQUB 0 1400 EQUB 0 1410 EQUB 7 1420 EQUB 0 1430 EQUB 0 1440 .losize EQUB0 1450 .hisize EQUB0 1460 .xstore EQUB0 1470 ] 1480 NEXT 1490 PRINT'" *SAVE QFORMAT "STR$~format " "STR$~P%