Date : Tue, 21 Jul 1998 23:24:01 +0100
From : jgh@... (Jonathan Graham Harston)
Subject: BBC2000
In message <000201bdb1ac$97af6ef0$0100a8c0@...> you wrote:
David Ashton <DAshton@...> wrote:
> IS there an official line on Millenium compliancy of BBC Micros, failing
> that, an unofficial one will do.
>
> I'm quite serious, if they don't comply I get to sell them a new system!
Mark Usher wrote:
> With what should it comply ? The BBC has no real time clock.
> A Master I can understand, but a BBC ?
>
> Am I missing something guys ?
Dave <dfl@...> wrote:
> Dunno, but...
> According to my dad, his beeb had a RTC, he build it himself. There is a
> ROM for the Master to make it Y2k complient somewhere, although I think
> some Econet fileservers gave up before 1990.
I have been writing an article on this for 8bs. Here is a short summary.
It's not a question of whether the Beebs/etc comply, it's whether the
programs running on them comply. The Beeb can comply fully, but if a
brain-dead programmer wrote the program it can fall over at any time.
The main problems with date compliancy (not Y2K) for Beebs, etc. occured
in 1996, as a lot of programmers assumed NetFS used a 4-bit year range
from 1981 instead of the correct 7-bit range.
If your Basic program just calls TIME$ to fetch the date/time, it will not
work. It will fail on anything before Basic 4, on the Compact it may
return 31-Dec-1999 or a wrong date translated froma fileserver.
A BBC can have a RTC, either through hardware of software. The only thing
special about the Master is that Basic 4 has a TIME$ function.
To find the RTC time/date, you should call OSWORD 14 directly, and check
the returned results. Doing anything else will cause problems.
The main problems that have happened due to dodgy programming are:
* Using TIME$ - crashes Basic before version 4, as not in.
* Using the returned string indescriminately, eg PRINTTAB(0,0);TIME$. You
do not know what you are displaying.
* Network fileserver time/date call: early and bad programmers couldn't be
bothered to use the full 128-year range, and just used a 16-year range.
This caused programs to claim that 1997 was actually 1981. All fileservers
written after about 1988 return the full 128-year range. This problem
has, unbelievably, been hardwired into the Master Compact which calls the
fileserver with the RTC time/date is asked for, and is leaves the year
portion in the top part of the date.
* Daft/dodgy/bad programmers doing PRINT "19";year%+81 instead of PRINT
year%+1981.
To get the date/time you should use something like:
DIM ctrl%30:X%=ctrl%:Y%=X%DIV256
DEFFNtime:!X%=0:A%=14:CALL&FFF1:IF!X%=0 OR X%!4+X%!13+X%!17=&AF83A49F:=""
X%?25=13:X%?15=13:A%=VALMID$($X%,5,2)>31
$(X%+11)=STR$(VAL$(X%+11)-16*A%-100*(VAL$(X%+11)<1981))
IFA%:X%?6=13:$(X%+4)=RIGHT$("0"+STR$(VAL$(X%+4)-32),2):X%?6=32
X%?15=46:=$X%
This calls the RTC directly and checks the result. If nothing is
returned, or if is is a dummy string from a Compact, a null string is
returned. The date and year are checked to ensure they are correct, and
if the year is BA (Before Acorn) - earlier than 1981, it makes it 20xx.
So, FNtime returns "" if no RTC present, or a string such as "Mon,23 Jan
2004.22:24:42" if RTC present.
Alternatively:
DIM ctrl%30:X%=ctrl%:Y%=X%DIV256
DEFPROCtime:!X%=1:X%!4=0:A%=14:CALL&FFF1:year%=FNbcd(?X%)
month%=FNbcd(X%?1):date%=FNbcd(X%?2):hour%=FNbcd(X%?4):minute%=FNbcd(X%?5)
second%=FNbcd(X%?5):year%=year%+(date%AND&E0)DIV2:date%=date%AND31
IF!X%=1:year%=0:ENDPROC
year%=1900+year%-100*(year%<81):ENDPROC
DEFFNbcd(A%)=VALSTR$~A%
This calls the RTC directly and checks the result. If nothing is
returned, or if is is a dummy string from a Compact, the variables get set
to zero. The date and year are checked to ensure they are correct, and if
the year is BA (Before Acorn) - earlier than 1981, it makes it 20xx.
So, PROCtime will set hour%, minute% and second% to the current time (eg
hour%=22, minute%=24, second%=42), and date%, month%, year% to the current
date (eg date%=23, month%=1, year% 04) if RTC present, or all set to
zero if no RTC present.
Jon Riply has thrown together a short bit of code that intercepts the
Osword 14 call, and checks and modifies the returned results. It will work
on any machine, not just the Master
By the way, what do you mean by selling them a 'new system'?
--
J.G.Harston (JGH BBC PD Library) 70 Camm Street, Walkley, SHEFFIELD S6 3TR
BBC+Master / Z80+6502 / CoPro+Tubes / Econet+SJ / Devolution / Transport /
Planning / Highways http://homepages.nildram.co.uk/~amilton/walkley.htm
jgh@... (( Anti-UCE address added by Arcade, not by me ))
- + - * NTAUS#3 24th-26th July 1998 * - + -
At my place again - Contact for details
--
___ ___ ___ ___ ___ ___ | Free Internet E-mail and Anti-UCE News |
| / \/ \/ \/ \/ \/ \ | +44 181 654 2212 also +44 181 655 4412 |
| A R C A D E | Croydon UK - Fidonet#2:254/27.0 |
| The Definitive Acorn BBS | http://arcade.demon.co.uk at weekends |