]> git.sur5r.net Git - cc65/blob - libsrc/atari/clock.s
info about c1541 in docs, lowered highest available address to $6000 due to
[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         sei                     ; Disable interrupts
22         lda     RTCLOK          ; Read clock
23         ldx     RTCLOK+1
24         ldy     RTCLOK+2
25         plp                     ; Restore old I bit
26         sty     sreg
27         rts
28
29 .endproc
30
31
32 .proc   __clocks_per_sec
33
34         lda     #50             ; Assume PAL
35         ldx     PAL             ; use hw register, PALNTS is only supported on XL/XE ROM
36         beq     @L1
37         ldx     #0
38         lda     #60
39 @L1:    rts
40
41 .endproc
42
43