2001-12-04 20:54:44 +01:00
|
|
|
/*
|
|
|
|
* Emulation of processor ioports.
|
|
|
|
*
|
|
|
|
* Copyright 1995 Morten Welinder
|
|
|
|
* Copyright 1998 Andreas Mohr, Ove Kaaven
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* 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
|
2001-12-04 20:54:44 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
2001-12-04 20:54:44 +01:00
|
|
|
#include "windef.h"
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "winbase.h"
|
2001-12-04 20:54:44 +01:00
|
|
|
#include "dosexe.h"
|
|
|
|
#include "vga.h"
|
2002-06-25 00:57:28 +02:00
|
|
|
#include "wine/debug.h"
|
2001-12-04 20:54:44 +01:00
|
|
|
|
2002-06-25 00:57:28 +02:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(int);
|
2001-12-04 20:54:44 +01:00
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* DOSVM_inport
|
|
|
|
*/
|
|
|
|
BOOL WINAPI DOSVM_inport( int port, int size, DWORD *res )
|
|
|
|
{
|
|
|
|
switch (port)
|
|
|
|
{
|
|
|
|
case 0x60:
|
|
|
|
*res = DOSVM_Int09ReadScan(NULL);
|
|
|
|
break;
|
2002-05-16 20:34:48 +02:00
|
|
|
case 0x22a:
|
|
|
|
case 0x22c:
|
|
|
|
case 0x22e:
|
|
|
|
*res = (DWORD)SB_ioport_in( port );
|
|
|
|
break;
|
2001-12-04 20:54:44 +01:00
|
|
|
case 0x3ba:
|
2002-06-25 00:57:28 +02:00
|
|
|
case 0x3c0:
|
|
|
|
case 0x3c1:
|
|
|
|
case 0x3c2:
|
|
|
|
case 0x3c3:
|
|
|
|
case 0x3c4:
|
|
|
|
case 0x3c5:
|
|
|
|
case 0x3c6:
|
|
|
|
case 0x3c7:
|
|
|
|
case 0x3c8:
|
|
|
|
case 0x3c9:
|
|
|
|
case 0x3ca:
|
|
|
|
case 0x3cb:
|
|
|
|
case 0x3cc:
|
|
|
|
case 0x3cd:
|
|
|
|
case 0x3ce:
|
|
|
|
case 0x3cf:
|
|
|
|
case 0x3d0:
|
|
|
|
case 0x3d1:
|
|
|
|
case 0x3d2:
|
|
|
|
case 0x3d3:
|
|
|
|
case 0x3d4:
|
|
|
|
case 0x3d5:
|
|
|
|
case 0x3d6:
|
|
|
|
case 0x3d7:
|
|
|
|
case 0x3d8:
|
|
|
|
case 0x3d9:
|
2001-12-04 20:54:44 +01:00
|
|
|
case 0x3da:
|
2002-06-25 00:57:28 +02:00
|
|
|
case 0x3db:
|
|
|
|
case 0x3dc:
|
|
|
|
case 0x3dd:
|
|
|
|
case 0x3de:
|
|
|
|
case 0x3df:
|
|
|
|
if(size > 1)
|
|
|
|
FIXME("Trying to read more than one byte from VGA!\n");
|
2001-12-04 20:54:44 +01:00
|
|
|
*res = (DWORD)VGA_ioport_in( port );
|
|
|
|
break;
|
2002-05-16 20:34:48 +02:00
|
|
|
case 0x00:
|
|
|
|
case 0x01:
|
|
|
|
case 0x02:
|
|
|
|
case 0x03:
|
|
|
|
case 0x04:
|
|
|
|
case 0x05:
|
|
|
|
case 0x06:
|
|
|
|
case 0x07:
|
|
|
|
case 0xC0:
|
|
|
|
case 0xC2:
|
|
|
|
case 0xC4:
|
|
|
|
case 0xC6:
|
|
|
|
case 0xC8:
|
|
|
|
case 0xCA:
|
2002-06-01 01:06:46 +02:00
|
|
|
case 0xCC:
|
2002-05-16 20:34:48 +02:00
|
|
|
case 0xCE:
|
|
|
|
case 0x87:
|
|
|
|
case 0x83:
|
|
|
|
case 0x81:
|
|
|
|
case 0x82:
|
|
|
|
case 0x8B:
|
|
|
|
case 0x89:
|
|
|
|
case 0x8A:
|
|
|
|
case 0x487:
|
|
|
|
case 0x483:
|
|
|
|
case 0x481:
|
|
|
|
case 0x482:
|
|
|
|
case 0x48B:
|
|
|
|
case 0x489:
|
|
|
|
case 0x48A:
|
|
|
|
case 0x08:
|
|
|
|
case 0xD0:
|
|
|
|
case 0x0D:
|
|
|
|
case 0xDA:
|
|
|
|
*res = (DWORD)DMA_ioport_in( port );
|
|
|
|
break;
|
2001-12-04 20:54:44 +01:00
|
|
|
default:
|
|
|
|
return FALSE; /* not handled */
|
|
|
|
}
|
|
|
|
return TRUE; /* handled */
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* DOSVM_outport
|
|
|
|
*/
|
|
|
|
BOOL WINAPI DOSVM_outport( int port, int size, DWORD value )
|
|
|
|
{
|
|
|
|
switch (port)
|
|
|
|
{
|
|
|
|
case 0x20:
|
|
|
|
DOSVM_PIC_ioport_out( port, (BYTE)value );
|
|
|
|
break;
|
2002-06-01 01:06:46 +02:00
|
|
|
case 0x226:
|
2002-05-16 20:34:48 +02:00
|
|
|
case 0x22c:
|
|
|
|
SB_ioport_out( port, (BYTE)value );
|
|
|
|
break;
|
2002-06-25 00:57:28 +02:00
|
|
|
case 0x3c0:
|
|
|
|
case 0x3c1:
|
|
|
|
case 0x3c2:
|
|
|
|
case 0x3c3:
|
|
|
|
case 0x3c4:
|
|
|
|
case 0x3c5:
|
|
|
|
case 0x3c6:
|
|
|
|
case 0x3c7:
|
2001-12-04 20:54:44 +01:00
|
|
|
case 0x3c8:
|
|
|
|
case 0x3c9:
|
2002-06-25 00:57:28 +02:00
|
|
|
case 0x3ca:
|
|
|
|
case 0x3cb:
|
|
|
|
case 0x3cc:
|
|
|
|
case 0x3cd:
|
|
|
|
case 0x3ce:
|
|
|
|
case 0x3cf:
|
|
|
|
case 0x3d0:
|
|
|
|
case 0x3d1:
|
|
|
|
case 0x3d2:
|
|
|
|
case 0x3d3:
|
|
|
|
case 0x3d4:
|
|
|
|
case 0x3d5:
|
|
|
|
case 0x3d6:
|
|
|
|
case 0x3d7:
|
|
|
|
case 0x3d8:
|
|
|
|
case 0x3d9:
|
|
|
|
case 0x3da:
|
|
|
|
case 0x3db:
|
|
|
|
case 0x3dc:
|
|
|
|
case 0x3dd:
|
|
|
|
case 0x3de:
|
|
|
|
case 0x3df:
|
2002-07-30 01:29:03 +02:00
|
|
|
VGA_ioport_out( port, LOBYTE(value) );
|
|
|
|
if(size > 1) {
|
|
|
|
VGA_ioport_out( port+1, HIBYTE(value) );
|
|
|
|
if(size > 2) {
|
|
|
|
VGA_ioport_out( port+2, LOBYTE(HIWORD(value)) );
|
|
|
|
VGA_ioport_out( port+3, HIBYTE(HIWORD(value)) );
|
|
|
|
}
|
|
|
|
}
|
2001-12-04 20:54:44 +01:00
|
|
|
break;
|
2002-05-16 20:34:48 +02:00
|
|
|
case 0x00:
|
|
|
|
case 0x01:
|
|
|
|
case 0x02:
|
|
|
|
case 0x03:
|
|
|
|
case 0x04:
|
|
|
|
case 0x05:
|
|
|
|
case 0x06:
|
|
|
|
case 0x07:
|
|
|
|
case 0xC0:
|
|
|
|
case 0xC2:
|
|
|
|
case 0xC4:
|
|
|
|
case 0xC6:
|
|
|
|
case 0xC8:
|
|
|
|
case 0xCA:
|
2002-06-01 01:06:46 +02:00
|
|
|
case 0xCC:
|
2002-05-16 20:34:48 +02:00
|
|
|
case 0xCE:
|
|
|
|
case 0x87:
|
|
|
|
case 0x83:
|
|
|
|
case 0x81:
|
|
|
|
case 0x82:
|
|
|
|
case 0x8B:
|
|
|
|
case 0x89:
|
|
|
|
case 0x8A:
|
|
|
|
case 0x487:
|
|
|
|
case 0x483:
|
|
|
|
case 0x481:
|
|
|
|
case 0x482:
|
|
|
|
case 0x48B:
|
|
|
|
case 0x489:
|
|
|
|
case 0x48A:
|
|
|
|
case 0x08:
|
|
|
|
case 0xD0:
|
|
|
|
case 0x0B:
|
|
|
|
case 0xD6:
|
|
|
|
case 0x0A:
|
|
|
|
case 0xD4:
|
|
|
|
case 0x0F:
|
|
|
|
case 0xDE:
|
|
|
|
case 0x09:
|
|
|
|
case 0xD2:
|
|
|
|
case 0x0C:
|
|
|
|
case 0xD8:
|
|
|
|
case 0x0D:
|
|
|
|
case 0xDA:
|
|
|
|
case 0x0E:
|
|
|
|
case 0xDC:
|
|
|
|
DMA_ioport_out( port, (BYTE)value );
|
|
|
|
break;
|
2001-12-04 20:54:44 +01:00
|
|
|
default:
|
|
|
|
return FALSE; /* not handled */
|
|
|
|
}
|
|
|
|
return TRUE; /* handled */
|
|
|
|
}
|