1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-08 15:29:37 +00:00
cc65/libsrc/pce/clock.s

34 lines
622 B
ArmAsm
Raw Normal View History

;
; clock_t clock (void);
;
2015-08-29 13:58:57 +00:00
.export _clock
2015-11-17 14:14:15 +00:00
.constructor initclock
2015-10-02 14:50:22 +00:00
2015-11-17 14:14:15 +00:00
.forceimport ticktock ; make sure that tickcount changes
2015-08-29 13:58:57 +00:00
.importzp sreg
2015-10-02 14:50:22 +00:00
.include "extzp.inc"
2015-07-12 12:27:24 +00:00
.proc _clock
2015-08-29 13:58:57 +00:00
lda tickcount+3
sta sreg+1
lda tickcount+2
sta sreg
ldx tickcount+1
lda tickcount
rts
.endproc
2015-07-16 14:54:40 +00:00
2015-11-17 14:14:15 +00:00
; Make the process clock start at zero.
.segment "ONCE"
2015-07-16 14:54:40 +00:00
initclock:
2015-08-29 13:58:57 +00:00
lda #0
ldx #3
@lp: sta tickcount,x
dex
bpl @lp
rts