diff --git a/time.asm b/time.asm index 4af8d83..b2b0a8b 100644 --- a/time.asm +++ b/time.asm @@ -46,6 +46,30 @@ lasttime ds 4 last time_t value returned by time() lastDST dc i2'-1' tm_isdst value for lasttime end +**************************************************************** +* +* clock_t __clocks_per_sec() +* +* Outputs: +* X-A - the number of clock ticks per second (50 or 60) +* +**************************************************************** +* +__clocks_per_sec start +LANGSEL equ $E1C02B LANGSEL soft switch + + short I,M + ldy #60 + ldx #0 + lda >LANGSEL + and #$10 test NTSC/PAL bit of LANGSEL + beq lb1 + ldy #50 +lb1 long I,M + tya + rtl + end + **************************************************************** * * char *asctime(struct tm *ts) diff --git a/time.macros b/time.macros index 01fb94f..c50a85f 100644 --- a/time.macros +++ b/time.macros @@ -560,3 +560,43 @@ &lab ldx #$0C03 jsl $E10000 MEND + macro +&l long &a,&b + lclb &i + lclb &m +&a amid &a,1,1 +&m setb ("&a"="M").or.("&a"="m") +&i setb ("&a"="I").or.("&a"="i") + aif c:&b=0,.a +&b amid &b,1,1 +&m setb ("&b"="M").or.("&b"="m").or.&m +&i setb ("&b"="I").or.("&b"="i").or.&i +.a +&l rep #&m*32+&i*16 + aif .not.&m,.b + longa on +.b + aif .not.&i,.c + longi on +.c + mend + macro +&l short &a,&b + lclb &i + lclb &m +&a amid &a,1,1 +&m setb ("&a"="M").or.("&a"="m") +&i setb ("&a"="I").or.("&a"="i") + aif c:&b=0,.a +&b amid &b,1,1 +&m setb ("&b"="M").or.("&b"="m").or.&m +&i setb ("&b"="I").or.("&b"="i").or.&i +.a +&l sep #&m*32+&i*16 + aif .not.&m,.b + longa off +.b + aif .not.&i,.c + longi off +.c + mend