Add a function to get the proper value of CLOCKS_PER_SEC.
This may be either 50 or 60, depending on the system's video frequency setting (50Hz PAL or 60Hz NTSC). The video setting can be determined by inspecting bit 4 of the LANGSEL soft switch, documented in Appendix E of the Apple IIGS Firmware Reference.
This commit is contained in:
parent
79201198a1
commit
690ee7137f
24
time.asm
24
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
|
lastDST dc i2'-1' tm_isdst value for lasttime
|
||||||
end
|
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)
|
* char *asctime(struct tm *ts)
|
||||||
|
|
40
time.macros
40
time.macros
|
@ -560,3 +560,43 @@
|
||||||
&lab ldx #$0C03
|
&lab ldx #$0C03
|
||||||
jsl $E10000
|
jsl $E10000
|
||||||
MEND
|
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
|
||||||
|
|
Loading…
Reference in New Issue