Difference between revisions of "OSWORD &0E"

From BeebWiki
Jump to: navigation, search
m (.)
m (Tidied data definitions.)
Line 1: Line 1:
 
[[Category:OSWORD]]
 
[[Category:OSWORD]]
 
{{PageTitle|OSWORD &0E (14): Read Real-Time clock}}
 
{{PageTitle|OSWORD &0E (14): Read Real-Time clock}}
__TOC__
+
__NOTOC__
 
  On entry:
 
  On entry:
 
   XY?0=function code
 
   XY?0=function code
Line 58: Line 58:
 
  On exit:
 
  On exit:
 
   XY+0..24: CR-terminated string
 
   XY+0..24: CR-terminated string
 
 
===Data format===
 
===Data format===
  The date string format is "DDD,dd mmm yyyy.hh:mm:ss". The punctuation is
+
  The date string format is "DDD,dd mmm yyyy.hh:mm:ss". The punctuation is normally
  normally irrelevant, the position of the component values is fixed.
+
  irrelevant, the position of the component values is fixed.
 +
 +
The I2C temperature string format is "hh:mm:ss DDD dd-mm-yy tt" where tt is the
 +
temperature.
 
   
 
   
 
  BCD date block format:
 
  BCD date block format:
Line 106: Line 108:
 
implements subcalls 0,1,2 and 8,9,10. The SoftRTC module included in HADFS
 
implements subcalls 0,1,2 and 8,9,10. The SoftRTC module included in HADFS
 
only implements subcalls 0,1,2 with the date set with *SETDATE.
 
only implements subcalls 0,1,2 with the date set with *SETDATE.
 +
 +
====I2C Control ROM===
  
 
==See Also==
 
==See Also==
Line 113: Line 117:
 
[[User:Jgharston|Jgharston]] 12:56, 26 May 2009 (UTC)
 
[[User:Jgharston|Jgharston]] 12:56, 26 May 2009 (UTC)
 
[[User:Jgharston|Jgharston]] ([[User talk:Jgharston|talk]]) 06:45, 12 April 2020 (CEST)
 
[[User:Jgharston|Jgharston]] ([[User talk:Jgharston|talk]]) 06:45, 12 April 2020 (CEST)
 +
[[User:Jgharston|Jgharston]] ([[User talk:Jgharston|talk]]) 23:56, 6 January 2023 (CET)

Revision as of 23:56, 6 January 2023

OSWORD &0E (14): Read Real-Time clock
On entry:
 XY?0=function code
 XY?0=0+n use 7-bit BCD date block
 XY?0=8+n use 8-bit BCD date block
 XY?0=0  XY?0=8   Read as 25-character string
 XY?0=1  XY?0=9   Read as 7- or 8-byte BCD block
 XY?0=2  XY?0=10  Convert 7- or 8-byte BCD block at XY+1 to string
 XY?0=3           Read as 5-byte centisecond time
 XY?0=3           Read 25-character string from file server (ANFS 4.2x)
 XY?0=4           Read BCD clock value from file server (ANFS)
 XY?0=4           Return "hh:mm:ss DDD dd-mm-yy tt",CR
                  where tt is temperature. (I2C Control ROM)
 XY?0=5
 XY?0=6
 XY?0=7
 
On entry:
 XY?0=0:   Return clock value as string
 XY?0=8:   Return clock value as string
On exit:
 XY+0..24:  CR-terminated string

On entry:
 XY?0=1:  Return 7-byte BCD clock value
 XY?0=9:  Return 8-byte BCD clock value
On exit:
 XY+0..6:  7-byte BCD clock value
 XY+0..7:  8-byte BCD clock value

On entry:
 XY?0=2:  Convert 7-bit BCD to string
 XY+1..7:  7-byte BCD clock value
 XY?0=10: Convert 8-bit BCD to string
 XY+1..8:  8-byte BCD clock value
On exit:
 XY+0..24: CR-terminated string

On entry:
 XY?0=3:   Return 5-byte centisecond clock value
On exit:
 XY?0..4:  Number of centiseconds since 00:00:00 01-Jan-1900

On entry:
 XY?0=3:  Return clock value as string from file server (ANFS 4.2x)
On exit:
 XY+0..24: CR-terminated string

On entry:
 XY?0=4:  Return BCD clock value from file server (ANFS).
On exit:
 XY+0..6:  7-byte BCD clock value

On entry:
 XY?0=4:  Return time, date and temperature string (I2C).
On exit:
 XY+0..24: CR-terminated string

Data format

The date string format is "DDD,dd mmm yyyy.hh:mm:ss". The punctuation is normally
irrelevant, the position of the component values is fixed.

The I2C temperature string format is "hh:mm:ss DDD dd-mm-yy tt" where tt is the
temperature.

BCD date block format:
 +0 year    &00-&99
 +1 month   &01-&12
 +2 date    &01-&31
 +3 day     &01-&07 Sun-Sat or &00 for unsupported
 +4 hour    &00-&59
 +5 minute  &00-&59
 +6 second  &00-&59
 +7 century &19-&20, if omitted, year is 1980-2079

BCD alarm block format:
 +0 hour    &00-&59 or &C0-&FF for 'any'
 +1 minute  &00-&59 or &C0-&FF for 'any'
 +2 second  &00-&59 or &C0-&FF for 'any'

Implementation

On a system without a Real Time Clock, the MOS passes OSWORD 14 to sideways ROMs for support.

Master MOS

The Master MOS 3 and MOS 4 implements subcalls 0,1,2. Unpatched versions always consistantly return the year in the date string as 19xx. This can be repaired with:

 Read time string to T$
 IF MID$(T$,14,1)<"8":T$=LEFT$(T$,11)+"20"+MID$(T$,14)

ANFS

Master ANFS 4.2x implements subcalls 0,1,3,4 and calls OSWORD 14,2 to convert the result of subcall 0 and 3 to a string. BBC ANFS 4.0x and 4.1x only implements OSWORD 14,4.

The ANFS implementation fails in a predictable manner with dates after 1996. The returned date is ((year-1981) DIV 16)*16+date and the returned year is (year-1981) AND 15. The date can be repaired across the whole date range with:

 date =BCDtoBIN(returned_date) AND 31
 month=BCDtoBIN(returned_month)
 year =(BCDtoBIN(returned_date) AND &E0) DIV 2 + BCDtoBIN(returned-year)+1900

SoftRTC

The SoftRTC module stores the time and date with the system TIME timer. It implements subcalls 0,1,2 and 8,9,10. The SoftRTC module included in HADFS only implements subcalls 0,1,2 with the date set with *SETDATE.

=I2C Control ROM

See Also

Jgharston 12:56, 26 May 2009 (UTC) Jgharston (talk) 06:45, 12 April 2020 (CEST) Jgharston (talk) 23:56, 6 January 2023 (CET)