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 /**********************************************************************
43 * 0x00 - 0x07 - date and time
44 * 0x?? - 0x?? - Microsoft Real Time Compression Interface
46 void WINAPI INT_Int1aHandler( CONTEXT *context )
52 switch(AH_reg(context))
55 ticks = INT1A_GetTicksSinceMidnight();
56 CX_reg(context) = HIWORD(ticks);
57 DX_reg(context) = LOWORD(ticks);
58 AX_reg(context) = 0; /* No midnight rollover */
59 TRACE(int,"int1a: AH=00 -- ticks=%ld\n", ticks);
64 bdtime = localtime(<ime);
66 CX_reg(context) = (BIN_TO_BCD(bdtime->tm_hour)<<8) |
67 BIN_TO_BCD(bdtime->tm_min);
68 DX_reg(context) = (BIN_TO_BCD(bdtime->tm_sec)<<8);
72 bdtime = localtime(<ime);
73 CX_reg(context) = (BIN_TO_BCD(bdtime->tm_year/100)<<8) |
74 BIN_TO_BCD((bdtime->tm_year-1900)%100);
75 DX_reg(context) = (BIN_TO_BCD(bdtime->tm_mon)<<8) |
76 BIN_TO_BCD(bdtime->tm_mday);
79 /* setting the time,date or RTC is not allow -EB */
92 case 0xb0: /* Microsoft Real Time Compression */
93 switch AL_reg(context)
99 INT_BARF(context, 0x1a);
104 INT_BARF( context, 0x1a );