- CL-GD 54xx SVGA emulation added (SF patch #869822 from m_suzu_abc@yahoo.co.jp)

- changes to the original svga_cirrus patch:
  * PCI memory/mmio PnP support, some emulation and compile fixes
  * ported write mode 4 + 5 and some bufixes from cirrus vga in qemu
  * new graphics API, hardware cursor support, configure option added (Robin Kay)
  * partial support for transparent bitblt and bitblt write mask
This commit is contained in:
Volker Ruppert 2004-08-16 08:07:23 +00:00
parent c2b7f183af
commit 45ccb97021
9 changed files with 3924 additions and 85 deletions

View File

@ -60,6 +60,7 @@ Changes to next release:
- vga
- VBE 8 bit DAC support added
- VBE memory now registered using DEV_register_memory_handlers()
- CL-GD 54xx SVGA emulation added (Makato Suzuki)
- floppy
- raw floppy access now works on Win9x host (Ben Lunt)
@ -83,6 +84,7 @@ Changes to next release:
rfb: timeout (time to wait for client connection)
sdl: fullscreen (startup in fullscreen mode)
win32: legacyF12 (use F12 to toggle mouse)
- new graphics update API added (used by svga_cirrus) (Robin Kay)
- configuration interface
- win32: gui runtime dialogs replace textconfig runtime dialogs
@ -106,6 +108,7 @@ Changes to next release:
[903332] copy the bximage result to clipboard, etc by Lukewarm
[950905] Do not PANIC on rare, bad input from user-mode by h.johansson
[924428] ET bit mismatch between CR0 and MSW
[869822] a real SVGA implementation by m_suzu
- these S.F. bugs were closed
#477043 math_abort panic in RH 7.1

View File

@ -266,6 +266,7 @@
#define BX_USE_NE2K_SMF 1 // NE2K
#define BX_USE_EFI_SMF 1 // External FPU IRQ
#define BX_USE_GAME_SMF 1 // Gameport
#define BX_USE_CIRRUS_SMF 1 // SVGA Cirrus
#define BX_PLUGINS 0
#define BX_HAVE_DLFCN_H 0
@ -279,7 +280,7 @@
|| !BX_USE_P2I_SMF || !BX_USE_PCIVGA_SMF || !BX_USE_PCIUSB_SMF \
|| !BX_USE_PCIPNIC_SMF || !BX_USE_PIDE_SMF \
|| !BX_USE_NE2K_SMF || !BX_USE_EFI_SMF || !BX_USE_GAME_SMF \
|| !BX_USE_PCIDEV_SMF)
|| !BX_USE_PCIDEV_SMF || !BX_USE_CIRRUS_SMF)
#error You must use SMF to have plugins
#endif
@ -679,8 +680,6 @@ typedef
#define BX_PROVIDE_CPU_MEMORY 1
#define BX_PROVIDE_DEVICE_MODELS 1
#define BX_SUPPORT_VBE 0
#define BX_PROVIDE_MAIN 1
#define BX_INSTRUMENTATION 0
@ -696,8 +695,19 @@ typedef
// limited i440FX PCI support
#define BX_SUPPORT_PCI 0
// Bochs VBE display interface
#define BX_SUPPORT_VBE 0
// CLGD54XX emulation
#define BX_SUPPORT_CLGD54XX 0
// CLGD54XX PCI emulation
#define BX_SUPPORT_CLGD54XX_PCI 1
// Experimental VGA on PCI
#if !(BX_SUPPORT_CLGD54XX && BX_SUPPORT_CLGD54XX_PCI)
#define BX_SUPPORT_PCIVGA 1
#endif
// Experimental host PCI device mapping
#define BX_SUPPORT_PCIDEV 0

105
bochs/configure vendored
View File

@ -1,5 +1,5 @@
#! /bin/sh
# From configure.in Id: configure.in,v 1.259 2004/08/11 11:05:10 vruppert Exp .
# From configure.in Id: configure.in,v 1.260 2004/08/16 08:02:14 vruppert Exp .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.57.
#
@ -1071,6 +1071,7 @@ Optional Features:
--enable-time0=n start at n instead of using time()
--enable-raw-serial use raw serial port access
--enable-vbe use VESA BIOS extensions
--enable-clgd54xx enable CLGD54XX emulation
--enable-fpu compile in FPU emulation
--enable-mmx MMX support
--enable-3dnow 3DNow! support
@ -3537,7 +3538,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
echo '#line 3540 "configure"' > conftest.$ac_ext
echo '#line 3541 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@ -4612,7 +4613,7 @@ fi
# Provide some information about the compiler.
echo "$as_me:4615:" \
echo "$as_me:4616:" \
"checking for Fortran 77 compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2`
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
@ -5628,11 +5629,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:5631: $lt_compile\"" >&5)
(eval echo "\"\$as_me:5632: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:5635: \$? = $ac_status" >&5
echo "$as_me:5636: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@ -5861,11 +5862,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:5864: $lt_compile\"" >&5)
(eval echo "\"\$as_me:5865: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:5868: \$? = $ac_status" >&5
echo "$as_me:5869: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@ -5928,11 +5929,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:5931: $lt_compile\"" >&5)
(eval echo "\"\$as_me:5932: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:5935: \$? = $ac_status" >&5
echo "$as_me:5936: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -7988,7 +7989,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 7991 "configure"
#line 7992 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -8086,7 +8087,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 8089 "configure"
#line 8090 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -10245,11 +10246,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:10248: $lt_compile\"" >&5)
(eval echo "\"\$as_me:10249: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:10252: \$? = $ac_status" >&5
echo "$as_me:10253: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@ -10312,11 +10313,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:10315: $lt_compile\"" >&5)
(eval echo "\"\$as_me:10316: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:10319: \$? = $ac_status" >&5
echo "$as_me:10320: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -11569,7 +11570,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 11572 "configure"
#line 11573 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -11667,7 +11668,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 11670 "configure"
#line 11671 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -12490,11 +12491,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:12493: $lt_compile\"" >&5)
(eval echo "\"\$as_me:12494: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:12497: \$? = $ac_status" >&5
echo "$as_me:12498: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@ -12557,11 +12558,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:12560: $lt_compile\"" >&5)
(eval echo "\"\$as_me:12561: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:12564: \$? = $ac_status" >&5
echo "$as_me:12565: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -14551,11 +14552,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:14554: $lt_compile\"" >&5)
(eval echo "\"\$as_me:14555: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:14558: \$? = $ac_status" >&5
echo "$as_me:14559: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@ -14784,11 +14785,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:14787: $lt_compile\"" >&5)
(eval echo "\"\$as_me:14788: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:14791: \$? = $ac_status" >&5
echo "$as_me:14792: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@ -14851,11 +14852,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:14854: $lt_compile\"" >&5)
(eval echo "\"\$as_me:14855: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:14858: \$? = $ac_status" >&5
echo "$as_me:14859: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -16911,7 +16912,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 16914 "configure"
#line 16915 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -17009,7 +17010,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 17012 "configure"
#line 17013 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -19166,7 +19167,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 19169 "configure"
#line 19170 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -33538,6 +33539,7 @@ echo "${ECHO_T}yes" >&6
#define BX_SUPPORT_VBE 1
_ACEOF
bx_support_vbe=1
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
@ -33545,6 +33547,7 @@ echo "${ECHO_T}no" >&6
#define BX_SUPPORT_VBE 0
_ACEOF
bx_support_vbe=0
fi
else
@ -33554,10 +33557,52 @@ echo "${ECHO_T}no" >&6
#define BX_SUPPORT_VBE 0
_ACEOF
bx_support_vbe=0
fi;
echo "$as_me:$LINENO: checking for CLGD54XX emulation" >&5
echo $ECHO_N "checking for CLGD54XX emulation... $ECHO_C" >&6
# Check whether --enable-clgd54xx or --disable-clgd54xx was given.
if test "${enable_clgd54xx+set}" = set; then
enableval="$enable_clgd54xx"
if test "$enableval" = yes; then
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
cat >>confdefs.h <<\_ACEOF
#define BX_SUPPORT_CLGD54XX 1
_ACEOF
bx_support_clgd54xx=1
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
cat >>confdefs.h <<\_ACEOF
#define BX_SUPPORT_CLGD54XX 0
_ACEOF
bx_support_clgd54xx=0
fi
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
cat >>confdefs.h <<\_ACEOF
#define BX_SUPPORT_CLGD54XX 0
_ACEOF
bx_support_clgd54xx=0
fi;
if test "$bx_support_vbe" = 1 && test "$bx_suppot_clgd54xx" = 1; then
{ { echo "$as_me:$LINENO: error: --enable-vbe and --enable-clgd54xx are mutually exclusive" >&5
echo "$as_me: error: --enable-vbe and --enable-clgd54xx are mutually exclusive" >&2;}
{ (exit 1); exit 1; }; }
fi
support_fpu=1
echo "$as_me:$LINENO: checking for FPU emulation" >&5
echo $ECHO_N "checking for FPU emulation... $ECHO_C" >&6

View File

@ -2,7 +2,7 @@ dnl // Process this file with autoconf to produce a configure script.
AC_PREREQ(2.50)
AC_INIT(bochs.h)
AC_REVISION([[$Id: configure.in,v 1.259 2004-08-11 11:05:10 vruppert Exp $]])
AC_REVISION([[$Id: configure.in,v 1.260 2004-08-16 08:02:14 vruppert Exp $]])
AC_CONFIG_HEADER(config.h)
AC_CONFIG_HEADER(ltdlconf.h)
@ -1484,16 +1484,42 @@ AC_ARG_ENABLE(vbe,
[if test "$enableval" = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE(BX_SUPPORT_VBE, 1)
bx_support_vbe=1
else
AC_MSG_RESULT(no)
AC_DEFINE(BX_SUPPORT_VBE, 0)
bx_support_vbe=0
fi],
[
AC_MSG_RESULT(no)
AC_DEFINE(BX_SUPPORT_VBE, 0)
bx_support_vbe=0
]
)
AC_MSG_CHECKING(for CLGD54XX emulation)
AC_ARG_ENABLE(clgd54xx,
[ --enable-clgd54xx enable CLGD54XX emulation],
[if test "$enableval" = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE(BX_SUPPORT_CLGD54XX, 1)
bx_support_clgd54xx=1
else
AC_MSG_RESULT(no)
AC_DEFINE(BX_SUPPORT_CLGD54XX, 0)
bx_support_clgd54xx=0
fi],
[
AC_MSG_RESULT(no)
AC_DEFINE(BX_SUPPORT_CLGD54XX, 0)
bx_support_clgd54xx=0
]
)
if test "$bx_support_vbe" = 1 && test "$bx_suppot_clgd54xx" = 1; then
AC_MSG_ERROR([[--enable-vbe and --enable-clgd54xx are mutually exclusive]])
fi
support_fpu=1
AC_MSG_CHECKING(for FPU emulation)
FPU_VAR=''

View File

@ -95,6 +95,7 @@ OBJS_THAT_CAN_BE_PLUGINS = \
OBJS_THAT_SUPPORT_OTHER_PLUGINS = \
scancodes.o \
serial_raw.o \
svga_cirrus.o \
vmware3.o \
$(CDROM_OBJS) \
$(SOUNDLOW_OBJS) \
@ -148,6 +149,9 @@ libbx_ne2k.la: ne2k.lo $(NETLOW_OBJS:.o=.lo)
libbx_serial.la: serial.lo serial_raw.lo
$(LIBTOOL) --mode=link $(CXX) -module serial.lo serial_raw.lo -o libbx_serial.la -rpath $(PLUGIN_PATH)
libbx_vga.la: vga.lo svga_cirrus.lo
$(LIBTOOL) --mode=link $(CXX) -module vga.lo svga_cirrus.lo -o libbx_vga.la -rpath $(PLUGIN_PATH)
#### building DLLs for win32 (tested on cygwin only)
bx_%.dll: %.o
$(CXX) $(CXXFLAGS) -shared -o $@ $< $(WIN32_DLL_IMPORT_LIBRARY)
@ -174,6 +178,9 @@ bx_gameport.dll: gameport.o
bx_serial.dll: serial.o serial_raw.o
$(CXX) $(CXXFLAGS) -shared -o bx_serial.dll serial.o serial_raw.o $(WIN32_DLL_IMPORT_LIBRARY)
bx_vga.dll: vga.o svga_cirrus.o
$(CXX) $(CXXFLAGS) -shared -o bx_vga.dll vga.o svga_cirrus.o $(WIN32_DLL_IMPORT_LIBRARY)
##### end DLL section
clean:
@ -810,7 +817,7 @@ unmapped.o: unmapped.@CPP_SUFFIX@ ../bochs.h ../config.h ../osdep.h \
../iodev/soundwin.h ../iodev/unmapped.h ../iodev/eth.h ../iodev/ne2k.h \
../iodev/guest2host.h ../iodev/slowdown_timer.h ../iodev/extfpuirq.h \
../iodev/gameport.h ../instrument/stubs/instrument.h
vga.o: vga.@CPP_SUFFIX@ ../bochs.h ../config.h ../osdep.h ../bx_debug/debug.h \
vga.o svga_cirrus.o: vga.@CPP_SUFFIX@ svga_cirrus.@CPP_SUFFIX@ ../bochs.h ../config.h ../osdep.h ../bx_debug/debug.h \
../bxversion.h ../gui/siminterface.h ../state_file.h ../cpu/cpu.h \
../cpu/lazy_flags.h ../cpu/i387.h ../memory/memory.h ../pc_system.h \
../plugin.h ../extplugin.h ../ltdl.h ../gui/gui.h ../gui/textconfig.h \

3446
bochs/iodev/svga_cirrus.cc Normal file

File diff suppressed because it is too large Load Diff

262
bochs/iodev/svga_cirrus.h Normal file
View File

@ -0,0 +1,262 @@
/////////////////////////////////////////////////////////////////////////
// $Id: svga_cirrus.h,v 1.1 2004-08-16 08:03:46 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2004 Makoto Suzuki (suzu)
// Volker Ruppert (vruppert)
// Robin Kay (komadori)
//
// 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 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
#if BX_SUPPORT_CLGD54XX
#if BX_USE_CIRRUS_SMF
# define BX_CIRRUS_SMF static
# define BX_CIRRUS_THIS theSvga->
# define BX_CIRRUS_THIS_PTR theSvga
#else
# define BX_CIRRUS_SMF
# define BX_CIRRUS_THIS this->
# define BX_CIRRUS_THIS_PTR this
#endif // BX_USE_CIRRUS_SMF
// 0x3b4,0x3d4
#define VGA_CRTC_MAX 0x18
#define CIRRUS_CRTC_MAX 0x27
// 0x3c4
#define VGA_SEQENCER_MAX 0x04
#define CIRRUS_SEQENCER_MAX 0x1f
// 0x3ce
#define VGA_CONTROL_MAX 0x08
#define CIRRUS_CONTROL_MAX 0x39
// Size of internal cache memory for bitblt. (must be >= 256 and 4-byte aligned)
#define CIRRUS_BLT_CACHESIZE (2048 * 4)
#if BX_SUPPORT_PCI && BX_SUPPORT_CLGD54XX_PCI
#define CIRRUS_VIDEO_MEMORY_MB 4
#else
#define CIRRUS_VIDEO_MEMORY_MB 2
#endif
#define CIRRUS_VIDEO_MEMORY_KB (CIRRUS_VIDEO_MEMORY_MB * 1024)
#define CIRRUS_VIDEO_MEMORY_BYTES (CIRRUS_VIDEO_MEMORY_KB * 1024)
typedef void (*bx_cirrus_bitblt_rop_t)(
Bit8u *dst,const Bit8u *src,
int dstpitch,int srcpitch,
int bltwidth,int bltheight);
class bx_svga_cirrus_c : public bx_vga_c {
public:
bx_svga_cirrus_c(void);
~bx_svga_cirrus_c();
virtual void init(void);
virtual void reset(unsigned type);
virtual void redraw_area(unsigned x0, unsigned y0,
unsigned width, unsigned height);
virtual Bit8u mem_read(Bit32u addr);
virtual void mem_write(Bit32u addr, Bit8u value);
virtual void mem_write_mode4and5_8bpp(Bit8u mode, Bit32u offset, Bit8u value);
virtual void mem_write_mode4and5_16bpp(Bit8u mode, Bit32u offset, Bit8u value);
virtual void get_text_snapshot(Bit8u **text_snapshot,
unsigned *txHeight, unsigned *txWidth);
virtual void trigger_timer(void *this_ptr);
virtual void set_update_interval (unsigned interval);
virtual Bit8u get_actl_palette_idx(Bit8u index);
private:
static Bit32u svga_read_handler(void *this_ptr, Bit32u address, unsigned io_len);
static void svga_write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len);
#if !BX_USE_CIRRUS_SMF
Bit32u svga_read(Bit32u address, unsigned io_len);
void svga_write(Bit32u address, Bit32u value, unsigned io_len);
#endif // !BX_USE_CIRRUS_SMF
static void svga_timer_handler(void *);
BX_CIRRUS_SMF void svga_timer(void);
BX_CIRRUS_SMF void svga_modeupdate(void);
BX_CIRRUS_SMF void svga_update(void);
BX_CIRRUS_SMF void svga_init_members();
BX_CIRRUS_SMF void draw_hardware_cursor(unsigned, unsigned, bx_svga_tileinfo_t *);
// bank memory
BX_CIRRUS_SMF void update_bank_ptr(Bit8u bank_index);
// 0x3b4-0x3b5,0x3d4-0x3d5
BX_CIRRUS_SMF Bit8u svga_read_crtc(Bit32u address, unsigned index);
BX_CIRRUS_SMF void svga_write_crtc(Bit32u address, unsigned index, Bit8u value);
// 0x3c4-0x3c5
BX_CIRRUS_SMF Bit8u svga_read_sequencer(Bit32u address, unsigned index);
BX_CIRRUS_SMF void svga_write_sequencer(Bit32u address, unsigned index, Bit8u value);
// 0x3ce-0x3cf
BX_CIRRUS_SMF Bit8u svga_read_control(Bit32u address, unsigned index);
BX_CIRRUS_SMF void svga_write_control(Bit32u address, unsigned index, Bit8u value);
// memory-mapped I/O
BX_CIRRUS_SMF Bit8u svga_mmio_vga_read(Bit32u address);
BX_CIRRUS_SMF void svga_mmio_vga_write(Bit32u address,Bit8u value);
BX_CIRRUS_SMF Bit8u svga_mmio_blt_read(Bit32u address);
BX_CIRRUS_SMF void svga_mmio_blt_write(Bit32u address,Bit8u value);
BX_CIRRUS_SMF void svga_reset_bitblt(void);
BX_CIRRUS_SMF void svga_bitblt();
BX_CIRRUS_SMF void svga_colorexpand(Bit8u *dst,const Bit8u *src,int count,int pixelwidth);
#if BX_USE_CIRRUS_SMF
#define svga_colorexpand_8_static svga_colorexpand_8
#define svga_colorexpand_16_static svga_colorexpand_16
#define svga_colorexpand_24_static svga_colorexpand_24
#define svga_colorexpand_32_static svga_colorexpand_32
#else // BX_USE_CIRRUS_SMF
static void svga_colorexpand_8_static(void *this_ptr,Bit8u *dst,const Bit8u *src,int count);
static void svga_colorexpand_16_static(void *this_ptr,Bit8u *dst,const Bit8u *src,int count);
static void svga_colorexpand_24_static(void *this_ptr,Bit8u *dst,const Bit8u *src,int count);
static void svga_colorexpand_32_static(void *this_ptr,Bit8u *dst,const Bit8u *src,int count);
#endif // BX_USE_CIRRUS_SMF
BX_CIRRUS_SMF void svga_colorexpand_8(Bit8u *dst,const Bit8u *src,int count);
BX_CIRRUS_SMF void svga_colorexpand_16(Bit8u *dst,const Bit8u *src,int count);
BX_CIRRUS_SMF void svga_colorexpand_24(Bit8u *dst,const Bit8u *src,int count);
BX_CIRRUS_SMF void svga_colorexpand_32(Bit8u *dst,const Bit8u *src,int count);
BX_CIRRUS_SMF void svga_setup_bitblt_cputovideo(Bit32u dstaddr,Bit32u srcaddr);
BX_CIRRUS_SMF void svga_setup_bitblt_videotocpu(Bit32u dstaddr,Bit32u srcaddr);
BX_CIRRUS_SMF void svga_setup_bitblt_videotovideo(Bit32u dstaddr,Bit32u srcaddr);
#if !BX_USE_CIRRUS_SMF
static void svga_patterncopy_static(void *this_ptr);
static void svga_simplebitblt_static(void *this_ptr);
static void svga_patterncopy_memsrc_static(void *this_ptr);
static void svga_simplebitblt_memsrc_static(void *this_ptr);
static void svga_simplebitblt_transp_memsrc_static(void *this_ptr);
#else
#define svga_patterncopy_static svga_patterncopy
#define svga_simplebitblt_static svga_simplebitblt
#define svga_patterncopy_memsrc_static svga_patterncopy_memsrc
#define svga_simplebitblt_memsrc_static svga_simplebitblt_memsrc
#define svga_simplebitblt_transp_memsrc_static svga_simplebitblt_transp_memsrc
#endif // !BX_USE_CIRRUS_SMF
BX_CIRRUS_SMF void svga_patterncopy();
BX_CIRRUS_SMF void svga_simplebitblt();
BX_CIRRUS_SMF void svga_patterncopy_memsrc();
BX_CIRRUS_SMF void svga_simplebitblt_memsrc();
BX_CIRRUS_SMF void svga_simplebitblt_transp_memsrc();
BX_CIRRUS_SMF bx_bool svga_asyncbitblt_next();
BX_CIRRUS_SMF bx_cirrus_bitblt_rop_t svga_get_fwd_rop_handler(Bit8u rop);
BX_CIRRUS_SMF bx_cirrus_bitblt_rop_t svga_get_bkwd_rop_handler(Bit8u rop);
struct {
Bit8u index;
Bit8u reg[CIRRUS_CRTC_MAX+1];
} crtc; // 0x3b4-5/0x3d4-5
struct {
Bit8u index;
Bit8u reg[CIRRUS_SEQENCER_MAX+1];
} sequencer; // 0x3c4-5
struct {
Bit8u index;
Bit8u reg[CIRRUS_CONTROL_MAX+1];
Bit8u shadow_reg0;
Bit8u shadow_reg1;
} control; // 0x3ce-f
struct {
unsigned lockindex;
Bit8u data;
Bit8u palette[48];
} hidden_dac; // 0x3c6
bx_bool svga_unlock_special;
bx_bool svga_needs_update_tile;
bx_bool svga_needs_update_dispentire;
bx_bool svga_needs_update_mode;
unsigned svga_xres;
unsigned svga_yres;
unsigned svga_pitch;
unsigned svga_bpp;
unsigned svga_dispbpp;
Bit8u *vidmem;
Bit8u *tilemem;
Bit32u bank_base[2];
Bit32u bank_limit[2];
Bit32u memsize;
Bit8u *disp_ptr;
#if BX_SUPPORT_PCI && BX_SUPPORT_CLGD54XX_PCI
bx_bool pci_enabled;
#endif
struct {
bx_cirrus_bitblt_rop_t rop_handler;
int pixelwidth;
int bltwidth;
int bltheight;
int dstpitch;
int srcpitch;
Bit8u bltmode;
Bit8u bltmodeext;
Bit8u bltrop;
Bit8u *dst;
const Bit8u *src;
#if BX_USE_CIRRUS_SMF
void (*bitblt_ptr)();
#else
void (*bitblt_ptr)(void *this_ptr);
#endif // BX_USE_CIRRUS_SMF
int async_xbytes;
int async_y;
Bit8u *memsrc_ptr; // CPU -> video
Bit8u *memsrc_endptr;
int memsrc_bytesperline;
int memsrc_needed;
Bit8u *memdst_ptr; // video -> CPU
Bit8u *memdst_endptr;
int memdst_bytesperline;
int memdst_needed;
Bit8u memsrc[CIRRUS_BLT_CACHESIZE];
Bit8u memdst[CIRRUS_BLT_CACHESIZE];
Bit16u pos_x;
Bit16u pos_y;
} bitblt;
struct {
Bit16u x, y, size;
} hw_cursor;
bx_bool is_unlocked() { return svga_unlock_special; }
bx_bool banking_granularity_is_16k() { return !!(control.reg[0x0B] & 0x20); }
bx_bool banking_is_dual() { return !!(control.reg[0x0B] & 0x01); }
#if BX_SUPPORT_PCI && BX_SUPPORT_CLGD54XX_PCI
BX_CIRRUS_SMF void svga_init_pcihandlers(void);
static Bit32u pci_read_handler(void *this_ptr, Bit8u address, unsigned io_len);
static void pci_write_handler(void *this_ptr, Bit8u address, Bit32u value, unsigned io_len);
BX_CIRRUS_SMF bx_bool cirrus_mem_read_handler(unsigned long addr, unsigned long len, void *data, void *param);
BX_CIRRUS_SMF bx_bool cirrus_mem_write_handler(unsigned long addr, unsigned long len, void *data, void *param);
#if !BX_USE_CIRRUS_SMF
Bit32u pci_read(Bit8u address, unsigned io_len);
void pci_write(Bit8u address, Bit32u value, unsigned io_len);
#endif // !BX_USE_CIRRUS_SMF
Bit8u pci_conf[256];
Bit32u pci_memaddr;
Bit32u pci_mmioaddr;
#endif // BX_SUPPORT_PCI && BX_SUPPORT_CLGD54XX_PCI
};
#endif // BX_SUPPORT_CLGD54XX

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: vga.cc,v 1.108 2004-08-06 15:49:55 vruppert Exp $
// $Id: vga.cc,v 1.109 2004-08-16 08:02:15 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -80,6 +80,13 @@ bx_vga_c *theVga = NULL;
unsigned old_iHeight = 0, old_iWidth = 0, old_MSL = 0, old_BPP = 0;
#if BX_SUPPORT_CLGD54XX
void
libvga_set_smf_pointer(bx_vga_c *theVga_ptr)
{
theVga = theVga_ptr;
}
#else // BX_SUPPORT_CLGD54XX
int
libvga_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *argv[])
{
@ -93,6 +100,7 @@ libvga_LTX_plugin_init(plugin_t *plugin, plugintype_t type, int argc, char *argv
libvga_LTX_plugin_fini(void)
{
}
#endif // BX_SUPPORT_CLGD54XX
bx_vga_c::bx_vga_c(void)
{
@ -122,35 +130,13 @@ bx_vga_c::init(void)
char *argv[16];
char *ptr;
char string[512];
Bit8u io_mask[16] = {3, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1};
#if BX_SUPPORT_VBE
unsigned addr;
for (addr=0x03B4; addr<=0x03B5; addr++) {
DEV_register_ioread_handler(this, read_handler, addr, "vga video", 1);
DEV_register_iowrite_handler(this, write_handler, addr, "vga video", 3);
}
for (addr=0x03BA; addr<=0x03BA; addr++) {
DEV_register_ioread_handler(this, read_handler, addr, "vga video", 1);
DEV_register_iowrite_handler(this, write_handler, addr, "vga video", 3);
}
i = 0;
for (addr=0x03C0; addr<=0x03CF; addr++) {
DEV_register_ioread_handler(this, read_handler, addr, "vga video", io_mask[i++]);
DEV_register_iowrite_handler(this, write_handler, addr, "vga video", 3);
}
for (addr=0x03D4; addr<=0x03D5; addr++) {
DEV_register_ioread_handler(this, read_handler, addr, "vga video", 3);
DEV_register_iowrite_handler(this, write_handler, addr, "vga video", 3);
}
for (addr=0x03DA; addr<=0x03DA; addr++) {
DEV_register_ioread_handler(this, read_handler, addr, "vga video", 1);
DEV_register_iowrite_handler(this, write_handler, addr, "vga video", 3);
}
#endif
#if !BX_SUPPORT_CLGD54XX
BX_VGA_THIS init_iohandlers(read_handler,write_handler);
#endif // !BX_SUPPORT_CLGD54XX
DEV_register_memory_handlers(mem_read_handler, theVga, mem_write_handler,
theVga, 0xa0000, 0xbffff);
@ -274,11 +260,9 @@ bx_vga_c::init(void)
}
}
BX_INFO(("interval=%u", bx_options.Ovga_update_interval->get ()));
if (BX_VGA_THIS timer_id == BX_NULL_TIMER_HANDLE) {
BX_VGA_THIS timer_id = bx_pc_system.register_timer(this, timer_handler,
bx_options.Ovga_update_interval->get (), 1, 1, "vga");
}
#if !BX_SUPPORT_CLGD54XX
BX_VGA_THIS init_systemtimer(timer_handler);
#endif // !BX_SUPPORT_CLGD54XX
/* video card with BIOS ROM */
DEV_cmos_set_reg(0x14, (DEV_cmos_get_reg(0x14) & 0xcf) | 0x00);
@ -341,6 +325,49 @@ bx_vga_c::init(void)
#endif
}
void
bx_vga_c::init_iohandlers(bx_read_handler_t f_read, bx_write_handler_t f_write)
{
unsigned addr, i;
Bit8u io_mask[16] = {3, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1};
for (addr=0x03B4; addr<=0x03B5; addr++) {
DEV_register_ioread_handler(this, f_read, addr, "vga video", 1);
DEV_register_iowrite_handler(this, f_write, addr, "vga video", 3);
}
for (addr=0x03BA; addr<=0x03BA; addr++) {
DEV_register_ioread_handler(this, f_read, addr, "vga video", 1);
DEV_register_iowrite_handler(this, f_write, addr, "vga video", 3);
}
i = 0;
for (addr=0x03C0; addr<=0x03CF; addr++) {
DEV_register_ioread_handler(this, f_read, addr, "vga video", io_mask[i++]);
DEV_register_iowrite_handler(this, f_write, addr, "vga video", 3);
}
for (addr=0x03D4; addr<=0x03D5; addr++) {
DEV_register_ioread_handler(this, f_read, addr, "vga video", 3);
DEV_register_iowrite_handler(this, f_write, addr, "vga video", 3);
}
for (addr=0x03DA; addr<=0x03DA; addr++) {
DEV_register_ioread_handler(this, f_read, addr, "vga video", 1);
DEV_register_iowrite_handler(this, f_write, addr, "vga video", 3);
}
}
void
bx_vga_c::init_systemtimer(bx_timer_handler_t f_timer)
{
BX_INFO(("interval=%u", bx_options.Ovga_update_interval->get ()));
if (BX_VGA_THIS timer_id == BX_NULL_TIMER_HANDLE) {
BX_VGA_THIS timer_id = bx_pc_system.register_timer(this, f_timer,
bx_options.Ovga_update_interval->get (), 1, 1, "vga");
}
}
void
bx_vga_c::reset(unsigned type)
{
@ -1014,7 +1041,7 @@ bx_vga_c::write(Bit32u address, Bit32u value, unsigned io_len, bx_bool no_log)
BX_DEBUG(("io write 0x3c5=0x%02x: clocking mode reg: ignoring",
(unsigned) value));
#endif
BX_VGA_THIS s.sequencer.reg1 = value & 0x3f;
BX_VGA_THIS s.sequencer.reg1 = value & 0x3d;
BX_VGA_THIS s.x_dotclockdiv2 = ((value & 0x08) > 0);
break;
case 2: /* sequencer: map mask register */
@ -1023,7 +1050,7 @@ bx_vga_c::write(Bit32u address, Bit32u value, unsigned io_len, bx_bool no_log)
BX_VGA_THIS s.sequencer.map_mask_bit[i] = (value >> i) & 0x01;
break;
case 3: /* sequencer: character map select register */
BX_VGA_THIS s.sequencer.char_map_select = value;
BX_VGA_THIS s.sequencer.char_map_select = value & 0x3f;
charmap1 = value & 0x13;
if (charmap1 > 3) charmap1 = (charmap1 & 3) + 4;
charmap2 = (value & 0x2C) >> 2;
@ -1150,8 +1177,7 @@ bx_vga_c::write(Bit32u address, Bit32u value, unsigned io_len, bx_bool no_log)
break;
case 3: /* Data Rotate */
BX_VGA_THIS s.graphics_ctrl.data_rotate = value & 0x07;
/* ??? is this bits 3..4 or 4..5 */
BX_VGA_THIS s.graphics_ctrl.raster_op = (value >> 3) & 0x03; /* ??? */
BX_VGA_THIS s.graphics_ctrl.raster_op = (value >> 3) & 0x03;
break;
case 4: /* Read Map Select */
BX_VGA_THIS s.graphics_ctrl.read_map_select = value & 0x03;
@ -2191,19 +2217,20 @@ bx_vga_c::mem_write(Bit32u addr, Bit8u value)
// 320 x 200 256 color mode: chained pixel representation
BX_VGA_THIS s.vga_memory[(offset & ~0x03) + (offset % 4)*65536] = value;
offset -= start_addr;
x_tileno = (offset % BX_VGA_THIS s.line_offset) / (X_TILESIZE/2);
if (BX_VGA_THIS s.y_doublescan) {
y_tileno = (offset / BX_VGA_THIS s.line_offset) / (Y_TILESIZE/2);
} else {
y_tileno = (offset / BX_VGA_THIS s.line_offset) / Y_TILESIZE;
if (BX_VGA_THIS s.line_offset > 0) {
offset -= start_addr;
x_tileno = (offset % BX_VGA_THIS s.line_offset) / (X_TILESIZE/2);
if (BX_VGA_THIS s.y_doublescan) {
y_tileno = (offset / BX_VGA_THIS s.line_offset) / (Y_TILESIZE/2);
} else {
y_tileno = (offset / BX_VGA_THIS s.line_offset) / Y_TILESIZE;
}
BX_VGA_THIS s.vga_mem_updated = 1;
SET_TILE_UPDATED (x_tileno, y_tileno, 1);
}
BX_VGA_THIS s.vga_mem_updated = 1;
SET_TILE_UPDATED (x_tileno, y_tileno, 1);
return;
}
}
}
/* addr between 0xA0000 and 0xAFFFF */

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: vga.h,v 1.41 2004-07-21 20:39:54 vruppert Exp $
// $Id: vga.h,v 1.42 2004-08-16 08:02:15 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -79,6 +79,11 @@
#define BX_MAX_XRES VBE_DISPI_MAX_XRES
#define BX_MAX_YRES VBE_DISPI_MAX_YRES
#elif BX_SUPPORT_CLGD54XX
#define BX_MAX_XRES 1280
#define BX_MAX_YRES 1024
#else
#define BX_MAX_XRES 800
@ -130,7 +135,9 @@ public:
unsigned *txWidth);
virtual Bit8u get_actl_palette_idx(Bit8u index);
private:
protected:
void init_iohandlers(bx_read_handler_t f_read, bx_write_handler_t f_write);
void init_systemtimer(bx_timer_handler_t f_timer);
static Bit32u read_handler(void *this_ptr, Bit32u address, unsigned io_len);
static void write_handler(void *this_ptr, Bit32u address, Bit32u value, unsigned io_len);
@ -300,9 +307,15 @@ private:
static void timer_handler(void *);
BX_VGA_SMF void timer(void);
private:
protected:
BX_VGA_SMF void update(void);
BX_VGA_SMF void dump_status(void);
BX_VGA_SMF void determine_screen_dimensions(unsigned *piHeight,
unsigned *piWidth);
};
#if BX_SUPPORT_CLGD54XX
void
libvga_set_smf_pointer(bx_vga_c *theVga_ptr);
#include "iodev/svga_cirrus.h"
#endif // BX_SUPPORT_CLGD54XX