8 /* #define DEBUG_INT */
11 #define BCD_TO_BIN(x) ((x&15) + (x>>4)*10)
12 #define BIN_TO_BCD(x) ((x%10) + ((x/10)<<4))
15 /**********************************************************************
16 * INT1A_GetTicksSinceMidnight
18 * Return number of clock ticks since midnight.
20 DWORD
INT1A_GetTicksSinceMidnight(void)
26 /* This should give us the (approximately) correct
27 * 18.206 clock ticks per second since midnight.
29 gettimeofday( &tvs
, NULL
);
31 bdtime
= localtime( &seconds
);
32 return (((bdtime
->tm_hour
* 3600 + bdtime
->tm_min
* 60 +
33 bdtime
->tm_sec
) * 18206) / 1000) +
34 (tvs
.tv_usec
/ 54927);
38 /**********************************************************************
41 * Handler for int 1ah (date and time).
43 void INT_Int1aHandler( SIGCONTEXT
*context
)
49 switch(AH_reg(context
))
52 ticks
= INT1A_GetTicksSinceMidnight();
53 CX_reg(context
) = HIWORD(ticks
);
54 DX_reg(context
) = LOWORD(ticks
);
55 AX_reg(context
) = 0; /* No midnight rollover */
56 dprintf_int(stddeb
,"int1a_00 // ticks=%ld\n", ticks
);
61 bdtime
= localtime(<ime
);
63 CX_reg(context
) = (BIN_TO_BCD(bdtime
->tm_hour
)<<8) |
64 BIN_TO_BCD(bdtime
->tm_min
);
65 DX_reg(context
) = (BIN_TO_BCD(bdtime
->tm_sec
)<<8);
69 bdtime
= localtime(<ime
);
70 CX_reg(context
) = (BIN_TO_BCD(bdtime
->tm_year
/100)<<8) |
71 BIN_TO_BCD((bdtime
->tm_year
-1900)%100);
72 DX_reg(context
) = (BIN_TO_BCD(bdtime
->tm_mon
)<<8) |
73 BIN_TO_BCD(bdtime
->tm_mday
);
76 /* setting the time,date or RTC is not allow -EB */
90 INT_BARF( context
, 0x1a );