I'm trying to compile a C program with z88dk for the ZX Spectrum. Using printf()
, when the text hits the bottom line of the screen on line 24 the program stops executing until a key is pressed on the keyboard - but I need printf()
to not lock up waiting for a key to be pressed.
The github page for z88dk states: "The screen scrolls when line 24 is "hit", the routine used is in the 48k ROM." Is this what I need to disable? Is this scroll routine being fired, and is this what waits for user input before continuing?
In BASIC, the "scroll?" message can be disabled with POKE 23692,n
and printing behaves normally. I have tried to call zx_bpoke(23692, 255);
to try to disable the wait in C but this has no effect. How can I scroll without waiting for a keypress?
Is 23692
the right address to poke for the 48K ROM to disable the scroll key press routine?
An example:
#include <stdio.h>
#include <stdlib.h>
#include <z80.h>
int main() {
for (int i = 0; i < 500; i++){
printf("%d\n", i); //<-- will pause here until key is pressed when bottom of the screen is hit
//attempt to disable this in the scroll routine
z80_bpoke(23692, 255); //<-- doesn't work?
}
}
I compile with the command:
zcc +zx -vn -startup=1 -clib=new -create-app main.c -o out
After line 23, the Spectrum waits for a key to be pressed, even when POKING at address 23692. Any help would be appreciated!