2021-09-07 02:28:07 +00:00
|
|
|
* MAINMEM.SVC.S
|
|
|
|
* (c) Bobbi 2021 GPLv3
|
2021-07-31 21:33:08 +00:00
|
|
|
*
|
2021-09-07 02:28:07 +00:00
|
|
|
* Main memory entry points called by Applecorn MOS running in
|
|
|
|
* aux memory. Each entry point performs some ProDOS service,
|
|
|
|
* then returns to aux memory.
|
2021-07-28 04:17:47 +00:00
|
|
|
|
2021-08-30 23:08:22 +00:00
|
|
|
* TO DO: All OSFILE calls combined and dispatch in here
|
|
|
|
* All start with PREPATH, UPDFB, COPYFB then branch
|
|
|
|
* to relevent routine.
|
|
|
|
|
|
|
|
INFOFILE >>> ENTMAIN
|
2021-09-01 00:10:34 +00:00
|
|
|
JSR PREPATH ; Preprocess path
|
2021-08-30 23:08:22 +00:00
|
|
|
JSR UPDFB ; Update FILEBLK
|
|
|
|
JSR COPYFB ; Copy back to aux mem
|
|
|
|
>>> XF2AUX,OSFILERET
|
|
|
|
|
|
|
|
|
2021-08-22 00:13:06 +00:00
|
|
|
* ProDOS file handling to delete a file
|
2021-08-27 03:32:40 +00:00
|
|
|
* Called by AppleMOS OSFILE
|
2021-08-29 05:13:31 +00:00
|
|
|
* Return A=0 no object, A=1 file deleted, A=2 dir deleted
|
|
|
|
* A>$1F ProDOS error
|
|
|
|
DELFILE >>> ENTMAIN
|
2021-09-01 00:10:34 +00:00
|
|
|
JSR PREPATH ; Preprocess pathname
|
2021-08-29 05:13:31 +00:00
|
|
|
JSR UPDFB ; Update FILEBLK
|
|
|
|
JSR COPYFB ; Copy back to aux mem
|
|
|
|
PHA ; Save object type
|
2021-09-10 22:21:49 +00:00
|
|
|
JSR DODELETE
|
2021-08-29 05:13:31 +00:00
|
|
|
BCC :DELETED
|
|
|
|
PLX ; Drop object
|
|
|
|
JSR CHKNOTFND
|
|
|
|
PHA
|
|
|
|
:DELETED PLA ; Get object back
|
|
|
|
:EXIT >>> XF2AUX,OSFILERET
|
|
|
|
|
2021-09-10 22:21:49 +00:00
|
|
|
DODELETE LDA #<MOSFILE ; Attempt to destroy file
|
2021-08-29 05:13:31 +00:00
|
|
|
STA DESTPL+1
|
|
|
|
LDA #>MOSFILE
|
|
|
|
STA DESTPL+2
|
|
|
|
JSR MLI
|
|
|
|
DB DESTCMD
|
|
|
|
DW DESTPL
|
|
|
|
RTS
|
2021-07-28 04:17:47 +00:00
|
|
|
|
2021-08-25 03:40:47 +00:00
|
|
|
* ProDOS file handling to create a directory
|
2021-08-27 03:32:40 +00:00
|
|
|
* Invoked by AppleMOS OSFILE
|
|
|
|
* Return A=02 on success (ie: 'directory')
|
2021-08-29 05:13:31 +00:00
|
|
|
* A>$1F ProDOS error, translated by OSFILE handler
|
|
|
|
MAKEDIR >>> ENTMAIN
|
2021-09-01 00:10:34 +00:00
|
|
|
JSR PREPATH ; Preprocess pathname
|
2021-08-29 05:13:31 +00:00
|
|
|
JSR UPDFB ; Update FILEBLK
|
|
|
|
JSR COPYFB ; Copy back to aux mem
|
|
|
|
CMP #$02
|
|
|
|
BEQ :EXIT ; Dir already exists
|
2021-08-30 23:08:22 +00:00
|
|
|
LDA #$0D ; 'Directory'
|
|
|
|
STA CREATEPL+7 ; ->Storage type
|
|
|
|
LDA #$0F ; 'Directory'
|
|
|
|
STA CREATEPL+4 ; ->File type
|
2021-08-29 05:13:31 +00:00
|
|
|
STZ CREATEPL+5 ; Aux type LSB
|
|
|
|
STZ CREATEPL+6 ; Aux type MSB
|
2021-09-07 03:43:42 +00:00
|
|
|
JSR CRTFILE ; Create MOSFILE
|
2021-08-29 05:13:31 +00:00
|
|
|
BCS :EXIT ; Failed, exit with ProDOS result
|
|
|
|
JSR UPDFB ; Update FILEBLK
|
|
|
|
JSR COPYFB ; Copy FILEBLK to aux mem
|
|
|
|
LDA #$02 ; Success, $02=dir created
|
|
|
|
:EXIT >>> XF2AUX,OSFILERET
|
2021-08-25 03:40:47 +00:00
|
|
|
|
2021-08-22 19:53:05 +00:00
|
|
|
* ProDOS file handling to rename a file
|
2021-08-29 05:13:31 +00:00
|
|
|
RENFILE >>> ENTMAIN
|
2021-09-04 06:00:26 +00:00
|
|
|
JSR PREPATH ; Preprocess arg1
|
|
|
|
JSR MFtoTMP ; Stash arg1
|
|
|
|
JSR COPYMF21 ; Copy arg2
|
|
|
|
JSR PREPATH ; Preprocess arg2
|
|
|
|
JSR COPYMF12 ; Put it back in MOSFILE2
|
|
|
|
JSR TMPtoMF ; Recover arg1->MOSFILE
|
|
|
|
LDA #<MOSFILE
|
2021-08-29 05:13:31 +00:00
|
|
|
STA RENPL+1
|
|
|
|
LDA #>MOSFILE
|
|
|
|
STA RENPL+2
|
|
|
|
LDA #<MOSFILE2
|
|
|
|
STA RENPL+3
|
|
|
|
LDA #>MOSFILE2
|
|
|
|
STA RENPL+4
|
|
|
|
JSR MLI
|
|
|
|
DB RENCMD
|
|
|
|
DW RENPL
|
2021-09-04 06:00:26 +00:00
|
|
|
>>> XF2AUX,RENRET
|
2021-08-22 19:53:05 +00:00
|
|
|
|
2021-08-22 00:13:06 +00:00
|
|
|
* ProDOS file handling for MOS OSFIND OPEN call
|
|
|
|
* Options in A: $40 'r', $80 'w', $C0 'rw'
|
2021-08-29 05:13:31 +00:00
|
|
|
OFILE >>> ENTMAIN
|
|
|
|
PHA ; Preserve arg for later
|
2021-09-01 00:10:34 +00:00
|
|
|
JSR PREPATH ; Preprocess pathname
|
2021-09-10 19:47:08 +00:00
|
|
|
PLA
|
|
|
|
PHA
|
|
|
|
CMP #$80 ; Is it "w"?
|
2021-09-10 20:11:57 +00:00
|
|
|
BEQ :NOWILD ; If so, no wildcards
|
2021-09-09 22:51:22 +00:00
|
|
|
JSR WILDONE ; Handle any wildcards
|
2021-09-10 20:11:57 +00:00
|
|
|
:NOWILD JSR EXISTS ; See if file exists ...
|
2021-09-01 01:24:12 +00:00
|
|
|
CMP #$02 ; ... and is a directory
|
|
|
|
BNE :NOTDIR
|
|
|
|
JMP :NOTFND ; Bail out if directory
|
|
|
|
:NOTDIR PLA
|
2021-09-01 00:10:34 +00:00
|
|
|
PHA
|
2021-08-29 05:13:31 +00:00
|
|
|
CMP #$80 ; Write mode
|
|
|
|
BNE :S0
|
2021-09-10 22:21:49 +00:00
|
|
|
JSR DODELETE
|
2021-08-30 23:08:22 +00:00
|
|
|
LDA #$01 ; Storage type - file
|
|
|
|
STA CREATEPL+7
|
|
|
|
LDA #$06 ; Filetype BIN
|
|
|
|
STA CREATEPL+4
|
2021-09-07 03:43:42 +00:00
|
|
|
LDA #<MOSFILE
|
2021-08-29 05:13:31 +00:00
|
|
|
STA OPENPL+1
|
|
|
|
LDA #>MOSFILE
|
|
|
|
STA OPENPL+2
|
|
|
|
LDA #$00 ; Auxtype
|
|
|
|
STA CREATEPL+5
|
|
|
|
LDA #$00
|
|
|
|
STA CREATEPL+6
|
2021-09-07 03:43:42 +00:00
|
|
|
JSR CRTFILE ; Create MOSFILE
|
2021-08-29 05:13:31 +00:00
|
|
|
:S0 LDA #$00 ; Look for empty slot
|
|
|
|
JSR FINDBUF
|
|
|
|
STX BUFIDX
|
|
|
|
CPX #$00
|
|
|
|
BNE :S1
|
|
|
|
LDA #<IOBUF1
|
|
|
|
LDY #>IOBUF1
|
|
|
|
BRA :S4
|
|
|
|
:S1 CPX #$01
|
|
|
|
BNE :S2
|
|
|
|
LDA #<IOBUF2
|
|
|
|
LDY #>IOBUF2
|
|
|
|
BRA :S4
|
|
|
|
:S2 CPX #$02
|
|
|
|
BNE :S3
|
|
|
|
LDA #<IOBUF3
|
|
|
|
LDY #>IOBUF3
|
|
|
|
BRA :S4
|
|
|
|
:S3 CPX #$03
|
|
|
|
BNE :NOTFND ; Out of buffers really
|
|
|
|
LDA #<IOBUF4
|
|
|
|
LDY #>IOBUF4
|
|
|
|
|
|
|
|
:S4 STA OPENPL2+3
|
|
|
|
STY OPENPL2+4
|
|
|
|
|
|
|
|
LDA #<MOSFILE
|
|
|
|
STA OPENPL2+1
|
|
|
|
LDA #>MOSFILE
|
|
|
|
STA OPENPL2+2
|
|
|
|
JSR MLI
|
|
|
|
DB OPENCMD
|
|
|
|
DW OPENPL2
|
|
|
|
BCS :NOTFND
|
|
|
|
LDA OPENPL2+5 ; File ref number
|
|
|
|
LDX BUFIDX
|
|
|
|
CPX #$FF
|
|
|
|
BEQ FINDEXIT
|
|
|
|
STA FILEREFS,X ; Record the ref number
|
|
|
|
BRA FINDEXIT
|
|
|
|
:NOTFND LDA #$00
|
|
|
|
FINDEXIT >>> XF2AUX,OSFINDRET
|
|
|
|
BUFIDX DB $00
|
2021-07-28 04:17:47 +00:00
|
|
|
|
|
|
|
* ProDOS file handling for MOS OSFIND CLOSE call
|
2021-08-29 05:13:31 +00:00
|
|
|
CFILE >>> ENTMAIN
|
|
|
|
LDA MOSFILE ; File ref number
|
|
|
|
STA CLSPL+1
|
|
|
|
JSR CLSFILE
|
|
|
|
LDA MOSFILE
|
|
|
|
JSR FINDBUF
|
|
|
|
CPX #$FF
|
|
|
|
BEQ :S1
|
|
|
|
LDA #$00
|
|
|
|
STA FILEREFS,X
|
|
|
|
:S1 JMP FINDEXIT
|
2021-07-28 04:17:47 +00:00
|
|
|
|
|
|
|
* ProDOS file handling for MOS OSBGET call
|
2021-08-04 13:08:19 +00:00
|
|
|
* Returns with char read in A and error num in Y (or 0)
|
2021-08-29 05:13:31 +00:00
|
|
|
FILEGET >>> ENTMAIN
|
|
|
|
LDA MOSFILE ; File ref number
|
|
|
|
STA READPL2+1
|
|
|
|
JSR MLI
|
|
|
|
DB READCMD
|
|
|
|
DW READPL2
|
|
|
|
BCC :NOERR
|
|
|
|
TAY ; Error number in Y
|
|
|
|
BRA :EXIT
|
|
|
|
:NOERR LDY #$00
|
|
|
|
LDA BLKBUF
|
|
|
|
:EXIT >>> XF2AUX,OSBGETRET
|
2021-07-28 04:17:47 +00:00
|
|
|
|
|
|
|
* ProDOS file handling for MOS OSBPUT call
|
2021-07-29 00:47:26 +00:00
|
|
|
* Enters with char to write in A
|
2021-08-29 05:13:31 +00:00
|
|
|
FILEPUT >>> ENTMAIN
|
|
|
|
STA BLKBUF ; Char to write
|
|
|
|
|
|
|
|
LDA MOSFILE ; File ref number
|
|
|
|
STA WRITEPL+1
|
|
|
|
LDA #$01 ; Bytes to write
|
|
|
|
STA WRITEPL+4
|
|
|
|
LDA #$00
|
|
|
|
STA WRITEPL+5
|
|
|
|
JSR WRTFILE
|
|
|
|
>>> XF2AUX,OSBPUTRET
|
2021-07-29 18:43:56 +00:00
|
|
|
|
|
|
|
* ProDOS file handling for OSBYTE $7F EOF
|
|
|
|
* Returns EOF status in A ($FF for EOF, $00 otherwise)
|
2021-08-29 05:13:31 +00:00
|
|
|
FILEEOF >>> ENTMAIN
|
|
|
|
|
|
|
|
LDA MOSFILE ; File ref number
|
|
|
|
STA GEOFPL+1
|
|
|
|
STA GMARKPL+1
|
|
|
|
JSR MLI
|
|
|
|
DB GEOFCMD
|
|
|
|
DW GEOFPL
|
|
|
|
BCS :ISEOF ; If error, just say EOF
|
|
|
|
|
|
|
|
JSR MLI
|
|
|
|
DB GMARKCMD
|
|
|
|
DW GMARKPL
|
|
|
|
BCS :ISEOF ; If error, just say EOF
|
|
|
|
|
|
|
|
LDA GEOFPL+2 ; Subtract Mark from EOF
|
|
|
|
SEC
|
|
|
|
SBC GMARKPL+2
|
|
|
|
STA :REMAIN
|
|
|
|
LDA GEOFPL+3
|
|
|
|
SBC GMARKPL+3
|
|
|
|
STA :REMAIN+1
|
|
|
|
LDA GEOFPL+4
|
|
|
|
SBC GMARKPL+4
|
|
|
|
STA :REMAIN+2
|
|
|
|
|
|
|
|
LDA :REMAIN ; Check bytes remaining
|
|
|
|
BNE :NOTEOF
|
|
|
|
LDA :REMAIN+1
|
|
|
|
BNE :NOTEOF
|
|
|
|
LDA :REMAIN+2
|
|
|
|
BNE :NOTEOF
|
|
|
|
:ISEOF LDA #$FF
|
|
|
|
BRA :EXIT
|
|
|
|
:NOTEOF LDA #$00
|
|
|
|
:EXIT >>> XF2AUX,CHKEOFRET
|
|
|
|
:REMAIN DS 3 ; Remaining bytes
|
2021-07-28 04:17:47 +00:00
|
|
|
|
2021-07-30 19:47:36 +00:00
|
|
|
* ProDOS file handling for OSARGS flush commands
|
2021-08-29 05:13:31 +00:00
|
|
|
FLUSH >>> ENTMAIN
|
|
|
|
LDA MOSFILE ; File ref number
|
|
|
|
STA FLSHPL+1
|
|
|
|
JSR MLI
|
|
|
|
DB FLSHCMD
|
|
|
|
DW FLSHPL
|
|
|
|
>>> XF2AUX,OSARGSRET
|
2021-07-30 19:47:36 +00:00
|
|
|
|
2021-08-01 19:28:10 +00:00
|
|
|
* ProDOS file handling for OSARGS set ptr command
|
2021-08-29 05:13:31 +00:00
|
|
|
SEEK >>> ENTMAIN
|
|
|
|
LDA MOSFILE ; File ref number
|
|
|
|
STA GMARKPL+1 ; GET_MARK has same params
|
|
|
|
LDA MOSFILE+2 ; Desired offset in MOSFILE[2..4]
|
|
|
|
STA GMARKPL+2
|
|
|
|
LDA MOSFILE+3
|
|
|
|
STA GMARKPL+3
|
|
|
|
LDA MOSFILE+4
|
|
|
|
STA GMARKPL+4
|
|
|
|
JSR MLI
|
|
|
|
DB SMARKCMD
|
|
|
|
DW GMARKPL
|
|
|
|
>>> XF2AUX,OSARGSRET
|
2021-08-01 19:28:10 +00:00
|
|
|
|
|
|
|
* ProDOS file handling for OSARGS get ptr command
|
2021-08-01 19:52:11 +00:00
|
|
|
* and for OSARGs get length command
|
2021-08-29 05:13:31 +00:00
|
|
|
TELL >>> ENTMAIN
|
|
|
|
LDA MOSFILE ; File ref number
|
|
|
|
STA GMARKPL+1
|
|
|
|
LDA MOSFILE+2 ; Mode (0=pos, otherwise len)
|
|
|
|
CMP #$00
|
|
|
|
BEQ :POS
|
|
|
|
JSR MLI
|
|
|
|
DB GEOFCMD
|
|
|
|
DW GMARKPL ; MARK parms same as EOF parms
|
|
|
|
BRA :S1
|
|
|
|
:POS JSR MLI
|
|
|
|
DB GMARKCMD
|
|
|
|
DW GMARKPL
|
|
|
|
:S1 LDX MOSFILE+1 ; Pointer to ZP control block
|
|
|
|
BCS :ERR
|
|
|
|
>>> ALTZP ; Alt ZP & Alt LC on
|
|
|
|
LDA GMARKPL+2
|
|
|
|
STA $00,X
|
|
|
|
LDA GMARKPL+3
|
|
|
|
STA $01,X
|
|
|
|
LDA GMARKPL+4
|
|
|
|
STA $02,X
|
|
|
|
STZ $03,X
|
|
|
|
>>> MAINZP ; Alt ZP off, ROM back in
|
|
|
|
:EXIT >>> XF2AUX,OSARGSRET
|
|
|
|
:ERR LDX MOSFILE+1 ; Address of ZP control block
|
|
|
|
>>> ALTZP ; Alt ZP & Alt LC on
|
|
|
|
STZ $00,X
|
|
|
|
STZ $01,X
|
|
|
|
STZ $02,X
|
|
|
|
STZ $03,X
|
|
|
|
>>> MAINZP ; Alt ZP off, ROM back in
|
|
|
|
BRA :EXIT
|
2021-08-01 19:28:10 +00:00
|
|
|
|
2021-08-30 23:08:22 +00:00
|
|
|
|
2021-07-28 04:17:47 +00:00
|
|
|
* ProDOS file handling for MOS OSFILE LOAD call
|
2021-08-27 03:32:40 +00:00
|
|
|
* Invoked by AppleMOS OSFILE
|
|
|
|
* Return A=01 if successful (meaning 'file')
|
2021-08-29 05:13:31 +00:00
|
|
|
* A>$1F ProDOS error, translated by FILERET
|
|
|
|
LOADFILE >>> ENTMAIN
|
2021-09-01 00:10:34 +00:00
|
|
|
JSR PREPATH ; Preprocess pathname
|
2021-09-09 22:51:22 +00:00
|
|
|
JSR WILDONE ; Handle any wildcards
|
2021-09-01 01:24:12 +00:00
|
|
|
JSR EXISTS ; See if it exists ...
|
|
|
|
CMP #$01 ; ... and is a file
|
2021-09-01 20:58:20 +00:00
|
|
|
BEQ :ISFILE
|
|
|
|
JMP :NOTFND
|
|
|
|
:ISFILE STZ :BLOCKS
|
2021-08-29 05:13:31 +00:00
|
|
|
LDA #<MOSFILE
|
|
|
|
STA OPENPL+1
|
|
|
|
LDA #>MOSFILE
|
|
|
|
STA OPENPL+2
|
|
|
|
JSR OPENFILE
|
|
|
|
BCS :NOTFND ; File not found
|
|
|
|
:L1 LDA OPENPL+5 ; File ref number
|
|
|
|
STA READPL+1
|
|
|
|
JSR RDFILE
|
|
|
|
BCC :S1
|
|
|
|
CMP #$4C ; EOF
|
|
|
|
BEQ :EOF
|
|
|
|
BRA :READERR
|
|
|
|
:S1 LDA #<BLKBUF
|
|
|
|
STA A1L
|
|
|
|
LDA #>BLKBUF
|
|
|
|
STA A1H
|
2021-09-01 20:58:20 +00:00
|
|
|
CLC
|
|
|
|
LDA #<BLKBUF
|
|
|
|
ADC READPL+6 ; LSB of trans count
|
2021-08-29 05:13:31 +00:00
|
|
|
STA A2L
|
2021-09-01 20:58:20 +00:00
|
|
|
LDA #>BLKBUF
|
|
|
|
ADC READPL+7 ; MSB of trans count
|
2021-08-29 05:13:31 +00:00
|
|
|
STA A2H
|
|
|
|
LDA FBEXEC ; If FBEXEC is zero, use addr
|
|
|
|
CMP #$00 ; in the control block
|
|
|
|
BEQ :CBADDR
|
|
|
|
LDA #<MOSFILE ; Otherwise use file addr
|
|
|
|
STA GINFOPL+1
|
|
|
|
LDA #>MOSFILE
|
|
|
|
STA GINFOPL+2
|
2021-09-05 18:00:31 +00:00
|
|
|
JSR GETINFO ; GET_FILE_INFO
|
2021-08-29 05:13:31 +00:00
|
|
|
BCS :READERR
|
|
|
|
LDA GINFOPL+5 ; Aux type LSB
|
|
|
|
STA FBLOAD+0
|
|
|
|
LDA GINFOPL+6 ; Aux type MSB
|
|
|
|
STA FBLOAD+1
|
|
|
|
:CBADDR LDA FBLOAD
|
|
|
|
STA A4L
|
|
|
|
STA FBEXEC ; EXEC = LOAD
|
|
|
|
LDA FBLOAD+1
|
|
|
|
STA A4H
|
|
|
|
STA FBEXEC+1
|
|
|
|
LDX :BLOCKS
|
|
|
|
:L2 CPX #$00
|
|
|
|
BEQ :S2
|
|
|
|
INC
|
|
|
|
INC
|
|
|
|
DEX
|
|
|
|
BRA :L2
|
|
|
|
:S2 STA A4H
|
|
|
|
SEC ; Main -> AUX
|
|
|
|
JSR AUXMOVE
|
|
|
|
INC :BLOCKS
|
|
|
|
BRA :L1
|
|
|
|
:NOTFND LDA #$46 ; Nothing found
|
|
|
|
PHA
|
|
|
|
BRA :EXIT
|
|
|
|
:READERR LDA #$5D ; Read error
|
|
|
|
PHA
|
|
|
|
BRA :EOF2
|
|
|
|
:EOF LDA #$01 ; Success ('File')
|
|
|
|
PHA
|
|
|
|
:EOF2 LDA OPENPL+5 ; File ref num
|
|
|
|
STA CLSPL+1
|
|
|
|
JSR CLSFILE
|
|
|
|
:EXIT JSR UPDFB ; Update FILEBLK
|
|
|
|
JSR COPYFB ; Copy FILEBLK to auxmem
|
|
|
|
PLA ; Get return code back
|
|
|
|
>>> XF2AUX,OSFILERET
|
|
|
|
:BLOCKS DB $00
|
2021-07-28 04:17:47 +00:00
|
|
|
|
|
|
|
* ProDOS file handling for MOS OSFILE SAVE call
|
2021-08-27 03:32:40 +00:00
|
|
|
* Invoked by AppleMOS OSFILE
|
|
|
|
* Return A=01 if successful (ie: 'file')
|
2021-08-29 05:13:31 +00:00
|
|
|
* A>$1F ProDOS error translated by FILERET
|
|
|
|
SAVEFILE >>> ENTMAIN
|
2021-09-01 00:10:34 +00:00
|
|
|
JSR PREPATH ; Preprocess pathname
|
2021-09-01 01:24:12 +00:00
|
|
|
JSR EXISTS ; See if file exists ...
|
|
|
|
CMP #$02 ; ... and is a directory
|
|
|
|
BNE :NOTDIR
|
|
|
|
LDA $41 ; Dir exists, return $41
|
|
|
|
PHA
|
|
|
|
JMP :EXIT
|
|
|
|
:NOTDIR LDA #<MOSFILE ; Attempt to destroy file
|
2021-08-29 05:13:31 +00:00
|
|
|
STA DESTPL+1
|
|
|
|
LDA #>MOSFILE
|
|
|
|
STA DESTPL+2
|
|
|
|
JSR MLI
|
|
|
|
DB DESTCMD
|
|
|
|
DW DESTPL
|
|
|
|
STZ :BLOCKS
|
2021-08-30 23:08:22 +00:00
|
|
|
LDA #$01 ; Storage type - file
|
|
|
|
STA CREATEPL+7
|
|
|
|
LDA #$06 ; Filetype BIN
|
|
|
|
STA CREATEPL+4
|
2021-08-29 05:13:31 +00:00
|
|
|
LDA #<MOSFILE
|
|
|
|
STA OPENPL+1
|
|
|
|
LDA #>MOSFILE
|
|
|
|
STA OPENPL+2
|
|
|
|
LDA FBLOAD ; Auxtype = load address
|
|
|
|
STA CREATEPL+5
|
|
|
|
LDA FBLOAD+1
|
|
|
|
STA CREATEPL+6
|
|
|
|
JSR CRTFILE
|
|
|
|
BCS :FWD1 ; :CANTOPEN error
|
|
|
|
JSR OPENFILE
|
|
|
|
BCS :FWD1 ; :CANTOPEN error
|
|
|
|
SEC ; Compute file length
|
|
|
|
LDA FBEND
|
|
|
|
SBC FBSTRT
|
|
|
|
STA :LENREM
|
|
|
|
LDA FBEND+1
|
|
|
|
SBC FBSTRT+1
|
|
|
|
STA :LENREM+1
|
|
|
|
:L1 LDA FBSTRT ; Set up for first block
|
|
|
|
STA A1L
|
|
|
|
STA A2L
|
|
|
|
LDA FBSTRT+1
|
|
|
|
STA A1H
|
|
|
|
STA A2H
|
|
|
|
INC A2H ; $200 = 512 bytes
|
|
|
|
INC A2H
|
|
|
|
LDA OPENPL+5 ; File ref number
|
|
|
|
STA WRITEPL+1
|
|
|
|
LDA #$00 ; 512 byte request count
|
|
|
|
STA WRITEPL+4
|
|
|
|
LDA #$02
|
|
|
|
STA WRITEPL+5
|
|
|
|
LDX :BLOCKS
|
|
|
|
:L2 CPX #$00 ; Adjust for subsequent blks
|
|
|
|
BEQ :S1
|
|
|
|
INC A1H
|
|
|
|
INC A1H
|
|
|
|
INC A2H
|
|
|
|
INC A2H
|
|
|
|
DEX
|
|
|
|
BRA :L2
|
|
|
|
|
|
|
|
:FWD1 BRA :CANTOPEN ; Forwarding call from above
|
|
|
|
|
|
|
|
:S1 LDA :LENREM+1 ; MSB of length remaining
|
|
|
|
CMP #$02
|
|
|
|
BCS :S2 ; MSB of len >= 2 (not last)
|
|
|
|
CMP #$00 ; If no bytes left ...
|
|
|
|
BNE :S3
|
|
|
|
LDA :LENREM
|
|
|
|
BNE :S3
|
|
|
|
BRA :NORMALEND
|
|
|
|
|
|
|
|
:S3 LDA FBEND ; Adjust for last block
|
|
|
|
STA A2L
|
|
|
|
LDA FBEND+1
|
|
|
|
STA A2H
|
|
|
|
LDA :LENREM
|
|
|
|
STA WRITEPL+4 ; Remaining bytes to write
|
|
|
|
LDA :LENREM+1
|
|
|
|
STA WRITEPL+5
|
|
|
|
|
|
|
|
:S2 LDA #<BLKBUF
|
|
|
|
STA A4L
|
|
|
|
LDA #>BLKBUF
|
|
|
|
STA A4H
|
|
|
|
|
|
|
|
CLC ; Aux -> Main
|
|
|
|
JSR AUXMOVE
|
|
|
|
|
|
|
|
LDA OPENPL+5 ; File ref number
|
|
|
|
STA WRITEPL+1
|
|
|
|
JSR WRTFILE
|
|
|
|
BCS :WRITEERR
|
|
|
|
|
|
|
|
BRA :UPDLEN
|
|
|
|
|
|
|
|
:ENDLOOP INC :BLOCKS
|
|
|
|
BRA :L1
|
|
|
|
|
|
|
|
:UPDLEN SEC ; Update length remaining
|
|
|
|
LDA :LENREM
|
|
|
|
SBC WRITEPL+4
|
|
|
|
STA :LENREM
|
|
|
|
LDA :LENREM+1
|
|
|
|
SBC WRITEPL+5
|
|
|
|
STA :LENREM+1
|
|
|
|
BRA :ENDLOOP
|
|
|
|
|
|
|
|
:CANTOPEN LDA #$5E ; Can't open/create
|
|
|
|
PHA
|
|
|
|
BRA :EXIT
|
|
|
|
|
|
|
|
:WRITEERR LDA OPENPL+5 ; File ref num
|
|
|
|
STA CLSPL+1
|
|
|
|
JSR CLSFILE
|
|
|
|
LDA #$5D ; Write error
|
|
|
|
PHA
|
|
|
|
BRA :EXIT
|
|
|
|
|
|
|
|
:NORMALEND LDA OPENPL+5 ; File ref num
|
|
|
|
STA CLSPL+1
|
|
|
|
JSR CLSFILE
|
|
|
|
BCC :OK ; If close OK
|
|
|
|
LDA #$5D ; Write error
|
|
|
|
PHA
|
|
|
|
BRA :EXIT
|
|
|
|
:OK LDA #$01 ; Success ('File')
|
|
|
|
PHA
|
|
|
|
:EXIT JSR UPDFB ; Update FILEBLK
|
|
|
|
JSR COPYFB ; Copy FILEBLK to aux mem
|
|
|
|
PLA
|
|
|
|
>>> XF2AUX,OSFILERET
|
|
|
|
:BLOCKS DB $00
|
|
|
|
:LENREM DW $0000 ; Remaining length
|
2021-08-24 02:06:48 +00:00
|
|
|
|
2021-08-24 03:59:52 +00:00
|
|
|
* Update FILEBLK before returning to aux memory
|
2021-08-29 05:13:31 +00:00
|
|
|
* Returns A=object type or ProDOS error
|
|
|
|
UPDFB LDA #<MOSFILE
|
|
|
|
STA OPENPL+1
|
|
|
|
STA GINFOPL+1
|
|
|
|
LDA #>MOSFILE
|
|
|
|
STA OPENPL+2
|
|
|
|
STA GINFOPL+2
|
2021-09-05 18:00:31 +00:00
|
|
|
JSR GETINFO ; Call GET_FILE_INFO
|
2021-08-30 23:08:22 +00:00
|
|
|
BCC :UPDFB1
|
|
|
|
JMP CHKNOTFND
|
|
|
|
|
|
|
|
:UPDFB1 LDA GINFOPL+5 ; Aux type LSB
|
2021-08-29 05:13:31 +00:00
|
|
|
STA FBLOAD
|
|
|
|
STA FBEXEC
|
|
|
|
LDA GINFOPL+6 ; Aux type MSB
|
|
|
|
STA FBLOAD+1
|
|
|
|
STA FBEXEC+1
|
|
|
|
STZ FBLOAD+2
|
|
|
|
STZ FBEXEC+2
|
|
|
|
STZ FBLOAD+3
|
|
|
|
STZ FBEXEC+3
|
2021-08-30 23:08:22 +00:00
|
|
|
*
|
2021-08-29 05:13:31 +00:00
|
|
|
LDA GINFOPL+3 ; Access byte
|
|
|
|
CMP #$40 ; Locked?
|
|
|
|
AND #$03 ; ------wr
|
|
|
|
PHP
|
|
|
|
STA FBATTR+0
|
|
|
|
ASL A ; -----wr-
|
|
|
|
ASL A ; ----wr--
|
|
|
|
ASL A ; ---wr---
|
|
|
|
ASL A ; --wr----
|
|
|
|
PLP
|
|
|
|
BCS :UPDFB2
|
|
|
|
ORA #$08 ; --wrl---
|
|
|
|
:UPDFB2 ORA FBATTR+0 ; --wrl-wr
|
|
|
|
STA FBATTR+0
|
2021-08-30 23:08:22 +00:00
|
|
|
*
|
|
|
|
LDA GINFOPL+11 ; yyyyyyym
|
|
|
|
PHA
|
|
|
|
ROR A ; ?yyyyyyy m
|
|
|
|
LDA GINFOPL+10 ; mmmddddd m
|
|
|
|
PHA
|
|
|
|
ROR A ; mmmmdddd
|
|
|
|
LSR A ; -mmmmddd
|
|
|
|
LSR A ; --mmmmdd
|
|
|
|
LSR A ; ---mmmmd
|
|
|
|
LSR A ; ----mmmm
|
|
|
|
STA FBATTR+2
|
|
|
|
PLA ; mmmddddd
|
|
|
|
AND #31 ; ---ddddd
|
|
|
|
STA FBATTR+1
|
|
|
|
PLA ; yyyyyyym
|
|
|
|
SEC
|
|
|
|
SBC #81*2 ; Offset from 1981
|
|
|
|
BCS :UPDFB3 ; 1981-1999 -> 00-18
|
|
|
|
ADC #100*2 ; 2000-2080 -> 19-99
|
|
|
|
:UPDFB3 PHA ; yyyyyyym
|
|
|
|
AND #$E0 ; yyy-----
|
|
|
|
ORA FBATTR+1 ; yyyddddd
|
|
|
|
STA FBATTR+1
|
|
|
|
PLA ; yyyyyyym
|
|
|
|
AND #$FE ; yyyyyyy0
|
|
|
|
ASL A ; yyyyyy00
|
|
|
|
ASL A ; yyyyy000
|
|
|
|
ASL A ; yyyy0000
|
|
|
|
ORA FBATTR+2 ; yyyymmmm
|
|
|
|
STA FBATTR+2
|
2021-08-29 05:13:31 +00:00
|
|
|
STZ FBATTR+3
|
|
|
|
|
|
|
|
JSR OPENFILE ; Open file
|
|
|
|
BCS :ERR
|
|
|
|
LDA OPENPL+5 ; File ref number
|
|
|
|
STA GMARKPL+1
|
|
|
|
JSR MLI ; Call GET_EOF MLI
|
|
|
|
DB GEOFCMD
|
|
|
|
DW GMARKPL ; MARK parms same as EOF
|
|
|
|
LDA GMARKPL+2
|
|
|
|
STA FBSIZE+0
|
|
|
|
LDA GMARKPL+3
|
|
|
|
STA FBSIZE+1
|
|
|
|
LDA GMARKPL+4
|
|
|
|
STA FBSIZE+2
|
|
|
|
STZ FBSIZE+3
|
|
|
|
LDA OPENPL+5 ; File ref number
|
|
|
|
STA CLSPL+1
|
|
|
|
JSR CLSFILE
|
|
|
|
LDA #$01 ; Prepare A=file
|
|
|
|
LDX GINFOPL+7
|
|
|
|
CPX #$0D ; Is it a directory?
|
2021-08-30 23:08:22 +00:00
|
|
|
BNE :UPDFB5
|
2021-08-29 05:13:31 +00:00
|
|
|
LDA #$02 ; Return A=directory
|
2021-08-30 23:08:22 +00:00
|
|
|
:UPDFB5 RTS
|
2021-08-29 05:13:31 +00:00
|
|
|
|
|
|
|
:ERR
|
|
|
|
CHKNOTFND CMP #$44 ; Convert ProDOS 'not found'
|
|
|
|
BEQ :NOTFND ; into result=$00
|
|
|
|
CMP #$45
|
|
|
|
BEQ :NOTFND
|
|
|
|
CMP #$46
|
|
|
|
BNE :CHKNOTFND2
|
|
|
|
:NOTFND LDA #$00
|
|
|
|
:CHKNOTFND2 RTS
|
|
|
|
|
2021-07-28 04:17:47 +00:00
|
|
|
|
|
|
|
* Quit to ProDOS
|
2021-08-29 05:13:31 +00:00
|
|
|
QUIT INC $3F4 ; Invalidate powerup byte
|
|
|
|
STA $C054 ; PAGE2 off
|
|
|
|
JSR MLI
|
|
|
|
DB QUITCMD
|
|
|
|
DW QUITPL
|
|
|
|
RTS
|
2021-07-28 04:17:47 +00:00
|
|
|
|
2021-09-10 23:29:10 +00:00
|
|
|
* Used for *CAT, *EX and *INFO
|
2021-09-11 03:36:46 +00:00
|
|
|
* On entry: A=$5x *CAT, A=$9x *EX, A=$Ax *INFO
|
2021-08-29 05:13:31 +00:00
|
|
|
CATALOG >>> ENTMAIN
|
2021-09-11 03:36:46 +00:00
|
|
|
AND #$F0
|
2021-09-10 23:29:10 +00:00
|
|
|
STA CATARG ; Stash argument
|
2021-09-11 03:36:46 +00:00
|
|
|
CMP #$A0 ; Is it *INFO?
|
|
|
|
BNE :NOTINFO
|
|
|
|
JMP INFO ; Handle entry for *INFO
|
|
|
|
:NOTINFO LDA MOSFILE ; Length of pathname
|
2021-09-03 00:35:36 +00:00
|
|
|
BEQ :NOPATH ; If zero use prefix
|
|
|
|
JSR PREPATH ; Preprocess pathname
|
2021-09-09 22:51:22 +00:00
|
|
|
JSR WILDONE ; Handle any wildcards
|
2021-09-03 01:31:18 +00:00
|
|
|
JSR EXISTS ; See if path exists ...
|
|
|
|
CMP #$01 ; ... and is a file
|
|
|
|
BNE :NOTFILE
|
|
|
|
LDA #$46 ; Not found (TO DO: err code?)
|
|
|
|
BRA CATEXIT
|
|
|
|
:NOTFILE LDA #<MOSFILE
|
2021-09-03 00:35:36 +00:00
|
|
|
STA OPENPL+1
|
|
|
|
LDA #>MOSFILE
|
|
|
|
STA OPENPL+2
|
|
|
|
BRA :OPEN
|
2021-09-04 06:00:26 +00:00
|
|
|
:NOPATH JSR GETPREF ; Fetch prefix into PREFIX
|
|
|
|
LDA #<PREFIX
|
2021-08-29 05:13:31 +00:00
|
|
|
STA OPENPL+1
|
2021-09-04 06:00:26 +00:00
|
|
|
LDA #>PREFIX
|
2021-08-29 05:13:31 +00:00
|
|
|
STA OPENPL+2
|
2021-09-03 00:35:36 +00:00
|
|
|
:OPEN JSR OPENFILE
|
2021-08-29 05:13:31 +00:00
|
|
|
BCS CATEXIT ; Can't open dir
|
2021-07-28 04:17:47 +00:00
|
|
|
|
|
|
|
CATREENTRY
|
2021-08-29 05:13:31 +00:00
|
|
|
LDA OPENPL+5 ; File ref num
|
|
|
|
STA READPL+1
|
|
|
|
JSR RDFILE
|
|
|
|
BCC :S1
|
|
|
|
CMP #$4C ; EOF
|
|
|
|
BEQ :EOF
|
|
|
|
BRA :READERR
|
|
|
|
:S1 JSR COPYAUXBLK
|
|
|
|
>>> XF2AUX,PRONEBLK
|
2021-07-28 04:17:47 +00:00
|
|
|
:READERR
|
2021-08-29 05:13:31 +00:00
|
|
|
:EOF LDA OPENPL+5 ; File ref num
|
|
|
|
STA CLSPL+1
|
|
|
|
JSR CLSFILE
|
|
|
|
CATEXIT >>> XF2AUX,STARCATRET
|
2021-07-28 04:17:47 +00:00
|
|
|
|
|
|
|
* PRONEBLK call returns here ...
|
|
|
|
CATALOGRET
|
2021-08-29 05:13:31 +00:00
|
|
|
>>> ENTMAIN
|
2021-09-11 03:36:46 +00:00
|
|
|
LDA CATARG
|
|
|
|
CMP #$A0 ; Is this an *INFO call?
|
|
|
|
BEQ INFOREENTRY
|
2021-08-29 05:13:31 +00:00
|
|
|
BRA CATREENTRY
|
|
|
|
|
2021-09-11 03:36:46 +00:00
|
|
|
CATARG DB $00
|
|
|
|
|
|
|
|
* Handle *INFO
|
|
|
|
INFO JSR PREPATH ; Preprocess pathname
|
2021-09-12 06:05:17 +00:00
|
|
|
SEC
|
2021-09-11 03:36:46 +00:00
|
|
|
JSR WILDCARD ; Handle any wildcards
|
2021-09-11 23:41:59 +00:00
|
|
|
JSR EXISTS ; Check matches something
|
|
|
|
CMP #$00
|
2021-09-12 02:38:02 +00:00
|
|
|
BNE INFOFIRST
|
|
|
|
LDA #$46 ; Not found (TO DO: err code?)
|
|
|
|
BRA CATEXIT
|
|
|
|
|
2021-09-11 03:36:46 +00:00
|
|
|
INFOREENTRY
|
2021-09-12 01:42:27 +00:00
|
|
|
JSR WILDNEXT2 ; Start of new block
|
2021-09-11 23:41:59 +00:00
|
|
|
BCS INFOEXIT ; No more matches
|
|
|
|
INFOFIRST LDA WILDIDX
|
|
|
|
CMP #$FF ; Is WILDNEXT about to read new blk?
|
|
|
|
BEQ :DONEBLK ; If so, print this blk first
|
2021-09-12 01:42:27 +00:00
|
|
|
JSR WILDNEXT2
|
2021-09-11 23:41:59 +00:00
|
|
|
BCS :DONEBLK ; If no more matches
|
|
|
|
BRA INFOFIRST
|
|
|
|
:DONEBLK JSR COPYAUXBLK
|
2021-09-11 03:36:46 +00:00
|
|
|
>>> XF2AUX,PRONEBLK
|
|
|
|
|
2021-09-11 23:41:59 +00:00
|
|
|
INFOEXIT CMP #$4C ; EOF
|
|
|
|
BNE INFOCLS
|
2021-09-11 03:36:46 +00:00
|
|
|
LDA #$00 ; EOF is not an error
|
2021-09-11 23:41:59 +00:00
|
|
|
INFOCLS JSR CLSDIR ; Be sure to close it!
|
2021-09-12 02:38:02 +00:00
|
|
|
BRA CATEXIT
|
2021-09-12 06:05:17 +00:00
|
|
|
|
2021-09-10 23:29:10 +00:00
|
|
|
|
2021-08-29 05:13:31 +00:00
|
|
|
* Set prefix. Used by *CHDIR to change directory
|
|
|
|
SETPFX >>> ENTMAIN
|
2021-09-01 00:10:34 +00:00
|
|
|
JSR PREPATH ; Preprocess pathname
|
2021-09-09 22:51:22 +00:00
|
|
|
JSR WILDONE ; Handle any wildcards
|
2021-08-29 05:13:31 +00:00
|
|
|
BCS :ERR
|
|
|
|
LDA #<MOSFILE
|
|
|
|
STA SPFXPL+1
|
|
|
|
LDA #>MOSFILE
|
|
|
|
STA SPFXPL+2
|
|
|
|
JSR MLI ; SET_PREFIX
|
|
|
|
DB SPFXCMD
|
|
|
|
DW SPFXPL
|
2021-09-02 21:59:04 +00:00
|
|
|
:EXIT >>> XF2AUX,CHDIRRET
|
2021-08-29 05:13:31 +00:00
|
|
|
:ERR LDA #$40 ; Invalid pathname syn
|
|
|
|
BRA :EXIT
|
2021-07-28 04:17:47 +00:00
|
|
|
|
2021-09-05 18:00:31 +00:00
|
|
|
* Obtain info on blocks used/total blocks
|
|
|
|
DRVINFO >>> ENTMAIN
|
|
|
|
JSR PREPATH
|
|
|
|
BCS :ERR
|
|
|
|
LDA #<MOSFILE
|
|
|
|
STA GINFOPL+1
|
|
|
|
LDA #>MOSFILE
|
|
|
|
STA GINFOPL+2
|
|
|
|
JSR GETINFO ; GET_FILE_INFO
|
|
|
|
BCS :EXIT
|
|
|
|
PHA
|
|
|
|
>>> ALTZP ; Alt ZP & Alt LC on
|
|
|
|
LDA GINFOPL+8 ; Blcks used LSB
|
|
|
|
STA AUXBLK
|
|
|
|
LDA GINFOPL+9 ; Blks used MSB
|
|
|
|
STA AUXBLK+1
|
2021-09-05 19:15:45 +00:00
|
|
|
LDA GINFOPL+5 ; Tot blks LSB
|
|
|
|
STA AUXBLK+2
|
|
|
|
LDA GINFOPL+6 ; Tot blks MSB
|
|
|
|
STA AUXBLK+3
|
2021-09-05 18:00:31 +00:00
|
|
|
>>> MAINZP ; ALt ZP off, ROM back in
|
|
|
|
PLA
|
|
|
|
:EXIT >>> XF2AUX,FREERET
|
|
|
|
:ERR LDA #$40 ; Invalid pathname syn
|
|
|
|
BRA :EXIT
|
|
|
|
|
2021-09-06 20:35:31 +00:00
|
|
|
* Change file permissions, for *ACCESS
|
|
|
|
* Filename in MOSFILE, flags in MOSFILE2
|
|
|
|
SETPERM >>> ENTMAIN
|
|
|
|
JSR PREPATH ; Preprocess pathname
|
2021-09-09 23:55:27 +00:00
|
|
|
BCS :SYNERR
|
2021-09-12 06:05:17 +00:00
|
|
|
CLC
|
2021-09-09 23:55:27 +00:00
|
|
|
JSR WILDCARD ; Handle any wildcards
|
|
|
|
BCS :NONE
|
2021-09-06 20:35:31 +00:00
|
|
|
STZ :LFLAG
|
|
|
|
STZ :WFLAG
|
|
|
|
STZ :RFLAG
|
|
|
|
LDX MOSFILE2 ; Length of arg2
|
|
|
|
INX
|
|
|
|
:L1 DEX
|
|
|
|
CPX #$00
|
2021-09-09 23:55:27 +00:00
|
|
|
BEQ :MAINLOOP
|
2021-09-06 20:35:31 +00:00
|
|
|
LDA MOSFILE2,X ; Read arg2 char
|
|
|
|
CMP #'L' ; L=Locked
|
|
|
|
BNE :S1
|
|
|
|
STA :LFLAG
|
|
|
|
BRA :L1
|
|
|
|
:S1 CMP #'R' ; R=Readable
|
|
|
|
BNE :S2
|
|
|
|
STA :RFLAG
|
|
|
|
BRA :L1
|
|
|
|
:S2 CMP #'W' ; W=Writable
|
|
|
|
BNE :ERR2 ; Bad attribute
|
|
|
|
STA :WFLAG
|
|
|
|
BRA :L1
|
2021-09-09 23:55:27 +00:00
|
|
|
:SYNERR LDA #$40 ; Invalid pathname syn
|
|
|
|
BRA :EXIT
|
|
|
|
:NONE JSR CLSDIR
|
|
|
|
LDA #$40 ; TODO PROPER ERROR CODE
|
|
|
|
BRA :EXIT
|
|
|
|
:MAINLOOP LDA #<MOSFILE
|
2021-09-06 20:35:31 +00:00
|
|
|
STA GINFOPL+1
|
|
|
|
LDA #>MOSFILE
|
|
|
|
STA GINFOPL+2
|
|
|
|
JSR GETINFO ; GET_FILE_INFO
|
|
|
|
BCS :EXIT
|
|
|
|
LDA GINFOPL+3 ; Access byte
|
2021-09-06 21:15:07 +00:00
|
|
|
AND #$03 ; Start with R, W off
|
|
|
|
ORA #$C0 ; Start with dest/ren on
|
2021-09-06 20:35:31 +00:00
|
|
|
LDX :RFLAG
|
|
|
|
BEQ :S3
|
|
|
|
ORA #$01 ; Turn on read enable
|
|
|
|
:S3 LDX :WFLAG
|
|
|
|
BEQ :S4
|
|
|
|
ORA #$02 ; Turn on write enable
|
|
|
|
:S4 LDX :LFLAG
|
|
|
|
BEQ :S5
|
2021-09-06 21:15:07 +00:00
|
|
|
AND #$3D ; Turn off destroy/ren/write
|
2021-09-06 20:35:31 +00:00
|
|
|
:S5 STA GINFOPL+3 ; Access byte
|
|
|
|
JSR SETINFO ; SET_FILE_INFO
|
2021-09-09 23:55:27 +00:00
|
|
|
JSR WILDNEXT
|
|
|
|
BCS :NOMORE
|
|
|
|
BRA :MAINLOOP
|
2021-09-06 20:35:31 +00:00
|
|
|
:EXIT >>> XF2AUX,ACCRET
|
2021-09-09 23:55:27 +00:00
|
|
|
:NOMORE JSR CLSDIR
|
|
|
|
LDA #$00
|
2021-09-06 20:35:31 +00:00
|
|
|
BRA :EXIT
|
|
|
|
:ERR2 LDA #$53 ; Invalid parameter
|
|
|
|
BRA :EXIT
|
|
|
|
:LFLAG DB $00 ; 'L' attribute
|
|
|
|
:WFLAG DB $00 ; 'W' attribute
|
|
|
|
:RFLAG DB $00 ; 'R' attribute
|
|
|
|
|
2021-09-10 22:21:49 +00:00
|
|
|
* Multi file delete, for *DESTROY
|
|
|
|
* Filename in MOSFILE
|
|
|
|
MULTIDEL >>> ENTMAIN
|
|
|
|
JSR PREPATH ; Preprocess pathname
|
|
|
|
BCS :SYNERR
|
2021-09-12 06:05:17 +00:00
|
|
|
CLC
|
2021-09-10 22:21:49 +00:00
|
|
|
JSR WILDCARD ; Handle any wildcards
|
|
|
|
BCS :NONE
|
|
|
|
BRA :MAINLOOP
|
|
|
|
:SYNERR LDA #$40 ; Invalid pathname syn
|
|
|
|
BRA :EXIT
|
|
|
|
:NONE JSR CLSDIR
|
|
|
|
LDA #$40 ; TODO PROPER ERROR CODE
|
|
|
|
BRA :EXIT
|
|
|
|
:MAINLOOP JSR DODELETE
|
|
|
|
BCS :DELERR
|
|
|
|
JSR WILDNEXT
|
|
|
|
BCS :NOMORE
|
|
|
|
BRA :MAINLOOP
|
|
|
|
:EXIT >>> XF2AUX,DESTRET
|
|
|
|
:DELERR JSR CLSDIR
|
|
|
|
LDA #$40 ; TODO PROPER ERROR CODE
|
|
|
|
BRA :EXIT
|
|
|
|
:NOMORE JSR CLSDIR
|
|
|
|
LDA #$00
|
|
|
|
BRA :EXIT
|
|
|
|
|
2021-09-06 23:36:04 +00:00
|
|
|
* Read mainmem from auxmem
|
|
|
|
MACHRD LDA $C081
|
|
|
|
LDA $C081
|
|
|
|
LDA $FBC0
|
|
|
|
SEC
|
|
|
|
JSR $FE1F
|
|
|
|
BRA MAINRDEXIT
|
|
|
|
|
2021-09-05 10:50:04 +00:00
|
|
|
* Read mainmem from auxmem
|
|
|
|
MAINRDMEM STA A1L
|
|
|
|
STY A1H
|
|
|
|
LDA $C081
|
|
|
|
LDA $C081
|
|
|
|
LDA (A1L)
|
|
|
|
MAINRDEXIT >>> XF2AUX,NULLRTS ; Back to an RTS
|
|
|
|
|
2021-09-12 06:05:17 +00:00
|
|
|
|
|
|
|
|