]> git.sur5r.net Git - cc65/commitdiff
Added creat()
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Thu, 12 Jun 2003 09:10:50 +0000 (09:10 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Thu, 12 Jun 2003 09:10:50 +0000 (09:10 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@2211 b7a2c559-68d2-44c3-8de9-860c34a00d81

libsrc/common/Makefile
libsrc/common/creat.s [new file with mode: 0644]

index 1de5b9a93e0f106925671c9f6739d00e8595f9c6..30db5df7ca871d4c2f196ec64f118dd26845b6fb 100644 (file)
@@ -73,6 +73,7 @@ S_OBJS =      _fdesc.o        \
                atoi.o          \
                calloc.o        \
                copydata.o      \
+                creat.o         \
                 ctime.o         \
                 divt.o          \
                errno.o         \
diff --git a/libsrc/common/creat.s b/libsrc/common/creat.s
new file mode 100644 (file)
index 0000000..a8b81f0
--- /dev/null
@@ -0,0 +1,45 @@
+;
+; Ullrich von Bassewitz, 2003-06-12
+;
+; int __fastcall__ creat (const char* name, unsigned mode);
+;
+
+        .export         _creat
+        .import         _open
+        .import         pushax
+
+        .include        "fcntl.inc"
+
+
+; The call
+;
+;       creat (name, mode);
+;
+; is equivalent to
+;
+;       open (name, O_CREAT | O_WRONLY | O_TRUNC, mode);
+;
+
+
+.proc   _creat
+
+        pha
+        txa
+        pha                             ; Save mode
+
+        lda     #<(O_CREAT | O_WRONLY | O_TRUNC)
+        ldx     #>(O_CREAT | O_WRONLY | O_TRUNC)
+        jsr     pushax
+
+        pla
+        tax
+        pla
+        jsr     pushax                  ; Push mode on argument stack
+
+        ldy     #6                      ; Number of argument bytes
+        jmp     _open
+
+.endproc
+
+
+