Fix filename terminator table, correct exclude_last value.
[wine] / dlls / winedos / int1a.c
1 /*
2  * BIOS interrupt 1ah handler
3  *
4  * Copyright 1993 Erik Bos
5  *
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.
10  *
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.
15  *
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
19  */
20
21 #include "config.h"
22 #include "miscemu.h"
23 #include "wine/debug.h"
24 #include "dosexe.h"
25
26 WINE_DEFAULT_DEBUG_CHANNEL(int);
27
28 #define BCD_TO_BIN(x) ((x&15) + (x>>4)*10)
29 #define BIN_TO_BCD(x) ((x%10) + ((x/10)<<4))
30
31
32 /**********************************************************************
33  *         DOSVM_Int1aHandler
34  *
35  * Handler for int 1ah.
36  */
37 void WINAPI DOSVM_Int1aHandler( CONTEXT86 *context )
38 {
39     switch(AH_reg(context))
40     {
41     case 0x00: /* GET SYSTEM TIME */
42         {
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 );
48         }
49         break;
50
51     case 0x01: /* SET SYSTEM TIME */
52         FIXME( "SET SYSTEM TIME - not allowed\n" );
53         break;
54
55     case 0x02: /* GET REAL-TIME CLOCK TIME */
56         TRACE( "GET REAL-TIME CLOCK TIME\n" );
57         {
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);
65         }
66         break;
67
68     case 0x03: /* SET REAL-TIME CLOCK TIME */
69         FIXME( "SET REAL-TIME CLOCK TIME - not allowed\n" );
70         break;
71
72     case 0x04: /* GET REAL-TIME CLOCK DATE */
73         TRACE( "GET REAL-TIME CLOCK DATE\n" );
74         {
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);
82         }
83         break;
84
85     case 0x05: /* SET REAL-TIME CLOCK DATE */
86         FIXME( "SET REAL-TIME CLOCK DATE - not allowed\n" );
87         break;
88
89     case 0x06: /* SET ALARM */
90         FIXME( "SET ALARM - unimplemented\n" );
91         break;
92
93     case 0x07: /* CANCEL ALARM */
94         FIXME( "CANCEL ALARM - unimplemented\n" );
95         break;
96
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;
107
108     case 0xb0:
109         if (CX_reg(context) == 0x4d52 && 
110             DX_reg(context) == 0x4349 && 
111             AL_reg(context) == 0x01)
112         {
113             /*
114              * Microsoft Real-Time Compression Interface (MRCI).
115              * Ignoring this call indicates MRCI is not supported.
116              */
117             TRACE( "Microsoft Real-Time Compression Interface - not supported\n" );
118         }
119         else
120         {
121             INT_BARF(context, 0x1a);
122         }
123         break;
124
125     default:
126         INT_BARF( context, 0x1a );
127     }
128 }