diff --git a/applecorn.po b/applecorn.po index 9569af7..42e0f44 100644 Binary files a/applecorn.po and b/applecorn.po differ diff --git a/auxmem.hostfs.s b/auxmem.hostfs.s index eda41ec..0fb2885 100644 --- a/auxmem.hostfs.s +++ b/auxmem.hostfs.s @@ -1,8 +1,7 @@ -* FILESYS.S -********************************************************* +* AUXMEM.HOSTFS.S +* (c) Bobbi 2021 GPL v3 +* * AppleMOS Host File System -********************************************************* - * OSFIND - open/close a file for byte access FINDHND PHX @@ -172,7 +171,9 @@ FILEHND PHX PHA STX ZP1 ; LSB of parameter block + STX CBPTR STY ZP1+1 ; MSB of parameter block + STY CBPTR+1 LDA #FILEBLK @@ -247,7 +248,19 @@ FILEHND PHX :S2 >>> XF2MAIN,LOADFILE OSFILERET >>> ENTAUX - PLY ; Value of A on entry + PHA + LDA CBPTR ; Copy OSFILE CB to :CBPTR addr + STA ZP1 + LDA CBPTR+1 + STA ZP1+1 + LDY #$00 +:L3 LDA AUXBLK,Y ; Mainmem left it in AUXBLK + STA (ZP1),Y + INY + CPY #18 ; 18 bytes in control block + BNE :L3 + PLA + PLY ; Value of A on OSFILE entry CPY #$FF ; LOAD BNE :S4 ; Deal with return from SAVE @@ -291,6 +304,7 @@ OSFILERET PLX RTS +CBPTR DW $0000 OSFILEM ASC 'OSFILE($' DB $00 OSFILEM2 ASC ')' @@ -328,7 +342,7 @@ FSCRUN STX OSFILECB ; Pointer to filename LDX #OSFILECB JSR OSFILE -* JMP (AUXBLK) ; DOESN'T WORK AS EXPECTED!!! + JMP (OSFILECB+6) ; Jump to EXEC addr RTS FSCREN LDA #>> ENTMAIN LDA FBEXEC ; If FBEXEC is zero, use addr CMP #$00 ; in the control block BEQ :CBADDR -* TODOL Load file (without addr) needs to fill in CB +* TODO: Load file (without addr) needs to fill in CB LDA #MOSFILE @@ -424,8 +424,7 @@ LOADFILE >>> ENTMAIN LDY GINFOPL+6 ; Aux type MSB STY FBLOAD+1 STY FBEXEC+1 -:CBADDR JSR PASSADDR ; Load addr -> code in aux bank - LDA FBLOAD +:CBADDR LDA FBLOAD STA A4L LDA FBLOAD+1 LDX :BLOCKS @@ -449,14 +448,21 @@ LOADFILE >>> ENTMAIN :EOF2 LDA OPENPL+5 ; File ref num STA CLSPL+1 JSR CLSFILE -:EXIT >>> XF2AUX,OSFILERET +:EXIT JSR COPYFB ; Copy FILEBLK to auxmem + >>> XF2AUX,OSFILERET :BLOCKS DB $00 -* Stash address in XY to first two bytes of AUXBLK -PASSADDR >>> ALTZP ; Alt ZP and LC - STX AUXBLK - STY AUXBLK+1 +* Copy FILEBLK to AUXBLK in aux memory +COPYFB LDX #$00 +:L1 LDA FILEBLK,X + TAY + >>> ALTZP ; Alt ZP and LC + TYA + STA AUXBLK,X >>> MAINZP ; Back to normal + INX + CPX #18 ; 18 bytes in FILEBLK + BNE :L1 RTS * ProDOS file handling for MOS OSFILE SAVE call @@ -595,7 +601,8 @@ SAVEFILE >>> ENTMAIN BCC :EXIT ; If close OK * TODO: After SAVE CB XY+10..XY+17 needs updating LDA #$02 ; Write error -:EXIT >>> XF2AUX,OSFILERET +:EXIT JSR COPYFB ; Copy FILEBLK to aux mem + >>> XF2AUX,OSFILERET :LEN DW $0000 :BLOCKS DB $00