TIME
Datum a čas
Základem měření data a času v systému Litos8 je časový údaj ve formátu Unix, představující počet sekund od 1.1.1970 0:00:00, s omezením do 7.2.2106 6:28:15 (rozsah čísla dword).
PackBCDByte - pack 1 byte to BCD format
INPUT:
AL = binary number (0..99)
OUTPUT:
AL = BCD number (00h..99h)
PackBCD2Byte - pack 2 bytes to BCD format
INPUT:
AH,AL = binary numbers (0..99)
OUTPUT:
AH,AL = BCD numbers (00h..99h)
PackBCD4Byte - pack 4 bytes to BCD format
INPUT:
DH,DL,AH,AL = binary numbers (0..99)
OUTPUT:
DH,DL,AH,AL = BCD numbers (00h..99h)
UnpackBCDByte - unpack 1 byte from BCD format
INPUT:
AL = BCD number (00h..99h)
OUTPUT:
AL = binary number (0..99)
UnpackBCD2Byte - unpack 2 bytes from BCD format
INPUT:
AH,AL = BCD numbers (00h..99h)
OUTPUT:
AH,AL = binary numbers (0..99)
UnpackBCD4Byte - unpack 4 bytes from BCD format
INPUT:
DH,DL,AH,AL = BCD numbers (00h..99h)
OUTPUT:
DH,DL,AH,AL = binary numbers (0..99)
ReadDT - read registers from DATETIME structure
INPUT:
DI = pointer to DATETIME structure
OUTPUT:
BL = hundredth (0..99)
BH = second (0..59)
CL = minute (0..59)
CH = hour (0..23)
DL = day (1..31)
DH = month (1..12)
SI = year (1970..2106)
WriteDT - write registers to DATETIME structure
INPUT:
DI = pointer to DATETIME structure
BL = hundredth (0..99)
BH = second (0..59)
CL = minute (0..59)
CH = hour (0..23)
DL = day (1..31)
DH = month (1..12)
SI = year (1970..2106)
PackDOSDate - pack date do DOS file format
INPUT:
DL = day (1..31, can be 0..31)
DH = month (1..12, can be 0..15)
SI = year (1980..2117)
OUTPUT:
AX = date in DOS file format
- bit 0..4: day (1..31, can be 0..31)
- bit 5..8: month (1..12, can be 0..15)
- bit 9..15: year - 1980 (0..127 = 1980..2117)
UnpackDOSDate - unpack date from DOS file format
INPUT:
AX = date in DOS file format
- bit 0..4: day (1..31, can be 0..31)
- bit 5..8: month (1..12, can be 0..15)
- bit 9..15: year - 1980 (0..127 = 1980..2117)
OUTPUT:
DL = day (1..31, can be 0..31)
DH = month (1..12, can be 0..15)
SI = year (1980..2117)
PackDOSTime - pack time to DOS file format
INPUT:
BH = second (0..58, can be 0..62, converted to even second)
CL = minute (0..59, can be 0..63)
CH = hour (0..23, can be 0..31)
OUTPUT:
AX = time in DOS file format
- bit 0..4: second/2 (value 0..29 = 0..58 seconds, can be 0..31 =
0..62 seconds)
- bit 5..10: minute (0..59, can be 0..63)
- bit 11..15: hour (0..23, can be 0..31)
UnpackDOSTime - unpack time from DOS file format
INPUT:
AX = time in DOS file format
- bit 0..4: second/2 (value 0..29 = 0..58 seconds, can be 0..31 =
0..62 seconds)
- bit 5..10: minute (0..59, can be 0..63)
- bit 11..15: hour (0..23, can be 0..31)
OUTPUT:
BH = second (0..58, can be 0..62, only even second)
CL = minute (0..59, can be 0..63)
CH = hour (0..23, can be 0..31)
DateValidate - limit date to valid values
INPUT:
DL = day (1..31)
DH = month (1..12)
SI = year (1970..2106)
OUTPUT:
values can be corrected to valid range
TimeValidate - limit time to valid values
INPUT:
BL = hundredth (0..99)
BH = second (0..59)
CL = minute (0..59)
CH = hour (0..23)
OUTPUT:
values can be corrected to valid range
DateTimeValidate - limit date and time to valid values
INPUT:
BL = hundredth (0..99)
BH = second (0..59)
CL = minute (0..59)
CH = hour (0..23)
DL = day (1..31)
DH = month (1..12)
SI = year (1970..2106)
OUTPUT:
values can be corrected to valid range
DateTimeValidateDT - limit date and time to valid values with DATETIME
INPUT:
DI = pointer to DATETIME structure
OUTPUT:
values in DATETIME can be corrected to valid range
ClockValidate - limit clock timer value
INPUT:
DX:AX = clock timer (0..1800AFh, interval 54.92549322ms)
OUTPUT:
value can be corrected to valid range
PackUnixTime - pack date and time to Unix format
INPUT:
BH = second (0..59)
CL = minute (0..59)
CH = hour (0..23)
DL = day (1..31)
DH = month (1..12)
SI = year (1970..2106)
OUTPUT:
DX:AX = number of seconds since 1/1/1970 0:00:00 Thursday
NOTES: Maxim date/time: 2/7/2106 6:28:15 (result 0ffffh:0ffffh)
UnpackUnixTime - unpack date and time from Unix format
INPUT:
DX:AX = number of seconds since 1/1/1970 0:00:00 Thursday
OUTPUT:
AL = day of week (1..7, 1=Monday...7=Sunday)
BH = second (0..59)
CL = minute (0..59)
CH = hour (0..23)
DL = day (1..31)
DH = month (1..12)
SI = year (1970..2106)
NOTES: Maxim date/time: 2/7/2106 6:28:15 Sunday (result 0ffffh:0ffffh)
DayToUnix - convert days (since 1/1/1970) to Unix format
INPUT:
AX = days since 1/1/1970
OUTPUT:
DX:AX = number of seconds since 1/1/1970 0:00:00 Thursday
NOTES: Maximum date/time: 2/7/2106 6:28:15 (result 0ffffh:0ffffh). Time is set to 0:00:00.
UnixToDay - covert Unix format to days
INPUT:
DX:AX = number of seconds since 1/1/1970 0:00:00 Thursday
OUTPUT:
AX = days since 1/1/1970
NOTES: Maximum date/time: 2/7/2106 6:28:15 (result 0ffffh:0ffffh).
GetTime - get current time
OUTPUT:
BL = hundredth (0..99)
BH = second (0..59)
CL = minute (0..59)
CH = hour (0..23)
GetDate - get current date
OUTPUT:
AL = day of week (1..7, 1=Monday...7=Sunday)
DL = day
DH = month
SI = year
GetDateTime - get current date and time
OUTPUT:
AL = day of week (1..7, 1=Monday...7=Sunday)
BL = hundredth (0..99)
BH = second (0..59)
CL = minute (0..59)
CH = hour (0..23)
DL = day (1..31)
DH = month (1..12)
SI = year (1970..2106)
GetDateTimeDT - get current date and time with DATETIME structure
INPUT:
DI = pointer to destination DATETIME structure
OUTPUT:
AL = day of week (1..7, 1=Monday...7=Sunday)
GetTimeUnix - get current time in Unix format
OUTPUT:
DX:AX = number of seconds (0..86399)
GetDateUnix - get current date in Unix format
OUTPUT:
DX:AX = number of seconds since 1/1/1970 0:00:00 Thursday
GetDateTimeUnix - get current date and time in Unix format
OUTPUT:
DX:AX = number of seconds since 1/1/1970 0:00:00 Thursday
Clock2Unix - convert clock timer to Unix time
INPUT:
DX:AX = clock timer (0..1800AFh, interval 54.92549322ms)
OUTPUT:
DX:AX = number of seconds (0..86399)
CL = hundredth (0..99)
Clock2Time - convert clock timer to time
INPUT:
DX:AX = clock timer (0..1800AFh, interval 54.92549322ms)
OUTPUT:
BL = hundredth (0..99)
BH = second (0..59)
CL = minute (0..59)
CH = hour (0..23)
Time2Clock - convert time to clock timer
INPUT:
BL = hundredth (0..99)
BH = second (0..59)
CL = minute (0..59)
CH = hour (0..23)
OUTPUT:
DX:AX = clock timer (0..1800AFh, interval 54.92549322ms)
GetClockTimer - get clock timer
OUTPUT:
DX:AX = clock timer (0..1800AFh, interval 54.92549322ms)
SetClockTimer - set clock timer (without updating RTC clock)
INPUT:
DX:AX = clock timer (0..1800AFh, interval 54.92549322ms)
GetRTCTime - get time from RTC (CMOS) clock
OUTPUT:
BH = second (0..59)
CL = minute (0..59)
CH = hour (0..23)
GetRTCDate - get date from RTC (CMOS) clock
OUTPUT:
DL = day (1..31)
DH = month (1..12)
SI = year (1970..2106)
GetRTCDateTime - get date and time from RTC (CMOS) clock
OUTPUT:
BH = second (0..59)
CL = minute (0..59)
CH = hour (0..23)
DL = day (1..31)
DH = month (1..12)
SI = year (1970..2106)
GetRTCDateTimeDT - get date and time from RTC clock with DATETIME
INPUT:
DI = pointer to DATETIME structure
SetTime - set new time
INPUT:
BL = hundredth (0..99)
BH = second (0..59)
CL = minute (0..59)
CH = hour (0..23)
SetDate - set new date
INPUT:
DL = day (1..31)
DH = month (1..12)
SI = year (1970..2106)
SetDateTime - set new date and time
INPUT:
BL = hundredth (0..99)
BH = second (0..59)
CL = minute (0..59)
CH = hour (0..23)
DL = day (1..31)
DH = month (1..12)
SI = year (1970..2106)
SetDateTimeDT - set new date and time with DATETIME
INPUT:
DI = pointer to DATETIME structure
ReinitDateTime - reinitialize date and time from RTC (CMOS) clock
NOTES:
Can be used after changing TIMER0 (Int 08h) frequency.
GetSysTimer - get system timer
OUTPUT:
AX = system timer (increasing 0..0ffffh)
NOTES: Timer counts in frequency 1.193182 MHz, resolution 0.838095 us. It takes aprox. 7 us.
SysTimerToUs - recalc system timer interval to microseconds
INPUT:
AX = system timer interval in ticks (0..0ffffh)
OUTPUT:
AX = time interval in microseconds (0..54924)
NOTES: Timer counts in frequency 1.193182 MHz, resolution 0.838095 us.
UsToSysTimer - recalc microseconds to system timer interval
INPUT:
AX = time interval in microseconds (0..54924)
OUTPUT:
AX = system timer interval in ticks (0..0ffffh)
NOTES: Timer counts in frequency 1.193182 MHz, resolution 0.838095 us.
WaitUs - wait short time in microseconds
INPUT:
AX = required period in us (0..50000)
NOTES: Interrupt need not be enabled. It takes minimal aprox. 15 us, granularity is aprox. 7 us.
WaitMs - wait given time in milliseconds
INPUT:
AX = required period in ms (0..65535)
NOTES: Interrupt need not be enabled.
DATETIME_Time: time entries
(hundr,sec,min,hour)
DATETIME_Hundr: (byte) (BL) hundredth (0..99)
DATETIME_Sec: (byte) (BH) second (0 to 59)
DATETIME_Min: (byte) (CL) minute (0 to 59)
DATETIME_Hour: (byte) (CH) hour (0 to 23)
DATETIME_Date: date entries (day, month,
year)
DATETIME_Day: (byte) (DL) day in month (1 to 31)
DATETIME_Month: (byte) (DH) month (1 to 12)
DATETIME_Year: (word) (SI) year (Unix 1970..2106, DOS 1980..2117)