2 * BIOS interrupt 1ah handler
10 #include "debugtools.h"
12 DEFAULT_DEBUG_CHANNEL(int);
14 #define BCD_TO_BIN(x) ((x&15) + (x>>4)*10)
15 #define BIN_TO_BCD(x) ((x%10) + ((x/10)<<4))
18 /**********************************************************************
19 * INT1A_GetTicksSinceMidnight
21 * Return number of clock ticks since midnight.
23 DWORD
INT1A_GetTicksSinceMidnight(void)
29 /* This should give us the (approximately) correct
30 * 18.206 clock ticks per second since midnight.
32 gettimeofday( &tvs
, NULL
);
34 bdtime
= localtime( &seconds
);
35 return (((bdtime
->tm_hour
* 3600 + bdtime
->tm_min
* 60 +
36 bdtime
->tm_sec
) * 18206) / 1000) +
37 (tvs
.tv_usec
/ 54927);
41 /**********************************************************************
45 * 0x00 - 0x07 - date and time
46 * 0x?? - 0x?? - Microsoft Real Time Compression Interface
48 void WINAPI
INT_Int1aHandler( CONTEXT86
*context
)
54 switch(AH_reg(context
))
57 ticks
= INT1A_GetTicksSinceMidnight();
58 CX_reg(context
) = HIWORD(ticks
);
59 DX_reg(context
) = LOWORD(ticks
);
60 AX_reg(context
) = 0; /* No midnight rollover */
61 TRACE("int1a: AH=00 -- ticks=%ld\n", ticks
);
66 bdtime
= localtime(<ime
);
68 CX_reg(context
) = (BIN_TO_BCD(bdtime
->tm_hour
)<<8) |
69 BIN_TO_BCD(bdtime
->tm_min
);
70 DX_reg(context
) = (BIN_TO_BCD(bdtime
->tm_sec
)<<8);
74 bdtime
= localtime(<ime
);
75 CX_reg(context
) = (BIN_TO_BCD(bdtime
->tm_year
/100)<<8) |
76 BIN_TO_BCD((bdtime
->tm_year
-1900)%100);
77 DX_reg(context
) = (BIN_TO_BCD(bdtime
->tm_mon
)<<8) |
78 BIN_TO_BCD(bdtime
->tm_mday
);
81 /* setting the time,date or RTC is not allow -EB */
94 case 0xb0: /* Microsoft Real Time Compression */
95 switch AL_reg(context
)
101 INT_BARF(context
, 0x1a);
106 INT_BARF( context
, 0x1a );