This forum is dedicated to those who wish to suggest new features.
Questo forum è dedicato a chi desidera suggerire nuove feature.
Ce forum est dédié à ceux qui souhaitent suggérer de nouvelles fonctionnalités.
With ugBasic you can measure time with TIMER instruction, that gives the the time spend since your computer boot up. The time unit is 1/50 second which is quite precise, but the Amstrad CPC is able to do better !
BITMAP ENABLE(320,200,4)
CLS
DECLARE SYSTEM PROC scnkey AT $BB06 ON CPC
DECLARE SYSTEM PROC myTime AT $BD0D ON CPC
DIM de AS WORD
DIM hl AS WORD
PRINT "Attendez un peu, et appuyez sur une touche "
CALL scnkey
ON CPUZ80 BEGIN ASM
CALL $BD0D
LD (_de),DE
LD (_hl),HL
END ASM
DIM time AS FLOAT
time = (de*256.0 + hl)/300.0
PRINT time ; "secondes"
Hi ldir_hector, wow, that's a very creative way to leverage ugBASIC and measure time!
ldir_hector wrote: ↑Sun Nov 19, 2023 1:05 pm
The time unit is 1/50 second which is quite precise, but the Amstrad CPC is able to do better !
It almost makes me want to add a "raw" timer, i.e. the possibility of actually reading the real timer of the hardware instead of the PAL/NTSC normalized one. I don't know whether to call it REAL TIMER or RAW TIMER, what do you think?
Ok, I see that this system call fetches a full 32 bits, and there is no way to declare a system procedure that can pass this value through more than one register, and return a value of 32 bits on more than one register. It's time to add it.
I think that REAL TIMER is confusing, as many would consider that there is a real time clock with the hour stored when the computer stops.
So Raw Timer is better, but I don't know if there is a more precise timer on every computer you support ?
Even worse, from what I understood, the Oric Atmos has no way to synchronize with the VSync ! There is an electronic soldering to do, to be able to do so but it's not standard !