fixed return code for _rs232_init
git-svn-id: svn://svn.cc65.org/cc65/trunk@2005 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
;
|
;
|
||||||
|
|
||||||
.import findfreeiocb
|
.import findfreeiocb
|
||||||
.import __seterrno, __do_oserror, __oserror
|
.import __do_oserror
|
||||||
.import fddecusage
|
.import fddecusage
|
||||||
.import fdtoiocb
|
.import fdtoiocb
|
||||||
.import __inviocb
|
.import __inviocb
|
||||||
@@ -60,16 +60,8 @@ rshand: .word $ffff
|
|||||||
.proc _rs232_init
|
.proc _rs232_init
|
||||||
|
|
||||||
jsr findfreeiocb
|
jsr findfreeiocb
|
||||||
beq iocbok ; we found one
|
bne init_err
|
||||||
|
txa
|
||||||
lda #<EMFILE ; "too many open files"
|
|
||||||
ldx #>EMFILE
|
|
||||||
seterr: jsr __seterrno
|
|
||||||
lda #$FF
|
|
||||||
tax
|
|
||||||
rts ; return -1
|
|
||||||
|
|
||||||
iocbok: txa
|
|
||||||
tay ; move iocb # into Y
|
tay ; move iocb # into Y
|
||||||
lda #3
|
lda #3
|
||||||
sta tmp3 ; name length + 1
|
sta tmp3 ; name length + 1
|
||||||
@@ -102,18 +94,21 @@ doopen: tax
|
|||||||
sta ICBLL,x ; zap buf len
|
sta ICBLL,x ; zap buf len
|
||||||
sta ICBLH,x
|
sta ICBLH,x
|
||||||
jsr CIOV
|
jsr CIOV
|
||||||
bmi cioerr
|
bmi cioerr1
|
||||||
|
|
||||||
lda tmp2 ; get fd
|
lda tmp2 ; get fd
|
||||||
sta rshand
|
sta rshand
|
||||||
ldx #0
|
ldx #0
|
||||||
stx rshand+1
|
stx rshand+1
|
||||||
txa
|
txa
|
||||||
stx __oserror
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
cioerr: jsr fddecusage ; decrement usage counter of fd as open failed
|
cioerr1:jsr fddecusage ; decrement usage counter of fd as open failed
|
||||||
jmp __do_oserror
|
|
||||||
|
init_err:
|
||||||
|
ldx #0
|
||||||
|
lda #RS_ERR_INIT_FAILED
|
||||||
|
rts
|
||||||
|
|
||||||
.endproc ; _rs232_init
|
.endproc ; _rs232_init
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user