nxtbasic : clock_set_date_time

All aspects of programming on the Commander X16.
Post Reply
funkheld
Posts: 322
Joined: Mon Feb 26, 2024 11:11 am

nxtbasic : clock_set_date_time

Post 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
unartic
Posts: 145
Joined: Sat Oct 28, 2023 3:26 pm

Re: nxtbasic : clock_set_date_time

Post 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.
funkheld
Posts: 322
Joined: Mon Feb 26, 2024 11:11 am

Re: nxtbasic : clock_set_date_time

Post 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
unartic
Posts: 145
Joined: Sat Oct 28, 2023 3:26 pm

Re: nxtbasic : clock_set_date_time

Post by unartic »

I understand. Than this is your answer :-)

POKE $02,$FF

Sets r0L to $FF
funkheld
Posts: 322
Joined: Mon Feb 26, 2024 11:11 am

Re: nxtbasic : clock_set_date_time

Post by funkheld »

hello tanks for demo.

greeting
Post Reply