]> git.sur5r.net Git - cc65/blob - libsrc/atari/clock.s
f4bda8469e8255495a48b2a0aa3e7ee113fc4a6a
[cc65] / libsrc / atari / clock.s
1 ;
2 ; Ullrich von Bassewitz, 25.07.2000
3 ;
4 ; Implemented using information from Sidney Cadot <sidney@janis.pds.twi.tudelft.nl
5 ;
6 ; clock_t clock (void);
7 ; unsigned _clocks_per_sec (void);
8 ;
9
10         .export         _clock, __clocks_per_sec
11         .importzp       sreg
12
13         .include        "atari.inc"
14
15
16 .proc   _clock
17
18         lda     #0              ; Byte 3 is always zero
19         sta     sreg+1
20         php                     ; Save current I flag value
21         cli                     ; Disable interrupts
22         lda     RTCLOK          ; Read clock
23         ldx     RTCLOK+1
24         ldy     RTCLOK+2
25         plp                     ; Restore old I bit
26         rts
27
28 .endproc
29
30
31 .proc   __clocks_per_sec
32
33         lda     #50             ; Assume PAL
34         ldx     PAL
35         beq     @L1
36         ldx     #0
37         lda     #60
38 @L1:    rts
39
40 .endproc
41
42