Page 1 of 2

Pause Function - useful for a Clock?

Posted: Mon Aug 08, 2016 4:24 pm
by johnnyrockets
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

Re: Pause Function - useful for a Clock?

Posted: Mon Aug 08, 2016 6:14 pm
by gammaray
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?

Re: Pause Function - useful for a Clock?

Posted: Tue Aug 09, 2016 9:23 am
by siggi
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

Re: Pause Function - useful for a Clock?

Posted: Tue Aug 09, 2016 1:05 pm
by 1024MAK
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

Re: Pause Function - useful for a Clock?

Posted: Tue Aug 09, 2016 1:26 pm
by Moggy
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:

Re: Pause Function - useful for a Clock?

Posted: Tue Aug 09, 2016 2:15 pm
by johnnyrockets
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

Re: Pause Function - useful for a Clock?

Posted: Tue Aug 09, 2016 2:19 pm
by johnnyrockets
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

Re: Pause Function - useful for a Clock?

Posted: Tue Aug 09, 2016 5:36 pm
by gammaray
Wilf's clock is "flex"-timeclock! It is ok for people on flextime... like myself. I am sometimes early... sometimes late!

Re: Pause Function - useful for a Clock?

Posted: Tue Aug 09, 2016 11:43 pm
by mrtinb
You need some external hardware for a clock.

Maybe you could use ZeddyNet to sync the clock with an Internet server.

Re: Pause Function - useful for a Clock?

Posted: Wed Aug 10, 2016 9:58 am
by PokeMon
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. ;)