2014-11-29 13:18:48 +00:00
|
|
|
;
|
|
|
|
; clock_t clock (void);
|
|
|
|
;
|
|
|
|
|
2015-08-29 13:58:57 +00:00
|
|
|
.include "pce.inc"
|
2015-09-19 13:37:39 +00:00
|
|
|
.include "extzp.inc"
|
2014-11-30 10:20:57 +00:00
|
|
|
|
2015-08-29 13:58:57 +00:00
|
|
|
.export _clock
|
|
|
|
.importzp sreg
|
2014-11-29 13:18:48 +00:00
|
|
|
|
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
|
2014-11-29 13:18:48 +00:00
|
|
|
|
|
|
|
.endproc
|
2015-07-16 14:54:40 +00:00
|
|
|
|
2015-08-29 13:58:57 +00:00
|
|
|
.constructor initclock, 24
|
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
|