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
|
||||
; 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
|
||||
|
||||
|
@ -129,6 +129,7 @@ fsdevPutC:
|
||||
jr nz, .error
|
||||
pop af
|
||||
out (FS_DATA_PORT), a
|
||||
cp a ; ensure Z
|
||||
ret
|
||||
.error:
|
||||
pop af
|
||||
|
Loading…
Reference in New Issue
Block a user