What does PAUSE do on a ZX81 ?

Anything Sinclair ZX Basic related; history, development, tips - differences between BASIC on the ZX80 and ZX81
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

What does PAUSE do on a ZX81 ?

Post by PokeMon »

Today I wrote a test program which confused me while testing my video output.
What does PAUSE exactly do ?
I found a flickering when using in a loop but it is independend from the length of PAUSE. It just flickers every PAUSE command for one time.
I found out with my oscilloscope, that there is the triggering of the horizontal sync is moving, so seem to be unsynced for a small moment.

In the emulator (EO) it's the same flickering.

The manual says, computing will just stop for "n" frames and only content is displayed.
Why the hell is it flickering / loosing sync ? It just could do no execution of the program for a defined time period.
But seems that there is the a new picture sync at the end of PAUSE.
For what is it good ?

Long time ago I programmed with PAUSE and never had that in my mind.

I think the ROM routines could be improved by many changes. This could be one of it.

Used this for testing:
10 PRINT "X";
20 PAUSE 50
30 GOTO 10
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: What does PAUSE do on a ZX81 ?

Post by PokeMon »

By the way, I just thought why is the display flickering at all in FAST mode ?
I think the switching between FAST and SLOW or "computing" and "computing&display" could be done with synchronization.
Don't you think so ?
8-)
User avatar
iturbez
Posts: 154
Joined: Fri Dec 25, 2009 1:06 pm
Location: Spain

Re: What does PAUSE do on a ZX81 ?

Post by iturbez »

As I can remenber, the PAUSE command always make display fickering... When my programs wanted to make some pause, I used an empty FOR-NEXT loop, to avoid screen flickering...

I think I remember this... Almost 30 years... from my very first ZX81 BASIC program... :D :D :D
User avatar
Andy Rea
Posts: 1606
Joined: Fri May 09, 2008 2:48 pm
Location: Planet Earth
Contact:

Re: What does PAUSE do on a ZX81 ?

Post by Andy Rea »

like iturbez said, PAUSE always has caused the display to flicker... it's just the way it is... crap programming (in the rom) ??? or maybe they thought it would only be useful when running in fast in which case the flicker doesn't matter !

Maybe a rom patch could fix it ??? i dunno aint really looked at it.

Andy
what's that Smell.... smells like fresh flux and solder fumes...
User avatar
PokeMon
Posts: 2264
Joined: Sat Sep 17, 2011 6:48 pm

Re: What does PAUSE do on a ZX81 ?

Post by PokeMon »

Andy Rea wrote: Maybe a rom patch could fix it ??? i dunno aint really looked at it.

Andy
Yes - I think it would be possible.
Flickering doesn't look very nice. :roll:


Andy Rea wrote: or maybe they thought it would only be useful when running in fast in which case the flicker doesn't matter !
If I want a program to be fast I wouldn't think about using PAUSE. :mrgreen:
User avatar
Andy Rea
Posts: 1606
Joined: Fri May 09, 2008 2:48 pm
Location: Planet Earth
Contact:

Re: What does PAUSE do on a ZX81 ?

Post by Andy Rea »

PokeMon wrote:
Andy Rea wrote: or maybe they thought it would only be useful when running in fast in which case the flicker doesn't matter !
If I want a program to be fast I wouldn't think about using PAUSE. :mrgreen:
but at some point your going to want to see the result ? or an imtermediate progress report
what's that Smell.... smells like fresh flux and solder fumes...
User avatar
RetroTechie
Posts: 379
Joined: Tue Nov 01, 2011 12:16 am
Location: Hengelo, NL
Contact:

Re: What does PAUSE do on a ZX81 ?

Post by RetroTechie »

PokeMon wrote:By the way, I just thought why is the display flickering at all in FAST mode ?
When you think of it: why doesn't a ZX81 simply count screen lines in FAST mode (like it does for top & bottom border in SLOW mode), but still produce the software-generated vertical sync? In other words: skip the CPU-expensive active display generation, but still do everything else.

That way almost all CPU time would be available for processing (=the purpose of FAST mode), and TV's would always see a continuous horizontal & vertical sync. Perhaps a ROM patch really is a better method to achieve this (as opposed to add-on hardware to produce vsync while in FAST mode). And integrate a fix for this PAUSE issue while we're at it...? ;)

Even more elegant: the above, combined with a system variable that says "display screen each X frames". X=1 -> SLOW mode. X=3, 5 or so: much faster processing, see a glimpse of what's on screen. X=large number -> same as original FAST mode.
Bill H
Posts: 163
Joined: Sat Nov 27, 2010 6:05 pm

Re: What does PAUSE do on a ZX81 ?

Post by Bill H »

RetroTechie wrote:
PokeMon wrote:Even more elegant: the above, combined with a system variable that says "display screen each X frames". X=1 -> SLOW mode. X=3, 5 or so: much faster processing, see a glimpse of what's on screen. X=large number -> same as original FAST mode.
You could something like this if you was making an arcade game like Space invaders, Slow mode for the score line, fast mode for a few lines, slow for a few lines to show aliens, fast to skip some lines,slow for the shooter

Bill H
User avatar
yerzmyey
Posts: 1240
Joined: Thu May 15, 2008 10:11 am
Location: Rubber Planet
Contact:

Re: What does PAUSE do on a ZX81 ?

Post by yerzmyey »

And - PAUSE also mess with interrupts, which Andy kindly pointed me once.
I was kinda shocked, as a ZX Spectrum user.
Now I know not to use PAUSE but FOR/TO/NEXT instead, when the music plays. ;)
IN NIHILUM REVERTERIS - a big text-adventure game for ZX81: http://tiny.pl/g2m6m
"MONOCHROME" issue 5 - (Spring 2014) free paper/PDF magazine about ZX81: http://tiny.pl/q2m44
ZX81 COMPETITIONS 2007/2009: http://zx81.republika.pl/
dr beep
Posts: 2076
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: What does PAUSE do on a ZX81 ?

Post by dr beep »

In MC I use FRAMES to get a 1/50 sec delay.

In BASIC:

Code: Select all

10 POKE 16436,255
20 IF PEEK 16436>205 THEN GOTO 20
This will app. wait 1 sec in BASIC before continuing (1 sec or 1,02 is what I got as a result)
Set the vaue to 255-n for n/50 sec delay.
Post Reply