2 * BIOS interrupt 1ah handler
4 * Copyright 1993 Erik Bos
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include "wine/debug.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(int);
30 #define BCD_TO_BIN(x) ((x&15) + (x>>4)*10)
31 #define BIN_TO_BCD(x) ((x%10) + ((x/10)<<4))
34 /**********************************************************************
35 * INT1A_GetTicksSinceMidnight
37 * Return number of clock ticks since midnight.
39 DWORD INT1A_GetTicksSinceMidnight(void)
45 /* This should give us the (approximately) correct
46 * 18.206 clock ticks per second since midnight.
48 gettimeofday( &tvs, NULL );
50 bdtime = localtime( &seconds );
51 return (((bdtime->tm_hour * 3600 + bdtime->tm_min * 60 +
52 bdtime->tm_sec) * 18206) / 1000) +
53 (tvs.tv_usec / 54927);
57 /**********************************************************************
58 * INT_Int1aHandler (WPROCS.126)
61 * 0x00 - 0x07 - date and time
62 * 0x?? - 0x?? - Microsoft Real Time Compression Interface
64 void WINAPI INT_Int1aHandler( CONTEXT86 *context )
70 switch(AH_reg(context))
73 ticks = INT1A_GetTicksSinceMidnight();
74 CX_reg(context) = HIWORD(ticks);
75 DX_reg(context) = LOWORD(ticks);
76 AX_reg(context) = 0; /* No midnight rollover */
77 TRACE("int1a: AH=00 -- ticks=%ld\n", ticks);
82 bdtime = localtime(<ime);
84 CX_reg(context) = (BIN_TO_BCD(bdtime->tm_hour)<<8) |
85 BIN_TO_BCD(bdtime->tm_min);
86 DX_reg(context) = (BIN_TO_BCD(bdtime->tm_sec)<<8);
90 bdtime = localtime(<ime);
91 CX_reg(context) = (BIN_TO_BCD(bdtime->tm_year/100)<<8) |
92 BIN_TO_BCD((bdtime->tm_year-1900)%100);
93 DX_reg(context) = (BIN_TO_BCD(bdtime->tm_mon)<<8) |
94 BIN_TO_BCD(bdtime->tm_mday);
97 /* setting the time,date or RTC is not allow -EB */
110 case 0xb0: /* Microsoft Real Time Compression */
111 switch AL_reg(context)
117 INT_BARF(context, 0x1a);
122 INT_BARF( context, 0x1a );