diff --git a/auxmem.hostfs.s b/auxmem.hostfs.s index 48b7dd8..c3b9301 100644 --- a/auxmem.hostfs.s +++ b/auxmem.hostfs.s @@ -60,22 +60,31 @@ OSFINDRET >>> ENTAUX RTS * OSGBPB - Get/Put a block of bytes to/from an open file -GBPBHND PHX +* Supports commands A=1,2,3,4 others unsupported +GBPBHND CMP #4 + BCC :S1 + RTS +:S1 PHX PHY PHA + >>> WRTMAIN + STX GBPBAUXCB+0 ; Copy address of control block .. + STY GBPBAUXCB+1 ; .. to main mem + >>> WRTAUX JSR XYtoLPTR ; Copy control block to GBPBBLK .. LDY #$0C ; .. in main memory >>> WRTMAIN :L1 LDA (OSLPTR),Y STA GBPBBLK,Y DEY - BNE :L1 + BPL :L1 >>> WRTAUX - PLA ; A represents the command + PLA ; A => OSGBPB command >>> XF2MAIN,GBPB OSGBPBRET >>> ENTAUX PLY PLX + LDA #$00 ; A=0 means supported command RTS * OSBPUT - write one byte to an open file diff --git a/mainmem.fsequ.s b/mainmem.fsequ.s index fb4f610..d3c73b0 100644 --- a/mainmem.fsequ.s +++ b/mainmem.fsequ.s @@ -22,8 +22,9 @@ GBPBHDL EQU GBPBBLK+0 ; File handle GBPBDAT EQU GBPBBLK+1 ; Pointer to data (4 bytes) GBPBNUM EQU GBPBBLK+5 ; Num bytes to transfer (4 bytes) GBPBPTR EQU GBPBBLK+9 ; File pointer (4 bytes) +GBPBAUXCB EQU GBPBBLK+13 ; Address of aux control block (2 bytes) -* $038F ; $2F bytes here +* $0391 ; $2D bytes here * Control block for OSFILE FILEBLK EQU $03BE diff --git a/mainmem.svc.s b/mainmem.svc.s index f638996..d6160f9 100644 --- a/mainmem.svc.s +++ b/mainmem.svc.s @@ -327,8 +327,46 @@ CFILE >>> ENTMAIN * A=2 : Write bytes to disk, ignoring seq pointer * A=3 : Read bytes from disk, using new seq pointer * A=4 : Read bytes from disk, ignoring seq pointer +* All others unsupported GBPB >>> ENTMAIN * ... + LDY GBPBHDL ; File ref number + STY READPL2+1 +:L1 JSR MLI ; Read one byte + DB READCMD + DW READPL2 + BCS :ERR + LDA GBPBDAT+0 + STA ZPMOS+0 + LDA GBPBDAT+1 + STA ZPMOS+1 + LDA BLKBUF + >>> WRTAUX + STA (ZPMOS) ; Store byte in aux mem + >>> WRTMAIN + INC GBPBDAT+0 ; Increment data pointer + BNE :S1 + INC GBPBDAT+1 +:S1 LDA GBPBNUM+0 ; Decrement number of bytes + BNE :S2 + LDA GBPBNUM+1 + BEQ :ZERO ; Zero remaining, done! + DEC GBPBNUM+1 +:S2 DEC GBPBNUM+0 + BRA :L1 +* ... +:ERR +:ZERO LDA GBPBAUXCB+0 ; Copy control block back .. + STA ZPMOS+0 ; .. to aux memory + LDA GBPBAUXCB+1 + STA ZPMOS+1 + LDY #$0C+1 + >>> WRTAUX +:L2 LDA GBPBBLK,Y + STA (ZPMOS),Y + DEY + BPL :L2 + >>> WRTMAIN >>> XF2AUX,OSGBPBRET * ProDOS file handling for MOS OSBGET call