]> git.sur5r.net Git - cc65/commitdiff
fixed return code for _rs232_init
authorcpg <cpg@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Fri, 7 Mar 2003 00:19:22 +0000 (00:19 +0000)
committercpg <cpg@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Fri, 7 Mar 2003 00:19:22 +0000 (00:19 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@2005 b7a2c559-68d2-44c3-8de9-860c34a00d81

libsrc/atari/rs232.s

index 1c00963cf2d49fc1fac342a6fb3e7f4b33142c1b..843827fb6f54dc856df9164d84ee17d8a20e0bb8 100644 (file)
@@ -15,7 +15,7 @@
 ;
 
        .import         findfreeiocb
-       .import         __seterrno, __do_oserror, __oserror
+       .import         __do_oserror
        .import         fddecusage
        .import         fdtoiocb
        .import         __inviocb
@@ -60,16 +60,8 @@ rshand:      .word   $ffff
 .proc  _rs232_init
 
        jsr     findfreeiocb
-       beq     iocbok          ; we found one
-
-       lda     #<EMFILE        ; "too many open files"
-       ldx     #>EMFILE
-seterr:        jsr     __seterrno
-       lda     #$FF
-       tax
-       rts                     ; return -1
-
-iocbok:        txa
+       bne     init_err
+       txa
        tay                     ; move iocb # into Y
        lda     #3
        sta     tmp3            ; name length + 1
@@ -102,18 +94,21 @@ doopen:    tax
        sta     ICBLL,x         ; zap buf len
        sta     ICBLH,x
        jsr     CIOV
-       bmi     cioerr
+       bmi     cioerr1
 
        lda     tmp2            ; get fd
        sta     rshand
        ldx     #0
        stx     rshand+1
        txa
-       stx     __oserror
        rts
 
-cioerr:        jsr     fddecusage      ; decrement usage counter of fd as open failed
-       jmp     __do_oserror
+cioerr1:jsr    fddecusage      ; decrement usage counter of fd as open failed
+
+init_err:
+       ldx     #0
+       lda     #RS_ERR_INIT_FAILED
+       rts
 
 .endproc       ; _rs232_init