2 * BIOS interrupt 1ah handler
12 #define BCD_TO_BIN(x) ((x&15) + (x>>4)*10)
13 #define BIN_TO_BCD(x) ((x%10) + ((x/10)<<4))
16 /**********************************************************************
17 * INT1A_GetTicksSinceMidnight
19 * Return number of clock ticks since midnight.
21 DWORD
INT1A_GetTicksSinceMidnight(void)
27 /* This should give us the (approximately) correct
28 * 18.206 clock ticks per second since midnight.
30 gettimeofday( &tvs
, NULL
);
32 bdtime
= localtime( &seconds
);
33 return (((bdtime
->tm_hour
* 3600 + bdtime
->tm_min
* 60 +
34 bdtime
->tm_sec
) * 18206) / 1000) +
35 (tvs
.tv_usec
/ 54927);
39 /**********************************************************************
42 * Handler for int 1ah (date and time).
44 void WINAPI
INT_Int1aHandler( CONTEXT
*context
)
50 switch(AH_reg(context
))
53 ticks
= INT1A_GetTicksSinceMidnight();
54 CX_reg(context
) = HIWORD(ticks
);
55 DX_reg(context
) = LOWORD(ticks
);
56 AX_reg(context
) = 0; /* No midnight rollover */
57 TRACE(int,"int1a: AH=00 -- ticks=%ld\n", ticks
);
62 bdtime
= localtime(<ime
);
64 CX_reg(context
) = (BIN_TO_BCD(bdtime
->tm_hour
)<<8) |
65 BIN_TO_BCD(bdtime
->tm_min
);
66 DX_reg(context
) = (BIN_TO_BCD(bdtime
->tm_sec
)<<8);
70 bdtime
= localtime(<ime
);
71 CX_reg(context
) = (BIN_TO_BCD(bdtime
->tm_year
/100)<<8) |
72 BIN_TO_BCD((bdtime
->tm_year
-1900)%100);
73 DX_reg(context
) = (BIN_TO_BCD(bdtime
->tm_mon
)<<8) |
74 BIN_TO_BCD(bdtime
->tm_mday
);
77 /* setting the time,date or RTC is not allow -EB */
91 INT_BARF( context
, 0x1a );