1
0
mirror of https://github.com/cc65/cc65.git synced 2025-08-08 22:25:28 +00:00

Add the time() function

git-svn-id: svn://svn.cc65.org/cc65/trunk@1504 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2002-11-12 19:54:30 +00:00
parent f95340fc44
commit 35aaf34e20
3 changed files with 48 additions and 1 deletions

View File

@@ -6,7 +6,7 @@
/* */ /* */
/* */ /* */
/* */ /* */
/* (C) 1998-2000 Ullrich von Bassewitz */ /* (C) 1998-2002 Ullrich von Bassewitz */
/* Wacholderweg 14 */ /* Wacholderweg 14 */
/* D-70597 Stuttgart */ /* D-70597 Stuttgart */
/* EMail: uz@musoftware.de */ /* EMail: uz@musoftware.de */
@@ -82,6 +82,7 @@ unsigned _clocks_per_sec (void);
/* Function prototypes */ /* Function prototypes */
clock_t clock (void); clock_t clock (void);
time_t __fastcall__ time (time_t* t);

View File

@@ -116,6 +116,7 @@ S_OBJS = _fdesc.o \
strspn.o \ strspn.o \
strstr.o \ strstr.o \
strupper.o \ strupper.o \
time.o \
tolower.o \ tolower.o \
toupper.o \ toupper.o \
vcprintf.o \ vcprintf.o \

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

@@ -0,0 +1,45 @@
;
; Ullrich von Bassewitz, 12.11.2002
;
; time_t __fastcall__ time (time_t* t);
;
.export _time
.import __errno
.importzp ptr1, sreg
.include "errno.inc"
.code
.proc _time
sta ptr1
stx ptr1+1 ; t
ldx #$FF
stx sreg
stx sreg+1
ora ptr1+1 ; t == 0?
beq @L1
ldy #$03
txa
@L0: sta (ptr1),y ; *t = -1
dey
bpl @L0
lda #$00
@L1: sta __errno+1
lda #ENOSYS ; Function not implemented
sta __errno
txa ; A = $FF
rts
.endproc