2000-07-25 20:06:34 +00:00
|
|
|
;
|
2001-11-05 23:52:19 +00:00
|
|
|
; Piotr Fusik, 04.11.2001
|
|
|
|
; originally by Ullrich von Bassewitz and Sidney Cadot
|
2000-07-25 20:06:34 +00:00
|
|
|
;
|
|
|
|
; clock_t clock (void);
|
2020-10-25 13:06:44 +00:00
|
|
|
; clock_t _clocks_per_sec (void);
|
2000-07-25 20:06:34 +00:00
|
|
|
;
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.export _clock, __clocks_per_sec
|
|
|
|
.importzp sreg
|
2000-07-25 20:06:34 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.include "atari.inc"
|
2000-07-25 20:06:34 +00:00
|
|
|
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.proc _clock
|
2000-07-25 20:06:34 +00:00
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
ldx #5 ; Synchronize with Antic, so the interrupt won't change RTCLOK
|
|
|
|
stx WSYNC ; while we're reading it. The synchronization is done same as
|
|
|
|
@L1: dex ; in SETVBLV function in Atari OS.
|
|
|
|
bne @L1
|
|
|
|
stx sreg+1 ; Byte 3 is always zero
|
|
|
|
lda RTCLOK+2
|
|
|
|
ldx RTCLOK+1
|
|
|
|
ldy RTCLOK
|
|
|
|
sty sreg
|
|
|
|
rts
|
2000-07-25 20:06:34 +00:00
|
|
|
|
|
|
|
.endproc
|
|
|
|
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.proc __clocks_per_sec
|
2000-07-25 20:06:34 +00:00
|
|
|
|
2020-10-25 13:06:44 +00:00
|
|
|
ldx #$00 ; Clear byte 1 of return value
|
|
|
|
stx sreg ; Clear byte 2 of return value
|
|
|
|
stx sreg+1 ; Clear byte 3 of return value
|
|
|
|
lda PAL ; Use hw register, PALNTS is only supported on XL/XE ROM
|
2013-05-09 11:56:54 +00:00
|
|
|
and #$0e
|
|
|
|
bne @NTSC
|
|
|
|
lda #50
|
|
|
|
rts
|
|
|
|
@NTSC: lda #60
|
|
|
|
rts
|
2000-07-25 20:06:34 +00:00
|
|
|
|
|
|
|
.endproc
|