Giter Club home page Giter Club logo

Comments (8)

luisvolkyazul avatar luisvolkyazul commented on September 18, 2024 1

from agon-mos.

tonedef71 avatar tonedef71 commented on September 18, 2024

@luisvolkyazul
Here is some RTC TIME-related BBC Basic code which you may find useful (taken from my "Agon Death House" project -- with line numbers removed):

:
MAXINT% = &3B9AC9FF
:
TIME = FN_SET_TIME(10, 30, 0)
PRINT FN_FORMAT_TIME(TRUE)
END

...

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%)
:= (hours% * 360000 + minutes% * 6000 + seconds% * 100) MOD MAXINT%
:
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

from agon-mos.

stevesims avatar stevesims commented on September 18, 2024

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))

from agon-mos.

luisvolkyazul avatar luisvolkyazul commented on September 18, 2024

from agon-mos.

luisvolkyazul avatar luisvolkyazul commented on September 18, 2024

Ok tried the change and think I understand the logic behind it...however I'm getting the following: No such variable at line 90
image

from agon-mos.

tonedef71 avatar tonedef71 commented on September 18, 2024

Ok tried the change and think I understand the logic behind it...however I'm getting the following: No such variable at line 90 image

In line 90, I see that you have SRT$ a couple of times in place of STR$.

from agon-mos.

breakintoprogram avatar breakintoprogram commented on September 18, 2024

@luisvolkyazul let me know if that answers your question and if it does I'l close this card.

from agon-mos.

luisvolkyazul avatar luisvolkyazul commented on September 18, 2024

Not able to get it working yet.

from agon-mos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.