Page 1 of 1

nxtbasic : clock_set_date_time

Posted: Fri Jul 26, 2024 11:35 am
by funkheld
hallo, guten tag.

Call address: $FF4D

how can I do this in nxtbasic :
---------------------------
Function Name: clock_set_date_time

Purpose: Set the date and time
Call address: $FF4D
Communication registers: r0 r1 r2 r3
Preparatory routines: None
Error returns: None
Registers affected: .A .X .Y

Description: The routine clock_set_date_time sets the system's real-time-clock.
Register Contents
r0L year (1900-based)
r0H month (1-12)
r1L day (1-31)
r1H hours (0-23)
r2L minutes (0-59)
r2H seconds (0-59)
r3L jiffies (0-59)
r3H weekday (1-7)
--------------------------


thanks
greeting

Re: nxtbasic : clock_set_date_time

Posted: Fri Jul 26, 2024 11:39 am
by unartic
funkheld wrote: Fri Jul 26, 2024 11:35 am hallo, guten tag.

Call address: $FF4D

how can I do this in nxtbasic :
---------------------------
Function Name: clock_set_date_time

Purpose: Set the date and time
Call address: $FF4D
Communication registers: r0 r1 r2 r3
Preparatory routines: None
Error returns: None
Registers affected: .A .X .Y

Description: The routine clock_set_date_time sets the system's real-time-clock.
Register Contents
r0L year (1900-based)
r0H month (1-12)
r1L day (1-31)
r1H hours (0-23)
r2L minutes (0-59)
r2H seconds (0-59)
r3L jiffies (0-59)
r3H weekday (1-7)
--------------------------


thanks
greeting
The r-registers are just memory locations:
r0L= $02
r0H= $03
r1L= $04
etc

So you can set them with POKE

The processor registers can be set with:
LDA value
LDX value
LDY value

Then you can do:

SYS $FF4D

And then you can read result directly from the r-registers (if needed) and the processor registers with:
var = GETA
var = GETX
var = GETY

but....if you want the real-time-clock of the emulator to be set, you can run the emulator with the -rtc argument. This will copy the system clock into the emulated real time clock.

Re: nxtbasic : clock_set_date_time

Posted: Fri Jul 26, 2024 12:05 pm
by funkheld
thank you, I'm also interested in other commands.

this was just a question about how to set this roL etc.
in nxtbasic.

greetings

Re: nxtbasic : clock_set_date_time

Posted: Fri Jul 26, 2024 12:39 pm
by unartic
I understand. Than this is your answer :-)

POKE $02,$FF

Sets r0L to $FF

Re: nxtbasic : clock_set_date_time

Posted: Fri Jul 26, 2024 2:46 pm
by funkheld
hello tanks for demo.

greeting