-
-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Date and Time not being updated #113
Comments
@luisvolkyazul
|
Ok thank you for sharing this with me
…On Tue, Nov 7, 2023 at 7:08 PM Tony DeFusco ***@***.***> wrote:
@luisvolkyazul <https://github.com/luisvolkyazul>
Here is some RTC TIME-related BBC Basic code which you may find useful
(taken from my "Agon Death House
<https://github.com/tonedef71/agon-death-house>" project -- with line
numbers removed):
:
MAXINT% = &3B9AC9FF
:
REM ::::::::::::::::::::::::::::::::
REM :: Prepend Zeroes To A Number ::
REM ::::::::::::::::::::::::::::::::
DEF FN_PAD_NUMBER(val%, len%)
LOCAL s$
s$ = STR$(val%)
:= STRING$(len% - LEN(s$), "0") + s$
:
REM ::::::::::::::::::::::::::::::::::::
REM :: Set the time of the simple RTC ::
REM :: in ticks (100 ticks / second) ::
REM ::::::::::::::::::::::::::::::::::::
DEF FN_SET_TIME(hours%, minutes%, seconds%)
TIME = (hours% * 360000 + minutes% * 6000 + seconds% * 100) MOD MAXINT%
:= TIME
:
REM :::::::::::::::::::::::::::::
REM :: Format time as a String ::
REM :::::::::::::::::::::::::::::
REM addColons% may be TRUE or FALSE
DEF FN_FORMAT_TIME(addColons%)
LOCAL hours%, minutes%, seconds%, time%, r$
r$ = "":time% = TIME
hours% = time% DIV 360000
minutes% = (time% - hours% * 360000) DIV 6000
seconds% = (time% - hours% * 360000 - minutes% * 6000) DIV 100
r$ = FN_PAD_NUMBER(hours%, 2):IF addColons% THEN r$ = r$ + ":"
r$ = r$ + FN_PAD_NUMBER(minutes%, 2)
IF addColons% THEN r$ = r$ + ":"
r$ = r$ + FN_PAD_NUMBER(seconds%, 2)
:= r$
:
REM :::::::::::::::::::::::::::::::::::::::
REM :: Pause execution of the program ::
REM :: for a number of ticks (1/100) sec ::
REM :::::::::::::::::::::::::::::::::::::::
DEF PROC_SLEEP(hundredth_seconds%)
LOCAL t
hundredth_seconds% = hundredth_seconds% + (hundredth_seconds% < 0) * -hundredth_seconds%
t = TIME
REPEAT UNTIL ((TIME - t) > hundredth_seconds%)
ENDPROC
—
Reply to this email directly, view it on GitHub
<#113 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A4D2SM64EJRGMDFLWZ2PXCLYDK5ORAVCNFSM6AAAAAA7B5KPZOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMBQGM2DKMJVG4>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
this line won't work:
reason being is that whatever is after the to do what you're after you need to construct a string, and pass that to the OSCLI command. this therefore should become:
|
Ok, thanks for the clarification.
…On Sat, Nov 11, 2023 at 11:48 AM Steve Sims ***@***.***> wrote:
this line won't work:
90 *TIME STR$(year) STR$(month) STR$(day) STR$(hour) STR$(minutes) STR$(seconds)
reason being is that whatever is after the * is just passed thru to MOS
as a star command to be interpreted. the STR$(year) etc won't get
evaluated but instead gets passed as-is.
to do what you're after you need to construct a string, and pass that to
the OSCLI command.
this therefore should become:
90 OSCLI("TIME " + STR$(year) + " " + STR$(month) + " " + STR$(day) + " " + STR$(hour) + " " + STR$(minutes) + " " + STR$(seconds))
—
Reply to this email directly, view it on GitHub
<#113 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A4D2SMZ5BMCQPBADATMA7Q3YD6M3JAVCNFSM6AAAAAA7B5KPZOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMBWHA2DSMBUGE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@luisvolkyazul let me know if that answers your question and if it does I'l close this card. |
Not able to get it working yet. |
I was trying to use TIME within BBS BASIC and within the MOS itself to update it every time I power on the unit, however the values did not reflect what was entered. Not sure if it is user error.
I am using MOS 2.0.0
VDP 2.0.1
This is the code I tried:
30 INPUT “Year:”year
40 INPUT “Month:”month
50 INPUT “Day:”day
60 INPUT “Hour:”hour
70 INPUT “Minutes:”minutes
80 INPUT “Seconds:”seconds
90 *TIME STR$(year) STR$(month) STR$(day) STR$(hour) STR$(minutes) STR$(seconds)
95 *TIME
The text was updated successfully, but these errors were encountered: