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
*********************************************************
* 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
STA ZP2
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 ; Pointer to control block
LDY #>OSFILECB
JSR OSFILE
* JMP (AUXBLK) ; DOESN'T WORK AS EXPECTED!!!
JMP (OSFILECB+6) ; Jump to EXEC addr
RTS
FSCREN
LDA #<OSFSCM

View File

@ -409,7 +409,7 @@ LOADFILE >>> 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 ; Otherwise use file addr
STA GINFOPL+1
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