]> git.sur5r.net Git - cc65/commitdiff
Add the time() function
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Tue, 12 Nov 2002 19:54:30 +0000 (19:54 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Tue, 12 Nov 2002 19:54:30 +0000 (19:54 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@1504 b7a2c559-68d2-44c3-8de9-860c34a00d81

include/time.h
libsrc/common/Makefile
libsrc/common/time.s [new file with mode: 0644]

index bd8c22b8eaf18a41a6b0de68286e486b90e7781f..0c6040dcf8bf743e6a94230e4932ddd696c2d827 100644 (file)
@@ -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);
 
 
 
index 2dd8096e3a2fe63f3163de5abac27daf05312aee..6df96901de10e18c4813d1a007ddaf12d9183ab5 100644 (file)
@@ -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 (file)
index 0000000..2ee3c04
--- /dev/null
@@ -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
+
+