From 19890fa4ab5c3dc6f802eb542b49be8e228c4dba Mon Sep 17 00:00:00 2001 From: Bobbi Webber-Manners Date: Thu, 24 Oct 2019 17:10:08 -0400 Subject: [PATCH] Starting work on code to load & run .COM files --- SOFTCARD80.ASM#040000 | 54 ++++++++++++++++++++++++++++++------------ SOFTCARD80.BIN#041000 | Bin 43011 -> 43011 bytes zapple2.po | Bin 819200 -> 819200 bytes 3 files changed, 39 insertions(+), 15 deletions(-) diff --git a/SOFTCARD80.ASM#040000 b/SOFTCARD80.ASM#040000 index 14dccbd..b976c75 100644 --- a/SOFTCARD80.ASM#040000 +++ b/SOFTCARD80.ASM#040000 @@ -16,14 +16,10 @@ ; ; TODO: F_WRITE bug turns out to be bug in ProDOS 2.5.0a7 (SET_MARK) -; Or maybe I was trashing memory. Need to retest. -; TODO: How does DIR / NSWEEP work out file sizes? Need to support this. ; TODO: Implement missing system calls: -; - F_ATTRIB +; - F_ATTRIB (needs to support wildcards, leave FCB at DMAADDR) ; - RS232 (A_READ, A_WRITE) ; - Printer (LWRITE) -; TODO: F_ATTRIB needs to work with FCB with wildcards and leave the FCB at -; DMAADDR ; TODO: IOBYTE doesn't do anything ; TODO: User number doesn't do anything ; TODO: Software R/O disk setting is not respected @@ -1019,7 +1015,7 @@ F_READ PUSH DE ; Copy pointer to FCB ... CP 0 ; See if there was some other error JP NZ,FRERR ; If so, return code 0FFH (h/w error) - LD HL,(DMAADDR) ; Read from DMA buffer address + LD HL,(DMAADDR) ; Write data starting at DMA buffer addr LD BC,OFFSET ; Convert to 6502 address ADD HL,BC ; ... LD (FRMLIDB),HL ; Store I/O buffer address in parm list @@ -1253,8 +1249,8 @@ F_READRAND PUSH DE ; Copy pointer to FCB ... LD (SMMLIN),A ; Store in parameter list for SET_MARK LD (FRMLIN),A ; Store in parameter list for READ - LD L,(IX+21H) ; Load LSB of random record number - LD H,(IX+22H) ; Load MSB of random record number + LD L,(IX+21H) ; Load random record number (LSB) + LD H,(IX+22H) ; Load random record number (MSB) CALL RRN2LEN ; Leaves the length in bytes in HL LD (SMMLIP1),HL ; Write 16 bit length in FRMLIP1,FRMLIP2 XOR A ; Set FRMLIP3 to zero @@ -1268,7 +1264,7 @@ F_READRAND PUSH DE ; Copy pointer to FCB ... CP 0 ; See if there was some other error JP NZ,FRRERR ; If so, return code 0FFH (h/w error) - LD HL,(DMAADDR) ; Read from DMA buffer address + LD HL,(DMAADDR) ; Write data starting at DMA buffer addr LD BC,OFFSET ; Convert to 6502 address ADD HL,BC ; ... LD (FRMLIDB),HL ; Store I/O buffer address in parm list @@ -1281,8 +1277,8 @@ F_READRAND PUSH DE ; Copy pointer to FCB ... CP 0 ; See if there was some other error JP NZ,FRRERR ; If so, return code 0FFH (h/w error) - LD L,(IX+21H) ; Load LSB of random record number - LD H,(IX+22H) ; Load MSB of random record number + LD L,(IX+21H) ; Load random record number (LSB) + LD H,(IX+22H) ; Load random record number (MSB) CALL RECS2EXRC ; Puts extent in B, recs in A LD A,(IX+20H),A ; Update sequential record number LD B,(IX+0CH),B ; Update sequential extent number @@ -1316,8 +1312,8 @@ F_WRITERAND PUSH DE ; Copy pointer to FCB ... LD HL,GEMLI ; Pass address of 6502 JSR instruction CALL PRODOS ; Invoke ProDOS MLI - GET_EOF - LD L,(IX+21H) ; Load LSB of random record number - LD H,(IX+22H) ; Load MSB of random record number + LD L,(IX+21H) ; Load random record number (LSB) + LD H,(IX+22H) ; Load random record number (MSB) CALL RRN2LEN ; Leaves the length in bytes in HL LD (SMMLIP1),HL ; 16 bit len in SMMLIP1,2 for SET_MARK XOR A ; Set SMMLIP3 to zero @@ -1355,8 +1351,8 @@ FWRS1 LD HL,SMMLI ; Pass address of 6502 JSR instruction CP 0 ; See if there was some other error JP NZ,FWRERR ; If so, return code 0FFH (h/w error) - LD L,(IX+21H) ; Load LSB of random record number - LD H,(IX+22H) ; Load MSB of random record number + LD L,(IX+21H) ; Load random record number (LSB) + LD H,(IX+22H) ; Load random record number (MSB) CALL RECS2EXRC ; Puts extent in B, recs in A LD A,(IX+20H),A ; Update sequential record number LD B,(IX+0CH),B ; Update sequential extent number @@ -1872,6 +1868,34 @@ N2H2 OR 0F0H ; INC DE ; RET +; Load and run a .COM file to 0100H +; DE is the address of the FCB describing the file to run +RUNCOM CALL F_OPEN ; + CP 0 ; + JP NZ,RCOERR ; Open error + LD HL,(DMAADDR) ; + PUSH HL ; Preserve DMAADDR + LD HL,0100H ; Set DMAADDR to 0100H + LD (DMAADDR),HL ; ... +RCL1 CALL F_READ ; Read records until done + CP 0 ; ... + JP Z,RCL1 ; ... + POP HL ; Restore DMAADDR + LD (DMAADDR),HL ; ... + CP 1 ; Check it was EOF + JP NZ,RCLERR ; Load error + JP PROGSTRT ; 0100H + RET +RCOERR LD DE,OEMSG ; 'Open error' message + CALL C_WRITESTR ; + RET +RCLERR LD DE,REMSG ; 'Read error' message + CALL C_WRITESTR ; + RET + +OEMSG DEFM 'Not found',13,'$' +REMSG DEFM 'Read error',13,'$' + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Additional private scratch space for BDOS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/SOFTCARD80.BIN#041000 b/SOFTCARD80.BIN#041000 index ecf1d8b038028e9cb389a2fe206a73930970d334..f6003ed903f29ace24d52153f247afa71e26655b 100644 GIT binary patch delta 837 zcmZuvPe>F|9DcLAW{Rx4Vp}*M^OjB<6%75cQ92~Fhr&XFPQ@6y9RjzcFbXu#gY$N0 z=gmC21i`w8N-C`OB9Uoov@`nD7R)Xic+gH;(xs$!?al03B+cQy?|tuk-}n3dn1Myt zz@qD!;I5_yt-;4Pqy7aFa`TnW(NEK--ERl0O+&N{an=y$()`d>j{8jF%HFoHL1)yZ z!pbN$wBn`(kk|+~;HwIbW0=PDxmpBM07(x#eODpu&juv_asS&`8 zu>+i`k|sz|2{f!>_^JG|1xahT5vRg4cfI0uJ}OIJ7_s5*CnjRhu1J|?)rI;o9|t|pzd z#t+)gEWR7&B0;*Y{f$@R<@iVOCdsFZ9^I~V8J8xu{XxjD=TB|mhxrrPU249yLWjTX zZdn@*YPrH=>fxGuO<}H3a5gH*+68nzU>o98s1AxvWHcnn+!-ef+ z8g^mBpXiAjLot`~~90gRt@7rO=8X5rrmcQfemI z?3W$z*1GYa1(h_$L%~*St(dOa8igMB&_5tpyeI4ICQ=OUVdl-7H{bid$7WlOY|F6} zc6w(O-3J%UslXhGIytv}49wQAIKSk)8HJxw_^iU`>fDoiEc=WU^GB|kWqm{1?(9@` zMedp!gZU7{GQ*z813(j?*Q749&R`)4our>{09v!Ss0O+wcalTZPBJWn7?f7_GuJ&r zl63RIkp)0c`!8cySb$#T7)EJw9CL@85NLw#!q)mKuYWI5hsPLUlE9-ZCi6IS%5Dn9 z`b9K6wMl2%+%|TMX+OUNd>V}Durcn__d%ovRlW{rk^I7(D+A~u@fSu9QIY&Vkyzkd z0BDY+3TNCso1*T{?EQ2?#5ZAfs<#8Yd^yaFLe`5O|RA62F`eW|U>^ ztt`yYZCMtwbo(F+Ir2tMrNYd|wUesoHY=YQhW;1yqtvIkDzavUqV=n)=rAi|&ne!x zrHWp&Vrgul1#EfazA8HH3#!sms_3G8x_9@j^v|(5Pb*s%`U?w$DB7x03o5qQ*84sD O^7*Z+# diff --git a/zapple2.po b/zapple2.po index 7eacc873c8bb73a6c08f43b3e3bafc22566f01be..66461023bcd42a06866111d17cd07a235e281e1f 100644 GIT binary patch delta 929 zcmZuvTSyd97(TPtv#YE-qFcBidzK*Bs9@+~qx6u_J|q?r)l0D(Y7d25QWyogP@p?| znKKhH5CrQ!lu}`rhn2|I)M#gPv=+=>HjvPswxpMm+O;!#DUt@hIsf_2H{buAp9uz; zV32uy!dL}q06qcxsqK)y;WrNYjTC{7Ku=&GFed#*Q>xyoifT1JxDlWiB#+bNG#B@@ zI@snk5tx&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