1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-09 06:29:38 +00:00

Added creat()

git-svn-id: svn://svn.cc65.org/cc65/trunk@2211 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2003-06-12 09:10:50 +00:00
parent 737bf33c38
commit 7c29033b58
2 changed files with 46 additions and 0 deletions

View File

@ -73,6 +73,7 @@ S_OBJS = _fdesc.o \
atoi.o \
calloc.o \
copydata.o \
creat.o \
ctime.o \
divt.o \
errno.o \

45
libsrc/common/creat.s Normal file
View File

@ -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