2 * BIOS interrupt 1ah handler
12 /* #define DEBUG_INT */
15 #define BCD_TO_BIN(x) ((x&15) + (x>>4)*10)
16 #define BIN_TO_BCD(x) ((x%10) + ((x/10)<<4))
19 /**********************************************************************
20 * INT1A_GetTicksSinceMidnight
22 * Return number of clock ticks since midnight.
24 DWORD
INT1A_GetTicksSinceMidnight(void)
30 /* This should give us the (approximately) correct
31 * 18.206 clock ticks per second since midnight.
33 gettimeofday( &tvs
, NULL
);
35 bdtime
= localtime( &seconds
);
36 return (((bdtime
->tm_hour
* 3600 + bdtime
->tm_min
* 60 +
37 bdtime
->tm_sec
) * 18206) / 1000) +
38 (tvs
.tv_usec
/ 54927);
42 /**********************************************************************
45 * Handler for int 1ah (date and time).
47 void WINAPI
INT_Int1aHandler( CONTEXT
*context
)
53 switch(AH_reg(context
))
56 ticks
= INT1A_GetTicksSinceMidnight();
57 CX_reg(context
) = HIWORD(ticks
);
58 DX_reg(context
) = LOWORD(ticks
);
59 AX_reg(context
) = 0; /* No midnight rollover */
60 dprintf_int(stddeb
,"int1a_00 // ticks=%ld\n", ticks
);
65 bdtime
= localtime(<ime
);
67 CX_reg(context
) = (BIN_TO_BCD(bdtime
->tm_hour
)<<8) |
68 BIN_TO_BCD(bdtime
->tm_min
);
69 DX_reg(context
) = (BIN_TO_BCD(bdtime
->tm_sec
)<<8);
73 bdtime
= localtime(<ime
);
74 CX_reg(context
) = (BIN_TO_BCD(bdtime
->tm_year
/100)<<8) |
75 BIN_TO_BCD((bdtime
->tm_year
-1900)%100);
76 DX_reg(context
) = (BIN_TO_BCD(bdtime
->tm_mon
)<<8) |
77 BIN_TO_BCD(bdtime
->tm_mday
);
80 /* setting the time,date or RTC is not allow -EB */
94 INT_BARF( context
, 0x1a );