]> git.sur5r.net Git - cc65/blobdiff - libsrc/common/_fopen.s
Allow "mode" argument to open() to be passed from 6502 code.
[cc65] / libsrc / common / _fopen.s
index 29f1c4cd92165ff1de2d1d4f03a522793a3c514c..0154858dd34180969da9d50ad2de46a72b6da1c9 100644 (file)
@@ -15,6 +15,7 @@
         .include        "errno.inc"
         .include        "fcntl.inc"
         .include        "_file.inc"
+        .include        "stat.inc"
 
 
 ; ------------------------------------------------------------------------
@@ -82,7 +83,10 @@ modeok: ldy     #$00
         tya
         iny
         sta     (sp),y
-        ldy     #4              ; Size of arguments in bytes
+        lda     #<(S_IREAD|S_IWRITE)
+        ldx     #>(S_IREAD|S_IWRITE)
+        jsr     pushax          ; Push the "mode" argument onto the stack
+        ldy     #6              ; Size of arguments in bytes
         jsr     _open           ; Will cleanup the stack
 
 ; Check the result of the open() call