Merge PR 143 'Updated CHDIR, FREE'
This commit is contained in:
parent
38bcf9b4dd
commit
9347de8059
BIN
applecorn.po
BIN
applecorn.po
Binary file not shown.
201
auxmem.hostfs.s
201
auxmem.hostfs.s
|
@ -18,6 +18,10 @@
|
|||
* *EX can use two columns. *OPT stored.
|
||||
* 29-Oct-2021 Bad *command->Bad command, bad *RUN->File not found.
|
||||
* Optimised RENAME, COPY, CHDIR, DRIVE. FREE<cr> allowed.
|
||||
* 01-Oct-2021 DRIVE, CHDIR shares same code, checking moved to maincode.
|
||||
* 02-Oct-2021 ACCESS uses generic access byte parsing.
|
||||
* PRACCESS shares code with ACCESS.
|
||||
* *BUG* PARSNAME should check len<64.
|
||||
|
||||
|
||||
* $B0-$BF Temporary filing system workspace
|
||||
|
@ -30,6 +34,7 @@ FSCTRL EQU FSXREG
|
|||
FSPTR1 EQU $C4
|
||||
FSPTR2 EQU $C6
|
||||
FSNUM EQU $C8
|
||||
FSACCBYTE EQU FSNUM+1
|
||||
FSZPCC EQU $CC
|
||||
FSCMDLINE EQU $CE
|
||||
|
||||
|
@ -99,9 +104,16 @@ OSBGETRET >>> ENTAUX
|
|||
* A=01 Write PTR#Y
|
||||
* A=02 Read EXT#Y
|
||||
* A=03 Write EXT#Y
|
||||
* (A=04 Read alloc#Y)
|
||||
* (A=05 Read EOF#Y)
|
||||
* (A=06 Write alloc#Y)
|
||||
* Y=0 A=FF Flush all channels
|
||||
* A=00 Return filing system number in A
|
||||
* A=01 Read command line address
|
||||
* (A=02 Read NFS bugfix flag)
|
||||
* (A=03 Read LIBFS filing system)
|
||||
* (A=04 Read used disk space)
|
||||
* (A=05 Read free disk space)
|
||||
* On exit, A=0 - implemented (except ARGS 0,0)
|
||||
* A - preserved=unimplemented
|
||||
* X,Y - preserved
|
||||
|
@ -546,41 +558,67 @@ PRDECSLH JSR PRDEC
|
|||
JMP OSWRCH
|
||||
|
||||
* Print object access string
|
||||
PRACCESS LDX #$04 ; Offset to chars
|
||||
PRACCESS LDX #$04 ; Offset to 'D' char
|
||||
LDY #$00
|
||||
LDA (FSPTR1),Y
|
||||
CMP #$D0 ; CS=Directory
|
||||
LDY #$1E
|
||||
LDA (FSPTR1),Y
|
||||
PHA
|
||||
LDY #$00 ; Chars printed
|
||||
LDA (FSPTR1),Y
|
||||
CMP #$D0
|
||||
JSR :PRACCCHR ; 'D'
|
||||
PLA
|
||||
CPY #$01 ; Has 'D' been printed?
|
||||
PHP
|
||||
PHA
|
||||
LDA (FSPTR1),Y ; Permission byte
|
||||
LDY #$0C ; Char counter
|
||||
EOR #$C0
|
||||
CMP #$40
|
||||
JSR :PRACCCHR ; 'L'
|
||||
PLA
|
||||
PLP
|
||||
BCS :PRACCDONE ; Dir, skip 'WR'
|
||||
ROR A
|
||||
PHP
|
||||
ROR A
|
||||
JSR :PRACCCHR ; 'W'
|
||||
PLP
|
||||
JSR :PRACCCHR ; 'R'
|
||||
:PRACCDONE LDA #$20
|
||||
:PRACCLP JSR :PRSPACE
|
||||
CPY #$04
|
||||
BCC :PRACCLP
|
||||
:PRSKIP RTS
|
||||
:PRACCCHR DEX
|
||||
BCC :PRSKIP
|
||||
LDA ACCESSCHRS,X
|
||||
:PRSPACE INY
|
||||
JMP OSWRCH
|
||||
ACCESSCHRS ASC 'RWLD'
|
||||
* AND #$E3 ; Keep LLB---WR
|
||||
AND #$C3 ; Keep LL----WR
|
||||
BCC :PRACC1 ; Not a directory
|
||||
AND #$FC ; Drop 'WR' bits
|
||||
:PRACC1 STA FSACCBYTE
|
||||
BCS :PRACC2 ; Jump to print 'D'
|
||||
:PRACCLP LDA FSACCBYTE
|
||||
AND ACCESSBITS,X ; Is bit set?
|
||||
BEQ :PRACC3
|
||||
:PRACC2 LDA ACCESSCHRS,X ; If so, print character
|
||||
JSR OSWRCH
|
||||
INY ; Inc. char counter
|
||||
:PRACC3 DEX
|
||||
BPL :PRACCLP ; Loop for all chars
|
||||
JMP PRSPACES ; Pad
|
||||
|
||||
* LDX #$04 ; Offset to chars
|
||||
* LDY #$1E
|
||||
* LDA (FSPTR1),Y
|
||||
* PHA
|
||||
* LDY #$00 ; Chars printed
|
||||
* LDA (FSPTR1),Y
|
||||
* CMP #$D0
|
||||
* JSR :PRACCCHR ; 'D'
|
||||
* PLA
|
||||
* CPY #$01 ; Has 'D' been printed?
|
||||
* PHP
|
||||
* PHA
|
||||
* EOR #$C0
|
||||
* CMP #$40
|
||||
* JSR :PRACCCHR ; 'L'
|
||||
* PLA
|
||||
* PLP
|
||||
* BCS :PRACCDONE ; Dir, skip 'WR'
|
||||
* ROR A
|
||||
* PHP
|
||||
* ROR A
|
||||
* JSR :PRACCCHR ; 'W'
|
||||
* PLP
|
||||
* JSR :PRACCCHR ; 'R'
|
||||
*:PRACCDONE LDA #$20
|
||||
*:PRACCLP JSR :PRSPACE
|
||||
* CPY #$04
|
||||
* BCC :PRACCLP
|
||||
*:PRSKIP RTS
|
||||
*:PRACCCHR DEX
|
||||
* BCC :PRSKIP
|
||||
* LDA ACCESSCHRS,X
|
||||
*:PRSPACE INY
|
||||
* JMP OSWRCH
|
||||
|
||||
ACCESSCHRS ASC 'RWBLD'
|
||||
ACCESSBITS DB $01,$02,$20,$C0,$00
|
||||
|
||||
* Print object addresses
|
||||
PRADDR LDX #3
|
||||
|
@ -608,8 +646,10 @@ FSCRENAME JSR PARSNAME ; Copy Arg1->MOSFILE
|
|||
BRK
|
||||
* ProDOS returns $40 (Bad filename) for bad renames.
|
||||
* Not easy to seperate out, so leave as Bad filename error.
|
||||
ACCRET
|
||||
RENRET
|
||||
COPYRET
|
||||
DESTRET
|
||||
CHDIRRET >>> ENTAUX
|
||||
JMP CHKERROR
|
||||
|
||||
|
@ -624,7 +664,7 @@ FSCCOPY JSR PARSLPTR ; Copy Arg1->MOSFILE
|
|||
>>> XF2MAIN,COPYFILE ; Do the heavy lifting
|
||||
:SYNTAX BRK
|
||||
DB $DC
|
||||
ASC 'Syntax: COPY <sourcespec> <destspec>'
|
||||
ASC 'Syntax: COPY <srcspec> <destspec>'
|
||||
BRK
|
||||
|
||||
|
||||
|
@ -633,6 +673,7 @@ FSCCOPY JSR PARSLPTR ; Copy Arg1->MOSFILE
|
|||
*
|
||||
FSCCHDIR JSR PARSLPTR ; Copy filename->MOSFILE
|
||||
BEQ ERRCHDIR ; No <dir>
|
||||
LDY #$00 ; Y=$00 - CHDIR
|
||||
FSCCHDIR2 >>> XF2MAIN,SETPFX
|
||||
ERRCHDIR BRK
|
||||
DB $DC
|
||||
|
@ -643,12 +684,9 @@ ERRCHDIR BRK
|
|||
* Handle *DRIVE command, which is similar to CHDIR
|
||||
* LPTR=>parameters string
|
||||
*
|
||||
FSCDRIVE LDA (OSLPTR),Y ; First char
|
||||
CMP #$3A ; Colon
|
||||
BNE :SYNTAX
|
||||
JSR PARSLPTR ; Copy arg->MOSFILE
|
||||
CMP #$03 ; Check 3 char arg
|
||||
BEQ FSCCHDIR2 ; Pass on as CHDIR
|
||||
FSCDRIVE JSR PARSLPTR ; Copy arg->MOSFILE
|
||||
TAY ; Y<>$00 - DRIVE
|
||||
BNE FSCCHDIR2 ; Pass on as CHDIR
|
||||
:SYNTAX BRK
|
||||
DB $DC
|
||||
ASC 'Syntax: DRIVE <drv> (eg: DRIVE :61)'
|
||||
|
@ -657,32 +695,13 @@ FSCDRIVE LDA (OSLPTR),Y ; First char
|
|||
|
||||
* Handle *FREE command
|
||||
* LPTR=>parameters string
|
||||
* Also allows *FREE<cr> for current drive
|
||||
* Syntax is FREE (<drv>)
|
||||
*
|
||||
FSCFREE
|
||||
* LDA (OSLPTR),Y ; First char
|
||||
* CMP #$3A ; Colon
|
||||
* BNE :ERR
|
||||
JSR PARSLPTR ; Copy arg->MOSFILE
|
||||
BEQ :HASPARM ; *FREE <cr>
|
||||
CMP #$03 ; Check 3 char arg
|
||||
BEQ :HASPARM
|
||||
:ERR BRK
|
||||
DB $DC
|
||||
ASC 'Syntax: FREE (<drv>) (eg: FREE :61)'
|
||||
BRK
|
||||
:HASPARM >>> XF2MAIN,DRVINFO
|
||||
|
||||
FREERET
|
||||
>>> ENTAUX
|
||||
FSCFREE JSR PARSLPTR ; Copy arg->MOSFILE
|
||||
>>> XF2MAIN,DRVINFO
|
||||
FREERET >>> ENTAUX
|
||||
JSR CHKERROR
|
||||
CMP #$00
|
||||
BEQ :NOERR
|
||||
BRK
|
||||
DB $CE ; Bad directory
|
||||
ASC 'Bad dir'
|
||||
BRK
|
||||
|
||||
*
|
||||
* Disk size is two-byte 512-byte block count
|
||||
* Maximum disk size is $FFFF blocks = 1FFFF00 bytes = 33554176 bytes = 32M-512
|
||||
:NOERR SEC
|
||||
|
@ -737,41 +756,44 @@ FREERET
|
|||
* Handle *ACCESS command
|
||||
* LPTR=>parameters string
|
||||
*
|
||||
ACCESS
|
||||
FSCACCESS JSR PARSLPTR ; Copy filename->MOSFILE
|
||||
CMP #$00 ; Filename length
|
||||
BEQ :SYNTAX
|
||||
JSR PARSLPTR2 ; Copy Arg2->MOSFILE2
|
||||
BEQ :SYNTAX ; No filename
|
||||
STZ FSACCBYTE ; Initialise access to ""
|
||||
:ACCESSLP1 LDA (OSLPTR),Y ; Get access character
|
||||
CMP #$0D
|
||||
BEQ :ACCESSGO ; End of line, action it
|
||||
INY
|
||||
AND #$DF ; Upper case
|
||||
LDX #$04 ; Check five chars 'DLBWR'
|
||||
:ACCESSLP2 CMP ACCESSCHRS,X
|
||||
BNE :ACCESSNXT
|
||||
LDA ACCESSBITS,X ; Add this to access mask
|
||||
ORA FSACCBYTE
|
||||
STA FSACCBYTE
|
||||
:ACCESSNXT DEX
|
||||
BPL :ACCESSLP2
|
||||
BMI :ACCESSLP1 ; Check next character
|
||||
:ACCESSGO LDA FSACCBYTE
|
||||
EOR #$C0 ; MOSFILE=filename, A=access mask
|
||||
>>> XF2MAIN,SETPERM
|
||||
:SYNTAX BRK
|
||||
DB $DC
|
||||
ASC 'Syntax: ACCESS <listspec> <L|W|R>'
|
||||
BRK
|
||||
|
||||
ACCRET >>> ENTAUX
|
||||
JSR CHKERROR
|
||||
LDA #$00
|
||||
RTS
|
||||
|
||||
|
||||
* Handle *DESTROY command
|
||||
* LPTR=>parameters string
|
||||
*
|
||||
FSCDESTROY
|
||||
DESTROY JSR PARSLPTR ; Copy filename->MOSFILE
|
||||
CMP #$00 ; Filename length
|
||||
BEQ :SYNTAX
|
||||
BEQ :SYNTAX ; No filename
|
||||
>>> XF2MAIN,MULTIDEL
|
||||
:SYNTAX BRK
|
||||
DB $DC
|
||||
ASC 'Syntax: DESTROY <listspec>'
|
||||
BRK
|
||||
|
||||
DESTRET >>> ENTAUX
|
||||
JSR CHKERROR
|
||||
LDA #$00
|
||||
RTS
|
||||
|
||||
|
||||
* Handle *TITLE command
|
||||
* LPTR=>parameters string
|
||||
|
@ -885,19 +907,19 @@ MKERROR3 ASL A
|
|||
PHA
|
||||
PHP
|
||||
RTI
|
||||
MKERROR4 DW ERROR28,ERROR27,ERROR27,ERROR2B,ERROR2C,ERROR27,ERROR2E,ERROR27
|
||||
MKERROR4 DW ERROR28,ERROR27,ERROR2A,ERROR2B,ERROR2C,ERROR27,ERROR2E,ERROR27
|
||||
DW ERROR40,ERROR41,ERROR42,ERROR43,ERROR44,ERROR45,ERROR46,ERROR47
|
||||
DW ERROR48,ERROR49,ERROR4A,ERROR4B,ERROR4C,ERROR4D,ERROR4E,ERROR4F
|
||||
DW ERROR50,ERROR51,ERROR52,ERROR53,ERROR54,ERROR55,ERROR56,ERROR57
|
||||
DW ERROR27,ERROR27,ERROR5A,ERROR27,ERROR27,ERROR27,ERROR5E,ERROR27
|
||||
|
||||
* $27 - I/O error (disk not formatted)
|
||||
* $28 - No device con'd (drive not present) Disk not present
|
||||
* $28 - No device con'd (drive not present) Drive not present
|
||||
* $29 -(GSOS Driver is busy)
|
||||
* $2A -
|
||||
* $2A -(Not a drive specifier) DRIVE/FREE: Bad drive
|
||||
* $2B - Disk write protected. Disk write protected
|
||||
* $2C - Bad byte count - file too long File too long
|
||||
* $2D -(GSOS bad block number)
|
||||
* $2D -(GSOS bad block number) (Sector not found?)
|
||||
* $2E - Disk switched Disk changed
|
||||
* $2F - Device is offline (drive empty/absent)
|
||||
|
||||
|
@ -912,7 +934,7 @@ MKERROR4 DW ERROR28,ERROR27,ERROR27,ERROR2B,ERROR2C,ERROR27,ERROR2E,ERROR2
|
|||
* $48 - Overrun error. Disk full
|
||||
* $49 - Volume directory full. Directory full
|
||||
* $4A - Incompatible file format. Disk not recognised
|
||||
* $4B - Unsupported storage_type. Disk not recognised
|
||||
* $4B - Unsupported storage_type. Not a directory
|
||||
* $4C - End of file has been encountered. End of file
|
||||
* $4D - Position out of range. Past end of file
|
||||
* $4E - Access error. (see also $4F) RD/WR: Insufficient access
|
||||
|
@ -921,7 +943,7 @@ MKERROR4 DW ERROR28,ERROR27,ERROR27,ERROR2B,ERROR2C,ERROR27,ERROR2E,ERROR2
|
|||
* $51 - Directory count error. Broken directory
|
||||
* $52 - Not a ProDOS disk. Disk not recognised
|
||||
* $53 - Invalid parameter. Invalid parameter
|
||||
* $54 -(Dir not empty when deleting, cf $4E) DEL: Dir not empty
|
||||
* $54 -(Dir not empty when deleting, cf $4E) DEL: Directory not empty
|
||||
* $55 - Volume Control Block table full. (Too many disks mounted)
|
||||
* $56 - Bad buffer address.
|
||||
* $57 - Duplicate volume.
|
||||
|
@ -936,9 +958,11 @@ MKERROR4 DW ERROR28,ERROR27,ERROR27,ERROR2B,ERROR2C,ERROR27,ERROR2E,ERROR2
|
|||
* $60+ - (GSOS)
|
||||
|
||||
|
||||
* AcornOS ProDOS
|
||||
* AcornOS ProDOS
|
||||
ERROR28 DW $D200
|
||||
ASC 'Disk not present' ; $28 - No device detected/connected
|
||||
ERROR2A DW $CD00
|
||||
ASC 'Bad drive' ; $2A - Not a drive specifier
|
||||
ERROR2B DW $C900
|
||||
ASC 'Disk write protected'; $2B - Disk write protected
|
||||
ERROR2C DW $C600
|
||||
|
@ -965,9 +989,10 @@ ERROR48 DW $C600
|
|||
ERROR49 DW $B300
|
||||
ASC 'Directory full' ; $49 - Volume directory full
|
||||
ERROR4A ; $4A - Incompatible file format
|
||||
ERROR4B ; $4B - Unsupported storage_type
|
||||
ERROR52 DW $C800
|
||||
ASC 'Disk not recognised' ; $52 - Not a ProDOS disk
|
||||
ERROR4B DW $BE00 ; $4B - Unsupported storage_type
|
||||
ASC 'Not a directory'
|
||||
ERROR4C DW $DF00
|
||||
ASC 'End of file' ; $4C - End of file has been encountered
|
||||
ERROR4D DW $C100
|
||||
|
|
|
@ -204,7 +204,7 @@ BYTE00 BEQ BYTE00A ; OSBYTE 0,0 - generate error
|
|||
RTS ; %000x1xxx host type, 'A'pple
|
||||
BYTE00A BRK
|
||||
DB $F7
|
||||
HELLO ASC 'Applecorn MOS 2021-10-28'
|
||||
HELLO ASC 'Applecorn MOS 2021-11-03'
|
||||
DB $00 ; Unify MOS messages
|
||||
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
* 20-Sep-2021 Updated PRDECIMAL routine, prints up to 32 bits.
|
||||
* 25-Oct-2021 Initial pseudo-sideways ROM selection code.
|
||||
* 26-Oct-2021 Corrected entry parameters to OSRDRM.
|
||||
* 03-Nov-2021 Temp'y fix, if can't find SROM, ignores it.
|
||||
|
||||
|
||||
* OSBYTE $80 - ADVAL
|
||||
|
@ -341,6 +342,12 @@ ROMSELECT CPX $F8
|
|||
:ROMSEL PHA
|
||||
PHX
|
||||
PHY
|
||||
|
||||
LDA OSLPTR+0
|
||||
PHA
|
||||
LDA OSLPTR+1
|
||||
PHA
|
||||
|
||||
TXA
|
||||
ASL A
|
||||
TAX
|
||||
|
@ -348,6 +355,14 @@ ROMSELECT CPX $F8
|
|||
STA OSFILECB+0
|
||||
LDA ROMTAB+1,X ; MSB of pointer to name
|
||||
STA OSFILECB+1
|
||||
|
||||
LDX #<OSFILECB
|
||||
LDY #>OSFILECB
|
||||
LDA #$05 ; Means 'INFO'
|
||||
JSR OSFILE
|
||||
CMP #$01
|
||||
BNE :ROMNOTFND ; File not found
|
||||
|
||||
STZ OSFILECB+2 ; Dest address $8000
|
||||
LDA #$80
|
||||
STA OSFILECB+3
|
||||
|
@ -356,12 +371,9 @@ ROMSELECT CPX $F8
|
|||
STZ OSFILECB+6 ; Load to specified address
|
||||
LDX #<OSFILECB
|
||||
LDY #>OSFILECB
|
||||
LDA OSLPTR+0
|
||||
PHA
|
||||
LDA OSLPTR+1
|
||||
PHA
|
||||
LDA #$FF ; Means 'LOAD'
|
||||
JSR OSFILE
|
||||
:ROMNOTFND
|
||||
PLA
|
||||
STA OSLPTR+1
|
||||
PLA
|
||||
|
|
299
mainmem.misc.s
299
mainmem.misc.s
|
@ -7,198 +7,179 @@
|
|||
* A1L/A1H: Start address
|
||||
* A2L/A2H: End address
|
||||
* A4L/A4H: Destination start address
|
||||
MEMCPY LDA (A1L)
|
||||
STA (A4L)
|
||||
LDA A1H
|
||||
CMP A2H
|
||||
BNE :S1
|
||||
LDA A1L
|
||||
CMP A2L
|
||||
BNE :S1
|
||||
BRA :DONE
|
||||
:S1 INC A1L
|
||||
BNE :S2
|
||||
INC A1H
|
||||
:S2 INC A4L
|
||||
BNE :S3
|
||||
INC A4H
|
||||
:S3 BRA MEMCPY
|
||||
:DONE RTS
|
||||
MEMCPY LDA (A1L)
|
||||
STA (A4L)
|
||||
LDA A1H
|
||||
CMP A2H
|
||||
BNE :S1
|
||||
LDA A1L
|
||||
CMP A2L
|
||||
BNE :S1
|
||||
:DONE RTS
|
||||
:S1 INC A1L
|
||||
BNE :S2
|
||||
INC A1H
|
||||
:S2 INC A4L
|
||||
BNE :S3
|
||||
INC A4H
|
||||
:S3 BRA MEMCPY
|
||||
|
||||
* Copy 512 bytes from BLKBUF to AUXBLK in aux LC
|
||||
COPYAUXBLK >>> ALTZP ; Alt ZP & Alt LC on
|
||||
LDY #$00
|
||||
:L1 LDA BLKBUF,Y
|
||||
STA $C005 ; Write aux mem
|
||||
STA AUXBLK,Y
|
||||
STA $C004 ; Write main mem
|
||||
CPY #$FF
|
||||
BEQ :S1
|
||||
INY
|
||||
BRA :L1
|
||||
:S1 LDY #$00
|
||||
:L2 LDA BLKBUF+$100,Y
|
||||
STA $C005 ; Write aux mem
|
||||
STA AUXBLK+$100,Y
|
||||
STA $C004 ; Write main mem
|
||||
CPY #$FF
|
||||
BEQ :S2
|
||||
INY
|
||||
BRA :L2
|
||||
:S2 >>> MAINZP ; Alt ZP off, ROM back in
|
||||
RTS
|
||||
COPYAUXBLK >>> ALTZP ; Alt ZP & Alt LC on
|
||||
LDY #$00
|
||||
STA $C005 ; Write aux mem
|
||||
:L1 LDA BLKBUF+$000,Y
|
||||
STA AUXBLK+$000,Y
|
||||
LDA BLKBUF+$100,Y
|
||||
STA AUXBLK+$100,Y
|
||||
INY
|
||||
BNE :L1
|
||||
STA $C004 ; Write main mem
|
||||
:S2 >>> MAINZP ; Alt ZP off, ROM back in
|
||||
RTS
|
||||
|
||||
* Search FILEREFS for value in A
|
||||
* On return, buffer number is in X (or $FF if no bufs)
|
||||
FINDBUF LDX #$00
|
||||
:L1 CMP FILEREFS,X
|
||||
BEQ :END
|
||||
INX
|
||||
CPX #$04
|
||||
BNE :L1
|
||||
LDX #$FF ; $FF for not found
|
||||
:END RTS
|
||||
FINDBUF LDX #$00
|
||||
:L1 CMP FILEREFS,X
|
||||
BEQ :END
|
||||
INX
|
||||
CPX #$04
|
||||
BNE :L1
|
||||
LDX #$FF ; $FF for not found
|
||||
:END RTS
|
||||
|
||||
* Obtain I/O buffer address
|
||||
* On entry: buffer number in X
|
||||
* On exit: buffer address in AY
|
||||
* Carry set if no bufs, clear otherwise
|
||||
BUFADDR CPX #$00
|
||||
BNE :S1
|
||||
LDA #<IOBUF1
|
||||
LDY #>IOBUF1
|
||||
BRA :EXIT
|
||||
:S1 CPX #$01
|
||||
BNE :S2
|
||||
LDA #<IOBUF2
|
||||
LDY #>IOBUF2
|
||||
BRA :EXIT
|
||||
:S2 CPX #$02
|
||||
BNE :S3
|
||||
LDA #<IOBUF3
|
||||
LDY #>IOBUF3
|
||||
BRA :EXIT
|
||||
:S3 CPX #$03
|
||||
BNE :NOBUFS
|
||||
LDA #<IOBUF4
|
||||
LDY #>IOBUF4
|
||||
:EXIT CLC
|
||||
RTS
|
||||
:NOBUFS SEC
|
||||
RTS
|
||||
BUFADDR CPX #$00
|
||||
BNE :S1
|
||||
LDA #<IOBUF1
|
||||
LDY #>IOBUF1
|
||||
BRA :EXIT
|
||||
:S1 CPX #$01
|
||||
BNE :S2
|
||||
LDA #<IOBUF2
|
||||
LDY #>IOBUF2
|
||||
BRA :EXIT
|
||||
:S2 CPX #$02
|
||||
BNE :S3
|
||||
LDA #<IOBUF3
|
||||
LDY #>IOBUF3
|
||||
BRA :EXIT
|
||||
:S3 CPX #$03
|
||||
BNE :NOBUFS
|
||||
LDA #<IOBUF4
|
||||
LDY #>IOBUF4
|
||||
:EXIT CLC
|
||||
RTS
|
||||
:NOBUFS SEC
|
||||
RTS
|
||||
|
||||
|
||||
* Check if file exists
|
||||
* Return A=0 if doesn't exist, A=1 file, A=2 dir
|
||||
EXISTS LDA #<MOSFILE
|
||||
STA GINFOPL+1
|
||||
LDA #>MOSFILE
|
||||
STA GINFOPL+2
|
||||
JSR GETINFO ; GET_FILE_INFO
|
||||
BCS :NOEXIST
|
||||
LDA GINFOPL+7 ; Storage type
|
||||
CMP #$0D
|
||||
BCS :DIR ; >= $0D
|
||||
LDA #$01 ; File
|
||||
RTS
|
||||
:DIR LDA #$02
|
||||
RTS
|
||||
:NOEXIST LDA #$00
|
||||
RTS
|
||||
* Returns A=0 if doesn't exist, A=1 file, A=2 dir
|
||||
EXISTS LDA #<MOSFILE
|
||||
STA GINFOPL+1
|
||||
LDA #>MOSFILE
|
||||
STA GINFOPL+2
|
||||
JSR GETINFO ; GET_FILE_INFO
|
||||
LDA #$00
|
||||
BCS :EXIT ; Any error -> $00
|
||||
LDA GINFOPL+7 ; Storage type
|
||||
CMP #$0D
|
||||
LDA #$01 ; File -> $01
|
||||
ADC #$00 ; Dir. -> $02
|
||||
:EXIT RTS
|
||||
|
||||
|
||||
* Copy FILEBLK to OSFILECB in aux memory
|
||||
* Preserves A
|
||||
COPYFB PHA
|
||||
LDX #$11 ; 18 bytes in FILEBLK
|
||||
* >>> WRTAUX ; Alt ZP and LC
|
||||
>>> WRTAUX ; Write to Aux mem
|
||||
:L1 LDA FILEBLK,X
|
||||
* STA AUXBLK,X
|
||||
STA OSFILECB,X
|
||||
DEX
|
||||
BPL :L1
|
||||
* >>> MAINZP ; Back to normal
|
||||
>>> WRTMAIN ; Back to Main mem
|
||||
PLA
|
||||
RTS
|
||||
COPYFB PHA
|
||||
LDX #$11 ; 18 bytes in FILEBLK
|
||||
>>> WRTAUX ; Write to Aux mem
|
||||
:L1 LDA FILEBLK,X
|
||||
STA OSFILECB,X
|
||||
DEX
|
||||
BPL :L1
|
||||
>>> WRTMAIN ; Back to Main mem
|
||||
PLA
|
||||
RTS
|
||||
|
||||
* Get file info
|
||||
GETINFO JSR MLI
|
||||
DB GINFOCMD
|
||||
DW GINFOPL
|
||||
RTS
|
||||
GETINFO JSR MLI
|
||||
DB GINFOCMD
|
||||
DW GINFOPL
|
||||
RTS
|
||||
|
||||
* Set file info
|
||||
SETINFO LDA #$07 ; SET_FILE_INFO 7 parms
|
||||
STA GINFOPL
|
||||
JSR MLI
|
||||
DB SINFOCMD
|
||||
DW GINFOPL ; Re-use PL from GFI
|
||||
LDA #$0A ; GET_FILE_INFO 10 parms
|
||||
STA GINFOPL
|
||||
RTS
|
||||
SETINFO LDA #$07 ; SET_FILE_INFO 7 parms
|
||||
STA GINFOPL
|
||||
JSR MLI
|
||||
DB SINFOCMD
|
||||
DW GINFOPL ; Re-use PL from GFI
|
||||
LDA #$0A ; GET_FILE_INFO 10 parms
|
||||
STA GINFOPL
|
||||
RTS
|
||||
|
||||
* Create disk file
|
||||
* Uses filename in MOSFILE
|
||||
CRTFILE JSR MLI ; GET_TIME
|
||||
DB GTIMECMD
|
||||
LDA #<MOSFILE
|
||||
STA CREATEPL+1
|
||||
LDA #>MOSFILE
|
||||
STA CREATEPL+2
|
||||
LDA #$C3 ; Open permissions
|
||||
STA CREATEPL+3
|
||||
LDA $BF90 ; Current date
|
||||
STA CREATEPL+8
|
||||
LDA $BF91
|
||||
STA CREATEPL+9
|
||||
LDA $BF92 ; Current time
|
||||
STA CREATEPL+10
|
||||
LDA $BF93
|
||||
STA CREATEPL+11
|
||||
JSR MLI
|
||||
DB CREATCMD
|
||||
DW CREATEPL
|
||||
RTS
|
||||
CRTFILE JSR MLI ; GET_TIME
|
||||
DB GTIMECMD
|
||||
LDA #<MOSFILE
|
||||
STA CREATEPL+1
|
||||
LDA #>MOSFILE
|
||||
STA CREATEPL+2
|
||||
LDA #$C3 ; Open permissions
|
||||
STA CREATEPL+3
|
||||
LDA $BF90 ; Current date
|
||||
STA CREATEPL+8
|
||||
LDA $BF91
|
||||
STA CREATEPL+9
|
||||
LDA $BF92 ; Current time
|
||||
STA CREATEPL+10
|
||||
LDA $BF93
|
||||
STA CREATEPL+11
|
||||
JSR MLI
|
||||
DB CREATCMD
|
||||
DW CREATEPL
|
||||
RTS
|
||||
|
||||
* Open disk file
|
||||
OPENMOSFILE LDA #<MOSFILE ; Open filename in MOSFILE
|
||||
STA OPENPL+1
|
||||
LDA #>MOSFILE
|
||||
STA OPENPL+2
|
||||
OPENFILE JSR MLI
|
||||
DB OPENCMD
|
||||
DW OPENPL
|
||||
RTS
|
||||
OPENMOSFILE LDA #<MOSFILE ; Open filename in MOSFILE
|
||||
STA OPENPL+1
|
||||
LDA #>MOSFILE
|
||||
STA OPENPL+2
|
||||
OPENFILE JSR MLI
|
||||
DB OPENCMD
|
||||
DW OPENPL
|
||||
RTS
|
||||
|
||||
* Close disk file
|
||||
CLSFILE JSR MLI
|
||||
DB CLSCMD
|
||||
DW CLSPL
|
||||
RTS
|
||||
CLSFILE JSR MLI
|
||||
DB CLSCMD
|
||||
DW CLSPL
|
||||
RTS
|
||||
|
||||
* Read 512 bytes into BLKBUF
|
||||
RDFILE JSR MLI
|
||||
DB READCMD
|
||||
DW READPL
|
||||
RTS
|
||||
RDFILE JSR MLI
|
||||
DB READCMD
|
||||
DW READPL
|
||||
RTS
|
||||
|
||||
* Write data in BLKBUF to disk
|
||||
WRTFILE JSR MLI
|
||||
DB WRITECMD
|
||||
DW WRITEPL
|
||||
RTS
|
||||
WRTFILE JSR MLI
|
||||
DB WRITECMD
|
||||
DW WRITEPL
|
||||
RTS
|
||||
|
||||
* Put ProDOS prefix in PREFIX
|
||||
GETPREF JSR MLI
|
||||
DB GPFXCMD
|
||||
DW GPFXPL
|
||||
RTS
|
||||
GETPREF JSR MLI
|
||||
DB GPFXCMD
|
||||
DW GPFXPL
|
||||
RTS
|
||||
|
||||
* Map of file reference numbers to IOBUF1..4
|
||||
FILEREFS DB $00,$00,$00,$00
|
||||
|
||||
|
||||
|
||||
|
||||
FILEREFS DB $00,$00,$00,$00
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
*
|
||||
* Code for handling Applecorn paths and converting them to
|
||||
* ProDOS paths. Runs in main memory.
|
||||
* TO DO: check range in :sd
|
||||
|
||||
* Preprocess path in MOSFILE, handles:
|
||||
* 1) ':sd' type slot and drive prefix (s,d are digits)
|
||||
|
@ -301,16 +302,6 @@ PREFIX DS 65 ; Buffer for ProDOS prefix
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
* Optimised entry and return from OSFILE routines.
|
||||
* DELETE returns 'Dir not empty' when appropriate.
|
||||
* 29-Oct-2021 DRVINFO reads current drive if "".
|
||||
* 01-Nov-2021 DRVINFO checks reading info on a root directory.
|
||||
|
||||
|
||||
* ProDOS file handling to rename a file
|
||||
|
@ -941,11 +942,18 @@ INFOCLS JSR CLSDIR ; Be sure to close it!
|
|||
|
||||
|
||||
* Set prefix. Used by *CHDIR/*DRIVE to change directory
|
||||
* Y= $00 - CHDIR, select any directory
|
||||
* Y<>$00 - DRIVE, must select root
|
||||
*
|
||||
SETPFX >>> ENTMAIN
|
||||
PHY ; Save CHDIR/DRIVE flag
|
||||
JSR PREPATH ; Preprocess pathname
|
||||
BCS :EXIT
|
||||
JSR WILDONE ; Handle any wildcards
|
||||
BCS :ERR
|
||||
LDA #$2E
|
||||
BCS :EXIT ; Exit with wildcard path
|
||||
* TO DO: If DRIVE disallow selecting a directory
|
||||
*
|
||||
LDA #<MOSFILE
|
||||
STA SPFXPL+1
|
||||
LDA #>MOSFILE
|
||||
|
@ -953,12 +961,12 @@ SETPFX >>> ENTMAIN
|
|||
JSR MLI ; SET_PREFIX
|
||||
DB SPFXCMD
|
||||
DW SPFXPL
|
||||
* Returns $4B 'Unknown storage' if *CD <notdir>
|
||||
:EXIT >>> XF2AUX,CHDIRRET
|
||||
:ERR LDA #$40 ; Invalid pathname syn
|
||||
BRA :EXIT
|
||||
|
||||
* Obtain info on blocks used/total blocks
|
||||
:EXIT PLY ; Drop CHDIR/DRIVE flag
|
||||
>>> XF2AUX,CHDIRRET
|
||||
|
||||
|
||||
* Obtain info on total/used blocks
|
||||
DRVINFO >>> ENTMAIN
|
||||
LDA MOSFILE
|
||||
BNE :DRVINF2
|
||||
|
@ -966,28 +974,34 @@ DRVINFO >>> ENTMAIN
|
|||
LDA #'@'
|
||||
STA MOSFILE+1 ; Convert "" to "@"
|
||||
:DRVINF2 JSR PREPATH
|
||||
BCS :ERR
|
||||
BCS :EXIT
|
||||
LDA #<MOSFILE
|
||||
STA GINFOPL+1
|
||||
LDA #>MOSFILE
|
||||
STA GINFOPL+2
|
||||
JSR GETINFO ; GET_FILE_INFO
|
||||
BCS :EXIT
|
||||
PHA
|
||||
LDA GINFOPL+7
|
||||
CMP #$0F
|
||||
BNE :EXIT1 ; Not a drive, exit with 'Bad drive'
|
||||
|
||||
>>> ALTZP ; Alt ZP & Alt LC on
|
||||
LDA GINFOPL+8 ; Blcks used LSB
|
||||
STA AUXBLK
|
||||
LDA GINFOPL+9 ; Blks used MSB
|
||||
LDA GINFOPL+8 ; Blocks used LSB
|
||||
STA AUXBLK+0
|
||||
LDA GINFOPL+9 ; Blocks used MSB
|
||||
STA AUXBLK+1
|
||||
LDA GINFOPL+5 ; Tot blks LSB
|
||||
LDA GINFOPL+5 ; Total blocks LSB
|
||||
STA AUXBLK+2
|
||||
LDA GINFOPL+6 ; Tot blks MSB
|
||||
LDA GINFOPL+6 ; Total blocks MSB
|
||||
STA AUXBLK+3
|
||||
>>> MAINZP ; ALt ZP off, ROM back in
|
||||
PLA
|
||||
:EXIT >>> XF2AUX,FREERET
|
||||
:ERR LDA #$40 ; Invalid pathname syn
|
||||
BRA :EXIT
|
||||
LDA #$00 ; $00=Ok
|
||||
|
||||
:EXIT CMP #$46
|
||||
BNE :EXIT2
|
||||
:EXIT1 LDA #$2A ; Change 'Not found' to 'Bad drive'
|
||||
:EXIT2 >>> XF2AUX,FREERET
|
||||
|
||||
|
||||
* Change file permissions, for *ACCESS
|
||||
* Filename in MOSFILE, flags in MOSFILE2
|
||||
|
|
Loading…
Reference in New Issue