0100 ;SIO-PATCH FOR A HARDDISK¢0110 ;CONNECTED AT D100 OR D500¢0120 ;(C) 1999 SIMONSOFT¢0130 ;¢0140 ;EDITED 12/07/1999 VERSION 1.3¢0150 ;¢0160 ;PROGRAM STORED: CC00-CDFF¢0170 ;PARTITION INFO: CE00-CEFF¢0180 ;FREE FOR USE : CF00-CFFF¢0190 ;* 128/256 BYTES TRANSFER¢0200 ;* RESET RELOADS PARTITIONS¢0210 ;* CE06 LOAD ERRORS AFTER RESET¢0220 ;* CE07 SAVE ERRORS AFTER RESET¢0230 ;* NO HD*SC=256 LIMIT.¢0240 ;¢0250 BELL=$F556 ;ONLY ON A XL!¢0260 PART=$CE00 ;OR CASBUF¢0270 PH=PART/256¢0280 PL=0-1*PH*256+PART¢0290 PROG=$CC00¢0300 PORT=$D100 ;OR D500¢0310 *= PROG ;INT.CHAR.BASE¢0320 ;¢0330 LDA $0300 ;CHK D:¢0340 CMP #$31¢0350 BNE NOHD¢0360 ;¢0370 LDA PORT+7 ;CHK ACTIVITY¢0380 BMI NOHD¢0390 ;¢0400 LDX PART+4 ;CHK PARTITION¢0410 BEQ NOHD¢0420 CP TXA¢0430 ASL A¢0440 ASL A¢0450 ASL A¢0460 TAY¢0470 LDA PART,Y¢0480 CMP $0301 ;WITH DRIVE-NR¢0490 BEQ HD¢0500 DEX¢0510 BNE CP¢0520 ;¢0530 NOH!
D JMP $C933 ;XL-OS REV.A¢0540 ;¢0550 HD STY PART+5 ;SAVE PART¢0560 LDA #$0B¢0570 STA $37 ;10 X RETRY¢0580 LDA $304¢0590 STA $32 ;SET BUFFER¢0600 LDA $305¢0610 STA $33¢0620 LDA $302¢0630 CMP #$52¢0640 BEQ CREA¢0650 CMP #$50¢0660 BEQ CWRI¢0670 CMP #$57¢0680 BEQ CWRI¢0690 CMP #$53¢0700 BEQ STAT¢0710 CMP #$21¢0720 BEQ FORM¢0730 IOER LDY #139 ;DEVICE NAK¢0740 STY $0303¢0750 RTS¢0760 ;¢0770 FORM LDA #$FF ;PUT FF,FF¢0780 LDY #$00¢0790 STA ($32),Y¢0800 INY¢0810 STA ($32),Y¢0820 IOOK LDY #$01¢0830 STY $0303¢0840 RTS¢0850 ;¢0860 STAT LDY PART+5¢0870 LDA PART+5,Y;DENSITY?¢0880 BEQ STA2 ;0=SINGLE¢0890 LDA #$20 ;DOUBLE¢0900 STA2 STA $02EA¢0910 LDA #$00¢0920 STA $02EB ;CONTROLLER OK¢0930 STA $02ED ;NOT USED¢0940 LDA #$FF¢0950 STA $02EC ;TIME-OUT¢0960 JMP IOOK¢0970 ;¢0980 CREA JSR SETU¢0990 BNE CRRR!
¢1000 RINI LDA #$21 ;READ¢1010 STA PORT+7¢1020 JSR BUSY¢1030 BMI CRRR¢1040 LDA PORT+7¢1050 AND #$01¢1060 BNE CRRR¢1070 LDY #$00¢1080 CRE1 LDA PORT¢1090 STA ($32),Y¢1100 INY¢1110 CPY $308¢1120 BNE CRE1¢1130 JSR VERY¢1140 BNE CRRR¢1150 JMP IOOK¢1160 CRRR INC PART+6¢1170 DEC $37¢1180 BNE CREA¢1190 JMP IOER¢1200 ;¢1210 CWRI JSR SETU¢1220 BNE CWRR¢1230 LDA #$31¢1240 STA PORT+7¢1250 STA $D40A¢1260 CWR1 LDA PORT+7¢1270 AND #$08¢1280 BEQ CWR1¢1290 LDY #$00¢1300 CWR2 LDA ($32),Y¢1310 STA PORT¢1320 INY¢1330 BNE CWR2 ;ALWAYS 256¢1340 JSR BUSY¢1350 BMI CWRR¢1360 LDA PORT+7¢1370 AND #$20¢1380 BNE CWRR¢1390 JSR VERY¢1400 BNE CWRR¢1410 JMP IOOK¢1420 CWRR INC PART+7¢1430 DEC $37¢1440 BNE CWRI¢1450 JMP IOER ;-ERROR¢1460 ;¢1470 VERY LDA #$01 ;ONE SECTOR¢1480 STA PORT+2¢1490 LDA #$21 ;READ!
¢1500 STA PORT+7¢1510 JSR BUSY¢1520 BMI VERE¢1530 LDY #$00¢1540 VER1 LDA PORT¢1550 CMP ($32),Y¢1560 BNE VERE¢1570 INY¢1580 CPY $308¢1590 BNE VER1¢1600 LDA #$00¢1610 RTS¢1620 VERE LDA #$FF¢1630 RTS¢1640 ;¢1650 SETU LDA #$00¢1660 STA PART+$F6 ;HD¢1670 LDY PART+5¢1680 LDA PART+1,Y¢1690 STA PART+$F4 ;CL¢1700 LDA PART+2,Y¢1710 STA PART+$F5 ;CH¢1720 LDA $30A¢1730 STA $30¢1740 LDA $30B¢1750 STA $31¢1760 DEC $30¢1770 BNE CAL1¢1780 LDA $31¢1790 BEQ SET1¢1800 CAL1 SEC¢1810 LDA $30¢1820 SBC PART+3¢1830 BCC CAL2¢1840 STA $30¢1850 JMP CAL3¢1860 CAL2 LDX $31¢1870 BEQ SET1¢1880 STA $30¢1890 DEC $31¢1900 CAL3 INC PART+$F6¢1910 LDA PART+2¢1920 CMP PART+$F6¢1930 BCS CAL1¢1940 LDA #$00¢1950 STA PART+$F6¢1960 INC PART+$F4¢1970 BNE CAL1¢1980 INC PART+$F5¢1990 BNE CAL1¢2000 SERR LDA #!
$FF¢2010 RTS ;OVERFLOW!¢2020 ;¢2030 SET1 INC $30¢2040 LDA $30¢2050 STA PART+$F3¢2060 LDA PART+$F5 ;CHK SIZE CH¢2070 CMP PART+4,Y¢2080 BEQ SET3 ;CHK CL TOO¢2090 BCC SET2 ;OK IF <¢2100 JMP SERR ;¢2110 SET3 LDA PART+$F4¢2120 CMP PART+3,Y¢2130 BCS SERR ;ERROR IF =,>¢2140 ;¢2150 SET2 LDA #$01¢2160 STA PORT+2 ;ONE SECTOR¢2170 LDA PART+$F3¢2180 STA PORT+3¢2190 LDA PART+$F4¢2200 STA PORT+4¢2210 LDA PART+$F5¢2220 STA PORT+5¢2230 LDA PART+$F6¢2240 STA PORT+6¢2250 LDA #$00¢2260 RTS¢2270 ;¢2280 BUSY LDX #$00¢2290 BUS1 STA $D40A¢2300 STA $D40A¢2305 STA $D40A¢2308 STA $D40A¢2309 STA $D40A¢2310 STA $D40A ;0.4 mS¢2320 LDA PORT+7¢2330 BPL BUSE¢2340 INX¢2350 BNE BUS1 ;MAX=100mS¢2360 LDA #$80 ;BMI=ERROR¢2370 BUSE RTS¢2380 ;¢2390 INIT JSR BUSY¢2400 BMI NOIN¢2410 LDA #$00¢2420 STA PORT+4¢2430 STA PORT+5¢2!
440 STA PORT+6¢2450 STA $308 ;256 BYTES¢2460 LDA #$01¢2470 STA PORT+2¢2480 STA PORT+3¢2490 LDA #PL¢2500 STA $32¢2510 LDA #PH¢2520 STA $33¢2530 JSR RINI¢2540 NOIN RTS¢2550 *=$E459¢2560 JMP PROG¢2570 *=$2E0 ;INIT HDISK¢2580 .WORD INIT¢