2003-05-02 13:40:01 +00:00
|
|
|
;
|
2003-05-05 08:20:07 +00:00
|
|
|
; clock.s
|
|
|
|
;
|
2003-05-02 13:40:01 +00:00
|
|
|
; Written by Groepaz/Hitmen <groepaz@gmx.net>
|
|
|
|
; Cleanup by Ullrich von Bassewitz <uz@cc65.org>
|
2003-05-05 08:20:07 +00:00
|
|
|
; 2003-05-02, Greg King <gngking@erols.com>
|
|
|
|
;
|
|
|
|
; #include <time.h>
|
2003-05-02 13:40:01 +00:00
|
|
|
;
|
|
|
|
; clock_t clock (void);
|
|
|
|
;
|
|
|
|
|
|
|
|
.include "nes.inc"
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.export _clock
|
|
|
|
.importzp sreg
|
2003-05-02 13:40:01 +00:00
|
|
|
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.proc _clock
|
2003-05-02 13:40:01 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
ldy #0 ; High word is always zero
|
|
|
|
sty sreg+1
|
|
|
|
sty sreg
|
2003-05-05 08:20:07 +00:00
|
|
|
L1: ldx tickcount+1
|
2003-05-02 13:40:01 +00:00
|
|
|
lda tickcount
|
2003-05-05 08:20:07 +00:00
|
|
|
cpx tickcount+1 ; Did tickcount change?
|
|
|
|
bne L1 ; Yes, re-read it
|
2013-05-09 11:56:54 +00:00
|
|
|
rts
|
2003-05-02 13:40:01 +00:00
|
|
|
|
|
|
|
.endproc
|
|
|
|
|