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);
|
|
|
|
; unsigned _clocks_per_sec (void);
|
|
|
|
;
|
|
|
|
|
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
|
|
|
|
2010-06-04 10:15:44 +00:00
|
|
|
ldx #$00 ; Clear high byte of return value
|
2013-05-09 11:56:54 +00:00
|
|
|
lda PAL ; use hw register, PALNTS is only supported on XL/XE ROM
|
|
|
|
and #$0e
|
|
|
|
bne @NTSC
|
|
|
|
lda #50
|
|
|
|
rts
|
|
|
|
@NTSC: lda #60
|
|
|
|
rts
|
2000-07-25 20:06:34 +00:00
|
|
|
|
|
|
|
.endproc
|