Use a variable to control use of Time Tool.

This ensures use of the Time Tool is fully under the control of the programmer, rather than potentially being affected by other things that may load it (like the Time Zone CDev). It also avoids calls to tiStatus in the default non-Time Tool code paths, and thereby allows them to work under Golden Gate.
This commit is contained in:
Stephen Heumann 2023-01-02 18:01:28 -06:00
parent c4d485e960
commit 69765a96ef
3 changed files with 20 additions and 20 deletions

4
cc.asm
View File

@ -187,6 +187,7 @@ TAB equ 9 TAB key code
stz ~QuickExitList stz ~QuickExitList
stz ~QuickExitList+2 stz ~QuickExitList+2
case on case on
stz __useTimeTool do not use Time Tool
jsl ~InitIO reset standard I/O jsl ~InitIO reset standard I/O
case off case off
@ -363,6 +364,9 @@ start ds 2 start of the command line string
stz ~ExitList+2 stz ~ExitList+2
stz ~QuickExitList stz ~QuickExitList
stz ~QuickExitList+2 stz ~QuickExitList+2
case on
stz __useTimeTool do not use Time Tool
case off
lda #~RTL set up so exit(), etc. call ~RTL lda #~RTL set up so exit(), etc. call ~RTL
sta ~C_Quit+1 sta ~C_Quit+1

View File

@ -394,13 +394,11 @@ ad1 tay
**************************************************************** ****************************************************************
* *
~get_tz_offset private ~get_tz_offset private
pha make space for status return/TZ prefs lda >__useTimeTool if not using time tool
pha beq no_tz assume we have no TZ offset
_tiStatus check if time tool is active
bcs no_tz
lda 1,s
beq no_tz
pha make space for TZ prefs
pha
pea 1 get one record element only (TZ offset) pea 1 get one record element only (TZ offset)
tsc get time zone preference tsc get time zone preference
@ -409,9 +407,14 @@ ad1 tay
pha pha
_tiGetTimePrefs _tiGetTimePrefs
pla pla
bcs no_tz bcc have_tz
pla
pla
lda #0 assume 0 offset if TZ info not available
no_tz tax
rts
pha determine if it's daylight savings have_tz pha determine if it's daylight savings
ph2 #$5E ph2 #$5E
_ReadBParam _ReadBParam
pla pla
@ -430,12 +433,6 @@ ad1 tay
ret pla return offset value ret pla return offset value
plx plx
rts rts
no_tz pla
pla
lda #0 assume 0 offset if no TZ info available
tax
rts
end end
**************************************************************** ****************************************************************
@ -1318,14 +1315,11 @@ Y_skip inx
;%Z - time zone name or abbreviation, if available ;%Z - time zone name or abbreviation, if available
;we print the numeric offset for both, or nothing if time zone is not available ;we print the numeric offset for both, or nothing if time zone is not available
fmt_z anop fmt_z anop
fmt_Z pha check if time tool is active fmt_Z lda >__useTimeTool if not using Time Tool
_tiStatus beq z_ret write nothing
pla
bcs z_ret
beq z_ret
pea 0 push pointer to string buffer pea 0 push pointer to string buffer
tdc tdc
; clc clc
adc #numstr adc #numstr
pha pha
pha make space for TZ preferences record pha make space for TZ preferences record

View File

@ -35,6 +35,8 @@ sys_nerr entry # of error messages
_toolErr entry last error in a tool call (C) _toolErr entry last error in a tool call (C)
~TOOLERROR entry last error in a tool call (Pascal) ~TOOLERROR entry last error in a tool call (Pascal)
ds 2 ds 2
__useTimeTool entry use Time Tool in <time.h> functions?
ds 2
end end
**************************************************************** ****************************************************************