]> git.sur5r.net Git - cc65/blob - libsrc/cbm/getres.s
d216a1b6a2b1202613f1bc103ee1bd133a775773
[cc65] / libsrc / cbm / getres.s
1 ;
2 ; Oliver Schmidt, 15.8.2018
3 ;
4 ; int clock_getres (clockid_t clk_id, struct timespec *res);
5 ;
6
7         .include        "time.inc"
8
9         .importzp       ptr1
10         .import         incsp1, return0
11
12
13 ;----------------------------------------------------------------------------
14 .code
15
16 .proc   _clock_getres
17
18         sta     ptr1
19         stx     ptr1+1
20
21         ldy     #.sizeof(timespec)-1
22 @L1:    lda     time,y
23         sta     (ptr1),y
24         dey
25         bpl     @L1
26
27         jsr     incsp1
28         jmp     return0
29
30 .endproc
31
32 ;----------------------------------------------------------------------------
33 ; timespec struct with tv_nsec set to 1/10 second
34 .rodata
35
36 time:   .dword  0
37         .dword  100 * 1000 * 1000