Pause Function - useful for a Clock?

Anything Sinclair ZX Basic related; history, development, tips - differences between BASIC on the ZX80 and ZX81
johnnyrockets
Posts: 34
Joined: Tue May 03, 2016 12:42 pm

Pause Function - useful for a Clock?

Post by johnnyrockets » Mon Aug 08, 2016 4:24 pm

Hi guys (gals),

I wrote a small program to (sort of) be a clock.

The idea is you have to enter the current time and then the clock should "go" on it's own.

Image

How reliable is the Pause command for something like this? Or is there a better way? Pause 120 seemed to be as close to 1 second as I could get using ZX81 with my laptop.

I'm a bit of a newbie so thanks for bearing with me! :)


Thanks!


John

User avatar
gammaray
Posts: 586
Joined: Sun Apr 17, 2016 2:44 am
Location: Texas

Re: Pause Function - useful for a Clock?

Post by gammaray » Mon Aug 08, 2016 6:14 pm

Run for 30 minutes check your time and you will see how accurate 'tis.

If you add anymore lines in your loop, will the duration of it increase and the clock slow?
5-TS1000,UK ZX81<-Sheelagh, US ZX81, 2-TS1500/KDLX , 3-TS2040 printer, 2-TS2020 cassette decks, ZXPAND+AY, ZeddyNET, ZXBlast, UDG, ZX8CCB, AERCO, BUILDS/REPAIRS ZX Spectrum, ZX80 Minstrel, ZXMAX48 v1 v2, 2-TS-2068, ROM, 16kRAM

User avatar
siggi
Posts: 883
Joined: Thu May 08, 2008 9:30 am
Location: Dauernheim, Germany
Contact:

Re: Pause Function - useful for a Clock?

Post by siggi » Tue Aug 09, 2016 9:23 am

johnnyrockets wrote:Hi guys (gals),

How reliable is the Pause command for something like this? Or is there a better way?
In Wilf's NOVA the clock is hooked into the display routine and is updated with 50/60 Hz AND runs concurrently to the BASIC program (and can be read and set by the BASIC program):

Code: Select all

         1. Increased horizontal line length with up to 34 characters per line.
         2. Increased number of lines with up to 29 lines (in 50Hz mode)
         3. No N/L character (CHR$ 118) required to terminate video lines.
         4. Sliding display window on memory permits horizontal and vertical scrolling.
         5. Rapid switching of Display files facilitates screen animations.
         6. Increased execution speed with smaller screen displays for fast action.
         7. View contents of large A$ string array directly
 
         In addition to these display features, NOVA1000 includes several new system
         utilities such as

             1. Repeating keys.
             2. 100 Hour clock/timer
             3. BASIC line number trace.
http://www.user.dccnet.com/wrigter/inde ... va2005.htm

Siggi
My ZX81 web-server: online since 2007
http://zx81-siggi.endoftheinternet.org/index.html

User avatar
1024MAK
Posts: 2527
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: Pause Function - useful for a Clock?

Post by 1024MAK » Tue Aug 09, 2016 1:05 pm

Keep in mind that a real ZX81 or TS1000 uses a resonator rather than a quartz crystal, so the 6.5MHz ULA clock signal is not very accurate over long time periods. So a real machine will lose or gain a surprising amount over 12 hours, let alone a few days :(

Mark

Moggy
Posts: 1861
Joined: Wed Jun 18, 2008 2:00 pm

Re: Pause Function - useful for a Clock?

Post by Moggy » Tue Aug 09, 2016 1:26 pm

1024MAK wrote:Keep in mind that a real ZX81 or TS1000 uses a resonator rather than a quartz crystal, so the 6.5MHz ULA clock signal is not very accurate over long time periods. So a real machine will lose or gain a surprising amount over 12 hours, let alone a few days :(

Mark

Agreed as anyone who has tried the "real time clock" listing in the Skywave forth ROM manual will testify, unreal time clock would be a more fitting description.

Inaccurate over the space of two hours let alone twelve. :lol:

johnnyrockets
Posts: 34
Joined: Tue May 03, 2016 12:42 pm

Re: Pause Function - useful for a Clock?

Post by johnnyrockets » Tue Aug 09, 2016 2:15 pm

1024MAK wrote:Keep in mind that a real ZX81 or TS1000 uses a resonator rather than a quartz crystal, so the 6.5MHz ULA clock signal is not very accurate over long time periods. So a real machine will lose or gain a surprising amount over 12 hours, let alone a few days :(

Mark

Maybe not such a good clock then! ;)

Thanks! I did not know that!


JR

johnnyrockets
Posts: 34
Joined: Tue May 03, 2016 12:42 pm

Re: Pause Function - useful for a Clock?

Post by johnnyrockets » Tue Aug 09, 2016 2:19 pm

Moggy wrote:
1024MAK wrote:Keep in mind that a real ZX81 or TS1000 uses a resonator rather than a quartz crystal, so the 6.5MHz ULA clock signal is not very accurate over long time periods. So a real machine will lose or gain a surprising amount over 12 hours, let alone a few days :(

Mark

Agreed as anyone who has tried the "real time clock" listing in the Skywave forth ROM manual will testify, unreal time clock would be a more fitting description.

Inaccurate over the space of two hours let alone twelve. :lol:

Funny what one gets themselves "into". I thought writing the clock would be simple. It is an exercise that I have done with many other modern languages, just for fun, but never with a retro computer.

Additionally, it is funny what one takes for "granted" in the modern computing world. Like Windows/Linux supplying the time and getting it right from the BIOS.

JR

User avatar
gammaray
Posts: 586
Joined: Sun Apr 17, 2016 2:44 am
Location: Texas

Re: Pause Function - useful for a Clock?

Post by gammaray » Tue Aug 09, 2016 5:36 pm

Wilf's clock is "flex"-timeclock! It is ok for people on flextime... like myself. I am sometimes early... sometimes late!
5-TS1000,UK ZX81<-Sheelagh, US ZX81, 2-TS1500/KDLX , 3-TS2040 printer, 2-TS2020 cassette decks, ZXPAND+AY, ZeddyNET, ZXBlast, UDG, ZX8CCB, AERCO, BUILDS/REPAIRS ZX Spectrum, ZX80 Minstrel, ZXMAX48 v1 v2, 2-TS-2068, ROM, 16kRAM

User avatar
mrtinb
Posts: 1062
Joined: Fri Nov 06, 2015 5:44 pm
Location: Denmark
Contact:

Re: Pause Function - useful for a Clock?

Post by mrtinb » Tue Aug 09, 2016 11:43 pm

You need some external hardware for a clock.

Maybe you could use ZeddyNet to sync the clock with an Internet server.
Martin
ZX81, Lambda 8300, Commodore 64, Mac G4 Cube

User avatar
PokeMon
Posts: 2225
Joined: Sat Sep 17, 2011 6:48 pm

Re: Pause Function - useful for a Clock?

Post by PokeMon » Wed Aug 10, 2016 9:58 am

You may write a clock program and give some correction factor manually based on your specific ZX81.
So let it run 1 hour, count the mismatch in seconds, divide 3600 seconds with your determined deviation and you adjust your time every 200 seconds or what it is by adding or subtracting one second. I think the frequency of your personal Zeddy won't change and can be treated more or less as constant. ;)

Post Reply