

NB Clock
_System Clock_
by Gerald McMullon
The COP provides a system clock after
each interrupt (50 times per second).
The COP scans the keyboard and looks
after the relays for the cassette motor
as well as handling the VF display.
Page zero stores 4 bytes, the current
status of the clock in location 52H-55H
(82-85 decimal).
The clock can be displayed by the
following:
FOR i=1TO1000 :
PUT 12 :
?PEEK(82),PEEK(83),PEEK(84),PEEK(85) :
NEXT i
The most significant byte is PEEK(85).
The true value can be found by
?PEEK(85) + 256*( PEEK(84)+256*(
PEEK(83) + 256*PEEK(82) ) )
and can be reset by
FOR i=82to85 : POKE i,0 : NEXT i
On the unexpanded NewBrain or simple
expansion (disk controller) the
following call locations are available:-
CALL 62383 :REM to reset the clock
CALL 62399, ms : REM to obtain the
system clock time
The value in seconds is calculated by
ms/50.
Example:
5 REM Waste 10 seconds
(approximately)
10 CALL 62383
20 CALL 62399,ms :
IF ms < 500 THEN 20
30 END
The clock is very accurate, and has
matched a quartz watch, to within a
minute for over 24 hours.
To time a piece of code, reset at the
begining and read at the end of the
code.
E.g.
CALL 62383
CALL 62399,no :REM time calls
CALL 62383
... : REM your code
CALL 62399,ms :
?"Took";(ms-no)/50;"secs"
NB note the system clock is normally
considered to be the routines at 62383
and 62399.
Main Menu
Home NB Hardware Catalog News Information Specifications FAQs NB Emulator HELP Advanced searchUser Login
Statistics
Languages: 2Members: 616
News: 93
WebLinks: 16








![]() | Today | 79 |
![]() | Yesterday | 314 |
![]() | This Week | 1630 |
![]() | This Month | 3637 |
Please use the NB CATALOG page here to insert your hardware and help us catalog everything that survived all these years.
Most programs on this website are in WinRar format. The WinRar compression program is available for free on the Internet.
Shouter
NB Forum Latest Posts

by cdesp

by proton

by proton

by plore90

by admin
Popular Files

(Emulation)

(Emulation)

(BOOKS)

(Emulation)

(BOOKS)

(Technical Notes)