2 ; Stefan Haubenthal, 27.7.2009
3 ; Oliver Schmidt, 14.8.2018
5 ; int clock_gettime (clockid_t clk_id, struct timespec *tp);
13 .importzp sreg, tmp1, tmp2
14 .import pushax, pusheax, tosmul0ax, steaxspidx, incsp1, return0
15 .import _get_tv, _get_ostype
18 ;----------------------------------------------------------------------------
46 jsr steaxspidx ; Pops address pushed by 2. pushax
48 lda #<(100 * 1000 * 1000 / $10000)
49 ldx #>(100 * 1000 * 1000 / $10000)
52 lda #<(100 * 1000 * 1000)
53 ldx #>(100 * 1000 * 1000)
59 ldy #timespec::tv_nsec
60 jsr steaxspidx ; Pops address pushed by 1. pushax
67 ;----------------------------------------------------------------------------
68 ; dec = (((BCD>>4)*10) + (BCD&0xf))
87 ;----------------------------------------------------------------------------
88 ; Constructor that writes to the 1/10 sec register of the TOD to kick it
89 ; into action. If this is not done, the clock hangs. We will read the register
90 ; and write it again, ignoring a possible change in between.
110 ;----------------------------------------------------------------------------
111 ; TM struct with date set to 1970-01-01