]> git.sur5r.net Git - cc65/blobdiff - libsrc/atari/open.s
Use labels instead of segment load addresses to specify entry points
[cc65] / libsrc / atari / open.s
index 8aeff9ed4d24ba4fabe3def1ddc9d151c9686225..2188257cb17d8f404d1131516cbaadf220d5cce0 100644 (file)
@@ -91,7 +91,10 @@ cont:   ldy     #3
         jsr     ldaxysp
 
 .ifdef  UCASE_FILENAME
-
+.ifdef  DEFAULT_DEVICE
+        ldy     #$80
+        sty     tmp2            ; set flag for ucase_fn
+.endif
         jsr     ucase_fn
         bcc     ucok1
 invret: lda     #<EINVAL        ; file name is too long
@@ -140,8 +143,12 @@ finish: php
         plp
 
         bpl     ok
-        jsr     fddecusage      ; decrement usage counter of fd as open failed
-        tya                     ; put error code into A
+        sty     tmp3            ; remember error code
+        lda     #CLOSE
+        sta     ICCOM,x
+        jsr     CIOV            ; close IOCB again since open failed
+        jsr     fddecusage      ; and decrement usage counter of fd
+        lda     tmp3            ; put error code into A
         jmp     __mappederrno
 
 ok:     lda     tmp2            ; get fd