mirror of
https://github.com/retro100/dosbox-wii.git
synced 2025-02-28 07:43:41 +01:00
DOSBox 0.60
This commit is contained in:
parent
d82f029c50
commit
e99193553b
2
AUTHORS
2
AUTHORS
@ -5,3 +5,5 @@ Sjoerd v.d. Berg <harekiet@zophar.net>
|
||||
Peter Veenstra <qbix79@users.sourceforge.net>
|
||||
Felix Jakschitsch <yot@users.sourceforge.net>
|
||||
Ulf Wohlers <finsterr@users.sourceforge.net>
|
||||
Tommy Frössman <fanskapet@php-coders.net>
|
||||
|
||||
|
32
ChangeLog
32
ChangeLog
@ -1,3 +1,35 @@
|
||||
0.60
|
||||
- rewrote memory system for future paging support
|
||||
- fixed several EMS and XMS bugs and rewrite for new memory system
|
||||
- added some support for tandy video modes
|
||||
- added MAME Tandy 3 voice emulation
|
||||
- added MAME CMS/GameBlaster emulation
|
||||
- added serial port emulation with virtual tcp/ip modem (somewhat buggy)
|
||||
- sound blaster emulation is now sb pro 2.0 compatible
|
||||
- added basic support for 32-bit protected mode
|
||||
- VGA now tries to emulate an S3 Trio 64 card with 2 MB
|
||||
- VESA 2.0 support for some 256 color modes
|
||||
- rewrote large piece of video bios code for better compatibility
|
||||
- added support for the not inheritance flags.
|
||||
- created functions for creating child psp.
|
||||
- updated errorcodes of findfirst (thanks Mirek!)
|
||||
- rewrote loggingsystem to generate less warnings
|
||||
- added dos protected mode interface (dpmi)
|
||||
- added cdrom label support
|
||||
- improved cdrom audio playing
|
||||
- fixed and improved directory cache
|
||||
- debugger shows selector- and cpu mode info
|
||||
- added SELINFO (selector information) command to debugger
|
||||
- added reference counting for dos files
|
||||
- added tab-completion
|
||||
- added basic fpu support.
|
||||
- fixed several bugs with case sensitive filesystems.
|
||||
- added more shell commands and improved their behaviour.
|
||||
- mouse improvements.
|
||||
- real time clock improvements.
|
||||
- DMA fixes.
|
||||
- Improved .BAT file support.
|
||||
|
||||
0.58
|
||||
- fixed date and time issues with fcbs
|
||||
- added more commands to the internal Shell
|
||||
|
42
INSTALL
42
INSTALL
@ -1,21 +1,28 @@
|
||||
Things needed for compilation.
|
||||
|
||||
SDL
|
||||
The Simple DirectMedia Library available at http://www.libsdl.org
|
||||
The Simple DirectMedia Library available at http://www.libsdl.org
|
||||
|
||||
Curses
|
||||
If you want to enable the debugger you need a curses library.
|
||||
ncurses should be installed on just about every unix distro.
|
||||
For win32 get pdcurses at http://pdcurses.sourceforge.net
|
||||
(optional)
|
||||
If you want to enable the debugger you need a curses library.
|
||||
ncurses should be installed on just about every unix distro.
|
||||
For win32 get pdcurses at http://pdcurses.sourceforge.net
|
||||
|
||||
Libpng
|
||||
Needed for the screenshots. (--enable-shots when configuring dosbox)
|
||||
Needed for the screenshots. (optional)
|
||||
For win32 get libpng from http://www.sourceforge.net/projects/gnuwin32
|
||||
|
||||
Zlib
|
||||
Needed by libpng.
|
||||
Needed by libpng. (optional)
|
||||
For win32 get libz (rename to zlib) from http://www.sourceforge.net/projects/gnuwin32
|
||||
|
||||
SDL_Net
|
||||
For modem support(optional). Get it from http://www.libsdl.org
|
||||
|
||||
ALSA_Headers
|
||||
(optional)
|
||||
???????? for Alsa support under linux
|
||||
|
||||
If you want compile from the CVS under a unix system, you'll also need
|
||||
automake (>=1.6), autoconf(>=2.50). Should be available at http://www.gnu.org
|
||||
@ -26,19 +33,28 @@ If you are building from the cvs run ./autogen.sh first before doing the followi
|
||||
1. ./configure
|
||||
2. make
|
||||
|
||||
In step 1 you could add the following switches --enable-shots this will
|
||||
enable the screenshot facility, also --enable-debug is a valid switch. This
|
||||
will enable the internal debugger. (It can be started by pressing - on the
|
||||
numeric keyboard)
|
||||
In step 1 you could add the following switches:
|
||||
--enable-debug
|
||||
enables the internal debugger. --enable-debug=heavy enables even more
|
||||
debug options. Dosbox should then be run from a xterm and when the sdl-
|
||||
window is active press - on numeric keyboard to enter the debugger.
|
||||
|
||||
--disable-fpu
|
||||
Will disable the emulated fpu. Although the fpu emulation hasn't finished and isn't
|
||||
entirely accurate it's advised to leave it on.
|
||||
|
||||
--enable-core-inline
|
||||
enables some memory increasing inlines. This greatly increases compiletime for maybe a increase
|
||||
in speed.
|
||||
|
||||
Check the src subdir for the binary.
|
||||
|
||||
|
||||
|
||||
Compiling on FreeBSD might be a problem since SDL has no joystick support there.
|
||||
To get around this edit sdlmain.cpp to enable some #define.
|
||||
Let's hope someday the sdl people will just report 0 joysticks in freebsd or get it working some other way :)
|
||||
|
||||
|
||||
Build instructions for VC++6
|
||||
|
||||
Open the workspace in the visualc subdir and build from there.
|
||||
|
||||
Don't use VC++ 6:it creates faulty code in core_normal.cpp
|
||||
|
250
Makefile.in
250
Makefile.in
@ -1,7 +1,7 @@
|
||||
# Makefile.in generated by automake 1.6.3 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.7.7 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -15,77 +15,122 @@
|
||||
@SET_MAKE@
|
||||
|
||||
# Main Makefile for DOSBox
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = .
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = @program_transform_name@
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
|
||||
EXEEXT = @EXEEXT@
|
||||
OBJEXT = @OBJEXT@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMDEP_FALSE = @AMDEP_FALSE@
|
||||
AMDEP_TRUE = @AMDEP_TRUE@
|
||||
AMTAR = @AMTAR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SDL_CFLAGS = @SDL_CFLAGS@
|
||||
SDL_CONFIG = @SDL_CONFIG@
|
||||
SDL_LIBS = @SDL_LIBS@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_RANLIB = @ac_ct_RANLIB@
|
||||
ac_ct_STRIP = @ac_ct_STRIP@
|
||||
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
|
||||
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
|
||||
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
|
||||
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
datadir = @datadir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
oldincludedir = @oldincludedir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target = @target@
|
||||
target_alias = @target_alias@
|
||||
target_cpu = @target_cpu@
|
||||
target_os = @target_os@
|
||||
target_vendor = @target_vendor@
|
||||
|
||||
EXTRA_DIST = autogen.sh
|
||||
SUBDIRS = src include visualc docs
|
||||
@ -96,14 +141,15 @@ CONFIG_HEADER = config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
DIST_SOURCES =
|
||||
|
||||
RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \
|
||||
uninstall-info-recursive all-recursive install-data-recursive \
|
||||
install-exec-recursive installdirs-recursive install-recursive \
|
||||
uninstall-recursive check-recursive installcheck-recursive
|
||||
DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \
|
||||
Makefile.in NEWS THANKS acinclude.m4 aclocal.m4 config.guess \
|
||||
config.h.in config.sub configure configure.in depcomp \
|
||||
install-sh missing mkinstalldirs
|
||||
RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \
|
||||
ps-recursive install-info-recursive uninstall-info-recursive \
|
||||
all-recursive install-data-recursive install-exec-recursive \
|
||||
installdirs-recursive install-recursive uninstall-recursive \
|
||||
check-recursive installcheck-recursive
|
||||
DIST_COMMON = README $(srcdir)/Makefile.in $(srcdir)/configure AUTHORS \
|
||||
COPYING ChangeLog INSTALL Makefile.am NEWS THANKS acinclude.m4 \
|
||||
aclocal.m4 config.guess config.h.in config.sub configure.in \
|
||||
depcomp install-sh missing mkinstalldirs
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
all: config.h
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-recursive
|
||||
@ -198,10 +244,17 @@ tags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
|
||||
done
|
||||
ctags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
|
||||
done
|
||||
|
||||
ETAGS = etags
|
||||
ETAGSFLAGS =
|
||||
|
||||
CTAGS = ctags
|
||||
CTAGSFLAGS =
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
@ -217,9 +270,15 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
if (etags --etags-include --version) >/dev/null 2>&1; then \
|
||||
include_option=--etags-include; \
|
||||
else \
|
||||
include_option=--include; \
|
||||
fi; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
|
||||
test -f $$subdir/TAGS && \
|
||||
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
|
||||
fi; \
|
||||
done; \
|
||||
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
|
||||
@ -232,13 +291,28 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
|
||||
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
ctags: CTAGS
|
||||
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
top_distdir = .
|
||||
@ -250,17 +324,25 @@ am__remove_distdir = \
|
||||
&& rm -fr $(distdir); }; }
|
||||
|
||||
GZIP_ENV = --best
|
||||
distuninstallcheck_listfiles = find . -type f -print
|
||||
distcleancheck_listfiles = find . -type f -print
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@if sed 15q $(srcdir)/NEWS | fgrep -e "$(VERSION)" >/dev/null; \
|
||||
then :; else \
|
||||
@case `sed 15q $(srcdir)/NEWS` in \
|
||||
*"$(VERSION)"*) : ;; \
|
||||
*) \
|
||||
echo "NEWS not updated; not releasing" 1>&2; \
|
||||
exit 1; \
|
||||
fi
|
||||
exit 1;; \
|
||||
esac
|
||||
$(am__remove_distdir)
|
||||
mkdir $(distdir)
|
||||
@list='$(DISTFILES)'; for file in $$list; do \
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(DISTFILES)'; for file in $$list; do \
|
||||
case $$file in \
|
||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
|
||||
esac; \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
@ -313,12 +395,13 @@ distcheck: dist
|
||||
$(am__remove_distdir)
|
||||
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf -
|
||||
chmod -R a-w $(distdir); chmod a+w $(distdir)
|
||||
mkdir $(distdir)/=build
|
||||
mkdir $(distdir)/=inst
|
||||
mkdir $(distdir)/_build
|
||||
mkdir $(distdir)/_inst
|
||||
chmod a-w $(distdir)
|
||||
dc_install_base=`$(am__cd) $(distdir)/=inst && pwd` \
|
||||
&& cd $(distdir)/=build \
|
||||
&& ../configure --srcdir=.. --prefix=$$dc_install_base \
|
||||
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
|
||||
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
|
||||
&& cd $(distdir)/_build \
|
||||
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
|
||||
$(DISTCHECK_CONFIGURE_FLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
|
||||
@ -326,23 +409,39 @@ distcheck: dist
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
|
||||
&& (test `find $$dc_install_base -type f -print | wc -l` -le 1 \
|
||||
|| { echo "ERROR: files left after uninstall:" ; \
|
||||
find $$dc_install_base -type f -print ; \
|
||||
exit 1; } >&2 ) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
|
||||
distuninstallcheck \
|
||||
&& chmod -R a-w "$$dc_install_base" \
|
||||
&& ({ \
|
||||
(cd ../.. && $(mkinstalldirs) "$$dc_destdir") \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
|
||||
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
|
||||
} || { rm -rf "$$dc_destdir"; exit 1; }) \
|
||||
&& rm -rf "$$dc_destdir" \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dist-gzip \
|
||||
&& rm -f $(distdir).tar.gz \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck
|
||||
$(am__remove_distdir)
|
||||
@echo "$(distdir).tar.gz is ready for distribution" | \
|
||||
sed 'h;s/./=/g;p;x;p;x'
|
||||
distuninstallcheck:
|
||||
@cd $(distuninstallcheck_dir) \
|
||||
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|
||||
|| { echo "ERROR: files left after uninstall:" ; \
|
||||
if test -n "$(DESTDIR)"; then \
|
||||
echo " (check DESTDIR support)"; \
|
||||
fi ; \
|
||||
$(distuninstallcheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
distcleancheck: distclean
|
||||
if test '$(srcdir)' = . ; then \
|
||||
@if test '$(srcdir)' = . ; then \
|
||||
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
|
||||
exit 1 ; \
|
||||
fi
|
||||
test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|
||||
|| { echo "ERROR: files left after distclean:" ; \
|
||||
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|
||||
|| { echo "ERROR: files left in build directory after distclean:" ; \
|
||||
$(distcleancheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
check-am: all-am
|
||||
@ -370,7 +469,7 @@ mostlyclean-generic:
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@ -381,6 +480,8 @@ clean-am: clean-generic mostlyclean-am
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic distclean-hdr distclean-tags
|
||||
|
||||
dvi: dvi-recursive
|
||||
@ -403,22 +504,33 @@ installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -rf autom4te.cache
|
||||
-rm -rf $(top_srcdir)/autom4te.cache
|
||||
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
pdf: pdf-recursive
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-recursive
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-info-am
|
||||
|
||||
uninstall-info: uninstall-info-recursive
|
||||
|
||||
.PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \
|
||||
clean-generic clean-recursive dist dist-all dist-gzip distcheck \
|
||||
distclean distclean-generic distclean-hdr distclean-recursive \
|
||||
distclean-tags distcleancheck distdir dvi dvi-am dvi-recursive \
|
||||
info info-am info-recursive install install-am install-data \
|
||||
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \
|
||||
clean-generic clean-recursive ctags ctags-recursive dist \
|
||||
dist-all dist-gzip distcheck distclean distclean-generic \
|
||||
distclean-hdr distclean-recursive distclean-tags distcleancheck \
|
||||
distdir distuninstallcheck dvi dvi-am dvi-recursive info \
|
||||
info-am info-recursive install install-am install-data \
|
||||
install-data-am install-data-recursive install-exec \
|
||||
install-exec-am install-exec-recursive install-info \
|
||||
install-info-am install-info-recursive install-man \
|
||||
@ -426,9 +538,9 @@ uninstall-info: uninstall-info-recursive
|
||||
installdirs installdirs-am installdirs-recursive \
|
||||
maintainer-clean maintainer-clean-generic \
|
||||
maintainer-clean-recursive mostlyclean mostlyclean-generic \
|
||||
mostlyclean-recursive tags tags-recursive uninstall \
|
||||
uninstall-am uninstall-info-am uninstall-info-recursive \
|
||||
uninstall-recursive
|
||||
mostlyclean-recursive pdf pdf-am pdf-recursive ps ps-am \
|
||||
ps-recursive tags tags-recursive uninstall uninstall-am \
|
||||
uninstall-info-am uninstall-info-recursive uninstall-recursive
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
|
32
NEWS
32
NEWS
@ -1,3 +1,35 @@
|
||||
0.60
|
||||
- rewrote memory system for future paging support
|
||||
- fixed several EMS and XMS bugs and rewrite for new memory system
|
||||
- added some support for tandy video modes
|
||||
- added MAME Tandy 3 voice emulation
|
||||
- added MAME CMS/GameBlaster emulation
|
||||
- added serial port emulation with virtual tcp/ip modem (somewhat buggy)
|
||||
- sound blaster emulation is now sb pro 2.0 compatible
|
||||
- added basic support for 32-bit protected mode
|
||||
- VGA now tries to emulate an S3 Trio 64 card with 2 MB
|
||||
- VESA 2.0 support for some 256 color modes
|
||||
- rewrote large piece of video bios code for better compatibility
|
||||
- added support for the not inheritance flags.
|
||||
- created functions for creating child psp.
|
||||
- updated errorcodes of findfirst (thanks Mirek!)
|
||||
- rewrote loggingsystem to generate less warnings
|
||||
- added dos protected mode interface (dpmi)
|
||||
- added cdrom label support
|
||||
- improved cdrom audio playing
|
||||
- fixed and improved directory cache
|
||||
- debugger shows selector- and cpu mode info
|
||||
- added SELINFO (selector information) command to debugger
|
||||
- added reference counting for dos files
|
||||
- added tab-completion
|
||||
- added basic fpu support.
|
||||
- fixed several bugs with case sensitive filesystems.
|
||||
- added more shell commands and improved their behaviour.
|
||||
- mouse improvements.
|
||||
- real time clock improvements.
|
||||
- DMA fixes.
|
||||
- Improved .BAT file support.
|
||||
|
||||
0.58
|
||||
- fixed date and time issues with fcbs
|
||||
- added more commands to the internal Shell
|
||||
|
305
README
305
README
@ -1,97 +1,173 @@
|
||||
DOSBox v0.58
|
||||
DOSBox v0.60
|
||||
|
||||
=====
|
||||
NOTE:
|
||||
=====
|
||||
|
||||
While we hope that, one day, DosBox will run virtually all programs
|
||||
ever made for the PC...we are not there yet. At present, DosBox run on a 1.7
|
||||
Gigahertz PC is roughly the equivalent of a 25MHz 386 PC. While the 0.60
|
||||
release has added support for "protected mode" allowing for more complex and
|
||||
recent programs, but note that this support is early in development and
|
||||
nowhere near as complete as the support for 386 real-mode games (or
|
||||
earlier). Also note that "protected mode" games need substantially more
|
||||
resources and may require a much faster processor for you to run it properly
|
||||
in DosBox.
|
||||
|
||||
======
|
||||
Usage:
|
||||
======
|
||||
|
||||
With the new internal shell,we've changed the command line a bit,
|
||||
so let's just give some examples of what you can do now.
|
||||
dosbox [name] [-exit] [-c command] [-fullscreen] [-conf congfigfile]
|
||||
[-lang languagefile]
|
||||
|
||||
dosbox
|
||||
With nothing on the command line you'll end up on the internal drive and
|
||||
from there you can mount directories as drives.
|
||||
dosbox [filename/directory]
|
||||
If dosbox detects a directory it'll mount that as the C: drive
|
||||
and then start the shell from c:\.
|
||||
If dosbox doesn't detect a directory it'll assume you mean an executable.
|
||||
This can be .bat .com .exe. Doesn't need to have extension included.
|
||||
It will mount the directory the file is in as the C: drive.
|
||||
Then start up the shell which will start the file.
|
||||
name
|
||||
If "name" is a directory it'll mount that as the C: drive.
|
||||
If "name" is an executable it'll mount the directory of "name"
|
||||
as the C: drive and execute "name".
|
||||
|
||||
-exit
|
||||
dosbox will exit after the "name" has been executed.
|
||||
|
||||
There also are a couple of command line switches.
|
||||
-c command
|
||||
Runs the specified command before running "name". Multiple commands
|
||||
can be specified. Each command should start with -c though.
|
||||
|
||||
dosbox -fullscreen
|
||||
starts dosbox in fullscreen mode.
|
||||
dosbox -conf file
|
||||
loads file as a configfile.
|
||||
dosbox -lang file
|
||||
loads file as a languagefile.
|
||||
-fullscreen
|
||||
Starts dosbox in fullscreen mode.
|
||||
|
||||
You can also add commands to be executed before the main program starts.
|
||||
Or you can use them to start the program.
|
||||
To add commands use the -c command line switch.
|
||||
-conf configfile
|
||||
Start dosbox with the options specified in "configfile".
|
||||
|
||||
-lang languagefile
|
||||
Start dosbox using the language string specified in "languagefile".
|
||||
|
||||
-noconsole (Windows Only)
|
||||
Start dosbox without showing the console window, output will
|
||||
be redirected to stdout.txt and stderr.txt
|
||||
|
||||
Note: If a name/command/configfile/languagefile contains a space in it, put
|
||||
the whole name/command/configfile/languagefile between quotes("example").
|
||||
|
||||
For example:
|
||||
|
||||
dosbox c:\atlantis\atlantis.exe -c "MOUNT D C:\SAVES"
|
||||
This would mount c:\atlanis as c:\ and run atlantis.exe.
|
||||
This would mount c:\atlantis as c:\ and run atlantis.exe.
|
||||
Before it does that it would first mount C:\SAVES as the D drive.
|
||||
|
||||
In Windows you can also drag directories/files on the dosbox executable.
|
||||
In Windows you can also drag directories/files onto the dosbox executable.
|
||||
|
||||
|
||||
|
||||
==================
|
||||
Internal Programs:
|
||||
==================
|
||||
|
||||
MOUNT
|
||||
Program to mount local directories as drives inside DOSBox.
|
||||
The option -t <type> specifies the media: Where <type> can be.
|
||||
dir = harddisk
|
||||
floppy = floppy drive
|
||||
cdrom = cdrom drive
|
||||
dosbox supports most of the DOS commands found in command.com.
|
||||
In addition, the following commands are available:
|
||||
|
||||
The option -cd lists all found cdrom drives and their id.
|
||||
The option -usecd [x] forces to use the cdrom number x (id as shown in list -cd)
|
||||
MOUNT "Emulated Drive letter" "Real Drive or Directory"
|
||||
[-t type] [-aspi] [-ioctl] [-usecd number] [-size drivesize]
|
||||
[-label drivelabel]
|
||||
MOUNT -cd
|
||||
|
||||
Program to mount local directories as drives inside DOSBox.
|
||||
|
||||
The option -aspi forces to use aspi driver
|
||||
(only valid if mounting a cdrom and on Windows systems with ASPI-Layer).
|
||||
The option -ioctl forces to use ioctl functions
|
||||
(only valid if mounting a cdrom and on Win2000/XP/NT systems).
|
||||
"Emulated Drive letter"
|
||||
The driveletter inside dosbox (eg. C).
|
||||
|
||||
For example to mount c:\floppy as a floppy : mount a c:\floppy -t floppy
|
||||
For example to mount system cdrom drive e as cdrom drive d in dosbox
|
||||
mount d e:\ -t cdrom
|
||||
For example to mount system cdrom drive at mountpoint /media/cdrom as cdrom
|
||||
drive d in dosbox
|
||||
mount d /media/cdrom -t cdrom -usecd 0
|
||||
"Real Drive letter or Directory"
|
||||
The local directory you want to have inside dosbox.
|
||||
(Under Win32 usually the same as "Emulated Drive letter".
|
||||
For Example: mount c c:\ )
|
||||
|
||||
It is also possible to mount a directory as cdrom, but it's limited.
|
||||
-t type
|
||||
Type of the mounted directory. Supported are: dir (standard),
|
||||
floppy, cdrom.
|
||||
|
||||
-size drivesize
|
||||
Sets the size of the drive.
|
||||
|
||||
-label drivelabel
|
||||
Sets the name of the drive to "drivelabel". Needed on some
|
||||
systems if the cd label isn't read correctly. Useful when a
|
||||
program can't find its cdrom.
|
||||
|
||||
-aspi
|
||||
Forces to use the aspi layer. Only valid if mounting a cdrom under
|
||||
Windows systems with an ASPI-Layer.
|
||||
|
||||
-ioctl
|
||||
Forces to use ioctl commands. Only valid if mounting a cdrom under
|
||||
windows which support them (Win2000/XP/NT).
|
||||
|
||||
-usecd number
|
||||
Forces to use SDL cdrom support for drive number.
|
||||
Number can be found by -cd. Valid on all systems.
|
||||
|
||||
-cd
|
||||
Displays all detected cdrom drives and their numbers. Use with -usecd.
|
||||
|
||||
Note: It's possible to mount a local directory as cdrom drive.
|
||||
Hardware support is then missing.
|
||||
|
||||
Basically, MOUNT allows you to connect real hardware to DosBox's "emulated"
|
||||
PC. So MOUNT C C:\ tells DosBox to use your real C: drive as drive C: in
|
||||
DosBox. It also allows you to change the drive's letter identification for
|
||||
programs that demand specific drive letters.
|
||||
|
||||
For example: Touche: Adventures of The Fifth Musketeer must be run on your C:
|
||||
drive. Using DosBox and it's mount command, you can trick into thinking it
|
||||
is on C drive while placing it where you want it. For example, if the game
|
||||
were in D:\TOUCHE, you can use the command MOUNT C D:\ would allow you to
|
||||
run Touche from the D drive.
|
||||
|
||||
|
||||
General MOUNT Examples:
|
||||
1. To mount c:\floppy as a floppy :
|
||||
mount a c:\floppy -t floppy
|
||||
2. To mount system cdrom drive E as cdrom drive D in dosbox:
|
||||
mount d e:\ -t cdrom
|
||||
3. To mount system cdrom drive at mountpoint /media/cdrom as cdrom drive D
|
||||
in dosbox:
|
||||
mount d /media/cdrom -t cdrom -usecd 0
|
||||
4. To mount a drive with 870 mb free diskspace (rarely needed! experts only):
|
||||
mount c d:\ -size 4025,127,16513,1700
|
||||
5. to mount /home/dos/dosgames as drive C in dosbox:
|
||||
mount c /home/dos/dosgames
|
||||
|
||||
MEM
|
||||
Program to display the amount of free memory
|
||||
Program to display the amount of free memory.
|
||||
|
||||
CONFIG
|
||||
Utility for generating a config file and language file.
|
||||
The option -writeconf filename is used to write the current config settings.
|
||||
The option -writelang filename is used to write the current language strings.
|
||||
CONFIG [-writeconf] [-writelang] localfile
|
||||
Write the current configuration or language settings to file.
|
||||
"localfile" is located on the local drive !!!
|
||||
|
||||
For more information use the the /? command line switch with the programs.
|
||||
LOADFIX [-size] [program] [program-parameters]
|
||||
LOADFIX -f
|
||||
Program to "eat up" memory. Useful for old programs which don't expect much
|
||||
memory to be free.
|
||||
|
||||
The Config File:
|
||||
===============
|
||||
A config file can be generated by CONFIG.COM, edit it to customize DOSBox.
|
||||
The file is divided in several sections (the names got [] around it).
|
||||
Some sections have options which you can set.
|
||||
# and % indicate commentlines.
|
||||
The generated configfile contains the current settings. You can alter them and
|
||||
start dosbox with the -conf switch to load the file and use these settings.
|
||||
-size
|
||||
number of kb to "eat up", default = 64kb
|
||||
|
||||
-f
|
||||
frees all previously allocated memory
|
||||
|
||||
|
||||
The Language File:
|
||||
=================
|
||||
A language file can be generated by CONFIG.COM.
|
||||
Read it and you will hopefuly understand how to change it.
|
||||
Start Dosbox with -lang switch to use your new language file
|
||||
Or you can setup the filename in the config file in the [dosbox] section.
|
||||
There's a language= entry that can be changed with the filename.
|
||||
Examples:
|
||||
1. To start mm2.exe and allocate 64kb memory :
|
||||
loadfix mm2
|
||||
2. To start mm2.exe and allocate 32kb memory :
|
||||
loadfix -32 mm2
|
||||
3. To free previous allocated memory :
|
||||
loadfix -f
|
||||
|
||||
For more information use the /? command line switch with the programs.
|
||||
|
||||
|
||||
|
||||
=============
|
||||
Special Keys:
|
||||
=============
|
||||
|
||||
@ -102,41 +178,27 @@ CTRL-F7 Decrease frameskip.
|
||||
CTRL-F8 Increase frameskip.
|
||||
CTRL-F9 Kill dosbox.
|
||||
CTRL-F10 Capture/Release the mouse.
|
||||
CTRL-F11 Slowdown emulation.
|
||||
CTRL-F12 Speedup emulation.
|
||||
CTRL-F11 Slow down emulation (Decrease DOSBox Cycles).
|
||||
CTRL-F12 Speed up emulation (Increase DOSox Cycles).
|
||||
|
||||
NOTE: Once you increase your DOSBox cycles beyond your computer's maximum
|
||||
capacity, it will produce the same effect as slowing down the emulation.
|
||||
This maximum will vary from computer to computer, there is no standard.
|
||||
|
||||
====================
|
||||
System requirements:
|
||||
====================
|
||||
|
||||
Fast machine my guess would be pentium-2 400+ to get decent emulation
|
||||
Fast machine. My guess would be pentium-2 400+ to get decent emulation
|
||||
of games written for an 286 machine.
|
||||
|
||||
FAQ:
|
||||
====
|
||||
|
||||
Q: I've got a Z instead of a C at the prompt.
|
||||
A: In DOSBox you can mount directories as drives
|
||||
in win32: mount c D:\ would give you an C in DOSBox which points
|
||||
at D:\ in win32
|
||||
in linux: mount c /home/username would give you and C in DOSBox
|
||||
which points at /home/username in Linux
|
||||
|
||||
Q: The mouse doesn't work.
|
||||
A: Normally dosbox detects the mouse being used by a game, if you click on
|
||||
the screen then it should get locked and work.
|
||||
Sometimes the dosbox mouse detection doesn't work with certain games, you
|
||||
might have to force to lock the mouse then with ctrl-f10.
|
||||
|
||||
Q: The sound stutters.
|
||||
A: Your using too much cpu power to keep dosbox running at the current speed.
|
||||
You can either lower the cycles or skip frames or get a faster machine.
|
||||
|
||||
|
||||
For more questions check the site/forum.
|
||||
For protected mode games a 1 Ghz machine is recommended and don't expect
|
||||
them to run fast though!! Be sure to read the next section on how to speed
|
||||
it up somewhat.
|
||||
|
||||
|
||||
================================
|
||||
To run resource-demanding games:
|
||||
===============================
|
||||
================================
|
||||
|
||||
DOSBox emulates the CPU, the sound and graphic cards, and some other
|
||||
stuff, all at the same time. You can overclock DOSBox by using CTRL+F12, but
|
||||
@ -164,12 +226,62 @@ You can also try to disable the sound through the setup utility of the game
|
||||
to further reduce load on your CPU.
|
||||
|
||||
|
||||
Building your own Version DOSBox:
|
||||
=================================
|
||||
====
|
||||
FAQ:
|
||||
====
|
||||
|
||||
Dowload the source.
|
||||
Q: I've got a Z instead of a C at the prompt.
|
||||
A: In DOSBox you can mount directories as drives.
|
||||
In win32: mount c D:\ would give you a C in DOSBox which points
|
||||
at D:\ in win32.
|
||||
In linux: mount c /home/username would give you a C in DOSBox
|
||||
which points at /home/username in Linux.
|
||||
|
||||
Q: The mouse doesn't work.
|
||||
A: Normally dosbox detects the mouse being used by a game. If you click on
|
||||
the screen then it should get locked and work.
|
||||
Sometimes the dosbox mouse detection doesn't work with certain games. You
|
||||
might have to force to lock the mouse then with ctrl-F10.
|
||||
|
||||
Q: The sound stutters.
|
||||
A: You're using too much cpu power to keep dosbox running at the current speed.
|
||||
You can either lower the cycles or skip frames or get a faster machine.
|
||||
|
||||
|
||||
For more questions check the site/forum:
|
||||
http://dosbox.sourceforge.net
|
||||
|
||||
|
||||
================
|
||||
The Config File:
|
||||
================
|
||||
|
||||
A config file can be generated by CONFIG.COM. Edit it to customize DOSBox.
|
||||
The file is divided into several sections (the names have [] around it).
|
||||
Some sections have options which you can set.
|
||||
# and % indicate commentlines.
|
||||
The generated configfile contains the current settings. You can alter them and
|
||||
start dosbox with the -conf switch to load the file and use these settings.
|
||||
|
||||
==================
|
||||
The Language File:
|
||||
==================
|
||||
|
||||
A language file can be generated by CONFIG.COM.
|
||||
Read it and you will hopefully understand how to change it.
|
||||
Start Dosbox with the -lang switch to use your new language file
|
||||
or you can setup the filename in the config file in the [dosbox] section.
|
||||
There's a language= entry that can be changed with the filename.
|
||||
|
||||
|
||||
====================================
|
||||
Building your own version of DOSBox:
|
||||
====================================
|
||||
|
||||
Download the source.
|
||||
Check the INSTALL in the source distribution.
|
||||
|
||||
===============
|
||||
Special Thanks:
|
||||
===============
|
||||
|
||||
@ -179,8 +291,9 @@ The Bochs and DOSemu projects which I used for information.
|
||||
Freedos for ideas in making my shell.
|
||||
The Beta Testers.
|
||||
|
||||
========
|
||||
Contact:
|
||||
========
|
||||
|
||||
Harekiet harekiet@zophar.net
|
||||
http://dosbox.zophar.net
|
||||
http://dosbox.sourceforge.net
|
||||
|
19
acinclude.m4
19
acinclude.m4
@ -303,9 +303,6 @@ AC_SUBST(ALSA_CFLAGS)
|
||||
AC_SUBST(ALSA_LIBS)
|
||||
])
|
||||
|
||||
|
||||
|
||||
|
||||
AH_TOP([
|
||||
/*
|
||||
* Copyright (C) 2002-2003 The DOSBox Team
|
||||
@ -326,8 +323,6 @@ AH_TOP([
|
||||
*/
|
||||
])
|
||||
|
||||
AH_TEMPLATE([C_HAS_ATTRIBUTE],[Determines if the compilers supports attributes for structures.])
|
||||
|
||||
AH_BOTTOM([#define INLINE inline])
|
||||
|
||||
AH_BOTTOM([#if C_HAS_ATTRIBUTE
|
||||
@ -336,18 +331,4 @@ AH_BOTTOM([#if C_HAS_ATTRIBUTE
|
||||
#define GCC_ATTRIBUTE(x) /* attribute not supported */
|
||||
#endif])
|
||||
|
||||
AH_BOTTOM([
|
||||
/* Enable some heavy debugging options */
|
||||
#define C_HEAVY_DEBUG 0
|
||||
|
||||
/* Enable some big compile-time increasing inlines */
|
||||
#define C_EXTRAINLINE 0
|
||||
|
||||
/* Enable the FPU module, still only for beta testing */
|
||||
#define C_FPU 0
|
||||
|
||||
/* Maximum memory address range in megabytes */
|
||||
#define C_MEM_MAX_SIZE 12
|
||||
])
|
||||
|
||||
|
||||
|
252
aclocal.m4
vendored
252
aclocal.m4
vendored
@ -1,6 +1,6 @@
|
||||
# aclocal.m4 generated automatically by aclocal 1.6.3 -*- Autoconf -*-
|
||||
# generated automatically by aclocal 1.7.7 -*- Autoconf -*-
|
||||
|
||||
# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
|
||||
# Free Software Foundation, Inc.
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -316,9 +316,6 @@ AC_SUBST(ALSA_CFLAGS)
|
||||
AC_SUBST(ALSA_LIBS)
|
||||
])
|
||||
|
||||
|
||||
|
||||
|
||||
AH_TOP([
|
||||
/*
|
||||
* Copyright (C) 2002-2003 The DOSBox Team
|
||||
@ -339,8 +336,6 @@ AH_TOP([
|
||||
*/
|
||||
])
|
||||
|
||||
AH_TEMPLATE([C_HAS_ATTRIBUTE],[Determines if the compilers supports attributes for structures.])
|
||||
|
||||
AH_BOTTOM([#define INLINE inline])
|
||||
|
||||
AH_BOTTOM([#if C_HAS_ATTRIBUTE
|
||||
@ -349,20 +344,6 @@ AH_BOTTOM([#if C_HAS_ATTRIBUTE
|
||||
#define GCC_ATTRIBUTE(x) /* attribute not supported */
|
||||
#endif])
|
||||
|
||||
AH_BOTTOM([
|
||||
/* Enable some heavy debugging options */
|
||||
#define C_HEAVY_DEBUG 0
|
||||
|
||||
/* Enable some big compile-time increasing inlines */
|
||||
#define C_EXTRAINLINE 0
|
||||
|
||||
/* Enable the FPU module, still only for beta testing */
|
||||
#define C_FPU 0
|
||||
|
||||
/* Maximum memory address range in megabytes */
|
||||
#define C_MEM_MAX_SIZE 12
|
||||
])
|
||||
|
||||
|
||||
|
||||
# Do all the work for Automake. -*- Autoconf -*-
|
||||
@ -370,7 +351,7 @@ AH_BOTTOM([
|
||||
# This macro actually does too much some checks are only needed if
|
||||
# your package does certain things. But this isn't really a big deal.
|
||||
|
||||
# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
@ -388,16 +369,9 @@ AH_BOTTOM([
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# serial 8
|
||||
# serial 10
|
||||
|
||||
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
|
||||
# written in clear, in which case automake, when reading aclocal.m4,
|
||||
# will think it sees a *use*, and therefore will trigger all it's
|
||||
# C support machinery. Also note that it means that autoscan, seeing
|
||||
# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
|
||||
|
||||
|
||||
AC_PREREQ([2.52])
|
||||
AC_PREREQ([2.54])
|
||||
|
||||
# Autoconf 2.50 wants to disallow AM_ names. We explicitly allow
|
||||
# the ones we care about.
|
||||
@ -423,6 +397,16 @@ if test "`cd $srcdir && pwd`" != "`pwd`" &&
|
||||
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
|
||||
fi
|
||||
|
||||
# test whether we have cygpath
|
||||
if test -z "$CYGPATH_W"; then
|
||||
if (cygpath --version) >/dev/null 2>/dev/null; then
|
||||
CYGPATH_W='cygpath -w'
|
||||
else
|
||||
CYGPATH_W=echo
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([CYGPATH_W])
|
||||
|
||||
# Define the identity of the package.
|
||||
dnl Distinguish between old-style and new-style calls.
|
||||
m4_ifval([$2],
|
||||
@ -430,8 +414,8 @@ m4_ifval([$2],
|
||||
AC_SUBST([PACKAGE], [$1])dnl
|
||||
AC_SUBST([VERSION], [$2])],
|
||||
[_AM_SET_OPTIONS([$1])dnl
|
||||
AC_SUBST([PACKAGE], [AC_PACKAGE_TARNAME])dnl
|
||||
AC_SUBST([VERSION], [AC_PACKAGE_VERSION])])dnl
|
||||
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
|
||||
AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
|
||||
|
||||
_AM_IF_OPTION([no-define],,
|
||||
[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
|
||||
@ -452,19 +436,41 @@ AM_PROG_INSTALL_STRIP
|
||||
# some platforms.
|
||||
AC_REQUIRE([AC_PROG_AWK])dnl
|
||||
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
|
||||
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
|
||||
|
||||
_AM_IF_OPTION([no-dependencies],,
|
||||
[AC_PROVIDE_IFELSE([AC_PROG_][CC],
|
||||
[AC_PROVIDE_IFELSE([AC_PROG_CC],
|
||||
[_AM_DEPENDENCIES(CC)],
|
||||
[define([AC_PROG_][CC],
|
||||
defn([AC_PROG_][CC])[_AM_DEPENDENCIES(CC)])])dnl
|
||||
AC_PROVIDE_IFELSE([AC_PROG_][CXX],
|
||||
[define([AC_PROG_CC],
|
||||
defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
|
||||
AC_PROVIDE_IFELSE([AC_PROG_CXX],
|
||||
[_AM_DEPENDENCIES(CXX)],
|
||||
[define([AC_PROG_][CXX],
|
||||
defn([AC_PROG_][CXX])[_AM_DEPENDENCIES(CXX)])])dnl
|
||||
[define([AC_PROG_CXX],
|
||||
defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
|
||||
])
|
||||
])
|
||||
|
||||
|
||||
# When config.status generates a header, we must update the stamp-h file.
|
||||
# This file resides in the same directory as the config header
|
||||
# that is generated. The stamp files are numbered to have different names.
|
||||
|
||||
# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
|
||||
# loop where config.status creates the headers, so we can generate
|
||||
# our stamp files there.
|
||||
AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
|
||||
[# Compute $1's index in $config_headers.
|
||||
_am_stamp_count=1
|
||||
for _am_header in $config_headers :; do
|
||||
case $_am_header in
|
||||
$1 | $1:* )
|
||||
break ;;
|
||||
* )
|
||||
_am_stamp_count=`expr $_am_stamp_count + 1` ;;
|
||||
esac
|
||||
done
|
||||
echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
|
||||
|
||||
# Copyright 2002 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
@ -485,14 +491,14 @@ AC_PROVIDE_IFELSE([AC_PROG_][CXX],
|
||||
# ----------------------------
|
||||
# Automake X.Y traces this macro to ensure aclocal.m4 has been
|
||||
# generated from the m4 files accompanying Automake X.Y.
|
||||
AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.6"])
|
||||
AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.7"])
|
||||
|
||||
# AM_SET_CURRENT_AUTOMAKE_VERSION
|
||||
# -------------------------------
|
||||
# Call AM_AUTOMAKE_VERSION so it can be traced.
|
||||
# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
|
||||
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
|
||||
[AM_AUTOMAKE_VERSION([1.6.3])])
|
||||
[AM_AUTOMAKE_VERSION([1.7.7])])
|
||||
|
||||
# Helper functions for option handling. -*- Autoconf -*-
|
||||
|
||||
@ -778,9 +784,42 @@ fi
|
||||
INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
|
||||
AC_SUBST([INSTALL_STRIP_PROGRAM])])
|
||||
|
||||
# serial 4 -*- Autoconf -*-
|
||||
# -*- Autoconf -*-
|
||||
# Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
|
||||
# Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program 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 General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# serial 1
|
||||
|
||||
# Check whether the underlying file-system supports filenames
|
||||
# with a leading dot. For instance MS-DOS doesn't.
|
||||
AC_DEFUN([AM_SET_LEADING_DOT],
|
||||
[rm -rf .tst 2>/dev/null
|
||||
mkdir .tst 2>/dev/null
|
||||
if test -d .tst; then
|
||||
am__leading_dot=.
|
||||
else
|
||||
am__leading_dot=_
|
||||
fi
|
||||
rmdir .tst 2>/dev/null
|
||||
AC_SUBST([am__leading_dot])])
|
||||
|
||||
# serial 5 -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -841,18 +880,32 @@ AC_CACHE_CHECK([dependency style of $depcc],
|
||||
# using a relative directory.
|
||||
cp "$am_depcomp" conftest.dir
|
||||
cd conftest.dir
|
||||
# We will build objects and dependencies in a subdirectory because
|
||||
# it helps to detect inapplicable dependency modes. For instance
|
||||
# both Tru64's cc and ICC support -MD to output dependencies as a
|
||||
# side effect of compilation, but ICC will put the dependencies in
|
||||
# the current directory while Tru64 will put them in the object
|
||||
# directory.
|
||||
mkdir sub
|
||||
|
||||
am_cv_$1_dependencies_compiler_type=none
|
||||
if test "$am_compiler_list" = ""; then
|
||||
am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
|
||||
fi
|
||||
for depmode in $am_compiler_list; do
|
||||
# Setup a source with many dependencies, because some compilers
|
||||
# like to wrap large dependency lists on column 80 (with \), and
|
||||
# we should not choose a depcomp mode which is confused by this.
|
||||
#
|
||||
# We need to recreate these files for each test, as the compiler may
|
||||
# overwrite some of them when testing with obscure command lines.
|
||||
# This happens at least with the AIX C compiler.
|
||||
echo '#include "conftest.h"' > conftest.c
|
||||
echo 'int i;' > conftest.h
|
||||
echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf
|
||||
: > sub/conftest.c
|
||||
for i in 1 2 3 4 5 6; do
|
||||
echo '#include "conftst'$i'.h"' >> sub/conftest.c
|
||||
: > sub/conftst$i.h
|
||||
done
|
||||
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
|
||||
|
||||
case $depmode in
|
||||
nosideeffect)
|
||||
@ -870,13 +923,20 @@ AC_CACHE_CHECK([dependency style of $depcc],
|
||||
# mode. It turns out that the SunPro C++ compiler does not properly
|
||||
# handle `-M -o', and we need to detect this.
|
||||
if depmode=$depmode \
|
||||
source=conftest.c object=conftest.o \
|
||||
depfile=conftest.Po tmpdepfile=conftest.TPo \
|
||||
$SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 &&
|
||||
grep conftest.h conftest.Po > /dev/null 2>&1 &&
|
||||
source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
|
||||
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
|
||||
$SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
|
||||
>/dev/null 2>conftest.err &&
|
||||
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
|
||||
grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
|
||||
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
|
||||
am_cv_$1_dependencies_compiler_type=$depmode
|
||||
break
|
||||
# icc doesn't choke on unknown options, it will just issue warnings
|
||||
# (even with -Werror). So we grep stderr for any message
|
||||
# that says an option was ignored.
|
||||
if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else
|
||||
am_cv_$1_dependencies_compiler_type=$depmode
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
@ -887,6 +947,9 @@ else
|
||||
fi
|
||||
])
|
||||
AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
|
||||
AM_CONDITIONAL([am__fastdep$1], [
|
||||
test "x$enable_dependency_tracking" != xno \
|
||||
&& test "$am_cv_$1_dependencies_compiler_type" = gcc3])
|
||||
])
|
||||
|
||||
|
||||
@ -895,16 +958,8 @@ AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
|
||||
# Choose a directory name for dependency files.
|
||||
# This macro is AC_REQUIREd in _AM_DEPENDENCIES
|
||||
AC_DEFUN([AM_SET_DEPDIR],
|
||||
[rm -f .deps 2>/dev/null
|
||||
mkdir .deps 2>/dev/null
|
||||
if test -d .deps; then
|
||||
DEPDIR=.deps
|
||||
else
|
||||
# MS-DOS does not allow filenames that begin with a dot.
|
||||
DEPDIR=_deps
|
||||
fi
|
||||
rmdir .deps 2>/dev/null
|
||||
AC_SUBST([DEPDIR])
|
||||
[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
|
||||
AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
|
||||
])
|
||||
|
||||
|
||||
@ -1006,7 +1061,9 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
|
||||
])
|
||||
|
||||
# Copyright 2001 Free Software Foundation, Inc. -*- Autoconf -*-
|
||||
# Check to see how 'make' treats includes. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -1031,8 +1088,9 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
AC_DEFUN([AM_MAKE_INCLUDE],
|
||||
[am_make=${MAKE-make}
|
||||
cat > confinc << 'END'
|
||||
doit:
|
||||
am__doit:
|
||||
@echo done
|
||||
.PHONY: am__doit
|
||||
END
|
||||
# If we don't find an include directive, just comment out the code.
|
||||
AC_MSG_CHECKING([for style of include used by $am_make])
|
||||
@ -1046,7 +1104,7 @@ echo "include confinc" > confmf
|
||||
# In particular we don't look at `^make:' because GNU make might
|
||||
# be invoked under some other name (usually "gmake"), in which
|
||||
# case it prints its new name instead of `make'.
|
||||
if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then
|
||||
if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
|
||||
am__include=include
|
||||
am__quote=
|
||||
_am_result=GNU
|
||||
@ -1060,9 +1118,9 @@ if test "$am__include" = "#"; then
|
||||
_am_result=BSD
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(am__include)
|
||||
AC_SUBST(am__quote)
|
||||
AC_MSG_RESULT($_am_result)
|
||||
AC_SUBST([am__include])
|
||||
AC_SUBST([am__quote])
|
||||
AC_MSG_RESULT([$_am_result])
|
||||
rm -f confinc confmf
|
||||
])
|
||||
|
||||
@ -1106,7 +1164,7 @@ else
|
||||
fi
|
||||
AC_CONFIG_COMMANDS_PRE(
|
||||
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
|
||||
AC_MSG_ERROR([conditional \"$1\" was never defined.
|
||||
AC_MSG_ERROR([conditional "$1" was never defined.
|
||||
Usually this means the macro was only invoked conditionally.])
|
||||
fi])])
|
||||
|
||||
@ -1133,58 +1191,6 @@ AC_PREREQ([2.52])
|
||||
|
||||
# serial 6
|
||||
|
||||
# When config.status generates a header, we must update the stamp-h file.
|
||||
# This file resides in the same directory as the config header
|
||||
# that is generated. We must strip everything past the first ":",
|
||||
# and everything past the last "/".
|
||||
|
||||
# _AM_DIRNAME(PATH)
|
||||
# -----------------
|
||||
# Like AS_DIRNAME, only do it during macro expansion
|
||||
AC_DEFUN([_AM_DIRNAME],
|
||||
[m4_if(regexp([$1], [^.*[^/]//*[^/][^/]*/*$]), -1,
|
||||
m4_if(regexp([$1], [^//\([^/]\|$\)]), -1,
|
||||
m4_if(regexp([$1], [^/.*]), -1,
|
||||
[.],
|
||||
patsubst([$1], [^\(/\).*], [\1])),
|
||||
patsubst([$1], [^\(//\)\([^/].*\|$\)], [\1])),
|
||||
patsubst([$1], [^\(.*[^/]\)//*[^/][^/]*/*$], [\1]))[]dnl
|
||||
])# _AM_DIRNAME
|
||||
|
||||
|
||||
# The stamp files are numbered to have different names.
|
||||
# We could number them on a directory basis, but that's additional
|
||||
# complications, let's have a unique counter.
|
||||
m4_define([_AM_STAMP_Count], [0])
|
||||
|
||||
|
||||
# _AM_STAMP(HEADER)
|
||||
# -----------------
|
||||
# The name of the stamp file for HEADER.
|
||||
AC_DEFUN([_AM_STAMP],
|
||||
[m4_define([_AM_STAMP_Count], m4_incr(_AM_STAMP_Count))dnl
|
||||
AS_ESCAPE(_AM_DIRNAME(patsubst([$1],
|
||||
[:.*])))/stamp-h[]_AM_STAMP_Count])
|
||||
|
||||
|
||||
# _AM_CONFIG_HEADER(HEADER[:SOURCES], COMMANDS, INIT-COMMANDS)
|
||||
# ------------------------------------------------------------
|
||||
# We used to try to get a real timestamp in stamp-h. But the fear is that
|
||||
# that will cause unnecessary cvs conflicts.
|
||||
AC_DEFUN([_AM_CONFIG_HEADER],
|
||||
[# Add the stamp file to the list of files AC keeps track of,
|
||||
# along with our hook.
|
||||
AC_CONFIG_HEADERS([$1],
|
||||
[# update the timestamp
|
||||
echo 'timestamp for $1' >"_AM_STAMP([$1])"
|
||||
$2],
|
||||
[$3])
|
||||
])# _AM_CONFIG_HEADER
|
||||
|
||||
|
||||
# AM_CONFIG_HEADER(HEADER[:SOURCES]..., COMMANDS, INIT-COMMANDS)
|
||||
# --------------------------------------------------------------
|
||||
AC_DEFUN([AM_CONFIG_HEADER],
|
||||
[AC_FOREACH([_AM_File], [$1], [_AM_CONFIG_HEADER(_AM_File, [$2], [$3])])
|
||||
])# AM_CONFIG_HEADER
|
||||
# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS.
|
||||
AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
|
||||
|
||||
|
32
config.h.in
32
config.h.in
@ -20,15 +20,33 @@
|
||||
*/
|
||||
|
||||
|
||||
/* Define to 1 to use inlined memory functions in cpu core */
|
||||
#undef C_CORE_INLINE
|
||||
|
||||
/* Define to 1 to enable internal debugger, requires libcurses */
|
||||
#undef C_DEBUG
|
||||
|
||||
/* Define to 1 to enable floating point emulation */
|
||||
#undef C_FPU
|
||||
|
||||
/* Determines if the compilers supports attributes for structures. */
|
||||
#undef C_HAS_ATTRIBUTE
|
||||
|
||||
/* Define to 1 to enable heavy debugging, also have to enable C_DEBUG */
|
||||
#undef C_HEAVY_DEBUG
|
||||
|
||||
/* Define to 1 to enable internal modem support, requires SDL_net */
|
||||
#undef C_MODEM
|
||||
|
||||
/* Define to 1 to enable screenshots, requires libpng */
|
||||
#undef C_SSHOT
|
||||
|
||||
/* environ can be included */
|
||||
#undef ENVIRON_INCLUDED
|
||||
|
||||
/* environ can be linked */
|
||||
#undef ENVIRON_LINKED
|
||||
|
||||
/* Define to 1 to use ALSA for MIDI */
|
||||
#undef HAVE_ALSA
|
||||
|
||||
@ -113,17 +131,3 @@
|
||||
#else
|
||||
#define GCC_ATTRIBUTE(x) /* attribute not supported */
|
||||
#endif
|
||||
|
||||
|
||||
/* Enable some heavy debugging options */
|
||||
#define C_HEAVY_DEBUG 0
|
||||
|
||||
/* Enable some big compile-time increasing inlines */
|
||||
#define C_EXTRAINLINE 0
|
||||
|
||||
/* Enable the FPU module, still only for beta testing */
|
||||
#define C_FPU 0
|
||||
|
||||
/* Maximum memory address range in megabytes */
|
||||
#define C_MEM_MAX_SIZE 12
|
||||
|
||||
|
75
config.sub
vendored
75
config.sub
vendored
@ -3,7 +3,7 @@
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||
# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2003-01-03'
|
||||
timestamp='2003-10-07'
|
||||
|
||||
# This file is (in principle) common to ALL GNU software.
|
||||
# The presence of a machine in this file suggests that SOME GNU software
|
||||
@ -118,7 +118,7 @@ esac
|
||||
# Here we must recognize all the valid KERNEL-OS combinations.
|
||||
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
||||
case $maybe_os in
|
||||
nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
|
||||
nto-qnx* | linux-gnu* | linux-dietlibc | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
|
||||
os=-$maybe_os
|
||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
||||
;;
|
||||
@ -228,13 +228,14 @@ case $basic_machine in
|
||||
| a29k \
|
||||
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
|
||||
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
|
||||
| am33_2.0 \
|
||||
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
|
||||
| clipper \
|
||||
| c4x | clipper \
|
||||
| d10v | d30v | dlx | dsp16xx \
|
||||
| fr30 | frv \
|
||||
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
|
||||
| i370 | i860 | i960 | ia64 \
|
||||
| ip2k \
|
||||
| ip2k | iq2000 \
|
||||
| m32r | m68000 | m68k | m88k | mcore \
|
||||
| mips | mipsbe | mipseb | mipsel | mipsle \
|
||||
| mips16 \
|
||||
@ -247,6 +248,7 @@ case $basic_machine in
|
||||
| mipsisa32 | mipsisa32el \
|
||||
| mipsisa32r2 | mipsisa32r2el \
|
||||
| mipsisa64 | mipsisa64el \
|
||||
| mipsisa64r2 | mipsisa64r2el \
|
||||
| mipsisa64sb1 | mipsisa64sb1el \
|
||||
| mipsisa64sr71k | mipsisa64sr71kel \
|
||||
| mipstx39 | mipstx39el \
|
||||
@ -257,11 +259,11 @@ case $basic_machine in
|
||||
| pdp10 | pdp11 | pj | pjl \
|
||||
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
|
||||
| pyramid \
|
||||
| sh | sh[1234] | sh3e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
|
||||
| sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
|
||||
| sh64 | sh64le \
|
||||
| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
|
||||
| strongarm \
|
||||
| tahoe | thumb | tic80 | tron \
|
||||
| tahoe | thumb | tic4x | tic80 | tron \
|
||||
| v850 | v850e \
|
||||
| we32k \
|
||||
| x86 | xscale | xstormy16 | xtensa \
|
||||
@ -296,7 +298,7 @@ case $basic_machine in
|
||||
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
|
||||
| avr-* \
|
||||
| bs2000-* \
|
||||
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* \
|
||||
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
|
||||
| clipper-* | cydra-* \
|
||||
| d10v-* | d30v-* | dlx-* \
|
||||
| elxsi-* \
|
||||
@ -304,7 +306,7 @@ case $basic_machine in
|
||||
| h8300-* | h8500-* \
|
||||
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
|
||||
| i*86-* | i860-* | i960-* | ia64-* \
|
||||
| ip2k-* \
|
||||
| ip2k-* | iq2000-* \
|
||||
| m32r-* \
|
||||
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
|
||||
| m88110-* | m88k-* | mcore-* \
|
||||
@ -319,6 +321,7 @@ case $basic_machine in
|
||||
| mipsisa32-* | mipsisa32el-* \
|
||||
| mipsisa32r2-* | mipsisa32r2el-* \
|
||||
| mipsisa64-* | mipsisa64el-* \
|
||||
| mipsisa64r2-* | mipsisa64r2el-* \
|
||||
| mipsisa64sb1-* | mipsisa64sb1el-* \
|
||||
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
|
||||
| mipstx39-* | mipstx39el-* \
|
||||
@ -329,11 +332,13 @@ case $basic_machine in
|
||||
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
|
||||
| pyramid-* \
|
||||
| romp-* | rs6000-* \
|
||||
| sh-* | sh[1234]-* | sh3e-* | sh[34]eb-* | shbe-* \
|
||||
| sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
|
||||
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
|
||||
| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
|
||||
| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
|
||||
| tahoe-* | thumb-* | tic30-* | tic4x-* | tic54x-* | tic80-* | tron-* \
|
||||
| tahoe-* | thumb-* \
|
||||
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
|
||||
| tron-* \
|
||||
| v850-* | v850e-* | vax-* \
|
||||
| we32k-* \
|
||||
| x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
|
||||
@ -371,6 +376,9 @@ case $basic_machine in
|
||||
basic_machine=a29k-none
|
||||
os=-bsd
|
||||
;;
|
||||
amd64)
|
||||
basic_machine=x86_64-pc
|
||||
;;
|
||||
amdahl)
|
||||
basic_machine=580-amdahl
|
||||
os=-sysv
|
||||
@ -766,18 +774,24 @@ case $basic_machine in
|
||||
pentiumpro | p6 | 6x86 | athlon | athlon_*)
|
||||
basic_machine=i686-pc
|
||||
;;
|
||||
pentiumii | pentium2)
|
||||
pentiumii | pentium2 | pentiumiii | pentium3)
|
||||
basic_machine=i686-pc
|
||||
;;
|
||||
pentium4)
|
||||
basic_machine=i786-pc
|
||||
;;
|
||||
pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
|
||||
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pentiumpro-* | p6-* | 6x86-* | athlon-*)
|
||||
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pentiumii-* | pentium2-*)
|
||||
pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
|
||||
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pentium4-*)
|
||||
basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pn)
|
||||
basic_machine=pn-gould
|
||||
;;
|
||||
@ -836,6 +850,10 @@ case $basic_machine in
|
||||
sb1el)
|
||||
basic_machine=mipsisa64sb1el-unknown
|
||||
;;
|
||||
sei)
|
||||
basic_machine=mips-sei
|
||||
os=-seiux
|
||||
;;
|
||||
sequent)
|
||||
basic_machine=i386-sequent
|
||||
;;
|
||||
@ -843,6 +861,9 @@ case $basic_machine in
|
||||
basic_machine=sh-hitachi
|
||||
os=-hms
|
||||
;;
|
||||
sh64)
|
||||
basic_machine=sh64-unknown
|
||||
;;
|
||||
sparclite-wrs | simso-wrs)
|
||||
basic_machine=sparclite-wrs
|
||||
os=-vxworks
|
||||
@ -917,14 +938,18 @@ case $basic_machine in
|
||||
basic_machine=t90-cray
|
||||
os=-unicos
|
||||
;;
|
||||
tic4x | c4x*)
|
||||
basic_machine=tic4x-unknown
|
||||
os=-coff
|
||||
;;
|
||||
tic54x | c54x*)
|
||||
basic_machine=tic54x-unknown
|
||||
os=-coff
|
||||
;;
|
||||
tic55x | c55x*)
|
||||
basic_machine=tic55x-unknown
|
||||
os=-coff
|
||||
;;
|
||||
tic6x | c6x*)
|
||||
basic_machine=tic6x-unknown
|
||||
os=-coff
|
||||
;;
|
||||
tx39)
|
||||
basic_machine=mipstx39-unknown
|
||||
;;
|
||||
@ -1027,7 +1052,7 @@ case $basic_machine in
|
||||
we32k)
|
||||
basic_machine=we32k-att
|
||||
;;
|
||||
sh3 | sh4 | sh3eb | sh4eb | sh[1234]le | sh3ele)
|
||||
sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
|
||||
basic_machine=sh-unknown
|
||||
;;
|
||||
sh64)
|
||||
@ -1106,7 +1131,7 @@ case $os in
|
||||
| -aos* \
|
||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||
| -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
|
||||
| -hiux* | -386bsd* | -knetbsd* | -netbsd* | -openbsd* | -kfreebsd* | -freebsd* | -riscix* \
|
||||
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||
@ -1118,7 +1143,7 @@ case $os in
|
||||
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
|
||||
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
|
||||
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
|
||||
| -powermax* | -dnix* | -microbsd*)
|
||||
| -powermax* | -dnix* | -nx6 | -nx7 | -sei*)
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
-qnx*)
|
||||
@ -1142,6 +1167,9 @@ case $os in
|
||||
-mac*)
|
||||
os=`echo $os | sed -e 's|mac|macos|'`
|
||||
;;
|
||||
-linux-dietlibc)
|
||||
os=-linux-dietlibc
|
||||
;;
|
||||
-linux*)
|
||||
os=`echo $os | sed -e 's|linux|linux-gnu|'`
|
||||
;;
|
||||
@ -1227,6 +1255,12 @@ case $os in
|
||||
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
|
||||
os=-mint
|
||||
;;
|
||||
-aros*)
|
||||
os=-aros
|
||||
;;
|
||||
-kaos*)
|
||||
os=-kaos
|
||||
;;
|
||||
-none)
|
||||
;;
|
||||
*)
|
||||
@ -1258,6 +1292,9 @@ case $basic_machine in
|
||||
arm*-semi)
|
||||
os=-aout
|
||||
;;
|
||||
c4x-* | tic4x-*)
|
||||
os=-coff
|
||||
;;
|
||||
# This must come before the *-dec entry.
|
||||
pdp10-*)
|
||||
os=-tops20
|
||||
|
683
configure
vendored
683
configure
vendored
@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.57 for dosbox 0.58.
|
||||
# Generated by GNU Autoconf 2.57 for dosbox 0.60.
|
||||
#
|
||||
# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
|
||||
# Free Software Foundation, Inc.
|
||||
@ -266,8 +266,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
|
||||
# Identity of this package.
|
||||
PACKAGE_NAME='dosbox'
|
||||
PACKAGE_TARNAME='dosbox'
|
||||
PACKAGE_VERSION='0.58'
|
||||
PACKAGE_STRING='dosbox 0.58'
|
||||
PACKAGE_VERSION='0.60'
|
||||
PACKAGE_STRING='dosbox 0.60'
|
||||
PACKAGE_BUGREPORT=''
|
||||
|
||||
ac_unique_file="README"
|
||||
@ -308,7 +308,7 @@ ac_includes_default="\
|
||||
# include <unistd.h>
|
||||
#endif"
|
||||
|
||||
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE RANLIB ac_ct_RANLIB SDL_CONFIG SDL_CFLAGS SDL_LIBS EGREP ALSA_CFLAGS ALSA_LIBS LIBOBJS LTLIBOBJS'
|
||||
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE am__leading_dot CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE RANLIB ac_ct_RANLIB SDL_CONFIG SDL_CFLAGS SDL_LIBS EGREP ALSA_CFLAGS ALSA_LIBS LIBOBJS LTLIBOBJS'
|
||||
ac_subst_files=''
|
||||
|
||||
# Initialize some variables set by options.
|
||||
@ -785,7 +785,7 @@ if test "$ac_init_help" = "long"; then
|
||||
# Omit some internal or obsolete options to make the list less imposing.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat <<_ACEOF
|
||||
\`configure' configures dosbox 0.58 to adapt to many kinds of systems.
|
||||
\`configure' configures dosbox 0.60 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
@ -852,7 +852,7 @@ fi
|
||||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of dosbox 0.58:";;
|
||||
short | recursive ) echo "Configuration of dosbox 0.60:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
@ -864,7 +864,8 @@ Optional Features:
|
||||
--disable-sdltest Do not try to compile and run a test SDL program
|
||||
--disable-alsatest Do not try to compile and run a test Alsa program
|
||||
--enable-debug Enable debug mode
|
||||
--enable-shots Enable screenshot support
|
||||
--enable-core-inline Enable inlined memory handling in CPU Core
|
||||
--disable-fpu Disable FPU support
|
||||
|
||||
Optional Packages:
|
||||
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
|
||||
@ -943,14 +944,14 @@ ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
|
||||
else
|
||||
echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
|
||||
fi
|
||||
cd $ac_popdir
|
||||
cd "$ac_popdir"
|
||||
done
|
||||
fi
|
||||
|
||||
test -n "$ac_init_help" && exit 0
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
dosbox configure 0.58
|
||||
dosbox configure 0.60
|
||||
generated by GNU Autoconf 2.57
|
||||
|
||||
Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
|
||||
@ -965,7 +966,7 @@ cat >&5 <<_ACEOF
|
||||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
It was created by dosbox $as_me 0.58, which was
|
||||
It was created by dosbox $as_me 0.60, which was
|
||||
generated by GNU Autoconf 2.57. Invocation command line was
|
||||
|
||||
$ $0 $@
|
||||
@ -1142,7 +1143,7 @@ _ASBOX
|
||||
echo "$as_me: caught signal $ac_signal"
|
||||
echo "$as_me: exit $exit_status"
|
||||
} >&5
|
||||
rm -f core core.* *.core &&
|
||||
rm -f core *.core &&
|
||||
rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
|
||||
exit $exit_status
|
||||
' 0
|
||||
@ -1412,7 +1413,7 @@ test -n "$target_alias" &&
|
||||
NONENONEs,x,x, &&
|
||||
program_prefix=${target_alias}-
|
||||
|
||||
am__api_version="1.6"
|
||||
am__api_version="1.7"
|
||||
# Find a good install program. We prefer a C program (faster),
|
||||
# so one script is as good as another. But avoid the broken or
|
||||
# incompatible versions:
|
||||
@ -1631,6 +1632,15 @@ echo "${ECHO_T}no" >&6
|
||||
SET_MAKE="MAKE=${MAKE-make}"
|
||||
fi
|
||||
|
||||
rm -rf .tst 2>/dev/null
|
||||
mkdir .tst 2>/dev/null
|
||||
if test -d .tst; then
|
||||
am__leading_dot=.
|
||||
else
|
||||
am__leading_dot=_
|
||||
fi
|
||||
rmdir .tst 2>/dev/null
|
||||
|
||||
# test to see if srcdir already configured
|
||||
if test "`cd $srcdir && pwd`" != "`pwd`" &&
|
||||
test -f $srcdir/config.status; then
|
||||
@ -1639,9 +1649,19 @@ echo "$as_me: error: source directory already configured; run \"make distclean\"
|
||||
{ (exit 1); exit 1; }; }
|
||||
fi
|
||||
|
||||
# test whether we have cygpath
|
||||
if test -z "$CYGPATH_W"; then
|
||||
if (cygpath --version) >/dev/null 2>/dev/null; then
|
||||
CYGPATH_W='cygpath -w'
|
||||
else
|
||||
CYGPATH_W=echo
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Define the identity of the package.
|
||||
PACKAGE=dosbox
|
||||
VERSION=0.58
|
||||
PACKAGE='dosbox'
|
||||
VERSION='0.60'
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
@ -1767,13 +1787,9 @@ INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
|
||||
|
||||
|
||||
|
||||
# Add the stamp file to the list of files AC keeps track of,
|
||||
# along with our hook.
|
||||
ac_config_headers="$ac_config_headers config.h"
|
||||
|
||||
|
||||
|
||||
|
||||
echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
|
||||
echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
|
||||
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'`
|
||||
@ -2571,8 +2587,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
for ac_declaration in \
|
||||
''\
|
||||
'#include <stdlib.h>' \
|
||||
'' \
|
||||
'extern "C" void std::exit (int) throw (); using std::exit;' \
|
||||
'extern "C" void std::exit (int); using std::exit;' \
|
||||
'extern "C" void exit (int) throw ();' \
|
||||
@ -2586,8 +2601,8 @@ _ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
#include <stdlib.h>
|
||||
$ac_declaration
|
||||
#include <stdlib.h>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
@ -2670,24 +2685,16 @@ ac_cpp='$CPP $CPPFLAGS'
|
||||
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||
rm -f .deps 2>/dev/null
|
||||
mkdir .deps 2>/dev/null
|
||||
if test -d .deps; then
|
||||
DEPDIR=.deps
|
||||
else
|
||||
# MS-DOS does not allow filenames that begin with a dot.
|
||||
DEPDIR=_deps
|
||||
fi
|
||||
rmdir .deps 2>/dev/null
|
||||
|
||||
DEPDIR="${am__leading_dot}deps"
|
||||
|
||||
ac_config_commands="$ac_config_commands depfiles"
|
||||
|
||||
|
||||
am_make=${MAKE-make}
|
||||
cat > confinc << 'END'
|
||||
doit:
|
||||
am__doit:
|
||||
@echo done
|
||||
.PHONY: am__doit
|
||||
END
|
||||
# If we don't find an include directive, just comment out the code.
|
||||
echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
|
||||
@ -2702,7 +2709,7 @@ echo "include confinc" > confmf
|
||||
# In particular we don't look at `^make:' because GNU make might
|
||||
# be invoked under some other name (usually "gmake"), in which
|
||||
# case it prints its new name instead of `make'.
|
||||
if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then
|
||||
if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
|
||||
am__include=include
|
||||
am__quote=
|
||||
_am_result=GNU
|
||||
@ -2762,18 +2769,32 @@ else
|
||||
# using a relative directory.
|
||||
cp "$am_depcomp" conftest.dir
|
||||
cd conftest.dir
|
||||
# We will build objects and dependencies in a subdirectory because
|
||||
# it helps to detect inapplicable dependency modes. For instance
|
||||
# both Tru64's cc and ICC support -MD to output dependencies as a
|
||||
# side effect of compilation, but ICC will put the dependencies in
|
||||
# the current directory while Tru64 will put them in the object
|
||||
# directory.
|
||||
mkdir sub
|
||||
|
||||
am_cv_CC_dependencies_compiler_type=none
|
||||
if test "$am_compiler_list" = ""; then
|
||||
am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
|
||||
fi
|
||||
for depmode in $am_compiler_list; do
|
||||
# Setup a source with many dependencies, because some compilers
|
||||
# like to wrap large dependency lists on column 80 (with \), and
|
||||
# we should not choose a depcomp mode which is confused by this.
|
||||
#
|
||||
# We need to recreate these files for each test, as the compiler may
|
||||
# overwrite some of them when testing with obscure command lines.
|
||||
# This happens at least with the AIX C compiler.
|
||||
echo '#include "conftest.h"' > conftest.c
|
||||
echo 'int i;' > conftest.h
|
||||
echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf
|
||||
: > sub/conftest.c
|
||||
for i in 1 2 3 4 5 6; do
|
||||
echo '#include "conftst'$i'.h"' >> sub/conftest.c
|
||||
: > sub/conftst$i.h
|
||||
done
|
||||
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
|
||||
|
||||
case $depmode in
|
||||
nosideeffect)
|
||||
@ -2791,13 +2812,20 @@ else
|
||||
# mode. It turns out that the SunPro C++ compiler does not properly
|
||||
# handle `-M -o', and we need to detect this.
|
||||
if depmode=$depmode \
|
||||
source=conftest.c object=conftest.o \
|
||||
depfile=conftest.Po tmpdepfile=conftest.TPo \
|
||||
$SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 &&
|
||||
grep conftest.h conftest.Po > /dev/null 2>&1 &&
|
||||
source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
|
||||
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
|
||||
$SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
|
||||
>/dev/null 2>conftest.err &&
|
||||
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
|
||||
grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
|
||||
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
|
||||
am_cv_CC_dependencies_compiler_type=$depmode
|
||||
break
|
||||
# icc doesn't choke on unknown options, it will just issue warnings
|
||||
# (even with -Werror). So we grep stderr for any message
|
||||
# that says an option was ignored.
|
||||
if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else
|
||||
am_cv_CC_dependencies_compiler_type=$depmode
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
@ -2813,6 +2841,18 @@ echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6
|
||||
CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
|
||||
|
||||
|
||||
|
||||
if
|
||||
test "x$enable_dependency_tracking" != xno \
|
||||
&& test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
|
||||
am__fastdepCC_TRUE=
|
||||
am__fastdepCC_FALSE='#'
|
||||
else
|
||||
am__fastdepCC_TRUE='#'
|
||||
am__fastdepCC_FALSE=
|
||||
fi
|
||||
|
||||
|
||||
ac_ext=c
|
||||
ac_cpp='$CPP $CPPFLAGS'
|
||||
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
@ -3273,8 +3313,7 @@ else
|
||||
fi
|
||||
fi
|
||||
for ac_declaration in \
|
||||
''\
|
||||
'#include <stdlib.h>' \
|
||||
'' \
|
||||
'extern "C" void std::exit (int) throw (); using std::exit;' \
|
||||
'extern "C" void std::exit (int); using std::exit;' \
|
||||
'extern "C" void exit (int) throw ();' \
|
||||
@ -3288,8 +3327,8 @@ _ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
#include <stdlib.h>
|
||||
$ac_declaration
|
||||
#include <stdlib.h>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
@ -3385,18 +3424,32 @@ else
|
||||
# using a relative directory.
|
||||
cp "$am_depcomp" conftest.dir
|
||||
cd conftest.dir
|
||||
# We will build objects and dependencies in a subdirectory because
|
||||
# it helps to detect inapplicable dependency modes. For instance
|
||||
# both Tru64's cc and ICC support -MD to output dependencies as a
|
||||
# side effect of compilation, but ICC will put the dependencies in
|
||||
# the current directory while Tru64 will put them in the object
|
||||
# directory.
|
||||
mkdir sub
|
||||
|
||||
am_cv_CXX_dependencies_compiler_type=none
|
||||
if test "$am_compiler_list" = ""; then
|
||||
am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
|
||||
fi
|
||||
for depmode in $am_compiler_list; do
|
||||
# Setup a source with many dependencies, because some compilers
|
||||
# like to wrap large dependency lists on column 80 (with \), and
|
||||
# we should not choose a depcomp mode which is confused by this.
|
||||
#
|
||||
# We need to recreate these files for each test, as the compiler may
|
||||
# overwrite some of them when testing with obscure command lines.
|
||||
# This happens at least with the AIX C compiler.
|
||||
echo '#include "conftest.h"' > conftest.c
|
||||
echo 'int i;' > conftest.h
|
||||
echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf
|
||||
: > sub/conftest.c
|
||||
for i in 1 2 3 4 5 6; do
|
||||
echo '#include "conftst'$i'.h"' >> sub/conftest.c
|
||||
: > sub/conftst$i.h
|
||||
done
|
||||
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
|
||||
|
||||
case $depmode in
|
||||
nosideeffect)
|
||||
@ -3414,13 +3467,20 @@ else
|
||||
# mode. It turns out that the SunPro C++ compiler does not properly
|
||||
# handle `-M -o', and we need to detect this.
|
||||
if depmode=$depmode \
|
||||
source=conftest.c object=conftest.o \
|
||||
depfile=conftest.Po tmpdepfile=conftest.TPo \
|
||||
$SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 &&
|
||||
grep conftest.h conftest.Po > /dev/null 2>&1 &&
|
||||
source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
|
||||
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
|
||||
$SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
|
||||
>/dev/null 2>conftest.err &&
|
||||
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
|
||||
grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
|
||||
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
|
||||
am_cv_CXX_dependencies_compiler_type=$depmode
|
||||
break
|
||||
# icc doesn't choke on unknown options, it will just issue warnings
|
||||
# (even with -Werror). So we grep stderr for any message
|
||||
# that says an option was ignored.
|
||||
if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else
|
||||
am_cv_CXX_dependencies_compiler_type=$depmode
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
@ -3436,6 +3496,18 @@ echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6
|
||||
CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type
|
||||
|
||||
|
||||
|
||||
if
|
||||
test "x$enable_dependency_tracking" != xno \
|
||||
&& test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then
|
||||
am__fastdepCXX_TRUE=
|
||||
am__fastdepCXX_FALSE='#'
|
||||
else
|
||||
am__fastdepCXX_TRUE='#'
|
||||
am__fastdepCXX_FALSE=
|
||||
fi
|
||||
|
||||
|
||||
# Find a good install program. We prefer a C program (faster),
|
||||
# so one script is as good as another. But avoid the broken or
|
||||
# incompatible versions:
|
||||
@ -3784,7 +3856,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
|
||||
( exit $ac_status )
|
||||
no_sdl=yes
|
||||
fi
|
||||
rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
|
||||
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
@ -4196,7 +4268,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
|
||||
( exit $ac_status )
|
||||
ac_cv_header_stdc=no
|
||||
fi
|
||||
rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
|
||||
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@ -4386,7 +4458,100 @@ fi
|
||||
|
||||
|
||||
|
||||
echo "$as_me:$LINENO: checking if environ can be included" >&5
|
||||
echo $ECHO_N "checking if environ can be included... $ECHO_C" >&6
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
#line $LINENO "configure"
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
*environ;
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
||||
(eval $ac_link) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -s conftest$ac_exeext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
echo "$as_me:$LINENO: result: yes" >&5
|
||||
echo "${ECHO_T}yes" >&6;
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define ENVIRON_INCLUDED 1
|
||||
_ACEOF
|
||||
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
echo "$as_me:$LINENO: result: no" >&5
|
||||
echo "${ECHO_T}no" >&6
|
||||
fi
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
|
||||
echo "$as_me:$LINENO: checking if environ can be linked" >&5
|
||||
echo $ECHO_N "checking if environ can be linked... $ECHO_C" >&6
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
#line $LINENO "configure"
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
extern char ** environ;
|
||||
int
|
||||
main ()
|
||||
{
|
||||
*environ;
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
||||
(eval $ac_link) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -s conftest$ac_exeext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
echo "$as_me:$LINENO: result: yes" >&5
|
||||
echo "${ECHO_T}yes" >&6;
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define ENVIRON_LINKED 1
|
||||
_ACEOF
|
||||
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
echo "$as_me:$LINENO: result: no" >&5
|
||||
echo "${ECHO_T}no" >&6
|
||||
fi
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
|
||||
|
||||
|
||||
#Check if the compiler support attributes
|
||||
|
||||
|
||||
echo "$as_me:$LINENO: checking if compiler allows __attribute__" >&5
|
||||
echo $ECHO_N "checking if compiler allows __attribute__... $ECHO_C" >&6
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
@ -4861,7 +5026,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
|
||||
( exit $ac_status )
|
||||
ac_cv_c_bigendian=yes
|
||||
fi
|
||||
rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
|
||||
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
fi
|
||||
rm -f conftest.$ac_objext conftest.$ac_ext
|
||||
@ -4889,6 +5054,8 @@ esac
|
||||
#Features to enable/disable
|
||||
|
||||
|
||||
|
||||
|
||||
# Check whether --enable-debug or --disable-debug was given.
|
||||
if test "${enable_debug+set}" = set; then
|
||||
enableval="$enable_debug"
|
||||
@ -5085,27 +5252,139 @@ if test $ac_cv_lib_curses_initscr = yes; then
|
||||
have_curses_lib=yes
|
||||
fi
|
||||
|
||||
echo "$as_me:$LINENO: checking for initscr in -lpdcurses" >&5
|
||||
echo $ECHO_N "checking for initscr in -lpdcurses... $ECHO_C" >&6
|
||||
if test "${ac_cv_lib_pdcurses_initscr+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lpdcurses $LIBS"
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
#line $LINENO "configure"
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
builtin and then its argument prototype would still apply. */
|
||||
char initscr ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
initscr ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
||||
(eval $ac_link) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -s conftest$ac_exeext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
ac_cv_lib_pdcurses_initscr=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_cv_lib_pdcurses_initscr=no
|
||||
fi
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: $ac_cv_lib_pdcurses_initscr" >&5
|
||||
echo "${ECHO_T}$ac_cv_lib_pdcurses_initscr" >&6
|
||||
if test $ac_cv_lib_pdcurses_initscr = yes; then
|
||||
have_pdcurses_lib=yes
|
||||
fi
|
||||
|
||||
|
||||
if test x$have_curses_lib = xyes -a x$have_curses_h = xyes ; then
|
||||
LIBS="$LIBS -lcurses"
|
||||
LIBS="$LIBS -lcurses"
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define C_DEBUG 1
|
||||
_ACEOF
|
||||
|
||||
if test x$enable_debug = xheavy ; then
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define C_HEAVY_DEBUG 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
elif test x$have_pdcurses_lib = xyes -a x$have_curses_h = xyes ; then
|
||||
LIBS="$LIBS -lpdcurses"
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define C_DEBUG 1
|
||||
_ACEOF
|
||||
|
||||
if test x$enable_debug = xheavy ; then
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define C_HEAVY_DEBUG 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
else
|
||||
{ echo "$as_me:$LINENO: WARNING: Can't enable debug mode without libcurses" >&5
|
||||
echo "$as_me: WARNING: Can't enable debug mode without libcurses" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: Can't find curses, debug mode disabled" >&5
|
||||
echo "$as_me: WARNING: Can't find curses, debug mode disabled" >&2;}
|
||||
fi
|
||||
|
||||
fi;
|
||||
|
||||
|
||||
|
||||
# Check whether --enable-shots or --disable-shots was given.
|
||||
if test "${enable_shots+set}" = set; then
|
||||
enableval="$enable_shots"
|
||||
# Check whether --enable-core-inline or --disable-core-inline was given.
|
||||
if test "${enable_core_inline+set}" = set; then
|
||||
enableval="$enable_core_inline"
|
||||
|
||||
if test "${ac_cv_header_png_h+set}" = set; then
|
||||
if test x$enable_core_inline = xyes ; then
|
||||
echo "$as_me:$LINENO: result: enabling inlined memory handling in CPU Core" >&5
|
||||
echo "${ECHO_T}enabling inlined memory handling in CPU Core" >&6,
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define C_CORE_INLINE 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
fi;
|
||||
|
||||
|
||||
|
||||
# Check whether --enable-fpu or --disable-fpu was given.
|
||||
if test "${enable_fpu+set}" = set; then
|
||||
enableval="$enable_fpu"
|
||||
|
||||
if test x$enable_fpu = xno ; then
|
||||
echo "$as_me:$LINENO: result: disabling FPU supportd" >&5
|
||||
echo "${ECHO_T}disabling FPU supportd" >&6
|
||||
else
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define C_FPU 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
else
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define C_FPU 1
|
||||
_ACEOF
|
||||
|
||||
fi;
|
||||
|
||||
|
||||
|
||||
if test "${ac_cv_header_png_h+set}" = set; then
|
||||
echo "$as_me:$LINENO: checking for png.h" >&5
|
||||
echo $ECHO_N "checking for png.h... $ECHO_C" >&6
|
||||
if test "${ac_cv_header_png_h+set}" = set; then
|
||||
@ -5239,7 +5518,7 @@ if test $ac_cv_header_png_h = yes; then
|
||||
fi
|
||||
|
||||
|
||||
echo "$as_me:$LINENO: checking for png_check_sig in -lpng" >&5
|
||||
echo "$as_me:$LINENO: checking for png_check_sig in -lpng" >&5
|
||||
echo $ECHO_N "checking for png_check_sig in -lpng... $ECHO_C" >&6
|
||||
if test "${ac_cv_lib_png_png_check_sig+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
@ -5297,18 +5576,222 @@ if test $ac_cv_lib_png_png_check_sig = yes; then
|
||||
have_png_lib=yes
|
||||
fi
|
||||
|
||||
if test x$have_png_lib = xyes -a x$have_png_h = xyes ; then
|
||||
LIBS="$LIBS -lpng -lz"
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
if test x$have_png_lib = xyes -a x$have_png_h = xyes ; then
|
||||
LIBS="$LIBS -lpng -lz"
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define C_SSHOT 1
|
||||
_ACEOF
|
||||
|
||||
else
|
||||
{ echo "$as_me:$LINENO: WARNING: Can't enable screenshots without libpng" >&5
|
||||
echo "$as_me: WARNING: Can't enable screenshots without libpng" >&2;}
|
||||
fi
|
||||
else
|
||||
{ echo "$as_me:$LINENO: WARNING: Can't find libpng, screenshot support disabled" >&5
|
||||
echo "$as_me: WARNING: Can't find libpng, screenshot support disabled" >&2;}
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if test "${ac_cv_header_SDL_SDL_net_h+set}" = set; then
|
||||
echo "$as_me:$LINENO: checking for SDL/SDL_net.h" >&5
|
||||
echo $ECHO_N "checking for SDL/SDL_net.h... $ECHO_C" >&6
|
||||
if test "${ac_cv_header_SDL_SDL_net_h+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: $ac_cv_header_SDL_SDL_net_h" >&5
|
||||
echo "${ECHO_T}$ac_cv_header_SDL_SDL_net_h" >&6
|
||||
else
|
||||
# Is the header compilable?
|
||||
echo "$as_me:$LINENO: checking SDL/SDL_net.h usability" >&5
|
||||
echo $ECHO_N "checking SDL/SDL_net.h usability... $ECHO_C" >&6
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
#line $LINENO "configure"
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
$ac_includes_default
|
||||
#include <SDL/SDL_net.h>
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
(eval $ac_compile) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -s conftest.$ac_objext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
ac_header_compiler=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_header_compiler=no
|
||||
fi
|
||||
rm -f conftest.$ac_objext conftest.$ac_ext
|
||||
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
|
||||
echo "${ECHO_T}$ac_header_compiler" >&6
|
||||
|
||||
# Is the header present?
|
||||
echo "$as_me:$LINENO: checking SDL/SDL_net.h presence" >&5
|
||||
echo $ECHO_N "checking SDL/SDL_net.h presence... $ECHO_C" >&6
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
#line $LINENO "configure"
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
#include <SDL/SDL_net.h>
|
||||
_ACEOF
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
|
||||
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } >/dev/null; then
|
||||
if test -s conftest.err; then
|
||||
ac_cpp_err=$ac_c_preproc_warn_flag
|
||||
else
|
||||
ac_cpp_err=
|
||||
fi
|
||||
else
|
||||
ac_cpp_err=yes
|
||||
fi
|
||||
if test -z "$ac_cpp_err"; then
|
||||
ac_header_preproc=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_header_preproc=no
|
||||
fi
|
||||
rm -f conftest.err conftest.$ac_ext
|
||||
echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
|
||||
echo "${ECHO_T}$ac_header_preproc" >&6
|
||||
|
||||
# So? What about this header?
|
||||
case $ac_header_compiler:$ac_header_preproc in
|
||||
yes:no )
|
||||
{ echo "$as_me:$LINENO: WARNING: SDL/SDL_net.h: accepted by the compiler, rejected by the preprocessor!" >&5
|
||||
echo "$as_me: WARNING: SDL/SDL_net.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: SDL/SDL_net.h: proceeding with the preprocessor's result" >&5
|
||||
echo "$as_me: WARNING: SDL/SDL_net.h: proceeding with the preprocessor's result" >&2;}
|
||||
(
|
||||
cat <<\_ASBOX
|
||||
## ------------------------------------ ##
|
||||
## Report this to bug-autoconf@gnu.org. ##
|
||||
## ------------------------------------ ##
|
||||
_ASBOX
|
||||
) |
|
||||
sed "s/^/$as_me: WARNING: /" >&2
|
||||
;;
|
||||
no:yes )
|
||||
{ echo "$as_me:$LINENO: WARNING: SDL/SDL_net.h: present but cannot be compiled" >&5
|
||||
echo "$as_me: WARNING: SDL/SDL_net.h: present but cannot be compiled" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: SDL/SDL_net.h: check for missing prerequisite headers?" >&5
|
||||
echo "$as_me: WARNING: SDL/SDL_net.h: check for missing prerequisite headers?" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: SDL/SDL_net.h: proceeding with the preprocessor's result" >&5
|
||||
echo "$as_me: WARNING: SDL/SDL_net.h: proceeding with the preprocessor's result" >&2;}
|
||||
(
|
||||
cat <<\_ASBOX
|
||||
## ------------------------------------ ##
|
||||
## Report this to bug-autoconf@gnu.org. ##
|
||||
## ------------------------------------ ##
|
||||
_ASBOX
|
||||
) |
|
||||
sed "s/^/$as_me: WARNING: /" >&2
|
||||
;;
|
||||
esac
|
||||
echo "$as_me:$LINENO: checking for SDL/SDL_net.h" >&5
|
||||
echo $ECHO_N "checking for SDL/SDL_net.h... $ECHO_C" >&6
|
||||
if test "${ac_cv_header_SDL_SDL_net_h+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
ac_cv_header_SDL_SDL_net_h=$ac_header_preproc
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: $ac_cv_header_SDL_SDL_net_h" >&5
|
||||
echo "${ECHO_T}$ac_cv_header_SDL_SDL_net_h" >&6
|
||||
|
||||
fi
|
||||
if test $ac_cv_header_SDL_SDL_net_h = yes; then
|
||||
have_sdl_net_h=yes
|
||||
fi
|
||||
|
||||
|
||||
echo "$as_me:$LINENO: checking for SDLNet_Init in -lSDL_net" >&5
|
||||
echo $ECHO_N "checking for SDLNet_Init in -lSDL_net... $ECHO_C" >&6
|
||||
if test "${ac_cv_lib_SDL_net_SDLNet_Init+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lSDL_net $LIBS"
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
#line $LINENO "configure"
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
builtin and then its argument prototype would still apply. */
|
||||
char SDLNet_Init ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
SDLNet_Init ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
||||
(eval $ac_link) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -s conftest$ac_exeext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
ac_cv_lib_SDL_net_SDLNet_Init=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_cv_lib_SDL_net_SDLNet_Init=no
|
||||
fi
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: $ac_cv_lib_SDL_net_SDLNet_Init" >&5
|
||||
echo "${ECHO_T}$ac_cv_lib_SDL_net_SDLNet_Init" >&6
|
||||
if test $ac_cv_lib_SDL_net_SDLNet_Init = yes; then
|
||||
have_sdl_net_lib=yes
|
||||
fi
|
||||
|
||||
if test x$have_sdl_net_lib = xyes -a x$have_sdl_net_h = xyes ; then
|
||||
LIBS="$LIBS -lSDL_net"
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define C_MODEM 1
|
||||
_ACEOF
|
||||
|
||||
else
|
||||
{ echo "$as_me:$LINENO: WARNING: Can't find SDL_net, internal modem disabled" >&5
|
||||
echo "$as_me: WARNING: Can't find SDL_net, internal modem disabled" >&2;}
|
||||
fi
|
||||
|
||||
fi;
|
||||
|
||||
case "$target" in
|
||||
*-*-cygwin* | *-*-mingw32*)
|
||||
@ -5325,7 +5808,7 @@ _ACEOF
|
||||
esac
|
||||
|
||||
|
||||
ac_config_files="$ac_config_files Makefile src/Makefile src/cpu/Makefile src/cpu/core_16/Makefile src/debug/Makefile src/dos/Makefile src/fpu/Makefile src/gui/Makefile src/hardware/Makefile src/ints/Makefile src/misc/Makefile src/shell/Makefile src/platform/Makefile src/platform/visualc/Makefile visualc/Makefile include/Makefile docs/Makefile"
|
||||
ac_config_files="$ac_config_files Makefile src/Makefile src/cpu/Makefile src/cpu/core_16/Makefile src/cpu/core_full/Makefile src/cpu/core_normal/Makefile src/debug/Makefile src/dos/Makefile src/fpu/Makefile src/gui/Makefile src/hardware/Makefile src/ints/Makefile src/misc/Makefile src/shell/Makefile src/platform/Makefile src/platform/visualc/Makefile visualc/Makefile include/Makefile docs/Makefile"
|
||||
cat >confcache <<\_ACEOF
|
||||
# This file is a shell script that caches the results of configure
|
||||
# tests run on this system so they can be shared between configure
|
||||
@ -5424,6 +5907,20 @@ echo "$as_me: error: conditional \"AMDEP\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
fi
|
||||
if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
|
||||
{ { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." >&5
|
||||
echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
fi
|
||||
if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
|
||||
{ { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." >&5
|
||||
echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
fi
|
||||
|
||||
: ${CONFIG_STATUS=./config.status}
|
||||
ac_clean_files_save=$ac_clean_files
|
||||
@ -5693,7 +6190,7 @@ _ASBOX
|
||||
} >&5
|
||||
cat >&5 <<_CSEOF
|
||||
|
||||
This file was extended by dosbox $as_me 0.58, which was
|
||||
This file was extended by dosbox $as_me 0.60, which was
|
||||
generated by GNU Autoconf 2.57. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
@ -5756,7 +6253,7 @@ _ACEOF
|
||||
|
||||
cat >>$CONFIG_STATUS <<_ACEOF
|
||||
ac_cs_version="\\
|
||||
dosbox config.status 0.58
|
||||
dosbox config.status 0.60
|
||||
configured by $0, generated by GNU Autoconf 2.57,
|
||||
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
|
||||
|
||||
@ -5871,6 +6368,8 @@ do
|
||||
"src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
|
||||
"src/cpu/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/cpu/Makefile" ;;
|
||||
"src/cpu/core_16/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/cpu/core_16/Makefile" ;;
|
||||
"src/cpu/core_full/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/cpu/core_full/Makefile" ;;
|
||||
"src/cpu/core_normal/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/cpu/core_normal/Makefile" ;;
|
||||
"src/debug/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/debug/Makefile" ;;
|
||||
"src/dos/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/dos/Makefile" ;;
|
||||
"src/fpu/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/fpu/Makefile" ;;
|
||||
@ -5986,6 +6485,7 @@ s,@target_os@,$target_os,;t t
|
||||
s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
|
||||
s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
|
||||
s,@INSTALL_DATA@,$INSTALL_DATA,;t t
|
||||
s,@CYGPATH_W@,$CYGPATH_W,;t t
|
||||
s,@PACKAGE@,$PACKAGE,;t t
|
||||
s,@VERSION@,$VERSION,;t t
|
||||
s,@ACLOCAL@,$ACLOCAL,;t t
|
||||
@ -6000,6 +6500,7 @@ s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t
|
||||
s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t
|
||||
s,@AWK@,$AWK,;t t
|
||||
s,@SET_MAKE@,$SET_MAKE,;t t
|
||||
s,@am__leading_dot@,$am__leading_dot,;t t
|
||||
s,@CC@,$CC,;t t
|
||||
s,@CFLAGS@,$CFLAGS,;t t
|
||||
s,@LDFLAGS@,$LDFLAGS,;t t
|
||||
@ -6014,11 +6515,15 @@ s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t
|
||||
s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t
|
||||
s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t
|
||||
s,@CCDEPMODE@,$CCDEPMODE,;t t
|
||||
s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t
|
||||
s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t
|
||||
s,@CPP@,$CPP,;t t
|
||||
s,@CXX@,$CXX,;t t
|
||||
s,@CXXFLAGS@,$CXXFLAGS,;t t
|
||||
s,@ac_ct_CXX@,$ac_ct_CXX,;t t
|
||||
s,@CXXDEPMODE@,$CXXDEPMODE,;t t
|
||||
s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t
|
||||
s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t
|
||||
s,@RANLIB@,$RANLIB,;t t
|
||||
s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
|
||||
s,@SDL_CONFIG@,$SDL_CONFIG,;t t
|
||||
@ -6454,13 +6959,29 @@ echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
|
||||
cat $tmp/config.h
|
||||
rm -f $tmp/config.h
|
||||
fi
|
||||
# Run the commands associated with the file.
|
||||
case $ac_file in
|
||||
config.h ) # update the timestamp
|
||||
echo 'timestamp for config.h' >"./stamp-h1"
|
||||
;;
|
||||
# Compute $ac_file's index in $config_headers.
|
||||
_am_stamp_count=1
|
||||
for _am_header in $config_headers :; do
|
||||
case $_am_header in
|
||||
$ac_file | $ac_file:* )
|
||||
break ;;
|
||||
* )
|
||||
_am_stamp_count=`expr $_am_stamp_count + 1` ;;
|
||||
esac
|
||||
done
|
||||
echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null ||
|
||||
$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
|
||||
X$ac_file : 'X\(//\)[^/]' \| \
|
||||
X$ac_file : 'X\(//\)$' \| \
|
||||
X$ac_file : 'X\(/\)' \| \
|
||||
. : '\(.\)' 2>/dev/null ||
|
||||
echo X$ac_file |
|
||||
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
|
||||
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
|
||||
/^X\(\/\/\)$/{ s//\1/; q; }
|
||||
/^X\(\/\).*/{ s//\1/; q; }
|
||||
s/.*/./; q'`/stamp-h$_am_stamp_count
|
||||
done
|
||||
_ACEOF
|
||||
cat >>$CONFIG_STATUS <<\_ACEOF
|
||||
|
||||
|
75
configure.in
75
configure.in
@ -1,5 +1,5 @@
|
||||
dnl Init.
|
||||
AC_INIT(dosbox,0.58)
|
||||
AC_INIT(dosbox,0.60)
|
||||
AC_PREREQ(2.50)
|
||||
AC_CONFIG_SRCDIR(README)
|
||||
|
||||
@ -36,9 +36,19 @@ AC_C_INLINE
|
||||
AC_TYPE_SIZE_T
|
||||
AC_STRUCT_TM
|
||||
|
||||
|
||||
AC_MSG_CHECKING(if environ can be included)
|
||||
AC_TRY_LINK([#include <unistd.h>
|
||||
#include <stdlib.h>],[*environ;],
|
||||
[AC_MSG_RESULT(yes);AC_DEFINE(ENVIRON_INCLUDED,1,[environ can be included])],AC_MSG_RESULT(no))
|
||||
AC_MSG_CHECKING(if environ can be linked)
|
||||
AC_TRY_LINK([extern char ** environ;],[*environ;],
|
||||
[AC_MSG_RESULT(yes);AC_DEFINE(ENVIRON_LINKED,1,[environ can be linked])],AC_MSG_RESULT(no))
|
||||
|
||||
dnl Checks for libraries.
|
||||
|
||||
#Check if the compiler support attributes
|
||||
AH_TEMPLATE([C_HAS_ATTRIBUTE],[Determines if the compilers supports attributes for structures.])
|
||||
AC_MSG_CHECKING(if compiler allows __attribute__)
|
||||
AC_TRY_COMPILE([], [typedef struct { } __attribute__ ((packed)) junk;],
|
||||
[ AC_MSG_RESULT(yes);AC_DEFINE(C_HAS_ATTRIBUTE)],AC_MSG_RESULT(no))
|
||||
@ -50,30 +60,67 @@ AC_C_BIGENDIAN
|
||||
|
||||
#Features to enable/disable
|
||||
AH_TEMPLATE(C_DEBUG,[Define to 1 to enable internal debugger, requires libcurses])
|
||||
AC_ARG_ENABLE(debug,[ --enable-debug Enable debug mode],[
|
||||
AH_TEMPLATE(C_HEAVY_DEBUG,[Define to 1 to enable heavy debugging, also have to enable C_DEBUG])
|
||||
AC_ARG_ENABLE(debug,AC_HELP_STRING([--enable-debug],[Enable debug mode]),[
|
||||
AC_CHECK_HEADER(curses.h,have_curses_h=yes,)
|
||||
AC_CHECK_LIB(curses, initscr, have_curses_lib=yes, , )
|
||||
AC_CHECK_LIB(pdcurses, initscr, have_pdcurses_lib=yes, , )
|
||||
|
||||
if test x$have_curses_lib = xyes -a x$have_curses_h = xyes ; then
|
||||
LIBS="$LIBS -lcurses"
|
||||
LIBS="$LIBS -lcurses"
|
||||
AC_DEFINE(C_DEBUG,1)
|
||||
if test x$enable_debug = xheavy ; then
|
||||
AC_DEFINE(C_HEAVY_DEBUG,1)
|
||||
fi
|
||||
elif test x$have_pdcurses_lib = xyes -a x$have_curses_h = xyes ; then
|
||||
LIBS="$LIBS -lpdcurses"
|
||||
AC_DEFINE(C_DEBUG,1)
|
||||
if test x$enable_debug = xheavy ; then
|
||||
AC_DEFINE(C_HEAVY_DEBUG,1)
|
||||
fi
|
||||
else
|
||||
AC_MSG_WARN([Can't enable debug mode without libcurses])
|
||||
AC_MSG_WARN([Can't find curses, debug mode disabled])
|
||||
fi
|
||||
],)
|
||||
|
||||
AH_TEMPLATE(C_SSHOT,[Define to 1 to enable screenshots, requires libpng])
|
||||
AC_ARG_ENABLE(shots,[ --enable-shots Enable screenshot support],[
|
||||
AC_CHECK_HEADER(png.h,have_png_h=yes,)
|
||||
AC_CHECK_LIB(png, png_check_sig, have_png_lib=yes, ,-lz)
|
||||
if test x$have_png_lib = xyes -a x$have_png_h = xyes ; then
|
||||
LIBS="$LIBS -lpng -lz"
|
||||
AC_DEFINE(C_SSHOT,1)
|
||||
else
|
||||
AC_MSG_WARN([Can't enable screenshots without libpng])
|
||||
AH_TEMPLATE(C_CORE_INLINE,[Define to 1 to use inlined memory functions in cpu core])
|
||||
AC_ARG_ENABLE(core-inline,AC_HELP_STRING([--enable-core-inline],[Enable inlined memory handling in CPU Core]),[
|
||||
if test x$enable_core_inline = xyes ; then
|
||||
AC_MSG_RESULT([enabling inlined memory handling in CPU Core]),
|
||||
AC_DEFINE(C_CORE_INLINE,1)
|
||||
fi
|
||||
],)
|
||||
|
||||
AH_TEMPLATE(C_FPU,[Define to 1 to enable floating point emulation])
|
||||
AC_ARG_ENABLE(fpu,AC_HELP_STRING([--disable-fpu],[Disable FPU support]),[
|
||||
if test x$enable_fpu = xno ; then
|
||||
AC_MSG_RESULT([disabling FPU supportd])
|
||||
else
|
||||
AC_DEFINE(C_FPU,1)
|
||||
fi
|
||||
],AC_DEFINE(C_FPU,1))
|
||||
|
||||
AH_TEMPLATE(C_SSHOT,[Define to 1 to enable screenshots, requires libpng])
|
||||
AC_CHECK_HEADER(png.h,have_png_h=yes,)
|
||||
AC_CHECK_LIB(png, png_check_sig, have_png_lib=yes, ,-lz)
|
||||
if test x$have_png_lib = xyes -a x$have_png_h = xyes ; then
|
||||
LIBS="$LIBS -lpng -lz"
|
||||
AC_DEFINE(C_SSHOT,1)
|
||||
else
|
||||
AC_MSG_WARN([Can't find libpng, screenshot support disabled])
|
||||
fi
|
||||
|
||||
AH_TEMPLATE(C_MODEM,[Define to 1 to enable internal modem support, requires SDL_net])
|
||||
AC_CHECK_HEADER(SDL/SDL_net.h,have_sdl_net_h=yes,)
|
||||
AC_CHECK_LIB(SDL_net, SDLNet_Init, have_sdl_net_lib=yes, , )
|
||||
if test x$have_sdl_net_lib = xyes -a x$have_sdl_net_h = xyes ; then
|
||||
LIBS="$LIBS -lSDL_net"
|
||||
AC_DEFINE(C_MODEM,1)
|
||||
else
|
||||
AC_MSG_WARN([Can't find SDL_net, internal modem disabled])
|
||||
fi
|
||||
|
||||
|
||||
dnl Some host detection and actions for them
|
||||
case "$target" in
|
||||
*-*-cygwin* | *-*-mingw32*)
|
||||
@ -95,6 +142,8 @@ Makefile
|
||||
src/Makefile
|
||||
src/cpu/Makefile
|
||||
src/cpu/core_16/Makefile
|
||||
src/cpu/core_full/Makefile
|
||||
src/cpu/core_normal/Makefile
|
||||
src/debug/Makefile
|
||||
src/dos/Makefile
|
||||
src/fpu/Makefile
|
||||
|
90
depcomp
90
depcomp
@ -1,7 +1,7 @@
|
||||
#! /bin/sh
|
||||
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
# Copyright 1999, 2000 Free Software Foundation, Inc.
|
||||
# Copyright 1999, 2000, 2003 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -172,19 +172,25 @@ sgi)
|
||||
|
||||
aix)
|
||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||
# in a .u file. This file always lives in the current directory.
|
||||
# Also, the AIX compiler puts `$object:' at the start of each line;
|
||||
# $object doesn't have directory information.
|
||||
stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
|
||||
# in a .u file. In older versions, this file always lives in the
|
||||
# current directory. Also, the AIX compiler puts `$object:' at the
|
||||
# start of each line; $object doesn't have directory information.
|
||||
# Version 6 uses the directory in both cases.
|
||||
stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
|
||||
tmpdepfile="$stripped.u"
|
||||
outname="$stripped.o"
|
||||
if test "$libtool" = yes; then
|
||||
"$@" -Wc,-M
|
||||
else
|
||||
"$@" -M
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
|
||||
if test -f "$tmpdepfile"; then :
|
||||
else
|
||||
stripped=`echo "$stripped" | sed 's,^.*/,,'`
|
||||
tmpdepfile="$stripped.u"
|
||||
fi
|
||||
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
@ -192,6 +198,7 @@ aix)
|
||||
fi
|
||||
|
||||
if test -f "$tmpdepfile"; then
|
||||
outname="$stripped.o"
|
||||
# Each line is of the form `foo.o: dependent.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
@ -206,6 +213,44 @@ aix)
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
icc)
|
||||
# Intel's C compiler understands `-MD -MF file'. However on
|
||||
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
|
||||
# ICC 7.0 will fill foo.d with something like
|
||||
# foo.o: sub/foo.c
|
||||
# foo.o: sub/foo.h
|
||||
# which is wrong. We want:
|
||||
# sub/foo.o: sub/foo.c
|
||||
# sub/foo.o: sub/foo.h
|
||||
# sub/foo.c:
|
||||
# sub/foo.h:
|
||||
# ICC 7.1 will output
|
||||
# foo.o: sub/foo.c sub/foo.h
|
||||
# and will wrap long lines using \ :
|
||||
# foo.o: sub/foo.c ... \
|
||||
# sub/foo.h ... \
|
||||
# ...
|
||||
|
||||
"$@" -MD -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each line is of the form `foo.o: dependent.h',
|
||||
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
|
||||
sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
tru64)
|
||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
|
||||
@ -240,8 +285,8 @@ tru64)
|
||||
fi
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
# That's a space and a tab in the [].
|
||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
# That's a tab and a space in the [].
|
||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
@ -254,7 +299,7 @@ tru64)
|
||||
|
||||
dashmstdout)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the proprocessed file to stdout, regardless of -o.
|
||||
# always write the preprocessed file to stdout, regardless of -o.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
@ -265,9 +310,7 @@ dashmstdout)
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove `-o $object'. We will use -o /dev/null later,
|
||||
# however we can't do the remplacement now because
|
||||
# `-o $object' might simply not be used
|
||||
# Remove `-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
@ -287,7 +330,11 @@ dashmstdout)
|
||||
done
|
||||
|
||||
test -z "$dashmflag" && dashmflag=-M
|
||||
"$@" -o /dev/null $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
|
||||
# Require at least two characters before searching for `:'
|
||||
# in the target name. This is to cope with DOS-style filenames:
|
||||
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
|
||||
"$@" $dashmflag |
|
||||
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
tr ' ' '
|
||||
@ -306,6 +353,13 @@ dashXmstdout)
|
||||
|
||||
makedepend)
|
||||
"$@" || exit $?
|
||||
# Remove any Libtool call
|
||||
if test "$libtool" = yes; then
|
||||
while test $1 != '--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
# X makedepend
|
||||
shift
|
||||
cleared=no
|
||||
@ -318,7 +372,9 @@ makedepend)
|
||||
case "$arg" in
|
||||
-D*|-I*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
-*)
|
||||
# Strip any option that makedepend may not understand. Remove
|
||||
# the object too, otherwise makedepend will parse it as a source file.
|
||||
-*|$object)
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
@ -339,7 +395,7 @@ makedepend)
|
||||
|
||||
cpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the proprocessed file to stdout.
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
@ -381,7 +437,7 @@ cpp)
|
||||
|
||||
msvisualcpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the proprocessed file to stdout, regardless of -o,
|
||||
# always write the preprocessed file to stdout, regardless of -o,
|
||||
# because we must use -o when running libtool.
|
||||
"$@" || exit $?
|
||||
IFS=" "
|
||||
|
144
docs/Makefile.in
144
docs/Makefile.in
@ -1,7 +1,7 @@
|
||||
# Makefile.in generated by automake 1.6.3 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.7.7 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -15,81 +15,127 @@
|
||||
@SET_MAKE@
|
||||
|
||||
# Main Makefile for DOSBox
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = @program_transform_name@
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
|
||||
EXEEXT = @EXEEXT@
|
||||
OBJEXT = @OBJEXT@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMDEP_FALSE = @AMDEP_FALSE@
|
||||
AMDEP_TRUE = @AMDEP_TRUE@
|
||||
AMTAR = @AMTAR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SDL_CFLAGS = @SDL_CFLAGS@
|
||||
SDL_CONFIG = @SDL_CONFIG@
|
||||
SDL_LIBS = @SDL_LIBS@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_RANLIB = @ac_ct_RANLIB@
|
||||
ac_ct_STRIP = @ac_ct_STRIP@
|
||||
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
|
||||
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
|
||||
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
|
||||
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
datadir = @datadir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
oldincludedir = @oldincludedir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target = @target@
|
||||
target_alias = @target_alias@
|
||||
target_cpu = @target_cpu@
|
||||
target_os = @target_os@
|
||||
target_vendor = @target_vendor@
|
||||
|
||||
man_MANS = dosbox.1
|
||||
EXTRA_DIST = $(man_MANS)
|
||||
subdir = docs
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
@ -97,7 +143,7 @@ DIST_SOURCES =
|
||||
|
||||
NROFF = nroff
|
||||
MANS = $(man_MANS)
|
||||
DIST_COMMON = Makefile.am Makefile.in
|
||||
DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
@ -144,6 +190,10 @@ uninstall-man1:
|
||||
done; \
|
||||
for i in $$list; do \
|
||||
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
|
||||
case "$$ext" in \
|
||||
1*) ;; \
|
||||
*) ext='1' ;; \
|
||||
esac; \
|
||||
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
|
||||
inst=`echo $$inst | sed -e 's/^.*\///'`; \
|
||||
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
|
||||
@ -153,13 +203,22 @@ uninstall-man1:
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
ctags: CTAGS
|
||||
CTAGS:
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
top_distdir = ..
|
||||
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@list='$(DISTFILES)'; for file in $$list; do \
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(DISTFILES)'; for file in $$list; do \
|
||||
case $$file in \
|
||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
|
||||
esac; \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
@ -185,7 +244,6 @@ all-am: Makefile $(MANS)
|
||||
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DESTDIR)$(man1dir)
|
||||
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
@ -205,7 +263,7 @@ mostlyclean-generic:
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@ -215,6 +273,7 @@ clean: clean-am
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f Makefile
|
||||
|
||||
distclean-am: clean-am distclean-generic
|
||||
|
||||
@ -237,6 +296,7 @@ install-man: install-man1
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f Makefile
|
||||
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
@ -244,6 +304,14 @@ mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-info-am uninstall-man
|
||||
|
||||
uninstall-man: uninstall-man1
|
||||
@ -254,8 +322,8 @@ uninstall-man: uninstall-man1
|
||||
install-exec-am install-info install-info-am install-man \
|
||||
install-man1 install-strip installcheck installcheck-am \
|
||||
installdirs maintainer-clean maintainer-clean-generic \
|
||||
mostlyclean mostlyclean-generic uninstall uninstall-am \
|
||||
uninstall-info-am uninstall-man uninstall-man1
|
||||
mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \
|
||||
uninstall-am uninstall-info-am uninstall-man uninstall-man1
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
|
198
docs/dosbox.1
198
docs/dosbox.1
@ -1,59 +1,193 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.TH DOSBOX 1 "March 31, 2003"
|
||||
.TH DOSBOX 1 "October 5, 2003"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.SH NAME
|
||||
dosbox \- an x86/DOS emulator with sound/graphics primarily for games
|
||||
dosbox \- an x86/DOS emulator with sound/graphics
|
||||
.SH SYNOPSIS
|
||||
.B dosbox
|
||||
[\fB-fullscreen\fR]
|
||||
[\fB-conf\fR \fIconfigfile\fR]
|
||||
[\fB-lang\fR \fIlangfile\fR]
|
||||
[\fBfile\fR]
|
||||
[\fB-c\fR \fIcommand1\fR <\fIcommand2\fR>...]
|
||||
.br
|
||||
.B [\-fullscreen]
|
||||
.BI "[\-conf " configfile ]
|
||||
.BI "[\-lang " langfile ]
|
||||
.B [file]
|
||||
.BI "[\-c " command ]
|
||||
.B [\-exit]
|
||||
.SH DESCRIPTION
|
||||
This manual page briefly documents
|
||||
\fBdosbox\fR, an x86/DOS emulator capable of running many games.
|
||||
.BR "dosbox" ", an x86/DOS emulator."
|
||||
.TP
|
||||
The optional \fBfile\fR argument should be a DOS executable or a directory. If it is a dos executable (.com .exe .bat) the program will run automatically. If it is a directory, a DOS session will run with the directory mounted as C:.
|
||||
.RB "The optional " file " argument should be a DOS executable or a directory. If it is a dos executable (.com .exe .bat) the program will run automatically. If it is a directory, a DOS session will run with the directory mounted as C:."
|
||||
.SH OPTIONS
|
||||
A summary of options is included below.
|
||||
.TP
|
||||
\fB-fullscreen\fR
|
||||
Start DOSBox in fullscreen mode
|
||||
.B \-fullscreen
|
||||
.RB "Start " dosbox " in fullscreen mode."
|
||||
.TP
|
||||
\fB-c\fR \fIcommand 1\fR [\fIcommand 2\fR] ...
|
||||
Run one or more DOS commands after starting \fBdosbox\fR. If an executable is
|
||||
also specified, these commands will be executed before running the program.
|
||||
.BI \-c " command"
|
||||
.RI "Runs the specified " command " before running "
|
||||
.BR file .
|
||||
.RI "Multiple commands can be specified. Each " command " should start with "
|
||||
.BR \-c " though."
|
||||
.TP
|
||||
\fB-conf\fR \fIconfigfile\fR
|
||||
Start \fBdosbox\fR with the options specified in \fIconfigfile\fR
|
||||
.BI \-conf " configfile
|
||||
.RB "Start " dosbox " with the options specified in "
|
||||
.IR configfile .
|
||||
.TP
|
||||
\fB-lang\fR \fIlangfile\fR
|
||||
Start \fBdosbox\fR with the language specified in \fIlangfile\fR
|
||||
.SH INTERNAL COMMANDS
|
||||
.BI \-lang " langfile
|
||||
.RB "Start " dosbox " with the language specified in "
|
||||
.IR langfile .
|
||||
.TP
|
||||
.B \-exit
|
||||
.BR dosbox " will exit after running the program specified by " file .
|
||||
.SH "INTERNAL COMMANDS"
|
||||
.B dosbox
|
||||
supports most of the DOS commands found in command.com. In addition, the
|
||||
following extra commands are available:
|
||||
.HP
|
||||
.BI "MOUNT [\-t " type "] [\-size " size ]
|
||||
.I driveletter sourcedirectory
|
||||
.B [\-aspi] [\-ioctl]
|
||||
.BI "[\-usecd " number "] [\-label " drivelabel ]
|
||||
.LP
|
||||
.B MOUNT \-cd
|
||||
.LP
|
||||
.RB "Program to mount local directories as drives inside " dosbox .
|
||||
.RS
|
||||
.TP
|
||||
\fBMOUNT\fR [\fB-t\fR \fItype\fR] [\fB-size\fR \fIsize\fR] \fBdriveletter\fR \fBsourcedirectory\fR [\fB-aspi\fR]
|
||||
Map \fBsourcedirectory\fR to \fBdriveletter\fR.
|
||||
\fItype\fR may be \fIdir\fR for a hard drive, \fIfloppy\fR for a floppy
|
||||
drive or \fIcdrom\fR for a cdrom. \fIsize\fR specifies the size of the volume.
|
||||
You can force ASPI mode for a cdrom with \fB-aspi\fR.
|
||||
.I driveletter
|
||||
The driveletter inside dosbox (eg. C).
|
||||
.TP
|
||||
\fBMEM\fR
|
||||
.I sourcedirectory
|
||||
The local directory you want to have inside dosbox.
|
||||
.TP
|
||||
.BI \-t " type"
|
||||
Type of the mounted directory. Supported are: dir (standard), floppy, cdrom.
|
||||
.TP
|
||||
.BI \-size " drivesize"
|
||||
Sets the size of the drive.
|
||||
.TP
|
||||
.BI \-label " drivelabel"
|
||||
.RI "Sets the name of the drive to " drivelabel ". Needed on some"
|
||||
systems if the cd label isn't read correctly. Useful when a
|
||||
program can't find its cdrom.
|
||||
.TP
|
||||
.B \-aspi
|
||||
Forces to use the aspi layer. Only valid if mounting a cdrom under
|
||||
Windows systems with an ASPI-Layer.
|
||||
.TP
|
||||
.B \-ioctl
|
||||
Forces to use ioctl commands. Only valid if mounting a cdrom under
|
||||
windows which support them (Win2000/XP/NT).
|
||||
.TP
|
||||
.BI \-usecd " number"
|
||||
Forces to use SDL cdrom support for drive number.
|
||||
.IR Number " can be found by "
|
||||
.BR \-cd ". Valid on all systems."
|
||||
.TP
|
||||
.B \-cd
|
||||
.RB "Displays all detected cdrom drives and their numbers. Use with " \-usecd "."
|
||||
.RE
|
||||
.PP
|
||||
.B "Example:"
|
||||
.TP
|
||||
.RB "To mount your /home/dos/dosgames directory as C drive in " dosbox :
|
||||
.RS
|
||||
mount c /home/dos/dosgames
|
||||
.RE
|
||||
.TP
|
||||
.B MEM
|
||||
.LP
|
||||
Display the amount of free memory
|
||||
.TP
|
||||
\fBCONFIG\fR [\fB-writeconf\fR] [\fB-writelang\fR] \fBfile\fR
|
||||
Write the current configuration or language settings to \fBfile\fR
|
||||
.B CONFIG [\-writeconf] [\-writelang] file
|
||||
.LP
|
||||
.RB "Write the current configuration or language settings to " file ,
|
||||
which is located on the local filesystem. Not a mounted drive in
|
||||
.BR dosbox .
|
||||
.TP
|
||||
.B LOADFIX [\-size] [programname] [parameters]
|
||||
.LP
|
||||
.B LOADFIX \-f
|
||||
.LP
|
||||
Program to eat up memory, Useful for old programs which don't expect much memory to be free.
|
||||
.RS
|
||||
.TP
|
||||
.B [programname]
|
||||
The name of the program which is executed after loadfix eats up its memory.
|
||||
.TP
|
||||
.B [parameters]
|
||||
.RB "Parameters given to the " programname " executable."
|
||||
.TP
|
||||
.B \-size
|
||||
The amount of memory to eat up (in kb). Example -32, -64 or -128
|
||||
.TP
|
||||
.B \-f
|
||||
Frees all memory eaten up by loadfix.
|
||||
.RE
|
||||
.SH FILES
|
||||
Configuration and language files use a format similar to Windows .ini files. If a file named
|
||||
\fBdosbox.conf\fR is found in the current directory, it will be automatically loaded.
|
||||
.BR dosbox.conf " is found in the current directory, it will be automatically loaded."
|
||||
.SH "SPECIAL KEYS"
|
||||
.TP 12m
|
||||
.IP ALT\-ENTER
|
||||
Go full screen and back.
|
||||
.IP CTRL\-F5
|
||||
Save a screenshot.
|
||||
.IP CTRL\-F6
|
||||
Start/Stop recording sound output to a wave file.
|
||||
.IP CTRL\-F7
|
||||
Decrease frameskip.
|
||||
.IP CTRL\-F8
|
||||
Increase frameskip.
|
||||
.IP CTRL\-F9
|
||||
Kill dosbox.
|
||||
.IP CTRL\-F10
|
||||
Capture/Release the mouse.
|
||||
.IP CTRL\-F11
|
||||
Slow down emulation (Increase DOSBox Cycles).
|
||||
.IP CTRL\-F12
|
||||
Speed up emulation (Decrease DOSBox Cycles).
|
||||
.PP
|
||||
.B "Note: "
|
||||
Once you increase your DOSBox cycles beyond your computer's maximum
|
||||
capacity, it will produce the same effect as slowing down the emulation.
|
||||
This maximum will vary from computer to computer, there is no standard.
|
||||
.SH "SYSTEM REQUIREMENTS"
|
||||
Fast machine. My guess would be pentium\-2 400+ to get decent emulation
|
||||
of games written for an 286 machine.
|
||||
For protected mode games a 1 Ghz machine is recommended and don't expect
|
||||
them to run fast though!! Be sure to read the next section on how to speed
|
||||
it up somewhat.
|
||||
.SS "To run resource\-demanding games"
|
||||
.BR dosbox " emulates the CPU, the sound and graphic cards, and some other"
|
||||
.RB " stuff, all at the same time. You can overclock " dosbox " by using CTRL\-F12, but"
|
||||
you'll be limited by the power of your actual CPU. You can see how much free
|
||||
time your true CPU has by various utils (top). Once 100% of your real CPU time is
|
||||
.RB "used there is no further way to speed up " dosbox " unless you reduce the load"
|
||||
.RB "generated by the non\-CPU parts of " dosbox .
|
||||
.PP
|
||||
So:
|
||||
.PP
|
||||
.RB "Close every program but " dosbox .
|
||||
.PP
|
||||
.RB "Overclock " dosbox " until 100% of your CPU is used.(CTR\-+F12)"
|
||||
.PP
|
||||
.RB "Since VGA emulation is the most demanding part of " dosbox " in terms of actual"
|
||||
CPU usage, we'll start here. Increase the number of frames skipped (in
|
||||
increments of one) by pressing CRTL\-F8. Your CPU usage should decrease.
|
||||
Go back one step and repeat this until the game runs fast enough for you.
|
||||
Please note that this is a trade off: you lose in fluidity of video what you
|
||||
gain in speed.
|
||||
.SH NOTES
|
||||
.RB "While we hope that, one day, " dosbox " will run virtually all programs ever made for the PC..."
|
||||
.RB "we are not there yet. At present, " dosbox " run on a 1.7 Gigahertz PC is roughly the equivalent of a 25MHz 386 PC."
|
||||
While the 0.60 release has added support for "protected mode" allowing for more complex and recent programs,
|
||||
but note that this support is early in development and nowhere near as complete as the support for 386 real\-mode
|
||||
games (or earlier). Also note that "protected mode" games need substantially more resources and may
|
||||
.RB "require a much faster processor for you to run it properly in " dosbox .
|
||||
.SH BUGS
|
||||
Not all DOS programs work properly. Notably, any program that uses protected mode will not work at all.
|
||||
DOSBox will exit without warning if an error occured.
|
||||
.SH SEE ALSO
|
||||
Not all DOS programs work properly.
|
||||
.BR dosbox " will exit without warning if an error occured."
|
||||
.SH "SEE ALSO"
|
||||
The README in /usr/share/doc/dosbox
|
||||
.SH AUTHOR
|
||||
This manual page was written by Peter Veenstra <H.P.Veenstra@student.rug.nl> and James Oakley <jfunk@funktronics.ca>,
|
||||
|
@ -13,15 +13,18 @@ hardware.h \
|
||||
inout.h \
|
||||
joystick.h \
|
||||
keyboard.h \
|
||||
logging.h \
|
||||
mem.h \
|
||||
mixer.h \
|
||||
modules.h \
|
||||
mouse.h \
|
||||
paging.h \
|
||||
pic.h \
|
||||
programs.h \
|
||||
render.h \
|
||||
regs.h \
|
||||
render.h \
|
||||
serialport.h \
|
||||
setup.h \
|
||||
support.h \
|
||||
timer.h \
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Makefile.in generated by automake 1.6.3 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.7.7 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -13,77 +13,122 @@
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = @program_transform_name@
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
|
||||
EXEEXT = @EXEEXT@
|
||||
OBJEXT = @OBJEXT@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMDEP_FALSE = @AMDEP_FALSE@
|
||||
AMDEP_TRUE = @AMDEP_TRUE@
|
||||
AMTAR = @AMTAR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SDL_CFLAGS = @SDL_CFLAGS@
|
||||
SDL_CONFIG = @SDL_CONFIG@
|
||||
SDL_LIBS = @SDL_LIBS@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_RANLIB = @ac_ct_RANLIB@
|
||||
ac_ct_STRIP = @ac_ct_STRIP@
|
||||
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
|
||||
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
|
||||
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
|
||||
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
datadir = @datadir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
oldincludedir = @oldincludedir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target = @target@
|
||||
target_alias = @target_alias@
|
||||
target_cpu = @target_cpu@
|
||||
target_os = @target_os@
|
||||
target_vendor = @target_vendor@
|
||||
noinst_HEADERS = \
|
||||
bios.h \
|
||||
callback.h \
|
||||
@ -99,28 +144,32 @@ hardware.h \
|
||||
inout.h \
|
||||
joystick.h \
|
||||
keyboard.h \
|
||||
logging.h \
|
||||
mem.h \
|
||||
mixer.h \
|
||||
modules.h \
|
||||
mouse.h \
|
||||
paging.h \
|
||||
pic.h \
|
||||
programs.h \
|
||||
render.h \
|
||||
regs.h \
|
||||
render.h \
|
||||
serialport.h \
|
||||
setup.h \
|
||||
support.h \
|
||||
timer.h \
|
||||
video.h
|
||||
|
||||
subdir = include
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
DIST_SOURCES =
|
||||
HEADERS = $(noinst_HEADERS)
|
||||
|
||||
DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in
|
||||
DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.in Makefile.am
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
@ -134,6 +183,9 @@ uninstall-info-am:
|
||||
ETAGS = etags
|
||||
ETAGSFLAGS =
|
||||
|
||||
CTAGS = ctags
|
||||
CTAGSFLAGS =
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
@ -159,20 +211,41 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
top_distdir = ..
|
||||
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@list='$(DISTFILES)'; for file in $$list; do \
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(DISTFILES)'; for file in $$list; do \
|
||||
case $$file in \
|
||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
|
||||
esac; \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
@ -197,7 +270,6 @@ check: check-am
|
||||
all-am: Makefile $(HEADERS)
|
||||
|
||||
installdirs:
|
||||
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
@ -217,7 +289,7 @@ mostlyclean-generic:
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@ -227,6 +299,7 @@ clean: clean-am
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f Makefile
|
||||
|
||||
distclean-am: clean-am distclean-generic distclean-tags
|
||||
|
||||
@ -249,6 +322,7 @@ install-man:
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f Makefile
|
||||
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
@ -256,16 +330,24 @@ mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-info-am
|
||||
|
||||
.PHONY: GTAGS all all-am check check-am clean clean-generic distclean \
|
||||
distclean-generic distclean-tags distdir dvi dvi-am info \
|
||||
info-am install install-am install-data install-data-am \
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic ctags \
|
||||
distclean distclean-generic distclean-tags distdir dvi dvi-am \
|
||||
info info-am install install-am install-data install-data-am \
|
||||
install-exec install-exec-am install-info install-info-am \
|
||||
install-man install-strip installcheck installcheck-am \
|
||||
installdirs maintainer-clean maintainer-clean-generic \
|
||||
mostlyclean mostlyclean-generic tags uninstall uninstall-am \
|
||||
uninstall-info-am
|
||||
mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \
|
||||
uninstall uninstall-am uninstall-info-am
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
|
@ -28,6 +28,7 @@ enum { CB_RETF,CB_IRET,CB_IRET_STI };
|
||||
|
||||
#define CB_MAX 1024
|
||||
#define CB_SEG 0xC800
|
||||
#define CB_BASE (CB_SEG << 4)
|
||||
|
||||
enum {
|
||||
CBRET_NONE=0,CBRET_STOP=1
|
||||
@ -47,6 +48,7 @@ void CALLBACK_RunRealInt(Bit8u intnum);
|
||||
void CALLBACK_RunRealFar(Bit16u seg,Bit16u off);
|
||||
|
||||
bool CALLBACK_Setup(Bitu callback,CallBack_Handler handler,Bitu type);
|
||||
bool CALLBACK_SetupAt(Bitu callback,CallBack_Handler handler,Bitu type,Bitu linearAddress);
|
||||
|
||||
bool CALLBACK_Free(Bitu callback);
|
||||
|
||||
|
381
include/cpu.h
381
include/cpu.h
@ -23,64 +23,353 @@
|
||||
#include "regs.h"
|
||||
#include "mem.h"
|
||||
|
||||
/* Some common Defines */
|
||||
/* A CPU Handler */
|
||||
typedef Bitu (CPU_Decoder)(void);
|
||||
extern CPU_Decoder * cpudecoder;
|
||||
|
||||
/* CPU Cycle Timing */
|
||||
extern Bits CPU_Cycles;
|
||||
extern Bits CPU_CycleLeft;
|
||||
extern Bits CPU_CycleMax;
|
||||
|
||||
/* Some common Defines */
|
||||
/* A CPU Handler */
|
||||
typedef Bits (CPU_Decoder)(void);
|
||||
extern CPU_Decoder * cpudecoder;
|
||||
|
||||
|
||||
//CPU Stuff
|
||||
void SetCPU16bit();
|
||||
void SetCPU16bit( );
|
||||
|
||||
//Types of Flag changing instructions
|
||||
enum {
|
||||
t_ADDb=0,t_ADDw,t_ADDd,
|
||||
t_ORb,t_ORw,t_ORd,
|
||||
t_ADCb,t_ADCw,t_ADCd,
|
||||
t_SBBb,t_SBBw,t_SBBd,
|
||||
t_ANDb,t_ANDw,t_ANDd,
|
||||
t_SUBb,t_SUBw,t_SUBd,
|
||||
t_XORb,t_XORw,t_XORd,
|
||||
t_CMPb,t_CMPw,t_CMPd,
|
||||
t_INCb,t_INCw,t_INCd,
|
||||
t_DECb,t_DECw,t_DECd,
|
||||
t_TESTb,t_TESTw,t_TESTd,
|
||||
t_SHLb,t_SHLw,t_SHLd,
|
||||
t_SHRb,t_SHRw,t_SHRd,
|
||||
t_SARb,t_SARw,t_SARd,
|
||||
t_ROLb,t_ROLw,t_ROLd,
|
||||
t_RORb,t_RORw,t_RORd,
|
||||
t_RCLb,t_RCLw,t_RCLd,
|
||||
t_RCRb,t_RCRw,t_RCRd,
|
||||
t_NEGb,t_NEGw,t_NEGd,
|
||||
t_CF,t_ZF,
|
||||
|
||||
t_DSHLw,t_DSHLd,
|
||||
t_DSHRw,t_DSHRd,
|
||||
t_MUL,t_DIV,
|
||||
t_UNKNOWN,
|
||||
t_NOTDONE,
|
||||
enum CODE_TYPE {
|
||||
CODE_REAL,
|
||||
CODE_PMODE16,
|
||||
CODE_PMODE32,
|
||||
CODE_INIT,
|
||||
};
|
||||
|
||||
void Interrupt(Bit8u num);
|
||||
extern bool parity_lookup[256];
|
||||
|
||||
//Flag Handling
|
||||
bool get_CF(void);
|
||||
bool get_AF(void);
|
||||
bool get_ZF(void);
|
||||
bool get_SF(void);
|
||||
bool get_OF(void);
|
||||
bool get_PF(void);
|
||||
void CPU_LLDT(Bitu selector);
|
||||
void CPU_LTR(Bitu selector);
|
||||
void CPU_LIDT(Bitu limit,Bitu base);
|
||||
void CPU_LGDT(Bitu limit,Bitu base);
|
||||
|
||||
#define LoadCF flags.cf=get_CF();
|
||||
#define LoadZF flags.zf=get_ZF();
|
||||
#define LoadSF flags.sf=get_SF();
|
||||
#define LoadOF flags.of=get_OF();
|
||||
void CPU_STR(Bitu & selector);
|
||||
void CPU_SLDT(Bitu & selector);
|
||||
void CPU_SIDT(Bitu & limit,Bitu & base);
|
||||
void CPU_SGDT(Bitu & limit,Bitu & base);
|
||||
|
||||
|
||||
void CPU_ARPL(Bitu & dest_sel,Bitu src_sel);
|
||||
void CPU_LAR(Bitu selector,Bitu & ar);
|
||||
void CPU_LSL(Bitu selector,Bitu & limit);
|
||||
|
||||
bool CPU_SET_CRX(Bitu cr,Bitu value);
|
||||
Bitu CPU_GET_CRX(Bitu cr);
|
||||
|
||||
void CPU_SMSW(Bitu & word);
|
||||
bool CPU_LMSW(Bitu word);
|
||||
|
||||
void CPU_VERR(Bitu selector);
|
||||
void CPU_VERW(Bitu selector);
|
||||
|
||||
bool CPU_JMP(bool use32,Bitu selector,Bitu offset);
|
||||
bool CPU_CALL(bool use32,Bitu selector,Bitu offset);
|
||||
bool CPU_RET(bool use32,Bitu bytes);
|
||||
|
||||
bool Interrupt(Bitu num);
|
||||
bool CPU_IRET(bool use32);
|
||||
void CPU_SetSegGeneral(SegNames seg,Bitu value);
|
||||
|
||||
void CPU_CPUID(void);
|
||||
void CPU_HLT(void);
|
||||
|
||||
Bitu CPU_Pop16(void);
|
||||
Bitu CPU_Pop32(void);
|
||||
void CPU_Push16(Bitu value);
|
||||
void CPU_Push32(Bitu value);
|
||||
|
||||
void CPU_SetFlags(Bitu word);
|
||||
|
||||
|
||||
INLINE void CPU_SetFlagsd(Bit32u word) {
|
||||
CPU_SetFlags(word);
|
||||
};
|
||||
|
||||
INLINE void CPU_SetFlagsw(Bit16u word) {
|
||||
CPU_SetFlags((flags.word&0xffff0000)|word);
|
||||
};
|
||||
|
||||
|
||||
|
||||
// *********************************************************************
|
||||
// Descriptor
|
||||
// *********************************************************************
|
||||
|
||||
#define CR0_PROTECTION 0x00000001
|
||||
#define CR0_FPUENABLED 0x00000002
|
||||
#define CR0_FPUMONITOR 0x00000004
|
||||
#define CR0_TASKSWITCH 0x00000008
|
||||
#define CR0_FPUPRESENT 0x00000010
|
||||
#define CR0_PAGING 0x80000000
|
||||
|
||||
|
||||
#define DESC_INVALID 0x00
|
||||
#define DESC_286_TSS_A 0x01
|
||||
#define DESC_LDT 0x02
|
||||
#define DESC_286_TSS_B 0x03
|
||||
#define DESC_286_CALL_GATE 0x04
|
||||
#define DESC_TASK_GATE 0x05
|
||||
#define DESC_286_INT_GATE 0x06
|
||||
#define DESC_286_TRAP_GATE 0x07
|
||||
|
||||
#define DESC_386_TSS_A 0x09
|
||||
#define DESC_386_TSS_B 0x0b
|
||||
#define DESC_386_CALL_GATE 0x0c
|
||||
#define DESC_386_INT_GATE 0x0e
|
||||
#define DESC_386_TRAP_GATE 0x0f
|
||||
|
||||
/* EU/ED Expand UP/DOWN RO/RW Read Only/Read Write NA/A Accessed */
|
||||
#define DESC_DATA_EU_RO_NA 0x10
|
||||
#define DESC_DATA_EU_RO_A 0x11
|
||||
#define DESC_DATA_EU_RW_NA 0x12
|
||||
#define DESC_DATA_EU_RW_A 0x13
|
||||
#define DESC_DATA_ED_RO_NA 0x14
|
||||
#define DESC_DATA_ED_RO_A 0x15
|
||||
#define DESC_DATA_ED_RW_NA 0x16
|
||||
#define DESC_DATA_ED_RW_A 0x17
|
||||
|
||||
/* N/R Readable NC/C Confirming A/NA Accessed */
|
||||
#define DESC_CODE_N_NC_A 0x18
|
||||
#define DESC_CODE_N_NC_NA 0x19
|
||||
#define DESC_CODE_R_NC_A 0x1a
|
||||
#define DESC_CODE_R_NC_NA 0x1b
|
||||
#define DESC_CODE_N_C_A 0x1c
|
||||
#define DESC_CODE_N_C_NA 0x1d
|
||||
#define DESC_CODE_R_C_A 0x1e
|
||||
#define DESC_CODE_R_C_NA 0x1f
|
||||
|
||||
#pragma pack(1)
|
||||
/* TSS Struct from Bochs - http://bochs.sf.net */
|
||||
struct TSS_386 {
|
||||
Bit16u back, RESERVED0; /* Backlink */
|
||||
Bit32u esp0; /* The CK stack pointer */
|
||||
Bit16u ss0, RESERVED1; /* The CK stack selector */
|
||||
Bit32u esp1; /* The parent KL stack pointer */
|
||||
Bit16u ss1, RESERVED2; /* The parent KL stack selector */
|
||||
Bit32u esp2; /* Unused */
|
||||
Bit16u ss2, RESERVED3; /* Unused */
|
||||
Bit32u cr3; /* The page directory pointer */
|
||||
Bit32u eip; /* The instruction pointer */
|
||||
Bit32u eflags; /* The flags */
|
||||
Bit32u eax, ecx, edx, ebx; /* The general purpose registers */
|
||||
Bit32u esp, ebp, esi, edi; /* The special purpose registers */
|
||||
Bit16u es, RESERVED4; /* The extra selector */
|
||||
Bit16u cs, RESERVED5; /* The code selector */
|
||||
Bit16u ss, RESERVED6; /* The application stack selector */
|
||||
Bit16u ds, RESERVED7; /* The data selector */
|
||||
Bit16u fs, RESERVED8; /* And another extra selector */
|
||||
Bit16u gs, RESERVED9; /* ... and another one */
|
||||
Bit16u ldt, RESERVED10; /* The local descriptor table */
|
||||
Bit16u trap; /* The trap flag (for debugging) */
|
||||
Bit16u io; /* The I/O Map base address */
|
||||
} GCC_ATTRIBUTE(packed);;
|
||||
|
||||
struct S_Descriptor {
|
||||
Bit32u limit_0_15 :16;
|
||||
Bit32u base_0_15 :16;
|
||||
Bit32u base_16_23 :8;
|
||||
Bit32u type :5;
|
||||
Bit32u dpl :2;
|
||||
Bit32u p :1;
|
||||
Bit32u limit_16_19 :4;
|
||||
Bit32u avl :1;
|
||||
Bit32u r :1;
|
||||
Bit32u big :1;
|
||||
Bit32u g :1;
|
||||
Bit32u base_24_31 :8;
|
||||
}GCC_ATTRIBUTE(packed);
|
||||
|
||||
struct G_Descriptor {
|
||||
Bit32u offset_0_15 :16;
|
||||
Bit32u selector :16;
|
||||
Bit32u paramcount :5;
|
||||
Bit32u reserved :3;
|
||||
Bit32u type :5;
|
||||
Bit32u dpl :2;
|
||||
Bit32u p :1;
|
||||
Bit32u offset_16_31 :16;
|
||||
} GCC_ATTRIBUTE(packed);
|
||||
|
||||
#pragma pack()
|
||||
|
||||
|
||||
struct TaskSegment_32 {
|
||||
Bit32u esp0; /* The CK stack pointer */
|
||||
Bit32u esp1; /* The parent KL stack pointer */
|
||||
Bit32u esp2; /* Unused */
|
||||
Bit32u cr3; /* The page directory pointer */
|
||||
Bit32u eip; /* The instruction pointer */
|
||||
Bit32u eflags; /* The flags */
|
||||
Bit32u eax, ecx, edx, ebx; /* The general purpose registers */
|
||||
Bit32u esp, ebp, esi, edi; /* The special purpose registers */
|
||||
Bit16u back; /* Backlink */
|
||||
Bit16u ss0; /* The CK stack selector */
|
||||
Bit16u ss1; /* The parent KL stack selector */
|
||||
Bit16u ss2; /* Unused */
|
||||
Bit16u es; /* The extra selector */
|
||||
Bit16u cs; /* The code selector */
|
||||
Bit16u ss; /* The application stack selector */
|
||||
Bit16u ds; /* The data selector */
|
||||
Bit16u fs; /* And another extra selector */
|
||||
Bit16u gs; /* ... and another one */
|
||||
Bit16u ldt; /* The local descriptor table */
|
||||
Bit16u trap; /* The trap flag (for debugging) */
|
||||
Bit16u io; /* The I/O Map base address */
|
||||
};
|
||||
|
||||
void CPU_ReadTaskSeg32(PhysPt base,TaskSegment_32 * seg);
|
||||
|
||||
class TaskStateSegment
|
||||
{
|
||||
public:
|
||||
bool Get_ss_esp(Bitu which,Bitu & _ss,Bitu & _esp) {
|
||||
PhysPt reader=seg_base+offsetof(TSS_386,esp0)+which*8;
|
||||
_esp=mem_readd(reader);
|
||||
_ss=mem_readw(reader+4);
|
||||
return true;
|
||||
}
|
||||
bool Get_cr3(Bitu which,Bitu & _cr3) {
|
||||
_cr3=mem_readd(seg_base+offsetof(TSS_386,cr3));;
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
PhysPt seg_base;
|
||||
Bitu seg_limit;
|
||||
Bitu seg_value;
|
||||
};
|
||||
|
||||
class Descriptor
|
||||
{
|
||||
public:
|
||||
Descriptor() { saved.fill[0]=saved.fill[1]=0; }
|
||||
|
||||
void Load(PhysPt address) {
|
||||
Bit32u* data = (Bit32u*)&saved;
|
||||
*data = mem_readd(address);
|
||||
*(data+1) = mem_readd(address+4);
|
||||
}
|
||||
void Save(PhysPt address) {
|
||||
Bit32u* data = (Bit32u*)&saved;
|
||||
mem_writed(address,*data);
|
||||
mem_writed(address+4,*(data+1));
|
||||
}
|
||||
PhysPt GetBase (void) {
|
||||
return (saved.seg.base_24_31<<24) | (saved.seg.base_16_23<<16) | saved.seg.base_0_15;
|
||||
}
|
||||
Bitu GetLimit (void) {
|
||||
Bitu limit = (saved.seg.limit_16_19<<16) | saved.seg.limit_0_15;
|
||||
if (saved.seg.g) return (limit<<12) | 0xFFF;
|
||||
return limit;
|
||||
}
|
||||
Bitu GetOffset(void) {
|
||||
return (saved.gate.offset_16_31 << 16) | saved.gate.offset_0_15;
|
||||
}
|
||||
Bitu GetSelector(void) {
|
||||
return saved.gate.selector;
|
||||
}
|
||||
Bitu Type(void) {
|
||||
return saved.seg.type;
|
||||
}
|
||||
Bitu Conforming(void) {
|
||||
return saved.seg.type & 8;
|
||||
}
|
||||
Bitu DPL(void) {
|
||||
return saved.seg.dpl;
|
||||
}
|
||||
Bitu Big(void) {
|
||||
return saved.seg.big;
|
||||
}
|
||||
public:
|
||||
union {
|
||||
S_Descriptor seg;
|
||||
G_Descriptor gate;
|
||||
Bit32u fill[2];
|
||||
} saved;
|
||||
};
|
||||
|
||||
class DescriptorTable {
|
||||
public:
|
||||
PhysPt GetBase (void) { return table_base; }
|
||||
Bitu GetLimit (void) { return table_limit; }
|
||||
void SetBase (PhysPt _base) { table_base = _base; }
|
||||
void SetLimit (Bitu _limit) { table_limit= _limit; }
|
||||
|
||||
bool GetDescriptor (Bitu selector, Descriptor& desc) {
|
||||
selector&=~7;
|
||||
if (selector>=table_limit) return false;
|
||||
desc.Load(table_base+(selector));
|
||||
return true;
|
||||
}
|
||||
protected:
|
||||
PhysPt table_base;
|
||||
Bitu table_limit;
|
||||
};
|
||||
|
||||
class GDTDescriptorTable : public DescriptorTable {
|
||||
public:
|
||||
bool GetDescriptor (Bitu selector, Descriptor& desc) {
|
||||
Bitu address=selector & ~7;
|
||||
if (selector & 4) {
|
||||
if (address>=ldt_limit) return false;
|
||||
desc.Load(ldt_base+address);
|
||||
return true;
|
||||
} else {
|
||||
if (address>=table_limit) return false;
|
||||
desc.Load(table_base+address);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Bitu SLDT(void) {
|
||||
return ldt_value;
|
||||
}
|
||||
bool LLDT(Bitu value) {
|
||||
//TODO checking
|
||||
Descriptor desc;
|
||||
GetDescriptor(value,desc);
|
||||
ldt_base=desc.GetBase();
|
||||
ldt_limit=desc.GetLimit();
|
||||
ldt_value=value;
|
||||
return true;
|
||||
}
|
||||
private:
|
||||
PhysPt ldt_base;
|
||||
Bitu ldt_limit;
|
||||
Bitu ldt_value;
|
||||
};
|
||||
|
||||
struct CPUBlock {
|
||||
Bitu cpl; /* Current Privilege */
|
||||
Bitu cr0;
|
||||
bool v86; /* Are we in a v86 task */
|
||||
bool pmode; /* Is Protected mode enabled */
|
||||
GDTDescriptorTable gdt;
|
||||
DescriptorTable idt;
|
||||
struct {
|
||||
Bit16u val;
|
||||
PhysPt base;
|
||||
Bitu type;
|
||||
} tr;
|
||||
struct {
|
||||
Bitu mask;
|
||||
bool big;
|
||||
} stack;
|
||||
struct {
|
||||
CODE_TYPE type; /* What kind of code are we running */
|
||||
bool big;
|
||||
} code;
|
||||
};
|
||||
|
||||
extern CPUBlock cpu;
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2002 The DOSBox Team
|
||||
* Copyright (C) 2002-2003 The DOSBox Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -26,9 +26,11 @@
|
||||
#if defined (_MSC_VER) /* MS Visual C++ */
|
||||
#include <direct.h>
|
||||
#include <io.h>
|
||||
#else /* LINUX */
|
||||
#define LONGTYPE(a) a##i64
|
||||
#else /* LINUX / GCC */
|
||||
#include <dirent.h>
|
||||
#include <unistd.h>
|
||||
#define LONGTYPE(a) a##LL
|
||||
#endif
|
||||
|
||||
#define CROSS_LEN 512 /* Maximum filename size */
|
||||
|
@ -25,6 +25,7 @@ void DEBUG_CheckExecuteBreakpoint(Bit16u seg, Bit32u off);
|
||||
bool DEBUG_ExitLoop(void);
|
||||
|
||||
extern Bitu cycle_count;
|
||||
extern Bitu debugCallback;
|
||||
|
||||
#ifdef C_HEAVY_DEBUG
|
||||
bool DEBUG_HeavyIsBreakpoint(void);
|
||||
|
@ -22,14 +22,16 @@
|
||||
#include <dos_system.h>
|
||||
#include <mem.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack (1)
|
||||
#endif
|
||||
struct CommandTail{
|
||||
Bit8u count; /* number of bytes returned */
|
||||
char buffer[127]; /* the buffer itself */
|
||||
} GCC_ATTRIBUTE(packed);
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack ()
|
||||
#endif
|
||||
|
||||
struct DOS_Date {
|
||||
Bit16u year;
|
||||
@ -95,6 +97,7 @@ bool DOS_GetFileDate(Bit16u entry, Bit16u* otime, Bit16u* odate);
|
||||
|
||||
/* Routines for Drive Class */
|
||||
bool DOS_OpenFile(char * name,Bit8u flags,Bit16u * entry);
|
||||
bool DOS_OpenFileExtended(char *name, Bit16u flags, Bit16u createAttr, Bit16u action, Bit16u *entry, Bit16u* status);
|
||||
bool DOS_CreateFile(char * name,Bit16u attribute,Bit16u * entry);
|
||||
bool DOS_UnlinkFile(char * name);
|
||||
bool DOS_FindFirst(char *search,Bit16u attr);
|
||||
@ -123,6 +126,7 @@ void DOS_SetupDevices(void);
|
||||
|
||||
/* Execute and new process creation */
|
||||
bool DOS_NewPSP(Bit16u pspseg,Bit16u size);
|
||||
bool DOS_ChildPSP(Bit16u pspseg,Bit16u size);
|
||||
bool DOS_Execute(char * name,PhysPt block,Bit8u flags);
|
||||
bool DOS_Terminate(bool tsr);
|
||||
|
||||
@ -199,29 +203,31 @@ INLINE Bit16u DOS_PackDate(Bit16u year,Bit16u mon,Bit16u day) {
|
||||
#define DOSERR_NOT_SAME_DEVICE 17
|
||||
#define DOSERR_NO_MORE_FILES 18
|
||||
|
||||
|
||||
/* Remains some classes used to access certain things */
|
||||
|
||||
#define sGet(s,m) GetIt(((s *)Phys2Host(pt))->m,(PhysPt)&(((s *)0)->m))
|
||||
#define sSave(s,m,val) SaveIt(((s *)Phys2Host(pt))->m,(PhysPt)&(((s *)0)->m),val)
|
||||
#define sGet(s,m) GetIt(((s *)0)->m,(PhysPt)&(((s *)0)->m))
|
||||
#define sSave(s,m,val) SaveIt(((s *)0)->m,(PhysPt)&(((s *)0)->m),val)
|
||||
|
||||
|
||||
class MemStruct {
|
||||
public:
|
||||
INLINE Bit8u GetIt(Bit8u,PhysPt addr) {
|
||||
INLINE Bit8u GetIt(Bit8u&,PhysPt addr) {
|
||||
return mem_readb(pt+addr);
|
||||
}
|
||||
INLINE Bit16u GetIt(Bit16u,PhysPt addr) {
|
||||
INLINE Bit16u GetIt(Bit16u&,PhysPt addr) {
|
||||
return mem_readw(pt+addr);
|
||||
}
|
||||
INLINE Bit32u GetIt(Bit32u,PhysPt addr) {
|
||||
INLINE Bit32u GetIt(Bit32u&,PhysPt addr) {
|
||||
return mem_readd(pt+addr);
|
||||
}
|
||||
INLINE void SaveIt(Bit8u,PhysPt addr,Bit8u val) {
|
||||
INLINE void SaveIt(Bit8u&,PhysPt addr,Bit8u val) {
|
||||
mem_writeb(pt+addr,val);
|
||||
}
|
||||
INLINE void SaveIt(Bit16u,PhysPt addr,Bit16u val) {
|
||||
INLINE void SaveIt(Bit16u&,PhysPt addr,Bit16u val) {
|
||||
mem_writew(pt+addr,val);
|
||||
}
|
||||
INLINE void SaveIt(Bit32u,PhysPt addr,Bit32u val) {
|
||||
INLINE void SaveIt(Bit32u&,PhysPt addr,Bit32u val) {
|
||||
mem_writed(pt+addr,val);
|
||||
}
|
||||
INLINE void SetPt(Bit16u seg) { pt=PhysMake(seg,0);}
|
||||
@ -233,16 +239,16 @@ protected:
|
||||
|
||||
class DOS_PSP :public MemStruct {
|
||||
public:
|
||||
DOS_PSP (Bit16u segment) { SetPt(segment);seg=segment;psp=(sPSP *)HostMake(segment,0);};
|
||||
DOS_PSP (Bit16u segment) { SetPt(segment);seg=segment;};
|
||||
void MakeNew (Bit16u memSize);
|
||||
void CopyFileTable (DOS_PSP* srcpsp);
|
||||
void CopyFileTable (DOS_PSP* srcpsp,bool createchildpsp);
|
||||
Bit16u FindFreeFileEntry (void);
|
||||
void CloseFiles (void);
|
||||
|
||||
void SaveVectors (void);
|
||||
void RestoreVectors (void);
|
||||
void SetSize (Bit16u size) { sSave(sPSP,next_seg,size); };
|
||||
Bit16u GetSize () { return sGet(sPSP,next_seg); };
|
||||
Bit16u GetSize (void) { return sGet(sPSP,next_seg); };
|
||||
void SetDTA (RealPt ptdta) { sSave(sPSP,dta,ptdta); };
|
||||
RealPt GetDTA (void) { return sGet(sPSP,dta); };
|
||||
void SetEnvironment (Bit16u envseg) { sSave(sPSP,environment,envseg); };
|
||||
@ -261,9 +267,11 @@ public:
|
||||
void SetCommandTail (RealPt src);
|
||||
bool SetNumFiles (Bit16u fileNum);
|
||||
Bit16u FindEntryByHandle (Bit8u handle);
|
||||
|
||||
|
||||
private:
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack(1)
|
||||
#endif
|
||||
struct sPSP {
|
||||
Bit8u exit[2]; /* CP/M-like exit poimt */
|
||||
Bit16u next_seg; /* Segment of first byte beyond memory allocated or program */
|
||||
@ -289,9 +297,10 @@ private:
|
||||
Bit8u fill_4[4]; /* unused */
|
||||
CommandTail cmdtail;
|
||||
} GCC_ATTRIBUTE(packed);
|
||||
#pragma pack()
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack()
|
||||
#endif
|
||||
Bit16u seg;
|
||||
sPSP* psp;
|
||||
public:
|
||||
static Bit16u rootpsp;
|
||||
};
|
||||
@ -302,7 +311,9 @@ public:
|
||||
void Clear(void);
|
||||
void LoadData(void);
|
||||
void SaveData(void); /* Save it as an exec block */
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack (1)
|
||||
#endif
|
||||
struct sOverlay {
|
||||
Bit16u loadseg;
|
||||
Bit16u relocation;
|
||||
@ -315,7 +326,9 @@ public:
|
||||
RealPt initsssp;
|
||||
RealPt initcsip;
|
||||
}GCC_ATTRIBUTE(packed);
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack()
|
||||
#endif
|
||||
sExec exec;
|
||||
sOverlay overlay;
|
||||
};
|
||||
@ -326,23 +339,31 @@ public:
|
||||
void SetLocation(Bit16u seg);
|
||||
void SetFirstMCB(Bit16u _first_mcb);
|
||||
void SetfirstFileTable(RealPt _first_table);
|
||||
void SetBuffers(Bit16u x,Bit16u y);
|
||||
RealPt GetPointer (void);
|
||||
private:
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack(1)
|
||||
#endif
|
||||
struct sDIB {
|
||||
Bit8u stuff1[22]; // some stuff, hopefully never used....
|
||||
Bit16u firstMCB; // first memory control block
|
||||
RealPt firstDPB; // first drive parameter block
|
||||
RealPt firstFileTable; // first system file table
|
||||
RealPt activeClock; // active clock device header
|
||||
RealPt activeCon; // active console device header
|
||||
Bit16u maxSectorLength; // maximum bytes per sector of any block device;
|
||||
RealPt discInfoBuffer; // pointer to disc info buffer
|
||||
RealPt curDirStructure; // pointer to current array of directory structure
|
||||
RealPt fcbTable; // pointer to system FCB table
|
||||
Bit8u stuff1[22]; // -0x18 some stuff, hopefully never used....
|
||||
Bit16u firstMCB; // -0x2 first memory control block
|
||||
RealPt firstDPB; // 0x00 first drive parameter block
|
||||
RealPt firstFileTable; // 0x04 first system file table
|
||||
RealPt activeClock; // 0x08 active clock device header
|
||||
RealPt activeCon; // 0x0c active console device header
|
||||
Bit16u maxSectorLength; // 0x10 maximum bytes per sector of any block device;
|
||||
RealPt discInfoBuffer; // 0x12 pointer to disc info buffer
|
||||
RealPt curDirStructure; // 0x16 pointer to current array of directory structure
|
||||
RealPt fcbTable; // 0x1a pointer to system FCB table
|
||||
Bit8u stuff2[0x21]; // 0x1e more stuff
|
||||
Bit16u buffers_x; // x in BUFFERS x,y
|
||||
Bit16u buffers_y; // y in BUFFERS x,y
|
||||
// some more stuff, hopefully never used.
|
||||
} GCC_ATTRIBUTE(packed);
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack ()
|
||||
#endif
|
||||
Bit16u seg;
|
||||
};
|
||||
|
||||
@ -360,7 +381,9 @@ public:
|
||||
void SetDirID(Bit16u entry) { sSave(sDTA,dirID,entry); };
|
||||
Bit16u GetDirID(void) { return sGet(sDTA,dirID); };
|
||||
private:
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack(1)
|
||||
#endif
|
||||
struct sDTA {
|
||||
Bit8u sdrive; /* The Drive the search is taking place */
|
||||
Bit8u sattr; /* The Attributes that need to be found */
|
||||
@ -374,7 +397,9 @@ private:
|
||||
Bit32u size;
|
||||
char name[DOS_NAMELENGTH_ASCII];
|
||||
} GCC_ATTRIBUTE(packed);
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack()
|
||||
#endif
|
||||
};
|
||||
|
||||
class DOS_FCB: public MemStruct {
|
||||
@ -397,7 +422,9 @@ public:
|
||||
private:
|
||||
bool extended;
|
||||
PhysPt real_pt;
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack (1)
|
||||
#endif
|
||||
struct sFCB {
|
||||
Bit8u drive; /* Drive number 0=default, 1=A, etc */
|
||||
Bit8u filename[8]; /* Space padded name */
|
||||
@ -414,7 +441,9 @@ private:
|
||||
Bit8u cur_rec; /* Current record in current block */
|
||||
Bit32u rndm; /* Current relative record number */
|
||||
} GCC_ATTRIBUTE(packed);
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack ()
|
||||
#endif
|
||||
};
|
||||
|
||||
class DOS_MCB : public MemStruct{
|
||||
@ -429,7 +458,9 @@ public:
|
||||
Bit16u GetSize(void) { return sGet(sMCB,size);}
|
||||
Bit16u GetPSPSeg(void) { return sGet(sMCB,psp_segment);}
|
||||
private:
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack (1)
|
||||
#endif
|
||||
struct sMCB {
|
||||
Bit8u type;
|
||||
Bit16u psp_segment;
|
||||
@ -437,7 +468,9 @@ private:
|
||||
Bit8u unused[3];
|
||||
Bit8u filename[8];
|
||||
} GCC_ATTRIBUTE(packed);
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack ()
|
||||
#endif
|
||||
};
|
||||
|
||||
extern DOS_InfoBlock dos_infoblock;;
|
||||
|
@ -16,6 +16,8 @@
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: dos_system.h,v 1.16 2003/10/09 13:50:27 finsterr Exp $ */
|
||||
|
||||
#ifndef DOSSYSTEM_H_
|
||||
#define DOSSYSTEM_H_
|
||||
|
||||
@ -51,7 +53,7 @@ class DOS_DTA;
|
||||
|
||||
class DOS_File {
|
||||
public:
|
||||
DOS_File() { name=0; };
|
||||
DOS_File():flags(0) { name=0; refCtr = 0; };
|
||||
virtual ~DOS_File(){};
|
||||
virtual bool Read(Bit8u * data,Bit16u * size)=0;
|
||||
virtual bool Write(Bit8u * data,Bit16u * size)=0;
|
||||
@ -62,12 +64,15 @@ public:
|
||||
virtual char* GetName(void) { return name; };
|
||||
virtual bool IsOpen() { return open; };
|
||||
virtual bool IsName(const char* _name) { if (!name) return false; return strcmp(name,_name)==0; };
|
||||
virtual void AddRef() { refCtr++; };
|
||||
virtual Bits RemoveRef() { return --refCtr; };
|
||||
Bit8u type;
|
||||
Bit32u flags;
|
||||
Bit16u time;
|
||||
Bit16u date;
|
||||
Bit16u attr;
|
||||
Bit32u size;
|
||||
Bits refCtr;
|
||||
bool open;
|
||||
char* name;
|
||||
/* Some Device Specific Stuff */
|
||||
@ -99,11 +104,16 @@ public:
|
||||
char* GetExpandName (const char* path);
|
||||
bool GetShortName (const char* fullname, char* shortname);
|
||||
|
||||
bool FindFirst (char* path, Bitu dtaAddress, Bitu& id);
|
||||
bool FindNext (Bitu id, char* &result);
|
||||
|
||||
void CacheOut (const char* path, bool ignoreLastDir = false);
|
||||
void AddEntry (const char* path, bool checkExist = false);
|
||||
void DeleteEntry (const char* path, bool ignoreLastDir = false);
|
||||
|
||||
void EmptyCache (void);
|
||||
void SetLabel (const char* name);
|
||||
char* GetLabel (void) { return label; };
|
||||
|
||||
class CFileInfo {
|
||||
public:
|
||||
@ -111,7 +121,7 @@ public:
|
||||
for (Bit32u i=0; i<fileList.size(); i++) delete fileList[i];
|
||||
fileList.clear();
|
||||
longNameList.clear();
|
||||
outputList.clear();
|
||||
compareCount = 0;
|
||||
};
|
||||
char orgname [CROSS_LEN];
|
||||
char shortname [DOS_NAMELENGTH_ASCII];
|
||||
@ -122,25 +132,23 @@ public:
|
||||
// contents
|
||||
std::vector<CFileInfo*> fileList;
|
||||
std::vector<CFileInfo*> longNameList;
|
||||
std::vector<CFileInfo*> outputList;
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
bool RemoveTrailingDot (char* shortname);
|
||||
Bit16s GetLongName (CFileInfo* info, char* shortname);
|
||||
Bits GetLongName (CFileInfo* info, char* shortname);
|
||||
void CreateShortName (CFileInfo* dir, CFileInfo* info);
|
||||
Bit16u CreateShortNameID (CFileInfo* dir, const char* name);
|
||||
bool SetResult (CFileInfo* dir, char * &result, Bit16u entryNr);
|
||||
bool IsCachedIn (CFileInfo* dir);
|
||||
CFileInfo* FindDirInfo (const char* path, char* expandedPath);
|
||||
bool RemoveSpaces (char* str);
|
||||
bool OpenDir (CFileInfo* dir, char* path, Bit16u& id);
|
||||
bool OpenDir (CFileInfo* dir, const char* path, Bit16u& id);
|
||||
void CreateEntry (CFileInfo* dir, const char* name);
|
||||
Bit16u GetFreeID (CFileInfo* dir);
|
||||
void Clear (void);
|
||||
|
||||
|
||||
CFileInfo* dirBase;
|
||||
char dirPath [CROSS_LEN];
|
||||
char basePath [CROSS_LEN];
|
||||
@ -154,7 +162,9 @@ private:
|
||||
CFileInfo* dirSearch [MAX_OPENDIRS];
|
||||
char dirSearchName [MAX_OPENDIRS];
|
||||
bool free [MAX_OPENDIRS];
|
||||
CFileInfo* dirFindFirst [MAX_OPENDIRS];
|
||||
|
||||
char label [CROSS_LEN];
|
||||
};
|
||||
|
||||
class DOS_No_Drive_Cache {
|
||||
@ -182,6 +192,9 @@ public:
|
||||
Bit16u GetCurrentEntry (void) { return 0; };
|
||||
|
||||
void EmptyCache (void) {};
|
||||
|
||||
void SetLabel (const char* name) {};
|
||||
char* GetLabel (void) {return "";};
|
||||
|
||||
public:
|
||||
char basePath [CROSS_LEN];
|
||||
@ -215,7 +228,7 @@ public:
|
||||
DOS_Drive_Cache dirCache;
|
||||
};
|
||||
|
||||
enum { OPEN_READ=0,OPEN_WRITE=1,OPEN_READWRITE=2 };
|
||||
enum { OPEN_READ=0,OPEN_WRITE=1,OPEN_READWRITE=2, DOS_NOT_INHERIT=128};
|
||||
enum { DOS_SEEK_SET=0,DOS_SEEK_CUR=1,DOS_SEEK_END=2};
|
||||
|
||||
|
||||
|
@ -22,8 +22,6 @@
|
||||
|
||||
void E_Exit(char * message,...);
|
||||
|
||||
void S_Warn(char * message,...);
|
||||
|
||||
void MSG_Add(const char*,const char*); //add messages to the internal langaugefile
|
||||
const char* MSG_Get(char const *); //get messages from the internal langaugafile
|
||||
|
||||
@ -61,27 +59,10 @@ void DOSBOX_Init(void);
|
||||
|
||||
class Config;
|
||||
extern Config * control;
|
||||
extern Bitu errorlevel;
|
||||
|
||||
#define LOG_MSG S_Warn
|
||||
|
||||
enum LOG_TYPES {
|
||||
LOG_ALL,
|
||||
LOG_VGA, LOG_VGAGFX,LOG_VGAMISC,LOG_INT10,
|
||||
LOG_SB,LOG_DMA,
|
||||
LOG_FPU,LOG_CPU,
|
||||
LOG_FCB,LOG_FILES,LOG_IOCTL,LOG_EXEC,LOG_DOSMISC,
|
||||
LOG_PIT,LOG_KEYBOARD,LOG_PIC,
|
||||
LOG_MOUSE,LOG_BIOS,LOG_GUI,LOG_MISC,
|
||||
LOG_MAX,LOG_ERROR=0x80
|
||||
};
|
||||
|
||||
#if C_DEBUG
|
||||
extern void DEBUG_ShowMsg(Bit32u msgmask, char * msg,...);
|
||||
#define LOG DEBUG_ShowMsg
|
||||
#else
|
||||
#define LOG
|
||||
#endif /* C_DEBUG */
|
||||
#ifndef __LOGGING_H_
|
||||
#include "logging.h"
|
||||
#endif // the logging system.
|
||||
|
||||
#endif /* __DOSBOX_H */
|
||||
|
||||
|
@ -38,13 +38,4 @@ void FPU_ESC6_EA(Bitu func,PhysPt ea);
|
||||
void FPU_ESC7_Normal(Bitu rm);
|
||||
void FPU_ESC7_EA(Bitu func,PhysPt ea);
|
||||
|
||||
#define FPU_ESC(code) { \
|
||||
Bit8u rm=Fetchb(); \
|
||||
if (rm>=0xc0) { \
|
||||
FPU_ESC ## code ## _Normal(rm); \
|
||||
} else { \
|
||||
GetEAa;FPU_ESC ## code ## _EA(rm,eaa); \
|
||||
} \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
65
include/logging.h
Normal file
65
include/logging.h
Normal file
@ -0,0 +1,65 @@
|
||||
#ifndef __LOGGING_H_
|
||||
#define __LOGGING_H_
|
||||
enum LOG_TYPES {
|
||||
LOG_ALL,
|
||||
LOG_VGA, LOG_VGAGFX,LOG_VGAMISC,LOG_INT10,
|
||||
LOG_SB,LOG_DMA,
|
||||
LOG_FPU,LOG_CPU,LOG_PAGING,
|
||||
LOG_FCB,LOG_FILES,LOG_IOCTL,LOG_EXEC,LOG_DOSMISC,
|
||||
LOG_PIT,LOG_KEYBOARD,LOG_PIC,
|
||||
LOG_MOUSE,LOG_BIOS,LOG_GUI,LOG_MISC,
|
||||
LOG_IO,
|
||||
LOG_MAX,
|
||||
};
|
||||
|
||||
enum LOG_SEVERITIES {
|
||||
LOG_NORMAL,
|
||||
LOG_WARN,
|
||||
LOG_ERROR,
|
||||
};
|
||||
|
||||
#if C_DEBUG
|
||||
class LOG
|
||||
{
|
||||
LOG_TYPES d_type;
|
||||
LOG_SEVERITIES d_severity;
|
||||
public:
|
||||
|
||||
LOG (LOG_TYPES type , LOG_SEVERITIES severity):
|
||||
d_type(type),
|
||||
d_severity(severity)
|
||||
{}
|
||||
void operator() (char* buf, ...); //../src/debug/debug_gui.cpp
|
||||
|
||||
};
|
||||
|
||||
void DEBUG_ShowMsg(char * format,...);
|
||||
#define LOG_MSG DEBUG_ShowMsg
|
||||
|
||||
#else //C_DEBUG
|
||||
|
||||
struct LOG
|
||||
{
|
||||
LOG(LOG_TYPES type, LOG_SEVERITIES severity) { return;}
|
||||
void operator()(char const* buf) { return;}
|
||||
void operator()(char const* buf, double f1) { return;}
|
||||
void operator()(char const* buf, double f1, double f2) { return;}
|
||||
void operator()(char const* buf, double f1, double f2, double f3) { return;}
|
||||
|
||||
void operator()(char const* buf, char const* s1) { return;}
|
||||
void operator()(char const* buf, char const* s1, double f1) { return;}
|
||||
void operator()(char const* buf, char const* s1, double f1,double f2) { return;}
|
||||
void operator()(char const* buf, double f1, char const* s1) { return;}
|
||||
|
||||
|
||||
|
||||
}; //add missing operators to here
|
||||
//try to avoid anything smaller than bit32...
|
||||
void GFX_ShowMsg(char * format,...);
|
||||
#define LOG_MSG GFX_ShowMsg
|
||||
|
||||
#endif //C_DEBUG
|
||||
|
||||
|
||||
#endif //__LOGGING_H_
|
||||
|
147
include/mem.h
147
include/mem.h
@ -26,34 +26,29 @@ typedef Bit32u PhysPt;
|
||||
typedef Bit8u * HostPt;
|
||||
typedef Bit32u RealPt;
|
||||
|
||||
typedef Bit8u (*MEMORY_ReadHandler)(PhysPt pt);
|
||||
typedef void (*MEMORY_WriteHandler)(PhysPt pt,Bit8u val);
|
||||
typedef Bits MemHandle;
|
||||
|
||||
#define PAGE_KB 16
|
||||
#define PAGE_SIZE (PAGE_KB*1024)
|
||||
#define PAGE_SHIFT 14
|
||||
#define PAGE_COUNT(A) (A & ((1 << PAGE_SHIFT)-1) ? 1+(A >> PAGE_SHIFT) : (A >> PAGE_SHIFT) )
|
||||
#define MAX_PAGES PAGE_COUNT(C_MEM_MAX_SIZE*1024*1024)
|
||||
#define MEM_PAGESIZE 4096
|
||||
|
||||
extern HostPt ReadHostTable[MAX_PAGES];
|
||||
extern HostPt WriteHostTable[MAX_PAGES];
|
||||
extern MEMORY_ReadHandler ReadHandlerTable[MAX_PAGES];
|
||||
extern MEMORY_WriteHandler WriteHandlerTable[MAX_PAGES];
|
||||
bool MEM_A20_Enabled(void);
|
||||
void MEM_A20_Enable(bool enable);
|
||||
|
||||
/* Memory management / EMS mapping */
|
||||
HostPt MEM_GetBlockPage(void);
|
||||
Bitu MEM_FreeTotal(void); //Free 4 kb pages
|
||||
Bitu MEM_FreeLargest(void); //Largest free 4 kb pages block
|
||||
Bitu MEM_TotalPages(void); //Total amount of 4 kb pages
|
||||
Bitu MEM_AllocatedPages(MemHandle handle); // amount of allocated pages of handle
|
||||
MemHandle MEM_AllocatePages(Bitu pages,bool sequence);
|
||||
PhysPt MEM_AllocatePage(void);
|
||||
void MEM_ReleasePages(MemHandle handle);
|
||||
bool MEM_ReAllocatePages(MemHandle & handle,Bitu pages,bool sequence);
|
||||
void MEM_MapPagesHandle(Bitu lin_page,MemHandle mem,Bitu mem_page,Bitu pages);
|
||||
void MEM_MapPagesDirect(Bitu lin_page,Bitu phys_page,Bitu pages);
|
||||
void MEM_UnmapPages(Bitu phys_page,Bitu pages);
|
||||
|
||||
|
||||
INLINE Bit16u PAGES(Bit32u bytes) {
|
||||
if ((bytes & 4095) == 0) return (Bit16u)(bytes>>12);
|
||||
return (Bit16u)(1+(bytes>>12));
|
||||
}
|
||||
|
||||
|
||||
void MEM_SetupPageHandlers(Bitu startpage,Bitu pages,MEMORY_ReadHandler read,MEMORY_WriteHandler write);
|
||||
void MEM_ClearPageHandlers(Bitu startpage,Bitu pages);
|
||||
|
||||
void MEM_SetupMapping(Bitu startpage,Bitu pages,void * data);
|
||||
void MEM_ClearMapping(Bitu startpage,Bitu pages);
|
||||
|
||||
extern HostPt memory;
|
||||
MemHandle MEM_NextHandle(MemHandle handle);
|
||||
|
||||
/*
|
||||
The folowing six functions are used everywhere in the end so these should be changed for
|
||||
@ -75,16 +70,20 @@ INLINE void writeb(HostPt off,Bit8u val) {
|
||||
off[0]=val;
|
||||
};
|
||||
INLINE void writew(HostPt off,Bit16u val) {
|
||||
off[0]=(Bit8u)((val & 0x00ff));
|
||||
off[1]=(Bit8u)((val & 0xff00) >> 8);
|
||||
off[0]=(Bit8u)(val);
|
||||
off[1]=(Bit8u)(val >> 8);
|
||||
};
|
||||
INLINE void writed(HostPt off,Bit32u val) {
|
||||
off[0]=(Bit8u)((val & 0x000000ff));
|
||||
off[1]=(Bit8u)((val & 0x0000ff00) >> 8);
|
||||
off[2]=(Bit8u)((val & 0x00ff0000) >> 16);
|
||||
off[3]=(Bit8u)((val & 0xff000000) >> 24);
|
||||
off[0]=(Bit8u)(val);
|
||||
off[1]=(Bit8u)(val >> 8);
|
||||
off[2]=(Bit8u)(val >> 16);
|
||||
off[3]=(Bit8u)(val >> 24);
|
||||
};
|
||||
|
||||
#define MLEB(_MLE_VAL_) (_MLE_VAL_)
|
||||
#define MLEW(_MLE_VAL_) ((_MLE_VAL_ >> 8) | (_MLE_VAL_ << 8))
|
||||
#define MLED(_MLE_VAL_) ((_MLE_VAL_ >> 24)|((_MLE_VAL_ >> 8)&0xFF00)|((_MLE_VAL_ << 8)&0xFF0000)|((_MLE_VAL_ << 24)&0xFF000000))
|
||||
|
||||
#else
|
||||
|
||||
INLINE Bit8u readb(HostPt off) {
|
||||
@ -106,12 +105,19 @@ INLINE void writed(HostPt off,Bit32u val) {
|
||||
*(Bit32u *)(off)=val;
|
||||
};
|
||||
|
||||
#define MLEB(_MLE_VAL_) (_MLE_VAL_)
|
||||
#define MLEW(_MLE_VAL_) (_MLE_VAL_)
|
||||
#define MLED(_MLE_VAL_) (_MLE_VAL_)
|
||||
|
||||
#endif
|
||||
|
||||
/* The Folowing six functions are slower but they recognize the paged memory system */
|
||||
//TODO maybe make em inline to go a bit faster
|
||||
#define WLE(VAR_,VAL_) \
|
||||
if (sizeof(VAR_)==1) VAR_=MLEB(VAL_); \
|
||||
if (sizeof(VAR_)==2) VAR_=MLEW(VAL_); \
|
||||
if (sizeof(VAR_)==4) VAR_=MLED(VAL_);
|
||||
|
||||
/* The Folowing six functions are slower but they recognize the paged memory system */
|
||||
|
||||
#if (!C_EXTRAINLINE)
|
||||
Bit8u mem_readb(PhysPt pt);
|
||||
Bit16u mem_readw(PhysPt pt);
|
||||
Bit32u mem_readd(PhysPt pt);
|
||||
@ -120,68 +126,22 @@ void mem_writeb(PhysPt pt,Bit8u val);
|
||||
void mem_writew(PhysPt pt,Bit16u val);
|
||||
void mem_writed(PhysPt pt,Bit32u val);
|
||||
|
||||
#else
|
||||
void phys_writeb(PhysPt addr,Bit8u val);
|
||||
void phys_writew(PhysPt addr,Bit16u val);
|
||||
void phys_writed(PhysPt addr,Bit32u val);
|
||||
|
||||
INLINE void mem_writeb(PhysPt pt,Bit8u val) {
|
||||
if (WriteHostTable[pt >> PAGE_SHIFT]) writeb(WriteHostTable[pt >> PAGE_SHIFT]+pt,val);
|
||||
else {
|
||||
WriteHandlerTable[pt >> PAGE_SHIFT](pt,val);
|
||||
}
|
||||
}
|
||||
|
||||
INLINE void mem_writew(PhysPt pt,Bit16u val) {
|
||||
if (WriteHostTable[pt >> PAGE_SHIFT]) writew(WriteHostTable[pt >> PAGE_SHIFT]+pt,val);
|
||||
else {
|
||||
WriteHandlerTable[pt >> PAGE_SHIFT](pt+0,(Bit8u)(val & 0xff));
|
||||
WriteHandlerTable[pt >> PAGE_SHIFT](pt+1,(Bit8u)((val >> 8) & 0xff) );
|
||||
}
|
||||
}
|
||||
|
||||
INLINE void mem_writed(PhysPt pt,Bit32u val) {
|
||||
if (WriteHostTable[pt >> PAGE_SHIFT]) writed(WriteHostTable[pt >> PAGE_SHIFT]+pt,val);
|
||||
else {
|
||||
WriteHandlerTable[pt >> PAGE_SHIFT](pt+0,(Bit8u)(val & 0xff));
|
||||
WriteHandlerTable[pt >> PAGE_SHIFT](pt+1,(Bit8u)((val >> 8) & 0xff) );
|
||||
WriteHandlerTable[pt >> PAGE_SHIFT](pt+2,(Bit8u)((val >> 16) & 0xff) );
|
||||
WriteHandlerTable[pt >> PAGE_SHIFT](pt+3,(Bit8u)((val >> 24) & 0xff) );
|
||||
}
|
||||
}
|
||||
|
||||
INLINE Bit8u mem_readb(PhysPt pt) {
|
||||
if (ReadHostTable[pt >> PAGE_SHIFT]) return readb(ReadHostTable[pt >> PAGE_SHIFT]+pt);
|
||||
else {
|
||||
return ReadHandlerTable[pt >> PAGE_SHIFT](pt);
|
||||
}
|
||||
}
|
||||
|
||||
INLINE Bit16u mem_readw(PhysPt pt) {
|
||||
if (ReadHostTable[pt >> PAGE_SHIFT]) return readw(ReadHostTable[pt >> PAGE_SHIFT]+pt);
|
||||
else {
|
||||
return
|
||||
(ReadHandlerTable[pt >> PAGE_SHIFT](pt+0)) |
|
||||
(ReadHandlerTable[pt >> PAGE_SHIFT](pt+1)) << 8;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
INLINE Bit32u mem_readd(PhysPt pt){
|
||||
if (ReadHostTable[pt >> PAGE_SHIFT]) return readd(ReadHostTable[pt >> PAGE_SHIFT]+pt);
|
||||
else {
|
||||
return
|
||||
(ReadHandlerTable[pt >> PAGE_SHIFT](pt+0)) |
|
||||
(ReadHandlerTable[pt >> PAGE_SHIFT](pt+1)) << 8 |
|
||||
(ReadHandlerTable[pt >> PAGE_SHIFT](pt+2)) << 16 |
|
||||
(ReadHandlerTable[pt >> PAGE_SHIFT](pt+3)) << 24;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
/* These don't check for alignment, better be sure it's correct */
|
||||
Bit32u phys_page_readd(Bitu page,Bitu off);
|
||||
|
||||
void MEM_BlockWrite(PhysPt pt,void * data,Bitu size);
|
||||
void MEM_BlockRead(PhysPt pt,void * data,Bitu size);
|
||||
void MEM_BlockCopy(PhysPt dest,PhysPt src,Bitu size);
|
||||
void MEM_StrCopy(PhysPt pt,char * data,Bitu size);
|
||||
|
||||
void mem_memcpy(PhysPt dest,PhysPt src,Bitu size);
|
||||
Bitu mem_strlen(PhysPt pt);
|
||||
void mem_strcpy(PhysPt dest,PhysPt src);
|
||||
|
||||
/* The folowing functions are all shortcuts to the above functions using physical addressing */
|
||||
|
||||
INLINE Bit8u real_readb(Bit16u seg,Bit16u off) {
|
||||
@ -204,13 +164,6 @@ INLINE void real_writed(Bit16u seg,Bit16u off,Bit32u val) {
|
||||
mem_writed(((seg<<4)+off),val);
|
||||
}
|
||||
|
||||
INLINE HostPt HostMake(Bit16u seg,Bit16u off) {
|
||||
return memory+(seg<<4)+off;
|
||||
}
|
||||
|
||||
INLINE HostPt Phys2Host(PhysPt pt) {
|
||||
return memory+pt;
|
||||
}
|
||||
|
||||
INLINE Bit16u RealSeg(RealPt pt) {
|
||||
return (Bit16u)(pt>>16);
|
||||
@ -228,10 +181,6 @@ INLINE PhysPt PhysMake(Bit16u seg,Bit16u off) {
|
||||
return (seg<<4)+off;
|
||||
}
|
||||
|
||||
INLINE HostPt Real2Host(RealPt pt) {
|
||||
return memory+(RealSeg(pt)<<4) +RealOff(pt);
|
||||
}
|
||||
|
||||
INLINE RealPt RealMake(Bit16u seg,Bit16u off) {
|
||||
return (seg<<16)+off;
|
||||
}
|
||||
|
@ -26,5 +26,5 @@ void Mouse_ButtonPressed(Bit8u button);
|
||||
void Mouse_ButtonReleased(Bit8u button);
|
||||
|
||||
void Mouse_AutoLock(bool enable);
|
||||
void Mouse_SetResolution(Bit16u width, Bit16u height);
|
||||
void Mouse_NewVideoMode(void);
|
||||
|
||||
|
224
include/paging.h
Normal file
224
include/paging.h
Normal file
@ -0,0 +1,224 @@
|
||||
/*
|
||||
* Copyright (C) 2002 The DOSBox Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef _PAGING_H_
|
||||
#define _PAGING_H_
|
||||
|
||||
#include "mem.h"
|
||||
|
||||
class PageDirectory;
|
||||
struct PageEntry;
|
||||
struct PageLink;
|
||||
|
||||
#define MEM_PAGE_SIZE (4096)
|
||||
#define XMS_START (0x110)
|
||||
|
||||
enum EntryTypes { //The type of memory contained in this link
|
||||
ENTRY_VGA,
|
||||
ENTRY_CHANGES,
|
||||
ENTRY_INIT,
|
||||
ENTRY_NA,
|
||||
ENTRY_ROM,
|
||||
ENTRY_LFB,
|
||||
ENTRY_RAM,
|
||||
ENTRY_ALLOC,
|
||||
};
|
||||
|
||||
enum VGA_RANGES {
|
||||
VGA_RANGE_A000,
|
||||
VGA_RANGE_B000,
|
||||
VGA_RANGE_B800,
|
||||
};
|
||||
|
||||
|
||||
class PageChange {
|
||||
public:
|
||||
virtual void Changed(PageLink * link,Bitu start,Bitu end)=0;
|
||||
};
|
||||
|
||||
/* Some other functions */
|
||||
void PAGING_Enable(bool enabled);
|
||||
bool PAGING_Enabled(void);
|
||||
|
||||
void MEM_CheckLinks(PageEntry * theentry);
|
||||
|
||||
PageDirectory * MEM_DefaultDirectory(void);
|
||||
Bitu PAGING_GetDirBase(void);
|
||||
void PAGING_SetDirBase(Bitu cr3);
|
||||
|
||||
PageLink * MEM_LinkPage(Bitu phys_page,PhysPt lin_base);
|
||||
|
||||
void MEM_UnlinkPage(PageLink * link);
|
||||
void MEM_SetLFB(Bitu _page,Bitu _pages,HostPt _pt);
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct {
|
||||
Bit32u p:1;
|
||||
Bit32u wr:1;
|
||||
Bit32u us:1;
|
||||
Bit32u pwt:1;
|
||||
Bit32u pcd:1;
|
||||
Bit32u a:1;
|
||||
Bit32u d:1;
|
||||
Bit32u pat:1;
|
||||
Bit32u g:1;
|
||||
Bit32u avl:3;
|
||||
Bit32u base:20;
|
||||
} X86_PageEntryBlock GCC_ATTRIBUTE(packed);
|
||||
#pragma pack()
|
||||
|
||||
union X86PageEntry {
|
||||
Bit32u load;
|
||||
X86_PageEntryBlock block;
|
||||
};
|
||||
|
||||
struct PageLink {
|
||||
HostPt read;
|
||||
HostPt write;
|
||||
PageChange * change;
|
||||
PhysPt lin_base;
|
||||
PageEntry * entry;
|
||||
union {
|
||||
PageDirectory * dir;
|
||||
Bitu table;
|
||||
} data;
|
||||
PageLink * next;
|
||||
};
|
||||
|
||||
struct PageEntry {
|
||||
PageLink * links;
|
||||
EntryTypes type;
|
||||
union {
|
||||
HostPt mem;
|
||||
PhysPt vga_base;
|
||||
PageDirectory * dir;
|
||||
} data;
|
||||
MemHandle next_handle;
|
||||
};
|
||||
|
||||
class PageDirectory {
|
||||
public:
|
||||
PageDirectory();
|
||||
~PageDirectory();
|
||||
void ClearDirectory(void);
|
||||
void SetBase(PhysPt page);
|
||||
void LinkPage(Bitu lin_page,Bitu phys_page);
|
||||
bool InitPage(Bitu lin_address);
|
||||
bool InitPageLinear(Bitu lin_address);
|
||||
void InvalidateTable(Bitu table);
|
||||
void InvalidateLink(Bitu table,Bitu index);
|
||||
PageDirectory * next;
|
||||
PageLink *links[1024*1024];
|
||||
PageLink *tables[1024];
|
||||
PageLink *link_dir; //Handler for main directory table
|
||||
PageEntry entry_init; //Handler for pages that need init
|
||||
PageLink link_init; //Handler for pages that need init
|
||||
Bit32u base_page; //Base got from CR3
|
||||
PageChange * table_change;
|
||||
PageChange * dir_change;
|
||||
};
|
||||
|
||||
struct PagingBlock {
|
||||
PageDirectory * cache;
|
||||
PageDirectory * dir;
|
||||
PageLink * free_link;
|
||||
Bitu cr3;
|
||||
bool enabled;
|
||||
};
|
||||
|
||||
extern PagingBlock paging;
|
||||
|
||||
/* Some support functions */
|
||||
|
||||
static INLINE PageLink * GetPageLink(PhysPt address) {
|
||||
Bitu index=(address>>12);
|
||||
return paging.dir->links[index];
|
||||
}
|
||||
|
||||
void PAGING_AddFreePageLink(PageLink * link);
|
||||
|
||||
PageLink * PAGING_GetFreePageLink(void);
|
||||
void MEM_SetupVGA(VGA_RANGES range,HostPt base);
|
||||
|
||||
/* Page Handler functions */
|
||||
|
||||
Bit8u ENTRY_readb(PageEntry * pentry,PhysPt address);
|
||||
Bit16u ENTRY_readw(PageEntry * pentry,PhysPt address);
|
||||
Bit32u ENTRY_readd(PageEntry * pentry,PhysPt address);
|
||||
void ENTRY_writeb(PageEntry * pentry,PhysPt address,Bit8u val);
|
||||
void ENTRY_writew(PageEntry * pentry,PhysPt address,Bit16u val);
|
||||
void ENTRY_writed(PageEntry * pentry,PhysPt address,Bit32u val);
|
||||
|
||||
/* Unaligned address handlers */
|
||||
Bit16u mem_unalignedreadw(PhysPt address);
|
||||
Bit32u mem_unalignedreadd(PhysPt address);
|
||||
void mem_unalignedwritew(PhysPt address,Bit16u val);
|
||||
void mem_unalignedwrited(PhysPt address,Bit32u val);
|
||||
|
||||
/* Special inlined memory reading/writing */
|
||||
|
||||
INLINE Bit8u mem_readb_inline(PhysPt address) {
|
||||
PageLink * plink=GetPageLink(address);
|
||||
|
||||
if (plink->read) return readb(plink->read+address);
|
||||
else return ENTRY_readb(plink->entry,address);
|
||||
}
|
||||
|
||||
INLINE Bit16u mem_readw_inline(PhysPt address) {
|
||||
if (address & 1) return mem_unalignedreadw(address);
|
||||
PageLink * plink=GetPageLink(address);
|
||||
|
||||
if (plink->read) return readw(plink->read+address);
|
||||
else return ENTRY_readw(plink->entry,address);
|
||||
}
|
||||
|
||||
|
||||
INLINE Bit32u mem_readd_inline(PhysPt address) {
|
||||
if (address & 3) return mem_unalignedreadd(address);
|
||||
PageLink * plink=GetPageLink(address);
|
||||
|
||||
if (plink->read) return readd(plink->read+address);
|
||||
else return ENTRY_readd(plink->entry,address);
|
||||
}
|
||||
|
||||
INLINE void mem_writeb_inline(PhysPt address,Bit8u val) {
|
||||
PageLink * plink=GetPageLink(address);
|
||||
|
||||
if (plink->write) writeb(plink->write+address,val);
|
||||
else ENTRY_writeb(plink->entry,address,val);
|
||||
}
|
||||
|
||||
INLINE void mem_writew_inline(PhysPt address,Bit16u val) {
|
||||
if (address & 1) {mem_unalignedwritew(address,val);return;}
|
||||
|
||||
PageLink * plink=GetPageLink(address);
|
||||
|
||||
if (plink->write) writew(plink->write+address,val);
|
||||
else ENTRY_writew(plink->entry,address,val);
|
||||
}
|
||||
|
||||
INLINE void mem_writed_inline(PhysPt address,Bit32u val) {
|
||||
if (address & 3) {mem_unalignedwrited(address,val);return;}
|
||||
|
||||
PageLink * plink=GetPageLink(address);
|
||||
|
||||
if (plink->write) writed(plink->write+address,val);
|
||||
else ENTRY_writed(plink->entry,address,val);
|
||||
}
|
||||
|
||||
#endif
|
@ -20,7 +20,10 @@
|
||||
#define __PIC_H
|
||||
|
||||
|
||||
#include "cpu.h"
|
||||
/* CPU Cycle Timing */
|
||||
extern Bits CPU_Cycles;
|
||||
extern Bits CPU_CycleLeft;
|
||||
extern Bits CPU_CycleMax;
|
||||
|
||||
typedef void (PIC_EOIHandler) (void);
|
||||
typedef void (* PIC_EventHandler)(void);
|
||||
@ -32,7 +35,6 @@ typedef void (* PIC_EventHandler)(void);
|
||||
|
||||
extern Bitu PIC_IRQCheck;
|
||||
extern Bitu PIC_IRQActive;
|
||||
|
||||
extern Bitu PIC_Ticks;
|
||||
|
||||
INLINE Bitu PIC_Index(void) {
|
||||
@ -55,7 +57,7 @@ void PIC_runIRQs(void);
|
||||
|
||||
void PIC_RegisterIRQ(Bit32u irq,PIC_EOIHandler handler,char * name);
|
||||
void PIC_FreeIRQ(Bit32u irq);
|
||||
Bitu PIC_RunQueue(void);
|
||||
bool PIC_RunQueue(void);
|
||||
|
||||
void PIC_AddIRQ(Bitu irq,Bitu delay);
|
||||
void PIC_AddEvent(PIC_EventHandler handler,Bitu delay);
|
||||
|
105
include/regs.h
105
include/regs.h
@ -29,19 +29,44 @@ struct Flag_Info {
|
||||
} var1,var2,result;
|
||||
Bitu type;
|
||||
Bitu prev_type;
|
||||
bool cf,sf,pf,af,zf,of,df,tf,intf;
|
||||
bool nt;
|
||||
Bit8u io;
|
||||
bool oldcf;
|
||||
Bitu oldcf;
|
||||
Bitu word;
|
||||
};
|
||||
|
||||
|
||||
#define FLAG_CF 0x00000001
|
||||
#define FLAG_PF 0x00000004
|
||||
#define FLAG_AF 0x00000010
|
||||
#define FLAG_ZF 0x00000040
|
||||
#define FLAG_SF 0x00000080
|
||||
#define FLAG_TF 0x00000100
|
||||
#define FLAG_IF 0x00000200
|
||||
#define FLAG_DF 0x00000400
|
||||
#define FLAG_OF 0x00000800
|
||||
|
||||
#define FLAG_MASK (FLAG_CF | FLAG_PF | FLAG_AF | FLAG_ZF | FLAG_SF | FLAG_OF)
|
||||
|
||||
#define FLAG_IOPL 0x00003000
|
||||
#define FLAG_NT 0x00004000
|
||||
#define FLAG_VM 0x00020000
|
||||
|
||||
|
||||
#define SETFLAGBIT(TYPE,TEST) if (TEST) flags.word|=FLAG_ ## TYPE; else flags.word&=~FLAG_ ## TYPE
|
||||
|
||||
#define GETFLAG(TYPE) (flags.word & FLAG_ ## TYPE)
|
||||
#define GETFLAGBOOL(TYPE) ((flags.word & FLAG_ ## TYPE) ? true : false )
|
||||
|
||||
struct Segment {
|
||||
Bit16u val;
|
||||
PhysPt phys; /* The phyiscal address start in emulated machine */
|
||||
};
|
||||
|
||||
enum SegNames { es=0,cs,ss,ds,fs,gs};
|
||||
|
||||
enum SegNames { cs=0,ds,es,fs,gs,ss};
|
||||
struct Segments {
|
||||
Bitu val[8];
|
||||
PhysPt phys[8];
|
||||
};
|
||||
|
||||
union GenReg32 {
|
||||
Bit32u dword[1];
|
||||
@ -69,7 +94,7 @@ struct CPU_Regs {
|
||||
GenReg32 regs[8],ip;
|
||||
};
|
||||
|
||||
extern Segment Segs[6];
|
||||
extern Segments Segs;
|
||||
extern Flag_Info flags;
|
||||
extern CPU_Regs cpu_regs;
|
||||
|
||||
@ -78,11 +103,11 @@ extern CPU_Regs cpu_regs;
|
||||
//#define SegValue(index) Segs[index].val
|
||||
|
||||
INLINE PhysPt SegPhys(SegNames index) {
|
||||
return Segs[index].phys;
|
||||
return Segs.phys[index];
|
||||
}
|
||||
|
||||
INLINE Bit16u SegValue(SegNames index) {
|
||||
return Segs[index].val;
|
||||
return Segs.val[index];
|
||||
}
|
||||
|
||||
|
||||
@ -92,16 +117,22 @@ INLINE RealPt RealMakeSeg(SegNames index,Bit16u off) {
|
||||
|
||||
|
||||
INLINE void SegSet16(Bitu index,Bit16u val) {
|
||||
Segs[index].val=val;
|
||||
Segs[index].phys=val << 4;
|
||||
Segs.val[index]=val;
|
||||
Segs.phys[index]=val << 4;
|
||||
}
|
||||
|
||||
|
||||
enum REG_NUM {
|
||||
REG_NUM_AX, REG_NUM_CX, REG_NUM_DX, REG_NUM_BX,
|
||||
REG_NUM_SP, REG_NUM_BP, REG_NUM_SI, REG_NUM_DI
|
||||
enum {
|
||||
REGI_AX, REGI_CX, REGI_DX, REGI_BX,
|
||||
REGI_SP, REGI_BP, REGI_SI, REGI_DI
|
||||
};
|
||||
|
||||
enum {
|
||||
REGI_AL, REGI_CL, REGI_DL, REGI_BL,
|
||||
REGI_AH, REGI_CH, REGI_DH, REGI_BH,
|
||||
};
|
||||
|
||||
|
||||
//macros to convert a 3-bit register index to the correct register
|
||||
#define reg_8l(reg) (cpu_regs.regs[(reg)].byte[BL_INDEX])
|
||||
#define reg_8h(reg) (cpu_regs.regs[(reg)].byte[BH_INDEX])
|
||||
@ -110,37 +141,37 @@ enum REG_NUM {
|
||||
#define reg_32(reg) (cpu_regs.regs[(reg)].dword[DW_INDEX])
|
||||
|
||||
|
||||
#define reg_al cpu_regs.regs[REG_NUM_AX].byte[BL_INDEX]
|
||||
#define reg_ah cpu_regs.regs[REG_NUM_AX].byte[BH_INDEX]
|
||||
#define reg_ax cpu_regs.regs[REG_NUM_AX].word[W_INDEX]
|
||||
#define reg_eax cpu_regs.regs[REG_NUM_AX].dword[DW_INDEX]
|
||||
#define reg_al cpu_regs.regs[REGI_AX].byte[BL_INDEX]
|
||||
#define reg_ah cpu_regs.regs[REGI_AX].byte[BH_INDEX]
|
||||
#define reg_ax cpu_regs.regs[REGI_AX].word[W_INDEX]
|
||||
#define reg_eax cpu_regs.regs[REGI_AX].dword[DW_INDEX]
|
||||
|
||||
#define reg_bl cpu_regs.regs[REG_NUM_BX].byte[BL_INDEX]
|
||||
#define reg_bh cpu_regs.regs[REG_NUM_BX].byte[BH_INDEX]
|
||||
#define reg_bx cpu_regs.regs[REG_NUM_BX].word[W_INDEX]
|
||||
#define reg_ebx cpu_regs.regs[REG_NUM_BX].dword[DW_INDEX]
|
||||
#define reg_bl cpu_regs.regs[REGI_BX].byte[BL_INDEX]
|
||||
#define reg_bh cpu_regs.regs[REGI_BX].byte[BH_INDEX]
|
||||
#define reg_bx cpu_regs.regs[REGI_BX].word[W_INDEX]
|
||||
#define reg_ebx cpu_regs.regs[REGI_BX].dword[DW_INDEX]
|
||||
|
||||
#define reg_cl cpu_regs.regs[REG_NUM_CX].byte[BL_INDEX]
|
||||
#define reg_ch cpu_regs.regs[REG_NUM_CX].byte[BH_INDEX]
|
||||
#define reg_cx cpu_regs.regs[REG_NUM_CX].word[W_INDEX]
|
||||
#define reg_ecx cpu_regs.regs[REG_NUM_CX].dword[DW_INDEX]
|
||||
#define reg_cl cpu_regs.regs[REGI_CX].byte[BL_INDEX]
|
||||
#define reg_ch cpu_regs.regs[REGI_CX].byte[BH_INDEX]
|
||||
#define reg_cx cpu_regs.regs[REGI_CX].word[W_INDEX]
|
||||
#define reg_ecx cpu_regs.regs[REGI_CX].dword[DW_INDEX]
|
||||
|
||||
#define reg_dl cpu_regs.regs[REG_NUM_DX].byte[BL_INDEX]
|
||||
#define reg_dh cpu_regs.regs[REG_NUM_DX].byte[BH_INDEX]
|
||||
#define reg_dx cpu_regs.regs[REG_NUM_DX].word[W_INDEX]
|
||||
#define reg_edx cpu_regs.regs[REG_NUM_DX].dword[DW_INDEX]
|
||||
#define reg_dl cpu_regs.regs[REGI_DX].byte[BL_INDEX]
|
||||
#define reg_dh cpu_regs.regs[REGI_DX].byte[BH_INDEX]
|
||||
#define reg_dx cpu_regs.regs[REGI_DX].word[W_INDEX]
|
||||
#define reg_edx cpu_regs.regs[REGI_DX].dword[DW_INDEX]
|
||||
|
||||
#define reg_si cpu_regs.regs[REG_NUM_SI].word[W_INDEX]
|
||||
#define reg_esi cpu_regs.regs[REG_NUM_SI].dword[DW_INDEX]
|
||||
#define reg_si cpu_regs.regs[REGI_SI].word[W_INDEX]
|
||||
#define reg_esi cpu_regs.regs[REGI_SI].dword[DW_INDEX]
|
||||
|
||||
#define reg_di cpu_regs.regs[REG_NUM_DI].word[W_INDEX]
|
||||
#define reg_edi cpu_regs.regs[REG_NUM_DI].dword[DW_INDEX]
|
||||
#define reg_di cpu_regs.regs[REGI_DI].word[W_INDEX]
|
||||
#define reg_edi cpu_regs.regs[REGI_DI].dword[DW_INDEX]
|
||||
|
||||
#define reg_sp cpu_regs.regs[REG_NUM_SP].word[W_INDEX]
|
||||
#define reg_esp cpu_regs.regs[REG_NUM_SP].dword[DW_INDEX]
|
||||
#define reg_sp cpu_regs.regs[REGI_SP].word[W_INDEX]
|
||||
#define reg_esp cpu_regs.regs[REGI_SP].dword[DW_INDEX]
|
||||
|
||||
#define reg_bp cpu_regs.regs[REG_NUM_BP].word[W_INDEX]
|
||||
#define reg_ebp cpu_regs.regs[REG_NUM_BP].dword[DW_INDEX]
|
||||
#define reg_bp cpu_regs.regs[REGI_BP].word[W_INDEX]
|
||||
#define reg_ebp cpu_regs.regs[REGI_BP].dword[DW_INDEX]
|
||||
|
||||
#define reg_ip cpu_regs.ip.word[W_INDEX]
|
||||
#define reg_eip cpu_regs.ip.dword[DW_INDEX]
|
||||
|
@ -19,8 +19,11 @@
|
||||
|
||||
|
||||
enum RENDER_Operation {
|
||||
OP_None,OP_Shot,
|
||||
OP_2xSai,OP_Scale2x,
|
||||
OP_None,
|
||||
OP_Shot,
|
||||
OP_Normal2x,
|
||||
OP_AdvMame2x,
|
||||
OP_Blit,
|
||||
};
|
||||
|
||||
enum {
|
||||
|
136
include/serialport.h
Normal file
136
include/serialport.h
Normal file
@ -0,0 +1,136 @@
|
||||
/*
|
||||
* Copyright (C) 2002 The DOSBox Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#if !defined __SERIALPORT_H
|
||||
#define __SERIALPORT_H
|
||||
|
||||
#include <dosbox.h>
|
||||
|
||||
//If it's too high you overflow terminal clients buffers i think
|
||||
#define FIFO_SIZE (1024)
|
||||
|
||||
// Serial port interface //
|
||||
|
||||
#define M_CTS 0x01
|
||||
#define M_DSR 0x02
|
||||
#define M_RI 0x04
|
||||
#define M_DCD 0x08
|
||||
|
||||
enum INT_TYPES {
|
||||
INT_MS,
|
||||
INT_TX,
|
||||
INT_RX,
|
||||
INT_RX_FIFO,
|
||||
INT_LS,
|
||||
INT_NONE,
|
||||
};
|
||||
|
||||
typedef void MControl_Handler(Bitu mc);
|
||||
|
||||
class CSerial {
|
||||
public:
|
||||
|
||||
// Constructor takes base port (0x3f0, 0x2f0, 0x2e0, etc.), IRQ, and initial bps //
|
||||
CSerial (Bit16u initbase, Bit8u initirq, Bit32u initbps);
|
||||
virtual ~CSerial();
|
||||
|
||||
// External port functions for IOHandlers //
|
||||
void write_port(Bit32u port, Bit8u val);
|
||||
Bit8u read_port(Bit32u port);
|
||||
|
||||
static void write_serial(Bit32u port,Bit8u val);
|
||||
static Bit8u read_serial(Bit32u port);
|
||||
|
||||
void SetMCHandler(MControl_Handler * mcontrol);
|
||||
|
||||
/* Allow the modem to change the modem status bits */
|
||||
void setmodemstatus(Bit8u status);
|
||||
Bit8u getmodemstatus(void);
|
||||
Bit8u getlinestatus(void);
|
||||
|
||||
void checkint(void);
|
||||
void raiseint(INT_TYPES type);
|
||||
void lowerint(INT_TYPES type);
|
||||
|
||||
/* Access to the receive fifo */
|
||||
Bitu rx_free();
|
||||
void rx_addb(Bit8u byte);
|
||||
void rx_adds(Bit8u * data,Bitu size);
|
||||
Bitu rx_size();
|
||||
Bit8u rx_readb(void);
|
||||
|
||||
/* Access to the transmit fifo */
|
||||
Bitu tx_free();
|
||||
void tx_addb(Bit8u byte);
|
||||
Bitu tx_size();
|
||||
Bit8u tx_readb(void);
|
||||
|
||||
|
||||
// These variables maintain the status of the serial port
|
||||
Bit16u base;
|
||||
Bit16u irq;
|
||||
Bit32u bps;
|
||||
|
||||
bool FIFOenabled;
|
||||
Bit16u FIFOsize;
|
||||
|
||||
private:
|
||||
|
||||
void setdivisor(Bit8u dmsb, Bit8u dlsb);
|
||||
void checkforirq(void);
|
||||
struct {
|
||||
Bitu used;
|
||||
Bitu pos;
|
||||
Bit8u data[FIFO_SIZE];
|
||||
} rx_fifo,tx_fifo;
|
||||
struct {
|
||||
Bitu requested;
|
||||
Bitu enabled;
|
||||
INT_TYPES active;
|
||||
} ints;
|
||||
|
||||
Bitu rx_lastread;
|
||||
Bit8u irq_pending;
|
||||
|
||||
Bit8u scratch;
|
||||
Bit8u dlab;
|
||||
Bit8u divisor_lsb;
|
||||
Bit8u divisor_msb;
|
||||
Bit8u wordlen;
|
||||
Bit8u dtr;
|
||||
Bit8u rts;
|
||||
Bit8u out1;
|
||||
Bit8u out2;
|
||||
Bit8u local_loopback;
|
||||
Bit8u linectrl;
|
||||
Bit8u intid;
|
||||
Bit8u ierval;
|
||||
Bit8u mstatus;
|
||||
|
||||
Bit8u txval;
|
||||
Bit8u timeout;
|
||||
|
||||
MControl_Handler * mc_handler;
|
||||
char remotestr[4096];
|
||||
};
|
||||
|
||||
// This function returns the CSerial objects for ports 1-4 //
|
||||
CSerial *getComport(Bitu portnum);
|
||||
|
||||
#endif
|
||||
|
@ -19,9 +19,11 @@
|
||||
#ifndef _SETUP_H_
|
||||
#define _SETUP_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning ( disable : 4786 )
|
||||
#endif
|
||||
|
||||
#include <cross.h>
|
||||
#include "cross.h"
|
||||
#include <string>
|
||||
#include <list>
|
||||
|
||||
@ -35,10 +37,10 @@ public:
|
||||
bool FindHex(char * name,int & value,bool remove=false);
|
||||
bool FindInt(char * name,int & value,bool remove=false);
|
||||
bool FindString(char * name,std::string & value,bool remove=false);
|
||||
bool FindCommand(int which,std::string & value);
|
||||
bool FindCommand(unsigned int which,std::string & value);
|
||||
bool FindStringBegin(char * begin,std::string & value, bool remove=false);
|
||||
bool FindStringRemain(char * name,std::string & value);
|
||||
int GetCount(void);
|
||||
unsigned int GetCount(void);
|
||||
private:
|
||||
typedef std::list<std::string>::iterator cmd_it;
|
||||
std::list<std::string> cmds;
|
||||
|
@ -34,6 +34,8 @@ struct GFX_PalEntry {
|
||||
#define GFX_FIXED_BPP 0x01
|
||||
#define GFX_RESIZEABLE 0x02
|
||||
#define GFX_SHADOW 0x04
|
||||
#define GFX_BLITTING 0x08
|
||||
|
||||
|
||||
|
||||
#define MODE_SET 0x01
|
||||
@ -50,6 +52,8 @@ void GFX_Start(void);
|
||||
void GFX_Stop(void);
|
||||
void GFX_SwitchFullScreen(void);
|
||||
|
||||
void GFX_Render_Blit(Bit8u * src,Bitu x,Bitu y,Bitu dx,Bitu dy);
|
||||
|
||||
void GFX_DoUpdate(void);
|
||||
|
||||
#endif
|
||||
|
149
install-sh
149
install-sh
@ -1,19 +1,37 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# install - install a program, script, or datafile
|
||||
# This comes from X11R5 (mit/util/scripts/install.sh).
|
||||
#
|
||||
# Copyright 1991 by the Massachusetts Institute of Technology
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Permission to use, copy, modify, distribute, and sell this software and its
|
||||
# documentation for any purpose is hereby granted without fee, provided that
|
||||
# the above copyright notice appear in all copies and that both that
|
||||
# copyright notice and this permission notice appear in supporting
|
||||
# documentation, and that the name of M.I.T. not be used in advertising or
|
||||
# publicity pertaining to distribution of the software without specific,
|
||||
# written prior permission. M.I.T. makes no representations about the
|
||||
# suitability of this software for any purpose. It is provided "as is"
|
||||
# without express or implied warranty.
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
@ -56,7 +74,7 @@ dir_arg=""
|
||||
|
||||
while [ x"$1" != x ]; do
|
||||
case $1 in
|
||||
-c) instcmd="$cpprog"
|
||||
-c) instcmd=$cpprog
|
||||
shift
|
||||
continue;;
|
||||
|
||||
@ -79,7 +97,7 @@ while [ x"$1" != x ]; do
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-s) stripcmd="$stripprog"
|
||||
-s) stripcmd=$stripprog
|
||||
shift
|
||||
continue;;
|
||||
|
||||
@ -106,7 +124,7 @@ done
|
||||
|
||||
if [ x"$src" = x ]
|
||||
then
|
||||
echo "install: no input file specified"
|
||||
echo "$0: no input file specified" >&2
|
||||
exit 1
|
||||
else
|
||||
:
|
||||
@ -115,8 +133,8 @@ fi
|
||||
if [ x"$dir_arg" != x ]; then
|
||||
dst=$src
|
||||
src=""
|
||||
|
||||
if [ -d $dst ]; then
|
||||
|
||||
if [ -d "$dst" ]; then
|
||||
instcmd=:
|
||||
chmodcmd=""
|
||||
else
|
||||
@ -125,20 +143,20 @@ if [ x"$dir_arg" != x ]; then
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
|
||||
if [ -f "$src" ] || [ -d "$src" ]
|
||||
then
|
||||
:
|
||||
else
|
||||
echo "install: $src does not exist"
|
||||
echo "$0: $src does not exist" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
if [ x"$dst" = x ]
|
||||
then
|
||||
echo "install: no destination specified"
|
||||
echo "$0: no destination specified" >&2
|
||||
exit 1
|
||||
else
|
||||
:
|
||||
@ -147,16 +165,16 @@ else
|
||||
# If destination is a directory, append the input filename; if your system
|
||||
# does not like double slashes in filenames, you may need to add some logic
|
||||
|
||||
if [ -d $dst ]
|
||||
if [ -d "$dst" ]
|
||||
then
|
||||
dst="$dst"/`basename $src`
|
||||
dst=$dst/`basename "$src"`
|
||||
else
|
||||
:
|
||||
fi
|
||||
fi
|
||||
|
||||
## this sed command emulates the dirname command
|
||||
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
|
||||
# Make sure that the destination directory exists.
|
||||
# this part is taken from Noah Friedman's mkinstalldirs script
|
||||
@ -165,69 +183,73 @@ dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
if [ ! -d "$dstdir" ]; then
|
||||
defaultIFS='
|
||||
'
|
||||
IFS="${IFS-${defaultIFS}}"
|
||||
IFS="${IFS-$defaultIFS}"
|
||||
|
||||
oIFS="${IFS}"
|
||||
oIFS=$IFS
|
||||
# Some sh's can't handle IFS=/ for some reason.
|
||||
IFS='%'
|
||||
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||
IFS="${oIFS}"
|
||||
set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||
IFS=$oIFS
|
||||
|
||||
pathcomp=''
|
||||
|
||||
while [ $# -ne 0 ] ; do
|
||||
pathcomp="${pathcomp}${1}"
|
||||
pathcomp=$pathcomp$1
|
||||
shift
|
||||
|
||||
if [ ! -d "${pathcomp}" ] ;
|
||||
if [ ! -d "$pathcomp" ] ;
|
||||
then
|
||||
$mkdirprog "${pathcomp}"
|
||||
$mkdirprog "$pathcomp"
|
||||
else
|
||||
:
|
||||
fi
|
||||
|
||||
pathcomp="${pathcomp}/"
|
||||
pathcomp=$pathcomp/
|
||||
done
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]
|
||||
then
|
||||
$doit $instcmd $dst &&
|
||||
$doit $instcmd "$dst" &&
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi
|
||||
else
|
||||
|
||||
# If we're going to rename the final executable, determine the name now.
|
||||
|
||||
if [ x"$transformarg" = x ]
|
||||
if [ x"$transformarg" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
dstfile=`basename "$dst"`
|
||||
else
|
||||
dstfile=`basename $dst $transformbasename |
|
||||
dstfile=`basename "$dst" $transformbasename |
|
||||
sed $transformarg`$transformbasename
|
||||
fi
|
||||
|
||||
# don't allow the sed command to completely eliminate the filename
|
||||
|
||||
if [ x"$dstfile" = x ]
|
||||
if [ x"$dstfile" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
dstfile=`basename "$dst"`
|
||||
else
|
||||
:
|
||||
fi
|
||||
|
||||
# Make a temp file name in the proper directory.
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
|
||||
dsttmp=$dstdir/#inst.$$#
|
||||
dsttmp=$dstdir/_inst.$$_
|
||||
rmtmp=$dstdir/_rm.$$_
|
||||
|
||||
# Trap to clean up temp files at exit.
|
||||
|
||||
trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
|
||||
trap '(exit $?); exit' 1 2 13 15
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
|
||||
$doit $instcmd $src $dsttmp &&
|
||||
|
||||
trap "rm -f ${dsttmp}" 0 &&
|
||||
$doit $instcmd "$src" "$dsttmp" &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits
|
||||
|
||||
@ -235,17 +257,38 @@ else
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi &&
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi &&
|
||||
|
||||
# Now remove or move aside any old file at destination location. We try this
|
||||
# two ways since rm can't unlink itself on some systems and the destination
|
||||
# file might be busy for other reasons. In this case, the final cleanup
|
||||
# might fail but the new file should still install successfully.
|
||||
|
||||
{
|
||||
if [ -f "$dstdir/$dstfile" ]
|
||||
then
|
||||
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null ||
|
||||
$doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null ||
|
||||
{
|
||||
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
|
||||
(exit 1); exit
|
||||
}
|
||||
else
|
||||
:
|
||||
fi
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
|
||||
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
|
||||
|
||||
fi &&
|
||||
|
||||
# The final little trick to "correctly" pass the exit status to the exit trap.
|
||||
|
||||
exit 0
|
||||
{
|
||||
(exit 0); exit
|
||||
}
|
||||
|
6
missing
6
missing
@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
# Common stub for a few missing GNU programs while installing.
|
||||
# Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
|
||||
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
@ -165,7 +165,7 @@ WARNING: \`$1' is missing on your system. You should only need it if
|
||||
WARNING: \`$1' is needed, and you do not seem to have it handy on your
|
||||
system. You might have modified some files without having the
|
||||
proper tools for further handling them.
|
||||
You can get \`$1Help2man' as part of \`Autoconf' from any GNU
|
||||
You can get \`$1' as part of \`Autoconf' from any GNU
|
||||
archive site."
|
||||
|
||||
file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
|
||||
@ -326,7 +326,7 @@ WARNING: I can't seem to be able to run \`tar' with the given arguments.
|
||||
WARNING: \`$1' is needed, and you do not seem to have it handy on your
|
||||
system. You might have modified some files without having the
|
||||
proper tools for further handling them. Check the \`README' file,
|
||||
it often tells you about the needed prerequirements for installing
|
||||
it often tells you about the needed prerequisites for installing
|
||||
this package. You may also peek at any GNU archive site, in case
|
||||
some other package would contain this missing \`$1' program."
|
||||
exit 1
|
||||
|
116
mkinstalldirs
116
mkinstalldirs
@ -12,18 +12,29 @@ Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
|
||||
|
||||
# process command line arguments
|
||||
while test $# -gt 0 ; do
|
||||
case "${1}" in
|
||||
-h | --help | --h* ) # -h for help
|
||||
echo "${usage}" 1>&2; exit 0 ;;
|
||||
-m ) # -m PERM arg
|
||||
shift
|
||||
test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; }
|
||||
dirmode="${1}"
|
||||
shift ;;
|
||||
-- ) shift; break ;; # stop option processing
|
||||
-* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option
|
||||
* ) break ;; # first non-opt arg
|
||||
esac
|
||||
case $1 in
|
||||
-h | --help | --h*) # -h for help
|
||||
echo "$usage" 1>&2
|
||||
exit 0
|
||||
;;
|
||||
-m) # -m PERM arg
|
||||
shift
|
||||
test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
|
||||
dirmode=$1
|
||||
shift
|
||||
;;
|
||||
--) # stop option processing
|
||||
shift
|
||||
break
|
||||
;;
|
||||
-*) # unknown option
|
||||
echo "$usage" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
*) # first non-opt arg
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
for file
|
||||
@ -36,64 +47,65 @@ do
|
||||
done
|
||||
|
||||
case $# in
|
||||
0) exit 0 ;;
|
||||
0) exit 0 ;;
|
||||
esac
|
||||
|
||||
case $dirmode in
|
||||
'')
|
||||
if mkdir -p -- . 2>/dev/null; then
|
||||
echo "mkdir -p -- $*"
|
||||
exec mkdir -p -- "$@"
|
||||
fi ;;
|
||||
*)
|
||||
if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
|
||||
echo "mkdir -m $dirmode -p -- $*"
|
||||
exec mkdir -m "$dirmode" -p -- "$@"
|
||||
fi ;;
|
||||
'')
|
||||
if mkdir -p -- . 2>/dev/null; then
|
||||
echo "mkdir -p -- $*"
|
||||
exec mkdir -p -- "$@"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
|
||||
echo "mkdir -m $dirmode -p -- $*"
|
||||
exec mkdir -m "$dirmode" -p -- "$@"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
for file
|
||||
do
|
||||
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
|
||||
shift
|
||||
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
|
||||
shift
|
||||
|
||||
pathcomp=
|
||||
for d
|
||||
do
|
||||
pathcomp="$pathcomp$d"
|
||||
case "$pathcomp" in
|
||||
-* ) pathcomp=./$pathcomp ;;
|
||||
esac
|
||||
pathcomp=
|
||||
for d
|
||||
do
|
||||
pathcomp="$pathcomp$d"
|
||||
case $pathcomp in
|
||||
-*) pathcomp=./$pathcomp ;;
|
||||
esac
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
echo "mkdir $pathcomp"
|
||||
if test ! -d "$pathcomp"; then
|
||||
echo "mkdir $pathcomp"
|
||||
|
||||
mkdir "$pathcomp" || lasterr=$?
|
||||
mkdir "$pathcomp" || lasterr=$?
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
errstatus=$lasterr
|
||||
else
|
||||
if test ! -z "$dirmode"; then
|
||||
echo "chmod $dirmode $pathcomp"
|
||||
if test ! -d "$pathcomp"; then
|
||||
errstatus=$lasterr
|
||||
else
|
||||
if test ! -z "$dirmode"; then
|
||||
echo "chmod $dirmode $pathcomp"
|
||||
lasterr=""
|
||||
chmod "$dirmode" "$pathcomp" || lasterr=$?
|
||||
|
||||
lasterr=""
|
||||
chmod "$dirmode" "$pathcomp" || lasterr=$?
|
||||
if test ! -z "$lasterr"; then
|
||||
errstatus=$lasterr
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test ! -z "$lasterr"; then
|
||||
errstatus=$lasterr
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
pathcomp="$pathcomp/"
|
||||
done
|
||||
pathcomp="$pathcomp/"
|
||||
done
|
||||
done
|
||||
|
||||
exit $errstatus
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 3
|
||||
# sh-indentation: 2
|
||||
# End:
|
||||
# mkinstalldirs ends here
|
||||
|
252
src/Makefile.in
252
src/Makefile.in
@ -1,7 +1,7 @@
|
||||
# Makefile.in generated by automake 1.6.3 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.7.7 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -13,77 +13,122 @@
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = @program_transform_name@
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
|
||||
EXEEXT = @EXEEXT@
|
||||
OBJEXT = @OBJEXT@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMDEP_FALSE = @AMDEP_FALSE@
|
||||
AMDEP_TRUE = @AMDEP_TRUE@
|
||||
AMTAR = @AMTAR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SDL_CFLAGS = @SDL_CFLAGS@
|
||||
SDL_CONFIG = @SDL_CONFIG@
|
||||
SDL_LIBS = @SDL_LIBS@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_RANLIB = @ac_ct_RANLIB@
|
||||
ac_ct_STRIP = @ac_ct_STRIP@
|
||||
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
|
||||
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
|
||||
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
|
||||
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
datadir = @datadir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
oldincludedir = @oldincludedir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target = @target@
|
||||
target_alias = @target_alias@
|
||||
target_cpu = @target_cpu@
|
||||
target_os = @target_os@
|
||||
target_vendor = @target_vendor@
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include
|
||||
|
||||
SUBDIRS = cpu debug dos fpu gui hardware ints misc shell platform
|
||||
@ -95,6 +140,7 @@ dosbox_LDADD = cpu/libcpu.a debug/libdebug.a dos/libdos.a fpu/libfpu.a hardware
|
||||
ints/libints.a misc/libmisc.a shell/libshell.a
|
||||
|
||||
subdir = src
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
@ -108,11 +154,7 @@ dosbox_DEPENDENCIES = cpu/libcpu.a debug/libdebug.a dos/libdos.a \
|
||||
misc/libmisc.a shell/libshell.a
|
||||
dosbox_LDFLAGS =
|
||||
|
||||
DEFS = @DEFS@
|
||||
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/dosbox.Po
|
||||
@ -121,14 +163,14 @@ CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
|
||||
CXXLD = $(CXX)
|
||||
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
|
||||
-o $@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
DIST_SOURCES = $(dosbox_SOURCES)
|
||||
|
||||
RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \
|
||||
uninstall-info-recursive all-recursive install-data-recursive \
|
||||
install-exec-recursive installdirs-recursive install-recursive \
|
||||
uninstall-recursive check-recursive installcheck-recursive
|
||||
DIST_COMMON = Makefile.am Makefile.in
|
||||
RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \
|
||||
ps-recursive install-info-recursive uninstall-info-recursive \
|
||||
all-recursive install-data-recursive install-exec-recursive \
|
||||
installdirs-recursive install-recursive uninstall-recursive \
|
||||
check-recursive installcheck-recursive
|
||||
DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
SOURCES = $(dosbox_SOURCES)
|
||||
|
||||
@ -151,7 +193,7 @@ install-binPROGRAMS: $(bin_PROGRAMS)
|
||||
; then \
|
||||
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
|
||||
echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \
|
||||
$(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f; \
|
||||
$(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \
|
||||
else :; fi; \
|
||||
done
|
||||
|
||||
@ -165,6 +207,21 @@ uninstall-binPROGRAMS:
|
||||
|
||||
clean-binPROGRAMS:
|
||||
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
|
||||
|
||||
installcheck-binPROGRAMS: $(bin_PROGRAMS)
|
||||
bad=0; pid=$$$$; list="$(bin_PROGRAMS)"; for p in $$list; do \
|
||||
case ' $(AM_INSTALLCHECK_STD_OPTIONS_EXEMPT) ' in \
|
||||
*" $$p "* | *" $(srcdir)/$$p "*) continue;; \
|
||||
esac; \
|
||||
f=`echo "$$p" | \
|
||||
sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
|
||||
for opt in --help --version; do \
|
||||
if $(DESTDIR)$(bindir)/$$f $$opt > c$${pid}_.out 2> c$${pid}_.err \
|
||||
&& test -n "`cat c$${pid}_.out`" \
|
||||
&& test -z "`cat c$${pid}_.err`"; then :; \
|
||||
else echo "$$f does not support $$opt" 1>&2; bad=1; fi; \
|
||||
done; \
|
||||
done; rm -f c$${pid}_.???; exit $$bad
|
||||
dosbox$(EXEEXT): $(dosbox_OBJECTS) $(dosbox_DEPENDENCIES)
|
||||
@rm -f dosbox$(EXEEXT)
|
||||
$(CXXLINK) $(dosbox_LDFLAGS) $(dosbox_OBJECTS) $(dosbox_LDADD) $(LIBS)
|
||||
@ -177,21 +234,27 @@ distclean-compile:
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dosbox.Po@am__quote@
|
||||
|
||||
distclean-depend:
|
||||
-rm -rf ./$(DEPDIR)
|
||||
|
||||
.cpp.o:
|
||||
@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
$(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
|
||||
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
|
||||
@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
|
||||
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
|
||||
@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
|
||||
@am__fastdepCXX_TRUE@ fi
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
|
||||
|
||||
.cpp.obj:
|
||||
@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
$(CXXCOMPILE) -c -o $@ `cygpath -w $<`
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
|
||||
@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
|
||||
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
|
||||
@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
|
||||
@am__fastdepCXX_TRUE@ fi
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
|
||||
uninstall-info-am:
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
@ -248,10 +311,17 @@ tags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
|
||||
done
|
||||
ctags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
|
||||
done
|
||||
|
||||
ETAGS = etags
|
||||
ETAGSFLAGS =
|
||||
|
||||
CTAGS = ctags
|
||||
CTAGSFLAGS =
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
@ -267,9 +337,15 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
if (etags --etags-include --version) >/dev/null 2>&1; then \
|
||||
include_option=--etags-include; \
|
||||
else \
|
||||
include_option=--include; \
|
||||
fi; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
|
||||
test -f $$subdir/TAGS && \
|
||||
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
|
||||
fi; \
|
||||
done; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
@ -282,20 +358,41 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
ctags: CTAGS
|
||||
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
top_distdir = ..
|
||||
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@list='$(DISTFILES)'; for file in $$list; do \
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(DISTFILES)'; for file in $$list; do \
|
||||
case $$file in \
|
||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
|
||||
esac; \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
@ -354,7 +451,7 @@ mostlyclean-generic:
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@ -364,9 +461,11 @@ clean: clean-recursive
|
||||
clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -rf ./$(DEPDIR)
|
||||
|
||||
distclean-am: clean-am distclean-compile distclean-depend \
|
||||
distclean-generic distclean-tags
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-recursive
|
||||
|
||||
@ -384,35 +483,46 @@ install-info: install-info-recursive
|
||||
|
||||
install-man:
|
||||
|
||||
installcheck-am:
|
||||
installcheck-am: installcheck-binPROGRAMS
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
-rm -rf ./$(DEPDIR)
|
||||
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic
|
||||
|
||||
pdf: pdf-recursive
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-recursive
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-binPROGRAMS uninstall-info-am
|
||||
|
||||
uninstall-info: uninstall-info-recursive
|
||||
|
||||
.PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \
|
||||
clean-binPROGRAMS clean-generic clean-recursive distclean \
|
||||
distclean-compile distclean-depend distclean-generic \
|
||||
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \
|
||||
clean-binPROGRAMS clean-generic clean-recursive ctags \
|
||||
ctags-recursive distclean distclean-compile distclean-generic \
|
||||
distclean-recursive distclean-tags distdir dvi dvi-am \
|
||||
dvi-recursive info info-am info-recursive install install-am \
|
||||
install-binPROGRAMS install-data install-data-am \
|
||||
install-data-recursive install-exec install-exec-am \
|
||||
install-exec-recursive install-info install-info-am \
|
||||
install-info-recursive install-man install-recursive \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
installdirs-am installdirs-recursive maintainer-clean \
|
||||
maintainer-clean-generic maintainer-clean-recursive mostlyclean \
|
||||
mostlyclean-compile mostlyclean-generic mostlyclean-recursive \
|
||||
tags tags-recursive uninstall uninstall-am \
|
||||
uninstall-binPROGRAMS uninstall-info-am \
|
||||
install-strip installcheck installcheck-am \
|
||||
installcheck-binPROGRAMS installdirs installdirs-am \
|
||||
installdirs-recursive maintainer-clean maintainer-clean-generic \
|
||||
maintainer-clean-recursive mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic mostlyclean-recursive pdf pdf-am \
|
||||
pdf-recursive ps ps-am ps-recursive tags tags-recursive \
|
||||
uninstall uninstall-am uninstall-binPROGRAMS uninstall-info-am \
|
||||
uninstall-info-recursive uninstall-recursive
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
|
@ -1,5 +1,6 @@
|
||||
SUBDIRS = core_16
|
||||
SUBDIRS = core_16 core_full core_normal
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include
|
||||
|
||||
noinst_LIBRARIES = libcpu.a
|
||||
libcpu_a_SOURCES = callback.cpp cpu.cpp flags.cpp modrm.cpp modrm.h slow_16.cpp instructions.h
|
||||
libcpu_a_SOURCES = callback.cpp cpu.cpp flags.cpp modrm.cpp modrm.h slow_16.cpp core_full.cpp instructions.h \
|
||||
paging.cpp lazyflags.h core_normal.cpp
|
@ -1,7 +1,7 @@
|
||||
# Makefile.in generated by automake 1.6.3 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.7.7 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -13,83 +13,131 @@
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = ../..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = @program_transform_name@
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
|
||||
EXEEXT = @EXEEXT@
|
||||
OBJEXT = @OBJEXT@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMDEP_FALSE = @AMDEP_FALSE@
|
||||
AMDEP_TRUE = @AMDEP_TRUE@
|
||||
AMTAR = @AMTAR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SDL_CFLAGS = @SDL_CFLAGS@
|
||||
SDL_CONFIG = @SDL_CONFIG@
|
||||
SDL_LIBS = @SDL_LIBS@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_RANLIB = @ac_ct_RANLIB@
|
||||
ac_ct_STRIP = @ac_ct_STRIP@
|
||||
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
|
||||
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
|
||||
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
|
||||
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
datadir = @datadir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
SUBDIRS = core_16
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
oldincludedir = @oldincludedir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target = @target@
|
||||
target_alias = @target_alias@
|
||||
target_cpu = @target_cpu@
|
||||
target_os = @target_os@
|
||||
target_vendor = @target_vendor@
|
||||
SUBDIRS = core_16 core_full core_normal
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include
|
||||
|
||||
noinst_LIBRARIES = libcpu.a
|
||||
libcpu_a_SOURCES = callback.cpp cpu.cpp flags.cpp modrm.cpp modrm.h slow_16.cpp instructions.h
|
||||
libcpu_a_SOURCES = callback.cpp cpu.cpp flags.cpp modrm.cpp modrm.h slow_16.cpp core_full.cpp instructions.h \
|
||||
paging.cpp lazyflags.h core_normal.cpp
|
||||
|
||||
subdir = src/cpu
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
@ -98,37 +146,34 @@ LIBRARIES = $(noinst_LIBRARIES)
|
||||
libcpu_a_AR = $(AR) cru
|
||||
libcpu_a_LIBADD =
|
||||
am_libcpu_a_OBJECTS = callback.$(OBJEXT) cpu.$(OBJEXT) flags.$(OBJEXT) \
|
||||
modrm.$(OBJEXT) slow_16.$(OBJEXT)
|
||||
modrm.$(OBJEXT) slow_16.$(OBJEXT) core_full.$(OBJEXT) \
|
||||
paging.$(OBJEXT) core_normal.$(OBJEXT)
|
||||
libcpu_a_OBJECTS = $(am_libcpu_a_OBJECTS)
|
||||
|
||||
DEFS = @DEFS@
|
||||
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/callback.Po ./$(DEPDIR)/cpu.Po \
|
||||
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/callback.Po ./$(DEPDIR)/core_full.Po \
|
||||
@AMDEP_TRUE@ ./$(DEPDIR)/core_normal.Po ./$(DEPDIR)/cpu.Po \
|
||||
@AMDEP_TRUE@ ./$(DEPDIR)/flags.Po ./$(DEPDIR)/modrm.Po \
|
||||
@AMDEP_TRUE@ ./$(DEPDIR)/slow_16.Po
|
||||
@AMDEP_TRUE@ ./$(DEPDIR)/paging.Po ./$(DEPDIR)/slow_16.Po
|
||||
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
|
||||
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
|
||||
CXXLD = $(CXX)
|
||||
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
|
||||
-o $@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CFLAGS = @CFLAGS@
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
DIST_SOURCES = $(libcpu_a_SOURCES)
|
||||
|
||||
RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \
|
||||
uninstall-info-recursive all-recursive install-data-recursive \
|
||||
install-exec-recursive installdirs-recursive install-recursive \
|
||||
uninstall-recursive check-recursive installcheck-recursive
|
||||
DIST_COMMON = Makefile.am Makefile.in
|
||||
RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \
|
||||
ps-recursive install-info-recursive uninstall-info-recursive \
|
||||
all-recursive install-data-recursive install-exec-recursive \
|
||||
installdirs-recursive install-recursive uninstall-recursive \
|
||||
check-recursive installcheck-recursive
|
||||
DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
SOURCES = $(libcpu_a_SOURCES)
|
||||
|
||||
@ -158,26 +203,35 @@ distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/callback.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/core_full.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/core_normal.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flags.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/modrm.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/paging.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/slow_16.Po@am__quote@
|
||||
|
||||
distclean-depend:
|
||||
-rm -rf ./$(DEPDIR)
|
||||
|
||||
.cpp.o:
|
||||
@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
$(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
|
||||
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
|
||||
@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
|
||||
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
|
||||
@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
|
||||
@am__fastdepCXX_TRUE@ fi
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
|
||||
|
||||
.cpp.obj:
|
||||
@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
$(CXXCOMPILE) -c -o $@ `cygpath -w $<`
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
|
||||
@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
|
||||
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
|
||||
@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
|
||||
@am__fastdepCXX_TRUE@ fi
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
|
||||
uninstall-info-am:
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
@ -234,10 +288,17 @@ tags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
|
||||
done
|
||||
ctags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
|
||||
done
|
||||
|
||||
ETAGS = etags
|
||||
ETAGSFLAGS =
|
||||
|
||||
CTAGS = ctags
|
||||
CTAGSFLAGS =
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
@ -253,9 +314,15 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
if (etags --etags-include --version) >/dev/null 2>&1; then \
|
||||
include_option=--etags-include; \
|
||||
else \
|
||||
include_option=--include; \
|
||||
fi; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
|
||||
test -f $$subdir/TAGS && \
|
||||
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
|
||||
fi; \
|
||||
done; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
@ -268,20 +335,41 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
ctags: CTAGS
|
||||
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
top_distdir = ../..
|
||||
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@list='$(DISTFILES)'; for file in $$list; do \
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(DISTFILES)'; for file in $$list; do \
|
||||
case $$file in \
|
||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
|
||||
esac; \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
@ -339,7 +427,7 @@ mostlyclean-generic:
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@ -349,9 +437,11 @@ clean: clean-recursive
|
||||
clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -rf ./$(DEPDIR)
|
||||
|
||||
distclean-am: clean-am distclean-compile distclean-depend \
|
||||
distclean-generic distclean-tags
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-recursive
|
||||
|
||||
@ -372,20 +462,30 @@ install-man:
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
-rm -rf ./$(DEPDIR)
|
||||
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic
|
||||
|
||||
pdf: pdf-recursive
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-recursive
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-info-am
|
||||
|
||||
uninstall-info: uninstall-info-recursive
|
||||
|
||||
.PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \
|
||||
clean-generic clean-noinstLIBRARIES clean-recursive distclean \
|
||||
distclean-compile distclean-depend distclean-generic \
|
||||
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \
|
||||
clean-generic clean-noinstLIBRARIES clean-recursive ctags \
|
||||
ctags-recursive distclean distclean-compile distclean-generic \
|
||||
distclean-recursive distclean-tags distdir dvi dvi-am \
|
||||
dvi-recursive info info-am info-recursive install install-am \
|
||||
install-data install-data-am install-data-recursive \
|
||||
@ -395,7 +495,8 @@ uninstall-info: uninstall-info-recursive
|
||||
installdirs installdirs-am installdirs-recursive \
|
||||
maintainer-clean maintainer-clean-generic \
|
||||
maintainer-clean-recursive mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic mostlyclean-recursive tags tags-recursive \
|
||||
mostlyclean-generic mostlyclean-recursive pdf pdf-am \
|
||||
pdf-recursive ps ps-am ps-recursive tags tags-recursive \
|
||||
uninstall uninstall-am uninstall-info-am \
|
||||
uninstall-info-recursive uninstall-recursive
|
||||
|
||||
|
@ -16,6 +16,8 @@
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: callback.cpp,v 1.16 2003/09/29 21:06:49 qbix79 Exp $ */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@ -40,7 +42,7 @@ static Bitu illegal_handler(void) {
|
||||
}
|
||||
|
||||
Bitu CALLBACK_Allocate(void) {
|
||||
for (Bitu i=0;(i<CB_MAX);i++) {
|
||||
for (Bitu i=1;(i<CB_MAX);i++) {
|
||||
if (CallBack_Handlers[i]==&illegal_handler) {
|
||||
CallBack_Handlers[i]=0;
|
||||
return i;
|
||||
@ -52,8 +54,8 @@ Bitu CALLBACK_Allocate(void) {
|
||||
|
||||
void CALLBACK_Idle(void) {
|
||||
/* this makes the cpu execute instructions to handle irq's and then come back */
|
||||
bool oldintf=flags.intf;
|
||||
flags.intf=true;
|
||||
Bitu oldIF=GETFLAG(IF);
|
||||
SETFLAGBIT(IF,true);
|
||||
Bit16u oldcs=SegValue(cs);
|
||||
Bit32u oldeip=reg_eip;
|
||||
SegSet16(cs,CB_SEG);
|
||||
@ -61,13 +63,13 @@ void CALLBACK_Idle(void) {
|
||||
DOSBOX_RunMachine();
|
||||
reg_eip=oldeip;
|
||||
SegSet16(cs,oldcs);
|
||||
flags.intf=oldintf;
|
||||
SETFLAGBIT(IF,oldIF);
|
||||
if (CPU_CycleLeft<300) CPU_CycleLeft=1;
|
||||
else CPU_CycleLeft-=300;
|
||||
}
|
||||
|
||||
static Bitu default_handler(void) {
|
||||
LOG(LOG_ERROR|LOG_CPU,"Illegal Unhandled Interrupt Called %X",lastint);
|
||||
LOG(LOG_CPU,LOG_ERROR)("Illegal Unhandled Interrupt Called %X",lastint);
|
||||
return CBRET_NONE;
|
||||
};
|
||||
|
||||
@ -121,23 +123,23 @@ bool CALLBACK_Setup(Bitu callback,CallBack_Handler handler,Bitu type) {
|
||||
if (callback>=CB_MAX) return false;
|
||||
switch (type) {
|
||||
case CB_RETF:
|
||||
real_writeb((Bit16u)CB_SEG,(callback<<4)+0,(Bit8u)0xFE); //GRP 4
|
||||
real_writeb((Bit16u)CB_SEG,(callback<<4)+1,(Bit8u)0x38); //Extra Callback instruction
|
||||
real_writew((Bit16u)CB_SEG,(callback<<4)+2,callback); //The immediate word
|
||||
real_writeb((Bit16u)CB_SEG,(callback<<4)+4,(Bit8u)0xCB); //A RETF Instruction
|
||||
phys_writeb(CB_BASE+(callback<<4)+0,(Bit8u)0xFE); //GRP 4
|
||||
phys_writeb(CB_BASE+(callback<<4)+1,(Bit8u)0x38); //Extra Callback instruction
|
||||
phys_writew(CB_BASE+(callback<<4)+2,callback); //The immediate word
|
||||
phys_writeb(CB_BASE+(callback<<4)+4,(Bit8u)0xCB); //A RETF Instruction
|
||||
break;
|
||||
case CB_IRET:
|
||||
real_writeb((Bit16u)CB_SEG,(callback<<4)+0,(Bit8u)0xFE); //GRP 4
|
||||
real_writeb((Bit16u)CB_SEG,(callback<<4)+1,(Bit8u)0x38); //Extra Callback instruction
|
||||
real_writew((Bit16u)CB_SEG,(callback<<4)+2,callback); //The immediate word
|
||||
real_writeb((Bit16u)CB_SEG,(callback<<4)+4,(Bit8u)0xCF); //An IRET Instruction
|
||||
phys_writeb(CB_BASE+(callback<<4)+0,(Bit8u)0xFE); //GRP 4
|
||||
phys_writeb(CB_BASE+(callback<<4)+1,(Bit8u)0x38); //Extra Callback instruction
|
||||
phys_writew(CB_BASE+(callback<<4)+2,callback); //The immediate word
|
||||
phys_writeb(CB_BASE+(callback<<4)+4,(Bit8u)0xCF); //An IRET Instruction
|
||||
break;
|
||||
case CB_IRET_STI:
|
||||
real_writeb((Bit16u)CB_SEG,(callback<<4)+0,(Bit8u)0xFB); //STI
|
||||
real_writeb((Bit16u)CB_SEG,(callback<<4)+1,(Bit8u)0xFE); //GRP 4
|
||||
real_writeb((Bit16u)CB_SEG,(callback<<4)+2,(Bit8u)0x38); //Extra Callback instruction
|
||||
real_writew((Bit16u)CB_SEG,(callback<<4)+3,callback); //The immediate word
|
||||
real_writeb((Bit16u)CB_SEG,(callback<<4)+5,(Bit8u)0xCF); //An IRET Instruction
|
||||
phys_writeb(CB_BASE+(callback<<4)+0,(Bit8u)0xFB); //STI
|
||||
phys_writeb(CB_BASE+(callback<<4)+1,(Bit8u)0xFE); //GRP 4
|
||||
phys_writeb(CB_BASE+(callback<<4)+2,(Bit8u)0x38); //Extra Callback instruction
|
||||
phys_writew(CB_BASE+(callback<<4)+3,callback); //The immediate word
|
||||
phys_writeb(CB_BASE+(callback<<4)+5,(Bit8u)0xCF); //An IRET Instruction
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -148,6 +150,35 @@ bool CALLBACK_Setup(Bitu callback,CallBack_Handler handler,Bitu type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CALLBACK_SetupAt(Bitu callback,CallBack_Handler handler,Bitu type,Bitu linearAddress) {
|
||||
if (callback>=CB_MAX) return false;
|
||||
switch (type) {
|
||||
case CB_RETF:
|
||||
mem_writeb(linearAddress+0,(Bit8u)0xFE); //GRP 4
|
||||
mem_writeb(linearAddress+1,(Bit8u)0x38); //Extra Callback instruction
|
||||
mem_writew(linearAddress+2, callback); //The immediate word
|
||||
mem_writeb(linearAddress+4,(Bit8u)0xCB); //A RETF Instruction
|
||||
break;
|
||||
case CB_IRET:
|
||||
mem_writeb(linearAddress+0,(Bit8u)0xFE); //GRP 4
|
||||
mem_writeb(linearAddress+1,(Bit8u)0x38); //Extra Callback instruction
|
||||
mem_writew(linearAddress+2,callback); //The immediate word
|
||||
mem_writeb(linearAddress+4,(Bit8u)0xCF); //An IRET Instruction
|
||||
break;
|
||||
case CB_IRET_STI:
|
||||
mem_writeb(linearAddress+0,(Bit8u)0xFB); //STI
|
||||
mem_writeb(linearAddress+1,(Bit8u)0xFE); //GRP 4
|
||||
mem_writeb(linearAddress+2,(Bit8u)0x38); //Extra Callback instruction
|
||||
mem_writew(linearAddress+3, callback); //The immediate word
|
||||
mem_writeb(linearAddress+5,(Bit8u)0xCF); //An IRET Instruction
|
||||
break;
|
||||
default:
|
||||
E_Exit("CALLBACK:Setup:Illegal type %d",type);
|
||||
}
|
||||
CallBack_Handlers[callback]=handler;
|
||||
return true;
|
||||
}
|
||||
|
||||
void CALLBACK_Init(Section* sec) {
|
||||
Bitu i;
|
||||
for (i=0;i<CB_MAX;i++) {
|
||||
@ -156,16 +187,16 @@ void CALLBACK_Init(Section* sec) {
|
||||
/* Setup the Stop Handler */
|
||||
call_stop=CALLBACK_Allocate();
|
||||
CallBack_Handlers[call_stop]=stop_handler;
|
||||
real_writeb((Bit16u)CB_SEG,(call_stop<<4)+0,0xFE);
|
||||
real_writeb((Bit16u)CB_SEG,(call_stop<<4)+1,0x38);
|
||||
real_writew((Bit16u)CB_SEG,(call_stop<<4)+2,call_stop);
|
||||
phys_writeb(CB_BASE+(call_stop<<4)+0,0xFE);
|
||||
phys_writeb(CB_BASE+(call_stop<<4)+1,0x38);
|
||||
phys_writew(CB_BASE+(call_stop<<4)+2,call_stop);
|
||||
/* Setup the idle handler */
|
||||
call_idle=CALLBACK_Allocate();
|
||||
CallBack_Handlers[call_idle]=stop_handler;
|
||||
for (i=0;i<=11;i++) real_writeb((Bit16u)CB_SEG,(call_idle<<4)+i,0x90);
|
||||
real_writeb((Bit16u)CB_SEG,(call_idle<<4)+12,0xFE);
|
||||
real_writeb((Bit16u)CB_SEG,(call_idle<<4)+13,0x38);
|
||||
real_writew((Bit16u)CB_SEG,(call_idle<<4)+14,call_idle);
|
||||
for (i=0;i<=11;i++) phys_writeb(CB_BASE+(call_idle<<4)+i,0x90);
|
||||
phys_writeb(CB_BASE+(call_idle<<4)+12,0xFE);
|
||||
phys_writeb(CB_BASE+(call_idle<<4)+13,0x38);
|
||||
phys_writew(CB_BASE+(call_idle<<4)+14,call_idle);
|
||||
|
||||
/* Setup all Interrupt to point to the default handler */
|
||||
call_default=CALLBACK_Allocate();
|
||||
@ -174,6 +205,8 @@ void CALLBACK_Init(Section* sec) {
|
||||
for (i=0;i<0x40;i++) {
|
||||
real_writed(0,i*4,CALLBACK_RealPointer(call_default));
|
||||
}
|
||||
real_writed(0,0x67*4,CALLBACK_RealPointer(call_default));
|
||||
//real_writed(0,0xf*4,0); some games don't like it
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
|
||||
noinst_HEADERS = helpers.h main.h prefix_66.h prefix_of.h start.h stop.h support.h table_ea.h \
|
||||
noinst_HEADERS = helpers.h main.h prefix_66.h prefix_of.h support.h table_ea.h \
|
||||
prefix_66_of.h
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Makefile.in generated by automake 1.6.3 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.7.7 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -13,89 +13,135 @@
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = ../../..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = @program_transform_name@
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
|
||||
EXEEXT = @EXEEXT@
|
||||
OBJEXT = @OBJEXT@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMDEP_FALSE = @AMDEP_FALSE@
|
||||
AMDEP_TRUE = @AMDEP_TRUE@
|
||||
AMTAR = @AMTAR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SDL_CFLAGS = @SDL_CFLAGS@
|
||||
SDL_CONFIG = @SDL_CONFIG@
|
||||
SDL_LIBS = @SDL_LIBS@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_RANLIB = @ac_ct_RANLIB@
|
||||
ac_ct_STRIP = @ac_ct_STRIP@
|
||||
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
|
||||
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
|
||||
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
|
||||
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
datadir = @datadir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
oldincludedir = @oldincludedir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target = @target@
|
||||
target_alias = @target_alias@
|
||||
target_cpu = @target_cpu@
|
||||
target_os = @target_os@
|
||||
target_vendor = @target_vendor@
|
||||
|
||||
noinst_HEADERS = helpers.h main.h prefix_66.h prefix_of.h start.h stop.h support.h table_ea.h \
|
||||
noinst_HEADERS = helpers.h main.h prefix_66.h prefix_of.h support.h table_ea.h \
|
||||
prefix_66_of.h
|
||||
|
||||
subdir = src/cpu/core_16
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
DIST_SOURCES =
|
||||
HEADERS = $(noinst_HEADERS)
|
||||
|
||||
DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in
|
||||
DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.in Makefile.am
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
@ -109,6 +155,9 @@ uninstall-info-am:
|
||||
ETAGS = etags
|
||||
ETAGSFLAGS =
|
||||
|
||||
CTAGS = ctags
|
||||
CTAGSFLAGS =
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
@ -134,20 +183,41 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
top_distdir = ../../..
|
||||
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@list='$(DISTFILES)'; for file in $$list; do \
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(DISTFILES)'; for file in $$list; do \
|
||||
case $$file in \
|
||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
|
||||
esac; \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
@ -172,7 +242,6 @@ check: check-am
|
||||
all-am: Makefile $(HEADERS)
|
||||
|
||||
installdirs:
|
||||
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
@ -192,7 +261,7 @@ mostlyclean-generic:
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@ -202,6 +271,7 @@ clean: clean-am
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f Makefile
|
||||
|
||||
distclean-am: clean-am distclean-generic distclean-tags
|
||||
|
||||
@ -224,6 +294,7 @@ install-man:
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f Makefile
|
||||
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
@ -231,16 +302,24 @@ mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-info-am
|
||||
|
||||
.PHONY: GTAGS all all-am check check-am clean clean-generic distclean \
|
||||
distclean-generic distclean-tags distdir dvi dvi-am info \
|
||||
info-am install install-am install-data install-data-am \
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic ctags \
|
||||
distclean distclean-generic distclean-tags distdir dvi dvi-am \
|
||||
info info-am install install-am install-data install-data-am \
|
||||
install-exec install-exec-am install-info install-info-am \
|
||||
install-man install-strip installcheck installcheck-am \
|
||||
installdirs maintainer-clean maintainer-clean-generic \
|
||||
mostlyclean mostlyclean-generic tags uninstall uninstall-am \
|
||||
uninstall-info-am
|
||||
mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \
|
||||
uninstall uninstall-am uninstall-info-am
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
|
@ -18,12 +18,13 @@
|
||||
|
||||
|
||||
#define GetEAa \
|
||||
EAPoint eaa=(*lookupEATable)[rm]();
|
||||
PhysPt eaa=(*lookupEATable)[rm]();
|
||||
|
||||
#define GetRMEAa \
|
||||
GetRM; \
|
||||
GetEAa;
|
||||
|
||||
|
||||
#define RMEbGb(inst) \
|
||||
{ \
|
||||
GetRMrb; \
|
||||
@ -38,6 +39,12 @@
|
||||
else {GetEAa;inst(*rmrb,LoadMb(eaa),LoadRb,SaveRb);} \
|
||||
}
|
||||
|
||||
#define RMEb(inst) \
|
||||
{ \
|
||||
if (rm >= 0xc0 ) {GetEArb;inst(*earb,LoadRb,SaveRb);} \
|
||||
else {GetEAa;inst(eaa,LoadMb,SaveMb);} \
|
||||
}
|
||||
|
||||
#define RMEwGw(inst) \
|
||||
{ \
|
||||
GetRMrw; \
|
||||
@ -45,6 +52,13 @@
|
||||
else {GetEAa;inst(eaa,*rmrw,LoadMw,SaveMw);} \
|
||||
}
|
||||
|
||||
#define RMEwGwOp3(inst,op3) \
|
||||
{ \
|
||||
GetRMrw; \
|
||||
if (rm >= 0xc0 ) {GetEArw;inst(*earw,*rmrw,op3,LoadRw,SaveRw);} \
|
||||
else {GetEAa;inst(eaa,*rmrw,op3,LoadMw,SaveMw);} \
|
||||
}
|
||||
|
||||
#define RMGwEw(inst) \
|
||||
{ \
|
||||
GetRMrw; \
|
||||
@ -52,6 +66,19 @@
|
||||
else {GetEAa;inst(*rmrw,LoadMw(eaa),LoadRw,SaveRw);} \
|
||||
}
|
||||
|
||||
#define RMGwEwOp3(inst,op3) \
|
||||
{ \
|
||||
GetRMrw; \
|
||||
if (rm >= 0xc0 ) {GetEArw;inst(*rmrw,*earw,op3,LoadRw,SaveRw);} \
|
||||
else {GetEAa;inst(*rmrw,LoadMw(eaa),op3,LoadRw,SaveRw);} \
|
||||
}
|
||||
|
||||
#define RMEw(inst) \
|
||||
{ \
|
||||
if (rm >= 0xc0 ) {GetEArw;inst(*earw,LoadRw,SaveRw);} \
|
||||
else {GetEAa;inst(eaa,LoadMw,SaveMw);} \
|
||||
}
|
||||
|
||||
#define RMEdGd(inst) \
|
||||
{ \
|
||||
GetRMrd; \
|
||||
@ -59,6 +86,14 @@
|
||||
else {GetEAa;inst(eaa,*rmrd,LoadMd,SaveMd);} \
|
||||
}
|
||||
|
||||
#define RMEdGdOp3(inst,op3) \
|
||||
{ \
|
||||
GetRMrd; \
|
||||
if (rm >= 0xc0 ) {GetEArd;inst(*eard,*rmrd,op3,LoadRd,SaveRd);} \
|
||||
else {GetEAa;inst(eaa,*rmrd,op3,LoadMd,SaveMd);} \
|
||||
}
|
||||
|
||||
|
||||
#define RMGdEd(inst) \
|
||||
{ \
|
||||
GetRMrd; \
|
||||
@ -66,6 +101,28 @@
|
||||
else {GetEAa;inst(*rmrd,LoadMd(eaa),LoadRd,SaveRd);} \
|
||||
}
|
||||
|
||||
#define RMGdEdOp3(inst,op3) \
|
||||
{ \
|
||||
GetRMrd; \
|
||||
if (rm >= 0xc0 ) {GetEArd;inst(*rmrd,*eard,op3,LoadRd,SaveRd);} \
|
||||
else {GetEAa;inst(*rmrd,LoadMd(eaa),op3,LoadRd,SaveRd);} \
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#define RMEw(inst) \
|
||||
{ \
|
||||
if (rm >= 0xc0 ) {GetEArw;inst(*earw,LoadRw,SaveRw);} \
|
||||
else {GetEAa;inst(eaa,LoadMw,SaveMw);} \
|
||||
}
|
||||
|
||||
#define RMEd(inst) \
|
||||
{ \
|
||||
if (rm >= 0xc0 ) {GetEArd;inst(*eard,LoadRd,SaveRd);} \
|
||||
else {GetEAa;inst(eaa,LoadMd,SaveMd);} \
|
||||
}
|
||||
|
||||
#define ALIb(inst) \
|
||||
{ inst(reg_al,Fetchb(),LoadRb,SaveRb)}
|
||||
|
||||
@ -74,3 +131,13 @@
|
||||
|
||||
#define EAXId(inst) \
|
||||
{ inst(reg_eax,Fetchd(),LoadRd,SaveRd);}
|
||||
|
||||
#define FPU_ESC(code) { \
|
||||
Bit8u rm=Fetchb(); \
|
||||
if (rm>=0xc0) { \
|
||||
FPU_ESC ## code ## _Normal(rm); \
|
||||
} else { \
|
||||
GetEAa;FPU_ESC ## code ## _EA(rm,eaa); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,8 @@ restart:
|
||||
Push_16(SegValue(ss));break;
|
||||
case 0x17: /* POP SS */
|
||||
SegSet16(ss,Pop_16());
|
||||
goto restart;
|
||||
CPU_Cycles++;//Be sure we run another instruction
|
||||
break;
|
||||
case 0x18: /* SBB Eb,Gb */
|
||||
RMEbGb(SBBB);break;
|
||||
case 0x19: /* SBB Ew,Gw */
|
||||
@ -82,7 +83,7 @@ restart:
|
||||
AXIw(SBBW);break;
|
||||
case 0x1e: /* PUSH DS */
|
||||
Push_16(SegValue(ds));break;
|
||||
case 0x1f: /* POP DS */
|
||||
case 0x1f: /* POP DS */
|
||||
SegSet16(ds,Pop_16());break;
|
||||
case 0x20: /* AND Eb,Gb */
|
||||
RMEbGb(ANDB);break;
|
||||
@ -99,23 +100,7 @@ restart:
|
||||
case 0x26: /* SEG ES: */
|
||||
SegPrefix(es);break;
|
||||
case 0x27: /* DAA */
|
||||
if (((reg_al & 0x0F)>0x09) || get_AF()) {
|
||||
reg_al+=0x06;
|
||||
flags.af=true;
|
||||
} else {
|
||||
flags.af=false;
|
||||
}
|
||||
flags.cf=get_CF();
|
||||
if ((reg_al > 0x9F) || flags.cf) {
|
||||
reg_al+=0x60;
|
||||
flags.cf=true;
|
||||
} else {
|
||||
flags.cf=false;
|
||||
}
|
||||
flags.sf=(reg_al>>7)>0;
|
||||
flags.zf=(reg_al==0);
|
||||
//TODO Maybe parity
|
||||
flags.type=t_UNKNOWN;
|
||||
DAA();
|
||||
break;
|
||||
case 0x28: /* SUB Eb,Gb */
|
||||
RMEbGb(SUBB);break;
|
||||
@ -132,19 +117,7 @@ restart:
|
||||
case 0x2e: /* SEG CS: */
|
||||
SegPrefix(cs);break;
|
||||
case 0x2f: /* DAS */
|
||||
if (((reg_al & 0x0f) > 9) || get_AF()) {
|
||||
reg_al-=6;
|
||||
flags.af=true;
|
||||
} else {
|
||||
flags.af=false;
|
||||
}
|
||||
if ((reg_al>0x9f) || get_CF()) {
|
||||
reg_al-=0x60;
|
||||
flags.cf=true;
|
||||
} else {
|
||||
flags.cf=false;
|
||||
}
|
||||
flags.type=t_UNKNOWN;
|
||||
DAS();
|
||||
break;
|
||||
case 0x30: /* XOR Eb,Gb */
|
||||
RMEbGb(XORB);break;
|
||||
@ -161,18 +134,7 @@ restart:
|
||||
case 0x36: /* SEG SS: */
|
||||
SegPrefix(ss);break;
|
||||
case 0x37: /* AAA */
|
||||
if (get_AF() || ((reg_al & 0xf) > 9))
|
||||
{
|
||||
reg_al += 6;
|
||||
reg_ah += 1;
|
||||
flags.af=true;
|
||||
flags.cf=true;
|
||||
} else {
|
||||
flags.af=false;
|
||||
flags.cf=false;
|
||||
}
|
||||
reg_al &= 0x0F;
|
||||
flags.type=t_UNKNOWN;
|
||||
AAA();
|
||||
break;
|
||||
case 0x38: /* CMP Eb,Gb */
|
||||
RMEbGb(CMPB);break;
|
||||
@ -189,14 +151,7 @@ restart:
|
||||
case 0x3e: /* SEG DS: */
|
||||
SegPrefix(ds);break;
|
||||
case 0x3f: /* AAS */
|
||||
if (((reg_al & 0x0f)>9) || get_AF()) {
|
||||
reg_al=(reg_al-6) & 0xF;
|
||||
reg_ah--;
|
||||
flags.af=flags.cf=true;
|
||||
} else {
|
||||
flags.af=flags.cf=false;
|
||||
}
|
||||
flags.type=t_UNKNOWN;
|
||||
AAS();
|
||||
break;
|
||||
case 0x40: /* INC AX */
|
||||
INCW(reg_ax,LoadRw,SaveRw);break;
|
||||
@ -240,7 +195,7 @@ restart:
|
||||
Push_16(reg_bx);break;
|
||||
case 0x54: /* PUSH SP */
|
||||
//TODO Check if this is correct i think it's SP+2 or something
|
||||
Push_16(reg_sp);break;
|
||||
Push_16(reg_sp);break;
|
||||
case 0x55: /* PUSH BP */
|
||||
Push_16(reg_bp);break;
|
||||
case 0x56: /* PUSH SI */
|
||||
@ -255,8 +210,8 @@ restart:
|
||||
reg_dx=Pop_16();break;
|
||||
case 0x5b: /* POP BX */
|
||||
reg_bx=Pop_16();break;
|
||||
case 0x5c: /* POP SP */
|
||||
reg_sp=Pop_16();break;
|
||||
case 0x5c: /* POP SP */
|
||||
reg_sp=Pop_16();break;
|
||||
case 0x5d: /* POP BP */
|
||||
reg_bp=Pop_16();break;
|
||||
case 0x5e: /* POP SI */
|
||||
@ -264,8 +219,11 @@ restart:
|
||||
case 0x5f: /* POP DI */
|
||||
reg_di=Pop_16();break;
|
||||
case 0x60: /* PUSHA */
|
||||
Push_16(reg_ax);Push_16(reg_cx);Push_16(reg_dx);Push_16(reg_bx);
|
||||
Push_16(reg_sp);Push_16(reg_bp);Push_16(reg_si);Push_16(reg_di);
|
||||
{
|
||||
Bit16u old_sp=reg_sp;
|
||||
Push_16(reg_ax);Push_16(reg_cx);Push_16(reg_dx);Push_16(reg_bx);
|
||||
Push_16(old_sp);Push_16(reg_bp);Push_16(reg_si);Push_16(reg_di);
|
||||
}
|
||||
break;
|
||||
case 0x61: /* POPA */
|
||||
reg_di=Pop_16();reg_si=Pop_16();reg_bp=Pop_16();Pop_16();//Don't save SP
|
||||
@ -278,7 +236,7 @@ restart:
|
||||
bound_min=LoadMw(eaa);
|
||||
bound_max=LoadMw(eaa+2);
|
||||
if ( (((Bit16s)*rmrw) < bound_min) || (((Bit16s)*rmrw) > bound_max) ) {
|
||||
INTERRUPT(5);
|
||||
EXCEPTION(5);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -294,11 +252,8 @@ restart:
|
||||
break;
|
||||
case 0x67: /* Address Size Prefix */
|
||||
#ifdef CPU_PREFIX_67
|
||||
prefix.mark|=PREFIX_ADDR;
|
||||
#ifdef CPU_PREFIX_COUNT
|
||||
prefix.count++;
|
||||
#endif
|
||||
lookupEATable=EAPrefixTable[prefix.mark];
|
||||
core_16.prefixes^=PREFIX_ADDR;
|
||||
lookupEATable=EAPrefixTable[core_16.prefixes];
|
||||
goto restart;
|
||||
#else
|
||||
NOTDONE;
|
||||
@ -308,35 +263,19 @@ restart:
|
||||
case 0x68: /* PUSH Iw */
|
||||
Push_16(Fetchw());break;
|
||||
case 0x69: /* IMUL Gw,Ew,Iw */
|
||||
{
|
||||
GetRMrw;
|
||||
Bit32s res;
|
||||
if (rm >= 0xc0 ) {GetEArw;res=(Bit32s)(*earws) * (Bit32s)Fetchws();}
|
||||
else {GetEAa;res=(Bit32s)LoadMws(eaa) * (Bit32s)Fetchws();}
|
||||
*rmrw=res & 0xFFFF;
|
||||
flags.type=t_MUL;
|
||||
if ((res> -32768) && (res<32767)) {flags.cf=false;flags.of=false;}
|
||||
else {flags.cf=true;flags.of=true;}
|
||||
break;
|
||||
};
|
||||
RMGwEwOp3(DIMULW,Fetchws());
|
||||
break;
|
||||
case 0x6a: /* PUSH Ib */
|
||||
Push_16(Fetchbs());break;
|
||||
Push_16(Fetchbs());
|
||||
break;
|
||||
case 0x6b: /* IMUL Gw,Ew,Ib */
|
||||
{
|
||||
GetRMrw;Bit32s res;
|
||||
if (rm >= 0xc0 ) {GetEArw;res=(Bit32s)(*earws) * (Bit32s)Fetchbs();}
|
||||
else {GetEAa;res=(Bit32s)LoadMws(eaa) * (Bit32s)Fetchbs();}
|
||||
*rmrw=res & 0xFFFF;
|
||||
flags.type=t_MUL;
|
||||
if ((res> -32768) && (res<32767)) {flags.cf=false;flags.of=false;}
|
||||
else {flags.cf=true;flags.of=true;}
|
||||
break;
|
||||
}
|
||||
RMGwEwOp3(DIMULW,Fetchbs());
|
||||
break;
|
||||
case 0x6c: /* INSB */
|
||||
{
|
||||
stringDI;
|
||||
SaveMb(to,IO_Read(reg_dx));
|
||||
if (flags.df) reg_di--; else reg_di++;
|
||||
if (GETFLAG(DF)) reg_di--; else reg_di++;
|
||||
break;
|
||||
}
|
||||
case 0x6d: /* INSW */
|
||||
@ -344,14 +283,14 @@ restart:
|
||||
stringDI;
|
||||
SaveMb(to,IO_Read(reg_dx));
|
||||
SaveMb((to+1),IO_Read(reg_dx+1));
|
||||
if (flags.df) reg_di-=2; else reg_di+=2;
|
||||
if (GETFLAG(DF)) reg_di-=2; else reg_di+=2;
|
||||
break;
|
||||
}
|
||||
case 0x6e: /* OUTSB */
|
||||
{
|
||||
stringSI;
|
||||
IO_Write(reg_dx,LoadMb(from));
|
||||
if (flags.df) reg_si--; else reg_si++;
|
||||
if (GETFLAG(DF)) reg_si--; else reg_si++;
|
||||
break;
|
||||
}
|
||||
case 0x6f: /* OUTSW */
|
||||
@ -359,7 +298,7 @@ restart:
|
||||
stringSI;
|
||||
IO_Write(reg_dx,LoadMb(from));
|
||||
IO_Write(reg_dx+1,LoadMb(from+1));
|
||||
if (flags.df) reg_si-=2; else reg_si+=2;
|
||||
if (GETFLAG(DF)) reg_si-=2; else reg_si+=2;
|
||||
break;
|
||||
}
|
||||
case 0x70: /* JO */
|
||||
@ -486,9 +425,11 @@ restart:
|
||||
break;
|
||||
}
|
||||
case 0x84: /* TEST Eb,Gb */
|
||||
RMEbGb(TESTB);break;
|
||||
RMEbGb(TESTB);
|
||||
break;
|
||||
case 0x85: /* TEST Ew,Gw */
|
||||
RMEwGw(TESTW);break;
|
||||
RMEwGw(TESTW);
|
||||
break;
|
||||
case 0x86: /* XCHG Eb,Gb */
|
||||
{
|
||||
GetRMrb;Bit8u oldrmrb=*rmrb;
|
||||
@ -557,9 +498,9 @@ restart:
|
||||
}
|
||||
case 0x8d: /* LEA */
|
||||
{
|
||||
prefix.segbase=0;
|
||||
prefix.mark|=PREFIX_SEG;
|
||||
lookupEATable=EAPrefixTable[prefix.mark];
|
||||
core_16.segbase=0;
|
||||
core_16.prefixes|=PREFIX_SEG;
|
||||
lookupEATable=EAPrefixTable[core_16.prefixes];
|
||||
GetRMrw;GetEAa;
|
||||
*rmrw=(Bit16u)eaa;
|
||||
break;
|
||||
@ -577,7 +518,7 @@ restart:
|
||||
break;
|
||||
case 0x10: /* MOV SS,Ew */
|
||||
SegSet16(ss,val);
|
||||
goto restart;
|
||||
CPU_Cycles++;//Be sure we run another instruction
|
||||
break;
|
||||
case 0x18: /* MOV DS,Ew */
|
||||
SegSet16(ds,val);break;
|
||||
@ -636,59 +577,50 @@ restart:
|
||||
case 0x9b: /* WAIT */
|
||||
break; /* No waiting here */
|
||||
case 0x9c: /* PUSHF */
|
||||
{
|
||||
Bit16u pflags=
|
||||
(get_CF() << 0) | (get_PF() << 2) | (get_AF() << 4) |
|
||||
(get_ZF() << 6) | (get_SF() << 7) | (flags.tf << 8) |
|
||||
(flags.intf << 9) |(flags.df << 10) | (get_OF() << 11) |
|
||||
(flags.io << 12) | (flags.nt <<14);
|
||||
Push_16(pflags);
|
||||
break;
|
||||
}
|
||||
FillFlags();
|
||||
Push_16(flags.word);
|
||||
break;
|
||||
case 0x9d: /* POPF */
|
||||
{
|
||||
Bit16u bits=Pop_16();
|
||||
Save_Flagsw(bits);
|
||||
break;
|
||||
}
|
||||
SETFLAGSw(Pop_16());
|
||||
CheckTF();
|
||||
#ifdef CPU_PIC_CHECK
|
||||
if (GETFLAG(IF) && PIC_IRQCheck) goto decode_end;
|
||||
#endif
|
||||
break;
|
||||
case 0x9e: /* SAHF */
|
||||
flags.of =get_OF();
|
||||
flags.type=t_UNKNOWN;
|
||||
flags.cf =(reg_ah & 0x001)!=0;flags.pf =(reg_ah & 0x004)!=0;
|
||||
flags.af =(reg_ah & 0x010)!=0;flags.zf =(reg_ah & 0x040)!=0;
|
||||
flags.sf =(reg_ah & 0x080)!=0;
|
||||
SETFLAGSb(reg_ah);
|
||||
break;
|
||||
case 0x9f: /* LAHF */
|
||||
{
|
||||
reg_ah=(get_CF() << 0) | (get_PF() << 2) | (get_AF() << 4) |
|
||||
(get_ZF() << 6) | (get_SF() << 7);
|
||||
FillFlags();
|
||||
reg_ah=(Bit8u)flags.word;
|
||||
break;
|
||||
}
|
||||
case 0xa0: /* MOV AL,Ob */
|
||||
{
|
||||
reg_al=LoadMb(GetEADirect[prefix.mark]());
|
||||
reg_al=LoadMb(GetEADirect[core_16.prefixes]());
|
||||
}
|
||||
break;
|
||||
case 0xa1: /* MOV AX,Ow */
|
||||
{
|
||||
reg_ax=LoadMw(GetEADirect[prefix.mark]());
|
||||
reg_ax=LoadMw(GetEADirect[core_16.prefixes]());
|
||||
}
|
||||
break;
|
||||
case 0xa2: /* MOV Ob,AL */
|
||||
{
|
||||
SaveMb(GetEADirect[prefix.mark](),reg_al);
|
||||
SaveMb(GetEADirect[core_16.prefixes](),reg_al);
|
||||
}
|
||||
break;
|
||||
case 0xa3: /* MOV Ow,AX */
|
||||
{
|
||||
SaveMw(GetEADirect[prefix.mark](),reg_ax);
|
||||
SaveMw(GetEADirect[core_16.prefixes](),reg_ax);
|
||||
}
|
||||
break;
|
||||
case 0xa4: /* MOVSB */
|
||||
{
|
||||
stringSI;stringDI;
|
||||
SaveMb(to,LoadMb(from));;
|
||||
if (flags.df) { reg_si--;reg_di--; }
|
||||
if (GETFLAG(DF)) { reg_si--;reg_di--; }
|
||||
else {reg_si++;reg_di++;}
|
||||
break;
|
||||
}
|
||||
@ -696,7 +628,7 @@ restart:
|
||||
{
|
||||
stringSI;stringDI;
|
||||
SaveMw(to,LoadMw(from));
|
||||
if (flags.df) { reg_si-=2;reg_di-=2; }
|
||||
if (GETFLAG(DF)) { reg_si-=2;reg_di-=2; }
|
||||
else {reg_si+=2;reg_di+=2;}
|
||||
break;
|
||||
}
|
||||
@ -704,7 +636,7 @@ restart:
|
||||
{
|
||||
stringSI;stringDI;
|
||||
CMPB(from,LoadMb(to),LoadMb,0);
|
||||
if (flags.df) { reg_si--;reg_di--; }
|
||||
if (GETFLAG(DF)) { reg_si--;reg_di--; }
|
||||
else {reg_si++;reg_di++;}
|
||||
break;
|
||||
}
|
||||
@ -712,7 +644,7 @@ restart:
|
||||
{
|
||||
stringSI;stringDI;
|
||||
CMPW(from,LoadMw(to),LoadMw,0);
|
||||
if (flags.df) { reg_si-=2;reg_di-=2; }
|
||||
if (GETFLAG(DF)) { reg_si-=2;reg_di-=2; }
|
||||
else {reg_si+=2;reg_di+=2;}
|
||||
break;
|
||||
}
|
||||
@ -724,7 +656,7 @@ restart:
|
||||
{
|
||||
stringDI;
|
||||
SaveMb(to,reg_al);
|
||||
if (flags.df) { reg_di--; }
|
||||
if (GETFLAG(DF)) { reg_di--; }
|
||||
else {reg_di++;}
|
||||
break;
|
||||
}
|
||||
@ -732,7 +664,7 @@ restart:
|
||||
{
|
||||
stringDI;
|
||||
SaveMw(to,reg_ax);
|
||||
if (flags.df) { reg_di-=2; }
|
||||
if (GETFLAG(DF)) { reg_di-=2; }
|
||||
else {reg_di+=2;}
|
||||
break;
|
||||
}
|
||||
@ -740,7 +672,7 @@ restart:
|
||||
{
|
||||
stringSI;
|
||||
reg_al=LoadMb(from);
|
||||
if (flags.df) { reg_si--; }
|
||||
if (GETFLAG(DF)) { reg_si--; }
|
||||
else {reg_si++;}
|
||||
break;
|
||||
}
|
||||
@ -748,7 +680,7 @@ restart:
|
||||
{
|
||||
stringSI;
|
||||
reg_ax=LoadMw(from);
|
||||
if (flags.df) { reg_si-=2;}
|
||||
if (GETFLAG(DF)) { reg_si-=2;}
|
||||
else {reg_si+=2;}
|
||||
break;
|
||||
}
|
||||
@ -756,7 +688,7 @@ restart:
|
||||
{
|
||||
stringDI;
|
||||
CMPB(reg_al,LoadMb(to),LoadRb,0);
|
||||
if (flags.df) { reg_di--; }
|
||||
if (GETFLAG(DF)) { reg_di--; }
|
||||
else {reg_di++;}
|
||||
break;
|
||||
}
|
||||
@ -764,7 +696,7 @@ restart:
|
||||
{
|
||||
stringDI;
|
||||
CMPW(reg_ax,LoadMw(to),LoadRw,0);
|
||||
if (flags.df) { reg_di-=2; }
|
||||
if (GETFLAG(DF)) { reg_di-=2; }
|
||||
else {reg_di+=2;}
|
||||
break;
|
||||
}
|
||||
@ -843,7 +775,7 @@ restart:
|
||||
{
|
||||
Bit16u bytes=Fetchw();Bit8u level=Fetchb();
|
||||
Push_16(reg_bp);reg_bp=reg_sp;reg_sp-=bytes;
|
||||
EAPoint reader=SegBase(ss)+reg_bp;
|
||||
PhysPt reader=SegBase(ss)+reg_bp;
|
||||
for (Bit8u i=1;i<level;i++) {Push_16(LoadMw(reader));reader-=2;}
|
||||
if (level) Push_16(reg_bp);
|
||||
break;
|
||||
@ -864,34 +796,52 @@ restart:
|
||||
}
|
||||
break;
|
||||
case 0xcc: /* INT3 */
|
||||
LEAVECORE;
|
||||
#if C_DEBUG
|
||||
SAVEIP;
|
||||
if (DEBUG_Breakpoint()) {
|
||||
LOADIP;
|
||||
return 1;
|
||||
return debugCallback;
|
||||
}
|
||||
LOADIP;
|
||||
#endif
|
||||
INTERRUPT(3);
|
||||
break;
|
||||
#endif
|
||||
if (Interrupt(3)) {
|
||||
if (GETFLAG(TF)) {
|
||||
LOG_MSG("Switch to trap decoder");
|
||||
cpudecoder=CPU_Real_16_Slow_Decode_Trap;
|
||||
return CBRET_NONE;
|
||||
}
|
||||
goto decode_start;
|
||||
} else return CBRET_NONE;
|
||||
case 0xcd: /* INT Ib */
|
||||
{
|
||||
Bit8u num=Fetchb();
|
||||
LEAVECORE;
|
||||
#if C_DEBUG
|
||||
SAVEIP;
|
||||
if (DEBUG_IntBreakpoint(num)) return 1;
|
||||
if (DEBUG_IntBreakpoint(num)) {
|
||||
return debugCallback;
|
||||
}
|
||||
#endif
|
||||
INTERRUPT(num);
|
||||
if (Interrupt(num)) {
|
||||
if (GETFLAG(TF)) {
|
||||
LOG_MSG("Switch to trap decoder");
|
||||
cpudecoder=CPU_Real_16_Slow_Decode_Trap;
|
||||
return CBRET_NONE;
|
||||
}
|
||||
goto decode_start;
|
||||
} else return CBRET_NONE;
|
||||
}
|
||||
break;
|
||||
case 0xce: /* INTO */
|
||||
if (get_OF()) INTERRUPT(4);
|
||||
if (get_OF()) EXCEPTION(4);
|
||||
break;
|
||||
case 0xcf: /* IRET */
|
||||
{
|
||||
Bit16u newip=Pop_16();Bit16u newcs=Pop_16();
|
||||
SegSet16(cs,newcs);SETIP(newip);
|
||||
Bit16u pflags=Pop_16();Save_Flagsw(pflags);
|
||||
Bit16u pflags=Pop_16();
|
||||
SETFLAGSw(pflags);
|
||||
CheckTF();
|
||||
#ifdef CPU_PIC_CHECK
|
||||
if (GETFLAG(IF) && PIC_IRQCheck) goto decode_end;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case 0xd0: /* GRP2 Eb,1 */
|
||||
@ -903,33 +853,18 @@ restart:
|
||||
case 0xd3: /* GRP2 Ew,CL */
|
||||
GRP2W(reg_cl);break;
|
||||
case 0xd4: /* AAM Ib */
|
||||
{
|
||||
Bit8u ib=Fetchb();
|
||||
|
||||
reg_ah=reg_al / ib;
|
||||
reg_al=reg_al % ib;
|
||||
flags.type=t_UNKNOWN;
|
||||
flags.sf=(reg_ah & 0x80) > 0;
|
||||
flags.zf=(reg_ax == 0);
|
||||
//TODO PF
|
||||
flags.pf=0;
|
||||
}
|
||||
AAM(Fetchb());
|
||||
break;
|
||||
case 0xd5: /* AAD Ib */
|
||||
reg_al=reg_ah*Fetchb()+reg_al;
|
||||
reg_ah=0;
|
||||
flags.cf=(reg_al>=0x80);
|
||||
flags.zf=(reg_al==0);
|
||||
//TODO PF
|
||||
flags.type=t_UNKNOWN;
|
||||
AAD(Fetchb());
|
||||
break;
|
||||
|
||||
case 0xd6: /* SALC */
|
||||
reg_al = get_CF() ? 0xFF : 0;
|
||||
break;
|
||||
case 0xd7: /* XLAT */
|
||||
if (prefix.mark & PREFIX_SEG) {
|
||||
reg_al=LoadMb(prefix.segbase+(Bit16u)(reg_bx+reg_al));
|
||||
PrefixReset;
|
||||
if (core_16.prefixes & PREFIX_SEG) {
|
||||
reg_al=LoadMb(core_16.segbase+(Bit16u)(reg_bx+reg_al));
|
||||
} else {
|
||||
reg_al=LoadMb(SegBase(ds)+(Bit16u)(reg_bx+reg_al));
|
||||
}
|
||||
@ -961,7 +896,7 @@ restart:
|
||||
case 0xde: /* FPU ESC 6 */
|
||||
case 0xdf: /* FPU ESC 7 */
|
||||
{
|
||||
LOG(LOG_CPU,"FPU used");
|
||||
LOG(LOG_CPU,LOG_NORMAL)("FPU used");
|
||||
Bit8u rm=Fetchb();
|
||||
if (rm<0xc0) GetEAa;
|
||||
}
|
||||
@ -982,8 +917,8 @@ restart:
|
||||
case 0xe3: /* JCXZ */
|
||||
{
|
||||
Bitu test;
|
||||
if (prefix.mark & PREFIX_ADDR) {
|
||||
test=reg_ecx;PrefixReset;
|
||||
if (core_16.prefixes & PREFIX_ADDR) {
|
||||
test=reg_ecx;
|
||||
} else test=reg_cx;
|
||||
if (!test) ADDIPFAST(Fetchbs());
|
||||
else ADDIPFAST(1);
|
||||
@ -1027,7 +962,7 @@ restart:
|
||||
break;
|
||||
case 0xed: /* IN AX,DX */
|
||||
reg_al=IO_Read(reg_dx);
|
||||
reg_ah=IO_Read(reg_dx+1);
|
||||
reg_ah=IO_Read(reg_dx+1);
|
||||
break;
|
||||
case 0xee: /* OUT DX,AL */
|
||||
IO_Write(reg_dx,reg_al);
|
||||
@ -1037,7 +972,7 @@ restart:
|
||||
IO_Write(reg_dx+1,reg_ah);
|
||||
break;
|
||||
case 0xf0: /* LOCK */
|
||||
LOG(LOG_CPU,"CPU:LOCK");
|
||||
// LOG(LOG_CPU,LOG_NORMAL)("CPU:LOCK");
|
||||
break;
|
||||
case 0xf1: /* Weird call undocumented */
|
||||
// INTERRUPT(1);
|
||||
@ -1050,30 +985,32 @@ restart:
|
||||
Repeat_Normal(true,false);
|
||||
continue;
|
||||
case 0xf4: /* HLT */
|
||||
break;
|
||||
LEAVECORE;
|
||||
CPU_HLT();
|
||||
return 0x0;
|
||||
case 0xf5: /* CMC */
|
||||
flags.cf=!get_CF();
|
||||
SETFLAGBIT(CF,!get_CF());
|
||||
if (flags.type!=t_CF) flags.prev_type=flags.type;
|
||||
flags.type=t_CF;
|
||||
break;
|
||||
case 0xf6: /* GRP3 Eb(,Ib) */
|
||||
{
|
||||
{
|
||||
GetRM;
|
||||
switch (rm & 0x38) {
|
||||
switch ((rm & 0x38)>>3) {
|
||||
case 0x00: /* TEST Eb,Ib */
|
||||
case 0x08: /* TEST Eb,Ib Undocumented*/
|
||||
case 0x01: /* TEST Eb,Ib Undocumented*/
|
||||
{
|
||||
if (rm >= 0xc0 ) {GetEArb;TESTB(*earb,Fetchb(),LoadRb,0)}
|
||||
else {GetEAa;TESTB(eaa,Fetchb(),LoadMb,0);}
|
||||
break;
|
||||
}
|
||||
case 0x10: /* NOT Eb */
|
||||
case 0x02: /* NOT Eb */
|
||||
{
|
||||
if (rm >= 0xc0 ) {GetEArb;*earb=~*earb;}
|
||||
else {GetEAa;SaveMb(eaa,~LoadMb(eaa));}
|
||||
break;
|
||||
}
|
||||
case 0x18: /* NEG Eb */
|
||||
case 0x03: /* NEG Eb */
|
||||
{
|
||||
flags.type=t_NEGb;
|
||||
if (rm >= 0xc0 ) {
|
||||
@ -1085,69 +1022,38 @@ restart:
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 0x20: /* MUL AL,Eb */
|
||||
{
|
||||
flags.type=t_MUL;
|
||||
if (rm >= 0xc0 ) {GetEArb;reg_ax=reg_al * (*earb);}
|
||||
else {GetEAa;reg_ax=reg_al * LoadMb(eaa);}
|
||||
flags.cf=flags.of=((reg_ax & 0xff00) !=0);
|
||||
break;
|
||||
}
|
||||
case 0x28: /* IMUL AL,Eb */
|
||||
{
|
||||
flags.type=t_MUL;
|
||||
if (rm >= 0xc0 ) {GetEArb;reg_ax=(Bit8s)reg_al * (*earbs);}
|
||||
else {GetEAa;reg_ax=((Bit8s)reg_al) * LoadMbs(eaa);}
|
||||
flags.cf=flags.of=!((reg_ax & 0xff80)==0xff80 || (reg_ax & 0xff80)==0x0000);
|
||||
break;
|
||||
}
|
||||
case 0x30: /* DIV Eb */
|
||||
{
|
||||
// flags.type=t_DIV;
|
||||
Bit8u val;
|
||||
if (rm >= 0xc0 ) {GetEArb;val=*earb;}
|
||||
else {GetEAa;val=LoadMb(eaa);}
|
||||
if (val==0) {INTERRUPT(0);break;}
|
||||
Bit16u quotientu=reg_ax / val;
|
||||
reg_ah=(Bit8u)(reg_ax % val);
|
||||
reg_al=quotientu & 0xff;
|
||||
if (quotientu!=reg_al)
|
||||
INTERRUPT(0);
|
||||
break;
|
||||
}
|
||||
case 0x38: /* IDIV Eb */
|
||||
{
|
||||
// flags.type=t_DIV;
|
||||
Bit8s val;
|
||||
if (rm >= 0xc0 ) {GetEArb;val=*earbs;}
|
||||
else {GetEAa;val=LoadMbs(eaa);}
|
||||
if (val==0) {INTERRUPT(0);break;}
|
||||
Bit16s quotients=((Bit16s)reg_ax) / val;
|
||||
reg_ah=(Bit8s)(((Bit16s)reg_ax) % val);
|
||||
reg_al=quotients & 0xff;
|
||||
if (quotients!=(Bit8s)reg_al)
|
||||
INTERRUPT(0);
|
||||
break;
|
||||
}
|
||||
case 0x04: /* MUL AL,Eb */
|
||||
RMEb(MULB);
|
||||
break;
|
||||
case 0x05: /* IMUL AL,Eb */
|
||||
RMEb(IMULB);
|
||||
break;
|
||||
case 0x06: /* DIV Eb */
|
||||
RMEb(DIVB);
|
||||
break;
|
||||
case 0x07: /* IDIV Eb */
|
||||
RMEb(IDIVB);
|
||||
break;
|
||||
}
|
||||
break;}
|
||||
break;
|
||||
}
|
||||
case 0xf7: /* GRP3 Ew(,Iw) */
|
||||
{ GetRM;
|
||||
switch (rm & 0x38) {
|
||||
switch ((rm & 0x38)>>3) {
|
||||
case 0x00: /* TEST Ew,Iw */
|
||||
case 0x08: /* TEST Ew,Iw Undocumented*/
|
||||
case 0x01: /* TEST Ew,Iw Undocumented*/
|
||||
{
|
||||
if (rm >= 0xc0 ) {GetEArw;TESTW(*earw,Fetchw(),LoadRw,SaveRw);}
|
||||
else {GetEAa;TESTW(eaa,Fetchw(),LoadMw,SaveMw);}
|
||||
break;
|
||||
}
|
||||
case 0x10: /* NOT Ew */
|
||||
case 0x02: /* NOT Ew */
|
||||
{
|
||||
if (rm >= 0xc0 ) {GetEArw;*earw=~*earw;}
|
||||
else {GetEAa;SaveMw(eaa,~LoadMw(eaa));}
|
||||
break;
|
||||
}
|
||||
case 0x18: /* NEG Ew */
|
||||
case 0x03: /* NEG Ew */
|
||||
{
|
||||
flags.type=t_NEGw;
|
||||
if (rm >= 0xc0 ) {
|
||||
@ -1159,125 +1065,63 @@ restart:
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 0x20: /* MUL AX,Ew */
|
||||
{
|
||||
flags.type=t_MUL;Bit32u tempu;
|
||||
if (rm >= 0xc0 ) {GetEArw;tempu=reg_ax * (*earw);}
|
||||
else {GetEAa;tempu=reg_ax * LoadMw(eaa);}
|
||||
reg_ax=(Bit16u)(tempu & 0xffff);reg_dx=(Bit16u)(tempu >> 16);
|
||||
flags.cf=flags.of=(reg_dx !=0);
|
||||
break;
|
||||
}
|
||||
case 0x28: /* IMUL AX,Ew */
|
||||
{
|
||||
flags.type=t_MUL;Bit32s temps;
|
||||
if (rm >= 0xc0 ) {GetEArw;temps=((Bit16s)reg_ax) * (*earws);}
|
||||
else {GetEAa;temps=((Bit16s)reg_ax) * LoadMws(eaa);}
|
||||
reg_ax=Bit16u(temps & 0xffff);reg_dx=(Bit16u)(temps >> 16);
|
||||
if ( (reg_dx==0xffff) && (reg_ax & 0x8000) ) {
|
||||
flags.cf=flags.of=false;
|
||||
} else if ( (reg_dx==0x0000) && (reg_ax<0x8000) ) {
|
||||
flags.cf=flags.of=false;
|
||||
} else {
|
||||
flags.cf=flags.of=true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 0x30: /* DIV Ew */
|
||||
{
|
||||
// flags.type=t_DIV;
|
||||
Bit16u val;
|
||||
if (rm >= 0xc0 ) {GetEArw;val=*earw;}
|
||||
else {GetEAa;val=LoadMw(eaa);}
|
||||
if (val==0) {INTERRUPT(0);break;}
|
||||
Bit32u tempu=(reg_dx<<16)|reg_ax;
|
||||
Bit32u quotientu=tempu/val;
|
||||
reg_dx=(Bit16u)(tempu % val);
|
||||
reg_ax=(Bit16u)(quotientu & 0xffff);
|
||||
if (quotientu>0xffff)
|
||||
INTERRUPT(0);
|
||||
break;
|
||||
}
|
||||
case 0x38: /* IDIV Ew */
|
||||
{
|
||||
// flags.type=t_DIV;
|
||||
Bit16s val;
|
||||
if (rm >= 0xc0 ) {GetEArw;val=*earws;}
|
||||
else {GetEAa;val=LoadMws(eaa);}
|
||||
if (val==0) {INTERRUPT(0);break;}
|
||||
Bit32s temps=(reg_dx<<16)|reg_ax;
|
||||
Bit32s quotients=temps/val;
|
||||
reg_dx=(Bit16s)(temps % val);
|
||||
reg_ax=(Bit16s)quotients;
|
||||
if (quotients!=(Bit16s)reg_ax)
|
||||
INTERRUPT(0);
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x04: /* MUL AX,Ew */
|
||||
RMEw(MULW);
|
||||
break;
|
||||
case 0x05: /* IMUL AX,Ew */
|
||||
RMEw(IMULW)
|
||||
break;
|
||||
case 0x06: /* DIV Ew */
|
||||
RMEw(DIVW)
|
||||
break;
|
||||
case 0x07: /* IDIV Ew */
|
||||
RMEw(IDIVW)
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 0xf8: /* CLC */
|
||||
flags.cf=false;
|
||||
SETFLAGBIT(CF,false);
|
||||
if (flags.type!=t_CF) flags.prev_type=flags.type;
|
||||
flags.type=t_CF;
|
||||
break;
|
||||
case 0xf9: /* STC */
|
||||
flags.cf=true;
|
||||
SETFLAGBIT(CF,true);
|
||||
if (flags.type!=t_CF) flags.prev_type=flags.type;
|
||||
flags.type=t_CF;
|
||||
break;
|
||||
case 0xfa: /* CLI */
|
||||
flags.intf=false;
|
||||
SETFLAGBIT(IF,false);
|
||||
break;
|
||||
case 0xfb: /* STI */
|
||||
flags.intf=true;
|
||||
if (flags.intf && PIC_IRQCheck) {
|
||||
SAVEIP;
|
||||
PIC_runIRQs();
|
||||
LOADIP;
|
||||
};
|
||||
SETFLAGBIT(IF,true);
|
||||
#ifdef CPU_PIC_CHECK
|
||||
if (GETFLAG(IF) && PIC_IRQCheck) goto decode_end;
|
||||
#endif
|
||||
break;
|
||||
case 0xfc: /* CLD */
|
||||
flags.df=false;
|
||||
SETFLAGBIT(DF,false);
|
||||
break;
|
||||
case 0xfd: /* STD */
|
||||
flags.df=true;
|
||||
SETFLAGBIT(DF,true);
|
||||
break;
|
||||
case 0xfe: /* GRP4 Eb */
|
||||
{
|
||||
GetRM;
|
||||
switch (rm & 0x38) {
|
||||
case 0x00: /* INC Eb */
|
||||
flags.cf=get_CF();flags.type=t_INCb;
|
||||
if (rm >= 0xc0 ) {GetEArb;flags.result.b=*earb+=1;}
|
||||
else {GetEAa;flags.result.b=LoadMb(eaa)+1;SaveMb(eaa,flags.result.b);}
|
||||
RMEb(INCB);
|
||||
break;
|
||||
case 0x08: /* DEC Eb */
|
||||
flags.cf=get_CF();flags.type=t_DECb;
|
||||
if (rm >= 0xc0 ) {GetEArb;flags.result.b=*earb-=1;}
|
||||
else {GetEAa;flags.result.b=LoadMb(eaa)-1;SaveMb(eaa,flags.result.b);}
|
||||
RMEb(DECB);
|
||||
break;
|
||||
case 0x38: /* CallBack */
|
||||
{
|
||||
Bit32u ret;
|
||||
Bit16u call=Fetchw();
|
||||
SAVEIP;
|
||||
if (call<CB_MAX) {
|
||||
ret=CallBack_Handlers[call]();
|
||||
} else {
|
||||
E_Exit("Too high CallBack Number %d called",call);
|
||||
}
|
||||
switch (ret) {
|
||||
case CBRET_NONE:
|
||||
LOADIP;
|
||||
break;
|
||||
case CBRET_STOP:return ret;
|
||||
default:
|
||||
E_Exit("CPU:Callback %d returned illegal %d code",call,ret);
|
||||
};
|
||||
break;
|
||||
Bitu cb=Fetchw();
|
||||
LEAVECORE;
|
||||
return cb;
|
||||
}
|
||||
|
||||
default:
|
||||
E_Exit("Illegal GRP4 Call %d",(rm>>3) & 7);
|
||||
break;
|
||||
@ -1289,15 +1133,11 @@ restart:
|
||||
GetRM;
|
||||
switch (rm & 0x38) {
|
||||
case 0x00: /* INC Ew */
|
||||
flags.cf=get_CF();flags.type=t_INCw;
|
||||
if (rm >= 0xc0 ) {GetEArw;flags.result.w=*earw+=1;}
|
||||
else {GetEAa;flags.result.w=LoadMw(eaa)+1;SaveMw(eaa,flags.result.w);}
|
||||
RMEw(INCW);
|
||||
break;
|
||||
case 0x08: /* DEC Ew */
|
||||
flags.cf=get_CF();flags.type=t_DECw;
|
||||
if (rm >= 0xc0 ) {GetEArw;flags.result.w=*earw-=1;}
|
||||
else {GetEAa;flags.result.w=LoadMw(eaa)-1;SaveMw(eaa,flags.result.w);}
|
||||
break;
|
||||
RMEw(DECW);
|
||||
break;
|
||||
case 0x10: /* CALL Ev */
|
||||
if (rm >= 0xc0 ) {GetEArw;Push_16(GETIP);SETIP(*earw);}
|
||||
else {GetEAa;Push_16(GETIP);SETIP(LoadMw(eaa));}
|
||||
|
@ -155,11 +155,8 @@ switch(Fetchb()) {
|
||||
SegPrefix_66(gs);break;
|
||||
case 0x67: /* Address Size Prefix */
|
||||
#ifdef CPU_PREFIX_67
|
||||
prefix.mark|=PREFIX_ADDR;
|
||||
#ifdef CPU_PREFIX_COUNT
|
||||
prefix.count++;
|
||||
#endif
|
||||
lookupEATable=EAPrefixTable[prefix.mark];
|
||||
core_16.prefixes^=PREFIX_ADDR;
|
||||
lookupEATable=EAPrefixTable[core_16.prefixes];
|
||||
goto restart_66;
|
||||
#else
|
||||
NOTDONE;
|
||||
@ -167,31 +164,13 @@ switch(Fetchb()) {
|
||||
case 0x68: /* PUSH Id */
|
||||
Push_32(Fetchd());break;
|
||||
case 0x69: /* IMUL Gd,Ed,Id */
|
||||
{
|
||||
GetRMrd;
|
||||
Bit64s res;
|
||||
if (rm >= 0xc0 ) {GetEArd;res=(Bit64s)(*eards) * (Bit64s)Fetchds();}
|
||||
else {GetEAa;res=(Bit64s)LoadMds(eaa) * (Bit64s)Fetchds();}
|
||||
*rmrd=(Bit32s)(res);
|
||||
flags.type=t_MUL;
|
||||
if ((res>-((Bit64s)(2147483647)+1)) && (res<(Bit64s)2147483647)) {flags.cf=false;flags.of=false;}
|
||||
else {flags.cf=true;flags.of=true;}
|
||||
break;
|
||||
}
|
||||
RMGdEdOp3(DIMULD,Fetchds());
|
||||
break;
|
||||
case 0x6a: /* PUSH Ib */
|
||||
Push_32(Fetchbs());break;
|
||||
case 0x6b: /* IMUL Gd,Ed,Ib */
|
||||
{
|
||||
GetRMrd;
|
||||
Bit64s res;
|
||||
if (rm >= 0xc0 ) {GetEArd;res=(Bit64s)(*eards) * (Bit64s)Fetchbs();}
|
||||
else {GetEAa;res=(Bit64s)LoadMds(eaa) * (Bit64s)Fetchbs();}
|
||||
*rmrd=(Bit32s)(res);
|
||||
flags.type=t_MUL;
|
||||
if ((res>-((Bit64s)(2147483647)+1)) && (res<(Bit64s)2147483647)) {flags.cf=false;flags.of=false;}
|
||||
else {flags.cf=true;flags.of=true;}
|
||||
break;
|
||||
}
|
||||
RMGdEdOp3(DIMULD,Fetchbs());
|
||||
break;
|
||||
case 0x81: /* Grpl Ed,Id */
|
||||
{
|
||||
GetRM;
|
||||
@ -276,13 +255,13 @@ switch(Fetchb()) {
|
||||
break;
|
||||
}
|
||||
case 0x8c:
|
||||
LOG(LOG_CPU,"CPU:66:8c looped back");
|
||||
LOG(LOG_CPU,LOG_NORMAL)("CPU:66:8c looped back");
|
||||
break;
|
||||
case 0x8d: /* LEA */
|
||||
{
|
||||
prefix.segbase=0;
|
||||
prefix.mark|=PREFIX_SEG;
|
||||
lookupEATable=EAPrefixTable[prefix.mark];
|
||||
core_16.segbase=0;
|
||||
core_16.prefixes|=PREFIX_SEG;
|
||||
lookupEATable=EAPrefixTable[core_16.prefixes];
|
||||
GetRMrd;GetEAa;
|
||||
*rmrd=(Bit32u)eaa;
|
||||
break;
|
||||
@ -324,35 +303,33 @@ switch(Fetchb()) {
|
||||
else reg_edx=0;
|
||||
break;
|
||||
case 0x9c: /* PUSHFD */
|
||||
{
|
||||
Bit32u pflags=
|
||||
(get_CF() << 0) | (get_PF() << 2) | (get_AF() << 4) |
|
||||
(get_ZF() << 6) | (get_SF() << 7) | (flags.tf << 8) |
|
||||
(flags.intf << 9) |(flags.df << 10) | (get_OF() << 11) |
|
||||
(flags.io << 12) | (flags.nt <<14);
|
||||
Push_32(pflags);
|
||||
break;
|
||||
}
|
||||
FillFlags();
|
||||
Push_32(flags.word);
|
||||
break;
|
||||
case 0x9d: /* POPFD */
|
||||
{
|
||||
Bit16u val=(Bit16u)(Pop_32()&0xffff);
|
||||
Save_Flagsw(val);
|
||||
break;
|
||||
}
|
||||
SETFLAGSd(Pop_32())
|
||||
CheckTF();
|
||||
#ifdef CPU_PIC_CHECK
|
||||
if (GETFLAG(IF) && PIC_IRQCheck) goto decode_end;
|
||||
#endif
|
||||
break;
|
||||
case 0xa1: /* MOV EAX,Ow */
|
||||
{
|
||||
reg_eax=LoadMd(GetEADirect[prefix.mark]());
|
||||
}
|
||||
reg_eax=LoadMd(GetEADirect[core_16.prefixes]());
|
||||
break;
|
||||
case 0xa3: /* MOV Ow,EAX */
|
||||
{
|
||||
SaveMd(GetEADirect[prefix.mark](),reg_eax);
|
||||
}
|
||||
SaveMd(GetEADirect[core_16.prefixes](),reg_eax);
|
||||
break;
|
||||
case 0xa5: /* MOVSD */
|
||||
{
|
||||
stringSI;stringDI;SaveMd(to,LoadMd(from));
|
||||
if (flags.df) { reg_si-=4;reg_di-=4; }
|
||||
if (GETFLAG(DF)) { reg_si-=4;reg_di-=4; }
|
||||
else { reg_si+=4;reg_di+=4;}
|
||||
}
|
||||
break;
|
||||
case 0xa7: /* CMPSD */
|
||||
{
|
||||
stringSI;stringDI; CMPD(to,LoadMd(from),LoadMd,0);
|
||||
if (GETFLAG(DF)) { reg_si-=4;reg_di-=4; }
|
||||
else { reg_si+=4;reg_di+=4;}
|
||||
}
|
||||
break;
|
||||
@ -363,7 +340,7 @@ switch(Fetchb()) {
|
||||
{
|
||||
stringDI;
|
||||
SaveMd(to,reg_eax);
|
||||
if (flags.df) { reg_di-=4; }
|
||||
if (GETFLAG(DF)) { reg_di-=4; }
|
||||
else {reg_di+=4;}
|
||||
break;
|
||||
}
|
||||
@ -371,7 +348,7 @@ switch(Fetchb()) {
|
||||
{
|
||||
stringSI;
|
||||
reg_eax=LoadMd(from);
|
||||
if (flags.df) { reg_si-=4;}
|
||||
if (GETFLAG(DF)) { reg_si-=4;}
|
||||
else {reg_si+=4;}
|
||||
break;
|
||||
}
|
||||
@ -379,7 +356,7 @@ switch(Fetchb()) {
|
||||
{
|
||||
stringDI;
|
||||
CMPD(reg_eax,LoadMd(to),LoadRd,0);
|
||||
if (flags.df) { reg_di-=4; }
|
||||
if (GETFLAG(DF)) { reg_di-=4; }
|
||||
else {reg_di+=4;}
|
||||
break;
|
||||
}
|
||||
@ -424,34 +401,42 @@ switch(Fetchb()) {
|
||||
GRP2D(1);break;
|
||||
case 0xd3: /* GRP2 Ed,CL */
|
||||
GRP2D(reg_cl);break;
|
||||
case 0xed: /* IN EAX,DX */
|
||||
reg_eax=IO_Read(reg_dx) |
|
||||
(IO_Read(reg_dx+1) << 8) |
|
||||
(IO_Read(reg_dx+2) << 16) |
|
||||
(IO_Read(reg_dx+3) << 24);
|
||||
break;
|
||||
case 0xef: /* OUT DX,EAX */
|
||||
IO_Write(reg_dx,(Bit8u)(reg_eax>>0));
|
||||
IO_Write(reg_dx+1,(Bit8u)(reg_eax>>8));
|
||||
IO_Write(reg_dx+2,(Bit8u)(reg_eax>>16));
|
||||
IO_Write(reg_dx+3,(Bit8u)(reg_eax>>24));
|
||||
break;
|
||||
case 0xf2: /* REPNZ */
|
||||
prefix.count++;
|
||||
Repeat_Normal(false,true);
|
||||
continue;
|
||||
case 0xf3: /* REPZ */
|
||||
prefix.count++;
|
||||
Repeat_Normal(true,true);
|
||||
continue;
|
||||
case 0xf7: /* GRP3 Ed(,Id) */
|
||||
{
|
||||
union { Bit64u u;Bit64s s;} temp;
|
||||
union {Bit64u u;Bit64s s;} quotient;
|
||||
GetRM;
|
||||
switch (rm & 0x38) {
|
||||
switch ((rm & 0x38)>>3) {
|
||||
case 0x00: /* TEST Ed,Id */
|
||||
case 0x08: /* TEST Ed,Id Undocumented*/
|
||||
case 0x01: /* TEST Ed,Id Undocumented*/
|
||||
{
|
||||
if (rm >= 0xc0 ) {GetEArd;TESTD(*eard,Fetchd(),LoadRd,SaveRd);}
|
||||
else {GetEAa;TESTD(eaa,Fetchd(),LoadMd,SaveMd);}
|
||||
break;
|
||||
}
|
||||
case 0x10: /* NOT Ed */
|
||||
case 0x02: /* NOT Ed */
|
||||
{
|
||||
if (rm >= 0xc0 ) {GetEArd;*eard=~*eard;}
|
||||
else {GetEAa;SaveMd(eaa,~LoadMd(eaa));}
|
||||
break;
|
||||
}
|
||||
case 0x18: /* NEG Ed */
|
||||
case 0x03: /* NEG Ed */
|
||||
{
|
||||
flags.type=t_NEGd;
|
||||
if (rm >= 0xc0 ) {
|
||||
@ -463,60 +448,18 @@ switch(Fetchb()) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 0x20: /* MUL EAX,Ed */
|
||||
{
|
||||
flags.type=t_MUL;
|
||||
if (rm >= 0xc0 ) {GetEArd;temp.u=(Bit64u)reg_eax * (Bit64u)(*eard);}
|
||||
else {GetEAa;temp.u=(Bit64u)reg_eax * (Bit64u)LoadMd(eaa);}
|
||||
reg_eax=(Bit32u)(temp.u & 0xffffffff);reg_edx=(Bit32u)(temp.u >> 32);
|
||||
flags.cf=flags.of=(reg_edx !=0);
|
||||
break;
|
||||
}
|
||||
case 0x28: /* IMUL EAX,Ed */
|
||||
{
|
||||
flags.type=t_MUL;
|
||||
if (rm >= 0xc0 ) {GetEArd;temp.s=((Bit64s)((Bit32s)reg_eax) * (Bit64s)(*eards));}
|
||||
else {GetEAa;temp.s=((Bit64s)((Bit32s)reg_eax) * (Bit64s)(LoadMds(eaa)));}
|
||||
reg_eax=Bit32u(temp.s & 0xffffffff);reg_edx=(Bit32u)(temp.s >> 32);
|
||||
if ( (reg_edx==0xffffffff) && (reg_eax & 0x80000000) ) {
|
||||
flags.cf=flags.of=false;
|
||||
} else if ( (reg_edx==0x00000000) && (reg_eax<0x80000000) ) {
|
||||
flags.cf=flags.of=false;
|
||||
} else {
|
||||
flags.cf=flags.of=true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 0x30: /* DIV Ed */
|
||||
{
|
||||
// flags.type=t_DIV;
|
||||
Bit32u val;
|
||||
if (rm >= 0xc0 ) {GetEArd;val=*eard;}
|
||||
else {GetEAa;val=LoadMd(eaa);}
|
||||
if (val==0) {INTERRUPT(0);break;}
|
||||
temp.u=(((Bit64u)reg_edx)<<32)|reg_eax;
|
||||
quotient.u=temp.u/val;
|
||||
reg_edx=(Bit32u)(temp.u % val);
|
||||
reg_eax=(Bit32u)(quotient.u & 0xffffffff);
|
||||
if (quotient.u>0xffffffff)
|
||||
INTERRUPT(0);
|
||||
break;
|
||||
}
|
||||
case 0x38: /* IDIV Ed */
|
||||
{
|
||||
// flags.type=t_DIV;
|
||||
Bit32s val;
|
||||
if (rm >= 0xc0 ) {GetEArd;val=*eards;}
|
||||
else {GetEAa;val=LoadMds(eaa);}
|
||||
if (val==0) {INTERRUPT(0);break;}
|
||||
temp.s=(((Bit64u)reg_edx)<<32)|reg_eax;
|
||||
quotient.s=(temp.s/val);
|
||||
reg_edx=(Bit32s)(temp.s % val);
|
||||
reg_eax=(Bit32s)(quotient.s);
|
||||
if (quotient.s!=(Bit32s)reg_eax)
|
||||
INTERRUPT(0);
|
||||
break;
|
||||
}
|
||||
case 0x04: /* MUL EAX,Ed */
|
||||
RMEd(MULD);
|
||||
break;
|
||||
case 0x05: /* IMUL EAX,Ed */
|
||||
RMEd(IMULD);
|
||||
break;
|
||||
case 0x06: /* DIV Ed */
|
||||
RMEd(DIVD);
|
||||
break;
|
||||
case 0x07: /* IDIV Ed */
|
||||
RMEd(IDIVD);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -525,14 +468,10 @@ switch(Fetchb()) {
|
||||
GetRM;
|
||||
switch (rm & 0x38) {
|
||||
case 0x00: /* INC Ed */
|
||||
flags.cf=get_CF();flags.type=t_INCd;
|
||||
if (rm >= 0xc0 ) {GetEArd;flags.result.d=*eard+=1;}
|
||||
else {GetEAa;flags.result.d=LoadMd(eaa)+1;SaveMd(eaa,flags.result.d);}
|
||||
RMEd(INCD);
|
||||
break;
|
||||
case 0x08: /* DEC Ed */
|
||||
flags.cf=get_CF();flags.type=t_DECd;
|
||||
if (rm >= 0xc0 ) {GetEArd;flags.result.d=*eard-=1;}
|
||||
else {GetEAa;flags.result.d=LoadMd(eaa)-1;SaveMd(eaa,flags.result.d);}
|
||||
RMEd(DECD);
|
||||
break;
|
||||
case 0x30: /* Push Ed */
|
||||
if (rm >= 0xc0 ) {GetEArd;Push_32(*eard);}
|
||||
|
@ -17,8 +17,55 @@
|
||||
*/
|
||||
|
||||
switch (Fetchb()) {
|
||||
case 0x01: /* Group 7 Ed */
|
||||
{
|
||||
GetRM;Bitu which=(rm>>3)&7;
|
||||
if (rm < 0xc0) { //First ones all use EA
|
||||
GetEAa;Bitu limit,base;
|
||||
switch (which) {
|
||||
case 0x00: /* SGDT */
|
||||
CPU_SGDT(limit,base);
|
||||
SaveMw(eaa,limit);
|
||||
SaveMd(eaa+2,base);
|
||||
break;
|
||||
case 0x01: /* SIDT */
|
||||
CPU_SIDT(limit,base);
|
||||
SaveMw(eaa,limit);
|
||||
SaveMd(eaa+2,base);
|
||||
break;
|
||||
case 0x02: /* LGDT */
|
||||
CPU_LGDT(LoadMw(eaa),LoadMd(eaa+2));
|
||||
break;
|
||||
case 0x03: /* LIDT */
|
||||
CPU_LIDT(LoadMw(eaa),LoadMd(eaa+2));
|
||||
break;
|
||||
case 0x04: /* SMSW */
|
||||
CPU_SMSW(limit);
|
||||
SaveMw(eaa,limit);
|
||||
break;
|
||||
case 0x06: /* LMSW */
|
||||
limit=LoadMw(eaa);
|
||||
if (!CPU_LMSW(limit)) goto decode_end;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
GetEArw;Bitu limit;
|
||||
switch (which) {
|
||||
case 0x04: /* SMSW */
|
||||
CPU_SMSW(limit);
|
||||
*earw=limit;
|
||||
break;
|
||||
case 0x06: /* LMSW */
|
||||
if (!CPU_LMSW(*earw)) goto decode_end;
|
||||
break;
|
||||
default:
|
||||
LOG(LOG_CPU,LOG_ERROR)("Illegal group 7 RM subfunction %d",which);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0xa4: /* SHLD Ed,Gd,Ib */
|
||||
{
|
||||
GetRMrd;
|
||||
@ -41,26 +88,19 @@ switch (Fetchb()) {
|
||||
break;
|
||||
}
|
||||
|
||||
case 0xb6: /* MOVZX Gd,Eb */
|
||||
case 0xb6: /* MOVZX Gd,Eb */
|
||||
{
|
||||
GetRMrd;
|
||||
if (rm >= 0xc0 ) {GetEArb;*rmrd=*earb;}
|
||||
else {GetEAa;*rmrd=LoadMb(eaa);}
|
||||
break;
|
||||
}
|
||||
case 0xaf: /* IMUL Gd,Ed */
|
||||
case 0xaf: /* IMUL Gd,Ed */
|
||||
{
|
||||
GetRMrd;
|
||||
Bit64s res;
|
||||
if (rm >= 0xc0 ) {GetEArd;res=((Bit64s)((Bit32s)*rmrd) * (Bit64s)((Bit32s)*eards));}
|
||||
else {GetEAa;res=((Bit64s)((Bit32s)*rmrd) * (Bit64s)LoadMds(eaa));}
|
||||
*rmrd=(Bit32s)(res);
|
||||
flags.type=t_MUL;
|
||||
if ((res>-((Bit64s)(2147483647)+1)) && (res<(Bit64s)2147483647)) {flags.cf=false;flags.of=false;}
|
||||
else {flags.cf=true;flags.of=true;}
|
||||
RMGdEdOp3(DIMULD,*rmrd);
|
||||
break;
|
||||
};
|
||||
case 0xb7: /* MOVXZ Gd,Ew */
|
||||
case 0xb7: /* MOVXZ Gd,Ew */
|
||||
{
|
||||
GetRMrd;
|
||||
if (rm >= 0xc0 ) {GetEArw;*rmrd=*earw;}
|
||||
@ -73,7 +113,7 @@ switch (Fetchb()) {
|
||||
if (rm >= 0xc0 ) {
|
||||
GetEArd;
|
||||
Bit32u mask=1 << (Fetchb() & 31);
|
||||
flags.cf=(*eard & mask)>0;
|
||||
SETFLAGBIT(CF,(*eard & mask));
|
||||
switch (rm & 0x38) {
|
||||
case 0x20: /* BT */
|
||||
break;
|
||||
@ -84,7 +124,7 @@ switch (Fetchb()) {
|
||||
*eard&=~mask;
|
||||
break;
|
||||
case 0x38: /* BTC */
|
||||
if (flags.cf) *eard&=~mask;
|
||||
if (GETFLAG(CF)) *eard&=~mask;
|
||||
else *eard|=mask;
|
||||
break;
|
||||
default:
|
||||
@ -93,7 +133,7 @@ switch (Fetchb()) {
|
||||
} else {
|
||||
GetEAa;Bit32u old=LoadMd(eaa);
|
||||
Bit32u mask=1 << (Fetchb() & 31);
|
||||
flags.cf=(old & mask)>0;
|
||||
SETFLAGBIT(CF,(old & mask));
|
||||
switch (rm & 0x38) {
|
||||
case 0x20: /* BT */
|
||||
break;
|
||||
@ -104,7 +144,7 @@ switch (Fetchb()) {
|
||||
SaveMd(eaa,old & ~mask);
|
||||
break;
|
||||
case 0x38: /* BTC */
|
||||
if (flags.cf) old&=~mask;
|
||||
if (GETFLAG(CF)) old&=~mask;
|
||||
else old|=mask;
|
||||
SaveMd(eaa,old);
|
||||
break;
|
||||
@ -122,11 +162,11 @@ switch (Fetchb()) {
|
||||
Bit32u mask=1 << (*rmrd & 31);
|
||||
if (rm >= 0xc0 ) {
|
||||
GetEArd;
|
||||
flags.cf=(*eard & mask)>0;
|
||||
SETFLAGBIT(CF,(*eard & mask));
|
||||
*eard^=mask;
|
||||
} else {
|
||||
GetEAa;Bit32u old=LoadMd(eaa);
|
||||
flags.cf=(old & mask)>0;
|
||||
SETFLAGBIT(CF,(old & mask));
|
||||
SaveMd(eaa,old ^ mask);
|
||||
}
|
||||
if (flags.type!=t_CF) { flags.prev_type=flags.type;flags.type=t_CF; }
|
||||
@ -139,11 +179,11 @@ switch (Fetchb()) {
|
||||
if (rm >= 0xc0) { GetEArd; value=*eard; }
|
||||
else { GetEAa; value=LoadMd(eaa); }
|
||||
if (value==0) {
|
||||
flags.zf = true;
|
||||
SETFLAGBIT(ZF,true);
|
||||
} else {
|
||||
result = 0;
|
||||
while ((value & 0x01)==0) { result++; value>>=1; }
|
||||
flags.zf = false;
|
||||
SETFLAGBIT(ZF,false);
|
||||
*rmrd = result;
|
||||
}
|
||||
flags.type=t_UNKNOWN;
|
||||
@ -156,11 +196,11 @@ switch (Fetchb()) {
|
||||
if (rm >= 0xc0) { GetEArd; value=*eard; }
|
||||
else { GetEAa; value=LoadMd(eaa); }
|
||||
if (value==0) {
|
||||
flags.zf = true;
|
||||
SETFLAGBIT(ZF,true);
|
||||
} else {
|
||||
result = 35; // Operandsize-1
|
||||
while ((value & 0x80000000)==0) { result--; value<<=1; }
|
||||
flags.zf = false;
|
||||
SETFLAGBIT(ZF,false);
|
||||
*rmrd = result;
|
||||
}
|
||||
flags.type=t_UNKNOWN;
|
||||
@ -169,14 +209,14 @@ switch (Fetchb()) {
|
||||
case 0xbe: /* MOVSX Gd,Eb */
|
||||
{
|
||||
GetRMrd;
|
||||
if (rm >= 0xc0 ) {GetEArb;*rmrd=*earbs;}
|
||||
if (rm >= 0xc0 ) {GetEArb;*rmrd=*(Bit8s *)earb;}
|
||||
else {GetEAa;*rmrd=LoadMbs(eaa);}
|
||||
break;
|
||||
}
|
||||
case 0xbf: /* MOVSX Gd,Ew */
|
||||
{
|
||||
GetRMrd;
|
||||
if (rm >= 0xc0 ) {GetEArw;*rmrd=*earws;}
|
||||
if (rm >= 0xc0 ) {GetEArw;*rmrd=*(Bit16s *)earw;}
|
||||
else {GetEAa;*rmrd=LoadMws(eaa);}
|
||||
break;
|
||||
}
|
||||
|
@ -19,94 +19,122 @@
|
||||
switch(Fetchb()) {
|
||||
case 0x00: /* GRP 6 */
|
||||
{
|
||||
INTERRUPT(6);
|
||||
break;
|
||||
GetRM;
|
||||
switch (rm & 0x38) {
|
||||
case 0x00:
|
||||
GetRM;Bitu which=(rm>>3)&7;
|
||||
switch (which) {
|
||||
case 0x00: /* SLDT */
|
||||
case 0x01: /* STR */
|
||||
{
|
||||
Bitu saveval;
|
||||
if (!which) CPU_SLDT(saveval);
|
||||
else CPU_STR(saveval);
|
||||
if (rm>0xc0) {GetEArw;*earw=saveval;}
|
||||
else {GetEAa;SaveMw(eaa,saveval);}
|
||||
}
|
||||
break;
|
||||
case 0x02:case 0x03:case 0x04:case 0x05:
|
||||
{
|
||||
Bitu loadval;
|
||||
if (rm >= 0xc0 ) {GetEArw;loadval=*earw;}
|
||||
else {GetEAa;loadval=LoadMw(eaa);}
|
||||
break;
|
||||
switch (which) {
|
||||
case 0x02:CPU_LLDT(loadval);break;
|
||||
case 0x03:CPU_LTR(loadval);break;
|
||||
case 0x04:CPU_VERR(loadval);break;
|
||||
case 0x05:CPU_VERW(loadval);break;
|
||||
}
|
||||
}
|
||||
default:
|
||||
E_Exit("CPU:GRP6:Illegal call %2X",(rm>>3) &3);
|
||||
LOG(LOG_CPU,LOG_ERROR)("GRP6:Illegal call %2X",which);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x01: /* GRP 7 */
|
||||
case 0x01: /* Group 7 Ew */
|
||||
{
|
||||
GetRM;Bitu which=(rm>>3)&7;
|
||||
if (rm < 0xc0) { //First ones all use EA
|
||||
GetEAa;Bitu limit,base;
|
||||
switch (which) {
|
||||
case 0x00: /* SGDT */
|
||||
CPU_SGDT(limit,base);
|
||||
SaveMw(eaa,limit);
|
||||
SaveMd(eaa+2,base);
|
||||
break;
|
||||
case 0x01: /* SIDT */
|
||||
CPU_SIDT(limit,base);
|
||||
SaveMw(eaa,limit);
|
||||
SaveMd(eaa+2,base);
|
||||
break;
|
||||
case 0x02: /* LGDT */
|
||||
CPU_LGDT(LoadMw(eaa),LoadMd(eaa+2) & 0xFFFFFF);
|
||||
break;
|
||||
case 0x03: /* LIDT */
|
||||
CPU_LIDT(LoadMw(eaa),LoadMd(eaa+2) & 0xFFFFFF);
|
||||
break;
|
||||
case 0x04: /* SMSW */
|
||||
CPU_SMSW(limit);
|
||||
SaveMw(eaa,limit);
|
||||
break;
|
||||
case 0x06: /* LMSW */
|
||||
limit=LoadMw(eaa);
|
||||
if (!CPU_LMSW(limit)) goto decode_end;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
GetEArw;Bitu limit;
|
||||
switch (which) {
|
||||
case 0x04: /* SMSW */
|
||||
CPU_SMSW(limit);
|
||||
*earw=limit;
|
||||
break;
|
||||
case 0x06: /* LMSW */
|
||||
if (!CPU_LMSW(*earw)) goto decode_end;
|
||||
break;
|
||||
default:
|
||||
LOG(LOG_CPU,LOG_ERROR)("Illegal group 7 RM subfunction %d",which);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0x20: /* MOV Rd.CRx */
|
||||
{
|
||||
GetRM;
|
||||
switch (rm & 0x38) {
|
||||
case 0x20: /* SMSW */
|
||||
/* Let's seriously fake this call */
|
||||
if (rm>0xc0) {GetEArw;*earw=0;}
|
||||
else {GetEAa;SaveMw(eaa,0);}
|
||||
break;
|
||||
default:
|
||||
E_Exit("CPU:GRP7:Illegal call %2X",(rm>>3) &3);
|
||||
Bitu which=(rm >> 3) & 7;
|
||||
if (rm >= 0xc0 ) {
|
||||
GetEArd;
|
||||
*eard=CPU_GET_CRX(which);
|
||||
} else {
|
||||
GetEAa;
|
||||
LOG(LOG_CPU,LOG_ERROR)("MOV XXX,CR%d with non-register",which);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0x22: /* MOV CRx,Rd */
|
||||
{
|
||||
GetRM;
|
||||
Bitu which=(rm >> 3) & 7;
|
||||
if (rm >= 0xc0 ) {
|
||||
GetEArd;
|
||||
if (!CPU_SET_CRX(which,*eard)) goto decode_end;
|
||||
} else {
|
||||
GetEAa;
|
||||
LOG(LOG_CPU,LOG_ERROR)("MOV CR%,XXX with non-register",which);
|
||||
}
|
||||
}
|
||||
break;
|
||||
/* 0x02 LAR Gw,Ew (286) */
|
||||
/* 0x03 LSL Gw,Ew (286) */
|
||||
/* 0x05 LOADALL (286 only?) */
|
||||
/* 0x06 CLTS (286) */
|
||||
/* 0x07 LOADALL (386 only?) */
|
||||
/* 0x08 INVD (486) */
|
||||
/* 0x02 WBINVD (486) */
|
||||
/* 0x10 UMOV Eb,Gb (386) */
|
||||
/* 0x11 UMOV Ew,Gw (386) */
|
||||
/* 0x12 UMOV Gb,Eb (386) */
|
||||
/* 0x13 UMOV Gw,Ew (386) */
|
||||
/* 0x20 MOV Rd,CRx (386) */
|
||||
/* 0x21 MOV Rd,DRx (386) */
|
||||
/* 0x22 MOV CRx,Rd (386) */
|
||||
/* 0x23 MOV DRx,Rd (386) */
|
||||
case 0x23: /* MOV DRx,Rd */
|
||||
{
|
||||
GetRM;
|
||||
LOG(LOG_CPU,"CPU:0F:23 does nothing");
|
||||
Bitu which=(rm >> 3) & 7;
|
||||
if (rm >= 0xc0 ) {
|
||||
GetEArd;
|
||||
} else {
|
||||
GetEAa;
|
||||
LOG(LOG_CPU,LOG_ERROR)("MOV DR%,XXX with non-register",which);
|
||||
}
|
||||
}
|
||||
break;
|
||||
/* 0x24 MOV Rd,TRx (386) */
|
||||
/* 0x26 MOV TRx,Rd (386) */
|
||||
/* 0x30 WRMSR (P5) */
|
||||
/* 0x31 RDTSC (P5) */
|
||||
/* 0x32 RDMSR (P5) */
|
||||
/* 0x33 RDPMC (P6) */
|
||||
/* 0x40-4F CMOVcc Gw,Ew (P6) */
|
||||
/* 0x50 PAVEB Rq,Eq (CYRIX MMX) */
|
||||
/* 0x51 PADDSIW Rq,Eq (CYRIX MMX) */
|
||||
/* 0x52 PMAGW Rq,Eq (CYRIX MMX) */
|
||||
/* 0x54 PDISTIB Rq,Eq (CYRIX MMX) */
|
||||
/* 0x55 PSUBSIW Rq,Eq (CYRIX MMX) */
|
||||
/* 0x58 PMVZB Rq,Eq (CYRIX MMX) */
|
||||
/* 0x59 PMULHRW Rq,Eq (CYRIX MMX) */
|
||||
/* 0x5A PMVNZB Rq,Eq (CYRIX MMX) */
|
||||
/* 0x5B PMVLZB Rq,Eq (CYRIX MMX) */
|
||||
/* 0x5C PMVGEZB Rq,Eq (CYRIX MMX) */
|
||||
/* 0x5D PMULHRIW Rq,Eq (CYRIX MMX) */
|
||||
/* 0x5E PMACHRIW Rq,Eq (CYRIX MMX) */
|
||||
/* 0x60 PUNPCKLBW Rq,Eq (MMX) */
|
||||
/* 0x61 PUNPCKLWD Rq,Eq (MMX) */
|
||||
/* 0x62 PUNPCKLDQ Rq,Eq (MMX) */
|
||||
/* 0x63 PACKSSWB Rq,Eq (MMX) */
|
||||
/* 0x64 PCMPGTB Rq,Eq (MMX) */
|
||||
/* 0x65 PCMPGTW Rq,Eq (MMX) */
|
||||
/* 0x66 PCMPGTD Rq,Eq (MMX) */
|
||||
/* 0x67 PACKUSWB Rq,Eq (MMX) */
|
||||
/* 0x68 PUNPCKHBW Rq,Eq (MMX) */
|
||||
/* 0x69 PUNPCKHWD Rq,Eq (MMX) */
|
||||
/* 0x6A PUNPCKHDQ Rq,Eq (MMX) */
|
||||
/* 0x6B PACKSSDW Rq,Eq (MMX) */
|
||||
/* 0x6E MOVD Rq,Ed (MMX) */
|
||||
/* 0x6F MOVQ Rq,Eq (MMX) */
|
||||
/* 0x71 PSLLW/PSRAW/PSRLW Rq,Ib (MMX) */
|
||||
/* 0x72 PSLLD/PSRAD/PSRLD Rq,Ib (MMX) */
|
||||
/* 0x73 PSLLQ/PSRLQ Rq,Ib (MMX) */
|
||||
/* 0x74 PCMPEQB Rq,Eq (MMX) */
|
||||
/* 0x75 PCMPEQW Rq,Eq (MMX) */
|
||||
/* 0x76 PCMPEQD Rq,Eq (MMX) */
|
||||
/* 0x77 EMMS (MMX) */
|
||||
/* 0x7E MOVD Ed,Rq (MMX) */
|
||||
/* 0x7F MOVQ Ed,Rq (MMX) */
|
||||
case 0x80: /* JO */
|
||||
JumpSIw(get_OF());break;
|
||||
case 0x81: /* JNO */
|
||||
@ -177,90 +205,64 @@ switch(Fetchb()) {
|
||||
Push_16(SegValue(fs));break;
|
||||
case 0xa1: /* POP FS */
|
||||
SegSet16(fs,Pop_16());break;
|
||||
/* 0xa2 CPUID */
|
||||
case 0xa2:
|
||||
CPU_CPUID();
|
||||
break;
|
||||
case 0xa3: /* BT Ew,Gw */
|
||||
{
|
||||
GetRMrw;
|
||||
Bit16u mask=1 << (*rmrw & 15);
|
||||
if (rm >= 0xc0 ) {
|
||||
GetEArw;
|
||||
flags.cf=(*earw & mask)>0;
|
||||
SETFLAGBIT(CF,(*earw & mask));
|
||||
} else {
|
||||
GetEAa;Bit16u old=LoadMw(eaa);
|
||||
flags.cf=(old & mask)>0;
|
||||
SETFLAGBIT(CF,(old & mask));
|
||||
}
|
||||
if (flags.type!=t_CF) { flags.prev_type=flags.type;flags.type=t_CF; }
|
||||
break;
|
||||
}
|
||||
case 0xa4: /* SHLD Ew,Gw,Ib */
|
||||
{
|
||||
GetRMrw;
|
||||
if (rm >= 0xc0 ) {GetEArw;DSHLW(*earw,*rmrw,Fetchb(),LoadRw,SaveRw);}
|
||||
else {GetEAa;DSHLW(eaa,*rmrw,Fetchb(),LoadMw,SaveMw);}
|
||||
break;
|
||||
}
|
||||
RMEwGwOp3(DSHLW,Fetchb());
|
||||
break;
|
||||
case 0xa5: /* SHLD Ew,Gw,CL */
|
||||
{
|
||||
GetRMrw;
|
||||
if (rm >= 0xc0 ) {GetEArw;DSHLW(*earw,*rmrw,reg_cl,LoadRw,SaveRw);}
|
||||
else {GetEAa;DSHLW(eaa,*rmrw,reg_cl,LoadMw,SaveMw);}
|
||||
break;
|
||||
}
|
||||
/* 0xa6 XBTS (early 386 only) CMPXCHG (early 486 only) */
|
||||
/* 0xa7 IBTS (early 386 only) CMPXCHG (early 486 only) */
|
||||
RMEwGwOp3(DSHLW,reg_cl);
|
||||
break;
|
||||
case 0xa8: /* PUSH GS */
|
||||
Push_16(SegValue(gs));break;
|
||||
case 0xa9: /* POP GS */
|
||||
SegSet16(gs,Pop_16());break;
|
||||
/* 0xaa RSM */
|
||||
case 0xab: /* BTS Ew,Gw */
|
||||
{
|
||||
GetRMrw;
|
||||
Bit16u mask=1 << (*rmrw & 15);
|
||||
if (rm >= 0xc0 ) {
|
||||
GetEArw;
|
||||
flags.cf=(*earw & mask)>0;
|
||||
SETFLAGBIT(CF,(*earw & mask));
|
||||
*earw|=mask;
|
||||
} else {
|
||||
GetEAa;Bit16u old=LoadMw(eaa);
|
||||
flags.cf=(old & mask)>0;
|
||||
SETFLAGBIT(CF,(old & mask));
|
||||
SaveMw(eaa,old | mask);
|
||||
}
|
||||
if (flags.type!=t_CF) { flags.prev_type=flags.type;flags.type=t_CF; }
|
||||
break;
|
||||
}
|
||||
case 0xac: /* SHRD Ew,Gw,Ib */
|
||||
{
|
||||
GetRMrw;
|
||||
if (rm >= 0xc0 ) {GetEArw;DSHRW(*earw,*rmrw,Fetchb(),LoadRw,SaveRw);}
|
||||
else {GetEAa;DSHRW(eaa,*rmrw,Fetchb(),LoadMw,SaveMw);}
|
||||
break;
|
||||
}
|
||||
RMEwGwOp3(DSHRW,Fetchb());
|
||||
break;
|
||||
case 0xad: /* SHRD Ew,Gw,CL */
|
||||
{
|
||||
GetRMrw;
|
||||
if (rm >= 0xc0 ) {GetEArw;DSHRW(*earw,*rmrw,reg_cl,LoadRw,SaveRw);}
|
||||
else {GetEAa;DSHRW(eaa,*rmrw,reg_cl,LoadMw,SaveMw);}
|
||||
break;
|
||||
}
|
||||
RMEwGwOp3(DSHRW,reg_cl);
|
||||
break;
|
||||
case 0xaf: /* IMUL Gw,Ew */
|
||||
{
|
||||
GetRMrw;
|
||||
Bit32s res;
|
||||
if (rm >= 0xc0 ) {GetEArw;res=(Bit32s)(*rmrw) * (Bit32s)(*earws);}
|
||||
else {GetEAa;res=(Bit32s)(*rmrw) *(Bit32s)LoadMws(eaa);}
|
||||
*rmrw=res & 0xFFFF;
|
||||
flags.type=t_MUL;
|
||||
if ((res> -32768) && (res<32767)) {flags.cf=false;flags.of=false;}
|
||||
else {flags.cf=true;flags.of=true;}
|
||||
break;
|
||||
}
|
||||
/* 0xb0 CMPXCHG Eb,Gb */
|
||||
/* 0xb1 CMPXCHG Ew,Gw */
|
||||
RMGwEwOp3(DIMULW,*rmrw);
|
||||
break;
|
||||
|
||||
case 0xb2: /* LSS */
|
||||
{
|
||||
GetRMrw;GetEAa;
|
||||
*rmrw=LoadMw(eaa);SegSet16(ss,LoadMw(eaa+2));
|
||||
CPU_Cycles++;//Be sure we run another instruction
|
||||
break;
|
||||
}
|
||||
case 0xb3: /* BTR Ew,Gw */
|
||||
@ -269,11 +271,11 @@ switch(Fetchb()) {
|
||||
Bit16u mask=1 << (*rmrw & 15);
|
||||
if (rm >= 0xc0 ) {
|
||||
GetEArw;
|
||||
flags.cf=(*earw & mask)>0;
|
||||
SETFLAGBIT(CF,(*earw & mask));
|
||||
*earw&= ~mask;
|
||||
} else {
|
||||
GetEAa;Bit16u old=LoadMw(eaa);
|
||||
flags.cf=(old & mask)>0;
|
||||
SETFLAGBIT(CF,(old & mask));
|
||||
SaveMw(eaa,old & ~mask);
|
||||
}
|
||||
if (flags.type!=t_CF) { flags.prev_type=flags.type;flags.type=t_CF; }
|
||||
@ -309,10 +311,10 @@ switch(Fetchb()) {
|
||||
case 0xba: /* GRP8 Ew,Ib */
|
||||
{
|
||||
GetRM;
|
||||
Bit16u mask=1 << (Fetchb() & 15);
|
||||
if (rm >= 0xc0 ) {
|
||||
GetEArw;
|
||||
flags.cf=(*earw & mask)>0;
|
||||
Bit16u mask=1 << (Fetchb() & 15);
|
||||
SETFLAGBIT(CF,(*earw & mask));
|
||||
switch (rm & 0x38) {
|
||||
case 0x20: /* BT */
|
||||
break;
|
||||
@ -330,7 +332,8 @@ switch(Fetchb()) {
|
||||
}
|
||||
} else {
|
||||
GetEAa;Bit16u old=LoadMw(eaa);
|
||||
flags.cf=(old & mask)>0;
|
||||
Bit16u mask=1 << (Fetchb() & 15);
|
||||
SETFLAGBIT(CF,(old & mask));
|
||||
switch (rm & 0x38) {
|
||||
case 0x20: /* BT */
|
||||
break;
|
||||
@ -356,11 +359,11 @@ switch(Fetchb()) {
|
||||
Bit16u mask=1 << (*rmrw & 15);
|
||||
if (rm >= 0xc0 ) {
|
||||
GetEArw;
|
||||
flags.cf=(*earw & mask)>0;
|
||||
SETFLAGBIT(CF,(*earw & mask));
|
||||
*earw^=mask;
|
||||
} else {
|
||||
GetEAa;Bit16u old=LoadMw(eaa);
|
||||
flags.cf=(old & mask)>0;
|
||||
SETFLAGBIT(CF,(old & mask));
|
||||
SaveMw(eaa,old ^ mask);
|
||||
}
|
||||
if (flags.type!=t_CF) { flags.prev_type=flags.type;flags.type=t_CF; }
|
||||
@ -373,11 +376,11 @@ switch(Fetchb()) {
|
||||
if (rm >= 0xc0) { GetEArw; value=*earw; }
|
||||
else { GetEAa; value=LoadMw(eaa); }
|
||||
if (value==0) {
|
||||
flags.zf = true;
|
||||
SETFLAGBIT(ZF,true);
|
||||
} else {
|
||||
result = 0;
|
||||
while ((value & 0x01)==0) { result++; value>>=1; }
|
||||
flags.zf = false;
|
||||
SETFLAGBIT(ZF,false);
|
||||
*rmrw = result;
|
||||
}
|
||||
flags.type=t_UNKNOWN;
|
||||
@ -390,11 +393,11 @@ switch(Fetchb()) {
|
||||
if (rm >= 0xc0) { GetEArw; value=*earw; }
|
||||
else { GetEAa; value=LoadMw(eaa); }
|
||||
if (value==0) {
|
||||
flags.zf = true;
|
||||
SETFLAGBIT(ZF,true);
|
||||
} else {
|
||||
result = 15; // Operandsize-1
|
||||
while ((value & 0x8000)==0) { result--; value<<=1; }
|
||||
flags.zf = false;
|
||||
SETFLAGBIT(ZF,false);
|
||||
*rmrw = result;
|
||||
}
|
||||
flags.type=t_UNKNOWN;
|
||||
@ -403,14 +406,10 @@ switch(Fetchb()) {
|
||||
case 0xbe: /* MOVSX Gw,Eb */
|
||||
{
|
||||
GetRMrw;
|
||||
if (rm >= 0xc0 ) {GetEArb;*rmrw=*earbs;}
|
||||
if (rm >= 0xc0 ) {GetEArb;*rmrw=*(Bit8s *)earb;}
|
||||
else {GetEAa;*rmrw=LoadMbs(eaa);}
|
||||
break;
|
||||
}
|
||||
/* 0xc0 XADD Eb,Gb (486) */
|
||||
/* 0xc1 XADD Ew,Gw (486) */
|
||||
/* 0xc7 CMPXCHG8B Mq (P5) */
|
||||
/* 0xc8-cf BSWAP Rw (odd behavior,486) */
|
||||
case 0xc8: BSWAP(reg_eax); break;
|
||||
case 0xc9: BSWAP(reg_ecx); break;
|
||||
case 0xca: BSWAP(reg_edx); break;
|
||||
@ -420,35 +419,6 @@ switch(Fetchb()) {
|
||||
case 0xce: BSWAP(reg_esi); break;
|
||||
case 0xcf: BSWAP(reg_edi); break;
|
||||
|
||||
/* 0xd1 PSRLW Rq,Eq (MMX) */
|
||||
/* 0xd2 PSRLD Rq,Eq (MMX) */
|
||||
/* 0xd3 PSRLQ Rq,Eq (MMX) */
|
||||
/* 0xd5 PMULLW Rq,Eq (MMX) */
|
||||
/* 0xd8 PSUBUSB Rq,Eq (MMX) */
|
||||
/* 0xd9 PSUBUSW Rq,Eq (MMX) */
|
||||
/* 0xdb PAND Rq,Eq (MMX) */
|
||||
/* 0xdc PADDUSB Rq,Eq (MMX) */
|
||||
/* 0xdd PADDUSW Rq,Eq (MMX) */
|
||||
/* 0xdf PANDN Rq,Eq (MMX) */
|
||||
/* 0xe1 PSRAW Rq,Eq (MMX) */
|
||||
/* 0xe2 PSRAD Rq,Eq (MMX) */
|
||||
/* 0xe5 PMULHW Rq,Eq (MMX) */
|
||||
/* 0xe8 PSUBSB Rq,Eq (MMX) */
|
||||
/* 0xe9 PSUBSW Rq,Eq (MMX) */
|
||||
/* 0xeb POR Rq,Eq (MMX) */
|
||||
/* 0xec PADDSB Rq,Eq (MMX) */
|
||||
/* 0xed PADDSW Rq,Eq (MMX) */
|
||||
/* 0xef PXOR Rq,Eq (MMX) */
|
||||
/* 0xf1 PSLLW Rq,Eq (MMX) */
|
||||
/* 0xf2 PSLLD Rq,Eq (MMX) */
|
||||
/* 0xf3 PSLLQ Rq,Eq (MMX) */
|
||||
/* 0xf5 PMADDWD Rq,Eq (MMX) */
|
||||
/* 0xf8 PSUBB Rq,Eq (MMX) */
|
||||
/* 0xf9 PSUBW Rq,Eq (MMX) */
|
||||
/* 0xfa PSUBD Rq,Eq (MMX) */
|
||||
/* 0xfc PADDB Rq,Eq (MMX) */
|
||||
/* 0xfd PADDW Rq,Eq (MMX) */
|
||||
/* 0xfe PADDD Rq,Eq (MMX) */
|
||||
default:
|
||||
SUBIP(1);
|
||||
E_Exit("CPU:Opcode 0F:%2X Unhandled",Fetchb());
|
||||
|
@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2002 The DOSBox Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* Setup the CS:IP and SS:SP Pointers */
|
||||
LOADIP;
|
@ -16,36 +16,60 @@
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
EAPoint IPPoint;
|
||||
|
||||
#define SUBIP(a) IPPoint-=a
|
||||
#define SETIP(a) IPPoint=SegBase(cs)+a
|
||||
#define GETIP (Bit16u)(IPPoint-SegBase(cs))
|
||||
#define SUBIP(a) core_16.ip_lookup-=a
|
||||
#define SETIP(a) core_16.ip_lookup=SegBase(cs)+a
|
||||
#define GETIP (Bit16u)(core_16.ip_lookup-SegBase(cs))
|
||||
#define SAVEIP reg_ip=GETIP
|
||||
#define LOADIP IPPoint=SegBase(cs)+reg_ip
|
||||
#define LOADIP core_16.ip_lookup=SegBase(cs)+reg_ip
|
||||
|
||||
#define LEAVECORE \
|
||||
SAVEIP; \
|
||||
FillFlags();
|
||||
|
||||
static INLINE void ADDIP(Bit16u add) {
|
||||
IPPoint=SegBase(cs)+((Bit16u)(((Bit16u)(IPPoint-SegBase(cs)))+(Bit16u)add));
|
||||
core_16.ip_lookup=SegBase(cs)+((Bit16u)(((Bit16u)(core_16.ip_lookup-SegBase(cs)))+(Bit16u)add));
|
||||
}
|
||||
|
||||
static INLINE void ADDIPFAST(Bit16s blah) {
|
||||
IPPoint+=blah;
|
||||
core_16.ip_lookup+=blah;
|
||||
}
|
||||
|
||||
#define CheckTF() \
|
||||
if (GETFLAG(TF)) { \
|
||||
cpudecoder=CPU_Real_16_Slow_Decode_Trap; \
|
||||
goto decode_end; \
|
||||
}
|
||||
|
||||
|
||||
#define EXCEPTION(blah) \
|
||||
{ \
|
||||
Bit8u new_num=blah; \
|
||||
core_16.ip_lookup=core_16.ip_start; \
|
||||
LEAVECORE; \
|
||||
if (Interrupt(new_num)) { \
|
||||
if (GETFLAG(TF)) { \
|
||||
cpudecoder=CPU_Real_16_Slow_Decode_Trap; \
|
||||
return CBRET_NONE; \
|
||||
} \
|
||||
goto decode_start; \
|
||||
} else return CBRET_NONE; \
|
||||
}
|
||||
|
||||
static INLINE Bit8u Fetchb() {
|
||||
Bit8u temp=LoadMb(IPPoint);
|
||||
IPPoint+=1;
|
||||
Bit8u temp=LoadMb(core_16.ip_lookup);
|
||||
core_16.ip_lookup+=1;
|
||||
return temp;
|
||||
}
|
||||
|
||||
static INLINE Bit16u Fetchw() {
|
||||
Bit16u temp=LoadMw(IPPoint);
|
||||
IPPoint+=2;
|
||||
Bit16u temp=LoadMw(core_16.ip_lookup);
|
||||
core_16.ip_lookup+=2;
|
||||
return temp;
|
||||
}
|
||||
static INLINE Bit32u Fetchd() {
|
||||
Bit32u temp=LoadMd(IPPoint);
|
||||
IPPoint+=4;
|
||||
Bit32u temp=LoadMd(core_16.ip_lookup);
|
||||
core_16.ip_lookup+=4;
|
||||
return temp;
|
||||
}
|
||||
|
||||
@ -82,15 +106,42 @@ static INLINE Bit32u Pop_32() {
|
||||
return temp;
|
||||
};
|
||||
|
||||
#define JumpSIb(blah) \
|
||||
if (blah) { \
|
||||
ADDIPFAST(Fetchbs()); \
|
||||
} else { \
|
||||
ADDIPFAST(1); \
|
||||
}
|
||||
|
||||
#define JumpSIw(blah) \
|
||||
if (blah) { \
|
||||
ADDIPFAST(Fetchws()); \
|
||||
} else { \
|
||||
ADDIPFAST(2); \
|
||||
}
|
||||
|
||||
#define SETcc(cc) \
|
||||
{ \
|
||||
GetRM; \
|
||||
if (rm >= 0xc0 ) {GetEArb;*earb=(cc) ? 1 : 0;} \
|
||||
else {GetEAa;SaveMb(eaa,(cc) ? 1 : 0);} \
|
||||
}
|
||||
|
||||
#define NOTDONE \
|
||||
SUBIP(1);E_Exit("CPU:Opcode %2X Unhandled",Fetchb());
|
||||
|
||||
#define NOTDONE66 \
|
||||
SUBIP(1);E_Exit("CPU:Opcode 66:%2X Unhandled",Fetchb());
|
||||
|
||||
|
||||
#define stringDI \
|
||||
EAPoint to; \
|
||||
PhysPt to; \
|
||||
to=SegBase(es)+reg_di
|
||||
|
||||
#define stringSI \
|
||||
EAPoint from; \
|
||||
if (prefix.mark & PREFIX_SEG) { \
|
||||
from=(prefix.segbase+reg_si); \
|
||||
PrefixReset; \
|
||||
PhysPt from; \
|
||||
if (core_16.prefixes & PREFIX_SEG) { \
|
||||
from=(core_16.segbase+reg_si); \
|
||||
} else { \
|
||||
from=SegBase(ds)+reg_si; \
|
||||
}
|
||||
@ -99,60 +150,47 @@ static INLINE Bit32u Pop_32() {
|
||||
#include "table_ea.h"
|
||||
#include "../modrm.h"
|
||||
|
||||
|
||||
static Bit8s table_df_8[2]={1,-1};
|
||||
static Bit16s table_df_16[2]={2,-2};
|
||||
static Bit32s table_df_32[2]={4,-4};
|
||||
|
||||
|
||||
static void Repeat_Normal(bool testz,bool prefix_66) {
|
||||
|
||||
PhysPt base_si,base_di;
|
||||
|
||||
Bit16s direct;
|
||||
if (flags.df) direct=-1;
|
||||
if (GETFLAG(DF)) direct=-1;
|
||||
else direct=1;
|
||||
base_di=SegBase(es);
|
||||
if (prefix.mark & PREFIX_ADDR) E_Exit("Unhandled 0x67 prefixed string op");
|
||||
if (core_16.prefixes & PREFIX_ADDR) E_Exit("Unhandled 0x67 prefixed string op");
|
||||
rep_again:
|
||||
if (prefix.mark & PREFIX_SEG) {
|
||||
base_si=(prefix.segbase);
|
||||
if (core_16.prefixes & PREFIX_SEG) {
|
||||
base_si=(core_16.segbase);
|
||||
} else {
|
||||
base_si=SegBase(ds);
|
||||
}
|
||||
switch (Fetchb()) {
|
||||
case 0x26: /* ES Prefix */
|
||||
prefix.segbase=SegBase(es);
|
||||
prefix.mark|=PREFIX_SEG;
|
||||
prefix.count++;
|
||||
core_16.segbase=SegBase(es);
|
||||
core_16.prefixes|=PREFIX_SEG;
|
||||
goto rep_again;
|
||||
case 0x2e: /* CS Prefix */
|
||||
prefix.segbase=SegBase(cs);
|
||||
prefix.mark|=PREFIX_SEG;
|
||||
prefix.count++;
|
||||
core_16.segbase=SegBase(cs);
|
||||
core_16.prefixes|=PREFIX_SEG;
|
||||
goto rep_again;
|
||||
case 0x36: /* SS Prefix */
|
||||
prefix.segbase=SegBase(ss);
|
||||
prefix.mark|=PREFIX_SEG;
|
||||
prefix.count++;
|
||||
core_16.segbase=SegBase(ss);
|
||||
core_16.prefixes|=PREFIX_SEG;
|
||||
goto rep_again;
|
||||
case 0x3e: /* DS Prefix */
|
||||
prefix.segbase=SegBase(ds);
|
||||
prefix.mark|=PREFIX_SEG;
|
||||
prefix.count++;
|
||||
core_16.segbase=SegBase(ds);
|
||||
core_16.prefixes|=PREFIX_SEG;
|
||||
goto rep_again;
|
||||
case 0x64: /* FS Prefix */
|
||||
prefix.segbase=SegBase(fs);
|
||||
prefix.mark|=PREFIX_SEG;
|
||||
prefix.count++;
|
||||
core_16.segbase=SegBase(fs);
|
||||
core_16.prefixes|=PREFIX_SEG;
|
||||
goto rep_again;
|
||||
case 0x65: /* GS Prefix */
|
||||
prefix.segbase=SegBase(gs);
|
||||
prefix.mark|=PREFIX_SEG;
|
||||
prefix.count++;
|
||||
core_16.segbase=SegBase(gs);
|
||||
core_16.prefixes|=PREFIX_SEG;
|
||||
goto rep_again;
|
||||
case 0x66: /* Size Prefix */
|
||||
prefix.count++;
|
||||
prefix_66=!prefix_66;
|
||||
goto rep_again;
|
||||
case 0x6c: /* REP INSB */
|
||||
@ -352,58 +390,12 @@ rep_again:
|
||||
}
|
||||
break;
|
||||
default:
|
||||
IPPoint--;
|
||||
LOG(LOG_CPU|LOG_ERROR,"Unhandled REP Prefix %X",Fetchb());
|
||||
core_16.ip_lookup--;
|
||||
LOG(LOG_CPU,LOG_ERROR)("Unhandled REP Prefix %X",Fetchb());
|
||||
goto normalexit;
|
||||
}
|
||||
/* If we end up here it's because the CPU_Cycles counter is 0, so restart instruction */
|
||||
IPPoint-=(prefix.count+2); /* Rep instruction and whatever string instruction */
|
||||
normalexit:
|
||||
PrefixReset;
|
||||
core_16.ip_lookup=core_16.ip_start;
|
||||
normalexit:;
|
||||
}
|
||||
|
||||
//flags.io and nt shouldn't be compiled for 386
|
||||
#ifdef CPU_386
|
||||
#define Save_Flagsw(FLAGW) \
|
||||
{ \
|
||||
flags.type=t_UNKNOWN; \
|
||||
flags.cf =(FLAGW & 0x001)>0;flags.pf =(FLAGW & 0x004)>0; \
|
||||
flags.af =(FLAGW & 0x010)>0;flags.zf =(FLAGW & 0x040)>0; \
|
||||
flags.sf =(FLAGW & 0x080)>0;flags.tf =(FLAGW & 0x100)>0; \
|
||||
flags.intf =(FLAGW & 0x200)>0; \
|
||||
flags.df =(FLAGW & 0x400)>0;flags.of =(FLAGW & 0x800)>0; \
|
||||
flags.io =(FLAGW >> 12) & 0x03; \
|
||||
flags.nt =(FLAGW & 0x4000)>0; \
|
||||
if (flags.intf && PIC_IRQCheck) { \
|
||||
SAVEIP; \
|
||||
PIC_runIRQs(); \
|
||||
LOADIP; \
|
||||
} \
|
||||
if (flags.tf) { \
|
||||
cpudecoder=&CPU_Real_16_Slow_Decode_Trap; \
|
||||
goto decode_end; \
|
||||
} \
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define Save_Flagsw(FLAGW) \
|
||||
{ \
|
||||
flags.type=t_UNKNOWN; \
|
||||
flags.cf =(FLAGW & 0x001)>0;flags.pf =(FLAGW & 0x004)>0; \
|
||||
flags.af =(FLAGW & 0x010)>0;flags.zf =(FLAGW & 0x040)>0; \
|
||||
flags.sf =(FLAGW & 0x080)>0;flags.tf =(FLAGW & 0x100)>0; \
|
||||
flags.intf =(FLAGW & 0x200)>0; \
|
||||
flags.df =(FLAGW & 0x400)>0;flags.of =(FLAGW & 0x800)>0; \
|
||||
if (flags.intf && PIC_IRQCheck) { \
|
||||
SAVEIP; \
|
||||
PIC_runIRQs(); \
|
||||
LOADIP; \
|
||||
} \
|
||||
if (flags.tf) { \
|
||||
cpudecoder=&CPU_Real_16_Slow_Decode_Trap; \
|
||||
goto decode_end; \
|
||||
} \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -18,8 +18,8 @@
|
||||
|
||||
/* Some variables for EA Loolkup */
|
||||
|
||||
typedef EAPoint (*GetEATable[256])(void);
|
||||
typedef EAPoint (*EA_LookupHandler)(void);
|
||||
typedef PhysPt (*GetEATable[256])(void);
|
||||
typedef PhysPt (*EA_LookupHandler)(void);
|
||||
|
||||
static GetEATable * lookupEATable;
|
||||
|
||||
@ -28,64 +28,51 @@ static GetEATable * lookupEATable;
|
||||
#define PREFIX_ADDR 0x2
|
||||
#define PREFIX_SEG_ADDR 0x3
|
||||
|
||||
static struct {
|
||||
Bitu mark;
|
||||
Bitu count;
|
||||
EAPoint segbase;
|
||||
} prefix;
|
||||
|
||||
/* Gets initialized at the bottem, can't seem to declare forward references */
|
||||
static GetEATable * EAPrefixTable[4];
|
||||
|
||||
|
||||
#define SegPrefix(blah) \
|
||||
prefix.segbase=SegBase(blah); \
|
||||
prefix.mark|=PREFIX_SEG; \
|
||||
prefix.count++; \
|
||||
lookupEATable=EAPrefixTable[prefix.mark]; \
|
||||
core_16.segbase=SegBase(blah); \
|
||||
core_16.prefixes|=PREFIX_SEG; \
|
||||
lookupEATable=EAPrefixTable[core_16.prefixes]; \
|
||||
goto restart;
|
||||
|
||||
#define SegPrefix_66(blah) \
|
||||
prefix.segbase=SegBase(blah); \
|
||||
prefix.mark|=PREFIX_SEG; \
|
||||
prefix.count++; \
|
||||
lookupEATable=EAPrefixTable[prefix.mark]; \
|
||||
core_16.segbase=SegBase(blah); \
|
||||
core_16.prefixes|=PREFIX_SEG; \
|
||||
lookupEATable=EAPrefixTable[core_16.prefixes]; \
|
||||
goto restart_66;
|
||||
|
||||
|
||||
#define PrefixReset \
|
||||
prefix.mark=PREFIX_NONE; \
|
||||
prefix.count=0; \
|
||||
lookupEATable=EAPrefixTable[PREFIX_NONE];
|
||||
|
||||
|
||||
/* The MOD/RM Decoder for EA for this decoder's addressing modes */
|
||||
static EAPoint EA_16_00_n(void) { return SegBase(ds)+(Bit16u)(reg_bx+(Bit16s)reg_si); }
|
||||
static EAPoint EA_16_01_n(void) { return SegBase(ds)+(Bit16u)(reg_bx+(Bit16s)reg_di); }
|
||||
static EAPoint EA_16_02_n(void) { return SegBase(ss)+(Bit16u)(reg_bp+(Bit16s)reg_si); }
|
||||
static EAPoint EA_16_03_n(void) { return SegBase(ss)+(Bit16u)(reg_bp+(Bit16s)reg_di); }
|
||||
static EAPoint EA_16_04_n(void) { return SegBase(ds)+(Bit16u)(reg_si); }
|
||||
static EAPoint EA_16_05_n(void) { return SegBase(ds)+(Bit16u)(reg_di); }
|
||||
static EAPoint EA_16_06_n(void) { return SegBase(ds)+(Bit16u)(Fetchw());}
|
||||
static EAPoint EA_16_07_n(void) { return SegBase(ds)+(Bit16u)(reg_bx); }
|
||||
static PhysPt EA_16_00_n(void) { return SegBase(ds)+(Bit16u)(reg_bx+(Bit16s)reg_si); }
|
||||
static PhysPt EA_16_01_n(void) { return SegBase(ds)+(Bit16u)(reg_bx+(Bit16s)reg_di); }
|
||||
static PhysPt EA_16_02_n(void) { return SegBase(ss)+(Bit16u)(reg_bp+(Bit16s)reg_si); }
|
||||
static PhysPt EA_16_03_n(void) { return SegBase(ss)+(Bit16u)(reg_bp+(Bit16s)reg_di); }
|
||||
static PhysPt EA_16_04_n(void) { return SegBase(ds)+(Bit16u)(reg_si); }
|
||||
static PhysPt EA_16_05_n(void) { return SegBase(ds)+(Bit16u)(reg_di); }
|
||||
static PhysPt EA_16_06_n(void) { return SegBase(ds)+(Bit16u)(Fetchw());}
|
||||
static PhysPt EA_16_07_n(void) { return SegBase(ds)+(Bit16u)(reg_bx); }
|
||||
|
||||
static EAPoint EA_16_40_n(void) { return SegBase(ds)+(Bit16u)(reg_bx+(Bit16s)reg_si+Fetchbs()); }
|
||||
static EAPoint EA_16_41_n(void) { return SegBase(ds)+(Bit16u)(reg_bx+(Bit16s)reg_di+Fetchbs()); }
|
||||
static EAPoint EA_16_42_n(void) { return SegBase(ss)+(Bit16u)(reg_bp+(Bit16s)reg_si+Fetchbs()); }
|
||||
static EAPoint EA_16_43_n(void) { return SegBase(ss)+(Bit16u)(reg_bp+(Bit16s)reg_di+Fetchbs()); }
|
||||
static EAPoint EA_16_44_n(void) { return SegBase(ds)+(Bit16u)(reg_si+Fetchbs()); }
|
||||
static EAPoint EA_16_45_n(void) { return SegBase(ds)+(Bit16u)(reg_di+Fetchbs()); }
|
||||
static EAPoint EA_16_46_n(void) { return SegBase(ss)+(Bit16u)(reg_bp+Fetchbs()); }
|
||||
static EAPoint EA_16_47_n(void) { return SegBase(ds)+(Bit16u)(reg_bx+Fetchbs()); }
|
||||
static PhysPt EA_16_40_n(void) { return SegBase(ds)+(Bit16u)(reg_bx+(Bit16s)reg_si+Fetchbs()); }
|
||||
static PhysPt EA_16_41_n(void) { return SegBase(ds)+(Bit16u)(reg_bx+(Bit16s)reg_di+Fetchbs()); }
|
||||
static PhysPt EA_16_42_n(void) { return SegBase(ss)+(Bit16u)(reg_bp+(Bit16s)reg_si+Fetchbs()); }
|
||||
static PhysPt EA_16_43_n(void) { return SegBase(ss)+(Bit16u)(reg_bp+(Bit16s)reg_di+Fetchbs()); }
|
||||
static PhysPt EA_16_44_n(void) { return SegBase(ds)+(Bit16u)(reg_si+Fetchbs()); }
|
||||
static PhysPt EA_16_45_n(void) { return SegBase(ds)+(Bit16u)(reg_di+Fetchbs()); }
|
||||
static PhysPt EA_16_46_n(void) { return SegBase(ss)+(Bit16u)(reg_bp+Fetchbs()); }
|
||||
static PhysPt EA_16_47_n(void) { return SegBase(ds)+(Bit16u)(reg_bx+Fetchbs()); }
|
||||
|
||||
static EAPoint EA_16_80_n(void) { return SegBase(ds)+(Bit16u)(reg_bx+(Bit16s)reg_si+Fetchws()); }
|
||||
static EAPoint EA_16_81_n(void) { return SegBase(ds)+(Bit16u)(reg_bx+(Bit16s)reg_di+Fetchws()); }
|
||||
static EAPoint EA_16_82_n(void) { return SegBase(ss)+(Bit16u)(reg_bp+(Bit16s)reg_si+Fetchws()); }
|
||||
static EAPoint EA_16_83_n(void) { return SegBase(ss)+(Bit16u)(reg_bp+(Bit16s)reg_di+Fetchws()); }
|
||||
static EAPoint EA_16_84_n(void) { return SegBase(ds)+(Bit16u)(reg_si+Fetchws()); }
|
||||
static EAPoint EA_16_85_n(void) { return SegBase(ds)+(Bit16u)(reg_di+Fetchws()); }
|
||||
static EAPoint EA_16_86_n(void) { return SegBase(ss)+(Bit16u)(reg_bp+Fetchws()); }
|
||||
static EAPoint EA_16_87_n(void) { return SegBase(ds)+(Bit16u)(reg_bx+Fetchws()); }
|
||||
static PhysPt EA_16_80_n(void) { return SegBase(ds)+(Bit16u)(reg_bx+(Bit16s)reg_si+Fetchws()); }
|
||||
static PhysPt EA_16_81_n(void) { return SegBase(ds)+(Bit16u)(reg_bx+(Bit16s)reg_di+Fetchws()); }
|
||||
static PhysPt EA_16_82_n(void) { return SegBase(ss)+(Bit16u)(reg_bp+(Bit16s)reg_si+Fetchws()); }
|
||||
static PhysPt EA_16_83_n(void) { return SegBase(ss)+(Bit16u)(reg_bp+(Bit16s)reg_di+Fetchws()); }
|
||||
static PhysPt EA_16_84_n(void) { return SegBase(ds)+(Bit16u)(reg_si+Fetchws()); }
|
||||
static PhysPt EA_16_85_n(void) { return SegBase(ds)+(Bit16u)(reg_di+Fetchws()); }
|
||||
static PhysPt EA_16_86_n(void) { return SegBase(ss)+(Bit16u)(reg_bp+Fetchws()); }
|
||||
static PhysPt EA_16_87_n(void) { return SegBase(ds)+(Bit16u)(reg_bx+Fetchws()); }
|
||||
|
||||
static GetEATable GetEA_16_n={
|
||||
/* 00 */
|
||||
@ -123,34 +110,33 @@ static GetEATable GetEA_16_n={
|
||||
};
|
||||
|
||||
|
||||
#define segprefixed(val) EAPoint ret=prefix.segbase+val;PrefixReset;return ret;
|
||||
|
||||
static EAPoint EA_16_00_s(void) { segprefixed((Bit16u)(reg_bx+(Bit16s)reg_si)) }
|
||||
static EAPoint EA_16_01_s(void) { segprefixed((Bit16u)(reg_bx+(Bit16s)reg_di)) }
|
||||
static EAPoint EA_16_02_s(void) { segprefixed((Bit16u)(reg_bp+(Bit16s)reg_si)) }
|
||||
static EAPoint EA_16_03_s(void) { segprefixed((Bit16u)(reg_bp+(Bit16s)reg_di)) }
|
||||
static EAPoint EA_16_04_s(void) { segprefixed((Bit16u)(reg_si)) }
|
||||
static EAPoint EA_16_05_s(void) { segprefixed((Bit16u)(reg_di)) }
|
||||
static EAPoint EA_16_06_s(void) { segprefixed((Bit16u)(Fetchw())) }
|
||||
static EAPoint EA_16_07_s(void) { segprefixed((Bit16u)(reg_bx)) }
|
||||
static PhysPt EA_16_00_s(void) { return core_16.segbase+(Bit16u)(reg_bx+(Bit16s)reg_si); }
|
||||
static PhysPt EA_16_01_s(void) { return core_16.segbase+(Bit16u)(reg_bx+(Bit16s)reg_di); }
|
||||
static PhysPt EA_16_02_s(void) { return core_16.segbase+(Bit16u)(reg_bp+(Bit16s)reg_si); }
|
||||
static PhysPt EA_16_03_s(void) { return core_16.segbase+(Bit16u)(reg_bp+(Bit16s)reg_di); }
|
||||
static PhysPt EA_16_04_s(void) { return core_16.segbase+(Bit16u)(reg_si); }
|
||||
static PhysPt EA_16_05_s(void) { return core_16.segbase+(Bit16u)(reg_di); }
|
||||
static PhysPt EA_16_06_s(void) { return core_16.segbase+(Bit16u)(Fetchw()); }
|
||||
static PhysPt EA_16_07_s(void) { return core_16.segbase+(Bit16u)(reg_bx); }
|
||||
|
||||
static EAPoint EA_16_40_s(void) { segprefixed((Bit16u)(reg_bx+(Bit16s)reg_si+Fetchbs())) }
|
||||
static EAPoint EA_16_41_s(void) { segprefixed((Bit16u)(reg_bx+(Bit16s)reg_di+Fetchbs())) }
|
||||
static EAPoint EA_16_42_s(void) { segprefixed((Bit16u)(reg_bp+(Bit16s)reg_si+Fetchbs())) }
|
||||
static EAPoint EA_16_43_s(void) { segprefixed((Bit16u)(reg_bp+(Bit16s)reg_di+Fetchbs())) }
|
||||
static EAPoint EA_16_44_s(void) { segprefixed((Bit16u)(reg_si+Fetchbs())) }
|
||||
static EAPoint EA_16_45_s(void) { segprefixed((Bit16u)(reg_di+Fetchbs())) }
|
||||
static EAPoint EA_16_46_s(void) { segprefixed((Bit16u)(reg_bp+Fetchbs())) }
|
||||
static EAPoint EA_16_47_s(void) { segprefixed((Bit16u)(reg_bx+Fetchbs())) }
|
||||
static PhysPt EA_16_40_s(void) { return core_16.segbase+(Bit16u)(reg_bx+(Bit16s)reg_si+Fetchbs()); }
|
||||
static PhysPt EA_16_41_s(void) { return core_16.segbase+(Bit16u)(reg_bx+(Bit16s)reg_di+Fetchbs()); }
|
||||
static PhysPt EA_16_42_s(void) { return core_16.segbase+(Bit16u)(reg_bp+(Bit16s)reg_si+Fetchbs()); }
|
||||
static PhysPt EA_16_43_s(void) { return core_16.segbase+(Bit16u)(reg_bp+(Bit16s)reg_di+Fetchbs()); }
|
||||
static PhysPt EA_16_44_s(void) { return core_16.segbase+(Bit16u)(reg_si+Fetchbs()); }
|
||||
static PhysPt EA_16_45_s(void) { return core_16.segbase+(Bit16u)(reg_di+Fetchbs()); }
|
||||
static PhysPt EA_16_46_s(void) { return core_16.segbase+(Bit16u)(reg_bp+Fetchbs()); }
|
||||
static PhysPt EA_16_47_s(void) { return core_16.segbase+(Bit16u)(reg_bx+Fetchbs()); }
|
||||
|
||||
static EAPoint EA_16_80_s(void) { segprefixed((Bit16u)(reg_bx+(Bit16s)reg_si+Fetchws())) }
|
||||
static EAPoint EA_16_81_s(void) { segprefixed((Bit16u)(reg_bx+(Bit16s)reg_di+Fetchws())) }
|
||||
static EAPoint EA_16_82_s(void) { segprefixed((Bit16u)(reg_bp+(Bit16s)reg_si+Fetchws())) }
|
||||
static EAPoint EA_16_83_s(void) { segprefixed((Bit16u)(reg_bp+(Bit16s)reg_di+Fetchws())) }
|
||||
static EAPoint EA_16_84_s(void) { segprefixed((Bit16u)(reg_si+Fetchws())) }
|
||||
static EAPoint EA_16_85_s(void) { segprefixed((Bit16u)(reg_di+Fetchws())) }
|
||||
static EAPoint EA_16_86_s(void) { segprefixed((Bit16u)(reg_bp+Fetchws())) }
|
||||
static EAPoint EA_16_87_s(void) { segprefixed((Bit16u)(reg_bx+Fetchws())) }
|
||||
static PhysPt EA_16_80_s(void) { return core_16.segbase+(Bit16u)(reg_bx+(Bit16s)reg_si+Fetchws()); }
|
||||
static PhysPt EA_16_81_s(void) { return core_16.segbase+(Bit16u)(reg_bx+(Bit16s)reg_di+Fetchws()); }
|
||||
static PhysPt EA_16_82_s(void) { return core_16.segbase+(Bit16u)(reg_bp+(Bit16s)reg_si+Fetchws()); }
|
||||
static PhysPt EA_16_83_s(void) { return core_16.segbase+(Bit16u)(reg_bp+(Bit16s)reg_di+Fetchws()); }
|
||||
static PhysPt EA_16_84_s(void) { return core_16.segbase+(Bit16u)(reg_si+Fetchws()); }
|
||||
static PhysPt EA_16_85_s(void) { return core_16.segbase+(Bit16u)(reg_di+Fetchws()); }
|
||||
static PhysPt EA_16_86_s(void) { return core_16.segbase+(Bit16u)(reg_bp+Fetchws()); }
|
||||
static PhysPt EA_16_87_s(void) { return core_16.segbase+(Bit16u)(reg_bx+Fetchws()); }
|
||||
|
||||
static GetEATable GetEA_16_s={
|
||||
/* 00 */
|
||||
@ -190,9 +176,9 @@ static GetEATable GetEA_16_s={
|
||||
static Bit32u SIBZero=0;
|
||||
static Bit32u * SIBIndex[8]= { ®_eax,®_ecx,®_edx,®_ebx,&SIBZero,®_ebp,®_esi,®_edi };
|
||||
|
||||
INLINE EAPoint Sib(Bitu mode) {
|
||||
INLINE PhysPt Sib(Bitu mode) {
|
||||
Bit8u sib=Fetchb();
|
||||
EAPoint base;
|
||||
PhysPt base;
|
||||
switch (sib&7) {
|
||||
case 0: /* EAX Base */
|
||||
base=SegBase(ds)+reg_eax;break;
|
||||
@ -220,32 +206,32 @@ INLINE EAPoint Sib(Bitu mode) {
|
||||
};
|
||||
|
||||
|
||||
static EAPoint EA_32_00_n(void) { PrefixReset;return SegBase(ds)+reg_eax; }
|
||||
static EAPoint EA_32_01_n(void) { PrefixReset;return SegBase(ds)+reg_ecx; }
|
||||
static EAPoint EA_32_02_n(void) { PrefixReset;return SegBase(ds)+reg_edx; }
|
||||
static EAPoint EA_32_03_n(void) { PrefixReset;return SegBase(ds)+reg_ebx; }
|
||||
static EAPoint EA_32_04_n(void) { PrefixReset;return Sib(0);}
|
||||
static EAPoint EA_32_05_n(void) { PrefixReset;return SegBase(ds)+Fetchd(); }
|
||||
static EAPoint EA_32_06_n(void) { PrefixReset;return SegBase(ds)+reg_esi; }
|
||||
static EAPoint EA_32_07_n(void) { PrefixReset;return SegBase(ds)+reg_edi; }
|
||||
static PhysPt EA_32_00_n(void) { return SegBase(ds)+reg_eax; }
|
||||
static PhysPt EA_32_01_n(void) { return SegBase(ds)+reg_ecx; }
|
||||
static PhysPt EA_32_02_n(void) { return SegBase(ds)+reg_edx; }
|
||||
static PhysPt EA_32_03_n(void) { return SegBase(ds)+reg_ebx; }
|
||||
static PhysPt EA_32_04_n(void) { return Sib(0);}
|
||||
static PhysPt EA_32_05_n(void) { return SegBase(ds)+Fetchd(); }
|
||||
static PhysPt EA_32_06_n(void) { return SegBase(ds)+reg_esi; }
|
||||
static PhysPt EA_32_07_n(void) { return SegBase(ds)+reg_edi; }
|
||||
|
||||
static EAPoint EA_32_40_n(void) { PrefixReset;return SegBase(ds)+reg_eax+Fetchbs(); }
|
||||
static EAPoint EA_32_41_n(void) { PrefixReset;return SegBase(ds)+reg_ecx+Fetchbs(); }
|
||||
static EAPoint EA_32_42_n(void) { PrefixReset;return SegBase(ds)+reg_edx+Fetchbs(); }
|
||||
static EAPoint EA_32_43_n(void) { PrefixReset;return SegBase(ds)+reg_ebx+Fetchbs(); }
|
||||
static EAPoint EA_32_44_n(void) { PrefixReset;EAPoint temp=Sib(1);return temp+Fetchbs();}
|
||||
static EAPoint EA_32_45_n(void) { PrefixReset;return SegBase(ss)+reg_ebp+Fetchbs(); }
|
||||
static EAPoint EA_32_46_n(void) { PrefixReset;return SegBase(ds)+reg_esi+Fetchbs(); }
|
||||
static EAPoint EA_32_47_n(void) { PrefixReset;return SegBase(ds)+reg_edi+Fetchbs(); }
|
||||
static PhysPt EA_32_40_n(void) { return SegBase(ds)+reg_eax+Fetchbs(); }
|
||||
static PhysPt EA_32_41_n(void) { return SegBase(ds)+reg_ecx+Fetchbs(); }
|
||||
static PhysPt EA_32_42_n(void) { return SegBase(ds)+reg_edx+Fetchbs(); }
|
||||
static PhysPt EA_32_43_n(void) { return SegBase(ds)+reg_ebx+Fetchbs(); }
|
||||
static PhysPt EA_32_44_n(void) { PhysPt temp=Sib(1);return temp+Fetchbs();}
|
||||
static PhysPt EA_32_45_n(void) { return SegBase(ss)+reg_ebp+Fetchbs(); }
|
||||
static PhysPt EA_32_46_n(void) { return SegBase(ds)+reg_esi+Fetchbs(); }
|
||||
static PhysPt EA_32_47_n(void) { return SegBase(ds)+reg_edi+Fetchbs(); }
|
||||
|
||||
static EAPoint EA_32_80_n(void) { PrefixReset;return SegBase(ds)+reg_eax+Fetchds(); }
|
||||
static EAPoint EA_32_81_n(void) { PrefixReset;return SegBase(ds)+reg_ecx+Fetchds(); }
|
||||
static EAPoint EA_32_82_n(void) { PrefixReset;return SegBase(ds)+reg_edx+Fetchds(); }
|
||||
static EAPoint EA_32_83_n(void) { PrefixReset;return SegBase(ds)+reg_ebx+Fetchds(); }
|
||||
static EAPoint EA_32_84_n(void) { PrefixReset;EAPoint temp=Sib(2);return temp+Fetchbs();}
|
||||
static EAPoint EA_32_85_n(void) { PrefixReset;return SegBase(ss)+reg_ebp+Fetchds(); }
|
||||
static EAPoint EA_32_86_n(void) { PrefixReset;return SegBase(ds)+reg_esi+Fetchds(); }
|
||||
static EAPoint EA_32_87_n(void) { PrefixReset;return SegBase(ds)+reg_edi+Fetchds(); }
|
||||
static PhysPt EA_32_80_n(void) { return SegBase(ds)+reg_eax+Fetchds(); }
|
||||
static PhysPt EA_32_81_n(void) { return SegBase(ds)+reg_ecx+Fetchds(); }
|
||||
static PhysPt EA_32_82_n(void) { return SegBase(ds)+reg_edx+Fetchds(); }
|
||||
static PhysPt EA_32_83_n(void) { return SegBase(ds)+reg_ebx+Fetchds(); }
|
||||
static PhysPt EA_32_84_n(void) { PhysPt temp=Sib(2);return temp+Fetchds();}
|
||||
static PhysPt EA_32_85_n(void) { return SegBase(ss)+reg_ebp+Fetchds(); }
|
||||
static PhysPt EA_32_86_n(void) { return SegBase(ds)+reg_esi+Fetchds(); }
|
||||
static PhysPt EA_32_87_n(void) { return SegBase(ds)+reg_edi+Fetchds(); }
|
||||
|
||||
static GetEATable GetEA_32_n={
|
||||
/* 00 */
|
||||
@ -282,64 +268,62 @@ static GetEATable GetEA_32_n={
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
INLINE EAPoint Sib_s(Bitu mode) {
|
||||
INLINE PhysPt Sib_s(Bitu mode) {
|
||||
Bit8u sib=Fetchb();
|
||||
EAPoint base;
|
||||
PhysPt base;
|
||||
switch (sib&7) {
|
||||
case 0: /* EAX Base */
|
||||
base=prefix.segbase+reg_eax;break;
|
||||
base=reg_eax;break;
|
||||
case 1: /* ECX Base */
|
||||
base=prefix.segbase+reg_ecx;break;
|
||||
base=reg_ecx;break;
|
||||
case 2: /* EDX Base */
|
||||
base=prefix.segbase+reg_edx;break;
|
||||
base=reg_edx;break;
|
||||
case 3: /* EBX Base */
|
||||
base=prefix.segbase+reg_ebx;break;
|
||||
base=reg_ebx;break;
|
||||
case 4: /* ESP Base */
|
||||
base=prefix.segbase+reg_esp;break;
|
||||
base=reg_esp;break;
|
||||
case 5: /* #1 Base */
|
||||
if (!mode) {
|
||||
base=prefix.segbase+Fetchd();break;
|
||||
base=Fetchd();break;
|
||||
} else {
|
||||
base=prefix.segbase+reg_ebp;break;
|
||||
base=reg_ebp;break;
|
||||
}
|
||||
case 6: /* ESI Base */
|
||||
base=prefix.segbase+reg_esi;break;
|
||||
base=reg_esi;break;
|
||||
case 7: /* EDI Base */
|
||||
base=prefix.segbase+reg_edi;break;
|
||||
base=reg_edi;break;
|
||||
}
|
||||
base+=*SIBIndex[(sib >> 3) &7] << (sib >> 6);
|
||||
PrefixReset;
|
||||
return base;
|
||||
};
|
||||
|
||||
#define segprefixed_32(val) EAPoint ret=prefix.segbase+(Bit32u)(val);PrefixReset;return ret;
|
||||
|
||||
static EAPoint EA_32_00_s(void) { segprefixed_32(reg_eax); }
|
||||
static EAPoint EA_32_01_s(void) { segprefixed_32(reg_ecx); }
|
||||
static EAPoint EA_32_02_s(void) { segprefixed_32(reg_edx); }
|
||||
static EAPoint EA_32_03_s(void) { segprefixed_32(reg_ebx); }
|
||||
static EAPoint EA_32_04_s(void) { return Sib_s(0);}
|
||||
static EAPoint EA_32_05_s(void) { segprefixed_32(Fetchd()); }
|
||||
static EAPoint EA_32_06_s(void) { segprefixed_32(reg_esi); }
|
||||
static EAPoint EA_32_07_s(void) { segprefixed_32(reg_edi); }
|
||||
static PhysPt EA_32_00_s(void) { return core_16.segbase+(Bit32u)(reg_eax); }
|
||||
static PhysPt EA_32_01_s(void) { return core_16.segbase+(Bit32u)(reg_ecx); }
|
||||
static PhysPt EA_32_02_s(void) { return core_16.segbase+(Bit32u)(reg_edx); }
|
||||
static PhysPt EA_32_03_s(void) { return core_16.segbase+(Bit32u)(reg_ebx); }
|
||||
static PhysPt EA_32_04_s(void) { return core_16.segbase+(Bit32u)(Sib_s(0));}
|
||||
static PhysPt EA_32_05_s(void) { return core_16.segbase+(Bit32u)(Fetchd()); }
|
||||
static PhysPt EA_32_06_s(void) { return core_16.segbase+(Bit32u)(reg_esi); }
|
||||
static PhysPt EA_32_07_s(void) { return core_16.segbase+(Bit32u)(reg_edi); }
|
||||
|
||||
static EAPoint EA_32_40_s(void) { segprefixed_32(reg_eax+Fetchbs()); }
|
||||
static EAPoint EA_32_41_s(void) { segprefixed_32(reg_ecx+Fetchbs()); }
|
||||
static EAPoint EA_32_42_s(void) { segprefixed_32(reg_edx+Fetchbs()); }
|
||||
static EAPoint EA_32_43_s(void) { segprefixed_32(reg_ebx+Fetchbs()); }
|
||||
static EAPoint EA_32_44_s(void) { return Sib_s(1)+Fetchbs();}
|
||||
static EAPoint EA_32_45_s(void) { segprefixed_32(reg_ebp+Fetchbs()); }
|
||||
static EAPoint EA_32_46_s(void) { segprefixed_32(reg_esi+Fetchbs()); }
|
||||
static EAPoint EA_32_47_s(void) { segprefixed_32(reg_edi+Fetchbs()); }
|
||||
static PhysPt EA_32_40_s(void) { return core_16.segbase+(Bit32u)(reg_eax+Fetchbs()); }
|
||||
static PhysPt EA_32_41_s(void) { return core_16.segbase+(Bit32u)(reg_ecx+Fetchbs()); }
|
||||
static PhysPt EA_32_42_s(void) { return core_16.segbase+(Bit32u)(reg_edx+Fetchbs()); }
|
||||
static PhysPt EA_32_43_s(void) { return core_16.segbase+(Bit32u)(reg_ebx+Fetchbs()); }
|
||||
static PhysPt EA_32_44_s(void) { return core_16.segbase+(Bit32u)(Sib_s(1)+Fetchbs());}
|
||||
static PhysPt EA_32_45_s(void) { return core_16.segbase+(Bit32u)(reg_ebp+Fetchbs()); }
|
||||
static PhysPt EA_32_46_s(void) { return core_16.segbase+(Bit32u)(reg_esi+Fetchbs()); }
|
||||
static PhysPt EA_32_47_s(void) { return core_16.segbase+(Bit32u)(reg_edi+Fetchbs()); }
|
||||
|
||||
static EAPoint EA_32_80_s(void) { segprefixed_32(reg_eax+Fetchds()); }
|
||||
static EAPoint EA_32_81_s(void) { segprefixed_32(reg_ecx+Fetchds()); }
|
||||
static EAPoint EA_32_82_s(void) { segprefixed_32(reg_edx+Fetchds()); }
|
||||
static EAPoint EA_32_83_s(void) { segprefixed_32(reg_ebx+Fetchds()); }
|
||||
static EAPoint EA_32_84_s(void) { return Sib_s(2)+Fetchds();}
|
||||
static EAPoint EA_32_85_s(void) { segprefixed_32(reg_ebp+Fetchds()); }
|
||||
static EAPoint EA_32_86_s(void) { segprefixed_32(reg_esi+Fetchds()); }
|
||||
static EAPoint EA_32_87_s(void) { segprefixed_32(reg_edi+Fetchds()); }
|
||||
static PhysPt EA_32_80_s(void) { return core_16.segbase+(Bit32u)(reg_eax+Fetchds()); }
|
||||
static PhysPt EA_32_81_s(void) { return core_16.segbase+(Bit32u)(reg_ecx+Fetchds()); }
|
||||
static PhysPt EA_32_82_s(void) { return core_16.segbase+(Bit32u)(reg_edx+Fetchds()); }
|
||||
static PhysPt EA_32_83_s(void) { return core_16.segbase+(Bit32u)(reg_ebx+Fetchds()); }
|
||||
static PhysPt EA_32_84_s(void) { return core_16.segbase+(Bit32u)(Sib_s(2)+Fetchds());}
|
||||
static PhysPt EA_32_85_s(void) { return core_16.segbase+(Bit32u)(reg_ebp+Fetchds()); }
|
||||
static PhysPt EA_32_86_s(void) { return core_16.segbase+(Bit32u)(reg_esi+Fetchds()); }
|
||||
static PhysPt EA_32_87_s(void) { return core_16.segbase+(Bit32u)(reg_edi+Fetchds()); }
|
||||
|
||||
|
||||
static GetEATable GetEA_32_s={
|
||||
@ -377,20 +361,20 @@ static GetEATable GetEA_32_s={
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
static EAPoint GetEADirect_NONE(void) {
|
||||
EAPoint result=SegBase(ds)+Fetchw();
|
||||
static PhysPt GetEADirect_NONE(void) {
|
||||
PhysPt result=SegBase(ds)+Fetchw();
|
||||
return result;
|
||||
}
|
||||
static EAPoint GetEADirect_SEG(void) {
|
||||
EAPoint result=prefix.segbase+Fetchw();PrefixReset;
|
||||
static PhysPt GetEADirect_SEG(void) {
|
||||
PhysPt result=core_16.segbase+Fetchw();
|
||||
return result;
|
||||
}
|
||||
static EAPoint GetEADirect_ADDR(void) {
|
||||
EAPoint result=SegBase(ds)+Fetchd();PrefixReset;
|
||||
static PhysPt GetEADirect_ADDR(void) {
|
||||
PhysPt result=SegBase(ds)+Fetchd();
|
||||
return result;
|
||||
}
|
||||
static EAPoint GetEADirect_SEG_ADDR(void) {
|
||||
EAPoint result=prefix.segbase+Fetchd();PrefixReset;
|
||||
static PhysPt GetEADirect_SEG_ADDR(void) {
|
||||
PhysPt result=core_16.segbase+Fetchd();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
111
src/cpu/core_full.cpp
Normal file
111
src/cpu/core_full.cpp
Normal file
@ -0,0 +1,111 @@
|
||||
/*
|
||||
* Copyright (C) 2002-2003 The DOSBox Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "dosbox.h"
|
||||
|
||||
#include "pic.h"
|
||||
#include "regs.h"
|
||||
#include "cpu.h"
|
||||
#include "lazyflags.h"
|
||||
#include "paging.h"
|
||||
#include "fpu.h"
|
||||
#include "debug.h"
|
||||
#include "inout.h"
|
||||
#include "callback.h"
|
||||
|
||||
|
||||
typedef PhysPt EAPoint;
|
||||
#define SegBase(c) SegPhys(c)
|
||||
|
||||
#define LoadMb(off) mem_readb_inline(off)
|
||||
#define LoadMw(off) mem_readw_inline(off)
|
||||
#define LoadMd(off) mem_readd_inline(off)
|
||||
|
||||
#define LoadMbs(off) (Bit8s)(LoadMb(off))
|
||||
#define LoadMws(off) (Bit16s)(LoadMw(off))
|
||||
#define LoadMds(off) (Bit32s)(LoadMd(off))
|
||||
|
||||
#define SaveMb(off,val) mem_writeb_inline(off,val)
|
||||
#define SaveMw(off,val) mem_writew_inline(off,val)
|
||||
#define SaveMd(off,val) mem_writed_inline(off,val)
|
||||
|
||||
#define LoadD(reg) reg
|
||||
#define SaveD(reg,val) reg=val
|
||||
|
||||
#include "core_full/loadwrite.h"
|
||||
#include "core_full/support.h"
|
||||
#include "core_full/optable.h"
|
||||
#include "instructions.h"
|
||||
|
||||
#define LEAVECORE \
|
||||
SaveIP(); \
|
||||
FillFlags();
|
||||
|
||||
#define EXCEPTION(blah) \
|
||||
{ \
|
||||
Bit8u new_num=blah; \
|
||||
IPPoint=inst.start_entry; \
|
||||
LEAVECORE; \
|
||||
Interrupt(new_num); \
|
||||
LoadIP(); \
|
||||
goto nextopcode; \
|
||||
}
|
||||
|
||||
Bits Full_DeCode(void) {
|
||||
FullData inst;
|
||||
if (!cpu.code.big) {
|
||||
inst.start_prefix=0x0;;
|
||||
inst.start_entry=0x0;
|
||||
} else {
|
||||
inst.start_prefix=PREFIX_ADDR;
|
||||
inst.start_entry=0x200;
|
||||
}
|
||||
EAPoint IPPoint;
|
||||
LoadIP();
|
||||
flags.type=t_UNKNOWN;
|
||||
while (CPU_Cycles>0) {
|
||||
#if C_DEBUG
|
||||
cycle_count++;
|
||||
#if C_HEAVY_DEBUG
|
||||
SaveIP();
|
||||
if (DEBUG_HeavyIsBreakpoint()) {
|
||||
LEAVECORE;
|
||||
return debugCallback;
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
inst.start=IPPoint;
|
||||
inst.entry=inst.start_entry;
|
||||
inst.prefix=inst.start_prefix;
|
||||
restartopcode:
|
||||
inst.entry=(inst.entry & 0xffffff00) | Fetchb();
|
||||
inst.code=OpCodeTable[inst.entry];
|
||||
#include "core_full/load.h"
|
||||
#include "core_full/op.h"
|
||||
#include "core_full/save.h"
|
||||
nextopcode:;
|
||||
CPU_Cycles--;
|
||||
}
|
||||
LEAVECORE;
|
||||
return CBRET_NONE;
|
||||
}
|
||||
|
||||
|
||||
void CPU_Core_Full_Start(bool big) {
|
||||
cpudecoder=&Full_DeCode;
|
||||
}
|
3
src/cpu/core_full/Makefile.am
Normal file
3
src/cpu/core_full/Makefile.am
Normal file
@ -0,0 +1,3 @@
|
||||
|
||||
noinst_HEADERS = ea_lookup.h load.h loadwrite.h op.h optable.h save.h \
|
||||
string.h support.h
|
326
src/cpu/core_full/Makefile.in
Normal file
326
src/cpu/core_full/Makefile.in
Normal file
@ -0,0 +1,326 @@
|
||||
# Makefile.in generated by automake 1.7.7 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = ../../..
|
||||
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
INSTALL = @INSTALL@
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_triplet = @host@
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMDEP_FALSE = @AMDEP_FALSE@
|
||||
AMDEP_TRUE = @AMDEP_TRUE@
|
||||
AMTAR = @AMTAR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SDL_CFLAGS = @SDL_CFLAGS@
|
||||
SDL_CONFIG = @SDL_CONFIG@
|
||||
SDL_LIBS = @SDL_LIBS@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_RANLIB = @ac_ct_RANLIB@
|
||||
ac_ct_STRIP = @ac_ct_STRIP@
|
||||
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
|
||||
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
|
||||
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
|
||||
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
datadir = @datadir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
oldincludedir = @oldincludedir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target = @target@
|
||||
target_alias = @target_alias@
|
||||
target_cpu = @target_cpu@
|
||||
target_os = @target_os@
|
||||
target_vendor = @target_vendor@
|
||||
|
||||
noinst_HEADERS = ea_lookup.h load.h loadwrite.h op.h optable.h save.h \
|
||||
string.h support.h
|
||||
|
||||
subdir = src/cpu/core_full
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
DIST_SOURCES =
|
||||
HEADERS = $(noinst_HEADERS)
|
||||
|
||||
DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.in Makefile.am
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnits src/cpu/core_full/Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
|
||||
uninstall-info-am:
|
||||
|
||||
ETAGS = etags
|
||||
ETAGSFLAGS =
|
||||
|
||||
CTAGS = ctags
|
||||
CTAGSFLAGS =
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
mkid -fID $$unique
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|
||||
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
top_distdir = ../../..
|
||||
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(DISTFILES)'; for file in $$list; do \
|
||||
case $$file in \
|
||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
|
||||
esac; \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
dir="/$$dir"; \
|
||||
$(mkinstalldirs) "$(distdir)$$dir"; \
|
||||
else \
|
||||
dir=''; \
|
||||
fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
|
||||
fi; \
|
||||
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(HEADERS)
|
||||
|
||||
installdirs:
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f Makefile
|
||||
|
||||
distclean-am: clean-am distclean-generic distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-man:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f Makefile
|
||||
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-info-am
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic ctags \
|
||||
distclean distclean-generic distclean-tags distdir dvi dvi-am \
|
||||
info info-am install install-am install-data install-data-am \
|
||||
install-exec install-exec-am install-info install-info-am \
|
||||
install-man install-strip installcheck installcheck-am \
|
||||
installdirs maintainer-clean maintainer-clean-generic \
|
||||
mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \
|
||||
uninstall uninstall-am uninstall-info-am
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
237
src/cpu/core_full/ea_lookup.h
Normal file
237
src/cpu/core_full/ea_lookup.h
Normal file
@ -0,0 +1,237 @@
|
||||
{
|
||||
EAPoint seg_base;
|
||||
Bit16u off;
|
||||
switch ((inst.rm_mod<<3)|inst.rm_eai) {
|
||||
case 0x00:
|
||||
off=reg_bx+reg_si;
|
||||
seg_base=SegBase(ds);
|
||||
break;
|
||||
case 0x01:
|
||||
off=reg_bx+reg_di;
|
||||
seg_base=SegBase(ds);
|
||||
break;
|
||||
case 0x02:
|
||||
off=reg_bp+reg_si;
|
||||
seg_base=SegBase(ss);
|
||||
break;
|
||||
case 0x03:
|
||||
off=reg_bp+reg_di;
|
||||
seg_base=SegBase(ss);
|
||||
break;
|
||||
case 0x04:
|
||||
off=reg_si;
|
||||
seg_base=SegBase(ds);
|
||||
break;
|
||||
case 0x05:
|
||||
off=reg_di;
|
||||
seg_base=SegBase(ds);
|
||||
break;
|
||||
case 0x06:
|
||||
off=Fetchw();
|
||||
seg_base=SegBase(ds);
|
||||
break;
|
||||
case 0x07:
|
||||
off=reg_bx;
|
||||
seg_base=SegBase(ds);
|
||||
break;
|
||||
|
||||
case 0x08:
|
||||
off=reg_bx+reg_si+Fetchbs();
|
||||
seg_base=SegBase(ds);
|
||||
break;
|
||||
case 0x09:
|
||||
off=reg_bx+reg_di+Fetchbs();
|
||||
seg_base=SegBase(ds);
|
||||
break;
|
||||
case 0x0a:
|
||||
off=reg_bp+reg_si+Fetchbs();
|
||||
seg_base=SegBase(ss);
|
||||
break;
|
||||
case 0x0b:
|
||||
off=reg_bp+reg_di+Fetchbs();
|
||||
seg_base=SegBase(ss);
|
||||
break;
|
||||
case 0x0c:
|
||||
off=reg_si+Fetchbs();
|
||||
seg_base=SegBase(ds);
|
||||
break;
|
||||
case 0x0d:
|
||||
off=reg_di+Fetchbs();
|
||||
seg_base=SegBase(ds);
|
||||
break;
|
||||
case 0x0e:
|
||||
off=reg_bp+Fetchbs();
|
||||
seg_base=SegBase(ss);
|
||||
break;
|
||||
case 0x0f:
|
||||
off=reg_bx+Fetchbs();
|
||||
seg_base=SegBase(ds);
|
||||
break;
|
||||
|
||||
case 0x10:
|
||||
off=reg_bx+reg_si+Fetchws();
|
||||
seg_base=SegBase(ds);
|
||||
break;
|
||||
case 0x11:
|
||||
off=reg_bx+reg_di+Fetchws();
|
||||
seg_base=SegBase(ds);
|
||||
break;
|
||||
case 0x12:
|
||||
off=reg_bp+reg_si+Fetchws();
|
||||
seg_base=SegBase(ss);
|
||||
break;
|
||||
case 0x13:
|
||||
off=reg_bp+reg_di+Fetchws();
|
||||
seg_base=SegBase(ss);
|
||||
break;
|
||||
case 0x14:
|
||||
off=reg_si+Fetchws();
|
||||
seg_base=SegBase(ds);
|
||||
break;
|
||||
case 0x15:
|
||||
off=reg_di+Fetchws();
|
||||
seg_base=SegBase(ds);
|
||||
break;
|
||||
case 0x16:
|
||||
off=reg_bp+Fetchws();
|
||||
seg_base=SegBase(ss);
|
||||
break;
|
||||
case 0x17:
|
||||
off=reg_bx+Fetchws();
|
||||
seg_base=SegBase(ds);
|
||||
break;
|
||||
}
|
||||
inst.rm_off=off;
|
||||
if (inst.prefix & PREFIX_SEG) {
|
||||
inst.rm_eaa=inst.seg.base+off;
|
||||
} else {
|
||||
inst.rm_eaa=seg_base+off;
|
||||
}
|
||||
} else {
|
||||
|
||||
|
||||
#define SIB(MODE) { \
|
||||
Bitu sib=Fetchb(); \
|
||||
switch (sib&7) { \
|
||||
case 0:seg_base=SegBase(ds);off=reg_eax;break; \
|
||||
case 1:seg_base=SegBase(ds);off=reg_ecx;break; \
|
||||
case 2:seg_base=SegBase(ds);off=reg_edx;break; \
|
||||
case 3:seg_base=SegBase(ds);off=reg_ebx;break; \
|
||||
case 4:seg_base=SegBase(ss);off=reg_esp;break; \
|
||||
case 5:if (!MODE) { seg_base=SegBase(ds);off=Fetchd();break; \
|
||||
} else { seg_base=SegBase(ss);off=reg_ebp;break;} \
|
||||
case 6:seg_base=SegBase(ds);off=reg_esi;break; \
|
||||
case 7:seg_base=SegBase(ds);off=reg_edi;break; \
|
||||
} \
|
||||
off+=*SIBIndex[(sib >> 3) &7] << (sib >> 6); \
|
||||
};
|
||||
static Bit32u SIBZero=0;
|
||||
static Bit32u * SIBIndex[8]= { ®_eax,®_ecx,®_edx,®_ebx,&SIBZero,®_ebp,®_esi,®_edi };
|
||||
EAPoint seg_base;
|
||||
Bit32u off;
|
||||
switch ((inst.rm_mod<<3)|inst.rm_eai) {
|
||||
case 0x00:
|
||||
off=reg_eax;
|
||||
seg_base=SegBase(ds);
|
||||
break;
|
||||
case 0x01:
|
||||
off=reg_ecx;
|
||||
seg_base=SegBase(ds);
|
||||
break;
|
||||
case 0x02:
|
||||
off=reg_edx;
|
||||
seg_base=SegBase(ds);
|
||||
break;
|
||||
case 0x03:
|
||||
off=reg_ebx;
|
||||
seg_base=SegBase(ds);
|
||||
break;
|
||||
case 0x04:
|
||||
SIB(0);
|
||||
break;
|
||||
case 0x05:
|
||||
off=Fetchd();
|
||||
seg_base=SegBase(ds);
|
||||
break;
|
||||
case 0x06:
|
||||
off=reg_esi;
|
||||
seg_base=SegBase(ds);
|
||||
break;
|
||||
case 0x07:
|
||||
off=reg_edi;
|
||||
seg_base=SegBase(ds);
|
||||
break;
|
||||
|
||||
case 0x08:
|
||||
off=reg_eax+Fetchbs();
|
||||
seg_base=SegBase(ds);
|
||||
break;
|
||||
case 0x09:
|
||||
off=reg_ecx+Fetchbs();
|
||||
seg_base=SegBase(ds);
|
||||
break;
|
||||
case 0x0a:
|
||||
off=reg_edx+Fetchbs();
|
||||
seg_base=SegBase(ds);
|
||||
break;
|
||||
case 0x0b:
|
||||
off=reg_ebx+Fetchbs();
|
||||
seg_base=SegBase(ds);
|
||||
break;
|
||||
case 0x0c:
|
||||
SIB(1);
|
||||
off+=Fetchbs();
|
||||
break;
|
||||
case 0x0d:
|
||||
off=reg_ebp+Fetchbs();
|
||||
seg_base=SegBase(ss);
|
||||
break;
|
||||
case 0x0e:
|
||||
off=reg_esi+Fetchbs();
|
||||
seg_base=SegBase(ds);
|
||||
break;
|
||||
case 0x0f:
|
||||
off=reg_edi+Fetchbs();
|
||||
seg_base=SegBase(ds);
|
||||
break;
|
||||
|
||||
case 0x10:
|
||||
off=reg_eax+Fetchds();
|
||||
seg_base=SegBase(ds);
|
||||
break;
|
||||
case 0x11:
|
||||
off=reg_ecx+Fetchds();
|
||||
seg_base=SegBase(ds);
|
||||
break;
|
||||
case 0x12:
|
||||
off=reg_edx+Fetchds();
|
||||
seg_base=SegBase(ds);
|
||||
break;
|
||||
case 0x13:
|
||||
off=reg_ebx+Fetchds();
|
||||
seg_base=SegBase(ds);
|
||||
break;
|
||||
case 0x14:
|
||||
SIB(1);
|
||||
off+=Fetchds();
|
||||
break;
|
||||
case 0x15:
|
||||
off=reg_ebp+Fetchds();
|
||||
seg_base=SegBase(ss);
|
||||
break;
|
||||
case 0x16:
|
||||
off=reg_esi+Fetchds();
|
||||
seg_base=SegBase(ds);
|
||||
break;
|
||||
case 0x17:
|
||||
off=reg_edi+Fetchds();
|
||||
seg_base=SegBase(ds);
|
||||
break;
|
||||
}
|
||||
inst.rm_off=off;
|
||||
if (inst.prefix & PREFIX_SEG) {
|
||||
inst.rm_eaa=inst.seg.base+off;
|
||||
} else {
|
||||
inst.rm_eaa=seg_base+off;
|
||||
}
|
||||
}
|
501
src/cpu/core_full/load.h
Normal file
501
src/cpu/core_full/load.h
Normal file
@ -0,0 +1,501 @@
|
||||
switch (inst.code.load) {
|
||||
/* General loading */
|
||||
case L_MODRM:
|
||||
inst.rm=Fetchb();
|
||||
inst.rm_index=(inst.rm >> 3) & 7;
|
||||
inst.rm_eai=inst.rm&07;
|
||||
inst.rm_mod=inst.rm>>6;
|
||||
/* Decode address of mod/rm if needed */
|
||||
if (inst.rm<0xc0) {
|
||||
if (!(inst.prefix & PREFIX_ADDR))
|
||||
#include "ea_lookup.h"
|
||||
}
|
||||
l_MODRMswitch:
|
||||
switch (inst.code.extra) {
|
||||
/* Byte */
|
||||
case M_Ib:
|
||||
inst.op1.d=Fetchb();
|
||||
break;
|
||||
case M_Ebx:
|
||||
if (inst.rm<0xc0) inst.op1.ds=(Bit8s)LoadMb(inst.rm_eaa);
|
||||
else inst.op1.ds=(Bit8s)reg_8(inst.rm_eai);
|
||||
break;
|
||||
case M_EbIb:
|
||||
inst.op2.d=Fetchb();
|
||||
case M_Eb:
|
||||
if (inst.rm<0xc0) inst.op1.d=LoadMb(inst.rm_eaa);
|
||||
else inst.op1.d=reg_8(inst.rm_eai);
|
||||
break;
|
||||
case M_EbGb:
|
||||
if (inst.rm<0xc0) inst.op1.d=LoadMb(inst.rm_eaa);
|
||||
else inst.op1.d=reg_8(inst.rm_eai);
|
||||
inst.op2.d=reg_8(inst.rm_index);
|
||||
break;
|
||||
case M_GbEb:
|
||||
if (inst.rm<0xc0) inst.op2.d=LoadMb(inst.rm_eaa);
|
||||
else inst.op2.d=reg_8(inst.rm_eai);
|
||||
case M_Gb:
|
||||
inst.op1.d=reg_8(inst.rm_index);;
|
||||
break;
|
||||
/* Word */
|
||||
case M_Iw:
|
||||
inst.op1.d=Fetchw();
|
||||
break;
|
||||
case M_EwxGwx:
|
||||
inst.op2.ds=(Bit16s)reg_16(inst.rm_index);
|
||||
goto l_M_Ewx;
|
||||
case M_EwxIbx:
|
||||
inst.op2.ds=Fetchbs();
|
||||
goto l_M_Ewx;
|
||||
case M_EwxIwx:
|
||||
inst.op2.ds=Fetchws();
|
||||
l_M_Ewx:
|
||||
case M_Ewx:
|
||||
if (inst.rm<0xc0) inst.op1.ds=(Bit16s)LoadMw(inst.rm_eaa);
|
||||
else inst.op1.ds=(Bit16s)reg_16(inst.rm_eai);
|
||||
break;
|
||||
case M_EwIbx:
|
||||
inst.op2.ds=Fetchbs();
|
||||
goto l_M_Ew;
|
||||
case M_EwIw:
|
||||
inst.op2.d=Fetchw();
|
||||
goto l_M_Ew;
|
||||
case M_EwGwCL:
|
||||
inst.imm.d=reg_cl;
|
||||
goto l_M_EwGw;
|
||||
case M_EwGwIb:
|
||||
inst.imm.d=Fetchb();
|
||||
l_M_EwGw:
|
||||
case M_EwGw:
|
||||
inst.op2.d=reg_16(inst.rm_index);
|
||||
l_M_Ew:
|
||||
case M_Ew:
|
||||
if (inst.rm<0xc0) inst.op1.d=LoadMw(inst.rm_eaa);
|
||||
else inst.op1.d=reg_16(inst.rm_eai);
|
||||
break;
|
||||
case M_GwEw:
|
||||
if (inst.rm<0xc0) inst.op2.d=LoadMw(inst.rm_eaa);
|
||||
else inst.op2.d=reg_16(inst.rm_eai);
|
||||
case M_Gw:
|
||||
inst.op1.d=reg_16(inst.rm_index);;
|
||||
break;
|
||||
/* DWord */
|
||||
case M_Id:
|
||||
inst.op1.d=Fetchd();
|
||||
break;
|
||||
case M_EdxGdx:
|
||||
inst.op2.ds=(Bit32s)reg_32(inst.rm_index);
|
||||
case M_Edx:
|
||||
if (inst.rm<0xc0) inst.op1.d=(Bit32s)LoadMd(inst.rm_eaa);
|
||||
else inst.op1.d=(Bit32s)reg_32(inst.rm_eai);
|
||||
break;
|
||||
case M_EdIbx:
|
||||
inst.op2.ds=Fetchbs();
|
||||
goto l_M_Ed;
|
||||
case M_EdId:
|
||||
inst.op2.d=Fetchd();
|
||||
goto l_M_Ed;
|
||||
case M_EdGdCL:
|
||||
inst.imm.d=reg_cl;
|
||||
goto l_M_EdGd;
|
||||
case M_EdGdIb:
|
||||
inst.imm.d=Fetchb();
|
||||
l_M_EdGd:
|
||||
case M_EdGd:
|
||||
inst.op2.d=reg_32(inst.rm_index);
|
||||
l_M_Ed:
|
||||
case M_Ed:
|
||||
if (inst.rm<0xc0) inst.op1.d=LoadMd(inst.rm_eaa);
|
||||
else inst.op1.d=reg_32(inst.rm_eai);
|
||||
break;
|
||||
case M_GdEd:
|
||||
if (inst.rm<0xc0) inst.op2.d=LoadMd(inst.rm_eaa);
|
||||
else inst.op2.d=reg_32(inst.rm_eai);
|
||||
case M_Gd:
|
||||
inst.op1.d=reg_32(inst.rm_index);
|
||||
break;
|
||||
/* Others */
|
||||
|
||||
case M_SEG:
|
||||
//TODO Check for limit
|
||||
inst.op1.d=SegValue((SegNames)inst.rm_index);
|
||||
break;
|
||||
case M_Efw:
|
||||
if (inst.rm>=0xC0) {
|
||||
LOG(LOG_CPU,LOG_ERROR)("MODRM:Illegal M_Efw ");
|
||||
goto nextopcode;
|
||||
}
|
||||
inst.op1.d=LoadMw(inst.rm_eaa);
|
||||
inst.op2.d=LoadMw(inst.rm_eaa+2);
|
||||
break;
|
||||
case M_Efd:
|
||||
if (inst.rm>=0xc0) {
|
||||
LOG(LOG_CPU,LOG_ERROR)("MODRM:Illegal M_Efw ");
|
||||
goto nextopcode;
|
||||
}
|
||||
inst.op1.d=LoadMd(inst.rm_eaa);
|
||||
inst.op2.d=LoadMw(inst.rm_eaa+4);
|
||||
break;
|
||||
case M_EA:
|
||||
inst.op1.d=inst.rm_off;
|
||||
break;
|
||||
case M_POPw:
|
||||
inst.op1.d = Pop_16();
|
||||
break;
|
||||
case M_POPd:
|
||||
inst.op1.d = Pop_32();
|
||||
break;
|
||||
case M_GRP:
|
||||
inst.code=Groups[inst.code.op][inst.rm_index];
|
||||
goto l_MODRMswitch;
|
||||
case M_GRP_Ib:
|
||||
inst.op2.d=Fetchb();
|
||||
inst.code=Groups[inst.code.op][inst.rm_index];
|
||||
goto l_MODRMswitch;
|
||||
case M_GRP_CL:
|
||||
inst.op2.d=reg_cl;
|
||||
inst.code=Groups[inst.code.op][inst.rm_index];
|
||||
goto l_MODRMswitch;
|
||||
case M_GRP_1:
|
||||
inst.op2.d=1;
|
||||
inst.code=Groups[inst.code.op][inst.rm_index];
|
||||
goto l_MODRMswitch;
|
||||
|
||||
/* Should continue with normal handler afterwards */
|
||||
case 0:
|
||||
break;
|
||||
default:
|
||||
LOG(LOG_CPU,LOG_ERROR)("MODRM:Unhandled load %d entry %x",inst.code.extra,inst.entry);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case L_POPw:
|
||||
inst.op1.d = Pop_16();
|
||||
break;
|
||||
case L_POPd:
|
||||
inst.op1.d = Pop_32();
|
||||
break;
|
||||
case L_POPfw:
|
||||
inst.op1.d = Pop_16();
|
||||
inst.op2.d = Pop_16();
|
||||
break;
|
||||
case L_POPfd:
|
||||
inst.op1.d = Pop_32();
|
||||
inst.op2.d = Pop_16();
|
||||
break;
|
||||
case L_Ib:
|
||||
inst.op1.d=Fetchb();
|
||||
break;
|
||||
case L_Ibx:
|
||||
inst.op1.ds=Fetchbs();
|
||||
break;
|
||||
case L_Iw:
|
||||
inst.op1.d=Fetchw();
|
||||
break;
|
||||
case L_Iwx:
|
||||
inst.op1.ds=Fetchws();
|
||||
break;
|
||||
case L_Idx:
|
||||
case L_Id:
|
||||
inst.op1.d=Fetchd();
|
||||
break;
|
||||
case L_Ifw:
|
||||
inst.op1.d=Fetchw();
|
||||
inst.op2.d=Fetchw();
|
||||
break;
|
||||
case L_Ifd:
|
||||
inst.op1.d=Fetchd();
|
||||
inst.op2.d=Fetchw();
|
||||
break;
|
||||
/* Direct load of registers */
|
||||
case L_REGbIb:
|
||||
inst.op2.d=Fetchb();
|
||||
case L_REGb:
|
||||
inst.op1.d=reg_8(inst.code.extra);
|
||||
break;
|
||||
case L_REGwIw:
|
||||
inst.op2.d=Fetchw();
|
||||
case L_REGw:
|
||||
inst.op1.d=reg_16(inst.code.extra);
|
||||
break;
|
||||
case L_REGdId:
|
||||
inst.op2.d=Fetchd();
|
||||
case L_REGd:
|
||||
inst.op1.d=reg_32(inst.code.extra);
|
||||
break;
|
||||
case L_FLG:
|
||||
FillFlags();
|
||||
inst.op1.d = flags.word;
|
||||
break;
|
||||
case L_SEG:
|
||||
inst.op1.d=SegValue((SegNames)inst.code.extra);
|
||||
break;
|
||||
/* Depending on addressize */
|
||||
case L_OP:
|
||||
if (inst.prefix & PREFIX_ADDR) {
|
||||
inst.rm_eaa=Fetchd();
|
||||
} else {
|
||||
inst.rm_eaa=Fetchw();
|
||||
}
|
||||
if (inst.prefix & PREFIX_SEG) {
|
||||
inst.rm_eaa+=inst.seg.base;
|
||||
} else {
|
||||
inst.rm_eaa+=SegBase(ds);
|
||||
}
|
||||
break;
|
||||
/* Special cases */
|
||||
case L_DOUBLE:
|
||||
inst.entry|=0x100;
|
||||
goto restartopcode;
|
||||
case L_PRESEG:
|
||||
inst.prefix|=PREFIX_SEG;
|
||||
inst.seg.base=SegBase((SegNames)inst.code.extra);
|
||||
goto restartopcode;
|
||||
case L_PREREPNE:
|
||||
inst.prefix|=PREFIX_REP;
|
||||
inst.repz=false;
|
||||
goto restartopcode;
|
||||
case L_PREREP:
|
||||
inst.prefix|=PREFIX_REP;
|
||||
inst.repz=true;
|
||||
goto restartopcode;
|
||||
case L_PREOP:
|
||||
inst.entry^=0x200;
|
||||
goto restartopcode;
|
||||
case L_PREADD:
|
||||
inst.prefix^=PREFIX_ADDR;
|
||||
goto restartopcode;
|
||||
case L_VAL:
|
||||
inst.op1.d=inst.code.extra;
|
||||
break;
|
||||
case L_INTO:
|
||||
if (!get_OF()) goto nextopcode;
|
||||
inst.op1.d=4;
|
||||
break;
|
||||
case D_IRETw:
|
||||
flags.type=t_UNKNOWN;
|
||||
if (!CPU_IRET(false)) return CBRET_NONE;
|
||||
if (GETFLAG(IF) && PIC_IRQCheck) {
|
||||
return CBRET_NONE;
|
||||
}
|
||||
LoadIP();
|
||||
goto nextopcode;
|
||||
case D_IRETd:
|
||||
flags.type=t_UNKNOWN;
|
||||
if (!CPU_IRET(true)) return CBRET_NONE;
|
||||
if (GETFLAG(IF) && PIC_IRQCheck) {
|
||||
return CBRET_NONE;
|
||||
}
|
||||
LoadIP();
|
||||
goto nextopcode;
|
||||
case D_RETFwIw:
|
||||
if (!CPU_RET(false,Fetchw())) {
|
||||
FillFlags();
|
||||
return CBRET_NONE;
|
||||
}
|
||||
LoadIP();
|
||||
goto nextopcode;
|
||||
case D_RETFw:
|
||||
if (!CPU_RET(false,0)) {
|
||||
FillFlags();
|
||||
return CBRET_NONE;
|
||||
}
|
||||
LoadIP();
|
||||
goto nextopcode;
|
||||
case D_RETFdIw:
|
||||
if (!CPU_RET(true,Fetchw())) {
|
||||
FillFlags();
|
||||
return CBRET_NONE;
|
||||
}
|
||||
LoadIP();
|
||||
goto nextopcode;
|
||||
case D_RETFd:
|
||||
if (!CPU_RET(true,0)) {
|
||||
FillFlags();
|
||||
return CBRET_NONE;
|
||||
}
|
||||
LoadIP();
|
||||
goto nextopcode;
|
||||
/* Direct operations */
|
||||
case L_STRING:
|
||||
#include "string.h"
|
||||
goto nextopcode;
|
||||
case D_PUSHAw:
|
||||
{
|
||||
Bit16u old_sp=reg_sp;
|
||||
Push_16(reg_ax);Push_16(reg_cx);Push_16(reg_dx);Push_16(reg_bx);
|
||||
Push_16(old_sp);Push_16(reg_bp);Push_16(reg_si);Push_16(reg_di);
|
||||
}
|
||||
goto nextopcode;
|
||||
case D_PUSHAd:
|
||||
{
|
||||
Bit32u old_esp=reg_esp;
|
||||
Push_32(reg_eax);Push_32(reg_ecx);Push_32(reg_edx);Push_32(reg_ebx);
|
||||
Push_32(old_esp);Push_32(reg_ebp);Push_32(reg_esi);Push_32(reg_edi);
|
||||
}
|
||||
goto nextopcode;
|
||||
case D_POPAw:
|
||||
reg_di=Pop_16();reg_si=Pop_16();reg_bp=Pop_16();Pop_16();//Don't save SP
|
||||
reg_bx=Pop_16();reg_dx=Pop_16();reg_cx=Pop_16();reg_ax=Pop_16();
|
||||
goto nextopcode;
|
||||
case D_POPAd:
|
||||
reg_edi=Pop_32();reg_esi=Pop_32();reg_ebp=Pop_32();Pop_32();//Don't save ESP
|
||||
reg_ebx=Pop_32();reg_edx=Pop_32();reg_ecx=Pop_32();reg_eax=Pop_32();
|
||||
goto nextopcode;
|
||||
case D_SETALC:
|
||||
reg_al = get_CF() ? 0xFF : 0;
|
||||
goto nextopcode;
|
||||
case D_XLATw:
|
||||
if (inst.prefix & PREFIX_SEG) reg_al=LoadMb(inst.seg.base+reg_bx+reg_al);
|
||||
else reg_al=LoadMb(SegBase(ds)+reg_bx+reg_al);
|
||||
goto nextopcode;
|
||||
case D_XLATd:
|
||||
if (inst.prefix & PREFIX_SEG) reg_al=LoadMb(inst.seg.base+reg_ebx+reg_al);
|
||||
else reg_al=LoadMb(SegBase(ds)+reg_ebx+reg_al);
|
||||
goto nextopcode;
|
||||
case D_CBW:
|
||||
reg_ax=(Bit8s)reg_al;
|
||||
goto nextopcode;
|
||||
case D_CWDE:
|
||||
reg_eax=(Bit16s)reg_ax;
|
||||
goto nextopcode;
|
||||
case D_CWD:
|
||||
if (reg_ax & 0x8000) reg_dx=0xffff;
|
||||
else reg_dx=0;
|
||||
goto nextopcode;
|
||||
case D_CDQ:
|
||||
if (reg_eax & 0x80000000) reg_edx=0xffffffff;
|
||||
else reg_edx=0;
|
||||
goto nextopcode;
|
||||
case D_CLI:
|
||||
SETFLAGBIT(IF,false);
|
||||
goto nextopcode;
|
||||
case D_STI:
|
||||
SETFLAGBIT(IF,true);
|
||||
if (GETFLAG(IF) && PIC_IRQCheck) {
|
||||
LEAVECORE;
|
||||
return CBRET_NONE;
|
||||
}
|
||||
goto nextopcode;
|
||||
case D_STC:
|
||||
SETFLAGBIT(CF,true);
|
||||
if (flags.type!=t_CF) flags.prev_type=flags.type;
|
||||
flags.type=t_CF;
|
||||
goto nextopcode;
|
||||
case D_CLC:
|
||||
SETFLAGBIT(CF,false);
|
||||
if (flags.type!=t_CF) flags.prev_type=flags.type;
|
||||
flags.type=t_CF;
|
||||
goto nextopcode;
|
||||
case D_CMC:
|
||||
SETFLAGBIT(CF,!get_CF());
|
||||
if (flags.type!=t_CF) flags.prev_type=flags.type;
|
||||
flags.type=t_CF;
|
||||
goto nextopcode;
|
||||
case D_CLD:
|
||||
SETFLAGBIT(DF,false);
|
||||
goto nextopcode;
|
||||
case D_STD:
|
||||
SETFLAGBIT(DF,true);
|
||||
goto nextopcode;
|
||||
case D_WAIT:
|
||||
case D_NOP:
|
||||
goto nextopcode;
|
||||
case D_ENTERw:
|
||||
{
|
||||
Bitu bytes=Fetchw();Bitu level=Fetchb() & 0x1f;
|
||||
Bitu frame_ptr=reg_esp-2;
|
||||
if (cpu.stack.big) {
|
||||
reg_esp-=2;
|
||||
mem_writew(SegBase(ss)+reg_esp,reg_bp);
|
||||
for (Bitu i=1;i<level;i++) {
|
||||
reg_ebp-=2;reg_esp-=2;
|
||||
mem_writew(SegBase(ss)+reg_esp,mem_readw(SegBase(ss)+reg_ebp));
|
||||
}
|
||||
if (level) {
|
||||
reg_esp-=2;
|
||||
mem_writew(SegBase(ss)+reg_esp,(Bit16u)frame_ptr);
|
||||
}
|
||||
reg_esp-=bytes;
|
||||
} else {
|
||||
reg_sp-=2;
|
||||
mem_writew(SegBase(ss)+reg_sp,reg_bp);
|
||||
for (Bitu i=1;i<level;i++) {
|
||||
reg_bp-=2;reg_sp-=2;
|
||||
mem_writew(SegBase(ss)+reg_sp,mem_readw(SegBase(ss)+reg_bp));
|
||||
}
|
||||
if (level) {
|
||||
reg_sp-=2;
|
||||
mem_writew(SegBase(ss)+reg_sp,(Bit16u)frame_ptr);
|
||||
}
|
||||
reg_sp-=bytes;
|
||||
}
|
||||
reg_bp=frame_ptr;
|
||||
goto nextopcode;
|
||||
}
|
||||
case D_ENTERd:
|
||||
{
|
||||
Bitu bytes=Fetchw();Bitu level=Fetchb() & 0x1f;
|
||||
Bitu frame_ptr=reg_esp-4;
|
||||
if (cpu.stack.big) {
|
||||
reg_esp-=4;
|
||||
mem_writed(SegBase(ss)+reg_esp,reg_ebp);
|
||||
for (Bitu i=1;i<level;i++) {
|
||||
reg_ebp-=4;reg_esp-=4;
|
||||
mem_writed(SegBase(ss)+reg_esp,mem_readd(SegBase(ss)+reg_ebp));
|
||||
}
|
||||
if (level) {
|
||||
reg_esp-=4;
|
||||
mem_writed(SegBase(ss)+reg_esp,(Bit32u)frame_ptr);
|
||||
}
|
||||
reg_esp-=bytes;
|
||||
} else {
|
||||
reg_sp-=4;
|
||||
mem_writed(SegBase(ss)+reg_sp,reg_ebp);
|
||||
for (Bitu i=1;i<level;i++) {
|
||||
reg_bp-=4;reg_sp-=4;
|
||||
mem_writed(SegBase(ss)+reg_sp,mem_readd(SegBase(ss)+reg_bp));
|
||||
}
|
||||
if (level) {
|
||||
reg_sp-=4;
|
||||
mem_writed(SegBase(ss)+reg_sp,(Bit32u)frame_ptr);
|
||||
}
|
||||
reg_sp-=bytes;
|
||||
}
|
||||
reg_ebp=frame_ptr;
|
||||
goto nextopcode;
|
||||
}
|
||||
case D_LEAVEw:
|
||||
reg_esp&=~cpu.stack.mask;
|
||||
reg_esp|=(reg_ebp&cpu.stack.mask);
|
||||
reg_bp=Pop_16();
|
||||
goto nextopcode;
|
||||
case D_LEAVEd:
|
||||
reg_esp&=~cpu.stack.mask;
|
||||
reg_esp|=(reg_ebp&cpu.stack.mask);
|
||||
reg_ebp=Pop_32();
|
||||
goto nextopcode;
|
||||
case D_DAA:
|
||||
DAA();
|
||||
goto nextopcode;
|
||||
case D_DAS:
|
||||
DAS();
|
||||
goto nextopcode;
|
||||
case D_AAA:
|
||||
AAA();
|
||||
goto nextopcode;
|
||||
case D_AAS:
|
||||
AAS();
|
||||
goto nextopcode;
|
||||
case D_CPUID:
|
||||
CPU_CPUID();
|
||||
goto nextopcode;
|
||||
case D_HLT:
|
||||
LEAVECORE;
|
||||
CPU_HLT();
|
||||
return CBRET_NONE;
|
||||
default:
|
||||
LOG(LOG_CPU,LOG_ERROR)("LOAD:Unhandled code %d opcode %X",inst.code.load,inst.entry);
|
||||
break;
|
||||
}
|
||||
|
52
src/cpu/core_full/loadwrite.h
Normal file
52
src/cpu/core_full/loadwrite.h
Normal file
@ -0,0 +1,52 @@
|
||||
#define SaveIP() reg_eip=(Bit32u)(IPPoint-SegBase(cs));
|
||||
#define LoadIP() IPPoint=SegBase(cs)+reg_eip;
|
||||
|
||||
|
||||
static INLINE Bit8u the_Fetchb(EAPoint & loc) {
|
||||
Bit8u temp=LoadMb(loc);
|
||||
loc+=1;
|
||||
return temp;
|
||||
}
|
||||
|
||||
static INLINE Bit16u the_Fetchw(EAPoint & loc) {
|
||||
Bit16u temp=LoadMw(loc);
|
||||
loc+=2;
|
||||
return temp;
|
||||
}
|
||||
static INLINE Bit32u the_Fetchd(EAPoint & loc) {
|
||||
Bit32u temp=LoadMd(loc);
|
||||
loc+=4;
|
||||
return temp;
|
||||
}
|
||||
|
||||
#define Fetchb() the_Fetchb(IPPoint)
|
||||
#define Fetchw() the_Fetchw(IPPoint)
|
||||
#define Fetchd() the_Fetchd(IPPoint)
|
||||
|
||||
#define Fetchbs() (Bit8s)the_Fetchb(IPPoint)
|
||||
#define Fetchws() (Bit16s)the_Fetchw(IPPoint)
|
||||
#define Fetchds() (Bit32s)the_Fetchd(IPPoint)
|
||||
|
||||
|
||||
static INLINE void Push_16(Bit16u blah) {
|
||||
reg_esp-=2;
|
||||
SaveMw(SegBase(ss) + (reg_esp & cpu.stack.mask),blah);
|
||||
}
|
||||
|
||||
static INLINE void Push_32(Bit32u blah) {
|
||||
reg_esp-=4;
|
||||
SaveMd(SegBase(ss) + (reg_esp & cpu.stack.mask),blah);
|
||||
}
|
||||
|
||||
static INLINE Bit16u Pop_16(void) {
|
||||
Bit16u temp=LoadMw(SegBase(ss) + (reg_esp & cpu.stack.mask));
|
||||
reg_esp+=2;
|
||||
return temp;
|
||||
}
|
||||
|
||||
static INLINE Bit32u Pop_32(void) {
|
||||
Bit32u temp=LoadMd(SegBase(ss) + (reg_esp & cpu.stack.mask));
|
||||
reg_esp+=4;
|
||||
return temp;
|
||||
}
|
||||
|
649
src/cpu/core_full/op.h
Normal file
649
src/cpu/core_full/op.h
Normal file
@ -0,0 +1,649 @@
|
||||
/* Do the actual opcode */
|
||||
switch (inst.code.op) {
|
||||
case t_ADDb: case t_ADDw: case t_ADDd:
|
||||
flags.var1.d=inst.op1.d;
|
||||
flags.var2.d=inst.op2.d;
|
||||
inst.op1.d=flags.result.d=flags.var1.d + flags.var2.d;
|
||||
flags.type=inst.code.op;
|
||||
break;
|
||||
case t_CMPb: case t_CMPw: case t_CMPd:
|
||||
case t_SUBb: case t_SUBw: case t_SUBd:
|
||||
flags.var1.d=inst.op1.d;
|
||||
flags.var2.d=inst.op2.d;
|
||||
inst.op1.d=flags.result.d=flags.var1.d - flags.var2.d;
|
||||
flags.type=inst.code.op;
|
||||
break;
|
||||
case t_ORb: case t_ORw: case t_ORd:
|
||||
flags.var1.d=inst.op1.d;
|
||||
flags.var2.d=inst.op2.d;
|
||||
inst.op1.d=flags.result.d=flags.var1.d | flags.var2.d;
|
||||
flags.type=inst.code.op;
|
||||
break;
|
||||
case t_XORb: case t_XORw: case t_XORd:
|
||||
flags.var1.d=inst.op1.d;
|
||||
flags.var2.d=inst.op2.d;
|
||||
inst.op1.d=flags.result.d=flags.var1.d ^ flags.var2.d;
|
||||
flags.type=inst.code.op;
|
||||
break;
|
||||
case t_TESTb: case t_TESTw: case t_TESTd:
|
||||
case t_ANDb: case t_ANDw: case t_ANDd:
|
||||
flags.var1.d=inst.op1.d;
|
||||
flags.var2.d=inst.op2.d;
|
||||
inst.op1.d=flags.result.d=flags.var1.d & flags.var2.d;
|
||||
flags.type=inst.code.op;
|
||||
break;
|
||||
case t_ADCb: case t_ADCw: case t_ADCd:
|
||||
flags.oldcf=get_CF();
|
||||
flags.var1.d=inst.op1.d;
|
||||
flags.var2.d=inst.op2.d;
|
||||
inst.op1.d=flags.result.d=flags.var1.d + flags.var2.d + flags.oldcf;
|
||||
flags.type=inst.code.op;
|
||||
break;
|
||||
case t_SBBb: case t_SBBw: case t_SBBd:
|
||||
flags.oldcf=get_CF();
|
||||
flags.var1.d=inst.op1.d;
|
||||
flags.var2.d=inst.op2.d;
|
||||
inst.op1.d=flags.result.d=flags.var1.d - flags.var2.d - flags.oldcf;
|
||||
flags.type=inst.code.op;
|
||||
break;
|
||||
case t_INCb: case t_INCw: case t_INCd:
|
||||
SETFLAGBIT(CF,get_CF());
|
||||
inst.op1.d=flags.result.d=inst.op1.d+1;
|
||||
flags.type=inst.code.op;
|
||||
break;
|
||||
case t_DECb: case t_DECw: case t_DECd:
|
||||
SETFLAGBIT(CF,get_CF());
|
||||
inst.op1.d=flags.result.d=inst.op1.d-1;
|
||||
flags.type=inst.code.op;
|
||||
break;
|
||||
/* Using the instructions.h defines */
|
||||
case t_ROLb:
|
||||
ROLB(inst.op1.b,inst.op2.b,LoadD,SaveD);
|
||||
break;
|
||||
case t_ROLw:
|
||||
ROLW(inst.op1.w,inst.op2.b,LoadD,SaveD);
|
||||
break;
|
||||
case t_ROLd:
|
||||
ROLD(inst.op1.d,inst.op2.b,LoadD,SaveD);
|
||||
break;
|
||||
|
||||
case t_RORb:
|
||||
RORB(inst.op1.b,inst.op2.b,LoadD,SaveD);
|
||||
break;
|
||||
case t_RORw:
|
||||
RORW(inst.op1.w,inst.op2.b,LoadD,SaveD);
|
||||
break;
|
||||
case t_RORd:
|
||||
RORD(inst.op1.d,inst.op2.b,LoadD,SaveD);
|
||||
break;
|
||||
|
||||
case t_RCLb:
|
||||
RCLB(inst.op1.b,inst.op2.b,LoadD,SaveD);
|
||||
break;
|
||||
case t_RCLw:
|
||||
RCLW(inst.op1.w,inst.op2.b,LoadD,SaveD);
|
||||
break;
|
||||
case t_RCLd:
|
||||
RCLD(inst.op1.d,inst.op2.b,LoadD,SaveD);
|
||||
break;
|
||||
|
||||
case t_RCRb:
|
||||
RCRB(inst.op1.b,inst.op2.b,LoadD,SaveD);
|
||||
break;
|
||||
case t_RCRw:
|
||||
RCRW(inst.op1.w,inst.op2.b,LoadD,SaveD);
|
||||
break;
|
||||
case t_RCRd:
|
||||
RCRD(inst.op1.d,inst.op2.b,LoadD,SaveD);
|
||||
break;
|
||||
|
||||
case t_SHLb:
|
||||
SHLB(inst.op1.b,inst.op2.b,LoadD,SaveD);
|
||||
break;
|
||||
case t_SHLw:
|
||||
SHLW(inst.op1.w,inst.op2.b,LoadD,SaveD);
|
||||
break;
|
||||
case t_SHLd:
|
||||
SHLD(inst.op1.d,inst.op2.b,LoadD,SaveD);
|
||||
break;
|
||||
|
||||
case t_SHRb:
|
||||
SHRB(inst.op1.b,inst.op2.b,LoadD,SaveD);
|
||||
break;
|
||||
case t_SHRw:
|
||||
SHRW(inst.op1.w,inst.op2.b,LoadD,SaveD);
|
||||
break;
|
||||
case t_SHRd:
|
||||
SHRD(inst.op1.d,inst.op2.b,LoadD,SaveD);
|
||||
break;
|
||||
|
||||
case t_SARb:
|
||||
SARB(inst.op1.b,inst.op2.b,LoadD,SaveD);
|
||||
break;
|
||||
case t_SARw:
|
||||
SARW(inst.op1.w,inst.op2.b,LoadD,SaveD);
|
||||
break;
|
||||
case t_SARd:
|
||||
SARD(inst.op1.d,inst.op2.b,LoadD,SaveD);
|
||||
break;
|
||||
|
||||
case O_DSHLw:
|
||||
{
|
||||
DSHLW(inst.op1.w,inst.op2.w,inst.imm.b,LoadD,SaveD);
|
||||
break;
|
||||
}
|
||||
case O_DSHRw:
|
||||
{
|
||||
DSHRW(inst.op1.w,inst.op2.w,inst.imm.b,LoadD,SaveD);
|
||||
break;
|
||||
}
|
||||
case O_DSHLd:
|
||||
{
|
||||
DSHLD(inst.op1.d,inst.op2.d,inst.imm.b,LoadD,SaveD);
|
||||
break;
|
||||
}
|
||||
case O_DSHRd:
|
||||
{
|
||||
DSHRD(inst.op1.d,inst.op2.d,inst.imm.b,LoadD,SaveD);
|
||||
break;
|
||||
}
|
||||
|
||||
case t_NEGb:
|
||||
flags.var1.b=inst.op1.b;
|
||||
inst.op1.b=flags.result.b=0-inst.op1.b;
|
||||
flags.type=t_NEGb;
|
||||
break;
|
||||
case t_NEGw:
|
||||
flags.var1.w=inst.op1.w;
|
||||
inst.op1.w=flags.result.w=0-inst.op1.w;
|
||||
flags.type=t_NEGw;
|
||||
break;
|
||||
case t_NEGd:
|
||||
flags.var1.d=inst.op1.d;
|
||||
inst.op1.d=flags.result.d=0-inst.op1.d;
|
||||
flags.type=t_NEGd;
|
||||
break;
|
||||
|
||||
case O_NOT:
|
||||
inst.op1.d=~inst.op1.d;
|
||||
break;
|
||||
|
||||
/* Special instructions */
|
||||
case O_IMULRw:
|
||||
DIMULW(inst.op1.ws,inst.op1.ws,inst.op2.ws,LoadD,SaveD);
|
||||
break;
|
||||
case O_IMULRd:
|
||||
DIMULD(inst.op1.ds,inst.op1.ds,inst.op2.ds,LoadD,SaveD);
|
||||
break;
|
||||
case O_MULb:
|
||||
MULB(inst.op1.b,LoadD,0);
|
||||
goto nextopcode;
|
||||
case O_MULw:
|
||||
MULW(inst.op1.w,LoadD,0);
|
||||
goto nextopcode;
|
||||
case O_MULd:
|
||||
MULD(inst.op1.d,LoadD,0);
|
||||
goto nextopcode;
|
||||
case O_IMULb:
|
||||
IMULB(inst.op1.b,LoadD,0);
|
||||
goto nextopcode;
|
||||
case O_IMULw:
|
||||
IMULW(inst.op1.w,LoadD,0);
|
||||
goto nextopcode;
|
||||
case O_IMULd:
|
||||
IMULD(inst.op1.d,LoadD,0);
|
||||
goto nextopcode;
|
||||
case O_DIVb:
|
||||
DIVB(inst.op1.b,LoadD,0);
|
||||
goto nextopcode;
|
||||
case O_DIVw:
|
||||
DIVW(inst.op1.w,LoadD,0);
|
||||
goto nextopcode;
|
||||
case O_DIVd:
|
||||
DIVD(inst.op1.d,LoadD,0);
|
||||
goto nextopcode;
|
||||
case O_IDIVb:
|
||||
IDIVB(inst.op1.b,LoadD,0);
|
||||
goto nextopcode;
|
||||
case O_IDIVw:
|
||||
IDIVW(inst.op1.w,LoadD,0);
|
||||
goto nextopcode;
|
||||
case O_IDIVd:
|
||||
IDIVD(inst.op1.d,LoadD,0);
|
||||
goto nextopcode;
|
||||
case O_AAM:
|
||||
AAM(inst.op1.b);
|
||||
goto nextopcode;
|
||||
case O_AAD:
|
||||
AAD(inst.op1.b);
|
||||
goto nextopcode;
|
||||
|
||||
case O_C_O: inst.cond=get_OF(); break;
|
||||
case O_C_NO: inst.cond=!get_OF(); break;
|
||||
case O_C_B: inst.cond=get_CF(); break;
|
||||
case O_C_NB: inst.cond=!get_CF(); break;
|
||||
case O_C_Z: inst.cond=get_ZF(); break;
|
||||
case O_C_NZ: inst.cond=!get_ZF(); break;
|
||||
case O_C_BE: inst.cond=get_CF() || get_ZF(); break;
|
||||
case O_C_NBE: inst.cond=!get_CF() && !get_ZF(); break;
|
||||
case O_C_S: inst.cond=get_SF(); break;
|
||||
case O_C_NS: inst.cond=!get_SF(); break;
|
||||
case O_C_P: inst.cond=get_PF(); break;
|
||||
case O_C_NP: inst.cond=!get_PF(); break;
|
||||
case O_C_L: inst.cond=get_SF() != get_OF(); break;
|
||||
case O_C_NL: inst.cond=get_SF() == get_OF(); break;
|
||||
case O_C_LE: inst.cond=get_ZF() || (get_SF() != get_OF()); break;
|
||||
case O_C_NLE: inst.cond=(get_SF() == get_OF()) && !get_ZF(); break;
|
||||
|
||||
case O_ALOP:
|
||||
reg_al=LoadMb(inst.rm_eaa);
|
||||
goto nextopcode;
|
||||
case O_AXOP:
|
||||
reg_ax=LoadMw(inst.rm_eaa);
|
||||
goto nextopcode;
|
||||
case O_EAXOP:
|
||||
reg_eax=LoadMd(inst.rm_eaa);
|
||||
goto nextopcode;
|
||||
case O_OPAL:
|
||||
SaveMb(inst.rm_eaa,reg_al);
|
||||
goto nextopcode;
|
||||
case O_OPAX:
|
||||
SaveMw(inst.rm_eaa,reg_ax);
|
||||
goto nextopcode;
|
||||
case O_OPEAX:
|
||||
SaveMd(inst.rm_eaa,reg_eax);
|
||||
goto nextopcode;
|
||||
case O_SEGDS:
|
||||
inst.code.extra=ds;
|
||||
break;
|
||||
case O_SEGES:
|
||||
inst.code.extra=es;
|
||||
break;
|
||||
case O_SEGFS:
|
||||
inst.code.extra=fs;
|
||||
break;
|
||||
case O_SEGGS:
|
||||
inst.code.extra=gs;
|
||||
break;
|
||||
case O_SEGSS:
|
||||
inst.code.extra=ss;
|
||||
break;
|
||||
|
||||
case O_LOOP:
|
||||
if (inst.prefix & PREFIX_ADDR) {
|
||||
if (--reg_ecx) break;
|
||||
} else {
|
||||
if (--reg_cx) break;
|
||||
}
|
||||
goto nextopcode;
|
||||
case O_LOOPZ:
|
||||
if (inst.prefix & PREFIX_ADDR) {
|
||||
if (--reg_ecx && get_ZF()) break;
|
||||
} else {
|
||||
if (--reg_cx && get_ZF()) break;
|
||||
}
|
||||
goto nextopcode;
|
||||
case O_LOOPNZ:
|
||||
if (inst.prefix & PREFIX_ADDR) {
|
||||
if (--reg_ecx && !get_ZF()) break;
|
||||
} else {
|
||||
if (--reg_cx && !get_ZF()) break;
|
||||
}
|
||||
goto nextopcode;
|
||||
case O_JCXZ:
|
||||
if (inst.prefix & PREFIX_ADDR) {
|
||||
if (reg_ecx) goto nextopcode;
|
||||
} else {
|
||||
if (reg_cx) goto nextopcode;
|
||||
}
|
||||
break;
|
||||
case O_XCHG_AX:
|
||||
{
|
||||
Bit16u temp=reg_ax;
|
||||
reg_ax=inst.op1.w;
|
||||
inst.op1.w=temp;
|
||||
break;
|
||||
}
|
||||
case O_XCHG_EAX:
|
||||
{
|
||||
Bit32u temp=reg_eax;
|
||||
reg_eax=inst.op1.d;
|
||||
inst.op1.d=temp;
|
||||
break;
|
||||
}
|
||||
case O_CALLNw:
|
||||
SaveIP();
|
||||
Push_16(reg_ip);
|
||||
break;
|
||||
case O_CALLNd:
|
||||
SaveIP();
|
||||
Push_32(reg_eip);
|
||||
break;
|
||||
case O_CALLFw:
|
||||
SaveIP();
|
||||
if (!CPU_CALL(false,inst.op2.d,inst.op1.d)) {
|
||||
FillFlags();
|
||||
return CBRET_NONE;
|
||||
}
|
||||
LoadIP();
|
||||
goto nextopcode;
|
||||
case O_CALLFd:
|
||||
SaveIP();
|
||||
if (!CPU_CALL(true,inst.op2.d,inst.op1.d)) {
|
||||
FillFlags();
|
||||
return CBRET_NONE;
|
||||
}
|
||||
LoadIP();
|
||||
goto nextopcode;
|
||||
case O_JMPFw:
|
||||
if (!CPU_JMP(false,inst.op2.d,inst.op1.d)){
|
||||
FillFlags();
|
||||
return CBRET_NONE;
|
||||
}
|
||||
LoadIP();
|
||||
goto nextopcode;
|
||||
case O_JMPFd:
|
||||
if (!CPU_JMP(true,inst.op2.d,inst.op1.d)) {
|
||||
FillFlags();
|
||||
return CBRET_NONE;
|
||||
}
|
||||
LoadIP();
|
||||
goto nextopcode;
|
||||
|
||||
case O_INT:
|
||||
LEAVECORE;
|
||||
#if C_DEBUG
|
||||
if (((inst.entry & 0xFF)==0xcc) && DEBUG_Breakpoint()) return debugCallback;
|
||||
else if (DEBUG_IntBreakpoint(inst.op1.b)) return debugCallback;
|
||||
#endif
|
||||
if (!Interrupt(inst.op1.b)) return CBRET_NONE;
|
||||
LoadIP();
|
||||
break;
|
||||
case O_INb:
|
||||
reg_al=IO_Read(inst.op1.d);
|
||||
goto nextopcode;
|
||||
case O_INw:
|
||||
reg_ax=IO_Read(inst.op1.d) | (IO_Read(inst.op1.d+1) << 8);
|
||||
goto nextopcode;
|
||||
case O_INd:
|
||||
reg_eax=IO_Read(inst.op1.d) | (IO_Read(inst.op1.d+1) << 8) | (IO_Read(inst.op1.d+2) << 16) | (IO_Read(inst.op1.d+3) << 24);
|
||||
goto nextopcode;
|
||||
case O_OUTb:
|
||||
IO_Write(inst.op1.d,reg_al);
|
||||
goto nextopcode;
|
||||
case O_OUTw:
|
||||
IO_Write(inst.op1.d+0,(Bit8u)reg_ax);
|
||||
IO_Write(inst.op1.d+1,(Bit8u)(reg_ax >> 8));
|
||||
goto nextopcode;
|
||||
case O_OUTd:
|
||||
IO_Write(inst.op1.d+0,(Bit8u)reg_eax);
|
||||
IO_Write(inst.op1.d+1,(Bit8u)(reg_eax >> 8));
|
||||
IO_Write(inst.op1.d+2,(Bit8u)(reg_eax >> 16));
|
||||
IO_Write(inst.op1.d+3,(Bit8u)(reg_eax >> 24));
|
||||
goto nextopcode;
|
||||
case O_CBACK:
|
||||
LEAVECORE;
|
||||
return inst.op1.d;
|
||||
case O_GRP6w:
|
||||
case O_GRP6d:
|
||||
switch (inst.rm_index) {
|
||||
case 0x00: /* SLDT */
|
||||
{
|
||||
Bitu selector;
|
||||
CPU_SLDT(selector);
|
||||
inst.op1.d=(Bit32u)selector;
|
||||
}
|
||||
break;
|
||||
case 0x01: /* STR */
|
||||
{
|
||||
Bitu selector;
|
||||
CPU_STR(selector);
|
||||
inst.op1.d=(Bit32u)selector;
|
||||
}
|
||||
break;
|
||||
case 0x02: /* LLDT */
|
||||
CPU_LLDT(inst.op1.d);
|
||||
goto nextopcode; /* Else value will saved */
|
||||
case 0x03: /* LTR */
|
||||
CPU_LTR(inst.op1.d);
|
||||
goto nextopcode; /* Else value will saved */
|
||||
case 0x04: /* VERR */
|
||||
FillFlags();
|
||||
CPU_VERR(inst.op1.d);
|
||||
goto nextopcode; /* Else value will saved */
|
||||
case 0x05: /* VERW */
|
||||
FillFlags();
|
||||
CPU_VERW(inst.op1.d);
|
||||
goto nextopcode; /* Else value will saved */
|
||||
default:
|
||||
LOG(LOG_CPU,LOG_ERROR)("Group 6 Illegal subfunction %X",inst.rm_index);
|
||||
}
|
||||
break;
|
||||
case O_GRP7w:
|
||||
case O_GRP7d:
|
||||
switch (inst.rm_index) {
|
||||
case 0: /* SGDT */
|
||||
{
|
||||
Bitu limit,base;
|
||||
CPU_SGDT(limit,base);
|
||||
SaveMw(inst.rm_eaa,limit);
|
||||
SaveMd(inst.rm_eaa+2,base);
|
||||
goto nextopcode;
|
||||
}
|
||||
case 1: /* SIDT */
|
||||
{
|
||||
Bitu limit,base;
|
||||
CPU_SIDT(limit,base);
|
||||
SaveMw(inst.rm_eaa,limit);
|
||||
SaveMd(inst.rm_eaa+2,base);
|
||||
goto nextopcode;
|
||||
}
|
||||
case 2: /* LGDT */
|
||||
CPU_LGDT(LoadMw(inst.rm_eaa),LoadMd(inst.rm_eaa+2)&((inst.code.op == O_GRP7w) ? 0xFFFFFF : 0xFFFFFFFF));
|
||||
goto nextopcode;
|
||||
case 3: /* LIDT */
|
||||
CPU_LIDT(LoadMw(inst.rm_eaa),LoadMd(inst.rm_eaa+2)&((inst.code.op == O_GRP7w) ? 0xFFFFFF : 0xFFFFFFFF));
|
||||
goto nextopcode;
|
||||
case 4: /* SMSW */
|
||||
{
|
||||
Bitu word;CPU_SMSW(word);
|
||||
inst.op1.d=word;
|
||||
break;
|
||||
}
|
||||
case 6: /* LMSW */
|
||||
FillFlags();
|
||||
CPU_LMSW(inst.op1.w);
|
||||
goto nextopcode;
|
||||
default:
|
||||
LOG(LOG_CPU,LOG_ERROR)("Group 7 Illegal subfunction %X",inst.rm_index);
|
||||
}
|
||||
break;
|
||||
case O_M_Cd_Rd:
|
||||
CPU_SET_CRX(inst.rm_index,inst.op1.d);
|
||||
break;
|
||||
case O_M_Rd_Cd:
|
||||
inst.op1.d=CPU_GET_CRX(inst.rm_index);
|
||||
break;
|
||||
case O_LAR:
|
||||
{
|
||||
FillFlags();
|
||||
Bitu ar;CPU_LAR(inst.op1.d,ar);
|
||||
inst.op1.d=(Bit32u)ar;
|
||||
}
|
||||
break;
|
||||
case O_LSL:
|
||||
{
|
||||
FillFlags();
|
||||
Bitu limit;CPU_LSL(inst.op1.d,limit);
|
||||
inst.op1.d=(Bit32u)limit;
|
||||
}
|
||||
break;
|
||||
case O_ARPL:
|
||||
{
|
||||
FillFlags();
|
||||
Bitu new_sel=inst.op1.d;
|
||||
CPU_ARPL(new_sel,inst.op2.d);
|
||||
inst.op1.d=(Bit32u)new_sel;
|
||||
}
|
||||
break;
|
||||
case O_BSFw:
|
||||
{
|
||||
FillFlags();
|
||||
if (!inst.op1.w) {
|
||||
SETFLAGBIT(ZF,true);
|
||||
} else {
|
||||
Bitu count=0;
|
||||
while (count<16) {
|
||||
if ((inst.op1.w>>count) & 1) break;
|
||||
count++;
|
||||
}
|
||||
inst.op1.d=count;
|
||||
SETFLAGBIT(ZF,false);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case O_BSFd:
|
||||
{
|
||||
FillFlags();
|
||||
if (!inst.op1.d) {
|
||||
SETFLAGBIT(ZF,true);
|
||||
} else {
|
||||
Bitu count=0;
|
||||
while (count<32) {
|
||||
if ((inst.op1.d>>count) & 1) break;
|
||||
count++;
|
||||
}
|
||||
inst.op1.d=count;
|
||||
SETFLAGBIT(ZF,false);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case O_BSRw:
|
||||
{
|
||||
FillFlags();
|
||||
if (!inst.op1.w) {
|
||||
SETFLAGBIT(ZF,true);
|
||||
} else {
|
||||
Bits count=15;
|
||||
while (count>0) {
|
||||
if ((inst.op1.w>>count) & 1) break;
|
||||
count--;
|
||||
}
|
||||
inst.op1.d=count;
|
||||
SETFLAGBIT(ZF,false);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case O_BSRd:
|
||||
{
|
||||
FillFlags();
|
||||
if (!inst.op1.d) {
|
||||
SETFLAGBIT(ZF,true);
|
||||
} else {
|
||||
Bits count=31;
|
||||
while (count>0) {
|
||||
if ((inst.op1.d>>count) & 1) break;
|
||||
count--;
|
||||
}
|
||||
inst.op1.d=count;
|
||||
SETFLAGBIT(ZF,false);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case O_BTw:
|
||||
case O_BTSw:
|
||||
case O_BTCw:
|
||||
case O_BTRw:
|
||||
{
|
||||
Bitu val;PhysPt read;
|
||||
Bitu mask=1 << (inst.op1.d & 15);
|
||||
FillFlags();
|
||||
if (inst.rm<0xc0) {
|
||||
read=inst.rm_eaa;//+2*(inst.op1.d / 16);
|
||||
val=mem_readw(read);
|
||||
} else {
|
||||
val=reg_16(inst.rm_eai);
|
||||
}
|
||||
SETFLAGBIT(CF,(val&mask)>0);
|
||||
if (inst.code.op==O_BTSw) val|=mask;
|
||||
if (inst.code.op==O_BTRw) val&=~mask;
|
||||
if (inst.code.op==O_BTCw) val^=mask;
|
||||
if (inst.code.op==O_BTw) break;
|
||||
if (inst.rm<0xc0) {
|
||||
mem_writew(read,val);
|
||||
} else {
|
||||
reg_16(inst.rm_eai)=val;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case O_BTd:
|
||||
case O_BTSd:
|
||||
case O_BTCd:
|
||||
case O_BTRd:
|
||||
{
|
||||
Bitu val;PhysPt read;
|
||||
Bitu mask=1 << (inst.op1.d & 31);
|
||||
FillFlags();
|
||||
if (inst.rm<0xc0) {
|
||||
read=inst.rm_eaa;//+4*(inst.op1.d / 32);
|
||||
val=mem_readd(read);
|
||||
} else {
|
||||
val=reg_32(inst.rm_eai);
|
||||
}
|
||||
SETFLAGBIT(CF,(val&mask)>0);
|
||||
if (inst.code.op==O_BTSd) val|=mask;
|
||||
if (inst.code.op==O_BTRd) val&=~mask;
|
||||
if (inst.code.op==O_BTCd) val^=mask;
|
||||
if (inst.code.op==O_BTd) break;
|
||||
if (inst.rm<0xc0) {
|
||||
mem_writed(read,val);
|
||||
} else {
|
||||
reg_32(inst.rm_eai)=val;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case O_BSWAP:
|
||||
BSWAP(inst.op1.d);
|
||||
break;
|
||||
case O_FPU:
|
||||
#if C_FPU
|
||||
switch (((inst.rm>=0xc0) << 3) | inst.code.save) {
|
||||
case 0x00: FPU_ESC0_EA(inst.rm,inst.rm_eaa);break;
|
||||
case 0x01: FPU_ESC1_EA(inst.rm,inst.rm_eaa);break;
|
||||
case 0x02: FPU_ESC2_EA(inst.rm,inst.rm_eaa);break;
|
||||
case 0x03: FPU_ESC3_EA(inst.rm,inst.rm_eaa);break;
|
||||
case 0x04: FPU_ESC4_EA(inst.rm,inst.rm_eaa);break;
|
||||
case 0x05: FPU_ESC5_EA(inst.rm,inst.rm_eaa);break;
|
||||
case 0x06: FPU_ESC6_EA(inst.rm,inst.rm_eaa);break;
|
||||
case 0x07: FPU_ESC7_EA(inst.rm,inst.rm_eaa);break;
|
||||
|
||||
case 0x08: FPU_ESC0_Normal(inst.rm);break;
|
||||
case 0x09: FPU_ESC1_Normal(inst.rm);break;
|
||||
case 0x0a: FPU_ESC2_Normal(inst.rm);break;
|
||||
case 0x0b: FPU_ESC3_Normal(inst.rm);break;
|
||||
case 0x0c: FPU_ESC4_Normal(inst.rm);break;
|
||||
case 0x0d: FPU_ESC5_Normal(inst.rm);break;
|
||||
case 0x0e: FPU_ESC6_Normal(inst.rm);break;
|
||||
case 0x0f: FPU_ESC7_Normal(inst.rm);break;
|
||||
}
|
||||
goto nextopcode;
|
||||
#else
|
||||
LOG(LOG_CPU,LOG_ERROR)("Unhandled FPU ESCAPE %d",inst.code.save);
|
||||
goto nextopcode;
|
||||
#endif
|
||||
case O_BOUNDw:
|
||||
{
|
||||
Bit16s bound_min, bound_max;
|
||||
bound_min=LoadMw(inst.rm_eaa);
|
||||
bound_max=LoadMw(inst.rm_eaa+2);
|
||||
if ( (((Bit16s)inst.op1.w) < bound_min) || (((Bit16s)inst.op1.w) > bound_max) ) {
|
||||
EXCEPTION(5);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
break;
|
||||
default:
|
||||
LOG(LOG_CPU,LOG_ERROR)("OP:Unhandled code %d entry %X",inst.code.op,inst.entry);
|
||||
|
||||
}
|
813
src/cpu/core_full/optable.h
Normal file
813
src/cpu/core_full/optable.h
Normal file
@ -0,0 +1,813 @@
|
||||
/* Big ass opcode table normal,double, 66 normal, 66 double */
|
||||
static OpCode OpCodeTable[1024]={
|
||||
/* 0x00 - 0x07 */
|
||||
{L_MODRM ,t_ADDb ,S_Eb ,M_EbGb },{L_MODRM ,t_ADDw ,S_Ew ,M_EwGw },
|
||||
{L_MODRM ,t_ADDb ,S_Gb ,M_GbEb },{L_MODRM ,t_ADDw ,S_Gw ,M_GwEw },
|
||||
{L_REGbIb ,t_ADDb ,S_REGb ,REGI_AL },{L_REGwIw ,t_ADDw ,S_REGw ,REGI_AX },
|
||||
{L_SEG ,0 ,S_PUSHw,es },{L_POPw ,0 ,S_SEGI ,es },
|
||||
/* 0x08 - 0x0f */
|
||||
{L_MODRM ,t_ORb ,S_Eb ,M_EbGb },{L_MODRM ,t_ORw ,S_Ew ,M_EwGw },
|
||||
{L_MODRM ,t_ORb ,S_Gb ,M_GbEb },{L_MODRM ,t_ORw ,S_Gw ,M_GwEw },
|
||||
{L_REGbIb ,t_ORb ,S_REGb ,REGI_AL },{L_REGwIw ,t_ORw ,S_REGw ,REGI_AX },
|
||||
{L_SEG ,0 ,S_PUSHw,cs },{L_DOUBLE ,0 ,0 ,0 },
|
||||
|
||||
/* 0x10 - 0x17 */
|
||||
{L_MODRM ,t_ADCb ,S_Eb ,M_EbGb },{L_MODRM ,t_ADCw ,S_Ew ,M_EwGw },
|
||||
{L_MODRM ,t_ADCb ,S_Gb ,M_GbEb },{L_MODRM ,t_ADCw ,S_Gw ,M_GwEw },
|
||||
{L_REGbIb ,t_ADCb ,S_REGb ,REGI_AL },{L_REGwIw ,t_ADCw ,S_REGw ,REGI_AX },
|
||||
{L_SEG ,0 ,S_PUSHw,ss },{L_POPw ,0 ,S_SEGI ,ss },
|
||||
/* 0x18 - 0x1f */
|
||||
{L_MODRM ,t_SBBb ,S_Eb ,M_EbGb },{L_MODRM ,t_SBBw ,S_Ew ,M_EwGw },
|
||||
{L_MODRM ,t_SBBb ,S_Gb ,M_GbEb },{L_MODRM ,t_SBBw ,S_Gw ,M_GwEw },
|
||||
{L_REGbIb ,t_SBBb ,S_REGb ,REGI_AL },{L_REGwIw ,t_SBBw ,S_REGw ,REGI_AX },
|
||||
{L_SEG ,0 ,S_PUSHw,ds },{L_POPw ,0 ,S_SEGI ,ds },
|
||||
|
||||
/* 0x20 - 0x27 */
|
||||
{L_MODRM ,t_ANDb ,S_Eb ,M_EbGb },{L_MODRM ,t_ANDw ,S_Ew ,M_EwGw },
|
||||
{L_MODRM ,t_ANDb ,S_Gb ,M_GbEb },{L_MODRM ,t_ANDw ,S_Gw ,M_GwEw },
|
||||
{L_REGbIb ,t_ANDb ,S_REGb ,REGI_AL },{L_REGwIw ,t_ANDw ,S_REGw ,REGI_AX },
|
||||
{L_PRESEG ,0 ,0 ,es },{D_DAA ,0 ,0 ,0 },
|
||||
/* 0x28 - 0x2f */
|
||||
{L_MODRM ,t_SUBb ,S_Eb ,M_EbGb },{L_MODRM ,t_SUBw ,S_Ew ,M_EwGw },
|
||||
{L_MODRM ,t_SUBb ,S_Gb ,M_GbEb },{L_MODRM ,t_SUBw ,S_Gw ,M_GwEw },
|
||||
{L_REGbIb ,t_SUBb ,S_REGb ,REGI_AL },{L_REGwIw ,t_SUBw ,S_REGw ,REGI_AX },
|
||||
{L_PRESEG ,0 ,0 ,cs },{D_DAS ,0 ,0 ,0 },
|
||||
|
||||
/* 0x30 - 0x37 */
|
||||
{L_MODRM ,t_XORb ,S_Eb ,M_EbGb },{L_MODRM ,t_XORw ,S_Ew ,M_EwGw },
|
||||
{L_MODRM ,t_XORb ,S_Gb ,M_GbEb },{L_MODRM ,t_XORw ,S_Gw ,M_GwEw },
|
||||
{L_REGbIb ,t_XORb ,S_REGb ,REGI_AL },{L_REGwIw ,t_XORw ,S_REGw ,REGI_AX },
|
||||
{L_PRESEG ,0 ,0 ,ss },{D_AAA ,0 ,0 ,0 },
|
||||
/* 0x38 - 0x3f */
|
||||
{L_MODRM ,t_CMPb ,0 ,M_EbGb },{L_MODRM ,t_CMPw ,0 ,M_EwGw },
|
||||
{L_MODRM ,t_CMPb ,0 ,M_GbEb },{L_MODRM ,t_CMPw ,0 ,M_GwEw },
|
||||
{L_REGbIb ,t_CMPb ,0 ,REGI_AL },{L_REGwIw ,t_CMPw ,0 ,REGI_AX },
|
||||
{L_PRESEG ,0 ,0 ,ds },{D_AAS ,0 ,0 ,0 },
|
||||
|
||||
/* 0x40 - 0x47 */
|
||||
{L_REGw ,t_INCw ,S_REGw ,REGI_AX},{L_REGw ,t_INCw ,S_REGw ,REGI_CX},
|
||||
{L_REGw ,t_INCw ,S_REGw ,REGI_DX},{L_REGw ,t_INCw ,S_REGw ,REGI_BX},
|
||||
{L_REGw ,t_INCw ,S_REGw ,REGI_SP},{L_REGw ,t_INCw ,S_REGw ,REGI_BP},
|
||||
{L_REGw ,t_INCw ,S_REGw ,REGI_SI},{L_REGw ,t_INCw ,S_REGw ,REGI_DI},
|
||||
/* 0x48 - 0x4f */
|
||||
{L_REGw ,t_DECw ,S_REGw ,REGI_AX},{L_REGw ,t_DECw ,S_REGw ,REGI_CX},
|
||||
{L_REGw ,t_DECw ,S_REGw ,REGI_DX},{L_REGw ,t_DECw ,S_REGw ,REGI_BX},
|
||||
{L_REGw ,t_DECw ,S_REGw ,REGI_SP},{L_REGw ,t_DECw ,S_REGw ,REGI_BP},
|
||||
{L_REGw ,t_DECw ,S_REGw ,REGI_SI},{L_REGw ,t_DECw ,S_REGw ,REGI_DI},
|
||||
|
||||
/* 0x50 - 0x57 */
|
||||
{L_REGw ,0 ,S_PUSHw,REGI_AX},{L_REGw ,0 ,S_PUSHw,REGI_CX},
|
||||
{L_REGw ,0 ,S_PUSHw,REGI_DX},{L_REGw ,0 ,S_PUSHw,REGI_BX},
|
||||
{L_REGw ,0 ,S_PUSHw,REGI_SP},{L_REGw ,0 ,S_PUSHw,REGI_BP},
|
||||
{L_REGw ,0 ,S_PUSHw,REGI_SI},{L_REGw ,0 ,S_PUSHw,REGI_DI},
|
||||
/* 0x58 - 0x5f */
|
||||
{L_POPw ,0 ,S_REGw ,REGI_AX},{L_POPw ,0 ,S_REGw ,REGI_CX},
|
||||
{L_POPw ,0 ,S_REGw ,REGI_DX},{L_POPw ,0 ,S_REGw ,REGI_BX},
|
||||
{L_POPw ,0 ,S_REGw ,REGI_SP},{L_POPw ,0 ,S_REGw ,REGI_BP},
|
||||
{L_POPw ,0 ,S_REGw ,REGI_SI},{L_POPw ,0 ,S_REGw ,REGI_DI},
|
||||
|
||||
|
||||
/* 0x60 - 0x67 */
|
||||
{D_PUSHAw ,0 ,0 ,0 },{D_POPAw ,0 ,0 ,0 },
|
||||
{L_MODRM ,O_BOUNDw ,0 ,M_Gw },{L_MODRM ,O_ARPL ,S_Ew ,M_EwGw },
|
||||
{L_PRESEG ,0 ,0 ,fs },{L_PRESEG ,0 ,0 ,gs },
|
||||
{L_PREOP ,0 ,0 ,0 },{L_PREADD ,0 ,0 ,0 },
|
||||
/* 0x68 - 0x6f */
|
||||
{L_Iw ,0 ,S_PUSHw,0 },{L_MODRM ,O_IMULRw ,S_Gw ,M_EwxIwx},
|
||||
{L_Ibx ,0 ,S_PUSHw,0 },{L_MODRM ,O_IMULRw ,S_Gw ,M_EwxIbx},
|
||||
{L_STRING ,R_INSB ,0 ,0 },{L_STRING ,R_INSW ,0 ,0 },
|
||||
{L_STRING ,R_OUTSB ,0 ,0 },{L_STRING ,R_OUTSW ,0 ,0 },
|
||||
|
||||
|
||||
/* 0x70 - 0x77 */
|
||||
{L_Ibx ,O_C_O ,S_C_AIPw,0 },{L_Ibx ,O_C_NO ,S_C_AIPw,0 },
|
||||
{L_Ibx ,O_C_B ,S_C_AIPw,0 },{L_Ibx ,O_C_NB ,S_C_AIPw,0 },
|
||||
{L_Ibx ,O_C_Z ,S_C_AIPw,0 },{L_Ibx ,O_C_NZ ,S_C_AIPw,0 },
|
||||
{L_Ibx ,O_C_BE ,S_C_AIPw,0 },{L_Ibx ,O_C_NBE ,S_C_AIPw,0 },
|
||||
/* 0x78 - 0x7f */
|
||||
{L_Ibx ,O_C_S ,S_C_AIPw,0 },{L_Ibx ,O_C_NS ,S_C_AIPw,0 },
|
||||
{L_Ibx ,O_C_P ,S_C_AIPw,0 },{L_Ibx ,O_C_NP ,S_C_AIPw,0 },
|
||||
{L_Ibx ,O_C_L ,S_C_AIPw,0 },{L_Ibx ,O_C_NL ,S_C_AIPw,0 },
|
||||
{L_Ibx ,O_C_LE ,S_C_AIPw,0 },{L_Ibx ,O_C_NLE ,S_C_AIPw,0 },
|
||||
|
||||
|
||||
/* 0x80 - 0x87 */
|
||||
{L_MODRM ,0 ,0 ,M_GRP },{L_MODRM ,1 ,0 ,M_GRP },
|
||||
{L_MODRM ,0 ,0 ,M_GRP },{L_MODRM ,3 ,0 ,M_GRP },
|
||||
{L_MODRM ,t_TESTb ,0 ,M_EbGb },{L_MODRM ,t_TESTw ,0 ,M_EwGw },
|
||||
{L_MODRM ,0 ,S_EbGb ,M_GbEb },{L_MODRM ,0 ,S_EwGw ,M_GwEw },
|
||||
/* 0x88 - 0x8f */
|
||||
{L_MODRM ,0 ,S_Eb ,M_Gb },{L_MODRM ,0 ,S_Ew ,M_Gw },
|
||||
{L_MODRM ,0 ,S_Gb ,M_Eb },{L_MODRM ,0 ,S_Gw ,M_Ew },
|
||||
{L_MODRM ,0 ,S_Ew ,M_SEG },{L_MODRM ,0 ,S_Gw ,M_EA },
|
||||
{L_MODRM ,0 ,S_SEGm ,M_Ew },{L_MODRM ,0 ,S_Ew ,M_POPw },
|
||||
|
||||
/* 0x90 - 0x97 */
|
||||
{D_NOP ,0 ,0 ,0 },{L_REGw ,O_XCHG_AX ,S_REGw ,REGI_CX},
|
||||
{L_REGw ,O_XCHG_AX ,S_REGw ,REGI_DX},{L_REGw ,O_XCHG_AX ,S_REGw ,REGI_BX},
|
||||
{L_REGw ,O_XCHG_AX ,S_REGw ,REGI_SP},{L_REGw ,O_XCHG_AX ,S_REGw ,REGI_BP},
|
||||
{L_REGw ,O_XCHG_AX ,S_REGw ,REGI_SI},{L_REGw ,O_XCHG_AX ,S_REGw ,REGI_DI},
|
||||
/* 0x98 - 0x9f */
|
||||
{D_CBW ,0 ,0 ,0 },{D_CWD ,0 ,0 ,0 },
|
||||
{L_Ifw ,O_CALLFw ,0 ,0 },{D_WAIT ,0 ,0 ,0 },
|
||||
{L_FLG ,0 ,S_PUSHw,0 },{L_POPw ,0 ,S_FLGw ,0 },
|
||||
{L_REGb ,0 ,S_FLGb ,REGI_AH},{L_FLG ,0 ,S_REGb ,REGI_AH},
|
||||
|
||||
/* 0xa0 - 0xa7 */
|
||||
{L_OP ,O_ALOP ,0 ,0 },{L_OP ,O_AXOP ,0 ,0 },
|
||||
{L_OP ,O_OPAL ,0 ,0 },{L_OP ,O_OPAX ,0 ,0 },
|
||||
{L_STRING ,R_MOVSB ,0 ,0 },{L_STRING ,R_MOVSW ,0 ,0 },
|
||||
{L_STRING ,R_CMPSB ,0 ,0 },{L_STRING ,R_CMPSW ,0 ,0 },
|
||||
/* 0xa8 - 0xaf */
|
||||
{L_REGbIb ,t_TESTb ,0 ,REGI_AL},{L_REGwIw ,t_TESTw ,0 ,REGI_AX},
|
||||
{L_STRING ,R_STOSB ,0 ,0 },{L_STRING ,R_STOSW ,0 ,0 },
|
||||
{L_STRING ,R_LODSB ,0 ,0 },{L_STRING ,R_LODSW ,0 ,0 },
|
||||
{L_STRING ,R_SCASB ,0 ,0 },{L_STRING ,R_SCASW ,0 ,0 },
|
||||
|
||||
/* 0xb0 - 0xb7 */
|
||||
{L_Ib ,0 ,S_REGb ,REGI_AL},{L_Ib ,0 ,S_REGb ,REGI_CL},
|
||||
{L_Ib ,0 ,S_REGb ,REGI_DL},{L_Ib ,0 ,S_REGb ,REGI_BL},
|
||||
{L_Ib ,0 ,S_REGb ,REGI_AH},{L_Ib ,0 ,S_REGb ,REGI_CH},
|
||||
{L_Ib ,0 ,S_REGb ,REGI_DH},{L_Ib ,0 ,S_REGb ,REGI_BH},
|
||||
/* 0xb8 - 0xbf */
|
||||
{L_Iw ,0 ,S_REGw ,REGI_AX},{L_Iw ,0 ,S_REGw ,REGI_CX},
|
||||
{L_Iw ,0 ,S_REGw ,REGI_DX},{L_Iw ,0 ,S_REGw ,REGI_BX},
|
||||
{L_Iw ,0 ,S_REGw ,REGI_SP},{L_Iw ,0 ,S_REGw ,REGI_BP},
|
||||
{L_Iw ,0 ,S_REGw ,REGI_SI},{L_Iw ,0 ,S_REGw ,REGI_DI},
|
||||
|
||||
/* 0xc0 - 0xc7 */
|
||||
{L_MODRM ,5 ,0 ,M_GRP_Ib },{L_MODRM ,6 ,0 ,M_GRP_Ib },
|
||||
{L_POPw ,0 ,S_IPIw ,0 },{L_POPw ,0 ,S_IP ,0 },
|
||||
{L_MODRM ,O_SEGES ,S_SEGGw,M_Efw },{L_MODRM ,O_SEGDS ,S_SEGGw,M_Efw },
|
||||
{L_MODRM ,0 ,S_Eb ,M_Ib },{L_MODRM ,0 ,S_Ew ,M_Iw },
|
||||
/* 0xc8 - 0xcf */
|
||||
{D_ENTERw ,0 ,0 ,0 },{D_LEAVEw ,0 ,0 ,0 },
|
||||
{D_RETFwIw ,0 ,0 ,0 },{D_RETFw ,0 ,0 ,0 },
|
||||
{L_VAL ,O_INT ,0 ,3 },{L_Ib ,O_INT ,0 ,0 },
|
||||
{L_INTO ,O_INT ,0 ,0 },{D_IRETw ,0 ,0 ,0 },
|
||||
|
||||
/* 0xd0 - 0xd7 */
|
||||
{L_MODRM ,5 ,0 ,M_GRP_1 },{L_MODRM ,6 ,0 ,M_GRP_1 },
|
||||
{L_MODRM ,5 ,0 ,M_GRP_CL },{L_MODRM ,6 ,0 ,M_GRP_CL },
|
||||
{L_Ib ,O_AAM ,0 ,0 },{L_Ib ,O_AAD ,0 ,0 },
|
||||
{D_SETALC ,0 ,0 ,0 },{D_XLATw ,0 ,0 ,0 },
|
||||
//TODO FPU
|
||||
/* 0xd8 - 0xdf */
|
||||
{L_MODRM ,O_FPU ,0 ,0 },{L_MODRM ,O_FPU ,1 ,0 },
|
||||
{L_MODRM ,O_FPU ,2 ,0 },{L_MODRM ,O_FPU ,3 ,0 },
|
||||
{L_MODRM ,O_FPU ,4 ,0 },{L_MODRM ,O_FPU ,5 ,0 },
|
||||
{L_MODRM ,O_FPU ,6 ,0 },{L_MODRM ,O_FPU ,7 ,0 },
|
||||
|
||||
/* 0xe0 - 0xe7 */
|
||||
{L_Ibx ,O_LOOPNZ ,S_AIPw ,0 },{L_Ibx ,O_LOOPZ ,S_AIPw ,0 },
|
||||
{L_Ibx ,O_LOOP ,S_AIPw ,0 },{L_Ibx ,O_JCXZ ,S_AIPw ,0 },
|
||||
{L_Ib ,O_INb ,0 ,0 },{L_Ib ,O_INw ,0 ,0 },
|
||||
{L_Ib ,O_OUTb ,0 ,0 },{L_Ib ,O_OUTw ,0 ,0 },
|
||||
/* 0xe8 - 0xef */
|
||||
{L_Iw ,O_CALLNw ,S_AIPw ,0 },{L_Iwx ,0 ,S_AIPw ,0 },
|
||||
{L_Ifw ,O_JMPFw ,0 ,0 },{L_Ibx ,0 ,S_AIPw ,0 },
|
||||
{L_REGw ,O_INb ,0 ,REGI_DX},{L_REGw ,O_INw ,0 ,REGI_DX},
|
||||
{L_REGw ,O_OUTb ,0 ,REGI_DX},{L_REGw ,O_OUTw ,0 ,REGI_DX},
|
||||
|
||||
/* 0xf0 - 0xf7 */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{L_PREREPNE ,0 ,0 ,0 },{L_PREREP ,0 ,0 ,0 },
|
||||
{D_HLT ,0 ,0 ,0 },{D_CMC ,0 ,0 ,0 },
|
||||
{L_MODRM ,8 ,0 ,M_GRP },{L_MODRM ,9 ,0 ,M_GRP },
|
||||
/* 0xf8 - 0xff */
|
||||
{D_CLC ,0 ,0 ,0 },{D_STC ,0 ,0 ,0 },
|
||||
{D_CLI ,0 ,0 ,0 },{D_STI ,0 ,0 ,0 },
|
||||
{D_CLD ,0 ,0 ,0 },{D_STD ,0 ,0 ,0 },
|
||||
{L_MODRM ,0xb ,0 ,M_GRP },{L_MODRM ,0xc ,0 ,M_GRP },
|
||||
|
||||
/* 0x100 - 0x107 */
|
||||
{L_MODRM ,O_GRP6w ,S_Ew ,M_Ew },{L_MODRM ,O_GRP7w ,S_Ew ,M_Ew },
|
||||
{L_MODRM ,O_LAR ,S_Gw ,M_Ew },{L_MODRM ,O_LSL ,S_Gw ,M_Ew },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
/* 0x108 - 0x10f */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
|
||||
/* 0x110 - 0x117 */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
/* 0x118 - 0x11f */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
|
||||
/* 0x120 - 0x127 */
|
||||
{L_MODRM ,O_M_Rd_Cd ,S_Ed ,0 },{0 ,0 ,0 ,0 },
|
||||
{L_MODRM ,O_M_Cd_Rd ,0 ,M_Ed },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
|
||||
/* 0x128 - 0x12f */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
|
||||
/* 0x130 - 0x137 */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
/* 0x138 - 0x13f */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
|
||||
/* 0x140 - 0x147 */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
/* 0x148 - 0x14f */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
|
||||
/* 0x150 - 0x157 */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
/* 0x158 - 0x15f */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
|
||||
/* 0x160 - 0x167 */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
/* 0x168 - 0x16f */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
|
||||
|
||||
/* 0x170 - 0x177 */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
/* 0x178 - 0x17f */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
|
||||
/* 0x180 - 0x187 */
|
||||
{L_Iwx ,O_C_O ,S_C_AIPw,0 },{L_Iwx ,O_C_NO ,S_C_AIPw,0 },
|
||||
{L_Iwx ,O_C_B ,S_C_AIPw,0 },{L_Iwx ,O_C_NB ,S_C_AIPw,0 },
|
||||
{L_Iwx ,O_C_Z ,S_C_AIPw,0 },{L_Iwx ,O_C_NZ ,S_C_AIPw,0 },
|
||||
{L_Iwx ,O_C_BE ,S_C_AIPw,0 },{L_Iwx ,O_C_NBE ,S_C_AIPw,0 },
|
||||
/* 0x188 - 0x18f */
|
||||
{L_Iwx ,O_C_S ,S_C_AIPw,0 },{L_Iwx ,O_C_NS ,S_C_AIPw,0 },
|
||||
{L_Iwx ,O_C_P ,S_C_AIPw,0 },{L_Iwx ,O_C_NP ,S_C_AIPw,0 },
|
||||
{L_Iwx ,O_C_L ,S_C_AIPw,0 },{L_Iwx ,O_C_NL ,S_C_AIPw,0 },
|
||||
{L_Iwx ,O_C_LE ,S_C_AIPw,0 },{L_Iwx ,O_C_NLE ,S_C_AIPw,0 },
|
||||
|
||||
/* 0x190 - 0x197 */
|
||||
{L_MODRM ,O_C_O ,S_C_Eb,0 },{L_MODRM ,O_C_NO ,S_C_Eb,0 },
|
||||
{L_MODRM ,O_C_B ,S_C_Eb,0 },{L_MODRM ,O_C_NB ,S_C_Eb,0 },
|
||||
{L_MODRM ,O_C_Z ,S_C_Eb,0 },{L_MODRM ,O_C_NZ ,S_C_Eb,0 },
|
||||
{L_MODRM ,O_C_BE ,S_C_Eb,0 },{L_MODRM ,O_C_NBE ,S_C_Eb,0 },
|
||||
/* 0x198 - 0x19f */
|
||||
{L_MODRM ,O_C_S ,S_C_Eb,0 },{L_MODRM ,O_C_NS ,S_C_Eb,0 },
|
||||
{L_MODRM ,O_C_P ,S_C_Eb,0 },{L_MODRM ,O_C_NP ,S_C_Eb,0 },
|
||||
{L_MODRM ,O_C_L ,S_C_Eb,0 },{L_MODRM ,O_C_NL ,S_C_Eb,0 },
|
||||
{L_MODRM ,O_C_LE ,S_C_Eb,0 },{L_MODRM ,O_C_NLE ,S_C_Eb,0 },
|
||||
|
||||
/* 0x1a0 - 0x1a7 */
|
||||
{L_SEG ,0 ,S_PUSHw ,fs },{L_POPw ,0 ,S_SEGI ,fs },
|
||||
{D_CPUID ,0 ,0 ,0 },{L_MODRM ,O_BTw ,0 ,M_Gw },
|
||||
{L_MODRM ,O_DSHLw ,S_Ew,M_EwGwIb },{L_MODRM ,O_DSHLw ,S_Ew ,M_EwGwCL },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
/* 0x1a8 - 0x1af */
|
||||
{L_SEG ,0 ,S_PUSHw ,gs },{L_POPw ,0 ,S_SEGI ,gs },
|
||||
{0 ,0 ,0 ,0 },{L_MODRM ,O_BTSw ,0 ,M_Gw },
|
||||
{L_MODRM ,O_DSHRw ,S_Ew,M_EwGwIb },{L_MODRM ,O_DSHRw ,S_Ew ,M_EwGwCL },
|
||||
{0 ,0 ,0 ,0 },{L_MODRM ,O_IMULRw ,S_Gw ,M_EwxGwx },
|
||||
|
||||
/* 0x1b0 - 0x1b7 */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{L_MODRM ,O_SEGSS ,S_SEGGw,M_Efw },{L_MODRM ,O_BTRw ,0 ,M_Gw },
|
||||
{L_MODRM ,O_SEGFS ,S_SEGGw,M_Efw },{L_MODRM ,O_SEGGS ,S_SEGGw,M_Efw },
|
||||
{L_MODRM ,0 ,S_Gw ,M_Eb },{L_MODRM ,0 ,S_Gw ,M_Ew },
|
||||
/* 0x1b8 - 0x1bf */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{L_MODRM ,0xe ,0 ,M_GRP },{L_MODRM ,O_BTCw ,0 ,M_Gw },
|
||||
{L_MODRM ,O_BSFw ,S_Gw ,M_Ew },{L_MODRM ,O_BSRw ,S_Gw ,M_Ew },
|
||||
{L_MODRM ,0 ,S_Gw ,M_Ebx },{L_MODRM ,0 ,S_Gw ,M_Ewx },
|
||||
|
||||
/* 0x1c0 - 0x1cc */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
/* 0x1c8 - 0x1cf */
|
||||
{L_REGd ,O_BSWAP ,S_REGd ,REGI_AX},{L_REGd ,O_BSWAP ,S_REGd ,REGI_CX},
|
||||
{L_REGd ,O_BSWAP ,S_REGd ,REGI_DX},{L_REGd ,O_BSWAP ,S_REGd ,REGI_BX},
|
||||
{L_REGd ,O_BSWAP ,S_REGd ,REGI_SP},{L_REGd ,O_BSWAP ,S_REGd ,REGI_BP},
|
||||
{L_REGd ,O_BSWAP ,S_REGd ,REGI_SI},{L_REGd ,O_BSWAP ,S_REGd ,REGI_DI},
|
||||
|
||||
/* 0x1d0 - 0x1d7 */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
/* 0x1d8 - 0x1df */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
|
||||
/* 0x1e0 - 0x1ee */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
/* 0x1e8 - 0x1ef */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
|
||||
/* 0x1f0 - 0x1fc */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
/* 0x1f8 - 0x1ff */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
|
||||
|
||||
/* 0x200 - 0x207 */
|
||||
{L_MODRM ,t_ADDb ,S_Eb ,M_EbGb },{L_MODRM ,t_ADDd ,S_Ed ,M_EdGd },
|
||||
{L_MODRM ,t_ADDb ,S_Gb ,M_GbEb },{L_MODRM ,t_ADDd ,S_Gd ,M_GdEd },
|
||||
{L_REGbIb ,t_ADDb ,S_REGb ,REGI_AL },{L_REGdId ,t_ADDd ,S_REGd ,REGI_AX },
|
||||
{L_SEG ,0 ,S_PUSHd,es },{L_POPd ,0 ,S_SEGI ,es },
|
||||
/* 0x208 - 0x20f */
|
||||
{L_MODRM ,t_ORb ,S_Eb ,M_EbGb },{L_MODRM ,t_ORd ,S_Ed ,M_EdGd },
|
||||
{L_MODRM ,t_ORb ,S_Gb ,M_GbEb },{L_MODRM ,t_ORd ,S_Gd ,M_GdEd },
|
||||
{L_REGbIb ,t_ORb ,S_REGb ,REGI_AL },{L_REGdId ,t_ORd ,S_REGd ,REGI_AX },
|
||||
{L_SEG ,0 ,S_PUSHd,cs },{L_DOUBLE ,0 ,0 ,0 },
|
||||
|
||||
/* 0x210 - 0x217 */
|
||||
{L_MODRM ,t_ADCb ,S_Eb ,M_EbGb },{L_MODRM ,t_ADCd ,S_Ed ,M_EdGd },
|
||||
{L_MODRM ,t_ADCb ,S_Gb ,M_GbEb },{L_MODRM ,t_ADCd ,S_Gd ,M_GdEd },
|
||||
{L_REGbIb ,t_ADCb ,S_REGb ,REGI_AL },{L_REGdId ,t_ADCd ,S_REGd ,REGI_AX },
|
||||
{L_SEG ,0 ,S_PUSHd,ss },{L_POPd ,0 ,S_SEGI ,ss },
|
||||
/* 0x218 - 0x21f */
|
||||
{L_MODRM ,t_SBBb ,S_Eb ,M_EbGb },{L_MODRM ,t_SBBd ,S_Ed ,M_EdGd },
|
||||
{L_MODRM ,t_SBBb ,S_Gb ,M_GbEb },{L_MODRM ,t_SBBd ,S_Gd ,M_GdEd },
|
||||
{L_REGbIb ,t_SBBb ,S_REGb ,REGI_AL },{L_REGdId ,t_SBBd ,S_REGd ,REGI_AX },
|
||||
{L_SEG ,0 ,S_PUSHd,ds },{L_POPd ,0 ,S_SEGI ,ds },
|
||||
|
||||
/* 0x220 - 0x227 */
|
||||
{L_MODRM ,t_ANDb ,S_Eb ,M_EbGb },{L_MODRM ,t_ANDd ,S_Ed ,M_EdGd },
|
||||
{L_MODRM ,t_ANDb ,S_Gb ,M_GbEb },{L_MODRM ,t_ANDd ,S_Gd ,M_GdEd },
|
||||
{L_REGbIb ,t_ANDb ,S_REGb ,REGI_AL },{L_REGdId ,t_ANDd ,S_REGd ,REGI_AX },
|
||||
{L_PRESEG ,0 ,0 ,es },{D_DAA ,0 ,0 ,0 },
|
||||
/* 0x228 - 0x22f */
|
||||
{L_MODRM ,t_SUBb ,S_Eb ,M_EbGb },{L_MODRM ,t_SUBd ,S_Ed ,M_EdGd },
|
||||
{L_MODRM ,t_SUBb ,S_Gb ,M_GbEb },{L_MODRM ,t_SUBd ,S_Gd ,M_GdEd },
|
||||
{L_REGbIb ,t_SUBb ,S_REGb ,REGI_AL },{L_REGdId ,t_SUBd ,S_REGd ,REGI_AX },
|
||||
{L_PRESEG ,0 ,0 ,cs },{D_DAS ,0 ,0 ,0 },
|
||||
|
||||
/* 0x230 - 0x237 */
|
||||
{L_MODRM ,t_XORb ,S_Eb ,M_EbGb },{L_MODRM ,t_XORd ,S_Ed ,M_EdGd },
|
||||
{L_MODRM ,t_XORb ,S_Gb ,M_GbEb },{L_MODRM ,t_XORd ,S_Gd ,M_GdEd },
|
||||
{L_REGbIb ,t_XORb ,S_REGb ,REGI_AL },{L_REGdId ,t_XORd ,S_REGd ,REGI_AX },
|
||||
{L_PRESEG ,0 ,0 ,ss },{D_AAA ,0 ,0 ,0 },
|
||||
/* 0x238 - 0x23f */
|
||||
{L_MODRM ,t_CMPb ,0 ,M_EbGb },{L_MODRM ,t_CMPd ,0 ,M_EdGd },
|
||||
{L_MODRM ,t_CMPb ,0 ,M_GbEb },{L_MODRM ,t_CMPd ,0 ,M_GdEd },
|
||||
{L_REGbIb ,t_CMPb ,0 ,REGI_AL },{L_REGdId ,t_CMPd ,0 ,REGI_AX },
|
||||
{L_PRESEG ,0 ,0 ,ds },{D_AAS ,0 ,0 ,0 },
|
||||
|
||||
/* 0x240 - 0x247 */
|
||||
{L_REGd ,t_INCd ,S_REGd ,REGI_AX},{L_REGd ,t_INCd ,S_REGd ,REGI_CX},
|
||||
{L_REGd ,t_INCd ,S_REGd ,REGI_DX},{L_REGd ,t_INCd ,S_REGd ,REGI_BX},
|
||||
{L_REGd ,t_INCd ,S_REGd ,REGI_SP},{L_REGd ,t_INCd ,S_REGd ,REGI_BP},
|
||||
{L_REGd ,t_INCd ,S_REGd ,REGI_SI},{L_REGd ,t_INCd ,S_REGd ,REGI_DI},
|
||||
/* 0x248 - 0x24f */
|
||||
{L_REGd ,t_DECd ,S_REGd ,REGI_AX},{L_REGd ,t_DECd ,S_REGd ,REGI_CX},
|
||||
{L_REGd ,t_DECd ,S_REGd ,REGI_DX},{L_REGd ,t_DECd ,S_REGd ,REGI_BX},
|
||||
{L_REGd ,t_DECd ,S_REGd ,REGI_SP},{L_REGd ,t_DECd ,S_REGd ,REGI_BP},
|
||||
{L_REGd ,t_DECd ,S_REGd ,REGI_SI},{L_REGd ,t_DECd ,S_REGd ,REGI_DI},
|
||||
|
||||
/* 0x250 - 0x257 */
|
||||
{L_REGd ,0 ,S_PUSHd,REGI_AX},{L_REGd ,0 ,S_PUSHd,REGI_CX},
|
||||
{L_REGd ,0 ,S_PUSHd,REGI_DX},{L_REGd ,0 ,S_PUSHd,REGI_BX},
|
||||
{L_REGd ,0 ,S_PUSHd,REGI_SP},{L_REGd ,0 ,S_PUSHd,REGI_BP},
|
||||
{L_REGd ,0 ,S_PUSHd,REGI_SI},{L_REGd ,0 ,S_PUSHd,REGI_DI},
|
||||
/* 0x258 - 0x25f */
|
||||
{L_POPd ,0 ,S_REGd ,REGI_AX},{L_POPd ,0 ,S_REGd ,REGI_CX},
|
||||
{L_POPd ,0 ,S_REGd ,REGI_DX},{L_POPd ,0 ,S_REGd ,REGI_BX},
|
||||
{L_POPd ,0 ,S_REGd ,REGI_SP},{L_POPd ,0 ,S_REGd ,REGI_BP},
|
||||
{L_POPd ,0 ,S_REGd ,REGI_SI},{L_POPd ,0 ,S_REGd ,REGI_DI},
|
||||
|
||||
/* 0x260 - 0x267 */
|
||||
{D_PUSHAd ,0 ,0 ,0 },{D_POPAd ,0 ,0 ,0 },
|
||||
{L_MODRM ,O_BOUNDd ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{L_PRESEG ,0 ,0 ,fs },{L_PRESEG ,0 ,0 ,gs },
|
||||
{L_PREOP ,0 ,0 ,0 },{L_PREADD ,0 ,0 ,0 },
|
||||
/* 0x268 - 0x26f */
|
||||
{L_Id ,0 ,S_PUSHd,0 },{L_MODRM ,O_IMULRd ,S_Gd ,M_EdId},
|
||||
{L_Ibx ,0 ,S_PUSHd,0 },{L_MODRM ,O_IMULRd ,S_Gd ,M_EdIbx},
|
||||
{L_STRING ,R_INSB ,0 ,0 },{L_STRING ,R_INSD ,0 ,0 },
|
||||
{L_STRING ,R_OUTSB ,0 ,0 },{L_STRING ,R_OUTSD ,0 ,0 },
|
||||
|
||||
/* 0x270 - 0x277 */
|
||||
{L_Ibx ,O_C_O ,S_C_AIPd,0 },{L_Ibx ,O_C_NO ,S_C_AIPd,0 },
|
||||
{L_Ibx ,O_C_B ,S_C_AIPd,0 },{L_Ibx ,O_C_NB ,S_C_AIPd,0 },
|
||||
{L_Ibx ,O_C_Z ,S_C_AIPd,0 },{L_Ibx ,O_C_NZ ,S_C_AIPd,0 },
|
||||
{L_Ibx ,O_C_BE ,S_C_AIPd,0 },{L_Ibx ,O_C_NBE ,S_C_AIPd,0 },
|
||||
/* 0x278 - 0x27f */
|
||||
{L_Ibx ,O_C_S ,S_C_AIPd,0 },{L_Ibx ,O_C_NS ,S_C_AIPd,0 },
|
||||
{L_Ibx ,O_C_P ,S_C_AIPd,0 },{L_Ibx ,O_C_NP ,S_C_AIPd,0 },
|
||||
{L_Ibx ,O_C_L ,S_C_AIPd,0 },{L_Ibx ,O_C_NL ,S_C_AIPd,0 },
|
||||
{L_Ibx ,O_C_LE ,S_C_AIPd,0 },{L_Ibx ,O_C_NLE ,S_C_AIPd,0 },
|
||||
|
||||
/* 0x280 - 0x287 */
|
||||
{L_MODRM ,0 ,0 ,M_GRP },{L_MODRM ,2 ,0 ,M_GRP },
|
||||
{L_MODRM ,0 ,0 ,M_GRP },{L_MODRM ,4 ,0 ,M_GRP },
|
||||
{L_MODRM ,t_TESTb ,0 ,M_EbGb },{L_MODRM ,t_TESTd ,0 ,M_EdGd },
|
||||
{L_MODRM ,0 ,S_EbGb ,M_GbEb },{L_MODRM ,0 ,S_EdGd ,M_GdEd },
|
||||
/* 0x288 - 0x28f */
|
||||
{L_MODRM ,0 ,S_Eb ,M_Gb },{L_MODRM ,0 ,S_Ed ,M_Gd },
|
||||
{L_MODRM ,0 ,S_Gb ,M_Eb },{L_MODRM ,0 ,S_Gd ,M_Ed },
|
||||
{L_MODRM ,0 ,S_EdMw ,M_SEG },{L_MODRM ,0 ,S_Gd ,M_EA },
|
||||
{L_MODRM ,0 ,S_SEGm ,M_Ew },{L_MODRM ,0 ,S_Ed ,M_POPd },
|
||||
|
||||
/* 0x290 - 0x297 */
|
||||
{D_NOP ,0 ,0 ,0 },{L_REGd ,O_XCHG_EAX ,S_REGd ,REGI_CX},
|
||||
{L_REGd ,O_XCHG_EAX ,S_REGd ,REGI_DX},{L_REGd ,O_XCHG_EAX ,S_REGd ,REGI_BX},
|
||||
{L_REGd ,O_XCHG_EAX ,S_REGd ,REGI_SP},{L_REGd ,O_XCHG_EAX ,S_REGd ,REGI_BP},
|
||||
{L_REGd ,O_XCHG_EAX ,S_REGd ,REGI_SI},{L_REGd ,O_XCHG_EAX ,S_REGd ,REGI_DI},
|
||||
/* 0x298 - 0x29f */
|
||||
{D_CWDE ,0 ,0 ,0 },{D_CDQ ,0 ,0 ,0 },
|
||||
{L_Ifd ,O_CALLFd ,0 ,0 },{D_WAIT ,0 ,0 ,0 },
|
||||
{L_FLG ,0 ,S_PUSHd,0 },{L_POPd ,0 ,S_FLGd ,0 },
|
||||
{L_REGb ,0 ,S_FLGb ,REGI_AH},{L_FLG ,0 ,S_REGb ,REGI_AH},
|
||||
|
||||
/* 0x2a0 - 0x2a7 */
|
||||
{L_OP ,O_ALOP ,0 ,0 },{L_OP ,O_EAXOP ,0 ,0 },
|
||||
{L_OP ,O_OPAL ,0 ,0 },{L_OP ,O_OPEAX ,0 ,0 },
|
||||
{L_STRING ,R_MOVSB ,0 ,0 },{L_STRING ,R_MOVSD ,0 ,0 },
|
||||
{L_STRING ,R_CMPSB ,0 ,0 },{L_STRING ,R_CMPSD ,0 ,0 },
|
||||
/* 0x2a8 - 0x2af */
|
||||
{L_REGbIb ,t_TESTb ,0 ,REGI_AL},{L_REGdId ,t_TESTd ,0 ,REGI_AX},
|
||||
{L_STRING ,R_STOSB ,0 ,0 },{L_STRING ,R_STOSD ,0 ,0 },
|
||||
{L_STRING ,R_LODSB ,0 ,0 },{L_STRING ,R_LODSD ,0 ,0 },
|
||||
{L_STRING ,R_SCASB ,0 ,0 },{L_STRING ,R_SCASD ,0 ,0 },
|
||||
|
||||
/* 0x2b0 - 0x2b7 */
|
||||
{L_Ib ,0 ,S_REGb ,REGI_AL},{L_Ib ,0 ,S_REGb ,REGI_CL},
|
||||
{L_Ib ,0 ,S_REGb ,REGI_DL},{L_Ib ,0 ,S_REGb ,REGI_BL},
|
||||
{L_Ib ,0 ,S_REGb ,REGI_AH},{L_Ib ,0 ,S_REGb ,REGI_CH},
|
||||
{L_Ib ,0 ,S_REGb ,REGI_DH},{L_Ib ,0 ,S_REGb ,REGI_BH},
|
||||
/* 0x2b8 - 0x2bf */
|
||||
{L_Id ,0 ,S_REGd ,REGI_AX},{L_Id ,0 ,S_REGd ,REGI_CX},
|
||||
{L_Id ,0 ,S_REGd ,REGI_DX},{L_Id ,0 ,S_REGd ,REGI_BX},
|
||||
{L_Id ,0 ,S_REGd ,REGI_SP},{L_Id ,0 ,S_REGd ,REGI_BP},
|
||||
{L_Id ,0 ,S_REGd ,REGI_SI},{L_Id ,0 ,S_REGd ,REGI_DI},
|
||||
|
||||
/* 0x2c0 - 0x2c7 */
|
||||
{L_MODRM ,5 ,0 ,M_GRP_Ib },{L_MODRM ,7 ,0 ,M_GRP_Ib },
|
||||
{L_POPd ,0 ,S_IPIw ,0 },{L_POPd ,0 ,S_IP ,0 },
|
||||
{L_MODRM ,O_SEGES ,S_SEGGd,M_Efd },{L_MODRM ,O_SEGDS ,S_SEGGd,M_Efd },
|
||||
{L_MODRM ,0 ,S_Eb ,M_Ib },{L_MODRM ,0 ,S_Ed ,M_Id },
|
||||
/* 0x2c8 - 0x2cf */
|
||||
{D_ENTERd ,0 ,0 ,0 },{D_LEAVEd ,0 ,0 ,0 },
|
||||
{D_RETFdIw ,0 ,0 ,0 },{D_RETFd ,0 ,0 ,0 },
|
||||
{L_VAL ,O_INT ,0 ,3 },{L_Ib ,O_INT ,0 ,0 },
|
||||
{L_INTO ,O_INT ,0 ,0 },{D_IRETd ,0 ,0 ,0 },
|
||||
|
||||
/* 0x2d0 - 0x2d7 */
|
||||
{L_MODRM ,5 ,0 ,M_GRP_1 },{L_MODRM ,7 ,0 ,M_GRP_1 },
|
||||
{L_MODRM ,5 ,0 ,M_GRP_CL },{L_MODRM ,7 ,0 ,M_GRP_CL },
|
||||
{L_Ib ,O_AAM ,0 ,0 },{L_Ib ,O_AAD ,0 ,0 },
|
||||
{D_SETALC ,0 ,0 ,0 },{D_XLATd ,0 ,0 ,0 },
|
||||
/* 0x2d8 - 0x2df */
|
||||
{L_MODRM ,O_FPU ,0 ,0 },{L_MODRM ,O_FPU ,1 ,0 },
|
||||
{L_MODRM ,O_FPU ,2 ,0 },{L_MODRM ,O_FPU ,3 ,0 },
|
||||
{L_MODRM ,O_FPU ,4 ,0 },{L_MODRM ,O_FPU ,5 ,0 },
|
||||
{L_MODRM ,O_FPU ,6 ,0 },{L_MODRM ,O_FPU ,7 ,0 },
|
||||
|
||||
/* 0x2e0 - 0x2e7 */
|
||||
{L_Ibx ,O_LOOPNZ ,S_AIPd ,0 },{L_Ibx ,O_LOOPZ ,S_AIPd ,0 },
|
||||
{L_Ibx ,O_LOOP ,S_AIPd ,0 },{L_Ibx ,O_JCXZ ,S_AIPd ,0 },
|
||||
{L_Ib ,O_INb ,0 ,0 },{L_Ib ,O_INd ,0 ,0 },
|
||||
{L_Ib ,O_OUTb ,0 ,0 },{L_Ib ,O_OUTd ,0 ,0 },
|
||||
/* 0x2e8 - 0x2ef */
|
||||
{L_Id ,O_CALLNd ,S_AIPd ,0 },{L_Idx ,0 ,S_AIPd ,0 },
|
||||
{L_Ifd ,O_JMPFd ,0 ,0 },{L_Ibx ,0 ,S_AIPd ,0 },
|
||||
{L_REGw ,O_INb ,0 ,REGI_DX},{L_REGw ,O_INd ,0 ,REGI_DX},
|
||||
{L_REGw ,O_OUTb ,0 ,REGI_DX},{L_REGw ,O_OUTd ,0 ,REGI_DX},
|
||||
|
||||
/* 0x2f0 - 0x2f7 */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{L_PREREPNE ,0 ,0 ,0 },{L_PREREP ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{D_CMC ,0 ,0 ,0 },
|
||||
{L_MODRM ,8 ,0 ,M_GRP },{L_MODRM ,0xa ,0 ,M_GRP },
|
||||
/* 0x2f8 - 0x2ff */
|
||||
{D_CLC ,0 ,0 ,0 },{D_STC ,0 ,0 ,0 },
|
||||
{D_CLI ,0 ,0 ,0 },{D_STI ,0 ,0 ,0 },
|
||||
{D_CLD ,0 ,0 ,0 },{D_STD ,0 ,0 ,0 },
|
||||
{L_MODRM ,0xb ,0 ,M_GRP },{L_MODRM ,0xd ,0 ,M_GRP },
|
||||
|
||||
|
||||
/* 0x300 - 0x307 */
|
||||
{L_MODRM ,O_GRP6d ,S_Ew ,M_Ew },{L_MODRM ,O_GRP7d ,S_Ew ,M_Ew },
|
||||
{L_MODRM ,O_LAR ,S_Gd ,M_Ew },{L_MODRM ,O_LSL ,S_Gd ,M_Ew },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
/* 0x308 - 0x30f */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
|
||||
/* 0x310 - 0x317 */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
/* 0x318 - 0x31f */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
|
||||
/* 0x320 - 0x327 */
|
||||
{L_MODRM ,O_M_Rd_Cd ,S_Ed ,0 },{0 ,0 ,0 ,0 },
|
||||
{L_MODRM ,O_M_Cd_Rd ,0 ,M_Ed },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
|
||||
/* 0x328 - 0x32f */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
|
||||
/* 0x330 - 0x337 */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
/* 0x338 - 0x33f */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
|
||||
/* 0x340 - 0x347 */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
/* 0x348 - 0x34f */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
|
||||
/* 0x350 - 0x357 */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
/* 0x358 - 0x35f */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
|
||||
/* 0x360 - 0x367 */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
/* 0x368 - 0x36f */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
|
||||
|
||||
/* 0x370 - 0x377 */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
/* 0x378 - 0x37f */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
|
||||
/* 0x380 - 0x387 */
|
||||
{L_Idx ,O_C_O ,S_C_AIPd,0 },{L_Idx ,O_C_NO ,S_C_AIPd,0 },
|
||||
{L_Idx ,O_C_B ,S_C_AIPd,0 },{L_Idx ,O_C_NB ,S_C_AIPd,0 },
|
||||
{L_Idx ,O_C_Z ,S_C_AIPd,0 },{L_Idx ,O_C_NZ ,S_C_AIPd,0 },
|
||||
{L_Idx ,O_C_BE ,S_C_AIPd,0 },{L_Idx ,O_C_NBE ,S_C_AIPd,0 },
|
||||
/* 0x388 - 0x38f */
|
||||
{L_Idx ,O_C_S ,S_C_AIPd,0 },{L_Idx ,O_C_NS ,S_C_AIPd,0 },
|
||||
{L_Idx ,O_C_P ,S_C_AIPd,0 },{L_Idx ,O_C_NP ,S_C_AIPd,0 },
|
||||
{L_Idx ,O_C_L ,S_C_AIPd,0 },{L_Idx ,O_C_NL ,S_C_AIPd,0 },
|
||||
{L_Idx ,O_C_LE ,S_C_AIPd,0 },{L_Idx ,O_C_NLE ,S_C_AIPd,0 },
|
||||
|
||||
/* 0x390 - 0x397 */
|
||||
{L_MODRM ,O_C_O ,S_C_Eb,0 },{L_MODRM ,O_C_NO ,S_C_Eb,0 },
|
||||
{L_MODRM ,O_C_B ,S_C_Eb,0 },{L_MODRM ,O_C_NB ,S_C_Eb,0 },
|
||||
{L_MODRM ,O_C_Z ,S_C_Eb,0 },{L_MODRM ,O_C_NZ ,S_C_Eb,0 },
|
||||
{L_MODRM ,O_C_BE ,S_C_Eb,0 },{L_MODRM ,O_C_NBE ,S_C_Eb,0 },
|
||||
/* 0x398 - 0x39f */
|
||||
{L_MODRM ,O_C_S ,S_C_Eb,0 },{L_MODRM ,O_C_NS ,S_C_Eb,0 },
|
||||
{L_MODRM ,O_C_P ,S_C_Eb,0 },{L_MODRM ,O_C_NP ,S_C_Eb,0 },
|
||||
{L_MODRM ,O_C_L ,S_C_Eb,0 },{L_MODRM ,O_C_NL ,S_C_Eb,0 },
|
||||
{L_MODRM ,O_C_LE ,S_C_Eb,0 },{L_MODRM ,O_C_NLE ,S_C_Eb,0 },
|
||||
|
||||
/* 0x3a0 - 0x3a7 */
|
||||
{L_SEG ,0 ,S_PUSHd ,fs },{L_POPd ,0 ,S_SEGI ,fs },
|
||||
{D_CPUID ,0 ,0 ,0 },{L_MODRM ,O_BTd ,0 ,M_Gd },
|
||||
{L_MODRM ,O_DSHLd ,S_Ed,M_EdGdIb },{L_MODRM ,O_DSHLd ,S_Ed ,M_EdGdCL },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
/* 0x3a8 - 0x3af */
|
||||
{L_SEG ,0 ,S_PUSHd ,gs },{L_POPd ,0 ,S_SEGI ,gs },
|
||||
{0 ,0 ,0 ,0 },{L_MODRM ,O_BTSd ,0 ,M_Gd },
|
||||
{L_MODRM ,O_DSHRd ,S_Ed,M_EdGdIb },{L_MODRM ,O_DSHRd ,S_Ed ,M_EdGdCL },
|
||||
{0 ,0 ,0 ,0 },{L_MODRM ,O_IMULRd ,S_Gd ,M_EdxGdx },
|
||||
|
||||
/* 0x3b0 - 0x3b7 */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{L_MODRM ,O_SEGSS ,S_SEGGd,M_Efd },{L_MODRM ,O_BTRd ,0 ,M_Gd },
|
||||
{L_MODRM ,O_SEGFS ,S_SEGGd,M_Efd },{L_MODRM ,O_SEGGS ,S_SEGGd,M_Efd },
|
||||
{L_MODRM ,0 ,S_Gd ,M_Eb },{L_MODRM ,0 ,S_Gd ,M_Ew },
|
||||
/* 0x3b8 - 0x3bf */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{L_MODRM ,0xf ,0 ,M_GRP },{L_MODRM ,O_BTCd ,0 ,M_Gd },
|
||||
{L_MODRM ,O_BSFd ,S_Gd ,M_Ed },{L_MODRM ,O_BSRd ,S_Gd ,M_Ed },
|
||||
{L_MODRM ,0 ,S_Gd ,M_Ebx },{L_MODRM ,0 ,S_Gd ,M_Ewx },
|
||||
|
||||
/* 0x3c0 - 0x3cc */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
/* 0x3c8 - 0x3cf */
|
||||
{L_REGd ,O_BSWAP ,S_REGd ,REGI_AX},{L_REGd ,O_BSWAP ,S_REGd ,REGI_CX},
|
||||
{L_REGd ,O_BSWAP ,S_REGd ,REGI_DX},{L_REGd ,O_BSWAP ,S_REGd ,REGI_BX},
|
||||
{L_REGd ,O_BSWAP ,S_REGd ,REGI_SP},{L_REGd ,O_BSWAP ,S_REGd ,REGI_BP},
|
||||
{L_REGd ,O_BSWAP ,S_REGd ,REGI_SI},{L_REGd ,O_BSWAP ,S_REGd ,REGI_DI},
|
||||
|
||||
/* 0x3d0 - 0x3d7 */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
/* 0x3d8 - 0x3df */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
|
||||
/* 0x3e0 - 0x3ee */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
/* 0x3e8 - 0x3ef */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
|
||||
/* 0x3f0 - 0x3fc */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
/* 0x3f8 - 0x3ff */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
|
||||
};
|
||||
|
||||
static OpCode Groups[16][8]={
|
||||
{ /* 0x00 Group 1 Eb,Ib */
|
||||
{0 ,t_ADDb ,S_Eb ,M_EbIb },{0 ,t_ORb ,S_Eb ,M_EbIb },
|
||||
{0 ,t_ADCb ,S_Eb ,M_EbIb },{0 ,t_SBBb ,S_Eb ,M_EbIb },
|
||||
{0 ,t_ANDb ,S_Eb ,M_EbIb },{0 ,t_SUBb ,S_Eb ,M_EbIb },
|
||||
{0 ,t_XORb ,S_Eb ,M_EbIb },{0 ,t_CMPb ,0 ,M_EbIb },
|
||||
},{ /* 0x01 Group 1 Ew,Iw */
|
||||
{0 ,t_ADDw ,S_Ew ,M_EwIw },{0 ,t_ORw ,S_Ew ,M_EwIw },
|
||||
{0 ,t_ADCw ,S_Ew ,M_EwIw },{0 ,t_SBBw ,S_Ew ,M_EwIw },
|
||||
{0 ,t_ANDw ,S_Ew ,M_EwIw },{0 ,t_SUBw ,S_Ew ,M_EwIw },
|
||||
{0 ,t_XORw ,S_Ew ,M_EwIw },{0 ,t_CMPw ,0 ,M_EwIw },
|
||||
},{ /* 0x02 Group 1 Ed,Id */
|
||||
{0 ,t_ADDd ,S_Ed ,M_EdId },{0 ,t_ORd ,S_Ed ,M_EdId },
|
||||
{0 ,t_ADCd ,S_Ed ,M_EdId },{0 ,t_SBBd ,S_Ed ,M_EdId },
|
||||
{0 ,t_ANDd ,S_Ed ,M_EdId },{0 ,t_SUBd ,S_Ed ,M_EdId },
|
||||
{0 ,t_XORd ,S_Ed ,M_EdId },{0 ,t_CMPd ,0 ,M_EdId },
|
||||
},{ /* 0x03 Group 1 Ew,Ibx */
|
||||
{0 ,t_ADDw ,S_Ew ,M_EwIbx },{0 ,t_ORw ,S_Ew ,M_EwIbx },
|
||||
{0 ,t_ADCw ,S_Ew ,M_EwIbx },{0 ,t_SBBw ,S_Ew ,M_EwIbx },
|
||||
{0 ,t_ANDw ,S_Ew ,M_EwIbx },{0 ,t_SUBw ,S_Ew ,M_EwIbx },
|
||||
{0 ,t_XORw ,S_Ew ,M_EwIbx },{0 ,t_CMPw ,0 ,M_EwIbx },
|
||||
},{ /* 0x04 Group 1 Ed,Ibx */
|
||||
{0 ,t_ADDd ,S_Ed ,M_EdIbx },{0 ,t_ORd ,S_Ed ,M_EdIbx },
|
||||
{0 ,t_ADCd ,S_Ed ,M_EdIbx },{0 ,t_SBBd ,S_Ed ,M_EdIbx },
|
||||
{0 ,t_ANDd ,S_Ed ,M_EdIbx },{0 ,t_SUBd ,S_Ed ,M_EdIbx },
|
||||
{0 ,t_XORd ,S_Ed ,M_EdIbx },{0 ,t_CMPd ,0 ,M_EdIbx },
|
||||
|
||||
},{ /* 0x05 Group 2 Eb,XXX */
|
||||
{0 ,t_ROLb ,S_Eb ,M_Eb },{0 ,t_RORb ,S_Eb ,M_Eb },
|
||||
{0 ,t_RCLb ,S_Eb ,M_Eb },{0 ,t_RCRb ,S_Eb ,M_Eb },
|
||||
{0 ,t_SHLb ,S_Eb ,M_Eb },{0 ,t_SHRb ,S_Eb ,M_Eb },
|
||||
{0 ,t_SHLb ,S_Eb ,M_Eb },{0 ,t_SARb ,S_Eb ,M_Eb },
|
||||
},{ /* 0x06 Group 2 Ew,XXX */
|
||||
{0 ,t_ROLw ,S_Ew ,M_Ew },{0 ,t_RORw ,S_Ew ,M_Ew },
|
||||
{0 ,t_RCLw ,S_Ew ,M_Ew },{0 ,t_RCRw ,S_Ew ,M_Ew },
|
||||
{0 ,t_SHLw ,S_Ew ,M_Ew },{0 ,t_SHRw ,S_Ew ,M_Ew },
|
||||
{0 ,t_SHLw ,S_Ew ,M_Ew },{0 ,t_SARw ,S_Ew ,M_Ew },
|
||||
},{ /* 0x07 Group 2 Ed,XXX */
|
||||
{0 ,t_ROLd ,S_Ed ,M_Ed },{0 ,t_RORd ,S_Ed ,M_Ed },
|
||||
{0 ,t_RCLd ,S_Ed ,M_Ed },{0 ,t_RCRd ,S_Ed ,M_Ed },
|
||||
{0 ,t_SHLd ,S_Ed ,M_Ed },{0 ,t_SHRd ,S_Ed ,M_Ed },
|
||||
{0 ,t_SHLd ,S_Ed ,M_Ed },{0 ,t_SARd ,S_Ed ,M_Ed },
|
||||
|
||||
|
||||
},{ /* 0x08 Group 3 Eb */
|
||||
{0 ,t_TESTb ,0 ,M_EbIb },{0 ,t_TESTb ,0 ,M_EbIb },
|
||||
{0 ,O_NOT ,S_Eb ,M_Eb },{0 ,t_NEGb ,S_Eb ,M_Eb },
|
||||
{0 ,O_MULb ,0 ,M_Eb },{0 ,O_IMULb ,0 ,M_Eb },
|
||||
{0 ,O_DIVb ,0 ,M_Eb },{0 ,O_IDIVb ,0 ,M_Eb },
|
||||
},{ /* 0x09 Group 3 Ew */
|
||||
{0 ,t_TESTw ,0 ,M_EwIw },{0 ,t_TESTw ,0 ,M_EwIw },
|
||||
{0 ,O_NOT ,S_Ew ,M_Ew },{0 ,t_NEGw ,S_Ew ,M_Ew },
|
||||
{0 ,O_MULw ,0 ,M_Ew },{0 ,O_IMULw ,0 ,M_Ew },
|
||||
{0 ,O_DIVw ,0 ,M_Ew },{0 ,O_IDIVw ,0 ,M_Ew },
|
||||
},{ /* 0x0a Group 3 Ed */
|
||||
{0 ,t_TESTd ,0 ,M_EdId },{0 ,t_TESTd ,0 ,M_EdId },
|
||||
{0 ,O_NOT ,S_Ed ,M_Ed },{0 ,t_NEGd ,S_Ed ,M_Ed },
|
||||
{0 ,O_MULd ,0 ,M_Ed },{0 ,O_IMULd ,0 ,M_Ed },
|
||||
{0 ,O_DIVd ,0 ,M_Ed },{0 ,O_IDIVd ,0 ,M_Ed },
|
||||
|
||||
},{ /* 0x0b Group 4 Eb */
|
||||
{0 ,t_INCb ,S_Eb ,M_Eb },{0 ,t_DECb ,S_Eb ,M_Eb },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,O_CBACK ,0 ,M_Iw },
|
||||
},{ /* 0x0c Group 5 Ew */
|
||||
{0 ,t_INCw ,S_Ew ,M_Ew },{0 ,t_DECw ,S_Ew ,M_Ew },
|
||||
{0 ,O_CALLNw ,S_IP ,M_Ew },{0 ,O_CALLFw ,0 ,M_Efw },
|
||||
{0 ,0 ,S_IP ,M_Ew },{0 ,O_JMPFw ,0 ,M_Efw },
|
||||
{0 ,0 ,S_PUSHw,M_Ew },{0 ,0 ,0 ,0 },
|
||||
},{ /* 0x0d Group 5 Ed */
|
||||
{0 ,t_INCd ,S_Ed ,M_Ed },{0 ,t_DECd ,S_Ed ,M_Ed },
|
||||
{0 ,O_CALLNd ,S_IP ,M_Ed },{0 ,O_CALLFd ,0 ,M_Efd },
|
||||
{0 ,0 ,S_IP ,M_Ed },{0 ,O_JMPFd ,0 ,M_Efd },
|
||||
{0 ,0 ,S_PUSHd,M_Ed },{0 ,0 ,0 ,0 },
|
||||
|
||||
|
||||
},{ /* 0x0e Group 8 Ew */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,O_BTw ,0 ,M_Ib },{0 ,O_BTSw ,0 ,M_Ib },
|
||||
{0 ,O_BTRw ,0 ,M_Ib },{0 ,O_BTCw ,0 ,M_Ib },
|
||||
},{ /* 0x0f Group 8 Ed */
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
|
||||
{0 ,O_BTd ,0 ,M_Ib },{0 ,O_BTSd ,0 ,M_Ib },
|
||||
{0 ,O_BTRd ,0 ,M_Ib },{0 ,O_BTCd ,0 ,M_Ib },
|
||||
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
122
src/cpu/core_full/save.h
Normal file
122
src/cpu/core_full/save.h
Normal file
@ -0,0 +1,122 @@
|
||||
/* Write the data from the opcode */
|
||||
switch (inst.code.save) {
|
||||
/* Byte */
|
||||
case S_C_Eb:
|
||||
inst.op1.b=inst.cond ? 1 : 0;
|
||||
case S_Eb:
|
||||
if (inst.rm<0xc0) SaveMb(inst.rm_eaa,inst.op1.b);
|
||||
else reg_8(inst.rm_eai)=inst.op1.b;
|
||||
break;
|
||||
case S_Gb:
|
||||
reg_8(inst.rm_index)=inst.op1.b;
|
||||
break;
|
||||
case S_EbGb:
|
||||
if (inst.rm<0xc0) SaveMb(inst.rm_eaa,inst.op1.b);
|
||||
else reg_8(inst.rm_eai)=inst.op1.b;
|
||||
reg_8(inst.rm_index)=inst.op2.b;
|
||||
break;
|
||||
/* Word */
|
||||
case S_Ew:
|
||||
if (inst.rm<0xc0) SaveMw(inst.rm_eaa,inst.op1.w);
|
||||
else reg_16(inst.rm_eai)=inst.op1.w;
|
||||
break;
|
||||
case S_Gw:
|
||||
reg_16(inst.rm_index)=inst.op1.w;
|
||||
break;
|
||||
case S_EwGw:
|
||||
if (inst.rm<0xc0) SaveMw(inst.rm_eaa,inst.op1.w);
|
||||
else reg_16(inst.rm_eai)=inst.op1.w;
|
||||
reg_16(inst.rm_index)=inst.op2.w;
|
||||
break;
|
||||
/* Dword */
|
||||
case S_Ed:
|
||||
if (inst.rm<0xc0) SaveMd(inst.rm_eaa,inst.op1.d);
|
||||
else reg_32(inst.rm_eai)=inst.op1.d;
|
||||
break;
|
||||
case S_EdMw: /* Special one 16 to memory, 32 zero extend to reg */
|
||||
if (inst.rm<0xc0) SaveMw(inst.rm_eaa,inst.op1.w);
|
||||
else reg_32(inst.rm_eai)=inst.op1.d;
|
||||
break;
|
||||
case S_Gd:
|
||||
reg_32(inst.rm_index)=inst.op1.d;
|
||||
break;
|
||||
case S_EdGd:
|
||||
if (inst.rm<0xc0) SaveMd(inst.rm_eaa,inst.op1.d);
|
||||
else reg_32(inst.rm_eai)=inst.op1.d;
|
||||
reg_32(inst.rm_index)=inst.op2.d;
|
||||
break;
|
||||
|
||||
case S_REGb:
|
||||
reg_8(inst.code.extra)=inst.op1.b;
|
||||
break;
|
||||
case S_REGw:
|
||||
reg_16(inst.code.extra)=inst.op1.w;
|
||||
break;
|
||||
case S_REGd:
|
||||
reg_32(inst.code.extra)=inst.op1.d;
|
||||
break;
|
||||
case S_SEGI:
|
||||
CPU_SetSegGeneral((SegNames)inst.code.extra,inst.op1.w);
|
||||
break;
|
||||
case S_SEGm:
|
||||
CPU_SetSegGeneral((SegNames)inst.rm_index,inst.op1.w);
|
||||
break;
|
||||
case S_SEGGw:
|
||||
reg_16(inst.rm_index)=inst.op1.w;
|
||||
CPU_SetSegGeneral((SegNames)inst.code.extra,inst.op2.w);
|
||||
break;
|
||||
case S_SEGGd:
|
||||
reg_32(inst.rm_index)=inst.op1.d;
|
||||
CPU_SetSegGeneral((SegNames)inst.code.extra,inst.op2.w);
|
||||
break;
|
||||
case S_PUSHw:
|
||||
Push_16(inst.op1.w);
|
||||
break;
|
||||
case S_PUSHd:
|
||||
Push_32(inst.op1.d);
|
||||
break;
|
||||
|
||||
case S_C_AIPw:
|
||||
if (!inst.cond) goto nextopcode;
|
||||
case S_AIPw:
|
||||
SaveIP();
|
||||
reg_eip+=inst.op1.d;
|
||||
reg_eip&=0xffff;
|
||||
LoadIP();
|
||||
break;
|
||||
case S_C_AIPd:
|
||||
if (!inst.cond) goto nextopcode;
|
||||
case S_AIPd:
|
||||
SaveIP();
|
||||
reg_eip+=inst.op1.d;
|
||||
LoadIP();
|
||||
break;
|
||||
case S_IPIw:
|
||||
reg_esp+=Fetchw();
|
||||
case S_IP:
|
||||
SaveIP();
|
||||
reg_eip=inst.op1.d;
|
||||
LoadIP();
|
||||
break;
|
||||
case S_FLGb:
|
||||
SETFLAGSb(inst.op1.b);
|
||||
break;
|
||||
case S_FLGw:
|
||||
SETFLAGSw(inst.op1.w);
|
||||
if (GETFLAG(IF) && PIC_IRQCheck) {
|
||||
SaveIP();
|
||||
return CBRET_NONE;
|
||||
}
|
||||
break;
|
||||
case S_FLGd:
|
||||
SETFLAGSd(inst.op1.d);
|
||||
if (GETFLAG(IF) && PIC_IRQCheck) {
|
||||
SaveIP();
|
||||
return CBRET_NONE;
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
break;
|
||||
default:
|
||||
LOG(LOG_CPU,LOG_ERROR)("SAVE:Unhandled code %d entry %X",inst.code.save,inst.entry);
|
||||
}
|
230
src/cpu/core_full/string.h
Normal file
230
src/cpu/core_full/string.h
Normal file
@ -0,0 +1,230 @@
|
||||
{
|
||||
EAPoint si_base,di_base;
|
||||
Bitu si_index,di_index;
|
||||
Bitu add_mask;
|
||||
Bitu count,count_left;
|
||||
Bits add_index;
|
||||
|
||||
if (inst.prefix & PREFIX_SEG) si_base=inst.seg.base;
|
||||
else si_base=SegBase(ds);
|
||||
di_base=SegBase(es);
|
||||
if (inst.prefix & PREFIX_ADDR) {
|
||||
add_mask=0xFFFFFFFF;
|
||||
si_index=reg_esi;
|
||||
di_index=reg_edi;
|
||||
count=reg_ecx;
|
||||
} else {
|
||||
add_mask=0xFFFF;
|
||||
si_index=reg_si;
|
||||
di_index=reg_di;
|
||||
count=reg_cx;
|
||||
}
|
||||
if (!(inst.prefix & PREFIX_REP)) {
|
||||
count=1;
|
||||
} else {
|
||||
/* Calculate amount of ops to do before cycles run out */
|
||||
if ((count>(Bitu)CPU_Cycles) && (inst.code.op<R_SCASB)) {
|
||||
count_left=count-CPU_Cycles;
|
||||
count=CPU_Cycles;
|
||||
CPU_Cycles=0;
|
||||
IPPoint=inst.start; //Reset IP to start of instruction
|
||||
} else {
|
||||
/* Won't interrupt scas and cmps instruction since they can interrupt themselves */
|
||||
count_left=0;
|
||||
}
|
||||
}
|
||||
add_index=GETFLAG(DF) ? -1 : 1;
|
||||
if (count) switch (inst.code.op) {
|
||||
case R_OUTSB:
|
||||
for (;count>0;count--) {
|
||||
IO_Write(reg_dx,LoadMb(si_base+si_index));
|
||||
si_index=(si_index+add_index) & add_mask;
|
||||
}
|
||||
break;
|
||||
case R_OUTSW:
|
||||
add_index<<=1;
|
||||
for (;count>0;count--) {
|
||||
IO_Write(reg_dx,LoadMb(si_base+si_index));
|
||||
IO_Write(reg_dx+1,LoadMb(si_base+si_index+1));
|
||||
si_index=(si_index+add_index) & add_mask;
|
||||
}
|
||||
break;
|
||||
case R_OUTSD:
|
||||
add_index<<=2;
|
||||
for (;count>0;count--) {
|
||||
IO_Write(reg_dx,LoadMb(si_base+si_index));
|
||||
IO_Write(reg_dx+1,LoadMb(si_base+si_index+1));
|
||||
IO_Write(reg_dx+2,LoadMb(si_base+si_index+2));
|
||||
IO_Write(reg_dx+3,LoadMb(si_base+si_index+3));
|
||||
si_index=(si_index+add_index) & add_mask;
|
||||
}
|
||||
break;
|
||||
case R_INSB:
|
||||
for (;count>0;count--) {
|
||||
SaveMb(di_base+di_index,IO_Read(reg_dx));
|
||||
di_index=(di_index+add_index) & add_mask;
|
||||
}
|
||||
break;
|
||||
case R_INSW:
|
||||
add_index<<=1;
|
||||
for (;count>0;count--) {
|
||||
SaveMb(di_base+di_index,IO_Read(reg_dx));
|
||||
SaveMb(di_base+di_index+1,IO_Read(reg_dx+1));
|
||||
di_index=(di_index+add_index) & add_mask;
|
||||
}
|
||||
break;
|
||||
case R_STOSB:
|
||||
for (;count>0;count--) {
|
||||
SaveMb(di_base+di_index,reg_al);
|
||||
di_index=(di_index+add_index) & add_mask;
|
||||
}
|
||||
break;
|
||||
case R_STOSW:
|
||||
add_index<<=1;
|
||||
for (;count>0;count--) {
|
||||
SaveMw(di_base+di_index,reg_ax);
|
||||
di_index=(di_index+add_index) & add_mask;
|
||||
}
|
||||
break;
|
||||
case R_STOSD:
|
||||
add_index<<=2;
|
||||
for (;count>0;count--) {
|
||||
SaveMd(di_base+di_index,reg_eax);
|
||||
di_index=(di_index+add_index) & add_mask;
|
||||
}
|
||||
break;
|
||||
case R_MOVSB:
|
||||
for (;count>0;count--) {
|
||||
SaveMb(di_base+di_index,LoadMb(si_base+si_index));
|
||||
di_index=(di_index+add_index) & add_mask;
|
||||
si_index=(si_index+add_index) & add_mask;
|
||||
}
|
||||
break;
|
||||
case R_MOVSW:
|
||||
add_index<<=1;
|
||||
for (;count>0;count--) {
|
||||
SaveMw(di_base+di_index,LoadMw(si_base+si_index));
|
||||
di_index=(di_index+add_index) & add_mask;
|
||||
si_index=(si_index+add_index) & add_mask;
|
||||
}
|
||||
break;
|
||||
case R_MOVSD:
|
||||
add_index<<=2;
|
||||
for (;count>0;count--) {
|
||||
SaveMd(di_base+di_index,LoadMd(si_base+si_index));
|
||||
di_index=(di_index+add_index) & add_mask;
|
||||
si_index=(si_index+add_index) & add_mask;
|
||||
}
|
||||
break;
|
||||
case R_LODSB:
|
||||
for (;count>0;count--) {
|
||||
reg_al=LoadMb(si_base+si_index);
|
||||
si_index=(si_index+add_index) & add_mask;
|
||||
}
|
||||
break;
|
||||
case R_LODSW:
|
||||
add_index<<=1;
|
||||
for (;count>0;count--) {
|
||||
reg_ax=LoadMw(si_base+si_index);
|
||||
si_index=(si_index+add_index) & add_mask;
|
||||
}
|
||||
break;
|
||||
case R_LODSD:
|
||||
add_index<<=2;
|
||||
for (;count>0;count--) {
|
||||
reg_eax=LoadMd(si_base+si_index);
|
||||
si_index=(si_index+add_index) & add_mask;
|
||||
}
|
||||
break;
|
||||
case R_SCASB:
|
||||
{
|
||||
Bit8u val2;
|
||||
for (;count>0;) {
|
||||
count--;CPU_Cycles--;
|
||||
val2=LoadMb(di_base+di_index);
|
||||
di_index=(di_index+add_index) & add_mask;
|
||||
if ((reg_al==val2)!=inst.repz) break;
|
||||
}
|
||||
CMPB(reg_al,val2,LoadD,0);
|
||||
}
|
||||
break;
|
||||
case R_SCASW:
|
||||
{
|
||||
add_index<<=1;Bit16u val2;
|
||||
for (;count>0;) {
|
||||
count--;CPU_Cycles--;
|
||||
val2=LoadMw(di_base+di_index);
|
||||
di_index=(di_index+add_index) & add_mask;
|
||||
if ((reg_ax==val2)!=inst.repz) break;
|
||||
}
|
||||
CMPW(reg_ax,val2,LoadD,0);
|
||||
}
|
||||
break;
|
||||
case R_SCASD:
|
||||
{
|
||||
add_index<<=2;Bit32u val2;
|
||||
for (;count>0;) {
|
||||
count--;CPU_Cycles--;
|
||||
val2=LoadMd(di_base+di_index);
|
||||
di_index=(di_index+add_index) & add_mask;
|
||||
if ((reg_eax==val2)!=inst.repz) break;
|
||||
}
|
||||
CMPD(reg_eax,val2,LoadD,0);
|
||||
}
|
||||
break;
|
||||
case R_CMPSB:
|
||||
{
|
||||
Bit8u val1,val2;
|
||||
for (;count>0;) {
|
||||
count--;CPU_Cycles--;
|
||||
val1=LoadMb(si_base+si_index);
|
||||
val2=LoadMb(di_base+di_index);
|
||||
si_index=(si_index+add_index) & add_mask;
|
||||
di_index=(di_index+add_index) & add_mask;
|
||||
if ((val1==val2)!=inst.repz) break;
|
||||
}
|
||||
CMPB(val1,val2,LoadD,0);
|
||||
}
|
||||
break;
|
||||
case R_CMPSW:
|
||||
{
|
||||
add_index<<=1;Bit16u val1,val2;
|
||||
for (;count>0;) {
|
||||
count--;CPU_Cycles--;
|
||||
val1=LoadMw(si_base+si_index);
|
||||
val2=LoadMw(di_base+di_index);
|
||||
si_index=(si_index+add_index) & add_mask;
|
||||
di_index=(di_index+add_index) & add_mask;
|
||||
if ((val1==val2)!=inst.repz) break;
|
||||
}
|
||||
CMPW(val1,val2,LoadD,0);
|
||||
}
|
||||
break;
|
||||
case R_CMPSD:
|
||||
{
|
||||
add_index<<=2;Bit32u val1,val2;
|
||||
for (;count>0;) {
|
||||
count--;CPU_Cycles--;
|
||||
val1=LoadMd(si_base+si_index);
|
||||
val2=LoadMd(di_base+di_index);
|
||||
si_index=(si_index+add_index) & add_mask;
|
||||
di_index=(di_index+add_index) & add_mask;
|
||||
if ((val1==val2)!=inst.repz) break;
|
||||
}
|
||||
CMPD(val1,val2,LoadD,0);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
LOG(LOG_CPU,LOG_ERROR)("Unhandled string %d entry %X",inst.code.op,inst.entry);
|
||||
}
|
||||
/* Clean up after certain amount of instructions */
|
||||
reg_esi&=(~add_mask);
|
||||
reg_esi|=(si_index & add_mask);
|
||||
reg_edi&=(~add_mask);
|
||||
reg_edi|=(di_index & add_mask);
|
||||
if (inst.prefix & PREFIX_REP) {
|
||||
count+=count_left;
|
||||
reg_ecx&=(~add_mask);
|
||||
reg_ecx|=(count & add_mask);
|
||||
}
|
||||
}
|
188
src/cpu/core_full/support.h
Normal file
188
src/cpu/core_full/support.h
Normal file
@ -0,0 +1,188 @@
|
||||
enum {
|
||||
L_N=0,
|
||||
L_SKIP,
|
||||
/* Grouped ones using MOD/RM */
|
||||
L_MODRM,
|
||||
|
||||
L_Ib,L_Iw,L_Id,
|
||||
L_Ibx,L_Iwx,L_Idx, //Sign extend
|
||||
L_Ifw,L_Ifd,
|
||||
L_OP,
|
||||
|
||||
L_REGb,L_REGw,L_REGd,
|
||||
L_REGbIb,L_REGwIw,L_REGdId,
|
||||
L_POPw,L_POPd,
|
||||
L_POPfw,L_POPfd,
|
||||
L_SEG,
|
||||
|
||||
|
||||
|
||||
L_FLG,L_INTO,
|
||||
|
||||
L_VAL,
|
||||
L_PRESEG,
|
||||
L_DOUBLE,
|
||||
L_PREOP,L_PREADD,L_PREREP,L_PREREPNE,
|
||||
L_STRING,
|
||||
|
||||
/* Direct ones */
|
||||
D_IRETw,D_IRETd,
|
||||
D_PUSHAw,D_PUSHAd,
|
||||
D_POPAw,D_POPAd,
|
||||
D_DAA,D_DAS,
|
||||
D_AAA,D_AAS,
|
||||
D_CBW,D_CWDE,
|
||||
D_CWD,D_CDQ,
|
||||
D_SETALC,
|
||||
D_XLATw,D_XLATd,
|
||||
D_CLI,D_STI,D_STC,D_CLC,D_CMC,D_CLD,D_STD,
|
||||
D_NOP,D_WAIT,
|
||||
D_ENTERw,D_ENTERd,
|
||||
D_LEAVEw,D_LEAVEd,
|
||||
L_ERROR,
|
||||
|
||||
D_RETFw,D_RETFd,
|
||||
D_RETFwIw,D_RETFdIw,
|
||||
D_CPUID,
|
||||
D_HLT,
|
||||
};
|
||||
|
||||
|
||||
enum {
|
||||
O_N=t_LASTFLAG,
|
||||
O_COND,
|
||||
O_XCHG_AX,O_XCHG_EAX,
|
||||
O_IMULRw,O_IMULRd,
|
||||
O_BOUNDw,O_BOUNDd,
|
||||
O_CALLNw,O_CALLNd,
|
||||
O_CALLFw,O_CALLFd,
|
||||
O_JMPFw,O_JMPFd,
|
||||
|
||||
O_OPAL,O_ALOP,
|
||||
O_OPAX,O_AXOP,
|
||||
O_OPEAX,O_EAXOP,
|
||||
O_INT,
|
||||
O_SEGDS,O_SEGES,O_SEGFS,O_SEGGS,O_SEGSS,
|
||||
O_LOOP,O_LOOPZ,O_LOOPNZ,O_JCXZ,
|
||||
O_INb,O_INw,O_INd,
|
||||
O_OUTb,O_OUTw,O_OUTd,
|
||||
|
||||
O_NOT,O_AAM,O_AAD,
|
||||
O_MULb,O_MULw,O_MULd,
|
||||
O_IMULb,O_IMULw,O_IMULd,
|
||||
O_DIVb,O_DIVw,O_DIVd,
|
||||
O_IDIVb,O_IDIVw,O_IDIVd,
|
||||
O_CBACK,
|
||||
|
||||
|
||||
O_DSHLw,O_DSHLd,
|
||||
O_DSHRw,O_DSHRd,
|
||||
O_C_O ,O_C_NO ,O_C_B ,O_C_NB ,O_C_Z ,O_C_NZ ,O_C_BE ,O_C_NBE,
|
||||
O_C_S ,O_C_NS ,O_C_P ,O_C_NP ,O_C_L ,O_C_NL ,O_C_LE ,O_C_NLE,
|
||||
|
||||
O_GRP6w,O_GRP6d,
|
||||
O_GRP7w,O_GRP7d,
|
||||
O_M_Cd_Rd,O_M_Rd_Cd,
|
||||
O_LAR,O_LSL,
|
||||
O_ARPL,
|
||||
|
||||
O_BTw,O_BTSw,O_BTRw,O_BTCw,
|
||||
O_BTd,O_BTSd,O_BTRd,O_BTCd,
|
||||
O_BSFw,O_BSRw,O_BSFd,O_BSRd,
|
||||
|
||||
O_BSWAP,
|
||||
O_FPU,
|
||||
|
||||
|
||||
};
|
||||
|
||||
enum {
|
||||
S_N=0,
|
||||
S_C_Eb,
|
||||
S_Eb,S_Gb,S_EbGb,
|
||||
S_Ew,S_Gw,S_EwGw,
|
||||
S_Ed,S_Gd,S_EdGd,S_EdMw,
|
||||
|
||||
|
||||
S_REGb,S_REGw,S_REGd,
|
||||
S_PUSHw,S_PUSHd,
|
||||
S_SEGI,
|
||||
S_SEGm,
|
||||
S_SEGGw,S_SEGGd,
|
||||
|
||||
|
||||
S_AIPw,S_C_AIPw,
|
||||
S_AIPd,S_C_AIPd,
|
||||
|
||||
S_FLGb,S_FLGw,S_FLGd,
|
||||
S_IP,S_IPIw,
|
||||
};
|
||||
|
||||
enum {
|
||||
R_OUTSB,R_OUTSW,R_OUTSD,
|
||||
R_INSB,R_INSW,R_INSD,
|
||||
R_MOVSB,R_MOVSW,R_MOVSD,
|
||||
R_LODSB,R_LODSW,R_LODSD,
|
||||
R_STOSB,R_STOSW,R_STOSD,
|
||||
R_SCASB,R_SCASW,R_SCASD,
|
||||
R_CMPSB,R_CMPSW,R_CMPSD,
|
||||
};
|
||||
|
||||
enum {
|
||||
M_None=0,
|
||||
M_Ebx,M_Eb,M_Gb,M_EbGb,M_GbEb,
|
||||
M_Ewx,M_Ew,M_Gw,M_EwGw,M_GwEw,M_EwxGwx,
|
||||
M_Edx,M_Ed,M_Gd,M_EdGd,M_GdEd,M_EdxGdx,
|
||||
|
||||
M_EbIb,
|
||||
M_EwIw,M_EwIbx,M_EwxIbx,M_EwxIwx,M_EwGwIb,M_EwGwCL,
|
||||
M_EdId,M_EdIbx,M_EdGdIb,M_EdGdCL,
|
||||
|
||||
M_Efw,M_Efd,
|
||||
|
||||
M_Ib,M_Iw,M_Id,
|
||||
|
||||
|
||||
M_SEG,M_EA,
|
||||
M_GRP,
|
||||
M_GRP_Ib,M_GRP_CL,M_GRP_1,
|
||||
|
||||
M_POPw,M_POPd,
|
||||
};
|
||||
|
||||
struct OpCode {
|
||||
Bit8u load,op,save,extra;
|
||||
};
|
||||
|
||||
struct FullData {
|
||||
Bitu entry;
|
||||
EAPoint start;
|
||||
Bitu rm;
|
||||
EAPoint rm_eaa;
|
||||
Bitu rm_off;
|
||||
Bitu rm_eai;
|
||||
Bitu rm_index;
|
||||
Bitu rm_mod;
|
||||
OpCode code;
|
||||
union {
|
||||
Bit8u b;Bit8s bs;
|
||||
Bit16u w;Bit16s ws;
|
||||
Bit32u d;Bit32s ds;
|
||||
} op1,op2,imm;
|
||||
Bitu new_flags;
|
||||
struct {
|
||||
EAPoint base;
|
||||
} seg;
|
||||
Bitu cond;
|
||||
bool repz;
|
||||
Bitu prefix;
|
||||
Bitu start_prefix;
|
||||
Bitu start_entry;
|
||||
};
|
||||
|
||||
|
||||
#define PREFIX_NONE 0x0
|
||||
#define PREFIX_SEG 0x1
|
||||
#define PREFIX_ADDR 0x2
|
||||
#define PREFIX_REP 0x4
|
||||
|
225
src/cpu/core_normal.cpp
Normal file
225
src/cpu/core_normal.cpp
Normal file
@ -0,0 +1,225 @@
|
||||
/*
|
||||
* Copyright (C) 2002-2003 The DOSBox Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
#include "dosbox.h"
|
||||
#include "mem.h"
|
||||
#include "cpu.h"
|
||||
#include "lazyflags.h"
|
||||
#include "inout.h"
|
||||
#include "callback.h"
|
||||
#include "pic.h"
|
||||
#include "fpu.h"
|
||||
|
||||
#if C_DEBUG
|
||||
#include "debug.h"
|
||||
#endif
|
||||
|
||||
|
||||
#define SegBase(c) SegPhys(c)
|
||||
#if (!C_CORE_INLINE)
|
||||
|
||||
#define LoadMb(off) mem_readb(off)
|
||||
#define LoadMw(off) mem_readw(off)
|
||||
#define LoadMd(off) mem_readd(off)
|
||||
|
||||
#define SaveMb(off,val) mem_writeb(off,val)
|
||||
#define SaveMw(off,val) mem_writew(off,val)
|
||||
#define SaveMd(off,val) mem_writed(off,val)
|
||||
|
||||
#else
|
||||
|
||||
#include "paging.h"
|
||||
#define LoadMb(off) mem_readb_inline(off)
|
||||
#define LoadMw(off) mem_readw_inline(off)
|
||||
#define LoadMd(off) mem_readd_inline(off)
|
||||
|
||||
#define SaveMb(off,val) mem_writeb_inline(off,val)
|
||||
#define SaveMw(off,val) mem_writew_inline(off,val)
|
||||
#define SaveMd(off,val) mem_writed_inline(off,val)
|
||||
|
||||
#endif
|
||||
|
||||
#define LoadMbs(off) (Bit8s)(LoadMb(off))
|
||||
#define LoadMws(off) (Bit16s)(LoadMw(off))
|
||||
#define LoadMds(off) (Bit32s)(LoadMd(off))
|
||||
|
||||
#define LoadRb(reg) reg
|
||||
#define LoadRw(reg) reg
|
||||
#define LoadRd(reg) reg
|
||||
|
||||
#define SaveRb(reg,val) reg=val
|
||||
#define SaveRw(reg,val) reg=val
|
||||
#define SaveRd(reg,val) reg=val
|
||||
|
||||
extern Bitu cycle_count;
|
||||
|
||||
#if C_FPU
|
||||
#define CPU_FPU 1 //Enable FPU escape instructions
|
||||
#endif
|
||||
|
||||
#define CPU_PIC_CHECK 1
|
||||
#define CPU_TRAP_CHECK 1
|
||||
|
||||
#define OPCODE_NONE 0x000
|
||||
#define OPCODE_0F 0x100
|
||||
#define OPCODE_SIZE 0x200
|
||||
|
||||
#define PREFIX_SEG 0x1
|
||||
#define PREFIX_ADDR 0x2
|
||||
#define PREFIX_SEG_ADDR (PREFIX_SEG|PREFIX_ADDR)
|
||||
#define PREFIX_REP 0x4
|
||||
|
||||
#define TEST_PREFIX_SEG (core.prefixes & PREFIX_SEG)
|
||||
#define TEST_PREFIX_ADDR (core.prefixes & PREFIX_ADDR)
|
||||
#define TEST_PREFIX_REP (core.prefixes & PREFIX_REP)
|
||||
|
||||
#define DO_PREFIX_SEG(_SEG) \
|
||||
core.prefixes|=PREFIX_SEG; \
|
||||
core.seg_prefix_base=SegBase(_SEG); \
|
||||
goto restart_prefix;
|
||||
|
||||
#define DO_PREFIX_ADDR() \
|
||||
core.prefixes^=PREFIX_ADDR; \
|
||||
goto restart_prefix;
|
||||
|
||||
#define DO_PREFIX_REP(_ZERO) \
|
||||
core.prefixes|=PREFIX_REP; \
|
||||
core.rep_zero=_ZERO; \
|
||||
goto restart_prefix;
|
||||
|
||||
typedef PhysPt (*GetEATable[256])(void);
|
||||
|
||||
static struct {
|
||||
Bitu opcode_index;
|
||||
Bitu prefixes;
|
||||
Bitu index_default;
|
||||
Bitu prefix_default;
|
||||
PhysPt op_start;
|
||||
PhysPt ip_lookup;
|
||||
PhysPt seg_prefix_base;
|
||||
bool rep_zero;
|
||||
GetEATable * ea_table;
|
||||
} core;
|
||||
|
||||
#include "instructions.h"
|
||||
#include "core_normal/support.h"
|
||||
#include "core_normal/string.h"
|
||||
|
||||
static GetEATable * EAPrefixTable[8] = {
|
||||
&GetEA_NONE,&GetEA_SEG,&GetEA_ADDR,&GetEA_SEG_ADDR,
|
||||
&GetEA_NONE,&GetEA_SEG,&GetEA_ADDR,&GetEA_SEG_ADDR,
|
||||
};
|
||||
|
||||
#define CASE_W(_WHICH) \
|
||||
case (OPCODE_NONE+_WHICH):
|
||||
|
||||
#define CASE_D(_WHICH) \
|
||||
case (OPCODE_SIZE+_WHICH):
|
||||
|
||||
#define CASE_B(_WHICH) \
|
||||
CASE_W(_WHICH) \
|
||||
CASE_D(_WHICH)
|
||||
|
||||
#define CASE_0F_W(_WHICH) \
|
||||
case ((OPCODE_0F|OPCODE_NONE)+_WHICH):
|
||||
|
||||
#define CASE_0F_D(_WHICH) \
|
||||
case ((OPCODE_0F|OPCODE_SIZE)+_WHICH):
|
||||
|
||||
#define CASE_0F_B(_WHICH) \
|
||||
CASE_0F_W(_WHICH) \
|
||||
CASE_0F_D(_WHICH)
|
||||
|
||||
#define EALookupTable (*(core.ea_table))
|
||||
|
||||
|
||||
static Bits CPU_Core_Normal_Decode_Trap(void);
|
||||
|
||||
static Bits CPU_Core_Normal_Decode(void) {
|
||||
decode_start:
|
||||
LOADIP;
|
||||
flags.type=t_UNKNOWN;
|
||||
while (CPU_Cycles>0) {
|
||||
core.op_start=core.ip_lookup;
|
||||
core.opcode_index=core.index_default;
|
||||
core.prefixes=core.prefix_default;
|
||||
#if C_DEBUG
|
||||
cycle_count++;
|
||||
#if C_HEAVY_DEBUG
|
||||
SAVEIP;
|
||||
if (DEBUG_HeavyIsBreakpoint()) {
|
||||
LEAVECORE;
|
||||
return debugCallback;
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
CPU_Cycles--;
|
||||
restart_prefix:
|
||||
core.ea_table=EAPrefixTable[core.prefixes];
|
||||
restart_opcode:
|
||||
switch (core.opcode_index+Fetchb()) {
|
||||
|
||||
#include "core_normal/prefix_none.h"
|
||||
#include "core_normal/prefix_0f.h"
|
||||
#include "core_normal/prefix_66.h"
|
||||
#include "core_normal/prefix_66_0f.h"
|
||||
default:
|
||||
ADDIPFAST(-1);
|
||||
#if C_DEBUG
|
||||
LOG_MSG("Unhandled code %X",core.opcode_index+Fetchb());
|
||||
#else
|
||||
E_Exit("Unhandled CPU opcode");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
decode_end:
|
||||
LEAVECORE;
|
||||
return CBRET_NONE;
|
||||
}
|
||||
|
||||
static Bits CPU_Core_Normal_Decode_Trap(void) {
|
||||
|
||||
Bits oldCycles = CPU_Cycles;
|
||||
CPU_Cycles = 1;
|
||||
Bits ret=CPU_Core_Normal_Decode();
|
||||
|
||||
Interrupt(1);
|
||||
|
||||
CPU_Cycles = oldCycles-1;
|
||||
cpudecoder = &CPU_Core_Normal_Decode;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CPU_Core_Normal_Start(bool big) {
|
||||
|
||||
if (GETFLAG(TF)) cpudecoder=CPU_Core_Normal_Decode_Trap;
|
||||
else cpudecoder=CPU_Core_Normal_Decode;
|
||||
|
||||
if (big) {
|
||||
core.index_default=0x200;
|
||||
core.prefix_default=PREFIX_ADDR;
|
||||
} else {
|
||||
core.index_default=0;
|
||||
core.prefix_default=0;
|
||||
}
|
||||
}
|
||||
|
3
src/cpu/core_normal/Makefile.am
Normal file
3
src/cpu/core_normal/Makefile.am
Normal file
@ -0,0 +1,3 @@
|
||||
|
||||
noinst_HEADERS = helpers.h prefix_none.h prefix_66.h prefix_0f.h support.h table_ea.h \
|
||||
prefix_66_0f.h string.h
|
326
src/cpu/core_normal/Makefile.in
Normal file
326
src/cpu/core_normal/Makefile.in
Normal file
@ -0,0 +1,326 @@
|
||||
# Makefile.in generated by automake 1.7.7 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = ../../..
|
||||
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
INSTALL = @INSTALL@
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_triplet = @host@
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMDEP_FALSE = @AMDEP_FALSE@
|
||||
AMDEP_TRUE = @AMDEP_TRUE@
|
||||
AMTAR = @AMTAR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SDL_CFLAGS = @SDL_CFLAGS@
|
||||
SDL_CONFIG = @SDL_CONFIG@
|
||||
SDL_LIBS = @SDL_LIBS@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_RANLIB = @ac_ct_RANLIB@
|
||||
ac_ct_STRIP = @ac_ct_STRIP@
|
||||
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
|
||||
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
|
||||
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
|
||||
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
datadir = @datadir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
oldincludedir = @oldincludedir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target = @target@
|
||||
target_alias = @target_alias@
|
||||
target_cpu = @target_cpu@
|
||||
target_os = @target_os@
|
||||
target_vendor = @target_vendor@
|
||||
|
||||
noinst_HEADERS = helpers.h prefix_none.h prefix_66.h prefix_0f.h support.h table_ea.h \
|
||||
prefix_66_0f.h string.h
|
||||
|
||||
subdir = src/cpu/core_normal
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
DIST_SOURCES =
|
||||
HEADERS = $(noinst_HEADERS)
|
||||
|
||||
DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.in Makefile.am
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnits src/cpu/core_normal/Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
|
||||
uninstall-info-am:
|
||||
|
||||
ETAGS = etags
|
||||
ETAGSFLAGS =
|
||||
|
||||
CTAGS = ctags
|
||||
CTAGSFLAGS =
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
mkid -fID $$unique
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|
||||
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
top_distdir = ../../..
|
||||
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(DISTFILES)'; for file in $$list; do \
|
||||
case $$file in \
|
||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
|
||||
esac; \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
dir="/$$dir"; \
|
||||
$(mkinstalldirs) "$(distdir)$$dir"; \
|
||||
else \
|
||||
dir=''; \
|
||||
fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
|
||||
fi; \
|
||||
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(HEADERS)
|
||||
|
||||
installdirs:
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f Makefile
|
||||
|
||||
distclean-am: clean-am distclean-generic distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-man:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f Makefile
|
||||
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-info-am
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic ctags \
|
||||
distclean distclean-generic distclean-tags distdir dvi dvi-am \
|
||||
info info-am install install-am install-data install-data-am \
|
||||
install-exec install-exec-am install-info install-info-am \
|
||||
install-man install-strip installcheck installcheck-am \
|
||||
installdirs maintainer-clean maintainer-clean-generic \
|
||||
mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \
|
||||
uninstall uninstall-am uninstall-info-am
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
143
src/cpu/core_normal/helpers.h
Normal file
143
src/cpu/core_normal/helpers.h
Normal file
@ -0,0 +1,143 @@
|
||||
/*
|
||||
* Copyright (C) 2002 The DOSBox Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
#define GetEAa \
|
||||
PhysPt eaa=EALookupTable[rm]();
|
||||
|
||||
#define GetRMEAa \
|
||||
GetRM; \
|
||||
GetEAa;
|
||||
|
||||
|
||||
#define RMEbGb(inst) \
|
||||
{ \
|
||||
GetRMrb; \
|
||||
if (rm >= 0xc0 ) {GetEArb;inst(*earb,*rmrb,LoadRb,SaveRb);} \
|
||||
else {GetEAa;inst(eaa,*rmrb,LoadMb,SaveMb);} \
|
||||
}
|
||||
|
||||
#define RMGbEb(inst) \
|
||||
{ \
|
||||
GetRMrb; \
|
||||
if (rm >= 0xc0 ) {GetEArb;inst(*rmrb,*earb,LoadRb,SaveRb);} \
|
||||
else {GetEAa;inst(*rmrb,LoadMb(eaa),LoadRb,SaveRb);} \
|
||||
}
|
||||
|
||||
#define RMEb(inst) \
|
||||
{ \
|
||||
if (rm >= 0xc0 ) {GetEArb;inst(*earb,LoadRb,SaveRb);} \
|
||||
else {GetEAa;inst(eaa,LoadMb,SaveMb);} \
|
||||
}
|
||||
|
||||
#define RMEwGw(inst) \
|
||||
{ \
|
||||
GetRMrw; \
|
||||
if (rm >= 0xc0 ) {GetEArw;inst(*earw,*rmrw,LoadRw,SaveRw);} \
|
||||
else {GetEAa;inst(eaa,*rmrw,LoadMw,SaveMw);} \
|
||||
}
|
||||
|
||||
#define RMEwGwOp3(inst,op3) \
|
||||
{ \
|
||||
GetRMrw; \
|
||||
if (rm >= 0xc0 ) {GetEArw;inst(*earw,*rmrw,op3,LoadRw,SaveRw);} \
|
||||
else {GetEAa;inst(eaa,*rmrw,op3,LoadMw,SaveMw);} \
|
||||
}
|
||||
|
||||
#define RMGwEw(inst) \
|
||||
{ \
|
||||
GetRMrw; \
|
||||
if (rm >= 0xc0 ) {GetEArw;inst(*rmrw,*earw,LoadRw,SaveRw);} \
|
||||
else {GetEAa;inst(*rmrw,LoadMw(eaa),LoadRw,SaveRw);} \
|
||||
}
|
||||
|
||||
#define RMGwEwOp3(inst,op3) \
|
||||
{ \
|
||||
GetRMrw; \
|
||||
if (rm >= 0xc0 ) {GetEArw;inst(*rmrw,*earw,op3,LoadRw,SaveRw);} \
|
||||
else {GetEAa;inst(*rmrw,LoadMw(eaa),op3,LoadRw,SaveRw);} \
|
||||
}
|
||||
|
||||
#define RMEw(inst) \
|
||||
{ \
|
||||
if (rm >= 0xc0 ) {GetEArw;inst(*earw,LoadRw,SaveRw);} \
|
||||
else {GetEAa;inst(eaa,LoadMw,SaveMw);} \
|
||||
}
|
||||
|
||||
#define RMEdGd(inst) \
|
||||
{ \
|
||||
GetRMrd; \
|
||||
if (rm >= 0xc0 ) {GetEArd;inst(*eard,*rmrd,LoadRd,SaveRd);} \
|
||||
else {GetEAa;inst(eaa,*rmrd,LoadMd,SaveMd);} \
|
||||
}
|
||||
|
||||
#define RMEdGdOp3(inst,op3) \
|
||||
{ \
|
||||
GetRMrd; \
|
||||
if (rm >= 0xc0 ) {GetEArd;inst(*eard,*rmrd,op3,LoadRd,SaveRd);} \
|
||||
else {GetEAa;inst(eaa,*rmrd,op3,LoadMd,SaveMd);} \
|
||||
}
|
||||
|
||||
|
||||
#define RMGdEd(inst) \
|
||||
{ \
|
||||
GetRMrd; \
|
||||
if (rm >= 0xc0 ) {GetEArd;inst(*rmrd,*eard,LoadRd,SaveRd);} \
|
||||
else {GetEAa;inst(*rmrd,LoadMd(eaa),LoadRd,SaveRd);} \
|
||||
}
|
||||
|
||||
#define RMGdEdOp3(inst,op3) \
|
||||
{ \
|
||||
GetRMrd; \
|
||||
if (rm >= 0xc0 ) {GetEArd;inst(*rmrd,*eard,op3,LoadRd,SaveRd);} \
|
||||
else {GetEAa;inst(*rmrd,LoadMd(eaa),op3,LoadRd,SaveRd);} \
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#define RMEw(inst) \
|
||||
{ \
|
||||
if (rm >= 0xc0 ) {GetEArw;inst(*earw,LoadRw,SaveRw);} \
|
||||
else {GetEAa;inst(eaa,LoadMw,SaveMw);} \
|
||||
}
|
||||
|
||||
#define RMEd(inst) \
|
||||
{ \
|
||||
if (rm >= 0xc0 ) {GetEArd;inst(*eard,LoadRd,SaveRd);} \
|
||||
else {GetEAa;inst(eaa,LoadMd,SaveMd);} \
|
||||
}
|
||||
|
||||
#define ALIb(inst) \
|
||||
{ inst(reg_al,Fetchb(),LoadRb,SaveRb)}
|
||||
|
||||
#define AXIw(inst) \
|
||||
{ inst(reg_ax,Fetchw(),LoadRw,SaveRw);}
|
||||
|
||||
#define EAXId(inst) \
|
||||
{ inst(reg_eax,Fetchd(),LoadRd,SaveRd);}
|
||||
|
||||
#define FPU_ESC(code) { \
|
||||
Bit8u rm=Fetchb(); \
|
||||
if (rm >= 0xc0) { \
|
||||
FPU_ESC ## code ## _Normal(rm); \
|
||||
} else { \
|
||||
GetEAa;FPU_ESC ## code ## _EA(rm,eaa); \
|
||||
} \
|
||||
}
|
||||
|
449
src/cpu/core_normal/prefix_0f.h
Normal file
449
src/cpu/core_normal/prefix_0f.h
Normal file
@ -0,0 +1,449 @@
|
||||
/*
|
||||
* Copyright (C) 2002 The DOSBox Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
CASE_0F_W(0x00) /* GRP 6 Exxx */
|
||||
{
|
||||
GetRM;Bitu which=(rm>>3)&7;
|
||||
switch (which) {
|
||||
case 0x00: /* SLDT */
|
||||
case 0x01: /* STR */
|
||||
{
|
||||
Bitu saveval;
|
||||
if (!which) CPU_SLDT(saveval);
|
||||
else CPU_STR(saveval);
|
||||
if (rm >= 0xc0) {GetEArw;*earw=saveval;}
|
||||
else {GetEAa;SaveMw(eaa,saveval);}
|
||||
}
|
||||
break;
|
||||
case 0x02:case 0x03:case 0x04:case 0x05:
|
||||
{
|
||||
FillFlags();
|
||||
Bitu loadval;
|
||||
if (rm >= 0xc0 ) {GetEArw;loadval=*earw;}
|
||||
else {GetEAa;loadval=LoadMw(eaa);}
|
||||
break;
|
||||
switch (which) {
|
||||
case 0x02:CPU_LLDT(loadval);break;
|
||||
case 0x03:CPU_LTR(loadval);break;
|
||||
case 0x04:CPU_VERR(loadval);break;
|
||||
case 0x05:CPU_VERW(loadval);break;
|
||||
}
|
||||
}
|
||||
default:
|
||||
LOG(LOG_CPU,LOG_ERROR)("GRP6:Illegal call %2X",which);
|
||||
}
|
||||
}
|
||||
break;
|
||||
CASE_0F_W(0x01) /* Group 7 Ew */
|
||||
{
|
||||
GetRM;Bitu which=(rm>>3)&7;
|
||||
if (rm < 0xc0) { //First ones all use EA
|
||||
GetEAa;Bitu limit,base;
|
||||
switch (which) {
|
||||
case 0x00: /* SGDT */
|
||||
CPU_SGDT(limit,base);
|
||||
SaveMw(eaa,limit);
|
||||
SaveMd(eaa+2,base);
|
||||
break;
|
||||
case 0x01: /* SIDT */
|
||||
CPU_SIDT(limit,base);
|
||||
SaveMw(eaa,limit);
|
||||
SaveMd(eaa+2,base);
|
||||
break;
|
||||
case 0x02: /* LGDT */
|
||||
CPU_LGDT(LoadMw(eaa),LoadMd(eaa+2) & 0xFFFFFF);
|
||||
break;
|
||||
case 0x03: /* LIDT */
|
||||
CPU_LIDT(LoadMw(eaa),LoadMd(eaa+2) & 0xFFFFFF);
|
||||
break;
|
||||
case 0x04: /* SMSW */
|
||||
CPU_SMSW(limit);
|
||||
SaveMw(eaa,limit);
|
||||
break;
|
||||
case 0x06: /* LMSW */
|
||||
limit=LoadMw(eaa);
|
||||
if (!CPU_LMSW(limit)) goto decode_end;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
GetEArw;Bitu limit;
|
||||
switch (which) {
|
||||
case 0x04: /* SMSW */
|
||||
CPU_SMSW(limit);
|
||||
*earw=limit;
|
||||
break;
|
||||
case 0x06: /* LMSW */
|
||||
if (!CPU_LMSW(*earw)) goto decode_end;
|
||||
break;
|
||||
default:
|
||||
LOG(LOG_CPU,LOG_ERROR)("Illegal group 7 RM subfunction %d",which);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
CASE_0F_W(0x02) /* LAR Gw,Ew */
|
||||
{
|
||||
FillFlags();
|
||||
GetRMrw;Bitu ar;
|
||||
if (rm >= 0xc0) {
|
||||
GetEArw;CPU_LAR(*earw,ar);
|
||||
} else {
|
||||
GetEAa;CPU_LAR(LoadMw(eaa),ar);
|
||||
}
|
||||
*rmrw=(Bit16u)ar;
|
||||
}
|
||||
break;
|
||||
CASE_0F_W(0x03) /* LSL Gw,Ew */
|
||||
{
|
||||
FillFlags();
|
||||
GetRMrw;Bitu limit;
|
||||
if (rm >= 0xc0) {
|
||||
GetEArw;CPU_LSL(*earw,limit);
|
||||
} else {
|
||||
GetEAa;CPU_LSL(LoadMw(eaa),limit);
|
||||
}
|
||||
*rmrw=(Bit16u)limit;
|
||||
}
|
||||
break;
|
||||
CASE_0F_B(0x20) /* MOV Rd.CRx */
|
||||
{
|
||||
GetRM;
|
||||
Bitu which=(rm >> 3) & 7;
|
||||
if (rm >= 0xc0 ) {
|
||||
GetEArd;
|
||||
*eard=CPU_GET_CRX(which);
|
||||
} else {
|
||||
GetEAa;
|
||||
LOG(LOG_CPU,LOG_ERROR)("MOV XXX,CR%d with non-register",which);
|
||||
}
|
||||
}
|
||||
break;
|
||||
CASE_0F_B(0x22) /* MOV CRx,Rd */
|
||||
{
|
||||
GetRM;
|
||||
Bitu which=(rm >> 3) & 7;
|
||||
if (rm >= 0xc0 ) {
|
||||
GetEArd;
|
||||
if (!CPU_SET_CRX(which,*eard)) goto decode_end;
|
||||
} else {
|
||||
GetEAa;
|
||||
LOG(LOG_CPU,LOG_ERROR)("MOV CR%,XXX with non-register",which);
|
||||
}
|
||||
}
|
||||
break;
|
||||
CASE_0F_B(0x23) /* MOV DRx,Rd */
|
||||
{
|
||||
GetRM;
|
||||
Bitu which=(rm >> 3) & 7;
|
||||
if (rm >= 0xc0 ) {
|
||||
GetEArd;
|
||||
} else {
|
||||
GetEAa;
|
||||
LOG(LOG_CPU,LOG_ERROR)("MOV DR%,XXX with non-register",which);
|
||||
}
|
||||
}
|
||||
break;
|
||||
CASE_0F_W(0x80) /* JO */
|
||||
JumpSIw(get_OF());break;
|
||||
CASE_0F_W(0x81) /* JNO */
|
||||
JumpSIw(!get_OF());break;
|
||||
CASE_0F_W(0x82) /* JB */
|
||||
JumpSIw(get_CF());break;
|
||||
CASE_0F_W(0x83) /* JNB */
|
||||
JumpSIw(!get_CF());break;
|
||||
CASE_0F_W(0x84) /* JZ */
|
||||
JumpSIw(get_ZF());break;
|
||||
CASE_0F_W(0x85) /* JNZ */
|
||||
JumpSIw(!get_ZF());break;
|
||||
CASE_0F_W(0x86) /* JBE */
|
||||
JumpSIw(get_CF() || get_ZF());break;
|
||||
CASE_0F_W(0x87) /* JNBE */
|
||||
JumpSIw(!get_CF() && !get_ZF());break;
|
||||
CASE_0F_W(0x88) /* JS */
|
||||
JumpSIw(get_SF());break;
|
||||
CASE_0F_W(0x89) /* JNS */
|
||||
JumpSIw(!get_SF());break;
|
||||
CASE_0F_W(0x8a) /* JP */
|
||||
JumpSIw(get_PF());break;
|
||||
CASE_0F_W(0x8b) /* JNP */
|
||||
JumpSIw(!get_PF());break;
|
||||
CASE_0F_W(0x8c) /* JL */
|
||||
JumpSIw(get_SF() != get_OF());break;
|
||||
CASE_0F_W(0x8d) /* JNL */
|
||||
JumpSIw(get_SF() == get_OF());break;
|
||||
CASE_0F_W(0x8e) /* JLE */
|
||||
JumpSIw(get_ZF() || (get_SF() != get_OF()));break;
|
||||
CASE_0F_W(0x8f) /* JNLE */
|
||||
JumpSIw((get_SF() == get_OF()) && !get_ZF());break;
|
||||
CASE_0F_B(0x90) /* SETO */
|
||||
SETcc(get_OF());break;
|
||||
CASE_0F_B(0x91) /* SETNO */
|
||||
SETcc(!get_OF());break;
|
||||
CASE_0F_B(0x92) /* SETB */
|
||||
SETcc(get_CF());break;
|
||||
CASE_0F_B(0x93) /* SETNB */
|
||||
SETcc(!get_CF());break;
|
||||
CASE_0F_B(0x94) /* SETZ */
|
||||
SETcc(get_ZF());break;
|
||||
CASE_0F_B(0x95) /* SETNZ */
|
||||
SETcc(!get_ZF()); break;
|
||||
CASE_0F_B(0x96) /* SETBE */
|
||||
SETcc(get_CF() || get_ZF());break;
|
||||
CASE_0F_B(0x97) /* SETNBE */
|
||||
SETcc(!get_CF() && !get_ZF());break;
|
||||
CASE_0F_B(0x98) /* SETS */
|
||||
SETcc(get_SF());break;
|
||||
CASE_0F_B(0x99) /* SETNS */
|
||||
SETcc(!get_SF());break;
|
||||
CASE_0F_B(0x9a) /* SETP */
|
||||
SETcc(get_PF());break;
|
||||
CASE_0F_B(0x9b) /* SETNP */
|
||||
SETcc(!get_PF());break;
|
||||
CASE_0F_B(0x9c) /* SETL */
|
||||
SETcc(get_SF() != get_OF());break;
|
||||
CASE_0F_B(0x9d) /* SETNL */
|
||||
SETcc(get_SF() == get_OF());break;
|
||||
CASE_0F_B(0x9e) /* SETLE */
|
||||
SETcc(get_ZF() || (get_SF() != get_OF()));break;
|
||||
CASE_0F_B(0x9f) /* SETNLE */
|
||||
SETcc((get_SF() == get_OF()) && !get_ZF());break;
|
||||
|
||||
CASE_0F_W(0xa0) /* PUSH FS */
|
||||
Push_16(SegValue(fs));break;
|
||||
CASE_0F_W(0xa1) /* POP FS */
|
||||
CPU_SetSegGeneral(fs,Pop_16());break;
|
||||
CASE_0F_B(0xa2) /* CPUID */
|
||||
CPU_CPUID();break;
|
||||
CASE_0F_W(0xa3) /* BT Ew,Gw */
|
||||
{
|
||||
GetRMrw;
|
||||
Bit16u mask=1 << (*rmrw & 15);
|
||||
if (rm >= 0xc0 ) {
|
||||
GetEArw;
|
||||
SETFLAGBIT(CF,(*earw & mask));
|
||||
} else {
|
||||
GetEAa;Bit16u old=LoadMw(eaa);
|
||||
SETFLAGBIT(CF,(old & mask));
|
||||
}
|
||||
if (flags.type!=t_CF) { flags.prev_type=flags.type;flags.type=t_CF; }
|
||||
break;
|
||||
}
|
||||
CASE_0F_W(0xa4) /* SHLD Ew,Gw,Ib */
|
||||
RMEwGwOp3(DSHLW,Fetchb());
|
||||
break;
|
||||
CASE_0F_W(0xa5) /* SHLD Ew,Gw,CL */
|
||||
RMEwGwOp3(DSHLW,reg_cl);
|
||||
break;
|
||||
CASE_0F_W(0xa8) /* PUSH GS */
|
||||
Push_16(SegValue(gs));break;
|
||||
CASE_0F_W(0xa9) /* POP GS */
|
||||
CPU_SetSegGeneral(gs,Pop_16());break;
|
||||
CASE_0F_W(0xab) /* BTS Ew,Gw */
|
||||
{
|
||||
GetRMrw;
|
||||
Bit16u mask=1 << (*rmrw & 15);
|
||||
if (rm >= 0xc0 ) {
|
||||
GetEArw;
|
||||
SETFLAGBIT(CF,(*earw & mask));
|
||||
*earw|=mask;
|
||||
} else {
|
||||
GetEAa;Bit16u old=LoadMw(eaa);
|
||||
SETFLAGBIT(CF,(old & mask));
|
||||
SaveMw(eaa,old | mask);
|
||||
}
|
||||
if (flags.type!=t_CF) { flags.prev_type=flags.type;flags.type=t_CF; }
|
||||
break;
|
||||
}
|
||||
CASE_0F_W(0xac) /* SHRD Ew,Gw,Ib */
|
||||
RMEwGwOp3(DSHRW,Fetchb());
|
||||
break;
|
||||
CASE_0F_W(0xad) /* SHRD Ew,Gw,CL */
|
||||
RMEwGwOp3(DSHRW,reg_cl);
|
||||
break;
|
||||
CASE_0F_W(0xaf) /* IMUL Gw,Ew */
|
||||
RMGwEwOp3(DIMULW,*rmrw);
|
||||
break;
|
||||
CASE_0F_W(0xb2) /* LSS Ew */
|
||||
{
|
||||
GetRMrw;GetEAa;
|
||||
*rmrw=LoadMw(eaa);CPU_SetSegGeneral(ss,LoadMw(eaa+2));
|
||||
break;
|
||||
}
|
||||
CASE_0F_W(0xb3) /* BTR Ew,Gw */
|
||||
{
|
||||
GetRMrw;
|
||||
Bit16u mask=1 << (*rmrw & 15);
|
||||
if (rm >= 0xc0 ) {
|
||||
GetEArw;
|
||||
SETFLAGBIT(CF,(*earw & mask));
|
||||
*earw&= ~mask;
|
||||
} else {
|
||||
GetEAa;Bit16u old=LoadMw(eaa);
|
||||
SETFLAGBIT(CF,(old & mask));
|
||||
SaveMw(eaa,old & ~mask);
|
||||
}
|
||||
if (flags.type!=t_CF) { flags.prev_type=flags.type;flags.type=t_CF; }
|
||||
break;
|
||||
}
|
||||
CASE_0F_W(0xb4) /* LFS Ew */
|
||||
{
|
||||
GetRMrw;GetEAa;
|
||||
*rmrw=LoadMw(eaa);CPU_SetSegGeneral(fs,LoadMw(eaa+2));
|
||||
break;
|
||||
}
|
||||
CASE_0F_W(0xb5) /* LGS Ew */
|
||||
{
|
||||
GetRMrw;GetEAa;
|
||||
*rmrw=LoadMw(eaa);CPU_SetSegGeneral(gs,LoadMw(eaa+2));
|
||||
break;
|
||||
}
|
||||
CASE_0F_W(0xb6) /* MOVZX Gw,Eb */
|
||||
{
|
||||
GetRMrw;
|
||||
if (rm >= 0xc0 ) {GetEArb;*rmrw=*earb;}
|
||||
else {GetEAa;*rmrw=LoadMb(eaa);}
|
||||
break;
|
||||
}
|
||||
CASE_0F_W(0xb7) /* MOVZX Gw,Ew */
|
||||
CASE_0F_W(0xbf) /* MOVSX Gw,Ew */
|
||||
{
|
||||
GetRMrw;
|
||||
if (rm >= 0xc0 ) {GetEArw;*rmrw=*earw;}
|
||||
else {GetEAa;*rmrw=LoadMw(eaa);}
|
||||
break;
|
||||
}
|
||||
CASE_0F_W(0xba) /* GRP8 Ew,Ib */
|
||||
{
|
||||
GetRM;
|
||||
if (rm >= 0xc0 ) {
|
||||
GetEArw;
|
||||
Bit16u mask=1 << (Fetchb() & 15);
|
||||
SETFLAGBIT(CF,(*earw & mask));
|
||||
switch (rm & 0x38) {
|
||||
case 0x20: /* BT */
|
||||
break;
|
||||
case 0x28: /* BTS */
|
||||
*earw|=mask;
|
||||
break;
|
||||
case 0x30: /* BTR */
|
||||
*earw&= ~mask;
|
||||
break;
|
||||
case 0x38: /* BTC */
|
||||
*earw^=mask;
|
||||
break;
|
||||
default:
|
||||
E_Exit("CPU:0F:BA:Illegal subfunction %X",rm & 0x38);
|
||||
}
|
||||
} else {
|
||||
GetEAa;Bit16u old=LoadMw(eaa);
|
||||
Bit16u mask=1 << (Fetchb() & 15);
|
||||
SETFLAGBIT(CF,(old & mask));
|
||||
switch (rm & 0x38) {
|
||||
case 0x20: /* BT */
|
||||
break;
|
||||
case 0x28: /* BTS */
|
||||
SaveMw(eaa,old|mask);
|
||||
break;
|
||||
case 0x30: /* BTR */
|
||||
SaveMw(eaa,old & ~mask);
|
||||
break;
|
||||
case 0x38: /* BTC */
|
||||
SaveMw(eaa,old ^ mask);
|
||||
break;
|
||||
default:
|
||||
E_Exit("CPU:0F:BA:Illegal subfunction %X",rm & 0x38);
|
||||
}
|
||||
}
|
||||
if (flags.type!=t_CF) { flags.prev_type=flags.type;flags.type=t_CF; }
|
||||
break;
|
||||
}
|
||||
CASE_0F_W(0xbb) /* BTC Ew,Gw */
|
||||
{
|
||||
GetRMrw;
|
||||
Bit16u mask=1 << (*rmrw & 15);
|
||||
if (rm >= 0xc0 ) {
|
||||
GetEArw;
|
||||
SETFLAGBIT(CF,(*earw & mask));
|
||||
*earw^=mask;
|
||||
} else {
|
||||
GetEAa;Bit16u old=LoadMw(eaa);
|
||||
SETFLAGBIT(CF,(old & mask));
|
||||
SaveMw(eaa,old ^ mask);
|
||||
}
|
||||
if (flags.type!=t_CF) { flags.prev_type=flags.type;flags.type=t_CF; }
|
||||
break;
|
||||
}
|
||||
CASE_0F_W(0xbc) /* BSF Gw,Ew */
|
||||
{
|
||||
GetRMrw;
|
||||
Bit16u result,value;
|
||||
if (rm >= 0xc0) { GetEArw; value=*earw; }
|
||||
else { GetEAa; value=LoadMw(eaa); }
|
||||
if (value==0) {
|
||||
SETFLAGBIT(ZF,true);
|
||||
} else {
|
||||
result = 0;
|
||||
while ((value & 0x01)==0) { result++; value>>=1; }
|
||||
SETFLAGBIT(ZF,false);
|
||||
*rmrw = result;
|
||||
}
|
||||
flags.type=t_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
CASE_0F_W(0xbd) /* BSR Gw,Ew */
|
||||
{
|
||||
GetRMrw;
|
||||
Bit16u result,value;
|
||||
if (rm >= 0xc0) { GetEArw; value=*earw; }
|
||||
else { GetEAa; value=LoadMw(eaa); }
|
||||
if (value==0) {
|
||||
SETFLAGBIT(ZF,true);
|
||||
} else {
|
||||
result = 15; // Operandsize-1
|
||||
while ((value & 0x8000)==0) { result--; value<<=1; }
|
||||
SETFLAGBIT(ZF,false);
|
||||
*rmrw = result;
|
||||
}
|
||||
flags.type=t_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
CASE_0F_W(0xbe) /* MOVSX Gw,Eb */
|
||||
{
|
||||
GetRMrw;
|
||||
if (rm >= 0xc0 ) {GetEArb;*rmrw=*(Bit8s *)earb;}
|
||||
else {GetEAa;*rmrw=LoadMbs(eaa);}
|
||||
break;
|
||||
}
|
||||
CASE_0F_B(0xc8) /* BSWAP EAX */
|
||||
BSWAP(reg_eax);break;
|
||||
CASE_0F_B(0xc9) /* BSWAP ECX */
|
||||
BSWAP(reg_ecx);break;
|
||||
CASE_0F_B(0xca) /* BSWAP EDX */
|
||||
BSWAP(reg_edx);break;
|
||||
CASE_0F_B(0xcb) /* BSWAP EBX */
|
||||
BSWAP(reg_ebx);break;
|
||||
CASE_0F_B(0xcc) /* BSWAP ESP */
|
||||
BSWAP(reg_esp);break;
|
||||
CASE_0F_B(0xcd) /* BSWAP EBP */
|
||||
BSWAP(reg_ebp);break;
|
||||
CASE_0F_B(0xce) /* BSWAP ESI */
|
||||
BSWAP(reg_esi);break;
|
||||
CASE_0F_B(0xcf) /* BSWAP EDI */
|
||||
BSWAP(reg_edi);break;
|
||||
|
666
src/cpu/core_normal/prefix_66.h
Normal file
666
src/cpu/core_normal/prefix_66.h
Normal file
@ -0,0 +1,666 @@
|
||||
/*
|
||||
* Copyright (C) 2002 The DOSBox Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
CASE_D(0x01) /* ADD Ed,Gd */
|
||||
RMEdGd(ADDD);break;
|
||||
CASE_D(0x03) /* ADD Gd,Ed */
|
||||
RMGdEd(ADDD);break;
|
||||
CASE_D(0x05) /* ADD EAX,Id */
|
||||
EAXId(ADDD);break;
|
||||
CASE_D(0x06) /* PUSH ES */
|
||||
Push_32(SegValue(es));break;
|
||||
CASE_D(0x07) /* POP ES */
|
||||
CPU_SetSegGeneral(es,(Bit16u)Pop_32());break;
|
||||
CASE_D(0x09) /* OR Ed,Gd */
|
||||
RMEdGd(ORD);break;
|
||||
CASE_D(0x0b) /* OR Gd,Ed */
|
||||
RMGdEd(ORD);break;
|
||||
CASE_D(0x0d) /* OR EAX,Id */
|
||||
EAXId(ORD);break;
|
||||
CASE_D(0x0e) /* PUSH CS */
|
||||
Push_32(SegValue(cs));break;
|
||||
CASE_D(0x11) /* ADC Ed,Gd */
|
||||
RMEdGd(ADCD);break;
|
||||
CASE_D(0x13) /* ADC Gd,Ed */
|
||||
RMGdEd(ADCD);break;
|
||||
CASE_D(0x15) /* ADC EAX,Id */
|
||||
EAXId(ADCD);break;
|
||||
CASE_D(0x16) /* PUSH SS */
|
||||
Push_32(SegValue(ss));break;
|
||||
CASE_D(0x17) /* POP SS */
|
||||
CPU_SetSegGeneral(ss,(Bit16u)Pop_32());break;
|
||||
CASE_D(0x19) /* SBB Ed,Gd */
|
||||
RMEdGd(SBBD);break;
|
||||
CASE_D(0x1b) /* SBB Gd,Ed */
|
||||
RMGdEd(SBBD);break;
|
||||
CASE_D(0x1d) /* SBB EAX,Id */
|
||||
EAXId(SBBD);break;
|
||||
CASE_D(0x1e) /* PUSH DS */
|
||||
Push_32(SegValue(ds));break;
|
||||
CASE_D(0x1f) /* POP DS */
|
||||
CPU_SetSegGeneral(ds,(Bit16u)Pop_32());break;
|
||||
CASE_D(0x21) /* AND Ed,Gd */
|
||||
RMEdGd(ANDD);break;
|
||||
CASE_D(0x23) /* AND Gd,Ed */
|
||||
RMGdEd(ANDD);break;
|
||||
CASE_D(0x25) /* AND EAX,Id */
|
||||
EAXId(ANDD);break;
|
||||
CASE_D(0x29) /* SUB Ed,Gd */
|
||||
RMEdGd(SUBD);break;
|
||||
CASE_D(0x2b) /* SUB Gd,Ed */
|
||||
RMGdEd(SUBD);break;
|
||||
CASE_D(0x2d) /* SUB EAX,Id */
|
||||
EAXId(SUBD);break;
|
||||
CASE_D(0x31) /* XOR Ed,Gd */
|
||||
RMEdGd(XORD);break;
|
||||
CASE_D(0x33) /* XOR Gd,Ed */
|
||||
RMGdEd(XORD);break;
|
||||
CASE_D(0x35) /* XOR EAX,Id */
|
||||
EAXId(XORD);break;
|
||||
CASE_D(0x39) /* CMP Ed,Gd */
|
||||
RMEdGd(CMPD);break;
|
||||
CASE_D(0x3b) /* CMP Gd,Ed */
|
||||
RMGdEd(CMPD);break;
|
||||
CASE_D(0x3d) /* CMP EAX,Id */
|
||||
EAXId(CMPD);break;
|
||||
CASE_D(0x40) /* INC EAX */
|
||||
INCD(reg_eax,LoadRd,SaveRd);break;
|
||||
CASE_D(0x41) /* INC ECX */
|
||||
INCD(reg_ecx,LoadRd,SaveRd);break;
|
||||
CASE_D(0x42) /* INC EDX */
|
||||
INCD(reg_edx,LoadRd,SaveRd);break;
|
||||
CASE_D(0x43) /* INC EBX */
|
||||
INCD(reg_ebx,LoadRd,SaveRd);break;
|
||||
CASE_D(0x44) /* INC ESP */
|
||||
INCD(reg_esp,LoadRd,SaveRd);break;
|
||||
CASE_D(0x45) /* INC EBP */
|
||||
INCD(reg_ebp,LoadRd,SaveRd);break;
|
||||
CASE_D(0x46) /* INC ESI */
|
||||
INCD(reg_esi,LoadRd,SaveRd);break;
|
||||
CASE_D(0x47) /* INC EDI */
|
||||
INCD(reg_edi,LoadRd,SaveRd);break;
|
||||
CASE_D(0x48) /* DEC EAX */
|
||||
DECD(reg_eax,LoadRd,SaveRd);break;
|
||||
CASE_D(0x49) /* DEC ECX */
|
||||
DECD(reg_ecx,LoadRd,SaveRd);break;
|
||||
CASE_D(0x4a) /* DEC EDX */
|
||||
DECD(reg_edx,LoadRd,SaveRd);break;
|
||||
CASE_D(0x4b) /* DEC EBX */
|
||||
DECD(reg_ebx,LoadRd,SaveRd);break;
|
||||
CASE_D(0x4c) /* DEC ESP */
|
||||
DECD(reg_esp,LoadRd,SaveRd);break;
|
||||
CASE_D(0x4d) /* DEC EBP */
|
||||
DECD(reg_ebp,LoadRd,SaveRd);break;
|
||||
CASE_D(0x4e) /* DEC ESI */
|
||||
DECD(reg_esi,LoadRd,SaveRd);break;
|
||||
CASE_D(0x4f) /* DEC EDI */
|
||||
DECD(reg_edi,LoadRd,SaveRd);break;
|
||||
CASE_D(0x50) /* PUSH EAX */
|
||||
Push_32(reg_eax);break;
|
||||
CASE_D(0x51) /* PUSH ECX */
|
||||
Push_32(reg_ecx);break;
|
||||
CASE_D(0x52) /* PUSH EDX */
|
||||
Push_32(reg_edx);break;
|
||||
CASE_D(0x53) /* PUSH EBX */
|
||||
Push_32(reg_ebx);break;
|
||||
CASE_D(0x54) /* PUSH ESP */
|
||||
Push_32(reg_esp);break;
|
||||
CASE_D(0x55) /* PUSH EBP */
|
||||
Push_32(reg_ebp);break;
|
||||
CASE_D(0x56) /* PUSH ESI */
|
||||
Push_32(reg_esi);break;
|
||||
CASE_D(0x57) /* PUSH EDI */
|
||||
Push_32(reg_edi);break;
|
||||
CASE_D(0x58) /* POP EAX */
|
||||
reg_eax=Pop_32();break;
|
||||
CASE_D(0x59) /* POP ECX */
|
||||
reg_ecx=Pop_32();break;
|
||||
CASE_D(0x5a) /* POP EDX */
|
||||
reg_edx=Pop_32();break;
|
||||
CASE_D(0x5b) /* POP EBX */
|
||||
reg_ebx=Pop_32();break;
|
||||
CASE_D(0x5c) /* POP ESP */
|
||||
reg_esp=Pop_32();break;
|
||||
CASE_D(0x5d) /* POP EBP */
|
||||
reg_ebp=Pop_32();break;
|
||||
CASE_D(0x5e) /* POP ESI */
|
||||
reg_esi=Pop_32();break;
|
||||
CASE_D(0x5f) /* POP EDI */
|
||||
reg_edi=Pop_32();break;
|
||||
CASE_D(0x60) /* PUSHAD */
|
||||
Push_32(reg_eax);Push_32(reg_ecx);Push_32(reg_edx);Push_32(reg_ebx);
|
||||
Push_32(reg_esp);Push_32(reg_ebp);Push_32(reg_esi);Push_32(reg_edi);
|
||||
break;
|
||||
CASE_D(0x61) /* POPAD */
|
||||
reg_edi=Pop_32();reg_esi=Pop_32();reg_ebp=Pop_32();Pop_32();//Don't save ESP
|
||||
reg_ebx=Pop_32();reg_edx=Pop_32();reg_ecx=Pop_32();reg_eax=Pop_32();
|
||||
break;
|
||||
CASE_D(0x62) /* BOUND Ed */
|
||||
{
|
||||
Bit32s bound_min, bound_max;
|
||||
GetRMrd;GetEAa;
|
||||
bound_min=LoadMd(eaa);
|
||||
bound_max=LoadMd(eaa+4);
|
||||
if ( (((Bit32s)*rmrd) < bound_min) || (((Bit32s)*rmrd) > bound_max) ) {
|
||||
EXCEPTION(5);
|
||||
}
|
||||
}
|
||||
break;
|
||||
CASE_D(0x63) /* ARPL Ed,Rd */
|
||||
{
|
||||
FillFlags();
|
||||
GetRMrw;
|
||||
if (rm >= 0xc0 ) {
|
||||
GetEArd;Bitu new_sel=(Bit16u)*eard;
|
||||
CPU_ARPL(new_sel,*rmrw);
|
||||
*eard=(Bit32u)new_sel;
|
||||
} else {
|
||||
GetEAa;Bitu new_sel=LoadMw(eaa);
|
||||
CPU_ARPL(new_sel,*rmrw);
|
||||
SaveMd(eaa,(Bit32u)new_sel);
|
||||
}
|
||||
}
|
||||
break;
|
||||
CASE_D(0x68) /* PUSH Id */
|
||||
Push_32(Fetchd());break;
|
||||
CASE_D(0x69) /* IMUL Gd,Ed,Id */
|
||||
RMGdEdOp3(DIMULD,Fetchds());
|
||||
break;
|
||||
CASE_D(0x6a) /* PUSH Ib */
|
||||
Push_32(Fetchbs());break;
|
||||
CASE_D(0x6b) /* IMUL Gd,Ed,Ib */
|
||||
RMGdEdOp3(DIMULD,Fetchbs());
|
||||
break;
|
||||
CASE_D(0x81) /* Grpl Ed,Id */
|
||||
{
|
||||
GetRM;Bitu which=(rm>>3)&7;
|
||||
if (rm >= 0xc0) {
|
||||
GetEArd;Bit32u id=Fetchd();
|
||||
switch (which) {
|
||||
case 0x00:ADDD(*eard,id,LoadRd,SaveRd);break;
|
||||
case 0x01: ORD(*eard,id,LoadRd,SaveRd);break;
|
||||
case 0x02:ADCD(*eard,id,LoadRd,SaveRd);break;
|
||||
case 0x03:SBBD(*eard,id,LoadRd,SaveRd);break;
|
||||
case 0x04:ANDD(*eard,id,LoadRd,SaveRd);break;
|
||||
case 0x05:SUBD(*eard,id,LoadRd,SaveRd);break;
|
||||
case 0x06:XORD(*eard,id,LoadRd,SaveRd);break;
|
||||
case 0x07:CMPD(*eard,id,LoadRd,SaveRd);break;
|
||||
}
|
||||
} else {
|
||||
GetEAa;Bit32u id=Fetchd();
|
||||
switch (which) {
|
||||
case 0x00:ADDD(eaa,id,LoadMd,SaveMd);break;
|
||||
case 0x01: ORD(eaa,id,LoadMd,SaveMd);break;
|
||||
case 0x02:ADCD(eaa,id,LoadMd,SaveMd);break;
|
||||
case 0x03:SBBD(eaa,id,LoadMd,SaveMd);break;
|
||||
case 0x04:ANDD(eaa,id,LoadMd,SaveMd);break;
|
||||
case 0x05:SUBD(eaa,id,LoadMd,SaveMd);break;
|
||||
case 0x06:XORD(eaa,id,LoadMd,SaveMd);break;
|
||||
case 0x07:CMPD(eaa,id,LoadMd,SaveMd);break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
CASE_D(0x83) /* Grpl Ed,Ix */
|
||||
{
|
||||
GetRM;Bitu which=(rm>>3)&7;
|
||||
if (rm >= 0xc0) {
|
||||
GetEArd;Bit32u id=(Bit32s)Fetchbs();
|
||||
switch (which) {
|
||||
case 0x00:ADDD(*eard,id,LoadRd,SaveRd);break;
|
||||
case 0x01: ORD(*eard,id,LoadRd,SaveRd);break;
|
||||
case 0x02:ADCD(*eard,id,LoadRd,SaveRd);break;
|
||||
case 0x03:SBBD(*eard,id,LoadRd,SaveRd);break;
|
||||
case 0x04:ANDD(*eard,id,LoadRd,SaveRd);break;
|
||||
case 0x05:SUBD(*eard,id,LoadRd,SaveRd);break;
|
||||
case 0x06:XORD(*eard,id,LoadRd,SaveRd);break;
|
||||
case 0x07:CMPD(*eard,id,LoadRd,SaveRd);break;
|
||||
}
|
||||
} else {
|
||||
GetEAa;Bit32u id=(Bit32s)Fetchbs();
|
||||
switch (which) {
|
||||
case 0x00:ADDD(eaa,id,LoadMd,SaveMd);break;
|
||||
case 0x01: ORD(eaa,id,LoadMd,SaveMd);break;
|
||||
case 0x02:ADCD(eaa,id,LoadMd,SaveMd);break;
|
||||
case 0x03:SBBD(eaa,id,LoadMd,SaveMd);break;
|
||||
case 0x04:ANDD(eaa,id,LoadMd,SaveMd);break;
|
||||
case 0x05:SUBD(eaa,id,LoadMd,SaveMd);break;
|
||||
case 0x06:XORD(eaa,id,LoadMd,SaveMd);break;
|
||||
case 0x07:CMPD(eaa,id,LoadMd,SaveMd);break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
CASE_D(0x85) /* TEST Ed,Gd */
|
||||
RMEdGd(TESTD);break;
|
||||
CASE_D(0x87) /* XCHG Ed,Gd */
|
||||
{
|
||||
GetRMrd;Bit32u oldrmrd=*rmrd;
|
||||
if (rm >= 0xc0 ) {GetEArd;*rmrd=*eard;*eard=oldrmrd;}
|
||||
else {GetEAa;*rmrd=LoadMd(eaa);SaveMd(eaa,oldrmrd);}
|
||||
break;
|
||||
}
|
||||
CASE_D(0x89) /* MOV Ed,Gd */
|
||||
{
|
||||
GetRMrd;
|
||||
if (rm >= 0xc0 ) {GetEArd;*eard=*rmrd;}
|
||||
else {GetEAa;SaveMd(eaa,*rmrd);}
|
||||
break;
|
||||
}
|
||||
CASE_D(0x8b) /* MOV Gd,Ed */
|
||||
{
|
||||
GetRMrd;
|
||||
if (rm >= 0xc0 ) {GetEArd;*rmrd=*eard;}
|
||||
else {GetEAa;*rmrd=LoadMd(eaa);}
|
||||
break;
|
||||
}
|
||||
CASE_D(0x8c) /* Mov Ew,Sw */
|
||||
{
|
||||
GetRM;Bit16u val;Bitu which=(rm>>3)&7;
|
||||
switch (which) {
|
||||
case 0x00: /* MOV Ew,ES */
|
||||
val=SegValue(es);break;
|
||||
case 0x01: /* MOV Ew,CS */
|
||||
val=SegValue(cs);break;
|
||||
case 0x02: /* MOV Ew,SS */
|
||||
val=SegValue(ss);break;
|
||||
case 0x03: /* MOV Ew,DS */
|
||||
val=SegValue(ds);break;
|
||||
case 0x04: /* MOV Ew,FS */
|
||||
val=SegValue(fs);break;
|
||||
case 0x05: /* MOV Ew,GS */
|
||||
val=SegValue(gs);break;
|
||||
default:
|
||||
val=0;
|
||||
E_Exit("CPU:8c:Illegal RM Byte");
|
||||
}
|
||||
if (rm >= 0xc0 ) {GetEArd;*eard=val;}
|
||||
else {GetEAa;SaveMw(eaa,val);}
|
||||
break;
|
||||
}
|
||||
CASE_D(0x8d) /* LEA Gd */
|
||||
{
|
||||
//Little hack to always use segprefixed version
|
||||
core.seg_prefix_base=0;
|
||||
GetRMrd;
|
||||
if (TEST_PREFIX_ADDR) {
|
||||
*rmrd=(Bit32u)(*GetEA_SEG_ADDR[rm])();
|
||||
} else {
|
||||
*rmrd=(Bit32u)(*GetEA_SEG[rm])();
|
||||
}
|
||||
break;
|
||||
}
|
||||
CASE_D(0x8f) /* POP Ed */
|
||||
{
|
||||
GetRM;
|
||||
if (rm >= 0xc0 ) {GetEArd;*eard=Pop_32();}
|
||||
else {GetEAa;SaveMd(eaa,Pop_32());}
|
||||
break;
|
||||
}
|
||||
CASE_D(0x91) /* XCHG ECX,EAX */
|
||||
{ Bit32u temp=reg_eax;reg_eax=reg_ecx;reg_ecx=temp;break;}
|
||||
CASE_D(0x92) /* XCHG EDX,EAX */
|
||||
{ Bit32u temp=reg_eax;reg_eax=reg_edx;reg_edx=temp;break;}
|
||||
break;
|
||||
CASE_D(0x93) /* XCHG EBX,EAX */
|
||||
{ Bit32u temp=reg_eax;reg_eax=reg_ebx;reg_ebx=temp;break;}
|
||||
break;
|
||||
CASE_D(0x94) /* XCHG ESP,EAX */
|
||||
{ Bit32u temp=reg_eax;reg_eax=reg_esp;reg_esp=temp;break;}
|
||||
break;
|
||||
CASE_D(0x95) /* XCHG EBP,EAX */
|
||||
{ Bit32u temp=reg_eax;reg_eax=reg_ebp;reg_ebp=temp;break;}
|
||||
break;
|
||||
CASE_D(0x96) /* XCHG ESI,EAX */
|
||||
{ Bit32u temp=reg_eax;reg_eax=reg_esi;reg_esi=temp;break;}
|
||||
break;
|
||||
CASE_D(0x97) /* XCHG EDI,EAX */
|
||||
{ Bit32u temp=reg_eax;reg_eax=reg_edi;reg_edi=temp;break;}
|
||||
break;
|
||||
CASE_D(0x98) /* CWDE */
|
||||
reg_eax=(Bit16s)reg_ax;break;
|
||||
CASE_D(0x99) /* CDQ */
|
||||
if (reg_eax & 0x80000000) reg_edx=0xffffffff;
|
||||
else reg_edx=0;
|
||||
break;
|
||||
CASE_D(0x9a) /* CALL FAR Ad */
|
||||
{
|
||||
Bit32u newip=Fetchd();Bit16u newcs=Fetchw();
|
||||
SAVEIP;
|
||||
if (CPU_CALL(true,newcs,newip)) {
|
||||
LOADIP;
|
||||
} else {
|
||||
FillFlags();return CBRET_NONE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
CASE_D(0x9c) /* PUSHFD */
|
||||
FillFlags();
|
||||
Push_32(flags.word);
|
||||
break;
|
||||
CASE_D(0x9d) /* POPFD */
|
||||
SETFLAGSd(Pop_32())
|
||||
#if CPU_TRAP_CHECK
|
||||
if (GETFLAG(TF)) {
|
||||
cpudecoder=CPU_Core_Normal_Decode_Trap;
|
||||
goto decode_end;
|
||||
}
|
||||
#endif
|
||||
#ifdef CPU_PIC_CHECK
|
||||
if (GETFLAG(IF) && PIC_IRQCheck) goto decode_end;
|
||||
#endif
|
||||
|
||||
break;
|
||||
CASE_D(0xa1) /* MOV EAX,Od */
|
||||
{
|
||||
GetEADirect;
|
||||
reg_eax=LoadMd(eaa);
|
||||
}
|
||||
break;
|
||||
CASE_D(0xa3) /* MOV Od,EAX */
|
||||
{
|
||||
GetEADirect;
|
||||
SaveMd(eaa,reg_eax);
|
||||
}
|
||||
break;
|
||||
CASE_D(0xa5) /* MOVSD */
|
||||
DoString(R_MOVSD);break;
|
||||
CASE_D(0xa7) /* CMPSD */
|
||||
DoString(R_CMPSD);break;
|
||||
CASE_D(0xa9) /* TEST EAX,Id */
|
||||
EAXId(TESTD);break;
|
||||
CASE_D(0xab) /* STOSD */
|
||||
DoString(R_STOSD);break;
|
||||
CASE_D(0xad) /* LODSD */
|
||||
DoString(R_LODSD);break;
|
||||
CASE_D(0xaf) /* SCASD */
|
||||
DoString(R_SCASD);break;
|
||||
CASE_D(0xb8) /* MOV EAX,Id */
|
||||
reg_eax=Fetchd();break;
|
||||
CASE_D(0xb9) /* MOV ECX,Id */
|
||||
reg_ecx=Fetchd();break;
|
||||
CASE_D(0xba) /* MOV EDX,Iw */
|
||||
reg_edx=Fetchd();break;
|
||||
CASE_D(0xbb) /* MOV EBX,Id */
|
||||
reg_ebx=Fetchd();break;
|
||||
CASE_D(0xbc) /* MOV ESP,Id */
|
||||
reg_esp=Fetchd();break;
|
||||
CASE_D(0xbd) /* MOV EBP.Id */
|
||||
reg_ebp=Fetchd();break;
|
||||
CASE_D(0xbe) /* MOV ESI,Id */
|
||||
reg_esi=Fetchd();break;
|
||||
CASE_D(0xbf) /* MOV EDI,Id */
|
||||
reg_edi=Fetchd();break;
|
||||
CASE_D(0xc1) /* GRP2 Ed,Ib */
|
||||
GRP2D(Fetchb());break;
|
||||
CASE_D(0xc2) /* RETN Iw */
|
||||
{
|
||||
Bit16u addsp=Fetchw();
|
||||
SETIP(Pop_32());reg_esp+=addsp;
|
||||
break;
|
||||
}
|
||||
CASE_D(0xc3) /* RETN */
|
||||
SETIP(Pop_32());
|
||||
break;
|
||||
CASE_D(0xc4) /* LES */
|
||||
{
|
||||
GetRMrd;GetEAa;
|
||||
*rmrd=LoadMd(eaa);CPU_SetSegGeneral(es,LoadMw(eaa+4));
|
||||
break;
|
||||
}
|
||||
CASE_D(0xc5) /* LDS */
|
||||
{
|
||||
GetRMrd;GetEAa;
|
||||
*rmrd=LoadMd(eaa);CPU_SetSegGeneral(ds,LoadMw(eaa+4));
|
||||
break;
|
||||
}
|
||||
CASE_D(0xc7) /* MOV Ed,Id */
|
||||
{
|
||||
GetRM;
|
||||
if (rm >= 0xc0) {GetEArd;*eard=Fetchd();}
|
||||
else {GetEAa;SaveMd(eaa,Fetchd());}
|
||||
break;
|
||||
}
|
||||
CASE_D(0xc8) /* ENTER Iw,Ib */
|
||||
{
|
||||
Bitu bytes=Fetchw();Bitu level=Fetchb() & 0x1f;
|
||||
Bitu frame_ptr=reg_esp-4;
|
||||
if (cpu.stack.big) {
|
||||
reg_esp-=4;
|
||||
mem_writed(SegBase(ss)+reg_esp,reg_ebp);
|
||||
for (Bitu i=1;i<level;i++) {
|
||||
reg_ebp-=4;reg_esp-=4;
|
||||
mem_writed(SegBase(ss)+reg_esp,mem_readd(SegBase(ss)+reg_ebp));
|
||||
}
|
||||
if (level) {
|
||||
reg_esp-=4;
|
||||
mem_writed(SegBase(ss)+reg_esp,(Bit32u)frame_ptr);
|
||||
}
|
||||
reg_esp-=bytes;
|
||||
} else {
|
||||
reg_sp-=4;
|
||||
mem_writed(SegBase(ss)+reg_sp,reg_ebp);
|
||||
for (Bitu i=1;i<level;i++) {
|
||||
reg_bp-=4;reg_sp-=4;
|
||||
mem_writed(SegBase(ss)+reg_sp,mem_readd(SegBase(ss)+reg_bp));
|
||||
}
|
||||
if (level) {
|
||||
reg_sp-=4;
|
||||
mem_writed(SegBase(ss)+reg_sp,(Bit32u)frame_ptr);
|
||||
}
|
||||
reg_sp-=bytes;
|
||||
}
|
||||
reg_ebp=frame_ptr;
|
||||
break;
|
||||
}
|
||||
CASE_D(0xc9) /* LEAVE */
|
||||
reg_esp&=~cpu.stack.mask;
|
||||
reg_esp|=(reg_ebp&cpu.stack.mask);
|
||||
reg_ebp=Pop_32();
|
||||
break;
|
||||
CASE_D(0xca) /* RETF Iw */
|
||||
{
|
||||
if (CPU_RET(true,Fetchw())) {
|
||||
LOADIP;
|
||||
} else {
|
||||
FillFlags();return CBRET_NONE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
CASE_D(0xcb) /* RETF */
|
||||
{
|
||||
if (CPU_RET(true,0)) {
|
||||
LOADIP;
|
||||
} else {
|
||||
FillFlags();return CBRET_NONE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
CASE_D(0xcf) /* IRET */
|
||||
{
|
||||
if (CPU_IRET(true)) {
|
||||
#if CPU_TRAP_CHECK
|
||||
if (GETFLAG(TF)) {
|
||||
cpudecoder=CPU_Core_Normal_Decode_Trap;
|
||||
return CBRET_NONE;
|
||||
}
|
||||
#endif
|
||||
#ifdef CPU_PIC_CHECK
|
||||
if (GETFLAG(IF) && PIC_IRQCheck) return CBRET_NONE;
|
||||
#endif
|
||||
//TODO TF check
|
||||
goto decode_start;
|
||||
} else return CBRET_NONE;
|
||||
break;
|
||||
}
|
||||
CASE_D(0xd1) /* GRP2 Ed,1 */
|
||||
GRP2D(1);break;
|
||||
CASE_D(0xd3) /* GRP2 Ed,CL */
|
||||
GRP2D(reg_cl);break;
|
||||
CASE_D(0xe5) /* IN EAX,Ib */
|
||||
{
|
||||
Bit16u port=Fetchb();
|
||||
reg_eax=IO_Read(port) |
|
||||
(IO_Read(port+1) << 8 ) |
|
||||
(IO_Read(port+2) << 16 ) |
|
||||
(IO_Read(port+3) << 24 );
|
||||
break;
|
||||
}
|
||||
CASE_D(0xe7) /* OUT Ib,EAX */
|
||||
{
|
||||
Bit16u port=Fetchb();
|
||||
IO_Write(port+0,(Bit8u)(reg_eax >> 0));
|
||||
IO_Write(port+1,(Bit8u)(reg_eax >> 8));
|
||||
IO_Write(port+2,(Bit8u)(reg_eax >> 16));
|
||||
IO_Write(port+3,(Bit8u)(reg_eax >> 24));
|
||||
break;
|
||||
}
|
||||
CASE_D(0xe8) /* CALL Jd */
|
||||
{
|
||||
Bit32s newip=Fetchds();
|
||||
Push_32((Bit32u)GETIP);
|
||||
ADDIPd(newip);
|
||||
break;
|
||||
}
|
||||
CASE_D(0xe9) /* JMP Jd */
|
||||
ADDIPd(Fetchds());
|
||||
break;
|
||||
CASE_D(0xea) /* JMP Ad */
|
||||
{
|
||||
Bit32u newip=Fetchd();
|
||||
Bit16u newcs=Fetchw();
|
||||
SAVEIP;
|
||||
if (CPU_JMP(true,newcs,newip)) {
|
||||
LOADIP;
|
||||
} else {
|
||||
FillFlags();return CBRET_NONE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
CASE_D(0xed) /* IN EAX,DX */
|
||||
reg_eax=IO_Read(reg_dx) |
|
||||
(IO_Read(reg_dx+1) << 8) |
|
||||
(IO_Read(reg_dx+2) << 16) |
|
||||
(IO_Read(reg_dx+3) << 24);
|
||||
break;
|
||||
CASE_D(0xef) /* OUT DX,EAX */
|
||||
IO_Write(reg_dx,(Bit8u)(reg_eax>>0));
|
||||
IO_Write(reg_dx+1,(Bit8u)(reg_eax>>8));
|
||||
IO_Write(reg_dx+2,(Bit8u)(reg_eax>>16));
|
||||
IO_Write(reg_dx+3,(Bit8u)(reg_eax>>24));
|
||||
break;
|
||||
CASE_D(0xf7) /* GRP3 Ed(,Id) */
|
||||
{
|
||||
GetRM;Bitu which=(rm>>3)&7;
|
||||
switch (which) {
|
||||
case 0x00: /* TEST Ed,Id */
|
||||
case 0x01: /* TEST Ed,Id Undocumented*/
|
||||
{
|
||||
if (rm >= 0xc0 ) {GetEArd;TESTD(*eard,Fetchd(),LoadRd,SaveRd);}
|
||||
else {GetEAa;TESTD(eaa,Fetchd(),LoadMd,SaveMd);}
|
||||
break;
|
||||
}
|
||||
case 0x02: /* NOT Ed */
|
||||
{
|
||||
if (rm >= 0xc0 ) {GetEArd;*eard=~*eard;}
|
||||
else {GetEAa;SaveMd(eaa,~LoadMd(eaa));}
|
||||
break;
|
||||
}
|
||||
case 0x03: /* NEG Ed */
|
||||
{
|
||||
flags.type=t_NEGd;
|
||||
if (rm >= 0xc0 ) {
|
||||
GetEArd;flags.var1.d=*eard;flags.result.d=0-flags.var1.d;
|
||||
*eard=flags.result.d;
|
||||
} else {
|
||||
GetEAa;flags.var1.d=LoadMd(eaa);flags.result.d=0-flags.var1.d;
|
||||
SaveMd(eaa,flags.result.d);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 0x04: /* MUL EAX,Ed */
|
||||
RMEd(MULD);
|
||||
break;
|
||||
case 0x05: /* IMUL EAX,Ed */
|
||||
RMEd(IMULD);
|
||||
break;
|
||||
case 0x06: /* DIV Ed */
|
||||
RMEd(DIVD);
|
||||
break;
|
||||
case 0x07: /* IDIV Ed */
|
||||
RMEd(IDIVD);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
CASE_D(0xff) /* GRP 5 Ed */
|
||||
{
|
||||
GetRM;Bitu which=(rm>>3)&7;
|
||||
switch (which) {
|
||||
case 0x00: /* INC Ed */
|
||||
RMEd(INCD);
|
||||
break;
|
||||
case 0x01: /* DEC Ed */
|
||||
RMEd(DECD);
|
||||
break;
|
||||
case 0x02: /* CALL NEAR Ed */
|
||||
if (rm >= 0xc0 ) {GetEArd;Push_32(GETIP);SETIP(*eard);}
|
||||
else {GetEAa;Push_32(GETIP);SETIP(LoadMd(eaa));}
|
||||
break;
|
||||
case 0x03: /* CALL FAR Ed */
|
||||
{
|
||||
GetEAa;
|
||||
Bit32u newip=LoadMd(eaa);
|
||||
Bit16u newcs=LoadMw(eaa+4);
|
||||
SAVEIP;
|
||||
if (CPU_CALL(true,newcs,newip)) {
|
||||
LOADIP;
|
||||
} else {
|
||||
FillFlags();return CBRET_NONE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0x04: /* JMP NEAR Ed */
|
||||
if (rm >= 0xc0 ) {GetEArd;SETIP(*eard);}
|
||||
else {GetEAa;SETIP(LoadMd(eaa));}
|
||||
break;
|
||||
case 0x05: /* JMP FAR Ed */
|
||||
{
|
||||
GetEAa;
|
||||
Bit32u newip=LoadMd(eaa);
|
||||
Bit16u newcs=LoadMw(eaa+4);
|
||||
SAVEIP;
|
||||
if (CPU_JMP(true,newcs,newip)) {
|
||||
LOADIP;
|
||||
} else {
|
||||
FillFlags();return CBRET_NONE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0x06: /* Push Ed */
|
||||
if (rm >= 0xc0 ) {GetEArd;Push_32(*eard);}
|
||||
else {GetEAa;Push_32(LoadMd(eaa));}
|
||||
break;
|
||||
default:
|
||||
E_Exit("CPU:66:GRP5:Illegal call %2X",which);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
360
src/cpu/core_normal/prefix_66_0f.h
Normal file
360
src/cpu/core_normal/prefix_66_0f.h
Normal file
@ -0,0 +1,360 @@
|
||||
/*
|
||||
* Copyright (C) 2002 The DOSBox Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
CASE_0F_D(0x00) /* GRP 6 Exxx */
|
||||
{
|
||||
GetRM;Bitu which=(rm>>3)&7;
|
||||
switch (which) {
|
||||
case 0x00: /* SLDT */
|
||||
case 0x01: /* STR */
|
||||
{
|
||||
Bitu saveval;
|
||||
if (!which) CPU_SLDT(saveval);
|
||||
else CPU_STR(saveval);
|
||||
if (rm >= 0xc0) {GetEArw;*earw=(Bit16u)saveval;}
|
||||
else {GetEAa;SaveMw(eaa,saveval);}
|
||||
}
|
||||
break;
|
||||
case 0x02:case 0x03:case 0x04:case 0x05:
|
||||
{
|
||||
/* Just use 16-bit loads since were only using selectors */
|
||||
FillFlags();
|
||||
Bitu loadval;
|
||||
if (rm >= 0xc0 ) {GetEArw;loadval=*earw;}
|
||||
else {GetEAa;loadval=LoadMw(eaa);}
|
||||
break;
|
||||
switch (which) {
|
||||
case 0x02:CPU_LLDT(loadval);break;
|
||||
case 0x03:CPU_LTR(loadval);break;
|
||||
case 0x04:CPU_VERR(loadval);break;
|
||||
case 0x05:CPU_VERW(loadval);break;
|
||||
}
|
||||
}
|
||||
default:
|
||||
LOG(LOG_CPU,LOG_ERROR)("GRP6:Illegal call %2X",which);
|
||||
}
|
||||
}
|
||||
break;
|
||||
CASE_0F_D(0x01) /* Group 7 Ed */
|
||||
{
|
||||
GetRM;Bitu which=(rm>>3)&7;
|
||||
if (rm < 0xc0) { //First ones all use EA
|
||||
GetEAa;Bitu limit,base;
|
||||
switch (which) {
|
||||
case 0x00: /* SGDT */
|
||||
CPU_SGDT(limit,base);
|
||||
SaveMw(eaa,(Bit16u)limit);
|
||||
SaveMd(eaa+2,(Bit32u)base);
|
||||
break;
|
||||
case 0x01: /* SIDT */
|
||||
CPU_SIDT(limit,base);
|
||||
SaveMw(eaa,(Bit16u)limit);
|
||||
SaveMd(eaa+2,(Bit32u)base);
|
||||
break;
|
||||
case 0x02: /* LGDT */
|
||||
CPU_LGDT(LoadMw(eaa),LoadMd(eaa+2));
|
||||
break;
|
||||
case 0x03: /* LIDT */
|
||||
CPU_LIDT(LoadMw(eaa),LoadMd(eaa+2));
|
||||
break;
|
||||
case 0x04: /* SMSW */
|
||||
CPU_SMSW(limit);
|
||||
SaveMw(eaa,(Bit16u)limit);
|
||||
break;
|
||||
case 0x06: /* LMSW */
|
||||
limit=LoadMw(eaa);
|
||||
if (!CPU_LMSW((Bit16u)limit)) goto decode_end;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
GetEArd;Bitu limit;
|
||||
switch (which) {
|
||||
case 0x04: /* SMSW */
|
||||
CPU_SMSW(limit);
|
||||
*eard=(Bit32u)limit;
|
||||
break;
|
||||
case 0x06: /* LMSW */
|
||||
if (!CPU_LMSW(*eard)) goto decode_end;
|
||||
break;
|
||||
default:
|
||||
LOG(LOG_CPU,LOG_ERROR)("Illegal group 7 RM subfunction %d",which);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
break;
|
||||
CASE_0F_D(0x02) /* LAR Gd,Ed */
|
||||
{
|
||||
FillFlags();
|
||||
GetRMrd;Bitu ar;
|
||||
if (rm >= 0xc0) {
|
||||
GetEArw;CPU_LAR(*earw,ar);
|
||||
} else {
|
||||
GetEAa;CPU_LAR(LoadMw(eaa),ar);
|
||||
}
|
||||
*rmrd=(Bit32u)ar;
|
||||
}
|
||||
break;
|
||||
CASE_0F_D(0x03) /* LSL Gd,Ew */
|
||||
{
|
||||
FillFlags();
|
||||
GetRMrd;Bitu limit;
|
||||
/* Just load 16-bit values for selectors */
|
||||
if (rm >= 0xc0) {
|
||||
GetEArw;CPU_LSL(*earw,limit);
|
||||
} else {
|
||||
GetEAa;CPU_LSL(LoadMw(eaa),limit);
|
||||
}
|
||||
*rmrd=(Bit16u)limit;
|
||||
}
|
||||
break;
|
||||
CASE_0F_D(0x80) /* JO */
|
||||
JumpSId(get_OF());break;
|
||||
CASE_0F_D(0x81) /* JNO */
|
||||
JumpSId(!get_OF());break;
|
||||
CASE_0F_D(0x82) /* JB */
|
||||
JumpSId(get_CF());break;
|
||||
CASE_0F_D(0x83) /* JNB */
|
||||
JumpSId(!get_CF());break;
|
||||
CASE_0F_D(0x84) /* JZ */
|
||||
JumpSId(get_ZF());break;
|
||||
CASE_0F_D(0x85) /* JNZ */
|
||||
JumpSId(!get_ZF());break;
|
||||
CASE_0F_D(0x86) /* JBE */
|
||||
JumpSId(get_CF() || get_ZF());break;
|
||||
CASE_0F_D(0x87) /* JNBE */
|
||||
JumpSId(!get_CF() && !get_ZF());break;
|
||||
CASE_0F_D(0x88) /* JS */
|
||||
JumpSId(get_SF());break;
|
||||
CASE_0F_D(0x89) /* JNS */
|
||||
JumpSId(!get_SF());break;
|
||||
CASE_0F_D(0x8a) /* JP */
|
||||
JumpSId(get_PF());break;
|
||||
CASE_0F_D(0x8b) /* JNP */
|
||||
JumpSId(!get_PF());break;
|
||||
CASE_0F_D(0x8c) /* JL */
|
||||
JumpSId(get_SF() != get_OF());break;
|
||||
CASE_0F_D(0x8d) /* JNL */
|
||||
JumpSId(get_SF() == get_OF());break;
|
||||
CASE_0F_D(0x8e) /* JLE */
|
||||
JumpSId(get_ZF() || (get_SF() != get_OF()));break;
|
||||
CASE_0F_D(0x8f) /* JNLE */
|
||||
JumpSId((get_SF() == get_OF()) && !get_ZF());break;
|
||||
|
||||
CASE_0F_D(0xa0) /* PUSH FS */
|
||||
Push_32(SegValue(fs));break;
|
||||
CASE_0F_D(0xa1) /* POP FS */
|
||||
CPU_SetSegGeneral(fs,(Bit16u)Pop_32());break;
|
||||
|
||||
CASE_0F_D(0xa3) /* BT Ed,Gd */
|
||||
{
|
||||
GetRMrd;
|
||||
Bit32u mask=1 << (*rmrd & 31);
|
||||
if (rm >= 0xc0 ) {
|
||||
GetEArd;
|
||||
SETFLAGBIT(CF,(*eard & mask));
|
||||
} else {
|
||||
GetEAa;Bit32u old=LoadMd(eaa);
|
||||
SETFLAGBIT(CF,(old & mask));
|
||||
}
|
||||
if (flags.type!=t_CF) { flags.prev_type=flags.type;flags.type=t_CF; }
|
||||
break;
|
||||
}
|
||||
CASE_0F_D(0xa4) /* SHLD Ed,Gd,Ib */
|
||||
RMEdGdOp3(DSHLD,Fetchb());
|
||||
break;
|
||||
CASE_0F_D(0xa5) /* SHLD Ed,Gd,CL */
|
||||
RMEdGdOp3(DSHLD,reg_cl);
|
||||
break;
|
||||
CASE_0F_D(0xa8) /* PUSH GS */
|
||||
Push_32(SegValue(gs));break;
|
||||
CASE_0F_D(0xa9) /* POP GS */
|
||||
CPU_SetSegGeneral(gs,(Bit16u)Pop_32());break;
|
||||
CASE_0F_D(0xab) /* BTS Ed,Gd */
|
||||
{
|
||||
GetRMrd;
|
||||
Bit32u mask=1 << (*rmrd & 31);
|
||||
if (rm >= 0xc0 ) {
|
||||
GetEArd;
|
||||
SETFLAGBIT(CF,(*eard & mask));
|
||||
*eard|=mask;
|
||||
} else {
|
||||
GetEAa;Bit32u old=LoadMd(eaa);
|
||||
SETFLAGBIT(CF,(old & mask));
|
||||
SaveMd(eaa,old | mask);
|
||||
}
|
||||
if (flags.type!=t_CF) { flags.prev_type=flags.type;flags.type=t_CF; }
|
||||
break;
|
||||
}
|
||||
|
||||
CASE_0F_D(0xac) /* SHRD Ed,Gd,Ib */
|
||||
RMEdGdOp3(DSHRD,Fetchb());
|
||||
break;
|
||||
CASE_0F_D(0xad) /* SHRD Ed,Gd,CL */
|
||||
RMEdGdOp3(DSHRD,reg_cl);
|
||||
break;
|
||||
CASE_0F_D(0xb4) /* LFS Ed */
|
||||
{
|
||||
GetRMrd;GetEAa;
|
||||
*rmrd=LoadMd(eaa);CPU_SetSegGeneral(fs,LoadMw(eaa+4));
|
||||
break;
|
||||
}
|
||||
CASE_0F_D(0xb5) /* LGS Ed */
|
||||
{
|
||||
GetRMrd;GetEAa;
|
||||
*rmrd=LoadMd(eaa);CPU_SetSegGeneral(gs,LoadMw(eaa+4));
|
||||
break;
|
||||
}
|
||||
CASE_0F_D(0xb6) /* MOVZX Gd,Eb */
|
||||
{
|
||||
GetRMrd;
|
||||
if (rm >= 0xc0 ) {GetEArb;*rmrd=*earb;}
|
||||
else {GetEAa;*rmrd=LoadMb(eaa);}
|
||||
break;
|
||||
}
|
||||
CASE_0F_D(0xaf) /* IMUL Gd,Ed */
|
||||
{
|
||||
RMGdEdOp3(DIMULD,*rmrd);
|
||||
break;
|
||||
}
|
||||
CASE_0F_D(0xb2) /* LSS Ed */
|
||||
{
|
||||
GetRMrd;GetEAa;
|
||||
*rmrd=LoadMd(eaa);CPU_SetSegGeneral(ss,LoadMw(eaa+4));
|
||||
break;
|
||||
}
|
||||
CASE_0F_D(0xb7) /* MOVXZ Gd,Ew */
|
||||
{
|
||||
GetRMrd;
|
||||
if (rm >= 0xc0 ) {GetEArw;*rmrd=*earw;}
|
||||
else {GetEAa;*rmrd=LoadMw(eaa);}
|
||||
break;
|
||||
}
|
||||
CASE_0F_D(0xba) /* GRP8 Ed,Ib */
|
||||
{
|
||||
GetRM;
|
||||
if (rm >= 0xc0 ) {
|
||||
GetEArd;
|
||||
Bit32u mask=1 << (Fetchb() & 31);
|
||||
SETFLAGBIT(CF,(*eard & mask));
|
||||
switch (rm & 0x38) {
|
||||
case 0x20: /* BT */
|
||||
break;
|
||||
case 0x28: /* BTS */
|
||||
*eard|=mask;
|
||||
break;
|
||||
case 0x30: /* BTR */
|
||||
*eard&=~mask;
|
||||
break;
|
||||
case 0x38: /* BTC */
|
||||
if (GETFLAG(CF)) *eard&=~mask;
|
||||
else *eard|=mask;
|
||||
break;
|
||||
default:
|
||||
E_Exit("CPU:66:0F:BA:Illegal subfunction %X",rm & 0x38);
|
||||
}
|
||||
} else {
|
||||
GetEAa;Bit32u old=LoadMd(eaa);
|
||||
Bit32u mask=1 << (Fetchb() & 31);
|
||||
SETFLAGBIT(CF,(old & mask));
|
||||
switch (rm & 0x38) {
|
||||
case 0x20: /* BT */
|
||||
break;
|
||||
case 0x28: /* BTS */
|
||||
SaveMd(eaa,old|mask);
|
||||
break;
|
||||
case 0x30: /* BTR */
|
||||
SaveMd(eaa,old & ~mask);
|
||||
break;
|
||||
case 0x38: /* BTC */
|
||||
if (GETFLAG(CF)) old&=~mask;
|
||||
else old|=mask;
|
||||
SaveMd(eaa,old);
|
||||
break;
|
||||
default:
|
||||
E_Exit("CPU:66:0F:BA:Illegal subfunction %X",rm & 0x38);
|
||||
}
|
||||
}
|
||||
if (flags.type!=t_CF) flags.prev_type=flags.type;
|
||||
flags.type=t_CF;
|
||||
break;
|
||||
}
|
||||
CASE_0F_D(0xbb) /* BTC Ed,Gd */
|
||||
{
|
||||
GetRMrd;
|
||||
Bit32u mask=1 << (*rmrd & 31);
|
||||
if (rm >= 0xc0 ) {
|
||||
GetEArd;
|
||||
SETFLAGBIT(CF,(*eard & mask));
|
||||
*eard^=mask;
|
||||
} else {
|
||||
GetEAa;Bit32u old=LoadMd(eaa);
|
||||
SETFLAGBIT(CF,(old & mask));
|
||||
SaveMd(eaa,old ^ mask);
|
||||
}
|
||||
if (flags.type!=t_CF) { flags.prev_type=flags.type;flags.type=t_CF; }
|
||||
break;
|
||||
}
|
||||
CASE_0F_D(0xbc) /* BSF Gd,Ed */
|
||||
{
|
||||
GetRMrd;
|
||||
Bit32u result,value;
|
||||
if (rm >= 0xc0) { GetEArd; value=*eard; }
|
||||
else { GetEAa; value=LoadMd(eaa); }
|
||||
if (value==0) {
|
||||
SETFLAGBIT(ZF,true);
|
||||
} else {
|
||||
result = 0;
|
||||
while ((value & 0x01)==0) { result++; value>>=1; }
|
||||
SETFLAGBIT(ZF,false);
|
||||
*rmrd = result;
|
||||
}
|
||||
flags.type=t_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
CASE_0F_D(0xbd) /* BSR Gd,Ed */
|
||||
{
|
||||
GetRMrd;
|
||||
Bit32u result,value;
|
||||
if (rm >= 0xc0) { GetEArd; value=*eard; }
|
||||
else { GetEAa; value=LoadMd(eaa); }
|
||||
if (value==0) {
|
||||
SETFLAGBIT(ZF,true);
|
||||
} else {
|
||||
result = 31; // Operandsize-1
|
||||
while ((value & 0x80000000)==0) { result--; value<<=1; }
|
||||
SETFLAGBIT(ZF,false);
|
||||
*rmrd = result;
|
||||
}
|
||||
flags.type=t_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
CASE_0F_D(0xbe) /* MOVSX Gd,Eb */
|
||||
{
|
||||
GetRMrd;
|
||||
if (rm >= 0xc0 ) {GetEArb;*rmrd=*(Bit8s *)earb;}
|
||||
else {GetEAa;*rmrd=LoadMbs(eaa);}
|
||||
break;
|
||||
}
|
||||
CASE_0F_D(0xbf) /* MOVSX Gd,Ew */
|
||||
{
|
||||
GetRMrd;
|
||||
if (rm >= 0xc0 ) {GetEArw;*rmrd=*(Bit16s *)earw;}
|
||||
else {GetEAa;*rmrd=LoadMws(eaa);}
|
||||
break;
|
||||
}
|
1171
src/cpu/core_normal/prefix_none.h
Normal file
1171
src/cpu/core_normal/prefix_none.h
Normal file
File diff suppressed because it is too large
Load Diff
243
src/cpu/core_normal/string.h
Normal file
243
src/cpu/core_normal/string.h
Normal file
@ -0,0 +1,243 @@
|
||||
enum STRING_OP {
|
||||
R_OUTSB,R_OUTSW,R_OUTSD,
|
||||
R_INSB,R_INSW,R_INSD,
|
||||
R_MOVSB,R_MOVSW,R_MOVSD,
|
||||
R_LODSB,R_LODSW,R_LODSD,
|
||||
R_STOSB,R_STOSW,R_STOSD,
|
||||
R_SCASB,R_SCASW,R_SCASD,
|
||||
R_CMPSB,R_CMPSW,R_CMPSD,
|
||||
};
|
||||
|
||||
#define LoadD(_BLAH) _BLAH
|
||||
|
||||
static void DoString(STRING_OP type) {
|
||||
PhysPt si_base,di_base;
|
||||
Bitu si_index,di_index;
|
||||
Bitu add_mask;
|
||||
Bitu count,count_left;
|
||||
Bits add_index;
|
||||
|
||||
if (TEST_PREFIX_SEG) si_base=core.seg_prefix_base;
|
||||
else si_base=SegBase(ds);
|
||||
di_base=SegBase(es);
|
||||
if (TEST_PREFIX_ADDR) {
|
||||
add_mask=0xFFFFFFFF;
|
||||
si_index=reg_esi;
|
||||
di_index=reg_edi;
|
||||
count=reg_ecx;
|
||||
} else {
|
||||
add_mask=0xFFFF;
|
||||
si_index=reg_si;
|
||||
di_index=reg_di;
|
||||
count=reg_cx;
|
||||
}
|
||||
if (!(TEST_PREFIX_REP)) {
|
||||
count=1;
|
||||
} else {
|
||||
CPU_Cycles++;
|
||||
/* Calculate amount of ops to do before cycles run out */
|
||||
if ((count>(Bitu)CPU_Cycles) && (type<R_SCASB)) {
|
||||
count_left=count-CPU_Cycles;
|
||||
count=CPU_Cycles;
|
||||
CPU_Cycles=0;
|
||||
core.ip_lookup=core.op_start; //Reset IP to start of instruction
|
||||
} else {
|
||||
/* Won't interrupt scas and cmps instruction since they can interrupt themselves */
|
||||
count_left=0;
|
||||
}
|
||||
}
|
||||
add_index=GETFLAG(DF) ? -1 : 1;
|
||||
if (count) switch (type) {
|
||||
case R_OUTSB:
|
||||
for (;count>0;count--) {
|
||||
IO_Write(reg_dx,LoadMb(si_base+si_index));
|
||||
si_index=(si_index+add_index) & add_mask;
|
||||
}
|
||||
break;
|
||||
case R_OUTSW:
|
||||
add_index<<=1;
|
||||
for (;count>0;count--) {
|
||||
IO_Write(reg_dx,LoadMb(si_base+si_index));
|
||||
IO_Write(reg_dx+1,LoadMb(si_base+si_index+1));
|
||||
si_index=(si_index+add_index) & add_mask;
|
||||
}
|
||||
break;
|
||||
case R_OUTSD:
|
||||
add_index<<=2;
|
||||
for (;count>0;count--) {
|
||||
IO_Write(reg_dx,LoadMb(si_base+si_index));
|
||||
IO_Write(reg_dx+1,LoadMb(si_base+si_index+1));
|
||||
IO_Write(reg_dx+2,LoadMb(si_base+si_index+2));
|
||||
IO_Write(reg_dx+3,LoadMb(si_base+si_index+3));
|
||||
si_index=(si_index+add_index) & add_mask;
|
||||
}
|
||||
break;
|
||||
case R_INSB:
|
||||
for (;count>0;count--) {
|
||||
SaveMb(di_base+di_index,IO_Read(reg_dx));
|
||||
di_index=(di_index+add_index) & add_mask;
|
||||
}
|
||||
break;
|
||||
case R_INSW:
|
||||
add_index<<=1;
|
||||
for (;count>0;count--) {
|
||||
SaveMb(di_base+di_index,IO_Read(reg_dx));
|
||||
SaveMb(di_base+di_index+1,IO_Read(reg_dx+1));
|
||||
di_index=(di_index+add_index) & add_mask;
|
||||
}
|
||||
break;
|
||||
case R_STOSB:
|
||||
for (;count>0;count--) {
|
||||
SaveMb(di_base+di_index,reg_al);
|
||||
di_index=(di_index+add_index) & add_mask;
|
||||
}
|
||||
break;
|
||||
case R_STOSW:
|
||||
add_index<<=1;
|
||||
for (;count>0;count--) {
|
||||
SaveMw(di_base+di_index,reg_ax);
|
||||
di_index=(di_index+add_index) & add_mask;
|
||||
}
|
||||
break;
|
||||
case R_STOSD:
|
||||
add_index<<=2;
|
||||
for (;count>0;count--) {
|
||||
SaveMd(di_base+di_index,reg_eax);
|
||||
di_index=(di_index+add_index) & add_mask;
|
||||
}
|
||||
break;
|
||||
case R_MOVSB:
|
||||
for (;count>0;count--) {
|
||||
SaveMb(di_base+di_index,LoadMb(si_base+si_index));
|
||||
di_index=(di_index+add_index) & add_mask;
|
||||
si_index=(si_index+add_index) & add_mask;
|
||||
}
|
||||
break;
|
||||
case R_MOVSW:
|
||||
add_index<<=1;
|
||||
for (;count>0;count--) {
|
||||
SaveMw(di_base+di_index,LoadMw(si_base+si_index));
|
||||
di_index=(di_index+add_index) & add_mask;
|
||||
si_index=(si_index+add_index) & add_mask;
|
||||
}
|
||||
break;
|
||||
case R_MOVSD:
|
||||
add_index<<=2;
|
||||
for (;count>0;count--) {
|
||||
SaveMd(di_base+di_index,LoadMd(si_base+si_index));
|
||||
di_index=(di_index+add_index) & add_mask;
|
||||
si_index=(si_index+add_index) & add_mask;
|
||||
}
|
||||
break;
|
||||
case R_LODSB:
|
||||
for (;count>0;count--) {
|
||||
reg_al=LoadMb(si_base+si_index);
|
||||
si_index=(si_index+add_index) & add_mask;
|
||||
}
|
||||
break;
|
||||
case R_LODSW:
|
||||
add_index<<=1;
|
||||
for (;count>0;count--) {
|
||||
reg_ax=LoadMw(si_base+si_index);
|
||||
si_index=(si_index+add_index) & add_mask;
|
||||
}
|
||||
break;
|
||||
case R_LODSD:
|
||||
add_index<<=2;
|
||||
for (;count>0;count--) {
|
||||
reg_eax=LoadMd(si_base+si_index);
|
||||
si_index=(si_index+add_index) & add_mask;
|
||||
}
|
||||
break;
|
||||
case R_SCASB:
|
||||
{
|
||||
Bit8u val2;
|
||||
for (;count>0;) {
|
||||
count--;CPU_Cycles--;
|
||||
val2=LoadMb(di_base+di_index);
|
||||
di_index=(di_index+add_index) & add_mask;
|
||||
if ((reg_al==val2)!=core.rep_zero) break;
|
||||
}
|
||||
CMPB(reg_al,val2,LoadD,0);
|
||||
}
|
||||
break;
|
||||
case R_SCASW:
|
||||
{
|
||||
add_index<<=1;Bit16u val2;
|
||||
for (;count>0;) {
|
||||
count--;CPU_Cycles--;
|
||||
val2=LoadMw(di_base+di_index);
|
||||
di_index=(di_index+add_index) & add_mask;
|
||||
if ((reg_ax==val2)!=core.rep_zero) break;
|
||||
}
|
||||
CMPW(reg_ax,val2,LoadD,0);
|
||||
}
|
||||
break;
|
||||
case R_SCASD:
|
||||
{
|
||||
add_index<<=2;Bit32u val2;
|
||||
for (;count>0;) {
|
||||
count--;CPU_Cycles--;
|
||||
val2=LoadMd(di_base+di_index);
|
||||
di_index=(di_index+add_index) & add_mask;
|
||||
if ((reg_eax==val2)!=core.rep_zero) break;
|
||||
}
|
||||
CMPD(reg_eax,val2,LoadD,0);
|
||||
}
|
||||
break;
|
||||
case R_CMPSB:
|
||||
{
|
||||
Bit8u val1,val2;
|
||||
for (;count>0;) {
|
||||
count--;CPU_Cycles--;
|
||||
val1=LoadMb(si_base+si_index);
|
||||
val2=LoadMb(di_base+di_index);
|
||||
si_index=(si_index+add_index) & add_mask;
|
||||
di_index=(di_index+add_index) & add_mask;
|
||||
if ((val1==val2)!=core.rep_zero) break;
|
||||
}
|
||||
CMPB(val1,val2,LoadD,0);
|
||||
}
|
||||
break;
|
||||
case R_CMPSW:
|
||||
{
|
||||
add_index<<=1;Bit16u val1,val2;
|
||||
for (;count>0;) {
|
||||
count--;CPU_Cycles--;
|
||||
val1=LoadMw(si_base+si_index);
|
||||
val2=LoadMw(di_base+di_index);
|
||||
si_index=(si_index+add_index) & add_mask;
|
||||
di_index=(di_index+add_index) & add_mask;
|
||||
if ((val1==val2)!=core.rep_zero) break;
|
||||
}
|
||||
CMPW(val1,val2,LoadD,0);
|
||||
}
|
||||
break;
|
||||
case R_CMPSD:
|
||||
{
|
||||
add_index<<=2;Bit32u val1,val2;
|
||||
for (;count>0;) {
|
||||
count--;CPU_Cycles--;
|
||||
val1=LoadMd(si_base+si_index);
|
||||
val2=LoadMd(di_base+di_index);
|
||||
si_index=(si_index+add_index) & add_mask;
|
||||
di_index=(di_index+add_index) & add_mask;
|
||||
if ((val1==val2)!=core.rep_zero) break;
|
||||
}
|
||||
CMPD(val1,val2,LoadD,0);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
LOG(LOG_CPU,LOG_ERROR)("Unhandled string op %d",type);
|
||||
}
|
||||
/* Clean up after certain amount of instructions */
|
||||
reg_esi&=(~add_mask);
|
||||
reg_esi|=(si_index & add_mask);
|
||||
reg_edi&=(~add_mask);
|
||||
reg_edi|=(di_index & add_mask);
|
||||
if (TEST_PREFIX_REP) {
|
||||
count+=count_left;
|
||||
reg_ecx&=(~add_mask);
|
||||
reg_ecx|=(count & add_mask);
|
||||
}
|
||||
}
|
138
src/cpu/core_normal/support.h
Normal file
138
src/cpu/core_normal/support.h
Normal file
@ -0,0 +1,138 @@
|
||||
/*
|
||||
* Copyright (C) 2002 The DOSBox Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#define SETIP(_a_) (core.ip_lookup=SegBase(cs)+_a_)
|
||||
#define GETIP (Bit32u)(core.ip_lookup-SegBase(cs))
|
||||
#define SAVEIP {reg_eip=GETIP;}
|
||||
#define LOADIP {core.ip_lookup=(SegBase(cs)+reg_eip);}
|
||||
|
||||
#define LEAVECORE \
|
||||
SAVEIP; \
|
||||
FillFlags();
|
||||
|
||||
static INLINE void ADDIPw(Bits add) {
|
||||
SAVEIP;
|
||||
reg_eip=(Bit16u)(reg_eip+add);
|
||||
LOADIP;
|
||||
}
|
||||
|
||||
static INLINE void ADDIPd(Bits add) {
|
||||
SAVEIP;
|
||||
reg_eip=(reg_eip+add);
|
||||
LOADIP;
|
||||
}
|
||||
|
||||
|
||||
static INLINE void ADDIPFAST(Bits blah) {
|
||||
core.ip_lookup+=blah;
|
||||
}
|
||||
|
||||
#define EXCEPTION(blah) \
|
||||
{ \
|
||||
Bit8u new_num=blah; \
|
||||
core.ip_lookup=core.op_start; \
|
||||
LEAVECORE; \
|
||||
if (Interrupt(new_num)) { \
|
||||
goto decode_start; \
|
||||
} else return CBRET_NONE; \
|
||||
}
|
||||
|
||||
static INLINE Bit8u Fetchb() {
|
||||
Bit8u temp=LoadMb(core.ip_lookup);
|
||||
core.ip_lookup+=1;
|
||||
return temp;
|
||||
}
|
||||
|
||||
static INLINE Bit16u Fetchw() {
|
||||
Bit16u temp=LoadMw(core.ip_lookup);
|
||||
core.ip_lookup+=2;
|
||||
return temp;
|
||||
}
|
||||
static INLINE Bit32u Fetchd() {
|
||||
Bit32u temp=LoadMd(core.ip_lookup);
|
||||
core.ip_lookup+=4;
|
||||
return temp;
|
||||
}
|
||||
|
||||
static INLINE Bit8s Fetchbs() {
|
||||
return Fetchb();
|
||||
}
|
||||
static INLINE Bit16s Fetchws() {
|
||||
return Fetchw();
|
||||
}
|
||||
|
||||
static INLINE Bit32s Fetchds() {
|
||||
return Fetchd();
|
||||
}
|
||||
|
||||
static INLINE void Push_16(Bit16u blah) {
|
||||
reg_esp-=2;
|
||||
SaveMw(SegBase(ss)+(reg_esp & cpu.stack.mask),blah);
|
||||
};
|
||||
|
||||
static INLINE void Push_32(Bit32u blah) {
|
||||
reg_esp-=4;
|
||||
SaveMd(SegBase(ss)+(reg_esp & cpu.stack.mask),blah);
|
||||
};
|
||||
|
||||
static INLINE Bit16u Pop_16() {
|
||||
Bit16u temp=LoadMw(SegBase(ss)+(reg_esp & cpu.stack.mask));
|
||||
reg_esp+=2;
|
||||
return temp;
|
||||
};
|
||||
|
||||
static INLINE Bit32u Pop_32() {
|
||||
Bit32u temp=LoadMd(SegBase(ss)+(reg_esp & cpu.stack.mask));
|
||||
reg_esp+=4;
|
||||
return temp;
|
||||
};
|
||||
|
||||
#define JumpSIb(blah) \
|
||||
if (blah) { \
|
||||
ADDIPFAST(Fetchbs()); \
|
||||
} else { \
|
||||
ADDIPFAST(1); \
|
||||
}
|
||||
|
||||
#define JumpSIw(blah) \
|
||||
if (blah) { \
|
||||
ADDIPw(Fetchws()); \
|
||||
} else { \
|
||||
ADDIPFAST(2); \
|
||||
}
|
||||
|
||||
|
||||
#define JumpSId(blah) \
|
||||
if (blah) { \
|
||||
ADDIPd(Fetchds()); \
|
||||
} else { \
|
||||
ADDIPFAST(4); \
|
||||
}
|
||||
|
||||
#define SETcc(cc) \
|
||||
{ \
|
||||
GetRM; \
|
||||
if (rm >= 0xc0 ) {GetEArb;*earb=(cc) ? 1 : 0;} \
|
||||
else {GetEAa;SaveMb(eaa,(cc) ? 1 : 0);} \
|
||||
}
|
||||
|
||||
#include "helpers.h"
|
||||
#include "table_ea.h"
|
||||
#include "../modrm.h"
|
||||
|
||||
|
356
src/cpu/core_normal/table_ea.h
Normal file
356
src/cpu/core_normal/table_ea.h
Normal file
@ -0,0 +1,356 @@
|
||||
/*
|
||||
* Copyright (C) 2002 The DOSBox Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
typedef PhysPt (*GetEATable[256])(void);
|
||||
typedef PhysPt (*EA_LookupHandler)(void);
|
||||
|
||||
|
||||
/* The MOD/RM Decoder for EA for this decoder's addressing modes */
|
||||
static PhysPt EA_16_00_n(void) { return SegBase(ds)+(Bit16u)(reg_bx+(Bit16s)reg_si); }
|
||||
static PhysPt EA_16_01_n(void) { return SegBase(ds)+(Bit16u)(reg_bx+(Bit16s)reg_di); }
|
||||
static PhysPt EA_16_02_n(void) { return SegBase(ss)+(Bit16u)(reg_bp+(Bit16s)reg_si); }
|
||||
static PhysPt EA_16_03_n(void) { return SegBase(ss)+(Bit16u)(reg_bp+(Bit16s)reg_di); }
|
||||
static PhysPt EA_16_04_n(void) { return SegBase(ds)+(Bit16u)(reg_si); }
|
||||
static PhysPt EA_16_05_n(void) { return SegBase(ds)+(Bit16u)(reg_di); }
|
||||
static PhysPt EA_16_06_n(void) { return SegBase(ds)+(Bit16u)(Fetchw());}
|
||||
static PhysPt EA_16_07_n(void) { return SegBase(ds)+(Bit16u)(reg_bx); }
|
||||
|
||||
static PhysPt EA_16_40_n(void) { return SegBase(ds)+(Bit16u)(reg_bx+(Bit16s)reg_si+Fetchbs()); }
|
||||
static PhysPt EA_16_41_n(void) { return SegBase(ds)+(Bit16u)(reg_bx+(Bit16s)reg_di+Fetchbs()); }
|
||||
static PhysPt EA_16_42_n(void) { return SegBase(ss)+(Bit16u)(reg_bp+(Bit16s)reg_si+Fetchbs()); }
|
||||
static PhysPt EA_16_43_n(void) { return SegBase(ss)+(Bit16u)(reg_bp+(Bit16s)reg_di+Fetchbs()); }
|
||||
static PhysPt EA_16_44_n(void) { return SegBase(ds)+(Bit16u)(reg_si+Fetchbs()); }
|
||||
static PhysPt EA_16_45_n(void) { return SegBase(ds)+(Bit16u)(reg_di+Fetchbs()); }
|
||||
static PhysPt EA_16_46_n(void) { return SegBase(ss)+(Bit16u)(reg_bp+Fetchbs()); }
|
||||
static PhysPt EA_16_47_n(void) { return SegBase(ds)+(Bit16u)(reg_bx+Fetchbs()); }
|
||||
|
||||
static PhysPt EA_16_80_n(void) { return SegBase(ds)+(Bit16u)(reg_bx+(Bit16s)reg_si+Fetchws()); }
|
||||
static PhysPt EA_16_81_n(void) { return SegBase(ds)+(Bit16u)(reg_bx+(Bit16s)reg_di+Fetchws()); }
|
||||
static PhysPt EA_16_82_n(void) { return SegBase(ss)+(Bit16u)(reg_bp+(Bit16s)reg_si+Fetchws()); }
|
||||
static PhysPt EA_16_83_n(void) { return SegBase(ss)+(Bit16u)(reg_bp+(Bit16s)reg_di+Fetchws()); }
|
||||
static PhysPt EA_16_84_n(void) { return SegBase(ds)+(Bit16u)(reg_si+Fetchws()); }
|
||||
static PhysPt EA_16_85_n(void) { return SegBase(ds)+(Bit16u)(reg_di+Fetchws()); }
|
||||
static PhysPt EA_16_86_n(void) { return SegBase(ss)+(Bit16u)(reg_bp+Fetchws()); }
|
||||
static PhysPt EA_16_87_n(void) { return SegBase(ds)+(Bit16u)(reg_bx+Fetchws()); }
|
||||
|
||||
static GetEATable GetEA_NONE={
|
||||
/* 00 */
|
||||
EA_16_00_n,EA_16_01_n,EA_16_02_n,EA_16_03_n,EA_16_04_n,EA_16_05_n,EA_16_06_n,EA_16_07_n,
|
||||
EA_16_00_n,EA_16_01_n,EA_16_02_n,EA_16_03_n,EA_16_04_n,EA_16_05_n,EA_16_06_n,EA_16_07_n,
|
||||
EA_16_00_n,EA_16_01_n,EA_16_02_n,EA_16_03_n,EA_16_04_n,EA_16_05_n,EA_16_06_n,EA_16_07_n,
|
||||
EA_16_00_n,EA_16_01_n,EA_16_02_n,EA_16_03_n,EA_16_04_n,EA_16_05_n,EA_16_06_n,EA_16_07_n,
|
||||
EA_16_00_n,EA_16_01_n,EA_16_02_n,EA_16_03_n,EA_16_04_n,EA_16_05_n,EA_16_06_n,EA_16_07_n,
|
||||
EA_16_00_n,EA_16_01_n,EA_16_02_n,EA_16_03_n,EA_16_04_n,EA_16_05_n,EA_16_06_n,EA_16_07_n,
|
||||
EA_16_00_n,EA_16_01_n,EA_16_02_n,EA_16_03_n,EA_16_04_n,EA_16_05_n,EA_16_06_n,EA_16_07_n,
|
||||
EA_16_00_n,EA_16_01_n,EA_16_02_n,EA_16_03_n,EA_16_04_n,EA_16_05_n,EA_16_06_n,EA_16_07_n,
|
||||
/* 01 */
|
||||
EA_16_40_n,EA_16_41_n,EA_16_42_n,EA_16_43_n,EA_16_44_n,EA_16_45_n,EA_16_46_n,EA_16_47_n,
|
||||
EA_16_40_n,EA_16_41_n,EA_16_42_n,EA_16_43_n,EA_16_44_n,EA_16_45_n,EA_16_46_n,EA_16_47_n,
|
||||
EA_16_40_n,EA_16_41_n,EA_16_42_n,EA_16_43_n,EA_16_44_n,EA_16_45_n,EA_16_46_n,EA_16_47_n,
|
||||
EA_16_40_n,EA_16_41_n,EA_16_42_n,EA_16_43_n,EA_16_44_n,EA_16_45_n,EA_16_46_n,EA_16_47_n,
|
||||
EA_16_40_n,EA_16_41_n,EA_16_42_n,EA_16_43_n,EA_16_44_n,EA_16_45_n,EA_16_46_n,EA_16_47_n,
|
||||
EA_16_40_n,EA_16_41_n,EA_16_42_n,EA_16_43_n,EA_16_44_n,EA_16_45_n,EA_16_46_n,EA_16_47_n,
|
||||
EA_16_40_n,EA_16_41_n,EA_16_42_n,EA_16_43_n,EA_16_44_n,EA_16_45_n,EA_16_46_n,EA_16_47_n,
|
||||
EA_16_40_n,EA_16_41_n,EA_16_42_n,EA_16_43_n,EA_16_44_n,EA_16_45_n,EA_16_46_n,EA_16_47_n,
|
||||
/* 10 */
|
||||
EA_16_80_n,EA_16_81_n,EA_16_82_n,EA_16_83_n,EA_16_84_n,EA_16_85_n,EA_16_86_n,EA_16_87_n,
|
||||
EA_16_80_n,EA_16_81_n,EA_16_82_n,EA_16_83_n,EA_16_84_n,EA_16_85_n,EA_16_86_n,EA_16_87_n,
|
||||
EA_16_80_n,EA_16_81_n,EA_16_82_n,EA_16_83_n,EA_16_84_n,EA_16_85_n,EA_16_86_n,EA_16_87_n,
|
||||
EA_16_80_n,EA_16_81_n,EA_16_82_n,EA_16_83_n,EA_16_84_n,EA_16_85_n,EA_16_86_n,EA_16_87_n,
|
||||
EA_16_80_n,EA_16_81_n,EA_16_82_n,EA_16_83_n,EA_16_84_n,EA_16_85_n,EA_16_86_n,EA_16_87_n,
|
||||
EA_16_80_n,EA_16_81_n,EA_16_82_n,EA_16_83_n,EA_16_84_n,EA_16_85_n,EA_16_86_n,EA_16_87_n,
|
||||
EA_16_80_n,EA_16_81_n,EA_16_82_n,EA_16_83_n,EA_16_84_n,EA_16_85_n,EA_16_86_n,EA_16_87_n,
|
||||
EA_16_80_n,EA_16_81_n,EA_16_82_n,EA_16_83_n,EA_16_84_n,EA_16_85_n,EA_16_86_n,EA_16_87_n,
|
||||
/* 11 These are illegal so make em 0 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
|
||||
|
||||
static PhysPt EA_16_00_s(void) { return core.seg_prefix_base+(Bit16u)(reg_bx+(Bit16s)reg_si); }
|
||||
static PhysPt EA_16_01_s(void) { return core.seg_prefix_base+(Bit16u)(reg_bx+(Bit16s)reg_di); }
|
||||
static PhysPt EA_16_02_s(void) { return core.seg_prefix_base+(Bit16u)(reg_bp+(Bit16s)reg_si); }
|
||||
static PhysPt EA_16_03_s(void) { return core.seg_prefix_base+(Bit16u)(reg_bp+(Bit16s)reg_di); }
|
||||
static PhysPt EA_16_04_s(void) { return core.seg_prefix_base+(Bit16u)(reg_si); }
|
||||
static PhysPt EA_16_05_s(void) { return core.seg_prefix_base+(Bit16u)(reg_di); }
|
||||
static PhysPt EA_16_06_s(void) { return core.seg_prefix_base+(Bit16u)(Fetchw()); }
|
||||
static PhysPt EA_16_07_s(void) { return core.seg_prefix_base+(Bit16u)(reg_bx); }
|
||||
|
||||
static PhysPt EA_16_40_s(void) { return core.seg_prefix_base+(Bit16u)(reg_bx+(Bit16s)reg_si+Fetchbs()); }
|
||||
static PhysPt EA_16_41_s(void) { return core.seg_prefix_base+(Bit16u)(reg_bx+(Bit16s)reg_di+Fetchbs()); }
|
||||
static PhysPt EA_16_42_s(void) { return core.seg_prefix_base+(Bit16u)(reg_bp+(Bit16s)reg_si+Fetchbs()); }
|
||||
static PhysPt EA_16_43_s(void) { return core.seg_prefix_base+(Bit16u)(reg_bp+(Bit16s)reg_di+Fetchbs()); }
|
||||
static PhysPt EA_16_44_s(void) { return core.seg_prefix_base+(Bit16u)(reg_si+Fetchbs()); }
|
||||
static PhysPt EA_16_45_s(void) { return core.seg_prefix_base+(Bit16u)(reg_di+Fetchbs()); }
|
||||
static PhysPt EA_16_46_s(void) { return core.seg_prefix_base+(Bit16u)(reg_bp+Fetchbs()); }
|
||||
static PhysPt EA_16_47_s(void) { return core.seg_prefix_base+(Bit16u)(reg_bx+Fetchbs()); }
|
||||
|
||||
static PhysPt EA_16_80_s(void) { return core.seg_prefix_base+(Bit16u)(reg_bx+(Bit16s)reg_si+Fetchws()); }
|
||||
static PhysPt EA_16_81_s(void) { return core.seg_prefix_base+(Bit16u)(reg_bx+(Bit16s)reg_di+Fetchws()); }
|
||||
static PhysPt EA_16_82_s(void) { return core.seg_prefix_base+(Bit16u)(reg_bp+(Bit16s)reg_si+Fetchws()); }
|
||||
static PhysPt EA_16_83_s(void) { return core.seg_prefix_base+(Bit16u)(reg_bp+(Bit16s)reg_di+Fetchws()); }
|
||||
static PhysPt EA_16_84_s(void) { return core.seg_prefix_base+(Bit16u)(reg_si+Fetchws()); }
|
||||
static PhysPt EA_16_85_s(void) { return core.seg_prefix_base+(Bit16u)(reg_di+Fetchws()); }
|
||||
static PhysPt EA_16_86_s(void) { return core.seg_prefix_base+(Bit16u)(reg_bp+Fetchws()); }
|
||||
static PhysPt EA_16_87_s(void) { return core.seg_prefix_base+(Bit16u)(reg_bx+Fetchws()); }
|
||||
|
||||
static GetEATable GetEA_SEG={
|
||||
/* 00 */
|
||||
EA_16_00_s,EA_16_01_s,EA_16_02_s,EA_16_03_s,EA_16_04_s,EA_16_05_s,EA_16_06_s,EA_16_07_s,
|
||||
EA_16_00_s,EA_16_01_s,EA_16_02_s,EA_16_03_s,EA_16_04_s,EA_16_05_s,EA_16_06_s,EA_16_07_s,
|
||||
EA_16_00_s,EA_16_01_s,EA_16_02_s,EA_16_03_s,EA_16_04_s,EA_16_05_s,EA_16_06_s,EA_16_07_s,
|
||||
EA_16_00_s,EA_16_01_s,EA_16_02_s,EA_16_03_s,EA_16_04_s,EA_16_05_s,EA_16_06_s,EA_16_07_s,
|
||||
EA_16_00_s,EA_16_01_s,EA_16_02_s,EA_16_03_s,EA_16_04_s,EA_16_05_s,EA_16_06_s,EA_16_07_s,
|
||||
EA_16_00_s,EA_16_01_s,EA_16_02_s,EA_16_03_s,EA_16_04_s,EA_16_05_s,EA_16_06_s,EA_16_07_s,
|
||||
EA_16_00_s,EA_16_01_s,EA_16_02_s,EA_16_03_s,EA_16_04_s,EA_16_05_s,EA_16_06_s,EA_16_07_s,
|
||||
EA_16_00_s,EA_16_01_s,EA_16_02_s,EA_16_03_s,EA_16_04_s,EA_16_05_s,EA_16_06_s,EA_16_07_s,
|
||||
/* 01 */
|
||||
EA_16_40_s,EA_16_41_s,EA_16_42_s,EA_16_43_s,EA_16_44_s,EA_16_45_s,EA_16_46_s,EA_16_47_s,
|
||||
EA_16_40_s,EA_16_41_s,EA_16_42_s,EA_16_43_s,EA_16_44_s,EA_16_45_s,EA_16_46_s,EA_16_47_s,
|
||||
EA_16_40_s,EA_16_41_s,EA_16_42_s,EA_16_43_s,EA_16_44_s,EA_16_45_s,EA_16_46_s,EA_16_47_s,
|
||||
EA_16_40_s,EA_16_41_s,EA_16_42_s,EA_16_43_s,EA_16_44_s,EA_16_45_s,EA_16_46_s,EA_16_47_s,
|
||||
EA_16_40_s,EA_16_41_s,EA_16_42_s,EA_16_43_s,EA_16_44_s,EA_16_45_s,EA_16_46_s,EA_16_47_s,
|
||||
EA_16_40_s,EA_16_41_s,EA_16_42_s,EA_16_43_s,EA_16_44_s,EA_16_45_s,EA_16_46_s,EA_16_47_s,
|
||||
EA_16_40_s,EA_16_41_s,EA_16_42_s,EA_16_43_s,EA_16_44_s,EA_16_45_s,EA_16_46_s,EA_16_47_s,
|
||||
EA_16_40_s,EA_16_41_s,EA_16_42_s,EA_16_43_s,EA_16_44_s,EA_16_45_s,EA_16_46_s,EA_16_47_s,
|
||||
/* 10 */
|
||||
EA_16_80_s,EA_16_81_s,EA_16_82_s,EA_16_83_s,EA_16_84_s,EA_16_85_s,EA_16_86_s,EA_16_87_s,
|
||||
EA_16_80_s,EA_16_81_s,EA_16_82_s,EA_16_83_s,EA_16_84_s,EA_16_85_s,EA_16_86_s,EA_16_87_s,
|
||||
EA_16_80_s,EA_16_81_s,EA_16_82_s,EA_16_83_s,EA_16_84_s,EA_16_85_s,EA_16_86_s,EA_16_87_s,
|
||||
EA_16_80_s,EA_16_81_s,EA_16_82_s,EA_16_83_s,EA_16_84_s,EA_16_85_s,EA_16_86_s,EA_16_87_s,
|
||||
EA_16_80_s,EA_16_81_s,EA_16_82_s,EA_16_83_s,EA_16_84_s,EA_16_85_s,EA_16_86_s,EA_16_87_s,
|
||||
EA_16_80_s,EA_16_81_s,EA_16_82_s,EA_16_83_s,EA_16_84_s,EA_16_85_s,EA_16_86_s,EA_16_87_s,
|
||||
EA_16_80_s,EA_16_81_s,EA_16_82_s,EA_16_83_s,EA_16_84_s,EA_16_85_s,EA_16_86_s,EA_16_87_s,
|
||||
EA_16_80_s,EA_16_81_s,EA_16_82_s,EA_16_83_s,EA_16_84_s,EA_16_85_s,EA_16_86_s,EA_16_87_s,
|
||||
/* 11 These are illegal so make em 0 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
static Bit32u SIBZero=0;
|
||||
static Bit32u * SIBIndex[8]= { ®_eax,®_ecx,®_edx,®_ebx,&SIBZero,®_ebp,®_esi,®_edi };
|
||||
|
||||
INLINE PhysPt Sib(Bitu mode) {
|
||||
Bit8u sib=Fetchb();
|
||||
PhysPt base;
|
||||
switch (sib&7) {
|
||||
case 0: /* EAX Base */
|
||||
base=SegBase(ds)+reg_eax;break;
|
||||
case 1: /* ECX Base */
|
||||
base=SegBase(ds)+reg_ecx;break;
|
||||
case 2: /* EDX Base */
|
||||
base=SegBase(ds)+reg_edx;break;
|
||||
case 3: /* EBX Base */
|
||||
base=SegBase(ds)+reg_ebx;break;
|
||||
case 4: /* ESP Base */
|
||||
base=SegBase(ss)+reg_esp;break;
|
||||
case 5: /* #1 Base */
|
||||
if (!mode) {
|
||||
base=SegBase(ds)+Fetchd();break;
|
||||
} else {
|
||||
base=SegBase(ss)+reg_ebp;break;
|
||||
}
|
||||
case 6: /* ESI Base */
|
||||
base=SegBase(ds)+reg_esi;break;
|
||||
case 7: /* EDI Base */
|
||||
base=SegBase(ds)+reg_edi;break;
|
||||
}
|
||||
base+=*SIBIndex[(sib >> 3) &7] << (sib >> 6);
|
||||
return base;
|
||||
};
|
||||
|
||||
|
||||
static PhysPt EA_32_00_n(void) { return SegBase(ds)+reg_eax; }
|
||||
static PhysPt EA_32_01_n(void) { return SegBase(ds)+reg_ecx; }
|
||||
static PhysPt EA_32_02_n(void) { return SegBase(ds)+reg_edx; }
|
||||
static PhysPt EA_32_03_n(void) { return SegBase(ds)+reg_ebx; }
|
||||
static PhysPt EA_32_04_n(void) { return Sib(0);}
|
||||
static PhysPt EA_32_05_n(void) { return SegBase(ds)+Fetchd(); }
|
||||
static PhysPt EA_32_06_n(void) { return SegBase(ds)+reg_esi; }
|
||||
static PhysPt EA_32_07_n(void) { return SegBase(ds)+reg_edi; }
|
||||
|
||||
static PhysPt EA_32_40_n(void) { return SegBase(ds)+reg_eax+Fetchbs(); }
|
||||
static PhysPt EA_32_41_n(void) { return SegBase(ds)+reg_ecx+Fetchbs(); }
|
||||
static PhysPt EA_32_42_n(void) { return SegBase(ds)+reg_edx+Fetchbs(); }
|
||||
static PhysPt EA_32_43_n(void) { return SegBase(ds)+reg_ebx+Fetchbs(); }
|
||||
static PhysPt EA_32_44_n(void) { PhysPt temp=Sib(1);return temp+Fetchbs();}
|
||||
//static PhysPt EA_32_44_n(void) { return Sib(1)+Fetchbs();}
|
||||
static PhysPt EA_32_45_n(void) { return SegBase(ss)+reg_ebp+Fetchbs(); }
|
||||
static PhysPt EA_32_46_n(void) { return SegBase(ds)+reg_esi+Fetchbs(); }
|
||||
static PhysPt EA_32_47_n(void) { return SegBase(ds)+reg_edi+Fetchbs(); }
|
||||
|
||||
static PhysPt EA_32_80_n(void) { return SegBase(ds)+reg_eax+Fetchds(); }
|
||||
static PhysPt EA_32_81_n(void) { return SegBase(ds)+reg_ecx+Fetchds(); }
|
||||
static PhysPt EA_32_82_n(void) { return SegBase(ds)+reg_edx+Fetchds(); }
|
||||
static PhysPt EA_32_83_n(void) { return SegBase(ds)+reg_ebx+Fetchds(); }
|
||||
static PhysPt EA_32_84_n(void) { PhysPt temp=Sib(2);return temp+Fetchds();}
|
||||
//static PhysPt EA_32_84_n(void) { return Sib(2)+Fetchds();}
|
||||
static PhysPt EA_32_85_n(void) { return SegBase(ss)+reg_ebp+Fetchds(); }
|
||||
static PhysPt EA_32_86_n(void) { return SegBase(ds)+reg_esi+Fetchds(); }
|
||||
static PhysPt EA_32_87_n(void) { return SegBase(ds)+reg_edi+Fetchds(); }
|
||||
|
||||
static GetEATable GetEA_ADDR={
|
||||
/* 00 */
|
||||
EA_32_00_n,EA_32_01_n,EA_32_02_n,EA_32_03_n,EA_32_04_n,EA_32_05_n,EA_32_06_n,EA_32_07_n,
|
||||
EA_32_00_n,EA_32_01_n,EA_32_02_n,EA_32_03_n,EA_32_04_n,EA_32_05_n,EA_32_06_n,EA_32_07_n,
|
||||
EA_32_00_n,EA_32_01_n,EA_32_02_n,EA_32_03_n,EA_32_04_n,EA_32_05_n,EA_32_06_n,EA_32_07_n,
|
||||
EA_32_00_n,EA_32_01_n,EA_32_02_n,EA_32_03_n,EA_32_04_n,EA_32_05_n,EA_32_06_n,EA_32_07_n,
|
||||
EA_32_00_n,EA_32_01_n,EA_32_02_n,EA_32_03_n,EA_32_04_n,EA_32_05_n,EA_32_06_n,EA_32_07_n,
|
||||
EA_32_00_n,EA_32_01_n,EA_32_02_n,EA_32_03_n,EA_32_04_n,EA_32_05_n,EA_32_06_n,EA_32_07_n,
|
||||
EA_32_00_n,EA_32_01_n,EA_32_02_n,EA_32_03_n,EA_32_04_n,EA_32_05_n,EA_32_06_n,EA_32_07_n,
|
||||
EA_32_00_n,EA_32_01_n,EA_32_02_n,EA_32_03_n,EA_32_04_n,EA_32_05_n,EA_32_06_n,EA_32_07_n,
|
||||
/* 01 */
|
||||
EA_32_40_n,EA_32_41_n,EA_32_42_n,EA_32_43_n,EA_32_44_n,EA_32_45_n,EA_32_46_n,EA_32_47_n,
|
||||
EA_32_40_n,EA_32_41_n,EA_32_42_n,EA_32_43_n,EA_32_44_n,EA_32_45_n,EA_32_46_n,EA_32_47_n,
|
||||
EA_32_40_n,EA_32_41_n,EA_32_42_n,EA_32_43_n,EA_32_44_n,EA_32_45_n,EA_32_46_n,EA_32_47_n,
|
||||
EA_32_40_n,EA_32_41_n,EA_32_42_n,EA_32_43_n,EA_32_44_n,EA_32_45_n,EA_32_46_n,EA_32_47_n,
|
||||
EA_32_40_n,EA_32_41_n,EA_32_42_n,EA_32_43_n,EA_32_44_n,EA_32_45_n,EA_32_46_n,EA_32_47_n,
|
||||
EA_32_40_n,EA_32_41_n,EA_32_42_n,EA_32_43_n,EA_32_44_n,EA_32_45_n,EA_32_46_n,EA_32_47_n,
|
||||
EA_32_40_n,EA_32_41_n,EA_32_42_n,EA_32_43_n,EA_32_44_n,EA_32_45_n,EA_32_46_n,EA_32_47_n,
|
||||
EA_32_40_n,EA_32_41_n,EA_32_42_n,EA_32_43_n,EA_32_44_n,EA_32_45_n,EA_32_46_n,EA_32_47_n,
|
||||
/* 10 */
|
||||
EA_32_80_n,EA_32_81_n,EA_32_82_n,EA_32_83_n,EA_32_84_n,EA_32_85_n,EA_32_86_n,EA_32_87_n,
|
||||
EA_32_80_n,EA_32_81_n,EA_32_82_n,EA_32_83_n,EA_32_84_n,EA_32_85_n,EA_32_86_n,EA_32_87_n,
|
||||
EA_32_80_n,EA_32_81_n,EA_32_82_n,EA_32_83_n,EA_32_84_n,EA_32_85_n,EA_32_86_n,EA_32_87_n,
|
||||
EA_32_80_n,EA_32_81_n,EA_32_82_n,EA_32_83_n,EA_32_84_n,EA_32_85_n,EA_32_86_n,EA_32_87_n,
|
||||
EA_32_80_n,EA_32_81_n,EA_32_82_n,EA_32_83_n,EA_32_84_n,EA_32_85_n,EA_32_86_n,EA_32_87_n,
|
||||
EA_32_80_n,EA_32_81_n,EA_32_82_n,EA_32_83_n,EA_32_84_n,EA_32_85_n,EA_32_86_n,EA_32_87_n,
|
||||
EA_32_80_n,EA_32_81_n,EA_32_82_n,EA_32_83_n,EA_32_84_n,EA_32_85_n,EA_32_86_n,EA_32_87_n,
|
||||
EA_32_80_n,EA_32_81_n,EA_32_82_n,EA_32_83_n,EA_32_84_n,EA_32_85_n,EA_32_86_n,EA_32_87_n,
|
||||
/* 11 These are illegal so make em 0 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
INLINE PhysPt Sib_s(Bitu mode) {
|
||||
Bit8u sib=Fetchb();
|
||||
PhysPt base;
|
||||
switch (sib&7) {
|
||||
case 0: /* EAX Base */
|
||||
base=reg_eax;break;
|
||||
case 1: /* ECX Base */
|
||||
base=reg_ecx;break;
|
||||
case 2: /* EDX Base */
|
||||
base=reg_edx;break;
|
||||
case 3: /* EBX Base */
|
||||
base=reg_ebx;break;
|
||||
case 4: /* ESP Base */
|
||||
base=reg_esp;break;
|
||||
case 5: /* #1 Base */
|
||||
if (!mode) {
|
||||
base=Fetchd();break;
|
||||
} else {
|
||||
base=reg_ebp;break;
|
||||
}
|
||||
case 6: /* ESI Base */
|
||||
base=reg_esi;break;
|
||||
case 7: /* EDI Base */
|
||||
base=reg_edi;break;
|
||||
}
|
||||
base+=*SIBIndex[(sib >> 3) &7] << (sib >> 6);
|
||||
return base;
|
||||
};
|
||||
|
||||
|
||||
static PhysPt EA_32_00_s(void) { return core.seg_prefix_base+(Bit32u)(reg_eax); }
|
||||
static PhysPt EA_32_01_s(void) { return core.seg_prefix_base+(Bit32u)(reg_ecx); }
|
||||
static PhysPt EA_32_02_s(void) { return core.seg_prefix_base+(Bit32u)(reg_edx); }
|
||||
static PhysPt EA_32_03_s(void) { return core.seg_prefix_base+(Bit32u)(reg_ebx); }
|
||||
static PhysPt EA_32_04_s(void) { return core.seg_prefix_base+(Bit32u)(Sib_s(0));}
|
||||
static PhysPt EA_32_05_s(void) { return core.seg_prefix_base+(Bit32u)(Fetchd()); }
|
||||
static PhysPt EA_32_06_s(void) { return core.seg_prefix_base+(Bit32u)(reg_esi); }
|
||||
static PhysPt EA_32_07_s(void) { return core.seg_prefix_base+(Bit32u)(reg_edi); }
|
||||
|
||||
static PhysPt EA_32_40_s(void) { return core.seg_prefix_base+(Bit32u)(reg_eax+Fetchbs()); }
|
||||
static PhysPt EA_32_41_s(void) { return core.seg_prefix_base+(Bit32u)(reg_ecx+Fetchbs()); }
|
||||
static PhysPt EA_32_42_s(void) { return core.seg_prefix_base+(Bit32u)(reg_edx+Fetchbs()); }
|
||||
static PhysPt EA_32_43_s(void) { return core.seg_prefix_base+(Bit32u)(reg_ebx+Fetchbs()); }
|
||||
static PhysPt EA_32_44_s(void) { PhysPt temp=Sib_s(1);return core.seg_prefix_base+(Bit32u)(temp+Fetchbs());}
|
||||
static PhysPt EA_32_45_s(void) { return core.seg_prefix_base+(Bit32u)(reg_ebp+Fetchbs()); }
|
||||
static PhysPt EA_32_46_s(void) { return core.seg_prefix_base+(Bit32u)(reg_esi+Fetchbs()); }
|
||||
static PhysPt EA_32_47_s(void) { return core.seg_prefix_base+(Bit32u)(reg_edi+Fetchbs()); }
|
||||
|
||||
static PhysPt EA_32_80_s(void) { return core.seg_prefix_base+(Bit32u)(reg_eax+Fetchds()); }
|
||||
static PhysPt EA_32_81_s(void) { return core.seg_prefix_base+(Bit32u)(reg_ecx+Fetchds()); }
|
||||
static PhysPt EA_32_82_s(void) { return core.seg_prefix_base+(Bit32u)(reg_edx+Fetchds()); }
|
||||
static PhysPt EA_32_83_s(void) { return core.seg_prefix_base+(Bit32u)(reg_ebx+Fetchds()); }
|
||||
static PhysPt EA_32_84_s(void) { PhysPt temp=Sib_s(2);return core.seg_prefix_base+(Bit32u)(temp+Fetchds());}
|
||||
static PhysPt EA_32_85_s(void) { return core.seg_prefix_base+(Bit32u)(reg_ebp+Fetchds()); }
|
||||
static PhysPt EA_32_86_s(void) { return core.seg_prefix_base+(Bit32u)(reg_esi+Fetchds()); }
|
||||
static PhysPt EA_32_87_s(void) { return core.seg_prefix_base+(Bit32u)(reg_edi+Fetchds()); }
|
||||
|
||||
|
||||
static GetEATable GetEA_SEG_ADDR={
|
||||
/* 00 */
|
||||
EA_32_00_s,EA_32_01_s,EA_32_02_s,EA_32_03_s,EA_32_04_s,EA_32_05_s,EA_32_06_s,EA_32_07_s,
|
||||
EA_32_00_s,EA_32_01_s,EA_32_02_s,EA_32_03_s,EA_32_04_s,EA_32_05_s,EA_32_06_s,EA_32_07_s,
|
||||
EA_32_00_s,EA_32_01_s,EA_32_02_s,EA_32_03_s,EA_32_04_s,EA_32_05_s,EA_32_06_s,EA_32_07_s,
|
||||
EA_32_00_s,EA_32_01_s,EA_32_02_s,EA_32_03_s,EA_32_04_s,EA_32_05_s,EA_32_06_s,EA_32_07_s,
|
||||
EA_32_00_s,EA_32_01_s,EA_32_02_s,EA_32_03_s,EA_32_04_s,EA_32_05_s,EA_32_06_s,EA_32_07_s,
|
||||
EA_32_00_s,EA_32_01_s,EA_32_02_s,EA_32_03_s,EA_32_04_s,EA_32_05_s,EA_32_06_s,EA_32_07_s,
|
||||
EA_32_00_s,EA_32_01_s,EA_32_02_s,EA_32_03_s,EA_32_04_s,EA_32_05_s,EA_32_06_s,EA_32_07_s,
|
||||
EA_32_00_s,EA_32_01_s,EA_32_02_s,EA_32_03_s,EA_32_04_s,EA_32_05_s,EA_32_06_s,EA_32_07_s,
|
||||
/* 01 */
|
||||
EA_32_40_s,EA_32_41_s,EA_32_42_s,EA_32_43_s,EA_32_44_s,EA_32_45_s,EA_32_46_s,EA_32_47_s,
|
||||
EA_32_40_s,EA_32_41_s,EA_32_42_s,EA_32_43_s,EA_32_44_s,EA_32_45_s,EA_32_46_s,EA_32_47_s,
|
||||
EA_32_40_s,EA_32_41_s,EA_32_42_s,EA_32_43_s,EA_32_44_s,EA_32_45_s,EA_32_46_s,EA_32_47_s,
|
||||
EA_32_40_s,EA_32_41_s,EA_32_42_s,EA_32_43_s,EA_32_44_s,EA_32_45_s,EA_32_46_s,EA_32_47_s,
|
||||
EA_32_40_s,EA_32_41_s,EA_32_42_s,EA_32_43_s,EA_32_44_s,EA_32_45_s,EA_32_46_s,EA_32_47_s,
|
||||
EA_32_40_s,EA_32_41_s,EA_32_42_s,EA_32_43_s,EA_32_44_s,EA_32_45_s,EA_32_46_s,EA_32_47_s,
|
||||
EA_32_40_s,EA_32_41_s,EA_32_42_s,EA_32_43_s,EA_32_44_s,EA_32_45_s,EA_32_46_s,EA_32_47_s,
|
||||
EA_32_40_s,EA_32_41_s,EA_32_42_s,EA_32_43_s,EA_32_44_s,EA_32_45_s,EA_32_46_s,EA_32_47_s,
|
||||
/* 10 */
|
||||
EA_32_80_s,EA_32_81_s,EA_32_82_s,EA_32_83_s,EA_32_84_s,EA_32_85_s,EA_32_86_s,EA_32_87_s,
|
||||
EA_32_80_s,EA_32_81_s,EA_32_82_s,EA_32_83_s,EA_32_84_s,EA_32_85_s,EA_32_86_s,EA_32_87_s,
|
||||
EA_32_80_s,EA_32_81_s,EA_32_82_s,EA_32_83_s,EA_32_84_s,EA_32_85_s,EA_32_86_s,EA_32_87_s,
|
||||
EA_32_80_s,EA_32_81_s,EA_32_82_s,EA_32_83_s,EA_32_84_s,EA_32_85_s,EA_32_86_s,EA_32_87_s,
|
||||
EA_32_80_s,EA_32_81_s,EA_32_82_s,EA_32_83_s,EA_32_84_s,EA_32_85_s,EA_32_86_s,EA_32_87_s,
|
||||
EA_32_80_s,EA_32_81_s,EA_32_82_s,EA_32_83_s,EA_32_84_s,EA_32_85_s,EA_32_86_s,EA_32_87_s,
|
||||
EA_32_80_s,EA_32_81_s,EA_32_82_s,EA_32_83_s,EA_32_84_s,EA_32_85_s,EA_32_86_s,EA_32_87_s,
|
||||
EA_32_80_s,EA_32_81_s,EA_32_82_s,EA_32_83_s,EA_32_84_s,EA_32_85_s,EA_32_86_s,EA_32_87_s,
|
||||
/* 11 These are illegal so make em 0 */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
#define GetEADirect \
|
||||
PhysPt eaa; \
|
||||
if (TEST_PREFIX_SEG) { \
|
||||
if (TEST_PREFIX_ADDR) { \
|
||||
eaa=core.seg_prefix_base+Fetchd(); \
|
||||
} else { \
|
||||
eaa=core.seg_prefix_base+Fetchw(); \
|
||||
} \
|
||||
} else { \
|
||||
if (TEST_PREFIX_ADDR) { \
|
||||
eaa=SegBase(ds)+Fetchd(); \
|
||||
} else { \
|
||||
eaa=SegBase(ds)+Fetchw(); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
984
src/cpu/cpu.cpp
984
src/cpu/cpu.cpp
File diff suppressed because it is too large
Load Diff
@ -23,13 +23,14 @@
|
||||
|
||||
#include "dosbox.h"
|
||||
#include "cpu.h"
|
||||
#include "lazyflags.h"
|
||||
#include "pic.h"
|
||||
|
||||
|
||||
/* CF Carry Flag -- Set on high-order bit carry or borrow; cleared
|
||||
otherwise.
|
||||
*/
|
||||
bool get_CF(void) {
|
||||
Bitu get_CF(void) {
|
||||
|
||||
switch (flags.type) {
|
||||
case t_UNKNOWN:
|
||||
@ -44,7 +45,7 @@ bool get_CF(void) {
|
||||
case t_RCLb:
|
||||
case t_RCLw:
|
||||
case t_RCLd:
|
||||
return flags.cf;
|
||||
return GETFLAG(CF);
|
||||
break;
|
||||
case t_ADDb:
|
||||
return (flags.result.b<flags.var1.b);
|
||||
@ -134,7 +135,7 @@ bool get_CF(void) {
|
||||
case t_DIV:
|
||||
return false; /* Unkown */
|
||||
default:
|
||||
LOG(LOG_ERROR|LOG_CPU,"get_CF Unknown %d",flags.type);
|
||||
LOG(LOG_CPU,LOG_ERROR)("get_CF Unknown %d",flags.type);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -143,7 +144,7 @@ bool get_CF(void) {
|
||||
four bits of AL; cleared otherwise. Used for decimal
|
||||
arithmetic.
|
||||
*/
|
||||
bool get_AF(void) {
|
||||
Bitu get_AF(void) {
|
||||
Bitu type=flags.type;
|
||||
again:
|
||||
switch (type) {
|
||||
@ -160,7 +161,7 @@ again:
|
||||
case t_RORd:
|
||||
case t_RCLd:
|
||||
case t_RCRd:
|
||||
return flags.af;
|
||||
return GETFLAG(AF);
|
||||
case t_CF:
|
||||
type=flags.prev_type;
|
||||
goto again;
|
||||
@ -229,7 +230,7 @@ again:
|
||||
case t_MUL:
|
||||
return false; /* Unkown */
|
||||
default:
|
||||
LOG(LOG_ERROR|LOG_CPU,"get_AF Unknown %d",flags.type);
|
||||
LOG(LOG_CPU,LOG_ERROR)("get_AF Unknown %d",flags.type);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -237,7 +238,7 @@ again:
|
||||
/* ZF Zero Flag -- Set if result is zero; cleared otherwise.
|
||||
*/
|
||||
|
||||
bool get_ZF(void) {
|
||||
Bitu get_ZF(void) {
|
||||
Bitu type=flags.type;
|
||||
again:
|
||||
switch (type) {
|
||||
@ -254,7 +255,7 @@ again:
|
||||
case t_RORd:
|
||||
case t_RCLd:
|
||||
case t_RCRd:
|
||||
return flags.zf;
|
||||
return GETFLAG(ZF);
|
||||
case t_CF:
|
||||
type=flags.prev_type;
|
||||
goto again;
|
||||
@ -314,14 +315,14 @@ again:
|
||||
case t_MUL:
|
||||
return false; /* Unkown */
|
||||
default:
|
||||
LOG(LOG_ERROR|LOG_CPU,"get_ZF Unknown %d",flags.type);
|
||||
LOG(LOG_CPU,LOG_ERROR)("get_ZF Unknown %d",flags.type);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/* SF Sign Flag -- Set equal to high-order bit of result (0 is
|
||||
positive, 1 if negative).
|
||||
*/
|
||||
bool get_SF(void) {
|
||||
Bitu get_SF(void) {
|
||||
Bitu type=flags.type;
|
||||
again:
|
||||
switch (type) {
|
||||
@ -338,7 +339,7 @@ again:
|
||||
case t_RORd:
|
||||
case t_RCLd:
|
||||
case t_RCRd:
|
||||
return flags.sf;
|
||||
return GETFLAG(SF);
|
||||
case t_CF:
|
||||
type=flags.prev_type;
|
||||
goto again;
|
||||
@ -398,12 +399,12 @@ again:
|
||||
case t_MUL:
|
||||
return false; /* Unkown */
|
||||
default:
|
||||
LOG(LOG_ERROR|LOG_CPU,"get_SF Unkown %d",flags.type);
|
||||
LOG(LOG_CPU,LOG_ERROR)("get_SF Unkown %d",flags.type);
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
bool get_OF(void) {
|
||||
Bitu get_OF(void) {
|
||||
Bit8u var1b7, var2b7, resultb7;
|
||||
Bit16u var1w15, var2w15, resultw15;
|
||||
Bit32u var1d31, var2d31, resultd31;
|
||||
@ -419,7 +420,7 @@ again:
|
||||
case t_SARb:
|
||||
case t_SARw:
|
||||
case t_SARd:
|
||||
return flags.of;
|
||||
return GETFLAG(OF);
|
||||
case t_CF:
|
||||
type=flags.prev_type;
|
||||
goto again;
|
||||
@ -539,12 +540,12 @@ again:
|
||||
case t_DIV:
|
||||
return false; /* Unkown */
|
||||
default:
|
||||
LOG(LOG_ERROR|LOG_CPU,"get_OF Unkown %d",flags.type);
|
||||
LOG(LOG_CPU,LOG_ERROR)("get_OF Unkown %d",flags.type);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool parity_lookup[256] = {
|
||||
bool parity_lookup[256] = {
|
||||
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
|
||||
0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
|
||||
0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
|
||||
@ -563,10 +564,10 @@ static bool parity_lookup[256] = {
|
||||
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1
|
||||
};
|
||||
|
||||
bool get_PF(void) {
|
||||
Bitu get_PF(void) {
|
||||
switch (flags.type) {
|
||||
case t_UNKNOWN:
|
||||
return flags.pf;
|
||||
return GETFLAG(PF);
|
||||
default:
|
||||
return (parity_lookup[flags.result.b]);;
|
||||
};
|
||||
@ -574,3 +575,247 @@ bool get_PF(void) {
|
||||
}
|
||||
|
||||
|
||||
void FillFlags(void) {
|
||||
Bitu new_word=(flags.word & ~FLAG_MASK);
|
||||
if (get_CF()) new_word|=FLAG_CF;
|
||||
if (get_PF()) new_word|=FLAG_PF;
|
||||
if (get_AF()) new_word|=FLAG_AF;
|
||||
if (get_ZF()) new_word|=FLAG_ZF;
|
||||
if (get_SF()) new_word|=FLAG_SF;
|
||||
if (get_OF()) new_word|=FLAG_OF;
|
||||
flags.word=new_word;
|
||||
flags.type=t_UNKNOWN;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
Bitu get_Flags(void) {
|
||||
Bitu new_flags=0;
|
||||
switch (flags.type) {
|
||||
case t_ADDb:
|
||||
SET_FLAG(FLAG_CF,(flags.result.b<flags.var1.b));
|
||||
SET_FLAG(FLAG_AF,(((flags.var1.b ^ flags.var2.b) ^ flags.result.b) & 0x10)>0);
|
||||
break;
|
||||
case t_ADDw:
|
||||
SET_FLAG(FLAG_CF,(flags.result.w<flags.var1.w));
|
||||
SET_FLAG(FLAG_AF,(((flags.var1.w ^ flags.var2.w) ^ flags.result.w) & 0x10)>0);
|
||||
break;
|
||||
case t_ADDd:
|
||||
SET_FLAG(FLAG_CF,(flags.result.d<flags.var1.d));
|
||||
SET_FLAG(FLAG_AF,(((flags.var1.d ^ flags.var2.d) ^ flags.result.d) & 0x10)>0);
|
||||
break;
|
||||
|
||||
|
||||
case t_ADCb:
|
||||
SET_FLAG(FLAG_CF,(flags.result.b < flags.var1.b) || (flags.oldcf && (flags.result.b == flags.var1.b)));
|
||||
SET_FLAG(FLAG_AF,(((flags.var1.b ^ flags.var2.b) ^ flags.result.b) & 0x10)>0);
|
||||
break;
|
||||
case t_ADCw:
|
||||
SET_FLAG(FLAG_CF,(flags.result.w < flags.var1.w) || (flags.oldcf && (flags.result.w == flags.var1.w)));
|
||||
SET_FLAG(FLAG_AF,(((flags.var1.w ^ flags.var2.w) ^ flags.result.w) & 0x10)>0);
|
||||
break;
|
||||
case t_ADCd:
|
||||
SET_FLAG(FLAG_CF,(flags.result.d < flags.var1.d) || (flags.oldcf && (flags.result.d == flags.var1.d)));
|
||||
SET_FLAG(FLAG_AF,(((flags.var1.d ^ flags.var2.d) ^ flags.result.d) & 0x10)>0);
|
||||
break;
|
||||
|
||||
|
||||
case t_SBBb:
|
||||
SET_FLAG(FLAG_CF,(flags.var1.b < flags.result.b) || (flags.oldcf && (flags.var2.b==0xff)));
|
||||
SET_FLAG(FLAG_AF,(((flags.var1.b ^ flags.var2.b) ^ flags.result.b) & 0x10)>0);
|
||||
break;
|
||||
case t_SBBw:
|
||||
SET_FLAG(FLAG_CF,(flags.var1.w < flags.result.w) || (flags.oldcf && (flags.var2.w==0xffff)));
|
||||
SET_FLAG(FLAG_AF,(((flags.var1.w ^ flags.var2.w) ^ flags.result.w) & 0x10)>0);
|
||||
break;
|
||||
case t_SBBd:
|
||||
SET_FLAG(FLAG_CF,(flags.var1.d < flags.result.d) || (flags.oldcf && (flags.var2.d==0xffffffff)));
|
||||
SET_FLAG(FLAG_AF,(((flags.var1.d ^ flags.var2.d) ^ flags.result.d) & 0x10)>0);
|
||||
break;
|
||||
|
||||
|
||||
case t_SUBb:
|
||||
case t_CMPb:
|
||||
SET_FLAG(FLAG_CF,(flags.var1.b<flags.var2.b));
|
||||
SET_FLAG(FLAG_AF,(((flags.var1.b ^ flags.var2.b) ^ flags.result.b) & 0x10)>0);
|
||||
break;
|
||||
case t_SUBw:
|
||||
case t_CMPw:
|
||||
SET_FLAG(FLAG_CF,(flags.var1.w<flags.var2.w));
|
||||
SET_FLAG(FLAG_AF,(((flags.var1.w ^ flags.var2.w) ^ flags.result.w) & 0x10)>0);
|
||||
break;
|
||||
case t_SUBd:
|
||||
case t_CMPd:
|
||||
SET_FLAG(FLAG_CF,(flags.var1.d<flags.var2.d));
|
||||
SET_FLAG(FLAG_AF,(((flags.var1.d ^ flags.var2.d) ^ flags.result.d) & 0x10)>0);
|
||||
break;
|
||||
|
||||
|
||||
case t_ORb:
|
||||
SET_FLAG(FLAG_CF,false);
|
||||
break;
|
||||
case t_ORw:
|
||||
SET_FLAG(FLAG_CF,false);
|
||||
break;
|
||||
case t_ORd:
|
||||
SET_FLAG(FLAG_CF,false);
|
||||
break;
|
||||
|
||||
|
||||
case t_TESTb:
|
||||
case t_ANDb:
|
||||
SET_FLAG(FLAG_CF,false);
|
||||
break;
|
||||
case t_TESTw:
|
||||
case t_ANDw:
|
||||
SET_FLAG(FLAG_CF,false);
|
||||
break;
|
||||
case t_TESTd:
|
||||
case t_ANDd:
|
||||
SET_FLAG(FLAG_CF,false);
|
||||
break;
|
||||
|
||||
|
||||
case t_XORb:
|
||||
SET_FLAG(FLAG_CF,false);
|
||||
break;
|
||||
case t_XORw:
|
||||
SET_FLAG(FLAG_CF,false);
|
||||
break;
|
||||
case t_XORd:
|
||||
SET_FLAG(FLAG_CF,false);
|
||||
break;
|
||||
|
||||
|
||||
case t_SHLb:
|
||||
if (flags.var2.b>8) SET_FLAG(FLAG_CF,false);
|
||||
else SET_FLAG(FLAG_CF,(flags.var1.b >> (8-flags.var2.b)) & 1);
|
||||
break;
|
||||
case t_SHLw:
|
||||
if (flags.var2.b>16) SET_FLAG(FLAG_CF,false);
|
||||
else SET_FLAG(FLAG_CF,(flags.var1.w >> (16-flags.var2.b)) & 1);
|
||||
break;
|
||||
case t_SHLd:
|
||||
SET_FLAG(FLAG_CF,(flags.var1.d >> (32 - flags.var2.b)) & 1);
|
||||
break;
|
||||
|
||||
|
||||
case t_DSHLw: /* Hmm this is not correct for shift higher than 16 */
|
||||
SET_FLAG(FLAG_CF,(flags.var1.d >> (32 - flags.var2.b)) & 1);
|
||||
break;
|
||||
case t_DSHLd:
|
||||
SET_FLAG(FLAG_CF,(flags.var1.d >> (32 - flags.var2.b)) & 1);
|
||||
break;
|
||||
|
||||
|
||||
case t_SHRb:
|
||||
SET_FLAG(FLAG_CF,(flags.var1.b >> (flags.var2.b - 1)) & 1);
|
||||
break;
|
||||
case t_SHRw:
|
||||
SET_FLAG(FLAG_CF,(flags.var1.w >> (flags.var2.b - 1)) & 1);
|
||||
break;
|
||||
case t_SHRd:
|
||||
SET_FLAG(FLAG_CF,(flags.var1.d >> (flags.var2.b - 1)) & 1);
|
||||
break;
|
||||
|
||||
|
||||
case t_DSHRw: /* Hmm this is not correct for shift higher than 16 */
|
||||
SET_FLAG(FLAG_CF,(flags.var1.d >> (flags.var2.b - 1)) & 1);
|
||||
break;
|
||||
case t_DSHRd:
|
||||
SET_FLAG(FLAG_CF,(flags.var1.d >> (flags.var2.b - 1)) & 1);
|
||||
break;
|
||||
|
||||
|
||||
case t_SARb:
|
||||
SET_FLAG(FLAG_CF,(((Bit8s) flags.var1.b) >> (flags.var2.b - 1)) & 1);
|
||||
break;
|
||||
case t_SARw:
|
||||
SET_FLAG(FLAG_CF,(((Bit16s) flags.var1.w) >> (flags.var2.b - 1)) & 1);
|
||||
break;
|
||||
case t_SARd:
|
||||
SET_FLAG(FLAG_CF,(((Bit32s) flags.var1.d) >> (flags.var2.b - 1)) & 1);
|
||||
break;
|
||||
|
||||
|
||||
case t_ROLb:
|
||||
SET_FLAG(FLAG_CF,flags.result.b & 1);
|
||||
break;
|
||||
case t_ROLw:
|
||||
SET_FLAG(FLAG_CF,flags.result.w & 1);
|
||||
break;
|
||||
case t_ROLd:
|
||||
SET_FLAG(FLAG_CF,flags.result.d & 1);
|
||||
break;
|
||||
|
||||
|
||||
case t_RORb:
|
||||
SET_FLAG(FLAG_CF,(flags.result.b & 0x80)>0);
|
||||
break;
|
||||
case t_RORw:
|
||||
SET_FLAG(FLAG_CF,(flags.result.w & 0x8000)>0);
|
||||
break;
|
||||
case t_RORd:
|
||||
SET_FLAG(FLAG_CF,(flags.result.d & 0x80000000)>0);
|
||||
break;
|
||||
|
||||
|
||||
case t_RCRb:
|
||||
SET_FLAG(FLAG_CF,(flags.var1.b >> (flags.var2.b - 1)) & 1);
|
||||
break;
|
||||
case t_RCRw:
|
||||
SET_FLAG(FLAG_CF,(flags.var1.w >> (flags.var2.b - 1)) & 1);
|
||||
break;
|
||||
case t_RCRd:
|
||||
SET_FLAG(FLAG_CF,(flags.var1.d >> (flags.var2.b - 1)) & 1);
|
||||
break;
|
||||
|
||||
|
||||
case t_INCb:
|
||||
SET_FLAG(FLAG_OF,(flags.result.b == 0x80));
|
||||
SET_FLAG(FLAG_AF,((flags.result.b & 0x0f) == 0));
|
||||
break;
|
||||
case t_INCw:
|
||||
SET_FLAG(FLAG_OF,(flags.result.w == 0x8000));
|
||||
SET_FLAG(FLAG_AF,((flags.result.w & 0x0f) == 0));
|
||||
break;
|
||||
case t_INCd:
|
||||
SET_FLAG(FLAG_OF,(flags.result.d == 0x80000000));
|
||||
SET_FLAG(FLAG_AF,((flags.result.d & 0x0f) == 0));
|
||||
break;
|
||||
|
||||
|
||||
case t_DECb:
|
||||
SET_FLAG(FLAG_OF,(flags.result.b == 0x7f));
|
||||
break;
|
||||
case t_DECw:
|
||||
SET_FLAG(FLAG_OF,(flags.result.w == 0x7fff));
|
||||
break;
|
||||
case t_DECd:
|
||||
SET_FLAG(FLAG_OF,(flags.result.d == 0x7fffffff));
|
||||
break;
|
||||
|
||||
|
||||
case t_NEGb:
|
||||
SET_FLAG(FLAG_CF,(flags.var1.b!=0));
|
||||
break;
|
||||
case t_NEGw:
|
||||
SET_FLAG(FLAG_CF,(flags.var1.w!=0));
|
||||
break;
|
||||
case t_NEGd:
|
||||
SET_FLAG(FLAG_CF,(flags.var1.d!=0));
|
||||
break;
|
||||
|
||||
|
||||
case t_DIV:
|
||||
SET_FLAG(FLAG_CF,false); /* Unkown */
|
||||
break;
|
||||
default:
|
||||
LOG(LOG_CPU,LOG_ERROR)("Unhandled flag type %d",flags.type);
|
||||
return 0;
|
||||
}
|
||||
flags.word=new_flags;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -18,41 +18,6 @@
|
||||
|
||||
/* Jumps */
|
||||
|
||||
/*
|
||||
Could perhaps do some things with 8 and 16 bit operations like shifts, doing them in 32 bit regs
|
||||
*/
|
||||
|
||||
#define JumpSIb(blah) \
|
||||
if (blah) { \
|
||||
ADDIPFAST(Fetchbs()); \
|
||||
} else { \
|
||||
ADDIPFAST(1); \
|
||||
}
|
||||
|
||||
#define JumpSIw(blah) \
|
||||
if (blah) { \
|
||||
ADDIPFAST(Fetchws()); \
|
||||
} else { \
|
||||
ADDIPFAST(2); \
|
||||
}
|
||||
|
||||
#define SETcc(cc) \
|
||||
{ \
|
||||
GetRM; \
|
||||
if (rm >= 0xc0 ) {GetEArb;*earb=(cc) ? 1 : 0;} \
|
||||
else {GetEAa;SaveMb(eaa,(cc) ? 1 : 0);} \
|
||||
}
|
||||
|
||||
#define INTERRUPT(blah) \
|
||||
{ \
|
||||
Bit8u new_num=blah; \
|
||||
SAVEIP; \
|
||||
Interrupt(new_num); \
|
||||
LOADIP; \
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* All Byte genereal instructions */
|
||||
#define ADDB(op1,op2,load,save) \
|
||||
flags.var1.b=load(op1);flags.var2.b=op2; \
|
||||
@ -254,227 +219,209 @@
|
||||
save(op1,flags.result.d); \
|
||||
flags.type=t_DECd;
|
||||
|
||||
#define NOTDONE \
|
||||
SUBIP(1);E_Exit("CPU:Opcode %2X Unhandled",Fetchb());
|
||||
|
||||
#define NOTDONE66 \
|
||||
SUBIP(1);E_Exit("CPU:Opcode 66:%2X Unhandled",Fetchb());
|
||||
|
||||
|
||||
//TODO Maybe make this into a bigger split up because of the rm >=0xc0 this seems make it a bit slower
|
||||
//TODO set Zero and Sign flag in one run
|
||||
#define ROLB(op1,op2,load,save) \
|
||||
if (!op2) break; \
|
||||
flags.zf=get_ZF();flags.sf=get_SF();flags.af=get_AF(); \
|
||||
flags.var2.b=op2&0x07;flags.var1.b=load(op1); \
|
||||
if (!flags.var2.b) { \
|
||||
flags.result.b=flags.var1.b; \
|
||||
} else { \
|
||||
LoadZF;LoadSF;LoadAF; \
|
||||
flags.var1.b=load(op1); \
|
||||
flags.var2.b=op2&0x07; \
|
||||
flags.result.b=(flags.var1.b << flags.var2.b) | \
|
||||
(flags.var1.b >> (8-flags.var2.b)); \
|
||||
} \
|
||||
save(op1,flags.result.b); \
|
||||
flags.type=t_ROLb;
|
||||
save(op1,flags.result.b); \
|
||||
flags.type=t_ROLb; \
|
||||
|
||||
|
||||
#define ROLW(op1,op2,load,save) \
|
||||
if (!op2) break; \
|
||||
flags.zf=get_ZF();flags.sf=get_SF();flags.af=get_AF(); \
|
||||
flags.var2.b=op2&0x0F;flags.var1.w=load(op1); \
|
||||
if (!flags.var2.b) { \
|
||||
flags.result.w=flags.var1.w; \
|
||||
} else { \
|
||||
LoadZF;LoadSF;LoadAF; \
|
||||
flags.var1.w=load(op1); \
|
||||
flags.var2.b=op2&0x0F; \
|
||||
flags.result.w=(flags.var1.w << flags.var2.b) | \
|
||||
(flags.var1.w >> (16-flags.var2.b)); \
|
||||
} \
|
||||
save(op1,flags.result.w); \
|
||||
flags.type=t_ROLw;
|
||||
save(op1,flags.result.w); \
|
||||
flags.type=t_ROLw; \
|
||||
|
||||
|
||||
#define ROLD(op1,op2,load,save) \
|
||||
if (!op2) break; \
|
||||
flags.zf=get_ZF();flags.sf=get_SF();flags.af=get_AF(); \
|
||||
flags.var2.b=op2;flags.var1.d=load(op1); \
|
||||
flags.result.d=(flags.var1.d << flags.var2.b) | \
|
||||
LoadZF;LoadSF;LoadAF; \
|
||||
flags.var1.d=load(op1); \
|
||||
flags.var2.b=op2; \
|
||||
flags.result.d=(flags.var1.d << flags.var2.b) | \
|
||||
(flags.var1.d >> (32-flags.var2.b)); \
|
||||
save(op1,flags.result.d); \
|
||||
flags.type=t_ROLd;
|
||||
save(op1,flags.result.d); \
|
||||
flags.type=t_ROLd; \
|
||||
|
||||
|
||||
#define RORB(op1,op2,load,save) \
|
||||
if (!op2) break; \
|
||||
flags.zf=get_ZF();flags.sf=get_SF();flags.af=get_AF(); \
|
||||
flags.var2.b=op2&0x07;flags.var1.b=load(op1); \
|
||||
if (!flags.var2.b) { \
|
||||
flags.result.b=flags.var1.b; \
|
||||
} else { \
|
||||
LoadZF;LoadSF;LoadAF; \
|
||||
flags.var1.b=load(op1); \
|
||||
flags.var2.b=op2&0x07; \
|
||||
flags.result.b=(flags.var1.b >> flags.var2.b) | \
|
||||
(flags.var1.b << (8-flags.var2.b)); \
|
||||
} \
|
||||
save(op1,flags.result.b); \
|
||||
flags.type=t_RORb;
|
||||
save(op1,flags.result.b); \
|
||||
flags.type=t_RORb; \
|
||||
|
||||
|
||||
#define RORW(op1,op2,load,save) \
|
||||
if (!op2) break; \
|
||||
flags.zf=get_ZF();flags.sf=get_SF();flags.af=get_AF(); \
|
||||
flags.var2.b=op2&0x0F;flags.var1.w=load(op1); \
|
||||
if (!flags.var2.b) { \
|
||||
flags.result.w=flags.var1.w; \
|
||||
} else { \
|
||||
if (op2&0x0F) { \
|
||||
LoadZF;LoadSF;LoadAF; \
|
||||
flags.var1.w=load(op1); \
|
||||
flags.var2.b=op2&0x0F; \
|
||||
flags.result.w=(flags.var1.w >> flags.var2.b) | \
|
||||
(flags.var1.w << (16-flags.var2.b)); \
|
||||
} \
|
||||
save(op1,flags.result.w); \
|
||||
flags.type=t_RORw;
|
||||
save(op1,flags.result.w); \
|
||||
flags.type=t_RORw; \
|
||||
}
|
||||
|
||||
#define RORD(op1,op2,load,save) \
|
||||
if (!op2) break; \
|
||||
flags.zf=get_ZF();flags.sf=get_SF();flags.af=get_AF(); \
|
||||
flags.var2.b=op2;flags.var1.d=load(op1); \
|
||||
flags.result.d=(flags.var1.d >> flags.var2.b) | \
|
||||
if (op2) { \
|
||||
LoadZF;LoadSF;LoadAF; \
|
||||
flags.var1.d=load(op1); \
|
||||
flags.var2.b=op2; \
|
||||
flags.result.d=(flags.var1.d >> flags.var2.b) | \
|
||||
(flags.var1.d << (32-flags.var2.b)); \
|
||||
save(op1,flags.result.d); \
|
||||
flags.type=t_RORd;
|
||||
save(op1,flags.result.d); \
|
||||
flags.type=t_RORd; \
|
||||
}
|
||||
|
||||
|
||||
/* flags.oldcf=get_CF();*/ \
|
||||
|
||||
#define RCLB(op1,op2,load,save) \
|
||||
if (!op2) break; \
|
||||
flags.zf=get_ZF();flags.sf=get_SF();flags.af=get_AF(); \
|
||||
flags.cf=get_CF();flags.type=t_RCLb; \
|
||||
flags.var2.b=op2%9;flags.var1.b=load(op1); \
|
||||
if (!flags.var2.b) { \
|
||||
flags.result.b=flags.var1.b; \
|
||||
} else { \
|
||||
if (op2%9) { \
|
||||
LoadZF;LoadSF;LoadAF; \
|
||||
Bit8u cf=get_CF(); \
|
||||
flags.var1.b=load(op1); \
|
||||
flags.var2.b=op2%9; \
|
||||
flags.type=t_RCLb; \
|
||||
flags.result.b=(flags.var1.b << flags.var2.b) | \
|
||||
(flags.cf << (flags.var2.b-1)) | \
|
||||
(cf << (flags.var2.b-1)) | \
|
||||
(flags.var1.b >> (9-flags.var2.b)); \
|
||||
flags.cf=((flags.var1.b >> (8-flags.var2.b)) & 1); \
|
||||
} \
|
||||
flags.of=((flags.result.b & 0x80) ^ (flags.cf ? 0x80 : 0)) != 0; \
|
||||
save(op1,flags.result.b);
|
||||
SETFLAGBIT(CF,((flags.var1.b >> (8-flags.var2.b)) & 1)); \
|
||||
SETFLAGBIT(OF,(flags.var1.b ^ flags.result.b) & 0x80); \
|
||||
save(op1,flags.result.b); \
|
||||
}
|
||||
|
||||
#define RCLW(op1,op2,load,save) \
|
||||
if (!op2) break; \
|
||||
flags.zf=get_ZF();flags.sf=get_SF();flags.af=get_AF(); \
|
||||
flags.cf=get_CF();flags.type=t_RCLw; \
|
||||
flags.var2.b=op2%17;flags.var1.w=load(op1); \
|
||||
if (!flags.var2.b) { \
|
||||
flags.result.w=flags.var1.w; \
|
||||
} else { \
|
||||
if (op2%17) { \
|
||||
LoadZF;LoadSF;LoadAF; \
|
||||
Bit16u cf=get_CF(); \
|
||||
flags.var1.w=load(op1); \
|
||||
flags.var2.b=op2%17; \
|
||||
flags.type=t_RCLw; \
|
||||
flags.result.w=(flags.var1.w << flags.var2.b) | \
|
||||
(flags.cf << (flags.var2.b-1)) | \
|
||||
(cf << (flags.var2.b-1)) | \
|
||||
(flags.var1.w >> (17-flags.var2.b)); \
|
||||
flags.cf=((flags.var1.w >> (16-flags.var2.b)) & 1); \
|
||||
} \
|
||||
flags.of=((flags.result.w & 0x8000) ^ (flags.cf ? 0x8000 : 0)) != 0; \
|
||||
save(op1,flags.result.w);
|
||||
SETFLAGBIT(CF,((flags.var1.w >> (16-flags.var2.b)) & 1)); \
|
||||
SETFLAGBIT(OF,(flags.var1.w ^ flags.result.w) & 0x8000); \
|
||||
save(op1,flags.result.w); \
|
||||
}
|
||||
|
||||
#define RCLD(op1,op2,load,save) \
|
||||
if (!op2) break; \
|
||||
flags.zf=get_ZF();flags.sf=get_SF();flags.af=get_AF(); \
|
||||
flags.cf=get_CF();flags.type=t_RCLd; \
|
||||
flags.var2.b=op2;flags.var1.d=load(op1); \
|
||||
if (flags.var2.b==1) { \
|
||||
flags.result.d=(flags.var1.d << 1) | flags.cf; \
|
||||
} else { \
|
||||
flags.result.d=(flags.var1.d << flags.var2.b) | \
|
||||
(flags.cf << (flags.var2.b-1)) | \
|
||||
(flags.var1.d >> (33-flags.var2.b)); \
|
||||
} \
|
||||
flags.cf=((flags.var1.d >> (32-flags.var2.b)) & 1); \
|
||||
flags.of=((flags.result.d & 0x80000000) ^ (flags.cf ? 0x80000000 : 0)) != 0; \
|
||||
save(op1,flags.result.d);
|
||||
if (op2) { \
|
||||
LoadZF;LoadSF;LoadAF; \
|
||||
Bit32u cf=get_CF(); \
|
||||
flags.var1.d=load(op1); \
|
||||
flags.var2.b=op2; \
|
||||
flags.type=t_RCLd; \
|
||||
if (flags.var2.b==1) { \
|
||||
flags.result.d=(flags.var1.d << 1) | cf; \
|
||||
} else { \
|
||||
flags.result.d=(flags.var1.d << flags.var2.b) | \
|
||||
(cf << (flags.var2.b-1)) | \
|
||||
(flags.var1.d >> (33-flags.var2.b)); \
|
||||
} \
|
||||
SETFLAGBIT(CF,((flags.var1.d >> (32-flags.var2.b)) & 1)); \
|
||||
SETFLAGBIT(OF,(flags.var1.d ^ flags.result.d) & 0x80000000); \
|
||||
save(op1,flags.result.d); \
|
||||
}
|
||||
|
||||
#define RCRB(op1,op2,load,save) \
|
||||
if (!op2) break; \
|
||||
flags.zf=get_ZF();flags.sf=get_SF();flags.af=get_AF(); \
|
||||
flags.cf=get_CF();flags.type=t_RCRb; \
|
||||
flags.var2.b=op2%9;flags.var1.b=load(op1); \
|
||||
if (!flags.var2.b) { \
|
||||
flags.result.b=flags.var1.b; \
|
||||
} else { \
|
||||
if (op2%9) { \
|
||||
LoadZF;LoadSF;LoadAF; \
|
||||
Bit8u cf=get_CF(); \
|
||||
flags.var1.b=load(op1); \
|
||||
flags.var2.b=op2%9; \
|
||||
flags.type=t_RCRb; \
|
||||
flags.result.b=(flags.var1.b >> flags.var2.b) | \
|
||||
(flags.cf << (8-flags.var2.b)) | \
|
||||
(cf << (8-flags.var2.b)) | \
|
||||
(flags.var1.b << (9-flags.var2.b)); \
|
||||
} \
|
||||
save(op1,flags.result.b);
|
||||
save(op1,flags.result.b); \
|
||||
}
|
||||
|
||||
#define RCRW(op1,op2,load,save) \
|
||||
if (!op2) break; \
|
||||
flags.zf=get_ZF();flags.sf=get_SF();flags.af=get_AF(); \
|
||||
flags.cf=get_CF();flags.type=t_RCRw; \
|
||||
flags.var2.b=op2%17;flags.var1.w=load(op1); \
|
||||
if (!flags.var2.b) { \
|
||||
flags.result.w=flags.var1.w; \
|
||||
} else { \
|
||||
if (op2%17) { \
|
||||
LoadZF;LoadSF;LoadAF; \
|
||||
Bit16u cf=get_CF(); \
|
||||
flags.var1.w=load(op1); \
|
||||
flags.var2.b=op2%17; \
|
||||
flags.type=t_RCRw; \
|
||||
flags.result.w=(flags.var1.w >> flags.var2.b) | \
|
||||
(flags.cf << (16-flags.var2.b)) | \
|
||||
(cf << (16-flags.var2.b)) | \
|
||||
(flags.var1.w << (17-flags.var2.b)); \
|
||||
} \
|
||||
save(op1,flags.result.w);
|
||||
save(op1,flags.result.w); \
|
||||
}
|
||||
|
||||
#define RCRD(op1,op2,load,save) \
|
||||
if (!op2) break; \
|
||||
flags.zf=get_ZF();flags.sf=get_SF();flags.af=get_AF(); \
|
||||
flags.cf=get_CF();flags.type=t_RCRd; \
|
||||
flags.var2.b=op2;flags.var1.d=load(op1); \
|
||||
if (flags.var2.b==1) { \
|
||||
flags.result.d=flags.var1.d >> 1 | flags.cf << 31; \
|
||||
} else { \
|
||||
flags.result.d=(flags.var1.d >> flags.var2.b) | \
|
||||
(flags.cf << (32-flags.var2.b)) | \
|
||||
if (op2) { \
|
||||
LoadZF;LoadSF;LoadAF; \
|
||||
Bit32u cf=get_CF(); \
|
||||
flags.var1.d=load(op1); \
|
||||
flags.var2.b=op2; \
|
||||
flags.type=t_RCRd; \
|
||||
if (flags.var2.b==1) { \
|
||||
flags.result.d=flags.var1.d >> 1 | cf << 31; \
|
||||
} else { \
|
||||
flags.result.d=(flags.var1.d >> flags.var2.b) | \
|
||||
(cf << (32-flags.var2.b)) | \
|
||||
(flags.var1.d << (33-flags.var2.b)); \
|
||||
} \
|
||||
save(op1,flags.result.d);
|
||||
} \
|
||||
save(op1,flags.result.d); \
|
||||
}
|
||||
|
||||
|
||||
#define SHLB(op1,op2,load,save) \
|
||||
if (!op2) break; \
|
||||
flags.var1.b=load(op1);flags.var2.b=op2; \
|
||||
if (!op2) break; \
|
||||
flags.var1.b=load(op1);flags.var2.b=op2; \
|
||||
flags.result.b=flags.var1.b << flags.var2.b; \
|
||||
save(op1,flags.result.b); \
|
||||
flags.type=t_SHLb;
|
||||
|
||||
#define SHLW(op1,op2,load,save) \
|
||||
if (!op2) break; \
|
||||
flags.var1.w=load(op1);flags.var2.b=op2 ; \
|
||||
if (!op2) break; \
|
||||
flags.var1.w=load(op1);flags.var2.b=op2 ; \
|
||||
flags.result.w=flags.var1.w << flags.var2.b; \
|
||||
save(op1,flags.result.w); \
|
||||
flags.type=t_SHLw;
|
||||
|
||||
#define SHLD(op1,op2,load,save) \
|
||||
if (!op2) break; \
|
||||
flags.var1.d=load(op1);flags.var2.b=op2; \
|
||||
if (!op2) break; \
|
||||
flags.var1.d=load(op1);flags.var2.b=op2; \
|
||||
flags.result.d=flags.var1.d << flags.var2.b; \
|
||||
save(op1,flags.result.d); \
|
||||
flags.type=t_SHLd;
|
||||
|
||||
|
||||
#define SHRB(op1,op2,load,save) \
|
||||
if (!op2) break; \
|
||||
flags.var1.b=load(op1);flags.var2.b=op2; \
|
||||
if (!op2) break; \
|
||||
flags.var1.b=load(op1);flags.var2.b=op2; \
|
||||
flags.result.b=flags.var1.b >> flags.var2.b; \
|
||||
save(op1,flags.result.b); \
|
||||
flags.type=t_SHRb;
|
||||
|
||||
#define SHRW(op1,op2,load,save) \
|
||||
if (!op2) break; \
|
||||
flags.var1.w=load(op1);flags.var2.b=op2; \
|
||||
if (!op2) break; \
|
||||
flags.var1.w=load(op1);flags.var2.b=op2; \
|
||||
flags.result.w=flags.var1.w >> flags.var2.b; \
|
||||
save(op1,flags.result.w); \
|
||||
flags.type=t_SHRw;
|
||||
|
||||
#define SHRD(op1,op2,load,save) \
|
||||
if (!op2) break; \
|
||||
flags.var1.d=load(op1);flags.var2.b=op2; \
|
||||
if (!op2) break; \
|
||||
flags.var1.d=load(op1);flags.var2.b=op2; \
|
||||
flags.result.d=flags.var1.d >> flags.var2.b; \
|
||||
save(op1,flags.result.d); \
|
||||
flags.type=t_SHRd;
|
||||
|
||||
|
||||
#define SARB(op1,op2,load,save) \
|
||||
if (!op2) break; \
|
||||
flags.var1.b=load(op1);flags.var2.b=op2; \
|
||||
if (!op2) break; \
|
||||
flags.var1.b=load(op1);flags.var2.b=op2; \
|
||||
if (flags.var2.b>8) flags.var2.b=8; \
|
||||
if (flags.var1.b & 0x80) { \
|
||||
flags.result.b=(flags.var1.b >> flags.var2.b)| \
|
||||
@ -512,34 +459,298 @@
|
||||
|
||||
|
||||
|
||||
#define DAA() \
|
||||
if (((reg_al & 0x0F)>0x09) || get_AF()) { \
|
||||
reg_al+=0x06; \
|
||||
SETFLAGBIT(AF,true); \
|
||||
} else { \
|
||||
SETFLAGBIT(AF,false); \
|
||||
} \
|
||||
if ((reg_al > 0x9F) || get_CF()) { \
|
||||
reg_al+=0x60; \
|
||||
SETFLAGBIT(CF,true); \
|
||||
} else { \
|
||||
SETFLAGBIT(CF,false); \
|
||||
} \
|
||||
SETFLAGBIT(SF,(reg_al&0x80)); \
|
||||
SETFLAGBIT(ZF,(reg_al==0)); \
|
||||
flags.type=t_UNKNOWN;
|
||||
|
||||
|
||||
#define DAS() \
|
||||
if (((reg_al & 0x0f) > 9) || get_AF()) { \
|
||||
reg_al-=6; \
|
||||
SETFLAGBIT(AF,true); \
|
||||
} else { \
|
||||
SETFLAGBIT(AF,false); \
|
||||
} \
|
||||
if ((reg_al>0x9f) || get_CF()) { \
|
||||
reg_al-=0x60; \
|
||||
SETFLAGBIT(CF,true); \
|
||||
} else { \
|
||||
SETFLAGBIT(CF,false); \
|
||||
} \
|
||||
flags.type=t_UNKNOWN;
|
||||
|
||||
|
||||
#define AAA() \
|
||||
if (get_AF() || ((reg_al & 0xf) > 9)) \
|
||||
{ \
|
||||
reg_al += 6; \
|
||||
reg_ah += 1; \
|
||||
SETFLAGBIT(AF,true); \
|
||||
SETFLAGBIT(CF,true); \
|
||||
} else { \
|
||||
SETFLAGBIT(AF,false); \
|
||||
SETFLAGBIT(CF,false); \
|
||||
} \
|
||||
reg_al &= 0x0F; \
|
||||
flags.type=t_UNKNOWN;
|
||||
|
||||
#define AAS() \
|
||||
if (((reg_al & 0x0f)>9) || get_AF()) { \
|
||||
reg_ah--; \
|
||||
if (reg_al < 6) reg_ah--; \
|
||||
reg_al=(reg_al-6) & 0xF; \
|
||||
SETFLAGBIT(AF,true); \
|
||||
SETFLAGBIT(CF,true); \
|
||||
} else { \
|
||||
SETFLAGBIT(AF,false); \
|
||||
SETFLAGBIT(CF,false); \
|
||||
} \
|
||||
reg_al &= 0x0F; \
|
||||
flags.type=t_UNKNOWN;
|
||||
|
||||
#define AAM(op1) \
|
||||
{ \
|
||||
Bit8u BLAH=op1; \
|
||||
reg_ah=reg_al / BLAH; \
|
||||
reg_al=reg_al % BLAH; \
|
||||
flags.type=t_UNKNOWN; \
|
||||
SETFLAGBIT(SF,(reg_al & 0x80)); \
|
||||
SETFLAGBIT(ZF,(reg_al == 0)); \
|
||||
SETFLAGBIT(PF,parity_lookup[reg_al]); \
|
||||
}
|
||||
|
||||
|
||||
//Took this from bochs, i seriously hate these weird bcd opcodes
|
||||
#define AAD(op1) \
|
||||
{ \
|
||||
Bit16u ax1 = reg_ah * op1; \
|
||||
Bit16u ax2 = ax1 + reg_al; \
|
||||
Bit8u old_al = reg_al; \
|
||||
reg_al = (Bit8u) ax2; \
|
||||
reg_ah = 0; \
|
||||
SETFLAGBIT(AF,(ax1 & 0x08) != (ax2 & 0x08)); \
|
||||
SETFLAGBIT(CF,ax2 > 0xff); \
|
||||
SETFLAGBIT(OF,(reg_al & 0x80) != (old_al & 0x80)); \
|
||||
SETFLAGBIT(SF,reg_al >= 0x80); \
|
||||
SETFLAGBIT(ZF,reg_al == 0); \
|
||||
SETFLAGBIT(PF,parity_lookup[reg_al]); \
|
||||
flags.type=t_UNKNOWN; \
|
||||
}
|
||||
|
||||
#define MULB(op1,load,save) \
|
||||
flags.type=t_MUL; \
|
||||
reg_ax=reg_al*load(op1); \
|
||||
if (reg_ax & 0xff00) { \
|
||||
SETFLAGBIT(CF,true);SETFLAGBIT(OF,true); \
|
||||
} else { \
|
||||
SETFLAGBIT(CF,false);SETFLAGBIT(OF,false); \
|
||||
}
|
||||
|
||||
#define MULW(op1,load,save) \
|
||||
{ \
|
||||
Bitu tempu=(Bitu)reg_ax*(Bitu)(load(op1)); \
|
||||
reg_ax=(Bit16u)(tempu); \
|
||||
reg_dx=(Bit16u)(tempu >> 16); \
|
||||
flags.type=t_MUL; \
|
||||
if (reg_dx) { \
|
||||
SETFLAGBIT(CF,true);SETFLAGBIT(OF,true); \
|
||||
} else { \
|
||||
SETFLAGBIT(CF,false);SETFLAGBIT(OF,false); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define MULD(op1,load,save) \
|
||||
{ \
|
||||
Bit64u tempu=(Bit64u)reg_eax*(Bit64u)(load(op1)); \
|
||||
reg_eax=(Bit32u)(tempu); \
|
||||
reg_edx=(Bit32u)(tempu >> 32); \
|
||||
flags.type=t_MUL; \
|
||||
if (reg_edx) { \
|
||||
SETFLAGBIT(CF,true);SETFLAGBIT(OF,true); \
|
||||
} else { \
|
||||
SETFLAGBIT(CF,false);SETFLAGBIT(OF,false); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define DIVB(op1,load,save) \
|
||||
{ \
|
||||
Bitu val=load(op1); \
|
||||
if (val==0) EXCEPTION(0); \
|
||||
Bitu quo=reg_ax / val; \
|
||||
reg_ah=(Bit8u)(reg_ax % val); \
|
||||
reg_al=(Bit8u)quo; \
|
||||
if (quo>0xff) EXCEPTION(0); \
|
||||
}
|
||||
|
||||
|
||||
#define DIVW(op1,load,save) \
|
||||
{ \
|
||||
Bitu val=load(op1); \
|
||||
if (val==0) EXCEPTION(0); \
|
||||
Bitu num=(reg_dx<<16)|reg_ax; \
|
||||
Bitu quo=num/val; \
|
||||
reg_dx=(Bit16u)(num % val); \
|
||||
reg_ax=(Bit16u)quo; \
|
||||
if (quo>0xffff) EXCEPTION(0); \
|
||||
}
|
||||
|
||||
#define DIVD(op1,load,save) \
|
||||
{ \
|
||||
Bitu val=load(op1); \
|
||||
if (!val) EXCEPTION(0); \
|
||||
Bit64u num=(((Bit64u)reg_edx)<<32)|reg_eax; \
|
||||
Bit64u quo=num/val; \
|
||||
reg_edx=(Bit32u)(num % val); \
|
||||
reg_eax=(Bit32u)quo; \
|
||||
if (quo!=(Bit64u)reg_eax) EXCEPTION(0); \
|
||||
}
|
||||
|
||||
|
||||
#define IDIVB(op1,load,save) \
|
||||
{ \
|
||||
Bits val=(Bit8s)(load(op1)); \
|
||||
if (val==0) EXCEPTION(0); \
|
||||
Bits quo=((Bit16s)reg_ax) / val; \
|
||||
reg_ah=(Bit8s)(((Bit16s)reg_ax) % val); \
|
||||
reg_al=(Bit8s)quo; \
|
||||
if (quo!=(Bit8s)reg_al) EXCEPTION(0); \
|
||||
}
|
||||
|
||||
|
||||
#define IDIVW(op1,load,save) \
|
||||
{ \
|
||||
Bits val=(Bit16s)(load(op1)); \
|
||||
if (!val) EXCEPTION(0); \
|
||||
Bits num=(Bit32s)((reg_dx<<16)|reg_ax); \
|
||||
Bits quo=num/val; \
|
||||
reg_dx=(Bit16u)(num % val); \
|
||||
reg_ax=(Bit16s)quo; \
|
||||
if (quo!=(Bit16s)reg_ax) EXCEPTION(0); \
|
||||
}
|
||||
|
||||
#define IDIVD(op1,load,save) \
|
||||
{ \
|
||||
Bits val=(Bit32s)(load(op1)); \
|
||||
if (!val) EXCEPTION(0); \
|
||||
Bit64s num=(((Bit64u)reg_edx)<<32)|reg_eax; \
|
||||
Bit64s quo=num/val; \
|
||||
reg_edx=(Bit32s)(num % val); \
|
||||
reg_eax=(Bit32s)(quo); \
|
||||
if (quo!=(Bit64s)((Bit32s)reg_eax)) EXCEPTION(0); \
|
||||
}
|
||||
|
||||
#define IMULB(op1,load,save) \
|
||||
{ \
|
||||
flags.type=t_MUL; \
|
||||
reg_ax=((Bit8s)reg_al) * ((Bit8s)(load(op1))); \
|
||||
if ((reg_ax & 0xff80)==0xff80 || \
|
||||
(reg_ax & 0xff80)==0x0000) { \
|
||||
SETFLAGBIT(CF,false);SETFLAGBIT(OF,false); \
|
||||
} else { \
|
||||
SETFLAGBIT(CF,true);SETFLAGBIT(OF,true); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
#define IMULW(op1,load,save) \
|
||||
{ \
|
||||
Bits temps=((Bit16s)reg_ax)*((Bit16s)(load(op1))); \
|
||||
reg_ax=(Bit16s)(temps); \
|
||||
reg_dx=(Bit16s)(temps >> 16); \
|
||||
flags.type=t_MUL; \
|
||||
if (((temps & 0xffff8000)==0xffff8000 || \
|
||||
(temps & 0xffff8000)==0x0000)) { \
|
||||
SETFLAGBIT(CF,false);SETFLAGBIT(OF,false); \
|
||||
} else { \
|
||||
SETFLAGBIT(CF,true);SETFLAGBIT(OF,true); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define IMULD(op1,load,save) \
|
||||
{ \
|
||||
Bit64s temps=((Bit64s)((Bit32s)reg_eax))* \
|
||||
((Bit64s)((Bit32s)(load(op1)))); \
|
||||
reg_eax=(Bit32u)(temps); \
|
||||
reg_edx=(Bit32u)(temps >> 32); \
|
||||
flags.type=t_MUL; \
|
||||
if ((reg_edx==0xffffffff) && \
|
||||
(reg_eax & 0x80000000) ) { \
|
||||
SETFLAGBIT(CF,false);SETFLAGBIT(OF,false); \
|
||||
} else if ( (reg_edx==0x00000000) && \
|
||||
(reg_eax< 0x80000000) ) { \
|
||||
SETFLAGBIT(CF,false);SETFLAGBIT(OF,false); \
|
||||
} else { \
|
||||
SETFLAGBIT(CF,true);SETFLAGBIT(OF,true); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define DIMULW(op1,op2,op3,load,save) \
|
||||
{ \
|
||||
Bits res; \
|
||||
res=((Bit16s)op2) * ((Bit16s)op3); \
|
||||
save(op1,res & 0xffff); \
|
||||
flags.type=t_MUL; \
|
||||
if ((res> -32768) && (res<32767)) { \
|
||||
SETFLAGBIT(CF,false);SETFLAGBIT(OF,false); \
|
||||
} else { \
|
||||
SETFLAGBIT(CF,true);SETFLAGBIT(OF,true); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define DIMULD(op1,op2,op3,load,save) \
|
||||
{ \
|
||||
Bit64s res=((Bit64s)((Bit32s)op2))*((Bit64s)((Bit32s)op3)); \
|
||||
save(op1,(Bit32s)res); \
|
||||
flags.type=t_MUL; \
|
||||
if ((res>-((Bit64s)(2147483647)+1)) && \
|
||||
(res<(Bit64s)2147483647)) { \
|
||||
SETFLAGBIT(CF,false);SETFLAGBIT(OF,false); \
|
||||
} else { \
|
||||
SETFLAGBIT(CF,true);SETFLAGBIT(OF,true); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define GRP2B(blah) \
|
||||
{ \
|
||||
GetRM; \
|
||||
GetRM;Bitu which=(rm>>3)&7; \
|
||||
if (rm >= 0xc0) { \
|
||||
GetEArb; \
|
||||
Bit8u val=blah & 0x1f; \
|
||||
switch (rm&0x38) { \
|
||||
switch (which) { \
|
||||
case 0x00:ROLB(*earb,val,LoadRb,SaveRb);break; \
|
||||
case 0x08:RORB(*earb,val,LoadRb,SaveRb);break; \
|
||||
case 0x10:RCLB(*earb,val,LoadRb,SaveRb);break; \
|
||||
case 0x18:RCRB(*earb,val,LoadRb,SaveRb);break; \
|
||||
case 0x20:/* SHL and SAL are the same */ \
|
||||
case 0x30:SHLB(*earb,val,LoadRb,SaveRb);break; \
|
||||
case 0x28:SHRB(*earb,val,LoadRb,SaveRb);break; \
|
||||
case 0x38:SARB(*earb,val,LoadRb,SaveRb);break; \
|
||||
case 0x01:RORB(*earb,val,LoadRb,SaveRb);break; \
|
||||
case 0x02:RCLB(*earb,val,LoadRb,SaveRb);break; \
|
||||
case 0x03:RCRB(*earb,val,LoadRb,SaveRb);break; \
|
||||
case 0x04:/* SHL and SAL are the same */ \
|
||||
case 0x06:SHLB(*earb,val,LoadRb,SaveRb);break; \
|
||||
case 0x05:SHRB(*earb,val,LoadRb,SaveRb);break; \
|
||||
case 0x07:SARB(*earb,val,LoadRb,SaveRb);break; \
|
||||
} \
|
||||
} else { \
|
||||
GetEAa; \
|
||||
Bit8u val=blah & 0x1f; \
|
||||
switch (rm & 0x38) { \
|
||||
switch (which) { \
|
||||
case 0x00:ROLB(eaa,val,LoadMb,SaveMb);break; \
|
||||
case 0x08:RORB(eaa,val,LoadMb,SaveMb);break; \
|
||||
case 0x10:RCLB(eaa,val,LoadMb,SaveMb);break; \
|
||||
case 0x18:RCRB(eaa,val,LoadMb,SaveMb);break; \
|
||||
case 0x20:/* SHL and SAL are the same */ \
|
||||
case 0x30:SHLB(eaa,val,LoadMb,SaveMb);break; \
|
||||
case 0x28:SHRB(eaa,val,LoadMb,SaveMb);break; \
|
||||
case 0x38:SARB(eaa,val,LoadMb,SaveMb);break; \
|
||||
case 0x01:RORB(eaa,val,LoadMb,SaveMb);break; \
|
||||
case 0x02:RCLB(eaa,val,LoadMb,SaveMb);break; \
|
||||
case 0x03:RCRB(eaa,val,LoadMb,SaveMb);break; \
|
||||
case 0x04:/* SHL and SAL are the same */ \
|
||||
case 0x06:SHLB(eaa,val,LoadMb,SaveMb);break; \
|
||||
case 0x05:SHRB(eaa,val,LoadMb,SaveMb);break; \
|
||||
case 0x07:SARB(eaa,val,LoadMb,SaveMb);break; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
@ -548,32 +759,32 @@
|
||||
|
||||
#define GRP2W(blah) \
|
||||
{ \
|
||||
GetRM; \
|
||||
GetRM;Bitu which=(rm>>3)&7; \
|
||||
if (rm >= 0xc0) { \
|
||||
GetEArw; \
|
||||
Bit8u val=blah & 0x1f; \
|
||||
switch (rm&0x38) { \
|
||||
switch (which) { \
|
||||
case 0x00:ROLW(*earw,val,LoadRw,SaveRw);break; \
|
||||
case 0x08:RORW(*earw,val,LoadRw,SaveRw);break; \
|
||||
case 0x10:RCLW(*earw,val,LoadRw,SaveRw);break; \
|
||||
case 0x18:RCRW(*earw,val,LoadRw,SaveRw);break; \
|
||||
case 0x20:/* SHL and SAL are the same */ \
|
||||
case 0x30:SHLW(*earw,val,LoadRw,SaveRw);break; \
|
||||
case 0x28:SHRW(*earw,val,LoadRw,SaveRw);break; \
|
||||
case 0x38:SARW(*earw,val,LoadRw,SaveRw);break; \
|
||||
case 0x01:RORW(*earw,val,LoadRw,SaveRw);break; \
|
||||
case 0x02:RCLW(*earw,val,LoadRw,SaveRw);break; \
|
||||
case 0x03:RCRW(*earw,val,LoadRw,SaveRw);break; \
|
||||
case 0x04:/* SHL and SAL are the same */ \
|
||||
case 0x06:SHLW(*earw,val,LoadRw,SaveRw);break; \
|
||||
case 0x05:SHRW(*earw,val,LoadRw,SaveRw);break; \
|
||||
case 0x07:SARW(*earw,val,LoadRw,SaveRw);break; \
|
||||
} \
|
||||
} else { \
|
||||
GetEAa; \
|
||||
Bit8u val=blah & 0x1f; \
|
||||
switch (rm & 0x38) { \
|
||||
switch (which) { \
|
||||
case 0x00:ROLW(eaa,val,LoadMw,SaveMw);break; \
|
||||
case 0x08:RORW(eaa,val,LoadMw,SaveMw);break; \
|
||||
case 0x10:RCLW(eaa,val,LoadMw,SaveMw);break; \
|
||||
case 0x18:RCRW(eaa,val,LoadMw,SaveMw);break; \
|
||||
case 0x20:/* SHL and SAL are the same */ \
|
||||
case 0x30:SHLW(eaa,val,LoadMw,SaveMw);break; \
|
||||
case 0x28:SHRW(eaa,val,LoadMw,SaveMw);break; \
|
||||
case 0x38:SARW(eaa,val,LoadMw,SaveMw);break; \
|
||||
case 0x01:RORW(eaa,val,LoadMw,SaveMw);break; \
|
||||
case 0x02:RCLW(eaa,val,LoadMw,SaveMw);break; \
|
||||
case 0x03:RCRW(eaa,val,LoadMw,SaveMw);break; \
|
||||
case 0x04:/* SHL and SAL are the same */ \
|
||||
case 0x06:SHLW(eaa,val,LoadMw,SaveMw);break; \
|
||||
case 0x05:SHRW(eaa,val,LoadMw,SaveMw);break; \
|
||||
case 0x07:SARW(eaa,val,LoadMw,SaveMw);break; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
@ -581,32 +792,32 @@
|
||||
|
||||
#define GRP2D(blah) \
|
||||
{ \
|
||||
GetRM; \
|
||||
GetRM;Bitu which=(rm>>3)&7; \
|
||||
if (rm >= 0xc0) { \
|
||||
GetEArd; \
|
||||
Bit8u val=blah & 0x1f; \
|
||||
switch (rm&0x38) { \
|
||||
switch (which) { \
|
||||
case 0x00:ROLD(*eard,val,LoadRd,SaveRd);break; \
|
||||
case 0x08:RORD(*eard,val,LoadRd,SaveRd);break; \
|
||||
case 0x10:RCLD(*eard,val,LoadRd,SaveRd);break; \
|
||||
case 0x18:RCRD(*eard,val,LoadRd,SaveRd);break; \
|
||||
case 0x20:/* SHL and SAL are the same */ \
|
||||
case 0x30:SHLD(*eard,val,LoadRd,SaveRd);break; \
|
||||
case 0x28:SHRD(*eard,val,LoadRd,SaveRd);break; \
|
||||
case 0x38:SARD(*eard,val,LoadRd,SaveRd);break; \
|
||||
case 0x01:RORD(*eard,val,LoadRd,SaveRd);break; \
|
||||
case 0x02:RCLD(*eard,val,LoadRd,SaveRd);break; \
|
||||
case 0x03:RCRD(*eard,val,LoadRd,SaveRd);break; \
|
||||
case 0x04:/* SHL and SAL are the same */ \
|
||||
case 0x06:SHLD(*eard,val,LoadRd,SaveRd);break; \
|
||||
case 0x05:SHRD(*eard,val,LoadRd,SaveRd);break; \
|
||||
case 0x07:SARD(*eard,val,LoadRd,SaveRd);break; \
|
||||
} \
|
||||
} else { \
|
||||
GetEAa; \
|
||||
Bit8u val=blah & 0x1f; \
|
||||
switch (rm & 0x38) { \
|
||||
switch (which) { \
|
||||
case 0x00:ROLD(eaa,val,LoadMd,SaveMd);break; \
|
||||
case 0x08:RORD(eaa,val,LoadMd,SaveMd);break; \
|
||||
case 0x10:RCLD(eaa,val,LoadMd,SaveMd);break; \
|
||||
case 0x18:RCRD(eaa,val,LoadMd,SaveMd);break; \
|
||||
case 0x20:/* SHL and SAL are the same */ \
|
||||
case 0x30:SHLD(eaa,val,LoadMd,SaveMd);break; \
|
||||
case 0x28:SHRD(eaa,val,LoadMd,SaveMd);break; \
|
||||
case 0x38:SARD(eaa,val,LoadMd,SaveMd);break; \
|
||||
case 0x01:RORD(eaa,val,LoadMd,SaveMd);break; \
|
||||
case 0x02:RCLD(eaa,val,LoadMd,SaveMd);break; \
|
||||
case 0x03:RCRD(eaa,val,LoadMd,SaveMd);break; \
|
||||
case 0x04:/* SHL and SAL are the same */ \
|
||||
case 0x06:SHLD(eaa,val,LoadMd,SaveMd);break; \
|
||||
case 0x05:SHRD(eaa,val,LoadMd,SaveMd);break; \
|
||||
case 0x07:SARD(eaa,val,LoadMd,SaveMd);break; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
84
src/cpu/lazyflags.h
Normal file
84
src/cpu/lazyflags.h
Normal file
@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright (C) 2002-2003 The DOSBox Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
//Flag Handling
|
||||
Bitu get_CF(void);
|
||||
Bitu get_AF(void);
|
||||
Bitu get_ZF(void);
|
||||
Bitu get_SF(void);
|
||||
Bitu get_OF(void);
|
||||
Bitu get_PF(void);
|
||||
|
||||
void FillFlags(void);
|
||||
|
||||
#define SETFLAGSb(FLAGB) \
|
||||
{ \
|
||||
SETFLAGBIT(OF,get_OF()); \
|
||||
flags.type=t_UNKNOWN; \
|
||||
CPU_SetFlags((flags.word&0xffffff00)|((FLAGB) & 0xff)); \
|
||||
}
|
||||
|
||||
#define SETFLAGSw(FLAGW) \
|
||||
{ \
|
||||
flags.type=t_UNKNOWN; \
|
||||
CPU_SetFlagsw(FLAGW); \
|
||||
}
|
||||
|
||||
#define SETFLAGSd(FLAGD) \
|
||||
{ \
|
||||
flags.type=t_UNKNOWN; \
|
||||
CPU_SetFlags(FLAGD); \
|
||||
}
|
||||
|
||||
#define LoadCF SETFLAGBIT(CF,get_CF());
|
||||
#define LoadZF SETFLAGBIT(ZF,get_ZF());
|
||||
#define LoadSF SETFLAGBIT(SF,get_SF());
|
||||
#define LoadOF SETFLAGBIT(OF,get_OF());
|
||||
#define LoadAF SETFLAGBIT(AF,get_AF());
|
||||
|
||||
//Types of Flag changing instructions
|
||||
enum {
|
||||
t_UNKNOWN=0,
|
||||
t_ADDb,t_ADDw,t_ADDd,
|
||||
t_ORb,t_ORw,t_ORd,
|
||||
t_ADCb,t_ADCw,t_ADCd,
|
||||
t_SBBb,t_SBBw,t_SBBd,
|
||||
t_ANDb,t_ANDw,t_ANDd,
|
||||
t_SUBb,t_SUBw,t_SUBd,
|
||||
t_XORb,t_XORw,t_XORd,
|
||||
t_CMPb,t_CMPw,t_CMPd,
|
||||
t_INCb,t_INCw,t_INCd,
|
||||
t_DECb,t_DECw,t_DECd,
|
||||
t_TESTb,t_TESTw,t_TESTd,
|
||||
t_SHLb,t_SHLw,t_SHLd,
|
||||
t_SHRb,t_SHRw,t_SHRd,
|
||||
t_SARb,t_SARw,t_SARd,
|
||||
t_ROLb,t_ROLw,t_ROLd,
|
||||
t_RORb,t_RORw,t_RORd,
|
||||
t_RCLb,t_RCLw,t_RCLd,
|
||||
t_RCRb,t_RCRw,t_RCRd,
|
||||
t_NEGb,t_NEGw,t_NEGd,
|
||||
t_CF,t_ZF,
|
||||
|
||||
t_DSHLw,t_DSHLd,
|
||||
t_DSHRw,t_DSHRd,
|
||||
t_MUL,t_DIV,
|
||||
t_NOTDONE,
|
||||
t_LASTFLAG
|
||||
};
|
||||
|
@ -53,24 +53,12 @@ extern Bit32u * lookupRMEAregd[256];
|
||||
|
||||
|
||||
#define GetEArb \
|
||||
union { \
|
||||
Bit8u * earb; \
|
||||
Bit8s * earbs; \
|
||||
}; \
|
||||
earb=lookupRMEAregb[rm];
|
||||
Bit8u * earb=lookupRMEAregb[rm];
|
||||
|
||||
#define GetEArw \
|
||||
union { \
|
||||
Bit16u * earw; \
|
||||
Bit16s * earws; \
|
||||
}; \
|
||||
earw=lookupRMEAregw[rm];
|
||||
Bit16u * earw=lookupRMEAregw[rm];
|
||||
|
||||
#define GetEArd \
|
||||
union { \
|
||||
Bit32u * eard; \
|
||||
Bit32s * eards; \
|
||||
}; \
|
||||
eard=lookupRMEAregd[rm];
|
||||
Bit32u * eard=lookupRMEAregd[rm];
|
||||
|
||||
|
||||
|
253
src/cpu/paging.cpp
Normal file
253
src/cpu/paging.cpp
Normal file
@ -0,0 +1,253 @@
|
||||
/*
|
||||
* Copyright (C) 2002-2003 The DOSBox Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "dosbox.h"
|
||||
#include "mem.h"
|
||||
#include "paging.h"
|
||||
#include "../hardware/vga.h"
|
||||
|
||||
|
||||
#define LINK_TOTAL (64*1024)
|
||||
|
||||
static PageLink link_list[LINK_TOTAL];
|
||||
struct PagingBlock paging;
|
||||
|
||||
class PageDirChange : public PageChange {
|
||||
public:
|
||||
PageDirChange(PageDirectory * mydir) { dir=mydir;}
|
||||
void Changed(PageLink * link,Bitu start,Bitu end) {
|
||||
start>>=2;end>>=2;
|
||||
for (;start<=end;start++) {
|
||||
dir->InvalidateTable(start);
|
||||
}
|
||||
}
|
||||
private:
|
||||
PageDirectory * dir;
|
||||
};
|
||||
|
||||
class PageTableChange : public PageChange {
|
||||
public:
|
||||
PageTableChange(PageDirectory * mydir) { dir=mydir;}
|
||||
void Changed(PageLink * link,Bitu start,Bitu end) {
|
||||
start>>=2;end>>=2;
|
||||
for (;start<=end;start++) {
|
||||
dir->InvalidateLink(link->data.table,start);
|
||||
}
|
||||
}
|
||||
private:
|
||||
PageDirectory * dir;
|
||||
};
|
||||
|
||||
|
||||
|
||||
PageDirectory::PageDirectory() {
|
||||
entry_init.data.dir=this;
|
||||
entry_init.type=ENTRY_INIT;
|
||||
link_init.read=0;
|
||||
link_init.write=0;
|
||||
link_init.entry=&entry_init;
|
||||
table_change = new PageTableChange(this);
|
||||
dir_change = new PageDirChange(this);
|
||||
}
|
||||
PageDirectory::~PageDirectory() {
|
||||
delete table_change;
|
||||
delete dir_change;
|
||||
}
|
||||
void PageDirectory::ClearDirectory(void) {
|
||||
Bitu i;
|
||||
for (i=0;i<1024*1024;i++) links[i]=&link_init;
|
||||
for (i=0;i<1024;i++) {
|
||||
tables[i]=0;
|
||||
}
|
||||
}
|
||||
void PageDirectory::SetBase(PhysPt page) {
|
||||
base_page=page;
|
||||
ClearDirectory();
|
||||
/* Setup handler for PageDirectory changes */
|
||||
link_dir=MEM_LinkPage(base_page,0);
|
||||
if (!link_dir) E_Exit("PAGING:Directory setup on illegal address");
|
||||
link_dir->data.dir=this;
|
||||
link_dir->change=dir_change;
|
||||
MEM_CheckLinks(link_dir->entry);
|
||||
}
|
||||
void PageDirectory::LinkPage(Bitu lin_page,Bitu phys_page) {
|
||||
if (links[lin_page] != &link_init) MEM_UnlinkPage(links[lin_page]);
|
||||
PageLink * link=MEM_LinkPage(phys_page,lin_page*4096);
|
||||
if (link) links[lin_page]=link;
|
||||
else links[lin_page]=&link_init;
|
||||
}
|
||||
|
||||
bool PageDirectory::InitPage(Bitu lin_address) {
|
||||
Bitu lin_page=lin_address >> 12;
|
||||
Bitu table=lin_page >> 10;
|
||||
Bitu index=lin_page & 0x3ff;
|
||||
/* Check if there already is table linked */
|
||||
if (!tables[table]) {
|
||||
X86PageEntry table_entry;
|
||||
table_entry.load=phys_page_readd(base_page,0);
|
||||
if (!table_entry.block.p) {
|
||||
LOG(LOG_PAGING,LOG_ERROR)("NP TABLE");
|
||||
return false;
|
||||
}
|
||||
PageLink * link=MEM_LinkPage(table_entry.block.base,table_entry.block.base);
|
||||
if (!link) return false;
|
||||
link->data.table=table;
|
||||
link->change=table_change;
|
||||
MEM_CheckLinks(link->entry);
|
||||
tables[table]=link;
|
||||
}
|
||||
X86PageEntry entry;
|
||||
entry.load=phys_page_readd(tables[table]->lin_base,index);
|
||||
if (!entry.block.p) {
|
||||
LOG(LOG_PAGING,LOG_ERROR)("NP PAGE");
|
||||
return false;
|
||||
}
|
||||
PageLink * link=MEM_LinkPage(entry.block.base,lin_page*4096);
|
||||
if (!link) return false;
|
||||
links[lin_page]=link;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool PageDirectory::InitPageLinear(Bitu lin_address) {
|
||||
Bitu phys_page=lin_address >> 12;
|
||||
PageLink * link=MEM_LinkPage(phys_page,phys_page*4096);
|
||||
if (link) {
|
||||
/* Set the page entry in our table */
|
||||
links[phys_page]=link;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void PageDirectory::InvalidateTable(Bitu table) {
|
||||
if (tables[table]) {
|
||||
MEM_UnlinkPage(tables[table]);
|
||||
tables[table]=0;
|
||||
for (Bitu i=(table*1024);i<(table+1)*1024;i++) {
|
||||
if (links[i]!=&link_init) {
|
||||
MEM_UnlinkPage(links[i]);
|
||||
links[i]=&link_init;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PageDirectory::InvalidateLink(Bitu table,Bitu index) {
|
||||
Bitu i=(table*1024)+index;
|
||||
if (links[i]!=&link_init) {
|
||||
MEM_UnlinkPage(links[i]);
|
||||
links[i]=&link_init;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Bitu PAGING_GetDirBase(void) {
|
||||
return paging.cr3;
|
||||
}
|
||||
|
||||
void PAGING_SetDirBase(Bitu cr3) {
|
||||
paging.cr3=cr3;
|
||||
Bitu base_page=cr3 >> 12;
|
||||
LOG(LOG_PAGING,LOG_NORMAL)("CR3:%X Base %X",cr3,base_page);
|
||||
if (paging.enabled) {
|
||||
/* Check if we already have this one cached */
|
||||
PageDirectory * dir=paging.cache;
|
||||
while (dir) {
|
||||
if (dir->base_page==base_page) {
|
||||
paging.dir=dir;
|
||||
return;
|
||||
}
|
||||
dir=dir->next;
|
||||
}
|
||||
/* Couldn't find cached directory, make a new one */
|
||||
dir=new PageDirectory();
|
||||
dir->next=paging.cache;
|
||||
paging.cache=dir;
|
||||
dir->SetBase(base_page);
|
||||
paging.dir=dir;
|
||||
}
|
||||
}
|
||||
|
||||
void PAGING_Enable(bool enabled) {
|
||||
/* If paging is disable we work from a default paging table */
|
||||
if (paging.enabled==enabled) return;
|
||||
paging.enabled=enabled;
|
||||
if (!enabled) {
|
||||
LOG(LOG_PAGING,LOG_NORMAL)("Disabled");
|
||||
paging.dir=MEM_DefaultDirectory();
|
||||
} else {
|
||||
LOG(LOG_PAGING,LOG_NORMAL)("Enabled");
|
||||
#if !(C_DEBUG)
|
||||
E_Exit("CPU Paging features aren't supported");
|
||||
#endif
|
||||
PAGING_SetDirBase(paging.cr3);
|
||||
}
|
||||
}
|
||||
|
||||
bool PAGING_Enabled(void) {
|
||||
return paging.enabled;
|
||||
}
|
||||
|
||||
|
||||
void PAGING_FreePageLink(PageLink * link) {
|
||||
MEM_UnlinkPage(link);
|
||||
PAGING_AddFreePageLink(link);
|
||||
}
|
||||
|
||||
void PAGING_LinkPage(PageDirectory * dir,Bitu lin_page,Bitu phys_page) {
|
||||
PageLink * link=MEM_LinkPage(phys_page,lin_page*4096);
|
||||
/* Only replace if we can */
|
||||
if (link) {
|
||||
PAGING_FreePageLink(dir->links[lin_page]);
|
||||
dir->links[lin_page]=link;
|
||||
}
|
||||
}
|
||||
|
||||
void PAGING_AddFreePageLink(PageLink * link) {
|
||||
link->read=0;
|
||||
link->write=0;
|
||||
link->change=0;
|
||||
link->next=paging.free_link;
|
||||
link->entry=0;
|
||||
paging.free_link=link;
|
||||
}
|
||||
|
||||
PageLink * PAGING_GetFreePageLink(void) {
|
||||
PageLink * ret;
|
||||
if (paging.free_link) ret=paging.free_link;
|
||||
else E_Exit("PAGING:Ran out of PageEntries");
|
||||
paging.free_link=ret->next;
|
||||
ret->next=0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void PAGING_Init(Section * sec) {
|
||||
Bitu i;
|
||||
/* Setup the free pages tables for fast page allocation */
|
||||
paging.cache=0;
|
||||
paging.free_link=0;
|
||||
for (i=0;i<LINK_TOTAL;i++) PAGING_AddFreePageLink(&link_list[i]);
|
||||
/* Setup default Page Directory, force it to update */
|
||||
paging.enabled=true;PAGING_Enable(false);
|
||||
}
|
@ -20,6 +20,7 @@
|
||||
#include "dosbox.h"
|
||||
#include "mem.h"
|
||||
#include "cpu.h"
|
||||
#include "lazyflags.h"
|
||||
#include "inout.h"
|
||||
#include "callback.h"
|
||||
#include "pic.h"
|
||||
@ -56,60 +57,69 @@ extern Bitu cycle_count;
|
||||
/* Enable parts of the cpu emulation */
|
||||
#define CPU_386 //Enable 386 instructions
|
||||
#define CPU_PREFIX_67 //Enable the 0x67 prefix
|
||||
#define CPU_PREFIX_COUNT //Enable counting of prefixes
|
||||
#define CPU_PIC_CHECK //Check for IRQ's on critical moment
|
||||
|
||||
#if C_FPU
|
||||
#define CPU_FPU //Enable FPU escape instructions
|
||||
#endif
|
||||
|
||||
static struct {
|
||||
Bitu prefixes;
|
||||
PhysPt segbase;
|
||||
PhysPt ip_lookup;
|
||||
PhysPt ip_start;
|
||||
}core_16 ;
|
||||
|
||||
|
||||
#include "instructions.h"
|
||||
#include "core_16/support.h"
|
||||
static Bitu CPU_Real_16_Slow_Decode_Trap(void);
|
||||
static Bits CPU_Real_16_Slow_Decode_Trap(void);
|
||||
|
||||
static Bitu CPU_Real_16_Slow_Decode(void) {
|
||||
#include "core_16/start.h"
|
||||
static Bits CPU_Real_16_Slow_Decode(void) {
|
||||
decode_start:
|
||||
LOADIP;
|
||||
flags.type=t_UNKNOWN;
|
||||
while (CPU_Cycles>0) {
|
||||
#if C_DEBUG
|
||||
cycle_count++;
|
||||
#if C_HEAVY_DEBUG
|
||||
SAVEIP;
|
||||
if (DEBUG_HeavyIsBreakpoint()) return 1;
|
||||
LEAVECORE;
|
||||
if (DEBUG_HeavyIsBreakpoint()) return debugCallback;
|
||||
#endif
|
||||
#endif
|
||||
core_16.ip_start=core_16.ip_lookup;
|
||||
core_16.prefixes=0;
|
||||
lookupEATable=EAPrefixTable[0];
|
||||
#include "core_16/main.h"
|
||||
if (prefix.count) {
|
||||
PrefixReset;
|
||||
//DEBUG_HeavyWriteLogInstruction();
|
||||
LOG(LOG_CPU,"Prefix for non prefixed instruction");
|
||||
}
|
||||
CPU_Cycles--;
|
||||
}
|
||||
#include "core_16/stop.h"
|
||||
decode_end:
|
||||
LEAVECORE;
|
||||
return CBRET_NONE;
|
||||
}
|
||||
|
||||
static Bitu CPU_Real_16_Slow_Decode_Trap(void) {
|
||||
static Bits CPU_Real_16_Slow_Decode_Trap(void) {
|
||||
|
||||
Bits oldCycles = CPU_Cycles;
|
||||
CPU_Cycles = 1;
|
||||
CPU_Real_16_Slow_Decode();
|
||||
Bits ret=CPU_Real_16_Slow_Decode();
|
||||
|
||||
// LOG_DEBUG("TRAP: Trap Flag executed");
|
||||
INTERRUPT(1);
|
||||
Interrupt(1);
|
||||
|
||||
CPU_Cycles = oldCycles-1;
|
||||
cpudecoder = &CPU_Real_16_Slow_Decode;
|
||||
|
||||
return CBRET_NONE;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void CPU_Real_16_Slow_Start(void) {
|
||||
void CPU_Real_16_Slow_Start(bool big) {
|
||||
if (big) E_Exit("Core 16 only runs 16-bit code");
|
||||
cpudecoder=&CPU_Real_16_Slow_Decode;
|
||||
EAPrefixTable[0]=&GetEA_16_n;
|
||||
EAPrefixTable[1]=&GetEA_16_s;
|
||||
EAPrefixTable[2]=&GetEA_32_n;
|
||||
EAPrefixTable[3]=&GetEA_32_s;
|
||||
PrefixReset;
|
||||
EAPrefixTable[0]=&GetEA_16_n;
|
||||
EAPrefixTable[1]=&GetEA_16_s;
|
||||
|
||||
};
|
||||
|
@ -1,5 +1,4 @@
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include
|
||||
|
||||
EXTRA_DIST = debug_win32.cpp
|
||||
noinst_LIBRARIES = libdebug.a
|
||||
libdebug_a_SOURCES = debug.cpp debug_gui.cpp debug_disasm.cpp debug_inc.h disasm_tables.h
|
||||
libdebug_a_SOURCES = debug.cpp debug_gui.cpp debug_disasm.cpp debug_inc.h disasm_tables.h debug_win32.cpp
|
@ -1,7 +1,7 @@
|
||||
# Makefile.in generated by automake 1.6.3 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.7.7 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -13,83 +13,128 @@
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = ../..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = @program_transform_name@
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
|
||||
EXEEXT = @EXEEXT@
|
||||
OBJEXT = @OBJEXT@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMDEP_FALSE = @AMDEP_FALSE@
|
||||
AMDEP_TRUE = @AMDEP_TRUE@
|
||||
AMTAR = @AMTAR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SDL_CFLAGS = @SDL_CFLAGS@
|
||||
SDL_CONFIG = @SDL_CONFIG@
|
||||
SDL_LIBS = @SDL_LIBS@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_RANLIB = @ac_ct_RANLIB@
|
||||
ac_ct_STRIP = @ac_ct_STRIP@
|
||||
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
|
||||
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
|
||||
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
|
||||
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
datadir = @datadir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
oldincludedir = @oldincludedir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target = @target@
|
||||
target_alias = @target_alias@
|
||||
target_cpu = @target_cpu@
|
||||
target_os = @target_os@
|
||||
target_vendor = @target_vendor@
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include
|
||||
|
||||
EXTRA_DIST = debug_win32.cpp
|
||||
noinst_LIBRARIES = libdebug.a
|
||||
libdebug_a_SOURCES = debug.cpp debug_gui.cpp debug_disasm.cpp debug_inc.h disasm_tables.h
|
||||
libdebug_a_SOURCES = debug.cpp debug_gui.cpp debug_disasm.cpp debug_inc.h disasm_tables.h debug_win32.cpp
|
||||
subdir = src/debug
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
@ -98,31 +143,25 @@ LIBRARIES = $(noinst_LIBRARIES)
|
||||
libdebug_a_AR = $(AR) cru
|
||||
libdebug_a_LIBADD =
|
||||
am_libdebug_a_OBJECTS = debug.$(OBJEXT) debug_gui.$(OBJEXT) \
|
||||
debug_disasm.$(OBJEXT)
|
||||
debug_disasm.$(OBJEXT) debug_win32.$(OBJEXT)
|
||||
libdebug_a_OBJECTS = $(am_libdebug_a_OBJECTS)
|
||||
|
||||
DEFS = @DEFS@
|
||||
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/debug.Po ./$(DEPDIR)/debug_disasm.Po \
|
||||
@AMDEP_TRUE@ ./$(DEPDIR)/debug_gui.Po
|
||||
@AMDEP_TRUE@ ./$(DEPDIR)/debug_gui.Po ./$(DEPDIR)/debug_win32.Po
|
||||
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
|
||||
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
|
||||
CXXLD = $(CXX)
|
||||
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
|
||||
-o $@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CFLAGS = @CFLAGS@
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
DIST_SOURCES = $(libdebug_a_SOURCES)
|
||||
DIST_COMMON = Makefile.am Makefile.in
|
||||
DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
|
||||
SOURCES = $(libdebug_a_SOURCES)
|
||||
|
||||
all: all-am
|
||||
@ -153,27 +192,37 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug_disasm.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug_gui.Po@am__quote@
|
||||
|
||||
distclean-depend:
|
||||
-rm -rf ./$(DEPDIR)
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug_win32.Po@am__quote@
|
||||
|
||||
.cpp.o:
|
||||
@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
$(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
|
||||
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
|
||||
@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
|
||||
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
|
||||
@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
|
||||
@am__fastdepCXX_TRUE@ fi
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
|
||||
|
||||
.cpp.obj:
|
||||
@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
$(CXXCOMPILE) -c -o $@ `cygpath -w $<`
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
|
||||
@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
|
||||
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
|
||||
@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
|
||||
@am__fastdepCXX_TRUE@ fi
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
|
||||
uninstall-info-am:
|
||||
|
||||
ETAGS = etags
|
||||
ETAGSFLAGS =
|
||||
|
||||
CTAGS = ctags
|
||||
CTAGSFLAGS =
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
@ -199,20 +248,41 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
top_distdir = ../..
|
||||
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@list='$(DISTFILES)'; for file in $$list; do \
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(DISTFILES)'; for file in $$list; do \
|
||||
case $$file in \
|
||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
|
||||
esac; \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
@ -237,7 +307,6 @@ check: check-am
|
||||
all-am: Makefile $(LIBRARIES)
|
||||
|
||||
installdirs:
|
||||
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
@ -257,7 +326,7 @@ mostlyclean-generic:
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@ -267,9 +336,11 @@ clean: clean-am
|
||||
clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
|
||||
distclean-am: clean-am distclean-compile distclean-depend \
|
||||
distclean-generic distclean-tags
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
@ -290,6 +361,8 @@ install-man:
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
@ -297,18 +370,25 @@ mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-info-am
|
||||
|
||||
.PHONY: GTAGS all all-am check check-am clean clean-generic \
|
||||
clean-noinstLIBRARIES distclean distclean-compile \
|
||||
distclean-depend distclean-generic distclean-tags distdir dvi \
|
||||
dvi-am info info-am install install-am install-data \
|
||||
install-data-am install-exec install-exec-am install-info \
|
||||
install-info-am install-man install-strip installcheck \
|
||||
installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic tags uninstall uninstall-am \
|
||||
uninstall-info-am
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||
clean-noinstLIBRARIES ctags distclean distclean-compile \
|
||||
distclean-generic distclean-tags distdir dvi dvi-am info \
|
||||
info-am install install-am install-data install-data-am \
|
||||
install-exec install-exec-am install-info install-info-am \
|
||||
install-man install-strip installcheck installcheck-am \
|
||||
installdirs maintainer-clean maintainer-clean-generic \
|
||||
mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \
|
||||
ps ps-am tags uninstall uninstall-am uninstall-info-am
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "mixer.h"
|
||||
#include "debug_inc.h"
|
||||
#include "timer.h"
|
||||
#include "../ints/xms.h"
|
||||
#include "../shell/shell_inc.h"
|
||||
|
||||
#ifdef WIN32
|
||||
@ -44,12 +45,15 @@ void WIN32_Console();
|
||||
static struct termios consolesettings;
|
||||
int old_cursor_state;
|
||||
#endif
|
||||
|
||||
// Forwards
|
||||
static void DrawCode(void);
|
||||
static bool DEBUG_Log_Loop(int count);
|
||||
static void DEBUG_RaiseTimerIrq(void);
|
||||
char* AnalyzeInstruction(char* inst);
|
||||
char* AnalyzeInstruction(char* inst, bool saveSelector);
|
||||
void SaveMemory(Bit16u seg, Bit16u ofs1, Bit32s num);
|
||||
Bit32u GetHexValue(char* str, char*& hex);
|
||||
|
||||
class DEBUG;
|
||||
|
||||
DEBUG* pDebugcom = 0;
|
||||
@ -60,16 +64,15 @@ static struct {
|
||||
Bit32u eax,ebx,ecx,edx,esi,edi,ebp,esp,eip;
|
||||
} oldregs;
|
||||
|
||||
|
||||
static char curSelectorName[3] = { 0,0,0 };
|
||||
|
||||
static Segment oldsegs[6];
|
||||
static Flag_Info oldflags;
|
||||
static Bitu oldflags;
|
||||
DBGBlock dbg;
|
||||
static char input_line[256];
|
||||
static Bitu input_count;
|
||||
Bitu cycle_count;
|
||||
static bool debugging;
|
||||
static void SetColor(bool test) {
|
||||
static void SetColor(Bitu test) {
|
||||
if (test) {
|
||||
if (has_colors()) { wattrset(dbg.win_reg,COLOR_PAIR(PAIR_BYELLOW_BLACK));}
|
||||
} else {
|
||||
@ -90,9 +93,52 @@ struct SCodeViewData {
|
||||
|
||||
} codeViewData;
|
||||
|
||||
static Bit16u dataSeg,dataOfs;
|
||||
static Bit16u dataSeg;
|
||||
static Bit32u dataOfs;
|
||||
static bool showExtend = true;
|
||||
|
||||
/***********/
|
||||
/* Helpers */
|
||||
/***********/
|
||||
|
||||
Bit32u PhysMakeProt(Bit16u selector, Bit32u offset)
|
||||
{
|
||||
Descriptor desc;
|
||||
if (cpu.gdt.GetDescriptor(selector,desc)) return desc.GetBase()+offset;
|
||||
return 0;
|
||||
};
|
||||
|
||||
Bit32u GetAddress(Bit16u seg, Bit32u offset)
|
||||
{
|
||||
if (cpu.pmode) return PhysMakeProt(seg,offset);
|
||||
return (seg<<4)+offset;
|
||||
};
|
||||
|
||||
bool GetDescriptorInfo(char* selname, char* out1, char* out2)
|
||||
{
|
||||
Bit16u sel;
|
||||
Descriptor desc;
|
||||
|
||||
if (strstr(selname,"cs") || strstr(selname,"CS")) sel = SegValue(cs); else
|
||||
if (strstr(selname,"ds") || strstr(selname,"DS")) sel = SegValue(ds); else
|
||||
if (strstr(selname,"es") || strstr(selname,"ES")) sel = SegValue(es); else
|
||||
if (strstr(selname,"fs") || strstr(selname,"FS")) sel = SegValue(fs); else
|
||||
if (strstr(selname,"gs") || strstr(selname,"GS")) sel = SegValue(gs); else
|
||||
if (strstr(selname,"ss") || strstr(selname,"SS")) sel = SegValue(ss); else
|
||||
sel = GetHexValue(selname,selname);
|
||||
// FIXME: Call Gate Descriptors
|
||||
if (cpu.gdt.GetDescriptor(sel,desc)) {
|
||||
sprintf(out1,"%s: b:%08X type:%02X parbg",selname,desc.GetBase(),desc.saved.seg.type);
|
||||
sprintf(out2," l:%08X dpl : %01X %1X%1X%1X%1X%1X",desc.GetLimit(),desc.saved.seg.dpl,desc.saved.seg.p,desc.saved.seg.avl,desc.saved.seg.r,desc.saved.seg.big,desc.saved.seg.g);
|
||||
return true;
|
||||
} else {
|
||||
strcpy(out1," ");
|
||||
strcpy(out2," ");
|
||||
}
|
||||
//out1[0] = out2[0] = 0;
|
||||
return false;
|
||||
};
|
||||
|
||||
/********************/
|
||||
/* DebugVar stuff */
|
||||
/********************/
|
||||
@ -137,7 +183,7 @@ class CBreakpoint
|
||||
public:
|
||||
CBreakpoint (void) { location = 0; active = once = false; segment = 0; offset = 0; intNr = 0; ahValue = 0; type = BKPNT_UNKNOWN; };
|
||||
|
||||
void SetAddress (Bit16u seg, Bit32u off) { location = PhysMake(seg,off); type = BKPNT_PHYSICAL; segment = seg; offset = off; };
|
||||
void SetAddress (Bit16u seg, Bit32u off) { location = GetAddress(seg,off); type = BKPNT_PHYSICAL; segment = seg; offset = off; };
|
||||
void SetAddress (PhysPt adr) { location = adr; type = BKPNT_PHYSICAL; };
|
||||
void SetInt (Bit8u _intNr, Bit16u ah) { intNr = _intNr, ahValue = ah; type = BKPNT_INTERRUPT; };
|
||||
void SetOnce (bool _once) { once = _once; };
|
||||
@ -161,6 +207,7 @@ public:
|
||||
static CBreakpoint* AddMemBreakpoint (Bit16u seg, Bit32u off);
|
||||
static void ActivateBreakpoints (PhysPt adr, bool activate);
|
||||
static bool CheckBreakpoint (PhysPt adr);
|
||||
static bool CheckBreakpoint (Bitu seg, Bitu off);
|
||||
static bool CheckIntBreakpoint (PhysPt adr, Bit8u intNr, Bit16u ahValue);
|
||||
static bool IsBreakpoint (PhysPt where);
|
||||
static bool IsBreakpointDrawn (PhysPt where);
|
||||
@ -214,6 +261,7 @@ void CBreakpoint::Activate(bool _active)
|
||||
// Statics
|
||||
std::list<CBreakpoint*> CBreakpoint::BPoints;
|
||||
CBreakpoint* CBreakpoint::ignoreOnce = 0;
|
||||
Bitu ignoreAddressOnce = 0;
|
||||
|
||||
CBreakpoint* CBreakpoint::AddBreakpoint(Bit16u seg, Bit32u off, bool once)
|
||||
{
|
||||
@ -259,15 +307,21 @@ void CBreakpoint::ActivateBreakpoints(PhysPt adr, bool activate)
|
||||
};
|
||||
};
|
||||
|
||||
bool CBreakpoint::CheckBreakpoint(PhysPt adr)
|
||||
bool CBreakpoint::CheckBreakpoint(Bitu seg, Bitu off)
|
||||
// Checks if breakpoint is valid an should stop execution
|
||||
{
|
||||
if ((ignoreAddressOnce!=0) && (GetAddress(seg,off)==ignoreAddressOnce)) {
|
||||
ignoreAddressOnce = 0;
|
||||
return false;
|
||||
} else
|
||||
ignoreAddressOnce = 0;
|
||||
|
||||
// Search matching breakpoint
|
||||
std::list<CBreakpoint*>::iterator i;
|
||||
CBreakpoint* bp;
|
||||
for(i=BPoints.begin(); i != BPoints.end(); i++) {
|
||||
bp = static_cast<CBreakpoint*>(*i);
|
||||
if ((bp->GetType()==BKPNT_PHYSICAL) && bp->IsActive() && (bp->GetLocation()==adr)) {
|
||||
if ((bp->GetType()==BKPNT_PHYSICAL) && bp->IsActive() && (bp->GetSegment()==seg) && (bp->GetOffset()==off)) {
|
||||
// Ignore Once ?
|
||||
if (ignoreOnce==bp) {
|
||||
ignoreOnce=0;
|
||||
@ -288,12 +342,14 @@ bool CBreakpoint::CheckBreakpoint(PhysPt adr)
|
||||
#if C_HEAVY_DEBUG
|
||||
// Memory breakpoint support
|
||||
else if ((bp->GetType()==BKPNT_MEMORY) && bp->IsActive()) {
|
||||
|
||||
Bit8u value = mem_readb(bp->GetLocation());
|
||||
|
||||
Bitu address = GetAddress(bp->GetSegment(),bp->GetOffset());
|
||||
// Bitu address = bp->GetSegment()*16 + bp->GetOffset();
|
||||
Bit8u value = mem_readb(address);
|
||||
if (bp->GetValue() != value) {
|
||||
// Yup, memory value changed
|
||||
|
||||
DEBUG_ShowMsg(0,"DEBUG: Memory breakpoint: %04X:%04X - %02X -> %02X",bp->GetSegment(),bp->GetOffset(),bp->GetValue(),value);
|
||||
DEBUG_ShowMsg("DEBUG: Memory breakpoint: %04X:%04X - %02X -> %02X",bp->GetSegment(),bp->GetOffset(),bp->GetValue(),value);
|
||||
bp->SetValue(value);
|
||||
return true;
|
||||
};
|
||||
@ -307,6 +363,12 @@ bool CBreakpoint::CheckBreakpoint(PhysPt adr)
|
||||
bool CBreakpoint::CheckIntBreakpoint(PhysPt adr, Bit8u intNr, Bit16u ahValue)
|
||||
// Checks if interrupt breakpoint is valid an should stop execution
|
||||
{
|
||||
if ((ignoreAddressOnce!=0) && (adr==ignoreAddressOnce)) {
|
||||
ignoreAddressOnce = 0;
|
||||
return false;
|
||||
} else
|
||||
ignoreAddressOnce = 0;
|
||||
|
||||
// Search matching breakpoint
|
||||
std::list<CBreakpoint*>::iterator i;
|
||||
CBreakpoint* bp;
|
||||
@ -371,7 +433,6 @@ bool CBreakpoint::DeleteByIndex(Bit16u index)
|
||||
bool CBreakpoint::DeleteBreakpoint(PhysPt where)
|
||||
{
|
||||
// Search matching breakpoint
|
||||
int nr = 0;
|
||||
std::list<CBreakpoint*>::iterator i;
|
||||
CBreakpoint* bp;
|
||||
for(i=BPoints.begin(); i != BPoints.end(); i++) {
|
||||
@ -394,6 +455,9 @@ bool CBreakpoint::IsBreakpoint(PhysPt adr)
|
||||
CBreakpoint* bp;
|
||||
for(i=BPoints.begin(); i != BPoints.end(); i++) {
|
||||
bp = static_cast<CBreakpoint*>(*i);
|
||||
if ((bp->GetType()==BKPNT_PHYSICAL) && (bp->GetSegment()==adr)) {
|
||||
return true;
|
||||
};
|
||||
if ((bp->GetType()==BKPNT_PHYSICAL) && (bp->GetLocation()==adr)) {
|
||||
return true;
|
||||
};
|
||||
@ -442,38 +506,42 @@ void CBreakpoint::ShowList(void)
|
||||
bool DEBUG_Breakpoint(void)
|
||||
{
|
||||
/* First get the phyiscal address and check for a set Breakpoint */
|
||||
PhysPt where=SegPhys(cs)+reg_eip-1;
|
||||
if (!CBreakpoint::CheckBreakpoint(where)) return false;
|
||||
// PhysPt where=SegPhys(cs)+reg_eip-1;
|
||||
PhysPt where=GetAddress(SegValue(cs),reg_eip-1);
|
||||
if (!CBreakpoint::CheckBreakpoint(SegValue(cs),reg_eip-1)) return false;
|
||||
// Found. Breakpoint is valid
|
||||
reg_eip -= 1;
|
||||
CBreakpoint::ActivateBreakpoints(SegPhys(cs)+reg_eip,false); // Deactivate all breakpoints
|
||||
exitLoop = true;
|
||||
DEBUG_Enable();
|
||||
CBreakpoint::ActivateBreakpoints(where,false); // Deactivate all breakpoints
|
||||
// exitLoop = true;
|
||||
// DEBUG_Enable();
|
||||
return true;
|
||||
};
|
||||
|
||||
bool DEBUG_IntBreakpoint(Bit8u intNum)
|
||||
{
|
||||
/* First get the phyiscal address and check for a set Breakpoint */
|
||||
PhysPt where=SegPhys(cs)+reg_eip-2;
|
||||
// PhysPt where=SegPhys(cs)+reg_eip-2;
|
||||
PhysPt where=GetAddress(SegValue(cs),reg_eip-2);
|
||||
if (!CBreakpoint::CheckIntBreakpoint(where,intNum,reg_ah)) return false;
|
||||
// Found. Breakpoint is valid
|
||||
reg_eip -= 2;
|
||||
CBreakpoint::ActivateBreakpoints(SegPhys(cs)+reg_eip,false); // Deactivate all breakpoints
|
||||
exitLoop = true;
|
||||
DEBUG_Enable();
|
||||
CBreakpoint::ActivateBreakpoints(where,false); // Deactivate all breakpoints
|
||||
// exitLoop = true;
|
||||
// DEBUG_Enable();
|
||||
return true;
|
||||
};
|
||||
|
||||
static bool StepOver()
|
||||
{
|
||||
PhysPt start=Segs[cs].phys+reg_eip;
|
||||
exitLoop = false;
|
||||
// PhysPt start=SegPhys(cs)+reg_eip;
|
||||
PhysPt start=GetAddress(SegValue(cs),reg_eip);
|
||||
char dline[200];Bitu size;
|
||||
size=DasmI386(dline, start, reg_eip, false);
|
||||
size=DasmI386(dline, start, reg_eip, cpu.code.big);
|
||||
|
||||
if (strstr(dline,"call") || strstr(dline,"int") || strstr(dline,"loop") || strstr(dline,"rep")) {
|
||||
CBreakpoint::AddBreakpoint (SegValue(cs),reg_eip+size, true);
|
||||
CBreakpoint::ActivateBreakpoints(SegPhys(cs)+reg_eip, true);
|
||||
CBreakpoint::ActivateBreakpoints(start, true);
|
||||
debugging=false;
|
||||
DrawCode();
|
||||
DOSBOX_SetNormalLoop();
|
||||
@ -497,13 +565,16 @@ bool DEBUG_ExitLoop(void)
|
||||
|
||||
static void DrawData(void) {
|
||||
|
||||
Bit16u add = dataOfs;
|
||||
Bit8u ch;
|
||||
Bit32u add = dataOfs;
|
||||
Bit32u address;
|
||||
/* Data win */
|
||||
for (int y=0; y<8; y++) {
|
||||
// Adress
|
||||
mvwprintw (dbg.win_data,1+y,0,"%04X:%04X ",dataSeg,add);
|
||||
for (int x=0; x<16; x++) {
|
||||
Bit8u ch = real_readb(dataSeg,add);
|
||||
address = GetAddress(dataSeg,add);
|
||||
if (address<8*1024*1024) ch = mem_readb(address); else ch = 0;
|
||||
mvwprintw (dbg.win_data,1+y,11+3*x,"%02X",ch);
|
||||
if (ch<32) ch='.';
|
||||
mvwprintw (dbg.win_data,1+y,60+x,"%c",ch);
|
||||
@ -535,17 +606,39 @@ static void DrawRegisters(void) {
|
||||
|
||||
/*Individual flags*/
|
||||
|
||||
flags.cf=get_CF();SetColor(flags.cf!=oldflags.cf);oldflags.cf=flags.cf;mvwprintw (dbg.win_reg,1,53,"%01X",flags.cf);
|
||||
flags.zf=get_ZF();SetColor(flags.zf!=oldflags.zf);oldflags.zf=flags.zf;mvwprintw (dbg.win_reg,1,56,"%01X",flags.zf);
|
||||
flags.sf=get_SF();SetColor(flags.sf!=oldflags.sf);oldflags.sf=flags.sf;mvwprintw (dbg.win_reg,1,59,"%01X",flags.sf);
|
||||
flags.of=get_OF();SetColor(flags.of!=oldflags.of);oldflags.of=flags.of;mvwprintw (dbg.win_reg,1,62,"%01X",flags.of);
|
||||
flags.af=get_AF();SetColor(flags.af!=oldflags.af);oldflags.af=flags.af;mvwprintw (dbg.win_reg,1,65,"%01X",flags.af);
|
||||
flags.pf=get_PF();SetColor(flags.pf!=oldflags.pf);oldflags.pf=flags.pf;mvwprintw (dbg.win_reg,1,68,"%01X",flags.pf);
|
||||
SetColor((flags.word ^ oldflags)&FLAG_CF);
|
||||
mvwprintw (dbg.win_reg,1,53,"%01X",GETFLAG(CF) ? 1:0);
|
||||
SetColor((flags.word ^ oldflags)&FLAG_ZF);
|
||||
mvwprintw (dbg.win_reg,1,56,"%01X",GETFLAG(ZF) ? 1:0);
|
||||
SetColor((flags.word ^ oldflags)&FLAG_SF);
|
||||
mvwprintw (dbg.win_reg,1,59,"%01X",GETFLAG(SF) ? 1:0);
|
||||
SetColor((flags.word ^ oldflags)&FLAG_OF);
|
||||
mvwprintw (dbg.win_reg,1,62,"%01X",GETFLAG(OF) ? 1:0);
|
||||
SetColor((flags.word ^ oldflags)&FLAG_AF);
|
||||
mvwprintw (dbg.win_reg,1,65,"%01X",GETFLAG(AF) ? 1:0);
|
||||
SetColor((flags.word ^ oldflags)&FLAG_PF);
|
||||
mvwprintw (dbg.win_reg,1,68,"%01X",GETFLAG(PF) ? 1:0);
|
||||
|
||||
|
||||
SetColor(flags.df!=oldflags.df);oldflags.df=flags.df;mvwprintw (dbg.win_reg,1,71,"%01X",flags.df);
|
||||
SetColor(flags.intf!=oldflags.intf);oldflags.intf=flags.intf;mvwprintw (dbg.win_reg,1,74,"%01X",flags.intf);
|
||||
SetColor(flags.tf!=oldflags.tf);oldflags.tf=flags.tf;mvwprintw (dbg.win_reg,1,77,"%01X",flags.tf);
|
||||
SetColor((flags.word ^ oldflags)&FLAG_DF);
|
||||
mvwprintw (dbg.win_reg,1,71,"%01X",GETFLAG(DF) ? 1:0);
|
||||
SetColor((flags.word ^ oldflags)&FLAG_IF);
|
||||
mvwprintw (dbg.win_reg,1,74,"%01X",GETFLAG(IF) ? 1:0);
|
||||
SetColor((flags.word ^ oldflags)&FLAG_TF);
|
||||
mvwprintw (dbg.win_reg,1,77,"%01X",GETFLAG(TF) ? 1:0);
|
||||
|
||||
oldflags=flags.word;
|
||||
|
||||
if (cpu.pmode) mvwprintw(dbg.win_reg,0,76,"Prot");
|
||||
else mvwprintw(dbg.win_reg,0,76,"Real");
|
||||
|
||||
// Selector info, if available
|
||||
if ((cpu.pmode) && curSelectorName[0]) {
|
||||
char out1[200], out2[200];
|
||||
GetDescriptorInfo(curSelectorName,out1,out2);
|
||||
mvwprintw(dbg.win_reg,2,28,out1);
|
||||
mvwprintw(dbg.win_reg,3,28,out2);
|
||||
}
|
||||
|
||||
wattrset(dbg.win_reg,0);
|
||||
mvwprintw(dbg.win_reg,3,60,"%d ",cycle_count);
|
||||
@ -554,11 +647,13 @@ static void DrawRegisters(void) {
|
||||
|
||||
static void DrawCode(void)
|
||||
{
|
||||
bool saveSel;
|
||||
Bit32u disEIP = codeViewData.useEIP;
|
||||
PhysPt start = codeViewData.useCS*16 + codeViewData.useEIP;
|
||||
PhysPt start = GetAddress(codeViewData.useCS,codeViewData.useEIP);
|
||||
char dline[200];Bitu size;Bitu c;
|
||||
|
||||
for (Bit32u i=0;i<10;i++) {
|
||||
for (int i=0;i<10;i++) {
|
||||
saveSel = false;
|
||||
if (has_colors()) {
|
||||
if ((codeViewData.useCS==SegValue(cs)) && (disEIP == reg_eip)) {
|
||||
wattrset(dbg.win_code,COLOR_PAIR(PAIR_GREEN_BLACK));
|
||||
@ -567,10 +662,12 @@ static void DrawCode(void)
|
||||
codeViewData.cursorSeg = SegValue(cs);
|
||||
codeViewData.cursorOfs = disEIP;
|
||||
}
|
||||
saveSel = (i == codeViewData.cursorPos);
|
||||
} else if (i == codeViewData.cursorPos) {
|
||||
wattrset(dbg.win_code,COLOR_PAIR(PAIR_BLACK_GREY));
|
||||
codeViewData.cursorSeg = codeViewData.useCS;
|
||||
codeViewData.cursorOfs = disEIP;
|
||||
saveSel = true;
|
||||
} else if (CBreakpoint::IsBreakpointDrawn(start)) {
|
||||
wattrset(dbg.win_code,COLOR_PAIR(PAIR_GREY_RED));
|
||||
} else {
|
||||
@ -578,15 +675,20 @@ static void DrawCode(void)
|
||||
}
|
||||
}
|
||||
|
||||
size=DasmI386(dline, start, disEIP, false);
|
||||
|
||||
Bitu drawsize=size=DasmI386(dline, start, disEIP, cpu.code.big);
|
||||
bool toolarge = false;
|
||||
mvwprintw(dbg.win_code,i,0,"%04X:%04X ",codeViewData.useCS,disEIP);
|
||||
for (c=0;c<size;c++) wprintw(dbg.win_code,"%02X",mem_readb(start+c));
|
||||
for (c=20;c>=size*2;c--) waddch(dbg.win_code,' ');
|
||||
|
||||
if (drawsize>10) { toolarge = true; drawsize = 9; };
|
||||
for (c=0;c<drawsize;c++) wprintw(dbg.win_code,"%02X",mem_readb(start+c));
|
||||
if (toolarge) { wprintw(dbg.win_code,".."); drawsize++; };
|
||||
for (c=20;c>=drawsize*2;c--) waddch(dbg.win_code,' ');
|
||||
|
||||
char* res = 0;
|
||||
if (showExtend) res = AnalyzeInstruction(dline);
|
||||
if (showExtend) res = AnalyzeInstruction(dline, saveSel);
|
||||
waddstr(dbg.win_code,dline);
|
||||
for (c=28-strlen(dline);c>0;c--) waddch(dbg.win_code,' ');
|
||||
if (strlen(dline)<28) for (c=28-strlen(dline);c>0;c--) waddch(dbg.win_code,' ');
|
||||
if (showExtend) {
|
||||
waddstr(dbg.win_code,res);
|
||||
for (c=strlen(res);c<20;c++) waddch(dbg.win_code,' ');
|
||||
@ -639,6 +741,15 @@ Bit32u GetHexValue(char* str, char*& hex)
|
||||
|
||||
hex = str;
|
||||
while (*hex==' ') hex++;
|
||||
if (strstr(hex,"EAX")==hex) { hex+=3; return reg_eax; };
|
||||
if (strstr(hex,"EBX")==hex) { hex+=3; return reg_ebx; };
|
||||
if (strstr(hex,"ECX")==hex) { hex+=3; return reg_ecx; };
|
||||
if (strstr(hex,"EDX")==hex) { hex+=3; return reg_edx; };
|
||||
if (strstr(hex,"ESI")==hex) { hex+=3; return reg_esi; };
|
||||
if (strstr(hex,"EDI")==hex) { hex+=3; return reg_edi; };
|
||||
if (strstr(hex,"EBP")==hex) { hex+=3; return reg_ebp; };
|
||||
if (strstr(hex,"ESP")==hex) { hex+=3; return reg_esp; };
|
||||
if (strstr(hex,"EIP")==hex) { hex+=3; return reg_eip; };
|
||||
if (strstr(hex,"AX")==hex) { hex+=2; return reg_ax; };
|
||||
if (strstr(hex,"BX")==hex) { hex+=2; return reg_bx; };
|
||||
if (strstr(hex,"CX")==hex) { hex+=2; return reg_cx; };
|
||||
@ -654,15 +765,6 @@ Bit32u GetHexValue(char* str, char*& hex)
|
||||
if (strstr(hex,"FS")==hex) { hex+=2; return SegValue(fs); };
|
||||
if (strstr(hex,"GS")==hex) { hex+=2; return SegValue(gs); };
|
||||
if (strstr(hex,"SS")==hex) { hex+=2; return SegValue(ss); };
|
||||
if (strstr(hex,"EAX")==hex) { hex+=3; return reg_eax; };
|
||||
if (strstr(hex,"EBX")==hex) { hex+=3; return reg_ebx; };
|
||||
if (strstr(hex,"ECX")==hex) { hex+=3; return reg_ecx; };
|
||||
if (strstr(hex,"EDX")==hex) { hex+=3; return reg_edx; };
|
||||
if (strstr(hex,"ESI")==hex) { hex+=3; return reg_esi; };
|
||||
if (strstr(hex,"EDI")==hex) { hex+=3; return reg_edi; };
|
||||
if (strstr(hex,"EBP")==hex) { hex+=3; return reg_ebp; };
|
||||
if (strstr(hex,"ESP")==hex) { hex+=3; return reg_esp; };
|
||||
if (strstr(hex,"EIP")==hex) { hex+=3; return reg_eip; };
|
||||
|
||||
while (*hex) {
|
||||
if ((*hex>='0') && (*hex<='9')) value = (value<<4)+*hex-'0'; else
|
||||
@ -675,10 +777,17 @@ Bit32u GetHexValue(char* str, char*& hex)
|
||||
|
||||
bool ChangeRegister(char* str)
|
||||
{
|
||||
Bit32u value = 0;
|
||||
|
||||
char* hex = str;
|
||||
while (*hex==' ') hex++;
|
||||
if (strstr(hex,"EAX")==hex) { hex+=3; reg_eax = GetHexValue(hex,hex); } else
|
||||
if (strstr(hex,"EBX")==hex) { hex+=3; reg_ebx = GetHexValue(hex,hex); } else
|
||||
if (strstr(hex,"ECX")==hex) { hex+=3; reg_ecx = GetHexValue(hex,hex); } else
|
||||
if (strstr(hex,"EDX")==hex) { hex+=3; reg_edx = GetHexValue(hex,hex); } else
|
||||
if (strstr(hex,"ESI")==hex) { hex+=3; reg_esi = GetHexValue(hex,hex); } else
|
||||
if (strstr(hex,"EDI")==hex) { hex+=3; reg_edi = GetHexValue(hex,hex); } else
|
||||
if (strstr(hex,"EBP")==hex) { hex+=3; reg_ebp = GetHexValue(hex,hex); } else
|
||||
if (strstr(hex,"ESP")==hex) { hex+=3; reg_esp = GetHexValue(hex,hex); } else
|
||||
if (strstr(hex,"EIP")==hex) { hex+=3; reg_eip = GetHexValue(hex,hex); } else
|
||||
if (strstr(hex,"AX")==hex) { hex+=2; reg_ax = GetHexValue(hex,hex); } else
|
||||
if (strstr(hex,"BX")==hex) { hex+=2; reg_bx = GetHexValue(hex,hex); } else
|
||||
if (strstr(hex,"CX")==hex) { hex+=2; reg_cx = GetHexValue(hex,hex); } else
|
||||
@ -694,22 +803,13 @@ bool ChangeRegister(char* str)
|
||||
if (strstr(hex,"FS")==hex) { hex+=2; SegSet16(fs,GetHexValue(hex,hex)); } else
|
||||
if (strstr(hex,"GS")==hex) { hex+=2; SegSet16(gs,GetHexValue(hex,hex)); } else
|
||||
if (strstr(hex,"SS")==hex) { hex+=2; SegSet16(ss,GetHexValue(hex,hex)); } else
|
||||
if (strstr(hex,"EAX")==hex) { hex+=3; reg_eax = GetHexValue(hex,hex); } else
|
||||
if (strstr(hex,"EBX")==hex) { hex+=3; reg_ebx = GetHexValue(hex,hex); } else
|
||||
if (strstr(hex,"ECX")==hex) { hex+=3; reg_ecx = GetHexValue(hex,hex); } else
|
||||
if (strstr(hex,"EDX")==hex) { hex+=3; reg_edx = GetHexValue(hex,hex); } else
|
||||
if (strstr(hex,"ESI")==hex) { hex+=3; reg_esi = GetHexValue(hex,hex); } else
|
||||
if (strstr(hex,"EDI")==hex) { hex+=3; reg_edi = GetHexValue(hex,hex); } else
|
||||
if (strstr(hex,"EBP")==hex) { hex+=3; reg_ebp = GetHexValue(hex,hex); } else
|
||||
if (strstr(hex,"ESP")==hex) { hex+=3; reg_esp = GetHexValue(hex,hex); } else
|
||||
if (strstr(hex,"EIP")==hex) { hex+=3; reg_eip = GetHexValue(hex,hex); } else
|
||||
if (strstr(hex,"AF")==hex) { hex+=2; flags.af = (GetHexValue(hex,hex)!=0); } else
|
||||
if (strstr(hex,"CF")==hex) { hex+=2; flags.cf = (GetHexValue(hex,hex)!=0); } else
|
||||
if (strstr(hex,"DF")==hex) { hex+=2; flags.df = (GetHexValue(hex,hex)!=0); } else
|
||||
if (strstr(hex,"IF")==hex) { hex+=2; flags.intf = (GetHexValue(hex,hex)!=0); } else
|
||||
if (strstr(hex,"OF")==hex) { hex+=3; flags.of = (GetHexValue(hex,hex)!=0); } else
|
||||
if (strstr(hex,"ZF")==hex) { hex+=3; flags.zf = (GetHexValue(hex,hex)!=0); } else
|
||||
if (strstr(hex,"PF")==hex) { hex+=3; flags.pf = (GetHexValue(hex,hex)!=0); } else
|
||||
if (strstr(hex,"AF")==hex) { hex+=2; SETFLAGBIT(AF,GetHexValue(hex,hex)); } else
|
||||
if (strstr(hex,"CF")==hex) { hex+=2; SETFLAGBIT(CF,GetHexValue(hex,hex)); } else
|
||||
if (strstr(hex,"DF")==hex) { hex+=2; SETFLAGBIT(PF,GetHexValue(hex,hex)); } else
|
||||
if (strstr(hex,"IF")==hex) { hex+=2; SETFLAGBIT(IF,GetHexValue(hex,hex)); } else
|
||||
if (strstr(hex,"OF")==hex) { hex+=3; SETFLAGBIT(OF,GetHexValue(hex,hex)); } else
|
||||
if (strstr(hex,"ZF")==hex) { hex+=3; SETFLAGBIT(ZF,GetHexValue(hex,hex)); } else
|
||||
if (strstr(hex,"PF")==hex) { hex+=3; SETFLAGBIT(PF,GetHexValue(hex,hex)); } else
|
||||
{ return false; };
|
||||
return true;
|
||||
};
|
||||
@ -744,8 +844,8 @@ bool ParseCommand(char* str)
|
||||
};
|
||||
name[15] = 0;
|
||||
|
||||
DEBUG_ShowMsg(0,"DEBUG: Created debug var %s at %04X:%04X",name,seg,ofs);
|
||||
CDebugVar::InsertVariable(name,PhysMake(seg,ofs));
|
||||
DEBUG_ShowMsg("DEBUG: Created debug var %s at %04X:%04X",name,seg,ofs);
|
||||
CDebugVar::InsertVariable(name,GetAddress(seg,ofs));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -758,13 +858,13 @@ bool ParseCommand(char* str)
|
||||
else { name[i] = 0; break; };
|
||||
};
|
||||
name[12] = 0;
|
||||
if (CDebugVar::SaveVars(name)) DEBUG_ShowMsg(0,"DEBUG: Variable list save (%s) : ok.",name);
|
||||
else DEBUG_ShowMsg(0,"DEBUG: Variable list save (%s) : failure",name);
|
||||
if (CDebugVar::SaveVars(name)) DEBUG_ShowMsg("DEBUG: Variable list save (%s) : ok.",name);
|
||||
else DEBUG_ShowMsg("DEBUG: Variable list save (%s) : failure",name);
|
||||
return true;
|
||||
}
|
||||
|
||||
found = strstr(str,"LV ");
|
||||
if (found) { // Save variables
|
||||
if (found) { // load variables
|
||||
found+=3;
|
||||
char name[13];
|
||||
for (int i=0; i<12; i++) {
|
||||
@ -772,8 +872,8 @@ bool ParseCommand(char* str)
|
||||
else { name[i] = 0; break; };
|
||||
};
|
||||
name[12] = 0;
|
||||
if (CDebugVar::LoadVars(name)) DEBUG_ShowMsg(0,"DEBUG: Variable list load (%s) : ok.",name);
|
||||
else DEBUG_ShowMsg(0,"DEBUG: Variable list load (%s) : failure",name);
|
||||
if (CDebugVar::LoadVars(name)) DEBUG_ShowMsg("DEBUG: Variable list load (%s) : ok.",name);
|
||||
else DEBUG_ShowMsg("DEBUG: Variable list load (%s) : failure",name);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -783,7 +883,7 @@ bool ParseCommand(char* str)
|
||||
Bit16u seg = GetHexValue(found,found);found++; // skip ":"
|
||||
Bit32u ofs = GetHexValue(found,found);
|
||||
CBreakpoint::AddBreakpoint(seg,ofs,false);
|
||||
DEBUG_ShowMsg(0,"DEBUG: Set breakpoint at %04X:%04X",seg,ofs);
|
||||
DEBUG_ShowMsg("DEBUG: Set breakpoint at %04X:%04X",seg,ofs);
|
||||
return true;
|
||||
}
|
||||
#if C_HEAVY_DEBUG
|
||||
@ -793,7 +893,7 @@ bool ParseCommand(char* str)
|
||||
Bit16u seg = GetHexValue(found,found);found++; // skip ":"
|
||||
Bit32u ofs = GetHexValue(found,found);
|
||||
CBreakpoint::AddMemBreakpoint(seg,ofs);
|
||||
DEBUG_ShowMsg(0,"DEBUG: Set memory breakpoint at %04X:%04X",seg,ofs);
|
||||
DEBUG_ShowMsg("DEBUG: Set memory breakpoint at %04X:%04X",seg,ofs);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
@ -804,10 +904,10 @@ bool ParseCommand(char* str)
|
||||
Bit8u valAH = GetHexValue(found,found);
|
||||
if ((valAH==0x00) && (*found=='*')) {
|
||||
CBreakpoint::AddIntBreakpoint(intNr,BPINT_ALL,false);
|
||||
DEBUG_ShowMsg(0,"DEBUG: Set interrupt breakpoint at INT %02X",intNr);
|
||||
DEBUG_ShowMsg("DEBUG: Set interrupt breakpoint at INT %02X",intNr);
|
||||
} else {
|
||||
CBreakpoint::AddIntBreakpoint(intNr,valAH,false);
|
||||
DEBUG_ShowMsg(0,"DEBUG: Set interrupt breakpoint at INT %02X AH=%02X",intNr,valAH);
|
||||
DEBUG_ShowMsg("DEBUG: Set interrupt breakpoint at INT %02X AH=%02X",intNr,valAH);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -815,7 +915,6 @@ bool ParseCommand(char* str)
|
||||
if (found) {
|
||||
wprintw(dbg.win_out,"Breakpoint list:\n");
|
||||
wprintw(dbg.win_out,"-------------------------------------------------------------------------\n");
|
||||
Bit32u nr = 0;
|
||||
CBreakpoint::ShowList();
|
||||
return true;
|
||||
};
|
||||
@ -826,7 +925,7 @@ bool ParseCommand(char* str)
|
||||
Bit8u bpNr = GetHexValue(found,found);
|
||||
if ((bpNr==0x00) && (*found=='*')) { // Delete all
|
||||
CBreakpoint::DeleteAll();
|
||||
DEBUG_ShowMsg(0,"DEBUG: Breakpoints deleted.");
|
||||
DEBUG_ShowMsg("DEBUG: Breakpoints deleted.");
|
||||
} else {
|
||||
// delete single breakpoint
|
||||
CBreakpoint::DeleteByIndex(bpNr);
|
||||
@ -838,7 +937,7 @@ bool ParseCommand(char* str)
|
||||
found++;
|
||||
Bit16u codeSeg = GetHexValue(found,found); found++;
|
||||
Bit32u codeOfs = GetHexValue(found,found);
|
||||
DEBUG_ShowMsg(0,"DEBUG: Set code overview to %04X:%04X",codeSeg,codeOfs);
|
||||
DEBUG_ShowMsg("DEBUG: Set code overview to %04X:%04X",codeSeg,codeOfs);
|
||||
codeViewData.useCS = codeSeg;
|
||||
codeViewData.useEIP = codeOfs;
|
||||
return true;
|
||||
@ -848,22 +947,22 @@ bool ParseCommand(char* str)
|
||||
found++;
|
||||
dataSeg = GetHexValue(found,found); found++;
|
||||
dataOfs = GetHexValue(found,found);
|
||||
DEBUG_ShowMsg(0,"DEBUG: Set data overview to %04X:%04X",dataSeg,dataOfs);
|
||||
DEBUG_ShowMsg("DEBUG: Set data overview to %04X:%04X",dataSeg,dataOfs);
|
||||
return true;
|
||||
}
|
||||
found = strstr(str,"LOG ");
|
||||
if (found) { // Create Cpu log file
|
||||
found+=4;
|
||||
DEBUG_ShowMsg(0,"DEBUG: Starting log");
|
||||
DEBUG_ShowMsg("DEBUG: Starting log");
|
||||
DEBUG_Log_Loop(GetHexValue(found,found));
|
||||
DEBUG_ShowMsg(0,"DEBUG: Logfile LOGCPU.TXT created.");
|
||||
DEBUG_ShowMsg("DEBUG: Logfile LOGCPU.TXT created.");
|
||||
return true;
|
||||
}
|
||||
found = strstr(str,"SR ");
|
||||
if (found) { // Set register value
|
||||
found+=2;
|
||||
if (ChangeRegister(found)) DEBUG_ShowMsg(0,"DEBUG: Set Register success.");
|
||||
else DEBUG_ShowMsg(0,"DEBUG: Set Register failure.");
|
||||
if (ChangeRegister(found)) DEBUG_ShowMsg("DEBUG: Set Register success.");
|
||||
else DEBUG_ShowMsg("DEBUG: Set Register failure.");
|
||||
return true;
|
||||
}
|
||||
found = strstr(str,"SM ");
|
||||
@ -876,18 +975,18 @@ bool ParseCommand(char* str)
|
||||
while (*found==' ') found++;
|
||||
if (*found) {
|
||||
Bit8u value = GetHexValue(found,found); found++;
|
||||
mem_writeb(PhysMake(seg,ofs+count),value);
|
||||
mem_writeb(GetAddress(seg,ofs+count),value);
|
||||
count++;
|
||||
}
|
||||
};
|
||||
DEBUG_ShowMsg(0,"DEBUG: Memory changed.");
|
||||
DEBUG_ShowMsg("DEBUG: Memory changed.");
|
||||
return true;
|
||||
}
|
||||
found = strstr(str,"INTT ");
|
||||
if (found) { // Create Cpu log file
|
||||
found+=4;
|
||||
Bit8u intNr = GetHexValue(found,found);
|
||||
DEBUG_ShowMsg(0,"DEBUG: Tracing INT %02X",intNr);
|
||||
DEBUG_ShowMsg("DEBUG: Tracing INT %02X",intNr);
|
||||
Interrupt(intNr);
|
||||
SetCodeWinStart();
|
||||
return true;
|
||||
@ -896,7 +995,7 @@ bool ParseCommand(char* str)
|
||||
if (found) { // Create Cpu log file
|
||||
found+=4;
|
||||
Bit8u intNr = GetHexValue(found,found);
|
||||
DEBUG_ShowMsg(0,"DEBUG: Starting INT %02X",intNr);
|
||||
DEBUG_ShowMsg("DEBUG: Starting INT %02X",intNr);
|
||||
CBreakpoint::AddBreakpoint (SegValue(cs),reg_eip, true);
|
||||
CBreakpoint::ActivateBreakpoints(SegPhys(cs)+reg_eip-1,true);
|
||||
debugging=false;
|
||||
@ -905,13 +1004,32 @@ bool ParseCommand(char* str)
|
||||
Interrupt(intNr);
|
||||
return true;
|
||||
}
|
||||
found = strstr(str,"SELINFO ");
|
||||
if (found) {
|
||||
found += 8;
|
||||
while (found[0]==' ') found++;
|
||||
char out1[200],out2[200];
|
||||
GetDescriptorInfo(found,out1,out2);
|
||||
DEBUG_ShowMsg("SelectorInfo %s:",found);
|
||||
DEBUG_ShowMsg("%s",out1);
|
||||
DEBUG_ShowMsg("%s",out2);
|
||||
};
|
||||
|
||||
/* found = strstr(str,"EXCEPTION ");
|
||||
if (found) {
|
||||
found += 9;
|
||||
Bit8u num = GetHexValue(found,found);
|
||||
DPMI_CreateException(num,0xDD);
|
||||
DEBUG_ShowMsg("Exception %04X",num);
|
||||
};
|
||||
*/
|
||||
|
||||
#if C_HEAVY_DEBUG
|
||||
found = strstr(str,"HEAVYLOG");
|
||||
if (found) { // Create Cpu log file
|
||||
logHeavy = !logHeavy;
|
||||
if (logHeavy) DEBUG_ShowMsg(0,"DEBUG: Heavy cpu logging on.");
|
||||
else DEBUG_ShowMsg(0,"DEBUG: Heavy cpu logging off.");
|
||||
if (logHeavy) DEBUG_ShowMsg("DEBUG: Heavy cpu logging on.");
|
||||
else DEBUG_ShowMsg("DEBUG: Heavy cpu logging off.");
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
@ -950,6 +1068,7 @@ bool ParseCommand(char* str)
|
||||
wprintw(dbg.win_out,"LV [seg]:[off] [name] - Load var list from file\n");
|
||||
|
||||
wprintw(dbg.win_out,"MEMDUMP [seg]:[off] [len] - Write memory to file memdump.txt\n");
|
||||
wprintw(dbg.win_out,"SELINFO [segName] - Show selector info\n");
|
||||
wprintw(dbg.win_out,"H - Help\n");
|
||||
|
||||
wrefresh(dbg.win_out);
|
||||
@ -958,7 +1077,7 @@ bool ParseCommand(char* str)
|
||||
return false;
|
||||
};
|
||||
|
||||
char* AnalyzeInstruction(char* inst)
|
||||
char* AnalyzeInstruction(char* inst, bool saveSelector)
|
||||
{
|
||||
static char result[256];
|
||||
|
||||
@ -1001,19 +1120,28 @@ char* AnalyzeInstruction(char* inst)
|
||||
} else
|
||||
pos++;
|
||||
};
|
||||
switch (DasmLastOperandSize()) {
|
||||
case 8 : { Bit8u val = mem_readb( PhysMake (seg,adr) );
|
||||
sprintf(result,"%s:[%04X]=%02X",prefix,adr,val);
|
||||
Bit32u address = GetAddress(seg,adr);
|
||||
// if (address<(XMS_GetSize()+1)*1024*1024) {
|
||||
static char outmask[] = "%s:[%04X]=%02X";
|
||||
|
||||
if (cpu.pmode) outmask[6] = '8';
|
||||
switch (DasmLastOperandSize()) {
|
||||
case 8 : { Bit8u val = mem_readb(address);
|
||||
outmask[12] = '2';
|
||||
sprintf(result,outmask,prefix,adr,val);
|
||||
} break;
|
||||
case 16: { Bit16u val = mem_readw( PhysMake (seg,adr) );
|
||||
sprintf(result,"%s:[%04X]=%04X",prefix,adr,val);
|
||||
case 16: { Bit16u val = mem_readw(address);
|
||||
outmask[12] = '4';
|
||||
sprintf(result,outmask,prefix,adr,val);
|
||||
} break;
|
||||
case 32: { Bit32u val = mem_readd( PhysMake (seg,adr) );
|
||||
sprintf(result,"%s:[%04X]=%08X",prefix,adr,val);
|
||||
case 32: { Bit32u val = mem_readd(address);
|
||||
outmask[12] = '8';
|
||||
sprintf(result,outmask,prefix,adr,val);
|
||||
} break;
|
||||
}
|
||||
// }
|
||||
// Variable found ?
|
||||
CDebugVar* var = CDebugVar::FindVar(PhysMake(seg,adr));
|
||||
CDebugVar* var = CDebugVar::FindVar(address);
|
||||
if (var) {
|
||||
// Replace occurance
|
||||
char* pos1 = strchr(inst,'[');
|
||||
@ -1026,6 +1154,10 @@ char* AnalyzeInstruction(char* inst)
|
||||
strcat(inst,temp); // add end
|
||||
};
|
||||
};
|
||||
// show descriptor info, if available
|
||||
if ((cpu.pmode) && saveSelector) {
|
||||
strcpy(curSelectorName,prefix);
|
||||
};
|
||||
};
|
||||
return result;
|
||||
};
|
||||
@ -1106,7 +1238,7 @@ Bit32u DEBUG_CheckKeys(void) {
|
||||
ParseCommand(codeViewData.inputStr);
|
||||
break;
|
||||
case 'T' : DEBUG_RaiseTimerIrq();
|
||||
DEBUG_ShowMsg(0,"Debug: Timer Int started.");
|
||||
DEBUG_ShowMsg("Debug: Timer Int started.");
|
||||
break;
|
||||
case 'V' : showExtend = !showExtend;
|
||||
break;
|
||||
@ -1125,11 +1257,12 @@ Bit32u DEBUG_CheckKeys(void) {
|
||||
break;
|
||||
case KEY_F(5): // Run Programm
|
||||
debugging=false;
|
||||
CBreakpoint::ActivateBreakpoints(SegPhys(cs)+reg_eip,true);
|
||||
CBreakpoint::ActivateBreakpoints(SegPhys(cs)+reg_eip,true);
|
||||
ignoreAddressOnce = SegPhys(cs)+reg_eip;
|
||||
DOSBOX_SetNormalLoop();
|
||||
break;
|
||||
case KEY_F(9): // Set/Remove TBreakpoint
|
||||
{ PhysPt ptr = PhysMake(codeViewData.cursorSeg,codeViewData.cursorOfs);
|
||||
{ PhysPt ptr = GetAddress(codeViewData.cursorSeg,codeViewData.cursorOfs);
|
||||
if (CBreakpoint::IsBreakpoint(ptr)) CBreakpoint::DeleteBreakpoint(ptr);
|
||||
else CBreakpoint::AddBreakpoint(codeViewData.cursorSeg, codeViewData.cursorOfs, false);
|
||||
}
|
||||
@ -1137,26 +1270,25 @@ Bit32u DEBUG_CheckKeys(void) {
|
||||
case KEY_F(10): // Step over inst
|
||||
if (StepOver()) return 0;
|
||||
else {
|
||||
exitLoop = false;
|
||||
skipFirstInstruction = true; // for heavy debugger
|
||||
CPU_Cycles = 1;
|
||||
Bitu ret=(*cpudecoder)();
|
||||
if (ret>0) ret=(*CallBack_Handlers[ret])();
|
||||
SetCodeWinStart();
|
||||
CBreakpoint::ignoreOnce = 0;
|
||||
}
|
||||
break;
|
||||
case KEY_F(11): // trace into
|
||||
exitLoop = false;
|
||||
skipFirstInstruction = true; // for heavy debugger
|
||||
CPU_Cycles = 1;
|
||||
ret = (*cpudecoder)();
|
||||
if (ret>0) ret=(*CallBack_Handlers[ret])();
|
||||
SetCodeWinStart();
|
||||
CBreakpoint::ignoreOnce = 0;
|
||||
break;
|
||||
|
||||
// default:
|
||||
// // FIXME : Is this correct ?
|
||||
// if (key<0x200) ret=(*cpudecoder)(1);
|
||||
// break;
|
||||
};
|
||||
}
|
||||
DEBUG_DrawScreen();
|
||||
}
|
||||
return ret;
|
||||
@ -1176,7 +1308,6 @@ Bitu DEBUG_Loop(void) {
|
||||
DOSBOX_SetNormalLoop();
|
||||
return 0;
|
||||
}
|
||||
|
||||
return DEBUG_CheckKeys();
|
||||
}
|
||||
|
||||
@ -1189,9 +1320,9 @@ void DEBUG_Enable(void) {
|
||||
}
|
||||
|
||||
void DEBUG_DrawScreen(void) {
|
||||
DrawRegisters();
|
||||
DrawData();
|
||||
DrawCode();
|
||||
DrawRegisters();
|
||||
}
|
||||
static void DEBUG_RaiseTimerIrq(void) {
|
||||
PIC_ActivateIRQ(0);
|
||||
@ -1201,19 +1332,21 @@ static void LogInstruction(Bit16u segValue, Bit32u eipValue, char* buffer)
|
||||
{
|
||||
static char empty[15] = { 32,32,32,32,32,32,32,32,32,32,32,32,32,32,0 };
|
||||
|
||||
PhysPt start = PhysMake(segValue,eipValue);
|
||||
PhysPt start = GetAddress(segValue,eipValue);
|
||||
char dline[200];Bitu size;
|
||||
size = DasmI386(dline, start, reg_eip, false);
|
||||
size = DasmI386(dline, start, reg_eip, cpu.code.big);
|
||||
Bitu len = strlen(dline);
|
||||
char* res = empty;
|
||||
if (showExtend) {
|
||||
res = AnalyzeInstruction(dline);
|
||||
res = AnalyzeInstruction(dline,false);
|
||||
if (!res || (strlen(res)==0)) res = empty;
|
||||
};
|
||||
|
||||
if (len<30) for (Bitu i=0; i<30-len; i++) strcat(dline," ");
|
||||
// Get register values
|
||||
sprintf(buffer,"%04X:%08X %s %s EAX:%08X EBX:%08X ECX:%08X EDX:%08X ESI:%08X EDI:%08X EBP:%08X ESP:%08X DS:%04X ES:%04X FS:%04X GS:%04X SS:%04X CF:%01X ZF:%01X SF:%01X OF:%01X AF:%01X PF:%01X\n",segValue,eipValue,dline,res,reg_eax,reg_ebx,reg_ecx,reg_edx,reg_esi,reg_edi,reg_ebp,reg_esp,SegValue(ds),SegValue(es),SegValue(fs),SegValue(gs),SegValue(ss),get_CF(),get_ZF(),get_SF(),get_OF(),get_AF(),get_PF());
|
||||
|
||||
sprintf(buffer,"%04X:%08X %s %s EAX:%08X EBX:%08X ECX:%08X EDX:%08X ESI:%08X EDI:%08X EBP:%08X ESP:%08X DS:%04X ES:%04X FS:%04X GS:%04X SS:%04X CF:%01X ZF:%01X SF:%01X OF:%01X AF:%01X PF:%01X\n",segValue,eipValue,dline,res,reg_eax,reg_ebx,reg_ecx,reg_edx,reg_esi,reg_edi,reg_ebp,reg_esp,SegValue(ds),SegValue(es),SegValue(fs),SegValue(gs),SegValue(ss),
|
||||
GETFLAGBOOL(CF),GETFLAGBOOL(ZF),GETFLAGBOOL(SF),GETFLAGBOOL(OF),GETFLAGBOOL(AF),GETFLAGBOOL(PF));
|
||||
};
|
||||
|
||||
static bool DEBUG_Log_Loop(int count) {
|
||||
@ -1237,7 +1370,8 @@ static bool DEBUG_Log_Loop(int count) {
|
||||
|
||||
CPU_Cycles = 1;
|
||||
ret=(*cpudecoder)();
|
||||
|
||||
if (ret>0) ret=(*CallBack_Handlers[ret])();
|
||||
|
||||
count--;
|
||||
if (count==0) break;
|
||||
|
||||
@ -1312,6 +1446,13 @@ void DEBUG_CheckExecuteBreakpoint(Bit16u seg, Bit32u off)
|
||||
};
|
||||
};
|
||||
|
||||
Bitu DEBUG_EnableDebugger(void)
|
||||
{
|
||||
exitLoop = true;
|
||||
DEBUG_Enable();
|
||||
return 0;
|
||||
};
|
||||
|
||||
static void DEBUG_ProgramStart(Program * * make) {
|
||||
*make=new DEBUG;
|
||||
}
|
||||
@ -1347,6 +1488,8 @@ static void DEBUG_ShutDown(Section * sec)
|
||||
#endif
|
||||
};
|
||||
|
||||
Bitu debugCallback;
|
||||
|
||||
void DEBUG_Init(Section* sec) {
|
||||
|
||||
MSG_Add("DEBUG_CONFIGFILE_HELP","Nothing to setup yet!\n");
|
||||
@ -1358,6 +1501,9 @@ void DEBUG_Init(Section* sec) {
|
||||
memset((void*)&codeViewData,0,sizeof(codeViewData));
|
||||
/* setup debug.com */
|
||||
PROGRAMS_MakeFile("DEBUG.COM",DEBUG_ProgramStart);
|
||||
/* Setup callback */
|
||||
debugCallback=CALLBACK_Allocate();
|
||||
CALLBACK_Setup(debugCallback,DEBUG_EnableDebugger,CB_RETF);
|
||||
/* shutdown function */
|
||||
sec->AddDestroyFunction(&DEBUG_ShutDown);
|
||||
}
|
||||
@ -1441,7 +1587,7 @@ void SaveMemory(Bit16u seg, Bit16u ofs1, Bit32s num)
|
||||
{
|
||||
FILE* f = fopen("MEMDUMP.TXT","wt");
|
||||
if (!f) {
|
||||
DEBUG_ShowMsg(0,"DEBUG: Memory dump failed.");
|
||||
DEBUG_ShowMsg("DEBUG: Memory dump failed.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1452,7 +1598,7 @@ void SaveMemory(Bit16u seg, Bit16u ofs1, Bit32s num)
|
||||
|
||||
sprintf(buffer,"%04X:%04X ",seg,ofs1);
|
||||
for (Bit16u x=0; x<16; x++) {
|
||||
sprintf (temp,"%02X ",mem_readb(PhysMake(seg,ofs1+x)));
|
||||
sprintf (temp,"%02X ",mem_readb(GetAddress(seg,ofs1+x)));
|
||||
strcat (buffer,temp);
|
||||
};
|
||||
ofs1+=16;
|
||||
@ -1461,14 +1607,14 @@ void SaveMemory(Bit16u seg, Bit16u ofs1, Bit32s num)
|
||||
fprintf(f,"%s\n",buffer);
|
||||
};
|
||||
fclose(f);
|
||||
DEBUG_ShowMsg(0,"DEBUG: Memory dump success.");
|
||||
DEBUG_ShowMsg("DEBUG: Memory dump success.");
|
||||
};
|
||||
|
||||
// HEAVY DEBUGGING STUFF
|
||||
|
||||
#if C_HEAVY_DEBUG
|
||||
|
||||
const Bit32u LOGCPUMAX = 200;
|
||||
const Bit32u LOGCPUMAX = 20000;
|
||||
|
||||
static Bit16u logCpuCS [LOGCPUMAX];
|
||||
static Bit32u logCpuEIP[LOGCPUMAX];
|
||||
@ -1494,11 +1640,11 @@ void DEBUG_HeavyWriteLogInstruction(void)
|
||||
|
||||
logHeavy = false;
|
||||
|
||||
DEBUG_ShowMsg(0,"DEBUG: Creating cpu log LOGCPU_INT_CD.TXT");
|
||||
DEBUG_ShowMsg("DEBUG: Creating cpu log LOGCPU_INT_CD.TXT");
|
||||
|
||||
FILE* f = fopen("LOGCPU_INT_CD.TXT","wt");
|
||||
if (!f) {
|
||||
DEBUG_ShowMsg(0,"DEBUG: Failed.");
|
||||
DEBUG_ShowMsg("DEBUG: Failed.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1511,7 +1657,7 @@ void DEBUG_HeavyWriteLogInstruction(void)
|
||||
|
||||
fclose(f);
|
||||
|
||||
DEBUG_ShowMsg(0,"DEBUG: Done.");
|
||||
DEBUG_ShowMsg("DEBUG: Done.");
|
||||
};
|
||||
|
||||
bool DEBUG_HeavyIsBreakpoint(void)
|
||||
@ -1523,14 +1669,13 @@ bool DEBUG_HeavyIsBreakpoint(void)
|
||||
skipFirstInstruction = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
PhysPt where = SegPhys(cs)+reg_eip;
|
||||
|
||||
if (CBreakpoint::CheckBreakpoint(where)) {
|
||||
exitLoop = true;
|
||||
DEBUG_Enable();
|
||||
return true;
|
||||
};
|
||||
if (CBreakpoint::CheckBreakpoint(SegValue(cs),reg_eip)) {
|
||||
// exitLoop = true;
|
||||
// DEBUG_Enable();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
|
@ -116,8 +116,6 @@ static int modrmv; /* flag for getting modrm byte */
|
||||
static int sibv; /* flag for getting sib byte */
|
||||
static int opsize; /* just like it says ... */
|
||||
static int addrsize;
|
||||
static int addr20bit=0;
|
||||
static int addr24bit=0;
|
||||
static int addr32bit=0;
|
||||
|
||||
/* some defines for extracting instruction bit fields from bytes */
|
||||
@ -444,13 +442,8 @@ static char *addr_to_hex(UINT32 addr, int splitup) {
|
||||
else
|
||||
#endif
|
||||
|
||||
if (addr20bit) {
|
||||
sprintf(buffer, "%05X", addr&0xfffff );
|
||||
} else if (addr24bit) {
|
||||
sprintf(buffer, "%06X", addr&0xffffff );
|
||||
} else if (addr32bit) {
|
||||
sprintf(buffer, "%08X", addr );
|
||||
}
|
||||
sprintf(buffer, "%08X", addr );
|
||||
|
||||
}
|
||||
|
||||
return buffer;
|
||||
@ -837,12 +830,12 @@ static void percent(char type, char subtype)
|
||||
break;
|
||||
|
||||
case 'C': /* reg(r/m) picks control reg */
|
||||
uprintf("C%d", REG(modrm()));
|
||||
uprintf("CR%d", REG(modrm()));
|
||||
must_do_size = 0;
|
||||
break;
|
||||
|
||||
case 'D': /* reg(r/m) picks debug reg */
|
||||
uprintf("D%d", REG(modrm()));
|
||||
uprintf("DR%d", REG(modrm()));
|
||||
must_do_size = 0;
|
||||
break;
|
||||
|
||||
@ -874,7 +867,6 @@ static void percent(char type, char subtype)
|
||||
vofs = (INT16)vofs;
|
||||
name = addr_to_hex(vofs+instruction_offset+INSTRUCTION_SIZE,0);
|
||||
break;
|
||||
#if 0
|
||||
/* i386 */
|
||||
case 4:
|
||||
vofs = (UINT32)getbyte(); /* yuk! */
|
||||
@ -883,7 +875,6 @@ static void percent(char type, char subtype)
|
||||
vofs |= (UINT32)getbyte() << 24;
|
||||
name = addr_to_hex(vofs+instruction_offset+INSTRUCTION_SIZE,1);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
if (vofs<0)
|
||||
uprintf("%s ($-%x)", name, -vofs);
|
||||
@ -920,7 +911,7 @@ static void percent(char type, char subtype)
|
||||
break;
|
||||
|
||||
case 'R': /* mod(r/m) picks register */
|
||||
reg_name(REG(modrm()), subtype); /* rh */
|
||||
reg_name(RM(modrm()), subtype); /* rh */
|
||||
must_do_size = 0;
|
||||
break;
|
||||
|
||||
@ -1087,7 +1078,7 @@ Bitu DasmI386(char* buffer, PhysPt pc, Bitu cur_ip, bool bit32)
|
||||
ubufp = buffer;
|
||||
first_space = 1;
|
||||
|
||||
addr32bit=1;addr20bit=addr24bit=0;
|
||||
addr32bit=1;
|
||||
|
||||
prefix = 0;
|
||||
modrmv = sibv = -1; /* set modrm and sib flags */
|
||||
|
@ -37,28 +37,36 @@ struct _LogGroup {
|
||||
bool enabled;
|
||||
};
|
||||
|
||||
namespace {
|
||||
_LogGroup loggrp[LOG_MAX]={"",true,0};
|
||||
|
||||
FILE* debuglog;
|
||||
};
|
||||
static _LogGroup loggrp[LOG_MAX]={{"",true},{0,false}};
|
||||
static FILE* debuglog;
|
||||
|
||||
extern int old_cursor_state;
|
||||
void DEBUG_ShowMsg(Bit32u entry, char * format,...) {
|
||||
|
||||
if (!(entry & LOG_ERROR) && entry && !loggrp[entry].enabled) return;
|
||||
|
||||
char buf[1024];
|
||||
strcpy(buf,loggrp[entry&127].front);
|
||||
|
||||
|
||||
void DEBUG_ShowMsg(char * format,...) {
|
||||
|
||||
char buf[512];
|
||||
va_list msg;
|
||||
va_start(msg,format);
|
||||
vsprintf(&buf[strlen(buf)],format,msg);
|
||||
vsprintf(buf,format,msg);
|
||||
va_end(msg);
|
||||
wprintw(dbg.win_out,"%10d: %s\n",cycle_count,buf);
|
||||
wrefresh(dbg.win_out);
|
||||
if(debuglog) fprintf(debuglog,"%10d: %s\n",cycle_count,buf);
|
||||
}
|
||||
|
||||
void LOG::operator() (char* format, ...){
|
||||
char buf[512];
|
||||
va_list msg;
|
||||
va_start(msg,format);
|
||||
vsprintf(buf,format,msg);
|
||||
va_end(msg);
|
||||
|
||||
if (d_type>=LOG_MAX) return;
|
||||
if ((d_severity!=LOG_ERROR) && (!loggrp[d_type].enabled)) return;
|
||||
DEBUG_ShowMsg("%s:%s",loggrp[d_type].front,buf);
|
||||
}
|
||||
|
||||
|
||||
static void Draw_RegisterLayout(void) {
|
||||
@ -148,7 +156,8 @@ static void LOG_Init(Section * sec) {
|
||||
char buf[1024];
|
||||
for (Bitu i=1;i<LOG_MAX;i++) {
|
||||
strcpy(buf,loggrp[i].front);
|
||||
buf[strlen(buf)-1]=0;
|
||||
buf[strlen(buf)]=0;
|
||||
lowcase(buf);
|
||||
loggrp[i].enabled=sect->Get_bool(buf);
|
||||
}
|
||||
}
|
||||
@ -156,30 +165,34 @@ static void LOG_Init(Section * sec) {
|
||||
|
||||
void LOG_StartUp(void) {
|
||||
/* Setup logging groups */
|
||||
loggrp[LOG_VGA].front="VGA:";
|
||||
loggrp[LOG_VGAGFX].front="VGAGFX:";
|
||||
loggrp[LOG_VGAMISC].front="VGAMISC:";
|
||||
loggrp[LOG_INT10].front="INT10:";
|
||||
loggrp[LOG_SB].front="SBLASTER:";
|
||||
loggrp[LOG_DMA].front="DMA:";
|
||||
loggrp[LOG_ALL].front="ALL";
|
||||
loggrp[LOG_VGA].front="VGA";
|
||||
loggrp[LOG_VGAGFX].front="VGAGFX";
|
||||
loggrp[LOG_VGAMISC].front="VGAMISC";
|
||||
loggrp[LOG_INT10].front="INT10";
|
||||
loggrp[LOG_SB].front="SBLASTER";
|
||||
loggrp[LOG_DMA].front="DMA";
|
||||
|
||||
loggrp[LOG_FPU].front="FPU:";
|
||||
loggrp[LOG_CPU].front="CPU:";
|
||||
loggrp[LOG_FPU].front="FPU";
|
||||
loggrp[LOG_CPU].front="CPU";
|
||||
loggrp[LOG_PAGING].front="PAGING";
|
||||
|
||||
loggrp[LOG_FCB].front="FCB:";
|
||||
loggrp[LOG_FILES].front="FILES:";
|
||||
loggrp[LOG_IOCTL].front="IOCTL:";
|
||||
loggrp[LOG_FCB].front="FCB";
|
||||
loggrp[LOG_FILES].front="FILES";
|
||||
loggrp[LOG_IOCTL].front="IOCTL";
|
||||
loggrp[LOG_EXEC].front="EXEC";
|
||||
loggrp[LOG_DOSMISC].front="DOSMISC:";
|
||||
loggrp[LOG_DOSMISC].front="DOSMISC";
|
||||
|
||||
loggrp[LOG_PIT].front="PIT:";
|
||||
loggrp[LOG_KEYBOARD].front="KEYBOARD:";
|
||||
loggrp[LOG_PIC].front="PIC:";
|
||||
loggrp[LOG_PIT].front="PIT";
|
||||
loggrp[LOG_KEYBOARD].front="KEYBOARD";
|
||||
loggrp[LOG_PIC].front="PIC";
|
||||
|
||||
loggrp[LOG_MOUSE].front="MOUSE:";
|
||||
loggrp[LOG_BIOS].front="BIOS:";
|
||||
loggrp[LOG_GUI].front="GUI:";
|
||||
loggrp[LOG_MISC].front="MISC:";
|
||||
loggrp[LOG_MOUSE].front="MOUSE";
|
||||
loggrp[LOG_BIOS].front="BIOS";
|
||||
loggrp[LOG_GUI].front="GUI";
|
||||
loggrp[LOG_MISC].front="MISC";
|
||||
|
||||
loggrp[LOG_IO].front="IO";
|
||||
|
||||
/* Register the log section */
|
||||
Section_prop * sect=control->AddSection_prop("log",LOG_Init);
|
||||
@ -187,7 +200,6 @@ void LOG_StartUp(void) {
|
||||
char buf[1024];
|
||||
for (Bitu i=1;i<LOG_MAX;i++) {
|
||||
strcpy(buf,loggrp[i].front);
|
||||
buf[strlen(buf)-1]=0;
|
||||
lowcase(buf);
|
||||
sect->Add_bool(buf,true);
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ struct DASMLine {
|
||||
|
||||
extern DBGBlock dbg;
|
||||
|
||||
|
||||
/* Local Debug Stuff */
|
||||
Bitu DasmI386(char* buffer, PhysPt pc, Bitu cur_ip, bool bit32);
|
||||
int DasmLastOperandSize(void);
|
||||
int DasmLastOperandSize(void);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2002 The DOSBox Team
|
||||
* Copyright (C) 2002-2003 The DOSBox Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -16,6 +16,8 @@
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
@ -66,9 +68,7 @@ static void ResizeConsole( HANDLE hConsole, SHORT xSize, SHORT ySize ) {
|
||||
|
||||
|
||||
void WIN32_Console() {
|
||||
AllocConsole();
|
||||
ResizeConsole(GetStdHandle(STD_OUTPUT_HANDLE),80,50);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Makefile.in generated by automake 1.6.3 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.7.7 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@ -13,77 +13,122 @@
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = ../..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = @program_transform_name@
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
|
||||
EXEEXT = @EXEEXT@
|
||||
OBJEXT = @OBJEXT@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALSA_CFLAGS = @ALSA_CFLAGS@
|
||||
ALSA_LIBS = @ALSA_LIBS@
|
||||
AMDEP_FALSE = @AMDEP_FALSE@
|
||||
AMDEP_TRUE = @AMDEP_TRUE@
|
||||
AMTAR = @AMTAR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SDL_CFLAGS = @SDL_CFLAGS@
|
||||
SDL_CONFIG = @SDL_CONFIG@
|
||||
SDL_LIBS = @SDL_LIBS@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_RANLIB = @ac_ct_RANLIB@
|
||||
ac_ct_STRIP = @ac_ct_STRIP@
|
||||
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
|
||||
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
|
||||
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
|
||||
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
datadir = @datadir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
oldincludedir = @oldincludedir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target = @target@
|
||||
target_alias = @target_alias@
|
||||
target_cpu = @target_cpu@
|
||||
target_os = @target_os@
|
||||
target_vendor = @target_vendor@
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include
|
||||
|
||||
noinst_LIBRARIES = libdos.a
|
||||
@ -95,6 +140,7 @@ libdos_a_SOURCES = dos.cpp dos_devices.cpp dos_execute.cpp dos_files.cpp dos_ioc
|
||||
cdrom.h cdrom.cpp cdrom_ioctl_win32.cpp cdrom_aspi_win32.cpp
|
||||
|
||||
subdir = src/dos
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
@ -111,11 +157,7 @@ am_libdos_a_OBJECTS = dos.$(OBJEXT) dos_devices.$(OBJEXT) \
|
||||
cdrom_ioctl_win32.$(OBJEXT) cdrom_aspi_win32.$(OBJEXT)
|
||||
libdos_a_OBJECTS = $(am_libdos_a_OBJECTS)
|
||||
|
||||
DEFS = @DEFS@
|
||||
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/cdrom.Po \
|
||||
@ -136,14 +178,12 @@ CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
|
||||
CXXLD = $(CXX)
|
||||
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
|
||||
-o $@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CFLAGS = @CFLAGS@
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
DIST_SOURCES = $(libdos_a_SOURCES)
|
||||
DIST_COMMON = Makefile.am Makefile.in
|
||||
DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
|
||||
SOURCES = $(libdos_a_SOURCES)
|
||||
|
||||
all: all-am
|
||||
@ -190,26 +230,35 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drive_virtual.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drives.Po@am__quote@
|
||||
|
||||
distclean-depend:
|
||||
-rm -rf ./$(DEPDIR)
|
||||
|
||||
.cpp.o:
|
||||
@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
$(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
|
||||
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
|
||||
@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
|
||||
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
|
||||
@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
|
||||
@am__fastdepCXX_TRUE@ fi
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
|
||||
|
||||
.cpp.obj:
|
||||
@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
$(CXXCOMPILE) -c -o $@ `cygpath -w $<`
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
|
||||
@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
|
||||
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
|
||||
@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
|
||||
@am__fastdepCXX_TRUE@ fi
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
|
||||
uninstall-info-am:
|
||||
|
||||
ETAGS = etags
|
||||
ETAGSFLAGS =
|
||||
|
||||
CTAGS = ctags
|
||||
CTAGSFLAGS =
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
@ -235,20 +284,41 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
top_distdir = ../..
|
||||
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@list='$(DISTFILES)'; for file in $$list; do \
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(DISTFILES)'; for file in $$list; do \
|
||||
case $$file in \
|
||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
|
||||
esac; \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
@ -273,7 +343,6 @@ check: check-am
|
||||
all-am: Makefile $(LIBRARIES)
|
||||
|
||||
installdirs:
|
||||
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
@ -293,7 +362,7 @@ mostlyclean-generic:
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@ -303,9 +372,11 @@ clean: clean-am
|
||||
clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
|
||||
distclean-am: clean-am distclean-compile distclean-depend \
|
||||
distclean-generic distclean-tags
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
@ -326,6 +397,8 @@ install-man:
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
@ -333,18 +406,25 @@ mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-info-am
|
||||
|
||||
.PHONY: GTAGS all all-am check check-am clean clean-generic \
|
||||
clean-noinstLIBRARIES distclean distclean-compile \
|
||||
distclean-depend distclean-generic distclean-tags distdir dvi \
|
||||
dvi-am info info-am install install-am install-data \
|
||||
install-data-am install-exec install-exec-am install-info \
|
||||
install-info-am install-man install-strip installcheck \
|
||||
installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic tags uninstall uninstall-am \
|
||||
uninstall-info-am
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||
clean-noinstLIBRARIES ctags distclean distclean-compile \
|
||||
distclean-generic distclean-tags distdir dvi dvi-am info \
|
||||
info-am install install-am install-data install-data-am \
|
||||
install-exec install-exec-am install-info install-info-am \
|
||||
install-man install-strip installcheck installcheck-am \
|
||||
installdirs maintainer-clean maintainer-clean-generic \
|
||||
mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \
|
||||
ps ps-am tags uninstall uninstall-am uninstall-info-am
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
|
@ -66,46 +66,43 @@ bool CDROM_Interface_SDL::SetDevice (char* path, int forceCD)
|
||||
|
||||
bool CDROM_Interface_SDL::GetAudioTracks (int& stTrack, int& end, TMSF& leadOut)
|
||||
{
|
||||
SDL_CDStatus(cd);
|
||||
if (CD_INDRIVE(cd->status)) {
|
||||
|
||||
if (CD_INDRIVE(SDL_CDStatus(cd))) {
|
||||
stTrack = 1;
|
||||
end = cd->numtracks;
|
||||
FRAMES_TO_MSF(cd->track[cd->numtracks].offset,&leadOut.min,&leadOut.sec,&leadOut.fr);
|
||||
}
|
||||
return CD_INDRIVE(cd->status);
|
||||
return CD_INDRIVE(SDL_CDStatus(cd));
|
||||
};
|
||||
|
||||
bool CDROM_Interface_SDL::GetAudioTrackInfo (int track, TMSF& start, unsigned char& attr)
|
||||
{
|
||||
SDL_CDStatus(cd);
|
||||
if (CD_INDRIVE(cd->status)) {
|
||||
if (CD_INDRIVE(SDL_CDStatus(cd))) {
|
||||
FRAMES_TO_MSF(cd->track[track-1].offset+150,&start.min,&start.sec,&start.fr);
|
||||
attr = cd->track[track-1].type;
|
||||
}
|
||||
return CD_INDRIVE(cd->status);
|
||||
return CD_INDRIVE(SDL_CDStatus(cd));
|
||||
};
|
||||
|
||||
bool CDROM_Interface_SDL::GetAudioSub (unsigned char& attr, unsigned char& track, unsigned char& index, TMSF& relPos, TMSF& absPos)
|
||||
{
|
||||
SDL_CDStatus(cd);
|
||||
if (CD_INDRIVE(cd->status)) {
|
||||
if (CD_INDRIVE(SDL_CDStatus(cd))) {
|
||||
track = cd->cur_track;
|
||||
index = cd->cur_track;
|
||||
attr = cd->track[track].type;
|
||||
FRAMES_TO_MSF(cd->cur_frame,&relPos.min,&relPos.sec,&relPos.fr);
|
||||
FRAMES_TO_MSF(cd->cur_frame+cd->track[track].offset,&absPos.min,&absPos.sec,&absPos.fr);
|
||||
}
|
||||
return CD_INDRIVE(cd->status);
|
||||
return CD_INDRIVE(SDL_CDStatus(cd));
|
||||
};
|
||||
|
||||
bool CDROM_Interface_SDL::GetAudioStatus (bool& playing, bool& pause)
|
||||
{
|
||||
SDL_CDStatus(cd);
|
||||
if (CD_INDRIVE(cd->status)) {
|
||||
if (CD_INDRIVE(SDL_CDStatus(cd))) {
|
||||
playing = (cd->status==CD_PLAYING);
|
||||
pause = (cd->status==CD_PAUSED);
|
||||
}
|
||||
return CD_INDRIVE(cd->status);
|
||||
return CD_INDRIVE(SDL_CDStatus(cd));
|
||||
};
|
||||
|
||||
bool CDROM_Interface_SDL::GetMediaTrayStatus (bool& mediaPresent, bool& mediaChanged, bool& trayOpen)
|
||||
@ -124,7 +121,7 @@ bool CDROM_Interface_SDL::PlayAudioSector (unsigned long start,unsigned long len
|
||||
// Has to be there, otherwise wrong cd status report (dunno why, sdl bug ?)
|
||||
SDL_CDClose(cd);
|
||||
cd = SDL_CDOpen(driveID);
|
||||
bool success = (SDL_CDPlay(cd,start,len)==0);
|
||||
bool success = (SDL_CDPlay(cd,start+150,len)==0);
|
||||
return success;
|
||||
};
|
||||
|
||||
@ -169,7 +166,7 @@ int CDROM_GetMountType(char* path, int forceCD)
|
||||
int num = SDL_CDNumDrives();
|
||||
// If cd drive is forced then check if its in range and return 0
|
||||
if ((forceCD>=0) && (forceCD<num)) {
|
||||
LOG(LOG_ERROR,"CDROM: Using drive %d",forceCD);
|
||||
LOG(LOG_ALL,LOG_ERROR)("CDROM: Using drive %d",forceCD);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
#define MAX_ASPI_CDROM 5
|
||||
|
||||
#include <string.h>
|
||||
#include "mem.h"
|
||||
#include "SDL.h"
|
||||
|
||||
#define RAW_SECTOR_SIZE 2352
|
||||
@ -40,7 +41,7 @@ public:
|
||||
virtual bool PauseAudio (bool resume) = 0;
|
||||
virtual bool StopAudio (void) = 0;
|
||||
|
||||
virtual bool ReadSectors (void* buffer, bool raw, unsigned long sector, unsigned long num) = 0;
|
||||
virtual bool ReadSectors (PhysPt buffer, bool raw, unsigned long sector, unsigned long num) = 0;
|
||||
|
||||
virtual bool LoadUnloadMedia (bool unload) = 0;
|
||||
};
|
||||
@ -61,7 +62,7 @@ public:
|
||||
bool PlayAudioSector (unsigned long start,unsigned long len);
|
||||
bool PauseAudio (bool resume);
|
||||
bool StopAudio (void);
|
||||
bool ReadSectors (void* buffer, bool raw, unsigned long sector, unsigned long num) { return true; };
|
||||
bool ReadSectors (PhysPt buffer, bool raw, unsigned long sector, unsigned long num) { return false; };
|
||||
bool LoadUnloadMedia (bool unload);
|
||||
|
||||
private:
|
||||
@ -86,7 +87,7 @@ public:
|
||||
bool PlayAudioSector (unsigned long start,unsigned long len) { return true; };
|
||||
bool PauseAudio (bool resume) { return true; };
|
||||
bool StopAudio (void) { return true; };
|
||||
bool ReadSectors (void* buffer, bool raw, unsigned long sector, unsigned long num) { return true; };
|
||||
bool ReadSectors (PhysPt buffer, bool raw, unsigned long sector, unsigned long num) { return true; };
|
||||
bool LoadUnloadMedia (bool unload) { return true; };
|
||||
};
|
||||
|
||||
@ -117,7 +118,7 @@ public:
|
||||
bool PauseAudio (bool resume);
|
||||
bool StopAudio (void);
|
||||
|
||||
bool ReadSectors (void* buffer, bool raw, unsigned long sector, unsigned long num);
|
||||
bool ReadSectors (PhysPt buffer, bool raw, unsigned long sector, unsigned long num);
|
||||
|
||||
bool LoadUnloadMedia (bool unload);
|
||||
|
||||
@ -164,7 +165,7 @@ public:
|
||||
bool PauseAudio (bool resume);
|
||||
bool StopAudio (void);
|
||||
|
||||
bool ReadSectors (void* buffer, bool raw, unsigned long sector, unsigned long num);
|
||||
bool ReadSectors (PhysPt buffer, bool raw, unsigned long sector, unsigned long num);
|
||||
|
||||
bool LoadUnloadMedia (bool unload);
|
||||
|
||||
|
@ -92,13 +92,13 @@ BYTE CDROM_Interface_Aspi::GetHostAdapter(char* hardwareID)
|
||||
if (sd.SRB_Status == SS_COMP) {
|
||||
if (sd.SRB_DeviceType == DTYPE_CDROM) {
|
||||
if ((target==j) && (lun==k)) {
|
||||
LOG(LOG_MISC,"SCSI: Getting Hardware vendor.");
|
||||
LOG(LOG_MISC,LOG_NORMAL)("SCSI: Getting Hardware vendor.");
|
||||
// "Hardware ID = vendor" match ?
|
||||
char vendor[64];
|
||||
if (GetVendor(i,target,lun,vendor)) {
|
||||
LOG(LOG_MISC,"SCSI: Vendor : %s",vendor);
|
||||
LOG(LOG_MISC,LOG_NORMAL)("SCSI: Vendor : %s",vendor);
|
||||
if (strstr(strupr(hardwareID),strupr(vendor))) {
|
||||
LOG(LOG_MISC,"SCSI: Host Adapter found: %d",i);
|
||||
LOG(LOG_MISC,LOG_NORMAL)("SCSI: Host Adapter found: %d",i);
|
||||
return i;
|
||||
}
|
||||
};
|
||||
@ -108,7 +108,7 @@ BYTE CDROM_Interface_Aspi::GetHostAdapter(char* hardwareID)
|
||||
}
|
||||
}
|
||||
}
|
||||
LOG(LOG_ERROR,"SCSI: Host Adapter not found: %d",i);
|
||||
LOG(LOG_MISC,LOG_ERROR)("SCSI: Host Adapter not found: %d",i);
|
||||
return 0;
|
||||
};
|
||||
|
||||
@ -131,16 +131,16 @@ bool CDROM_Interface_Aspi::ScanRegistryFindKey(HKEY& hKeyBase)
|
||||
newKeyResult = RegOpenKeyEx (hKeyBase,subKey,0,KEY_READ,&hNewKey);
|
||||
if (newKeyResult==ERROR_SUCCESS) {
|
||||
if (GetRegistryValue(hNewKey,"CurrentDriveLetterAssignment",buffer,256)) {
|
||||
LOG(LOG_MISC,"SCSI: Drive Letter found: %s",buffer);
|
||||
LOG(LOG_MISC,LOG_NORMAL)("SCSI: Drive Letter found: %s",buffer);
|
||||
// aha, something suspicious...
|
||||
if (buffer[0]==letter) {
|
||||
char hardwareID[256];
|
||||
// found it... lets see if we can get the scsi values
|
||||
bool v1 = GetRegistryValue(hNewKey,"SCSILUN",buffer,256);
|
||||
LOG(LOG_MISC,"SCSI: SCSILUN found: %s",buffer);
|
||||
LOG(LOG_MISC,LOG_NORMAL)("SCSI: SCSILUN found: %s",buffer);
|
||||
lun = buffer[0]-'0';
|
||||
bool v2 = GetRegistryValue(hNewKey,"SCSITargetID",buffer,256);
|
||||
LOG(LOG_MISC,"SCSI: SCSITargetID found: %s",buffer);
|
||||
LOG(LOG_MISC,LOG_NORMAL)("SCSI: SCSITargetID found: %s",buffer);
|
||||
target = buffer[0]-'0';
|
||||
bool v3 = GetRegistryValue(hNewKey,"HardwareID",hardwareID,256);
|
||||
RegCloseKey(hNewKey);
|
||||
@ -667,7 +667,7 @@ bool CDROM_Interface_Aspi::GetMediaTrayStatus(bool& mediaPresent, bool& mediaCha
|
||||
return true;
|
||||
};
|
||||
|
||||
bool CDROM_Interface_Aspi::ReadSectors(void* buffer, bool raw, unsigned long sector, unsigned long num)
|
||||
bool CDROM_Interface_Aspi::ReadSectors(PhysPt buffer, bool raw, unsigned long sector, unsigned long num)
|
||||
{
|
||||
SRB_ExecSCSICmd s;DWORD dwStatus;
|
||||
|
||||
@ -675,12 +675,8 @@ bool CDROM_Interface_Aspi::ReadSectors(void* buffer, bool raw, unsigned long sec
|
||||
|
||||
memset(&s,0,sizeof(s));
|
||||
|
||||
// FIXME : Is there a method to get cooked sectors with aspi ???
|
||||
// all combination i tried were failing.
|
||||
// so we have to allocate extra mem and copy data to buffer if in cooked mode
|
||||
char* inPtr = (char*)buffer;
|
||||
if (!raw) inPtr = new char[num*2352];
|
||||
if (!inPtr) return false;
|
||||
Bitu buflen = raw?2352*num:2048*num;
|
||||
Bit8u* bufdata = new Bit8u[buflen];
|
||||
|
||||
s.SRB_Cmd = SC_EXEC_SCSI_CMD;
|
||||
s.SRB_HaId = haId;
|
||||
@ -689,8 +685,8 @@ bool CDROM_Interface_Aspi::ReadSectors(void* buffer, bool raw, unsigned long sec
|
||||
s.SRB_Flags = SRB_DIR_IN | SRB_EVENT_NOTIFY;
|
||||
s.SRB_SenseLen = SENSE_LEN;
|
||||
|
||||
s.SRB_BufLen = 2352*num; //num*(raw?2352:2048);
|
||||
s.SRB_BufPointer = (BYTE FAR*)inPtr;
|
||||
s.SRB_BufLen = buflen;
|
||||
s.SRB_BufPointer = (BYTE FAR*)bufdata;
|
||||
s.SRB_CDBLen = 12;
|
||||
s.SRB_PostProc = (LPVOID)hEvent;
|
||||
|
||||
@ -712,24 +708,12 @@ bool CDROM_Interface_Aspi::ReadSectors(void* buffer, bool raw, unsigned long sec
|
||||
|
||||
CloseHandle(hEvent);
|
||||
|
||||
if (s.SRB_Status!=SS_COMP) {
|
||||
if (!raw) delete[] inPtr;
|
||||
return false;
|
||||
}
|
||||
// Copy to PhysPt
|
||||
MEM_BlockWrite(buffer,bufdata,buflen);
|
||||
|
||||
if (!raw) {
|
||||
// copy user data to buffer
|
||||
char* source = inPtr;
|
||||
source+=16; // jump 16 bytes
|
||||
char* outPtr = (char*)buffer;
|
||||
for (unsigned long i=0; i<num; i++) {
|
||||
memcpy(outPtr,source,2048);
|
||||
outPtr+=COOKED_SECTOR_SIZE;
|
||||
source+=RAW_SECTOR_SIZE;
|
||||
};
|
||||
delete[] inPtr;
|
||||
};
|
||||
return true;
|
||||
delete[] bufdata;
|
||||
|
||||
return (s.SRB_Status==SS_COMP);
|
||||
};
|
||||
|
||||
#endif
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include <windows.h>
|
||||
#include <winioctl.h> // Ioctl stuff
|
||||
#include <io.h>
|
||||
#include "ntddcdrm.h" // Ioctl stuff
|
||||
#include "cdrom.h"
|
||||
|
||||
@ -37,6 +38,7 @@ CDROM_Interface_Ioctl::CDROM_Interface_Ioctl()
|
||||
CDROM_Interface_Ioctl::~CDROM_Interface_Ioctl()
|
||||
{
|
||||
StopAudio();
|
||||
Close();
|
||||
};
|
||||
|
||||
bool CDROM_Interface_Ioctl::GetUPC(unsigned char& attr, char* upc)
|
||||
@ -47,12 +49,12 @@ bool CDROM_Interface_Ioctl::GetUPC(unsigned char& attr, char* upc)
|
||||
|
||||
bool CDROM_Interface_Ioctl::GetAudioTracks(int& stTrack, int& endTrack, TMSF& leadOut)
|
||||
{
|
||||
Open();
|
||||
// Open();
|
||||
CDROM_TOC toc;
|
||||
DWORD byteCount;
|
||||
BOOL bStat = DeviceIoControl(hIOCTL,IOCTL_CDROM_READ_TOC, NULL, 0,
|
||||
&toc, sizeof(toc), &byteCount,NULL);
|
||||
Close();
|
||||
// Close();
|
||||
if (!bStat) return false;
|
||||
|
||||
stTrack = toc.FirstTrack;
|
||||
@ -65,12 +67,12 @@ bool CDROM_Interface_Ioctl::GetAudioTracks(int& stTrack, int& endTrack, TMSF& le
|
||||
|
||||
bool CDROM_Interface_Ioctl::GetAudioTrackInfo(int track, TMSF& start, unsigned char& attr)
|
||||
{
|
||||
Open();
|
||||
// Open();
|
||||
CDROM_TOC toc;
|
||||
DWORD byteCount;
|
||||
BOOL bStat = DeviceIoControl(hIOCTL,IOCTL_CDROM_READ_TOC, NULL, 0,
|
||||
&toc, sizeof(toc), &byteCount,NULL);
|
||||
Close();
|
||||
// Close();
|
||||
if (!bStat) return false;
|
||||
|
||||
attr = (toc.TrackData[track-1].Adr << 4) | toc.TrackData[track].Control;
|
||||
@ -82,7 +84,7 @@ bool CDROM_Interface_Ioctl::GetAudioTrackInfo(int track, TMSF& start, unsigned c
|
||||
|
||||
bool CDROM_Interface_Ioctl::GetAudioSub(unsigned char& attr, unsigned char& track, unsigned char& index, TMSF& relPos, TMSF& absPos)
|
||||
{
|
||||
Open();
|
||||
// Open();
|
||||
|
||||
CDROM_SUB_Q_DATA_FORMAT insub;
|
||||
SUB_Q_CHANNEL_DATA sub;
|
||||
@ -92,7 +94,7 @@ bool CDROM_Interface_Ioctl::GetAudioSub(unsigned char& attr, unsigned char& trac
|
||||
|
||||
BOOL bStat = DeviceIoControl(hIOCTL,IOCTL_CDROM_READ_Q_CHANNEL, &insub, sizeof(insub),
|
||||
&sub, sizeof(sub), &byteCount,NULL);
|
||||
Close();
|
||||
// Close();
|
||||
if (!bStat) return false;
|
||||
|
||||
attr = (sub.CurrentPosition.ADR << 4) | sub.CurrentPosition.Control;
|
||||
@ -110,7 +112,7 @@ bool CDROM_Interface_Ioctl::GetAudioSub(unsigned char& attr, unsigned char& trac
|
||||
|
||||
bool CDROM_Interface_Ioctl::GetAudioStatus(bool& playing, bool& pause)
|
||||
{
|
||||
Open();
|
||||
// Open();
|
||||
|
||||
CDROM_SUB_Q_DATA_FORMAT insub;
|
||||
SUB_Q_CHANNEL_DATA sub;
|
||||
@ -120,7 +122,7 @@ bool CDROM_Interface_Ioctl::GetAudioStatus(bool& playing, bool& pause)
|
||||
|
||||
BOOL bStat = DeviceIoControl(hIOCTL,IOCTL_CDROM_READ_Q_CHANNEL, &insub, sizeof(insub),
|
||||
&sub, sizeof(sub), &byteCount,NULL);
|
||||
Close();
|
||||
// Close();
|
||||
if (!bStat) return false;
|
||||
|
||||
playing = (sub.CurrentPosition.Header.AudioStatus == AUDIO_STATUS_IN_PROGRESS);
|
||||
@ -138,6 +140,10 @@ bool CDROM_Interface_Ioctl::GetMediaTrayStatus(bool& mediaPresent, bool& mediaCh
|
||||
mediaPresent = GetAudioTracks(track1, track2, leadOut),
|
||||
trayOpen = !mediaPresent;
|
||||
mediaChanged = (oldLeadOut.min!=leadOut.min) || (oldLeadOut.sec!=leadOut.sec) || (oldLeadOut.fr!=leadOut.fr);
|
||||
if (mediaChanged) {
|
||||
// Open new media
|
||||
Close(); Open();
|
||||
};
|
||||
// Save old values
|
||||
oldLeadOut.min = leadOut.min;
|
||||
oldLeadOut.sec = leadOut.sec;
|
||||
@ -148,7 +154,7 @@ bool CDROM_Interface_Ioctl::GetMediaTrayStatus(bool& mediaPresent, bool& mediaCh
|
||||
|
||||
bool CDROM_Interface_Ioctl::PlayAudioSector (unsigned long start,unsigned long len)
|
||||
{
|
||||
Open();
|
||||
// Open();
|
||||
CDROM_PLAY_AUDIO_MSF audio;
|
||||
DWORD byteCount;
|
||||
// Start
|
||||
@ -164,79 +170,79 @@ bool CDROM_Interface_Ioctl::PlayAudioSector (unsigned long start,unsigned long l
|
||||
|
||||
BOOL bStat = DeviceIoControl(hIOCTL,IOCTL_CDROM_PLAY_AUDIO_MSF, &audio, sizeof(audio),
|
||||
NULL, 0, &byteCount,NULL);
|
||||
Close();
|
||||
// Close();
|
||||
return bStat>0;
|
||||
};
|
||||
|
||||
bool CDROM_Interface_Ioctl::PauseAudio(bool resume)
|
||||
{
|
||||
Open();
|
||||
// Open();
|
||||
BOOL bStat;
|
||||
DWORD byteCount;
|
||||
if (resume) bStat = DeviceIoControl(hIOCTL,IOCTL_CDROM_RESUME_AUDIO, NULL, 0,
|
||||
NULL, 0, &byteCount,NULL);
|
||||
else bStat = DeviceIoControl(hIOCTL,IOCTL_CDROM_PAUSE_AUDIO, NULL, 0,
|
||||
NULL, 0, &byteCount,NULL);
|
||||
Close();
|
||||
// Close();
|
||||
return bStat>0;
|
||||
};
|
||||
|
||||
bool CDROM_Interface_Ioctl::StopAudio(void)
|
||||
{
|
||||
Open();
|
||||
// Open();
|
||||
BOOL bStat;
|
||||
DWORD byteCount;
|
||||
bStat = DeviceIoControl(hIOCTL,IOCTL_CDROM_STOP_AUDIO, NULL, 0,
|
||||
NULL, 0, &byteCount,NULL);
|
||||
Close();
|
||||
// Close();
|
||||
return bStat>0;
|
||||
};
|
||||
|
||||
bool CDROM_Interface_Ioctl::LoadUnloadMedia(bool unload)
|
||||
{
|
||||
Open();
|
||||
// Open();
|
||||
BOOL bStat;
|
||||
DWORD byteCount;
|
||||
if (unload) bStat = DeviceIoControl(hIOCTL,IOCTL_STORAGE_EJECT_MEDIA, NULL, 0,
|
||||
NULL, 0, &byteCount,NULL);
|
||||
else bStat = DeviceIoControl(hIOCTL,IOCTL_STORAGE_LOAD_MEDIA, NULL, 0,
|
||||
NULL, 0, &byteCount,NULL);
|
||||
Close();
|
||||
// Close();
|
||||
return bStat>0;
|
||||
};
|
||||
|
||||
bool CDROM_Interface_Ioctl::ReadSectors(void* buffer, bool raw, unsigned long sector, unsigned long num)
|
||||
bool CDROM_Interface_Ioctl::ReadSectors(PhysPt buffer, bool raw, unsigned long sector, unsigned long num)
|
||||
{
|
||||
// TODO : How to copy cooked without current overhead ?
|
||||
BOOL bStat;
|
||||
DWORD byteCount;
|
||||
RAW_READ_INFO in;
|
||||
char* inPtr;
|
||||
BOOL bStat;
|
||||
DWORD byteCount = 0;
|
||||
|
||||
in.DiskOffset.LowPart = sector;
|
||||
in.DiskOffset.HighPart = 0;
|
||||
in.SectorCount = num;
|
||||
in.TrackMode = CDDA;
|
||||
|
||||
if (!raw) inPtr = new char[num*RAW_SECTOR_SIZE];
|
||||
else inPtr = (char*)buffer;
|
||||
// Open();
|
||||
|
||||
bStat = DeviceIoControl(hIOCTL,IOCTL_CDROM_RAW_READ, &in, sizeof(in),
|
||||
inPtr, num*RAW_SECTOR_SIZE, &byteCount,NULL);
|
||||
Bitu buflen = raw ? num*RAW_SECTOR_SIZE : num*COOKED_SECTOR_SIZE;
|
||||
Bit8u* bufdata = new Bit8u[buflen];
|
||||
|
||||
if (!raw) {
|
||||
char* source = inPtr;
|
||||
source+=16; // jump 16 bytes
|
||||
char* outPtr = (char*)buffer;
|
||||
for (unsigned long i=0; i<num; i++) {
|
||||
memcpy(outPtr,source,COOKED_SECTOR_SIZE);
|
||||
outPtr+=COOKED_SECTOR_SIZE;
|
||||
source+=RAW_SECTOR_SIZE;
|
||||
};
|
||||
delete[] inPtr;
|
||||
};
|
||||
|
||||
return (byteCount!=num*RAW_SECTOR_SIZE) && (bStat>0);
|
||||
// Cooked
|
||||
int success = 0;
|
||||
DWORD newPos = SetFilePointer(hIOCTL, sector*COOKED_SECTOR_SIZE, 0, FILE_BEGIN);
|
||||
if (newPos != 0xFFFFFFFF) success = ReadFile(hIOCTL, bufdata, buflen, &byteCount, NULL);
|
||||
bStat = (success!=0);
|
||||
} else {
|
||||
// Raw
|
||||
RAW_READ_INFO in;
|
||||
in.DiskOffset.LowPart = sector;
|
||||
in.DiskOffset.HighPart = 0;
|
||||
in.SectorCount = num;
|
||||
in.TrackMode = CDDA;
|
||||
bStat = DeviceIoControl(hIOCTL,IOCTL_CDROM_RAW_READ, &in, sizeof(in),
|
||||
bufdata, buflen, &byteCount,NULL);
|
||||
}
|
||||
// Close();
|
||||
|
||||
MEM_BlockWrite(buffer,bufdata,buflen);
|
||||
delete[] bufdata;
|
||||
|
||||
return (byteCount==buflen) && (bStat>0);
|
||||
}
|
||||
|
||||
bool CDROM_Interface_Ioctl::SetDevice(char* path, int forceCD)
|
||||
@ -247,7 +253,7 @@ bool CDROM_Interface_Ioctl::SetDevice(char* path, int forceCD)
|
||||
strcpy(pathname,"\\\\.\\");
|
||||
strcat(pathname,letter);
|
||||
if (Open()) {
|
||||
Close();
|
||||
// Close();
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
@ -16,8 +16,11 @@
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: dev_con.h,v 1.14 2003/09/08 18:06:44 qbix79 Exp $ */
|
||||
|
||||
#include "dos_inc.h"
|
||||
#include "../ints/int10.h"
|
||||
#include <string.h>
|
||||
|
||||
#define NUMBER_ANSI_DATA 10
|
||||
|
||||
@ -35,6 +38,7 @@ private:
|
||||
struct ansi { /* should create a constructor which fills them with the appriorate values */
|
||||
bool esc;
|
||||
bool sci;
|
||||
bool enabled;
|
||||
Bit8u attr;
|
||||
Bit8u data[NUMBER_ANSI_DATA];
|
||||
Bit8u numberofarg;
|
||||
@ -45,8 +49,6 @@ private:
|
||||
} ansi;
|
||||
|
||||
};
|
||||
void INT10_TeletypeOutput(Bit8u chr,Bit8u attr,bool showattr, Bit8u page);
|
||||
void INT10_SetCursorPos(Bit8u row,Bit8u col,Bit8u page);
|
||||
|
||||
bool device_CON::Read(Bit8u * data,Bit16u * size) {
|
||||
Bit16u oldax=reg_ax;
|
||||
@ -54,7 +56,7 @@ bool device_CON::Read(Bit8u * data,Bit16u * size) {
|
||||
if ((cache) && (*size)) {
|
||||
data[count++]=cache;
|
||||
if(dos.echo) {
|
||||
INT10_TeletypeOutput(cache,7,false,0);
|
||||
INT10_TeletypeOutput(cache,7,false);
|
||||
}
|
||||
cache=0;
|
||||
|
||||
@ -69,8 +71,8 @@ bool device_CON::Read(Bit8u * data,Bit16u * size) {
|
||||
*size=count;
|
||||
reg_ax=oldax;
|
||||
if(dos.echo) {
|
||||
INT10_TeletypeOutput(13,7,false,0); //maybe don't do this ( no need for it actually ) (but it's compatible)
|
||||
INT10_TeletypeOutput(10,7,false,0);
|
||||
INT10_TeletypeOutput(13,7,false); //maybe don't do this ( no need for it actually ) (but it's compatible)
|
||||
INT10_TeletypeOutput(10,7,false);
|
||||
}
|
||||
return true;
|
||||
break;
|
||||
@ -78,8 +80,8 @@ bool device_CON::Read(Bit8u * data,Bit16u * size) {
|
||||
if(*size==1) data[count++]=reg_al; //one char at the time so give back that BS
|
||||
else if(count) { //Remove data if it exists (extended keys don't go right)
|
||||
data[count--]=0;
|
||||
INT10_TeletypeOutput(8,7,false,0);
|
||||
INT10_TeletypeOutput(' ',7,false,0);
|
||||
INT10_TeletypeOutput(8,7,false);
|
||||
INT10_TeletypeOutput(' ',7,false);
|
||||
} else {
|
||||
continue; //no data read yet so restart whileloop.
|
||||
}
|
||||
@ -96,7 +98,7 @@ bool device_CON::Read(Bit8u * data,Bit16u * size) {
|
||||
|
||||
}
|
||||
if(dos.echo) { //what to do if *size==1 and character is BS ?????
|
||||
INT10_TeletypeOutput(reg_al,7,false,0);
|
||||
INT10_TeletypeOutput(reg_al,7,false);
|
||||
}
|
||||
}
|
||||
*size=count;
|
||||
@ -108,9 +110,8 @@ bool device_CON::Read(Bit8u * data,Bit16u * size) {
|
||||
bool device_CON::Write(Bit8u * data,Bit16u * size) {
|
||||
Bit16u count=0;
|
||||
Bitu i;
|
||||
Bit8s col,row;
|
||||
static bool ansiwarned=false;
|
||||
|
||||
Bit8u col,row;
|
||||
Bit8u tempdata;
|
||||
while (*size>count) {
|
||||
if (!ansi.esc){
|
||||
if(data[count]=='\033') {
|
||||
@ -119,19 +120,16 @@ bool device_CON::Write(Bit8u * data,Bit16u * size) {
|
||||
/* start the sequence */
|
||||
ansi.esc=true;
|
||||
count++;
|
||||
if(!ansiwarned) {
|
||||
LOG(LOG_IOCTL,"ANSI sequences detected. enabling ansi support"); /* maybe LOG_MSG */
|
||||
ansiwarned=true;
|
||||
}
|
||||
continue;
|
||||
|
||||
} else {
|
||||
INT10_TeletypeOutput(data[count],ansi.attr,true,0);
|
||||
count++;
|
||||
continue;
|
||||
// pass attribute only if ansi is enabled
|
||||
INT10_TeletypeOutput(data[count],ansi.attr,ansi.enabled);
|
||||
count++;
|
||||
continue;
|
||||
};
|
||||
};
|
||||
/* ansi.esc=true */
|
||||
|
||||
if(!ansi.sci){
|
||||
|
||||
switch(data[count]){
|
||||
@ -143,7 +141,7 @@ bool device_CON::Write(Bit8u * data,Bit16u * size) {
|
||||
case 'D':/* scrolling DOWN*/
|
||||
case 'M':/* scrolling UP*/
|
||||
default:
|
||||
LOG(LOG_IOCTL,"ANSI: unknown char %c after a esc",data[count]); /*prob () */
|
||||
LOG(LOG_IOCTL,LOG_NORMAL)("ANSI: unknown char %c after a esc",data[count]); /*prob () */
|
||||
ClearAnsi();
|
||||
break;
|
||||
}
|
||||
@ -170,22 +168,23 @@ bool device_CON::Write(Bit8u * data,Bit16u * size) {
|
||||
break;
|
||||
case 'm': /* SGR */
|
||||
for(i=0;i<=ansi.numberofarg;i++){
|
||||
|
||||
ansi.enabled=true;
|
||||
switch(ansi.data[i]){
|
||||
case 0: /* normal */
|
||||
ansi.attr=0x7;
|
||||
ansi.enabled=false;
|
||||
break;
|
||||
case 1: /* bold mode on*/
|
||||
ansi.attr|=0x8;
|
||||
break;
|
||||
case 4: /* underline */
|
||||
LOG(LOG_IOCTL,"ANSI:no support for underline yet");
|
||||
LOG(LOG_IOCTL,LOG_NORMAL)("ANSI:no support for underline yet");
|
||||
break;
|
||||
case 5: /* blinking */
|
||||
LOG(LOG_IOCTL,"ANSI:no support for blinking yet");
|
||||
LOG(LOG_IOCTL,LOG_NORMAL)("ANSI:no support for blinking yet");
|
||||
break;
|
||||
case 7: /* reverse */
|
||||
LOG(LOG_IOCTL,"ANSI:no support for reverse yet");
|
||||
LOG(LOG_IOCTL,LOG_NORMAL)("ANSI:no support for reverse yet");
|
||||
break;
|
||||
case 30: /* fg color black */
|
||||
ansi.attr&=0xf8;
|
||||
@ -265,45 +264,64 @@ bool device_CON::Write(Bit8u * data,Bit16u * size) {
|
||||
INT10_SetCursorPos(--(ansi.data[0]),--(ansi.data[1]),0); /*ansi=1 based, int10 is 0 based */
|
||||
ClearAnsi();
|
||||
break;
|
||||
/* cursor up down and forward and backward only change the row or the col not both */
|
||||
case 'A': /* cursor up*/
|
||||
col=CURSOR_POS_COL(0) ;
|
||||
row=CURSOR_POS_ROW(0) - (ansi.data[0]? ansi.data[0] : 1);
|
||||
row=CURSOR_POS_ROW(0) ;
|
||||
tempdata = (ansi.data[0]? ansi.data[0] : 1);
|
||||
if(tempdata > row)
|
||||
{ row=0; }
|
||||
else
|
||||
{ row-=tempdata;}
|
||||
INT10_SetCursorPos(row,col,0);
|
||||
ClearAnsi();
|
||||
break;
|
||||
case 'B': /*cursor Down */
|
||||
col=CURSOR_POS_COL(0) ;
|
||||
row=CURSOR_POS_ROW(0) ;
|
||||
tempdata = (ansi.data[0]? ansi.data[0] : 1);
|
||||
if(tempdata + static_cast<Bitu>(row) >= ansi.nrows)
|
||||
{ row = ansi.nrows - 1;}
|
||||
else
|
||||
{ row += tempdata; }
|
||||
INT10_SetCursorPos(row,col,0);
|
||||
ClearAnsi();
|
||||
break;
|
||||
case 'C': /*cursor forward */
|
||||
col=CURSOR_POS_COL(0);
|
||||
row=CURSOR_POS_ROW(0);
|
||||
tempdata=(ansi.data[0]? ansi.data[0] : 1);
|
||||
if(tempdata + static_cast<Bitu>(col) >= ansi.ncols)
|
||||
{ col = ansi.ncols - 1;}
|
||||
else
|
||||
{ col += tempdata;}
|
||||
INT10_SetCursorPos(row,col,0);
|
||||
ClearAnsi();
|
||||
break;
|
||||
case 'C': /*cursor forward */
|
||||
col=CURSOR_POS_COL(0) + (ansi.data[0]? ansi.data[0] : 1);
|
||||
case 'D': /*Cursor Backward */
|
||||
col=CURSOR_POS_COL(0);
|
||||
row=CURSOR_POS_ROW(0);
|
||||
while(col>=ansi.ncols) {
|
||||
row++;
|
||||
col = col - ansi.ncols; // should depend on linebrake mode
|
||||
}
|
||||
tempdata=(ansi.data[0]? ansi.data[0] : 1);
|
||||
if(tempdata > col)
|
||||
{col = 0;}
|
||||
else
|
||||
{ col -= tempdata;}
|
||||
INT10_SetCursorPos(row,col,0);
|
||||
ClearAnsi();
|
||||
break;
|
||||
case 'J': /*erase screen and move cursor home*/
|
||||
if(ansi.data[0]==0) ansi.data[0]=2;
|
||||
if(ansi.data[0]!=2) {/* only number 2 (the standard one supported) */
|
||||
LOG(LOG_IOCTL,"ANSI: esc[%dJ called : not supported",ansi.data[0]);
|
||||
LOG(LOG_IOCTL,LOG_NORMAL)("ANSI: esc[%dJ called : not supported",ansi.data[0]);
|
||||
break;
|
||||
}
|
||||
for(i=0;i<(Bitu)ansi.ncols*ansi.nrows;i++) INT10_TeletypeOutput(' ',ansi.attr,true,0);
|
||||
for(i=0;i<(Bitu)ansi.ncols*ansi.nrows;i++) INT10_TeletypeOutput(' ',ansi.attr,true);
|
||||
ClearAnsi();
|
||||
INT10_SetCursorPos(0,0,0);
|
||||
break;
|
||||
case 'h': /* set MODE (if code =7 enable linewrap) */
|
||||
case 'I': /*RESET MODE */
|
||||
LOG(LOG_IOCTL,"ANSI: set/reset mode called(not supported)");
|
||||
ClearAnsi();
|
||||
break;
|
||||
case 'D': /*Cursor Backward */
|
||||
col=CURSOR_POS_COL(0) - (ansi.data[0]? ansi.data[0] : 1);
|
||||
row=CURSOR_POS_ROW(0);
|
||||
while(col<0) {
|
||||
row--;
|
||||
col = col + ansi.ncols ; // should depend on linebrake mode
|
||||
}
|
||||
INT10_SetCursorPos(row,col,0);
|
||||
LOG(LOG_IOCTL,LOG_NORMAL)("ANSI: set/reset mode called(not supported)");
|
||||
ClearAnsi();
|
||||
break;
|
||||
case 'u': /* Restore Cursor Pos */
|
||||
@ -315,12 +333,15 @@ bool device_CON::Write(Bit8u * data,Bit16u * size) {
|
||||
ansi.saverow=CURSOR_POS_ROW(0);
|
||||
ClearAnsi();
|
||||
break;
|
||||
case 'K':/* erase till end of line */
|
||||
case 'K':/* erase till end of line */
|
||||
for(i = CURSOR_POS_COL(0);i<(Bitu) ansi.ncols; i++) INT10_TeletypeOutput(' ',ansi.attr,true);
|
||||
ClearAnsi(); /* maybe set cursor back to starting place ???? */
|
||||
break;
|
||||
case 'l':/* (if code =7) disable linewrap */
|
||||
case 'p':/* reassign keys (needs strings) */
|
||||
case 'i':/* printer stuff */
|
||||
default:
|
||||
LOG(LOG_IOCTL,"ANSI: unhandled char %c in esc[",data[count]);
|
||||
LOG(LOG_IOCTL,LOG_NORMAL)("ANSI: unhandled char %c in esc[",data[count]);
|
||||
ClearAnsi();
|
||||
break;
|
||||
}
|
||||
@ -353,13 +374,15 @@ device_CON::device_CON() {
|
||||
cache=0;
|
||||
ansi.esc=false;
|
||||
ansi.sci=false;
|
||||
ansi.enabled=false;
|
||||
ansi.attr=0x7;
|
||||
ansi.numberofarg=0;
|
||||
for(Bit8u i=0; i<NUMBER_ANSI_DATA;i++) ansi.data[i]=0;
|
||||
ansi.ncols=real_readw(BIOSMEM_SEG,BIOSMEM_NB_COLS); //should be updated once set/reset mode is implemented
|
||||
ansi.nrows=real_readb(BIOSMEM_SEG,BIOSMEM_NB_ROWS);
|
||||
ansi.nrows=real_readb(BIOSMEM_SEG,BIOSMEM_NB_ROWS) + 1;
|
||||
ansi.saverow=0;
|
||||
ansi.savecol=0;
|
||||
ClearAnsi();
|
||||
}
|
||||
|
||||
void device_CON::ClearAnsi(void){
|
||||
|
126
src/dos/dos.cpp
126
src/dos/dos.cpp
@ -16,6 +16,8 @@
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: dos.cpp,v 1.57 2003/10/14 23:33:33 harekiet Exp $ */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -28,7 +30,6 @@
|
||||
#include "regs.h"
|
||||
#include "dos_inc.h"
|
||||
#include "setup.h"
|
||||
#include "cpu.h"
|
||||
|
||||
DOS_Block dos;
|
||||
DOS_InfoBlock dos_infoblock;
|
||||
@ -43,6 +44,10 @@ void DOS_SetError(Bit16u code) {
|
||||
|
||||
#define DOSNAMEBUF 256
|
||||
static Bitu DOS_21Handler(void) {
|
||||
|
||||
DOS_PSP psp(dos.psp);
|
||||
psp.SetStack(RealMake(SegValue(ss),reg_sp));
|
||||
|
||||
char name1[DOSNAMEBUF+1];
|
||||
char name2[DOSNAMEBUF+1];
|
||||
switch (reg_ah) {
|
||||
@ -172,7 +177,7 @@ static Bitu DOS_21Handler(void) {
|
||||
}else{
|
||||
reg_al=0xff;
|
||||
}
|
||||
LOG(LOG_FCB,"DOS:0x0f FCB-fileopen used, result:al=%d",reg_al);
|
||||
LOG(LOG_FCB,LOG_NORMAL)("DOS:0x0f FCB-fileopen used, result:al=%d",reg_al);
|
||||
break;
|
||||
case 0x10: /* Close File using FCB */
|
||||
if(DOS_FCBClose(SegValue(ds),reg_dx)){
|
||||
@ -180,7 +185,7 @@ static Bitu DOS_21Handler(void) {
|
||||
}else{
|
||||
reg_al=0xff;
|
||||
}
|
||||
LOG(LOG_FCB,"DOS:0x10 FCB-fileclose used, result:al=%d",reg_al);
|
||||
LOG(LOG_FCB,LOG_NORMAL)("DOS:0x10 FCB-fileclose used, result:al=%d",reg_al);
|
||||
break;
|
||||
case 0x11: /* Find First Matching File using FCB */
|
||||
if(DOS_FCBFindFirst(SegValue(ds),reg_dx)){
|
||||
@ -188,7 +193,7 @@ static Bitu DOS_21Handler(void) {
|
||||
}else{
|
||||
reg_al=0xff;
|
||||
}
|
||||
LOG(LOG_FCB,"DOS:0x11 FCB-FindFirst used, result:al=%d",reg_al);
|
||||
LOG(LOG_FCB,LOG_NORMAL)("DOS:0x11 FCB-FindFirst used, result:al=%d",reg_al);
|
||||
break;
|
||||
case 0x12: /* Find Next Matching File using FCB */
|
||||
if(DOS_FCBFindNext(SegValue(ds),reg_dx)){
|
||||
@ -196,7 +201,7 @@ static Bitu DOS_21Handler(void) {
|
||||
}else{
|
||||
reg_al=0xff;
|
||||
}
|
||||
LOG(LOG_FCB,"DOS:0x12 FCB-FindNext used, result:al=%d",reg_al);
|
||||
LOG(LOG_FCB,LOG_NORMAL)("DOS:0x12 FCB-FindNext used, result:al=%d",reg_al);
|
||||
break;
|
||||
case 0x13: /* Delete File using FCB */
|
||||
if (DOS_FCBDeleteFile(SegValue(ds),reg_dx)) reg_al = 0x00;
|
||||
@ -204,16 +209,16 @@ static Bitu DOS_21Handler(void) {
|
||||
break;
|
||||
case 0x14: /* Sequential read from FCB */
|
||||
reg_al = DOS_FCBRead(SegValue(ds),reg_dx,0);
|
||||
LOG(LOG_FCB,"DOS:0x14 FCB-Read used, result:al=%d",reg_al);
|
||||
LOG(LOG_FCB,LOG_NORMAL)("DOS:0x14 FCB-Read used, result:al=%d",reg_al);
|
||||
break;
|
||||
case 0x15: /* Sequential write to FCB */
|
||||
reg_al=DOS_FCBWrite(SegValue(ds),reg_dx,0);
|
||||
LOG(LOG_FCB,"DOS:0x15 FCB-Write used, result:al=%d",reg_al);
|
||||
LOG(LOG_FCB,LOG_NORMAL)("DOS:0x15 FCB-Write used, result:al=%d",reg_al);
|
||||
break;
|
||||
case 0x16: /* Create or truncate file using FCB */
|
||||
if (DOS_FCBCreate(SegValue(ds),reg_dx)) reg_al = 0x00;
|
||||
else reg_al = 0xFF;
|
||||
LOG(LOG_FCB,"DOS:0x16 FCB-Create used, result:al=%d",reg_al);
|
||||
LOG(LOG_FCB,LOG_NORMAL)("DOS:0x16 FCB-Create used, result:al=%d",reg_al);
|
||||
break;
|
||||
case 0x17: /* Rename file using FCB */
|
||||
if (DOS_FCBRenameFile(SegValue(ds),reg_dx)) reg_al = 0x00;
|
||||
@ -227,11 +232,11 @@ static Bitu DOS_21Handler(void) {
|
||||
break;
|
||||
case 0x21: /* Read random record from FCB */
|
||||
reg_al = DOS_FCBRandomRead(SegValue(ds),reg_dx,1,true);
|
||||
LOG(LOG_FCB,"DOS:0x21 FCB-Random read used, result:al=%d",reg_al);
|
||||
LOG(LOG_FCB,LOG_NORMAL)("DOS:0x21 FCB-Random read used, result:al=%d",reg_al);
|
||||
break;
|
||||
case 0x22: /* Write random record to FCB */
|
||||
reg_al=DOS_FCBRandomWrite(SegValue(ds),reg_dx,1,true);
|
||||
LOG(LOG_FCB,"DOS:0x22 FCB-Random write used, result:al=%d",reg_al);
|
||||
LOG(LOG_FCB,LOG_NORMAL)("DOS:0x22 FCB-Random write used, result:al=%d",reg_al);
|
||||
break;
|
||||
case 0x23: /* Get file size for FCB */
|
||||
if (DOS_FCBGetFileSize(SegValue(ds),reg_dx,reg_cx)) reg_al = 0x00;
|
||||
@ -242,11 +247,11 @@ static Bitu DOS_21Handler(void) {
|
||||
break;
|
||||
case 0x27: /* Random block read from FCB */
|
||||
reg_al = DOS_FCBRandomRead(SegValue(ds),reg_dx,reg_cx,false);
|
||||
LOG(LOG_FCB,"DOS:0x27 FCB-Random(block) read used, result:al=%d",reg_al);
|
||||
LOG(LOG_FCB,LOG_NORMAL)("DOS:0x27 FCB-Random(block) read used, result:al=%d",reg_al);
|
||||
break;
|
||||
case 0x28: /* Random Block write to FCB */
|
||||
reg_al=DOS_FCBRandomWrite(SegValue(ds),reg_dx,reg_cx,false);
|
||||
LOG(LOG_FCB,"DOS:0x28 FCB-Random(block) write used, result:al=%d",reg_al);
|
||||
LOG(LOG_FCB,LOG_NORMAL)("DOS:0x28 FCB-Random(block) write used, result:al=%d",reg_al);
|
||||
break;
|
||||
case 0x29: /* Parse filename into FCB */
|
||||
{ Bit8u difference;
|
||||
@ -255,7 +260,7 @@ static Bitu DOS_21Handler(void) {
|
||||
reg_al=FCB_Parsename(SegValue(es),reg_di,reg_al ,string, &difference);
|
||||
reg_si+=difference;
|
||||
}
|
||||
LOG(LOG_FCB,"DOS:29:FCB Parse Filename, result:al=%d",reg_al);
|
||||
LOG(LOG_FCB,LOG_NORMAL)("DOS:29:FCB Parse Filename, result:al=%d",reg_al);
|
||||
break;
|
||||
case 0x19: /* Get current default drive */
|
||||
reg_al=DOS_GetDefaultDrive();
|
||||
@ -296,16 +301,18 @@ static Bitu DOS_21Handler(void) {
|
||||
case 0x2c: /* Get System Time */
|
||||
//TODO Get time through bios calls date is fixed
|
||||
{
|
||||
Bit32u ticks=mem_readd(BIOS_TIMER);
|
||||
Bit32u seconds=(ticks*10)/182;
|
||||
/* Calculate how many miliseconds have passed */
|
||||
Bitu ticks=5*mem_readd(BIOS_TIMER);
|
||||
ticks = ((ticks / 59659u) << 16) + ((ticks % 59659u) << 16) / 59659u;
|
||||
Bitu seconds=(ticks/100);
|
||||
reg_ch=(Bit8u)(seconds/3600);
|
||||
reg_cl=(Bit8u)((seconds % 3600)/60);
|
||||
reg_dh=(Bit8u)(seconds % 60);
|
||||
reg_dl=(Bit8u)(((ticks * 10) % 182)*100)/182;
|
||||
reg_dl=(Bit8u)(ticks % 100);
|
||||
}
|
||||
break;
|
||||
case 0x2d: /* Set System Time */
|
||||
LOG(LOG_ERROR,"DOS:Set System Time not supported");
|
||||
LOG(LOG_DOSMISC,LOG_ERROR)("DOS:Set System Time not supported");
|
||||
reg_al=0; /* Noone is changing system time */
|
||||
break;
|
||||
case 0x2e: /* Set Verify flag */
|
||||
@ -322,16 +329,12 @@ static Bitu DOS_21Handler(void) {
|
||||
reg_ah=dos.version.minor;
|
||||
break;
|
||||
case 0x31: /* Terminate and stay resident */
|
||||
//TODO First get normal files executing
|
||||
//TODO First get normal files executing
|
||||
// Important: This service does not set the carry flag!
|
||||
DOS_ResizeMemory(dos.psp,®_dx);
|
||||
if (DOS_Terminate(true)) {
|
||||
dos.return_code=reg_al;
|
||||
dos.return_mode=RETURN_TSR;
|
||||
CALLBACK_SCF(false);
|
||||
} else {
|
||||
reg_ax=dos.errorcode;
|
||||
CALLBACK_SCF(true);
|
||||
}
|
||||
DOS_Terminate(true);
|
||||
dos.return_code=reg_al;
|
||||
dos.return_mode=RETURN_TSR;
|
||||
break;
|
||||
case 0x33: /* Extended Break Checking */
|
||||
switch (reg_al) {
|
||||
@ -383,7 +386,7 @@ static Bitu DOS_21Handler(void) {
|
||||
case 3:
|
||||
reg_al=0;break;
|
||||
};
|
||||
LOG(LOG_ERROR|LOG_MISC,"DOS:0x37:Call for not supported switchchar");
|
||||
LOG(LOG_MISC,LOG_ERROR)("DOS:0x37:Call for not supported switchchar");
|
||||
break;
|
||||
case 0x38: /* Set Country Code */
|
||||
if (reg_al==0) { /* Get country specidic information */
|
||||
@ -403,7 +406,7 @@ static Bitu DOS_21Handler(void) {
|
||||
CALLBACK_SCF(false);
|
||||
break;
|
||||
} else { /* Set country code */
|
||||
LOG(LOG_ERROR|LOG_MISC,"DOS:Setting country code not supported");
|
||||
LOG(LOG_MISC,LOG_ERROR)("DOS:Setting country code not supported");
|
||||
}
|
||||
CALLBACK_SCF(true);
|
||||
break;
|
||||
@ -523,11 +526,13 @@ static Bitu DOS_21Handler(void) {
|
||||
}
|
||||
break;
|
||||
case 0x01: /* Set */
|
||||
LOG(LOG_ERROR|LOG_MISC,"DOS:Set File Attributes for %s not supported",name1);
|
||||
LOG(LOG_MISC,LOG_ERROR)("DOS:Set File Attributes for %s not supported",name1);
|
||||
CALLBACK_SCF(false);
|
||||
break;
|
||||
default:
|
||||
E_Exit("DOS:0x43:Illegal subfunction %2X",reg_al);
|
||||
LOG(LOG_MISC,LOG_ERROR)("DOS:0x43:Illegal subfunction %2X",reg_al);
|
||||
CALLBACK_SCF(false);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 0x44: /* IOCTL Functions */
|
||||
@ -600,7 +605,7 @@ static Bitu DOS_21Handler(void) {
|
||||
case 0x4b: /* EXEC Load and/or execute program */
|
||||
{
|
||||
MEM_StrCopy(SegPhys(ds)+reg_dx,name1,DOSNAMEBUF);
|
||||
LOG(LOG_ERROR|LOG_MISC,"Execute %s %d",name1,reg_al);
|
||||
LOG(LOG_EXEC,LOG_ERROR)("Execute %s %d",name1,reg_al);
|
||||
if (!DOS_Execute(name1,SegPhys(es)+reg_bx,reg_al)) {
|
||||
reg_ax=dos.errorcode;
|
||||
CALLBACK_SCF(true);
|
||||
@ -654,7 +659,7 @@ static Bitu DOS_21Handler(void) {
|
||||
RealPt addr=dos_infoblock.GetPointer();
|
||||
SegSet16(es,RealSeg(addr));
|
||||
reg_bx=RealOff(addr);
|
||||
LOG(LOG_MISC,"Call is made for list of lists - let's hope for the best");
|
||||
LOG(LOG_DOSMISC,LOG_NORMAL)("Call is made for list of lists - let's hope for the best");
|
||||
break; }
|
||||
//TODO Think hard how shit this is gonna be
|
||||
//And will any game ever use this :)
|
||||
@ -665,7 +670,7 @@ static Bitu DOS_21Handler(void) {
|
||||
reg_al=dos.verify?1:0;
|
||||
break;
|
||||
case 0x55: /* Create Child PSP*/
|
||||
DOS_NewPSP(reg_dx,reg_si);
|
||||
DOS_ChildPSP(reg_dx,reg_si);
|
||||
dos.psp = reg_dx;
|
||||
break;
|
||||
case 0x56: /* RENAME Rename file */
|
||||
@ -684,11 +689,12 @@ static Bitu DOS_21Handler(void) {
|
||||
CALLBACK_SCF(false);
|
||||
} else {
|
||||
CALLBACK_SCF(true);
|
||||
};
|
||||
}
|
||||
} else if (reg_al==0x01) {
|
||||
LOG(LOG_DOSMISC,LOG_ERROR)("DOS:57:Set File Date Time Faked");
|
||||
CALLBACK_SCF(false);
|
||||
} else {
|
||||
reg_cx=0;
|
||||
reg_dx=0;
|
||||
LOG(LOG_ERROR|LOG_MISC,"DOS:57:Setting File Date is faked",reg_ah);
|
||||
LOG(LOG_DOSMISC,LOG_ERROR)("DOS:57:Unsupported subtion %X",reg_al);
|
||||
}
|
||||
break;
|
||||
case 0x58: /* Get/Set Memory allocation strategy */
|
||||
@ -708,7 +714,7 @@ static Bitu DOS_21Handler(void) {
|
||||
CALLBACK_SCF(true);
|
||||
break;
|
||||
default:
|
||||
LOG(LOG_ERROR|LOG_MISC,"DOS:58:Not Supported Set//Get memory allocation call %X",reg_al);
|
||||
LOG(LOG_DOSMISC,LOG_ERROR)("DOS:58:Not Supported Set//Get memory allocation call %X",reg_al);
|
||||
}
|
||||
break;
|
||||
case 0x59: /* Get Extended error information */
|
||||
@ -769,7 +775,7 @@ static Bitu DOS_21Handler(void) {
|
||||
case 0x65: /* Get extented country information and a lot of other useless shit*/
|
||||
/* Todo maybe fully support this for now we set it standard for USA */
|
||||
{
|
||||
LOG(LOG_ERROR|LOG_MISC,"DOS:65:Extended country information call");
|
||||
LOG(LOG_DOSMISC,LOG_ERROR)("DOS:65:Extended country information call");
|
||||
PhysPt data=SegPhys(es)+reg_di;
|
||||
switch (reg_al) {
|
||||
case 1:
|
||||
@ -798,12 +804,12 @@ static Bitu DOS_21Handler(void) {
|
||||
}
|
||||
case 0x66: /* Get/Set global code page table */
|
||||
if (reg_al==1) {
|
||||
LOG(LOG_ERROR|LOG_MISC,"Getting global code page table");
|
||||
LOG(LOG_DOSMISC,LOG_ERROR)("Getting global code page table");
|
||||
reg_bx=reg_dx=437;
|
||||
CALLBACK_SCF(false);
|
||||
break;
|
||||
}
|
||||
LOG(LOG_DOSMISC,"DOS:Setting code page table is not supported");
|
||||
LOG(LOG_DOSMISC,LOG_NORMAL)("DOS:Setting code page table is not supported");
|
||||
break;
|
||||
case 0x67: /* Set handle count */
|
||||
/* Weird call to increase amount of file handles needs to allocate memory if >20 */
|
||||
@ -817,23 +823,29 @@ static Bitu DOS_21Handler(void) {
|
||||
{
|
||||
switch(reg_al) {
|
||||
case 0x00: /* Get */
|
||||
LOG(LOG_ERROR|LOG_MISC,"DOS:Get Disk serial number");
|
||||
LOG(LOG_DOSMISC,LOG_ERROR)("DOS:Get Disk serial number");
|
||||
CALLBACK_SCF(true);
|
||||
break;
|
||||
case 0x01:
|
||||
LOG(LOG_ERROR|LOG_MISC,"DOS:Set Disk serial number");
|
||||
LOG(LOG_DOSMISC,LOG_ERROR)("DOS:Set Disk serial number");
|
||||
default:
|
||||
E_Exit("DOS:Illegal Get Serial Number call %2X",reg_al);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 0x6c: /* Extended Open/Create */
|
||||
E_Exit("Unhandled Dos 21 call %02X",reg_ah);
|
||||
MEM_StrCopy(SegPhys(ds)+reg_si,name1,DOSNAMEBUF);
|
||||
if (DOS_OpenFileExtended(name1,reg_bx,reg_cx,reg_dx,®_ax,®_cx)) {
|
||||
CALLBACK_SCF(false);
|
||||
} else {
|
||||
reg_ax=dos.errorcode;
|
||||
CALLBACK_SCF(true);
|
||||
}
|
||||
break;
|
||||
case 0x71: /* Unknown probably 4dos detection */
|
||||
reg_ax=0x7100;
|
||||
CALLBACK_SCF(true);
|
||||
LOG(LOG_DOSMISC,"DOS:Windows long file name support call %2X",reg_al);
|
||||
LOG(LOG_DOSMISC,LOG_NORMAL)("DOS:Windows long file name support call %2X",reg_al);
|
||||
break;
|
||||
case 0x68: /* FFLUSH Commit file */
|
||||
case 0x63: /* Weirdo double byte stuff (fails but say it succeeded) available only in MSDOS 2.25 */
|
||||
@ -854,7 +866,7 @@ static Bitu DOS_21Handler(void) {
|
||||
case 0x5e: /* More Network Functions */
|
||||
case 0x5f: /* And Even More Network Functions */
|
||||
default:
|
||||
LOG(LOG_ERROR|LOG_MISC,"DOS:Unhandled call %02X al=%02X. Set al to default of 0",reg_ah,reg_al);
|
||||
LOG(LOG_DOSMISC,LOG_ERROR)("DOS:Unhandled call %02X al=%02X. Set al to default of 0",reg_ah,reg_al);
|
||||
reg_al=0x00; /* default value */
|
||||
break;
|
||||
};
|
||||
@ -879,27 +891,26 @@ static Bitu DOS_27Handler(void)
|
||||
return CBRET_NONE;
|
||||
}
|
||||
static Bitu DOS_25Handler(void) {
|
||||
flags.type=t_UNKNOWN;
|
||||
flags.type=0;
|
||||
if(Drives[reg_al]==0){
|
||||
reg_ax=0x8002;
|
||||
flags.cf=true;
|
||||
SETFLAGBIT(CF,true);
|
||||
}else{
|
||||
flags.cf=false;
|
||||
SETFLAGBIT(CF,false);
|
||||
reg_ax=0;
|
||||
if((reg_cx != 1) ||(reg_dx != 1))
|
||||
LOG(LOG_DOSMISC,"int 25 called but not as diskdetection");
|
||||
LOG(LOG_DOSMISC,LOG_NORMAL)("int 25 called but not as diskdetection");
|
||||
}
|
||||
return CBRET_NONE;
|
||||
}
|
||||
static Bitu DOS_26Handler(void) {
|
||||
LOG(LOG_DOSMISC,"int 26 called: hope for the best!");
|
||||
flags.type=t_UNKNOWN;
|
||||
LOG(LOG_DOSMISC,LOG_NORMAL)("int 26 called: hope for the best!");
|
||||
flags.type=0;
|
||||
if(Drives[reg_al]==0){
|
||||
|
||||
reg_ax=0x8002;
|
||||
flags.cf=true;
|
||||
SETFLAGBIT(CF,true);
|
||||
}else{
|
||||
flags.cf=false;
|
||||
SETFLAGBIT(CF,false);
|
||||
reg_ax=0;
|
||||
}
|
||||
return CBRET_NONE;
|
||||
@ -909,12 +920,12 @@ static Bitu DOS_28Handler(void) {
|
||||
}
|
||||
|
||||
static Bitu DOS_29Handler(void) {
|
||||
LOG(LOG_ERROR|LOG_MISC,"int 29 called");
|
||||
LOG(LOG_DOSMISC,LOG_ERROR)("int 29 called");
|
||||
return CBRET_NONE;
|
||||
}
|
||||
|
||||
static Bitu DOS_CaseMapFunc(void) {
|
||||
//LOG(LOG_ERROR|LOG_MISC,"Case map routine called : %c",reg_al);
|
||||
//LOG(LOG_DOSMISC,LOG_ERROR)("Case map routine called : %c",reg_al);
|
||||
return CBRET_NONE;
|
||||
};
|
||||
|
||||
@ -925,7 +936,6 @@ void DOS_ShutDown(Section* sec)
|
||||
|
||||
|
||||
void DOS_Init(Section* sec) {
|
||||
MSG_Add("DOS_CONFIGFILE_HELP","Setting a memory size to 0 will disable it.\n");
|
||||
call_20=CALLBACK_Allocate();
|
||||
CALLBACK_Setup(call_20,DOS_20Handler,CB_IRET);
|
||||
RealSetVec(0x20,CALLBACK_RealPointer(call_20));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2002 The DOSBox Team
|
||||
* Copyright (C) 2002-2003 The DOSBox Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -16,6 +16,8 @@
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: dos_classes.cpp,v 1.32 2003/10/09 13:47:06 finsterr Exp $ */
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "dosbox.h"
|
||||
@ -73,6 +75,12 @@ void DOS_InfoBlock::SetfirstFileTable(RealPt _first_table){
|
||||
sSave(sDIB,firstFileTable,_first_table);
|
||||
}
|
||||
|
||||
void DOS_InfoBlock::SetBuffers(Bit16u x,Bit16u y) {
|
||||
sSave(sDIB,buffers_x,x);
|
||||
sSave(sDIB,buffers_y,y);
|
||||
|
||||
}
|
||||
|
||||
RealPt DOS_InfoBlock::GetPointer(void)
|
||||
{
|
||||
return RealMake(seg,offsetof(sDIB,firstDPB));
|
||||
@ -94,7 +102,9 @@ void DOS_PSP::MakeNew(Bit16u mem_size)
|
||||
sSave(sPSP,next_seg,seg+mem_size);
|
||||
/* far call opcode */
|
||||
sSave(sPSP,far_call,0xea);
|
||||
// sSave(sPSP,cmp_entry
|
||||
// far call to interrupt 0x21 - faked for bill & ted
|
||||
// lets hope nobody really uses this address
|
||||
sSave(sPSP,cpm_entry,RealMake(0xDEAD,0xFFFF));
|
||||
/* Standard blocks,int 20 and int21 retf */
|
||||
sSave(sPSP,exit[0],0xcd);
|
||||
sSave(sPSP,exit[1],0x20);
|
||||
@ -148,19 +158,34 @@ Bit16u DOS_PSP::FindFreeFileEntry(void)
|
||||
Bit16u DOS_PSP::FindEntryByHandle(Bit8u handle)
|
||||
{
|
||||
PhysPt files=Real2Phys(sGet(sPSP,file_table));
|
||||
Bit16u max = sGet(sPSP,max_files);
|
||||
for (Bit16u i=0;i<sGet(sPSP,max_files);i++) {
|
||||
if (mem_readb(files+i)==handle) return i;
|
||||
}
|
||||
return 0xFF;
|
||||
};
|
||||
|
||||
void DOS_PSP::CopyFileTable(DOS_PSP* srcpsp)
|
||||
void DOS_PSP::CopyFileTable(DOS_PSP* srcpsp,bool createchildpsp)
|
||||
{
|
||||
/* Copy file table from calling process */
|
||||
for (Bit16u i=0;i<20;i++) {
|
||||
Bit8u handle = srcpsp->GetFileHandle(i);
|
||||
SetFileHandle(i,handle);
|
||||
if(createchildpsp)
|
||||
{ //copy obeying not inherit flag.(but dont duplicate them)
|
||||
bool allowCopy = (handle==0) || ((handle>0) && (FindEntryByHandle(handle)==0xff));
|
||||
if((handle<DOS_FILES) && Files[handle] && !(Files[handle]->flags & DOS_NOT_INHERIT) && allowCopy)
|
||||
{
|
||||
Files[handle]->AddRef();
|
||||
SetFileHandle(i,handle);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetFileHandle(i,0xff);
|
||||
}
|
||||
}
|
||||
else
|
||||
{ //normal copy so don't mind the inheritance
|
||||
SetFileHandle(i,handle);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -211,6 +236,7 @@ bool DOS_PSP::SetNumFiles(Bit16u fileNum)
|
||||
{
|
||||
if (fileNum>20) {
|
||||
// Allocate needed paragraphs
|
||||
fileNum+=2; // Add a few more files for safety
|
||||
Bit16u para = (fileNum/16)+((fileNum%16)>0);
|
||||
RealPt data = RealMake(DOS_GetMemory(para),0);
|
||||
sSave(sPSP,file_table,data);
|
||||
@ -230,7 +256,7 @@ void DOS_DTA::SetupSearch(Bit8u _sdrive,Bit8u _sattr,char * pattern) {
|
||||
sSave(sDTA,sattr,_sattr);
|
||||
/* Fill with spaces */
|
||||
Bitu i;
|
||||
for (i=0;i<12;i++) mem_writeb(pt+offsetof(sDTA,sname)+i,' ');
|
||||
for (i=0;i<11;i++) mem_writeb(pt+offsetof(sDTA,sname)+i,' ');
|
||||
char * find_ext;
|
||||
find_ext=strchr(pattern,'.');
|
||||
if (find_ext) {
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include <string.h>
|
||||
#include "dosbox.h"
|
||||
#include "callback.h"
|
||||
#include "cpu.h"
|
||||
#include "regs.h"
|
||||
#include "mem.h"
|
||||
#include "bios.h"
|
||||
#include "dos_inc.h"
|
||||
|
@ -20,11 +20,13 @@
|
||||
#include "dosbox.h"
|
||||
#include "mem.h"
|
||||
#include "dos_inc.h"
|
||||
#include "cpu.h"
|
||||
#include "regs.h"
|
||||
#include "callback.h"
|
||||
#include "debug.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack(1)
|
||||
#endif
|
||||
struct EXE_Header {
|
||||
Bit16u signature; /* EXE Signature MZ or ZM */
|
||||
Bit16u extrabytes; /* Bytes on the last page */
|
||||
@ -41,7 +43,9 @@ struct EXE_Header {
|
||||
Bit16u reloctable;
|
||||
Bit16u overlay;
|
||||
} GCC_ATTRIBUTE(packed);
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack()
|
||||
#endif
|
||||
|
||||
#define MAGIC1 0x5a4d
|
||||
#define MAGIC2 0x4d5a
|
||||
@ -91,11 +95,12 @@ bool DOS_Terminate(bool tsr) {
|
||||
dos.return_mode=RETURN_EXIT;
|
||||
|
||||
Bit16u mempsp = dos.psp;
|
||||
|
||||
DOS_PSP curpsp(dos.psp);
|
||||
if (dos.psp==curpsp.GetParent()) return true;
|
||||
|
||||
/* Free Files owned by process */
|
||||
if (!tsr) curpsp.CloseFiles();
|
||||
if (!tsr) curpsp.CloseFiles();
|
||||
|
||||
/* Get the termination address */
|
||||
RealPt old22 = curpsp.GetInt22();
|
||||
/* Restore vector 22,23,24 */
|
||||
@ -124,55 +129,64 @@ static bool MakeEnv(char * name,Bit16u * segment) {
|
||||
|
||||
/* If segment to copy environment is 0 copy the caller's environment */
|
||||
DOS_PSP psp(dos.psp);
|
||||
Bit8u * envread,*envwrite;
|
||||
PhysPt envread,envwrite;
|
||||
Bit16u envsize=1;
|
||||
bool parentenv=true;
|
||||
|
||||
if (*segment==0) {
|
||||
if (!psp.GetEnvironment()) parentenv=false; //environment seg=0
|
||||
envread=HostMake(psp.GetEnvironment(),0);
|
||||
envread=PhysMake(psp.GetEnvironment(),0);
|
||||
} else {
|
||||
if (!*segment) parentenv=false; //environment seg=0
|
||||
envread=HostMake(*segment,0);
|
||||
envread=PhysMake(*segment,0);
|
||||
}
|
||||
|
||||
if (parentenv) {
|
||||
// hack to allow creation from envblock in unused mem (0xCD)
|
||||
if (readw(envread)==0xCDCD) writew(envread,0x0000);
|
||||
|
||||
for (envsize=0; ;envsize++) {
|
||||
if (envsize>=MAXENV - ENV_KEEPFREE) {
|
||||
DOS_SetError(DOSERR_ENVIRONMENT_INVALID);
|
||||
return false;
|
||||
}
|
||||
if (readw(envread+envsize)==0) break;
|
||||
if (mem_readw(envread+envsize)==0) break;
|
||||
}
|
||||
envsize += 2; /* account for trailing \0\0 */
|
||||
}
|
||||
Bit16u size=long2para(envsize+ENV_KEEPFREE);
|
||||
if (!DOS_AllocateMemory(segment,&size)) return false;
|
||||
envwrite=HostMake(*segment,0);
|
||||
envwrite=PhysMake(*segment,0);
|
||||
if (parentenv) {
|
||||
bmemcpy(envwrite,envread,envsize);
|
||||
MEM_BlockCopy(envwrite,envread,envsize);
|
||||
// mem_memcpy(envwrite,envread,envsize);
|
||||
envwrite+=envsize;
|
||||
} else {
|
||||
*envwrite++=0;
|
||||
mem_writeb(envwrite++,0);
|
||||
}
|
||||
*((Bit16u *) envwrite)=1;
|
||||
mem_writew(envwrite,1);
|
||||
envwrite+=2;
|
||||
|
||||
return DOS_Canonicalize(name,(char *)envwrite);
|
||||
};
|
||||
char namebuf[DOS_PATHLENGTH];
|
||||
if (DOS_Canonicalize(name,namebuf)) {
|
||||
MEM_BlockWrite(envwrite,namebuf,strlen(namebuf)+1);
|
||||
return true;
|
||||
} else return false;
|
||||
}
|
||||
|
||||
bool DOS_NewPSP(Bit16u segment, Bit16u size)
|
||||
{
|
||||
DOS_PSP psp(segment);
|
||||
psp.MakeNew(size);
|
||||
DOS_PSP psp_parent(psp.GetParent());
|
||||
psp.CopyFileTable(&psp_parent);
|
||||
psp.CopyFileTable(&psp_parent,false);
|
||||
return true;
|
||||
};
|
||||
|
||||
bool DOS_ChildPSP(Bit16u segment, Bit16u size)
|
||||
{
|
||||
DOS_PSP psp(segment);
|
||||
psp.MakeNew(size);
|
||||
DOS_PSP psp_parent(psp.GetParent());
|
||||
psp.CopyFileTable(&psp_parent,true);
|
||||
return true;
|
||||
};
|
||||
static void SetupPSP(Bit16u pspseg,Bit16u memsize,Bit16u envseg) {
|
||||
|
||||
/* Fix the PSP for psp and environment MCB's */
|
||||
@ -184,11 +198,11 @@ static void SetupPSP(Bit16u pspseg,Bit16u memsize,Bit16u envseg) {
|
||||
DOS_PSP psp(pspseg);
|
||||
psp.MakeNew(memsize);
|
||||
psp.SetEnvironment(envseg);
|
||||
/* Copy file handles */
|
||||
if (DOS_PSP::rootpsp!=dos.psp) {
|
||||
/* Copy file handles //QBIX::ALWAYS COPY BUT LEFT ORIGINAL INCASE OF MISTAKES
|
||||
/* if (DOS_PSP::rootpsp!=dos.psp) { */
|
||||
// TODO: Improve this
|
||||
// If prog wasnt started from commandline copy file table (California Games 2)
|
||||
DOS_PSP oldpsp(dos.psp);
|
||||
/* DOS_PSP oldpsp(dos.psp);
|
||||
psp.CopyFileTable(&oldpsp);
|
||||
} else {
|
||||
psp.SetFileHandle(STDIN ,DOS_FindDevice("CON"));
|
||||
@ -197,8 +211,11 @@ static void SetupPSP(Bit16u pspseg,Bit16u memsize,Bit16u envseg) {
|
||||
psp.SetFileHandle(STDAUX,DOS_FindDevice("CON"));
|
||||
psp.SetFileHandle(STDNUL,DOS_FindDevice("CON"));
|
||||
psp.SetFileHandle(STDPRN,DOS_FindDevice("CON"));
|
||||
}
|
||||
} */
|
||||
/* Save old DTA in psp */
|
||||
DOS_PSP oldpsp(dos.psp);
|
||||
psp.CopyFileTable(&oldpsp,true);
|
||||
|
||||
psp.SetDTA(dos.dta);
|
||||
/* Setup the DTA */
|
||||
dos.dta=RealMake(pspseg,0x80);
|
||||
@ -215,9 +232,10 @@ bool DOS_Execute(char * name,PhysPt block_pt,Bit8u flags) {
|
||||
EXE_Header head;Bitu i;
|
||||
Bit16u fhandle;Bit16u len;Bit32u pos;
|
||||
Bit16u pspseg,envseg,loadseg,memsize,readsize;
|
||||
HostPt loadaddress;RealPt relocpt;
|
||||
PhysPt loadaddress;RealPt relocpt;
|
||||
Bitu headersize,imagesize;
|
||||
DOS_ParamBlock block(block_pt);
|
||||
|
||||
block.LoadData();
|
||||
if (flags!=LOADNGO && flags!=OVERLAY && flags!=LOAD) {
|
||||
E_Exit("DOS:Not supported execute mode %d for file %s",flags,name);
|
||||
@ -274,26 +292,27 @@ bool DOS_Execute(char * name,PhysPt block_pt,Bit8u flags) {
|
||||
else memsize=maxsize;
|
||||
if (!DOS_AllocateMemory(&pspseg,&memsize)) E_Exit("DOS:Exec error in memory");
|
||||
loadseg=pspseg+16;
|
||||
/* Setup a psp */
|
||||
SetupPSP(pspseg,memsize,envseg);
|
||||
SetupCMDLine(pspseg,block);
|
||||
} else loadseg=block.overlay.loadseg;
|
||||
/* Load the executable */
|
||||
loadaddress=HostMake(loadseg,0);
|
||||
Bit8u * loadbuf=(Bit8u *)new Bit8u[0x10000];
|
||||
loadaddress=PhysMake(loadseg,0);
|
||||
if (iscom) { /* COM Load 64k - 256 bytes max */
|
||||
pos=0;DOS_SeekFile(fhandle,&pos,DOS_SEEK_SET);
|
||||
readsize=0xffff-256;
|
||||
DOS_ReadFile(fhandle,loadaddress,&readsize);
|
||||
DOS_ReadFile(fhandle,loadbuf,&readsize);
|
||||
MEM_BlockWrite(loadaddress,loadbuf,readsize);
|
||||
} else { /* EXE Load in 32kb blocks and then relocate */
|
||||
pos=headersize;DOS_SeekFile(fhandle,&pos,DOS_SEEK_SET);
|
||||
while (imagesize>0x7FFF) {
|
||||
readsize=0x8000;DOS_ReadFile(fhandle,loadaddress,&readsize);
|
||||
if (readsize!=0x8000) LOG(LOG_EXEC,"Illegal header");
|
||||
readsize=0x8000;DOS_ReadFile(fhandle,loadbuf,&readsize);
|
||||
MEM_BlockWrite(loadaddress,loadbuf,readsize);
|
||||
if (readsize!=0x8000) LOG(LOG_EXEC,LOG_NORMAL)("Illegal header");
|
||||
loadaddress+=0x8000;imagesize-=0x8000;
|
||||
}
|
||||
if (imagesize>0) {
|
||||
readsize=(Bit16u)imagesize;DOS_ReadFile(fhandle,loadaddress,&readsize);
|
||||
if (readsize!=imagesize) LOG(LOG_EXEC,"Illegal header");
|
||||
readsize=(Bit16u)imagesize;DOS_ReadFile(fhandle,loadbuf,&readsize);
|
||||
MEM_BlockWrite(loadaddress,loadbuf,readsize);
|
||||
if (readsize!=imagesize) LOG(LOG_EXEC,LOG_NORMAL)("Illegal header");
|
||||
}
|
||||
/* Relocate the exe image */
|
||||
Bit16u relocate;
|
||||
@ -307,7 +326,16 @@ bool DOS_Execute(char * name,PhysPt block_pt,Bit8u flags) {
|
||||
mem_writew(address,mem_readw(address)+relocate);
|
||||
}
|
||||
}
|
||||
delete[] loadbuf;
|
||||
DOS_CloseFile(fhandle);
|
||||
|
||||
/* Setup a psp */
|
||||
if (flags!=OVERLAY) {
|
||||
// Create psp after closing exe, to avoid dead file handle of exe in copied psp
|
||||
SetupPSP(pspseg,memsize,envseg);
|
||||
SetupCMDLine(pspseg,block);
|
||||
};
|
||||
|
||||
CALLBACK_SCF(false); /* Carry flag cleared for caller if successfull */
|
||||
if (flags==OVERLAY) return true; /* Everything done for overlays */
|
||||
RealPt csip,sssp;
|
||||
|
@ -16,6 +16,8 @@
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: dos_files.cpp,v 1.47 2003/10/10 13:50:34 finsterr Exp $ */
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
@ -24,7 +26,7 @@
|
||||
#include "dosbox.h"
|
||||
#include "bios.h"
|
||||
#include "mem.h"
|
||||
#include "cpu.h"
|
||||
#include "regs.h"
|
||||
#include "dos_inc.h"
|
||||
#include "drives.h"
|
||||
#include "cross.h"
|
||||
@ -79,7 +81,7 @@ bool DOS_MakeName(char * name,char * fullname,Bit8u * drive) {
|
||||
case '\\': case '$': case '#': case '@': case '(': case ')':
|
||||
case '!': case '%': case '{': case '}': case '`': case '~':
|
||||
case '_': case '-': case '.': case '*': case '?': case '&':
|
||||
case '\'':
|
||||
case '\'': case '+':
|
||||
upname[w++]=c;
|
||||
break;
|
||||
default:
|
||||
@ -110,7 +112,28 @@ bool DOS_MakeName(char * name,char * fullname,Bit8u * drive) {
|
||||
w=0;r++;
|
||||
continue;
|
||||
}
|
||||
if (strcmp(tempdir,"..")==0) {
|
||||
|
||||
Bit32u iDown, cDots;
|
||||
bool dots = true;
|
||||
Bit32u templen =strlen(tempdir);
|
||||
for(iDown=0;(iDown < templen) && dots;iDown++)
|
||||
if(tempdir[iDown] != '.')
|
||||
dots = false;
|
||||
|
||||
// only dots?
|
||||
cDots = templen - 1;
|
||||
if(dots && (cDots > 0))
|
||||
{
|
||||
for(iDown=strlen(fullname)-1;iDown>=0;iDown--)
|
||||
{
|
||||
if(fullname[iDown]=='\\' || iDown==0)
|
||||
{
|
||||
lastdir = iDown;
|
||||
cDots--;
|
||||
if(cDots==0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
fullname[lastdir]=0;
|
||||
Bit32u t=0;lastdir=0;
|
||||
while (fullname[t]!=0) {
|
||||
@ -121,13 +144,14 @@ bool DOS_MakeName(char * name,char * fullname,Bit8u * drive) {
|
||||
w=0;r++;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
lastdir=strlen(fullname);
|
||||
//TODO Maybe another check for correct type because of .... stuff
|
||||
|
||||
if (lastdir!=0) strcat(fullname,"\\");
|
||||
char * ext=strchr(tempdir,'.');
|
||||
if (ext) {
|
||||
ext[4]=0;
|
||||
Bitu blah=strlen(tempdir);
|
||||
if (strlen(tempdir)>12) memmove(tempdir+8,ext,5);
|
||||
} else tempdir[8]=0;
|
||||
strcat(fullname,tempdir);
|
||||
@ -206,14 +230,13 @@ bool DOS_FindFirst(char * search,Bit16u attr) {
|
||||
}
|
||||
dta.SetupSearch(drive,(Bit8u)attr,pattern);
|
||||
if (Drives[drive]->FindFirst(dir,dta)) return true;
|
||||
DOS_SetError(DOSERR_NO_MORE_FILES);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DOS_FindNext(void) {
|
||||
DOS_DTA dta(dos.dta);
|
||||
if (Drives[dta.GetSearchDrive()]->FindNext(dta)) return true;
|
||||
DOS_SetError(DOSERR_NO_MORE_FILES);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -287,15 +310,15 @@ bool DOS_CloseFile(Bit16u entry) {
|
||||
DOS_SetError(DOSERR_INVALID_HANDLE);
|
||||
return false;
|
||||
};
|
||||
//TODO Figure this out with devices :)
|
||||
|
||||
DOS_PSP psp(dos.psp);
|
||||
if (entry>STDPRN) psp.SetFileHandle(entry,0xff);
|
||||
|
||||
/* Devices won't allow themselves to be closed or killed */
|
||||
if (Files[handle]->Close()) {
|
||||
delete Files[handle];
|
||||
Files[handle]=0;
|
||||
if (Files[handle]->Close())
|
||||
{ //if close succesfull => delete file/update psp
|
||||
DOS_PSP psp(dos.psp);
|
||||
psp.SetFileHandle(entry,0xff);
|
||||
if (Files[handle]->RemoveRef()<=0) {
|
||||
delete Files[handle];
|
||||
Files[handle]=0;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -324,6 +347,7 @@ bool DOS_CreateFile(char * name,Bit16u attributes,Bit16u * entry) {
|
||||
}
|
||||
bool foundit=Drives[drive]->FileCreate(&Files[handle],fullname,attributes);
|
||||
if (foundit) {
|
||||
Files[handle]->AddRef();
|
||||
psp.SetFileHandle(*entry,handle);
|
||||
return true;
|
||||
} else {
|
||||
@ -333,9 +357,9 @@ bool DOS_CreateFile(char * name,Bit16u attributes,Bit16u * entry) {
|
||||
|
||||
bool DOS_OpenFile(char * name,Bit8u flags,Bit16u * entry) {
|
||||
/* First check for devices */
|
||||
if (flags>2) LOG(LOG_FILES|LOG_ERROR,"Special file open command %X file %s",flags,name);
|
||||
else LOG(LOG_FILES,"file open command %X file %s",flags,name);
|
||||
flags&=3;
|
||||
if (flags>2) LOG(LOG_FILES,LOG_ERROR)("Special file open command %X file %s",flags,name);
|
||||
else LOG(LOG_FILES,LOG_NORMAL)("file open command %X file %s",flags,name);
|
||||
|
||||
DOS_PSP psp(dos.psp);
|
||||
Bit8u handle=DOS_FindDevice((char *)name);
|
||||
bool device=false;char fullname[DOS_PATHLENGTH];Bit8u drive;Bit8u i;
|
||||
@ -366,6 +390,12 @@ bool DOS_OpenFile(char * name,Bit8u flags,Bit16u * entry) {
|
||||
bool exists=false;
|
||||
if (!device) exists=Drives[drive]->FileOpen(&Files[handle],fullname,flags);
|
||||
if (exists || device ) {
|
||||
// devices can only be opened once
|
||||
if (device && (psp.FindEntryByHandle(handle)!=0xff)) {
|
||||
*entry=psp.FindEntryByHandle(handle);
|
||||
return true;
|
||||
}
|
||||
Files[handle]->AddRef();
|
||||
psp.SetFileHandle(*entry,handle);
|
||||
return true;
|
||||
} else {
|
||||
@ -374,6 +404,32 @@ bool DOS_OpenFile(char * name,Bit8u flags,Bit16u * entry) {
|
||||
}
|
||||
}
|
||||
|
||||
bool DOS_OpenFileExtended(char *name, Bit16u flags, Bit16u createAttr, Bit16u action, Bit16u *entry, Bit16u* status)
|
||||
// FIXME: Not yet supported : Bit 13 of flags (int 0x24 on critical error
|
||||
{
|
||||
Bit16u result = 0;
|
||||
if (DOS_OpenFile(name, (Bit8u)flags, entry)) {
|
||||
// File already exists
|
||||
switch (action & 0x0f) {
|
||||
case 0x00 : return false; // failed
|
||||
case 0x01 : result = 1; break; // file open (already done)
|
||||
case 0x02 : DOS_CloseFile(*entry); // replace
|
||||
if (!DOS_CreateFile(name, flags, entry)) return false;
|
||||
result = 3;
|
||||
break;
|
||||
default : E_Exit("DOS: OpenFileExtended: Unknown action.");
|
||||
};
|
||||
} else {
|
||||
// File doesnt exist
|
||||
if ((action & 0xf0)==0) return false;
|
||||
// Create File
|
||||
if (!DOS_CreateFile(name, flags, entry)) return false;
|
||||
result = 2;
|
||||
};
|
||||
*status = result;
|
||||
return true;
|
||||
};
|
||||
|
||||
bool DOS_UnlinkFile(char * name) {
|
||||
char fullname[DOS_PATHLENGTH];Bit8u drive;
|
||||
if (!DOS_MakeName(name,fullname,&drive)) return false;
|
||||
@ -414,6 +470,13 @@ bool DOS_GetFreeDiskSpace(Bit8u drive,Bit16u * bytes,Bit8u * sectors,Bit16u * cl
|
||||
}
|
||||
|
||||
bool DOS_DuplicateEntry(Bit16u entry,Bit16u * newentry) {
|
||||
|
||||
// Dont duplicate console handles
|
||||
if (entry<=STDPRN) {
|
||||
*newentry = entry;
|
||||
return true;
|
||||
};
|
||||
|
||||
Bit8u handle=RealHandle(entry);
|
||||
if (handle>=DOS_FILES) {
|
||||
DOS_SetError(DOSERR_INVALID_HANDLE);
|
||||
@ -429,11 +492,19 @@ bool DOS_DuplicateEntry(Bit16u entry,Bit16u * newentry) {
|
||||
DOS_SetError(DOSERR_TOO_MANY_OPEN_FILES);
|
||||
return false;
|
||||
}
|
||||
Files[handle]->AddRef();
|
||||
psp.SetFileHandle(*newentry,handle);
|
||||
return true;
|
||||
};
|
||||
|
||||
bool DOS_ForceDuplicateEntry(Bit16u entry,Bit16u newentry) {
|
||||
|
||||
// Dont duplicate console handles
|
||||
if (entry<=STDPRN) {
|
||||
newentry = entry;
|
||||
return true;
|
||||
};
|
||||
|
||||
Bit8u orig=RealHandle(entry);
|
||||
if (orig>=DOS_FILES) {
|
||||
DOS_SetError(DOSERR_INVALID_HANDLE);
|
||||
@ -453,6 +524,7 @@ bool DOS_ForceDuplicateEntry(Bit16u entry,Bit16u newentry) {
|
||||
return false;
|
||||
};
|
||||
DOS_PSP psp(dos.psp);
|
||||
Files[orig]->AddRef();
|
||||
psp.SetFileHandle(newentry,(Bit8u)entry);
|
||||
return true;
|
||||
};
|
||||
@ -478,14 +550,6 @@ bool DOS_CreateTempFile(char * name,Bit16u * entry) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static bool FCB_MakeName2 (DOS_FCB & fcb, char* outname, Bit8u* outdrive){
|
||||
char short_name[DOS_FCBNAME];
|
||||
fcb.GetName(short_name);
|
||||
return DOS_MakeName(short_name,outname, outdrive);
|
||||
}
|
||||
|
||||
#define FCB_SEP ":.;,=+"
|
||||
#define ILLEGAL ":.;,=+ \t/\"[]<>|"
|
||||
|
||||
@ -494,13 +558,6 @@ static bool isvalid(const char in){
|
||||
return (Bit8u(in)>0x1F) && (!strchr(ill,in));
|
||||
}
|
||||
|
||||
static void vullen (char* veld,char* pveld){
|
||||
for(Bitu i=(pveld-veld);i<strlen(veld);i++){
|
||||
*(veld+i)='?';
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
#define PARSE_SEP_STOP 0x01
|
||||
#define PARSE_DFLT_DRIVE 0x02
|
||||
#define PARSE_BLNK_FNAME 0x04
|
||||
@ -518,7 +575,9 @@ Bit8u FCB_Parsename(Bit16u seg,Bit16u offset,Bit8u parser ,char *string, Bit8u *
|
||||
hasdrive=hasname=hasext=false;
|
||||
Bitu index;bool finished;Bit8u fill;
|
||||
/* First get the old data from the fcb */
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack (1)
|
||||
#endif
|
||||
union {
|
||||
struct {
|
||||
char drive[2];
|
||||
@ -527,7 +586,9 @@ Bit8u FCB_Parsename(Bit16u seg,Bit16u offset,Bit8u parser ,char *string, Bit8u *
|
||||
} part GCC_ATTRIBUTE (packed) ;
|
||||
char full[DOS_FCBNAME];
|
||||
} fcb_name;
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack()
|
||||
#endif
|
||||
/* Get the old information from the previous fcb */
|
||||
fcb.GetName(fcb_name.full);fcb_name.part.drive[1]=0;fcb_name.part.name[8]=0;fcb_name.part.ext[3]=0;
|
||||
/* Strip of the leading sepetaror */
|
||||
@ -651,13 +712,13 @@ bool DOS_FCBOpen(Bit16u seg,Bit16u offset) {
|
||||
if (!DOS_MakeName(shortname,fullname,&drive)) return false;
|
||||
|
||||
/* Check, if file is already opened */
|
||||
for (Bit16u i=0;i<DOS_FILES;i++) {
|
||||
for (Bit8u i=0;i<DOS_FILES;i++) {
|
||||
DOS_PSP psp(dos.psp);
|
||||
if (Files[i] && Files[i]->IsOpen() && Files[i]->IsName(fullname)) {
|
||||
handle = psp.FindEntryByHandle(i);
|
||||
if (handle==0xFF) {
|
||||
// This shouldnt happen
|
||||
LOG(LOG_FILES|LOG_ERROR,"DOS: File %s is opened but has no psp entry.",shortname);
|
||||
LOG(LOG_FILES,LOG_ERROR)("DOS: File %s is opened but has no psp entry.",shortname);
|
||||
return false;
|
||||
}
|
||||
fcb.FileOpen((Bit8u)handle);
|
||||
|
@ -16,17 +16,15 @@
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: dos_ioctl.cpp,v 1.16 2003/10/14 08:38:35 qbix79 Exp $ */
|
||||
|
||||
#include <string.h>
|
||||
#include "dosbox.h"
|
||||
#include "callback.h"
|
||||
#include "mem.h"
|
||||
#include "cpu.h"
|
||||
#include "regs.h"
|
||||
#include "dos_inc.h"
|
||||
|
||||
#define MAX_DEVICE 20
|
||||
static DOS_File * dos_devices[MAX_DEVICE];
|
||||
|
||||
|
||||
bool DOS_IOCTL(void) {
|
||||
Bitu handle;Bit8u drive;
|
||||
if (reg_al<8) { /* call 0-7 use a file handle */
|
||||
@ -44,8 +42,26 @@ bool DOS_IOCTL(void) {
|
||||
case 0x00: /* Get Device Information */
|
||||
reg_dx=Files[handle]->GetInformation();
|
||||
return true;
|
||||
case 0x06: /* Get Input Status */
|
||||
if (Files[handle]->GetInformation() & 0x8000) { //Check for device
|
||||
reg_al=(Files[handle]->GetInformation() & 0x40) ? 0x0 : 0xff;
|
||||
} else { // FILE
|
||||
Bit32u oldlocation=0;
|
||||
Files[handle]->Seek(&oldlocation, DOS_SEEK_CUR);
|
||||
Bit32u endlocation=0;
|
||||
Files[handle]->Seek(&endlocation, DOS_SEEK_END);
|
||||
if(oldlocation < endlocation){//Still data available
|
||||
reg_al=0xff;
|
||||
} else
|
||||
{
|
||||
reg_al=0x0; //EOF or beyond
|
||||
}
|
||||
Files[handle]->Seek(&oldlocation, DOS_SEEK_SET); //restore filelocation
|
||||
LOG(LOG_IOCTL,LOG_NORMAL)("06:Used Get Input Status on regualar file with handle %d",handle);
|
||||
}
|
||||
return true;
|
||||
case 0x07: /* Get Output Status */
|
||||
LOG(LOG_IOCTL,"DOS:IOCTL:07:Fakes output status is ready for handle %d",handle);
|
||||
LOG(LOG_IOCTL,LOG_NORMAL)("07:Fakes output status is ready for handle %d",handle);
|
||||
reg_al=0xff;
|
||||
return true;
|
||||
case 0x08: /* Check if block device removable */
|
||||
@ -58,6 +74,17 @@ bool DOS_IOCTL(void) {
|
||||
DOS_SetError(DOSERR_INVALID_DRIVE);
|
||||
return false;
|
||||
}
|
||||
case 0x09: /* Check if block device remote */
|
||||
drive=reg_bl;if (!drive) drive=dos.current_drive;else drive--;
|
||||
if (Drives[drive]) {
|
||||
reg_dx=0;
|
||||
//TODO Cdrom drives are remote
|
||||
//TODO Set bit 9 on drives that don't support direct I/O
|
||||
return true;
|
||||
} else {
|
||||
DOS_SetError(DOSERR_INVALID_DRIVE);
|
||||
return false;
|
||||
}
|
||||
case 0x0D: /* Generic block device request */
|
||||
{
|
||||
PhysPt ptr = SegPhys(ds)+reg_dx;
|
||||
@ -71,7 +98,7 @@ bool DOS_IOCTL(void) {
|
||||
mem_writeb(ptr+6,0x00); // media type (00=other type)
|
||||
break;
|
||||
default :
|
||||
LOG(LOG_IOCTL|LOG_ERROR,"DOS:IOCTL Call 0D:%2X Drive %2X unhandled",reg_cl,drive);
|
||||
LOG(LOG_IOCTL,LOG_ERROR)("DOS:IOCTL Call 0D:%2X Drive %2X unhandled",reg_cl,drive);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -86,15 +113,8 @@ bool DOS_IOCTL(void) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case 0x06: /* Get Input Status */
|
||||
if(reg_bx==0x00) { /* might work for other handles, but tested it only for STDIN */
|
||||
if(Files[handle]->GetInformation() & 0x40) reg_al=0x00; else
|
||||
reg_al=0xFF;
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
LOG(LOG_DOSMISC|LOG_ERROR,"DOS:IOCTL Call %2X unhandled",reg_al);
|
||||
LOG(LOG_DOSMISC,LOG_ERROR)("DOS:IOCTL Call %2X unhandled",reg_al);
|
||||
return false;
|
||||
};
|
||||
return false;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user