Difference between revisions of "OSWORD &0E"
(Added subfunction 3.) |
m (Formatted title.) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
[[Category:OSWORD]] | [[Category:OSWORD]] | ||
− | OSWORD &0E (14 ) - | + | {{PageTitle|OSWORD &0E (14): Read Real-Time clock}} |
− | |||
On entry: | On entry: | ||
− | XY | + | XY?0=function code |
− | + | ||
0 - Return clock value as string | 0 - Return clock value as string | ||
On exit: | On exit: | ||
XY+0..23=CR-terminated string in form | XY+0..23=CR-terminated string in form | ||
"Day,DD Mon Year.HH:MM:SS". | "Day,DD Mon Year.HH:MM:SS". | ||
− | + | ||
1 - Return BCD clock value. | 1 - Return BCD clock value. | ||
On exit: | On exit: | ||
Line 15: | Line 14: | ||
XY?1=month (&01-&12) | XY?1=month (&01-&12) | ||
XY?2=date (&01-&31) | XY?2=date (&01-&31) | ||
− | XY?3=day of week (&01-&07, Sun-Sat) | + | XY?3=day of week (&01-&07, Sun-Sat or &00=not returned) |
XY?4=hours (&00-&23) | XY?4=hours (&00-&23) | ||
XY?5=minutes (&00-&59) | XY?5=minutes (&00-&59) | ||
Line 22: | Line 21: | ||
A year value of &80-&99 represents 1980-1999, a value of | A year value of &80-&99 represents 1980-1999, a value of | ||
&00-&79 represents 2000-2079. | &00-&79 represents 2000-2079. | ||
− | + | ||
2 - Convert BCD to string. | 2 - Convert BCD to string. | ||
On entry: | On entry: | ||
Line 28: | Line 27: | ||
On exit: | On exit: | ||
XY+1..25=CR-terminated string as with subfunction 0 | XY+1..25=CR-terminated string as with subfunction 0 | ||
− | + | ||
3 - Return 5-byte centisecond clock value (where supported) | 3 - Return 5-byte centisecond clock value (where supported) | ||
On exit: | On exit: | ||
XY?0..4=number of centiseconds since 00:00:00 01-Jan-1900 | XY?0..4=number of centiseconds since 00:00:00 01-Jan-1900 | ||
+ | |||
+ | 3 - Return clock value as string from file server (ANFS 4.2x) | ||
+ | On exit: | ||
+ | XY+0..23=CR-terminated string in form | ||
+ | "Day,DD Mon Year.HH:MM:SS". | ||
+ | |||
+ | 4 - Return BCD clock value from file server (ANFS). | ||
+ | On exit: | ||
+ | XY?0=year (&00-&99) | ||
+ | XY?1=month (&01-&12) | ||
+ | XY?2=date (&01-&31) | ||
+ | XY?3=day of week (&00=not returned) | ||
+ | XY?4=hours (&00-&23) | ||
+ | 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. | ||
+ | |||
+ | ? - Return BCD time/date/temperature | ||
+ | |||
+ | ? - Return time/date/temperature string | ||
+ | |||
+ | ==Implementation== | ||
+ | On a system without a Real Time Clock, the MOS passes OSWORD 14 to sideways | ||
+ | ROMs for support. | ||
+ | |||
+ | ===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 (included in HADFS) implements subcalls 0,1,2 with the | ||
+ | date set with *SETDATE and the time being calculated from TIME. | ||
==See Also== | ==See Also== | ||
Line 38: | Line 81: | ||
[[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) |
Revision as of 15:52, 21 November 2021
OSWORD &0E (14): Read Real-Time clock
On entry: XY?0=function code 0 - Return clock value as string On exit: XY+0..23=CR-terminated string in form "Day,DD Mon Year.HH:MM:SS". 1 - Return BCD clock value. On exit: XY?0=year (&00-&99) XY?1=month (&01-&12) XY?2=date (&01-&31) XY?3=day of week (&01-&07, Sun-Sat or &00=not returned) XY?4=hours (&00-&23) 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: XY+1..7=BCD value as with subfunction 1 On exit: XY+1..25=CR-terminated string as with subfunction 0 3 - Return 5-byte centisecond clock value (where supported) On exit: XY?0..4=number of centiseconds since 00:00:00 01-Jan-1900 3 - Return clock value as string from file server (ANFS 4.2x) On exit: XY+0..23=CR-terminated string in form "Day,DD Mon Year.HH:MM:SS". 4 - Return BCD clock value from file server (ANFS). On exit: XY?0=year (&00-&99) XY?1=month (&01-&12) XY?2=date (&01-&31) XY?3=day of week (&00=not returned) XY?4=hours (&00-&23) 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. ? - Return BCD time/date/temperature ? - Return time/date/temperature string
Contents
Implementation
On a system without a Real Time Clock, the MOS passes OSWORD 14 to sideways ROMs for support.
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 (included in HADFS) implements subcalls 0,1,2 with the date set with *SETDATE and the time being calculated from TIME.
See Also
Jgharston 12:56, 26 May 2009 (UTC) Jgharston (talk) 06:45, 12 April 2020 (CEST)