]> git.sur5r.net Git - cc65/blob - libsrc/atari5200/clock.s
atari5200: conio now uses just four colors altogether
[cc65] / libsrc / atari5200 / clock.s
1 ;
2 ; from Atari computer version by Christian Groessler, 2014
3 ;
4 ; clock_t clock (void);
5 ; unsigned _clocks_per_sec (void);
6 ;
7
8         .export         _clock
9         .importzp       sreg
10
11         .include        "atari5200.inc"
12
13
14 .proc   _clock
15
16         ldx     #5              ; Synchronize with Antic, so the interrupt won't change RTCLOK
17         stx     WSYNC           ; while we're reading it. The synchronization is done same as
18 @L1:    dex                     ; in SETVBLV function in Atari OS.
19         bne     @L1
20         stx     sreg+1          ; Byte 3 is always zero
21         stx     sreg            ; Byte 2 is always zero, too
22         lda     RTCLOK+1
23         ldx     RTCLOK
24         rts
25
26 .endproc