DOSBox 0.65

This commit is contained in:
Carl.Kenner 2009-05-02 22:18:08 +00:00
parent 9ae8458414
commit 6ca1ff8d7f
235 changed files with 26971 additions and 9415 deletions

View File

@ -1,3 +1,87 @@
0.65
- Fixed FAT writing.
- Added some more missing DOS functions.
- Improved PIC so that it actually honours irq 2/9.
- Improved intelligent MPU-401 mode so that more games work with it.
- Some mouse fixes.
- Changed DMA transfers a bit so they bypass the paging tables.
- Added S3 XGA functionality.
- Improved paging so that read and write faults are handled differently.
- Rewrote exception handling a bit (no exception 0x0B with dos4gw anymore).
- Added IO exceptions in all but the dynamic core.
- Some ems improvements.
- Added midi-device selection code for the windows hosts.
- Fix crashes/segfaults related to the disabling of the pcspeaker.
- Added some more FILES=XX detection tricks.
- Fixed some vga detection schemes.
- Fixed screenshot corruption when using -noconsole in a read-only directory.
- Fix wrong scaled screenshots.
- Added some hidden file functions when using diskimages. (helps with cdrom
detection schemes)
- Fixed a bug in the mixer code, that muted the music in certain games.
- Added an assembly fpu core.
- Made the shell more flexible for batch files.
- Check for unaligned memory acces fixes hangups on ARM processors.
- Some 64 bit fixes.
- Added code to change configuration at runtime.
- Improved ADPCM emulation.
- Fixed a few cpu instructions.
- Always report vesa 2.0 and fix some colour issues with vesa games.
- Fix video mode 0x06 and 0x0a.
- Improvements to the joystick emulation. 4 buttons are supported as well.
- Add VCPI emulation for Origin games.
- Fixed a lot of things in the boot code. Most booters work now.
- Lots of improvements to the IPX emulation.
- Rewritten modem emulation. Should work with more games.
- Improvements to the dos memory managment routines.
- Add UMB (upper memory blocks) support.
- Emulate the pause key.
- Improve Composite CGA mode emulation.
- Lots of vga compatibility changes.
- Improved support for chained video modes.
- Improved mode and palette handling in cga modes.
- Mount accepts ~ now.
- Added a few of the EGA RIL functions.
- Added TandyDAC emulation.
- OS/2 support.
- Improved and speed up the dynamic cpu core.
- Fix some errors in the CD-ROM emulation layer.
- Added an automatic work-around for some graphics chipsets.
- Add PCjr support.
- Allow mousedriver to be replaced. Fixes a few games that come with their
own (internal) driver.
- Improved dynamic cpu core so it can handle pagefaults and some obscure
types of self-modifying code.
- Added -noautoexec switch to skip the contents of [autoexec] in the
configuration file.
- Improved v86 mode emulation (mainly for Strike Commander).
- Improved timer behavior.
- Improved extended keyboard support.
- Enhanced and added several DOS tables.
- Made core_full endian safe.
- Made pagefaults endian safe.
- Add support for moviecapturing
- Add support for 15/16/32 bit videomodes.
- Add some more VESA modi (4 bit).
- Add 1024x768 output.
- Changed screenrendering so it only draws changes to the screen.
- Allow remapping of the EMS page when the dma transfer was started from
the page frame
- Made EMS and DMA work together when playing from a mapped memory page.
- Renamed several configuration options, so that they are unique.
- Merged mpu and intelligent into one option.
- Merged fullfixed and fullresolution.
- Extended keys should be handled better.
- F11 and F12 work.
- Compilation fixes for various platforms.
- Fix a few crashes when giving bad input.
- Removed interp2x and added few new scalers.
- Reintroduce the lockfree mouse. (autolock=false)
- Add a larger cache for the dynamic cpu core.
- Improved soundblaster DSP, so it gets detected by creative tools.
- Lots of bugfixes.
- Even more bugfixes.
0.63
- Fixed crash with keymapper (ctrl-f1) and output=surface.
- Added unmounting.

10
INSTALL
View File

@ -50,8 +50,18 @@ In step 1 you could add the following switches:
enables some memory increasing inlines. This greatly increases
compiletime for maybe a increase in speed.
--disable-dynamic-x86
disables the dynamic cpu core. Although it's unstable it can greatly
improve the speed of dosbox on x86 hosts.
--disable-fpu-x86
disables the assembly fpu core. Although relatively new the x86 fpu
core has more accuracy then the regular fpu core.
Check the src subdir for the binary.
NOTE: If capslock and numlock appear to be broken. open
src/ints/bios_keyboard.cpp and go to line 30 and read there how to fix it.
Build instructions for VC++6

View File

@ -1,8 +1,8 @@
# Makefile.in generated by automake 1.9.3 from Makefile.am.
# Makefile.in generated by automake 1.9.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004 Free Software Foundation, Inc.
# 2003, 2004, 2005 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.
@ -41,7 +41,7 @@ target_triplet = @target@
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
$(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \
THANKS config.guess config.sub depcomp install-sh missing
THANKS TODO config.guess config.sub depcomp install-sh missing
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
@ -101,6 +101,8 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
HAVE_WINDRES_FALSE = @HAVE_WINDRES_FALSE@
HAVE_WINDRES_TRUE = @HAVE_WINDRES_TRUE@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
@ -126,10 +128,12 @@ SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
WINDRES = @WINDRES@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
ac_ct_WINDRES = @ac_ct_WINDRES@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
@ -236,7 +240,13 @@ uninstall-info-am:
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@set fnord $$MAKEFLAGS; amf=$$2; \
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
@ -248,7 +258,7 @@ $(RECURSIVE_TARGETS):
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
@ -256,7 +266,13 @@ $(RECURSIVE_TARGETS):
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
@set fnord $$MAKEFLAGS; amf=$$2; \
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
@ -277,7 +293,7 @@ maintainer-clean-recursive:
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \

84
NEWS
View File

@ -1,3 +1,87 @@
0.65
- Fixed FAT writing.
- Added some more missing DOS functions.
- Improved PIC so that it actually honours irq 2/9.
- Improved intelligent MPU-401 mode so that more games work with it.
- Some mouse fixes.
- Changed DMA transfers a bit so they bypass the paging tables.
- Added S3 XGA functionality.
- Improved paging so that read and write faults are handled differently.
- Rewrote exception handling a bit (no exception 0x0B with dos4gw anymore).
- Added IO exceptions in all but the dynamic core.
- Some ems improvements.
- Added midi-device selection code for the windows hosts.
- Fix crashes/segfaults related to the disabling of the pcspeaker.
- Added some more FILES=XX detection tricks.
- Fixed some vga detection schemes.
- Fixed screenshot corruption when using -noconsole in a read-only directory.
- Fix wrong scaled screenshots.
- Added some hidden file functions when using diskimages. (helps with cdrom
detection schemes)
- Fixed a bug in the mixer code, that muted the music in certain games.
- Added an assembly fpu core.
- Made the shell more flexible for batch files.
- Check for unaligned memory acces fixes hangups on ARM processors.
- Some 64 bit fixes.
- Added code to change configuration at runtime.
- Improved ADPCM emulation.
- Fixed a few cpu instructions.
- Always report vesa 2.0 and fix some colour issues with vesa games.
- Fix video mode 0x06 and 0x0a.
- Improvements to the joystick emulation. 4 buttons are supported as well.
- Add VCPI emulation for Origin games.
- Fixed a lot of things in the boot code. Most booters work now.
- Lots of improvements to the IPX emulation.
- Rewritten modem emulation. Should work with more games.
- Improvements to the dos memory managment routines.
- Add UMB (upper memory blocks) support.
- Emulate the pause key.
- Improve Composite CGA mode emulation.
- Lots of vga compatibility changes.
- Improved support for chained video modes.
- Improved mode and palette handling in cga modes.
- Mount accepts ~ now.
- Added a few of the EGA RIL functions.
- Added TandyDAC emulation.
- OS/2 support.
- Improved and speed up the dynamic cpu core.
- Fix some errors in the CD-ROM emulation layer.
- Added an automatic work-around for some graphics chipsets.
- Add PCjr support.
- Allow mousedriver to be replaced. Fixes a few games that come with their
own (internal) driver.
- Improved dynamic cpu core so it can handle pagefaults and some obscure
types of self-modifying code.
- Added -noautoexec switch to skip the contents of [autoexec] in the
configuration file.
- Improved v86 mode emulation (mainly for Strike Commander).
- Improved timer behavior.
- Improved extended keyboard support.
- Enhanced and added several DOS tables.
- Made core_full endian safe.
- Made pagefaults endian safe.
- Add support for moviecapturing
- Add support for 15/16/32 bit videomodes.
- Add some more VESA modi (4 bit).
- Add 1024x768 output.
- Changed screenrendering so it only draws changes to the screen.
- Allow remapping of the EMS page when the dma transfer was started from
the page frame
- Made EMS and DMA work together when playing from a mapped memory page.
- Renamed several configuration options, so that they are unique.
- Merged mpu and intelligent into one option.
- Merged fullfixed and fullresolution.
- Extended keys should be handled better.
- F11 and F12 work.
- Compilation fixes for various platforms.
- Fix a few crashes when giving bad input.
- Removed interp2x and added few new scalers.
- Reintroduce the lockfree mouse. (autolock=false)
- Add a larger cache for the dynamic cpu core.
- Improved soundblaster DSP, so it gets detected by creative tools.
- Lots of bugfixes.
- Even more bugfixes.
0.63
- Fixed crash with keymapper (ctrl-f1) and output=surface.
- Added unmounting.

362
README
View File

@ -1,19 +1,19 @@
DOSBox v0.63
DOSBox v0.65
=====
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 high-
end machine will roughly be the equivalent of a 486 PC. The 0.60
While we are hoping that one day, DOSBox will run all programs
ever made for the PC, we are not there yet. At present, DOSBox running on a
high-end machine will roughly be the equivalent of a 486 PC. 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.
recent programs, but note that this support is still in an early stage of
development and unlike the support for 386 real-mode games (or earlier) hasn't
been completed yet. Also note that "protected mode" games need substantially
more resources and may require a much faster processor for you to run them
properly in DOSBox.
@ -49,9 +49,10 @@ Type INTRO in DOSBox. That's it.
Some Frequently Asked Questions:
Q: I've got a Z instead of a C at the prompt.
Q: My game crashes when using opengl/nb or is much slower.
Q: My CD-ROM doesn't work.
Q: The mouse doesn't work.
Q: The sound stutters.
Q: The sound stutters or sounds stretched/weird.
Q: I can't type \ or : in DOSBox.
Q: The game/application can't find its CD-ROM.
Q: The game/application runs much too slow!
@ -66,16 +67,21 @@ Q: Great README, but I still don't get it.
Q: I've got a Z instead of a C at the prompt.
A: You have to make your directories available as drives in DOSBox by using
the "mount" command. For example, in Windows "mount C D:\" would give
you a C in DOSBox which points at your Windows D:\ drive.
In Linux, "mount c /home/username" would give you a C in DOSBox
which points at /home/username in Linux.
the "mount" command. For example, in Windows "mount C D:\GAMES" will give
you a C drive in DOSBox which points to your Windows D:\GAMES directory.
In Linux, "mount c /home/username" will give you a C drive in DOSBox
which points to /home/username in Linux.
Q: My game crashes when using opengl/nb or is much slower.
A: Somehow our opengl code isn't entirely stable on some platforms.
Use surface instead.
Q: My CD-ROM doesn't work.
A: To mount your cdrom in DOSBox you have to specify some additional options
when mounting the cdrom.
To enable the most basic cdrom support:
A: To mount your CD-ROM in DOSBox you have to specify some additional options
when mounting the CD-ROM.
To enable the most basic CD-ROM support:
- mount d f:\ -t cdrom
To enable low-level SDL-support:
- mount d f:\ -t cdrom -usecd 0
@ -84,23 +90,23 @@ A: To mount your cdrom in DOSBox you have to specify some additional options
To enable low-level aspi-support (win98 with aspi-layer installed):
- mount d f:\ -t cdrom -usecd 0 -apsi
In the commands: - d driveletter you in DOSBox
In the commands: - d driveletter you will get in DOSBox
- f:\ location of cdrom on your PC.
- 0 The number of the cdrom drive, reported by mount -cd
- 0 The number of the CD-ROM drive, reported by mount -cd
See also the question: The game/application can't find its CD-ROM.
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 (confined to the DOSBox window)
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.
A: Usually, DOSBox detects when a game uses mouse control. When you click on
the screen it should get locked (confined to the DOSBox window) and work.
With certain games, the DOSBox mouse detection doesn't work. In that case
you will have to lock the mouse manually by pressing CTRL-F10.
Q: The sound stutters.
Q: The sound stutters or sounds stretched/weird.
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.
You can also increase the prebuffer in the configfile
You can lower the cycles, skip frames or get a faster machine.
You can also increase the prebuffer in the configfile.
Q: I can't type \ or : in DOSBox.
@ -108,16 +114,18 @@ A: This is a known problem. It only occurs if your keyboard layout isn't US.
Some possible fixes:
1. Switch your keyboard layout.
2. Use / instead.
3. Add the commands you want to execute to the "configfile".
4. Start the keymapper (CTRL-F1 or add -startmapper switch to dosbox)
5. for \ try the keys around "enter". For ":" try shift and the keys between
"enter" and "l" (US keyboard layout).
6. Use keyb.com from FreeDOS (http://projects.freedos.net/keyb/).
3. Open dosbox.conf and change usescancodes=false to usescancodes=true.
4. Add the commands you want to execute to the "configfile".
5. Start the keymapper (CTRL-F1 or add -startmapper switch to DOSBox).
6. Use ALT-58 for : and ALT-92 for \.
7. for \ try the keys around "enter". For ":" try shift and the keys
between "enter" and "l" (US keyboard layout).
8. Use keyb.com from FreeDOS (http://projects.freedos.net/keyb/).
Q: The game/application can't find its CD-ROM.
A: Be sure to mount the CD-ROM with -t cdrom switch. Also try adding the
correct label (-label LABEL). To enable more low-level CD-ROM support add
correct label (-label LABEL). To enable more low-level CD-ROM support, add
the following switch to mount: -usecd #, where # is the number of your
CD-ROM drive reported by mount -cd. If you run Win32 you can specify -ioctl
or -aspi. Look at the description elsewhere in this document for their
@ -145,26 +153,26 @@ A: DOSBox emulates several legacy sound devices:
this with the Adlib emulation may result in conflicts.
- Tandy 3 voice
The emulation of this sound hardware is complete with the exception of
the noise channel, which is not very well documented and as such is only
a best guess as to the sound's accuracy.
the noise channel. The noise channel is not very well documented and as
such is only a best guess as to the sound's accuracy.
- Adlib
Borrowed from MAME, this emulation is almost perfect and includes the
Adlib's ability to almost play digitized sound.
- SoundBlaster 16/ SoundBlaster Pro I & II /Sound Blaster I & II
Coupled with the Adlib, by default DOSBox provides Soundblaster 16
level 16-bit stereo sound. You can select a different SoundBlaster
version in the configfile of DOSBox (See Internal Commands: CONFIG).
- SoundBlaster 16/ SoundBlaster Pro I & II /SoundBlaster I & II
By default DOSBox provides Soundblaster 16 level 16-bit stereo sound.
You can select a different SoundBlaster version in the configfile of
DOSBox (See Internal Commands: CONFIG).
- Disney Soundsource
Using the printer port, this sound device outputs digital sound only.
- Gravis Ultrasound
The emulation of this hardware is nearly complete, though the MIDI
capabilities have been left out since an MPU-401 has been
capabilities have been left out, since an MPU-401 has been
emulated in other code.
- MPU-401
A MIDI passthrough interface is also emulated. This method of sound
output will only work when used with a General Midi or MT-32 device.
Q: DOSBox crashes on startup and I'm running arts
Q: DOSBox crashes on startup and I'm running arts.
A: This isn't really a DOSBox problem, but the solution is to set the
environment variable SDL_AUDIODRIVER to alsa or oss.
@ -187,70 +195,73 @@ http://dosbox.sourceforge.net
3. Usage:
=========
An overview of the commandline options you can give to DOSBox.
An overview of the command line options you can give to DOSBox.
Windows Users must open cmd.exe or command.com or edit the shortcut to
dosbox.exe for this.
DOSBox.exe for this.
The options are valid for all operating systems unless noted in the option
description:
dosbox [name] [-exit] [-c command] [-fullscreen] [-conf congfigfile]
[-lang languagefile] [-machine machinetype] [-noconsole]
[-startmapper]
[-startmapper] [-noautoexec]
dosbox -version
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"
If "name" is a directory it will mount that as the C: drive.
If "name" is an executable it will mount the directory of "name"
as the C: drive and execute "name".
-exit
dosbox will close itself when the DOS application "name" ends.
DOSBox will close itself when the DOS application "name" ends.
-c command
Runs the specified command before running "name". Multiple commands
can be specified. Each command should start with -c though.
can be specified. Each command should start with "-c", though.
A command can be: an Internal Program, a DOS command or an executable
on a mounted drive.
-fullscreen
Starts dosbox in fullscreen mode.
Starts DOSBox in fullscreen mode.
-conf configfile
Start dosbox with the options specified in "configfile".
Start DOSBox with the options specified in "configfile".
See Chapter 9 for more details.
-lang languagefile
Start dosbox using the language specified in "languagefile".
Start DOSBox using the language specified in "languagefile".
-noconsole (Windows Only)
Start dosbox without showing the console window. Output will
Start DOSBox without showing the console window. Output will
be redirected to stdout.txt and stderr.txt
-machine machinetype
Setup dosbox to emulate a specific type of machine. Valid choices are:
hercules, cga, tandy, vga (default). The machinetype has influence on
Setup DOSBox to emulate a specific type of machine. Valid choices are:
hercules, cga, pcjr, tandy, vga (default). The machinetype affects
both the videocard and the available soundcards.
-startmapper
Enter the keymapper directly on startup. Useful for people with
keyboard problems.
-noautoexec
Skips the [autoexec] section of the loaded configuration file.
-version
output version information and exit. Useful for frontends.
Note: If a name/command/configfile/languagefile contains a space in it, put
Note: If a name/command/configfile/languagefile contains a space, put
the whole name/command/configfile/languagefile between quotes
("command or file name").
For example:
dosbox c:\atlantis\atlantis.exe -c "MOUNT D C:\SAVES"
This would mount c:\atlantis as c:\ and run atlantis.exe.
This mounts c:\atlantis as c:\ and runs atlantis.exe.
Before it does that it would first mount C:\SAVES as the D drive.
In Windows you can also drag directories/files onto the dosbox executable.
In Windows, you can also drag directories/files onto the DOSBox executable.
=====================
@ -285,7 +296,7 @@ MOUNT -u "Emulated Drive letter"
-freesize size_in_mb
Sets the amount of free space available on a drive in MB's. This
is a more simple version of -size.
is a simpler version of -size.
-label drivelabel
Sets the name of the drive to "drivelabel". Needed on some
@ -295,19 +306,19 @@ MOUNT -u "Emulated Drive letter"
For win32: label is extracted from "Real Drive".
For Linux: label is set to NO_LABEL.
If you do specify a label this label will be kept as long as the drive
If you do specify a label, this label will be kept as long as the drive
is mounted. It will not be updated !!
-aspi
Forces to use the aspi layer. Only valid if mounting a cdrom under
Forces use of 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
Forces use of ioctl commands. Only valid if mounting a cdrom under
a Windows OS which support them (Win2000/XP/NT).
-usecd number
Forces to use SDL cdrom support for drive number.
Forces use of SDL cdrom support for drive number.
Number can be found by -cd. Valid on all systems.
-cd
@ -320,16 +331,20 @@ MOUNT -u "Emulated Drive letter"
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.
PC. So MOUNT C C:\GAMES tells DOSBox to use your C:\GAMES directory 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 its 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.
drive. Using DOSBox and its mount command, you can trick the game into
believing it is on the C drive, while you can still place it where you
want it. For example, if the game is in D:\TOUCHE, the command MOUNT C D:\
will allow you to run Touche from the D drive.
Mounting your entire C drive with MOUNT C C:\ is NOT recommended!
If you or DOSBox makes a mistake you may loose all your files.
It's recommended to put all your applications/games in a subdirectory and
mount that.
General MOUNT Examples:
1. To mount c:\DirX as a floppy :
@ -350,22 +365,50 @@ MEM
Program to display the amount of free memory.
CONFIG [-writeconf] [-writelang] localfile
Write the current configuration or language settings to file.
"localfile" is located on the local drive. Not a mounted drive in DOSBox.
CONFIG -set "section property=value"
CONFIG -get "section property"
The configuration file controls various settings of DOSBox: The amount
of emulated memory, the emulated soundcards and many more things. It
allows acces to AUTOEXEC.BAT as well.
See section 9 (The Config File) for more information.
CONFIG can be used to change or query various settings of DOSBox
during runtime. It can save the current settings and language strings to
disk. Information about all possible sections and properties can
be found in section 9 (The Config File).
The language file controls all visible ouput of the internal commands
and the internal dos.
-writeconf localfile
Write the current configuration settings to file. "localfile" is
located on the local drive, not a mounted drive in DOSBox.
The configuration file controls various settings of DOSBox:
the amount of emulated memory, the emulated soundcards and many more
things. It allows access to AUTOEXEC.BAT as well.
See section 9 (The Config File) for more information.
-writelang localfile
Write the current language settings to file. "localfile" is
located on the local drive, not a mounted drive in DOSBox.
The language file controls all visible ouput of the internal commands
and the internal dos.
-set "section property=value"
CONFIG will attempt to set the property to new value. At this moment
CONFIG can not report whether the command succeeded or not.
-get "section property"
The current value of the property is reported and stored in the
environment variable %CONFIG%. This can be used to store the value
when using batch files.
Both "-set" and "-get" work from batch files and can be used to set up your
own preferences for each game.
Examples:
1. To create a configfile in your current directory:
config -writeconf dosbox.conf
2. To set the cpu cycles to 10000:
config -set "cpu cycles=10000"
3. To turn ems memory emulation off:
config -set "dos ems=off"
4. To check which cpu core is being used.
config -get "cpu core"
Example:
To create a configfile in your current directory:
config -writeconf dosbox.conf
LOADFIX [-size] [program] [program-parameters]
LOADFIX -f
Program to reduce the amount of memory available. Useful for old programs
@ -395,9 +438,9 @@ RESCAN
MIXER
Makes DOSBox display its current volume settings.
You can change this way:
Here's how you can change them:
mixer channel left:right [/NOSHOW]
mixer channel left:right [/NOSHOW] [/LISTMIDI]
channel
Can be one of the following: MASTER, DISNEY, SPKR, GUS, SB, FM.
@ -409,8 +452,14 @@ MIXER
/NOSHOW
Prevents DOSBox from showing the result if you set one
of the volume levels.
/LISTMIDI
Lists the available midi devices on your pc (Windows). To select a
device other than the Windows default midi-mapper, add a line
'config=id' to the [midi] section in the configuration file, where
'id' is the number for the device as listed by LISTMIDI.
IMGMOUNT
A utility to mount disk images and CD-ROM images in DOSBox.
@ -418,9 +467,9 @@ IMGMOUNT
-size [sectorsbytesize, sectorsperhead, heads, cylinders]
imagefile
location of the image files to mount in DOSBox. The location is on a
Location of the image files to mount in DOSBox. The location is on a
mounted drive inside DOSBox. CD-ROM images can be mounted
directly as well. They don't need to be a mounted drive.
directly as well. They don't have to be on a mounted drive.
-t
The following are valid image types:
@ -434,16 +483,16 @@ IMGMOUNT
-fs
The following are valid file system formats:
iso: Specifies the ISO 9660 CD-ROM format.
fat: Specifies the image uses the FAT file system. DOSBox will attempt
fat: Specifies that the image uses the FAT file system. DOSBox will attempt
to mount this image as a drive in DOSBox and make the files
available from inside DOSBox.
none: DOSBox will make no attempt to read the file system on the disk.
This is useful if one needs to format it or one wants to boot
off of the disk using the BOOT command. When using the "none"
filesystem, one must specify the drive number (2 or 3,
This is useful if you need to format it or if you want to boot
the disk using the BOOT command. When using the "none"
filesystem, you must specify the drive number (2 or 3,
where 2 = master, 3 = slave) rather than a drive letter.
For example, to mount a 70MB image as the slave drive device,
one would type:
you would type:
"imgmount 3 d:\test.img -size 512,63,16,142 -fs none"
(without the quotes) Compare this with a mount to read the
drive in DOSBox, which would read as:
@ -470,13 +519,13 @@ BOOT
diskimgN.img
This can be any number of floppy disk images one wants mounted after
DOSBox boots the specified drive letter.
To swap between images, one hits CTRL+F4 to swap out the current disk
and swap in the next disk in the list. Once the last disk in the list is
swapped out, the list loops back to the beginning.
To swap between images, hit CTRL-F4 to change from the current disk
to the next disk in the list. The list will loop back from the last
disk image to the beginning.
[-l driveletter]
This parameter allows one to specify the drive to boot from.
The default is the A drive, the floppy drive. One can also boot off of
This parameter allows you to specify the drive to boot from.
The default is the A drive, the floppy drive. You can also boot
a hard drive image mounted as master by specifying "-l C"
without the quotes, or the drive as slave by specifying "-l D"
@ -487,14 +536,14 @@ IPX
All of the IPX networking is managed through the internal DOSBox program
IPXNET. For help on the IPX networking from inside DOSBox, type
"IPXNET HELP" (without quotes) and the program will list out the commands
"IPXNET HELP" (without quotes) and the program will list the commands
and relevant documentation.
With regard to actually setting up a network, one system needs to be
the server. To set this up, in a DOSBox session, one should type
"IPXNET STARTSERVER" (without the quotes). The server DOSBox session will
automatically add itself to the virtual IPX network. In turn, for every
other computer that should be part of the virtual IPX network,
the server. To set this up, type "IPXNET STARTSERVER" (without the quotes)
in a DOSBox session. The server DOSBox session will
automatically add itself to the virtual IPX network. For every
additional computer that should be part of the virtual IPX network,
you'll need to type "IPXNET CONNECT <computer host name or IP>".
For example, if your server is at bob.dosbox.com,
you would type "IPXNET CONNECT bob.dosbox.com" on every non-server system.
@ -503,18 +552,18 @@ IPX
IPXNET CONNECT
IPXNET CONNECT opens a connection to an IPX tunneling server
IPXNET CONNECT opens a connection to an IPX tunnelling server
running on another DOSBox session. The "address" parameter specifies
the IP address or host name of the server computer. One can also
specify the UDP port to use. By default IPXNET uses port 213, the
assigned IANA port for IPX tunneling, for its connection.
the IP address or host name of the server computer. You can also
specify the UDP port to use. By default IPXNET uses port 213 - the
assigned IANA port for IPX tunnelling - for its connection.
The syntax for IPXNET CONNECT is:
IPXNET CONNECT address <port>
IPXNET DISCONNECT
IPXNET DISCONNECT closes the connection to the IPX tunneling server.
IPXNET DISCONNECT closes the connection to the IPX tunnelling server.
The syntax for IPXNET DISCONNECT is:
IPXNET DISCONNECT
@ -524,34 +573,34 @@ IPX
IPXNET STARTSERVER starts and IPX tunneling server on this DOSBox
session. By default, the server will accept connections on UDP port
213, though this can be changed. Once the server is started, DOSBox
will automatically start a client connection to the IPX tunneling server.
will automatically start a client connection to the IPX tunnelling server.
The syntax for IPXNET STARTSERVER is:
IPXNET STARTSERVER <port>
The syntax for IPXNET STARTSERVER is:
IPXNET STARTSERVER <port>
IPXNET STOPSERVER
IPXNET STOPSERVER
IPXNET STOPSERVER stops the IPX tunneling server running on this DOSBox
IPXNET STOPSERVER stops the IPX tunnelling server running on this DOSBox
session. Care should be taken to ensure that all other connections have
terminated as well since stopping the server may cause lockups on other
machines still using the IPX tunneling server.
terminated as well, since stopping the server may cause lockups on other
machines that are still using the IPX tunnelling server.
The syntax for IPXNET STOPSERVER is:
IPXNET STOPSERVER
IPXNET PING
IPXNET PING
IPXNET PING broadcasts a ping request through the IPX tunneled network.
IPXNET PING broadcasts a ping request through the IPX tunnelled network.
In response, all other connected computers will respond to the ping
and report the time it took to receive and send the ping message.
The syntax for IPXNET PING is:
IPXNET PING
IPXNET PING
IPXNET STATUS
IPXNET STATUS
IPXNET STATUS reports the current state of this DOSBox's sessions
IPX tunneling network. For a list of the computers connected to the
IPXNET STATUS reports the current state of this DOSBox session's
IPX tunnelling network. For a list of all computers connected to the
network use the IPXNET PING command.
The syntax for IPXNET STATUS is:
@ -566,9 +615,11 @@ For more information use the /? command line switch with the programs.
5. Special Keys:
================
ALT-ENTER Go full screen and back.
ALT-ENTER Switch to full screen and back.
ALT-PAUSE Pause emulation.
CTRL-F1 Start the keymapper.
CTRL-F4 Swap mounted disk-image. Update directory cache for all drives!
CTRL-F4 Change between mounted disk-images. Update directory cache for all drives!
CTRL-ALT-F5 Start/Stop creating a movie of the screen.
CTRL-F5 Save a screenshot.(png)
CTRL-F6 Start/Stop recording sound output to a wave file.
CTRL-ALT-F7 Start/Stop recording of OPL commands.
@ -579,18 +630,19 @@ CTRL-F9 Kill dosbox.
CTRL-F10 Capture/Release the mouse.
CTRL-F11 Slow down emulation (Decrease DOSBox Cycles).
CTRL-F12 Speed up emulation (Increase DOSBox Cycles).
ALT-F12 Unlock speed (turbo button).
These are the default keybindings. They can be changed in the keymapper.
Saved/recorded files can be found in current_directory/capture
(can be changed in the configfile).
The directory has to exist prior to starting DOSBox else nothing
The directory has to exist prior to starting DOSBox, otherwise nothing
gets saved/recorded !
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.
This maximum will vary from computer to computer; there is no standard.
@ -599,12 +651,12 @@ This maximum will vary from computer to computer, there is no standard.
=============
When you start the keymapper (either with CTRL-F1 or -startmapper as a
commandline argument to the DOSBox executable) you are presented with
command line argument to the DOSBox executable) you are presented with
a virtual keyboard.
This virtual keyboard corresponds with the keys DOSBox will report to its
This virtual keyboard corresponds to the keys DOSBox will report to its
applications. If you click on a key with your mouse, you can see in the
lowerleft corner which key on your keyboard corresponds with it.
lower left corner which key on your keyboard corresponds to it.
Event: EVENT
BIND: BIND
@ -624,35 +676,35 @@ mod1,2,3
BIND. mod1 = CTRL and mod2 = ALT. These are generally only used when you
want to change the special keys of DOSBox.
Add
Add a new BIND to this EVENT. Basicly add a key from your keyboard which
Add a new BIND to this EVENT. Basically add a key from your keyboard which
will produce the key EVENT in DOSBox.
Del
Delete the BIND to this EVENT. If an EVENT has no BINDS than it's not
Delete the BIND to this EVENT. If an EVENT has no BINDS, then it's not
possible to type this key in DOSBox.
Next
Cycle through the list of keys(BINDS) which map to this EVENT.
Go through the list of keys(BINDS) which map to this EVENT.
Example:
Q1. You want to have the X on your keyboard to type a Z in DOSBox.
A. With your mouse click on the Z on the keyboard mapper. Click "Add".
A. Click on the Z on the keyboard mapper. Click "Add".
Now press the X key on your keyboard.
Q2. If you click "Next" a few times you will notice that the Z on your
Q2. If you click "Next" a couple of times, you will notice that the Z on your
keyboard also produces an Z in DOSBox.
A. Therefore select the Z again and click "Next" till you have the Z on
A. Therefore select the Z again, and click "Next" until you have the Z on
your keyboard. Now click "Del".
Q3. If you try it out in DOSBox you will notice that pressing X makes ZX
Q3. If you try it out in DOSBox, you will notice that pressing X makes ZX
appear.
A. The X on your keyboard is still mapped to the X as well! Click on
the X in the keyboard mapper and search with "Next" till you find the
the X in the keyboard mapper and search with "Next" until you find the
mapped key X. Click "Del".
If you change the default mapping you can save your changes by pressing
"Save". DOSBox will save the mapping to location specified in the configfile
(mapperfile=mapper.txt). At startup DOSBox will load your mapperfile if it's
If you change the default mapping, you can save your changes by pressing
"Save". DOSBox will save the mapping to a location specified in the configfile
(mapperfile=mapper.txt). At startup, DOSBox will load your mapperfile, if it's
present in the configfile.
@ -663,8 +715,8 @@ present in the configfile.
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
For protected mode games a 1 Ghz machine is recommended - don't expect
them to run fast, though! Be sure to read the next section on how to speed
it up somewhat.
@ -674,7 +726,7 @@ it up somewhat.
===================================
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
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 looking at the Task Manager in Windows 2000/XP and
the System Monitor in Windows 95/98/ME. Once 100% of your real CPU time is
@ -689,14 +741,14 @@ Overclock DOSBox until 100% of your CPU is used (use the utilities above to
check)
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.
CPU usage, we'll start there. Increase the number of frames skipped (in
increments of one) by pressing CTRL-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
Please note that this is a trade-off: you lose in fluidity of video what you
gain in speed
You can also try to disable the sound through the setup utility of the game
to further reduce load on your CPU.
to reduce load on your CPU further.
@ -710,7 +762,7 @@ programs section of the readme for usage of CONFIG.COM.
You can edit the generated configfile to customize DOSBox.
The file is divided into several sections (the names have [] around it).
Some sections have options which you can set.
Some sections have options you can set.
# and % indicate comment-lines.
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.
@ -726,10 +778,10 @@ current directory for dosbox.conf. Then it will look for ~/.dosboxrc (Linux),
======================
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.
Read it, and you will hopefully understand how to change it.
Start DOSBox with the -lang switch to use your new language file.
Alternatively, 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.
@ -746,9 +798,9 @@ Check the INSTALL in the source distribution.
12. Special Thanks:
===================
Vlad R. of the vdmsound project for excellent sound blaster info.
Vlad R. of the VDMSound project for excellent SoundBlaster info.
Tatsuyuki Satoh of the Mame Team for making an excellent FM emulator.
The Bochs and DOSemu projects which I used for information.
The Bochs and DOSemu projects, which I used for information.
Freedos for ideas in making my shell.
Pierre-Yves Gérardy for hosting the old Beta Board.
Colin Snover for hosting our forum.
@ -762,4 +814,4 @@ The Beta Testers.
See the site:
http://dosbox.sourceforge.net
for an emailaddress (The Crew-page).
for an email address (The Crew-page).

1
TODO Normal file
View File

@ -0,0 +1 @@
perharps check if console exists before setting name.

View File

@ -305,7 +305,7 @@ AC_SUBST(ALSA_LIBS)
AH_TOP([
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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
@ -331,6 +331,12 @@ AH_BOTTOM([#if C_HAS_ATTRIBUTE
#define GCC_ATTRIBUTE(x) /* attribute not supported */
#endif])
AH_BOTTOM([#if C_HAS_BUILTIN_EXPECT
#define GCC_UNLIKELY(x) __builtin_expect((x),0)
#else
#define GCC_UNLIKELY(x) (x)
#endif])
AH_BOTTOM([
typedef double Real64;

412
aclocal.m4 vendored
View File

@ -1,7 +1,7 @@
# generated automatically by aclocal 1.9.3 -*- Autoconf -*-
# generated automatically by aclocal 1.9.5 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
# Free Software Foundation, Inc.
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005 Free Software Foundation, Inc.
# This file 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.
@ -11,23 +11,11 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
# -*- Autoconf -*-
# Copyright (C) 2002, 2003 Free Software Foundation, Inc.
# Generated from amversion.in; do not edit by hand.
# 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
# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
#
# This file 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.
# AM_AUTOMAKE_VERSION(VERSION)
# ----------------------------
@ -40,26 +28,15 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
# 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.9.3])])
[AM_AUTOMAKE_VERSION([1.9.5])])
# AM_AUX_DIR_EXPAND
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
# Copyright (C) 2001, 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
# 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.
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file 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.
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
@ -106,26 +83,16 @@ AC_PREREQ([2.50])dnl
am_aux_dir=`cd $ac_aux_dir && pwd`
])
# AM_CONDITIONAL -*- Autoconf -*-
# AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997, 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file 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 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 6
# serial 7
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
# -------------------------------------
@ -149,26 +116,15 @@ AC_CONFIG_COMMANDS_PRE(
Usually this means the macro was only invoked conditionally.]])
fi])])
# serial 7 -*- Autoconf -*-
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file 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 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 8
# 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,
@ -177,7 +133,6 @@ fi])])
# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
# _AM_DEPENDENCIES(NAME)
# ----------------------
# See how the compiler implements dependency checking.
@ -317,27 +272,16 @@ AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
AC_SUBST([AMDEPBACKSLASH])
])
# Generate code to set up dependency tracking. -*- Autoconf -*-
# Generate code to set up dependency tracking. -*- Autoconf -*-
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
# Free Software Foundation, Inc.
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file 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 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 2
#serial 3
# _AM_OUTPUT_DEPENDENCY_COMMANDS
# ------------------------------
@ -396,54 +340,31 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
])
# Like AC_CONFIG_HEADER, but automatically create stamp file. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
# Free Software Foundation, Inc.
#
# This file 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.
# Copyright (C) 1996, 1997, 2000, 2001, 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
# 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 7
# serial 8
# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS.
AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
# Do all the work for Automake. -*- Autoconf -*-
# Do all the work for Automake. -*- Autoconf -*-
# 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 (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file 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 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.
# serial 12
# 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 11
# 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.
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
# AM_INIT_AUTOMAKE([OPTIONS])
@ -545,51 +466,27 @@ for _am_header in $config_headers :; do
done
echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file 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.
# AM_PROG_INSTALL_SH
# ------------------
# Define $install_sh.
# Copyright (C) 2001, 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
# 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.
AC_DEFUN([AM_PROG_INSTALL_SH],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
install_sh=${install_sh-"$am_aux_dir/install-sh"}
AC_SUBST(install_sh)])
# -*- Autoconf -*-
# Copyright (C) 2003 Free Software Foundation, Inc.
# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
#
# This file 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 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
# serial 2
# Check whether the underlying file-system supports filenames
# with a leading dot. For instance MS-DOS doesn't.
@ -604,26 +501,15 @@ fi
rmdir .tst 2>/dev/null
AC_SUBST([am__leading_dot])])
# Check to see how 'make' treats includes. -*- Autoconf -*-
# Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
#
# This file 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 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 2
# serial 3
# AM_MAKE_INCLUDE()
# -----------------
@ -667,27 +553,16 @@ AC_MSG_RESULT([$_am_result])
rm -f confinc confmf
])
# -*- Autoconf -*-
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
# Free Software Foundation, Inc.
#
# This file 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.
# Copyright (C) 1997, 1999, 2000, 2001, 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
# 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 3
# serial 4
# AM_MISSING_PROG(NAME, PROGRAM)
# ------------------------------
@ -713,27 +588,16 @@ else
fi
])
# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
#
# This file 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.
# AM_PROG_MKDIR_P
# ---------------
# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
# Copyright (C) 2003, 2004 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.
#
# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
# created by `make install' are always world readable, even if the
# installer happens to have an overly restrictive umask (e.g. 077).
@ -787,26 +651,15 @@ else
fi
AC_SUBST([mkdir_p])])
# Helper functions for option handling. -*- Autoconf -*-
# Helper functions for option handling. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
#
# This file 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 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 2
# serial 3
# _AM_MANGLE_OPTION(NAME)
# -----------------------
@ -831,28 +684,16 @@ AC_DEFUN([_AM_SET_OPTIONS],
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
# Check to make sure that the build environment is sane. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
# Free Software Foundation, Inc.
#
# Check to make sure that the build environment is sane.
#
# This file 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.
# Copyright (C) 1996, 1997, 2000, 2001, 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
# 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 3
# serial 4
# AM_SANITY_CHECK
# ---------------
@ -895,25 +736,14 @@ Check your system clock])
fi
AC_MSG_RESULT(yes)])
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file 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.
# AM_PROG_INSTALL_STRIP
# Copyright (C) 2001, 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
# 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.
# ---------------------
# One issue with vendor `install' (even GNU) is that you can't
# specify the program used to strip binaries. This is especially
# annoying in cross-compiling environments, where the build's strip
@ -936,25 +766,13 @@ AC_SUBST([INSTALL_STRIP_PROGRAM])])
# Check how to create a tarball. -*- Autoconf -*-
# Copyright (C) 2004 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
# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
#
# This file 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.
# serial 2
# _AM_PROG_TAR(FORMAT)
# --------------------

View File

@ -2,7 +2,7 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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,7 +26,8 @@
/* Define to 1 to enable internal debugger, requires libcurses */
#undef C_DEBUG
/* Define to 1 if you want serial passthrough support (Win32 only). */
/* Define to 1 if you want serial passthrough support (Win32 and OS/2 only).
*/
#undef C_DIRECTSERIAL
/* Define to 1 to use x86 dynamic cpu core */
@ -35,9 +36,19 @@
/* Define to 1 to enable floating point emulation */
#undef C_FPU
/* Define to 1 to use a x86 assembly fpu core */
#undef C_FPU_X86
/* Determines if the compilers supports attributes for structures. */
#undef C_HAS_ATTRIBUTE
/* Determines if the compilers supports __builtin_expect for branch
prediction. */
#undef C_HAS_BUILTIN_EXPECT
/* Define to 1 if you have the mprotect function */
#undef C_HAVE_MPROTECT
/* Define to 1 to enable heavy debugging, also have to enable C_DEBUG */
#undef C_HEAVY_DEBUG
@ -62,6 +73,9 @@
/* Define to 1 to enable screenshots, requires libpng */
#undef C_SSHOT
/* Define to 1 to use a unaligned memory access */
#undef C_UNALIGNED_MEMORY
/* environ can be included */
#undef ENVIRON_INCLUDED
@ -110,6 +124,9 @@
/* Compiling on Mac OS X */
#undef MACOSX
/* Compiling on OS/2 EMX */
#undef OS2
/* Name of package */
#undef PACKAGE
@ -179,6 +196,12 @@
#define GCC_ATTRIBUTE(x) /* attribute not supported */
#endif
#if C_HAS_BUILTIN_EXPECT
#define GCC_UNLIKELY(x) __builtin_expect((x),0)
#else
#define GCC_UNLIKELY(x) (x)
#endif
typedef double Real64;

601
configure vendored
View File

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59 for dosbox 0.63.
# Generated by GNU Autoconf 2.59 for dosbox 0.65.
#
# Copyright (C) 2003 Free Software Foundation, Inc.
# This configure script is free software; the Free Software Foundation
@ -267,8 +267,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='dosbox'
PACKAGE_TARNAME='dosbox'
PACKAGE_VERSION='0.63'
PACKAGE_STRING='dosbox 0.63'
PACKAGE_VERSION='0.65'
PACKAGE_STRING='dosbox 0.65'
PACKAGE_BUGREPORT=''
ac_unique_file="README"
@ -309,7 +309,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 CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar 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_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 install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar 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 WINDRES ac_ct_WINDRES HAVE_WINDRES_TRUE HAVE_WINDRES_FALSE LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@ -786,7 +786,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.63 to adapt to many kinds of systems.
\`configure' configures dosbox 0.65 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -853,7 +853,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of dosbox 0.63:";;
short | recursive ) echo "Configuration of dosbox 0.65:";;
esac
cat <<\_ACEOF
@ -868,6 +868,9 @@ Optional Features:
--enable-core-inline Enable inlined memory handling in CPU Core
--disable-dynamic-x86 Disable x86 dynamic cpu core
--disable-fpu Disable fpu support
--disable-fpu-x86 Disable x86 assembly fpu core
--disable-unaligned-memory
Disable unaligned memory access
--disable-opengl Disable opengl support
Optional Packages:
@ -987,7 +990,7 @@ fi
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
dosbox configure 0.63
dosbox configure 0.65
generated by GNU Autoconf 2.59
Copyright (C) 2003 Free Software Foundation, Inc.
@ -1001,7 +1004,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.63, which was
It was created by dosbox $as_me 0.65, which was
generated by GNU Autoconf 2.59. Invocation command line was
$ $0 $@
@ -1730,7 +1733,7 @@ fi
# Define the identity of the package.
PACKAGE='dosbox'
VERSION='0.63'
VERSION='0.65'
cat >>confdefs.h <<_ACEOF
@ -3844,6 +3847,12 @@ else
fi
if test x$target = xi386-pc-os2-emx ; then
CXXFLAGS="$CXXFLAGS -Zmt"
LDFLAGS="$LDFLAGS -Zomf -Zmt"
LIBS="$LIBS -los2me"
fi
SDL_VERSION=1.2.0
@ -7292,6 +7301,67 @@ echo "${ECHO_T}no" >&6
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
#Check if the compiler supports __builtin_expect
echo "$as_me:$LINENO: checking if compiler allows __builtin_expect" >&5
echo $ECHO_N "checking if compiler allows __builtin_expect... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
main ()
{
int main(int argc,char* argv[]){
int x=10;if( __builtin_expect ((x==1),0) ) ;
return 0;
}
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 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); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (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); }; } &&
{ 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
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6;cat >>confdefs.h <<\_ACEOF
#define C_HAS_BUILTIN_EXPECT 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.err conftest.$ac_objext conftest.$ac_ext
alsa_save_CFLAGS="$CFLAGS"
alsa_save_LDFLAGS="$LDFLAGS"
alsa_save_LIBS="$LIBS"
@ -7558,7 +7628,7 @@ fi
#Check for big endian machine, should #define WORD_BIGENDIAN if so
#Check for big endian machine, should #define WORDS_BIGENDIAN if so
echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5
echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6
if test "${ac_cv_c_bigendian+set}" = set; then
@ -8072,7 +8142,10 @@ if test $ac_cv_lib_pdcurses_initscr = yes; then
fi
if test x$have_curses_lib = xyes -a x$have_curses_h = xyes ; then
if test x$enable_debug = xno; then
echo "$as_me:$LINENO: result: Debugger not enabled" >&5
echo "${ECHO_T}Debugger not enabled" >&6
elif test x$have_curses_lib = xyes -a x$have_curses_h = xyes ; then
LIBS="$LIBS -lcurses"
cat >>confdefs.h <<\_ACEOF
#define C_DEBUG 1
@ -8126,7 +8199,7 @@ fi;
echo "$as_me:$LINENO: checking for target cpu type" >&5
echo $ECHO_N "checking for target cpu type... $ECHO_C" >&6
case "$target_cpu" in
i386|i486|i586|i686)
i?86)
cat >>confdefs.h <<\_ACEOF
#define C_HOSTCPU X86
_ACEOF
@ -8134,18 +8207,41 @@ _ACEOF
echo "$as_me:$LINENO: result: x86 compatible" >&5
echo "${ECHO_T}x86 compatible" >&6
c_hostcpu="x86"
c_unalignedmemory=yes
;;
*)
powerpc*)
cat >>confdefs.h <<\_ACEOF
#define C_HOSTCPU POWERPC
_ACEOF
echo "$as_me:$LINENO: result: Power PC" >&5
echo "${ECHO_T}Power PC" >&6
c_hostcpu="powerpc"
c_unalignedmemory=yes
;;
m68k*)
cat >>confdefs.h <<\_ACEOF
#define C_HOSTCPU M68K
_ACEOF
echo "$as_me:$LINENO: result: Motorola 68000" >&5
echo "${ECHO_T}Motorola 68000" >&6
c_hostcpu="m68k"
c_unalignedmemory=yes
;;
*)
cat >>confdefs.h <<\_ACEOF
#define C_HOSTCPU UNKOWN
_ACEOF
echo "$as_me:$LINENO: result: unknown" >&5
echo "${ECHO_T}unknown" >&6
c_unalignedmemory=no
;;
esac
# Check whether --enable-dynamic-x86 or --disable-dynamic-x86 was given.
if test "${enable_dynamic_x86+set}" = set; then
enableval="$enable_dynamic_x86"
@ -8174,8 +8270,6 @@ fi
# Check whether --enable-fpu or --disable-fpu was given.
if test "${enable_fpu+set}" = set; then
enableval="$enable_fpu"
@ -8199,6 +8293,62 @@ fi
# Check whether --enable-fpu-x86 or --disable-fpu-x86 was given.
if test "${enable_fpu_x86+set}" = set; then
enableval="$enable_fpu_x86"
else
enable_fpu_x86=yes
fi;
echo "$as_me:$LINENO: checking whether x86 assembly fpu core will be enabled" >&5
echo $ECHO_N "checking whether x86 assembly fpu core will be enabled... $ECHO_C" >&6
if test x$enable_fpu_x86 = xno ; then
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
else
if test x$enable_fpu = xyes; then
if test x$c_hostcpu = xx86 ; then
cat >>confdefs.h <<\_ACEOF
#define C_FPU_X86 1
_ACEOF
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
fi
# Check whether --enable-unaligned_memory or --disable-unaligned_memory was given.
if test "${enable_unaligned_memory+set}" = set; then
enableval="$enable_unaligned_memory"
else
enable_unaligned_memory=yes
fi;
echo "$as_me:$LINENO: checking whether to enable unaligned memory access" >&5
echo $ECHO_N "checking whether to enable unaligned memory access... $ECHO_C" >&6
if test x$enable_unaligned_memory = xyes -a x$c_unalignedmemory = xyes; then
cat >>confdefs.h <<\_ACEOF
#define C_UNALIGNED_MEMORY 1
_ACEOF
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
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
@ -8563,6 +8713,54 @@ if test $ac_cv_header_SDL_net_h = yes; then
fi
if test x$target = xi386-pc-os2-emx ; then
echo "$as_me:$LINENO: checking for SDLNet_Init in SDL_net" >&5
echo $ECHO_N "checking for SDLNet_Init in SDL_net... $ECHO_C" >&6;
LIBS_BACKUP=$LIBS;
LIBS="$LIBS -lSDL_Net";
cat >conftest.$ac_ext <<_ACEOF
#include <SDL_Net.h>
int main(int argc,char * argv) {
return SDLNet_Init ();
};
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 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); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (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); }; } &&
{ 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; have_sdl_net_lib=yes
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.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$LIBS_BACKUP
else
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
@ -8630,6 +8828,7 @@ if test $ac_cv_lib_SDL_net_SDLNet_Init = yes; then
have_sdl_net_lib=yes
fi
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
@ -9241,6 +9440,247 @@ fi
if test "${ac_cv_header_sys_mman_h+set}" = set; then
echo "$as_me:$LINENO: checking for sys/mman.h" >&5
echo $ECHO_N "checking for sys/mman.h... $ECHO_C" >&6
if test "${ac_cv_header_sys_mman_h+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
echo "$as_me:$LINENO: result: $ac_cv_header_sys_mman_h" >&5
echo "${ECHO_T}$ac_cv_header_sys_mman_h" >&6
else
# Is the header compilable?
echo "$as_me:$LINENO: checking sys/mman.h usability" >&5
echo $ECHO_N "checking sys/mman.h usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
#include <sys/mman.h>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 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); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (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); }; } &&
{ 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.err 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 sys/mman.h presence" >&5
echo $ECHO_N "checking sys/mman.h presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <sys/mman.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
ac_cpp_err=$ac_cpp_err$ac_c_werror_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:$ac_c_preproc_warn_flag in
yes:no: )
{ echo "$as_me:$LINENO: WARNING: sys/mman.h: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: sys/mman.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ echo "$as_me:$LINENO: WARNING: sys/mman.h: proceeding with the compiler's result" >&5
echo "$as_me: WARNING: sys/mman.h: proceeding with the compiler's result" >&2;}
ac_header_preproc=yes
;;
no:yes:* )
{ echo "$as_me:$LINENO: WARNING: sys/mman.h: present but cannot be compiled" >&5
echo "$as_me: WARNING: sys/mman.h: present but cannot be compiled" >&2;}
{ echo "$as_me:$LINENO: WARNING: sys/mman.h: check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: sys/mman.h: check for missing prerequisite headers?" >&2;}
{ echo "$as_me:$LINENO: WARNING: sys/mman.h: see the Autoconf documentation" >&5
echo "$as_me: WARNING: sys/mman.h: see the Autoconf documentation" >&2;}
{ echo "$as_me:$LINENO: WARNING: sys/mman.h: section \"Present But Cannot Be Compiled\"" >&5
echo "$as_me: WARNING: sys/mman.h: section \"Present But Cannot Be Compiled\"" >&2;}
{ echo "$as_me:$LINENO: WARNING: sys/mman.h: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: sys/mman.h: proceeding with the preprocessor's result" >&2;}
{ echo "$as_me:$LINENO: WARNING: sys/mman.h: in the future, the compiler will take precedence" >&5
echo "$as_me: WARNING: sys/mman.h: in the future, the compiler will take precedence" >&2;}
(
cat <<\_ASBOX
## --------------------------------- ##
## Report this to the dosbox lists. ##
## --------------------------------- ##
_ASBOX
) |
sed "s/^/$as_me: WARNING: /" >&2
;;
esac
echo "$as_me:$LINENO: checking for sys/mman.h" >&5
echo $ECHO_N "checking for sys/mman.h... $ECHO_C" >&6
if test "${ac_cv_header_sys_mman_h+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_cv_header_sys_mman_h=$ac_header_preproc
fi
echo "$as_me:$LINENO: result: $ac_cv_header_sys_mman_h" >&5
echo "${ECHO_T}$ac_cv_header_sys_mman_h" >&6
fi
if test $ac_cv_header_sys_mman_h = yes; then
echo "$as_me:$LINENO: checking for mprotect" >&5
echo $ECHO_N "checking for mprotect... $ECHO_C" >&6
if test "${ac_cv_func_mprotect+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Define mprotect to an innocuous variant, in case <limits.h> declares mprotect.
For example, HP-UX 11i <limits.h> declares gettimeofday. */
#define mprotect innocuous_mprotect
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char mprotect (); below.
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
<limits.h> exists even on freestanding compilers. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
#undef mprotect
/* 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 mprotect ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_mprotect) || defined (__stub___mprotect)
choke me
#else
char (*f) () = mprotect;
#endif
#ifdef __cplusplus
}
#endif
int
main ()
{
return f != mprotect;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 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); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (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); }; } &&
{ 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_func_mprotect=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_func_mprotect=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_func_mprotect" >&5
echo "${ECHO_T}$ac_cv_func_mprotect" >&6
if test $ac_cv_func_mprotect = yes; then
cat >>confdefs.h <<\_ACEOF
#define C_HAVE_MPROTECT 1
_ACEOF
fi
fi
echo "$as_me:$LINENO: checking for setpriority support" >&5
echo $ECHO_N "checking for setpriority support... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
@ -9461,10 +9901,121 @@ cat >>confdefs.h <<\_ACEOF
_ACEOF
;;
*-*-os2-emx*)
cat >>confdefs.h <<\_ACEOF
#define OS2 1
_ACEOF
cat >>confdefs.h <<\_ACEOF
#define C_DIRECTSERIAL 1
_ACEOF
;;
esac
case "$target" in
*-*-cygwin* | *-*-mingw32*)
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}windres", so it can be a program name with args.
set dummy ${ac_tool_prefix}windres; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_WINDRES+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$WINDRES"; then
ac_cv_prog_WINDRES="$WINDRES" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_WINDRES="${ac_tool_prefix}windres"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
fi
fi
WINDRES=$ac_cv_prog_WINDRES
if test -n "$WINDRES"; then
echo "$as_me:$LINENO: result: $WINDRES" >&5
echo "${ECHO_T}$WINDRES" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
fi
if test -z "$ac_cv_prog_WINDRES"; then
ac_ct_WINDRES=$WINDRES
# Extract the first word of "windres", so it can be a program name with args.
set dummy windres; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_WINDRES+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$ac_ct_WINDRES"; then
ac_cv_prog_ac_ct_WINDRES="$ac_ct_WINDRES" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_WINDRES="windres"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
test -z "$ac_cv_prog_ac_ct_WINDRES" && ac_cv_prog_ac_ct_WINDRES=":"
fi
fi
ac_ct_WINDRES=$ac_cv_prog_ac_ct_WINDRES
if test -n "$ac_ct_WINDRES"; then
echo "$as_me:$LINENO: result: $ac_ct_WINDRES" >&5
echo "${ECHO_T}$ac_ct_WINDRES" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
WINDRES=$ac_ct_WINDRES
else
WINDRES="$ac_cv_prog_WINDRES"
fi
;;
*)
WINDRES=":"
;;
esac
ac_config_files="$ac_config_files Makefile src/Makefile src/cpu/Makefile src/cpu/core_full/Makefile src/cpu/core_normal/Makefile src/cpu/core_dyn_x86/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 visualc_net/Makefile include/Makefile docs/Makefile"
if test "x$WINDRES" != "x:"; then
HAVE_WINDRES_TRUE=
HAVE_WINDRES_FALSE='#'
else
HAVE_WINDRES_TRUE='#'
HAVE_WINDRES_FALSE=
fi
ac_config_files="$ac_config_files Makefile src/Makefile src/cpu/Makefile src/cpu/core_full/Makefile src/cpu/core_normal/Makefile src/cpu/core_dyn_x86/Makefile src/debug/Makefile src/dos/Makefile src/fpu/Makefile src/gui/Makefile src/hardware/Makefile src/hardware/serialport/Makefile src/ints/Makefile src/libs/Makefile src/libs/zmbv/Makefile src/misc/Makefile src/shell/Makefile src/platform/Makefile src/platform/visualc/Makefile visualc/Makefile visualc_net/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
@ -9577,6 +10128,13 @@ 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
if test -z "${HAVE_WINDRES_TRUE}" && test -z "${HAVE_WINDRES_FALSE}"; then
{ { echo "$as_me:$LINENO: error: conditional \"HAVE_WINDRES\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
echo "$as_me: error: conditional \"HAVE_WINDRES\" 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
@ -9848,7 +10406,7 @@ _ASBOX
} >&5
cat >&5 <<_CSEOF
This file was extended by dosbox $as_me 0.63, which was
This file was extended by dosbox $as_me 0.65, which was
generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -9911,7 +10469,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
dosbox config.status 0.63
dosbox config.status 0.65
configured by $0, generated by GNU Autoconf 2.59,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
@ -10032,7 +10590,10 @@ do
"src/fpu/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/fpu/Makefile" ;;
"src/gui/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/gui/Makefile" ;;
"src/hardware/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/hardware/Makefile" ;;
"src/hardware/serialport/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/hardware/serialport/Makefile" ;;
"src/ints/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/ints/Makefile" ;;
"src/libs/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/libs/Makefile" ;;
"src/libs/zmbv/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/libs/zmbv/Makefile" ;;
"src/misc/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/misc/Makefile" ;;
"src/shell/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/shell/Makefile" ;;
"src/platform/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/platform/Makefile" ;;
@ -10193,6 +10754,10 @@ s,@SDL_LIBS@,$SDL_LIBS,;t t
s,@EGREP@,$EGREP,;t t
s,@ALSA_CFLAGS@,$ALSA_CFLAGS,;t t
s,@ALSA_LIBS@,$ALSA_LIBS,;t t
s,@WINDRES@,$WINDRES,;t t
s,@ac_ct_WINDRES@,$ac_ct_WINDRES,;t t
s,@HAVE_WINDRES_TRUE@,$HAVE_WINDRES_TRUE,;t t
s,@HAVE_WINDRES_FALSE@,$HAVE_WINDRES_FALSE,;t t
s,@LIBOBJS@,$LIBOBJS,;t t
s,@LTLIBOBJS@,$LTLIBOBJS,;t t
CEOF

View File

@ -1,5 +1,5 @@
dnl Init.
AC_INIT(dosbox,0.63)
AC_INIT(dosbox,0.65)
AC_PREREQ(2.50)
AC_CONFIG_SRCDIR(README)
@ -19,6 +19,14 @@ AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_RANLIB
dnl Some needed libaries for OS2
dnl perharps join this with the other host depended checks. move them upwards
if test x$target = xi386-pc-os2-emx ; then
CXXFLAGS="$CXXFLAGS -Zmt"
LDFLAGS="$LDFLAGS -Zomf -Zmt"
LIBS="$LIBS -los2me"
fi
dnl Check for SDL
SDL_VERSION=1.2.0
AM_PATH_SDL($SDL_VERSION,
@ -58,9 +66,20 @@ 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))
#Check if the compiler supports __builtin_expect
AH_TEMPLATE([C_HAS_BUILTIN_EXPECT],[Determines if the compilers supports __builtin_expect for branch prediction.])
AC_MSG_CHECKING(if compiler allows __builtin_expect)
AC_TRY_COMPILE([],[
int main(int argc,char* argv[]){
int x=10;if( __builtin_expect ((x==1),0) ) ;
return 0;
}
], [ AC_MSG_RESULT(yes);AC_DEFINE(C_HAS_BUILTIN_EXPECT)],AC_MSG_RESULT(no))
AM_PATH_ALSA(0.9.0, AC_DEFINE(HAVE_ALSA,1,[Define to 1 to use ALSA for MIDI]) , : )
#Check for big endian machine, should #define WORD_BIGENDIAN if so
#Check for big endian machine, should #define WORDS_BIGENDIAN if so
AC_C_BIGENDIAN
#Features to enable/disable
@ -71,7 +90,9 @@ AC_ARG_ENABLE(debug,AC_HELP_STRING([--enable-debug],[Enable debug mode]),[
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
if test x$enable_debug = xno; then
AC_MSG_RESULT([Debugger not enabled])
elif test x$have_curses_lib = xyes -a x$have_curses_h = xyes ; then
LIBS="$LIBS -lcurses"
AC_DEFINE(C_DEBUG,1)
if test x$enable_debug = xheavy ; then
@ -101,16 +122,31 @@ dnl The target cpu checks for dynamic cores
AH_TEMPLATE(C_HOSTCPU,[The type of cpu this host has])
AC_MSG_CHECKING(for target cpu type)
case "$target_cpu" in
i386|i486|i586|i686)
i?86)
AC_DEFINE(C_HOSTCPU,X86)
AC_MSG_RESULT(x86 compatible)
c_hostcpu="x86"
c_unalignedmemory=yes
;;
*)
powerpc*)
AC_DEFINE(C_HOSTCPU,POWERPC)
AC_MSG_RESULT(Power PC)
c_hostcpu="powerpc"
c_unalignedmemory=yes
;;
m68k*)
AC_DEFINE(C_HOSTCPU,M68K)
AC_MSG_RESULT(Motorola 68000)
c_hostcpu="m68k"
c_unalignedmemory=yes
;;
*)
AC_DEFINE(C_HOSTCPU,UNKOWN)
AC_MSG_RESULT(unknown)
c_unalignedmemory=no
;;
esac
AH_TEMPLATE(C_DYNAMIC_X86,[Define to 1 to use x86 dynamic cpu core])
AC_ARG_ENABLE(dynamic-x86,AC_HELP_STRING([--disable-dynamic-x86],[Disable x86 dynamic cpu core]),,enable_dynamic_x86=yes)
AC_MSG_CHECKING(whether x86 dynamic cpu core will be enabled)
@ -125,8 +161,6 @@ else
fi
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]),,enable_fpu=yes)
AC_MSG_CHECKING(whether fpu emulation will be enabled)
@ -137,6 +171,34 @@ else
AC_MSG_RESULT(no)
fi
AH_TEMPLATE(C_FPU_X86,[Define to 1 to use a x86 assembly fpu core])
AC_ARG_ENABLE(fpu-x86,AC_HELP_STRING([--disable-fpu-x86],[Disable x86 assembly fpu core]),,enable_fpu_x86=yes)
AC_MSG_CHECKING(whether x86 assembly fpu core will be enabled)
if test x$enable_fpu_x86 = xno ; then
AC_MSG_RESULT(no)
else
if test x$enable_fpu = xyes; then
if test x$c_hostcpu = xx86 ; then
AC_DEFINE(C_FPU_X86,1)
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
else
AC_MSG_RESULT(no)
fi
fi
AH_TEMPLATE(C_UNALIGNED_MEMORY,[Define to 1 to use a unaligned memory access])
AC_ARG_ENABLE(unaligned_memory,AC_HELP_STRING([--disable-unaligned-memory],[Disable unaligned memory access]),,enable_unaligned_memory=yes)
AC_MSG_CHECKING(whether to enable unaligned memory access)
if test x$enable_unaligned_memory = xyes -a x$c_unalignedmemory = xyes; then
AC_DEFINE(C_UNALIGNED_MEMORY,1)
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
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)
@ -150,7 +212,21 @@ fi
AH_TEMPLATE(C_MODEM,[Define to 1 to enable internal modem support, requires SDL_net])
AH_TEMPLATE(C_IPX,[Define to 1 to enable IPX over Internet networking, requires SDL_net])
AC_CHECK_HEADER(SDL_net.h,have_sdl_net_h=yes,)
if test x$target = xi386-pc-os2-emx ; then
AC_MSG_CHECKING(for SDLNet_Init in SDL_net);
LIBS_BACKUP=$LIBS;
LIBS="$LIBS -lSDL_Net";
AC_LINK_IFELSE([
#include <SDL_Net.h>
int main(int argc,char * argv[]) {
return SDLNet_Init ();
};
], [AC_MSG_RESULT(yes); have_sdl_net_lib=yes], AC_MSG_RESULT(no))
LIBS=$LIBS_BACKUP
else
AC_CHECK_LIB(SDL_net, SDLNet_Init, 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"
AC_DEFINE(C_MODEM,1)
@ -192,6 +268,13 @@ else
AC_MSG_WARN([Can't find libSDL_sound, libSDL_sound support disabled])
fi
dnl Check for mprotect. Needed for 64 bits linux
AH_TEMPLATE(C_HAVE_MPROTECT,[Define to 1 if you have the mprotect function])
AC_CHECK_HEADER([sys/mman.h], [
AC_CHECK_FUNC([mprotect],[AC_DEFINE(C_HAVE_MPROTECT,1)])
])
dnl Setpriority
AH_TEMPLATE(C_SET_PRIORITY,[Define to 1 if you have setpriority support])
AC_MSG_CHECKING(for setpriority support)
AC_LINK_IFELSE([
@ -207,7 +290,7 @@ case "$target" in
*-*-cygwin* | *-*-mingw32*)
LIBS="$LIBS -lwinmm"
AC_CHECK_HEADERS(ddraw.h)
AC_DEFINE(C_DIRECTSERIAL, 1, [ Define to 1 if you want serial passthrough support (Win32 only).])
AC_DEFINE(C_DIRECTSERIAL, 1, [ Define to 1 if you want serial passthrough support (Win32 and OS/2 only).])
;;
*-*-darwin*)
dnl We have a problem here: both MacOS X and Darwin report
@ -220,8 +303,25 @@ case "$target" in
*-*-linux-gnu*)
AC_DEFINE(LINUX, 1, [Compiling on GNU/Linux])
;;
*-*-os2-emx*)
AC_DEFINE(OS2, 1, [Compiling on OS/2 EMX])
AC_DEFINE(C_DIRECTSERIAL, 1, [ Define to 1 if you want serial passthrough support (Win32 and OS/2 only).])
;;
esac
dnl Some stuff for the icon.
case "$target" in
*-*-cygwin* | *-*-mingw32*)
dnl Some stuff for the ico
AC_CHECK_TOOL(WINDRES, windres, :)
;;
*)
WINDRES=":"
;;
esac
AM_CONDITIONAL(HAVE_WINDRES, test "x$WINDRES" != "x:")
AC_SUBST(WINDRES)
AC_OUTPUT([
Makefile
@ -235,7 +335,10 @@ src/dos/Makefile
src/fpu/Makefile
src/gui/Makefile
src/hardware/Makefile
src/hardware/serialport/Makefile
src/ints/Makefile
src/libs/Makefile
src/libs/zmbv/Makefile
src/misc/Makefile
src/shell/Makefile
src/platform/Makefile

View File

@ -1,7 +1,7 @@
# Main Makefile for DOSBox
man_MANS = dosbox.1
EXTRA_DIST = $(man_MANS)
man_MANS = dosbox.1
EXTRA_DIST = $(man_MANS) README.video

View File

@ -1,8 +1,8 @@
# Makefile.in generated by automake 1.9.3 from Makefile.am.
# Makefile.in generated by automake 1.9.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004 Free Software Foundation, Inc.
# 2003, 2004, 2005 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.
@ -81,6 +81,8 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
HAVE_WINDRES_FALSE = @HAVE_WINDRES_FALSE@
HAVE_WINDRES_TRUE = @HAVE_WINDRES_TRUE@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
@ -106,10 +108,12 @@ SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
WINDRES = @WINDRES@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
ac_ct_WINDRES = @ac_ct_WINDRES@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
@ -151,8 +155,8 @@ target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
man_MANS = dosbox.1
EXTRA_DIST = $(man_MANS)
man_MANS = dosbox.1
EXTRA_DIST = $(man_MANS) README.video
all: all-am
.SUFFIXES:

32
docs/README.video Normal file
View File

@ -0,0 +1,32 @@
Starting with version 0.65, DOSBox allows you to create movies out of screen
output.
To record a movie, you have to press CTRL-ALT-F5.
To stop/end the recording, you have to press CTRL-ALT-F5 again.
To play the recorded movie, you need a movie player which can handle the
ZMBV codec. MS Windows users can find this codec in the start menu entry of
DOSBox. Users of Linux and other OSes should look for a movie player that
uses the ffmpeg libary (you may need to update or ask your distribution to
upgrade).
FAQ:
Q: During the display of the movies the sound is lagging.
A: Check your display properties to see whether your refresh rate is set to
at least 70 hz. Try playing the movie in virtualdub (http://virtualdub.sf.net)
Q: Why does the resulting movie consist of multiple files?
A: Each time the game changes resolution, DOSBox creates a new movie file,
because a movie file can only contain one resolution.
Q: Can I set the cycles higher than my PC can handle during recording?
A: Yes. During recording, the game might play slowly and stuttering, but the
resulting movie should play at the intended speed and have no stuttering.
Q: CTRL-ALT-F5 switches to the console under linux.
A: 1. Start DOSBox like this: dosbox -startmapper
2. Click on Video, click on Add
3. Press the key you want (for example scroll lock or printscreen)
4. Click exit.
5. You can make movies by pressing scroll lock or whichever key you
selected.

View File

@ -1,5 +1,5 @@
.\" Hey, EMACS: -*- nroff -*-
.TH DOSBOX 1 "Nov 18, 2004"
.TH DOSBOX 1 "Mar 28, 2006"
.\" Please adjust this date whenever revising the manpage.
.SH NAME
dosbox \- an x86/DOS emulator with sound/graphics
@ -7,6 +7,7 @@ dosbox \- an x86/DOS emulator with sound/graphics
.B dosbox
.B [\-fullscreen]
.B [\-startmapper]
.B [\-noautoexec]
.BI "[\-conf " configfile ]
.BI "[\-lang " langfile ]
.B [file]
@ -35,6 +36,9 @@ A summary of options is included below.
.B \-startmapper
.RB "Start the internal keymapper on startup of " dosbox ". You can use it to change the keys " dosbox " uses."
.TP
.B \-noautoexec
Skips the [autoexec] section of the loaded configuration file.
.TP
.BI \-c " command"
.RI "Runs the specified " command " before running "
.BR file .
@ -56,7 +60,7 @@ wish to execute on startup.
.TP
.BI \-machine " machinetype
.RB "Setup " dosbox " to emulate a specific type of machine."
.RI "Valid choices are: " "hercules, cga, tandy, vga(default)".
.RI "Valid choices are: " "hercules, cga, pcjr, tandy, vga(default)".
The machinetype has influence on both the videocard and the available
soundcards.
.TP
@ -214,8 +218,12 @@ automatically loaded, else ~/.dosboxrc (if present) will be loaded.
.TP 12m
.IP ALT\-ENTER
Go full screen and back.
.IP ALT\-PAUSE
Pause emulation.
.IP CTRL\-F1
Start the keymapper.
.IP CTRL\-ALT\-F5
Start/Stop creating a movie of the screen.
.IP CTRL\-F4
Swap mounted disk-image (Only used with imgmount). Update directory cache
for all drives!
@ -239,6 +247,8 @@ Capture/Release the mouse.
Slow down emulation (Increase dosbox Cycles).
.IP CTRL\-F12
Speed up emulation (Decrease dosbox Cycles).
.IP ALT\-F12
Unlock speed (turbo button).
.PP
These are the default keybindings. They can be changed in the keymapper.
.PP
@ -268,11 +278,11 @@ So:
.PP
.RB "Close every program but " dosbox .
.PP
.RB "Overclock " dosbox " until 100% of your CPU is used.(CTR\-+F12)"
.RB "Overclock " dosbox " until 100% of your CPU is used.(CTRL\-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.
increments of one) by pressing CTRL\-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.

View File

@ -1,8 +1,8 @@
# Makefile.in generated by automake 1.9.3 from Makefile.am.
# Makefile.in generated by automake 1.9.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004 Free Software Foundation, Inc.
# 2003, 2004, 2005 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.
@ -80,6 +80,8 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
HAVE_WINDRES_FALSE = @HAVE_WINDRES_FALSE@
HAVE_WINDRES_TRUE = @HAVE_WINDRES_TRUE@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
@ -105,10 +107,12 @@ SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
WINDRES = @WINDRES@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
ac_ct_WINDRES = @ac_ct_WINDRES@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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,8 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _BIOS_H_
#define _BIOS_H_
#ifndef DOSBOX_BIOS_H
#define DOSBOX_BIOS_H
#define BIOS_BASE_ADDRESS_COM1 0x400
#define BIOS_BASE_ADDRESS_COM2 0x402
@ -30,6 +30,7 @@
#define BIOS_CONFIGURATION 0x410
/* 0x412 is reserved */
#define BIOS_MEMORY_SIZE 0x413
#define BIOS_TRUE_MEMORY_SIZE 0x415
/* #define bios_expansion_memory_size (*(unsigned int *) 0x415) */
#define BIOS_KEYBOARD_STATE 0x417
#define BIOS_KEYBOARD_FLAGS1 BIOS_KEYBOARD_STATE
@ -72,7 +73,9 @@
/* 0x47b is reserved */
#define BIOS_COM1_TIMEOUT 0x47c
#define BIOS_COM2_TIMEOUT 0x47d
/* 0x47e is reserved */
#define BIOS_COM3_TIMEOUT 0x47e
#define BIOS_COM4_TIMEOUT 0x47f
/* 0x47e is reserved */ //<- why that?
/* 0x47f-0x4ff is unknow for me */
#define BIOS_KEYBOARD_BUFFER_START 0x480
#define BIOS_KEYBOARD_BUFFER_END 0x482
@ -112,8 +115,12 @@ struct diskGeo {
extern diskGeo DiskGeometryList[];
#include <stdio.h>
#ifndef DOSBOX_MEM_H
#include "mem.h"
#endif
#ifndef DOSBOX_DOS_INC_H
#include "dos_inc.h"
#endif
class imageDisk {
public:
@ -153,7 +160,7 @@ extern DOS_DTA *imgDTA;
void swapInDisks(void);
void swapInNextDisk(void);
void BIOS_ZeroExtendedSize(void);
void BIOS_ZeroExtendedSize(bool in);
void char_out(Bit8u chr,Bit32u att,Bit8u page);
void INT10_StartUp(void);
void INT16_StartUp(void);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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,17 +16,21 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __CALLBACK_H
#define __CALLBACK_H
/* $Id: callback.h,v 1.16 2006/02/09 11:47:47 qbix79 Exp $ */
#include <mem.h>
#ifndef DOSBOX_CALLBACK_H
#define DOSBOX_CALLBACK_H
#ifndef DOSBOX_MEM_H
#include "mem.h"
#endif
typedef Bitu (*CallBack_Handler)(void);
extern CallBack_Handler CallBack_Handlers[];
enum { CB_RETF,CB_IRET,CB_IRET_STI };
enum { CB_RETN, CB_RETF,CB_IRET,CB_IRET_STI };
#define CB_MAX 1024
#define CB_MAX 144
#define CB_SEG 0xC800
#define CB_BASE (CB_SEG << 4)
@ -48,12 +52,37 @@ void CALLBACK_RunRealInt(Bit8u intnum);
void CALLBACK_RunRealFar(Bit16u seg,Bit16u off);
bool CALLBACK_Setup(Bitu callback,CallBack_Handler handler,Bitu type,const char* description=0);
bool CALLBACK_SetupAt(Bitu callback,CallBack_Handler handler,Bitu type,Bitu linearAddress, const char* description=0);
/* Returns with the size of the extra callback */
Bitu CALLBACK_SetupExtra(Bitu callback, Bitu type, PhysPt physAddress);
const char* CALLBACK_GetDescription(Bitu callback);
bool CALLBACK_Free(Bitu callback);
void CALLBACK_SCF(bool val);
void CALLBACK_SZF(bool val);
#endif
extern Bitu call_priv_io;
class CALLBACK_HandlerObject{
private:
bool installed;
Bit16u m_callback;
enum {NONE,SETUP,SETUPAT} m_type;
struct {
RealPt old_vector;
Bit8u interrupt;
bool installed;
} vectorhandler;
public:
CALLBACK_HandlerObject():installed(false),m_type(NONE){vectorhandler.installed=false;}
~CALLBACK_HandlerObject();
//Install and allocate a callback.
void Install(CallBack_Handler handler,Bitu type,const char* description=0);
//Only allocate a callback number
void Allocate(CallBack_Handler handler,const char* description=0);
Bit16u Get_callback(){return m_callback;}
RealPt Get_RealPointer(){ return RealMake(CB_SEG,m_callback << 4);}
void Set_RealVec(Bit8u vec);
};
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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,17 +16,24 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __CPU_H
#define __CPU_H
#ifndef DOSBOX_CPU_H
#define DOSBOX_CPU_H
#ifndef DOSBOX_DOSBOX_H
#include "dosbox.h"
#endif
#ifndef DOSBOX_REGS_H
#include "regs.h"
#endif
#ifndef DOSBOX_MEM_H
#include "mem.h"
#endif
/* CPU Cycle Timing */
extern Bits CPU_Cycles;
extern Bits CPU_CycleLeft;
extern Bits CPU_CycleMax;
extern bool CPU_CycleAuto;
/* Some common Defines */
/* A CPU Handler */
@ -43,8 +50,8 @@ Bits CPU_Core_Dyn_X86_Run(void);
extern Bit16u parity_lookup[256];
void CPU_LLDT(Bitu selector);
void CPU_LTR(Bitu selector);
bool CPU_LLDT(Bitu selector);
bool CPU_LTR(Bitu selector);
void CPU_LIDT(Bitu limit,Bitu base);
void CPU_LGDT(Bitu limit,Bitu base);
@ -57,8 +64,13 @@ 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);
void CPU_SET_CRX(Bitu cr,Bitu value);
bool CPU_WRITE_CRX(Bitu cr,Bitu value);
Bitu CPU_GET_CRX(Bitu cr);
bool CPU_READ_CRX(Bitu cr,Bit32u & retvalue);
bool CPU_WRITE_DRX(Bitu dr,Bitu value);
bool CPU_READ_DRX(Bitu dr,Bit32u & retvalue);
void CPU_SMSW(Bitu & word);
Bitu CPU_LMSW(Bitu word);
@ -85,6 +97,7 @@ void CPU_ENTER(bool use32,Bitu bytes,Bitu level);
#define CPU_INT_SOFTWARE 0x1
#define CPU_INT_EXCEPTION 0x2
#define CPU_INT_HAS_ERROR 0x4
#define CPU_INT_NOIOPLCHECK 0x8
void CPU_Interrupt(Bitu num,Bitu type,Bitu oldeip);
INLINE void CPU_HW_Interrupt(Bitu num) {
@ -93,6 +106,9 @@ INLINE void CPU_HW_Interrupt(Bitu num) {
INLINE void CPU_SW_Interrupt(Bitu num,Bitu oldeip) {
CPU_Interrupt(num,CPU_INT_SOFTWARE,oldeip);
}
INLINE void CPU_SW_Interrupt_NoIOPLCheck(Bitu num,Bitu oldeip) {
CPU_Interrupt(num,CPU_INT_SOFTWARE|CPU_INT_NOIOPLCHECK,oldeip);
}
bool CPU_PrepareException(Bitu which,Bitu error);
void CPU_Exception(Bitu which,Bitu error=0);
@ -108,18 +124,25 @@ void CPU_Push32(Bitu value);
void CPU_SetFlags(Bitu word,Bitu mask);
#define EXCEPTION_UD 6
#define EXCEPTION_TS 10
#define EXCEPTION_NP 11
#define EXCEPTION_SS 12
#define EXCEPTION_GP 13
#define CR0_PROTECTION 0x00000001
#define CR0_MONITORPROCESSOR 0x00000002
#define CR0_FPUEMULATION 0x00000004
#define CR0_TASKSWITCH 0x00000008
#define CR0_FPUPRESENT 0x00000010
#define CR0_PAGING 0x80000000
// *********************************************************************
// 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
@ -352,9 +375,16 @@ public:
return ldt_value;
}
bool LLDT(Bitu value) {
//TODO checking
if ((value&0xfffc)==0) {
ldt_value=0;
ldt_base=0;
ldt_limit=0;
return true;
}
Descriptor desc;
GetDescriptor(value,desc);
if (!GetDescriptor(value,desc)) return !CPU_PrepareException(EXCEPTION_GP,value);
if (desc.Type()!=DESC_LDT) return !CPU_PrepareException(EXCEPTION_GP,value);
if (!desc.saved.seg.p) return !CPU_PrepareException(EXCEPTION_NP,value);
ldt_base=desc.GetBase();
ldt_limit=desc.GetLimit();
ldt_value=value;
@ -402,6 +432,7 @@ struct CPUBlock {
Bitu which,error;
} exception;
Bits direction;
Bit32u drx[8];
};
extern CPUBlock cpu;
@ -418,4 +449,3 @@ INLINE void CPU_SetFlagsw(Bitu word) {
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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,10 +16,10 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: cross.h,v 1.11 2004/09/16 21:46:03 qbix79 Exp $ */
/* $Id: cross.h,v 1.16 2006/02/09 11:47:47 qbix79 Exp $ */
#ifndef _CROSS_H
#define _CROSS_H
#ifndef DOSBOX_CROSS_H
#define DOSBOX_CROSS_H
#include <stdio.h>
#include <sys/stat.h>
@ -40,7 +40,7 @@
#define CROSS_LEN 512 /* Maximum filename size */
#if defined (WIN32) /* Win 32 */
#if defined (WIN32) || defined (OS2) /* Win 32 & OS/2*/
#define CROSS_FILENAME(blah)
#define CROSS_FILESPLIT '\\'
#define F_OK 0
@ -57,4 +57,3 @@
#endif
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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
@ -20,7 +20,7 @@ void DEBUG_SetupConsole(void);
void DEBUG_DrawScreen(void);
bool DEBUG_Breakpoint(void);
bool DEBUG_IntBreakpoint(Bit8u intNum);
void DEBUG_Enable(void);
void DEBUG_Enable(bool pressed);
void DEBUG_CheckExecuteBreakpoint(Bit16u seg, Bit32u off);
bool DEBUG_ExitLoop(void);
void DEBUG_RefreshPage(char scroll);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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,10 +16,10 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: dma.h,v 1.12 2004/08/04 09:12:50 qbix79 Exp $ */
/* $Id: dma.h,v 1.16 2006/02/09 11:47:47 qbix79 Exp $ */
#ifndef __DMA_H
#define __DMA_H
#ifndef DOSBOX_DMA_H
#define DOSBOX_DMA_H
enum DMAEvent {
DMA_REACHED_TC,
@ -31,19 +31,6 @@ enum DMAEvent {
class DmaChannel;
typedef void (* DMA_CallBack)(DmaChannel * chan,DMAEvent event);
class DmaController {
public:
bool flipflop;
Bit8u ctrlnum;
Bit8u chanbase;
public:
DmaController(Bit8u num) {
flipflop = false;
ctrlnum = num;
chanbase = num * 4;
}
};
class DmaChannel {
public:
Bit32u pagebase;
@ -85,9 +72,37 @@ public:
Bitu Write(Bitu size, Bit8u * buffer);
};
extern DmaChannel *DmaChannels[8];
extern DmaController *DmaControllers[2];
class DmaController {
private:
Bit8u ctrlnum;
bool flipflop;
DmaChannel *DmaChannels[4];
public:
IO_ReadHandleObject DMA_ReadHandler[0x11];
IO_WriteHandleObject DMA_WriteHandler[0x11];
DmaController(Bit8u num) {
flipflop = false;
ctrlnum = num; /* first or second DMA controller */
for(Bit8u i=0;i<4;i++) {
DmaChannels[i] = new DmaChannel(i+ctrlnum*4,ctrlnum==1);
}
}
~DmaController(void) {
for(Bit8u i=0;i<4;i++) {
delete DmaChannels[i];
}
}
DmaChannel * GetChannel(Bit8u chan) {
if (chan<4) return DmaChannels[chan];
else return NULL;
}
void WriteControllerReg(Bitu reg,Bitu val,Bitu len);
Bitu ReadControllerReg(Bitu reg,Bitu len);
};
DmaChannel * GetDMAChannel(Bit8u chan);
void CloseSecondDMAController(void);
bool SecondDMAControllerAvailable(void);
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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,13 +16,17 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: dos_inc.h,v 1.51 2004/11/16 14:28:15 qbix79 Exp $ */
/* $Id: dos_inc.h,v 1.59 2006/02/09 11:47:47 qbix79 Exp $ */
#ifndef DOS_H_
#define DOS_H_
#ifndef DOSBOX_DOS_INC_H
#define DOSBOX_DOS_INC_H
#include <dos_system.h>
#include <mem.h>
#ifndef DOSBOX_DOS_SYSTEM_H
#include "dos_system.h"
#endif
#ifndef DOSBOX_MEM_H
#include "mem.h"
#endif
#ifdef _MSC_VER
#pragma pack (1)
@ -72,6 +76,15 @@ enum { RETURN_EXIT=0,RETURN_CTRLC=1,RETURN_ABORT=2,RETURN_TSR=3};
#define DOS_DRIVES 26
#define DOS_DEVICES 10
#define DOS_INFOBLOCK_SEG 0x80
#define DOS_CDS_SEG 0x90
#define DOS_CONSTRING_SEG 0xa0
#define DOS_CONDRV_SEG 0xa4
#define DOS_SDA_SEG 0xb2
#define DOS_SDA_OFS 0
#define DOS_MEM_START 0x102 //First Segment that DOS can use
/* internal Dos Tables */
extern DOS_File * Files[DOS_FILES];
@ -143,8 +156,10 @@ bool DOS_ResizeMemory(Bit16u segment,Bit16u * blocks);
bool DOS_FreeMemory(Bit16u segment);
void DOS_FreeProcessMemory(Bit16u pspseg);
Bit16u DOS_GetMemory(Bit16u pages);
void DOS_SetMemAllocStrategy(Bit16u strat);
bool DOS_SetMemAllocStrategy(Bit16u strat);
Bit16u DOS_GetMemAllocStrategy(void);
void DOS_BuildUMBChain(const char* use_umbs,bool ems_active);
bool DOS_LinkUMBsToMemChain(Bit16u linkstate);
/* FCB stuff */
bool DOS_FCBOpen(Bit16u seg,Bit16u offset);
@ -208,6 +223,7 @@ INLINE Bit16u DOS_PackDate(Bit16u year,Bit16u mon,Bit16u day) {
#define DOSERR_REMOVE_CURRENT_DIRECTORY 16
#define DOSERR_NOT_SAME_DEVICE 17
#define DOSERR_NO_MORE_FILES 18
#define DOSERR_FILE_ALREADY_EXISTS 80
/* Remains some classes used to access certain things */
@ -341,18 +357,24 @@ public:
DOS_InfoBlock () {};
void SetLocation(Bit16u seg);
void SetFirstMCB(Bit16u _first_mcb);
void SetfirstFileTable(RealPt _first_table);
void SetBuffers(Bit16u x,Bit16u y);
void SetCurDirStruct(Bit32u _curdirstruct);
void SetFCBTable(Bit32u _fcbtable);
void SetDeviceChainStart(Bit32u _devchain);
void SetDiskInfoBuffer(Bit32u _dinfobuf);
RealPt GetPointer (void);
void SetDiskBufferHeadPt(Bit32u _dbheadpt);
void SetStartOfUMBChain(Bit16u _umbstartseg);
void SetUMBChainState(Bit8u _umbchaining);
Bit16u GetStartOfUMBChain(void);
Bit8u GetUMBChainState(void);
RealPt GetPointer(void);
#ifdef _MSC_VER
#pragma pack(1)
#endif
struct sDIB {
Bit8u unknown1[4];
Bit16u magicWord; // -0x22 needs to be 1
Bit8u unknown2[8];
Bit16u regCXfrom5e; // -0x18 CX from last int21/ah=5e
Bit16u countLRUcache; // -0x16 LRU counter for FCB caching
Bit16u countLRUopens; // -0x14 LRU counter for FCB openings
@ -387,7 +409,17 @@ public:
Bit8u bootDrive; // 0x43 boot drive
Bit8u useDwordMov; // 0x44 use dword moves
Bit16u extendedSize; // 0x45 size of extended memory
// some more stuff, hopefully never used.
Bit32u diskBufferHeadPt; // 0x47 pointer to least-recently used buffer header
Bit16u dirtyDiskBuffers; // 0x4b number of dirty disk buffers
Bit32u lookaheadBufPt; // 0x4d pointer to lookahead buffer
Bit16u lookaheadBufNumber; // 0x51 number of lookahead buffers
Bit8u bufferLocation; // 0x53 workspace buffer location
Bit32u workspaceBuffer; // 0x54 pointer to workspace buffer
Bit8u unknown3[11]; // 0x58
Bit8u chainingUMB; // 0x63 bit0: UMB chain linked to MCB chain
Bit16u minMemForExec; // 0x64 minimum paragraphs needed for current program
Bit16u startOfUMBChain; // 0x66 segment of first UMB-MCB
Bit16u memAllocScanStart; // 0x68 start paragraph for memory allocation
} GCC_ATTRIBUTE(packed);
#ifdef _MSC_VER
#pragma pack ()
@ -506,11 +538,6 @@ private:
#endif
};
extern Bit16u sdaseg;
#define DOS_SDA_SEG sdaseg
#define DOS_SDA_OFS 0
class DOS_SDA : public MemStruct {
public:
DOS_SDA(Bit16u _seg,Bit16u _offs) { SetPt(_seg,_offs); }
@ -584,4 +611,3 @@ INLINE Bit8u RealHandle(Bit16u handle) {
}
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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,15 +16,19 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: dos_system.h,v 1.28 2004/11/13 12:08:42 qbix79 Exp $ */
/* $Id: dos_system.h,v 1.31 2006/02/09 11:47:47 qbix79 Exp $ */
#ifndef DOSBOX_DOS_SYSTEM_H
#define DOSBOX_DOS_SYSTEM_H
#ifndef DOSSYSTEM_H_
#define DOSSYSTEM_H_
#include <string.h>
#include <vector>
#ifndef DOSBOX_DOSBOX_H
#include "dosbox.h"
#endif
#ifndef DOSBOX_CROSS_H
#include "cross.h"
#endif
#define DOS_NAMELENGTH 12
#define DOS_NAMELENGTH_ASCII (DOS_NAMELENGTH+1)
@ -247,7 +251,8 @@ public:
char * GetInfo(void);
char curdir[DOS_PATHLENGTH];
char info[256];
/* Can be overridden for example in iso images */
virtual char const * GetLabel(){return dirCache.GetLabel();};
DOS_Drive_Cache dirCache;
};
@ -262,8 +267,12 @@ enum { DOS_SEEK_SET=0,DOS_SEEK_CUR=1,DOS_SEEK_END=2};
typedef bool (MultiplexHandler)(void);
void DOS_AddMultiplexHandler(MultiplexHandler * handler);
void DOS_DelMultiplexHandler(MultiplexHandler * handler);
/* AddDevice stores the pointer to a created device */
void DOS_AddDevice(DOS_Device * adddev);
/* DelDevice destroys the device that is pointed to. */
void DOS_DelDevice(DOS_Device * dev);
void VFILE_Register(const char * name,Bit8u * data,Bit32u size);
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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,16 +16,15 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#if !defined __DOSBOX_H
#define __DOSBOX_H
#ifndef DOSBOX_DOSBOX_H
#define DOSBOX_DOSBOX_H
#include "config.h"
void E_Exit(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
#include <stddef.h>
#include "config.h"
const char* MSG_Get(char const *); //get messages from the internal langaugafile
class Section;
@ -44,15 +43,24 @@ enum MachineType {
MCH_HERC,
MCH_CGA,
MCH_TANDY,
MCH_PCJR,
MCH_VGA
};
enum SVGACards {
SVGA_None,
SVGA_S3Trio
};
extern SVGACards svgaCard;
extern MachineType machine;
extern bool SDLNetInited;
#ifndef __LOGGING_H_
#define IS_TANDY_ARCH ((machine==MCH_TANDY) || (machine==MCH_PCJR))
#define TANDY_ARCH_CASE MCH_TANDY: case MCH_PCJR
#ifndef DOSBOX_LOGGING_H
#include "logging.h"
#endif // the logging system.
#endif /* __DOSBOX_H */
#endif /* DOSBOX_DOSBOX_H */

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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,10 +16,12 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __FPU_H
#define __FPU_H
#ifndef DOSBOX_FPU_H
#define DOSBOX_FPU_H
#ifndef DOSBOX_MEM_H
#include "mem.h"
#endif
void FPU_ESC0_Normal(Bitu rm);
void FPU_ESC0_EA(Bitu func,PhysPt ea);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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,8 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _HARDWARE_H_
#define _HARDWARE_H_
#ifndef DOSBOX_HARDWARE_H
#define DOSBOX_HARDWARE_H
#include <stdio.h>
@ -25,13 +25,26 @@ class Section;
enum OPL_Mode {
OPL_none,OPL_cms,OPL_opl2,OPL_dualopl2,OPL_opl3
};
#define CAPTURE_WAVE 0x01
#define CAPTURE_OPL 0x02
#define CAPTURE_MIDI 0x04
#define CAPTURE_IMAGE 0x08
#define CAPTURE_VIDEO 0x10
extern Bitu CaptureState;
void OPL_Init(Section* sec,OPL_Mode mode);
void CMS_Init(Section* sec);
void OPL_ShutDown(Section* sec);
void CMS_ShutDown(Section* sec);
void OPL_Init(Section* sec,Bitu base,OPL_Mode mode,Bitu rate);
void CMS_Init(Section* sec,Bitu base,Bitu rate);
extern Bit8u adlib_commandreg;
FILE * OpenCaptureFile(const char * type,const char * ext);
void CAPTURE_AddWave(Bit32u freq, Bit32u len, Bit16s * data);
#define CAPTURE_FLAG_DBLW 0x1
#define CAPTURE_FLAG_DBLH 0x2
void CAPTURE_AddImage(Bitu width, Bitu height, Bitu bpp, Bitu pitch, Bitu flags, float fps, Bit8u * data, Bit8u * pal);
void CAPTURE_AddMidi(bool sysex, Bitu len, Bit8u * data);
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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,11 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: inout.h,v 1.9 2006/02/09 11:47:47 qbix79 Exp $ */
#ifndef DOSBOX_INOUT_H
#define DOSBOX_INOUT_H
#define IO_MAX (64*1024+3)
#define IO_MB 0x1
@ -32,28 +37,36 @@ extern IO_ReadHandler * io_readhandlers[3][IO_MAX];
void IO_RegisterReadHandler(Bitu port,IO_ReadHandler * handler,Bitu mask,Bitu range=1);
void IO_RegisterWriteHandler(Bitu port,IO_WriteHandler * handler,Bitu mask,Bitu range=1);
void IO_FreeReadHandler(Bitu port,Bitu mask,Bitu range=0);
void IO_FreeWriteHandler(Bitu port,Bitu mask,Bitu range=0);
void IO_FreeReadHandler(Bitu port,Bitu mask,Bitu range=1);
void IO_FreeWriteHandler(Bitu port,Bitu mask,Bitu range=1);
INLINE void IO_WriteB(Bitu port,Bitu val) {
io_writehandlers[0][port](port,val,1);
};
INLINE void IO_WriteW(Bitu port,Bitu val) {
io_writehandlers[1][port](port,val,2);
};
INLINE void IO_WriteD(Bitu port,Bitu val) {
io_writehandlers[2][port](port,val,4);
};
void IO_WriteB(Bitu port,Bitu val);
void IO_WriteW(Bitu port,Bitu val);
void IO_WriteD(Bitu port,Bitu val);
INLINE Bitu IO_ReadB(Bitu port) {
return io_readhandlers[0][port](port,1);
}
INLINE Bitu IO_ReadW(Bitu port) {
return io_readhandlers[1][port](port,2);
}
INLINE Bitu IO_ReadD(Bitu port) {
return io_readhandlers[2][port](port,4);
}
Bitu IO_ReadB(Bitu port);
Bitu IO_ReadW(Bitu port);
Bitu IO_ReadD(Bitu port);
/* Classes to manage the IO objects created by the various devices.
* The io objects will remove itself on destruction.*/
class IO_Base{
protected:
bool installed;
Bitu m_port, m_mask,m_range;
public:
IO_Base():installed(false){};
};
class IO_ReadHandleObject: private IO_Base{
public:
void Install(Bitu port,IO_ReadHandler * handler,Bitu mask,Bitu range=1);
~IO_ReadHandleObject();
};
class IO_WriteHandleObject: private IO_Base{
public:
void Install(Bitu port,IO_WriteHandler * handler,Bitu mask,Bitu range=1);
~IO_WriteHandleObject();
};
INLINE void IO_Write(Bitu port,Bit8u val) {
IO_WriteB(port,val);
@ -62,4 +75,4 @@ INLINE Bit8u IO_Read(Bitu port){
return IO_ReadB(port);
}
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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,8 +16,20 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _IPX_H_
#define _IPX_H_
/* $Id: ipx.h,v 1.9 2006/02/26 13:46:31 qbix79 Exp $ */
#ifndef DOSBOX_IPX_H
#define DOSBOX_IPX_H
// Uncomment this for a lot of debug messages:
//#define IPX_DEBUGMSG
#ifndef DOSBOX_DOSBOX_H
#include "dosbox.h"
#endif
#ifndef DOSBOX_MEM_H
#include "mem.h"
#endif
// In Use Flag codes
#define USEFLAG_AVAILABLE 0x00
@ -31,7 +43,6 @@
#define USEFLAG_LISTENING 0xfe
#define USEFLAG_SENDING 0xff
// Completion codes
#define COMP_SUCCESS 0x00
#define COMP_REMOTETERM 0xec
@ -52,7 +63,6 @@
// For Uint8 type
#include "SDL_net.h"
struct PackedIP {
Uint32 host;
Uint16 port;
@ -78,6 +88,48 @@ struct IPXHeader {
} dest, src;
} GCC_ATTRIBUTE(packed);
struct fragmentDescriptor {
Bit16u offset;
Bit16u segment;
Bit16u size;
};
#define IPXBUFFERSIZE 1424
class ECBClass {
public:
RealPt ECBAddr;
bool isInESRList;
ECBClass *prevECB;
ECBClass *nextECB;
Bit8u iuflag;
#ifdef IPX_DEBUGMSG
Bitu SerialNumber;
#endif
ECBClass(Bit16u segment, Bit16u offset);
Bit16u getSocket(void);
Bit8u getInUseFlag(void);
void setInUseFlag(Bit8u flagval);
void setCompletionFlag(Bit8u flagval);
Bit16u getFragCount(void);
void getFragDesc(Bit16u descNum, fragmentDescriptor *fragDesc);
RealPt getESRAddr(void);
void NotifyESR(void);
void setImmAddress(Bit8u *immAddr);
void getImmAddress(Bit8u* immAddr);
~ECBClass();
};
// The following routines may not be needed on all systems. On my build of SDL the IPaddress structure is 8 octects
// and therefore screws up my IPXheader structure since it needs to be packed.
@ -89,4 +141,3 @@ void PackIP(IPaddress ipAddr, PackedIP *ipPack);
#endif
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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,8 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _IPXSERVER_H_
#define _IPXSERVER_H_
#ifndef DOSBOX_IPXSERVER_H_
#define DOSBOX_IPXSERVER_H_
#if C_IPX
@ -33,7 +33,6 @@ struct packetBuffer {
};
#define SOCKETTABLESIZE 16
#define IPXBUFFERSIZE 1024
#define CONVIP(hostvar) hostvar & 0xff, (hostvar >> 8) & 0xff, (hostvar >> 16) & 0xff, (hostvar >> 24) & 0xff
#define CONVIPX(hostvar) hostvar[0], hostvar[1], hostvar[2], hostvar[3], hostvar[4], hostvar[5]
@ -47,4 +46,3 @@ Bit8u packetCRC(Bit8u *buffer, Bit16u bufSize);
#endif
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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,9 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: joystick.h,v 1.8 2006/02/09 11:47:48 qbix79 Exp $ */
#ifndef DOSBOX_JOYSTICK_H
#define DOSBOX_JOYSTICK_H
void JOYSTICK_Enable(Bitu which,bool enabled);
void JOYSTICK_Button(Bitu which,Bitu num,bool pressed);
@ -31,3 +34,14 @@ bool JOYSTICK_GetButton(Bitu which, Bitu num);
float JOYSTICK_GetMove_X(Bitu which);
float JOYSTICK_GetMove_Y(Bitu which);
enum JoystickType {
JOY_NONE,
JOY_2AXIS,
JOY_4AXIS,
JOY_FCS,
JOY_CH
};
extern JoystickType joytype;
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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,8 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _KEYBOARD_H_
#define _KEYBOARD_H_
#ifndef DOSBOX_KEYBOARD_H
#define DOSBOX_KEYBOARD_H
enum KBD_KEYS {
KBD_NONE,
@ -34,7 +34,7 @@ enum KBD_KEYS {
KBD_capslock,KBD_scrolllock,KBD_numlock,
KBD_grave,KBD_minus,KBD_equals,KBD_backslash,KBD_leftbracket,KBD_rightbracket,
KBD_semicolon,KBD_quote,KBD_period,KBD_comma,KBD_slash,
KBD_semicolon,KBD_quote,KBD_period,KBD_comma,KBD_slash,KBD_extra_lt_gt,
KBD_printscreen,KBD_pause,
KBD_insert,KBD_home,KBD_pageup,KBD_delete,KBD_end,KBD_pagedown,
@ -47,6 +47,7 @@ enum KBD_KEYS {
KBD_LAST
};
void KEYBOARD_ClrBuffer(void);
void KEYBOARD_AddKey(KBD_KEYS keytype,bool pressed);
#endif

View File

@ -1,5 +1,5 @@
#ifndef __LOGGING_H_
#define __LOGGING_H_
#ifndef DOSBOX_LOGGING_H
#define DOSBOX_LOGGING_H
enum LOG_TYPES {
LOG_ALL,
LOG_VGA, LOG_VGAGFX,LOG_VGAMISC,LOG_INT10,
@ -45,6 +45,8 @@ struct LOG
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, double f1, double f2, double f3, double f4) { return;}
void operator()(char const* buf, double f1, double f2, double f3, double f4, double f5) { return;}
void operator()(char const* buf, char const* s1) { return;}
void operator()(char const* buf, char const* s1, double f1) { return;}
@ -61,5 +63,4 @@ void GFX_ShowMsg(char * format,...);
#endif //C_DEBUG
#endif //__LOGGING_H_
#endif //DOSBOX_LOGGING_H

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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,8 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef MAPPER_H_
#define MAPPER_H_
#ifndef DOSBOX_MAPPER_H
#define DOSBOX_MAPPER_H
enum MapKeys {
MK_f1,MK_f2,MK_f3,MK_f4,MK_f5,MK_f6,MK_f7,MK_f8,MK_f9,MK_f10,MK_f11,MK_f12,
@ -25,13 +25,12 @@ enum MapKeys {
};
typedef void (MAPPER_Handler)(void);
typedef void (MAPPER_Handler)(bool pressed);
void MAPPER_AddHandler(MAPPER_Handler * handler,MapKeys key,Bitu mods,char * eventname,char * buttonname);
void MAPPER_Init(void);
void MAPPER_StartUp(Section * sec);
void MAPPER_Run(void);
void MAPPER_Run(bool pressed);
void MAPPER_LosingFocus(void);
#define MMOD1 0x1

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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,9 +16,12 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#if !defined __MEM_H
#define __MEM_H
#include <dosbox.h>
#ifndef DOSBOX_MEM_H
#define DOSBOX_MEM_H
#ifndef DOSBOX_DOSBOX_H
#include "dosbox.h"
#endif
typedef Bit32u PhysPt;
typedef Bit8u * HostPt;
@ -29,6 +32,7 @@ typedef Bit32s MemHandle;
#define MEM_PAGESIZE 4096
extern HostPt MemBase;
HostPt GetMemBase(void);
bool MEM_A20_Enabled(void);
void MEM_A20_Enable(bool enable);
@ -52,7 +56,7 @@ MemHandle MEM_NextHandleAt(MemHandle handle,Bitu where);
Working on big or little endian machines
*/
#ifdef WORDS_BIGENDIAN
#if defined(WORDS_BIGENDIAN) || !defined(C_UNALIGNED_MEMORY)
INLINE Bit8u host_readb(HostPt off) {
return off[0];
@ -77,10 +81,6 @@ INLINE void host_writed(HostPt off,Bit32u val) {
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 host_readb(HostPt off) {
@ -102,16 +102,20 @@ INLINE void host_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
#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_);
INLINE void var_write(Bit8u * var, Bit8u val) {
host_writeb((HostPt)var, val);
}
INLINE void var_write(Bit16u * var, Bit16u val) {
host_writew((HostPt)var, val);
}
INLINE void var_write(Bit32u * var, Bit32u val) {
host_writed((HostPt)var, val);
}
/* The Folowing six functions are slower but they recognize the paged memory system */
@ -199,7 +203,12 @@ INLINE RealPt RealMake(Bit16u seg,Bit16u off) {
INLINE void RealSetVec(Bit8u vec,RealPt pt) {
mem_writed(vec<<2,pt);
}
}
INLINE void RealSetVec(Bit8u vec,RealPt pt,RealPt &old) {
old = mem_readd(vec<<2);
mem_writed(vec<<2,pt);
}
INLINE RealPt RealGetVec(Bit8u vec) {
return mem_readd(vec<<2);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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,13 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef DOSBOX_MIXER_H
#define DOSBOX_MIXER_H
#ifndef DOSBOX_DOSBOX_H
#include "dosbox.h"
#endif
typedef void (*MIXER_MixHandler)(Bit8u * sampdate,Bit32u len);
typedef void (*MIXER_Handler)(Bitu len);
@ -65,9 +72,24 @@ public:
MixerChannel * MIXER_AddChannel(MIXER_Handler handler,Bitu freq,char * name);
MixerChannel * MIXER_FindChannel(const char * name);
/* Find the device you want to delete with findchannel "delchan gets deleted" */
void MIXER_DelChannel(MixerChannel* delchan);
/* Object to maintain a mixerchannel; As all objects it registers itself with create
* and removes itself when destroyed. */
class MixerObject{
private:
bool installed;
char m_name[32];
public:
MixerObject():installed(false){};
MixerChannel* Install(MIXER_Handler handler,Bitu freq,char * name);
~MixerObject();
};
/* PC Speakers functions, tightly related to the timer functions */
void PCSPEAKER_SetCounter(Bitu cntr,Bitu mode);
void PCSPEAKER_SetType(Bitu mode);
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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,18 +16,18 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: mouse.h,v 1.7 2004/08/04 09:12:51 qbix79 Exp $ */
/* $Id: mouse.h,v 1.12 2006/02/09 11:47:48 qbix79 Exp $ */
#ifndef _MOUSE_H_
#define _MOUSE_H_
#ifndef DOSBOX_MOUSE_H
#define DOSBOX_MOUSE_H
void Mouse_ShowCursor(void);
void Mouse_HideCursor(void);
void Mouse_SetPS2State(bool use);
bool Mouse_SetPS2State(bool use);
void Mouse_ChangePS2Callback(Bit16u pseg, Bit16u pofs);
void Mouse_CursorMoved(float x,float y);
void Mouse_CursorMoved(float xrel,float yrel,float x,float y,bool emulate);
void Mouse_CursorSet(float x,float y);
void Mouse_ButtonPressed(Bit8u button);
void Mouse_ButtonReleased(Bit8u button);
@ -35,5 +35,4 @@ void Mouse_ButtonReleased(Bit8u button);
void Mouse_AutoLock(bool enable);
void Mouse_NewVideoMode(void);
#endif
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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,13 +16,17 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: paging.h,v 1.12 2004/10/12 10:45:10 harekiet Exp $ */
/* $Id: paging.h,v 1.22 2006/02/09 11:47:48 qbix79 Exp $ */
#ifndef _PAGING_H_
#define _PAGING_H_
#ifndef DOSBOX_PAGING_H
#define DOSBOX_PAGING_H
#ifndef DOSBOX_DOSBOX_H
#include "dosbox.h"
#endif
#ifndef DOSBOX_MEM_H
#include "mem.h"
#endif
class PageDirectory;
@ -50,7 +54,14 @@ public:
virtual void writeb(PhysPt addr,Bitu val);
virtual void writew(PhysPt addr,Bitu val);
virtual void writed(PhysPt addr,Bitu val);
virtual HostPt GetHostPt(Bitu phys_page);
virtual HostPt GetHostReadPt(Bitu phys_page);
virtual HostPt GetHostWritePt(Bitu phys_page);
virtual bool readb_checked(PhysPt addr, Bitu * val);
virtual bool readw_checked(PhysPt addr, Bitu * val);
virtual bool readd_checked(PhysPt addr, Bitu * val);
virtual bool writeb_checked(PhysPt addr,Bitu val);
virtual bool writew_checked(PhysPt addr,Bitu val);
virtual bool writed_checked(PhysPt addr,Bitu val);
Bitu flags;
};
@ -69,8 +80,8 @@ void PAGING_UnlinkPages(Bitu lin_page,Bitu pages);
void PAGING_MapPage(Bitu lin_page,Bitu phys_page);
bool PAGING_MakePhysPage(Bitu & page);
void MEM_SetLFB(Bitu _page,Bitu _pages,HostPt _pt);
void MEM_SetPageHandler(Bitu phys_page,Bitu pages,PageHandler * handler);
void MEM_SetLFB( Bitu page, Bitu pages, PageHandler *handler);
void MEM_SetPageHandler(Bitu phys_page, Bitu pages, PageHandler * handler);
void MEM_ResetPageHandler(Bitu phys_page, Bitu pages);
@ -78,6 +89,19 @@ void MEM_ResetPageHandler(Bitu phys_page, Bitu pages);
#pragma pack (1)
#endif
struct X86_PageEntryBlock{
#ifdef WORDS_BIGENDIAN
Bit32u base:20;
Bit32u avl:3;
Bit32u g:1;
Bit32u pat:1;
Bit32u d:1;
Bit32u a:1;
Bit32u pcd:1;
Bit32u pwt:1;
Bit32u us:1;
Bit32u wr:1;
Bit32u p:1;
#else
Bit32u p:1;
Bit32u wr:1;
Bit32u us:1;
@ -89,6 +113,7 @@ struct X86_PageEntryBlock{
Bit32u g:1;
Bit32u avl:3;
Bit32u base:20;
#endif
} GCC_ATTRIBUTE(packed);
#ifdef _MSC_VER
#pragma pack ()
@ -117,7 +142,8 @@ struct PagingBlock {
Bitu used;
Bit32u entries[PAGING_LINKS];
} links;
bool enabled;
Bit32u firstmb[LINK_START];
bool enabled;
};
extern PagingBlock paging;
@ -126,12 +152,27 @@ extern PagingBlock paging;
PageHandler * MEM_GetPageHandler(Bitu phys_page);
/* Use this helper function to access linear addresses in readX/writeX functions */
INLINE PhysPt PAGING_GetPhysicalPage(PhysPt linePage) {
return (paging.tlb.phys_page[linePage>>12]<<12);
}
INLINE PhysPt PAGING_GetPhysicalAddress(PhysPt linAddr) {
return (paging.tlb.phys_page[linAddr>>12]<<12)|(linAddr&0xfff);
}
/* 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);
bool mem_unalignedreadw_checked_x86(PhysPt address,Bit16u * val);
bool mem_unalignedreadd_checked_x86(PhysPt address,Bit32u * val);
bool mem_unalignedwritew_checked_x86(PhysPt address,Bit16u val);
bool mem_unalignedwrited_checked_x86(PhysPt address,Bit32u val);
/* Special inlined memory reading/writing */
INLINE Bit8u mem_readb_inline(PhysPt address) {
@ -141,20 +182,21 @@ INLINE Bit8u mem_readb_inline(PhysPt address) {
}
INLINE Bit16u mem_readw_inline(PhysPt address) {
if (address & 1) return mem_unalignedreadw(address);
if (!(address & 1)) {
Bitu index=(address>>12);
Bitu index=(address>>12);
if (paging.tlb.read[index]) return host_readw(paging.tlb.read[index]+address);
else return paging.tlb.handler[index]->readw(address);
if (paging.tlb.read[index]) return host_readw(paging.tlb.read[index]+address);
else return paging.tlb.handler[index]->readw(address);
} else return mem_unalignedreadw(address);
}
INLINE Bit32u mem_readd_inline(PhysPt address) {
if (address & 3) return mem_unalignedreadd(address);
if (!(address & 3)) {
Bitu index=(address>>12);
Bitu index=(address>>12);
if (paging.tlb.read[index]) return host_readd(paging.tlb.read[index]+address);
else return paging.tlb.handler[index]->readd(address);
if (paging.tlb.read[index]) return host_readd(paging.tlb.read[index]+address);
else return paging.tlb.handler[index]->readd(address);
} else return mem_unalignedreadd(address);
}
INLINE void mem_writeb_inline(PhysPt address,Bit8u val) {
@ -165,21 +207,135 @@ INLINE void mem_writeb_inline(PhysPt address,Bit8u val) {
}
INLINE void mem_writew_inline(PhysPt address,Bit16u val) {
if (address & 1) {mem_unalignedwritew(address,val);return;}
if (!(address & 1)) {
Bitu index=(address>>12);
Bitu index=(address>>12);
if (paging.tlb.write[index]) host_writew(paging.tlb.write[index]+address,val);
else paging.tlb.handler[index]->writew(address,val);
if (paging.tlb.write[index]) host_writew(paging.tlb.write[index]+address,val);
else paging.tlb.handler[index]->writew(address,val);
} else mem_unalignedwritew(address,val);
}
INLINE void mem_writed_inline(PhysPt address,Bit32u val) {
if (address & 3) {mem_unalignedwrited(address,val);return;}
Bitu index=(address>>12);
if (paging.tlb.write[index]) host_writed(paging.tlb.write[index]+address,val);
else paging.tlb.handler[index]->writed(address,val);
if (!(address & 3)) {
Bitu index=(address>>12);
if (paging.tlb.write[index]) host_writed(paging.tlb.write[index]+address,val);
else paging.tlb.handler[index]->writed(address,val);
} else mem_unalignedwrited(address,val);
}
INLINE Bit16u mem_readw_dyncorex86(PhysPt address) {
if ((address & 0xfff)<0xfff) {
Bitu index=(address>>12);
if (paging.tlb.read[index]) return host_readw(paging.tlb.read[index]+address);
else return paging.tlb.handler[index]->readw(address);
} else return mem_unalignedreadw(address);
}
INLINE Bit32u mem_readd_dyncorex86(PhysPt address) {
if ((address & 0xfff)<0xffd) {
Bitu index=(address>>12);
if (paging.tlb.read[index]) return host_readd(paging.tlb.read[index]+address);
else return paging.tlb.handler[index]->readd(address);
} else return mem_unalignedreadd(address);
}
INLINE void mem_writew_dyncorex86(PhysPt address,Bit16u val) {
if ((address & 0xfff)<0xfff) {
Bitu index=(address>>12);
if (paging.tlb.write[index]) host_writew(paging.tlb.write[index]+address,val);
else paging.tlb.handler[index]->writew(address,val);
} else mem_unalignedwritew(address,val);
}
INLINE void mem_writed_dyncorex86(PhysPt address,Bit32u val) {
if ((address & 0xfff)<0xffd) {
Bitu index=(address>>12);
if (paging.tlb.write[index]) host_writed(paging.tlb.write[index]+address,val);
else paging.tlb.handler[index]->writed(address,val);
} else mem_unalignedwrited(address,val);
}
INLINE bool mem_readb_checked_x86(PhysPt address, Bit8u * val) {
Bitu index=(address>>12);
if (paging.tlb.read[index]) {
*val=host_readb(paging.tlb.read[index]+address);
return false;
} else {
Bitu uval;
bool retval;
retval=paging.tlb.handler[index]->readb_checked(address, &uval);
*val=(Bit8u)uval;
return retval;
}
}
INLINE bool mem_readw_checked_x86(PhysPt address, Bit16u * val) {
if ((address & 0xfff)<0xfff) {
Bitu index=(address>>12);
if (paging.tlb.read[index]) {
*val=host_readw(paging.tlb.read[index]+address);
return false;
} else {
Bitu uval;
bool retval;
retval=paging.tlb.handler[index]->readw_checked(address, &uval);
*val=(Bit16u)uval;
return retval;
}
} else return mem_unalignedreadw_checked_x86(address, val);
}
INLINE bool mem_readd_checked_x86(PhysPt address, Bit32u * val) {
if ((address & 0xfff)<0xffd) {
Bitu index=(address>>12);
if (paging.tlb.read[index]) {
*val=host_readd(paging.tlb.read[index]+address);
return false;
} else {
Bitu uval;
bool retval;
retval=paging.tlb.handler[index]->readd_checked(address, &uval);
*val=(Bit32u)uval;
return retval;
}
} else return mem_unalignedreadd_checked_x86(address, val);
}
INLINE bool mem_writeb_checked_x86(PhysPt address,Bit8u val) {
Bitu index=(address>>12);
if (paging.tlb.write[index]) {
host_writeb(paging.tlb.write[index]+address,val);
return false;
} else return paging.tlb.handler[index]->writeb_checked(address,val);
}
INLINE bool mem_writew_checked_x86(PhysPt address,Bit16u val) {
if ((address & 0xfff)<0xfff) {
Bitu index=(address>>12);
if (paging.tlb.write[index]) {
host_writew(paging.tlb.write[index]+address,val);
return false;
} else return paging.tlb.handler[index]->writew_checked(address,val);
} else return mem_unalignedwritew_checked_x86(address,val);
}
INLINE bool mem_writed_checked_x86(PhysPt address,Bit32u val) {
if ((address & 0xfff)<0xffd) {
Bitu index=(address>>12);
if (paging.tlb.write[index]) {
host_writed(paging.tlb.write[index]+address,val);
return false;
} else return paging.tlb.handler[index]->writed_checked(address,val);
} else return mem_unalignedwrited_checked_x86(address,val);
}
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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,8 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __PIC_H
#define __PIC_H
#ifndef DOSBOX_PIC_H
#define DOSBOX_PIC_H
/* CPU Cycle Timing */
@ -60,4 +60,3 @@ void PIC_RemoveEvents(PIC_EventHandler handler);
void PIC_SetIRQMask(Bitu irq, bool masked);
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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,19 +16,20 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __PROGRAM_H
#define __PROGRAM_H
#ifndef DOSBOX_PROGRAMS_H
#define DOSBOX_PROGRAMS_H
#ifndef DOSBOX_DOSBOX_H
#include "dosbox.h"
#endif
#ifndef DOSBOX_DOS_INC_H
#include "dos_inc.h"
#endif
#ifndef DOSBOX_SETUP_H
#include "setup.h"
#endif
class Program;
typedef void (PROGRAMS_Main)(Program * * make);
void PROGRAMS_MakeFile(char * name,PROGRAMS_Main * main);
class Program {
public:
Program();
@ -40,20 +41,15 @@ public:
CommandLine * cmd;
DOS_PSP * psp;
virtual void Run(void)=0;
bool Program::GetEnvStr(const char * entry,std::string & result);
bool GetEnvStr(const char * entry,std::string & result);
bool GetEnvNum(Bitu num,std::string & result);
Bitu GetEnvCount(void);
bool SetEnv(const char * entry,const char * new_string);
void WriteOut(const char * format,...); /* Write to standard output */
void WriteOut(const char * format,...); /* Write to standard output */
};
void SHELL_AddAutoexec(char * line,...);
typedef void (PROGRAMS_Main)(Program * * make);
void PROGRAMS_MakeFile(char * name,PROGRAMS_Main * main);
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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,10 +16,12 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#if !defined __REGS_H
#define __REGS_H
#ifndef DOSBOX_REGS_H
#define DOSBOX_REGS_H
#include <mem.h>
#ifndef DOSBOX_MEM_H
#include "mem.h"
#endif
#define FLAG_CF 0x00000001
#define FLAG_PF 0x00000004
@ -165,4 +167,3 @@ enum {
#define reg_flags cpu_regs.flags
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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,17 +16,69 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __RENDER_H
#define __RENDER_H
#ifndef DOSBOX_RENDER_H
#define DOSBOX_RENDER_H
typedef void (* RENDER_Line_Handler)(const Bit8u * src);
#include "../src/gui/render_scalers.h"
void RENDER_SetSize(Bitu width,Bitu height,Bitu bpp,double ratio,bool dblw,bool dblh);
typedef struct {
struct {
Bit8u red;
Bit8u green;
Bit8u blue;
Bit8u unused;
} rgb[256];
union {
Bit16u b16[256];
Bit32u b32[256];
} lut;
bool changed;
Bit8u modified[256];
Bitu first;
Bitu last;
} RenderPal_t;
typedef struct {
struct {
Bitu width;
Bitu height;
Bitu bpp;
bool dblw,dblh;
double ratio;
float fps;
} src;
struct {
Bitu count;
Bitu max;
} frameskip;
struct {
Bitu size;
scalerMode_t inMode;
scalerMode_t outMode;
scalerOperation_t op;
bool clearCache;
ScalerLineHandler_t lineHandler;
ScalerLineHandler_t linePalHandler;
ScalerComplexHandler_t complexHandler;
Bitu blocks, lastBlock;
Bitu outPitch;
Bit8u *outWrite;
Bitu cachePitch;
Bit8u *cacheRead;
Bitu inHeight, inLine, outLine;
} scale;
RenderPal_t pal;
bool updating;
bool active;
bool aspect;
} Render_t;
extern Render_t render;
extern ScalerLineHandler_t RENDER_DrawLine;
void RENDER_SetSize(Bitu width,Bitu height,Bitu bpp,float fps,double ratio,bool dblw,bool dblh);
bool RENDER_StartUpdate(void);
void RENDER_EndUpdate(void);
void RENDER_EndUpdate( bool fullUpdate );
void RENDER_SetPal(Bit8u entry,Bit8u red,Bit8u green,Bit8u blue);
extern RENDER_Line_Handler RENDER_DrawLine;
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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,140 +16,284 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#if !defined __SERIALPORT_H
#define __SERIALPORT_H
/* $Id: serialport.h,v 1.12 2006/02/09 11:47:48 qbix79 Exp $ */
#include <assert.h>
#ifndef DOSBOX_SERIALPORT_H
#define DOSBOX_SERIALPORT_H
#include "dosbox.h"
// Uncomment this for a lot of debug messages:
// #define SERIALPORT_DEBUGMSG
#ifndef DOSBOX_DOSBOX_H
#include "dosbox.h"
#endif
#ifndef DOSBOX_INOUT_H
#include "inout.h"
#endif
#ifndef DOSBOX_TIMER_H
#include "timer.h"
#endif
//If it's too high you overflow terminal clients buffers i think
#define QUEUE_SIZE 1024
// Serial port interface //
#define MS_CTS 0x01
#define MS_DSR 0x02
#define MS_RI 0x04
#define MS_DCD 0x08
#define MC_DTR 0x1
#define MC_RTS 0x2
class CFifo {
public:
CFifo(Bitu _size) {
size=_size;
pos=used=0;
data=new Bit8u[size];
}
~CFifo() {
delete[] data;
}
INLINE Bitu left(void) {
return size-used;
}
INLINE Bitu inuse(void) {
return used;
}
void clear(void) {
used=pos=0;
}
bool isFull() {
return (used >= size);
}
void addb(Bit8u _val) {
assert(used<size);
Bitu where=pos+used;
if (where>=size) where-=size;
data[where]=_val;
used++;
}
void adds(Bit8u * _str,Bitu _len) {
assert((used+_len)<=size);
Bitu where=pos+used;
used+=_len;
while (_len--) {
if (where>=size) where-=size;
data[where++]=*_str++;
}
}
Bit8u getb(void) {
if (!used) return data[pos];
Bitu where=pos;
if (++pos>=size) pos-=size;
used--;
return data[where];
}
void gets(Bit8u * _str,Bitu _len) {
assert(used>=_len);
used-=_len;
while (_len--) {
*_str++=data[pos];
if (++pos>=size) pos-=size;
}
}
private:
Bit8u * data;
Bitu size,pos,used;
};
class CSerial {
public:
CSerial() {
}
// Constructor takes base port (0x3f0, 0x2f0, 0x2e0, etc.), IRQ, and initial bps //
CSerial (Bit16u initbase, Bit8u initirq, Bit32u initbps);
// Constructor takes base port (0x3f8, 0x2f8, 0x2e8, etc.), IRQ, and initial bps //
CSerial(IO_ReadHandler* rh, IO_WriteHandler* wh,
TIMER_TickHandler TimerHandler,
Bit16u initbase, Bit8u initirq, Bit32u initbps,
Bit8u bytesize, const char* parity, Bit8u stopbits);
TIMER_TickHandler TimerHnd;
virtual ~CSerial();
void InstallTimerHandler(TIMER_TickHandler);
IO_ReadHandleObject ReadHandler[8];
IO_WriteHandleObject WriteHandler[8];
void write_reg(Bitu reg, Bitu val);
Bitu read_reg(Bitu reg);
void SetModemStatus(Bit8u status);
virtual bool CanRecv(void)=0;
virtual bool CanSend(void)=0;
virtual void Send(Bit8u val)=0;
virtual Bit8u Recv(Bit8u val)=0;
virtual void Timer(void);
void checkint(void);
void Timer(void);
virtual void Timer2(void)=0;
Bitu base;
Bitu irq;
Bitu bps;
Bit8u mctrl;
bool getDTR();
bool getRTS();
CFifo *rqueue;
CFifo *tqueue;
bool getRI();
bool getCD();
bool getDSR();
bool getCTS();
void setRI(bool value);
void setDSR(bool value);
void setCD(bool value);
void setCTS(bool value);
void Write_THR(Bit8u data);
Bitu Read_RHR();
Bitu Read_IER();
void Write_IER(Bit8u data);
Bitu Read_ISR();
Bitu Read_LCR();
void Write_LCR(Bit8u data);
Bitu Read_MCR();
void Write_MCR(Bit8u data);
Bitu Read_LSR();
// Really old hardware seems to have the delta part of this register writable
void Write_MSR(Bit8u data);
Bitu Read_MSR();
Bitu Read_SPR();
void Write_SPR(Bit8u data);
void Write_reserved(Bit8u data, Bit8u address);
// If a byte comes from wherever(loopback or real port or maybe
// that softmodem thingy), put it in here.
void receiveByte(Bit8u data);
// If an error was received, put it here (in LSR register format)
void receiveError(Bit8u errorword);
// connected device checks, if port can receive data:
bool CanReceiveByte();
// When done sending, notify here
void ByteTransmitted();
// Virtual app has read the received data
virtual void RXBufferEmpty()=0;
// real transmit
virtual void transmitByte(Bit8u val)=0;
// switch break state to the passed value
virtual void setBreak(bool value)=0;
// set output lines
virtual void updateModemControlLines(/*Bit8u mcr*/)=0;
// change baudrate, number of bits, parity, word length al at once
virtual void updatePortConfig(Bit8u dll, Bit8u dlm, Bit8u lcr)=0;
// CSerial requests an update of the input lines
virtual void updateMSR()=0;
// after update request, or some "real" changes,
// modify MSR here
void changeMSR(Bit8u data); // make public
void Init_Registers(Bit32u initbps,
Bit8u bytesize, const char* parity, Bit8u stopbits);
private:
void UpdateBaudrate(void);
bool FIFOenabled;
Bit8u FIFOsize;
bool dotxint;
Bit8u scratch;
Bit8u dlab;
Bit8u divisor_lsb;
Bit8u divisor_msb;
Bit8u local_loopback;
Bit8u iir;
Bit8u ier;
Bit8u mstatus;
Bit8u linectrl;
Bit8u errors;
// I used this spec: http://www.exar.com/products/st16c450v420.pdf
void changeMSR_Loopback(Bit8u data);
void WriteRealIER(Bit8u data);
// reason for an interrupt has occured - functions triggers interrupt
// if it is enabled and no higher-priority irq pending
void rise(Bit8u priority);
// clears the pending interrupt
void clear(Bit8u priority);
#define ERROR_PRIORITY 4 // overrun, parity error, frame error, break
#define RX_PRIORITY 1 // a byte has been received
#define TX_PRIORITY 2 // tx buffer has become empty
#define MSR_PRIORITY 8 // CRS, DSR, RI, DCD change
#define NONE_PRIORITY 0
Bit8u pending_interrupts; // stores triggered interupts
Bit8u current_priority;
Bit8u waiting_interrupts; // these are on, but maybe not enabled
// 16C450 (no FIFO)
// read/write name
Bit8u DLL; // r Baudrate divider low byte
Bit8u DLM; // r "" high byte
Bit8u RHR; // r Receive Holding Register, also LSB of Divisor Latch (r/w)
#define RHR_OFFSET 0
// Data: whole byte
Bit8u THR; // w Transmit Holding Register
#define THR_OFFSET 0
// Data: whole byte
Bit8u IER; // r/w Interrupt Enable Register, also MSB of Divisor Latch (r/w)
#define IER_OFFSET 1
// Data:
// bit0 receive holding register
// bit1 transmit holding register
// bit2 receive line status interrupt
// bit3 modem status interrupt
#define RHR_INT_Enable_MASK 0x1
#define THR_INT_Enable_MASK 0x2
#define Receive_Line_INT_Enable_MASK 0x4
#define Modem_Status_INT_Enable_MASK 0x8
Bit8u ISR; // r Interrupt Status Register
#define ISR_OFFSET 2
#define ISR_CLEAR_VAL 0x1
#define ISR_ERROR_VAL 0x6
#define ISR_RX_VAL 0x4
#define ISR_TX_VAL 0x2
#define ISR_MSR_VAL 0x0
public:
Bit8u LCR; // r/w Line Control Register
private:
#define LCR_OFFSET 3
// bit0: word length bit0
// bit1: word length bit1
// bit2: stop bits
// bit3: parity enable
// bit4: even parity
// bit5: set parity
// bit6: set break
// bit7: divisor latch enable
#define LCR_BREAK_MASK 0x40
#define LCR_DIVISOR_Enable_MASK 0x80
#define LCR_PORTCONFIG_MASK 0x3F
#define LCR_PARITY_NONE 0x0
#define LCR_PARITY_ODD 0x8
#define LCR_PARITY_EVEN 0x18
#define LCR_PARITY_MARK 0x28
#define LCR_PARITY_SPACE 0x38
#define LCR_DATABITS_5 0x0
#define LCR_DATABITS_6 0x1
#define LCR_DATABITS_7 0x2
#define LCR_DATABITS_8 0x3
#define LCR_STOPBITS_1 0x0
#define LCR_STOPBITS_MORE_THAN_1 0x4
Bit8u MCR; // r/w Modem Control Register
#define MCR_OFFSET 4
// bit0: DTR
// bit1: RTS
// bit2: OP1
// bit3: OP2
// bit4: loop back enable
#define MCR_LOOPBACK_Enable_MASK 0x10
#define MCR_LEVELS_MASK 0xf
#define MCR_DTR_MASK 0x1
#define MCR_RTS_MASK 0x2
#define MCR_OP1_MASK 0x4
#define MCR_OP2_MASK 0x8
Bit8u LSR; // r Line Status Register
#define LSR_OFFSET 5
#define LSR_RX_DATA_READY_MASK 0x1
#define LSR_OVERRUN_ERROR_MASK 0x2
#define LSR_PARITY_ERROR_MASK 0x4
#define LSR_FRAMING_ERROR_MASK 0x8
#define LSR_RX_BREAK_MASK 0x10
#define LSR_TX_HOLDING_EMPTY_MASK 0x20
#define LSR_TX_EMPTY_MASK 0x40
#define LSR_ERROR_MASK 0x1e
Bit8u MSR; // r Modem Status Register
#define MSR_OFFSET 6
// bit0: deltaCTS
// bit1: deltaDSR
// bit2: deltaRI
// bit3: deltaCD
// bit4: CTS
// bit5: DSR
// bit6: RI
// bit7: CD
#define MSR_delta_MASK 0xf
#define MSR_LINE_MASK 0xf0
#define MSR_dCTS_MASK 0x1
#define MSR_dDSR_MASK 0x2
#define MSR_dRI_MASK 0x4
#define MSR_dCD_MASK 0x8
#define MSR_CTS_MASK 0x10
#define MSR_DSR_MASK 0x20
#define MSR_RI_MASK 0x40
#define MSR_CD_MASK 0x80
Bit8u SPR; // r/w Scratchpad Register
#define SPR_OFFSET 7
// For loopback purposes...
bool loopback_pending;
Bit8u loopback_data;
void transmitLoopbackByte(Bit8u val);
// 16C550 (FIFO)
// TODO
//Bit8u FCR; // FIFO Control Register
};
#include <list>
typedef std::list<CSerial *> CSerialList;
typedef std::list<CSerial *>::iterator CSerial_it;
extern CSerialList seriallist;
#define COM1_BASE 0x3f8
#define COM2_BASE 0x2f8
#define COM3_BASE 0x3e8
#define COM4_BASE 0x2e8
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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,16 +16,18 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: setup.h,v 1.16 2004/08/04 09:12:51 qbix79 Exp $ */
/* $Id: setup.h,v 1.22 2006/02/09 11:47:48 qbix79 Exp $ */
#ifndef _SETUP_H_
#define _SETUP_H_
#ifndef DOSBOX_SETUP_H
#define DOSBOX_SETUP_H
#ifdef _MSC_VER
#pragma warning ( disable : 4786 )
#endif
#ifndef DOSBOX_CROSS_H
#include "cross.h"
#endif
#include <string>
#include <list>
@ -34,7 +36,7 @@ public:
CommandLine(int argc,char * argv[]);
CommandLine(char * name,char * cmdline);
const char * GetFileName(){ return file_name.c_str();}
bool FindExist(char * name,bool remove=false);
bool FindHex(char * name,int & value,bool remove=false);
bool FindInt(char * name,int & value,bool remove=false);
@ -42,6 +44,7 @@ public:
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);
bool GetStringRemain(std::string & value);
unsigned int GetCount(void);
private:
typedef std::list<std::string>::iterator cmd_it;
@ -63,16 +66,16 @@ public:
Property(const char* _propname):propname(_propname) { }
virtual void SetValue(char* input)=0;
virtual void GetValuestring(char* str)=0;
Value GetValue() { return __value;}
std::string propname;
Value __value;
Value GetValue() { return value;}
virtual ~Property(){ }
std::string propname;
Value value;
};
class Prop_int:public Property {
public:
Prop_int(const char* _propname, int _value):Property(_propname) {
__value._int=_value;
value._int=_value;
}
void SetValue(char* input);
void GetValuestring(char* str);
@ -81,7 +84,7 @@ public:
class Prop_float:public Property {
public:
Prop_float(const char* _propname, float _value):Property(_propname){
__value._float=_value;
value._float=_value;
}
void SetValue(char* input);
void GetValuestring(char* str);
@ -91,7 +94,7 @@ public:
class Prop_bool:public Property {
public:
Prop_bool(const char* _propname, bool _value):Property(_propname) {
__value._bool=_value;
value._bool=_value;
}
void SetValue(char* input);
void GetValuestring(char* str);
@ -101,10 +104,10 @@ public:
class Prop_string:public Property{
public:
Prop_string(const char* _propname, char* _value):Property(_propname) {
__value._string=new std::string(_value);
value._string=new std::string(_value);
}
~Prop_string(){
delete __value._string;
delete value._string;
}
void SetValue(char* input);
void GetValuestring(char* str);
@ -112,45 +115,51 @@ public:
class Prop_hex:public Property {
public:
Prop_hex(const char* _propname, int _value):Property(_propname) {
__value._hex=_value;
value._hex=_value;
}
void SetValue(char* input);
~Prop_hex(){ }
void GetValuestring(char* str);
void GetValuestring(char* str);
};
class Section {
public:
Section(const char* _sectionname) { sectionname=_sectionname; }
virtual ~Section(){ ExecuteDestroy();}
private:
typedef void (*SectionFunction)(Section*);
void AddInitFunction(SectionFunction func) {initfunctions.push_back(func);}
void AddDestroyFunction(SectionFunction func) {destroyfunctions.push_front(func);}
void ExecuteInit() {
typedef std::list<SectionFunction>::iterator func_it;
for (func_it tel=initfunctions.begin(); tel!=initfunctions.end(); tel++){
(*tel)(this);
/* Wrapper class around startup and shutdown functions. the variable
* canchange indicates it can be called on configuration changes */
struct Function_wrapper {
SectionFunction function;
bool canchange;
Function_wrapper(SectionFunction _fun,bool _ch){
function=_fun;
canchange=_ch;
}
}
void ExecuteDestroy() {
typedef std::list<SectionFunction>::iterator func_it;
for (func_it tel=destroyfunctions.begin(); tel!=destroyfunctions.end(); tel++){
(*tel)(this);
}
}
std::list<SectionFunction> initfunctions;
std::list<SectionFunction> destroyfunctions;
virtual void HandleInputline(char * _line){}
virtual void PrintData(FILE* outfile) {}
std::string sectionname;
};
std::list<Function_wrapper> initfunctions;
std::list<Function_wrapper> destroyfunctions;
std::string sectionname;
public:
Section(const char* _sectionname):sectionname(_sectionname) { }
void AddInitFunction(SectionFunction func,bool canchange=false) {initfunctions.push_back(Function_wrapper(func,canchange));}
void AddDestroyFunction(SectionFunction func,bool canchange=false) {destroyfunctions.push_front(Function_wrapper(func,canchange));}
void ExecuteInit(bool initall=true);
void ExecuteDestroy(bool destroyall=true);
const char* GetName() {return sectionname.c_str();}
virtual char* GetPropValue(const char* _property)=0;
virtual void HandleInputline(char * _line)=0;
virtual void PrintData(FILE* outfile)=0;
virtual ~Section() { /*Children must call executedestroy ! */}
};
class Section_prop:public Section {
public:
private:
std::list<Property*> properties;
typedef std::list<Property*>::iterator it;
public:
Section_prop(const char* _sectionname):Section(_sectionname){}
void Add_int(const char* _propname, int _value=0);
void Add_string(const char* _propname, char* _value=NULL);
void Add_bool(const char* _propname, bool _value=false);
@ -164,30 +173,38 @@ class Section_prop:public Section {
float Get_float(const char* _propname);
void HandleInputline(char *gegevens);
void PrintData(FILE* outfile);
std::list<Property*> properties;
typedef std::list<Property*>::iterator it;
virtual char* GetPropValue(const char* _property);
//ExecuteDestroy should be here else the destroy functions use destroyed properties
virtual ~Section_prop();
};
class Section_line: public Section{
public:
Section_line(const char* _sectionname):Section(_sectionname){}
~Section_line(){ExecuteDestroy(true);}
void HandleInputline(char* gegevens);
void PrintData(FILE* outfile);
virtual char* GetPropValue(const char* _property);
std::string data;
};
class Config{
public:
CommandLine * cmdline;
private:
std::list<Section*> sectionlist;
typedef std::list<Section*>::iterator it;
typedef std::list<Section*>::reverse_iterator reverse_it;
void (* _start_function)(void);
public:
Config(CommandLine * cmd){ cmdline=cmd;}
~Config();
CommandLine * cmdline;
Section * AddSection(const char * _name,void (*_initfunction)(Section*));
Section_line * AddSection_line(const char * _name,void (*_initfunction)(Section*));
Section_prop * AddSection_prop(const char * _name,void (*_initfunction)(Section*));
Section_prop * AddSection_prop(const char * _name,void (*_initfunction)(Section*),bool canchange=false);
Section* GetSection(const char* _sectionname);
Section* GetSectionFromProperty(const char* prop);
void SetStartUp(void (*_function)(void));
void Init();
@ -196,12 +213,17 @@ public:
void PrintConfig(const char* configfilename);
bool ParseConfigFile(const char* configfilename);
void ParseEnv(char ** envp);
std::list<Section*> sectionlist;
typedef std::list<Section*>::iterator it;
typedef std::list<Section*>::reverse_iterator reverse_it;
private:
void (* _start_function)(void);
};
class Module_base {
/* Base for all hardware and software "devices" */
protected:
Section* m_configuration;
public:
Module_base(Section* configuration){m_configuration=configuration;};
// Module_base(Section* configuration, SaveState* state) {};
~Module_base(){/*LOG_MSG("executed")*/;};//Destructors are required
/* Returns true if succesful.*/
virtual bool Change_Config(Section* newconfig) {return false;} ;
};
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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,22 +16,18 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: shell.h,v 1.9 2004/11/13 12:06:39 qbix79 Exp $ */
#ifndef SHELL_H_
#define SHELL_H_
/* $Id: shell.h,v 1.15 2006/02/09 11:47:48 qbix79 Exp $ */
#ifndef DOSBOX_SHELL_H
#define DOSBOX_SHELL_H
#include <ctype.h>
#include <stdio.h>
#ifndef DOSBOX_DOSBOX_H
#include "dosbox.h"
#include "mem.h"
#endif
#ifndef DOSBOX_PROGRAMS_H
#include "programs.h"
#include "dos_inc.h"
#include "regs.h"
#include "support.h"
#include "callback.h"
#include "setup.h"
#endif
#include <string>
#include <list>
@ -40,6 +36,9 @@
#define CMD_MAXCMDS 20
#define CMD_OLDSIZE 4096
extern Bitu call_shellstop;
/* first_shell is used to add and delete stuff from the shell env
* by "external" programs. (config) */
extern Program * first_shell;
class DOS_Shell;
@ -75,7 +74,9 @@ public:
void InputCommand(char * line);
void ShowPrompt();
void DoCommand(char * cmd);
void Execute(char * name,char * args);
bool Execute(char * name,char * args);
/* Checks if it matches a hardware-property */
bool CheckConfig(char* cmd,char*line);
/* Some internal used functions */
char * Which(char * name);
/* Some supported commands */
@ -144,4 +145,20 @@ static inline char* ExpandDot(char*args, char* buffer) {
return buffer;
}
/* Object to manage lines in the autoexec.bat The lines get removed from
* the file if the object gets destroyed. The environment is updated
* as well if the line set a a variable */
class AutoexecObject{
private:
bool installed;
char buf[256];
public:
AutoexecObject():installed(false){};
void Install(char * line,...);
void InstallBefore(char* line, ...);
~AutoexecObject();
private:
void CreateAutoexec(void);
};
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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,13 +16,14 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#if !defined __SUPPORT_H
#define __SUPPORT_H
#ifndef DOSBOX_SUPPORT_H
#define DOSBOX_SUPPORT_H
#include <string.h>
#include <ctype.h>
#ifndef DOSBOX_DOSBOX_H
#include "dosbox.h"
#endif
#if defined (_MSC_VER) /* MS Visual C++ */
#define strcasecmp(a,b) stricmp(a,b)
@ -33,6 +34,8 @@
//#define nocasestrcmp(a,b) stricmp(a,b)
#endif
#define safe_strncpy(a,b,n) do { strncpy((a),(b),(n)-1); (a)[(n)-1] = 0; } while (0)
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
@ -62,4 +65,3 @@ INLINE char * lowcase(char * str) {
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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,8 +16,9 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _TIMER_H_
#define _TIMER_H_
#ifndef DOSBOX_TIMER_H
#define DOSBOX_TIMER_H
/* underlying clock rate in HZ */
#include <SDL.h>
@ -35,4 +36,3 @@ void TIMER_DelTickHandler(TIMER_TickHandler handler);
void TIMER_AddTick(void);
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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,23 +16,26 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef VGA_H_
#define VGA_H_
#ifndef DOSBOX_VGA_H
#define DOSBOX_VGA_H
#include <mem.h>
#ifndef DOSBOX_DOSBOX_H
#include "dosbox.h"
#endif
class PageHandler;
enum VGAModes {
M_CGA2,M_CGA4,
M_EGA16,
M_VGA,
M_LIN8,
M_CGA2, M_CGA4,
M_EGA, M_VGA,
M_LIN4, M_LIN8, M_LIN15, M_LIN16, M_LIN32,
M_TEXT,
M_HERC_GFX,M_HERC_TEXT,
M_CGA16,M_TANDY2,M_TANDY4,M_TANDY16,M_TANDY_TEXT,
M_HERC_GFX, M_HERC_TEXT,
M_CGA16, M_TANDY2, M_TANDY4, M_TANDY16, M_TANDY_TEXT,
M_ERROR,
};
#define CLK_25 25175
#define CLK_28 28322
@ -61,6 +64,7 @@ typedef struct {
/* Some other screen related variables */
Bitu line_compare;
bool chained; /* Enable or Disabled Chain 4 Mode */
bool compatible_chain4;
/* Pixel Scrolling */
Bit8u pel_panning; /* Amount of pixels to skip when starting horizontal line */
@ -84,7 +88,6 @@ typedef struct {
Bit32u full_not_enable_set_reset;
Bit32u full_enable_set_reset;
Bit32u full_enable_and_set_reset;
} VGA_Config;
typedef struct {
@ -194,6 +197,8 @@ typedef struct {
Bit8u gfx_control;
Bit8u palette_mask;
Bit8u border_color;
bool is_32k_mode;
bool pcjr_flipflop;
} VGA_TANDY;
typedef struct {
@ -287,10 +292,20 @@ union VGA_Memory {
Bit8u linear[512*1024*4];
Bit8u paged[512*1024][4];
VGA_Latch latched[512*1024];
};
};
typedef struct {
Bit32u page;
Bit32u addr;
Bit32u mask;
PageHandler *handler;
} VGA_LFB;
#define VGA_CHANGE_SHIFT 9
typedef Bit8u VGA_Changed[(2*1024*1024) >> VGA_CHANGE_SHIFT];
typedef struct {
VGAModes mode; /* The mode the vga system is in */
VGAModes lastmode;
Bit8u misc_output;
VGA_Draw draw;
VGA_Config config;
@ -307,6 +322,9 @@ typedef struct {
VGA_TANDY tandy;
VGA_OTHER other;
VGA_Memory mem;
VGA_LFB lfb;
VGA_Changed changed;
Bit8u * gfxmem_start;
} VGA_Type;
@ -343,6 +361,15 @@ void VGA_StartUpdateLFB(void);
void VGA_SetBlinking(Bitu enabled);
void VGA_SetCGA2Table(Bit8u val0,Bit8u val1);
void VGA_SetCGA4Table(Bit8u val0,Bit8u val1,Bit8u val2,Bit8u val3);
void VGA_ActivateHardwareCursor(void);
void VGA_KillDrawing(void);
/* S3 Functions */
Bitu SVGA_S3_GetClock(void);
void SVGA_S3_WriteCRTC(Bitu reg,Bitu val,Bitu iolen);
Bitu SVGA_S3_ReadCRTC(Bitu reg,Bitu iolen);
void SVGA_S3_WriteSEQ(Bitu reg,Bitu val,Bitu iolen);
Bitu SVGA_S3_ReadSEQ(Bitu reg,Bitu iolen);
extern VGA_Type vga;
@ -350,6 +377,7 @@ extern Bit32u ExpandTable[256];
extern Bit32u FillTable[16];
extern Bit32u CGA_2_Table[16];
extern Bit32u CGA_4_Table[256];
extern Bit32u CGA_4_HiRes_Table[256];
extern Bit32u CGA_16_Table[256];
extern Bit32u TXT_Font_Table[16];
extern Bit32u TXT_FG_Table[16];
@ -359,4 +387,3 @@ extern Bit32u Expand16BigTable[0x10000];
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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,10 +16,16 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __VIDEO_H
#define __VIDEO_H
#ifndef DOSBOX_VIDEO_H
#define DOSBOX_VIDEO_H
typedef void (* GFX_ResetCallBack)(void);
typedef enum {
GFX_CallBackReset,
GFX_CallBackStop,
GFX_CallBackRedraw,
} GFX_CallBackFunctions_t;
typedef void (*GFX_CallBack_t)( GFX_CallBackFunctions_t function );
struct GFX_PalEntry {
Bit8u r;
@ -28,43 +34,38 @@ struct GFX_PalEntry {
Bit8u unused;
};
#define CAN_8 0x0001
#define CAN_16 0x0002
#define CAN_32 0x0004
#define GFX_CAN_8 0x0001
#define GFX_CAN_15 0x0002
#define GFX_CAN_16 0x0004
#define GFX_CAN_32 0x0008
#define CAN_ALL (CAN_8|CAN_16|CAN_32)
#define GFX_LOVE_8 0x0010
#define GFX_LOVE_15 0x0020
#define GFX_LOVE_16 0x0040
#define GFX_LOVE_32 0x0080
#define LOVE_8 0x0010
#define LOVE_16 0x0020
#define LOVE_32 0x0040
#define GFX_RGBONLY 0x0100
#define NEED_RGB 0x0100
#define DONT_ASPECT 0x0200
#define GFX_SCALING 0x1000
#define GFX_HARDWARE 0x2000
#define HAVE_SCALING 0x1000
enum GFX_Modes {
GFX_8,GFX_15,GFX_16,GFX_32,GFX_NONE,
};
#define GFX_CAN_RANDOM 0x4000 //If the interface can also do random access surface
void GFX_Events(void);
void GFX_SetPalette(Bitu start,Bitu count,GFX_PalEntry * entries);
Bitu GFX_GetBestMode(Bitu flags);
Bitu GFX_GetRGB(Bit8u red,Bit8u green,Bit8u blue);
GFX_Modes GFX_SetSize(Bitu width,Bitu height,Bitu flags,double scalex,double scaley,GFX_ResetCallBack cb_reset);
Bitu GFX_SetSize(Bitu width,Bitu height,Bitu flags,double scalex,double scaley,GFX_CallBack_t cb);
void GFX_ResetScreen(void);
void GFX_Start(void);
void GFX_Stop(void);
void GFX_SwitchFullScreen(void);
bool GFX_StartUpdate(Bit8u * & pixels,Bitu & pitch);
void GFX_EndUpdate(void);
void GFX_EndUpdate( const Bit16u *changedLines );
/* Mouse related */
void GFX_CaptureMouse(void);
extern bool mouselocked; //true if mouse is confined to window
#endif

View File

@ -1,7 +1,7 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2004-10-22.00
scriptversion=2004-09-10.20
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
@ -213,7 +213,7 @@ do
fi
# This sed command emulates the dirname command.
dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
@ -226,8 +226,7 @@ do
oIFS=$IFS
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
shift
set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS=$oIFS
pathcomp=

View File

@ -1,10 +1,18 @@
AM_CPPFLAGS = -I$(top_srcdir)/include
SUBDIRS = cpu debug dos fpu gui hardware ints misc shell platform
SUBDIRS = cpu debug dos fpu gui hardware libs ints misc shell platform
bin_PROGRAMS = dosbox
dosbox_SOURCES = dosbox.cpp
dosbox_LDADD = cpu/libcpu.a debug/libdebug.a dos/libdos.a fpu/libfpu.a hardware/libhardware.a gui/libgui.a \
ints/libints.a misc/libmisc.a shell/libshell.a
ints/libints.a misc/libmisc.a shell/libshell.a hardware/serialport/libserial.a
if HAVE_WINDRES
dosbox_LDADD += dosbox_ico.o
endif
EXTRA_DIST = dosbox.rc dosbox.ico
dosbox_ico.o: dosbox.rc dosbox.ico
$(WINDRES) dosbox.rc dosbox_ico.o

View File

@ -1,8 +1,8 @@
# Makefile.in generated by automake 1.9.3 from Makefile.am.
# Makefile.in generated by automake 1.9.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004 Free Software Foundation, Inc.
# 2003, 2004, 2005 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.
@ -40,6 +40,7 @@ build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
bin_PROGRAMS = dosbox$(EXEEXT)
@HAVE_WINDRES_TRUE@am__append_1 = dosbox_ico.o
subdir = src
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@ -55,9 +56,11 @@ binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS)
am_dosbox_OBJECTS = dosbox.$(OBJEXT)
dosbox_OBJECTS = $(am_dosbox_OBJECTS)
@HAVE_WINDRES_TRUE@am__DEPENDENCIES_1 = dosbox_ico.o
dosbox_DEPENDENCIES = cpu/libcpu.a debug/libdebug.a dos/libdos.a \
fpu/libfpu.a hardware/libhardware.a gui/libgui.a \
ints/libints.a misc/libmisc.a shell/libshell.a
ints/libints.a misc/libmisc.a shell/libshell.a \
hardware/serialport/libserial.a $(am__DEPENDENCIES_1)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@ -104,6 +107,8 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
HAVE_WINDRES_FALSE = @HAVE_WINDRES_FALSE@
HAVE_WINDRES_TRUE = @HAVE_WINDRES_TRUE@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
@ -129,10 +134,12 @@ SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
WINDRES = @WINDRES@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
ac_ct_WINDRES = @ac_ct_WINDRES@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
@ -175,11 +182,13 @@ 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
SUBDIRS = cpu debug dos fpu gui hardware libs ints misc shell platform
dosbox_SOURCES = dosbox.cpp
dosbox_LDADD = cpu/libcpu.a debug/libdebug.a dos/libdos.a fpu/libfpu.a hardware/libhardware.a gui/libgui.a \
ints/libints.a misc/libmisc.a shell/libshell.a
dosbox_LDADD = cpu/libcpu.a debug/libdebug.a dos/libdos.a fpu/libfpu.a \
hardware/libhardware.a gui/libgui.a ints/libints.a \
misc/libmisc.a shell/libshell.a \
hardware/serialport/libserial.a $(am__append_1)
EXTRA_DIST = dosbox.rc dosbox.ico
all: all-recursive
.SUFFIXES:
@ -245,7 +254,8 @@ installcheck-binPROGRAMS: $(bin_PROGRAMS)
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 \
if "$(DESTDIR)$(bindir)/$$f" $$opt >c$${pid}_.out \
2>c$${pid}_.err </dev/null \
&& 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; \
@ -285,7 +295,13 @@ uninstall-info-am:
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@set fnord $$MAKEFLAGS; amf=$$2; \
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
@ -297,7 +313,7 @@ $(RECURSIVE_TARGETS):
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
@ -305,7 +321,13 @@ $(RECURSIVE_TARGETS):
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
@set fnord $$MAKEFLAGS; amf=$$2; \
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
@ -326,7 +348,7 @@ maintainer-clean-recursive:
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
@ -537,6 +559,8 @@ uninstall-info: uninstall-info-recursive
mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
uninstall uninstall-am uninstall-binPROGRAMS uninstall-info-am
dosbox_ico.o: dosbox.rc dosbox.ico
$(WINDRES) dosbox.rc dosbox_ico.o
# 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:

View File

@ -1,8 +1,8 @@
# Makefile.in generated by automake 1.9.3 from Makefile.am.
# Makefile.in generated by automake 1.9.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004 Free Software Foundation, Inc.
# 2003, 2004, 2005 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.
@ -109,6 +109,8 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
HAVE_WINDRES_FALSE = @HAVE_WINDRES_FALSE@
HAVE_WINDRES_TRUE = @HAVE_WINDRES_TRUE@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
@ -134,10 +136,12 @@ SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
WINDRES = @WINDRES@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
ac_ct_WINDRES = @ac_ct_WINDRES@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
@ -265,7 +269,13 @@ uninstall-info-am:
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@set fnord $$MAKEFLAGS; amf=$$2; \
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
@ -277,7 +287,7 @@ $(RECURSIVE_TARGETS):
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
@ -285,7 +295,13 @@ $(RECURSIVE_TARGETS):
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
@set fnord $$MAKEFLAGS; amf=$$2; \
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
@ -306,7 +322,7 @@ maintainer-clean-recursive:
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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,28 +16,26 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: callback.cpp,v 1.22 2004/08/29 11:22:37 qbix79 Exp $ */
/* $Id: callback.cpp,v 1.31 2006/02/12 23:28:21 harekiet Exp $ */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "dosbox.h"
#include "callback.h"
#include "mem.h"
#include "cpu.h"
#include "pic.h"
/* CallBack are located at 0xC800:0
And they are 16 bytes each and you can define them to behave in certain ways like a
far return or and IRET
*/
CallBack_Handler CallBack_Handlers[CB_MAX];
char* CallBack_Description[CB_MAX];
static Bitu call_stop,call_idle,call_default;
Bitu call_priv_io;
static Bitu illegal_handler(void) {
E_Exit("Illegal CallBack Called");
@ -55,6 +53,11 @@ Bitu CALLBACK_Allocate(void) {
return 0;
}
void CALLBACK_DeAllocate(Bitu in) {
CallBack_Handlers[in]=&illegal_handler;
}
void CALLBACK_Idle(void) {
/* this makes the cpu execute instructions to handle irq's and then come back */
Bitu oldIF=GETFLAG(IF);
@ -67,7 +70,8 @@ void CALLBACK_Idle(void) {
reg_eip=oldeip;
SegSet16(cs,oldcs);
SETFLAGBIT(IF,oldIF);
if (CPU_Cycles>0) CPU_Cycles=0;
if (!CPU_CycleAuto && CPU_Cycles>0)
CPU_Cycles=0;
}
static Bitu default_handler(void) {
@ -104,8 +108,6 @@ void CALLBACK_RunRealInt(Bit8u intnum) {
SegSet16(cs,oldcs);
}
void CALLBACK_SZF(bool val) {
Bit16u tempf=mem_readw(SegPhys(ss)+reg_sp+4) & 0xFFBF;
Bit16u newZF=(val==true) << 6;
@ -118,8 +120,7 @@ void CALLBACK_SCF(bool val) {
mem_writew(SegPhys(ss)+reg_sp+4,(tempf | newCF));
};
void CALLBACK_SetDescription(Bitu nr, const char* descr)
{
void CALLBACK_SetDescription(Bitu nr, const char* descr) {
if (descr) {
CallBack_Description[nr] = new char[strlen(descr)+1];
strcpy(CallBack_Description[nr],descr);
@ -127,8 +128,7 @@ void CALLBACK_SetDescription(Bitu nr, const char* descr)
CallBack_Description[nr] = 0;
};
const char* CALLBACK_GetDescription(Bitu nr)
{
const char* CALLBACK_GetDescription(Bitu nr) {
if (nr>=CB_MAX) return 0;
return CallBack_Description[nr];
};
@ -155,44 +155,100 @@ bool CALLBACK_Setup(Bitu callback,CallBack_Handler handler,Bitu type,const char*
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:
E_Exit("CALLBACK:Setup:Illegal type %d",type);
}
CallBack_Handlers[callback]=handler;
CALLBACK_SetDescription(callback,descr);
return true;
}
bool CALLBACK_SetupAt(Bitu callback,CallBack_Handler handler,Bitu type,Bitu linearAddress,const char* descr) {
if (callback>=CB_MAX) return false;
void CALLBACK_RemoveSetup(Bitu callback) {
for (Bitu i = 0;i < 16;i++) {
phys_writeb(CB_BASE+(callback<<4)+i ,(Bit8u) 0x00);
}
}
Bitu CALLBACK_SetupExtra(Bitu callback, Bitu type, PhysPt physAddress) {
if (callback>=CB_MAX)
return 0;
switch (type) {
case CB_RETN:
phys_writeb(physAddress+0,(Bit8u)0xFE); //GRP 4
phys_writeb(physAddress+1,(Bit8u)0x38); //Extra Callback instruction
phys_writew(physAddress+2, callback); //The immediate word
phys_writeb(physAddress+4,(Bit8u)0xC3); //A RETN Instruction
return 5;
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;
phys_writeb(physAddress+0,(Bit8u)0xFE); //GRP 4
phys_writeb(physAddress+1,(Bit8u)0x38); //Extra Callback instruction
phys_writew(physAddress+2, callback); //The immediate word
phys_writeb(physAddress+4,(Bit8u)0xCB); //A RETF Instruction
return 5;
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;
phys_writeb(physAddress+0,(Bit8u)0xFE); //GRP 4
phys_writeb(physAddress+1,(Bit8u)0x38); //Extra Callback instruction
phys_writew(physAddress+2,callback); //The immediate word
phys_writeb(physAddress+4,(Bit8u)0xCF); //An IRET Instruction
return 5;
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;
phys_writeb(physAddress+0,(Bit8u)0xFB); //STI
phys_writeb(physAddress+1,(Bit8u)0xFE); //GRP 4
phys_writeb(physAddress+2,(Bit8u)0x38); //Extra Callback instruction
phys_writew(physAddress+3, callback); //The immediate word
phys_writeb(physAddress+5,(Bit8u)0xCF); //An IRET Instruction
return 6;
default:
E_Exit("CALLBACK:Setup:Illegal type %d",type);
}
CallBack_Handlers[callback]=handler;
CALLBACK_SetDescription(callback,descr);
return true;
return 0;
}
CALLBACK_HandlerObject::~CALLBACK_HandlerObject(){
if(!installed) return;
if(m_type == CALLBACK_HandlerObject::SETUP) {
if(vectorhandler.installed){
//See if we are the current handler. if so restore the old one
if(RealGetVec(vectorhandler.interrupt) == Get_RealPointer()) {
RealSetVec(vectorhandler.interrupt,vectorhandler.old_vector);
} else
LOG(LOG_MISC,LOG_WARN)("Interrupt vector changed on %X %s",vectorhandler.interrupt,CALLBACK_GetDescription(m_callback));
}
CALLBACK_RemoveSetup(m_callback);
} else if(m_type == CALLBACK_HandlerObject::SETUPAT){
E_Exit("Callback:SETUP at not handled yet.");
} else if(m_type == CALLBACK_HandlerObject::NONE){
//Do nothing. Merely DeAllocate the callback
} else E_Exit("what kind of callback is this!");
if(CallBack_Description[m_callback]) delete [] CallBack_Description[m_callback];
CallBack_Description[m_callback] = 0;
CALLBACK_DeAllocate(m_callback);
}
void CALLBACK_HandlerObject::Install(CallBack_Handler handler,Bitu type,const char* description){
if(!installed) {
installed=true;
m_type=SETUP;
m_callback=CALLBACK_Allocate();
CALLBACK_Setup(m_callback,handler,type,description);
} else E_Exit("Allready installed");
}
void CALLBACK_HandlerObject::Allocate(CallBack_Handler handler,const char* description) {
if(!installed) {
installed=true;
m_type=NONE;
m_callback=CALLBACK_Allocate();
CALLBACK_SetDescription(m_callback,description);
CallBack_Handlers[m_callback]=handler;
} else E_Exit("Allready installed");
}
void CALLBACK_HandlerObject::Set_RealVec(Bit8u vec){
if(!vectorhandler.installed) {
vectorhandler.installed=true;
vectorhandler.interrupt=vec;
RealSetVec(vec,Get_RealPointer(),vectorhandler.old_vector);
} else E_Exit ("double usage of vector handler");
}
void CALLBACK_Init(Section* sec) {
@ -219,6 +275,7 @@ void CALLBACK_Init(Section* sec) {
/* Setup all Interrupt to point to the default handler */
call_default=CALLBACK_Allocate();
CALLBACK_Setup(call_default,&default_handler,CB_IRET,"default");
/* Only setup default handler for first half of interrupt table */
for (i=0;i<0x40;i++) {
real_writed(0,i*4,CALLBACK_RealPointer(call_default));
@ -237,6 +294,22 @@ void CALLBACK_Init(Section* sec) {
real_writed(0,0x67*4,CALLBACK_RealPointer(call_default));
real_writed(0,0x5c*4,CALLBACK_RealPointer(call_default)); //Network stuff
//real_writed(0,0xf*4,0); some games don't like it
call_priv_io=CALLBACK_Allocate();
phys_writeb(CB_BASE+(call_priv_io<<4)+0x00,(Bit8u)0xec); // in al, dx
phys_writeb(CB_BASE+(call_priv_io<<4)+0x01,(Bit8u)0xcb); // retf
phys_writeb(CB_BASE+(call_priv_io<<4)+0x02,(Bit8u)0xed); // in ax, dx
phys_writeb(CB_BASE+(call_priv_io<<4)+0x03,(Bit8u)0xcb); // retf
phys_writeb(CB_BASE+(call_priv_io<<4)+0x04,(Bit8u)0x66); // in eax, dx
phys_writeb(CB_BASE+(call_priv_io<<4)+0x05,(Bit8u)0xed);
phys_writeb(CB_BASE+(call_priv_io<<4)+0x06,(Bit8u)0xcb); // retf
phys_writeb(CB_BASE+(call_priv_io<<4)+0x08,(Bit8u)0xee); // out dx, al
phys_writeb(CB_BASE+(call_priv_io<<4)+0x09,(Bit8u)0xcb); // retf
phys_writeb(CB_BASE+(call_priv_io<<4)+0x0a,(Bit8u)0xef); // out dx, ax
phys_writeb(CB_BASE+(call_priv_io<<4)+0x0b,(Bit8u)0xcb); // retf
phys_writeb(CB_BASE+(call_priv_io<<4)+0x0c,(Bit8u)0x66); // out dx, eax
phys_writeb(CB_BASE+(call_priv_io<<4)+0x0d,(Bit8u)0xef);
phys_writeb(CB_BASE+(call_priv_io<<4)+0x0e,(Bit8u)0xcb); // retf
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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
@ -20,10 +20,23 @@
#if (C_DYNAMIC_X86)
#define CHECKED_MEMORY_ACCESS
#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <stddef.h>
#include <stdlib.h>
#if (C_HAVE_MPROTECT)
#include <sys/mman.h>
#include <limits.h>
#ifndef PAGESIZE
#define PAGESIZE 4096
#endif
#endif /* C_HAVE_MPROTECT */
#include "callback.h"
#include "regs.h"
@ -33,11 +46,15 @@
#include "paging.h"
#include "inout.h"
#define CACHE_TOTAL (512*1024)
#ifdef CHECKED_MEMORY_ACCESS
#define CACHE_MAXSIZE (4096*2)
#else
#define CACHE_MAXSIZE (4096)
#define CACHE_BLOCKS (32*1024)
#endif
#define CACHE_PAGES (128*8)
#define CACHE_TOTAL (CACHE_PAGES*4096)
#define CACHE_BLOCKS (64*1024)
#define CACHE_ALIGN (16)
#define CACHE_PAGES (128)
#define DYN_HASH_SHIFT (4)
#define DYN_PAGE_HASH (4096>>DYN_HASH_SHIFT)
#define DYN_LINKS (16)
@ -48,6 +65,10 @@
#define DYN_LOG
#endif
#if C_FPU
#define CPU_FPU 1 //Enable FPU escape instructions
#endif
enum {
G_EAX,G_ECX,G_EDX,G_EBX,
G_ESP,G_EBP,G_ESI,G_EDI,
@ -98,8 +119,12 @@ enum BlockReturn {
BR_OpcodeFull,
#endif
BR_CallBack,
BR_SMCBlock
};
#define SMC_CURRENT_BLOCK 0xffff
#define DYNFLG_HAS16 0x1 //Would like 8-bit host reg support
#define DYNFLG_HAS8 0x2 //Would like 16-bit host reg support
#define DYNFLG_LOAD 0x4 //Load value when accessed
@ -133,14 +158,14 @@ static struct {
Bitu ea,tmpb,tmpd,stack,shift;
} extra_regs;
static void IllegalOption(void) {
E_Exit("Illegal option");
static void IllegalOption(const char* msg) {
E_Exit("DynCore: illegal option in %s",msg);
}
#include "core_dyn_x86/cache.h"
static struct {
Bitu callback;
Bitu callback,readdata;
} core_dyn;
@ -180,12 +205,23 @@ static void dyn_loadstate(DynState * state) {
}
}
static void dyn_synchstate(DynState * state) {
for (Bitu i=0;i<G_MAX;i++) {
gen_synchreg(&DynRegs[i],&state->regs[i]);
}
}
static void dyn_saveregister(DynReg * src_reg, DynReg * dst_reg) {
dst_reg->flags=src_reg->flags;
dst_reg->genreg=src_reg->genreg;
}
static void dyn_restoreregister(DynReg * src_reg, DynReg * dst_reg) {
dst_reg->flags=src_reg->flags;
dst_reg->genreg=src_reg->genreg;
dst_reg->genreg->dynreg=dst_reg; // necessary when register has been released
}
#include "core_dyn_x86/decoder.h"
Bits CPU_Core_Dyn_X86_Run(void) {
@ -220,6 +256,10 @@ run_block:
return CBRET_NONE;
case BR_CallBack:
return core_dyn.callback;
case BR_SMCBlock:
// LOG_MSG("selfmodification of running block at %x:%x",SegValue(cs),reg_eip);
cpu.exception.which=0;
// fallthrough, let the normal core handle the block-modifying instruction
case BR_Opcode:
CPU_CycleLeft+=CPU_Cycles;
CPU_Cycles=1;
@ -306,11 +346,14 @@ void CPU_Core_Dyn_X86_Init(void) {
DynRegs[G_SHIFT].flags=DYNFLG_HAS8|DYNFLG_HAS16;
DynRegs[G_EXIT].data=0;
DynRegs[G_EXIT].flags=DYNFLG_HAS16;
/* Initialize code cache and dynamic blocks */
cache_init();
/* Init the generator */
gen_init();
return;
}
void CPU_Core_Dyn_X86_Cache_Init(bool enable_cache) {
/* Initialize code cache and dynamic blocks */
cache_init(enable_cache);
}
#endif

View File

@ -1,8 +1,8 @@
# Makefile.in generated by automake 1.9.3 from Makefile.am.
# Makefile.in generated by automake 1.9.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004 Free Software Foundation, Inc.
# 2003, 2004, 2005 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.
@ -80,6 +80,8 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
HAVE_WINDRES_FALSE = @HAVE_WINDRES_FALSE@
HAVE_WINDRES_TRUE = @HAVE_WINDRES_TRUE@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
@ -105,10 +107,12 @@ SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
WINDRES = @WINDRES@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
ac_ct_WINDRES = @ac_ct_WINDRES@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@

View File

@ -42,10 +42,14 @@ static struct {
CodePageHandler * last_page;
} cache;
#if (C_HAVE_MPROTECT)
static Bit8u cache_code_link_blocks[2][16] GCC_ATTRIBUTE(aligned(PAGESIZE));
#else
static Bit8u cache_code_link_blocks[2][16];
static Bit8u cache_code[CACHE_TOTAL+CACHE_MAXSIZE];
static CacheBlock cache_blocks[CACHE_BLOCKS];
#endif
static CacheBlock link_blocks[2];
class CodePageHandler :public PageHandler {
public:
CodePageHandler() {}
@ -59,21 +63,27 @@ public:
memset(&hash_map,0,sizeof(hash_map));
memset(&write_map,0,sizeof(write_map));
}
void InvalidateRange(Bitu start,Bitu end) {
bool InvalidateRange(Bitu start,Bitu end) {
Bits index=1+(start>>DYN_HASH_SHIFT);
bool is_current_block=false;
Bit32u ip_point=SegPhys(cs)+reg_eip;
ip_point=((paging.tlb.phys_page[ip_point>>12]-phys_page)<<12)+(ip_point&0xfff);
while (index>=0) {
Bitu map=0;
for (Bitu count=start;count<=end;count++) map+=write_map[count];
if (!map) return;
if (!map) return is_current_block;
CacheBlock * block=hash_map[index];
while (block) {
CacheBlock * nextblock=block->hash.next;
if (start<=block->page.end && end>=block->page.start)
if (start<=block->page.end && end>=block->page.start) {
if (ip_point<=block->page.end && ip_point>=block->page.start) is_current_block=true;
block->Clear();
}
block=nextblock;
}
index--;
}
return is_current_block;
}
void writeb(PhysPt addr,Bitu val){
addr&=4095;
@ -102,6 +112,48 @@ public:
if (!active_count) Release();
} else InvalidateRange(addr,addr+3);
}
bool writeb_checked(PhysPt addr,Bitu val) {
addr&=4095;
if (!*(Bit8u*)&write_map[addr]) {
if (!active_blocks) {
active_count--;
if (!active_count) Release();
}
} else if (InvalidateRange(addr,addr)) {
cpu.exception.which=SMC_CURRENT_BLOCK;
return true;
}
host_writeb(hostmem+addr,val);
return false;
}
bool writew_checked(PhysPt addr,Bitu val) {
addr&=4095;
if (!*(Bit16u*)&write_map[addr]) {
if (!active_blocks) {
active_count--;
if (!active_count) Release();
}
} else if (InvalidateRange(addr,addr+1)) {
cpu.exception.which=SMC_CURRENT_BLOCK;
return true;
}
host_writew(hostmem+addr,val);
return false;
}
bool writed_checked(PhysPt addr,Bitu val) {
addr&=4095;
if (!*(Bit32u*)&write_map[addr]) {
if (!active_blocks) {
active_count--;
if (!active_count) Release();
}
} else if (InvalidateRange(addr,addr+3)) {
cpu.exception.which=SMC_CURRENT_BLOCK;
return true;
}
host_writed(hostmem+addr,val);
return false;
}
void AddCacheBlock(CacheBlock * block) {
Bitu index=1+(block->page.start>>DYN_HASH_SHIFT);
block->hash.next=hash_map[index];
@ -161,10 +213,13 @@ public:
}
return 0;
}
HostPt GetHostPt(Bitu phys_page) {
hostmem=old_pagehandler->GetHostPt(phys_page);
HostPt GetHostReadPt(Bitu phys_page) {
hostmem=old_pagehandler->GetHostReadPt(phys_page);
return hostmem;
}
HostPt GetHostWritePt(Bitu phys_page) {
return GetHostReadPt( phys_page );
}
public:
Bit8u write_map[4096];
CodePageHandler * next, * prev;
@ -235,10 +290,13 @@ void CacheBlock::Clear(void) {
}
if (link[ind].to!=&link_blocks[ind]) {
CacheBlock * * wherelink=&link[ind].to->link[ind].from;
while (*wherelink!=this) {
wherelink=&(*wherelink)->link[ind].next;
while (*wherelink != this && *wherelink) {
wherelink = &(*wherelink)->link[ind].next;
}
*wherelink=(*wherelink)->link[ind].next;
if(*wherelink)
*wherelink = (*wherelink)->link[ind].next;
else
LOG(LOG_CPU,LOG_ERROR)("Cache anomaly. please investigate");
}
} else
cache_addunsedblock(this);
@ -332,34 +390,68 @@ static INLINE void cache_addd(Bit32u val) {
static void gen_return(BlockReturn retcode);
static void cache_init(void) {
static Bit8u * cache_code=NULL;
static CacheBlock * cache_blocks=NULL;
/* Define temporary pagesize so the MPROTECT case and the regular case share as much code as possible */
#if (C_HAVE_MPROTECT)
#define PAGESIZE_TEMP PAGESIZE
#else
#define PAGESIZE_TEMP 1
#endif
static void cache_init(bool enable) {
static bool cache_initialized = false;
Bits i;
memset(&cache_blocks,0,sizeof(cache_blocks));
cache.block.free=&cache_blocks[0];
for (i=0;i<CACHE_BLOCKS-1;i++) {
cache_blocks[i].link[0].to=(CacheBlock *)1;
cache_blocks[i].link[1].to=(CacheBlock *)1;
cache_blocks[i].cache.next=&cache_blocks[i+1];
}
CacheBlock * block=cache_getblock();
cache.block.first=block;
cache.block.active=block;
block->cache.start=&cache_code[0];
block->cache.size=CACHE_TOTAL;
block->cache.next=0; //Last block in the list
cache.pos=&cache_code_link_blocks[0][0];
link_blocks[0].cache.start=cache.pos;
gen_return(BR_Link1);
cache.pos=&cache_code_link_blocks[1][0];
link_blocks[1].cache.start=cache.pos;
gen_return(BR_Link2);
cache.free_pages=0;
cache.last_page=0;
cache.used_pages=0;
/* Setup the code pages */
for (i=0;i<CACHE_PAGES-1;i++) {
CodePageHandler * newpage=new CodePageHandler();
newpage->next=cache.free_pages;
cache.free_pages=newpage;
if (enable) {
if (cache_initialized) return;
cache_initialized = true;
if (cache_blocks == NULL) {
cache_blocks=(CacheBlock*)malloc(CACHE_BLOCKS*sizeof(CacheBlock));
if(!cache_blocks) E_Exit("Allocating cache_blocks has failed");
memset(cache_blocks,0,sizeof(CacheBlock)*CACHE_BLOCKS);
cache.block.free=&cache_blocks[0];
for (i=0;i<CACHE_BLOCKS-1;i++) {
cache_blocks[i].link[0].to=(CacheBlock *)1;
cache_blocks[i].link[1].to=(CacheBlock *)1;
cache_blocks[i].cache.next=&cache_blocks[i+1];
}
}
#if (C_HAVE_MPROTECT)
if(mprotect(cache_code_link_blocks,sizeof(cache_code_link_blocks),PROT_WRITE|PROT_READ|PROT_EXEC))
LOG_MSG("Setting excute permission on cache code link blocks has failed");
#endif
if (cache_code==NULL) {
cache_code=(Bit8u*)malloc(CACHE_TOTAL+CACHE_MAXSIZE+PAGESIZE_TEMP-1);
if(!cache_code) E_Exit("Allocating dynamic cache failed");
#if (C_HAVE_MPROTECT)
cache_code=(Bit8u*)(((int)cache_code + PAGESIZE-1) & ~(PAGESIZE-1)); //MEM LEAK. store old pointer if you want to free it.
if(mprotect(cache_code,CACHE_TOTAL+CACHE_MAXSIZE,PROT_WRITE|PROT_READ|PROT_EXEC))
LOG_MSG("Setting excute permission on the code cache has failed!");
#endif
CacheBlock * block=cache_getblock();
cache.block.first=block;
cache.block.active=block;
block->cache.start=&cache_code[0];
block->cache.size=CACHE_TOTAL;
block->cache.next=0; //Last block in the list
}
/* Setup the default blocks for block linkage returns */
cache.pos=&cache_code_link_blocks[0][0];
link_blocks[0].cache.start=cache.pos;
gen_return(BR_Link1);
cache.pos=&cache_code_link_blocks[1][0];
link_blocks[1].cache.start=cache.pos;
gen_return(BR_Link2);
cache.free_pages=0;
cache.last_page=0;
cache.used_pages=0;
/* Setup the code pages */
for (i=0;i<CACHE_PAGES-1;i++) {
CodePageHandler * newpage=new CodePageHandler();
newpage->next=cache.free_pages;
cache.free_pages=newpage;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,18 +1,22 @@
static bool dyn_helper_divb(Bit8u val) {
if (!val) return CPU_PrepareException(0,0);
Bitu quo=reg_ax / val;
reg_ah=(Bit8u)(reg_ax % val);
reg_al=(Bit8u)quo;
Bit8u rem=(Bit8u)(reg_ax % val);
Bit8u quo8=(Bit8u)(quo&0xff);
if (quo>0xff) return CPU_PrepareException(0,0);
reg_ah=rem;
reg_al=quo8;
return false;
}
static bool dyn_helper_idivb(Bit8s val) {
if (!val) return CPU_PrepareException(0,0);
Bits quo=(Bit16s)reg_ax / val;
reg_ah=(Bit8s)((Bit16s)reg_ax % val);
reg_al=(Bit8s)quo;
if (quo!=(Bit8s)reg_al) return CPU_PrepareException(0,0);
Bit8s rem=(Bit8s)((Bit16s)reg_ax % val);
Bit8s quo8s=(Bit8s)(quo&0xff);
if (quo!=(Bit16s)quo8s) return CPU_PrepareException(0,0);
reg_ah=rem;
reg_al=quo8s;
return false;
}
@ -20,9 +24,11 @@ static bool dyn_helper_divw(Bit16u val) {
if (!val) return CPU_PrepareException(0,0);
Bitu num=(reg_dx<<16)|reg_ax;
Bitu quo=num/val;
reg_dx=(Bit16u)(num % val);
reg_ax=(Bit16u)quo;
if (quo!=reg_ax) return CPU_PrepareException(0,0);
Bit16u rem=(Bit16u)(num % val);
Bit16u quo16=(Bit16u)(quo&0xffff);
if (quo!=(Bit32u)quo16) return CPU_PrepareException(0,0);
reg_dx=rem;
reg_ax=quo16;
return false;
}
@ -30,9 +36,11 @@ static bool dyn_helper_idivw(Bit16s val) {
if (!val) return CPU_PrepareException(0,0);
Bits num=(reg_dx<<16)|reg_ax;
Bits quo=num/val;
reg_dx=(Bit16s)(num % val);
reg_ax=(Bit16s)quo;
if (quo!=(Bit16s)reg_ax) return CPU_PrepareException(0,0);
Bit16s rem=(Bit16s)(num % val);
Bit16s quo16s=(Bit16s)quo;
if (quo!=(Bit32s)quo16s) return CPU_PrepareException(0,0);
reg_dx=rem;
reg_ax=quo16s;
return false;
}
@ -40,9 +48,11 @@ static bool dyn_helper_divd(Bit32u val) {
if (!val) return CPU_PrepareException(0,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) return CPU_PrepareException(0,0);
Bit32u rem=(Bit32u)(num % val);
Bit32u quo32=(Bit32u)(quo&0xffffffff);
if (quo!=(Bit64u)quo32) return CPU_PrepareException(0,0);
reg_edx=rem;
reg_eax=quo32;
return false;
}
@ -50,8 +60,10 @@ static bool dyn_helper_idivd(Bit32s val) {
if (!val) return CPU_PrepareException(0,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)) return CPU_PrepareException(0,0);
Bit32s rem=(Bit32s)(num % val);
Bit32s quo32s=(Bit32s)(quo&0xffffffff);
if (quo!=(Bit64s)quo32s) return CPU_PrepareException(0,0);
reg_edx=rem;
reg_eax=quo32s;
return false;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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
@ -39,36 +39,35 @@ static struct {
class GenReg {
public:
GenReg(Bit8u _index,bool _protect) {
index=_index;protect=_protect;
GenReg(Bit8u _index) {
index=_index;
notusable=false;dynreg=0;
}
DynReg * dynreg;
Bitu last_used; //Keeps track of last assigned regs
Bit8u index;
bool notusable;
bool protect;
void Load(DynReg * _dynreg) {
void Load(DynReg * _dynreg,bool stale=false) {
if (!_dynreg) return;
if (dynreg) Clear();
if (GCC_UNLIKELY((Bitu)dynreg)) Clear();
dynreg=_dynreg;
last_used=x86gen.last_used;
dynreg->flags&=~DYNFLG_CHANGED;
dynreg->genreg=this;
if (dynreg->flags & (DYNFLG_LOAD|DYNFLG_ACTIVE)) {
if ((!stale) && (dynreg->flags & (DYNFLG_LOAD|DYNFLG_ACTIVE))) {
cache_addw(0x058b+(index << (8+3))); //Mov reg,[data]
cache_addd((Bit32u)dynreg->data);
}
dynreg->flags|=DYNFLG_ACTIVE;
}
void Save(void) {
if (!dynreg) IllegalOption();
if (GCC_UNLIKELY(!((Bitu)dynreg))) IllegalOption("GenReg->Save");
dynreg->flags&=~DYNFLG_CHANGED;
cache_addw(0x0589+(index << (8+3))); //Mov [data],reg
cache_addd((Bit32u)dynreg->data);
}
void Release(void) {
if (!dynreg) return;
if (GCC_UNLIKELY(!((Bitu)dynreg))) return;
if (dynreg->flags&DYNFLG_CHANGED && dynreg->flags&DYNFLG_SAVE) {
Save();
}
@ -82,8 +81,6 @@ public:
}
dynreg->genreg=0;dynreg=0;
}
};
static BlockReturn gen_runcode(Bit8u * code) {
@ -131,7 +128,7 @@ return_address:
return retval;
}
static GenReg * FindDynReg(DynReg * dynreg) {
static GenReg * FindDynReg(DynReg * dynreg,bool stale=false) {
x86gen.last_used++;
if (dynreg->genreg) {
dynreg->genreg->last_used=x86gen.last_used;
@ -143,11 +140,11 @@ static GenReg * FindDynReg(DynReg * dynreg) {
first_used=-1;
if (dynreg->flags & DYNFLG_HAS8) {
/* Has to be eax,ebx,ecx,edx */
for (i=first_index=0;i<=X86_REG_EDX;i++) {
for (i=first_index=0;i<=X86_REG_EBX;i++) {
GenReg * genreg=x86gen.regs[i];
if (genreg->notusable) continue;
if (!(genreg->dynreg)) {
genreg->Load(dynreg);
genreg->Load(dynreg,stale);
return genreg;
}
if (genreg->last_used<first_used) {
@ -155,16 +152,12 @@ static GenReg * FindDynReg(DynReg * dynreg) {
first_index=i;
}
}
/* No free register found use earliest assigned one */
GenReg * newreg=x86gen.regs[first_index];
newreg->Load(dynreg);
return newreg;
} else {
for (i=first_index=X86_REGS-1;i>=0;i--) {
GenReg * genreg=x86gen.regs[i];
if (genreg->notusable) continue;
if (!(genreg->dynreg)) {
genreg->Load(dynreg);
genreg->Load(dynreg,stale);
return genreg;
}
if (genreg->last_used<first_used) {
@ -172,11 +165,11 @@ static GenReg * FindDynReg(DynReg * dynreg) {
first_index=i;
}
}
/* No free register found use earliest assigned one */
GenReg * newreg=x86gen.regs[first_index];
newreg->Load(dynreg);
return newreg;
}
/* No free register found use earliest assigned one */
GenReg * newreg=x86gen.regs[first_index];
newreg->Load(dynreg,stale);
return newreg;
}
static GenReg * ForceDynReg(GenReg * genreg,DynReg * dynreg) {
@ -242,6 +235,30 @@ static void gen_protectflags(void) {
}
}
static void gen_discardflags(void) {
if (!x86gen.flagsactive) {
x86gen.flagsactive=true;
cache_addw(0xc483); //ADD ESP,4
cache_addb(0x4);
}
}
static void gen_needcarry(void) {
if (!x86gen.flagsactive) {
x86gen.flagsactive=true;
cache_addw(0x2cd1); //SHR DWORD [ESP],1
cache_addb(0x24);
cache_addd(0x0424648d); //LEA ESP,[ESP+4]
}
}
static bool skip_flags=false;
static void set_skipflags(bool state) {
if (!state) gen_discardflags();
skip_flags=state;
}
static void gen_reinit(void) {
x86gen.last_used=0;
x86gen.flagsactive=false;
@ -252,87 +269,72 @@ static void gen_reinit(void) {
static void gen_dop_byte(DualOps op,DynReg * dr1,Bit8u di1,DynReg * dr2,Bit8u di2) {
GenReg * gr1=FindDynReg(dr1);GenReg * gr2=FindDynReg(dr2);
Bit8u tmp;
switch (op) {
case DOP_ADD:cache_addb(0x02);dr1->flags|=DYNFLG_CHANGED;break;
case DOP_OR: cache_addb(0x0a);dr1->flags|=DYNFLG_CHANGED;break;
case DOP_ADC:cache_addb(0x12);dr1->flags|=DYNFLG_CHANGED;break;
case DOP_SBB:cache_addb(0x1a);dr1->flags|=DYNFLG_CHANGED;break;
case DOP_AND:cache_addb(0x22);dr1->flags|=DYNFLG_CHANGED;break;
case DOP_SUB:cache_addb(0x2a);dr1->flags|=DYNFLG_CHANGED;break;
case DOP_XOR:cache_addb(0x32);dr1->flags|=DYNFLG_CHANGED;break;
case DOP_CMP:cache_addb(0x3a);break;
case DOP_MOV:cache_addb(0x8a);dr1->flags|=DYNFLG_CHANGED;break;
case DOP_XCHG:cache_addb(0x86);dr1->flags|=DYNFLG_CHANGED;dr2->flags|=DYNFLG_CHANGED;break;
case DOP_TEST:cache_addb(0x84);break;
case DOP_ADD: tmp=0x02; break;
case DOP_ADC: tmp=0x12; break;
case DOP_SUB: tmp=0x2a; break;
case DOP_SBB: tmp=0x1a; break;
case DOP_CMP: tmp=0x3a; goto nochange;
case DOP_XOR: tmp=0x32; break;
case DOP_AND: tmp=0x22; if ((dr1==dr2) && (di1==di2)) goto nochange; break;
case DOP_OR: tmp=0x0a; if ((dr1==dr2) && (di1==di2)) goto nochange; break;
case DOP_TEST: tmp=0x84; goto nochange;
case DOP_MOV: if ((dr1==dr2) && (di1==di2)) return; tmp=0x8a; break;
case DOP_XCHG: tmp=0x86; dr2->flags|=DYNFLG_CHANGED; break;
default:
IllegalOption();
IllegalOption("gen_dop_byte");
}
cache_addb(0xc0+((gr1->index+di1)<<3)+gr2->index+di2);
dr1->flags|=DYNFLG_CHANGED;
nochange:
cache_addw(tmp|(0xc0+((gr1->index+di1)<<3)+gr2->index+di2)<<8);
}
static void gen_dop_byte_imm(DualOps op,DynReg * dr1,Bit8u di1,Bitu imm) {
GenReg * gr1=FindDynReg(dr1);
Bit16u tmp;
switch (op) {
case DOP_ADD:
cache_addw(0xc080+((gr1->index+di1)<<8));
dr1->flags|=DYNFLG_CHANGED;
break;
case DOP_OR:
cache_addw(0xc880+((gr1->index+di1)<<8));
dr1->flags|=DYNFLG_CHANGED;
break;
case DOP_ADC:
cache_addw(0xd080+((gr1->index+di1)<<8));
dr1->flags|=DYNFLG_CHANGED;
break;
case DOP_SBB:
cache_addw(0xd880+((gr1->index+di1)<<8));
dr1->flags|=DYNFLG_CHANGED;
break;
case DOP_AND:
cache_addw(0xe080+((gr1->index+di1)<<8));
dr1->flags|=DYNFLG_CHANGED;
break;
case DOP_SUB:
cache_addw(0xe880+((gr1->index+di1)<<8));
dr1->flags|=DYNFLG_CHANGED;
break;
case DOP_XOR:
cache_addw(0xf080+((gr1->index+di1)<<8));
dr1->flags|=DYNFLG_CHANGED;
break;
case DOP_CMP:
cache_addw(0xf880+((gr1->index+di1)<<8));
break;//Doesn't change
case DOP_MOV:
cache_addb(0xb0+gr1->index+di1);
dr1->flags|=DYNFLG_CHANGED;
break;
case DOP_TEST:
cache_addw(0xc0f6+((gr1->index+di1)<<8));
break;//Doesn't change
case DOP_ADD: tmp=0xc080; break;
case DOP_ADC: tmp=0xd080; break;
case DOP_SUB: tmp=0xe880; break;
case DOP_SBB: tmp=0xd880; break;
case DOP_CMP: tmp=0xf880; goto nochange; //Doesn't change
case DOP_XOR: tmp=0xf080; break;
case DOP_AND: tmp=0xe080; break;
case DOP_OR: tmp=0xc880; break;
case DOP_TEST: tmp=0xc0f6; goto nochange; //Doesn't change
case DOP_MOV: cache_addb(0xb0+gr1->index+di1);
dr1->flags|=DYNFLG_CHANGED;
goto finish;
default:
IllegalOption();
IllegalOption("gen_dop_byte_imm");
}
dr1->flags|=DYNFLG_CHANGED;
nochange:
cache_addw(tmp+((gr1->index+di1)<<8));
finish:
cache_addb(imm);
}
static void gen_sop_byte(SingleOps op,DynReg * dr1,Bit8u di1) {
GenReg * gr1=FindDynReg(dr1);
Bit16u tmp;
switch (op) {
case SOP_INC:cache_addw(0xc0FE + ((gr1->index+di1)<<8));break;
case SOP_DEC:cache_addw(0xc8FE + ((gr1->index+di1)<<8));break;
case SOP_NOT:cache_addw(0xd0f6 + ((gr1->index+di1)<<8));break;
case SOP_NEG:cache_addw(0xd8f6 + ((gr1->index+di1)<<8));break;
case SOP_INC: tmp=0xc0FE; break;
case SOP_DEC: tmp=0xc8FE; break;
case SOP_NOT: tmp=0xd0f6; break;
case SOP_NEG: tmp=0xd8f6; break;
default:
IllegalOption();
IllegalOption("gen_sop_byte");
}
cache_addw(tmp + ((gr1->index+di1)<<8));
dr1->flags|=DYNFLG_CHANGED;
}
static void gen_extend_word(bool sign,DynReg * ddr,DynReg * dsr) {
GenReg * gdr=FindDynReg(ddr);GenReg * gsr=FindDynReg(dsr);
GenReg * gsr=FindDynReg(dsr);
GenReg * gdr=FindDynReg(ddr,true);
if (sign) cache_addw(0xbf0f);
else cache_addw(0xb70f);
cache_addb(0xc0+(gdr->index<<3)+(gsr->index));
@ -340,7 +342,8 @@ static void gen_extend_word(bool sign,DynReg * ddr,DynReg * dsr) {
}
static void gen_extend_byte(bool sign,bool dword,DynReg * ddr,DynReg * dsr,Bit8u dsi) {
GenReg * gdr=FindDynReg(ddr);GenReg * gsr=FindDynReg(dsr);
GenReg * gsr=FindDynReg(dsr);
GenReg * gdr=FindDynReg(ddr,dword);
if (!dword) cache_addb(0x66);
if (sign) cache_addw(0xbe0f);
else cache_addw(0xb60f);
@ -368,6 +371,7 @@ static void gen_lea(DynReg * ddr,DynReg * dsr1,DynReg * dsr2,Bitu scale,Bits imm
Bit8u sib=(gsr1->index)+(gsr2->index<<3)+(scale<<6);
cache_addb(sib);
} else {
if ((ddr==dsr1) && !imm_size) return;
cache_addb(0x8d); //LEA
cache_addb(rm_base+gsr1->index);
}
@ -394,59 +398,80 @@ static void gen_lea(DynReg * ddr,DynReg * dsr1,DynReg * dsr2,Bitu scale,Bits imm
}
static void gen_dop_word(DualOps op,bool dword,DynReg * dr1,DynReg * dr2) {
GenReg * gr1=FindDynReg(dr1);GenReg * gr2=FindDynReg(dr2);
if (!dword) cache_addb(0x66);
GenReg * gr2=FindDynReg(dr2);
GenReg * gr1=FindDynReg(dr1,dword && op==DOP_MOV);
Bit8u tmp;
switch (op) {
case DOP_ADD:cache_addb(0x03);dr1->flags|=DYNFLG_CHANGED;break;
case DOP_OR: cache_addb(0x0b);dr1->flags|=DYNFLG_CHANGED;break;
case DOP_ADC:cache_addb(0x13);dr1->flags|=DYNFLG_CHANGED;break;
case DOP_SBB:cache_addb(0x1b);dr1->flags|=DYNFLG_CHANGED;break;
case DOP_AND:cache_addb(0x23);dr1->flags|=DYNFLG_CHANGED;break;
case DOP_SUB:cache_addb(0x2b);dr1->flags|=DYNFLG_CHANGED;break;
case DOP_XOR:cache_addb(0x33);dr1->flags|=DYNFLG_CHANGED;break;
case DOP_CMP:cache_addb(0x3b);break;
case DOP_MOV:cache_addb(0x8b);dr1->flags|=DYNFLG_CHANGED;break;
case DOP_XCHG:cache_addb(0x87);dr1->flags|=DYNFLG_CHANGED;dr2->flags|=DYNFLG_CHANGED;break;
case DOP_TEST:cache_addb(0x85);break;
case DOP_ADD: tmp=0x03; break;
case DOP_ADC: tmp=0x13; break;
case DOP_SUB: tmp=0x2b; break;
case DOP_SBB: tmp=0x1b; break;
case DOP_CMP: tmp=0x3b; goto nochange;
case DOP_XOR: tmp=0x33; break;
case DOP_AND: tmp=0x23; if (dr1==dr2) goto nochange; break;
case DOP_OR: tmp=0x0b; if (dr1==dr2) goto nochange; break;
case DOP_TEST: tmp=0x85; goto nochange;
case DOP_MOV: if (dr1==dr2) return; tmp=0x8b; break;
case DOP_XCHG:
dr2->flags|=DYNFLG_CHANGED;
if (dword && !((dr1->flags&DYNFLG_HAS8) ^ (dr2->flags&DYNFLG_HAS8))) {
dr1->genreg=gr2;dr1->genreg->dynreg=dr1;
dr2->genreg=gr1;dr2->genreg->dynreg=dr2;
dr1->flags|=DYNFLG_CHANGED;
return;
}
tmp=0x87;
break;
default:
IllegalOption();
IllegalOption("gen_dop_word");
}
cache_addb(0xc0+(gr1->index<<3)+gr2->index);
dr1->flags|=DYNFLG_CHANGED;
nochange:
if (!dword) cache_addb(0x66);
cache_addw(tmp|(0xc0+(gr1->index<<3)+gr2->index)<<8);
}
static void gen_dop_word_imm(DualOps op,bool dword,DynReg * dr1,Bits imm) {
GenReg * gr1=FindDynReg(dr1);
GenReg * gr1=FindDynReg(dr1,dword && op==DOP_MOV);
Bit16u tmp;
if (!dword) cache_addb(0x66);
switch (op) {
case DOP_ADD:cache_addw(0xc081+(gr1->index<<8));dr1->flags|=DYNFLG_CHANGED;break;
case DOP_OR: cache_addw(0xc881+(gr1->index<<8));dr1->flags|=DYNFLG_CHANGED;break;
case DOP_ADC:cache_addw(0xd081+(gr1->index<<8));dr1->flags|=DYNFLG_CHANGED;break;
case DOP_SBB:cache_addw(0xd881+(gr1->index<<8));dr1->flags|=DYNFLG_CHANGED;break;
case DOP_AND:cache_addw(0xe081+(gr1->index<<8));dr1->flags|=DYNFLG_CHANGED;break;
case DOP_SUB:cache_addw(0xe881+(gr1->index<<8));dr1->flags|=DYNFLG_CHANGED;break;
case DOP_XOR:cache_addw(0xf081+(gr1->index<<8));dr1->flags|=DYNFLG_CHANGED;break;
case DOP_CMP:cache_addw(0xf881+(gr1->index<<8));break;//Doesn't change
case DOP_MOV:cache_addb(0xb8+(gr1->index));dr1->flags|=DYNFLG_CHANGED;break;
case DOP_TEST:cache_addw(0xc0f7+(gr1->index<<8));break;//Doesn't change
case DOP_ADD: tmp=0xc081; break;
case DOP_ADC: tmp=0xd081; break;
case DOP_SUB: tmp=0xe881; break;
case DOP_SBB: tmp=0xd881; break;
case DOP_CMP: tmp=0xf881; goto nochange; //Doesn't change
case DOP_XOR: tmp=0xf081; break;
case DOP_AND: tmp=0xe081; break;
case DOP_OR: tmp=0xc881; break;
case DOP_TEST: tmp=0xc0f7; goto nochange; //Doesn't change
case DOP_MOV: cache_addb(0xb8+(gr1->index)); dr1->flags|=DYNFLG_CHANGED; goto finish;
default:
IllegalOption();
IllegalOption("gen_dop_word_imm");
}
dr1->flags|=DYNFLG_CHANGED;
nochange:
cache_addw(tmp+(gr1->index<<8));
finish:
if (dword) cache_addd(imm);
else cache_addw(imm);
}
static void gen_imul_word(bool dword,DynReg * dr1,DynReg * dr2) {
GenReg * gr1=FindDynReg(dr1);GenReg * gr2=FindDynReg(dr2);
if (!dword) cache_addb(0x66);
cache_addw(0xaf0f);
cache_addb(0xc0+(gr1->index<<3)+gr2->index);
dr1->flags|=DYNFLG_CHANGED;
if (!dword) {
cache_addd(0xaf0f66|(0xc0+(gr1->index<<3)+gr2->index)<<24);
} else {
cache_addw(0xaf0f);
cache_addb(0xc0+(gr1->index<<3)+gr2->index);
}
}
static void gen_imul_word_imm(bool dword,DynReg * dr1,DynReg * dr2,Bits imm) {
GenReg * gr1=FindDynReg(dr1);GenReg * gr2=FindDynReg(dr2);
if (!dword) cache_addb(0x66);
if ((imm>=-128 && imm<=127)) {
if ((imm>=-128 && imm<=127)) {
cache_addb(0x6b);
cache_addb(0xc0+(gr1->index<<3)+gr2->index);
cache_addb(imm);
@ -469,7 +494,7 @@ static void gen_sop_word(SingleOps op,bool dword,DynReg * dr1) {
case SOP_NOT:cache_addw(0xd0f7+(gr1->index<<8));break;
case SOP_NEG:cache_addw(0xd8f7+(gr1->index<<8));break;
default:
IllegalOption();
IllegalOption("gen_sop_word");
}
dr1->flags|=DYNFLG_CHANGED;
}
@ -498,10 +523,13 @@ static void gen_shift_word_cl(Bitu op,bool dword,DynReg * dr1,DynReg * drecx) {
static void gen_shift_word_imm(Bitu op,bool dword,DynReg * dr1,Bit8u imm) {
GenReg * gr1=FindDynReg(dr1);
if (!dword) cache_addb(0x66);
cache_addw(0xc0c1+(((Bit16u)op) << 11) + ((gr1->index)<<8));
cache_addb(imm);
dr1->flags|=DYNFLG_CHANGED;
if (!dword) {
cache_addd(0x66|((0xc0c1+((Bit16u)op << 11) + (gr1->index<<8))|imm<<16)<<8);
} else {
cache_addw(0xc0c1+((Bit16u)op << 11) + (gr1->index<<8));
cache_addb(imm);
}
}
static void gen_cbw(bool dword,DynReg * dyn_ax) {
@ -514,10 +542,10 @@ static void gen_cbw(bool dword,DynReg * dyn_ax) {
static void gen_cwd(bool dword,DynReg * dyn_ax,DynReg * dyn_dx) {
ForceDynReg(x86gen.regs[X86_REG_EAX],dyn_ax);
ForceDynReg(x86gen.regs[X86_REG_EDX],dyn_dx);
if (!dword) cache_addb(0x66);
cache_addb(0x99);
dyn_ax->flags|=DYNFLG_CHANGED;
dyn_dx->flags|=DYNFLG_CHANGED;
if (!dword) cache_addw(0x9966);
else cache_addb(0x99);
}
static void gen_mul_byte(bool imul,DynReg * dyn_ax,DynReg * dr1,Bit8u di1) {
@ -563,6 +591,7 @@ static void gen_dshift_cl(bool dword,bool left,DynReg * dr1,DynReg * dr2,DynReg
static void gen_call_function(void * func,char * ops,...) {
Bits paramcount=0;
bool release_flags=false;
struct ParamInfo {
char * line;
Bitu value;
@ -570,9 +599,9 @@ static void gen_call_function(void * func,char * ops,...) {
ParamInfo * retparam=0;
/* Clear the EAX Genreg for usage */
x86gen.regs[X86_REG_EAX]->Clear();
x86gen.regs[X86_REG_EAX]->notusable=true;;
x86gen.regs[X86_REG_EAX]->notusable=true;
/* Save the flags */
gen_protectflags();
if (GCC_UNLIKELY(!skip_flags)) gen_protectflags();
/* Scan for the amount of params */
if (ops) {
va_list params;
@ -626,7 +655,7 @@ static void gen_call_function(void * func,char * ops,...) {
release=true;
goto scanagain;
default:
IllegalOption();
IllegalOption("gen_call_function param:DREG");
}
if (release) gen_releasereg(dynreg);
}
@ -635,8 +664,11 @@ static void gen_call_function(void * func,char * ops,...) {
retparam =&pinfo[pindex];
pinfo[pindex].line=scan;
break;
case 'F': /* Release flags from stack */
release_flags=true;
break;
default:
IllegalOption();
IllegalOption("gen_call_function unknown param");
}
}
}
@ -649,12 +681,16 @@ static void gen_call_function(void * func,char * ops,...) {
/* Restore the params of the stack */
if (paramcount) {
cache_addw(0xc483); //add ESP,imm byte
cache_addb(paramcount*4);
cache_addb(paramcount*4+(release_flags?4:0));
} else if (release_flags) {
cache_addw(0xc483); //add ESP,imm byte
cache_addb(4);
}
/* Save the return value in correct register */
if (retparam) {
DynReg * dynreg=(DynReg *)retparam->value;
GenReg * genreg=FindDynReg(dynreg);
if (genreg->index) // test for (e)ax/al
switch (*retparam->line) {
case 'd':
cache_addw(0xc08b+(genreg->index <<(8+3))); //mov reg,eax
@ -676,10 +712,47 @@ static void gen_call_function(void * func,char * ops,...) {
x86gen.regs[X86_REG_EAX]->notusable=false;
}
static void gen_call_write(DynReg * dr,Bit32u val,Bitu write_size) {
/* Clear the EAX Genreg for usage */
x86gen.regs[X86_REG_EAX]->Clear();
x86gen.regs[X86_REG_EAX]->notusable=true;
gen_protectflags();
cache_addb(0x68); //PUSH val
cache_addd(val);
GenReg * genreg=FindDynReg(dr);
cache_addb(0x50+genreg->index); //PUSH reg
/* Clear some unprotected registers */
x86gen.regs[X86_REG_ECX]->Clear();
x86gen.regs[X86_REG_EDX]->Clear();
/* Do the actual call to the procedure */
cache_addb(0xe8);
#ifdef CHECKED_MEMORY_ACCESS
switch (write_size) {
case 1: cache_addd((Bit32u)mem_writeb_checked_x86 - (Bit32u)cache.pos-4); break;
case 2: cache_addd((Bit32u)mem_writew_checked_x86 - (Bit32u)cache.pos-4); break;
case 4: cache_addd((Bit32u)mem_writed_checked_x86 - (Bit32u)cache.pos-4); break;
default: IllegalOption("gen_call_write");
}
#else
switch (write_size) {
case 1: cache_addd((Bit32u)mem_writeb - (Bit32u)cache.pos-4); break;
case 2: cache_addd((Bit32u)mem_writew_dyncorex86 - (Bit32u)cache.pos-4); break;
case 4: cache_addd((Bit32u)mem_writed_dyncorex86 - (Bit32u)cache.pos-4); break;
default: IllegalOption("gen_call_write");
}
#endif
cache_addw(0xc483); //ADD ESP,8
cache_addb(2*4);
x86gen.regs[X86_REG_EAX]->notusable=false;
gen_releasereg(dr);
}
static Bit8u * gen_create_branch(BranchTypes type) {
/* First free all registers */
cache_addb(0x70+type);
cache_addb(0);
cache_addw(0x70+type);
return (cache.pos-1);
}
@ -692,6 +765,16 @@ static void gen_fill_branch(Bit8u * data,Bit8u * from=cache.pos) {
*data=(from-data-1);
}
static Bit8u * gen_create_branch_long(BranchTypes type) {
cache_addw(0x800f+(type<<8));
cache_addd(0);
return (cache.pos-4);
}
static void gen_fill_branch_long(Bit8u * data,Bit8u * from=cache.pos) {
*(Bit32u*)data=(from-data-4);
}
static Bit8u * gen_create_jump(Bit8u * to=0) {
/* First free all registers */
cache_addb(0xe9);
@ -720,7 +803,7 @@ static void gen_jmp_ptr(void * ptr,Bits imm=0) {
}
static void gen_save_flags(DynReg * dynreg) {
if (x86gen.flagsactive) IllegalOption();
if (GCC_UNLIKELY(x86gen.flagsactive)) IllegalOption("gen_save_flags");
GenReg * genreg=FindDynReg(dynreg);
cache_addb(0x8b); //MOV REG,[esp]
cache_addw(0x2404+(genreg->index << 3));
@ -728,7 +811,7 @@ static void gen_save_flags(DynReg * dynreg) {
}
static void gen_load_flags(DynReg * dynreg) {
if (x86gen.flagsactive) IllegalOption();
if (GCC_UNLIKELY(x86gen.flagsactive)) IllegalOption("gen_load_flags");
cache_addw(0xc483); //ADD ESP,4
cache_addb(0x4);
GenReg * genreg=FindDynReg(dynreg);
@ -748,29 +831,62 @@ static void gen_load_host(void * data,DynReg * dr1,Bitu size) {
case 2:cache_addw(0xb70f);break; //movzx word
case 4:cache_addb(0x8b);break; //mov
default:
IllegalOption();
IllegalOption("gen_load_host");
}
cache_addb(0x5+(gr1->index<<3));
cache_addd((Bit32u)data);
dr1->flags|=DYNFLG_CHANGED;
}
static void gen_mov_host(void * data,DynReg * dr1,Bitu size,Bit8u di1=0) {
GenReg * gr1=FindDynReg(dr1);
switch (size) {
case 1:cache_addb(0x8a);break; //mov byte
case 2:cache_addb(0x66); //mov word
case 4:cache_addb(0x8b);break; //mov
default:
IllegalOption("gen_load_host");
}
cache_addb(0x5+((gr1->index+(di1?4:0))<<3));
cache_addd((Bit32u)data);
dr1->flags|=DYNFLG_CHANGED;
}
static void gen_return(BlockReturn retcode) {
gen_protectflags();
cache_addb(0x59); //POP ECX, the flags
cache_addb(0xb8); //MOV EAX, retcode
cache_addd(retcode);
if (retcode==0) cache_addw(0xc033); //MOV EAX, 0
else {
cache_addb(0xb8); //MOV EAX, retcode
cache_addd(retcode);
}
cache_addb(0xc3); //RET
}
static void gen_return_fast(BlockReturn retcode,bool ret_exception=false) {
if (GCC_UNLIKELY(x86gen.flagsactive)) IllegalOption("gen_return_fast");
cache_addw(0x0d8b); //MOV ECX, the flags
cache_addd((Bit32u)&cpu_regs.flags);
if (!ret_exception) {
cache_addw(0xc483); //ADD ESP,4
cache_addb(0x4);
if (retcode==0) cache_addw(0xc033); //MOV EAX, 0
else {
cache_addb(0xb8); //MOV EAX, retcode
cache_addd(retcode);
}
}
cache_addb(0xc3); //RET
}
static void gen_init(void) {
x86gen.regs[X86_REG_EAX]=new GenReg(0,false);
x86gen.regs[X86_REG_ECX]=new GenReg(1,false);
x86gen.regs[X86_REG_EDX]=new GenReg(2,false);
x86gen.regs[X86_REG_EBX]=new GenReg(3,true);
x86gen.regs[X86_REG_EBP]=new GenReg(5,true);
x86gen.regs[X86_REG_ESI]=new GenReg(6,true);
x86gen.regs[X86_REG_EDI]=new GenReg(7,true);
x86gen.regs[X86_REG_EAX]=new GenReg(0);
x86gen.regs[X86_REG_ECX]=new GenReg(1);
x86gen.regs[X86_REG_EDX]=new GenReg(2);
x86gen.regs[X86_REG_EBX]=new GenReg(3);
x86gen.regs[X86_REG_EBP]=new GenReg(5);
x86gen.regs[X86_REG_ESI]=new GenReg(6);
x86gen.regs[X86_REG_EDI]=new GenReg(7);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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
@ -51,7 +51,7 @@ static void dyn_string(STRING_OP op) {
case STR_INSB: case STR_INSW: case STR_INSD:
tmp_reg=DREG(TMPB);usesi=false;usedi=true;break;
default:
IllegalOption();
IllegalOption("dyn_string op");
}
gen_load_host(&cpu.direction,DREG(TMPW),4);
switch (op & 3) {
@ -59,7 +59,7 @@ static void dyn_string(STRING_OP op) {
case 1:gen_shift_word_imm(SHIFT_SHL,true,DREG(TMPW),1);break;
case 2:gen_shift_word_imm(SHIFT_SHL,true,DREG(TMPW),2);break;
default:
IllegalOption();
IllegalOption("dyn_string shift");
}
if (usesi) {
@ -80,13 +80,10 @@ static void dyn_string(STRING_OP op) {
dyn_savestate(&rep_state);
Bit8u * rep_start=cache.pos;
Bit8u * rep_ecx_jmp;
/* Check if ECX!=zero and decrease it */
/* Check if ECX!=zero */
if (decode.rep) {
gen_dop_word(DOP_OR,decode.big_addr,DREG(ECX),DREG(ECX));
Bit8u * branch_ecx=gen_create_branch(BR_NZ);
rep_ecx_jmp=gen_create_jump();
gen_fill_branch(branch_ecx);
gen_sop_word(SOP_DEC,decode.big_addr,DREG(ECX));
rep_ecx_jmp=gen_create_branch_long(BR_Z);
}
if (usesi) {
if (!decode.big_addr) {
@ -95,7 +92,6 @@ static void dyn_string(STRING_OP op) {
} else {
gen_lea(DREG(EA),si_base,DREG(ESI),0,0);
}
gen_dop_word(DOP_ADD,decode.big_addr,DREG(ESI),DREG(TMPW));
switch (op&3) {
case 0:dyn_read_byte(DREG(EA),tmp_reg,false);break;
case 1:dyn_read_word(DREG(EA),tmp_reg,false);break;
@ -117,7 +113,6 @@ static void dyn_string(STRING_OP op) {
} else {
gen_lea(DREG(EA),di_base,DREG(EDI),0,0);
}
gen_dop_word(DOP_ADD,decode.big_addr,DREG(EDI),DREG(TMPW));
/* Maybe something special to be done to fill the value */
switch (op) {
case STR_INSB:
@ -139,25 +134,31 @@ static void dyn_string(STRING_OP op) {
dyn_write_word(DREG(EA),tmp_reg,true);
break;
default:
IllegalOption();
IllegalOption("dyn_string op");
}
}
gen_releasereg(DREG(EA));gen_releasereg(DREG(TMPB));
/* update registers */
if (usesi) gen_dop_word(DOP_ADD,decode.big_addr,DREG(ESI),DREG(TMPW));
if (usedi) gen_dop_word(DOP_ADD,decode.big_addr,DREG(EDI),DREG(TMPW));
if (decode.rep) {
DynState cycle_state;
gen_sop_word(SOP_DEC,decode.big_addr,DREG(ECX));
gen_sop_word(SOP_DEC,true,DREG(CYCLES));
gen_releasereg(DREG(CYCLES));
dyn_savestate(&cycle_state);
Bit8u * cycle_branch=gen_create_branch(BR_NLE);
gen_dop_word_imm(DOP_ADD,decode.big_op,DREG(EIP),decode.op_start-decode.code_start);
dyn_save_critical_regs();
gen_return(BR_Cycles);
gen_fill_branch(cycle_branch);
dyn_loadstate(&cycle_state);
dyn_synchstate(&rep_state);
dyn_savestate(&save_info[used_save_info].state);
save_info[used_save_info].branch_pos=gen_create_branch_long(BR_LE);
save_info[used_save_info].eip_change=decode.op_start-decode.code_start;
save_info[used_save_info].type=normal;
used_save_info++;
/* Jump back to start of ECX check */
dyn_synchstate(&rep_state);
gen_create_jump(rep_start);
gen_fill_jump(rep_ecx_jmp);
dyn_loadstate(&rep_state);
gen_fill_branch_long(rep_ecx_jmp);
}
gen_releasereg(DREG(TMPW));
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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
@ -86,7 +86,7 @@ nextopcode:;
SaveIP();
continue;
illegalopcode:
LOG_MSG("Illegal opcode");
LOG(LOG_CPU,LOG_NORMAL)("Illegal opcode");
CPU_Exception(0x6,0);
}
FillFlags();

View File

@ -1,8 +1,8 @@
# Makefile.in generated by automake 1.9.3 from Makefile.am.
# Makefile.in generated by automake 1.9.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004 Free Software Foundation, Inc.
# 2003, 2004, 2005 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.
@ -80,6 +80,8 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
HAVE_WINDRES_FALSE = @HAVE_WINDRES_FALSE@
HAVE_WINDRES_TRUE = @HAVE_WINDRES_TRUE@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
@ -105,10 +107,12 @@ SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
WINDRES = @WINDRES@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
ac_ct_WINDRES = @ac_ct_WINDRES@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@

View File

@ -1,10 +1,10 @@
switch (inst.code.load) {
/* General loading */
case L_POPwRM:
inst.op1.w = Pop_16();
inst_op1_w = Pop_16();
goto case_L_MODRM;
case L_POPdRM:
inst.op1.d = Pop_32();
inst_op1_d = Pop_32();
goto case_L_MODRM;
case_L_MODRM:
case L_MODRM:
@ -21,160 +21,160 @@ l_MODRMswitch:
switch (inst.code.extra) {
/* Byte */
case M_Ib:
inst.op1.d=Fetchb();
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);
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();
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);
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);
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);
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);;
inst_op1_d=reg_8(inst.rm_index);;
break;
/* Word */
case M_Iw:
inst.op1.d=Fetchw();
inst_op1_d=Fetchw();
break;
case M_EwxGwx:
inst.op2.ds=(Bit16s)reg_16(inst.rm_index);
inst_op2_ds=(Bit16s)reg_16(inst.rm_index);
goto l_M_Ewx;
case M_EwxIbx:
inst.op2.ds=Fetchbs();
inst_op2_ds=Fetchbs();
goto l_M_Ewx;
case M_EwxIwx:
inst.op2.ds=Fetchws();
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);
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_EwIb:
inst.op2.d=Fetchb();
inst_op2_d=Fetchb();
goto l_M_Ew;
case M_EwIbx:
inst.op2.ds=Fetchbs();
inst_op2_ds=Fetchbs();
goto l_M_Ew;
case M_EwIw:
inst.op2.d=Fetchw();
inst_op2_d=Fetchw();
goto l_M_Ew;
case M_EwGwCL:
inst.imm.d=reg_cl;
inst_imm_d=reg_cl;
goto l_M_EwGw;
case M_EwGwIb:
inst.imm.d=Fetchb();
inst_imm_d=Fetchb();
goto l_M_EwGw;
case M_EwGwt:
inst.op2.d=reg_16(inst.rm_index);
inst.rm_eaa+=((Bit16s)inst.op2.d >> 4) * 2;
inst_op2_d=reg_16(inst.rm_index);
inst.rm_eaa+=((Bit16s)inst_op2_d >> 4) * 2;
goto l_M_Ew;
l_M_EwGw:
case M_EwGw:
inst.op2.d=reg_16(inst.rm_index);
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);
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);
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);;
inst_op1_d=reg_16(inst.rm_index);;
break;
/* DWord */
case M_Id:
inst.op1.d=Fetchd();
inst_op1_d=Fetchd();
break;
case M_EdxGdx:
inst.op2.ds=(Bit32s)reg_32(inst.rm_index);
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);
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_EdIb:
inst.op2.d=Fetchb();
inst_op2_d=Fetchb();
goto l_M_Ed;
case M_EdIbx:
inst.op2.ds=Fetchbs();
inst_op2_ds=Fetchbs();
goto l_M_Ed;
case M_EdId:
inst.op2.d=Fetchd();
inst_op2_d=Fetchd();
goto l_M_Ed;
case M_EdGdCL:
inst.imm.d=reg_cl;
inst_imm_d=reg_cl;
goto l_M_EdGd;
case M_EdGdt:
inst.op2.d=reg_32(inst.rm_index);
inst.rm_eaa+=((Bit32s)inst.op2.d >> 5) * 4;
inst_op2_d=reg_32(inst.rm_index);
inst.rm_eaa+=((Bit32s)inst_op2_d >> 5) * 4;
goto l_M_Ed;
case M_EdGdIb:
inst.imm.d=Fetchb();
inst_imm_d=Fetchb();
goto l_M_EdGd;
l_M_EdGd:
case M_EdGd:
inst.op2.d=reg_32(inst.rm_index);
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);
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);
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);
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);
inst_op1_d=SegValue((SegNames)inst.rm_index);
break;
case M_Efw:
if (inst.rm>=0xc0) goto illegalopcode;
inst.op1.d=LoadMw(inst.rm_eaa);
inst.op2.d=LoadMw(inst.rm_eaa+2);
inst_op1_d=LoadMw(inst.rm_eaa);
inst_op2_d=LoadMw(inst.rm_eaa+2);
break;
case M_Efd:
if (inst.rm>=0xc0) goto illegalopcode;
inst.op1.d=LoadMd(inst.rm_eaa);
inst.op2.d=LoadMw(inst.rm_eaa+4);
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;
inst_op1_d=inst.rm_off;
break;
case M_POPw:
inst.op1.d = Pop_16();
inst_op1_d = Pop_16();
break;
case M_POPd:
inst.op1.d = Pop_32();
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_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_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_op2_d=1;
inst.code=Groups[inst.code.op][inst.rm_index];
goto l_MODRMswitch;
case 0:
@ -185,61 +185,61 @@ l_M_Ed:
}
break;
case L_POPw:
inst.op1.d = Pop_16();
inst_op1_d = Pop_16();
break;
case L_POPd:
inst.op1.d = Pop_32();
inst_op1_d = Pop_32();
break;
case L_POPfw:
inst.op1.d = Pop_16();
inst.op2.d = Pop_16();
inst_op1_d = Pop_16();
inst_op2_d = Pop_16();
break;
case L_POPfd:
inst.op1.d = Pop_32();
inst.op2.d = Pop_16();
inst_op1_d = Pop_32();
inst_op2_d = Pop_16();
break;
case L_Ib:
inst.op1.d=Fetchb();
inst_op1_d=Fetchb();
break;
case L_Ibx:
inst.op1.ds=Fetchbs();
inst_op1_ds=Fetchbs();
break;
case L_Iw:
inst.op1.d=Fetchw();
inst_op1_d=Fetchw();
break;
case L_Iwx:
inst.op1.ds=Fetchws();
inst_op1_ds=Fetchws();
break;
case L_Idx:
case L_Id:
inst.op1.d=Fetchd();
inst_op1_d=Fetchd();
break;
case L_Ifw:
inst.op1.d=Fetchw();
inst.op2.d=Fetchw();
inst_op1_d=Fetchw();
inst_op2_d=Fetchw();
break;
case L_Ifd:
inst.op1.d=Fetchd();
inst.op2.d=Fetchw();
inst_op1_d=Fetchd();
inst_op2_d=Fetchw();
break;
/* Direct load of registers */
case L_REGbIb:
inst.op2.d=Fetchb();
inst_op2_d=Fetchb();
case L_REGb:
inst.op1.d=reg_8(inst.code.extra);
inst_op1_d=reg_8(inst.code.extra);
break;
case L_REGwIw:
inst.op2.d=Fetchw();
inst_op2_d=Fetchw();
case L_REGw:
inst.op1.d=reg_16(inst.code.extra);
inst_op1_d=reg_16(inst.code.extra);
break;
case L_REGdId:
inst.op2.d=Fetchd();
inst_op2_d=Fetchd();
case L_REGd:
inst.op1.d=reg_32(inst.code.extra);
inst_op1_d=reg_32(inst.code.extra);
break;
case L_SEG:
inst.op1.d=SegValue((SegNames)inst.code.extra);
inst_op1_d=SegValue((SegNames)inst.code.extra);
break;
/* Depending on addressize */
case L_OP:
@ -277,11 +277,11 @@ l_M_Ed:
inst.prefix=(inst.prefix & ~1) | (cpu.code.big ^ 1);
goto restartopcode;
case L_VAL:
inst.op1.d=inst.code.extra;
inst_op1_d=inst.code.extra;
break;
case L_INTO:
if (!get_OF()) goto nextopcode;
inst.op1.d=4;
inst_op1_d=4;
break;
case D_IRETw:
FillFlags();
@ -428,6 +428,10 @@ l_M_Ed:
case D_WAIT:
case D_NOP:
goto nextopcode;
case D_LOCK: /* FIXME: according to intel, LOCK should raise an exception if it's not followed by one of a small set of instructions;
probably doesn't matter for our purposes as it is a pentium prefix anyhow */
LOG(LOG_CPU,LOG_NORMAL)("CPU:LOCK");
goto nextopcode;
case D_ENTERw:
{
Bitu bytes=Fetchw();
@ -468,12 +472,18 @@ l_M_Ed:
CPU_CPUID();
goto nextopcode;
case D_HLT:
if (cpu.pmode && cpu.cpl) EXCEPTION(EXCEPTION_GP);
FillFlags();
CPU_HLT(GetIP());
return CBRET_NONE;
case D_CLTS:
//TODO Really clear it sometime
if (cpu.pmode && cpu.cpl) goto illegalopcode;
cpu.cr0&=(~CR0_TASKSWITCH);
goto nextopcode;
case D_ICEBP:
FillFlags();
CPU_SW_Interrupt_NoIOPLCheck(1,GetIP());
continue;
default:
LOG(LOG_CPU,LOG_ERROR)("LOAD:Unhandled code %d opcode %X",inst.code.load,inst.entry);
goto illegalopcode;

View File

@ -1,223 +1,223 @@
/* Do the actual opcode */
switch (inst.code.op) {
case t_ADDb: case t_ADDw: case t_ADDd:
lf_var1d=inst.op1.d;
lf_var2d=inst.op2.d;
inst.op1.d=lf_resd=lf_var1d + lf_var2d;
lf_var1d=inst_op1_d;
lf_var2d=inst_op2_d;
inst_op1_d=lf_resd=lf_var1d + lf_var2d;
lflags.type=inst.code.op;
break;
case t_CMPb: case t_CMPw: case t_CMPd:
case t_SUBb: case t_SUBw: case t_SUBd:
lf_var1d=inst.op1.d;
lf_var2d=inst.op2.d;
inst.op1.d=lf_resd=lf_var1d - lf_var2d;
lf_var1d=inst_op1_d;
lf_var2d=inst_op2_d;
inst_op1_d=lf_resd=lf_var1d - lf_var2d;
lflags.type=inst.code.op;
break;
case t_ORb: case t_ORw: case t_ORd:
lf_var1d=inst.op1.d;
lf_var2d=inst.op2.d;
inst.op1.d=lf_resd=lf_var1d | lf_var2d;
lf_var1d=inst_op1_d;
lf_var2d=inst_op2_d;
inst_op1_d=lf_resd=lf_var1d | lf_var2d;
lflags.type=inst.code.op;
break;
case t_XORb: case t_XORw: case t_XORd:
lf_var1d=inst.op1.d;
lf_var2d=inst.op2.d;
inst.op1.d=lf_resd=lf_var1d ^ lf_var2d;
lf_var1d=inst_op1_d;
lf_var2d=inst_op2_d;
inst_op1_d=lf_resd=lf_var1d ^ lf_var2d;
lflags.type=inst.code.op;
break;
case t_TESTb: case t_TESTw: case t_TESTd:
case t_ANDb: case t_ANDw: case t_ANDd:
lf_var1d=inst.op1.d;
lf_var2d=inst.op2.d;
inst.op1.d=lf_resd=lf_var1d & lf_var2d;
lf_var1d=inst_op1_d;
lf_var2d=inst_op2_d;
inst_op1_d=lf_resd=lf_var1d & lf_var2d;
lflags.type=inst.code.op;
break;
case t_ADCb: case t_ADCw: case t_ADCd:
lflags.oldcf=(get_CF()!=0);
lf_var1d=inst.op1.d;
lf_var2d=inst.op2.d;
inst.op1.d=lf_resd=lf_var1d + lf_var2d + lflags.oldcf;
lf_var1d=inst_op1_d;
lf_var2d=inst_op2_d;
inst_op1_d=lf_resd=lf_var1d + lf_var2d + lflags.oldcf;
lflags.type=inst.code.op;
break;
case t_SBBb: case t_SBBw: case t_SBBd:
lflags.oldcf=(get_CF()!=0);
lf_var1d=inst.op1.d;
lf_var2d=inst.op2.d;
inst.op1.d=lf_resd=lf_var1d - lf_var2d - lflags.oldcf;
lf_var1d=inst_op1_d;
lf_var2d=inst_op2_d;
inst_op1_d=lf_resd=lf_var1d - lf_var2d - lflags.oldcf;
lflags.type=inst.code.op;
break;
case t_INCb: case t_INCw: case t_INCd:
LoadCF;
lf_var1d=inst.op1.d;
inst.op1.d=lf_resd=inst.op1.d+1;
lf_var1d=inst_op1_d;
inst_op1_d=lf_resd=inst_op1_d+1;
lflags.type=inst.code.op;
break;
case t_DECb: case t_DECw: case t_DECd:
LoadCF;
lf_var1d=inst.op1.d;
inst.op1.d=lf_resd=inst.op1.d-1;
lf_var1d=inst_op1_d;
inst_op1_d=lf_resd=inst_op1_d-1;
lflags.type=inst.code.op;
break;
/* Using the instructions.h defines */
case t_ROLb:
ROLB(inst.op1.b,inst.op2.b,LoadD,SaveD);
ROLB(inst_op1_b,inst_op2_b,LoadD,SaveD);
break;
case t_ROLw:
ROLW(inst.op1.w,inst.op2.b,LoadD,SaveD);
ROLW(inst_op1_w,inst_op2_b,LoadD,SaveD);
break;
case t_ROLd:
ROLD(inst.op1.d,inst.op2.b,LoadD,SaveD);
ROLD(inst_op1_d,inst_op2_b,LoadD,SaveD);
break;
case t_RORb:
RORB(inst.op1.b,inst.op2.b,LoadD,SaveD);
RORB(inst_op1_b,inst_op2_b,LoadD,SaveD);
break;
case t_RORw:
RORW(inst.op1.w,inst.op2.b,LoadD,SaveD);
RORW(inst_op1_w,inst_op2_b,LoadD,SaveD);
break;
case t_RORd:
RORD(inst.op1.d,inst.op2.b,LoadD,SaveD);
RORD(inst_op1_d,inst_op2_b,LoadD,SaveD);
break;
case t_RCLb:
RCLB(inst.op1.b,inst.op2.b,LoadD,SaveD);
RCLB(inst_op1_b,inst_op2_b,LoadD,SaveD);
break;
case t_RCLw:
RCLW(inst.op1.w,inst.op2.b,LoadD,SaveD);
RCLW(inst_op1_w,inst_op2_b,LoadD,SaveD);
break;
case t_RCLd:
RCLD(inst.op1.d,inst.op2.b,LoadD,SaveD);
RCLD(inst_op1_d,inst_op2_b,LoadD,SaveD);
break;
case t_RCRb:
RCRB(inst.op1.b,inst.op2.b,LoadD,SaveD);
RCRB(inst_op1_b,inst_op2_b,LoadD,SaveD);
break;
case t_RCRw:
RCRW(inst.op1.w,inst.op2.b,LoadD,SaveD);
RCRW(inst_op1_w,inst_op2_b,LoadD,SaveD);
break;
case t_RCRd:
RCRD(inst.op1.d,inst.op2.b,LoadD,SaveD);
RCRD(inst_op1_d,inst_op2_b,LoadD,SaveD);
break;
case t_SHLb:
SHLB(inst.op1.b,inst.op2.b,LoadD,SaveD);
SHLB(inst_op1_b,inst_op2_b,LoadD,SaveD);
break;
case t_SHLw:
SHLW(inst.op1.w,inst.op2.b,LoadD,SaveD);
SHLW(inst_op1_w,inst_op2_b,LoadD,SaveD);
break;
case t_SHLd:
SHLD(inst.op1.d,inst.op2.b,LoadD,SaveD);
SHLD(inst_op1_d,inst_op2_b,LoadD,SaveD);
break;
case t_SHRb:
SHRB(inst.op1.b,inst.op2.b,LoadD,SaveD);
SHRB(inst_op1_b,inst_op2_b,LoadD,SaveD);
break;
case t_SHRw:
SHRW(inst.op1.w,inst.op2.b,LoadD,SaveD);
SHRW(inst_op1_w,inst_op2_b,LoadD,SaveD);
break;
case t_SHRd:
SHRD(inst.op1.d,inst.op2.b,LoadD,SaveD);
SHRD(inst_op1_d,inst_op2_b,LoadD,SaveD);
break;
case t_SARb:
SARB(inst.op1.b,inst.op2.b,LoadD,SaveD);
SARB(inst_op1_b,inst_op2_b,LoadD,SaveD);
break;
case t_SARw:
SARW(inst.op1.w,inst.op2.b,LoadD,SaveD);
SARW(inst_op1_w,inst_op2_b,LoadD,SaveD);
break;
case t_SARd:
SARD(inst.op1.d,inst.op2.b,LoadD,SaveD);
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);
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);
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);
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);
DSHRD(inst_op1_d,inst_op2_d,inst_imm_b,LoadD,SaveD);
break;
}
case t_NEGb:
lf_var1b=inst.op1.b;
inst.op1.b=lf_resb=0-inst.op1.b;
lf_var1b=inst_op1_b;
inst_op1_b=lf_resb=0-inst_op1_b;
lflags.type=t_NEGb;
break;
case t_NEGw:
lf_var1w=inst.op1.w;
inst.op1.w=lf_resw=0-inst.op1.w;
lf_var1w=inst_op1_w;
inst_op1_w=lf_resw=0-inst_op1_w;
lflags.type=t_NEGw;
break;
case t_NEGd:
lf_var1d=inst.op1.d;
inst.op1.d=lf_resd=0-inst.op1.d;
lf_var1d=inst_op1_d;
inst_op1_d=lf_resd=0-inst_op1_d;
lflags.type=t_NEGd;
break;
case O_NOT:
inst.op1.d=~inst.op1.d;
inst_op1_d=~inst_op1_d;
break;
/* Special instructions */
case O_IMULRw:
DIMULW(inst.op1.ws,inst.op1.ws,inst.op2.ws,LoadD,SaveD);
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);
DIMULD(inst_op1_ds,inst_op1_ds,inst_op2_ds,LoadD,SaveD);
break;
case O_MULb:
MULB(inst.op1.b,LoadD,0);
MULB(inst_op1_b,LoadD,0);
goto nextopcode;
case O_MULw:
MULW(inst.op1.w,LoadD,0);
MULW(inst_op1_w,LoadD,0);
goto nextopcode;
case O_MULd:
MULD(inst.op1.d,LoadD,0);
MULD(inst_op1_d,LoadD,0);
goto nextopcode;
case O_IMULb:
IMULB(inst.op1.b,LoadD,0);
IMULB(inst_op1_b,LoadD,0);
goto nextopcode;
case O_IMULw:
IMULW(inst.op1.w,LoadD,0);
IMULW(inst_op1_w,LoadD,0);
goto nextopcode;
case O_IMULd:
IMULD(inst.op1.d,LoadD,0);
IMULD(inst_op1_d,LoadD,0);
goto nextopcode;
case O_DIVb:
DIVB(inst.op1.b,LoadD,0);
DIVB(inst_op1_b,LoadD,0);
goto nextopcode;
case O_DIVw:
DIVW(inst.op1.w,LoadD,0);
DIVW(inst_op1_w,LoadD,0);
goto nextopcode;
case O_DIVd:
DIVD(inst.op1.d,LoadD,0);
DIVD(inst_op1_d,LoadD,0);
goto nextopcode;
case O_IDIVb:
IDIVB(inst.op1.b,LoadD,0);
IDIVB(inst_op1_b,LoadD,0);
goto nextopcode;
case O_IDIVw:
IDIVW(inst.op1.w,LoadD,0);
IDIVW(inst_op1_w,LoadD,0);
goto nextopcode;
case O_IDIVd:
IDIVD(inst.op1.d,LoadD,0);
IDIVD(inst_op1_d,LoadD,0);
goto nextopcode;
case O_AAM:
AAM(inst.op1.b);
AAM(inst_op1_b);
goto nextopcode;
case O_AAD:
AAD(inst.op1.b);
AAD(inst_op1_b);
goto nextopcode;
case O_C_O: inst.cond=TFLG_O; break;
@ -302,15 +302,15 @@ switch (inst.code.op) {
case O_XCHG_AX:
{
Bit16u temp=reg_ax;
reg_ax=inst.op1.w;
inst.op1.w=temp;
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;
reg_eax=inst_op1_d;
inst_op1_d=temp;
break;
}
case O_CALLNw:
@ -323,90 +323,94 @@ switch (inst.code.op) {
break;
case O_CALLFw:
FillFlags();
CPU_CALL(false,inst.op2.d,inst.op1.d,GetIP());
CPU_CALL(false,inst_op2_d,inst_op1_d,GetIP());
continue;
case O_CALLFd:
FillFlags();
CPU_CALL(true,inst.op2.d,inst.op1.d,GetIP());
CPU_CALL(true,inst_op2_d,inst_op1_d,GetIP());
continue;
case O_JMPFw:
FillFlags();
CPU_JMP(false,inst.op2.d,inst.op1.d,GetIP());
CPU_JMP(false,inst_op2_d,inst_op1_d,GetIP());
continue;
case O_JMPFd:
FillFlags();
CPU_JMP(true,inst.op2.d,inst.op1.d,GetIP());
CPU_JMP(true,inst_op2_d,inst_op1_d,GetIP());
continue;
case O_INT:
FillFlags();
#if C_DEBUG
if (((inst.entry & 0xFF)==0xcc) && DEBUG_Breakpoint())
return debugCallback;
else if (DEBUG_IntBreakpoint(inst.op1.b))
else if (DEBUG_IntBreakpoint(inst_op1_b))
return debugCallback;
#endif
CPU_SW_Interrupt(inst.op1.b,GetIP());
CPU_SW_Interrupt(inst_op1_b,GetIP());
continue;
case O_INb:
if (CPU_IO_Exception(inst.op1.d,1)) RunException();
reg_al=IO_ReadB(inst.op1.d);
if (CPU_IO_Exception(inst_op1_d,1)) RunException();
reg_al=IO_ReadB(inst_op1_d);
goto nextopcode;
case O_INw:
if (CPU_IO_Exception(inst.op1.d,2)) RunException();
reg_ax=IO_ReadW(inst.op1.d);
if (CPU_IO_Exception(inst_op1_d,2)) RunException();
reg_ax=IO_ReadW(inst_op1_d);
goto nextopcode;
case O_INd:
if (CPU_IO_Exception(inst.op1.d,4)) RunException();
reg_eax=IO_ReadD(inst.op1.d);
if (CPU_IO_Exception(inst_op1_d,4)) RunException();
reg_eax=IO_ReadD(inst_op1_d);
goto nextopcode;
case O_OUTb:
if (CPU_IO_Exception(inst.op1.d,1)) RunException();
IO_WriteB(inst.op1.d,reg_al);
if (CPU_IO_Exception(inst_op1_d,1)) RunException();
IO_WriteB(inst_op1_d,reg_al);
goto nextopcode;
case O_OUTw:
if (CPU_IO_Exception(inst.op1.d,2)) RunException();
IO_WriteW(inst.op1.d,reg_ax);
if (CPU_IO_Exception(inst_op1_d,2)) RunException();
IO_WriteW(inst_op1_d,reg_ax);
goto nextopcode;
case O_OUTd:
if (CPU_IO_Exception(inst.op1.d,4)) RunException();
IO_WriteD(inst.op1.d,reg_eax);
if (CPU_IO_Exception(inst_op1_d,4)) RunException();
IO_WriteD(inst_op1_d,reg_eax);
goto nextopcode;
case O_CBACK:
FillFlags();SaveIP();
return inst.op1.d;
return inst_op1_d;
case O_GRP6w:
case O_GRP6d:
if ((reg_flags & FLAG_VM) || (!cpu.pmode)) goto illegalopcode;
switch (inst.rm_index) {
case 0x00: /* SLDT */
{
Bitu selector;
CPU_SLDT(selector);
inst.op1.d=(Bit32u)selector;
inst_op1_d=(Bit32u)selector;
}
break;
case 0x01: /* STR */
{
Bitu selector;
CPU_STR(selector);
inst.op1.d=(Bit32u)selector;
inst_op1_d=(Bit32u)selector;
}
break;
case 0x02: /* LLDT */
CPU_LLDT(inst.op1.d);
if (cpu.cpl) EXCEPTION(EXCEPTION_GP);
if (CPU_LLDT(inst_op1_d)) RunException();
goto nextopcode; /* Else value will saved */
case 0x03: /* LTR */
CPU_LTR(inst.op1.d);
if (cpu.cpl) EXCEPTION(EXCEPTION_GP);
if (CPU_LTR(inst_op1_d)) RunException();
goto nextopcode; /* Else value will saved */
case 0x04: /* VERR */
FillFlags();
CPU_VERR(inst.op1.d);
CPU_VERR(inst_op1_d);
goto nextopcode; /* Else value will saved */
case 0x05: /* VERW */
FillFlags();
CPU_VERW(inst.op1.d);
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);
goto illegalopcode;
}
break;
case O_GRP7w:
@ -429,76 +433,80 @@ switch (inst.code.op) {
goto nextopcode;
}
case 2: /* LGDT */
if (cpu.pmode && cpu.cpl) EXCEPTION(EXCEPTION_GP);
CPU_LGDT(LoadMw(inst.rm_eaa),LoadMd(inst.rm_eaa+2)&((inst.code.op == O_GRP7w) ? 0xFFFFFF : 0xFFFFFFFF));
goto nextopcode;
case 3: /* LIDT */
if (cpu.pmode && cpu.cpl) EXCEPTION(EXCEPTION_GP);
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;
inst_op1_d=word;
break;
}
case 6: /* LMSW */
FillFlags();
CPU_LMSW(inst.op1.w);
if (CPU_LMSW(inst_op1_w)) RunException();
goto nextopcode;
default:
LOG(LOG_CPU,LOG_ERROR)("Group 7 Illegal subfunction %X",inst.rm_index);
goto illegalopcode;
}
break;
case O_M_CRx_Rd:
CPU_SET_CRX(inst.rm_index,inst.op1.d);
if (CPU_WRITE_CRX(inst.rm_index,inst_op1_d)) RunException();
break;
case O_M_Rd_CRx:
inst.op1.d=CPU_GET_CRX(inst.rm_index);
if (CPU_READ_CRX(inst.rm_index,inst_op1_d)) RunException();
break;
case O_M_DRx_Rd:
// LOG(LOG_CPU,LOG_NORMAL)("MOV DR%d,%X",inst.rm_index,inst.op1.d);
if (CPU_WRITE_DRX(inst.rm_index,inst_op1_d)) RunException();
break;
case O_M_Rd_DRx:
inst.op1.d=0;
// LOG(LOG_CPU,LOG_NORMAL)("MOV %X,DR%d",inst.op1.d,inst.rm_index);
if (CPU_READ_DRX(inst.rm_index,inst_op1_d)) RunException();
break;
case O_LAR:
{
if ((reg_flags & FLAG_VM) || (!cpu.pmode)) goto illegalopcode;
FillFlags();
Bitu ar=inst.op2.d;
CPU_LAR(inst.op1.w,ar);
inst.op1.d=(Bit32u)ar;
Bitu ar=inst_op2_d;
CPU_LAR(inst_op1_w,ar);
inst_op1_d=(Bit32u)ar;
}
break;
case O_LSL:
{
if ((reg_flags & FLAG_VM) || (!cpu.pmode)) goto illegalopcode;
FillFlags();
Bitu limit=inst.op2.d;
CPU_LSL(inst.op1.w,limit);
inst.op1.d=(Bit32u)limit;
Bitu limit=inst_op2_d;
CPU_LSL(inst_op1_w,limit);
inst_op1_d=(Bit32u)limit;
}
break;
case O_ARPL:
{
if ((reg_flags & FLAG_VM) || !cpu.pmode) goto illegalopcode;
FillFlags();
Bitu new_sel=inst.op1.d;
CPU_ARPL(new_sel,inst.op2.d);
inst.op1.d=(Bit32u)new_sel;
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) {
if (!inst_op1_w) {
SETFLAGBIT(ZF,true);
goto nextopcode;
} else {
Bitu count=0;
while (1) {
if (inst.op1.w & 0x1) break;
count++;inst.op1.w>>=1;
if (inst_op1_w & 0x1) break;
count++;inst_op1_w>>=1;
}
inst.op1.d=count;
inst_op1_d=count;
SETFLAGBIT(ZF,false);
}
}
@ -506,16 +514,16 @@ switch (inst.code.op) {
case O_BSFd:
{
FillFlags();
if (!inst.op1.d) {
if (!inst_op1_d) {
SETFLAGBIT(ZF,true);
goto nextopcode;
} else {
Bitu count=0;
while (1) {
if (inst.op1.d & 0x1) break;
count++;inst.op1.d>>=1;
if (inst_op1_d & 0x1) break;
count++;inst_op1_d>>=1;
}
inst.op1.d=count;
inst_op1_d=count;
SETFLAGBIT(ZF,false);
}
}
@ -523,16 +531,16 @@ switch (inst.code.op) {
case O_BSRw:
{
FillFlags();
if (!inst.op1.w) {
if (!inst_op1_w) {
SETFLAGBIT(ZF,true);
goto nextopcode;
} else {
Bitu count=15;
while (1) {
if (inst.op1.w & 0x8000) break;
count--;inst.op1.w<<=1;
if (inst_op1_w & 0x8000) break;
count--;inst_op1_w<<=1;
}
inst.op1.d=count;
inst_op1_d=count;
SETFLAGBIT(ZF,false);
}
}
@ -540,60 +548,60 @@ switch (inst.code.op) {
case O_BSRd:
{
FillFlags();
if (!inst.op1.d) {
if (!inst_op1_d) {
SETFLAGBIT(ZF,true);
goto nextopcode;
} else {
Bitu count=31;
while (1) {
if (inst.op1.d & 0x80000000) break;
count--;inst.op1.d<<=1;
if (inst_op1_d & 0x80000000) break;
count--;inst_op1_d<<=1;
}
inst.op1.d=count;
inst_op1_d=count;
SETFLAGBIT(ZF,false);
}
}
break;
case O_BTw:
FillFlags();
SETFLAGBIT(CF,(inst.op1.d & (1 << (inst.op2.d & 15))));
SETFLAGBIT(CF,(inst_op1_d & (1 << (inst_op2_d & 15))));
break;
case O_BTSw:
FillFlags();
SETFLAGBIT(CF,(inst.op1.d & (1 << (inst.op2.d & 15))));
inst.op1.d|=(1 << (inst.op2.d & 15));
SETFLAGBIT(CF,(inst_op1_d & (1 << (inst_op2_d & 15))));
inst_op1_d|=(1 << (inst_op2_d & 15));
break;
case O_BTCw:
FillFlags();
SETFLAGBIT(CF,(inst.op1.d & (1 << (inst.op2.d & 15))));
inst.op1.d^=(1 << (inst.op2.d & 15));
SETFLAGBIT(CF,(inst_op1_d & (1 << (inst_op2_d & 15))));
inst_op1_d^=(1 << (inst_op2_d & 15));
break;
case O_BTRw:
FillFlags();
SETFLAGBIT(CF,(inst.op1.d & (1 << (inst.op2.d & 15))));
inst.op1.d&=~(1 << (inst.op2.d & 15));
SETFLAGBIT(CF,(inst_op1_d & (1 << (inst_op2_d & 15))));
inst_op1_d&=~(1 << (inst_op2_d & 15));
break;
case O_BTd:
FillFlags();
SETFLAGBIT(CF,(inst.op1.d & (1 << (inst.op2.d & 31))));
SETFLAGBIT(CF,(inst_op1_d & (1 << (inst_op2_d & 31))));
break;
case O_BTSd:
FillFlags();
SETFLAGBIT(CF,(inst.op1.d & (1 << (inst.op2.d & 31))));
inst.op1.d|=(1 << (inst.op2.d & 31));
SETFLAGBIT(CF,(inst_op1_d & (1 << (inst_op2_d & 31))));
inst_op1_d|=(1 << (inst_op2_d & 31));
break;
case O_BTCd:
FillFlags();
SETFLAGBIT(CF,(inst.op1.d & (1 << (inst.op2.d & 31))));
inst.op1.d^=(1 << (inst.op2.d & 31));
SETFLAGBIT(CF,(inst_op1_d & (1 << (inst_op2_d & 31))));
inst_op1_d^=(1 << (inst_op2_d & 31));
break;
case O_BTRd:
FillFlags();
SETFLAGBIT(CF,(inst.op1.d & (1 << (inst.op2.d & 31))));
inst.op1.d&=~(1 << (inst.op2.d & 31));
SETFLAGBIT(CF,(inst_op1_d & (1 << (inst_op2_d & 31))));
inst_op1_d&=~(1 << (inst_op2_d & 31));
break;
case O_BSWAP:
BSWAP(inst.op1.d);
BSWAP(inst_op1_d);
break;
case O_FPU:
#if C_FPU
@ -626,7 +634,7 @@ switch (inst.code.op) {
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) ) {
if ( (((Bit16s)inst_op1_w) < bound_min) || (((Bit16s)inst_op1_w) > bound_max) ) {
EXCEPTION(5);
}
}

View File

@ -171,7 +171,7 @@ static OpCode OpCodeTable[1024]={
{L_REGw ,O_OUTb ,0 ,REGI_DX},{L_REGw ,O_OUTw ,0 ,REGI_DX},
/* 0xf0 - 0xf7 */
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
{D_LOCK ,0 ,0 ,0 },{D_ICEBP ,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 },
@ -316,7 +316,7 @@ static OpCode OpCodeTable[1024]={
{L_MODRM ,0 ,S_Gw ,M_Ebx },{L_MODRM ,0 ,S_Gw ,M_Ewx },
/* 0x1c0 - 0x1cc */
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
{L_MODRM ,t_ADDb ,S_EbGb ,M_GbEb },{L_MODRM ,t_ADDw ,S_EwGw ,M_GwEw },
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
@ -526,7 +526,7 @@ static OpCode OpCodeTable[1024]={
{L_REGw ,O_OUTb ,0 ,REGI_DX},{L_REGw ,O_OUTd ,0 ,REGI_DX},
/* 0x2f0 - 0x2f7 */
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
{D_LOCK ,0 ,0 ,0 },{D_ICEBP ,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 },
@ -672,7 +672,7 @@ static OpCode OpCodeTable[1024]={
{L_MODRM ,0 ,S_Gd ,M_Ebx },{L_MODRM ,0 ,S_Gd ,M_Ewx },
/* 0x3c0 - 0x3cc */
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
{L_MODRM ,t_ADDb ,S_EbGb ,M_GbEb },{L_MODRM ,t_ADDd ,S_EdGd ,M_GdEd },
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },
{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 },

View File

@ -2,95 +2,95 @@
switch (inst.code.save) {
/* Byte */
case S_C_Eb:
inst.op1.b=inst.cond ? 1 : 0;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
reg_8(inst.code.extra)=inst_op1_b;
break;
case S_REGw:
reg_16(inst.code.extra)=inst.op1.w;
reg_16(inst.code.extra)=inst_op1_w;
break;
case S_REGd:
reg_32(inst.code.extra)=inst.op1.d;
reg_32(inst.code.extra)=inst_op1_d;
break;
case S_SEGm:
if (CPU_SetSegGeneral((SegNames)inst.rm_index,inst.op1.w)) RunException();
if (CPU_SetSegGeneral((SegNames)inst.rm_index,inst_op1_w)) RunException();
break;
case S_SEGGw:
if (CPU_SetSegGeneral((SegNames)inst.code.extra,inst.op2.w)) RunException();
reg_16(inst.rm_index)=inst.op1.w;
if (CPU_SetSegGeneral((SegNames)inst.code.extra,inst_op2_w)) RunException();
reg_16(inst.rm_index)=inst_op1_w;
break;
case S_SEGGd:
if (CPU_SetSegGeneral((SegNames)inst.code.extra,inst.op2.w)) RunException();
reg_32(inst.rm_index)=inst.op1.d;
if (CPU_SetSegGeneral((SegNames)inst.code.extra,inst_op2_w)) RunException();
reg_32(inst.rm_index)=inst_op1_d;
break;
case S_PUSHw:
Push_16(inst.op1.w);
Push_16(inst_op1_w);
break;
case S_PUSHd:
Push_32(inst.op1.d);
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+=inst_op1_d;
reg_eip&=0xffff;
continue;
case S_C_AIPd:
if (!inst.cond) goto nextopcode;
case S_AIPd:
SaveIP();
reg_eip+=inst.op1.d;
reg_eip+=inst_op1_d;
continue;
case S_IPIw:
reg_esp+=Fetchw();
case S_IP:
SaveIP();
reg_eip=inst.op1.d;
reg_eip=inst_op1_d;
continue;
case 0:
break;

View File

@ -45,6 +45,7 @@ enum {
D_SAHF,D_LAHF,
D_CPUID,
D_HLT,D_CLTS,
D_LOCK,D_ICEBP,
L_ERROR,
};
@ -164,11 +165,22 @@ struct FullData {
Bitu rm_mod;
OpCode code;
EAPoint cseip;
#ifdef WORDS_BIGENDIAN
union {
Bit32u dword[1];
Bit32s dwords[1];
Bit16u word[2];
Bit16s words[2];
Bit8u byte[4];
Bit8s bytes[4];
} blah1,blah2,blah_imm;
#else
union {
Bit8u b;Bit8s bs;
Bit16u w;Bit16s ws;
Bit32u d;Bit32s ds;
} op1,op2,imm;
#endif
Bitu new_flags;
struct {
EAPoint base;
@ -178,6 +190,55 @@ struct FullData {
Bitu prefix;
};
/* Some defines to get the names correct. */
#ifdef WORDS_BIGENDIAN
#define inst_op1_b inst.blah1.byte[3]
#define inst_op1_bs inst.blah1.bytes[3]
#define inst_op1_w inst.blah1.word[1]
#define inst_op1_ws inst.blah1.words[1]
#define inst_op1_d inst.blah1.dword[0]
#define inst_op1_ds inst.blah1.dwords[0]
#define inst_op2_b inst.blah2.byte[3]
#define inst_op2_bs inst.blah2.bytes[3]
#define inst_op2_w inst.blah2.word[1]
#define inst_op2_ws inst.blah2.words[1]
#define inst_op2_d inst.blah2.dword[0]
#define inst_op2_ds inst.blah2.dwords[0]
#define inst_imm_b inst.blah_imm.byte[3]
#define inst_imm_bs inst.blah_imm.bytes[3]
#define inst_imm_w inst.blah_imm.word[1]
#define inst_imm_ws inst.blah_imm.words[1]
#define inst_imm_d inst.blah_imm.dword[0]
#define inst_imm_ds inst.blah_imm.dwords[0]
#else
#define inst_op1_b inst.op1.b
#define inst_op1_bs inst.op1.bs
#define inst_op1_w inst.op1.w
#define inst_op1_ws inst.op1.ws
#define inst_op1_d inst.op1.d
#define inst_op1_ds inst.op1.ds
#define inst_op2_b inst.op2.b
#define inst_op2_bs inst.op2.bs
#define inst_op2_w inst.op2.w
#define inst_op2_ws inst.op2.ws
#define inst_op2_d inst.op2.d
#define inst_op2_ds inst.op2.ds
#define inst_imm_b inst.imm.b
#define inst_imm_bs inst.imm.bs
#define inst_imm_w inst.imm.w
#define inst_imm_ws inst.imm.ws
#define inst_imm_d inst.imm.d
#define inst_imm_ds inst.imm.ds
#endif
#define PREFIX_NONE 0x0
#define PREFIX_ADDR 0x1

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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
@ -171,7 +171,7 @@ restart_opcode:
sprintf(writecode,"%X",mem_readb(core.cseip++));
writecode+=2;
}
LOG(LOG_CPU,LOG_ERROR)("Illegal/Unhandled opcode %s",tempcode);
LOG(LOG_CPU,LOG_NORMAL)("Illegal/Unhandled opcode %s",tempcode);
}
#endif
CPU_Exception(6,0);
@ -188,13 +188,12 @@ decode_end:
}
Bits CPU_Core_Normal_Trap_Run(void) {
Bits oldCycles = CPU_Cycles;
CPU_Cycles = 1;
core.trap.skip=false;
Bits ret=CPU_Core_Normal_Run();
if (!core.trap.skip) CPU_SW_Interrupt(1,reg_eip);
if (!core.trap.skip) CPU_HW_Interrupt(1);
CPU_Cycles = oldCycles-1;
cpudecoder = &CPU_Core_Normal_Run;

View File

@ -1,8 +1,8 @@
# Makefile.in generated by automake 1.9.3 from Makefile.am.
# Makefile.in generated by automake 1.9.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004 Free Software Foundation, Inc.
# 2003, 2004, 2005 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.
@ -80,6 +80,8 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
HAVE_WINDRES_FALSE = @HAVE_WINDRES_FALSE@
HAVE_WINDRES_TRUE = @HAVE_WINDRES_TRUE@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
@ -105,10 +107,12 @@ SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
WINDRES = @WINDRES@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
ac_ct_WINDRES = @ac_ct_WINDRES@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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
@ -18,6 +18,7 @@
CASE_0F_W(0x00) /* GRP 6 Exxx */
{
if ((reg_flags & FLAG_VM) || (!cpu.pmode)) goto illegal_opcode;
GetRM;Bitu which=(rm>>3)&7;
switch (which) {
case 0x00: /* SLDT */
@ -37,10 +38,20 @@
if (rm >= 0xc0 ) {GetEArw;loadval=*earw;}
else {GetEAa;loadval=LoadMw(eaa);}
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;
case 0x02:
if (cpu.cpl) EXCEPTION(EXCEPTION_GP);
if (CPU_LLDT(loadval)) RUNEXCEPTION();
break;
case 0x03:
if (cpu.cpl) EXCEPTION(EXCEPTION_GP);
if (CPU_LTR(loadval)) RUNEXCEPTION();
break;
case 0x04:
CPU_VERR(loadval);
break;
case 0x05:
CPU_VERW(loadval);
break;
}
}
break;
@ -66,9 +77,11 @@
SaveMd(eaa+2,base);
break;
case 0x02: /* LGDT */
if (cpu.pmode && cpu.cpl) EXCEPTION(EXCEPTION_GP);
CPU_LGDT(LoadMw(eaa),LoadMd(eaa+2) & 0xFFFFFF);
break;
case 0x03: /* LIDT */
if (cpu.pmode && cpu.cpl) EXCEPTION(EXCEPTION_GP);
CPU_LIDT(LoadMw(eaa),LoadMd(eaa+2) & 0xFFFFFF);
break;
case 0x04: /* SMSW */
@ -83,6 +96,12 @@
} else {
GetEArw;Bitu limit;
switch (which) {
case 0x02: /* LGDT */
if (cpu.pmode && cpu.cpl) EXCEPTION(EXCEPTION_GP);
goto illegal_opcode;
case 0x03: /* LIDT */
if (cpu.pmode && cpu.cpl) EXCEPTION(EXCEPTION_GP);
goto illegal_opcode;
case 0x04: /* SMSW */
CPU_SMSW(limit);
*earw=limit;
@ -98,6 +117,7 @@
break;
CASE_0F_W(0x02) /* LAR Gw,Ew */
{
if ((reg_flags & FLAG_VM) || (!cpu.pmode)) goto illegal_opcode;
FillFlags();
GetRMrw;Bitu ar=*rmrw;
if (rm >= 0xc0) {
@ -110,6 +130,7 @@
break;
CASE_0F_W(0x03) /* LSL Gw,Ew */
{
if ((reg_flags & FLAG_VM) || (!cpu.pmode)) goto illegal_opcode;
FillFlags();
GetRMrw;Bitu limit=*rmrw;
if (rm >= 0xc0) {
@ -121,52 +142,59 @@
}
break;
CASE_0F_B(0x06) /* CLTS */
if (cpu.pmode && cpu.cpl) EXCEPTION(EXCEPTION_GP);
cpu.cr0&=(~CR0_TASKSWITCH);
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;
if (rm < 0xc0 ) {
rm |= 0xc0;
LOG(LOG_CPU,LOG_ERROR)("MOV XXX,CR%d with non-register",which);
}
GetEArd;
Bit32u crx_value;
if (CPU_READ_CRX(which,crx_value)) RUNEXCEPTION();
*eard=crx_value;
}
break;
CASE_0F_B(0x21) /* MOV Rd,DRx */
{
GetRM;
Bitu which=(rm >> 3) & 7;
if (rm >= 0xc0 ) {
GetEArd;
} else {
GetEAa;
if (rm < 0xc0 ) {
rm |= 0xc0;
LOG(LOG_CPU,LOG_ERROR)("MOV XXX,DR% with non-register",which);
}
GetEArd;
Bit32u drx_value;
if (CPU_READ_DRX(which,drx_value)) RUNEXCEPTION();
*eard=drx_value;
}
break;
CASE_0F_B(0x22) /* MOV CRx,Rd */
{
GetRM;
Bitu which=(rm >> 3) & 7;
if (rm >= 0xc0 ) {
GetEArd;
if (CPU_SET_CRX(which,*eard)) RUNEXCEPTION();
} else goto illegal_opcode;
if (rm < 0xc0 ) {
rm |= 0xc0;
LOG(LOG_CPU,LOG_ERROR)("MOV XXX,CR% with non-register",which);
}
GetEArd;
if (CPU_WRITE_CRX(which,*eard)) RUNEXCEPTION();
}
break;
CASE_0F_B(0x23) /* MOV DRx,Rd */
{
GetRM;
Bitu which=(rm >> 3) & 7;
if (rm >= 0xc0 ) {
GetEArd;
} else {
GetEAa;
if (rm < 0xc0 ) {
rm |= 0xc0;
LOG(LOG_CPU,LOG_ERROR)("MOV DR%,XXX with non-register",which);
}
GetEArd;
if (CPU_WRITE_DRX(which,*eard)) RUNEXCEPTION();
}
break;
CASE_0F_W(0x80) /* JO */
@ -444,6 +472,20 @@
else {GetEAa;*rmrw=LoadMbs(eaa);}
break;
}
CASE_0F_B(0xc0) /* XADD Gb,Eb */
{
GetRMrb;Bit8u oldrmrb=*rmrb;
if (rm >= 0xc0 ) {GetEArb;*rmrb=*earb;*earb+=oldrmrb;}
else {GetEAa;*rmrb=LoadMb(eaa);SaveMb(eaa,LoadMb(eaa)+oldrmrb);}
break;
}
CASE_0F_W(0xc1) /* XADD Gw,Ew */
{
GetRMrw;Bit16u oldrmrw=*rmrw;
if (rm >= 0xc0 ) {GetEArw;*rmrw=*earw;*earw+=oldrmrw;}
else {GetEAa;*rmrw=LoadMw(eaa);SaveMw(eaa,LoadMw(eaa)+oldrmrw);}
break;
}
CASE_0F_B(0xc8) /* BSWAP EAX */
BSWAP(reg_eax);break;
CASE_0F_B(0xc9) /* BSWAP ECX */

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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
@ -331,8 +331,8 @@
case 0x05: /* MOV Ew,GS */
val=SegValue(gs);break;
default:
val=0;
E_Exit("CPU:8c:Illegal RM Byte");
LOG(LOG_CPU,LOG_ERROR)("CPU:8c:Illegal RM Byte");
goto illegal_opcode;
}
if (rm >= 0xc0 ) {GetEArd;*eard=val;}
else {GetEAa;SaveMw(eaa,val);}
@ -389,6 +389,12 @@
Bit32u newip=Fetchd();Bit16u newcs=Fetchw();
FillFlags();
CPU_CALL(true,newcs,newip,GETIP);
#if CPU_TRAP_CHECK
if (GETFLAG(TF)) {
cpudecoder=CPU_Core_Normal_Trap_Run;
return CBRET_NONE;
}
#endif
continue;
}
CASE_D(0x9c) /* PUSHFD */
@ -581,6 +587,12 @@
Bit16u newcs=Fetchw();
FillFlags();
CPU_JMP(true,newcs,newip,GETIP);
#if CPU_TRAP_CHECK
if (GETFLAG(TF)) {
cpudecoder=CPU_Core_Normal_Trap_Run;
return CBRET_NONE;
}
#endif
continue;
}
CASE_D(0xeb) /* JMP Jb */
@ -657,11 +669,18 @@
continue;
case 0x03: /* CALL FAR Ed */
{
if (rm >= 0xc0) goto illegal_opcode;
GetEAa;
Bit32u newip=LoadMd(eaa);
Bit16u newcs=LoadMw(eaa+4);
FillFlags();
CPU_CALL(true,newcs,newip,GETIP);
#if CPU_TRAP_CHECK
if (GETFLAG(TF)) {
cpudecoder=CPU_Core_Normal_Trap_Run;
return CBRET_NONE;
}
#endif
continue;
}
case 0x04: /* JMP NEAR Ed */
@ -670,11 +689,18 @@
continue;
case 0x05: /* JMP FAR Ed */
{
if (rm >= 0xc0) goto illegal_opcode;
GetEAa;
Bit32u newip=LoadMd(eaa);
Bit16u newcs=LoadMw(eaa+4);
FillFlags();
CPU_JMP(true,newcs,newip,GETIP);
#if CPU_TRAP_CHECK
if (GETFLAG(TF)) {
cpudecoder=CPU_Core_Normal_Trap_Run;
return CBRET_NONE;
}
#endif
continue;
}
break;

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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
@ -15,8 +15,10 @@
* 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 */
{
if ((reg_flags & FLAG_VM) || (!cpu.pmode)) goto illegal_opcode;
GetRM;Bitu which=(rm>>3)&7;
switch (which) {
case 0x00: /* SLDT */
@ -37,15 +39,26 @@
if (rm >= 0xc0 ) {GetEArw;loadval=*earw;}
else {GetEAa;loadval=LoadMw(eaa);}
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;
case 0x02:
if (cpu.cpl) EXCEPTION(EXCEPTION_GP);
if (CPU_LLDT(loadval)) RUNEXCEPTION();
break;
case 0x03:
if (cpu.cpl) EXCEPTION(EXCEPTION_GP);
if (CPU_LTR(loadval)) RUNEXCEPTION();
break;
case 0x04:
CPU_VERR(loadval);
break;
case 0x05:
CPU_VERW(loadval);
break;
}
}
break;
default:
LOG(LOG_CPU,LOG_ERROR)("GRP6:Illegal call %2X",which);
goto illegal_opcode;
}
}
break;
@ -66,9 +79,11 @@
SaveMd(eaa+2,(Bit32u)base);
break;
case 0x02: /* LGDT */
if (cpu.pmode && cpu.cpl) EXCEPTION(EXCEPTION_GP);
CPU_LGDT(LoadMw(eaa),LoadMd(eaa+2));
break;
case 0x03: /* LIDT */
if (cpu.pmode && cpu.cpl) EXCEPTION(EXCEPTION_GP);
CPU_LIDT(LoadMw(eaa),LoadMd(eaa+2));
break;
case 0x04: /* SMSW */
@ -77,21 +92,28 @@
break;
case 0x06: /* LMSW */
limit=LoadMw(eaa);
if (!CPU_LMSW((Bit16u)limit)) goto decode_end;
if (CPU_LMSW((Bit16u)limit)) RUNEXCEPTION();
break;
}
} else {
GetEArd;Bitu limit;
switch (which) {
case 0x02: /* LGDT */
if (cpu.pmode && cpu.cpl) EXCEPTION(EXCEPTION_GP);
goto illegal_opcode;
case 0x03: /* LIDT */
if (cpu.pmode && cpu.cpl) EXCEPTION(EXCEPTION_GP);
goto illegal_opcode;
case 0x04: /* SMSW */
CPU_SMSW(limit);
*eard=(Bit32u)limit;
break;
case 0x06: /* LMSW */
if (!CPU_LMSW(*eard)) goto decode_end;
if (CPU_LMSW(*eard)) RUNEXCEPTION();
break;
default:
LOG(LOG_CPU,LOG_ERROR)("Illegal group 7 RM subfunction %d",which);
goto illegal_opcode;
break;
}
@ -100,6 +122,7 @@
break;
CASE_0F_D(0x02) /* LAR Gd,Ed */
{
if ((reg_flags & FLAG_VM) || (!cpu.pmode)) goto illegal_opcode;
FillFlags();
GetRMrd;Bitu ar=*rmrd;
if (rm >= 0xc0) {
@ -112,6 +135,7 @@
break;
CASE_0F_D(0x03) /* LSL Gd,Ew */
{
if ((reg_flags & FLAG_VM) || (!cpu.pmode)) goto illegal_opcode;
FillFlags();
GetRMrd;Bitu limit=*rmrd;
/* Just load 16-bit values for selectors */
@ -376,3 +400,10 @@
else {GetEAa;*rmrd=LoadMws(eaa);}
break;
}
CASE_0F_D(0xc1) /* XADD Gd,Ed */
{
GetRMrd;Bit32u oldrmrd=*rmrd;
if (rm >= 0xc0 ) {GetEArd;*rmrd=*eard;*eard+=oldrmrd;}
else {GetEAa;*rmrd=LoadMd(eaa);SaveMd(eaa,LoadMd(eaa)+oldrmrd);}
break;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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
@ -472,8 +472,8 @@
case 0x05: /* MOV Ew,GS */
val=SegValue(gs);break;
default:
val=0;
E_Exit("CPU:8c:Illegal RM Byte");
LOG(LOG_CPU,LOG_ERROR)("CPU:8c:Illegal RM Byte");
goto illegal_opcode;
}
if (rm >= 0xc0 ) {GetEArw;*earw=val;}
else {GetEAa;SaveMw(eaa,val);}
@ -551,6 +551,12 @@
FillFlags();
Bit16u newip=Fetchw();Bit16u newcs=Fetchw();
CPU_CALL(false,newcs,newip,GETIP);
#if CPU_TRAP_CHECK
if (GETFLAG(TF)) {
cpudecoder=CPU_Core_Normal_Trap_Run;
return CBRET_NONE;
}
#endif
continue;
}
CASE_B(0x9b) /* WAIT */
@ -727,7 +733,7 @@
if (DEBUG_Breakpoint())
return debugCallback;
#endif
CPU_SW_Interrupt(3,GETIP);
CPU_SW_Interrupt_NoIOPLCheck(3,GETIP);
#if CPU_TRAP_CHECK
core.trap.skip=true;
#endif
@ -761,14 +767,14 @@
{
FillFlags();
CPU_IRET(false,GETIP);
#if CPU_PIC_CHECK
if (GETFLAG(IF) && PIC_IRQCheck) return CBRET_NONE;
#endif
#if CPU_TRAP_CHECK
if (GETFLAG(TF)) {
cpudecoder=CPU_Core_Normal_Trap_Run;
return CBRET_NONE;
}
#endif
#if CPU_PIC_CHECK
if (GETFLAG(IF) && PIC_IRQCheck) return CBRET_NONE;
#endif
continue;
}
@ -900,6 +906,12 @@
Bit16u newcs=Fetchw();
FillFlags();
CPU_JMP(false,newcs,newip,GETIP);
#if CPU_TRAP_CHECK
if (GETFLAG(TF)) {
cpudecoder=CPU_Core_Normal_Trap_Run;
return CBRET_NONE;
}
#endif
continue;
}
CASE_W(0xeb) /* JMP Jb */
@ -926,8 +938,15 @@
IO_WriteW(reg_dx,reg_ax);
break;
CASE_B(0xf0) /* LOCK */
LOG(LOG_CPU,LOG_NORMAL)("CPU:LOCK");
LOG(LOG_CPU,LOG_NORMAL)("CPU:LOCK"); /* FIXME: see case D_LOCK in core_full/load.h */
break;
CASE_B(0xf1) /* ICEBP */
FillFlags();
CPU_SW_Interrupt_NoIOPLCheck(1,GETIP);
#if CPU_TRAP_CHECK
core.trap.skip=true;
#endif
continue;
CASE_B(0xf2) /* REPNZ */
DO_PREFIX_REP(false);
break;
@ -935,6 +954,7 @@
DO_PREFIX_REP(true);
break;
CASE_B(0xf4) /* HLT */
if (cpu.pmode && cpu.cpl) EXCEPTION(EXCEPTION_GP);
FillFlags();
CPU_HLT(GETIP);
return CBRET_NONE; //Needs to return for hlt cpu core
@ -1094,11 +1114,18 @@
continue;
case 0x03: /* CALL Ep */
{
if (rm >= 0xc0) goto illegal_opcode;
GetEAa;
Bit16u newip=LoadMw(eaa);
Bit16u newcs=LoadMw(eaa+2);
FillFlags();
CPU_CALL(false,newcs,newip,GETIP);
#if CPU_TRAP_CHECK
if (GETFLAG(TF)) {
cpudecoder=CPU_Core_Normal_Trap_Run;
return CBRET_NONE;
}
#endif
continue;
}
break;
@ -1108,11 +1135,18 @@
continue;
case 0x05: /* JMP Ep */
{
if (rm >= 0xc0) goto illegal_opcode;
GetEAa;
Bit16u newip=LoadMw(eaa);
Bit16u newcs=LoadMw(eaa+2);
FillFlags();
CPU_JMP(false,newcs,newip,GETIP);
#if CPU_TRAP_CHECK
if (GETFLAG(TF)) {
cpudecoder=CPU_Core_Normal_Trap_Run;
return CBRET_NONE;
}
#endif
continue;
}
break;

View File

@ -34,6 +34,7 @@ static void DoString(STRING_OP type) {
CPU_Cycles=0;
LOADIP; //RESET IP to the start
} else {
if ((count<=1) && (CPU_Cycles<=1)) CPU_Cycles--;
/* Won't interrupt scas and cmps instruction since they can interrupt themselves */
count_left=0;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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
@ -165,7 +165,7 @@ restart_opcode:
// sprintf(writecode,"%X",mem_readb(core.cseip++));
writecode+=2;
}
LOG(LOG_CPU,LOG_ERROR)("Illegal/Unhandled opcode %s",tempcode);
LOG(LOG_CPU,LOG_NORMAL)("Illegal/Unhandled opcode %s",tempcode);
}
#endif
CPU_Exception(6,0);
@ -200,4 +200,3 @@ Bits CPU_Core_Simple_Trap_Run(void) {
void CPU_Core_Simple_Init(void) {
}

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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
@ -599,9 +599,11 @@
Bitu val=load(op1); \
if (val==0) EXCEPTION(0); \
Bitu quo=reg_ax / val; \
reg_ah=(Bit8u)(reg_ax % val); \
reg_al=(Bit8u)quo; \
Bit8u rem=(Bit8u)(reg_ax % val); \
Bit8u quo8=(Bit8u)(quo&0xff); \
if (quo>0xff) EXCEPTION(0); \
reg_ah=rem; \
reg_al=quo8; \
}
@ -611,9 +613,11 @@
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); \
Bit16u rem=(Bit16u)(num % val); \
Bit16u quo16=(Bit16u)(quo&0xffff); \
if (quo!=(Bit32u)quo16) EXCEPTION(0); \
reg_dx=rem; \
reg_ax=quo16; \
}
#define DIVD(op1,load,save) \
@ -622,9 +626,11 @@
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); \
Bit32u rem=(Bit32u)(num % val); \
Bit32u quo32=(Bit32u)(quo&0xffffffff); \
if (quo!=(Bit64u)quo32) EXCEPTION(0); \
reg_edx=rem; \
reg_eax=quo32; \
}
@ -633,9 +639,11 @@
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); \
Bit8s rem=(Bit8s)((Bit16s)reg_ax % val); \
Bit8s quo8s=(Bit8s)(quo&0xff); \
if (quo!=(Bit16s)quo8s) EXCEPTION(0); \
reg_ah=rem; \
reg_al=quo8s; \
}
@ -645,9 +653,11 @@
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); \
Bit16s rem=(Bit16s)(num % val); \
Bit16s quo16s=(Bit16s)quo; \
if (quo!=(Bit32s)quo16s) EXCEPTION(0); \
reg_dx=rem; \
reg_ax=quo16s; \
}
#define IDIVD(op1,load,save) \
@ -656,9 +666,11 @@
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); \
Bit32s rem=(Bit32s)(num % val); \
Bit32s quo32s=(Bit32s)(quo&0xffffffff); \
if (quo!=(Bit64s)quo32s) EXCEPTION(0); \
reg_edx=rem; \
reg_eax=quo32s; \
}
#define IMULB(op1,load,save) \

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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
@ -27,11 +27,13 @@
#include "lazyflags.h"
#include "cpu.h"
#include "debug.h"
#include "setup.h"
#define LINK_TOTAL (64*1024)
PagingBlock paging;
static Bit32u mapfirstmb[LINK_START];
Bitu PageHandler::readb(PhysPt addr) {
E_Exit("No byte handler for read from %d",addr);
@ -65,10 +67,34 @@ void PageHandler::writed(PhysPt addr,Bitu val) {
writeb(addr+3,(Bit8u) (val >> 24));
};
HostPt PageHandler::GetHostPt(Bitu phys_page) {
HostPt PageHandler::GetHostReadPt(Bitu phys_page) {
return 0;
}
HostPt PageHandler::GetHostWritePt(Bitu phys_page) {
return 0;
}
bool PageHandler::readb_checked(PhysPt addr, Bitu * val) {
*val=readb(addr); return false;
}
bool PageHandler::readw_checked(PhysPt addr, Bitu * val) {
*val=readw(addr); return false;
}
bool PageHandler::readd_checked(PhysPt addr, Bitu * val) {
*val=readd(addr); return false;
}
bool PageHandler::writeb_checked(PhysPt addr,Bitu val) {
writeb(addr,val); return false;
}
bool PageHandler::writew_checked(PhysPt addr,Bitu val) {
writew(addr,val); return false;
}
bool PageHandler::writed_checked(PhysPt addr,Bitu val) {
writed(addr,val); return false;
}
struct PF_Entry {
Bitu cs;
@ -77,7 +103,7 @@ struct PF_Entry {
};
#define PF_QUEUESIZE 16
struct {
static struct {
Bitu used;
PF_Entry entries[PF_QUEUESIZE];
} pf_queue;
@ -104,7 +130,7 @@ Bitu DEBUG_EnableDebugger(void);
bool first=false;
void PAGING_PageFault(PhysPt lin_addr,Bitu page_addr,Bitu type) {
void PAGING_PageFault(PhysPt lin_addr,Bitu page_addr,bool writefault,Bitu faultcode) {
/* Save the state of the cpu cores */
LazyFlags old_lflags;
memcpy(&old_lflags,&lflags,sizeof(LazyFlags));
@ -113,14 +139,14 @@ void PAGING_PageFault(PhysPt lin_addr,Bitu page_addr,Bitu type) {
cpudecoder=&PageFaultCore;
paging.cr2=lin_addr;
PF_Entry * entry=&pf_queue.entries[pf_queue.used++];
LOG(LOG_PAGING,LOG_NORMAL)("PageFault at %X type %d queue %d",lin_addr,type,pf_queue.used);
LOG(LOG_PAGING,LOG_NORMAL)("PageFault at %X type [%x:%x] queue %d",lin_addr,writefault,faultcode,pf_queue.used);
// LOG_MSG("EAX:%04X ECX:%04X EDX:%04X EBX:%04X",reg_eax,reg_ecx,reg_edx,reg_ebx);
// LOG_MSG("CS:%04X EIP:%08X SS:%04x SP:%08X",SegValue(cs),reg_eip,SegValue(ss),reg_esp);
entry->cs=SegValue(cs);
entry->eip=reg_eip;
entry->page_addr=page_addr;
//Caused by a write by default?
CPU_Exception(14,0x2 );
CPU_Exception(14,(writefault?0x02:0x00) | faultcode);
#if C_DEBUG
// DEBUG_EnableDebugger();
#endif
@ -136,30 +162,66 @@ class InitPageHandler : public PageHandler {
public:
InitPageHandler() {flags=PFLAG_INIT|PFLAG_NOCODE;}
Bitu readb(PhysPt addr) {
InitPage(addr);
InitPage(addr,false);
return mem_readb(addr);
}
Bitu readw(PhysPt addr) {
InitPage(addr);
InitPage(addr,false);
return mem_readw(addr);
}
Bitu readd(PhysPt addr) {
InitPage(addr);
InitPage(addr,false);
return mem_readd(addr);
}
void writeb(PhysPt addr,Bitu val) {
InitPage(addr);
InitPage(addr,true);
mem_writeb(addr,val);
}
void writew(PhysPt addr,Bitu val) {
InitPage(addr);
InitPage(addr,true);
mem_writew(addr,val);
}
void writed(PhysPt addr,Bitu val) {
InitPage(addr);
InitPage(addr,true);
mem_writed(addr,val);
}
void InitPage(Bitu lin_addr) {
bool readb_checked(PhysPt addr, Bitu * val) {
if (InitPage(addr,false,true)) {
*val=mem_readb(addr);
return false;
} else return true;
}
bool readw_checked(PhysPt addr, Bitu * val) {
if (InitPage(addr,false,true)){
*val=mem_readw(addr);
return false;
} else return true;
}
bool readd_checked(PhysPt addr, Bitu * val) {
if (InitPage(addr,false,true)) {
*val=mem_readd(addr);
return false;
} else return true;
}
bool writeb_checked(PhysPt addr,Bitu val) {
if (InitPage(addr,true,true)) {
mem_writeb(addr,val);
return false;
} else return true;
}
bool writew_checked(PhysPt addr,Bitu val) {
if (InitPage(addr,true,true)) {
mem_writew(addr,val);
return false;
} else return true;
}
bool writed_checked(PhysPt addr,Bitu val) {
if (InitPage(addr,true,true)) {
mem_writed(addr,val);
return false;
} else return true;
}
bool InitPage(Bitu lin_addr,bool writing,bool check_only=false) {
Bitu lin_page=lin_addr >> 12;
Bitu phys_page;
if (paging.enabled) {
@ -169,32 +231,63 @@ public:
X86PageEntry table;
table.load=phys_readd(table_addr);
if (!table.block.p) {
LOG(LOG_PAGING,LOG_ERROR)("NP Table");
PAGING_PageFault(lin_addr,table_addr,0);
if (check_only) {
paging.cr2=lin_addr;
cpu.exception.which=14;
cpu.exception.error=writing?0x02:0x00;
return false;
}
LOG(LOG_PAGING,LOG_NORMAL)("NP Table");
PAGING_PageFault(lin_addr,table_addr,false,writing?0x02:0x00);
table.load=phys_readd(table_addr);
if (!table.block.p)
E_Exit("Pagefault didn't correct table");
}
table.block.a=table.block.d=1; //Set access/Dirty
phys_writed(table_addr,table.load);
if (!table.block.a) {
table.block.a=1; //Set access
phys_writed(table_addr,table.load);
}
X86PageEntry entry;
Bitu entry_addr=(table.block.base<<12)+t_index*4;
entry.load=phys_readd(entry_addr);
if (!entry.block.p) {
LOG(LOG_PAGING,LOG_ERROR)("NP Page");
PAGING_PageFault(lin_addr,entry_addr,0);
if (check_only) {
paging.cr2=lin_addr;
cpu.exception.which=14;
cpu.exception.error=writing?0x02:0x00;
return false;
}
// LOG(LOG_PAGING,LOG_NORMAL)("NP Page");
PAGING_PageFault(lin_addr,entry_addr,false,writing?0x02:0x00);
entry.load=phys_readd(entry_addr);
if (!entry.block.p)
E_Exit("Pagefault didn't correct page");
}
entry.block.a=entry.block.d=1; //Set access/Dirty
phys_writed(entry_addr,entry.load);
if (cpu.cpl==3) {
if ((entry.block.us==0) || (table.block.us==0) && (((entry.block.wr==0) || (table.block.wr==0)) && writing)) {
LOG(LOG_PAGING,LOG_NORMAL)("Page access denied: cpl=%i, %x:%x:%x:%x",cpu.cpl,entry.block.us,table.block.us,entry.block.wr,table.block.wr);
if (check_only) {
paging.cr2=lin_addr;
cpu.exception.which=14;
cpu.exception.error=0x05 | (writing?0x02:0x00);
return false;
}
PAGING_PageFault(lin_addr,entry_addr,writing,0x05 | (writing?0x02:0x00));
}
}
if (check_only) return true;
if ((!entry.block.a) || (!entry.block.d)) {
entry.block.a=1; //Set access
entry.block.d=1; //Set dirty
phys_writed(entry_addr,entry.load);
}
phys_page=entry.block.base;
} else {
if (lin_page<LINK_START) phys_page=mapfirstmb[lin_page];
if (lin_page<LINK_START) phys_page=paging.firstmb[lin_page];
else phys_page=lin_page;
}
PAGING_LinkPage(lin_page,phys_page);
return true;
}
};
@ -210,7 +303,7 @@ bool PAGING_MakePhysPage(Bitu & page) {
if (!entry.block.p) return false;
page=entry.block.base;
} else {
if (page<LINK_START) page=mapfirstmb[page];
if (page<LINK_START) page=paging.firstmb[page];
//Else keep it the same
}
return true;
@ -262,11 +355,10 @@ void PAGING_LinkPage(Bitu lin_page,Bitu phys_page) {
PAGING_ClearTLB();
}
HostPt host_mem=handler->GetHostPt(phys_page);
paging.tlb.phys_page[lin_page]=phys_page;
if (handler->flags & PFLAG_READABLE) paging.tlb.read[lin_page]=host_mem-lin_base;
if (handler->flags & PFLAG_READABLE) paging.tlb.read[lin_page]=handler->GetHostReadPt(phys_page)-lin_base;
else paging.tlb.read[lin_page]=0;
if (handler->flags & PFLAG_WRITEABLE) paging.tlb.write[lin_page]=host_mem-lin_base;
if (handler->flags & PFLAG_WRITEABLE) paging.tlb.write[lin_page]=handler->GetHostWritePt(phys_page)-lin_base;
else paging.tlb.write[lin_page]=0;
paging.links.entries[paging.links.used++]=lin_page;
@ -275,7 +367,7 @@ void PAGING_LinkPage(Bitu lin_page,Bitu phys_page) {
void PAGING_MapPage(Bitu lin_page,Bitu phys_page) {
if (lin_page<LINK_START) {
mapfirstmb[lin_page]=phys_page;
paging.firstmb[lin_page]=phys_page;
paging.tlb.read[lin_page]=0;
paging.tlb.write[lin_page]=0;
paging.tlb.handler[lin_page]=&init_page_handler;
@ -318,14 +410,22 @@ bool PAGING_Enabled(void) {
return paging.enabled;
}
void PAGING_Init(Section * sec) {
/* Setup default Page Directory, force it to update */
paging.enabled=false;
PAGING_InitTLB();
Bitu i;
for (i=0;i<LINK_START;i++) {
mapfirstmb[i]=i;
class PAGING:public Module_base{
public:
PAGING(Section* configuration):Module_base(configuration){
/* Setup default Page Directory, force it to update */
paging.enabled=false;
PAGING_InitTLB();
Bitu i;
for (i=0;i<LINK_START;i++) {
paging.firstmb[i]=i;
}
pf_queue.used=0;
}
pf_queue.used=0;
}
~PAGING(){}
};
static PAGING* test;
void PAGING_Init(Section * sec) {
test = new PAGING(sec);
}

View File

@ -1,8 +1,8 @@
# Makefile.in generated by automake 1.9.3 from Makefile.am.
# Makefile.in generated by automake 1.9.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004 Free Software Foundation, Inc.
# 2003, 2004, 2005 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.
@ -100,6 +100,8 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
HAVE_WINDRES_FALSE = @HAVE_WINDRES_FALSE@
HAVE_WINDRES_TRUE = @HAVE_WINDRES_TRUE@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
@ -125,10 +127,12 @@ SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
WINDRES = @WINDRES@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
ac_ct_WINDRES = @ac_ct_WINDRES@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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,10 +16,11 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: debug.cpp,v 1.60 2004/10/23 15:15:06 qbix79 Exp $ */
/* $Id: debug.cpp,v 1.76 2006/03/26 11:11:56 qbix79 Exp $ */
#include <string.h>
#include <list>
#include <ctype.h>
#include "dosbox.h"
#if C_DEBUG
@ -39,6 +40,8 @@
#include "shell.h"
#include "programs.h"
#include "debug_inc.h"
#include "../cpu/lazyflags.h"
#include "keyboard.h"
#ifdef WIN32
void WIN32_Console();
@ -53,16 +56,37 @@ int old_cursor_state;
static void DrawCode(void);
static bool DEBUG_Log_Loop(int count);
static void DEBUG_RaiseTimerIrq(void);
static void SaveMemory(Bitu seg, Bitu ofs1, Bit32s num);
static void SaveMemory(Bitu seg, Bitu ofs1, Bit32u num);
static void SaveMemoryBin(Bitu seg, Bitu ofs1, Bit32u num);
static void LogGDT(void);
static void LogLDT(void);
static void LogIDT(void);
static void LogPages(char* selname);
static void LogCPUInfo(void);
static void OutputVecTable(char* filename);
static void DrawVariables(void);
char* AnalyzeInstruction(char* inst, bool saveSelector);
Bit32u GetHexValue(char* str, char*& hex);
class DebugPageHandler : public PageHandler {
public:
Bitu readb(PhysPt addr) {
}
Bitu readw(PhysPt addr) {
}
Bitu readd(PhysPt addr) {
}
void writeb(PhysPt addr,Bitu val) {
}
void writew(PhysPt addr,Bitu val) {
}
void writed(PhysPt addr,Bitu val) {
}
};
class DEBUG;
@ -77,6 +101,7 @@ bool logHeavy = false;
static FILE* cpuLogFile = 0;
static bool cpuLog = false;
static int cpuLogCounter = 0;
static int cpuLogType = 1; // log detail
#endif
@ -88,7 +113,7 @@ static struct {
static char curSelectorName[3] = { 0,0,0 };
static Segment oldsegs[6];
static Bitu oldflags;
static Bitu oldflags,oldcpucpl;
DBGBlock dbg;
static Bitu input_count;
Bitu cycle_count;
@ -134,7 +159,7 @@ Bit32u PhysMakeProt(Bit16u selector, Bit32u offset)
Bit32u GetAddress(Bit16u seg, Bit32u offset)
{
if (seg==SegValue(cs)) return SegPhys(cs)+offset;
if (cpu.pmode) {
if (cpu.pmode && !(reg_flags & FLAG_VM)) {
Descriptor desc;
if (cpu.gdt.GetDescriptor(seg,desc)) return PhysMakeProt(seg,offset);
}
@ -147,15 +172,43 @@ bool GetDescriptorInfo(char* selname, char* out1, char* out2)
Bitu 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 (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);
if (*selname==0) selname=" ";
}
if (cpu.gdt.GetDescriptor(sel,desc)) {
switch (desc.Type()) {
case DESC_TASK_GATE:
sprintf(out1,"%s: s:%08X type:%02X p",selname,desc.GetSelector(),desc.saved.gate.type);
sprintf(out2," TaskGate dpl : %01X %1X",desc.saved.gate.dpl,desc.saved.gate.p);
return true;
case DESC_LDT:
case DESC_286_TSS_A:
case DESC_286_TSS_B:
case DESC_386_TSS_A:
case DESC_386_TSS_B:
sprintf(out1,"%s: b:%08X type:%02X pag",selname,desc.GetBase(),desc.saved.seg.type);
sprintf(out2," l:%08X dpl : %01X %1X%1X%1X",desc.GetLimit(),desc.saved.seg.dpl,desc.saved.seg.p,desc.saved.seg.avl,desc.saved.seg.g);
return true;
case DESC_286_CALL_GATE:
case DESC_386_CALL_GATE:
sprintf(out1,"%s: s:%08X type:%02X p params: %02X",selname,desc.GetSelector(),desc.saved.gate.type,desc.saved.gate.paramcount);
sprintf(out2," o:%08X dpl : %01X %1X",desc.GetOffset(),desc.saved.gate.dpl,desc.saved.gate.p);
return true;
case DESC_286_INT_GATE:
case DESC_286_TRAP_GATE:
case DESC_386_INT_GATE:
case DESC_386_TRAP_GATE:
sprintf(out1,"%s: s:%08X type:%02X p",selname,desc.GetSelector(),desc.saved.gate.type);
sprintf(out2," o:%08X dpl : %01X %1X",desc.GetOffset(),desc.saved.gate.dpl,desc.saved.gate.p);
return true;
}
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;
@ -163,7 +216,6 @@ bool GetDescriptorInfo(char* selname, char* out1, char* out2)
strcpy(out1," ");
strcpy(out2," ");
}
//out1[0] = out2[0] = 0;
return false;
};
@ -174,7 +226,7 @@ bool GetDescriptorInfo(char* selname, char* out1, char* out2)
class CDebugVar
{
public:
CDebugVar(char* _name, PhysPt _adr) { adr=_adr; (strlen(name)<15)?strcpy(name,_name):strncpy(name,_name,15); name[15]=0; };
CDebugVar(char* _name, PhysPt _adr) { adr=_adr; safe_strncpy(name,_name,16); };
char* GetName(void) { return name; };
PhysPt GetAdr (void) { return adr; };
@ -536,6 +588,9 @@ void CBreakpoint::ShowList(void)
} else if (bp->GetType()==BKPNT_MEMORY) {
DEBUG_ShowMsg("%02X. BPMEM %04X:%04X (%02X)\n",nr,bp->GetSegment(),bp->GetOffset(),bp->GetValue());
nr++;
} else if (bp->GetType()==BKPNT_MEMORY_PROT) {
DEBUG_ShowMsg("%02X. BPPM %04X:%08X (%02X)\n",nr,bp->GetSegment(),bp->GetOffset(),bp->GetValue());
nr++;
};
}
};
@ -603,15 +658,16 @@ static void DrawData(void) {
/* Data win */
for (int y=0; y<8; y++) {
// Adress
mvwprintw (dbg.win_data,1+y,0,"%04X:%04X ",dataSeg,add);
if (add<0x10000) mvwprintw (dbg.win_data,1+y,0,"%04X:%04X ",dataSeg,add);
else mvwprintw (dbg.win_data,1+y,0,"%04X:%08X ",dataSeg,add);
for (int x=0; x<16; x++) {
address = GetAddress(dataSeg,add);
if (!(paging.tlb.handler[address >> 12]->flags & PFLAG_INIT)) {
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);
mvwprintw (dbg.win_data,1+y,14+3*x,"%02X",ch);
if (ch<32 || !isprint(*reinterpret_cast<unsigned char*>(&ch))) ch='.';
mvwprintw (dbg.win_data,1+y,63+x,"%c",ch);
add++;
};
}
@ -661,8 +717,14 @@ static void DrawRegisters(void) {
SetColor((reg_flags ^ oldflags)&FLAG_TF);
mvwprintw (dbg.win_reg,1,77,"%01X",GETFLAG(TF) ? 1:0);
SetColor((reg_flags ^ oldflags)&FLAG_IOPL);
mvwprintw (dbg.win_reg,2,72,"%01X",GETFLAG(IOPL)>>12);
oldflags=reg_flags;
SetColor(cpu.cpl ^ oldcpucpl);
mvwprintw (dbg.win_reg,2,78,"%01X",cpu.cpl);
oldcpucpl=cpu.cpl;
if (cpu.pmode) {
if (reg_flags & FLAG_VM) mvwprintw(dbg.win_reg,0,76,"VM86");
else if (cpu.code.big) mvwprintw(dbg.win_reg,0,76,"Pr32");
@ -843,12 +905,13 @@ bool ChangeRegister(char* str)
if (strstr(hex,"SS")==hex) { hex+=2; SegSet16(ss,(Bit16u)GetHexValue(hex,hex)); } 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,"DF")==hex) { hex+=2; SETFLAGBIT(DF,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; };
if (strstr(hex,"SF")==hex) { hex+=3; SETFLAGBIT(SF,GetHexValue(hex,hex)); } else
{ return false; };
return true;
};
@ -869,6 +932,15 @@ bool ParseCommand(char* str)
SaveMemory(seg,ofs,num);
return true;
};
found = strstr(str,"MEMDUMPBIN ");
if (found) { // Insert variable
found+=11;
Bit16u seg = (Bit16u)GetHexValue(found,found); found++;
Bit32u ofs = GetHexValue(found,found); found++;
Bit32u num = GetHexValue(found,found); found++;
SaveMemoryBin(seg,ofs,num);
return true;
};
found = strstr(str,"IV ");
if (found) { // Insert variable
@ -964,8 +1036,11 @@ bool ParseCommand(char* str)
Bit16u seg = (Bit16u)GetHexValue(found,found);found++; // skip ":"
Bit32u ofs = GetHexValue(found,found);
CBreakpoint* bp = CBreakpoint::AddMemBreakpoint(seg,ofs);
if (bp) bp->SetType(BKPNT_MEMORY_PROT);
DEBUG_ShowMsg("DEBUG: Set prot-mode memory breakpoint at %04X:%08X\n",seg,ofs);
if (bp)
{
bp->SetType(BKPNT_MEMORY_PROT);
DEBUG_ShowMsg("DEBUG: Set prot-mode memory breakpoint at %04X:%08X\n",seg,ofs);
}
return true;
}
found = strstr(str,"BPLM ");
@ -1039,10 +1114,51 @@ bool ParseCommand(char* str)
// DEBUG_Log_Loop(GetHexValue(found,found));
cpuLogFile = fopen("LOGCPU.TXT","wt");
if (!cpuLogFile) {
DEBUG_ShowMsg("DEBUG: Logfile couldnt be created.\n");
DEBUG_ShowMsg("DEBUG: Logfile couldn't be created.\n");
return false;
}
cpuLog = true;
cpuLogType = 1;
cpuLogCounter = GetHexValue(found,found);
debugging=false;
CBreakpoint::ActivateBreakpoints(SegPhys(cs)+reg_eip,true);
ignoreAddressOnce = SegPhys(cs)+reg_eip;
DOSBOX_SetNormalLoop();
return true;
}
found = strstr(str,"LOGS ");
if (found) { // Create Cpu log file
found+=4;
DEBUG_ShowMsg("DEBUG: Starting log\n");
cpuLogFile = fopen("LOGCPU.TXT","wt");
if (!cpuLogFile) {
DEBUG_ShowMsg("DEBUG: Logfile couldn't be created.\n");
return false;
}
cpuLog = true;
cpuLogType = 0;
cpuLogCounter = GetHexValue(found,found);
debugging=false;
CBreakpoint::ActivateBreakpoints(SegPhys(cs)+reg_eip,true);
ignoreAddressOnce = SegPhys(cs)+reg_eip;
DOSBOX_SetNormalLoop();
return true;
}
found = strstr(str,"LOGL ");
if (found) { // Create Cpu log file
found+=4;
DEBUG_ShowMsg("DEBUG: Starting log\n");
cpuLogFile = fopen("LOGCPU.TXT","wt");
if (!cpuLogFile) {
DEBUG_ShowMsg("DEBUG: Logfile couldn't be created.\n");
return false;
}
cpuLog = true;
cpuLogType = 2;
cpuLogCounter = GetHexValue(found,found);
debugging=false;
@ -1100,6 +1216,18 @@ bool ParseCommand(char* str)
LogIDT();
}
found = strstr(str,"PAGING");
if (found) {
found += 6;
while (found[0]==' ') found++;
LogPages(found);
}
found = strstr(str,"CPU");
if (found) {
LogCPUInfo();
}
found = strstr(str,"INTVEC ");
if (found)
{
@ -1124,15 +1252,6 @@ bool ParseCommand(char* str)
}
}
/* found = strstr(str,"EXCEPTION ");
if (found) {
found += 9;
Bit8u num = GetHexValue(found,found);
DPMI_CreateException(num,0xDD);
DEBUG_ShowMsg("Exception %04X\n",num);
};
*/
#if C_HEAVY_DEBUG
found = strstr(str,"HEAVYLOG");
if (found) { // Create Cpu log file
@ -1169,6 +1288,7 @@ bool ParseCommand(char* str)
DEBUG_ShowMsg("INT [nr] / INTT [nr] - Execute / Trace into interrupt.\n");
#if C_HEAVY_DEBUG
DEBUG_ShowMsg("LOG [num] - Write cpu log file.\n");
DEBUG_ShowMsg("LOGS/LOGL [num] - Write short/long cpu log file.\n");
DEBUG_ShowMsg("HEAVYLOG - Enable/Disable automatic cpu when dosbox exits.\n");
#endif
DEBUG_ShowMsg("SR [reg] [value] - Set register value.\n");
@ -1176,14 +1296,21 @@ bool ParseCommand(char* str)
DEBUG_ShowMsg("IV [seg]:[off] [name] - Create var name for memory address.\n");
DEBUG_ShowMsg("SV [filename] - Save var list in file.\n");
DEBUG_ShowMsg("LV [seg]:[off] [name] - Load var list from file.\n");
DEBUG_ShowMsg("LV [filename] - Load var list from file.\n");
DEBUG_ShowMsg("MEMDUMP [seg]:[off] [len] - Write memory to file memdump.txt.\n");
DEBUG_ShowMsg("MEMDUMPBIN [s]:[o] [len] - Write memory to file memdump.bin.\n");
DEBUG_ShowMsg("SELINFO [segName] - Show selector info.\n");
DEBUG_ShowMsg("INTVEC [filename] - Writes interrupt vector table to file.\n");
DEBUG_ShowMsg("INTHAND [intNum] - Set code view to interrupt handler.\n");
DEBUG_ShowMsg("CPU - Display CPU status information.\n");
DEBUG_ShowMsg("GDT - Lists descriptors of the GDT.\n");
DEBUG_ShowMsg("LDT - Lists descriptors of the LDT.\n");
DEBUG_ShowMsg("IDT - Lists descriptors of the IDT.\n");
DEBUG_ShowMsg("PAGING [page] - Display content of page table.\n");
DEBUG_ShowMsg("H - Help\n");
return TRUE;
@ -1288,65 +1415,65 @@ char* AnalyzeInstruction(char* inst, bool saveSelector)
// Must be a jump
if (instu[0] == 'J')
{
bool jmp = 0;
bool jmp = false;
switch (instu[1]) {
case 'A' : { jmp = !GETFLAGBOOL(CF) && !GETFLAGBOOL(ZF); // JA
case 'A' : { jmp = (get_CF()?false:true) && (get_ZF()?false:true); // JA
} break;
case 'B' : { if (instu[2] == 'E') {
jmp = GETFLAGBOOL(CF) && GETFLAGBOOL(ZF); // JBE
jmp = (get_CF()?true:false) && (get_ZF()?true:false); // JBE
} else {
jmp = GETFLAGBOOL(CF); // JB
jmp = get_CF()?true:false; // JB
}
} break;
case 'C' : { if (instu[2] == 'X') {
jmp = reg_cx == 0; // JCXZ
} else {
jmp = GETFLAGBOOL(CF); // JC
jmp = get_CF()?true:false; // JC
}
} break;
case 'E' : { jmp = GETFLAGBOOL(ZF); // JE
case 'E' : { jmp = get_ZF()?true:false; // JE
} break;
case 'G' : { if (instu[2] == 'E') {
jmp = !GETFLAGBOOL(SF); // JGE
jmp = get_SF()?false:true; // JGE
} else {
jmp = !GETFLAGBOOL(SF) && !GETFLAGBOOL(ZF); // JG
jmp = (get_SF()?false:true) && (get_ZF()?false:true); // JG
}
} break;
case 'L' : { if (instu[2] == 'E') {
jmp = GETFLAGBOOL(SF) || GETFLAGBOOL(ZF); // JLE
jmp = (get_SF()?true:false) || (get_ZF()?true:false) ; // JLE
} else {
jmp = GETFLAGBOOL(SF); // JL
jmp = get_SF()?true:false; // JL
}
} break;
case 'M' : { jmp = true; // JMP
} break;
case 'N' : { switch (instu[2]) {
case 'B' :
case 'C' : { jmp = !GETFLAGBOOL(CF); // JNB / JNC
case 'C' : { jmp = get_CF()?false:true; // JNB / JNC
} break;
case 'E' : { jmp = !GETFLAGBOOL(ZF); // JNE
case 'E' : { jmp = get_ZF()?false:true; // JNE
} break;
case 'O' : { jmp = !GETFLAGBOOL(OF); // JNO
case 'O' : { jmp = get_OF()?false:true; // JNO
} break;
case 'P' : { jmp = !GETFLAGBOOL(PF); // JNP
case 'P' : { jmp = get_PF()?false:true; // JNP
} break;
case 'S' : { jmp = !GETFLAGBOOL(SF); // JNS
case 'S' : { jmp = get_SF()?false:true; // JNS
} break;
case 'Z' : { jmp = !GETFLAGBOOL(ZF); // JNZ
case 'Z' : { jmp = get_ZF()?false:true; // JNZ
} break;
}
} break;
case 'O' : { jmp = GETFLAGBOOL(OF); // JMP
case 'O' : { jmp = get_OF()?true:false; // JMP
} break;
case 'P' : { if (instu[2] == 'O') {
jmp = !GETFLAGBOOL(PF); // JPO
jmp = get_PF()?false:true; // JPO
} else {
jmp = GETFLAGBOOL(SF); // JP / JPE
jmp = get_SF()?true:false; // JP / JPE
}
} break;
case 'S' : { jmp = GETFLAGBOOL(SF); // JS
case 'S' : { jmp = get_SF()?true:false; // JS
} break;
case 'Z' : { jmp = GETFLAGBOOL(ZF); // JZ
case 'Z' : { jmp = get_ZF()?true:false; // JZ
} break;
}
if (jmp) {
@ -1374,6 +1501,7 @@ Bit32u DEBUG_CheckKeys(void) {
ParseCommand(codeViewData.inputStr);
break;
case 0x107: //backspace (linux)
case 0x7f: //backspace in some terminal emulators (linux)
case 0x08: // delete
if (strlen(codeViewData.inputStr)>0) codeViewData.inputStr[strlen(codeViewData.inputStr)-1] = 0;
break;
@ -1418,19 +1546,24 @@ Bit32u DEBUG_CheckKeys(void) {
ret=(*cpudecoder)();
break;
case 'D': dataSeg = SegValue(ds);
dataOfs = reg_si;
if (cpu.pmode && !(reg_flags & FLAG_VM)) dataOfs = reg_esi;
else dataOfs = reg_si;
break;
case 'E': dataSeg = SegValue(es);
dataOfs = reg_di;
if (cpu.pmode && !(reg_flags & FLAG_VM)) dataOfs = reg_edi;
else dataOfs = reg_di;
break;
case 'X': dataSeg = SegValue(ds);
dataOfs = reg_dx;
if (cpu.pmode && !(reg_flags & FLAG_VM)) dataOfs = reg_edx;
else dataOfs = reg_dx;
break;
case 'B': dataSeg = SegValue(es);
dataOfs = reg_bx;
if (cpu.pmode && !(reg_flags & FLAG_VM)) dataOfs = reg_ebx;
else dataOfs = reg_bx;
break;
case 'S': dataSeg = SegValue(ss);
dataOfs = reg_sp;
if (cpu.pmode && !(reg_flags & FLAG_VM)) dataOfs = reg_esp;
else dataOfs = reg_sp;
break;
case 'R' : dataOfs -= 16; break;
@ -1527,7 +1660,9 @@ Bitu DEBUG_Loop(void) {
return DEBUG_CheckKeys();
}
void DEBUG_Enable(void) {
void DEBUG_Enable(bool pressed) {
if (!pressed)
return;
static bool showhelp=false;
debugging=true;
SetCodeWinStart();
@ -1537,6 +1672,7 @@ void DEBUG_Enable(void) {
showhelp=true;
DEBUG_ShowMsg("***| PRESS \"H\" TO SHOW ALL COMMANDS. PRESS \"RETURN\" TO ENTER COMMANDMODE. |***\n");
}
KEYBOARD_ClrBuffer();
}
void DEBUG_DrawScreen(void) {
@ -1603,6 +1739,68 @@ static void LogIDT(void)
};
};
void LogPages(char* selname)
{
char out1[512];
if (paging.enabled) {
Bitu sel = GetHexValue(selname,selname);
if ((sel==0x00) && ((*selname==0) || (*selname=='*'))) {
for (int i=0; i<0xfffff; i++) {
Bitu table_addr=(paging.base.page<<12)+(i >> 10)*4;
X86PageEntry table;
table.load=phys_readd(table_addr);
if (table.block.p) {
X86PageEntry entry;
Bitu entry_addr=(table.block.base<<12)+(i & 0x3ff)*4;
entry.load=phys_readd(entry_addr);
if (entry.block.p) {
sprintf(out1,"page %05Xxxx -> %04Xxxx flags [uw] %x:%x::%x:%x",i,entry.block.base,entry.block.us,table.block.us,entry.block.wr,table.block.wr);
LOG(LOG_MISC,LOG_ERROR)(out1);
}
}
}
} else {
Bitu table_addr=(paging.base.page<<12)+(sel >> 10)*4;
X86PageEntry table;
table.load=phys_readd(table_addr);
if (table.block.p) {
X86PageEntry entry;
Bitu entry_addr=(table.block.base<<12)+(sel & 0x3ff)*4;
entry.load=phys_readd(entry_addr);
sprintf(out1,"page %05Xxxx -> %04Xxxx flags [puw] %x:%x::%x:%x::%x:%x",sel,entry.block.base,entry.block.p,table.block.p,entry.block.us,table.block.us,entry.block.wr,table.block.wr);
LOG(LOG_MISC,LOG_ERROR)(out1);
} else {
sprintf(out1,"pagetable %03X not present, flags [puw] %x::%x::%x",(sel >> 10),table.block.p,table.block.us,table.block.wr);
LOG(LOG_MISC,LOG_ERROR)(out1);
}
}
}
};
static void LogCPUInfo(void)
{
char out1[512];
sprintf(out1,"cr0:%08X cr2:%08X cr3:%08X cpl=%x",cpu.cr0,paging.cr2,paging.cr3,cpu.cpl);
LOG(LOG_MISC,LOG_ERROR)(out1);
sprintf(out1,"eflags:%08X [vm=%x iopl=%x nt=%x]",reg_flags,GETFLAG(VM)>>17,GETFLAG(IOPL)>>12,GETFLAG(NT)>>14);
LOG(LOG_MISC,LOG_ERROR)(out1);
sprintf(out1,"GDT base=%08X limit=%08X",cpu.gdt.GetBase(),cpu.gdt.GetLimit());
LOG(LOG_MISC,LOG_ERROR)(out1);
sprintf(out1,"IDT base=%08X limit=%08X",cpu.idt.GetBase(),cpu.idt.GetLimit());
LOG(LOG_MISC,LOG_ERROR)(out1);
Bitu sel;
Descriptor desc;
CPU_STR(sel);
cpu.gdt.GetDescriptor(sel,desc);
sprintf(out1,"TR selector=%04X, base=%08X limit=%08X*%X",sel,desc.GetBase(),desc.GetLimit(),desc.saved.seg.g?0x4000:1);
LOG(LOG_MISC,LOG_ERROR)(out1);
sel=cpu.gdt.SLDT();
cpu.gdt.GetDescriptor(sel,desc);
sprintf(out1,"LDT selector=%04X, base=%08X limit=%08X*%X",sel,desc.GetBase(),desc.GetLimit(),desc.saved.seg.g?0x4000:1);
LOG(LOG_MISC,LOG_ERROR)(out1);
};
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 };
@ -1614,13 +1812,41 @@ static void LogInstruction(Bit16u segValue, Bit32u eipValue, char* buffer)
char* res = empty;
if (showExtend) {
res = AnalyzeInstruction(dline,false);
len = strlen(dline);
#if C_HEAVY_DEBUG
if (cpuLogType>=2) {
Bitu reslen=strlen(res);
if (reslen<24) for (Bitu i=0; i<24-reslen; i++) strcat(res," ");
} else
#endif
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 IF:%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),GETFLAGBOOL(IF));
#if C_HEAVY_DEBUG
if (cpuLogType==1) {
#endif
if (len<30) for (Bitu i=0; i<30-len; i++) strcat(dline," ");
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 IF:%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()?1:0,get_ZF()?1:0,get_SF()?1:0,get_OF()?1:0,get_AF()?1:0,get_PF()?1:0,GETFLAGBOOL(IF));
#if C_HEAVY_DEBUG
} else if (cpuLogType==0) {
if (len<27) for (Bitu i=0; i<27-len; i++) strcat(dline," ");
sprintf(buffer,"%04X:%04X %s EAX:%08X EBX:%08X ECX:%08X EDX:%08X ESI:%08X EDI:%08X EBP:%08X ESP:%08X DS:%04X ES:%04X SS:%04X C%01X Z%01X S%01X O%01X I%01X\n",segValue,eipValue,dline,reg_eax,reg_ebx,reg_ecx,reg_edx,reg_esi,reg_edi,reg_ebp,reg_esp,SegValue(ds),SegValue(es),SegValue(ss),
get_CF()?1:0,get_ZF()?1:0,get_SF()?1:0,get_OF()?1:0,GETFLAGBOOL(IF));
} else {
if (len<34) for (Bitu i=0; i<34-len; i++) strcat(dline," ");
char ibytes[200]=""; char tmpc[200];
for (Bitu i=0; i<size; i++) {
sprintf(tmpc,"%02X ",mem_readb(start+i));
strcat(ibytes,tmpc);
}
len=strlen(ibytes);
if (len<21) for (Bitu i=0; i<21-len; i++) strcat(ibytes," ");
sprintf(buffer,"%04X:%08X %s %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 IF:%01X TF:%01X VM:%01X FLG:%08X CR0:%08X\n",segValue,eipValue,ibytes,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()?1:0,get_ZF()?1:0,get_SF()?1:0,get_OF()?1:0,get_AF()?1:0,get_PF()?1:0,GETFLAGBOOL(IF),GETFLAGBOOL(TF),GETFLAGBOOL(VM),reg_flags,cpu.cr0);
}
#endif
};
static bool DEBUG_Log_Loop(int count) {
@ -1671,7 +1897,7 @@ public:
char filename[128];
char args[256];
cmd->FindCommand(1,temp_line);
strncpy(filename,temp_line.c_str(),128);
safe_strncpy(filename,temp_line.c_str(),128);
// Read commandline
Bit16u i =2;
bool ok = false;
@ -1723,7 +1949,7 @@ void DEBUG_CheckExecuteBreakpoint(Bit16u seg, Bit32u off)
Bitu DEBUG_EnableDebugger(void)
{
exitLoop = true;
DEBUG_Enable();
DEBUG_Enable(true);
CPU_Cycles=CPU_CycleLeft=0;
return 0;
};
@ -1758,7 +1984,8 @@ static void DEBUG_ShutDown(Section * sec)
#ifndef WIN32
curs_set(old_cursor_state);
tcsetattr(0, TCSANOW,&consolesettings);
printf("\e[0m\e[2J");
// printf("\e[0m\e[2J"); //Seems to destroy scrolling
printf("\ec");
fflush(NULL);
#endif
};
@ -1770,7 +1997,7 @@ void DEBUG_Init(Section* sec) {
MSG_Add("DEBUG_CONFIGFILE_HELP","Debugger related options.\n");
DEBUG_DrawScreen();
/* Add some keyhandlers */
MAPPER_AddHandler(DEBUG_Enable,MK_pause,0,"debugger","Debugger");
MAPPER_AddHandler(DEBUG_Enable,MK_pause,MMOD2,"debugger","Debugger");
/* Clear the TBreakpoint list */
memset((void*)&codeViewData,0,sizeof(codeViewData));
/* setup debug.com */
@ -1857,7 +2084,7 @@ bool CDebugVar::LoadVars(char* name)
return true;
};
static void SaveMemory(Bitu seg, Bitu ofs1, Bit32s num)
static void SaveMemory(Bitu seg, Bitu ofs1, Bit32u num)
{
FILE* f = fopen("MEMDUMP.TXT","wt");
if (!f) {
@ -1884,6 +2111,22 @@ static void SaveMemory(Bitu seg, Bitu ofs1, Bit32s num)
DEBUG_ShowMsg("DEBUG: Memory dump success.\n");
};
static void SaveMemoryBin(Bitu seg, Bitu ofs1, Bit32u num) {
FILE* f = fopen("MEMDUMP.BIN","wb");
if (!f) {
DEBUG_ShowMsg("DEBUG: Memory binary dump failed.\n");
return;
}
for(Bitu x = 0; x < num;x++) {
Bit8u val = mem_readb(GetAddress(seg,ofs1+x));
fwrite(&val,1,1,f);
};
fclose(f);
DEBUG_ShowMsg("DEBUG: Memory dump binary success.\n");
};
static void OutputVecTable(char* filename)
{
FILE* f = fopen(filename, "wt");

View File

@ -260,7 +260,7 @@ static char *op386map1[256] = {
"call %Jv", "jmp %Jv", "jmp %Ap", "jmp %Ks%Jb",
"in al,dx", "in %eax,dx", "out dx,al", "out dx,%eax",
/* f */
"lock %p ", 0, "repne %p ", "repe %p ",
"lock %p ", "icebp", "repne %p ", "repe %p ",
"hlt", "cmc", "%g2", "%g2",
"clc", "stc", "cli", "sti",
"cld", "std", "%g3", "%g4"
@ -269,8 +269,8 @@ static char *op386map1[256] = {
static char *second[] = {
/* 0 */
"%g5", "%g6", "lar %Gv,%Ew", "lsl %Gv,%Ew",
0, "loadall", "clts", "loadall",
"invd", "wbinvd", 0, 0,
0, "[loadall]", "clts", "[loadall]",
"invd", "wbinvd", 0, "UD2",
0, 0, 0, 0,
/* 1 */
"mov %Eb,%Gb", "mov %Ev,%Gv", "mov %Gb,%Eb", "mov %Gv,%Ev",
@ -308,7 +308,7 @@ static char *second[] = {
"sets %Eb", "setns %Eb", "setp %Eb", "setnp %Eb",
"setl %Eb", "setge %Eb", "setle %Eb", "setg %Eb",
/* a */
"push fs", "pop fs", 0, "bt %Ev,%Gv",
"push fs", "pop fs", "cpuid", "bt %Ev,%Gv",
"shld %Ev,%Gv,%Ib", "shld %Ev,%Gv,cl", 0, 0,
"push gs", "pop gs", 0, "bts %Ev,%Gv",
"shrd %Ev,%Gv,%Ib", "shrd %Ev,%Gv,cl", 0, "imul %Gv,%Ev",
@ -354,7 +354,7 @@ static char *groups[][8] = { /* group 0 is group 3 for %Ev set */
"verr %Ew", "verw %Ew", 0, 0 },
/* 6 */
{ "sgdt %Ms", "sidt %Ms", "lgdt %Ms", "lidt %Ms",
"smsw %Ew", 0, "lmsw %Ew", 0 },
"smsw %Ew", 0, "lmsw %Ew", "invlpg" },
/* 7 */
{ 0, 0, 0, 0,
"bt", "bts", "btr", "btc" }
@ -363,8 +363,10 @@ static char *groups[][8] = { /* group 0 is group 3 for %Ev set */
/* zero here means invalid. If first entry starts with '*', use st(i) */
/* no assumed %EFs here. Indexed by RM(modrm()) */
static char *f0[] = { 0, 0, 0, 0, 0, 0, 0, 0};
static char *fop_8[] = { "*fld st,%GF" };
static char *fop_9[] = { "*fxch st,%GF" };
static char *fop_10[] = { "fnop", 0, 0, 0, 0, 0, 0, 0 };
static char *fop_11[] = { "*fst st,%GF" };
static char *fop_12[] = { "fchs", "fabs", 0, 0, "ftst", "fxam", 0, 0 };
static char *fop_13[] = { "fld1", "fldl2t", "fldl2e", "fldpi",
"fldlg2", "fldln2", "fldz", 0 };
@ -373,20 +375,24 @@ static char *fop_14[] = { "f2xm1", "fyl2x", "fptan", "fpatan",
static char *fop_15[] = { "fprem", "fyl2xp1", "fsqrt", "fsincos",
"frndint", "fscale", "fsin", "fcos" };
static char *fop_21[] = { 0, "fucompp", 0, 0, 0, 0, 0, 0 };
static char *fop_28[] = { 0, 0, "fclex", "finit", 0, 0, 0, 0 };
static char *fop_28[] = { "[fneni]", "[fndis]", "fclex", "finit", "[fnsetpm]", "[frstpm]", 0, 0 };
static char *fop_32[] = { "*fadd %GF,st" };
static char *fop_33[] = { "*fmul %GF,st" };
static char *fop_34[] = { "*fcom %GF,st" };
static char *fop_35[] = { "*fcomp %GF,st" };
static char *fop_36[] = { "*fsubr %GF,st" };
static char *fop_37[] = { "*fsub %GF,st" };
static char *fop_38[] = { "*fdivr %GF,st" };
static char *fop_39[] = { "*fdiv %GF,st" };
static char *fop_40[] = { "*ffree %GF" };
static char *fop_41[] = { "*fxch %GF" };
static char *fop_42[] = { "*fst %GF" };
static char *fop_43[] = { "*fstp %GF" };
static char *fop_44[] = { "*fucom %GF" };
static char *fop_45[] = { "*fucomp %GF" };
static char *fop_48[] = { "*faddp %GF,st" };
static char *fop_49[] = { "*fmulp %GF,st" };
static char *fop_50[] = { "*fcomp %GF,st" };
static char *fop_51[] = { 0, "fcompp", 0, 0, 0, 0, 0, 0 };
static char *fop_52[] = { "*fsubrp %GF,st" };
static char *fop_53[] = { "*fsubp %GF,st" };
@ -396,12 +402,12 @@ static char *fop_60[] = { "fstsw ax", 0, 0, 0, 0, 0, 0, 0 };
static char **fspecial[] = { /* 0=use st(i), 1=undefined 0 in fop_* means undefined */
0, 0, 0, 0, 0, 0, 0, 0,
0, fop_9, fop_10, 0, fop_12, fop_13, fop_14, fop_15,
fop_8, fop_9, fop_10, fop_11, fop_12, fop_13, fop_14, fop_15,
f0, f0, f0, f0, f0, fop_21, f0, f0,
f0, f0, f0, f0, fop_28, f0, f0, f0,
fop_32, fop_33, f0, f0, fop_36, fop_37, fop_38, fop_39,
fop_40, f0, fop_42, fop_43, fop_44, fop_45, f0, f0,
fop_48, fop_49, f0, fop_51, fop_52, fop_53, fop_54, fop_55,
fop_32, fop_33, fop_34, fop_35, fop_36, fop_37, fop_38, fop_39,
fop_40, fop_41, fop_42, fop_43, fop_44, fop_45, f0, f0,
fop_48, fop_49, fop_50, fop_51, fop_52, fop_53, fop_54, fop_55,
f0, f0, f0, f0, fop_60, f0, f0, f0,
};

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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,9 +16,10 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: debug_gui.cpp,v 1.28 2006/02/09 11:47:48 qbix79 Exp $ */
#include "dosbox.h"
#if C_DEBUG
#include "setup.h"
#include <stdlib.h>
@ -36,11 +37,16 @@ struct _LogGroup {
char * front;
bool enabled;
};
#include <list>
#include <string>
using namespace std;
#define MAX_LOG_BUFFER 500
static list<string> logBuff;
static list<string>::iterator logBuffPos = logBuff.end();
static _LogGroup loggrp[LOG_MAX]={{"",true},{0,false}};
static FILE* debuglog;
static std::list<char*> logBuff;
static std::list<char*>::iterator logBuffPos = logBuff.end();
extern int old_cursor_state;
@ -60,19 +66,15 @@ void DEBUG_ShowMsg(char * format,...) {
if(debuglog) fprintf(debuglog,"%s",buf);
char* newLine = new char[strlen(buf) + 1];
strcpy(newLine, buf);
if (logBuffPos!=logBuff.end()) {
logBuffPos=logBuff.end();
DEBUG_RefreshPage(0);
mvwprintw(dbg.win_out,dbg.win_out->_maxy-1, 0, "");
}
logBuff.push_back(newLine);
if (logBuff.size()>500) {
char * firstline = logBuff.front();
delete firstline;
logBuff.push_back(buf);
if (logBuff.size() > MAX_LOG_BUFFER)
logBuff.pop_front();
}
logBuffPos = logBuff.end();
wprintw(dbg.win_out,"%s",buf);
wrefresh(dbg.win_out);
@ -82,14 +84,15 @@ void DEBUG_RefreshPage(char scroll) {
if (scroll==-1 && logBuffPos!=logBuff.begin()) logBuffPos--;
else if (scroll==1 && logBuffPos!=logBuff.end()) logBuffPos++;
std::list<char*>::iterator i = logBuffPos;
list<string>::iterator i = logBuffPos;
int rem_lines = dbg.win_out->_maxy;
wclear(dbg.win_out);
while (rem_lines > 0 && i!=logBuff.begin()) {
rem_lines -= (int) (strlen(*--i) / dbg.win_out->_maxx) + 1;
mvwprintw(dbg.win_out,rem_lines-1, 0, *i);
rem_lines -= (int) ((*--i).size() / dbg.win_out->_maxx) + 1;
/* Const cast is needed for pdcurses which has no const char in mvwprintw (bug maybe) */
mvwprintw(dbg.win_out,rem_lines-1, 0, const_cast<char*>((*i).c_str()));
}
wrefresh(dbg.win_out);
}
@ -127,6 +130,8 @@ static void Draw_RegisterLayout(void) {
mvwaddstr(dbg.win_reg,1,28,"CS=");
mvwaddstr(dbg.win_reg,1,38,"EIP=");
mvwaddstr(dbg.win_reg,2,75,"CPL");
mvwaddstr(dbg.win_reg,2,68,"IOPL");
mvwaddstr(dbg.win_reg,1,52,"C Z S O A P D I T ");
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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
@ -18,7 +18,7 @@
/* Local Debug Function */
/* $Id: debug_inc.h,v 1.8 2004/08/28 12:51:35 qbix79 Exp $ */
/* $Id: debug_inc.h,v 1.10 2006/02/09 11:47:48 qbix79 Exp $ */
#include <curses.h>
#include "mem.h"

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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
@ -69,6 +69,7 @@ static void ResizeConsole( HANDLE hConsole, SHORT xSize, SHORT ySize ) {
void WIN32_Console() {
AllocConsole();
SetConsoleTitle("DOSBox Debugger");
ResizeConsole(GetStdHandle(STD_OUTPUT_HANDLE),80,50);
}
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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

View File

@ -6,4 +6,5 @@ libdos_a_SOURCES = dos.cpp dos_devices.cpp dos_execute.cpp dos_files.cpp dos_ioc
dos_misc.cpp dos_classes.cpp dos_programs.cpp dos_tables.cpp \
drives.cpp drives.h drive_virtual.cpp drive_local.cpp drive_cache.cpp drive_fat.cpp \
drive_iso.cpp dev_con.h dos_mscdex.cpp \
cdrom.h cdrom.cpp cdrom_ioctl_win32.cpp cdrom_aspi_win32.cpp cdrom_ioctl_linux.cpp cdrom_image.cpp
cdrom.h cdrom.cpp cdrom_ioctl_win32.cpp cdrom_aspi_win32.cpp cdrom_ioctl_linux.cpp cdrom_image.cpp \
cdrom_ioctl_os2.cpp

View File

@ -1,8 +1,8 @@
# Makefile.in generated by automake 1.9.3 from Makefile.am.
# Makefile.in generated by automake 1.9.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004 Free Software Foundation, Inc.
# 2003, 2004, 2005 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.
@ -62,7 +62,8 @@ am_libdos_a_OBJECTS = dos.$(OBJEXT) dos_devices.$(OBJEXT) \
drive_cache.$(OBJEXT) drive_fat.$(OBJEXT) drive_iso.$(OBJEXT) \
dos_mscdex.$(OBJEXT) cdrom.$(OBJEXT) \
cdrom_ioctl_win32.$(OBJEXT) cdrom_aspi_win32.$(OBJEXT) \
cdrom_ioctl_linux.$(OBJEXT) cdrom_image.$(OBJEXT)
cdrom_ioctl_linux.$(OBJEXT) cdrom_image.$(OBJEXT) \
cdrom_ioctl_os2.$(OBJEXT)
libdos_a_OBJECTS = $(am_libdos_a_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
@ -107,6 +108,8 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
HAVE_WINDRES_FALSE = @HAVE_WINDRES_FALSE@
HAVE_WINDRES_TRUE = @HAVE_WINDRES_TRUE@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
@ -132,10 +135,12 @@ SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
WINDRES = @WINDRES@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
ac_ct_WINDRES = @ac_ct_WINDRES@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
@ -184,7 +189,8 @@ libdos_a_SOURCES = dos.cpp dos_devices.cpp dos_execute.cpp dos_files.cpp dos_ioc
dos_misc.cpp dos_classes.cpp dos_programs.cpp dos_tables.cpp \
drives.cpp drives.h drive_virtual.cpp drive_local.cpp drive_cache.cpp drive_fat.cpp \
drive_iso.cpp dev_con.h dos_mscdex.cpp \
cdrom.h cdrom.cpp cdrom_ioctl_win32.cpp cdrom_aspi_win32.cpp cdrom_ioctl_linux.cpp cdrom_image.cpp
cdrom.h cdrom.cpp cdrom_ioctl_win32.cpp cdrom_aspi_win32.cpp cdrom_ioctl_linux.cpp cdrom_image.cpp \
cdrom_ioctl_os2.cpp
all: all-am
@ -237,6 +243,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdrom_aspi_win32.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdrom_image.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdrom_ioctl_linux.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdrom_ioctl_os2.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdrom_ioctl_win32.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dos.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dos_classes.Po@am__quote@

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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
@ -53,7 +53,9 @@ bool CDROM_Interface_SDL::SetDevice (char* path, int forceCD)
int num = SDL_CDNumDrives();
if ((forceCD>=0) && (forceCD<num)) {
driveID = forceCD;
return true;
cd = SDL_CDOpen(driveID);
SDL_CDStatus(cd);
return true;
};
const char* cdname = 0;
@ -164,7 +166,7 @@ int CDROM_GetMountType(char* path, int forceCD)
const char* cdName;
char buffer[512];
strcpy(buffer,path);
#if defined (WIN32)
#if defined (WIN32) || defined(OS2)
upcase(buffer);
#endif
@ -183,10 +185,8 @@ int CDROM_GetMountType(char* path, int forceCD)
// Detect ISO
struct stat file_stat;
stat(path, &file_stat);
if (S_ISREG(file_stat.st_mode)) return 1;
return 2;
if ((stat(path, &file_stat) == 0) && S_ISREG(file_stat.st_mode)) return 1;
return 2;
};
// ******************************************************

View File

@ -296,7 +296,7 @@ private:
#endif /* WIN 32 */
#if defined (LINUX)
#if defined (LINUX) || defined(OS2)
class CDROM_Interface_Ioctl : public CDROM_Interface_SDL
{

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: cdrom_aspi_win32.cpp,v 1.12 2004/08/04 09:12:53 qbix79 Exp $ */
/* $Id: cdrom_aspi_win32.cpp,v 1.16 2006/02/09 11:47:48 qbix79 Exp $ */
#if defined (WIN32)
@ -24,6 +24,7 @@
#include "dosbox.h"
#include "cdrom.h"
#include "support.h"
//Are actually system includes but leave for now
#include "wnaspi32.h"
@ -219,8 +220,7 @@ bool CDROM_Interface_Aspi::GetVendor(BYTE HA_num, BYTE SCSI_Id, BYTE SCSI_Lun, c
strcpy (szBuffer, "error" );
return false;
} else {
strncpy(szBuffer,szBuffer+8,25);
szBuffer[25] = 0;
safe_strncpy(szBuffer,szBuffer+8,26);
int len = strlen(szBuffer);
for (int i=0; i<len; i++) if (szBuffer[i]<=32) szBuffer[i]='_';
};

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: cdrom_image.cpp,v 1.4 2004/10/05 19:55:03 qbix79 Exp $ */
/* $Id: cdrom_image.cpp,v 1.11 2006/02/09 11:47:48 qbix79 Exp $ */
#include <cctype>
#include <cmath>
@ -29,9 +29,12 @@
#include <sys/stat.h>
#include "cdrom.h"
#include "drives.h"
#include "support.h"
#if !defined(WIN32)
#include <libgen.h>
#else
#include <string.h>
#endif
using namespace std;
@ -256,7 +259,7 @@ bool CDROM_Interface_Image::ReadSectors(PhysPt buffer, bool raw, unsigned long s
Bitu buflen = num * sectorSize;
Bit8u* buf = new Bit8u[buflen];
bool success;
bool success = true; //Gobliiins reads 0 sectors
for(int i = 0; i < num; i++) {
success = ReadSector(&buf[i * sectorSize], raw, sector);
if (!success) break;
@ -387,6 +390,22 @@ bool CDROM_Interface_Image::CanReadPVD(TrackFile *file, int sectorSize, bool mod
return (pvd[0] == 1 && !strncmp((char*)(&pvd[1]), "CD001", 5) && pvd[6] == 1);
}
#if defined(WIN32)
static string dirname(char * file) {
char * sep = strrchr(file, '\\');
if (sep == NULL)
sep = strrchr(file, '/');
if (sep == NULL)
return "";
else {
int len = (int)(sep - file);
char tmp[MAX_FILENAME_LENGTH];
safe_strncpy(tmp, file, len+1);
return tmp;
}
}
#endif
bool CDROM_Interface_Image::LoadCueSheet(char *cuefile)
{
Track track = {0, 0, 0, 0, 0, 0, false, NULL};
@ -398,12 +417,8 @@ bool CDROM_Interface_Image::LoadCueSheet(char *cuefile)
bool success;
bool canAddTrack = false;
char tmp[MAX_FILENAME_LENGTH]; // dirname can change its argument
strncpy(tmp, cuefile, MAX_FILENAME_LENGTH);
#if defined(WIN32)
string pathname("");
#else
safe_strncpy(tmp, cuefile, MAX_FILENAME_LENGTH);
string pathname(dirname(tmp));
#endif
ifstream in;
in.open(cuefile, ios::in);
if (in.fail()) return false;
@ -572,17 +587,15 @@ bool CDROM_Interface_Image::GetRealFileName(string &filename, string &pathname)
if (stat(filename.c_str(), &test) == 0) return true;
// check if file with path relative to cue file exists
#ifndef WIN32
string tmpstr(pathname + "/" + filename);
if (stat(tmpstr.c_str(), &test) == 0) {
filename = tmpstr;
return true;
}
#endif
// finally check if file is in a dosbox local drive
char fullname[CROSS_LEN];
char tmp[CROSS_LEN];
strncpy(tmp, filename.c_str(), CROSS_LEN);
safe_strncpy(tmp, filename.c_str(), CROSS_LEN);
Bit8u drive;
if (!DOS_MakeName(tmp, fullname, &drive)) return false;

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2004 The DOSBox Team
* Copyright (C) 2002-2006 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
@ -19,6 +19,7 @@
#include <string.h>
#include "cdrom.h"
#include "support.h"
#if defined (LINUX)
#include <fcntl.h>
@ -45,7 +46,7 @@ bool CDROM_Interface_Ioctl::GetUPC(unsigned char& attr, char* upc)
if (ret > 0) {
attr = 0;
strncpy(upc, (char*)cdrom_mcn.medium_catalog_number, 14);
safe_strncpy(upc, (char*)cdrom_mcn.medium_catalog_number, 14);
}
return (ret > 0);
@ -86,7 +87,7 @@ bool CDROM_Interface_Ioctl::SetDevice(char* path, int forceCD)
if (success) {
const char* tmp = SDL_CDName(forceCD);
if (tmp) strncpy(device_name, tmp, 512);
if (tmp) safe_strncpy(device_name, tmp, 512);
else success = false;
}

Some files were not shown because too many files have changed in this diff Show More