mirror of
https://github.com/bobbimanners/Applecorn.git
synced 2025-02-06 02:30:15 +00:00
Merge part 2 of PR 121 'Tidied FILE handler'
This commit is contained in:
parent
275e22ab99
commit
88666e5c88
BIN
applecorn.po
BIN
applecorn.po
Binary file not shown.
303
auxmem.hostfs.s
303
auxmem.hostfs.s
@ -12,6 +12,7 @@
|
||||
* 12-Oct-2021 BGET and BPUT check for returned error.
|
||||
* 13-Oct-2021 FIND, BGET, BPUT optimised passing registers to main.
|
||||
* 13-Oct-2021 ARGS, EOF returns errors, optimised passing registers.
|
||||
* 14-Oct-2021 Tidied FILE handler.
|
||||
|
||||
|
||||
* $B0-$BF Temporary filing system workspace
|
||||
@ -210,45 +211,62 @@ FILEHND PHX
|
||||
PHY
|
||||
PHA
|
||||
|
||||
STX CBPTR ; LSB of parameter block
|
||||
STX ZP1
|
||||
STY CBPTR+1 ; MSB of parameter block
|
||||
STY ZP1+1
|
||||
* STX CBPTR ; LSB of parameter block
|
||||
* STX ZP1
|
||||
* STY CBPTR+1 ; MSB of parameter block
|
||||
* STY ZP1+1
|
||||
|
||||
LDA (ZP1) ; Filename ptr->XY
|
||||
STX FSCTRL+0 ; FSCTRL=>control block
|
||||
STY FSCTRL+1
|
||||
LDA (FSCTRL) ; XY=>filename
|
||||
TAX
|
||||
LDY #$01
|
||||
LDA (ZP1),Y
|
||||
LDA (FSCTRL),Y
|
||||
TAY
|
||||
|
||||
JSR PARSNAME ; Copy filename->MOSFILE
|
||||
|
||||
LDA #<FILEBLK
|
||||
STA ZP2
|
||||
LDA #>FILEBLK
|
||||
STA ZP2+1
|
||||
LDY #$00 ; Copy to FILEBLK in main mem
|
||||
:L1 LDA (ZP1),Y
|
||||
* LDA (ZP1) ; Filename ptr->XY
|
||||
* TAX
|
||||
* LDY #$01
|
||||
* LDA (ZP1),Y
|
||||
* TAY
|
||||
* JSR PARSNAME ; Copy filename->MOSFILE
|
||||
|
||||
* LDA #<FILEBLK
|
||||
* STA ZP2
|
||||
* LDA #>FILEBLK
|
||||
* STA ZP2+1
|
||||
* LDY #$00 ; Copy to FILEBLK in main mem
|
||||
*:L1 LDA (ZP1),Y
|
||||
* >>> WRTMAIN
|
||||
* STA (ZP2),Y
|
||||
* >>> WRTAUX
|
||||
* INY
|
||||
* CPY #$12
|
||||
* BNE :L1
|
||||
|
||||
LDY #$11
|
||||
>>> WRTMAIN
|
||||
STA (ZP2),Y
|
||||
:L1 LDA (FSCTRL),Y ; Copy control block to auxmem
|
||||
STA FILEBLK,Y
|
||||
DEY
|
||||
BPL :L1
|
||||
>>> WRTAUX
|
||||
INY
|
||||
CPY #$12
|
||||
BNE :L1
|
||||
|
||||
PLA ; Get action back
|
||||
PHA
|
||||
* PHA
|
||||
BEQ :SAVE ; A=00 -> SAVE
|
||||
CMP #$FF
|
||||
BEQ :LOAD ; A=FF -> LOAD
|
||||
CMP #$06
|
||||
BEQ :DELETE ; A=06 -> DELETE
|
||||
* BCC :INFO ; A=01-05 -> INFO
|
||||
BCC :JMPINFO ; A=01-05 -> INFO
|
||||
CMP #$08
|
||||
BEQ :MKDIR ; A=08 -> MKDIR
|
||||
|
||||
PLA ; Not implemented, return unchanged
|
||||
PLY
|
||||
* PLA
|
||||
PLY ; Not implemented, return unchanged
|
||||
PLX
|
||||
RTS
|
||||
|
||||
@ -256,45 +274,52 @@ FILEHND PHX
|
||||
:SAVE >>> XF2MAIN,SAVEFILE
|
||||
:LOAD >>> XF2MAIN,LOADFILE
|
||||
:DELETE >>> XF2MAIN,DELFILE
|
||||
:MKDIR >>> XF2MAIN,MAKEDIR
|
||||
:INFO >>> XF2MAIN,INFOFILE
|
||||
:MKDIR >>> XF2MAIN,MAKEDIR
|
||||
|
||||
* On return here, A<$20 return to caller, A>$1F ProDOS error
|
||||
OSFILERET
|
||||
>>> ENTAUX
|
||||
PHA
|
||||
LDA CBPTR ; Copy OSFILE CB to :CBPTR addr
|
||||
STA ZP1
|
||||
LDA CBPTR+1
|
||||
STA ZP1+1
|
||||
LDY #$02
|
||||
:L3 LDA AUXBLK,Y ; Mainmem left it in AUXBLK
|
||||
STA (ZP1),Y
|
||||
INY
|
||||
CPY #18 ; 18 bytes in control block
|
||||
BNE :L3
|
||||
PLA
|
||||
PLY ; Original action
|
||||
OSFILERET >>> ENTAUX
|
||||
JSR CHKERROR ; Check if error returned
|
||||
PHA
|
||||
LDY #$11 ; Copy updated control block back
|
||||
:L3 LDA AUXBLK,Y ; Mainmem left it in AUXBLK
|
||||
STA (FSCTRL),Y
|
||||
DEY
|
||||
BPL :L3
|
||||
|
||||
* LDA CBPTR ; Copy OSFILE CB to :CBPTR addr
|
||||
* STA ZP1
|
||||
* LDA CBPTR+1
|
||||
* STA ZP1+1
|
||||
* LDY #$02
|
||||
*:L3 LDA AUXBLK,Y ; Mainmem left it in AUXBLK
|
||||
* STA (ZP1),Y
|
||||
* INY
|
||||
* CPY #18 ; 18 bytes in control block
|
||||
* BNE :L3
|
||||
|
||||
PLA ; Returned object type
|
||||
* PLY ; Original action
|
||||
* JSR CHKERROR ; Check if error returned
|
||||
PLY ; No error, return to caller
|
||||
PLX
|
||||
RTS
|
||||
|
||||
ERRNOTFND BRK
|
||||
DB $D6 ; $D6 = Object not found
|
||||
ASC 'File not found'
|
||||
BRK
|
||||
*ERRNOTFND BRK
|
||||
* DB $D6 ; $D6 = Object not found
|
||||
* ASC 'File not found'
|
||||
* BRK
|
||||
|
||||
ERREXISTS BRK
|
||||
DB $C4 ; Can't create a dir if a file is
|
||||
ASC 'File exists' ; already there
|
||||
BRK
|
||||
*ERREXISTS BRK
|
||||
* DB $C4 ; Can't create a dir if a file is
|
||||
* ASC 'File exists' ; already there
|
||||
* BRK
|
||||
|
||||
CBPTR DW $0000
|
||||
OSFILEM ASC 'OSFILE($'
|
||||
DB $00
|
||||
OSFILEM2 ASC ')'
|
||||
DB $00
|
||||
*CBPTR DW $0000
|
||||
*OSFILEM ASC 'OSFILE($'
|
||||
* DB $00
|
||||
*OSFILEM2 ASC ')'
|
||||
* DB $00
|
||||
OSFSCM ASC 'OSFSC.'
|
||||
DB $00
|
||||
|
||||
@ -688,19 +713,19 @@ FREERET
|
||||
LDA AUXBLK+3 ; MSB of total blks
|
||||
SBC AUXBLK+1 ; MSB of blocks used
|
||||
TAY
|
||||
LDA #$00 ; *TO DO* b16-b23 of free
|
||||
LDA #$00 ; *TO DO* b16-b23 of free
|
||||
* NEW
|
||||
JSR :FREEDEC ; Print 'AAYYXX blocks aaayyyxxx bytes '
|
||||
JSR :FREEDEC ; Print 'AAYYXX blocks aaayyyxxx bytes '
|
||||
LDX #<:FREE
|
||||
LDY #>:FREE
|
||||
JSR OUTSTR ; Print 'free'<nl>
|
||||
LDX AUXBLK+0 ; Blocks used
|
||||
JSR OUTSTR ; Print 'free'<nl>
|
||||
LDX AUXBLK+0 ; Blocks used
|
||||
LDY AUXBLK+1
|
||||
LDA #$00 ; *TO DO* b16-b23 of used
|
||||
JSR :FREEDEC ; Print 'AAYYXX blocks aaayyyxxx bytes '
|
||||
LDA #$00 ; *TO DO* b16-b23 of used
|
||||
JSR :FREEDEC ; Print 'AAYYXX blocks aaayyyxxx bytes '
|
||||
LDX #<:USED
|
||||
LDY #>:USED
|
||||
JMP OUTSTR ; Print 'used'<nl>
|
||||
JMP OUTSTR ; Print 'used'<nl>
|
||||
|
||||
* OLD
|
||||
* JSR PRDECXY ; Print in decimal
|
||||
@ -723,20 +748,20 @@ FREERET
|
||||
STA FSNUM+3
|
||||
* What's the maximum number of blocks?
|
||||
* JSR PRHEX ; Blocks b16-b23 in hex
|
||||
JSR PR2HEX ; Blocks b0-b15 in hex
|
||||
JSR PR2HEX ; Blocks b0-b15 in hex
|
||||
LDX #<:BLOCKS
|
||||
LDY #>:BLOCKS
|
||||
JSR OUTSTR ; ' blocks '
|
||||
STZ FSNUM+0 ; FSNUM=blocks*512
|
||||
JSR OUTSTR ; ' blocks '
|
||||
STZ FSNUM+0 ; FSNUM=blocks*512
|
||||
ASL FSNUM+1
|
||||
ROL FSNUM+2
|
||||
ROL FSNUM+3
|
||||
LDX #FSNUM ; X=>number to print
|
||||
LDY #8 ; Y=pad up to 8 digits
|
||||
JSR PRINTDEC ; Print it in decimal
|
||||
LDX #FSNUM ; X=>number to print
|
||||
LDY #8 ; Y=pad up to 8 digits
|
||||
JSR PRINTDEC ; Print it in decimal
|
||||
LDX #<:BYTES
|
||||
LDY #>:BYTES
|
||||
JMP OUTSTR ; ' bytes '
|
||||
JMP OUTSTR ; ' bytes '
|
||||
:BLOCKS ASC ' blocks '
|
||||
DB 0
|
||||
:BYTES ASC ' bytes '
|
||||
@ -833,7 +858,7 @@ CHKERROR CMP #$20
|
||||
RTS
|
||||
|
||||
*ERREXISTS LDA #$47 ; File exists
|
||||
*ERRNOTFND LDA #$46 ; File not found
|
||||
ERRNOTFND LDA #$46 ; File not found
|
||||
|
||||
MKERROR
|
||||
BIT $E0
|
||||
@ -873,13 +898,13 @@ ERRMSG
|
||||
MKERROR1
|
||||
CMP #$40
|
||||
BCS MKERROR2
|
||||
ADC #$31
|
||||
ORA #$30 ; <$40 -> $30-$3F
|
||||
MKERROR2
|
||||
SEC
|
||||
SBC #$40
|
||||
CMP #$20
|
||||
SBC #$37
|
||||
CMP #$28
|
||||
BCC MKERROR3
|
||||
LDA #$18 ; I/O error
|
||||
LDA #$00 ; I/O error
|
||||
MKERROR3
|
||||
ASL A
|
||||
TAX
|
||||
@ -889,111 +914,121 @@ MKERROR3
|
||||
PHA
|
||||
PHP
|
||||
RTI
|
||||
MKERROR4
|
||||
MKERROR4 DW ERROR27
|
||||
DW ERROR28,ERROR27,ERROR27,ERROR2B,ERROR27,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,ERROR28,ERROR5A,ERROR5B,ERROR2B,ERROR5D,ERROR5E,ERROR2E
|
||||
DW ERROR27,ERROR27,ERROR5A,ERROR5B,ERROR27,ERROR5D,ERROR5E,ERROR27
|
||||
|
||||
* $40 - Invalid pathname syntax. Bad filename
|
||||
* $41 - Duplicate filename. (additional) Directory exists
|
||||
* $42 - File Control Block table full. Too many open
|
||||
* $43 - Invalid reference number. Channel not open
|
||||
* $44 - Path not found. File not found
|
||||
* $45 - Volume directory not found. Disk not found
|
||||
* $46 - File not found. File not found
|
||||
* $47 - Duplicate filename. (see also $41) File exists
|
||||
* $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
|
||||
* $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
|
||||
* $4F - Access error. (additional) REN/DEL: Locked
|
||||
* $50 - File is open. Can't - file open
|
||||
* $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) Dir not empty
|
||||
* $27 - I/O error (disk not formatted)
|
||||
* $28 - No device con'd (drive not present) Disk not present
|
||||
* $29 - (GEOS Driver is busy)
|
||||
* $2A -
|
||||
* $2B - Disk write protected. Disk write protected
|
||||
* $2C - (GEOS bad byte count)
|
||||
* $2D - (GEOS bad block number)
|
||||
* $2E - Disk switched Disk changed
|
||||
* $2F - Device is offline (drive empty)
|
||||
|
||||
* $40 - Invalid pathname syntax. Bad filename
|
||||
* $41 - Duplicate filename. (split from $47) Directory exists
|
||||
* $42 - File Control Block table full. Too many open
|
||||
* $43 - Invalid reference number. Channel not open
|
||||
* $44 - Path not found. (Dir not found) File not found
|
||||
* $45 - Volume directory not found. Disk not found
|
||||
* $46 - File not found. File not found
|
||||
* $47 - Duplicate filename. (see also $41) File exists
|
||||
* $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
|
||||
* $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
|
||||
* $4F - Access error. (split from $4E) REN/DEL: Locked
|
||||
* $50 - File already open. Can't - file open
|
||||
* $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) Dir not empty
|
||||
* $55 - Volume Control Block table full.
|
||||
* $56 - Bad buffer address.
|
||||
* $57 - Duplicate volume.
|
||||
* ($58) $27 - I/O error (disk not formatted)
|
||||
* ($59) $28 - No device connected (drive not present) Disk not present
|
||||
* $5A ($29) - Bit map disk address is impossible. Sector not found
|
||||
* $5B $2A -
|
||||
* ($5C) $2B - Disk write protected. Disk write protected
|
||||
* $5D ($2C) - (EOF during load or save) Data lost
|
||||
* $5E ($2D) - (Couldn't open to save) Can't save
|
||||
* ($5F) $2E - Disk switched Disk changed
|
||||
* $2F - Device is offline (drive empty)
|
||||
*
|
||||
* $58 - Bad volume bitmap.
|
||||
* $59 - (GEOS File level out of range)
|
||||
* $5A - Bit map disk address is impossible. Sector not found
|
||||
* $5B - (GEOS Bad ChangePath pathname)
|
||||
* $5C - (GEOS Not executable file)
|
||||
* $5D - (EOF during load or save) Data lost
|
||||
* $5E - (Couldn't open to save) Can't save
|
||||
* $5F - (GEOS Too many applications)
|
||||
* $60+ - (GEOS)
|
||||
|
||||
|
||||
* AcornOS ProDOS
|
||||
ERROR40 DW $CC00
|
||||
ASC 'Bad filename' ; $40 - Invalid pathname syntax
|
||||
ASC 'Bad filename' ; $40 - Invalid pathname syntax
|
||||
ERROR41 DW $C400
|
||||
ASC 'Directory exists' ; $41 - Duplicate filename (split from $47)
|
||||
ASC 'Directory exists' ; $41 - Duplicate filename (split from $47)
|
||||
ERROR42 DW $C000
|
||||
ASC 'Too many open' ; $42 - File Control Block table full
|
||||
ASC 'Too many open' ; $42 - File Control Block table full
|
||||
ERROR43 DW $DE00
|
||||
ASC 'Channel not open' ; $43 - Invalid reference number
|
||||
ERROR44 ; $44 - Path not found
|
||||
ASC 'Channel not open' ; $43 - Invalid reference number
|
||||
ERROR44 ; $44 - Path not found
|
||||
ERROR46 DW $D600
|
||||
ASC 'File not found' ; $46 - File not found
|
||||
ASC 'File not found' ; $46 - File not found
|
||||
ERROR45 DW $D600
|
||||
ASC 'Disk not found' ; $45 - Volume directory not found
|
||||
ASC 'Disk not found' ; $45 - Volume directory not found
|
||||
ERROR47 DW $C400
|
||||
ASC 'File exists' ; $47 - Duplicate filename (see also $41)
|
||||
ASC 'File exists' ; $47 - Duplicate filename (see also $41)
|
||||
ERROR48 DW $C600
|
||||
ASC 'Disk full' ; $48 - Overrun error
|
||||
ASC 'Disk full' ; $48 - Overrun error
|
||||
ERROR49 DW $B300
|
||||
ASC 'Directory full' ; $49 - Volume directory full
|
||||
ERROR4A ; $4A - Incompatible file format
|
||||
ERROR4B ; $4B - Unsupported storage_type
|
||||
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
|
||||
ASC 'Disk not recognised' ; $52 - Not a ProDOS disk
|
||||
ERROR4C DW $DF00
|
||||
ASC 'End of file' ; $4C - End of file has been encountered
|
||||
ASC 'End of file' ; $4C - End of file has been encountered
|
||||
ERROR4D DW $C100
|
||||
ASC 'Not open for update' ; $4D - Position out of range
|
||||
ASC 'Not open for update' ; $4D - Position out of range
|
||||
ERROR4E DW $BD00
|
||||
ASC 'Insufficient access' ; $4E - Access error (see also $4F)
|
||||
ASC 'Insufficient access' ; $4E - Access error (see also $4F)
|
||||
ERROR4F DW $C300
|
||||
ASC 'Locked' ; $4F - Access error (split from $4E)
|
||||
ASC 'Locked' ; $4F - Access error (split from $4E)
|
||||
ERROR50 DW $C200
|
||||
ASC 'Can'
|
||||
DB $27
|
||||
ASC 't - file open' ; $50 - File is open
|
||||
ASC 't - file open' ; $50 - File is open
|
||||
ERROR51 DW $A800
|
||||
ASC 'Broken directory' ; $51 - Directory count error
|
||||
ASC 'Broken directory' ; $51 - Directory count error
|
||||
ERROR53 DW $DC00
|
||||
ASC 'Invalid parameter' ; $53 - Invalid parameter
|
||||
ASC 'Invalid parameter' ; $53 - Invalid parameter
|
||||
ERROR54 DW $D400
|
||||
ASC 'Directory not empty' ; $54 - Directory not empty
|
||||
ASC 'Directory not empty' ; $54 - Directory not empty
|
||||
ERROR55 DW $FF00
|
||||
ASC 'ProDOS: VCB full' ; $55 - Volume Control Block table full
|
||||
ASC 'ProDOS: VCB full' ; $55 - Volume Control Block table full
|
||||
ERROR56 DW $FF00
|
||||
ASC 'ProDOS: Bad addr' ; $56 - Bad buffer address
|
||||
ASC 'ProDOS: Bad addr' ; $56 - Bad buffer address
|
||||
ERROR57 DW $FF00
|
||||
ASC 'ProDOS: Dup volm' ; $57 - Duplicate volume
|
||||
ERROR5B ; spare
|
||||
ASC 'ProDOS: Dup volm' ; $57 - Duplicate volume
|
||||
ERROR5B ; spare
|
||||
ERROR27 DW $FF00
|
||||
ASC 'I/O error' ; $27 - I/O error
|
||||
ASC 'I/O error' ; $27 - I/O error
|
||||
ERROR28 DW $D200
|
||||
ASC 'Disk not present' ; $28 - No device detected/connected
|
||||
ASC 'Disk not present' ; $28 - No device detected/connected
|
||||
ERROR5A DW $FF00
|
||||
ASC 'Sector not found' ; $5A - Bit map disk address is impossible
|
||||
ASC 'Sector not found' ; $5A - Bit map disk address is impossible
|
||||
ERROR2B DW $C900
|
||||
ASC 'Disk write protected' ; $2B - Disk write protected
|
||||
ASC 'Disk write protected'; $2B - Disk write protected
|
||||
ERROR5D DW $CA00
|
||||
ASC 'Data lost' ; $5D - EOF during LOAD or SAVE
|
||||
ASC 'Data lost' ; $5D - EOF during LOAD or SAVE
|
||||
ERROR5E DW $C000
|
||||
ASC 'Can'
|
||||
DB $27
|
||||
ASC 't save' ; $5E - Couldn't open for save
|
||||
ASC 't save' ; $5E - Couldn't open for save
|
||||
ERROR2E DW $C800
|
||||
ASC 'Disk changed' ; $2E - Disk switched
|
||||
ASC 'Disk changed' ; $2E - Disk switched
|
||||
DB $00
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user