DOSBox Compilation Guides

General information and assistance with DOSBox.

DOSBox Compilation Guides

Postby DosFreak » 2017-8-30 @ 20:53

The intent of the attached guides is to update the documentation on the DOSBox WIKI:
https://www.dosbox.com/wiki/BuildingDOSBox


Credits:
gandhig (For reviewing the guide and providing corrections and testing)
Qbix
Neozeed
All the people that wrote the guides that I read to make this one.
Attachments
DOSBOXMingw64.txt
(14.63 KiB) Downloaded 8 times
DOSBOXMINGW.txt
(17.69 KiB) Downloaded 4 times
mingwrt-5.0.1-mingw32-dev-NOSSE.zip
(943.74 KiB) Downloaded 3 times
dosboxsvn-10262017-mingw64710-NT351+.zip
(9.26 MiB) Downloaded 8 times
dosboxsvn-10262017-mingw630-NT351+.zip
(8.58 MiB) Downloaded 8 times
DXSDKFEBJune2010forSDL1.2.x.zip
(275.23 KiB) Downloaded 4 times
MINGW64-5.0.2-DXfiles-for-MINGW32.zip
(101.36 KiB) Downloaded 3 times
DOSBOXVisualStudioMultTarget.txt
(29.76 KiB) Downloaded 13 times
DOSBOXVisualStudioIndiv.txt
(38.36 KiB) Downloaded 24 times
vbempj.zip
(125.83 KiB) Downloaded 21 times
Q932590.zip
(206.91 KiB) Downloaded 23 times
SDL_net-1.2.8-NT351-95-NT4forGCC.zip
(587.46 KiB) Downloaded 29 times
dosboxsvn09182017-351tovista.zip
(6.29 MiB) Downloaded 21 times
vc6redistsetup_enu.zip
(1.71 MiB) Downloaded 30 times
User avatar
DosFreak
l33t++
 
Posts: 9484
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DOSBox Compilation Guides

Postby DosFreak » 2017-9-21 @ 12:03

COMPILING DOSBOX
https://github.com/aqualung99/dosbox-0. ... 75GLES.txt
https://www.chocolate-doom.org/wiki/ind ... ing_Cygwin
https://github.com/msys2/msys2/wiki/MSYS2-installation
MAC: https://hexeract.wordpress.com/2016/09/ ... cos-sierra

MSVC
Look into compiling from CLI https://doc.libretro.com/compilation/wi ... c-cmdline/
Update VS guides with mingw-w64 guide updates.
Repositories vs zips. Test
Use vbempj.zip for NT3.51
Instructions for 64bit DOSBox (not recommended due to slow dynrec)
If dynamic then list redist as requirement
Updated MSVC guide with MINGW64 guide changes
diff against SDL and DOSBOX for changes? Mabye provide both methods.
Use Mingw with Visual Studio https://stackoverflow.com/questions/156 ... le-project
SDL_NET 1.2.7 vs 1.2.8
VS compiled DOSBox with /MT does not require msvcrt.dll
Command to gather all executables and dlls
Equivalent to "make clean"
Need to verify dependencies work in dosbox
Possible issue with SDL_Sound http://www.vogons.org/viewtopic.php?t=39101&p=354759
Add DOSBox files to package
Precompiled libraries
static link libraries or not?
viewtopic.php?t=3944
PNGLIB PATCH viewtopic.php?f=32&t=53116&p=573451#p573451
Verify SDL_SOUND and other sound libriaries and see if they work.
Comment vs removing issues in dependencies.
For pnflibconf.h bug look into putting in troubleshooting section.
Download free versions of Visual Studio Versions and Platform and Windows SDKs. https://en.wikipedia.org/wiki/Microsoft_Windows_SDK

NT3.51 requirements: MSVCRT
95 requirements: Winsock2, OpenGL, IE4 Active Desktop, MSVCRT
NT4 requirements: IE4 Active Desktop

GIT
GIT vs VisualSVN and TortoiseSVN
Visual Studio 2017 GIT support
https://git-for-windows.github.io/

Relative paths for projects:
If C:\BUILD\Dosbox
then should be able to point to $(ProjectDir)..\whatever or ..\whatever

STATIC LINK TO MSVCRT.dll like MS does for programs that come with Windows?
May have to use /MD with WDDK 2003 SP1 compiler or PSDK 2003 SP1
Windows Server 2003 SP1 Platform SDK https://www.microsoft.com/en-us/downloa ... x?id=12261
or mabye link with the 7600.16385.1 WDK
http://planet.jboss.org/post/fighting_t ... t_dll_hell

https://hero.handmade.network/forums/co ... on_windows
http://bearwindows.zcm.com.au/msvc.htm#c8

OPERATING SYSTEM COMPATIBILITY

COMPILE DOSBOX WITH COMPILERS THAT DO NOT SUPPORT WINDOWS 95

Blackwingcat vcfix
http://blog.livedoor.jp/blackwingcat/ar ... 52362.html

To use:
-----------------------
add to dosbox.cpp
#define WINVER2 0x0400
#include "commonfix.h"

and add commonfix.h to the dosbox\src directory for now.
--------------------------------------------

VS2005 compiled DOSBox

Windows 95 missing:
InterlockedCompareExchange (Fixed with LegacyExtender)

VS2010 compiled DOSBox

Windows 95 missing:
EncodePointer (Fixed with LegacyExtender)
DecodePointer (Fixed with LegacyExtender)
FindFirstFileExA
HeapSetInformation (Fixed with LegacyExtender)

VS2012 compiled DOSBox

Windows 95 missing:
InitializeCriticalSectionEx
EncodePointer
DecodePointer
GetModuleHandleExW
FindFirstFileExW
InitOnceExecuteOnce
SetFilePointerEx
FlsAlloc
FlsGetValue
FlsSetValue
FlsFree
GetTickCount64
CompareStringEx
GetLocaleInfoEx
GetUserDefaultLocaleName
LCMapStringEx
IsValidLocaleName
EnumSystemLocalesEx

MINGW

LOW
Repositories vs zips. Test on mingw32 and mingw64
Use vbempj.zip for NT3.51
Instructions for setting up MINGW 6.3.0 with MINGWRT 3.22 or with MINGWRT v5 with crt2.o from 3.22
diff against SDL and DOSBOX for changes? Mabye provide both methods.
SDL_NET 1.2.7 vs 1.2.8 OS compatibility
Add DOSBox files to package
Precompiled libraries? Any point?
DOSBox Debug viewtopic.php?t=3944
QtCreator vs Codeblocks

Check sdl_net and verify if changes for NT 3.51 and 9x are needed.
Check gandhig PM for SSE executables for Windows 95.
Possible mouse issue with SDL 1.2.15 and 9x. Mouse cursor frozen on exiting DOSBox sometimes. Execute dosbox again to unfreeze.
https://sourceforge.net/p/scummvm/bugs/5859/
---------------
NT3.50
w32api
winbase.h
getsystemtimeasfiletime

To make a working VICE SDL binary for Windows NT 3.50 the following needs to be done:

- Compile SDL without DX, GL and joystick support:

SDL_config_win32.h

REMOVE:
#define SDL_AUDIO_DRIVER_DSOUND 1
#define SDL_VIDEO_DRIVER_DDRAW 1
#define SDL_VIDEO_OPENGL 1
#define SDL_VIDEO_OPENGL_WGL 1

SDL_config_win32.h
ADD
#define NO_CHANGEDISPLAYSETTINGS 1

SDL.DSP

REMOVE
Directx.h
SDL_dx5audio.c
SDL_dx5audio.h
SDL_dx5events.c
SDL_dx5events_c.h
SDL_dx5video.c
SDL_dx5video.h
SDL_dx5yuv.c
SDL_dx5yuv_c.h
SDL_joystick.c
SDL_joystick_c.h
SDL_mmjoystick.c
SDL_sysjoystick.h


C:\Mingw\msys\1.0\home\XXX\BUILD\DOSBOX\3.50\SDL-1.2.15\include\sdl_config_win32.h
#define SDL_JOYSTICK_DISABLED 1

------------------------
zips vs version contrl

SDL - online newer
SDL_net - online newer
sdlsound online newer


flac same
zlib same
libpng same
libogg same
libvorbis same

HIGH
http://matpack.de/cygwin/
Instructions for 64bit DOSBox (not recommended due to slow dynrec)
Verify dependencies work in dosbox
Possible issue with SDL_Sound http://www.vogons.org/viewtopic.php?t=39101&p=354759

Compile automake,gawk,libtool for mingw from here: https://ftp.gnu.org/gnu/
Compile pkg-config for mingw https://pkg-config.freedesktop.org/releases/?C=M;O=D

Procedures for testing:
screenshot CTRL+F5
video capture CTRL+ALT+F5
networking IPX and modem
bin/cue CD audio,flac,ogg,mp3




Remove MSVCRT dependency:
http://nullprogram.com/blog/2016/01/31/
https://stackoverflow.com/questions/730 ... pendencies

LINUX HOST
https://lists.gnu.org/archive/html/ming ... 00045.html
Cross compile Linux to Windows

It is also possible to cross compile from Linux to windows using the MinGW cross tools and even to run the test suite under Wine, the Linux/*nix windows emulator.

On Debian and Ubuntu systems, these cross compiler tools can be installed by doing:

sudo apt-get mingw32 mingw32-binutils mingw32-runtime wine
Once these tools are installed its possible to compile and test by executing the following commands, or something similar depending on your system:

./configure --host=i586-mingw32msvc --target=i586-mingw32msvc --build=i586-linux
make
make check


DOSBOX COMPILED WITH VS2008 (Runs on NT3.51)

Windows NT 3.5 SP0

KERNEL32.DLL
GetSystemTimeAsFileTime

USER32.DLL (Need to remove fullscreen support in SDL)
ChangeDisplaySettingsA
EnumDisplaySettingsA

WINMM.DLL (Need to remove joystick support from SDL)
joyGetPosEx

Missing APIs in Windows NT 3.10:

KERNEL32.DLL:
CompareStringA (only CompareStringW exists)
EnumSystemLocalesA (only EnumSystemLocalesW exists)
GetLocaleInfoA (only GetLocaleInfoW exists)
GetStringTypeA (only GetStringTypeW exists)
GetSystemTimeAsFileTime
GetVersionExA (only non-Ex version GetVersion available)
LCMapStringA (only LCMapStringW exists)

USER32.DLL
ChangeDisplaySettingsA
CreateIconFromResourceEx (only non-Ex version CreateIconFromResource available)
EnumDisplaySettingsA
GetKeyboardLayout
LoadImageA (only LoadBitmapA exists)
MapVirtualKeyExA (only non-Ex version MapVirtualKeyA available)
ToAsciiEx (only non-Ex version ToAscii available)

WINMM.DLL
joyGetPosEx (only non-Ex version joyGetPos available)

GDI32.DLL
CreateDIBSection
GetDeviceGammaRamp
SetDIBColorTable
SetDeviceGammaRamp

OLE32.DLL (whole file is missing in NT 3.10 retail and SP3)
CoInitialize


BUILDBOT


Need to look into either a #define to remove ActiveDesktop or a fallback if no Active Desktop found.


THIRD PARTY PATCHES
viewtopic.php?f=32&t=35256&p=301919#p301814
https://blogs.msdn.microsoft.com/chuckw ... rtain-age/
Pixel Perfect Patch
https://roadtoalm.com/2013/10/22/use-vi ... cal-files/
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\vsdiffmerge.exe
http://gnuwin32.sourceforge.net/packages/patch.htm

SDL2 on Windows 2000
https://www.tapatalk.com/groups/win2kga ... t1073.html
viewtopic.php?f=32&t=34770&start=60#p537272

MIDI
https://www.dosbox.com/wiki/MIDI_software_devices
viewtopic.php?f=33&t=55993

MUNT Windows 98

A multi-platform software synthesiser emulating (somewhat inaccurately) pre-GM MIDI devices such as the Roland MT-32, CM-32L, CM-64 and LAPC-I. In no way endorsed by or affiliated with Roland Corp.

viewtopic.php?f=40&t=55981

OPL3
https://sourceforge.net/p/dosbox/patches/270/
viewtopic.php?f=41&t=49327

XBRZ
viewtopic.php?f=41&t=34125

NE2000
https://sourceforge.net/p/dosbox/patches/238/

VSYNC
viewtopic.php?f=41&t=35535
viewtopic.php?t=37148

Check
https://sourceforge.net/p/dosbox/patches/125/


Need to categorize third party patches:
What are the "necessary" third party patches?
cross-platform
Never will be crossplatform
Already in DOSBox
Never will be in DOSBox
etc

PIXELPERFECT
viewtopic.php?f=41&t=49160&hilit=pixel+perfect&start=420
https://git-scm.com/download/win
Install
Add C:\Program Files (x86)\Git\usr\bin to path variable

Put "diff" in dosbox folder

Run patch -p0 < patchfile

http://gnuwin32.sourceforge.net/packages/rpl.htm


VS2008 does not like "round" identifier. VS2010 should work.
Patch should work with Mingw which works on less than XP.

viewtopic.php?f=41&t=36342



WINDOWS ONLY
http://www.si-gamer.net/gulikoza/

Need to find latest software ver of xbrz (Non-GL)


Shader support for DOSBox Mac,Windows,Lunux. Which patch?
viewtopic.php?f=41&t=36342
https://www.gamingonlinux.com/wiki/Buil ... rom_source
https://lists.freedesktop.org/archives/ ... 00497.html
https://mesamatrix.net/
viewtopic.php?f=32&t=49999&start=20
https://www.dosbox.com/wiki/Cuesheet
viewtopic.php?f=31&t=41610
https://www.dosbox.com/wiki/connectivity
http://gadgets.itwriting.com/2158-getti ... ourse.html
https://web.archive.org/web/20160131005 ... index.html
https://sourceforge.net/p/dosbox/patches/270/
https://sourceforge.net/p/dosbox/patches/260/
https://sourceforge.net/p/dosbox/patches/238/

-----------------------------
OLD

VISUAL STUDIO
Link-time Code Generation
Whole Program Optimization

Visual Studio 2005+ do not support setting /subsystem and /osversion less than 4.00 in the linker. EDITBIN has same limitation

STATIC LINK VS NON-STATIC CRT USING VISUAL STUDIO
Sticking with Static Linking the CRT.
Only see downsides to not static linking. Potentially mabye might be a good idea for Windows Operating systems currently in support and that receive all Windows updates not just security updates.
If don't static link CRT then for XP need to install Visual Studio 2015 VCRedist.
For Vista+ the Universal CRT should be pushed through Windows Update but unknown if EOL OS will receive this update or not. (If only security updates pushed to box then will not receive the Universal CRT)
https://blogs.msdn.microsoft.com/vcblog ... ersal-crt/


COMPILERS

VISUAL STUDIO

OFFICIAL
Visual Studio 2003 95-98-NT4-2000
Visual Studio 2005 NT4-98-2000 (NT4 if /MT set or if CRT recompiled)
Visual Studio 2008 Pre-SP1 for Windows 2000
Visual Studio 2008 SP1 XP+ (Possibly Windows 2000 with KB816542 and PE header modified)

VISUAL STUDIO WITH MINGW
Looks like VS2017 requires remote access to a Linux system. To use it on the local filesystem requires using the App Store. Tried to use the Ubunto distro without the App Store but no luck. Ridiculous.


LIBRARIES

COMPRESSED AUDIO SUPPORT
viewtopic.php?f=32&t=50077
https://www.dosbox.com/wiki/Building_DOSBox_with_MinGW
Game Acronym List
DosBox CVS Builds
DosBox Feature Request Thread
DosBox FAQ
PC Game Compatibility List
"Who's got time to read all the way down to the bottom of an email?"
User avatar
DosFreak
l33t++
 
Posts: 9484
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DOSBox Compilation Guides

Postby DosFreak » 2017-9-22 @ 13:03

Got Mesa 7.5.1 to work on Windows 95.

7.10.3 is the last ver to support Visual Studio. 6-13-2011 OpenGL 2.1

Download: https://mesa.freedesktop.org/archive/ol ... 7.x/7.5.1/
Compile with VS2008 and LegacyExtender
EDITVERSION from LegacyExtender should work if not then use VS2005 EDITBIN
EDITBIN from VS2005 C++ Command prompt "editbin /subsystem:windows,4.00 /osversion:4.0 opengl32.dll"
https://www.gamingonlinux.com/wiki/Buil ... rom_source

Copy opengl32.dll to quake 2 directory to test.

https://mesa.freedesktop.org/archive/ol ... .x/7.10.3/
https://wiki.qt.io/Cross_compiling_Mesa_for_Windows
https://wiki.qt.io/MesaLlvmpipe
https://github.com/florianlink/MesaOnWindows


OTHER

EXEVersion may work: http://louis.steelbytes.com/vs2008_vs_win40.html

https://fdossena.com/?p=mesa/build.frag
https://stackoverflow.com/questions/178 ... 7-mesa-9-1


MESA
https://sourceforge.net/projects/msys2/ ... INGW/i686/
https://sourceforge.net/p/mingw-w64/bugs/599/
https://github.com/Alexpux/MINGW-packages/issues/2282
https://github.com/pal1000/mesa-dist-win
http://forums.thedarkmod.com/topic/1786 ... ntry391478

Possible issue with MSYS2 and GCC. Works fine with MSVC
https://github.com/Alexpux/MINGW-packages/issues/2089
mingw-w64-i686 standalone with dwarf exceptions and posix threading
Possibily fixed in GCC 7.2.0
Attachments
95Quake2Mesa7.5.1.PNG
Game Acronym List
DosBox CVS Builds
DosBox Feature Request Thread
DosBox FAQ
PC Game Compatibility List
"Who's got time to read all the way down to the bottom of an email?"
User avatar
DosFreak
l33t++
 
Posts: 9484
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DOSBox Compilation Guides

Postby DosFreak » 2017-10-06 @ 18:37

HXRT & HXGUI

PREREQUISITES

MEMORY
If you want to use Dynamic core or use higher than 16mb of memory in DOSBox then you'll need more than 64mb of memory on your host system.
If you have 64mb or less then only normal core and 16mb of memory can be used in DOSBox.

DOSBOX
Download my 3.51 or 95 builds of DOSBox

HXRT & HXGUI
https://sourceforge.net/projects/hx-dos/
https://web.archive.org/web/20140904175 ... de/HX.html
http://sound-dos.ucoz.ru/load/new_hxdos ... 17/1-1-0-8
hxrt217.zip
hxgui217.zip

HIMEMX
*If OS is less than Windows 95 then use HIMEMX or mabye you can use HIMEM.SYS from Windows 95+.

MSVCRT
Download from this thread or Windows 2000 SP4

INSTALL

HXRT & HXGUI
Unzip both into the same folder c:\HX
Add "C:\HX" to your PATH

DOSBOX
Extract DOSBox to C:\DOSBOX

MSVCRT
Copy MSVCRT.DLL to C:\DOSBOX

Copy the following files from Windows 95 C:\Windows\System to C:\DOSBOX
CRTDLL.DLL
GLU32.DLL
OPENGL32.DLL






DOSBOX CONFIGURATION SETTING FOR MAXIMUM PERFORMANCE

fullscreen=true
fullresolution=original
output=surface
Core=dynamic
cpu=pentium_slow
cycles=max
scaler=none
memory=63
machine=svga_s3

TROUBLESHOOTING

VIDEO
If you only get a black screen when loading DOSBox then verify that you have not exited Windows and then tried to start DOSBox. Boot straight to DOS instead.

INPUT
DOSBox with HXRT & HXGUI seems to have issues with the mouse

BENCHMARKS

DOSBox running quake on the host
210 320x200
70 800x600

QUAKE running in DOS under vmware
*fps numbers vary significantly
377 320x200
233 800x600
167 1024x768

DOSBox running quake under hxrt in DOS under vmware
180 320x200
60 800x600
40.7 1024x768

Between DOSBox in DOS (VMWARE) vs DOSBox on the host there isn't much of a difference in speed.
Between Quake in DOS (VMWARE) vs Quake in DOSBOX using HXRT in DOS (VMWARE) there is a big difference.
Attachments
Capture.PNG
Game Acronym List
DosBox CVS Builds
DosBox Feature Request Thread
DosBox FAQ
PC Game Compatibility List
"Who's got time to read all the way down to the bottom of an email?"
User avatar
DosFreak
l33t++
 
Posts: 9484
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DOSBox Compilation Guides

Postby DosFreak » 2017-10-30 @ 23:38

Non-DOSBox. CMOV theory with Mingw 4.6+ versions and libraries. True or false? Is objdump accurate? Not relevant for DOSBox but possibly for other projects.

Consolidation of Ryzen posts

NOT RELEVANT TO COMPILING DOSBOX BUT USEFUL FOR CMOV RESEARCH

MANUAL COMPILE OF GCC

Source code for gcc 464:
https://ftp.gnu.org/gnu/gcc/gcc-4.6.4/

1. tar xzf gcc-4.6.4.tar.gz
2. rename gcc-4.6.4 to gcc
2b. Originally ran 3-step bootstrap process for native build, but instead save time and do 1-step for testing
3. cd gcc
4. This was the original configure line, but I don't know yet whether PPro instructions are emitted from this build. Best to specify architecture explicitly in this line and also verify in code that no CMOV code is enabled.
./configure --prefix=$HOME/gcc --enable-languages=c,c++ --disable-sjlj-exceptions --with-dwarf2 --disable-win32-registry --enable-version-specific-runtime-libs --build=mingw32 --prefix=/mingw --disable-libquadmath --disable-libgomp --disable-nls
5. make
6. make install

Source code:
ftp://gcc.gnu.org/pub/gcc/infrastructure/
gmp-6.1.2.tar.bz2
mpfr-3.1.5.tar.gz
mpc-1.0.3.tar.gz

Built the above three libraries using mingw32/gcc462/binutils222.
1. configure shared libraries of gmp/mpc/mpfr for /mingw
./configure --enable-shared --disable-static --prefix=/mingw
3. make; make install


MANUAL COMPILE OF MINGW GCC
https://sourceforge.net/projects/mingw/ ... c-4.8.1-4/
https://sourceforge.net/projects/mingw/ ... tils-2.28/
https://sourceforge.net/projects/mingw/ ... rt-3.21.1/

gcc-c++-4.8.1-4-mingw32-dev.tar.lzma
gcc-c++-4.8.1-4-mingw32-bin.tar.lzma
gcc-core-4.8.1-4-mingw32-bin.tar.lzma
gcc-core-4.8.1-4-mingw32-dev.tar.lzma
binutils-2.28-1-mingw32-bin.tar.xz
libiberty-2.28-1-mingw32-dev.tar.xz
binutils-2.28-1-mingw32-dev.tar.xz
mingwrt-3.21.1-mingw32-dev.tar.xz

gcc-c++-4.8.1-4-mingw32-dll.tar.lzma (C++ runtimes)
gcc-core-4.8.1-4-mingw32-dll.tar.lzma (C runtimes)

The C/C++ runtime files (*.dll) contain PPro instructions but linked staticly then Pentium Pro instructions not included

C++ 11 threading https://github.com/meganz/mingw-std-threads

GCC 4.62 and libraries may not have PPro instructions

MANUAL COMPILE OF MINGW GCC DEPENDENCIES

These are the dependencies in the case of a manual installation of them:
GMP 6.1.2
https://sourceforge.net/projects/mingw/ ... gmp-6.1.2/

gmp-6.1.2-2-mingw32-dev.tar.xz
libgmp-6.1.2-2-mingw32-dll-10.tar.xz

MPFR 3.1.5
https://sourceforge.net/projects/mingw/ ... pfr-3.1.5/

mpfr-3.1.5-1-mingw32-dev.tar.xz
libmpfr-3.1.5-1-mingw32-dll-4.tar.xz

MPC 1.0.3
https://sourceforge.net/projects/mingw/ ... mpc-1.0.3/

libmpc-1.0.3-1-mingw32-dll-3.tar.xz
mpc-1.0.3-1-mingw32-dev.tar.xz

Testing with gcc v493 from here;
https://sourceforge.net/projects/mingw/ ... c-4.9.3-1/

gcc-4.9.3-1-mingw32-src.tar.xz

I recall that the earlier gcc versions have a ready-made configure system, but v493 doesn't. Here is a potential configure line for gcc v493 (--prefix= should be changed accordingly):
./configure --prefix=$HOME/gcc --enable-languages=c,c++ --disable-sjlj-exceptions --with-dwarf2 --disable-win32-registry --enable-version-specific-runtime-libs --build=mingw32 --prefix=/mingw --disable-libquadmath --disable-libgomp --disable-nls --disable-bootstrap --host=mingw32 --with-tune=i386 --with-arch=i386
make install


OLD

The bug report for gcc 4.7 branch shows at least some of the problem in i386.h:
X86_ARCH_CMOV
#define TARGET_CMOV
#define TARGET_CMOVE

This is one section of code which refers to activation of the PPro instruction set. I haven't searched for other examples nor in other branches yet. If the PPro issue is difficult to solve, then these targets may be defined away in the code for testing.

Edit: one possibility is that the GMP library is the cause along the gcc 4.6 branch. Found this in the configure log for it: march=pentium4. In the source code of gcc 4.6.4, couldn't find any examples of *CMOV*, but the GMP library had many references to it.

Perhaps defining "HAVE_HOST_CPU_pentium" in GMP configure.ac will at least fix the issue in GMP?

Edit 2: it is probably necessary to confirm that objdump is producing the correct output by trying another tool and compare the results.

For example, a Quake 2 binary from 1998 shows a single fcmovu instruction from the PPro set. It was presumably built by Visual C++ 5.0 which does have the capability to emit the PPro set.

Edit 3: verified that the gcc 464 custom build had PPro instructions in libgmp while the official gcc 46 version did not. However, the CMOV patch discussed in the previously posted gcc bug report was applied to gcc 464. Also, verified that i386.c/h are the main parts of gcc 464 which have references to the PPro instructions.

Edit 4: tried to verify the PPro instructions predicted by objdump against those generated by gcc itself (gcc -S option). The result was that PPro instructions were already in "libdxguid.a", a third-party available mingw32 library. That probably explains a previous finding of PPro instructions when building with the default gcc 4.6 of mingw32. Requires more testing.

Edit 5: the gcc 3.4 finding was probably a result of false detection of cmovs by a djgpp version of objdump. This version of objdump also detected cmovs in software compiled by gcc versions before the PPro was supported.
Game Acronym List
DosBox CVS Builds
DosBox Feature Request Thread
DosBox FAQ
PC Game Compatibility List
"Who's got time to read all the way down to the bottom of an email?"
User avatar
DosFreak
l33t++
 
Posts: 9484
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DOSBox Compilation Guides

Postby DosFreak » 2017-11-06 @ 19:34

ISSUE
Mingwrt newer than 3.22 results in illegal instruction error in NT3.51 and Windows 95 compiled executable in Vmware (NT4 guest works fine). Executables work fine on host or in pcem.
Static or dynamic link of libgcc and libstdc++ make no difference since the issue is with mingwrt.
CPUID matches between 95 and NT4 guests (when guestos = "winnt" instead of guestos - "winn95" in 95 vmx)
Same OS ver on pcem and vmware


Hello.cpp code

#include <iostream>
using namespace std;

int main()
{
cout << "Hello world" << endl;
}


Once I add the following line to the Vmware .vmx file then an executable compiled with Mingw 6.30 and Mingwrt v5+ will work correctly with an i686 processor and an OS that does not support SSE:
cpuid.1.edx=----:-00-:----:----:----:----:----:----
https://communities.vmware.com/thread/488599?db=5
https://kb.vmware.com/s/article/1993


This line masks the SSE support which causes the executable to believe it's running on a processor without SSE which allows it to load.

So:

Mingwrt v3 - Executable works on i386+
Mingwrt v5+ - Executable works on i386+ but will not work if the processor supports SSE and the OS does not.


Current options:
Use MINGW with mingwrt v3 for all projects (NT3.51+)
Use seperate MINGW with mingwrt v3 environment for less than i386-i586 executables (NT3.51+ and another MINGW with mingwrt v5 environment for i686+ and NT4-98+
Use seperate MINGW with mingwrt v3 environment for less than i386-i586 executables (NT3.51+) and MINGW-W64 for i686+ (NT3.51+)
Use Mingw with Mingwrt v5 and crt2.o from mingwrt v3.22 for all projects. (NT3.51+) TEMP WORKAROUND
Look into modifying mingwrt v5 files to remove or test for SSE cpu support and recompile.
Submit bug report to Mingw devs and hope that they fix.
http://www.mingw.org/reporting_bugs
https://sourceforge.net/p/mingw/mailman ... sg32777646


MinGW Application Startup Code:

Lines 118 to 122 of fesetenv.c referred by CRT1.c

if( __HAS_SSE )
/* Finally, if SSE instructions are supported, set the MXCSR
* exception handling policy flags...
*/
__asm__( "ldmxcsr %0" :: "m" (fenv_mxcsr) );

COMPILE MINGWRT

DOWNLOAD SOURCE FILES
https://sourceforge.net/projects/mingw/ ... gwrt-5.0.1
mingwrt-5.0.1-mingw32-src.tar.xz

https://sourceforge.net/projects/mingw/ ... 2api-5.0.1
w32api-5.0.1-mingw32-src.tar.xz

Extract all
Go to mingwrt-5.0.1 directory
Run ./configure --prefix=/mingw/test CFLAGS=-march=i386 CXXFLAGS=-I/mingw/msys/1.0/home/XXX/Test/w32api-5.0.1/include
make
make install
Compiled files will be in /mingw/test
Save files somewhere and delete files from /mingw/test

So today I removed the following lines in Mingwrt v5.0.1 and recompiled:

mingwrt-5.0.1\mingwex\fesetenv.c

Lines 118 to 122

if( __HAS_SSE )
/* Finally, if SSE instructions are supported, set the MXCSR
* exception handling policy flags...
*/
__asm__( "ldmxcsr %0" :: "m" (fenv_mxcsr) );

I then recompiled the Hello World which works in Windows 95 in Vmware.

So:
Are the above really needed? What is lost by removing them?
Test or define if target OS doesn't support SSE
Seperate mingwrt package for OS without SSE

Attached the compiled mingwrt v5 to the first post. Only crt2.o from the package is needed for DOSBox.

EDIT https://sourceforge.net/p/mingw/bugs/2357/



OLD


git clone https://git.code.sf.net/p/mingw/mingw-org-wsl mingw-mingw-org-wsl
cd mingw-mingw-org-wls
git checkout 280f64
Copy ./configure file and "tests" folder from v5.01 source and place in mingwrt directory.
Run ./configure --prefix=/mingw/test CFLAGS=-march=i386 CXXFLAGS=-I/mingw/msys/1.0/home/XXX/Test/mingw-mingw-org-wsl/w32api-5.0.1
make install

https://sourceforge.net/p/mingw/mingw-o ... 3cf6d48c12
Game Acronym List
DosBox CVS Builds
DosBox Feature Request Thread
DosBox FAQ
PC Game Compatibility List
"Who's got time to read all the way down to the bottom of an email?"
User avatar
DosFreak
l33t++
 
Posts: 9484
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DOSBox Compilation Guides

Postby DosFreak » 2017-11-17 @ 16:13

Mouse issue in 9x.

If DirectX being used then if mouse capture by DOSBox then on exiting DOSBox mouse cursor will be frozen.
Relaunching dosbox and uncapturing the mouse will free the cursor.

Tested with

SDL 1.2.13 -works
SDL 1.2.14 - Does not work
SDL 1.2.15 - Does not work

DOSBOX SDL 1.2.13 works fine with newly compiled DOSBox.

Might be: https://bugzilla.libsdl.org/show_bug.cgi?id=849 but states that it's fixed in 1.2.15? Looks like this was just for the cursor disappearing, not for the cursor being frozen.

mmx.h in SDL

Need to go through commits after SDL 1.2.13 release but before 1.2.14 to see if can find issue.

Use SDL 1.2.13 for 9x for now or use Windib. Any point to directx?
Game Acronym List
DosBox CVS Builds
DosBox Feature Request Thread
DosBox FAQ
PC Game Compatibility List
"Who's got time to read all the way down to the bottom of an email?"
User avatar
DosFreak
l33t++
 
Posts: 9484
Joined: 2002-6-30 @ 16:35
Location: Your Head


Re: DOSBox Compilation Guides

Postby DosFreak » 2017-11-18 @ 00:59

Replacing
C:\Mingw\msys\1.0\home\XXX\BUILD\DOSBOX\95-NT4\SDL-1.2.15\src\video\windx5
SDL_dx5events.c in SDL 1.2.15

with the SDL_dx5events.c from SDL 1.2.13 fixed the mouse issue.
Game Acronym List
DosBox CVS Builds
DosBox Feature Request Thread
DosBox FAQ
PC Game Compatibility List
"Who's got time to read all the way down to the bottom of an email?"
User avatar
DosFreak
l33t++
 
Posts: 9484
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DOSBox Compilation Guides

Postby DosFreak » 2017-11-18 @ 02:01

Found it.


SDL_DX5events.c

Line 374

Revert back to SDL 1.2.13 code

Code: Select all
   /* If we are in windowed mode, Windows is taking care of the mouse */
   if (  (SDL_PublicSurface->flags & SDL_OPENGL) ||
        !(SDL_PublicSurface->flags & SDL_FULLSCREEN) ) {
      return;
   }


Otherwise mouse will be frozen on the desktop if you capture the mouse in dosbox and do not uncapture the mouse before you exit dosbox.....

That was fun.....

https://icculus.org/pipermail/quake3-co ... 01365.html
http://diehardwolfers.areyep.com/viewtopic.php?p=89401


TEST
-static-libstdc++ -static-libgcc
mingw and mingw64 gdb
Game Acronym List
DosBox CVS Builds
DosBox Feature Request Thread
DosBox FAQ
PC Game Compatibility List
"Who's got time to read all the way down to the bottom of an email?"
User avatar
DosFreak
l33t++
 
Posts: 9484
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DOSBox Compilation Guides

Postby DosFreak » 2017-11-20 @ 21:30

Spent an hour today verifying that the following works on a fresh copy of SDL 1.2.15 to fix the mouse capture issue in 9x:


EDIT Even with the below it looks like using the mouse is broken when using DOSBox in a window with directinput (even in Windows 10). If can't figure out then will revert back to 1.2.13 method.

Need to verify dosbox in a window with original sdl 1.2.15 works with mouse.
Need to see what's involved with using 1.2.15 but reverting all code from this commit back to 1.2.13.

Code: Select all
C:\Mingw\msys\1.0\home\XXX\BUILD\DOSBOX\95-NT4\SDL-1.2.15\src\video\windx5
SDL_dx5events.c

Make lines #152 and #153 look as follows:

#147 #if DIRECTINPUT_VERSION >= 0x700
      
#148        &c_dfDIMouse2,

#149 #else
      
#150        &c_dfDIMouse,

#151 #endif
      
#152 (DISCL_FOREGROUND|DISCL_NONEXCLUSIVE),
      
#153 (DISCL_FOREGROUND|DISCL_EXCLUSIVE), handle_mouse },
   
#154 { NULL, NULL, NULL, 0, 0, NULL }
#155 }:

Replace Lines #373-377 with the following from SDL 1.2.13:

#301   /* If we are in windowed mode, Windows is taking care of the mouse */
   
#302 if (  (SDL_PublicSurface->flags & SDL_OPENGL) ||
        
#303 !(SDL_PublicSurface->flags & SDL_FULLSCREEN) ) {
      
#304 return;
   
#304 }

Remove Line 551 extra bracket:

#547   if ( xrel || yrel ) {
         
#548       post_mouse_motion(1, xrel, yrel);
             }
   
#549       }

#550
#551 }



Mabye keep all original 1.2.15 code but revert back sdl_sysevents.c
C:\Mingw\msys\1.0\home\XXX\BUILD\DOSBOX\95-NT4\SDL-1.2.15\src\video\wincommon
+- if ( SDL_VideoSurface && ! DINPUT_FULLSCREEN() ) {
Game Acronym List
DosBox CVS Builds
DosBox Feature Request Thread
DosBox FAQ
PC Game Compatibility List
"Who's got time to read all the way down to the bottom of an email?"
User avatar
DosFreak
l33t++
 
Posts: 9484
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DOSBox Compilation Guides

Postby DosFreak » 2017-11-20 @ 23:30

SDL 1.2.15 no issues with using mouse inside dosbox in 9x and host.


Only changing:

sdl_sysevents.c
C:\Mingw\msys\1.0\home\XXX\BUILD\DOSBOX\95-NT4\SDL-1.2.15\src\video\wincommon
+- if ( SDL_VideoSurface && ! DINPUT_FULLSCREEN() ) {

Results in mouse working inside dosbox in both 9x and host but with mouse capture issue.


Check ecwolf (sdl 1.2.14) for SDL changes to mouse
Run dosbox through dependency walker and look through errors.
Revert all SDL 1.2.14 changes to mouse in ioquake3 commit back to 1.2.13
Game Acronym List
DosBox CVS Builds
DosBox Feature Request Thread
DosBox FAQ
PC Game Compatibility List
"Who's got time to read all the way down to the bottom of an email?"
User avatar
DosFreak
l33t++
 
Posts: 9484
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DOSBox Compilation Guides

Postby DosFreak » 2017-11-21 @ 21:02

So I did some investigating today and was able to revert back to using windib when DOSBox is in a window (same behavior as 1.2.13) in SDL 1.2.15.

It looks like SDL_dx5events handles the interaction by the host with DOSBox (mouse capture issue)
It looks like SDL_sysevents.c handles moving the mouse inside DOSBox.

Modifying SDL_dx5events to "fix" the mouse capture issue was relatively simply but for SDL_sysevents.c I had to revert back alot of changes before I was able to get a functional mouse inside DOSBox.

I don't currently have the knowledge to get the mouse working properly with DirectInput in 9x when DOSBox is a window so reverting back to the 1.2.13 code is the solution for now.

The issue isn't that big of a deal but it is annoying.

When DOSBox (using Directx) is executed on a 9x system then if you try to move the mouse over the DOSBox window then it will either freeze or move erraticly (not captured yet). If captured the mouse works fine in DOSBox.
Also if the mouse is captured by DOSBox and you exit then the mouse will be frozen, you must uncapture the mouse before exiting DOSBox.

If using DOSBox with WINDIB then no issue.

This occurs with SDL 1.2.14 and SDL 1.2.15.

For now use the attached SDL 1.2.15 for 9x builds.


Of course I tested all this in Pcem which doesn't appear to support a DirectInput mouse so this issue could likely only occur on systems without a mouse driver supporting DirectInput......
Attachments
SDL-1.2.15 for 9x.zip
(16.71 MiB) Downloaded 2 times
Game Acronym List
DosBox CVS Builds
DosBox Feature Request Thread
DosBox FAQ
PC Game Compatibility List
"Who's got time to read all the way down to the bottom of an email?"
User avatar
DosFreak
l33t++
 
Posts: 9484
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DOSBox Compilation Guides

Postby DosFreak » 2017-11-21 @ 21:30

Attached is SDL 1.2.15 for 9x with only SDL_dx5events.c and SDL_sysevents.c modified which appears to work.
Attachments
SDL-1.2.15 9x-Minimal.zip
(16.76 MiB) Downloaded 2 times
Game Acronym List
DosBox CVS Builds
DosBox Feature Request Thread
DosBox FAQ
PC Game Compatibility List
"Who's got time to read all the way down to the bottom of an email?"
User avatar
DosFreak
l33t++
 
Posts: 9484
Joined: 2002-6-30 @ 16:35
Location: Your Head

Re: DOSBox Compilation Guides

Postby DosFreak » 2017-11-22 @ 19:24

viewtopic.php?f=31&t=57075&p=629449#p629449

Confirmed issue occurs on a physical system and also on Windows 98.
Game Acronym List
DosBox CVS Builds
DosBox Feature Request Thread
DosBox FAQ
PC Game Compatibility List
"Who's got time to read all the way down to the bottom of an email?"
User avatar
DosFreak
l33t++
 
Posts: 9484
Joined: 2002-6-30 @ 16:35
Location: Your Head


Return to DOSBox General

Who is online

Users browsing this forum: No registered users and 1 guest