1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-17 00:29:31 +00:00
cc65/libsrc/pce/clock.s
2018-08-30 11:48:46 +02:00

34 lines
622 B
ArmAsm

;
; clock_t clock (void);
;
.export _clock
.constructor initclock
.forceimport ticktock ; make sure that tickcount changes
.importzp sreg
.include "extzp.inc"
.proc _clock
lda tickcount+3
sta sreg+1
lda tickcount+2
sta sreg
ldx tickcount+1
lda tickcount
rts
.endproc
; Make the process clock start at zero.
.segment "ONCE"
initclock:
lda #0
ldx #3
@lp: sta tickcount,x
dex
bpl @lp
rts