1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-23 15:48:05 +11:00

Fix error handling when writing to files in emulated shell

This commit is contained in:
Virgil Dupras 2019-06-05 16:13:15 -04:00
parent 2483ee699d
commit fc81bce70f
2 changed files with 9 additions and 4 deletions

View File

@ -82,8 +82,7 @@ blkLoad:
; Load the specified number of bytes (max 0xff) from the current memory pointer
; and write them to I/O. Memory pointer doesn't move. This puts chars to
; blkPutC.
; Control is returned to the shell only after all bytes are written.
; blkPutC. Raises error if not all bytes could be written.
;
; Example: save 42
blkSaveCmd:
@ -99,11 +98,16 @@ blkSave:
ld a, (hl)
inc hl
call blkPutC
jr nz, .ioError
djnz .loop
.loopend:
; success
xor a
jr .end
.ioError:
ld a, SHELL_ERR_IO_ERROR
.end:
pop hl
pop bc
xor a
ret

View File

@ -129,6 +129,7 @@ fsdevPutC:
jr nz, .error
pop af
out (FS_DATA_PORT), a
cp a ; ensure Z
ret
.error:
pop af