Use correct linear pointer when accessing BIOS data area.
[wine/multimedia.git] / dlls / winedos / int1a.c
blob27f30938ffbf43479f015b4d08e15e9603d135cf
1 /*
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
21 #include "config.h"
22 #include "miscemu.h"
23 #include "wine/debug.h"
24 #include "dosexe.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(int);
28 #define BCD_TO_BIN(x) ((x&15) + (x>>4)*10)
29 #define BIN_TO_BCD(x) ((x%10) + ((x/10)<<4))
32 /**********************************************************************
33 * DOSVM_Int1aHandler
35 * Handler for int 1ah.
37 void WINAPI DOSVM_Int1aHandler( CONTEXT86 *context )
39 switch(AH_reg(context))
41 case 0x00: /* GET SYSTEM TIME */
43 BIOSDATA *data = DOSVM_BiosData();
44 SET_CX( context, HIWORD(data->Ticks) );
45 SET_DX( context, LOWORD(data->Ticks) );
46 SET_AL( context, 0 ); /* FIXME: midnight flag is unsupported */
47 TRACE( "GET SYSTEM TIME - ticks=%ld\n", data->Ticks );
49 break;
51 case 0x01: /* SET SYSTEM TIME */
52 FIXME( "SET SYSTEM TIME - not allowed\n" );
53 break;
55 case 0x02: /* GET REAL-TIME CLOCK TIME */
56 TRACE( "GET REAL-TIME CLOCK TIME\n" );
58 SYSTEMTIME systime;
59 GetLocalTime( &systime );
60 SET_CH( context, BIN_TO_BCD(systime.wHour) );
61 SET_CL( context, BIN_TO_BCD(systime.wMinute) );
62 SET_DH( context, BIN_TO_BCD(systime.wSecond) );
63 SET_DL( context, 0 ); /* FIXME: assume no daylight saving */
64 RESET_CFLAG(context);
66 break;
68 case 0x03: /* SET REAL-TIME CLOCK TIME */
69 FIXME( "SET REAL-TIME CLOCK TIME - not allowed\n" );
70 break;
72 case 0x04: /* GET REAL-TIME CLOCK DATE */
73 TRACE( "GET REAL-TIME CLOCK DATE\n" );
75 SYSTEMTIME systime;
76 GetLocalTime( &systime );
77 SET_CH( context, BIN_TO_BCD(systime.wYear / 100) );
78 SET_CL( context, BIN_TO_BCD(systime.wYear % 100) );
79 SET_DH( context, BIN_TO_BCD(systime.wMonth) );
80 SET_DL( context, BIN_TO_BCD(systime.wDay) );
81 RESET_CFLAG(context);
83 break;
85 case 0x05: /* SET REAL-TIME CLOCK DATE */
86 FIXME( "SET REAL-TIME CLOCK DATE - not allowed\n" );
87 break;
89 case 0x06: /* SET ALARM */
90 FIXME( "SET ALARM - unimplemented\n" );
91 break;
93 case 0x07: /* CANCEL ALARM */
94 FIXME( "CANCEL ALARM - unimplemented\n" );
95 break;
97 case 0x08: /* SET RTC ACTIVATED POWER ON MODE */
98 case 0x09: /* READ RTC ALARM TIME AND STATUS */
99 case 0x0a: /* READ SYSTEM-TIMER DAY COUNTER */
100 case 0x0b: /* SET SYSTEM-TIMER DAY COUNTER */
101 case 0x0c: /* SET RTC DATE/TIME ACTIVATED POWER-ON MODE */
102 case 0x0d: /* RESET RTC DATE/TIME ACTIVATED POWER-ON MODE */
103 case 0x0e: /* GET RTC DATE/TIME ALARM AND STATUS */
104 case 0x0f: /* INITIALIZE REAL-TIME CLOCK */
105 INT_BARF( context, 0x1a );
106 break;
108 case 0xb0:
109 if (CX_reg(context) == 0x4d52 &&
110 DX_reg(context) == 0x4349 &&
111 AL_reg(context) == 0x01)
114 * Microsoft Real-Time Compression Interface (MRCI).
115 * Ignoring this call indicates MRCI is not supported.
117 TRACE( "Microsoft Real-Time Compression Interface - not supported\n" );
119 else
121 INT_BARF(context, 0x1a);
123 break;
125 default:
126 INT_BARF( context, 0x1a );