Difference between revisions of "OSWORD &0E"
(Added subfunction 3.) |
(Added subcode 3,4 and implementation details.) |
||
Line 1: | Line 1: | ||
[[Category:OSWORD]] | [[Category:OSWORD]] | ||
− | OSWORD &0E (14 ) - Reads CMOS clock | + | OSWORD &0E (14) - Reads CMOS 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. | ||
Line 15: | Line 15: | ||
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) | ||
− | XY?6=seconds (&00-&59) | + | XY?6=seconds (&00-&59) |
A year value of &80-&99 represents 1980-1999, a value of | A year value of &80-&99 represents 1980-1999, a value of | ||
Line 32: | Line 32: | ||
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 82: | ||
[[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]]) 14:36, 23 January 2019 (CET) |
Revision as of 14:36, 23 January 2019
OSWORD &0E (14) - Reads CMOS 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) 14:36, 23 January 2019 (CET)