Fix error handling when writing to files in emulated shell
This commit is contained in:
parent
2483ee699d
commit
fc81bce70f
@ -82,8 +82,7 @@ blkLoad:
|
|||||||
|
|
||||||
; Load the specified number of bytes (max 0xff) from the current memory pointer
|
; 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
|
; and write them to I/O. Memory pointer doesn't move. This puts chars to
|
||||||
; blkPutC.
|
; blkPutC. Raises error if not all bytes could be written.
|
||||||
; Control is returned to the shell only after all bytes are written.
|
|
||||||
;
|
;
|
||||||
; Example: save 42
|
; Example: save 42
|
||||||
blkSaveCmd:
|
blkSaveCmd:
|
||||||
@ -99,11 +98,16 @@ blkSave:
|
|||||||
ld a, (hl)
|
ld a, (hl)
|
||||||
inc hl
|
inc hl
|
||||||
call blkPutC
|
call blkPutC
|
||||||
|
jr nz, .ioError
|
||||||
djnz .loop
|
djnz .loop
|
||||||
|
.loopend:
|
||||||
|
; success
|
||||||
|
xor a
|
||||||
|
jr .end
|
||||||
|
.ioError:
|
||||||
|
ld a, SHELL_ERR_IO_ERROR
|
||||||
.end:
|
.end:
|
||||||
pop hl
|
pop hl
|
||||||
pop bc
|
pop bc
|
||||||
xor a
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
@ -129,6 +129,7 @@ fsdevPutC:
|
|||||||
jr nz, .error
|
jr nz, .error
|
||||||
pop af
|
pop af
|
||||||
out (FS_DATA_PORT), a
|
out (FS_DATA_PORT), a
|
||||||
|
cp a ; ensure Z
|
||||||
ret
|
ret
|
||||||
.error:
|
.error:
|
||||||
pop af
|
pop af
|
||||||
|
Loading…
Reference in New Issue
Block a user