1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-07 23:29:39 +00:00

Use MACHID to check for realtime clock.

There's no need to do guesswork to know if a realtime clock is present/active.
This commit is contained in:
Oliver Schmidt 2019-09-10 09:49:06 +02:00
parent c53b167307
commit 3b128ba59f
4 changed files with 22 additions and 26 deletions

View File

@ -500,16 +500,14 @@ From that perspective it makes most sense to not set both the date and the time
rather only set the date and have the time just stay zero. Then files show up in a
directory as <tt/DD-MON-YY 0:00/.
So <tt/clock_settime()/ checks if the current time equals 0:00. If it does <bf/NOT/
then a realtime clock is supposed to be active and <tt/clock_settime()/ fails with
<tt/ERANGE/. Otherwise <tt/clock_settime()/ sets the date - and completely ignores
the time provided as parameter.
So <tt/clock_settime()/ checks if a realtime clock is active. If it is then
<tt/clock_settime()/ fails with <tt/ERANGE/. Otherwise <tt/clock_settime()/
sets the date - and completely ignores the time provided as parameter.
<tt/clock_getres()/ too checks if the current time equals 0:00. If it does <bf/NOT/
then a realtime clock is supposed to be active and <tt/clock_getres()/ returns a time
resolution of one minute. Otherwise <tt/clock_getres()/ presumes that the only one
who sets the RAM location is <tt/clock_settime()/ and therefore returns a time
resolution of one day.
<tt/clock_getres()/ too checks if a realtime clock is active. If it is then
<tt/clock_getres()/ returns a time resolution of one minute. Otherwise
<tt/clock_getres()/ presumes that the only one who sets the RAM location is
<tt/clock_settime()/ and therefore returns a time resolution of one day.

View File

@ -501,16 +501,14 @@ From that perspective it makes most sense to not set both the date and the time
rather only set the date and have the time just stay zero. Then files show up in a
directory as <tt/DD-MON-YY 0:00/.
So <tt/clock_settime()/ checks if the current time equals 0:00. If it does <bf/NOT/
then a realtime clock is supposed to be active and <tt/clock_settime()/ fails with
<tt/ERANGE/. Otherwise <tt/clock_settime()/ sets the date - and completely ignores
the time provided as parameter.
So <tt/clock_settime()/ checks if a realtime clock is active. If it is then
<tt/clock_settime()/ fails with <tt/ERANGE/. Otherwise <tt/clock_settime()/
sets the date - and completely ignores the time provided as parameter.
<tt/clock_getres()/ too checks if the current time equals 0:00. If it does <bf/NOT/
then a realtime clock is supposed to be active and <tt/clock_getres()/ returns a time
resolution of one minute. Otherwise <tt/clock_getres()/ presumes that the only one
who sets the RAM location is <tt/clock_settime()/ and therefore returns a time
resolution of one day.
<tt/clock_getres()/ too checks if a realtime clock is active. If it is then
<tt/clock_getres()/ returns a time resolution of one minute. Otherwise
<tt/clock_getres()/ presumes that the only one who sets the RAM location is
<tt/clock_settime()/ and therefore returns a time resolution of one day.

View File

@ -27,10 +27,10 @@ _clock_getres:
ldx #<day_res
ldy #>day_res
; Check for existing minutes or hours
lda TIMELO
ora TIMELO+1
beq :+
; Check for realtme clock
lda MACHID
lsr a
bcc :+
; Switch to minute resolution
ldx #<min_res

View File

@ -21,11 +21,11 @@ _clock_settime:
ldy __dos_type
beq enosys
; Check for existing minutes or hours
; Check for realtme clock
tay ; Save A
lda TIMELO
ora TIMELO+1
bne erange
lda MACHID
lsr a
bcs erange
tya ; Restore A
; Get tm