Changes

UIDE Universal IDE adapter cards for Z-80 computers

178 bytes added, 08:55, 8 March 2019
/* BASIC program to load the PCW driver from a DOM or CF card */
To get the PCW xdriver from the image, enter the following program into BASIC and run it. It will retrieve the driver from the IDE device and write it to the currently logged-in disk. The driver file is written to the first three sectors on the IDE device, so that even if you format it, you can still use the BASIC program to restore the FID (because track 0 is reserved by the driver for future use).
[code] 10 REM uIDE bootstrap - load FID from uIDE track 0 20 MEMORY &HCFF0 30 : 40 PRINT 50 PRINT "uIDE-8 PCW driver retrieval program" 60 PRINT "Copyright (c) Jon Bradbury 2019" 70 PRINT 80 REM for XDRV release v1.11 use fidStart%=&HD000: fidEnd%=&HD4FF: fidSec%=3 85 REM for XDRV release v1.12 use fidStart%=&HD000: fidEnd%=&HD544: fidSec%=3 87 fidStart%=&HD000: fidEnd%=&HD544: fidSec%=3 90 cfBase%=&HC8 100 cfData%=cfBase% 110 cfFeatures%=cfBase%+1 120 cfError%=cfBase%+1 130 cfSecCount%=cfBase%+2 140 cfLBA0%=cfBase%+3 150 cfLBA1%=cfBase%+4 160 cfLBA2%=cfBase%+5 170 cfHead%=cfBase%+6 180 cfStatus%=cfBase%+7 190 cfCommand%=cfBase%+7 200 cf8Bit%=1 210 cfReadSec%=&H20 220 cfMaster%=&HE0 230 cfSetFeat%=&HEF 240 tout%=0: addr%=fidStart% 250 GOSUB 850 260 : 270 GOSUB 580: REM cfWait 280 IF tout%=1 THEN GOTO 560: REM check for timeout 290 : 300 REM init IDE device 310 CALL di% 320 OUT cfFeatures%,cf8Bit% 330 OUT cfCommand%, cfSetFeat% 340 CALL ei% 350 GOSUB 580: REM cfWait 360 : 370 REM retrieve FID 380 PRINT "Retrieving driver: [ ]"; 390 FOR x=0 TO 24: PRINT CHR$(8);: NEXT x 400 FOR secNo% = 1 TO fidSec% 410 GOSUB 680: REM get current sector 420 NEXT secNo% 430 PRINT 440 PRINT "Writing xdrv.fid: [ ]"; 450 FOR x=0 TO 22: PRINT CHR$(8);: NEXT x 460 OPEN "R",#1,"xdrv.fid",1 470 FIELD #1,1 AS d0$ 480 FOR addr%=fidStart% TO fidEnd% 490 LSET d0$=CHR$(PEEK(addr%)) 500 PUT #1 510 IF addr% MOD &H40 = 0 THEN PRINT CHR$(128); 520 NEXT addr% 530 CLOSE #1 540 PRINT: PRINT: PRINT "Done." 550 PRINT "Copy xdrv.fid to your PCW CP/M boot disk and reboot." 560 END 570 : 580 REM cfWait 590 FOR try%= 0 TO 31 600 CALL di% 610 status% = INP(cfStatus%) 620 CALL ei% 630 IF (status% <> &HFF) AND (status% AND &H80 <> 0) THEN RETURN 640 NEXT try% 650 PRINT "IDE device timeout - check it is connected." 660 tout%=1 670 RETURN 680 : 690 REM get sector in secNo%, copy to buffer 700 CALL di% 710 OUT cfLBA0%,secNo% 720 OUT cfLBA1%,0 730 OUT cfLBA2%,0 740 OUT cfHead%,cfMaster% 750 OUT cfSecCount%,1 760 OUT cfCommand%,cfReadSec% 770 CALL ei% 780 GOSUB 570 790 FOR byte%=0 TO 511 800 POKE addr%,INP(cfData%) 810 addr%=addr%+1 820 IF addr% MOD &H40 = 0 THEN PRINT CHR$(128); 830 NEXT byte% 840 RETURN 850 : 860 REM load up ei-di routines 870 DATA &HF3,&HC9,&HFB,&HC9 880 FOR x=&HCFF1 TO &HCFF4 890 READ inst% 900 POKE x,inst% 910 NEXT x 920 di%=&HCFF1 930 ei%=&HCFF3 940 RETURN[/code]
'''To use the program.'''
412
edits