mirror of
https://github.com/cc65/cc65.git
synced 2024-07-07 19:29:18 +00:00
Fixed an error: The write routine didn't detect write errors correctly.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5653 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
2ce084228f
commit
33926dee54
@ -7,7 +7,7 @@
|
|||||||
.export _write
|
.export _write
|
||||||
.constructor initstdout
|
.constructor initstdout
|
||||||
|
|
||||||
.import SETLFS, OPEN, CKOUT, BSOUT, CLRCH
|
.import SETLFS, OPEN, CKOUT, BSOUT, READST, CLRCH
|
||||||
.import rwcommon
|
.import rwcommon
|
||||||
.importzp sp, ptr1, ptr2, ptr3
|
.importzp sp, ptr1, ptr2, ptr3
|
||||||
|
|
||||||
@ -72,7 +72,15 @@
|
|||||||
bne @L1
|
bne @L1
|
||||||
inc ptr2+1 ; A = *buf++;
|
inc ptr2+1 ; A = *buf++;
|
||||||
@L1: jsr BSOUT
|
@L1: jsr BSOUT
|
||||||
bcs @error ; Bail out on errors
|
|
||||||
|
; Check the status
|
||||||
|
|
||||||
|
pha
|
||||||
|
jsr READST
|
||||||
|
lsr a ; Bit zero is write timeout
|
||||||
|
bne devnotpresent2
|
||||||
|
pla
|
||||||
|
bcs @L3
|
||||||
|
|
||||||
; Count characters written
|
; Count characters written
|
||||||
|
|
||||||
@ -87,9 +95,9 @@
|
|||||||
inc ptr1+1
|
inc ptr1+1
|
||||||
bne @L0
|
bne @L0
|
||||||
|
|
||||||
; Wrote all chars, close the output channel
|
; Wrote all chars or disk full. Close the output channel
|
||||||
|
|
||||||
jsr CLRCH
|
@L3: jsr CLRCH
|
||||||
|
|
||||||
; Clear _oserror and return the number of chars written
|
; Clear _oserror and return the number of chars written
|
||||||
|
|
||||||
@ -101,6 +109,8 @@
|
|||||||
|
|
||||||
; Error entry: Device not present
|
; Error entry: Device not present
|
||||||
|
|
||||||
|
devnotpresent2:
|
||||||
|
pla
|
||||||
devnotpresent:
|
devnotpresent:
|
||||||
lda #ENODEV
|
lda #ENODEV
|
||||||
jmp __directerrno ; Sets _errno, clears _oserror, returns -1
|
jmp __directerrno ; Sets _errno, clears _oserror, returns -1
|
||||||
|
Loading…
Reference in New Issue
Block a user