FujiNet is a fantastic new device for the Atari 8 bit line of computers which provides WiFi, and SD card storage among other things, all over SIO. One of the functions provided is APETIME support, a protocol developed by AtariMax as part of their Atari Peripheral Emulator (APE).
In the last post I demonstrated my BASIC version of a program to get the time from the FujiNet device using APETIME. The procedure is documented here (https://github.com/FujiNetWIFI/fujinet-platformio/wiki/Accessing-the-Real-Time-Clock). At the time of this writing there was no Action! example.
After completing the BASIC version, I moved to creating an Action! version. This post details my solution. I wrote the routine into a procedure which can be called from the main program at any point. It only requires passing a pointer to a 6 byte array.
After failing to get success using the described 5 byte assembly procedure on the FujiNet wiki by using an inline assembly code block, I instead created a procedure with the name SIOV and setting its address to the OS SIO vector address.
The routine that gets the time from FujiNet is the FNGTime() procedure (FujiNet Get Time). It first sets the DCB variables with their addresses set to the DCB (Device Control Block) memory location. This is convenient for assigning (poking) values into those locations, with no need for the Poke function.
Next it sets up the SIO call by assigning the appropriate values into the DCB. It sets the buffer location (DBUF), to the address of the byte array passed in.
Last it calls the SIO vector using the SIOV procedure.
The main routine sets aside 6 bytes of storage, calls the FNGTime() routine with the address of the storage array, then prints the result in a friendly fashion.
; Prog..: FNTIME.ACT ; Author: Wade Ripkowski ; Date..: 2021.02.01 ; Desc..: Gets date/time from FujiNet MODULE ; ----------------------------------- ; Proc..: SIOV() ; Desc..: OS SIO Vector ; ----------------------------------- PROC SIOV=$E459() ; ----------------------------------- ; Proc..: FNGTime(BYTE ARRAY bA) ; Desc..: Get date/time from FujiNet ; via APETIME protocol ; Return: 6 bytes DMYHMS into bA ; ----------------------------------- PROC FNGTime(BYTE POINTER bA) ; Set DCB variable pointers BYTE DDEVIC=$300, DUNIT=$301, DCOMND=$302, DSTATS=$303, DTIMLO=$306 CARD DBUF=$304, DBYT=$308 ; Setup SIO call using byte array address ; by putting values into the DCB. ; APETime=Device 69 ($45), Unit 1 ; Time command=147 ($93) ; Get 6 bytes, timeout just over 15s DDEVIC=69 DUNIT=1 DCOMND=147 DSTATS=64 DTIMLO=15 DBUF=bA DBYT=6 ; Call SIO SIOV() RETURN ; ----------------------------------- ; Main Routine ; ----------------------------------- PROC Main() ; Storage for 6 bytes preset to 0 BYTE ARRAY bDT(6)=[0 0 0 0 0 0] ; Call time routine with the storage array FNGTime(bDT) ; What time is it? PrintF("Date: 20%B.%B.%B%E",bDT(2),bDT(1),bDT(0)) PrintF("Time: %B:%B:%B%E",bDT(3),bDT(4),bDT(5)) RETURN
I’m going to include the FNGTime() function in my Action! library which was developed in 2016 and released in early 2017 right here on this blog (search posts with Action! tag), and is now at version 1.5 and will be re-released soon as an update.
Awesome! And yeah, “PROC SIOV=$E459()” seems to be best/easiest the way to do stuff like this in Action!