]> git.sur5r.net Git - cc65/blobdiff - libsrc/common/_fopen.s
The spans do now contain the size of a span, no longer the end offset.
[cc65] / libsrc / common / _fopen.s
index da0e8d8d864a6ee486d280918102492fc0e9f9b1..29f1c4cd92165ff1de2d1d4f03a522793a3c514c 100644 (file)
@@ -1,4 +1,4 @@
-;                     
+;
 ; Ullrich von Bassewitz, 22.11.2002
 ;
 ; FILE* __fastcall__ _fopen (const char* name, const char* mode, FILE* f);
 
 invmode:
         lda     #EINVAL
-        sta     __errno
-        lda     #0
-        sta     __errno+1
-        tax
+        jsr     __seterrno      ; Set __errno, returns zero in A
+        tax                     ; a/x = 0
         jmp     incsp4
 
 ; Mode string successfully parsed. Store the binary mode onto the stack in
@@ -101,9 +99,9 @@ openok: ldy     file
         sty     ptr1
         ldy     file+1
         sty     ptr1+1
-        ldy     #_FILE_f_fd
+        ldy     #_FILE::f_fd
         sta     (ptr1),y        ; file->f_fd = fd;
-        ldy     #_FILE_f_flags
+        ldy     #_FILE::f_flags
         lda     #_FOPEN
         sta     (ptr1),y        ; file->f_flags = _FOPEN;