2003-04-13 22:12:09 +00:00
|
|
|
;
|
|
|
|
; Ullrich von Bassewitz, 2003-04-13
|
|
|
|
;
|
|
|
|
; clock_t clock (void);
|
|
|
|
;
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.export _clock
|
2003-04-13 22:12:09 +00:00
|
|
|
.import negax
|
2013-05-09 11:56:54 +00:00
|
|
|
.importzp sreg
|
2003-04-13 22:12:09 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.include "atmos.inc"
|
2003-04-13 22:12:09 +00:00
|
|
|
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.proc _clock
|
2003-04-13 22:12:09 +00:00
|
|
|
|
|
|
|
; Clear the timer high 16 bits
|
|
|
|
|
|
|
|
ldy #$00
|
|
|
|
sty sreg
|
|
|
|
sty sreg+1
|
|
|
|
|
|
|
|
; Read the timer
|
|
|
|
|
|
|
|
sei ; Disable interrupts
|
|
|
|
lda TIMER3
|
|
|
|
ldx TIMER3+1
|
|
|
|
cli ; Reenable interrupts
|
|
|
|
|
|
|
|
|
|
|
|
; Since the timer is counting downwards, return the negated value
|
|
|
|
|
|
|
|
jmp negax
|
|
|
|
|
|
|
|
.endproc
|
|
|
|
|
|
|
|
|