1
0
mirror of https://github.com/bobbimanners/Applecorn.git synced 2025-03-25 06:29:44 +00:00

Adding error handling to DELETE. In progress.

This commit is contained in:
Bobbi Webber-Manners 2021-08-24 00:50:56 -04:00
parent ac256afdfd
commit d5ee3aaf02
3 changed files with 25 additions and 7 deletions

Binary file not shown.

@ -263,8 +263,8 @@ OSFILERET
BNE :L3
PLA
PLY ; Value of A on OSFILE entry
CPY #$FF ; LOAD
BNE :S4 ; Deal with return from SAVE
CPY #$FF ; See if command was LOAD
BNE :NOTLOAD ; Deal with return from SAVE
CMP #$01 ; No file found
BNE :SL1
@ -283,8 +283,8 @@ OSFILERET
:SL2 LDA #$01 ; Return code - file found
BRA :EXIT
:S4 CPY #$00 ; Return from SAVE
BNE :S6
:NOTLOAD CPY #$00 ; See if command was SAVE
BNE :NOTLS ; Not LOAD or SAVE
CMP #$01 ; Unable to create or open
BNE :SS1
BRK
@ -295,13 +295,19 @@ OSFILERET
BRK
:SS1 CMP #$02 ; Unable to write
BNE :S6
BNE :EXIT
BRK
DB $CA ; $CA = Premature end, 'Data lost'
ASC 'Write error'
BRK
:S6 LDA #$01 ; Short-term hack
:NOTLS CMP #$00 ; Unable to delete
BNE :EXIT
BRK
DB $D6 ; $D6 = File not found
ASC 'File not found'
BRK
:EXIT PLY
PLX
RTS

@ -141,9 +141,21 @@ COPYAUXBLK
RTS
* ProDOS file handling to delete a file
* Return A=0 not found, A=1 file, A=2 dir
DELFILE >>> ENTMAIN
JSR UPDFB ; Update FILEBLK
JSR COPYFB ; Copy back to aux mem
JSR DESTROY
>>> XF2AUX,OSFILERET
BCC :DELETED
LDA $00 ; 'Not found'
BRA :EXIT
:DELETED LDA GINFOPL+7 ; Storage type
CMP #$0D ; Directory
BEQ :DIRDEL
LDA #$01 ; 'File deleted'
BRA :EXIT
:DIRDEL LDA #$02 ; 'Dir deleted'
:EXIT >>> XF2AUX,OSFILERET
DESTROY LDA #<MOSFILE ; Attempt to destroy file
STA DESTPL+1