10 /* #define DEBUG_INT */
13 #define BCD_TO_BIN(x) ((x&15) + (x>>4)*10)
14 #define BIN_TO_BCD(x) ((x%10) + ((x/10)<<4))
17 /**********************************************************************
18 * INT1A_GetTicksSinceMidnight
20 * Return number of clock ticks since midnight.
22 DWORD
INT1A_GetTicksSinceMidnight(void)
28 /* This should give us the (approximately) correct
29 * 18.206 clock ticks per second since midnight.
31 gettimeofday( &tvs
, NULL
);
33 bdtime
= localtime( &seconds
);
34 return (((bdtime
->tm_hour
* 3600 + bdtime
->tm_min
* 60 +
35 bdtime
->tm_sec
) * 18206) / 1000) +
36 (tvs
.tv_usec
/ 54927);
40 /**********************************************************************
43 * Handler for int 1ah (date and time).
45 void INT_Int1aHandler( struct sigcontext_struct context
)
51 switch(AH_reg(&context
))
54 ticks
= INT1A_GetTicksSinceMidnight();
55 CX_reg(&context
) = HIWORD(ticks
);
56 DX_reg(&context
) = LOWORD(ticks
);
57 AX_reg(&context
) = 0; /* No midnight rollover */
58 dprintf_int(stddeb
,"int1a_00 // ticks=%ld\n", ticks
);
63 bdtime
= localtime(<ime
);
65 CX_reg(&context
) = (BIN_TO_BCD(bdtime
->tm_hour
)<<8) |
66 BIN_TO_BCD(bdtime
->tm_min
);
67 DX_reg(&context
) = (BIN_TO_BCD(bdtime
->tm_sec
)<<8);
71 bdtime
= localtime(<ime
);
72 CX_reg(&context
) = (BIN_TO_BCD(bdtime
->tm_year
/100)<<8) |
73 BIN_TO_BCD((bdtime
->tm_year
-1900)%100);
74 DX_reg(&context
) = (BIN_TO_BCD(bdtime
->tm_mon
)<<8) |
75 BIN_TO_BCD(bdtime
->tm_mday
);
78 /* setting the time,date or RTC is not allow -EB */
92 INT_BARF( &context
, 0x1a );