Difference between revisions of "OSWORD &0E"

From BeebWiki
Jump to: navigation, search
m (Formatted title.)
(Tidied up.)
Line 3: Line 3:
 
  On entry:
 
  On entry:
 
   XY?0=function code
 
   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
 
   
 
   
  0 - Return clock value as string
+
  On entry:
  On exit:
+
  XY?0=1:  Return 7-byte BCD clock value
  XY+0..23=CR-terminated string in form
+
  XY?0=9:  Return 8-byte BCD clock value
  "Day,DD Mon Year.HH:MM:SS".
+
On exit:
 +
  XY+0..6:  7-byte BCD clock value
 +
  XY+0..7: 8-byte BCD clock value
 
   
 
   
  1 - Return BCD clock value.
+
  On entry:
  On exit:
+
  XY?0=2:  Convert 7-bit BCD to string
  XY?0=year (&00-&99)
+
  XY+1..7:  7-byte BCD clock value
  XY?1=month (&01-&12)
+
  XY?0=10: Convert 8-bit BCD to string
  XY?2=date (&01-&31)
+
  XY+1..8:  8-byte BCD clock value
  XY?3=day of week (&01-&07, Sun-Sat or &00=not returned)
+
On exit:
  XY?4=hours (&00-&23)
+
  XY+0..24: CR-terminated string
  XY?5=minutes (&00-&59)
 
  XY?6=seconds (&00-&59).
 
 
 
  A year value of &80-&99 represents 1980-1999, a value of
 
  &00-&79 represents 2000-2079.
 
 
   
 
   
  2 - Convert BCD to string.
+
  On entry:
  On entry:
+
  XY?0=3:  Return 5-byte centisecond clock value
  XY+1..7=BCD value as with subfunction 1
+
On exit:
  On exit:
+
  XY?0..4:  Number of centiseconds since 00:00:00 01-Jan-1900
  XY+1..25=CR-terminated string as with subfunction 0
 
 
   
 
   
  3 - Return 5-byte centisecond clock value (where supported)
+
  On entry:
  On exit:
+
  XY?0=3Return clock value as string from file server (ANFS 4.2x)
  XY?0..4=number of centiseconds since 00:00:00 01-Jan-1900
+
On exit:
 +
  XY+0..24: CR-terminated string
 
   
 
   
  3 - Return clock value as string from file server (ANFS 4.2x)
+
  On entry:
  On exit:
+
  XY?0=4:  Return BCD clock value from file server (ANFS).
  XY+0..23=CR-terminated string in form
+
On exit:
  "Day,DD Mon Year.HH:MM:SS".
+
  XY+0..6:  7-byte BCD clock value
 
   
 
   
  4 - Return BCD clock value from file server (ANFS).
+
  On entry:
  On exit:
+
  XY?0=4Return time, date and temperature string (I2C).
  XY?0=year (&00-&99)
+
On exit:
  XY?1=month (&01-&12)
+
  XY+0..24: CR-terminated string
  XY?2=date (&01-&31)
+
 
  XY?3=day of week (&00=not returned)
+
===Data format===
  XY?4=hours (&00-&23)
+
The date string format is "DDD,dd mmm yyyy.hh:mm:ss". The punctuation is
  XY?5=minutes (&00-&59)
+
normally irrelevant, the position of the component values is fixed.
  XY?6=seconds (&00-&59).
 
 
 
  A year value of &80-&99 represents 1980-1999, a value of
 
  &00-&79 represents 2000-2079.
 
 
   
 
   
  ? - Return BCD time/date/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
 
   
 
   
  ? - Return time/date/temperature string
+
  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==
 
==Implementation==
 
On a system without a Real Time Clock, the MOS passes OSWORD 14 to sideways
 
On a system without a Real Time Clock, the MOS passes OSWORD 14 to sideways
 
ROMs for support.
 
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===
 
===ANFS===
Line 67: Line 97:
 
year is (year-1981) AND 15. The date can be repaired across the whole date
 
year is (year-1981) AND 15. The date can be repaired across the whole date
 
range with:
 
range with:
 
 
   date =BCDtoBIN(returned_date) AND 31
 
   date =BCDtoBIN(returned_date) AND 31
 
   month=BCDtoBIN(returned_month)
 
   month=BCDtoBIN(returned_month)
Line 73: Line 102:
  
 
===SoftRTC===
 
===SoftRTC===
The SoftRTC module (included in HADFS) implements subcalls 0,1,2 with the
+
The SoftRTC module stores the time and date with the system TIME timer. It
date set with *SETDATE and the time being calculated from TIME.
+
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.
  
 
==See Also==
 
==See Also==

Revision as of 23:51, 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.

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.

See Also

Jgharston 12:56, 26 May 2009 (UTC) Jgharston (talk) 06:45, 12 April 2020 (CEST)