ZX80: ersatz PAUSE and PRINT AT?
Posted: Mon Dec 06, 2021 2:29 pm
I am being somewhat thwarted by the ZX80's extreme simplicity again.
My overall question is: "is there any way to keep a picture on screen for a specific length of time on the ZX80?"
I had some thoughts, knowing that FOR N=1 TO 1000: NEXT N would just blank the screen. I looked for the ZX80's equivalent of FRAMES in the system variables, POKE both bytes to 0, then wait for the value to increase to a certain point - but not only does that blank the screen, it also never gets raised above 0 so this is a loop that will only end with BREAK.
I also tried repeated PRINT CHR$(116), i.e. HOME, which I thought would reset the equivalent of the PRINT AT position to 0,0 - but it affects the program cursor instead. Even so, would it work? No. It printed a question mark. The same happened with CHR$(112), the cursor-up character. So we can't control the PRINT AT position that way, Commodore-style.
While fiddling around with the potential for a PRINT AT on the ZX80, I thought I'd POKE the system variables 16420 and 16421, even though the manual says not to (they're marked with an X for "DO NOT POKE"). POKE 16420,33 and POKE 16421,23 should, as I understood it, return the PRINT AT position to 0,0 - but the POKEs have no effect on the PRINT position - all it did is made the error report invisible.
This thread from 2014 implies "PAUSE is impossible, and also, it is possible". It will take the ZX80 *some time* to keep doing loops, and all I have to do is work out how many times it needs to loop. But there's still that problem of the screen shutting off while it happens. The thread also mentions making input requests to the keyboard...
So my thoughts turned to machine code. Is there a way of printing non-printable characters to the screen - is there even a non-printable character that would not appear as a question mark - that could be deposited on screen with RST 16 (or POKE directly to the screen), and controlled by a BC loop, which in turn might be inside another BC loop? Is there a way of shifting the PRINT AT position from a ROM call that I'm unaware of? And is any of this going to be possible without the screen blanking, without digging very deep into the "flicker-free graphics" that are way, way beyond my understanding?
The only way I can find to PRINT AT is to POKE directly to the display file, but it seems to change depending on what else I've done. So, for instance:
10 PRINT "BOB"
20 LET X=PEEK(16396)+256*PEEK(16397)
30 POKE X+6,41
...this changes BOB to BOD, requiring an adjustment of 6 to the PEEKed D_FILE to PRINT AT 0,2;"D". However, if we try to POKE directly without a variable...
10 PRINT "BOB"
20 POKE 3+PEEK(16396)+256*PEEK(16397),41
...this has the same effect; only an adjustment of 3 is needed.
It's the same result with 1K, 4K or 16K - unlike the ZX81.
Any bright ideas, ZX80 experts? I'm out of options.
My overall question is: "is there any way to keep a picture on screen for a specific length of time on the ZX80?"
I had some thoughts, knowing that FOR N=1 TO 1000: NEXT N would just blank the screen. I looked for the ZX80's equivalent of FRAMES in the system variables, POKE both bytes to 0, then wait for the value to increase to a certain point - but not only does that blank the screen, it also never gets raised above 0 so this is a loop that will only end with BREAK.
I also tried repeated PRINT CHR$(116), i.e. HOME, which I thought would reset the equivalent of the PRINT AT position to 0,0 - but it affects the program cursor instead. Even so, would it work? No. It printed a question mark. The same happened with CHR$(112), the cursor-up character. So we can't control the PRINT AT position that way, Commodore-style.
While fiddling around with the potential for a PRINT AT on the ZX80, I thought I'd POKE the system variables 16420 and 16421, even though the manual says not to (they're marked with an X for "DO NOT POKE"). POKE 16420,33 and POKE 16421,23 should, as I understood it, return the PRINT AT position to 0,0 - but the POKEs have no effect on the PRINT position - all it did is made the error report invisible.
This thread from 2014 implies "PAUSE is impossible, and also, it is possible". It will take the ZX80 *some time* to keep doing loops, and all I have to do is work out how many times it needs to loop. But there's still that problem of the screen shutting off while it happens. The thread also mentions making input requests to the keyboard...
So my thoughts turned to machine code. Is there a way of printing non-printable characters to the screen - is there even a non-printable character that would not appear as a question mark - that could be deposited on screen with RST 16 (or POKE directly to the screen), and controlled by a BC loop, which in turn might be inside another BC loop? Is there a way of shifting the PRINT AT position from a ROM call that I'm unaware of? And is any of this going to be possible without the screen blanking, without digging very deep into the "flicker-free graphics" that are way, way beyond my understanding?
The only way I can find to PRINT AT is to POKE directly to the display file, but it seems to change depending on what else I've done. So, for instance:
10 PRINT "BOB"
20 LET X=PEEK(16396)+256*PEEK(16397)
30 POKE X+6,41
...this changes BOB to BOD, requiring an adjustment of 6 to the PEEKed D_FILE to PRINT AT 0,2;"D". However, if we try to POKE directly without a variable...
10 PRINT "BOB"
20 POKE 3+PEEK(16396)+256*PEEK(16397),41
...this has the same effect; only an adjustment of 3 is needed.
It's the same result with 1K, 4K or 16K - unlike the ZX81.
Any bright ideas, ZX80 experts? I'm out of options.