2014-11-29 14:18:48 +01:00
|
|
|
;
|
|
|
|
; clock_t clock (void);
|
|
|
|
;
|
|
|
|
|
2015-08-29 15:58:57 +02:00
|
|
|
.include "pce.inc"
|
2015-09-19 15:37:39 +02:00
|
|
|
.include "extzp.inc"
|
2014-11-30 11:20:57 +01:00
|
|
|
|
2015-08-29 15:58:57 +02:00
|
|
|
.export _clock
|
2015-10-09 21:44:20 +02:00
|
|
|
.forceimport ticktock
|
2015-08-29 15:58:57 +02:00
|
|
|
.importzp sreg
|
2015-10-09 21:44:20 +02:00
|
|
|
.constructor initclock
|
|
|
|
|
2014-11-29 14:18:48 +01:00
|
|
|
|
2015-07-12 14:27:24 +02:00
|
|
|
.proc _clock
|
|
|
|
|
2015-08-29 15:58:57 +02:00
|
|
|
lda tickcount+3
|
|
|
|
sta sreg+1
|
|
|
|
lda tickcount+2
|
|
|
|
sta sreg
|
|
|
|
ldx tickcount+1
|
|
|
|
lda tickcount
|
|
|
|
rts
|
2014-11-29 14:18:48 +01:00
|
|
|
|
|
|
|
.endproc
|
2015-07-16 16:54:40 +02:00
|
|
|
|
2016-03-06 21:26:22 +01:00
|
|
|
.segment "ONCE"
|
2015-07-16 16:54:40 +02:00
|
|
|
initclock:
|
2015-08-29 15:58:57 +02:00
|
|
|
lda #0
|
|
|
|
ldx #3
|
|
|
|
@lp: sta tickcount,x
|
|
|
|
dex
|
|
|
|
bpl @lp
|
|
|
|
rts
|