OSFILE updates it's control block. *RUN works.

This commit is contained in:
Bobbi Webber-Manners 2021-08-20 21:03:42 -04:00
parent 77215e1566
commit fa4a88585d
3 changed files with 36 additions and 15 deletions

Binary file not shown.

View File

@ -1,8 +1,7 @@
* FILESYS.S * AUXMEM.HOSTFS.S
********************************************************* * (c) Bobbi 2021 GPL v3
*
* AppleMOS Host File System * AppleMOS Host File System
*********************************************************
* OSFIND - open/close a file for byte access * OSFIND - open/close a file for byte access
FINDHND PHX FINDHND PHX
@ -172,7 +171,9 @@ FILEHND PHX
PHA PHA
STX ZP1 ; LSB of parameter block STX ZP1 ; LSB of parameter block
STX CBPTR
STY ZP1+1 ; MSB of parameter block STY ZP1+1 ; MSB of parameter block
STY CBPTR+1
LDA #<FILEBLK LDA #<FILEBLK
STA ZP2 STA ZP2
LDA #>FILEBLK LDA #>FILEBLK
@ -247,7 +248,19 @@ FILEHND PHX
:S2 >>> XF2MAIN,LOADFILE :S2 >>> XF2MAIN,LOADFILE
OSFILERET OSFILERET
>>> ENTAUX >>> 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 CPY #$FF ; LOAD
BNE :S4 ; Deal with return from SAVE BNE :S4 ; Deal with return from SAVE
@ -291,6 +304,7 @@ OSFILERET
PLX PLX
RTS RTS
CBPTR DW $0000
OSFILEM ASC 'OSFILE($' OSFILEM ASC 'OSFILE($'
DB $00 DB $00
OSFILEM2 ASC ')' OSFILEM2 ASC ')'
@ -328,7 +342,7 @@ FSCRUN STX OSFILECB ; Pointer to filename
LDX #<OSFILECB ; Pointer to control block LDX #<OSFILECB ; Pointer to control block
LDY #>OSFILECB LDY #>OSFILECB
JSR OSFILE JSR OSFILE
* JMP (AUXBLK) ; DOESN'T WORK AS EXPECTED!!! JMP (OSFILECB+6) ; Jump to EXEC addr
RTS RTS
FSCREN FSCREN
LDA #<OSFSCM LDA #<OSFSCM

View File

@ -409,7 +409,7 @@ LOADFILE >>> ENTMAIN
LDA FBEXEC ; If FBEXEC is zero, use addr LDA FBEXEC ; If FBEXEC is zero, use addr
CMP #$00 ; in the control block CMP #$00 ; in the control block
BEQ :CBADDR BEQ :CBADDR
* TODOL Load file (without addr) needs to fill in CB * TODO: Load file (without addr) needs to fill in CB
LDA #<MOSFILE ; Otherwise use file addr LDA #<MOSFILE ; Otherwise use file addr
STA GINFOPL+1 STA GINFOPL+1
LDA #>MOSFILE LDA #>MOSFILE
@ -424,8 +424,7 @@ LOADFILE >>> ENTMAIN
LDY GINFOPL+6 ; Aux type MSB LDY GINFOPL+6 ; Aux type MSB
STY FBLOAD+1 STY FBLOAD+1
STY FBEXEC+1 STY FBEXEC+1
:CBADDR JSR PASSADDR ; Load addr -> code in aux bank :CBADDR LDA FBLOAD
LDA FBLOAD
STA A4L STA A4L
LDA FBLOAD+1 LDA FBLOAD+1
LDX :BLOCKS LDX :BLOCKS
@ -449,14 +448,21 @@ LOADFILE >>> ENTMAIN
:EOF2 LDA OPENPL+5 ; File ref num :EOF2 LDA OPENPL+5 ; File ref num
STA CLSPL+1 STA CLSPL+1
JSR CLSFILE JSR CLSFILE
:EXIT >>> XF2AUX,OSFILERET :EXIT JSR COPYFB ; Copy FILEBLK to auxmem
>>> XF2AUX,OSFILERET
:BLOCKS DB $00 :BLOCKS DB $00
* Stash address in XY to first two bytes of AUXBLK * Copy FILEBLK to AUXBLK in aux memory
PASSADDR >>> ALTZP ; Alt ZP and LC COPYFB LDX #$00
STX AUXBLK :L1 LDA FILEBLK,X
STY AUXBLK+1 TAY
>>> ALTZP ; Alt ZP and LC
TYA
STA AUXBLK,X
>>> MAINZP ; Back to normal >>> MAINZP ; Back to normal
INX
CPX #18 ; 18 bytes in FILEBLK
BNE :L1
RTS RTS
* ProDOS file handling for MOS OSFILE SAVE call * ProDOS file handling for MOS OSFILE SAVE call
@ -595,7 +601,8 @@ SAVEFILE >>> ENTMAIN
BCC :EXIT ; If close OK BCC :EXIT ; If close OK
* TODO: After SAVE CB XY+10..XY+17 needs updating * TODO: After SAVE CB XY+10..XY+17 needs updating
LDA #$02 ; Write error LDA #$02 ; Write error
:EXIT >>> XF2AUX,OSFILERET :EXIT JSR COPYFB ; Copy FILEBLK to aux mem
>>> XF2AUX,OSFILERET
:LEN DW $0000 :LEN DW $0000
:BLOCKS DB $00 :BLOCKS DB $00