From 35aaf34e2039db88654561d39cf2f08b3c80b866 Mon Sep 17 00:00:00 2001 From: cuz Date: Tue, 12 Nov 2002 19:54:30 +0000 Subject: [PATCH] Add the time() function git-svn-id: svn://svn.cc65.org/cc65/trunk@1504 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- include/time.h | 3 ++- libsrc/common/Makefile | 1 + libsrc/common/time.s | 45 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 libsrc/common/time.s diff --git a/include/time.h b/include/time.h index bd8c22b8e..0c6040dcf 100644 --- a/include/time.h +++ b/include/time.h @@ -6,7 +6,7 @@ /* */ /* */ /* */ -/* (C) 1998-2000 Ullrich von Bassewitz */ +/* (C) 1998-2002 Ullrich von Bassewitz */ /* Wacholderweg 14 */ /* D-70597 Stuttgart */ /* EMail: uz@musoftware.de */ @@ -82,6 +82,7 @@ unsigned _clocks_per_sec (void); /* Function prototypes */ clock_t clock (void); +time_t __fastcall__ time (time_t* t); diff --git a/libsrc/common/Makefile b/libsrc/common/Makefile index 2dd8096e3..6df96901d 100644 --- a/libsrc/common/Makefile +++ b/libsrc/common/Makefile @@ -116,6 +116,7 @@ S_OBJS = _fdesc.o \ strspn.o \ strstr.o \ strupper.o \ + time.o \ tolower.o \ toupper.o \ vcprintf.o \ diff --git a/libsrc/common/time.s b/libsrc/common/time.s new file mode 100644 index 000000000..2ee3c04d2 --- /dev/null +++ b/libsrc/common/time.s @@ -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 + +