in my experience with z88dk/sccz80, I successfully used FRAMES (23672) system variable for timing management in my Spectrum apps.
Now I am trying z88dk with sdcc and it seems to me that every access to FRAMES system variable always gets the same value.

As a comparison, I prepared 2 versions of a test program and ran them in fuse and zesarux emulators.
The sccz80 version:
Code: Select all
// zcc +zx -lndos frames_sccz80.c -o frames_sccz80 -create-app
#include <stdio.h>
extern unsigned int frames(23672);
void main()
{
unsigned int j = 0;
unsigned char i = 0;
for (i=0; i<10; i++)
{
printf("%u\n", frames);
for (j=0; j<1000; j++);
}
}
In the sdcc version:
Code: Select all
// zcc +zx -startup=1 -clib=sdcc_iy frames_sdcc.c -o frames_sdcc -create-app
#include <stdio.h>
#include <cpu.h>
void main()
{
unsigned int j = 0;
unsigned char i = 0;
unsigned int* frames = 23672;
for (i=0; i<10; i++)
{
printf("%u %u \n", cpu_wpeek(23672), *frames);
for (j=0; j<10000; j++);
}
}
I am using a recent z88dk nightly build on windows.
Which is the correct way of accessing the FRAMES counter with sdcc?
Are there better ways for timing management rather than FRAMES?
Thanks to all z88dk developers for excellent work!
marco