int15.c 4.92 KB
Newer Older
Alexandre Julliard's avatar
Alexandre Julliard committed
1 2
/*
 * BIOS interrupt 15h handler
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
 *
 * Copyright 1997 Jan Willamowius
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
Alexandre Julliard's avatar
Alexandre Julliard committed
19 20 21
 */

#include <stdlib.h>
22
#include "dosexe.h"
23
#include "wine/debug.h"
24
#include "wine/winbase16.h"
Alexandre Julliard's avatar
Alexandre Julliard committed
25

26
WINE_DEFAULT_DEBUG_CHANNEL(int);
27

Alexandre Julliard's avatar
Alexandre Julliard committed
28 29

/**********************************************************************
30
 *	    DOSVM_Int15Handler (WINEDOS16.121)
Alexandre Julliard's avatar
Alexandre Julliard committed
31
 *
32
 * Handler for int 15h
Alexandre Julliard's avatar
Alexandre Julliard committed
33
 */
34
void WINAPI DOSVM_Int15Handler( CONTEXT86 *context )
Alexandre Julliard's avatar
Alexandre Julliard committed
35 36 37
{
    switch(AH_reg(context))
    {
38
    case 0x4f: /*catch keyboard*/
39 40
        FIXME("INT15: intercept keyboard not handled yet\n");
        break;
41 42 43 44 45 46 47 48 49 50 51
    case 0x83: /* start timer*/
        switch(AL_reg(context))
        {
        case 0x00: /* Start Timer*/
            FIXME("INT15: Start Timer not handled yet\n");
            break;
        case 0x01: /* stop  timer*/
            FIXME("INT15: Stop Timer not handled yet\n");
            break;
        }
        break;
52 53 54 55 56 57 58
    case 0x84: /* read joystick information */
        FIXME("Read joystick information not implemented\n");

        /* FIXME: report status as if no game port exists */
        switch(DX_reg(context))
        {
        case 0x0: /* read joystick switches */
59
            SET_AL( context, 0x0 ); /* all switches open */
60 61
            break;
        case 0x1: /* read joystick position */
62 63 64 65
            SET_AX( context, 0x0 );
            SET_BX( context, 0x0 );
            SET_CX( context, 0x0 );
            SET_DX( context, 0x0 );
66 67 68 69 70 71 72 73
            break;
	default:
            INT_BARF( context, 0x15 );
            break;
        }

        RESET_CFLAG(context);
        break;
74 75 76 77 78 79 80 81 82 83
    case 0x85: /* sysreq - key  used*/
        FIXME("INT15: SysReq - Key not handled yet\n");
        break;
    case 0x86: /* wait*/
        FIXME("INT15: Wait not correctly handled yet\n");
        if ( AL_reg( context ) != 0x00 ) ERR("Invalid Input to Int15 function 0x86h AL != 0x00 \n");
        break;
    case 0x87: /* move memory regions*/
        FIXME("INT15: Move memory regions not implemented\n");
        break;
84

Alexandre Julliard's avatar
Alexandre Julliard committed
85
    case 0x88: /* get size of memory above 1 M */
86
        SET_AX( context, 64 );  /* FIXME: are 64K ok? */
Alexandre Julliard's avatar
Alexandre Julliard committed
87 88
        RESET_CFLAG(context);
        break;
89 90 91 92 93 94 95 96 97
    case 0x89: /*  Switch to protected mode*/
        FIXME("INT15: switching to protected mode not supported\n");
        break;
    case 0x90:/* OS hook  - Device busy*/
        FIXME("INT15: OS hook - device busy\n");
        break;
    case 0x91: /* OS hook -  Device post*/
        FIXME("INT15: OS hook - device post\n");
        break;
Alexandre Julliard's avatar
Alexandre Julliard committed
98

99
    case 0xc0: /* GET CONFIGURATION */
100 101 102
        if (ISV86(context))
        {
            /* real mode segment */
103
            context->SegEs = 0xf000;
104
        }
105
        else
106 107 108 109 110 111
        {
            /* KERNEL.194: __F000H - protected mode selector */
            FARPROC16 proc = GetProcAddress16( GetModuleHandle16("KERNEL"),
                                               (LPCSTR)(ULONG_PTR)194 );
            context->SegEs = LOWORD(proc);
        }
112 113
        SET_BX( context, 0xe6f5 );
        SET_AH( context, 0x0 );
114 115
        RESET_CFLAG(context);
        break;
116

117 118 119 120 121
    case 0xc2:
	switch(AL_reg(context))
	{
	case 0x00: /* Enable-Disable Pointing Device (mouse) */
	    /* BH = newstate, 00h = disabled 01h = enabled */
122
	    switch(BH_reg(context))
123 124
	    {
	        case 0x00:
125
	    	    FIXME("Disable Pointing Device - not implemented\n");
126 127
		    break;
	    	case 0x01:
128
	    	    FIXME("Enable Pointing Device - not implemented\n");
129 130 131 132 133
		    break;
	    	default:
		    INT_BARF( context, 0x15 );
		    break;
	    }
134
	    SET_AH( context, 0x00 ); /* successful */
135 136 137
	    break;
	case 0x02: /* Set Sampling Rate */
	    /* BH = sampling rate */
138
	    FIXME("Set Sampling Rate - not implemented\n");
139
	    SET_AH( context, 0x00 ); /* successful */
140 141
	    break;
	case 0x04: /* Get Pointing Device Type */
142
	    FIXME("Get Pointing Device Type - not implemented\n");
143 144
            /* FIXME: BH = Device id, What is it supposed to be? */
	    SET_BH( context, 0x01 );
145 146 147 148 149
	    break;
	default:
	    INT_BARF( context, 0x15 );
	}
        break;
150 151 152 153 154 155 156
    case 0xc3: /* set carry flag, so BorlandRTM doesn't  assume a Vectra/PS2*/
	FIXME("INT15: 0xc3\n");
	SET_AH( context , 0x86 );
	break;
    case 0xc4: /*  BIOS POS Programm option select  */
	FIXME("INT15: option 0xc4 not handled!\n");
	break;
157

Alexandre Julliard's avatar
Alexandre Julliard committed
158 159 160 161
    default:
        INT_BARF( context, 0x15 );
    }
}