├── AUTHORS ├── COPYING ├── ChangeLog ├── INSTALL ├── Makefile.am ├── NEWS ├── README ├── THANKS ├── VERSION ├── acinclude.m4 ├── autogen.sh ├── configure.ac ├── docs ├── Makefile.am ├── PORTING ├── README.video └── dosbox.1 ├── include ├── Makefile.am ├── bios.h ├── bios_disk.h ├── callback.h ├── control.h ├── cpu.h ├── cross.h ├── debug.h ├── dma.h ├── dos_inc.h ├── dos_system.h ├── dosbox.h ├── fpu.h ├── hardware.h ├── inout.h ├── ipx.h ├── ipxserver.h ├── joystick.h ├── keyboard.h ├── logging.h ├── mapper.h ├── mem.h ├── midi.h ├── mixer.h ├── mouse.h ├── paging.h ├── pci_bus.h ├── pic.h ├── programs.h ├── regs.h ├── render.h ├── serialport.h ├── setup.h ├── shell.h ├── support.h ├── timer.h ├── vga.h └── video.h ├── scripts ├── captures.bat ├── dosbox-installer.nsi ├── editconf.bat ├── ega-switch.pl ├── font-switch.pl ├── resetconf.bat └── resetmapper.bat ├── src ├── Makefile.am ├── cpu │ ├── Makefile.am │ ├── callback.cpp │ ├── core_dyn_x86.cpp │ ├── core_dyn_x86 │ │ ├── Makefile.am │ │ ├── cache.h │ │ ├── decoder.h │ │ ├── dyn_fpu.h │ │ ├── dyn_fpu_dh.h │ │ ├── helpers.h │ │ ├── risc_x86.h │ │ └── string.h │ ├── core_dynrec.cpp │ ├── core_dynrec │ │ ├── Makefile.am │ │ ├── cache.h │ │ ├── decoder.h │ │ ├── decoder_basic.h │ │ ├── decoder_opcodes.h │ │ ├── dyn_fpu.h │ │ ├── operators.h │ │ ├── risc_armv4le-common.h │ │ ├── risc_armv4le-o3.h │ │ ├── risc_armv4le-thumb-iw.h │ │ ├── risc_armv4le-thumb-niw.h │ │ ├── risc_armv4le-thumb.h │ │ ├── risc_armv4le.h │ │ ├── risc_armv8le.h │ │ ├── risc_mipsel32.h │ │ ├── risc_x64.h │ │ └── risc_x86.h │ ├── core_full.cpp │ ├── core_full │ │ ├── Makefile.am │ │ ├── ea_lookup.h │ │ ├── load.h │ │ ├── loadwrite.h │ │ ├── op.h │ │ ├── optable.h │ │ ├── save.h │ │ ├── string.h │ │ └── support.h │ ├── core_normal.cpp │ ├── core_normal │ │ ├── Makefile.am │ │ ├── helpers.h │ │ ├── prefix_0f.h │ │ ├── prefix_66.h │ │ ├── prefix_66_0f.h │ │ ├── prefix_none.h │ │ ├── string.h │ │ ├── support.h │ │ └── table_ea.h │ ├── core_prefetch.cpp │ ├── core_simple.cpp │ ├── cpu.cpp │ ├── flags.cpp │ ├── instructions.h │ ├── lazyflags.h │ ├── modrm.cpp │ ├── modrm.h │ └── paging.cpp ├── debug │ ├── Makefile.am │ ├── debug.cpp │ ├── debug_disasm.cpp │ ├── debug_gui.cpp │ ├── debug_inc.h │ ├── debug_win32.cpp │ └── disasm_tables.h ├── dos │ ├── Makefile.am │ ├── cdrom.cpp │ ├── cdrom.h │ ├── cdrom_aspi_win32.cpp │ ├── cdrom_image.cpp │ ├── cdrom_ioctl_linux.cpp │ ├── cdrom_ioctl_os2.cpp │ ├── cdrom_ioctl_win32.cpp │ ├── dev_con.h │ ├── dos.cpp │ ├── dos_classes.cpp │ ├── dos_codepages.h │ ├── dos_devices.cpp │ ├── dos_execute.cpp │ ├── dos_files.cpp │ ├── dos_ioctl.cpp │ ├── dos_keyboard_layout.cpp │ ├── dos_keyboard_layout_data.h │ ├── dos_memory.cpp │ ├── dos_misc.cpp │ ├── dos_mscdex.cpp │ ├── dos_programs.cpp │ ├── dos_tables.cpp │ ├── drive_cache.cpp │ ├── drive_fat.cpp │ ├── drive_iso.cpp │ ├── drive_local.cpp │ ├── drive_virtual.cpp │ ├── drives.cpp │ ├── drives.h │ ├── scsidefs.h │ └── wnaspi32.h ├── dosbox.cpp ├── dosbox.ico ├── fpu │ ├── Makefile.am │ ├── fpu.cpp │ ├── fpu_instructions.h │ └── fpu_instructions_x86.h ├── gui │ ├── Makefile.am │ ├── dosbox_logo.h │ ├── dosbox_splash.h │ ├── midi.cpp │ ├── midi_alsa.h │ ├── midi_coreaudio.h │ ├── midi_coremidi.h │ ├── midi_oss.h │ ├── midi_win32.h │ ├── render.cpp │ ├── render_loops.h │ ├── render_scalers.cpp │ ├── render_scalers.h │ ├── render_simple.h │ ├── render_templates.h │ ├── render_templates_hq.h │ ├── render_templates_hq2x.h │ ├── render_templates_hq3x.h │ ├── render_templates_sai.h │ ├── sdl_gui.cpp │ ├── sdl_mapper.cpp │ └── sdlmain.cpp ├── hardware │ ├── Makefile.am │ ├── adlib.cpp │ ├── adlib.h │ ├── cmos.cpp │ ├── dbopl.cpp │ ├── dbopl.h │ ├── disney.cpp │ ├── dma.cpp │ ├── gameblaster.cpp │ ├── gus.cpp │ ├── hardware.cpp │ ├── iohandler.cpp │ ├── ipx.cpp │ ├── ipxserver.cpp │ ├── joystick.cpp │ ├── keyboard.cpp │ ├── mame │ │ ├── Makefile.am │ │ ├── emu.h │ │ ├── fmopl.cpp │ │ ├── fmopl.h │ │ ├── saa1099.cpp │ │ ├── saa1099.h │ │ ├── sn76496.cpp │ │ ├── sn76496.h │ │ ├── ymdeltat.cpp │ │ ├── ymdeltat.h │ │ ├── ymf262.cpp │ │ └── ymf262.h │ ├── memory.cpp │ ├── mixer.cpp │ ├── mpu401.cpp │ ├── opl.cpp │ ├── opl.h │ ├── pci_bus.cpp │ ├── pci_devices.h │ ├── pcspeaker.cpp │ ├── pic.cpp │ ├── sblaster.cpp │ ├── serialport │ │ ├── Makefile.am │ │ ├── directserial.cpp │ │ ├── directserial.h │ │ ├── libserial.cpp │ │ ├── libserial.h │ │ ├── misc_util.cpp │ │ ├── misc_util.h │ │ ├── nullmodem.cpp │ │ ├── nullmodem.h │ │ ├── serialdummy.cpp │ │ ├── serialdummy.h │ │ ├── serialport.cpp │ │ ├── softmodem.cpp │ │ └── softmodem.h │ ├── tandy_sound.cpp │ ├── timer.cpp │ ├── vga.cpp │ ├── vga_attr.cpp │ ├── vga_crtc.cpp │ ├── vga_dac.cpp │ ├── vga_draw.cpp │ ├── vga_gfx.cpp │ ├── vga_memory.cpp │ ├── vga_misc.cpp │ ├── vga_other.cpp │ ├── vga_paradise.cpp │ ├── vga_s3.cpp │ ├── vga_seq.cpp │ ├── vga_tseng.cpp │ └── vga_xga.cpp ├── ints │ ├── Makefile.am │ ├── bios.cpp │ ├── bios_disk.cpp │ ├── bios_keyboard.cpp │ ├── ems.cpp │ ├── int10.cpp │ ├── int10.h │ ├── int10_char.cpp │ ├── int10_memory.cpp │ ├── int10_misc.cpp │ ├── int10_modes.cpp │ ├── int10_pal.cpp │ ├── int10_put_pixel.cpp │ ├── int10_vesa.cpp │ ├── int10_video_state.cpp │ ├── int10_vptable.cpp │ ├── mouse.cpp │ ├── xms.cpp │ └── xms.h ├── libs │ ├── Makefile.am │ ├── gui_tk │ │ ├── Doxyfile │ │ ├── Makefile.am │ │ ├── gui_tk.cpp │ │ └── gui_tk.h │ └── zmbv │ │ ├── Makefile.am │ │ ├── drvproc.cpp │ │ ├── resource.h │ │ ├── zmbv.cpp │ │ ├── zmbv.def │ │ ├── zmbv.h │ │ ├── zmbv.inf │ │ ├── zmbv.sln │ │ ├── zmbv.vcproj │ │ ├── zmbv_vfw.cpp │ │ ├── zmbv_vfw.h │ │ └── zmbv_vfw.rc ├── misc │ ├── Makefile.am │ ├── cross.cpp │ ├── messages.cpp │ ├── programs.cpp │ ├── setup.cpp │ └── support.cpp ├── platform │ ├── Makefile.am │ ├── sdl-win32.diff │ └── visualc │ │ ├── Makefile.am │ │ ├── config.h │ │ ├── ntddcdrm.h │ │ ├── ntddscsi.h │ │ └── unistd.h ├── shell │ ├── Makefile.am │ ├── shell.cpp │ ├── shell_batch.cpp │ ├── shell_cmds.cpp │ └── shell_misc.cpp └── winres.rc └── visualc_net ├── Makefile.am ├── dosbox.sln └── dosbox.vcproj /AUTHORS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/svn2github/dosbox/acd380bcde72db74f3b476253899016f686bc0ef/AUTHORS -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | Things needed for compilation. 2 | 3 | SDL 4 | The Simple DirectMedia Library available at http://www.libsdl.org 5 | The dll distributed with the windows version of DOSBox is slightly 6 | modified. You can find the changes in the sourcepackage of DOSBox 7 | (src/platform/sdl-win32.diff). If you want the patched sourcetree 8 | send us an email. (see README) 9 | Licensed under LGPL 10 | Note that only version 1.2 and its subversions (1.2.8, 1.2.13 etc.) 11 | are currently supported. 12 | 13 | Curses (optional) 14 | If you want to enable the debugger you need a curses library. 15 | ncurses should be installed on just about every unix distro. 16 | For win32 get pdcurses at http://pdcurses.sourceforge.net 17 | License: Open source 18 | 19 | Libpng (optional) 20 | Needed for the screenshots. 21 | For win32 get libpng from http://gnuwin32.sourceforge.net/packages.html 22 | See http://www.libpng.org/pub/png/ for more details. 23 | License: Open Source 24 | 25 | Zlib (optional) 26 | Needed by libpng. 27 | For win32 get libz (rename to zlib) from http://gnuwin32.sourceforge.net/packages.html 28 | See http://www.zlib.net for more details. 29 | License: Open Source 30 | 31 | SDL_Net (optional) 32 | For modem/ipx support. Get it from http://www.libsdl.org/projects/SDL_net/ 33 | Licensed under LGPL 34 | 35 | SDL_Sound 36 | For compressed audio on diskimages. (optional) 37 | This is for cue/bin cdrom images with compressed (mp3/ogg) audio tracks. 38 | Get it from http://icculus.org/SDL_sound 39 | Licenced under LGPL 40 | 41 | ALSA_Headers 42 | (optional) 43 | for Alsa support under linux. Part of the linux kernel sources 44 | Licensed under LGPL 45 | 46 | If you want compile from developer sources (SVN) under a unix system, you'll also need 47 | automake (>=1.6), autoconf(>=2.50). Should be available at http://www.gnu.org 48 | 49 | For building on unix systems. 50 | If you are building from developer sources run ./autogen.sh first before doing the following. 51 | 52 | 1. ./configure 53 | 2. make 54 | 55 | In step 1 you could add the following switches: 56 | --enable-debug 57 | enables the internal debugger. --enable-debug=heavy enables even more 58 | debug options. DOSBox should then be run from a xterm and when the sdl- 59 | window is active press alt-pause to enter the debugger. 60 | 61 | --enable-core-inline 62 | enables some memory increasing inlines. This greatly increases 63 | compiletime for maybe a increase in speed. 64 | 65 | --disable-fpu 66 | disables the emulated fpu. Although the fpu emulation code isn't 67 | finished and isn't entirely accurate it's advised to leave it on. 68 | 69 | --disable-fpu-x86 70 | --disable-fpu-x64 71 | disables the assembly fpu core. Although relatively new, the x86/x64 fpu 72 | core has more accuracy then the regular fpu core. 73 | 74 | --disable-dynamic-x86 75 | disables the dynamic x86 specific cpu core. Although it might be 76 | be a bit unstable, it can greatly improve the speed of dosbox on x86 77 | hosts. 78 | Please note that this option on x86 will result in a different 79 | dynamic/recompiling cpu core being compiled then the default. 80 | For more information see the option --disable-dynrec 81 | 82 | --disable-dynrec 83 | disables the recompiling cpu core. Currently x86 and x86_64 only. 84 | You can activate this core on x86 by disabling the dynamic-x86 core. 85 | 86 | --disable-dynamic-core 87 | disables all dynamic cores. (same effect as 88 | --disable-dynamic-x86 --disable-dynrec) 89 | 90 | --disable-opengl 91 | disables OpenGL-support (output mode that can be selected in the 92 | DOSBox configuration file). 93 | 94 | --disable-unaligned-memory 95 | disables unaligned memory access. 96 | 97 | Check the src subdir for the binary. 98 | 99 | NOTE: If capslock and numlock appear to be broken. open 100 | src/ints/bios_keyboard.cpp and go to line 30 and read there how to fix it. 101 | 102 | 103 | Build instructions for VC++6 104 | Don't use VC++ 6: it creates faulty code in core_normal.cpp 105 | Later Visual Studio versions work fine (vs2003/.net up to vs2010) 106 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | # Main Makefile for DOSBox 2 | 3 | EXTRA_DIST = autogen.sh 4 | SUBDIRS = src include docs visualc_net 5 | -------------------------------------------------------------------------------- /THANKS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/svn2github/dosbox/acd380bcde72db74f3b476253899016f686bc0ef/THANKS -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 0.74-2 2 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo "Generating build information using aclocal, autoheader, automake and autoconf" 4 | echo "This may take a while ..." 5 | 6 | # Regenerate configuration files. 7 | 8 | aclocal 9 | autoheader 10 | automake --include-deps --add-missing --copy 11 | autoconf 12 | 13 | echo "Now you are ready to run ./configure." 14 | echo "You can also run ./configure --help for extra features to enable/disable." 15 | -------------------------------------------------------------------------------- /docs/Makefile.am: -------------------------------------------------------------------------------- 1 | # Main Makefile for DOSBox 2 | 3 | man_MANS = dosbox.1 4 | EXTRA_DIST = $(man_MANS) README.video PORTING 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/PORTING: -------------------------------------------------------------------------------- 1 | Some notes about porting DOSBox to systems with certain restrictions, 2 | like handheld devices. 3 | 4 | General: 5 | - depending on where you start off with the port, assure that the 6 | config.h entries are correct/exhausting, like GCC_ATTRIBUTE is 7 | required (struct packing) but is undefined if you base the port 8 | on msvc sources which have a special config.h 9 | 10 | If memory is a constraint: 11 | - in paging.h out-comment the USE_FULL_TLB define to enable special 12 | TLB linking code that uses less memory 13 | drawback: none (the code is not heavily tested though) 14 | gain: reduces memory requirements about ~15mb 15 | - in render.h lower the scaler integration: 16 | #define RENDER_USE_ADVANCED_SCALERS 1 17 | or 18 | #define RENDER_USE_ADVANCED_SCALERS 0 19 | drawback: complex scalers and the scaler cache are disabled, 20 | be sure to test if this affects speed! 21 | with define RENDER_USE_ADVANCED_SCALERS==0 most simple 22 | scalers are disabled as well, some graphics modes won't 23 | work due to reduced cache sizes 24 | gain: ~2mb with RENDER_USE_ADVANCED_SCALERS==1 25 | ~5mb with RENDER_USE_ADVANCED_SCALERS==0 26 | - in dos_system.h reduce the drive cache entries: 27 | #define MAX_OPENDIRS 256 28 | drawback: some apps might not work with large directory trees 29 | gain: ~1mb per mounted drive 30 | - remove the GUS emulation (gus.cpp, especially GUSRam[1024*1024] ) 31 | drawback: no gravis ultrasound 32 | gain: reduces memory requirements about 1mb 33 | - reduce the size of the emulated graphics memory: 34 | see the memory sizing in SVGA_Setup_*, especially the defaults 35 | in vga_s3.cpp's SVGA_Setup_S3Trio 36 | drawback: some graphics modes won't work then 37 | gain: reduces memory requirements 38 | TODO: fully check this, introduce hard limits 39 | 40 | If speed is a constraint: 41 | - see if the simple core is faster, possibly remove the normal core 42 | set the simple core as default 43 | drawback: one game is known to not work with the simple core; 44 | the simple core does only work for games which don't use paging 45 | (when paging is requested the normal core is used automatically) 46 | gain: the simple core should be somewhat faster 47 | TODO: add possibility to easily remove the normal core, use fullcore fallback 48 | - raise the default frameskip value 49 | drawback: minor graphics smoothness loss for some games (video playback) 50 | gain: reduces graphics load 51 | -------------------------------------------------------------------------------- /docs/README.video: -------------------------------------------------------------------------------- 1 | Starting with version 0.65, DOSBox allows you to create movies out of screen 2 | output. 3 | 4 | To record a movie, you have to press CTRL-ALT-F5. 5 | To stop/end the recording, you have to press CTRL-ALT-F5 again. 6 | 7 | To play the recorded movie, you need a movie player which can handle the 8 | ZMBV codec. MS Windows users can find this codec in the start menu entry of 9 | DOSBox. Users of Linux and other OSes should look for a movie player that 10 | uses the ffmpeg libary (you may need to update or ask your distribution to 11 | upgrade). 12 | 13 | FAQ: 14 | Q: During the display of the movies the sound is lagging. 15 | A: Check your display properties to see whether your refresh rate is set to 16 | at least 70 hz. Try playing the movie in virtualdub (http://virtualdub.sf.net) 17 | 18 | Q: Why does the resulting movie consist of multiple files? 19 | A: Each time the game changes resolution, DOSBox creates a new movie file, 20 | because a movie file can only contain one resolution. 21 | 22 | Q: Can I set the cycles higher than my PC can handle during recording? 23 | A: Yes. During recording, the game might play slowly and stuttering, but the 24 | resulting movie should play at the intended speed and have no stuttering. 25 | 26 | Q: CTRL-ALT-F5 switches to the console under linux. 27 | A: 1. Start DOSBox like this: dosbox -startmapper 28 | 2. Click on Video, click on Add 29 | 3. Press the key you want (for example scroll lock or printscreen) 30 | 4. Click exit. 31 | 5. You can make movies by pressing scroll lock or whichever key you 32 | selected. 33 | 34 | Q: The colours are wrong and I'm using 64 bit windows 35 | A: Look here: http://vogons.zetafleet.com/viewtopic.php?t=12133 36 | -------------------------------------------------------------------------------- /include/Makefile.am: -------------------------------------------------------------------------------- 1 | noinst_HEADERS = \ 2 | bios.h \ 3 | bios_disk.h \ 4 | callback.h \ 5 | cpu.h \ 6 | cross.h \ 7 | control.h \ 8 | debug.h \ 9 | dma.h \ 10 | dos_inc.h \ 11 | dos_system.h \ 12 | dosbox.h \ 13 | fpu.h \ 14 | hardware.h \ 15 | inout.h \ 16 | joystick.h \ 17 | ipx.h \ 18 | ipxserver.h \ 19 | keyboard.h \ 20 | logging.h \ 21 | mapper.h \ 22 | mem.h \ 23 | midi.h \ 24 | mixer.h \ 25 | mouse.h \ 26 | paging.h \ 27 | pci_bus.h \ 28 | pic.h \ 29 | programs.h \ 30 | render.h \ 31 | regs.h \ 32 | render.h \ 33 | serialport.h \ 34 | setup.h \ 35 | shell.h \ 36 | support.h \ 37 | timer.h \ 38 | vga.h \ 39 | video.h 40 | 41 | -------------------------------------------------------------------------------- /include/bios_disk.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | #ifndef DOSBOX_BIOS_DISK_H 20 | #define DOSBOX_BIOS_DISK_H 21 | 22 | #include 23 | #ifndef DOSBOX_MEM_H 24 | #include "mem.h" 25 | #endif 26 | #ifndef DOSBOX_DOS_INC_H 27 | #include "dos_inc.h" 28 | #endif 29 | #ifndef DOSBOX_BIOS_H 30 | #include "bios.h" 31 | #endif 32 | 33 | /* The Section handling Bios Disk Access */ 34 | #define BIOS_MAX_DISK 10 35 | 36 | #define MAX_SWAPPABLE_DISKS 20 37 | struct diskGeo { 38 | Bit32u ksize; /* Size in kilobytes */ 39 | Bit16u secttrack; /* Sectors per track */ 40 | Bit16u headscyl; /* Heads per cylinder */ 41 | Bit16u cylcount; /* Cylinders per side */ 42 | Bit16u biosval; /* Type to return from BIOS */ 43 | }; 44 | extern diskGeo DiskGeometryList[]; 45 | 46 | class imageDisk { 47 | public: 48 | Bit8u Read_Sector(Bit32u head,Bit32u cylinder,Bit32u sector,void * data); 49 | Bit8u Write_Sector(Bit32u head,Bit32u cylinder,Bit32u sector,void * data); 50 | Bit8u Read_AbsoluteSector(Bit32u sectnum, void * data); 51 | Bit8u Write_AbsoluteSector(Bit32u sectnum, void * data); 52 | 53 | void Set_Geometry(Bit32u setHeads, Bit32u setCyl, Bit32u setSect, Bit32u setSectSize); 54 | void Get_Geometry(Bit32u * getHeads, Bit32u *getCyl, Bit32u *getSect, Bit32u *getSectSize); 55 | Bit8u GetBiosType(void); 56 | Bit32u getSectSize(void); 57 | imageDisk(FILE *imgFile, Bit8u *imgName, Bit32u imgSizeK, bool isHardDisk); 58 | ~imageDisk() { if(diskimg != NULL) { fclose(diskimg); } }; 59 | 60 | bool hardDrive; 61 | bool active; 62 | FILE *diskimg; 63 | Bit8u diskname[512]; 64 | Bit8u floppytype; 65 | 66 | Bit32u sector_size; 67 | Bit32u heads,cylinders,sectors; 68 | private: 69 | Bit32u current_fpos; 70 | enum { NONE,READ,WRITE } last_action; 71 | }; 72 | 73 | void updateDPT(void); 74 | void incrementFDD(void); 75 | 76 | #define MAX_HDD_IMAGES 2 77 | 78 | extern imageDisk *imageDiskList[2 + MAX_HDD_IMAGES]; 79 | extern imageDisk *diskSwap[20]; 80 | extern Bit32s swapPosition; 81 | extern Bit16u imgDTASeg; /* Real memory location of temporary DTA pointer for fat image disk access */ 82 | extern RealPt imgDTAPtr; /* Real memory location of temporary DTA pointer for fat image disk access */ 83 | extern DOS_DTA *imgDTA; 84 | 85 | void swapInDisks(void); 86 | void swapInNextDisk(void); 87 | bool getSwapRequest(void); 88 | 89 | #endif 90 | -------------------------------------------------------------------------------- /include/callback.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | 20 | #ifndef DOSBOX_CALLBACK_H 21 | #define DOSBOX_CALLBACK_H 22 | 23 | #ifndef DOSBOX_MEM_H 24 | #include "mem.h" 25 | #endif 26 | 27 | typedef Bitu (*CallBack_Handler)(void); 28 | extern CallBack_Handler CallBack_Handlers[]; 29 | 30 | enum { CB_RETN,CB_RETF,CB_RETF8,CB_IRET,CB_IRETD,CB_IRET_STI,CB_IRET_EOI_PIC1, 31 | CB_IRQ0,CB_IRQ1,CB_IRQ9,CB_IRQ12,CB_IRQ12_RET,CB_IRQ6_PCJR,CB_MOUSE, 32 | CB_INT29,CB_INT16,CB_HOOKABLE,CB_TDE_IRET,CB_IPXESR,CB_IPXESR_RET, 33 | CB_INT21,CB_INT13,CB_VESA_WAIT,CB_VESA_PM }; 34 | 35 | #define CB_MAX 128 36 | #define CB_SIZE 32 37 | #define CB_SEG 0xF000 38 | #define CB_SOFFSET 0x1000 39 | 40 | enum { 41 | CBRET_NONE=0,CBRET_STOP=1 42 | }; 43 | 44 | extern Bit8u lastint; 45 | 46 | static INLINE RealPt CALLBACK_RealPointer(Bitu callback) { 47 | return RealMake(CB_SEG,(Bit16u)(CB_SOFFSET+callback*CB_SIZE)); 48 | } 49 | static INLINE PhysPt CALLBACK_PhysPointer(Bitu callback) { 50 | return PhysMake(CB_SEG,(Bit16u)(CB_SOFFSET+callback*CB_SIZE)); 51 | } 52 | 53 | static INLINE PhysPt CALLBACK_GetBase(void) { 54 | return (CB_SEG << 4) + CB_SOFFSET; 55 | } 56 | 57 | Bitu CALLBACK_Allocate(); 58 | 59 | void CALLBACK_Idle(void); 60 | 61 | 62 | void CALLBACK_RunRealInt(Bit8u intnum); 63 | void CALLBACK_RunRealFar(Bit16u seg,Bit16u off); 64 | 65 | bool CALLBACK_Setup(Bitu callback,CallBack_Handler handler,Bitu type,const char* descr); 66 | Bitu CALLBACK_Setup(Bitu callback,CallBack_Handler handler,Bitu type,PhysPt addr,const char* descr); 67 | 68 | const char* CALLBACK_GetDescription(Bitu callback); 69 | bool CALLBACK_Free(Bitu callback); 70 | 71 | void CALLBACK_SCF(bool val); 72 | void CALLBACK_SZF(bool val); 73 | void CALLBACK_SIF(bool val); 74 | 75 | extern Bitu call_priv_io; 76 | 77 | 78 | class CALLBACK_HandlerObject{ 79 | private: 80 | bool installed; 81 | Bitu m_callback; 82 | enum {NONE,SETUP,SETUPAT} m_type; 83 | struct { 84 | RealPt old_vector; 85 | Bit8u interrupt; 86 | bool installed; 87 | } vectorhandler; 88 | public: 89 | CALLBACK_HandlerObject():installed(false),m_type(NONE) { 90 | vectorhandler.installed=false; 91 | } 92 | ~CALLBACK_HandlerObject(); 93 | 94 | //Install and allocate a callback. 95 | void Install(CallBack_Handler handler,Bitu type,const char* description); 96 | void Install(CallBack_Handler handler,Bitu type,PhysPt addr,const char* description); 97 | 98 | void Uninstall(); 99 | 100 | //Only allocate a callback number 101 | void Allocate(CallBack_Handler handler,const char* description=0); 102 | Bit16u Get_callback() { 103 | return (Bit16u)m_callback; 104 | } 105 | RealPt Get_RealPointer() { 106 | return CALLBACK_RealPointer(m_callback); 107 | } 108 | void Set_RealVec(Bit8u vec); 109 | }; 110 | #endif 111 | -------------------------------------------------------------------------------- /include/control.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | 20 | #ifndef DOSBOX_CONTROL_H 21 | #define DOSBOX_CONTROL_H 22 | 23 | #ifdef _MSC_VER 24 | #pragma warning ( disable : 4786 ) 25 | #pragma warning ( disable : 4290 ) 26 | #endif 27 | 28 | #ifndef DOSBOX_PROGRAMS_H 29 | #include "programs.h" 30 | #endif 31 | #ifndef DOSBOX_SETUP_H 32 | #include "setup.h" 33 | #endif 34 | 35 | #ifndef CH_LIST 36 | #define CH_LIST 37 | #include 38 | #endif 39 | 40 | #ifndef CH_VECTOR 41 | #define CH_VECTOR 42 | #include 43 | #endif 44 | 45 | #ifndef CH_STRING 46 | #define CH_STRING 47 | #include 48 | #endif 49 | 50 | 51 | 52 | 53 | class Config{ 54 | public: 55 | CommandLine * cmdline; 56 | private: 57 | std::list sectionlist; 58 | typedef std::list::iterator it; 59 | typedef std::list::reverse_iterator reverse_it; 60 | typedef std::list::const_iterator const_it; 61 | typedef std::list::const_reverse_iterator const_reverse_it; 62 | void (* _start_function)(void); 63 | bool secure_mode; //Sandbox mode 64 | public: 65 | bool initialised; 66 | std::vector startup_params; 67 | std::vector configfiles; 68 | Config(CommandLine * cmd):cmdline(cmd),secure_mode(false) { 69 | startup_params.push_back(cmdline->GetFileName()); 70 | cmdline->FillVector(startup_params); 71 | initialised=false; 72 | } 73 | ~Config(); 74 | 75 | Section_line * AddSection_line(char const * const _name,void (*_initfunction)(Section*)); 76 | Section_prop * AddSection_prop(char const * const _name,void (*_initfunction)(Section*),bool canchange=false); 77 | 78 | Section* GetSection(int index); 79 | Section* GetSection(std::string const&_sectionname) const; 80 | Section* GetSectionFromProperty(char const * const prop) const; 81 | 82 | void SetStartUp(void (*_function)(void)); 83 | void Init(); 84 | void ShutDown(); 85 | void StartUp(); 86 | bool PrintConfig(char const * const configfilename) const; 87 | bool ParseConfigFile(char const * const configfilename); 88 | void ParseEnv(char ** envp); 89 | bool SecureMode() const { return secure_mode; } 90 | void SwitchToSecureMode() { secure_mode = true; }//can't be undone 91 | }; 92 | 93 | #endif 94 | -------------------------------------------------------------------------------- /include/cross.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | 20 | #ifndef DOSBOX_CROSS_H 21 | #define DOSBOX_CROSS_H 22 | 23 | #ifndef DOSBOX_DOSBOX_H 24 | #include "dosbox.h" 25 | #endif 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #if defined (_MSC_VER) /* MS Visual C++ */ 33 | #include 34 | #include 35 | #define LONGTYPE(a) a##i64 36 | #define snprintf _snprintf 37 | #define vsnprintf _vsnprintf 38 | #else /* LINUX / GCC */ 39 | #include 40 | #include 41 | #define LONGTYPE(a) a##LL 42 | #endif 43 | 44 | #define CROSS_LEN 512 /* Maximum filename size */ 45 | 46 | 47 | #if defined (WIN32) || defined (OS2) /* Win 32 & OS/2*/ 48 | #define CROSS_FILENAME(blah) 49 | #define CROSS_FILESPLIT '\\' 50 | #define F_OK 0 51 | #else 52 | #define CROSS_FILENAME(blah) strreplace(blah,'\\','/') 53 | #define CROSS_FILESPLIT '/' 54 | #endif 55 | 56 | #define CROSS_NONE 0 57 | #define CROSS_FILE 1 58 | #define CROSS_DIR 2 59 | #if defined (WIN32) 60 | #define ftruncate(blah,blah2) chsize(blah,blah2) 61 | #endif 62 | 63 | //Solaris maybe others 64 | #if defined (DB_HAVE_NO_POWF) 65 | #include 66 | static inline float powf (float x, float y) { return (float) pow (x,y); } 67 | #endif 68 | 69 | class Cross { 70 | public: 71 | static void GetPlatformConfigDir(std::string& in); 72 | static void GetPlatformConfigName(std::string& in); 73 | static void CreatePlatformConfigDir(std::string& in); 74 | static void ResolveHomedir(std::string & temp_line); 75 | static void CreateDir(std::string const& temp); 76 | static bool IsPathAbsolute(std::string const& in); 77 | }; 78 | 79 | 80 | #if defined (WIN32) 81 | 82 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from 83 | #include 84 | 85 | typedef struct dir_struct { 86 | HANDLE handle; 87 | char base_path[MAX_PATH+4]; 88 | WIN32_FIND_DATA search_data; 89 | } dir_information; 90 | 91 | #else 92 | 93 | //#include //Included above 94 | #include 95 | 96 | typedef struct dir_struct { 97 | DIR* dir; 98 | char base_path[CROSS_LEN]; 99 | } dir_information; 100 | 101 | #endif 102 | 103 | dir_information* open_directory(const char* dirname); 104 | bool read_directory_first(dir_information* dirp, char* entry_name, bool& is_directory); 105 | bool read_directory_next(dir_information* dirp, char* entry_name, bool& is_directory); 106 | void close_directory(dir_information* dirp); 107 | 108 | #endif 109 | -------------------------------------------------------------------------------- /include/debug.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | void DEBUG_SetupConsole(void); 20 | void DEBUG_DrawScreen(void); 21 | bool DEBUG_Breakpoint(void); 22 | bool DEBUG_IntBreakpoint(Bit8u intNum); 23 | void DEBUG_Enable(bool pressed); 24 | void DEBUG_CheckExecuteBreakpoint(Bit16u seg, Bit32u off); 25 | bool DEBUG_ExitLoop(void); 26 | void DEBUG_RefreshPage(char scroll); 27 | Bitu DEBUG_EnableDebugger(void); 28 | 29 | extern Bitu cycle_count; 30 | extern Bitu debugCallback; 31 | 32 | #ifdef C_HEAVY_DEBUG 33 | bool DEBUG_HeavyIsBreakpoint(void); 34 | void DEBUG_HeavyWriteLogInstruction(void); 35 | #endif 36 | -------------------------------------------------------------------------------- /include/dma.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | 20 | #ifndef DOSBOX_DMA_H 21 | #define DOSBOX_DMA_H 22 | 23 | enum DMAEvent { 24 | DMA_REACHED_TC, 25 | DMA_MASKED, 26 | DMA_UNMASKED, 27 | DMA_TRANSFEREND 28 | }; 29 | 30 | class DmaChannel; 31 | typedef void (* DMA_CallBack)(DmaChannel * chan,DMAEvent event); 32 | 33 | class DmaChannel { 34 | public: 35 | Bit32u pagebase; 36 | Bit16u baseaddr; 37 | Bit32u curraddr; 38 | Bit16u basecnt; 39 | Bit16u currcnt; 40 | Bit8u channum; 41 | Bit8u pagenum; 42 | Bit8u DMA16; 43 | bool increment; 44 | bool autoinit; 45 | Bit8u trantype; 46 | bool masked; 47 | bool tcount; 48 | bool request; 49 | DMA_CallBack callback; 50 | 51 | DmaChannel(Bit8u num, bool dma16); 52 | void DoCallBack(DMAEvent event) { 53 | if (callback) (*callback)(this,event); 54 | } 55 | void SetMask(bool _mask) { 56 | masked=_mask; 57 | DoCallBack(masked ? DMA_MASKED : DMA_UNMASKED); 58 | } 59 | void Register_Callback(DMA_CallBack _cb) { 60 | callback = _cb; 61 | SetMask(masked); 62 | if (callback) Raise_Request(); 63 | else Clear_Request(); 64 | } 65 | void ReachedTC(void) { 66 | tcount=true; 67 | DoCallBack(DMA_REACHED_TC); 68 | } 69 | void SetPage(Bit8u val) { 70 | pagenum=val; 71 | pagebase=(pagenum >> DMA16) << (16+DMA16); 72 | } 73 | void Raise_Request(void) { 74 | request=true; 75 | } 76 | void Clear_Request(void) { 77 | request=false; 78 | } 79 | Bitu Read(Bitu size, Bit8u * buffer); 80 | Bitu Write(Bitu size, Bit8u * buffer); 81 | }; 82 | 83 | class DmaController { 84 | private: 85 | Bit8u ctrlnum; 86 | bool flipflop; 87 | DmaChannel *DmaChannels[4]; 88 | public: 89 | IO_ReadHandleObject DMA_ReadHandler[0x12]; 90 | IO_WriteHandleObject DMA_WriteHandler[0x12]; 91 | DmaController(Bit8u num) { 92 | flipflop = false; 93 | ctrlnum = num; /* first or second DMA controller */ 94 | for(Bit8u i=0;i<4;i++) { 95 | DmaChannels[i] = new DmaChannel(i+ctrlnum*4,ctrlnum==1); 96 | } 97 | } 98 | ~DmaController(void) { 99 | for(Bit8u i=0;i<4;i++) { 100 | delete DmaChannels[i]; 101 | } 102 | } 103 | DmaChannel * GetChannel(Bit8u chan) { 104 | if (chan<4) return DmaChannels[chan]; 105 | else return NULL; 106 | } 107 | void WriteControllerReg(Bitu reg,Bitu val,Bitu len); 108 | Bitu ReadControllerReg(Bitu reg,Bitu len); 109 | }; 110 | 111 | DmaChannel * GetDMAChannel(Bit8u chan); 112 | 113 | void CloseSecondDMAController(void); 114 | bool SecondDMAControllerAvailable(void); 115 | 116 | void DMA_SetWrapping(Bitu wrap); 117 | 118 | #endif 119 | -------------------------------------------------------------------------------- /include/dosbox.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | 20 | #ifndef DOSBOX_DOSBOX_H 21 | #define DOSBOX_DOSBOX_H 22 | 23 | #include "config.h" 24 | 25 | GCC_ATTRIBUTE(noreturn) void E_Exit(const char * message,...) GCC_ATTRIBUTE( __format__(__printf__, 1, 2)); 26 | 27 | void MSG_Add(const char*,const char*); //add messages to the internal languagefile 28 | const char* MSG_Get(char const *); //get messages from the internal languagefile 29 | 30 | class Section; 31 | 32 | typedef Bitu (LoopHandler)(void); 33 | 34 | void DOSBOX_RunMachine(); 35 | void DOSBOX_SetLoop(LoopHandler * handler); 36 | void DOSBOX_SetNormalLoop(); 37 | 38 | void DOSBOX_Init(void); 39 | 40 | class Config; 41 | extern Config * control; 42 | 43 | enum MachineType { 44 | MCH_HERC, 45 | MCH_CGA, 46 | MCH_TANDY, 47 | MCH_PCJR, 48 | MCH_EGA, 49 | MCH_VGA 50 | }; 51 | 52 | enum SVGACards { 53 | SVGA_None, 54 | SVGA_S3Trio, 55 | SVGA_TsengET4K, 56 | SVGA_TsengET3K, 57 | SVGA_ParadisePVGA1A 58 | }; 59 | 60 | extern SVGACards svgaCard; 61 | extern MachineType machine; 62 | extern bool SDLNetInited; 63 | 64 | #define IS_TANDY_ARCH ((machine==MCH_TANDY) || (machine==MCH_PCJR)) 65 | #define IS_EGAVGA_ARCH ((machine==MCH_EGA) || (machine==MCH_VGA)) 66 | #define IS_VGA_ARCH (machine==MCH_VGA) 67 | #define TANDY_ARCH_CASE MCH_TANDY: case MCH_PCJR 68 | #define EGAVGA_ARCH_CASE MCH_EGA: case MCH_VGA 69 | #define VGA_ARCH_CASE MCH_VGA 70 | 71 | #ifndef DOSBOX_LOGGING_H 72 | #include "logging.h" 73 | #endif // the logging system. 74 | 75 | #endif /* DOSBOX_DOSBOX_H */ 76 | -------------------------------------------------------------------------------- /include/fpu.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | #ifndef DOSBOX_FPU_H 20 | #define DOSBOX_FPU_H 21 | 22 | #ifndef DOSBOX_MEM_H 23 | #include "mem.h" 24 | #endif 25 | 26 | void FPU_ESC0_Normal(Bitu rm); 27 | void FPU_ESC0_EA(Bitu func,PhysPt ea); 28 | void FPU_ESC1_Normal(Bitu rm); 29 | void FPU_ESC1_EA(Bitu func,PhysPt ea); 30 | void FPU_ESC2_Normal(Bitu rm); 31 | void FPU_ESC2_EA(Bitu func,PhysPt ea); 32 | void FPU_ESC3_Normal(Bitu rm); 33 | void FPU_ESC3_EA(Bitu func,PhysPt ea); 34 | void FPU_ESC4_Normal(Bitu rm); 35 | void FPU_ESC4_EA(Bitu func,PhysPt ea); 36 | void FPU_ESC5_Normal(Bitu rm); 37 | void FPU_ESC5_EA(Bitu func,PhysPt ea); 38 | void FPU_ESC6_Normal(Bitu rm); 39 | void FPU_ESC6_EA(Bitu func,PhysPt ea); 40 | void FPU_ESC7_Normal(Bitu rm); 41 | void FPU_ESC7_EA(Bitu func,PhysPt ea); 42 | 43 | 44 | typedef union { 45 | double d; 46 | #ifndef WORDS_BIGENDIAN 47 | struct { 48 | Bit32u lower; 49 | Bit32s upper; 50 | } l; 51 | #else 52 | struct { 53 | Bit32s upper; 54 | Bit32u lower; 55 | } l; 56 | #endif 57 | Bit64s ll; 58 | } FPU_Reg; 59 | 60 | typedef struct { 61 | Bit32u m1; 62 | Bit32u m2; 63 | Bit16u m3; 64 | 65 | Bit16u d1; 66 | Bit32u d2; 67 | } FPU_P_Reg; 68 | 69 | enum FPU_Tag { 70 | TAG_Valid = 0, 71 | TAG_Zero = 1, 72 | TAG_Weird = 2, 73 | TAG_Empty = 3 74 | }; 75 | 76 | enum FPU_Round { 77 | ROUND_Nearest = 0, 78 | ROUND_Down = 1, 79 | ROUND_Up = 2, 80 | ROUND_Chop = 3 81 | }; 82 | 83 | typedef struct { 84 | FPU_Reg regs[9]; 85 | FPU_P_Reg p_regs[9]; 86 | FPU_Tag tags[9]; 87 | Bit16u cw,cw_mask_all; 88 | Bit16u sw; 89 | Bit32u top; 90 | FPU_Round round; 91 | } FPU_rec; 92 | 93 | 94 | //get pi from a real library 95 | #define PI 3.14159265358979323846 96 | #define L2E 1.4426950408889634 97 | #define L2T 3.3219280948873623 98 | #define LN2 0.69314718055994531 99 | #define LG2 0.3010299956639812 100 | 101 | 102 | extern FPU_rec fpu; 103 | 104 | #define TOP fpu.top 105 | #define STV(i) ( (fpu.top+ (i) ) & 7 ) 106 | 107 | 108 | Bit16u FPU_GetTag(void); 109 | void FPU_FLDCW(PhysPt addr); 110 | 111 | static INLINE void FPU_SetTag(Bit16u tag){ 112 | for(Bitu i=0;i<8;i++) 113 | fpu.tags[i] = static_cast((tag >>(2*i))&3); 114 | } 115 | 116 | static INLINE void FPU_SetCW(Bitu word){ 117 | fpu.cw = (Bit16u)word; 118 | fpu.cw_mask_all = (Bit16u)(word | 0x3f); 119 | fpu.round = (FPU_Round)((word >> 10) & 3); 120 | } 121 | 122 | 123 | static INLINE Bitu FPU_GET_TOP(void) { 124 | return (fpu.sw & 0x3800)>>11; 125 | } 126 | 127 | static INLINE void FPU_SET_TOP(Bitu val){ 128 | fpu.sw &= ~0x3800; 129 | fpu.sw |= (val&7)<<11; 130 | } 131 | 132 | 133 | static INLINE void FPU_SET_C0(Bitu C){ 134 | fpu.sw &= ~0x0100; 135 | if(C) fpu.sw |= 0x0100; 136 | } 137 | 138 | static INLINE void FPU_SET_C1(Bitu C){ 139 | fpu.sw &= ~0x0200; 140 | if(C) fpu.sw |= 0x0200; 141 | } 142 | 143 | static INLINE void FPU_SET_C2(Bitu C){ 144 | fpu.sw &= ~0x0400; 145 | if(C) fpu.sw |= 0x0400; 146 | } 147 | 148 | static INLINE void FPU_SET_C3(Bitu C){ 149 | fpu.sw &= ~0x4000; 150 | if(C) fpu.sw |= 0x4000; 151 | } 152 | 153 | 154 | #endif 155 | -------------------------------------------------------------------------------- /include/hardware.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | 20 | #ifndef DOSBOX_HARDWARE_H 21 | #define DOSBOX_HARDWARE_H 22 | 23 | #include 24 | 25 | class Section; 26 | enum OPL_Mode { 27 | OPL_none,OPL_cms,OPL_opl2,OPL_dualopl2,OPL_opl3,OPL_opl3gold 28 | }; 29 | #define CAPTURE_WAVE 0x01 30 | #define CAPTURE_OPL 0x02 31 | #define CAPTURE_MIDI 0x04 32 | #define CAPTURE_IMAGE 0x08 33 | #define CAPTURE_VIDEO 0x10 34 | 35 | extern Bitu CaptureState; 36 | 37 | void OPL_Init(Section* sec,OPL_Mode mode); 38 | void CMS_Init(Section* sec); 39 | void OPL_ShutDown(Section* sec); 40 | void CMS_ShutDown(Section* sec); 41 | 42 | bool SB_Get_Address(Bitu& sbaddr, Bitu& sbirq, Bitu& sbdma); 43 | bool TS_Get_Address(Bitu& tsaddr, Bitu& tsirq, Bitu& tsdma); 44 | 45 | extern Bit8u adlib_commandreg; 46 | FILE * OpenCaptureFile(const char * type,const char * ext); 47 | 48 | void CAPTURE_AddWave(Bit32u freq, Bit32u len, Bit16s * data); 49 | #define CAPTURE_FLAG_DBLW 0x1 50 | #define CAPTURE_FLAG_DBLH 0x2 51 | void CAPTURE_AddImage(Bitu width, Bitu height, Bitu bpp, Bitu pitch, Bitu flags, float fps, Bit8u * data, Bit8u * pal); 52 | void CAPTURE_AddMidi(bool sysex, Bitu len, Bit8u * data); 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /include/inout.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | 20 | #ifndef DOSBOX_INOUT_H 21 | #define DOSBOX_INOUT_H 22 | 23 | #define IO_MAX (64*1024+3) 24 | 25 | #define IO_MB 0x1 26 | #define IO_MW 0x2 27 | #define IO_MD 0x4 28 | #define IO_MA (IO_MB | IO_MW | IO_MD ) 29 | 30 | typedef Bitu IO_ReadHandler(Bitu port,Bitu iolen); 31 | typedef void IO_WriteHandler(Bitu port,Bitu val,Bitu iolen); 32 | 33 | extern IO_WriteHandler * io_writehandlers[3][IO_MAX]; 34 | extern IO_ReadHandler * io_readhandlers[3][IO_MAX]; 35 | 36 | void IO_RegisterReadHandler(Bitu port,IO_ReadHandler * handler,Bitu mask,Bitu range=1); 37 | void IO_RegisterWriteHandler(Bitu port,IO_WriteHandler * handler,Bitu mask,Bitu range=1); 38 | 39 | void IO_FreeReadHandler(Bitu port,Bitu mask,Bitu range=1); 40 | void IO_FreeWriteHandler(Bitu port,Bitu mask,Bitu range=1); 41 | 42 | void IO_WriteB(Bitu port,Bitu val); 43 | void IO_WriteW(Bitu port,Bitu val); 44 | void IO_WriteD(Bitu port,Bitu val); 45 | 46 | Bitu IO_ReadB(Bitu port); 47 | Bitu IO_ReadW(Bitu port); 48 | Bitu IO_ReadD(Bitu port); 49 | 50 | /* Classes to manage the IO objects created by the various devices. 51 | * The io objects will remove itself on destruction.*/ 52 | class IO_Base{ 53 | protected: 54 | bool installed; 55 | Bitu m_port, m_mask,m_range; 56 | public: 57 | IO_Base():installed(false){}; 58 | }; 59 | class IO_ReadHandleObject: private IO_Base{ 60 | public: 61 | void Install(Bitu port,IO_ReadHandler * handler,Bitu mask,Bitu range=1); 62 | void Uninstall(); 63 | ~IO_ReadHandleObject(); 64 | }; 65 | class IO_WriteHandleObject: private IO_Base{ 66 | public: 67 | void Install(Bitu port,IO_WriteHandler * handler,Bitu mask,Bitu range=1); 68 | void Uninstall(); 69 | ~IO_WriteHandleObject(); 70 | }; 71 | 72 | static INLINE void IO_Write(Bitu port,Bit8u val) { 73 | IO_WriteB(port,val); 74 | } 75 | static INLINE Bit8u IO_Read(Bitu port){ 76 | return (Bit8u)IO_ReadB(port); 77 | } 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /include/ipx.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | 20 | #ifndef DOSBOX_IPX_H 21 | #define DOSBOX_IPX_H 22 | 23 | // Uncomment this for a lot of debug messages: 24 | //#define IPX_DEBUGMSG 25 | 26 | #ifdef IPX_DEBUGMSG 27 | #define LOG_IPX LOG_MSG 28 | #else 29 | #if defined (_MSC_VER) 30 | #define LOG_IPX 31 | #else 32 | #define LOG_IPX(...) 33 | #endif 34 | #endif 35 | 36 | #ifndef DOSBOX_DOSBOX_H 37 | #include "dosbox.h" 38 | #endif 39 | #ifndef DOSBOX_MEM_H 40 | #include "mem.h" 41 | #endif 42 | 43 | // In Use Flag codes 44 | #define USEFLAG_AVAILABLE 0x00 45 | #define USEFLAG_AESTEMP 0xe0 46 | #define USEFLAG_IPXCRIT 0xf8 47 | #define USEFLAG_SPXLISTEN 0xf9 48 | #define USEFLAG_PROCESSING 0xfa 49 | #define USEFLAG_HOLDING 0xfb 50 | #define USEFLAG_AESWAITING 0xfc 51 | #define USEFLAG_AESCOUNT 0xfd 52 | #define USEFLAG_LISTENING 0xfe 53 | #define USEFLAG_SENDING 0xff 54 | 55 | // Completion codes 56 | #define COMP_SUCCESS 0x00 57 | #define COMP_REMOTETERM 0xec 58 | #define COMP_DISCONNECT 0xed 59 | #define COMP_INVALIDID 0xee 60 | #define COMP_SPXTABLEFULL 0xef 61 | #define COMP_EVENTNOTCANCELED 0xf9 62 | #define COMP_NOCONNECTION 0xfa 63 | #define COMP_CANCELLED 0xfc 64 | #define COMP_MALFORMED 0xfd 65 | #define COMP_UNDELIVERABLE 0xfe 66 | #define COMP_HARDWAREERROR 0xff 67 | 68 | #ifdef _MSC_VER 69 | #pragma pack(1) 70 | #endif 71 | 72 | // For Uint8 type 73 | #include "SDL_net.h" 74 | 75 | struct PackedIP { 76 | Uint32 host; 77 | Uint16 port; 78 | } GCC_ATTRIBUTE(packed); 79 | 80 | struct nodeType { 81 | Uint8 node[6]; 82 | } GCC_ATTRIBUTE(packed) ; 83 | 84 | struct IPXHeader { 85 | Uint8 checkSum[2]; 86 | Uint8 length[2]; 87 | Uint8 transControl; // Transport control 88 | Uint8 pType; // Packet type 89 | 90 | struct transport { 91 | Uint8 network[4]; 92 | union addrtype { 93 | nodeType byNode; 94 | PackedIP byIP ; 95 | } GCC_ATTRIBUTE(packed) addr; 96 | Uint8 socket[2]; 97 | } dest, src; 98 | } GCC_ATTRIBUTE(packed); 99 | 100 | struct fragmentDescriptor { 101 | Bit16u offset; 102 | Bit16u segment; 103 | Bit16u size; 104 | }; 105 | 106 | #define IPXBUFFERSIZE 1424 107 | 108 | class ECBClass { 109 | public: 110 | RealPt ECBAddr; 111 | bool isInESRList; 112 | ECBClass *prevECB; // Linked List 113 | ECBClass *nextECB; 114 | 115 | Bit8u iuflag; // Need to save data since we are not always in 116 | Bit16u mysocket; // real mode 117 | 118 | Bit8u* databuffer; // received data is stored here until we get called 119 | Bitu buflen; // by Interrupt 120 | 121 | #ifdef IPX_DEBUGMSG 122 | Bitu SerialNumber; 123 | #endif 124 | 125 | ECBClass(Bit16u segment, Bit16u offset); 126 | Bit16u getSocket(void); 127 | 128 | Bit8u getInUseFlag(void); 129 | 130 | void setInUseFlag(Bit8u flagval); 131 | 132 | void setCompletionFlag(Bit8u flagval); 133 | 134 | Bit16u getFragCount(void); 135 | 136 | bool writeData(); 137 | void writeDataBuffer(Bit8u* buffer, Bit16u length); 138 | 139 | void getFragDesc(Bit16u descNum, fragmentDescriptor *fragDesc); 140 | RealPt getESRAddr(void); 141 | 142 | void NotifyESR(void); 143 | 144 | void setImmAddress(Bit8u *immAddr); 145 | void getImmAddress(Bit8u* immAddr); 146 | 147 | ~ECBClass(); 148 | }; 149 | 150 | // The following routines may not be needed on all systems. On my build of SDL the IPaddress structure is 8 octects 151 | // and therefore screws up my IPXheader structure since it needs to be packed. 152 | 153 | void UnpackIP(PackedIP ipPack, IPaddress * ipAddr); 154 | void PackIP(IPaddress ipAddr, PackedIP *ipPack); 155 | 156 | #ifdef _MSC_VER 157 | #pragma pack() 158 | #endif 159 | 160 | #endif 161 | -------------------------------------------------------------------------------- /include/ipxserver.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | #ifndef DOSBOX_IPXSERVER_H_ 20 | #define DOSBOX_IPXSERVER_H_ 21 | 22 | #if C_IPX 23 | 24 | #include "SDL_net.h" 25 | 26 | struct packetBuffer { 27 | Bit8u buffer[1024]; 28 | Bit16s packetSize; // Packet size remaining in read 29 | Bit16s packetRead; // Bytes read of total packet 30 | bool inPacket; // In packet reception flag 31 | bool connected; // Connected flag 32 | bool waitsize; 33 | }; 34 | 35 | #define SOCKETTABLESIZE 16 36 | #define CONVIP(hostvar) hostvar & 0xff, (hostvar >> 8) & 0xff, (hostvar >> 16) & 0xff, (hostvar >> 24) & 0xff 37 | #define CONVIPX(hostvar) hostvar[0], hostvar[1], hostvar[2], hostvar[3], hostvar[4], hostvar[5] 38 | 39 | 40 | void IPX_StopServer(); 41 | bool IPX_StartServer(Bit16u portnum); 42 | bool IPX_isConnectedToServer(Bits tableNum, IPaddress ** ptrAddr); 43 | 44 | Bit8u packetCRC(Bit8u *buffer, Bit16u bufSize); 45 | 46 | #endif 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /include/joystick.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | #ifndef DOSBOX_JOYSTICK_H 20 | #define DOSBOX_JOYSTICK_H 21 | void JOYSTICK_Enable(Bitu which,bool enabled); 22 | 23 | void JOYSTICK_Button(Bitu which,Bitu num,bool pressed); 24 | 25 | void JOYSTICK_Move_X(Bitu which,float x); 26 | 27 | void JOYSTICK_Move_Y(Bitu which,float y); 28 | 29 | bool JOYSTICK_IsEnabled(Bitu which); 30 | 31 | bool JOYSTICK_GetButton(Bitu which, Bitu num); 32 | 33 | float JOYSTICK_GetMove_X(Bitu which); 34 | 35 | float JOYSTICK_GetMove_Y(Bitu which); 36 | 37 | enum JoystickType { 38 | JOY_NONE, 39 | JOY_AUTO, 40 | JOY_2AXIS, 41 | JOY_4AXIS, 42 | JOY_4AXIS_2, 43 | JOY_FCS, 44 | JOY_CH 45 | }; 46 | 47 | extern JoystickType joytype; 48 | extern bool button_wrapping_enabled; 49 | #endif 50 | -------------------------------------------------------------------------------- /include/keyboard.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | #ifndef DOSBOX_KEYBOARD_H 20 | #define DOSBOX_KEYBOARD_H 21 | 22 | enum KBD_KEYS { 23 | KBD_NONE, 24 | KBD_1, KBD_2, KBD_3, KBD_4, KBD_5, KBD_6, KBD_7, KBD_8, KBD_9, KBD_0, 25 | KBD_q, KBD_w, KBD_e, KBD_r, KBD_t, KBD_y, KBD_u, KBD_i, KBD_o, KBD_p, 26 | KBD_a, KBD_s, KBD_d, KBD_f, KBD_g, KBD_h, KBD_j, KBD_k, KBD_l, KBD_z, 27 | KBD_x, KBD_c, KBD_v, KBD_b, KBD_n, KBD_m, 28 | KBD_f1, KBD_f2, KBD_f3, KBD_f4, KBD_f5, KBD_f6, KBD_f7, KBD_f8, KBD_f9, KBD_f10,KBD_f11,KBD_f12, 29 | 30 | /*Now the weirder keys */ 31 | 32 | KBD_esc,KBD_tab,KBD_backspace,KBD_enter,KBD_space, 33 | KBD_leftalt,KBD_rightalt,KBD_leftctrl,KBD_rightctrl,KBD_leftshift,KBD_rightshift, 34 | KBD_capslock,KBD_scrolllock,KBD_numlock, 35 | 36 | KBD_grave,KBD_minus,KBD_equals,KBD_backslash,KBD_leftbracket,KBD_rightbracket, 37 | KBD_semicolon,KBD_quote,KBD_period,KBD_comma,KBD_slash,KBD_extra_lt_gt, 38 | 39 | KBD_printscreen,KBD_pause, 40 | KBD_insert,KBD_home,KBD_pageup,KBD_delete,KBD_end,KBD_pagedown, 41 | KBD_left,KBD_up,KBD_down,KBD_right, 42 | 43 | KBD_kp1,KBD_kp2,KBD_kp3,KBD_kp4,KBD_kp5,KBD_kp6,KBD_kp7,KBD_kp8,KBD_kp9,KBD_kp0, 44 | KBD_kpdivide,KBD_kpmultiply,KBD_kpminus,KBD_kpplus,KBD_kpenter,KBD_kpperiod, 45 | 46 | 47 | KBD_LAST 48 | }; 49 | 50 | void KEYBOARD_ClrBuffer(void); 51 | void KEYBOARD_AddKey(KBD_KEYS keytype,bool pressed); 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /include/logging.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | #ifndef DOSBOX_LOGGING_H 20 | #define DOSBOX_LOGGING_H 21 | enum LOG_TYPES { 22 | LOG_ALL, 23 | LOG_VGA, LOG_VGAGFX,LOG_VGAMISC,LOG_INT10, 24 | LOG_SB,LOG_DMACONTROL, 25 | LOG_FPU,LOG_CPU,LOG_PAGING, 26 | LOG_FCB,LOG_FILES,LOG_IOCTL,LOG_EXEC,LOG_DOSMISC, 27 | LOG_PIT,LOG_KEYBOARD,LOG_PIC, 28 | LOG_MOUSE,LOG_BIOS,LOG_GUI,LOG_MISC, 29 | LOG_IO, 30 | LOG_PCI, 31 | LOG_MAX 32 | }; 33 | 34 | enum LOG_SEVERITIES { 35 | LOG_NORMAL, 36 | LOG_WARN, 37 | LOG_ERROR 38 | }; 39 | 40 | #if C_DEBUG 41 | class LOG 42 | { 43 | LOG_TYPES d_type; 44 | LOG_SEVERITIES d_severity; 45 | public: 46 | 47 | LOG (LOG_TYPES type , LOG_SEVERITIES severity): 48 | d_type(type), 49 | d_severity(severity) 50 | {} 51 | void operator() (char const* buf, ...) GCC_ATTRIBUTE(__format__(__printf__, 2, 3)); //../src/debug/debug_gui.cpp 52 | 53 | }; 54 | 55 | void DEBUG_ShowMsg(char const* format,...) GCC_ATTRIBUTE(__format__(__printf__, 1, 2)); 56 | #define LOG_MSG DEBUG_ShowMsg 57 | 58 | #else //C_DEBUG 59 | 60 | struct LOG 61 | { 62 | LOG(LOG_TYPES , LOG_SEVERITIES ) { } 63 | void operator()(char const* ) { } 64 | void operator()(char const* , double ) { } 65 | void operator()(char const* , double , double ) { } 66 | void operator()(char const* , double , double , double ) { } 67 | void operator()(char const* , double , double , double , double ) { } 68 | void operator()(char const* , double , double , double , double , double ) { } 69 | void operator()(char const* , double , double , double , double , double , double ) { } 70 | void operator()(char const* , double , double , double , double , double , double , double) { } 71 | 72 | 73 | 74 | void operator()(char const* , char const* ) { } 75 | void operator()(char const* , char const* , double ) { } 76 | void operator()(char const* , char const* , double ,double ) { } 77 | void operator()(char const* , double , char const* ) { } 78 | void operator()(char const* , double , double, char const* ) { } 79 | void operator()(char const* , char const*, char const*) { } 80 | 81 | void operator()(char const* , double , double , double , char const* ) { } 82 | }; //add missing operators to here 83 | //try to avoid anything smaller than bit32... 84 | void GFX_ShowMsg(char const* format,...) GCC_ATTRIBUTE(__format__(__printf__, 1, 2)); 85 | #define LOG_MSG GFX_ShowMsg 86 | 87 | #endif //C_DEBUG 88 | 89 | 90 | #endif //DOSBOX_LOGGING_H 91 | -------------------------------------------------------------------------------- /include/mapper.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | #ifndef DOSBOX_MAPPER_H 20 | #define DOSBOX_MAPPER_H 21 | 22 | enum MapKeys { 23 | MK_f1,MK_f2,MK_f3,MK_f4,MK_f5,MK_f6,MK_f7,MK_f8,MK_f9,MK_f10,MK_f11,MK_f12, 24 | MK_return,MK_kpminus,MK_scrolllock,MK_printscreen,MK_pause,MK_home 25 | 26 | }; 27 | 28 | typedef void (MAPPER_Handler)(bool pressed); 29 | void MAPPER_AddHandler(MAPPER_Handler * handler,MapKeys key,Bitu mods,char const * const eventname,char const * const buttonname); 30 | void MAPPER_Init(void); 31 | void MAPPER_StartUp(Section * sec); 32 | void MAPPER_Run(bool pressed); 33 | void MAPPER_RunInternal(); 34 | void MAPPER_LosingFocus(void); 35 | 36 | 37 | #define MMOD1 0x1 38 | #define MMOD2 0x2 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /include/midi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | 20 | #ifndef DOSBOX_MIDI_H 21 | #define DOSBOX_MIDI_H 22 | 23 | #ifndef DOSBOX_PROGRAMS_H 24 | #include "programs.h" 25 | #endif 26 | 27 | class MidiHandler { 28 | public: 29 | MidiHandler(); 30 | virtual bool Open(const char * /*conf*/) { return true; }; 31 | virtual void Close(void) {}; 32 | virtual void PlayMsg(Bit8u * /*msg*/) {}; 33 | virtual void PlaySysex(Bit8u * /*sysex*/,Bitu /*len*/) {}; 34 | virtual const char * GetName(void) { return "none"; }; 35 | virtual void ListAll(Program * base) {}; 36 | virtual ~MidiHandler() { }; 37 | MidiHandler * next; 38 | }; 39 | 40 | 41 | #define SYSEX_SIZE 8192 42 | struct DB_Midi { 43 | Bitu status; 44 | Bitu cmd_len; 45 | Bitu cmd_pos; 46 | Bit8u cmd_buf[8]; 47 | Bit8u rt_buf[8]; 48 | struct { 49 | Bit8u buf[SYSEX_SIZE]; 50 | Bitu used; 51 | Bitu delay; 52 | Bit32u start; 53 | } sysex; 54 | bool available; 55 | MidiHandler * handler; 56 | }; 57 | 58 | extern DB_Midi midi; 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /include/mixer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | 20 | #ifndef DOSBOX_MIXER_H 21 | #define DOSBOX_MIXER_H 22 | 23 | #ifndef DOSBOX_DOSBOX_H 24 | #include "dosbox.h" 25 | #endif 26 | 27 | typedef void (*MIXER_MixHandler)(Bit8u * sampdate,Bit32u len); 28 | typedef void (*MIXER_Handler)(Bitu len); 29 | 30 | enum BlahModes { 31 | MIXER_8MONO,MIXER_8STEREO, 32 | MIXER_16MONO,MIXER_16STEREO 33 | }; 34 | 35 | enum MixerModes { 36 | M_8M,M_8S, 37 | M_16M,M_16S 38 | }; 39 | 40 | #define MIXER_BUFSIZE (16*1024) 41 | #define MIXER_BUFMASK (MIXER_BUFSIZE-1) 42 | extern Bit8u MixTemp[MIXER_BUFSIZE]; 43 | 44 | #define MAX_AUDIO ((1<<(16-1))-1) 45 | #define MIN_AUDIO -(1<<(16-1)) 46 | 47 | class MixerChannel { 48 | public: 49 | void SetVolume(float _left,float _right); 50 | void SetScale( float f ); 51 | void UpdateVolume(void); 52 | void SetFreq(Bitu _freq); 53 | void Mix(Bitu _needed); 54 | void AddSilence(void); //Fill up until needed 55 | 56 | template 57 | void AddSamples(Bitu len, const Type* data); 58 | 59 | void AddSamples_m8(Bitu len, const Bit8u * data); 60 | void AddSamples_s8(Bitu len, const Bit8u * data); 61 | void AddSamples_m8s(Bitu len, const Bit8s * data); 62 | void AddSamples_s8s(Bitu len, const Bit8s * data); 63 | void AddSamples_m16(Bitu len, const Bit16s * data); 64 | void AddSamples_s16(Bitu len, const Bit16s * data); 65 | void AddSamples_m16u(Bitu len, const Bit16u * data); 66 | void AddSamples_s16u(Bitu len, const Bit16u * data); 67 | void AddSamples_m32(Bitu len, const Bit32s * data); 68 | void AddSamples_s32(Bitu len, const Bit32s * data); 69 | void AddSamples_m16_nonnative(Bitu len, const Bit16s * data); 70 | void AddSamples_s16_nonnative(Bitu len, const Bit16s * data); 71 | void AddSamples_m16u_nonnative(Bitu len, const Bit16u * data); 72 | void AddSamples_s16u_nonnative(Bitu len, const Bit16u * data); 73 | void AddSamples_m32_nonnative(Bitu len, const Bit32s * data); 74 | void AddSamples_s32_nonnative(Bitu len, const Bit32s * data); 75 | 76 | void AddStretched(Bitu len,Bit16s * data); //Strech block up into needed data 77 | 78 | void FillUp(void); 79 | void Enable(bool _yesno); 80 | MIXER_Handler handler; 81 | float volmain[2]; 82 | float scale; 83 | Bit32s volmul[2]; 84 | 85 | //This gets added the frequency counter each mixer step 86 | Bitu freq_add; 87 | //When this flows over a new sample needs to be read from the device 88 | Bitu freq_counter; 89 | //Timing on how many samples have been done and were needed by th emixer 90 | Bitu done, needed; 91 | //Previous and next samples 92 | Bits prevSample[2]; 93 | Bits nextSample[2]; 94 | const char * name; 95 | bool interpolate; 96 | bool enabled; 97 | MixerChannel * next; 98 | }; 99 | 100 | MixerChannel * MIXER_AddChannel(MIXER_Handler handler,Bitu freq,const char * name); 101 | MixerChannel * MIXER_FindChannel(const char * name); 102 | /* Find the device you want to delete with findchannel "delchan gets deleted" */ 103 | void MIXER_DelChannel(MixerChannel* delchan); 104 | 105 | /* Object to maintain a mixerchannel; As all objects it registers itself with create 106 | * and removes itself when destroyed. */ 107 | class MixerObject{ 108 | private: 109 | bool installed; 110 | char m_name[32]; 111 | public: 112 | MixerObject():installed(false){}; 113 | MixerChannel* Install(MIXER_Handler handler,Bitu freq,const char * name); 114 | ~MixerObject(); 115 | }; 116 | 117 | 118 | /* PC Speakers functions, tightly related to the timer functions */ 119 | void PCSPEAKER_SetCounter(Bitu cntr,Bitu mode); 120 | void PCSPEAKER_SetType(Bitu mode); 121 | 122 | #endif 123 | -------------------------------------------------------------------------------- /include/mouse.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | 20 | 21 | #ifndef DOSBOX_MOUSE_H 22 | #define DOSBOX_MOUSE_H 23 | 24 | 25 | void Mouse_ShowCursor(void); 26 | void Mouse_HideCursor(void); 27 | 28 | bool Mouse_SetPS2State(bool use); 29 | 30 | void Mouse_ChangePS2Callback(Bit16u pseg, Bit16u pofs); 31 | 32 | 33 | void Mouse_CursorMoved(float xrel,float yrel,float x,float y,bool emulate); 34 | void Mouse_CursorSet(float x,float y); 35 | void Mouse_ButtonPressed(Bit8u button); 36 | void Mouse_ButtonReleased(Bit8u button); 37 | 38 | void Mouse_AutoLock(bool enable); 39 | void Mouse_BeforeNewVideoMode(bool setmode); 40 | void Mouse_AfterNewVideoMode(bool setmode); 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /include/pci_bus.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | #ifndef DOSBOX_PCI_H 20 | #define DOSBOX_PCI_H 21 | 22 | //#define PCI_FUNCTIONALITY_ENABLED 0 23 | 24 | #if defined PCI_FUNCTIONALITY_ENABLED 25 | 26 | #define PCI_MAX_PCIDEVICES 10 27 | #define PCI_MAX_PCIFUNCTIONS 8 28 | 29 | 30 | class PCI_Device { 31 | private: 32 | Bits pci_id, pci_subfunction; 33 | Bit16u vendor_id, device_id; 34 | 35 | // subdevices declarations, they will respond to pci functions 1 to 7 36 | // (main device is attached to function 0) 37 | Bitu num_subdevices; 38 | PCI_Device* subdevices[PCI_MAX_PCIFUNCTIONS-1]; 39 | 40 | public: 41 | PCI_Device(Bit16u vendor, Bit16u device); 42 | 43 | Bits PCIId(void) { 44 | return pci_id; 45 | } 46 | Bits PCISubfunction(void) { 47 | return pci_subfunction; 48 | } 49 | Bit16u VendorID(void) { 50 | return vendor_id; 51 | } 52 | Bit16u DeviceID(void) { 53 | return device_id; 54 | } 55 | 56 | void SetPCIId(Bitu number, Bits subfct); 57 | 58 | bool AddSubdevice(PCI_Device* dev); 59 | void RemoveSubdevice(Bits subfct); 60 | 61 | PCI_Device* GetSubdevice(Bits subfct); 62 | 63 | Bit16u NumSubdevices(void) { 64 | if (num_subdevices>PCI_MAX_PCIFUNCTIONS-1) return (Bit16u)(PCI_MAX_PCIFUNCTIONS-1); 65 | return (Bit16u)num_subdevices; 66 | } 67 | 68 | Bits GetNextSubdeviceNumber(void) { 69 | if (num_subdevices>=PCI_MAX_PCIFUNCTIONS-1) return -1; 70 | return (Bits)num_subdevices+1; 71 | } 72 | 73 | virtual Bits ParseReadRegister(Bit8u regnum)=0; 74 | virtual bool OverrideReadRegister(Bit8u regnum, Bit8u* rval, Bit8u* rval_mask)=0; 75 | virtual Bits ParseWriteRegister(Bit8u regnum,Bit8u value)=0; 76 | virtual bool InitializeRegisters(Bit8u registers[256])=0; 77 | 78 | }; 79 | 80 | bool PCI_IsInitialized(); 81 | 82 | RealPt PCI_GetPModeInterface(void); 83 | 84 | #endif 85 | 86 | #endif 87 | -------------------------------------------------------------------------------- /include/pic.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | #ifndef DOSBOX_PIC_H 20 | #define DOSBOX_PIC_H 21 | 22 | 23 | /* CPU Cycle Timing */ 24 | extern Bit32s CPU_Cycles; 25 | extern Bit32s CPU_CycleLeft; 26 | extern Bit32s CPU_CycleMax; 27 | 28 | typedef void (PIC_EOIHandler) (void); 29 | typedef void (* PIC_EventHandler)(Bitu val); 30 | 31 | 32 | extern Bitu PIC_IRQCheck; 33 | extern Bitu PIC_Ticks; 34 | 35 | static INLINE float PIC_TickIndex(void) { 36 | return (CPU_CycleMax-CPU_CycleLeft-CPU_Cycles)/(float)CPU_CycleMax; 37 | } 38 | 39 | static INLINE Bits PIC_TickIndexND(void) { 40 | return CPU_CycleMax-CPU_CycleLeft-CPU_Cycles; 41 | } 42 | 43 | static INLINE Bits PIC_MakeCycles(double amount) { 44 | return (Bits)(CPU_CycleMax*amount); 45 | } 46 | 47 | static INLINE double PIC_FullIndex(void) { 48 | return PIC_Ticks+(double)PIC_TickIndex(); 49 | } 50 | 51 | void PIC_ActivateIRQ(Bitu irq); 52 | void PIC_DeActivateIRQ(Bitu irq); 53 | 54 | void PIC_runIRQs(void); 55 | bool PIC_RunQueue(void); 56 | 57 | //Delay in milliseconds 58 | void PIC_AddEvent(PIC_EventHandler handler,float delay,Bitu val=0); 59 | void PIC_RemoveEvents(PIC_EventHandler handler); 60 | void PIC_RemoveSpecificEvents(PIC_EventHandler handler, Bitu val); 61 | 62 | void PIC_SetIRQMask(Bitu irq, bool masked); 63 | #endif 64 | -------------------------------------------------------------------------------- /include/programs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | 20 | #ifndef DOSBOX_PROGRAMS_H 21 | #define DOSBOX_PROGRAMS_H 22 | 23 | #ifndef DOSBOX_DOSBOX_H 24 | #include "dosbox.h" 25 | #endif 26 | #ifndef DOSBOX_DOS_INC_H 27 | #include "dos_inc.h" 28 | #endif 29 | 30 | #ifndef CH_LIST 31 | #define CH_LIST 32 | #include 33 | #endif 34 | 35 | #ifndef CH_STRING 36 | #define CH_STRING 37 | #include 38 | #endif 39 | 40 | class CommandLine { 41 | public: 42 | CommandLine(int argc,char const * const argv[]); 43 | CommandLine(char const * const name,char const * const cmdline); 44 | const char * GetFileName(){ return file_name.c_str();} 45 | 46 | bool FindExist(char const * const name,bool remove=false); 47 | bool FindHex(char const * const name,int & value,bool remove=false); 48 | bool FindInt(char const * const name,int & value,bool remove=false); 49 | bool FindString(char const * const name,std::string & value,bool remove=false); 50 | bool FindCommand(unsigned int which,std::string & value); 51 | bool FindStringBegin(char const * const begin,std::string & value, bool remove=false); 52 | bool FindStringRemain(char const * const name,std::string & value); 53 | bool FindStringRemainBegin(char const * const name,std::string & value); 54 | bool GetStringRemain(std::string & value); 55 | int GetParameterFromList(const char* const params[], std::vector & output); 56 | void FillVector(std::vector & vector); 57 | unsigned int GetCount(void); 58 | void Shift(unsigned int amount=1); 59 | Bit16u Get_arglength(); 60 | 61 | private: 62 | typedef std::list::iterator cmd_it; 63 | std::list cmds; 64 | std::string file_name; 65 | bool FindEntry(char const * const name,cmd_it & it,bool neednext=false); 66 | }; 67 | 68 | class Program { 69 | public: 70 | Program(); 71 | virtual ~Program(){ 72 | delete cmd; 73 | delete psp; 74 | } 75 | std::string temp_line; 76 | CommandLine * cmd; 77 | DOS_PSP * psp; 78 | virtual void Run(void)=0; 79 | bool GetEnvStr(const char * entry,std::string & result); 80 | bool GetEnvNum(Bitu num,std::string & result); 81 | Bitu GetEnvCount(void); 82 | bool SetEnv(const char * entry,const char * new_string); 83 | void WriteOut(const char * format,...); /* Write to standard output */ 84 | void WriteOut_NoParsing(const char * format); /* Write to standard output, no parsing */ 85 | void ChangeToLongCmd(); 86 | 87 | }; 88 | 89 | typedef void (PROGRAMS_Main)(Program * * make); 90 | void PROGRAMS_MakeFile(char const * const name,PROGRAMS_Main * main); 91 | 92 | #endif 93 | -------------------------------------------------------------------------------- /include/render.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | #ifndef DOSBOX_RENDER_H 20 | #define DOSBOX_RENDER_H 21 | 22 | // 0: complex scalers off, scaler cache off, some simple scalers off, memory requirements reduced 23 | // 1: complex scalers off, scaler cache off, all simple scalers on 24 | // 2: complex scalers off, scaler cache on 25 | // 3: complex scalers on 26 | #define RENDER_USE_ADVANCED_SCALERS 3 27 | 28 | #include "../src/gui/render_scalers.h" 29 | 30 | #define RENDER_SKIP_CACHE 16 31 | //Enable this for scalers to support 0 input for empty lines 32 | //#define RENDER_NULL_INPUT 33 | 34 | typedef struct { 35 | struct { 36 | Bit8u red; 37 | Bit8u green; 38 | Bit8u blue; 39 | Bit8u unused; 40 | } rgb[256]; 41 | union { 42 | Bit16u b16[256]; 43 | Bit32u b32[256]; 44 | } lut; 45 | bool changed; 46 | Bit8u modified[256]; 47 | Bitu first; 48 | Bitu last; 49 | } RenderPal_t; 50 | 51 | typedef struct { 52 | struct { 53 | Bitu width, start; 54 | Bitu height; 55 | Bitu bpp; 56 | bool dblw,dblh; 57 | double ratio; 58 | float fps; 59 | } src; 60 | struct { 61 | Bitu count; 62 | Bitu max; 63 | Bitu index; 64 | Bit8u hadSkip[RENDER_SKIP_CACHE]; 65 | } frameskip; 66 | struct { 67 | Bitu size; 68 | scalerMode_t inMode; 69 | scalerMode_t outMode; 70 | scalerOperation_t op; 71 | bool clearCache; 72 | bool forced; 73 | ScalerLineHandler_t lineHandler; 74 | ScalerLineHandler_t linePalHandler; 75 | ScalerComplexHandler_t complexHandler; 76 | Bitu blocks, lastBlock; 77 | Bitu outPitch; 78 | Bit8u *outWrite; 79 | Bitu cachePitch; 80 | Bit8u *cacheRead; 81 | Bitu inHeight, inLine, outLine; 82 | } scale; 83 | RenderPal_t pal; 84 | bool updating; 85 | bool active; 86 | bool aspect; 87 | bool fullFrame; 88 | } Render_t; 89 | 90 | extern Render_t render; 91 | extern ScalerLineHandler_t RENDER_DrawLine; 92 | void RENDER_SetSize(Bitu width,Bitu height,Bitu bpp,float fps,double ratio,bool dblw,bool dblh); 93 | bool RENDER_StartUpdate(void); 94 | void RENDER_EndUpdate(bool abort); 95 | void RENDER_SetPal(Bit8u entry,Bit8u red,Bit8u green,Bit8u blue); 96 | 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /include/shell.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | 20 | #ifndef DOSBOX_SHELL_H 21 | #define DOSBOX_SHELL_H 22 | 23 | #include 24 | #ifndef DOSBOX_DOSBOX_H 25 | #include "dosbox.h" 26 | #endif 27 | #ifndef DOSBOX_PROGRAMS_H 28 | #include "programs.h" 29 | #endif 30 | 31 | #include 32 | #include 33 | 34 | #define CMD_MAXLINE 4096 35 | #define CMD_MAXCMDS 20 36 | #define CMD_OLDSIZE 4096 37 | extern Bitu call_shellstop; 38 | /* first_shell is used to add and delete stuff from the shell env 39 | * by "external" programs. (config) */ 40 | extern Program * first_shell; 41 | 42 | class DOS_Shell; 43 | 44 | class BatchFile { 45 | public: 46 | BatchFile(DOS_Shell * host,char const* const resolved_name,char const* const entered_name, char const * const cmd_line); 47 | virtual ~BatchFile(); 48 | virtual bool ReadLine(char * line); 49 | bool Goto(char * where); 50 | void Shift(void); 51 | Bit16u file_handle; 52 | Bit32u location; 53 | bool echo; 54 | DOS_Shell * shell; 55 | BatchFile * prev; 56 | CommandLine * cmd; 57 | std::string filename; 58 | }; 59 | 60 | class AutoexecEditor; 61 | class DOS_Shell : public Program { 62 | private: 63 | friend class AutoexecEditor; 64 | std::list l_history, l_completion; 65 | 66 | char *completion_start; 67 | Bit16u completion_index; 68 | 69 | public: 70 | 71 | DOS_Shell(); 72 | 73 | void Run(void); 74 | void RunInternal(void); //for command /C 75 | /* A load of subfunctions */ 76 | void ParseLine(char * line); 77 | Bitu GetRedirection(char *s, char **ifn, char **ofn,bool * append); 78 | void InputCommand(char * line); 79 | void ShowPrompt(); 80 | void DoCommand(char * cmd); 81 | bool Execute(char * name,char * args); 82 | /* Checks if it matches a hardware-property */ 83 | bool CheckConfig(char* cmd_in,char*line); 84 | /* Some internal used functions */ 85 | char * Which(char * name); 86 | /* Some supported commands */ 87 | void CMD_HELP(char * args); 88 | void CMD_CLS(char * args); 89 | void CMD_COPY(char * args); 90 | void CMD_DATE(char * args); 91 | void CMD_TIME(char * args); 92 | void CMD_DIR(char * args); 93 | void CMD_DELETE(char * args); 94 | void CMD_ECHO(char * args); 95 | void CMD_EXIT(char * args); 96 | void CMD_MKDIR(char * args); 97 | void CMD_CHDIR(char * args); 98 | void CMD_RMDIR(char * args); 99 | void CMD_SET(char * args); 100 | void CMD_IF(char * args); 101 | void CMD_GOTO(char * args); 102 | void CMD_TYPE(char * args); 103 | void CMD_REM(char * args); 104 | void CMD_RENAME(char * args); 105 | void CMD_CALL(char * args); 106 | void SyntaxError(void); 107 | void CMD_PAUSE(char * args); 108 | void CMD_SUBST(char* args); 109 | void CMD_LOADHIGH(char* args); 110 | void CMD_CHOICE(char * args); 111 | void CMD_ATTRIB(char * args); 112 | void CMD_PATH(char * args); 113 | void CMD_SHIFT(char * args); 114 | void CMD_VER(char * args); 115 | /* The shell's variables */ 116 | Bit16u input_handle; 117 | BatchFile * bf; 118 | bool echo; 119 | bool exit; 120 | bool call; 121 | }; 122 | 123 | struct SHELL_Cmd { 124 | const char * name; /* Command name*/ 125 | Bit32u flags; /* Flags about the command */ 126 | void (DOS_Shell::*handler)(char * args); /* Handler for this command */ 127 | const char * help; /* String with command help */ 128 | }; 129 | 130 | /* Object to manage lines in the autoexec.bat The lines get removed from 131 | * the file if the object gets destroyed. The environment is updated 132 | * as well if the line set a a variable */ 133 | class AutoexecObject{ 134 | private: 135 | bool installed; 136 | std::string buf; 137 | public: 138 | AutoexecObject():installed(false){ }; 139 | void Install(std::string const &in); 140 | void InstallBefore(std::string const &in); 141 | ~AutoexecObject(); 142 | private: 143 | void CreateAutoexec(void); 144 | }; 145 | 146 | #endif 147 | -------------------------------------------------------------------------------- /include/support.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | 20 | #ifndef DOSBOX_SUPPORT_H 21 | #define DOSBOX_SUPPORT_H 22 | 23 | #include 24 | #include 25 | #include 26 | #ifndef DOSBOX_DOSBOX_H 27 | #include "dosbox.h" 28 | #endif 29 | 30 | #if defined (_MSC_VER) /* MS Visual C++ */ 31 | #define strcasecmp(a,b) stricmp(a,b) 32 | #define strncasecmp(a,b,n) _strnicmp(a,b,n) 33 | #endif 34 | 35 | #define safe_strncpy(a,b,n) do { strncpy((a),(b),(n)-1); (a)[(n)-1] = 0; } while (0) 36 | 37 | #ifdef HAVE_STRINGS_H 38 | #include 39 | #endif 40 | 41 | void strreplace(char * str,char o,char n); 42 | char *ltrim(char *str); 43 | char *rtrim(char *str); 44 | char *trim(char * str); 45 | char * upcase(char * str); 46 | char * lowcase(char * str); 47 | 48 | bool ScanCMDBool(char * cmd,char const * const check); 49 | char * ScanCMDRemain(char * cmd); 50 | char * StripWord(char *&cmd); 51 | bool IsDecWord(char * word); 52 | bool IsHexWord(char * word); 53 | Bits ConvDecWord(char * word); 54 | Bits ConvHexWord(char * word); 55 | 56 | void trim(std::string& str); 57 | void upcase(std::string &str); 58 | void lowcase(std::string &str); 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /include/timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | #ifndef DOSBOX_TIMER_H 20 | #define DOSBOX_TIMER_H 21 | 22 | /* underlying clock rate in HZ */ 23 | #include 24 | 25 | #define PIT_TICK_RATE 1193182 26 | 27 | #define GetTicks() SDL_GetTicks() 28 | 29 | typedef void (*TIMER_TickHandler)(void); 30 | 31 | /* Register a function that gets called everytime if 1 or more ticks pass */ 32 | void TIMER_AddTickHandler(TIMER_TickHandler handler); 33 | void TIMER_DelTickHandler(TIMER_TickHandler handler); 34 | 35 | /* This will add 1 milliscond to all timers */ 36 | void TIMER_AddTick(void); 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /include/video.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | 20 | #ifndef DOSBOX_VIDEO_H 21 | #define DOSBOX_VIDEO_H 22 | 23 | #define REDUCE_JOYSTICK_POLLING 24 | 25 | typedef enum { 26 | GFX_CallBackReset, 27 | GFX_CallBackStop, 28 | GFX_CallBackRedraw 29 | } GFX_CallBackFunctions_t; 30 | 31 | typedef void (*GFX_CallBack_t)( GFX_CallBackFunctions_t function ); 32 | 33 | struct GFX_PalEntry { 34 | Bit8u r; 35 | Bit8u g; 36 | Bit8u b; 37 | Bit8u unused; 38 | }; 39 | 40 | #define GFX_CAN_8 0x0001 41 | #define GFX_CAN_15 0x0002 42 | #define GFX_CAN_16 0x0004 43 | #define GFX_CAN_32 0x0008 44 | 45 | #define GFX_LOVE_8 0x0010 46 | #define GFX_LOVE_15 0x0020 47 | #define GFX_LOVE_16 0x0040 48 | #define GFX_LOVE_32 0x0080 49 | 50 | #define GFX_RGBONLY 0x0100 51 | 52 | #define GFX_SCALING 0x1000 53 | #define GFX_HARDWARE 0x2000 54 | 55 | #define GFX_CAN_RANDOM 0x4000 //If the interface can also do random access surface 56 | 57 | void GFX_Events(void); 58 | void GFX_SetPalette(Bitu start,Bitu count,GFX_PalEntry * entries); 59 | Bitu GFX_GetBestMode(Bitu flags); 60 | Bitu GFX_GetRGB(Bit8u red,Bit8u green,Bit8u blue); 61 | Bitu GFX_SetSize(Bitu width,Bitu height,Bitu flags,double scalex,double scaley,GFX_CallBack_t cb); 62 | 63 | void GFX_ResetScreen(void); 64 | void GFX_Start(void); 65 | void GFX_Stop(void); 66 | void GFX_SwitchFullScreen(void); 67 | bool GFX_StartUpdate(Bit8u * & pixels,Bitu & pitch); 68 | void GFX_EndUpdate( const Bit16u *changedLines ); 69 | void GFX_GetSize(int &width, int &height, bool &fullscreen); 70 | void GFX_LosingFocus(void); 71 | 72 | #if defined (WIN32) 73 | bool GFX_SDLUsingWinDIB(void); 74 | #endif 75 | 76 | #if defined (REDUCE_JOYSTICK_POLLING) 77 | void MAPPER_UpdateJoysticks(void); 78 | #endif 79 | 80 | /* Mouse related */ 81 | void GFX_CaptureMouse(void); 82 | extern bool mouselocked; //true if mouse is confined to window 83 | 84 | #endif 85 | -------------------------------------------------------------------------------- /scripts/captures.bat: -------------------------------------------------------------------------------- 1 | DOSBox.exe -opencaptures explorer.exe -------------------------------------------------------------------------------- /scripts/dosbox-installer.nsi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/svn2github/dosbox/acd380bcde72db74f3b476253899016f686bc0ef/scripts/dosbox-installer.nsi -------------------------------------------------------------------------------- /scripts/editconf.bat: -------------------------------------------------------------------------------- 1 | DOSBox.exe -editconf notepad.exe -editconf %SystemRoot%\system32\notepad.exe -editconf %WINDIR%\notepad.exe -------------------------------------------------------------------------------- /scripts/ega-switch.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | use integer; 3 | open (THEFILE,'>','../src/hardware/ega-switch.h') 4 | or die "Can't open my file $!"; 5 | 6 | print THEFILE "switch (bit_mask) {\n"; 7 | for ($i = 0; $i < 256; $i++) { 8 | print THEFILE "\tcase $i:\n"; 9 | $b=128; 10 | $add=0; 11 | do { 12 | if ($i & $b) { 13 | print THEFILE "\t{\n"; 14 | print THEFILE "\t\tBit8u color=0;\n"; 15 | print THEFILE "\t\tif (pixels.b[0] & $b) color|=1;\n"; 16 | print THEFILE "\t\tif (pixels.b[1] & $b) color|=2;\n"; 17 | print THEFILE "\t\tif (pixels.b[2] & $b) color|=4;\n"; 18 | print THEFILE "\t\tif (pixels.b[3] & $b) color|=8;\n"; 19 | print THEFILE "\t\t*(write_pixels+$add)=color;\n"; 20 | print THEFILE "\t\t*(write_pixels+$add+512*1024)=color;\n"; 21 | print THEFILE "\t}\n"; 22 | } 23 | 24 | $b=$b >> 1; 25 | $add=$add+1; 26 | } until ($b == 0); 27 | print THEFILE "\tbreak;\n"; 28 | } 29 | print THEFILE "}\n"; 30 | 31 | 32 | close (THEFILE); 33 | -------------------------------------------------------------------------------- /scripts/font-switch.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | use integer; 3 | open (THEFILE,'>','../src/hardware/font-switch.h') 4 | or die "Can't open my file $!"; 5 | 6 | print THEFILE "switch (bit_mask) {\n"; 7 | for ($i = 0; $i < 256; $i++) { 8 | print THEFILE "\tcase $i:\n"; 9 | $b=128; 10 | $add=0; 11 | do { 12 | if ($i & $b) { 13 | print THEFILE "\t\t*(draw+$add)=fg;\n"; 14 | } else { 15 | print THEFILE "\t\t*(draw+$add)=bg;\n"; 16 | } 17 | $b=$b >> 1; 18 | $add=$add+1; 19 | } until ($b == 0); 20 | print THEFILE "\tbreak;\n"; 21 | } 22 | print THEFILE "}\n"; 23 | 24 | 25 | close (THEFILE); 26 | -------------------------------------------------------------------------------- /scripts/resetconf.bat: -------------------------------------------------------------------------------- 1 | DOSBox.exe -resetconf -------------------------------------------------------------------------------- /scripts/resetmapper.bat: -------------------------------------------------------------------------------- 1 | DOSBox.exe -resetmapper -------------------------------------------------------------------------------- /src/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = -I$(top_srcdir)/include 2 | 3 | SUBDIRS = cpu debug dos fpu gui hardware libs ints misc shell platform 4 | 5 | bin_PROGRAMS = dosbox 6 | 7 | if HAVE_WINDRES 8 | ico_stuff = winres.rc 9 | endif 10 | 11 | .rc.o: 12 | $(WINDRES) -o $@ $< 13 | 14 | dosbox_SOURCES = dosbox.cpp $(ico_stuff) 15 | dosbox_LDADD = cpu/libcpu.a debug/libdebug.a dos/libdos.a fpu/libfpu.a hardware/libhardware.a gui/libgui.a \ 16 | ints/libints.a misc/libmisc.a shell/libshell.a hardware/mame/libmame.a \ 17 | hardware/serialport/libserial.a libs/gui_tk/libgui_tk.a 18 | 19 | EXTRA_DIST = winres.rc dosbox.ico 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/cpu/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = core_full core_normal core_dyn_x86 core_dynrec 2 | AM_CPPFLAGS = -I$(top_srcdir)/include 3 | 4 | noinst_LIBRARIES = libcpu.a 5 | libcpu_a_SOURCES = callback.cpp cpu.cpp flags.cpp modrm.cpp modrm.h core_full.cpp instructions.h \ 6 | paging.cpp lazyflags.h core_normal.cpp core_simple.cpp core_prefetch.cpp \ 7 | core_dyn_x86.cpp core_dynrec.cpp 8 | -------------------------------------------------------------------------------- /src/cpu/core_dyn_x86/Makefile.am: -------------------------------------------------------------------------------- 1 | noinst_HEADERS = cache.h helpers.h decoder.h risc_x86.h string.h \ 2 | dyn_fpu.h dyn_fpu_dh.h -------------------------------------------------------------------------------- /src/cpu/core_dyn_x86/helpers.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | static bool dyn_helper_divb(Bit8u val) { 20 | if (!val) return CPU_PrepareException(0,0); 21 | Bitu quo=reg_ax / val; 22 | Bit8u rem=(Bit8u)(reg_ax % val); 23 | Bit8u quo8=(Bit8u)(quo&0xff); 24 | if (quo>0xff) return CPU_PrepareException(0,0); 25 | reg_ah=rem; 26 | reg_al=quo8; 27 | return false; 28 | } 29 | 30 | static bool dyn_helper_idivb(Bit8s val) { 31 | if (!val) return CPU_PrepareException(0,0); 32 | Bits quo=(Bit16s)reg_ax / val; 33 | Bit8s rem=(Bit8s)((Bit16s)reg_ax % val); 34 | Bit8s quo8s=(Bit8s)(quo&0xff); 35 | if (quo!=(Bit16s)quo8s) return CPU_PrepareException(0,0); 36 | reg_ah=rem; 37 | reg_al=quo8s; 38 | return false; 39 | } 40 | 41 | static bool dyn_helper_divw(Bit16u val) { 42 | if (!val) return CPU_PrepareException(0,0); 43 | Bitu num=(reg_dx<<16)|reg_ax; 44 | Bitu quo=num/val; 45 | Bit16u rem=(Bit16u)(num % val); 46 | Bit16u quo16=(Bit16u)(quo&0xffff); 47 | if (quo!=(Bit32u)quo16) return CPU_PrepareException(0,0); 48 | reg_dx=rem; 49 | reg_ax=quo16; 50 | return false; 51 | } 52 | 53 | static bool dyn_helper_idivw(Bit16s val) { 54 | if (!val) return CPU_PrepareException(0,0); 55 | Bits num=(reg_dx<<16)|reg_ax; 56 | Bits quo=num/val; 57 | Bit16s rem=(Bit16s)(num % val); 58 | Bit16s quo16s=(Bit16s)quo; 59 | if (quo!=(Bit32s)quo16s) return CPU_PrepareException(0,0); 60 | reg_dx=rem; 61 | reg_ax=quo16s; 62 | return false; 63 | } 64 | 65 | static bool dyn_helper_divd(Bit32u val) { 66 | if (!val) return CPU_PrepareException(0,0); 67 | Bit64u num=(((Bit64u)reg_edx)<<32)|reg_eax; 68 | Bit64u quo=num/val; 69 | Bit32u rem=(Bit32u)(num % val); 70 | Bit32u quo32=(Bit32u)(quo&0xffffffff); 71 | if (quo!=(Bit64u)quo32) return CPU_PrepareException(0,0); 72 | reg_edx=rem; 73 | reg_eax=quo32; 74 | return false; 75 | } 76 | 77 | static bool dyn_helper_idivd(Bit32s val) { 78 | if (!val) return CPU_PrepareException(0,0); 79 | Bit64s num=(((Bit64u)reg_edx)<<32)|reg_eax; 80 | Bit64s quo=num/val; 81 | Bit32s rem=(Bit32s)(num % val); 82 | Bit32s quo32s=(Bit32s)(quo&0xffffffff); 83 | if (quo!=(Bit64s)quo32s) return CPU_PrepareException(0,0); 84 | reg_edx=rem; 85 | reg_eax=quo32s; 86 | return false; 87 | } 88 | -------------------------------------------------------------------------------- /src/cpu/core_dynrec/Makefile.am: -------------------------------------------------------------------------------- 1 | noinst_HEADERS = cache.h decoder.h decoder_basic.h decoder_opcodes.h \ 2 | dyn_fpu.h operators.h risc_x64.h risc_x86.h risc_mipsel32.h \ 3 | risc_armv4le.h risc_armv4le-common.h \ 4 | risc_armv4le-o3.h risc_armv4le-thumb.h \ 5 | risc_armv4le-thumb-iw.h risc_armv4le-thumb-niw.h risc_armv8le.h 6 | -------------------------------------------------------------------------------- /src/cpu/core_dynrec/risc_armv4le-common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | 20 | 21 | /* ARMv4 (little endian) backend by M-HT (common data/functions) */ 22 | 23 | 24 | // some configuring defines that specify the capabilities of this architecture 25 | // or aspects of the recompiling 26 | 27 | // protect FC_ADDR over function calls if necessaray 28 | // #define DRC_PROTECT_ADDR_REG 29 | 30 | // try to use non-flags generating functions if possible 31 | #define DRC_FLAGS_INVALIDATION 32 | // try to replace _simple functions by code 33 | #define DRC_FLAGS_INVALIDATION_DCODE 34 | 35 | // type with the same size as a pointer 36 | #define DRC_PTR_SIZE_IM Bit32u 37 | 38 | // calling convention modifier 39 | #define DRC_CALL_CONV /* nothing */ 40 | #define DRC_FC /* nothing */ 41 | 42 | // use FC_REGS_ADDR to hold the address of "cpu_regs" and to access it using FC_REGS_ADDR 43 | #define DRC_USE_REGS_ADDR 44 | // use FC_SEGS_ADDR to hold the address of "Segs" and to access it using FC_SEGS_ADDR 45 | #define DRC_USE_SEGS_ADDR 46 | 47 | // register mapping 48 | typedef Bit8u HostReg; 49 | 50 | // "lo" registers 51 | #define HOST_r0 0 52 | #define HOST_r1 1 53 | #define HOST_r2 2 54 | #define HOST_r3 3 55 | #define HOST_r4 4 56 | #define HOST_r5 5 57 | #define HOST_r6 6 58 | #define HOST_r7 7 59 | // "hi" registers 60 | #define HOST_r8 8 61 | #define HOST_r9 9 62 | #define HOST_r10 10 63 | #define HOST_r11 11 64 | #define HOST_r12 12 65 | #define HOST_r13 13 66 | #define HOST_r14 14 67 | #define HOST_r15 15 68 | 69 | // register aliases 70 | // "lo" registers 71 | #define HOST_a1 HOST_r0 72 | #define HOST_a2 HOST_r1 73 | #define HOST_a3 HOST_r2 74 | #define HOST_a4 HOST_r3 75 | #define HOST_v1 HOST_r4 76 | #define HOST_v2 HOST_r5 77 | #define HOST_v3 HOST_r6 78 | #define HOST_v4 HOST_r7 79 | // "hi" registers 80 | #define HOST_v5 HOST_r8 81 | #define HOST_v6 HOST_r9 82 | #define HOST_v7 HOST_r10 83 | #define HOST_v8 HOST_r11 84 | #define HOST_ip HOST_r12 85 | #define HOST_sp HOST_r13 86 | #define HOST_lr HOST_r14 87 | #define HOST_pc HOST_r15 88 | 89 | 90 | static void cache_block_closing(Bit8u* block_start,Bitu block_size) { 91 | #if (__ARM_EABI__) 92 | //flush cache - eabi 93 | register unsigned long _beg __asm ("a1") = (unsigned long)(block_start); // block start 94 | register unsigned long _end __asm ("a2") = (unsigned long)(block_start+block_size); // block end 95 | register unsigned long _flg __asm ("a3") = 0; 96 | register unsigned long _par __asm ("r7") = 0xf0002; // sys_cacheflush 97 | __asm __volatile ("swi 0x0" 98 | : // no outputs 99 | : "r" (_beg), "r" (_end), "r" (_flg), "r" (_par) 100 | ); 101 | #else 102 | // GP2X BEGIN 103 | //flush cache - old abi 104 | register unsigned long _beg __asm ("a1") = (unsigned long)(block_start); // block start 105 | register unsigned long _end __asm ("a2") = (unsigned long)(block_start+block_size); // block end 106 | register unsigned long _flg __asm ("a3") = 0; 107 | __asm __volatile ("swi 0x9f0002 @ sys_cacheflush" 108 | : // no outputs 109 | : "r" (_beg), "r" (_end), "r" (_flg) 110 | ); 111 | // GP2X END 112 | #endif 113 | } 114 | -------------------------------------------------------------------------------- /src/cpu/core_dynrec/risc_armv4le.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | 20 | 21 | /* ARMv4/ARMv7 (little endian) backend (switcher) by M-HT */ 22 | 23 | #include "risc_armv4le-common.h" 24 | 25 | // choose your destiny: 26 | #if C_TARGETCPU == ARMV7LE 27 | #include "risc_armv4le-o3.h" 28 | #else 29 | #if defined(__THUMB_INTERWORK__) 30 | #include "risc_armv4le-thumb-iw.h" 31 | #else 32 | #include "risc_armv4le-o3.h" 33 | // #include "risc_armv4le-thumb-niw.h" 34 | // #include "risc_armv4le-thumb.h" 35 | #endif 36 | #endif 37 | -------------------------------------------------------------------------------- /src/cpu/core_full.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | #include "dosbox.h" 20 | 21 | #include "pic.h" 22 | #include "regs.h" 23 | #include "cpu.h" 24 | #include "lazyflags.h" 25 | #include "paging.h" 26 | #include "fpu.h" 27 | #include "debug.h" 28 | #include "inout.h" 29 | #include "callback.h" 30 | 31 | 32 | typedef PhysPt EAPoint; 33 | #define SegBase(c) SegPhys(c) 34 | 35 | #define LoadMb(off) mem_readb_inline(off) 36 | #define LoadMw(off) mem_readw_inline(off) 37 | #define LoadMd(off) mem_readd_inline(off) 38 | 39 | #define LoadMbs(off) (Bit8s)(LoadMb(off)) 40 | #define LoadMws(off) (Bit16s)(LoadMw(off)) 41 | #define LoadMds(off) (Bit32s)(LoadMd(off)) 42 | 43 | #define SaveMb(off,val) mem_writeb_inline(off,val) 44 | #define SaveMw(off,val) mem_writew_inline(off,val) 45 | #define SaveMd(off,val) mem_writed_inline(off,val) 46 | 47 | #define LoadD(reg) reg 48 | #define SaveD(reg,val) reg=val 49 | 50 | 51 | 52 | #include "core_full/loadwrite.h" 53 | #include "core_full/support.h" 54 | #include "core_full/optable.h" 55 | #include "instructions.h" 56 | 57 | #define EXCEPTION(blah) \ 58 | { \ 59 | Bit8u new_num=blah; \ 60 | CPU_Exception(new_num,0); \ 61 | continue; \ 62 | } 63 | 64 | Bits CPU_Core_Full_Run(void) { 65 | FullData inst; 66 | while (CPU_Cycles-->0) { 67 | #if C_DEBUG 68 | cycle_count++; 69 | #if C_HEAVY_DEBUG 70 | if (DEBUG_HeavyIsBreakpoint()) { 71 | FillFlags(); 72 | return debugCallback; 73 | }; 74 | #endif 75 | #endif 76 | LoadIP(); 77 | inst.entry=cpu.code.big*0x200; 78 | inst.prefix=cpu.code.big; 79 | restartopcode: 80 | inst.entry=(inst.entry & 0xffffff00) | Fetchb(); 81 | inst.code=OpCodeTable[inst.entry]; 82 | #include "core_full/load.h" 83 | #include "core_full/op.h" 84 | #include "core_full/save.h" 85 | nextopcode:; 86 | SaveIP(); 87 | continue; 88 | illegalopcode: 89 | LOG(LOG_CPU,LOG_NORMAL)("Illegal opcode"); 90 | CPU_Exception(0x6,0); 91 | } 92 | FillFlags(); 93 | return CBRET_NONE; 94 | } 95 | 96 | 97 | void CPU_Core_Full_Init(void) { 98 | 99 | } 100 | -------------------------------------------------------------------------------- /src/cpu/core_full/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | noinst_HEADERS = ea_lookup.h load.h loadwrite.h op.h optable.h save.h \ 3 | string.h support.h 4 | -------------------------------------------------------------------------------- /src/cpu/core_full/loadwrite.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | #define SaveIP() reg_eip=(Bit32u)(inst.cseip-SegBase(cs)); 20 | #define LoadIP() inst.cseip=SegBase(cs)+reg_eip; 21 | #define GetIP() (inst.cseip-SegBase(cs)) 22 | 23 | #define RunException() { \ 24 | CPU_Exception(cpu.exception.which,cpu.exception.error); \ 25 | continue; \ 26 | } 27 | 28 | static INLINE Bit8u the_Fetchb(EAPoint & loc) { 29 | Bit8u temp=LoadMb(loc); 30 | loc+=1; 31 | return temp; 32 | } 33 | 34 | static INLINE Bit16u the_Fetchw(EAPoint & loc) { 35 | Bit16u temp=LoadMw(loc); 36 | loc+=2; 37 | return temp; 38 | } 39 | static INLINE Bit32u the_Fetchd(EAPoint & loc) { 40 | Bit32u temp=LoadMd(loc); 41 | loc+=4; 42 | return temp; 43 | } 44 | 45 | #define Fetchb() the_Fetchb(inst.cseip) 46 | #define Fetchw() the_Fetchw(inst.cseip) 47 | #define Fetchd() the_Fetchd(inst.cseip) 48 | 49 | #define Fetchbs() (Bit8s)the_Fetchb(inst.cseip) 50 | #define Fetchws() (Bit16s)the_Fetchw(inst.cseip) 51 | #define Fetchds() (Bit32s)the_Fetchd(inst.cseip) 52 | 53 | #define Push_16 CPU_Push16 54 | #define Push_32 CPU_Push32 55 | #define Pop_16 CPU_Pop16 56 | #define Pop_32 CPU_Pop32 57 | 58 | -------------------------------------------------------------------------------- /src/cpu/core_full/save.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | /* Write the data from the opcode */ 20 | switch (inst.code.save) { 21 | /* Byte */ 22 | case S_C_Eb: 23 | inst_op1_b=inst.cond ? 1 : 0; 24 | case S_Eb: 25 | if (inst.rm<0xc0) SaveMb(inst.rm_eaa,inst_op1_b); 26 | else reg_8(inst.rm_eai)=inst_op1_b; 27 | break; 28 | case S_Gb: 29 | reg_8(inst.rm_index)=inst_op1_b; 30 | break; 31 | case S_EbGb: 32 | if (inst.rm<0xc0) SaveMb(inst.rm_eaa,inst_op1_b); 33 | else reg_8(inst.rm_eai)=inst_op1_b; 34 | reg_8(inst.rm_index)=inst_op2_b; 35 | break; 36 | /* Word */ 37 | case S_Ew: 38 | if (inst.rm<0xc0) SaveMw(inst.rm_eaa,inst_op1_w); 39 | else reg_16(inst.rm_eai)=inst_op1_w; 40 | break; 41 | case S_Gw: 42 | reg_16(inst.rm_index)=inst_op1_w; 43 | break; 44 | case S_EwGw: 45 | if (inst.rm<0xc0) SaveMw(inst.rm_eaa,inst_op1_w); 46 | else reg_16(inst.rm_eai)=inst_op1_w; 47 | reg_16(inst.rm_index)=inst_op2_w; 48 | break; 49 | /* Dword */ 50 | case S_Ed: 51 | if (inst.rm<0xc0) SaveMd(inst.rm_eaa,inst_op1_d); 52 | else reg_32(inst.rm_eai)=inst_op1_d; 53 | break; 54 | case S_EdMw: /* Special one 16 to memory, 32 zero extend to reg */ 55 | if (inst.rm<0xc0) SaveMw(inst.rm_eaa,inst_op1_w); 56 | else reg_32(inst.rm_eai)=inst_op1_d; 57 | break; 58 | case S_Gd: 59 | reg_32(inst.rm_index)=inst_op1_d; 60 | break; 61 | case S_EdGd: 62 | if (inst.rm<0xc0) SaveMd(inst.rm_eaa,inst_op1_d); 63 | else reg_32(inst.rm_eai)=inst_op1_d; 64 | reg_32(inst.rm_index)=inst_op2_d; 65 | break; 66 | 67 | case S_REGb: 68 | reg_8(inst.code.extra)=inst_op1_b; 69 | break; 70 | case S_REGw: 71 | reg_16(inst.code.extra)=inst_op1_w; 72 | break; 73 | case S_REGd: 74 | reg_32(inst.code.extra)=inst_op1_d; 75 | break; 76 | case S_SEGm: 77 | if (CPU_SetSegGeneral((SegNames)inst.rm_index,inst_op1_w)) RunException(); 78 | break; 79 | case S_SEGGw: 80 | if (CPU_SetSegGeneral((SegNames)inst.code.extra,inst_op2_w)) RunException(); 81 | reg_16(inst.rm_index)=inst_op1_w; 82 | break; 83 | case S_SEGGd: 84 | if (CPU_SetSegGeneral((SegNames)inst.code.extra,inst_op2_w)) RunException(); 85 | reg_32(inst.rm_index)=inst_op1_d; 86 | break; 87 | case S_PUSHw: 88 | Push_16(inst_op1_w); 89 | break; 90 | case S_PUSHd: 91 | Push_32(inst_op1_d); 92 | break; 93 | 94 | case S_C_AIPw: 95 | if (!inst.cond) goto nextopcode; 96 | case S_AIPw: 97 | SaveIP(); 98 | reg_eip+=inst_op1_d; 99 | reg_eip&=0xffff; 100 | continue; 101 | case S_C_AIPd: 102 | if (!inst.cond) goto nextopcode; 103 | case S_AIPd: 104 | SaveIP(); 105 | reg_eip+=inst_op1_d; 106 | continue; 107 | case S_IPIw: 108 | reg_esp+=Fetchw(); 109 | case S_IP: 110 | SaveIP(); 111 | reg_eip=inst_op1_d; 112 | continue; 113 | case 0: 114 | break; 115 | default: 116 | LOG(LOG_CPU,LOG_ERROR)("SAVE:Unhandled code %d entry %X",inst.code.save,inst.entry); 117 | } 118 | -------------------------------------------------------------------------------- /src/cpu/core_normal/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | noinst_HEADERS = helpers.h prefix_none.h prefix_66.h prefix_0f.h support.h table_ea.h \ 3 | prefix_66_0f.h string.h 4 | -------------------------------------------------------------------------------- /src/cpu/core_normal/support.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | 20 | #define LoadMbs(off) (Bit8s)(LoadMb(off)) 21 | #define LoadMws(off) (Bit16s)(LoadMw(off)) 22 | #define LoadMds(off) (Bit32s)(LoadMd(off)) 23 | 24 | #define LoadRb(reg) reg 25 | #define LoadRw(reg) reg 26 | #define LoadRd(reg) reg 27 | 28 | #define SaveRb(reg,val) reg=val 29 | #define SaveRw(reg,val) reg=val 30 | #define SaveRd(reg,val) reg=val 31 | 32 | static INLINE Bit8s Fetchbs() { 33 | return Fetchb(); 34 | } 35 | static INLINE Bit16s Fetchws() { 36 | return Fetchw(); 37 | } 38 | 39 | static INLINE Bit32s Fetchds() { 40 | return Fetchd(); 41 | } 42 | 43 | 44 | #define RUNEXCEPTION() { \ 45 | CPU_Exception(cpu.exception.which,cpu.exception.error); \ 46 | continue; \ 47 | } 48 | 49 | #define EXCEPTION(blah) \ 50 | { \ 51 | CPU_Exception(blah); \ 52 | continue; \ 53 | } 54 | 55 | //TODO Could probably make all byte operands fast? 56 | #define JumpCond16_b(COND) { \ 57 | SAVEIP; \ 58 | if (COND) reg_ip+=Fetchbs(); \ 59 | reg_ip+=1; \ 60 | continue; \ 61 | } 62 | 63 | #define JumpCond16_w(COND) { \ 64 | SAVEIP; \ 65 | if (COND) reg_ip+=Fetchws(); \ 66 | reg_ip+=2; \ 67 | continue; \ 68 | } 69 | 70 | #define JumpCond32_b(COND) { \ 71 | SAVEIP; \ 72 | if (COND) reg_eip+=Fetchbs(); \ 73 | reg_eip+=1; \ 74 | continue; \ 75 | } 76 | 77 | #define JumpCond32_d(COND) { \ 78 | SAVEIP; \ 79 | if (COND) reg_eip+=Fetchds(); \ 80 | reg_eip+=4; \ 81 | continue; \ 82 | } 83 | 84 | 85 | #define SETcc(cc) \ 86 | { \ 87 | GetRM; \ 88 | if (rm >= 0xc0 ) {GetEArb;*earb=(cc) ? 1 : 0;} \ 89 | else {GetEAa;SaveMb(eaa,(cc) ? 1 : 0);} \ 90 | } 91 | 92 | #include "helpers.h" 93 | #include "table_ea.h" 94 | #include "../modrm.h" 95 | 96 | 97 | -------------------------------------------------------------------------------- /src/cpu/lazyflags.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | #ifndef DOSBOX_LAZYFLAGS_H 20 | #define DOSBOX_LAZYFLAGS_H 21 | 22 | //Flag Handling 23 | Bit32u get_CF(void); 24 | Bit32u get_AF(void); 25 | Bit32u get_ZF(void); 26 | Bit32u get_SF(void); 27 | Bit32u get_OF(void); 28 | Bit32u get_PF(void); 29 | 30 | Bitu FillFlags(void); 31 | void FillFlagsNoCFOF(void); 32 | void DestroyConditionFlags(void); 33 | 34 | #ifndef DOSBOX_REGS_H 35 | #include "regs.h" 36 | #endif 37 | 38 | struct LazyFlags { 39 | GenReg32 var1,var2,res; 40 | Bitu type; 41 | Bitu prev_type; 42 | Bitu oldcf; 43 | }; 44 | 45 | extern LazyFlags lfags; 46 | 47 | #define lf_var1b lflags.var1.byte[BL_INDEX] 48 | #define lf_var2b lflags.var2.byte[BL_INDEX] 49 | #define lf_resb lflags.res.byte[BL_INDEX] 50 | 51 | #define lf_var1w lflags.var1.word[W_INDEX] 52 | #define lf_var2w lflags.var2.word[W_INDEX] 53 | #define lf_resw lflags.res.word[W_INDEX] 54 | 55 | #define lf_var1d lflags.var1.dword[DW_INDEX] 56 | #define lf_var2d lflags.var2.dword[DW_INDEX] 57 | #define lf_resd lflags.res.dword[DW_INDEX] 58 | 59 | 60 | extern LazyFlags lflags; 61 | 62 | #define SETFLAGSb(FLAGB) \ 63 | { \ 64 | SETFLAGBIT(OF,get_OF()); \ 65 | lflags.type=t_UNKNOWN; \ 66 | CPU_SetFlags(FLAGB,FMASK_NORMAL & 0xff); \ 67 | } 68 | 69 | #define SETFLAGSw(FLAGW) \ 70 | { \ 71 | lflags.type=t_UNKNOWN; \ 72 | CPU_SetFlagsw(FLAGW); \ 73 | } 74 | 75 | #define SETFLAGSd(FLAGD) \ 76 | { \ 77 | lflags.type=t_UNKNOWN; \ 78 | CPU_SetFlagsd(FLAGD); \ 79 | } 80 | 81 | #define LoadCF SETFLAGBIT(CF,get_CF()); 82 | #define LoadZF SETFLAGBIT(ZF,get_ZF()); 83 | #define LoadSF SETFLAGBIT(SF,get_SF()); 84 | #define LoadOF SETFLAGBIT(OF,get_OF()); 85 | #define LoadAF SETFLAGBIT(AF,get_AF()); 86 | 87 | #define TFLG_O (get_OF()) 88 | #define TFLG_NO (!get_OF()) 89 | #define TFLG_B (get_CF()) 90 | #define TFLG_NB (!get_CF()) 91 | #define TFLG_Z (get_ZF()) 92 | #define TFLG_NZ (!get_ZF()) 93 | #define TFLG_BE (get_CF() || get_ZF()) 94 | #define TFLG_NBE (!get_CF() && !get_ZF()) 95 | #define TFLG_S (get_SF()) 96 | #define TFLG_NS (!get_SF()) 97 | #define TFLG_P (get_PF()) 98 | #define TFLG_NP (!get_PF()) 99 | #define TFLG_L ((get_SF()!=0) != (get_OF()!=0)) 100 | #define TFLG_NL ((get_SF()!=0) == (get_OF()!=0)) 101 | #define TFLG_LE (get_ZF() || ((get_SF()!=0) != (get_OF()!=0))) 102 | #define TFLG_NLE (!get_ZF() && ((get_SF()!=0) == (get_OF()!=0))) 103 | 104 | //Types of Flag changing instructions 105 | enum { 106 | t_UNKNOWN=0, 107 | t_ADDb,t_ADDw,t_ADDd, 108 | t_ORb,t_ORw,t_ORd, 109 | t_ADCb,t_ADCw,t_ADCd, 110 | t_SBBb,t_SBBw,t_SBBd, 111 | t_ANDb,t_ANDw,t_ANDd, 112 | t_SUBb,t_SUBw,t_SUBd, 113 | t_XORb,t_XORw,t_XORd, 114 | t_CMPb,t_CMPw,t_CMPd, 115 | t_INCb,t_INCw,t_INCd, 116 | t_DECb,t_DECw,t_DECd, 117 | t_TESTb,t_TESTw,t_TESTd, 118 | t_SHLb,t_SHLw,t_SHLd, 119 | t_SHRb,t_SHRw,t_SHRd, 120 | t_SARb,t_SARw,t_SARd, 121 | t_ROLb,t_ROLw,t_ROLd, 122 | t_RORb,t_RORw,t_RORd, 123 | t_RCLb,t_RCLw,t_RCLd, 124 | t_RCRb,t_RCRw,t_RCRd, 125 | t_NEGb,t_NEGw,t_NEGd, 126 | 127 | t_DSHLw,t_DSHLd, 128 | t_DSHRw,t_DSHRd, 129 | t_MUL,t_DIV, 130 | t_NOTDONE, 131 | t_LASTFLAG 132 | }; 133 | 134 | #endif 135 | -------------------------------------------------------------------------------- /src/cpu/modrm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | extern Bit8u * lookupRMregb[]; 20 | extern Bit16u * lookupRMregw[]; 21 | extern Bit32u * lookupRMregd[]; 22 | extern Bit8u * lookupRMEAregb[256]; 23 | extern Bit16u * lookupRMEAregw[256]; 24 | extern Bit32u * lookupRMEAregd[256]; 25 | 26 | #define GetRM \ 27 | Bit8u rm=Fetchb(); 28 | 29 | #define Getrb \ 30 | Bit8u * rmrb; \ 31 | rmrb=lookupRMregb[rm]; 32 | 33 | #define Getrw \ 34 | Bit16u * rmrw; \ 35 | rmrw=lookupRMregw[rm]; 36 | 37 | #define Getrd \ 38 | Bit32u * rmrd; \ 39 | rmrd=lookupRMregd[rm]; 40 | 41 | 42 | #define GetRMrb \ 43 | GetRM; \ 44 | Getrb; 45 | 46 | #define GetRMrw \ 47 | GetRM; \ 48 | Getrw; 49 | 50 | #define GetRMrd \ 51 | GetRM; \ 52 | Getrd; 53 | 54 | 55 | #define GetEArb \ 56 | Bit8u * earb=lookupRMEAregb[rm]; 57 | 58 | #define GetEArw \ 59 | Bit16u * earw=lookupRMEAregw[rm]; 60 | 61 | #define GetEArd \ 62 | Bit32u * eard=lookupRMEAregd[rm]; 63 | 64 | 65 | -------------------------------------------------------------------------------- /src/debug/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = -I$(top_srcdir)/include 2 | 3 | noinst_LIBRARIES = libdebug.a 4 | libdebug_a_SOURCES = debug.cpp debug_gui.cpp debug_disasm.cpp debug_inc.h disasm_tables.h debug_win32.cpp -------------------------------------------------------------------------------- /src/debug/debug_inc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | /* Local Debug Function */ 20 | 21 | 22 | #include 23 | #include "mem.h" 24 | 25 | #define PAIR_BLACK_BLUE 1 26 | #define PAIR_BYELLOW_BLACK 2 27 | #define PAIR_GREEN_BLACK 3 28 | #define PAIR_BLACK_GREY 4 29 | #define PAIR_GREY_RED 5 30 | 31 | 32 | void DBGUI_StartUp(void); 33 | 34 | struct DBGBlock { 35 | WINDOW * win_main; /* The Main Window */ 36 | WINDOW * win_reg; /* Register Window */ 37 | WINDOW * win_data; /* Data Output window */ 38 | WINDOW * win_code; /* Disassembly/Debug point Window */ 39 | WINDOW * win_var; /* Variable Window */ 40 | WINDOW * win_out; /* Text Output Window */ 41 | Bit32u active_win; /* Current active window */ 42 | Bit32u input_y; 43 | Bit32u global_mask; /* Current msgmask */ 44 | }; 45 | 46 | 47 | struct DASMLine { 48 | Bit32u pc; 49 | char dasm[80]; 50 | PhysPt ea; 51 | Bit16u easeg; 52 | Bit32u eaoff; 53 | }; 54 | 55 | extern DBGBlock dbg; 56 | 57 | /* Local Debug Stuff */ 58 | Bitu DasmI386(char* buffer, PhysPt pc, Bitu cur_ip, bool bit32); 59 | int DasmLastOperandSize(void); 60 | 61 | -------------------------------------------------------------------------------- /src/debug/debug_win32.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | #include "dosbox.h" 20 | #if C_DEBUG 21 | #ifdef WIN32 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | #ifndef min 28 | #define min(a,b) ((a)<(b)?(a):(b)) 29 | #endif 30 | 31 | /* 32 | Have to remember where i ripped this code sometime ago. 33 | 34 | */ 35 | static void ResizeConsole( HANDLE hConsole, SHORT xSize, SHORT ySize ) { 36 | CONSOLE_SCREEN_BUFFER_INFO csbi; // Hold Current Console Buffer Info 37 | BOOL bSuccess; 38 | SMALL_RECT srWindowRect; // Hold the New Console Size 39 | COORD coordScreen; 40 | 41 | bSuccess = GetConsoleScreenBufferInfo( hConsole, &csbi ); 42 | 43 | // Get the Largest Size we can size the Console Window to 44 | coordScreen = GetLargestConsoleWindowSize( hConsole ); 45 | 46 | // Define the New Console Window Size and Scroll Position 47 | srWindowRect.Right = (SHORT)(min(xSize, coordScreen.X) - 1); 48 | srWindowRect.Bottom = (SHORT)(min(ySize, coordScreen.Y) - 1); 49 | srWindowRect.Left = srWindowRect.Top = (SHORT)0; 50 | 51 | // Define the New Console Buffer Size 52 | coordScreen.X = xSize; 53 | coordScreen.Y = ySize; 54 | 55 | // If the Current Buffer is Larger than what we want, Resize the 56 | // Console Window First, then the Buffer 57 | if( (DWORD)csbi.dwSize.X * csbi.dwSize.Y > (DWORD) xSize * ySize) 58 | { 59 | bSuccess = SetConsoleWindowInfo( hConsole, TRUE, &srWindowRect ); 60 | bSuccess = SetConsoleScreenBufferSize( hConsole, coordScreen ); 61 | } 62 | 63 | // If the Current Buffer is Smaller than what we want, Resize the 64 | // Buffer First, then the Console Window 65 | if( (DWORD)csbi.dwSize.X * csbi.dwSize.Y < (DWORD) xSize * ySize ) 66 | { 67 | bSuccess = SetConsoleScreenBufferSize( hConsole, coordScreen ); 68 | bSuccess = SetConsoleWindowInfo( hConsole, TRUE, &srWindowRect ); 69 | } 70 | 71 | // If the Current Buffer *is* the Size we want, Don't do anything! 72 | return; 73 | } 74 | 75 | 76 | void WIN32_Console() { 77 | AllocConsole(); 78 | SetConsoleTitle("DOSBox Debugger"); 79 | ResizeConsole(GetStdHandle(STD_OUTPUT_HANDLE),80,50); 80 | } 81 | #endif 82 | #endif 83 | -------------------------------------------------------------------------------- /src/dos/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = -I$(top_srcdir)/include 2 | 3 | noinst_LIBRARIES = libdos.a 4 | EXTRA_DIST = scsidefs.h wnaspi32.h dos_codepages.h dos_keyboard_layout_data.h 5 | libdos_a_SOURCES = dos.cpp dos_devices.cpp dos_execute.cpp dos_files.cpp dos_ioctl.cpp dos_memory.cpp \ 6 | dos_misc.cpp dos_classes.cpp dos_programs.cpp dos_tables.cpp \ 7 | drives.cpp drives.h drive_virtual.cpp drive_local.cpp drive_cache.cpp drive_fat.cpp \ 8 | drive_iso.cpp dev_con.h dos_mscdex.cpp dos_keyboard_layout.cpp \ 9 | cdrom.h cdrom.cpp cdrom_ioctl_win32.cpp cdrom_aspi_win32.cpp cdrom_ioctl_linux.cpp cdrom_image.cpp \ 10 | cdrom_ioctl_os2.cpp 11 | -------------------------------------------------------------------------------- /src/dos/cdrom_ioctl_linux.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | 20 | #include 21 | #include "cdrom.h" 22 | #include "support.h" 23 | 24 | #if defined (LINUX) 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | CDROM_Interface_Ioctl::CDROM_Interface_Ioctl(void) : CDROM_Interface_SDL() 33 | { 34 | strcpy(device_name, ""); 35 | } 36 | 37 | bool CDROM_Interface_Ioctl::GetUPC(unsigned char& attr, char* upc) 38 | { 39 | int cdrom_fd = open(device_name, O_RDONLY | O_NONBLOCK); 40 | if (cdrom_fd == -1) return false; 41 | 42 | struct cdrom_mcn cdrom_mcn; 43 | int ret = ioctl(cdrom_fd, CDROM_GET_MCN, &cdrom_mcn); 44 | 45 | close(cdrom_fd); 46 | 47 | if (ret > 0) { 48 | attr = 0; 49 | safe_strncpy(upc, (char*)cdrom_mcn.medium_catalog_number, 14); 50 | } 51 | 52 | return (ret > 0); 53 | } 54 | 55 | bool CDROM_Interface_Ioctl::ReadSectors(PhysPt buffer, bool raw, unsigned long sector, unsigned long num) 56 | { 57 | int cdrom_fd = open(device_name, O_RDONLY | O_NONBLOCK); 58 | if (cdrom_fd == -1) return false; 59 | 60 | Bits buflen = raw ? num * CD_FRAMESIZE_RAW : num * CD_FRAMESIZE; 61 | Bit8u* buf = new Bit8u[buflen]; 62 | int ret; 63 | 64 | if (raw) { 65 | struct cdrom_read cdrom_read; 66 | cdrom_read.cdread_lba = sector; 67 | cdrom_read.cdread_bufaddr = (char*)buf; 68 | cdrom_read.cdread_buflen = buflen; 69 | 70 | ret = ioctl(cdrom_fd, CDROMREADRAW, &cdrom_read); 71 | } else { 72 | ret = lseek(cdrom_fd, sector * CD_FRAMESIZE, SEEK_SET); 73 | if (ret >= 0) ret = read(cdrom_fd, buf, buflen); 74 | if (ret != buflen) ret = -1; 75 | } 76 | close(cdrom_fd); 77 | 78 | MEM_BlockWrite(buffer, buf, buflen); 79 | delete[] buf; 80 | 81 | return (ret > 0); 82 | } 83 | 84 | bool CDROM_Interface_Ioctl::SetDevice(char* path, int forceCD) 85 | { 86 | bool success = CDROM_Interface_SDL::SetDevice(path, forceCD); 87 | 88 | if (success) { 89 | const char* tmp = SDL_CDName(forceCD); 90 | if (tmp) safe_strncpy(device_name, tmp, 512); 91 | else success = false; 92 | } 93 | 94 | return success; 95 | } 96 | 97 | #endif 98 | -------------------------------------------------------------------------------- /src/dosbox.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/svn2github/dosbox/acd380bcde72db74f3b476253899016f686bc0ef/src/dosbox.ico -------------------------------------------------------------------------------- /src/fpu/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = -I$(top_srcdir)/include 2 | 3 | noinst_LIBRARIES = libfpu.a 4 | libfpu_a_SOURCES = fpu.cpp fpu_instructions.h \ 5 | fpu_instructions_x86.h 6 | -------------------------------------------------------------------------------- /src/gui/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = -I$(top_srcdir)/include 2 | 3 | noinst_LIBRARIES = libgui.a 4 | libgui_a_SOURCES = sdlmain.cpp sdl_mapper.cpp dosbox_logo.h \ 5 | render.cpp render_scalers.cpp render_scalers.h \ 6 | render_templates.h render_loops.h render_simple.h \ 7 | render_templates_sai.h render_templates_hq.h \ 8 | render_templates_hq2x.h render_templates_hq3x.h \ 9 | midi.cpp midi_win32.h midi_oss.h midi_coreaudio.h midi_alsa.h \ 10 | midi_coremidi.h sdl_gui.cpp dosbox_splash.h 11 | 12 | -------------------------------------------------------------------------------- /src/gui/midi_coremidi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This program is free software; you can redistribute it and/or modify 3 | * it under the terms of the GNU General Public License as published by 4 | * the Free Software Foundation; either version 2 of the License, or 5 | * (at your option) any later version. 6 | * 7 | * This program is distributed in the hope that it will be useful, 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | * GNU General Public License for more details. 11 | * 12 | * You should have received a copy of the GNU General Public License along 13 | * with this program; if not, write to the Free Software Foundation, Inc., 14 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | class MidiHandler_coremidi : public MidiHandler { 22 | private: 23 | MIDIPortRef m_port; 24 | MIDIClientRef m_client; 25 | MIDIEndpointRef m_endpoint; 26 | MIDIPacket* m_pCurPacket; 27 | public: 28 | MidiHandler_coremidi() {m_pCurPacket = 0;} 29 | const char * GetName(void) { return "coremidi"; } 30 | bool Open(const char * conf) { 31 | // Get the MIDIEndPoint 32 | m_endpoint = 0; 33 | OSStatus result; 34 | Bitu numDests = MIDIGetNumberOfDestinations(); 35 | Bitu destId = numDests; 36 | if(conf && *conf) { 37 | std::string strconf(conf); 38 | std::istringstream configmidi(strconf); 39 | configmidi >> destId; 40 | if (configmidi.fail() && numDests) { 41 | lowcase(strconf); 42 | for(Bitu i = 0; i= numDests) destId = 0; 61 | if (destId < numDests) 62 | { 63 | m_endpoint = MIDIGetDestination(destId); 64 | } 65 | 66 | // Create a MIDI client and port 67 | MIDIClientCreate(CFSTR("MyClient"), 0, 0, &m_client); 68 | 69 | if (!m_client) 70 | { 71 | LOG_MSG("MIDI:coremidi: No client created."); 72 | return false; 73 | } 74 | 75 | MIDIOutputPortCreate(m_client, CFSTR("MyOutPort"), &m_port); 76 | 77 | if (!m_port) 78 | { 79 | LOG_MSG("MIDI:coremidi: No port created."); 80 | return false; 81 | } 82 | 83 | 84 | return true; 85 | } 86 | 87 | void Close(void) { 88 | // Dispose the port 89 | MIDIPortDispose(m_port); 90 | 91 | // Dispose the client 92 | MIDIClientDispose(m_client); 93 | 94 | // Dispose the endpoint 95 | // Not, as it is for Endpoints created by us 96 | // MIDIEndpointDispose(m_endpoint); 97 | } 98 | 99 | void PlayMsg(Bit8u * msg) { 100 | // Acquire a MIDIPacketList 101 | Byte packetBuf[128]; 102 | MIDIPacketList *packetList = (MIDIPacketList *)packetBuf; 103 | m_pCurPacket = MIDIPacketListInit(packetList); 104 | 105 | // Determine the length of msg 106 | Bitu len=MIDI_evt_len[*msg]; 107 | 108 | // Add msg to the MIDIPacketList 109 | MIDIPacketListAdd(packetList, (ByteCount)sizeof(packetBuf), m_pCurPacket, (MIDITimeStamp)0, len, msg); 110 | 111 | // Send the MIDIPacketList 112 | MIDISend(m_port,m_endpoint,packetList); 113 | } 114 | 115 | void PlaySysex(Bit8u * sysex, Bitu len) { 116 | // Acquire a MIDIPacketList 117 | Byte packetBuf[SYSEX_SIZE*4]; 118 | Bitu pos=0; 119 | MIDIPacketList *packetList = (MIDIPacketList *)packetBuf; 120 | m_pCurPacket = MIDIPacketListInit(packetList); 121 | 122 | // Add msg to the MIDIPacketList 123 | MIDIPacketListAdd(packetList, (ByteCount)sizeof(packetBuf), m_pCurPacket, (MIDITimeStamp)0, len, sysex); 124 | 125 | // Send the MIDIPacketList 126 | MIDISend(m_port,m_endpoint,packetList); 127 | } 128 | void ListAll(Program* base) { 129 | Bitu numDests = MIDIGetNumberOfDestinations(); 130 | for(Bitu i = 0; i < numDests; i++){ 131 | MIDIEndpointRef dest = MIDIGetDestination(i); 132 | if (!dest) continue; 133 | CFStringRef midiname = 0; 134 | if(MIDIObjectGetStringProperty(dest, kMIDIPropertyDisplayName, &midiname) == noErr) { 135 | const char * s = CFStringGetCStringPtr(midiname, kCFStringEncodingMacRoman); 136 | if (s) base->WriteOut("%02d\t%s\n",i,s); 137 | } 138 | //This is for EndPoints created by us. 139 | //MIDIEndpointDispose(dest); 140 | } 141 | 142 | } 143 | }; 144 | 145 | MidiHandler_coremidi Midi_coremidi; 146 | 147 | -------------------------------------------------------------------------------- /src/gui/midi_oss.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | #include 20 | #define SEQ_MIDIPUTC 5 21 | 22 | class MidiHandler_oss: public MidiHandler { 23 | private: 24 | int device; 25 | Bit8u device_num; 26 | bool isOpen; 27 | public: 28 | MidiHandler_oss() : MidiHandler(),isOpen(false) {}; 29 | const char * GetName(void) { return "oss";}; 30 | bool Open(const char * conf) { 31 | char devname[512]; 32 | if (conf && conf[0]) safe_strncpy(devname,conf,512); 33 | else strcpy(devname,"/dev/sequencer"); 34 | char * devfind=(strrchr(devname,',')); 35 | if (devfind) { 36 | *devfind++=0; 37 | device_num=atoi(devfind); 38 | } else device_num=0; 39 | if (isOpen) return false; 40 | device=open(devname, O_WRONLY, 0); 41 | if (device<0) return false; 42 | return true; 43 | }; 44 | void Close(void) { 45 | if (!isOpen) return; 46 | if (device>0) close(device); 47 | }; 48 | void PlayMsg(Bit8u * msg) { 49 | Bit8u buf[128];Bitu pos=0; 50 | Bitu len=MIDI_evt_len[*msg]; 51 | for (;len>0;len--) { 52 | buf[pos++] = SEQ_MIDIPUTC; 53 | buf[pos++] = *msg; 54 | buf[pos++] = device_num; 55 | buf[pos++] = 0; 56 | msg++; 57 | } 58 | write(device,buf,pos); 59 | }; 60 | void PlaySysex(Bit8u * sysex,Bitu len) { 61 | Bit8u buf[SYSEX_SIZE*4];Bitu pos=0; 62 | for (;len>0;len--) { 63 | buf[pos++] = SEQ_MIDIPUTC; 64 | buf[pos++] = *sysex++; 65 | buf[pos++] = device_num; 66 | buf[pos++] = 0; 67 | } 68 | write(device,buf,pos); 69 | } 70 | }; 71 | 72 | MidiHandler_oss Midi_oss; 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /src/gui/midi_win32.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | 20 | #ifndef WIN32_LEAN_AND_MEAN 21 | #define WIN32_LEAN_AND_MEAN 22 | #endif 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | class MidiHandler_win32: public MidiHandler { 29 | private: 30 | HMIDIOUT m_out; 31 | MIDIHDR m_hdr; 32 | HANDLE m_event; 33 | bool isOpen; 34 | public: 35 | MidiHandler_win32() : MidiHandler(),isOpen(false) {}; 36 | const char * GetName(void) { return "win32";}; 37 | bool Open(const char * conf) { 38 | if (isOpen) return false; 39 | m_event = CreateEvent (NULL, true, true, NULL); 40 | MMRESULT res = MMSYSERR_NOERROR; 41 | if(conf && *conf) { 42 | std::string strconf(conf); 43 | std::istringstream configmidi(strconf); 44 | unsigned int total = midiOutGetNumDevs(); 45 | unsigned int nummer = total; 46 | configmidi >> nummer; 47 | if (configmidi.fail() && total) { 48 | lowcase(strconf); 49 | for(unsigned int i = 0; i< total;i++) { 50 | MIDIOUTCAPS mididev; 51 | midiOutGetDevCaps(i, &mididev, sizeof(MIDIOUTCAPS)); 52 | std::string devname(mididev.szPname); 53 | lowcase(devname); 54 | if (devname.find(strconf) != std::string::npos) { 55 | nummer = i; 56 | break; 57 | } 58 | } 59 | } 60 | 61 | if (nummer < total) { 62 | MIDIOUTCAPS mididev; 63 | midiOutGetDevCaps(nummer, &mididev, sizeof(MIDIOUTCAPS)); 64 | LOG_MSG("MIDI: win32 selected %s",mididev.szPname); 65 | res = midiOutOpen(&m_out, nummer, (DWORD_PTR)m_event, 0, CALLBACK_EVENT); 66 | } 67 | } else { 68 | res = midiOutOpen(&m_out, MIDI_MAPPER, (DWORD_PTR)m_event, 0, CALLBACK_EVENT); 69 | } 70 | if (res != MMSYSERR_NOERROR) return false; 71 | isOpen=true; 72 | return true; 73 | }; 74 | 75 | void Close(void) { 76 | if (!isOpen) return; 77 | isOpen=false; 78 | midiOutClose(m_out); 79 | CloseHandle (m_event); 80 | }; 81 | void PlayMsg(Bit8u * msg) { 82 | midiOutShortMsg(m_out, *(Bit32u*)msg); 83 | }; 84 | void PlaySysex(Bit8u * sysex,Bitu len) { 85 | if (WaitForSingleObject (m_event, 2000) == WAIT_TIMEOUT) { 86 | LOG(LOG_MISC,LOG_ERROR)("Can't send midi message"); 87 | return; 88 | } 89 | midiOutUnprepareHeader (m_out, &m_hdr, sizeof (m_hdr)); 90 | 91 | m_hdr.lpData = (char *) sysex; 92 | m_hdr.dwBufferLength = len ; 93 | m_hdr.dwBytesRecorded = len ; 94 | m_hdr.dwUser = 0; 95 | 96 | MMRESULT result = midiOutPrepareHeader (m_out, &m_hdr, sizeof (m_hdr)); 97 | if (result != MMSYSERR_NOERROR) return; 98 | ResetEvent (m_event); 99 | result = midiOutLongMsg (m_out,&m_hdr,sizeof(m_hdr)); 100 | if (result != MMSYSERR_NOERROR) { 101 | SetEvent (m_event); 102 | return; 103 | } 104 | } 105 | void ListAll(Program* base) { 106 | unsigned int total = midiOutGetNumDevs(); 107 | for(unsigned int i = 0;i < total;i++) { 108 | MIDIOUTCAPS mididev; 109 | midiOutGetDevCaps(i, &mididev, sizeof(MIDIOUTCAPS)); 110 | base->WriteOut("%2d\t \"%s\"\n",i,mididev.szPname); 111 | } 112 | } 113 | }; 114 | 115 | MidiHandler_win32 Midi_win32; 116 | 117 | 118 | -------------------------------------------------------------------------------- /src/gui/render_scalers.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | #ifndef _RENDER_SCALERS_H 20 | #define _RENDER_SCALERS_H 21 | 22 | //#include "render.h" 23 | #include "video.h" 24 | #if RENDER_USE_ADVANCED_SCALERS>0 25 | #define SCALER_MAXWIDTH 1280 26 | #define SCALER_MAXHEIGHT 1024 27 | #else 28 | // reduced to save some memory 29 | #define SCALER_MAXWIDTH 800 30 | #define SCALER_MAXHEIGHT 600 31 | #endif 32 | 33 | #if RENDER_USE_ADVANCED_SCALERS>1 34 | #define SCALER_COMPLEXWIDTH 800 35 | #define SCALER_COMPLEXHEIGHT 600 36 | #endif 37 | 38 | #define SCALER_BLOCKSIZE 16 39 | 40 | typedef enum { 41 | scalerMode8, scalerMode15, scalerMode16, scalerMode32 42 | } scalerMode_t; 43 | 44 | typedef enum scalerOperation { 45 | scalerOpNormal, 46 | #if RENDER_USE_ADVANCED_SCALERS>2 47 | scalerOpAdvMame, 48 | scalerOpAdvInterp, 49 | scalerOpHQ, 50 | scalerOpSaI, 51 | scalerOpSuperSaI, 52 | scalerOpSuperEagle, 53 | #endif 54 | #if RENDER_USE_ADVANCED_SCALERS>0 55 | scalerOpTV, 56 | scalerOpRGB, 57 | scalerOpScan, 58 | #endif 59 | scalerLast 60 | } scalerOperation_t; 61 | 62 | typedef void (*ScalerLineHandler_t)(const void *src); 63 | typedef void (*ScalerComplexHandler_t)(void); 64 | 65 | extern Bit8u Scaler_Aspect[]; 66 | extern Bit8u diff_table[]; 67 | extern Bitu Scaler_ChangedLineIndex; 68 | extern Bit16u Scaler_ChangedLines[]; 69 | #if RENDER_USE_ADVANCED_SCALERS>1 70 | /* Not entirely happy about those +2's since they make a non power of 2, with muls instead of shift */ 71 | typedef Bit8u scalerChangeCache_t [SCALER_COMPLEXHEIGHT][SCALER_COMPLEXWIDTH / SCALER_BLOCKSIZE] ; 72 | typedef union { 73 | Bit32u b32 [SCALER_COMPLEXHEIGHT] [SCALER_COMPLEXWIDTH]; 74 | Bit16u b16 [SCALER_COMPLEXHEIGHT] [SCALER_COMPLEXWIDTH]; 75 | Bit8u b8 [SCALER_COMPLEXHEIGHT] [SCALER_COMPLEXWIDTH]; 76 | } scalerFrameCache_t; 77 | #endif 78 | typedef union { 79 | Bit32u b32 [SCALER_MAXHEIGHT] [SCALER_MAXWIDTH]; 80 | Bit16u b16 [SCALER_MAXHEIGHT] [SCALER_MAXWIDTH]; 81 | Bit8u b8 [SCALER_MAXHEIGHT] [SCALER_MAXWIDTH]; 82 | } scalerSourceCache_t; 83 | extern scalerSourceCache_t scalerSourceCache; 84 | #if RENDER_USE_ADVANCED_SCALERS>1 85 | extern scalerChangeCache_t scalerChangeCache; 86 | #endif 87 | typedef ScalerLineHandler_t ScalerLineBlock_t[5][4]; 88 | 89 | typedef struct { 90 | const char *name; 91 | Bitu gfxFlags; 92 | Bitu xscale,yscale; 93 | ScalerComplexHandler_t Linear[4]; 94 | ScalerComplexHandler_t Random[4]; 95 | } ScalerComplexBlock_t; 96 | 97 | typedef struct { 98 | const char *name; 99 | Bitu gfxFlags; 100 | Bitu xscale,yscale; 101 | ScalerLineBlock_t Linear; 102 | ScalerLineBlock_t Random; 103 | } ScalerSimpleBlock_t; 104 | 105 | 106 | #define SCALE_LEFT 0x1 107 | #define SCALE_RIGHT 0x2 108 | #define SCALE_FULL 0x4 109 | 110 | /* Simple scalers */ 111 | extern ScalerSimpleBlock_t ScaleNormal1x; 112 | extern ScalerSimpleBlock_t ScaleNormalDw; 113 | extern ScalerSimpleBlock_t ScaleNormalDh; 114 | extern ScalerSimpleBlock_t ScaleNormal2x; 115 | extern ScalerSimpleBlock_t ScaleNormal3x; 116 | #if RENDER_USE_ADVANCED_SCALERS>0 117 | extern ScalerSimpleBlock_t ScaleTV2x; 118 | extern ScalerSimpleBlock_t ScaleTV3x; 119 | extern ScalerSimpleBlock_t ScaleRGB2x; 120 | extern ScalerSimpleBlock_t ScaleRGB3x; 121 | extern ScalerSimpleBlock_t ScaleScan2x; 122 | extern ScalerSimpleBlock_t ScaleScan3x; 123 | #endif 124 | /* Complex scalers */ 125 | #if RENDER_USE_ADVANCED_SCALERS>2 126 | extern ScalerComplexBlock_t ScaleHQ2x; 127 | extern ScalerComplexBlock_t ScaleHQ3x; 128 | extern ScalerComplexBlock_t Scale2xSaI; 129 | extern ScalerComplexBlock_t ScaleSuper2xSaI; 130 | extern ScalerComplexBlock_t ScaleSuperEagle; 131 | extern ScalerComplexBlock_t ScaleAdvMame2x; 132 | extern ScalerComplexBlock_t ScaleAdvMame3x; 133 | extern ScalerComplexBlock_t ScaleAdvInterp2x; 134 | extern ScalerComplexBlock_t ScaleAdvInterp3x; 135 | #endif 136 | #if RENDER_USE_ADVANCED_SCALERS>1 137 | extern ScalerLineBlock_t ScalerCache; 138 | #endif 139 | #endif 140 | -------------------------------------------------------------------------------- /src/gui/render_simple.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | 20 | #if defined (SCALERLINEAR) 21 | static void conc4d(SCALERNAME,SBPP,DBPP,L)(const void *s) { 22 | #else 23 | static void conc4d(SCALERNAME,SBPP,DBPP,R)(const void *s) { 24 | #endif 25 | #ifdef RENDER_NULL_INPUT 26 | if (!s) { 27 | render.scale.cacheRead += render.scale.cachePitch; 28 | #if defined(SCALERLINEAR) 29 | Bitu skipLines = SCALERHEIGHT; 30 | #else 31 | Bitu skipLines = Scaler_Aspect[ render.scale.outLine++ ]; 32 | #endif 33 | ScalerAddLines( 0, skipLines ); 34 | return; 35 | } 36 | #endif 37 | /* Clear the complete line marker */ 38 | Bitu hadChange = 0; 39 | const SRCTYPE *src = (SRCTYPE*)s; 40 | SRCTYPE *cache = (SRCTYPE*)(render.scale.cacheRead); 41 | render.scale.cacheRead += render.scale.cachePitch; 42 | PTYPE * line0=(PTYPE *)(render.scale.outWrite); 43 | #if (SBPP == 9) 44 | for (Bits x=render.src.width;x>0;) { 45 | if (*(Bit32u const*)src == *(Bit32u*)cache && !( 46 | render.pal.modified[src[0]] | 47 | render.pal.modified[src[1]] | 48 | render.pal.modified[src[2]] | 49 | render.pal.modified[src[3]] )) { 50 | x-=4; 51 | src+=4; 52 | cache+=4; 53 | line0+=4*SCALERWIDTH; 54 | #else 55 | for (Bits x=render.src.width;x>0;) { 56 | if (*(Bitu const*)src == *(Bitu*)cache) { 57 | x-=(sizeof(Bitu)/sizeof(SRCTYPE)); 58 | src+=(sizeof(Bitu)/sizeof(SRCTYPE)); 59 | cache+=(sizeof(Bitu)/sizeof(SRCTYPE)); 60 | line0+=(sizeof(Bitu)/sizeof(SRCTYPE))*SCALERWIDTH; 61 | #endif 62 | } else { 63 | #if defined(SCALERLINEAR) 64 | #if (SCALERHEIGHT > 1) 65 | PTYPE *line1 = WC[0]; 66 | #endif 67 | #if (SCALERHEIGHT > 2) 68 | PTYPE *line2 = WC[1]; 69 | #endif 70 | #else 71 | #if (SCALERHEIGHT > 1) 72 | PTYPE *line1 = (PTYPE *)(((Bit8u*)line0)+ render.scale.outPitch); 73 | #endif 74 | #if (SCALERHEIGHT > 2) 75 | PTYPE *line2 = (PTYPE *)(((Bit8u*)line0)+ render.scale.outPitch * 2); 76 | #endif 77 | #endif //defined(SCALERLINEAR) 78 | hadChange = 1; 79 | for (Bitu i = x > 32 ? 32 : x;i>0;i--,x--) { 80 | const SRCTYPE S = *src; 81 | *cache = S; 82 | src++;cache++; 83 | const PTYPE P = PMAKE(S); 84 | SCALERFUNC; 85 | line0 += SCALERWIDTH; 86 | #if (SCALERHEIGHT > 1) 87 | line1 += SCALERWIDTH; 88 | #endif 89 | #if (SCALERHEIGHT > 2) 90 | line2 += SCALERWIDTH; 91 | #endif 92 | } 93 | #if defined(SCALERLINEAR) 94 | #if (SCALERHEIGHT > 1) 95 | Bitu copyLen = (Bitu)((Bit8u*)line1 - (Bit8u*)WC[0]); 96 | BituMove(((Bit8u*)line0)-copyLen+render.scale.outPitch ,WC[0], copyLen ); 97 | #endif 98 | #if (SCALERHEIGHT > 2) 99 | BituMove(((Bit8u*)line0)-copyLen+render.scale.outPitch*2,WC[1], copyLen ); 100 | #endif 101 | #endif //defined(SCALERLINEAR) 102 | } 103 | } 104 | #if defined(SCALERLINEAR) 105 | Bitu scaleLines = SCALERHEIGHT; 106 | #else 107 | Bitu scaleLines = Scaler_Aspect[ render.scale.outLine++ ]; 108 | if ( scaleLines - SCALERHEIGHT && hadChange ) { 109 | BituMove( render.scale.outWrite + render.scale.outPitch * SCALERHEIGHT, 110 | render.scale.outWrite + render.scale.outPitch * (SCALERHEIGHT-1), 111 | render.src.width * SCALERWIDTH * PSIZE); 112 | } 113 | #endif 114 | ScalerAddLines( hadChange, scaleLines ); 115 | } 116 | 117 | #if !defined(SCALERLINEAR) 118 | #define SCALERLINEAR 1 119 | #include "render_simple.h" 120 | #undef SCALERLINEAR 121 | #endif 122 | -------------------------------------------------------------------------------- /src/gui/render_templates_hq.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | /* 20 | * The HQ3x high quality 3x graphics filter. 21 | * Original author Maxim Stepin (see http://www.hiend3d.com/hq3x.html). 22 | * Adapted for DOSBox from ScummVM and HiEnd3D code by Kronuz. 23 | */ 24 | 25 | #include 26 | 27 | #ifndef RENDER_TEMPLATES_HQNX_TABLE_H 28 | #define RENDER_TEMPLATES_HQNX_TABLE_H 29 | 30 | static Bit32u *_RGBtoYUV = 0; 31 | static inline bool diffYUV(Bit32u yuv1, Bit32u yuv2) 32 | { 33 | static const Bit32u Ymask = 0x00FF0000; 34 | static const Bit32u Umask = 0x0000FF00; 35 | static const Bit32u Vmask = 0x000000FF; 36 | static const Bit32u trY = 0x00300000; 37 | static const Bit32u trU = 0x00000700; 38 | static const Bit32u trV = 0x00000006; 39 | 40 | Bit32u diff; 41 | Bit32u mask; 42 | 43 | diff = ((yuv1 & Ymask) - (yuv2 & Ymask)); 44 | mask = diff >> 31; // -1 if value < 0, 0 otherwise 45 | diff = (diff ^ mask) - mask; //-1: ~value + 1; 0: value 46 | if (diff > trY) return true; 47 | 48 | diff = ((yuv1 & Umask) - (yuv2 & Umask)); 49 | mask = diff >> 31; // -1 if value < 0, 0 otherwise 50 | diff = (diff ^ mask) - mask; //-1: ~value + 1; 0: value 51 | if (diff > trU) return true; 52 | 53 | diff = ((yuv1 & Vmask) - (yuv2 & Vmask)); 54 | mask = diff >> 31; // -1 if value < 0, 0 otherwise 55 | diff = (diff ^ mask) - mask; //-1: ~value + 1; 0: value 56 | if (diff > trV) return true; 57 | 58 | return false; 59 | } 60 | 61 | #endif 62 | 63 | static inline void conc2d(InitLUTs,SBPP)(void) 64 | { 65 | int r, g, b; 66 | int Y, u, v; 67 | 68 | _RGBtoYUV = (Bit32u *)malloc(65536 * sizeof(Bit32u)); 69 | 70 | for (int color = 0; color < 65536; ++color) { 71 | #if SBPP == 32 72 | r = ((color & 0xF800) >> 11) << (8 - 5); 73 | g = ((color & 0x07E0) >> 5) << (8 - 6); 74 | b = ((color & 0x001F) >> 0) << (8 - 5); 75 | #else 76 | r = ((color & redMask) >> redShift) << (8 - redBits); 77 | g = ((color & greenMask) >> greenShift) << (8 - greenBits); 78 | b = ((color & blueMask) >> blueShift) << (8 - blueBits); 79 | #endif 80 | Y = (r + g + b) >> 2; 81 | u = 128 + ((r - b) >> 2); 82 | v = 128 + ((-r + 2 * g - b) >> 3); 83 | _RGBtoYUV[color] = (Y << 16) | (u << 8) | v; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/hardware/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = -I$(top_srcdir)/include 2 | 3 | SUBDIRS = serialport mame 4 | 5 | EXTRA_DIST = opl.cpp opl.h adlib.h dbopl.h pci_devices.h 6 | 7 | noinst_LIBRARIES = libhardware.a 8 | 9 | libhardware_a_SOURCES = adlib.cpp dma.cpp gameblaster.cpp hardware.cpp iohandler.cpp joystick.cpp keyboard.cpp \ 10 | memory.cpp mixer.cpp pcspeaker.cpp pci_bus.cpp pic.cpp sblaster.cpp tandy_sound.cpp timer.cpp \ 11 | vga.cpp vga_attr.cpp vga_crtc.cpp vga_dac.cpp vga_draw.cpp vga_gfx.cpp vga_other.cpp \ 12 | vga_memory.cpp vga_misc.cpp vga_seq.cpp vga_xga.cpp vga_s3.cpp vga_tseng.cpp vga_paradise.cpp \ 13 | cmos.cpp disney.cpp gus.cpp mpu401.cpp ipx.cpp ipxserver.cpp dbopl.cpp 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/hardware/adlib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | 20 | #ifndef DOSBOX_ADLIB_H 21 | #define DOSBOX_ADLIB_H 22 | 23 | #include "dosbox.h" 24 | #include "mixer.h" 25 | #include "inout.h" 26 | #include "setup.h" 27 | #include "pic.h" 28 | #include "hardware.h" 29 | 30 | 31 | namespace Adlib { 32 | 33 | struct Timer { 34 | double start; 35 | double delay; 36 | bool enabled, overflow, masked; 37 | Bit8u counter; 38 | Timer() { 39 | masked = false; 40 | overflow = false; 41 | enabled = false; 42 | counter = 0; 43 | delay = 0; 44 | } 45 | //Call update before making any further changes 46 | void Update( double time ) { 47 | if ( !enabled || !delay ) 48 | return; 49 | double deltaStart = time - start; 50 | //Only set the overflow flag when not masked 51 | if ( deltaStart >= 0 && !masked ) { 52 | overflow = 1; 53 | } 54 | } 55 | //On a reset make sure the start is in sync with the next cycle 56 | void Reset(const double& time ) { 57 | overflow = false; 58 | if ( !delay || !enabled ) 59 | return; 60 | double delta = (time - start); 61 | double rem = fmod( delta, delay ); 62 | double next = delay - rem; 63 | start = time + next; 64 | } 65 | void Stop( ) { 66 | enabled = false; 67 | } 68 | void Start( const double& time, Bits scale ) { 69 | //Don't enable again 70 | if ( enabled ) { 71 | return; 72 | } 73 | enabled = true; 74 | delay = 0.001 * (256 - counter ) * scale; 75 | start = time + delay; 76 | } 77 | 78 | }; 79 | 80 | struct Chip { 81 | //Last selected register 82 | Timer timer[2]; 83 | //Check for it being a write to the timer 84 | bool Write( Bit32u addr, Bit8u val ); 85 | //Read the current timer state, will use current double 86 | Bit8u Read( ); 87 | }; 88 | 89 | //The type of handler this is 90 | typedef enum { 91 | MODE_OPL2, 92 | MODE_DUALOPL2, 93 | MODE_OPL3, 94 | MODE_OPL3GOLD 95 | } Mode; 96 | 97 | class Handler { 98 | public: 99 | //Write an address to a chip, returns the address the chip sets 100 | virtual Bit32u WriteAddr( Bit32u port, Bit8u val ) = 0; 101 | //Write to a specific register in the chip 102 | virtual void WriteReg( Bit32u addr, Bit8u val ) = 0; 103 | //Generate a certain amount of samples 104 | virtual void Generate( MixerChannel* chan, Bitu samples ) = 0; 105 | //Initialize at a specific sample rate and mode 106 | virtual void Init( Bitu rate ) = 0; 107 | virtual ~Handler() { 108 | } 109 | }; 110 | 111 | //The cache for 2 chips or an opl3 112 | typedef Bit8u RegisterCache[512]; 113 | 114 | //Internal class used for dro capturing 115 | class Capture; 116 | 117 | class Module: public Module_base { 118 | IO_ReadHandleObject ReadHandler[3]; 119 | IO_WriteHandleObject WriteHandler[3]; 120 | MixerObject mixerObject; 121 | 122 | //Mode we're running in 123 | Mode mode; 124 | //Last selected address in the chip for the different modes 125 | union { 126 | Bit32u normal; 127 | Bit8u dual[2]; 128 | } reg; 129 | struct { 130 | bool active; 131 | Bit8u index; 132 | Bit8u lvol; 133 | Bit8u rvol; 134 | bool mixer; 135 | } ctrl; 136 | void CacheWrite( Bit32u reg, Bit8u val ); 137 | void DualWrite( Bit8u index, Bit8u reg, Bit8u val ); 138 | void CtrlWrite( Bit8u val ); 139 | Bitu CtrlRead( void ); 140 | public: 141 | static OPL_Mode oplmode; 142 | MixerChannel* mixerChan; 143 | Bit32u lastUsed; //Ticks when adlib was last used to turn of mixing after a few second 144 | 145 | Handler* handler; //Handler that will generate the sound 146 | RegisterCache cache; 147 | Capture* capture; 148 | Chip chip[2]; 149 | 150 | //Handle port writes 151 | void PortWrite( Bitu port, Bitu val, Bitu iolen ); 152 | Bitu PortRead( Bitu port, Bitu iolen ); 153 | void Init( Mode m ); 154 | 155 | Module( Section* configuration); 156 | ~Module(); 157 | }; 158 | 159 | 160 | } //Adlib namespace 161 | 162 | #endif 163 | -------------------------------------------------------------------------------- /src/hardware/mame/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = -I$(top_srcdir)/include 2 | 3 | noinst_LIBRARIES = libmame.a 4 | libmame_a_SOURCES = emu.h \ 5 | fmopl.cpp fmopl.h \ 6 | saa1099.cpp saa1099.h \ 7 | sn76496.cpp sn76496.h \ 8 | ymdeltat.cpp ymdeltat.h \ 9 | ymf262.cpp ymf262.h 10 | -------------------------------------------------------------------------------- /src/hardware/mame/emu.h: -------------------------------------------------------------------------------- 1 | #ifndef DOSBOX_EMU_H 2 | #define DOSBOX_EMU_H 3 | 4 | 5 | #include "dosbox.h" 6 | #if defined(_MSC_VER) && (_MSC_VER <= 1500) 7 | #include 8 | #else 9 | #include 10 | #endif 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #if C_DEBUG 17 | #include 18 | #include 19 | #endif 20 | 21 | #ifndef M_PI 22 | #define M_PI 3.14159265358979323846 23 | #endif 24 | 25 | typedef Bit16s stream_sample_t; 26 | 27 | typedef Bit8u u8; 28 | typedef Bit32u u32; 29 | 30 | class device_t; 31 | struct machine_config; 32 | 33 | #define NAME( _ASDF_ ) 0 34 | #define BIT( _INPUT_, _BIT_ ) ( ( _INPUT_) >> (_BIT_)) & 1 35 | 36 | #define ATTR_UNUSED 37 | #define DECLARE_READ8_MEMBER(name) u8 name( int, int) 38 | #define DECLARE_WRITE8_MEMBER(name) void name( int, int, u8 data) 39 | #define READ8_MEMBER(name) u8 name( int, int) 40 | #define WRITE8_MEMBER(name) void name( int offset, int space, u8 data) 41 | 42 | #define DECLARE_DEVICE_TYPE(Type, Class) \ 43 | extern const device_type Type; \ 44 | class Class; 45 | 46 | #define DEFINE_DEVICE_TYPE(Type, Class, ShortName, FullName) \ 47 | const device_type Type = 0; 48 | 49 | 50 | class device_sound_interface { 51 | public: 52 | struct sound_stream { 53 | void update() { 54 | } 55 | }; 56 | sound_stream temp; 57 | 58 | sound_stream* stream_alloc(int whatever, int channels, int size) { 59 | return &temp; 60 | }; 61 | 62 | 63 | virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) = 0; 64 | 65 | device_sound_interface(const machine_config &mconfig, device_t& _device) { 66 | } 67 | 68 | }; 69 | 70 | struct attotime { 71 | int whatever; 72 | 73 | static attotime from_hz(int hz) { 74 | return attotime(); 75 | } 76 | }; 77 | 78 | struct machine_config { 79 | }; 80 | 81 | typedef int device_type; 82 | 83 | class device_t { 84 | u32 clockRate; 85 | public: 86 | struct machine_t { 87 | int describe_context() const { 88 | return 0; 89 | } 90 | }; 91 | 92 | machine_t machine() const { 93 | return machine_t(); 94 | } 95 | 96 | //int offset, space; 97 | 98 | u32 clock() const { 99 | return clockRate; 100 | } 101 | 102 | void logerror(const char* format, ...) { 103 | #if C_DEBUG 104 | char buf[512*2]; 105 | va_list msg; 106 | va_start(msg,format); 107 | vsprintf(buf,format,msg); 108 | va_end(msg); 109 | LOG(LOG_MISC,LOG_NORMAL)("%s",buf); 110 | #endif 111 | } 112 | 113 | static int tag() { 114 | return 0; 115 | } 116 | 117 | virtual void device_start() { 118 | } 119 | 120 | void save_item(int wtf, int blah= 0) { 121 | } 122 | 123 | device_t(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 _clock) : clockRate( _clock ) { 124 | } 125 | 126 | }; 127 | 128 | 129 | 130 | static void auto_free(const device_t::machine_t& machine, void * buffer) { 131 | free(buffer); 132 | } 133 | 134 | #define auto_alloc_array_clear(m, t, c) calloc(c, sizeof(t) ) 135 | #define auto_alloc_clear(m, t) static_cast( calloc(1, sizeof(t) ) ) 136 | 137 | 138 | 139 | 140 | #endif 141 | -------------------------------------------------------------------------------- /src/hardware/mame/fmopl.h: -------------------------------------------------------------------------------- 1 | // license:GPL-2.0+ 2 | // copyright-holders:Jarek Burczynski,Tatsuyuki Satoh 3 | #ifndef MAME_SOUND_FMOPL_H 4 | #define MAME_SOUND_FMOPL_H 5 | 6 | #pragma once 7 | 8 | #if defined(_MSC_VER) && (_MSC_VER <= 1500) 9 | #include 10 | #else 11 | #include 12 | #endif 13 | 14 | 15 | /* --- select emulation chips --- */ 16 | #define BUILD_YM3812 1 17 | #define BUILD_YM3526 (0) 18 | #define BUILD_Y8950 (0) 19 | 20 | /* select output bits size of output : 8 or 16 */ 21 | #define OPL_SAMPLE_BITS 16 22 | 23 | typedef stream_sample_t OPLSAMPLE; 24 | /* 25 | #if (OPL_SAMPLE_BITS==16) 26 | typedef int16_t OPLSAMPLE; 27 | #endif 28 | #if (OPL_SAMPLE_BITS==8) 29 | typedef int8_t OPLSAMPLE; 30 | #endif 31 | */ 32 | 33 | typedef void (*OPL_TIMERHANDLER)(device_t *device,int timer,const attotime &period); 34 | typedef void (*OPL_IRQHANDLER)(device_t *device,int irq); 35 | typedef void (*OPL_UPDATEHANDLER)(device_t *device,int min_interval_us); 36 | typedef void (*OPL_PORTHANDLER_W)(device_t *device,unsigned char data); 37 | typedef unsigned char (*OPL_PORTHANDLER_R)(device_t *device); 38 | 39 | 40 | #if BUILD_YM3812 41 | 42 | void *ym3812_init(device_t *device, uint32_t clock, uint32_t rate); 43 | void ym3812_clock_changed(void *chip, uint32_t clock, uint32_t rate); 44 | void ym3812_shutdown(void *chip); 45 | void ym3812_reset_chip(void *chip); 46 | int ym3812_write(void *chip, int a, int v); 47 | unsigned char ym3812_read(void *chip, int a); 48 | int ym3812_timer_over(void *chip, int c); 49 | void ym3812_update_one(void *chip, OPLSAMPLE *buffer, int length); 50 | 51 | void ym3812_set_timer_handler(void *chip, OPL_TIMERHANDLER TimerHandler, device_t *device); 52 | void ym3812_set_irq_handler(void *chip, OPL_IRQHANDLER IRQHandler, device_t *device); 53 | void ym3812_set_update_handler(void *chip, OPL_UPDATEHANDLER UpdateHandler, device_t *device); 54 | 55 | #endif /* BUILD_YM3812 */ 56 | 57 | 58 | #if BUILD_YM3526 59 | 60 | /* 61 | ** Initialize YM3526 emulator(s). 62 | ** 63 | ** 'num' is the number of virtual YM3526's to allocate 64 | ** 'clock' is the chip clock in Hz 65 | ** 'rate' is sampling rate 66 | */ 67 | void *ym3526_init(device_t *device, uint32_t clock, uint32_t rate); 68 | void ym3526_clock_changed(void *chip, uint32_t clock, uint32_t rate); 69 | /* shutdown the YM3526 emulators*/ 70 | void ym3526_shutdown(void *chip); 71 | void ym3526_reset_chip(void *chip); 72 | int ym3526_write(void *chip, int a, int v); 73 | unsigned char ym3526_read(void *chip, int a); 74 | int ym3526_timer_over(void *chip, int c); 75 | /* 76 | ** Generate samples for one of the YM3526's 77 | ** 78 | ** 'which' is the virtual YM3526 number 79 | ** '*buffer' is the output buffer pointer 80 | ** 'length' is the number of samples that should be generated 81 | */ 82 | void ym3526_update_one(void *chip, OPLSAMPLE *buffer, int length); 83 | 84 | void ym3526_set_timer_handler(void *chip, OPL_TIMERHANDLER TimerHandler, device_t *device); 85 | void ym3526_set_irq_handler(void *chip, OPL_IRQHANDLER IRQHandler, device_t *device); 86 | void ym3526_set_update_handler(void *chip, OPL_UPDATEHANDLER UpdateHandler, device_t *device); 87 | 88 | #endif /* BUILD_YM3526 */ 89 | 90 | 91 | #if BUILD_Y8950 92 | 93 | /* Y8950 port handlers */ 94 | void y8950_set_port_handler(void *chip, OPL_PORTHANDLER_W PortHandler_w, OPL_PORTHANDLER_R PortHandler_r, device_t *device); 95 | void y8950_set_keyboard_handler(void *chip, OPL_PORTHANDLER_W KeyboardHandler_w, OPL_PORTHANDLER_R KeyboardHandler_r, device_t *device); 96 | void y8950_set_delta_t_memory(void *chip, void * deltat_mem_ptr, int deltat_mem_size ); 97 | 98 | void * y8950_init(device_t *device, uint32_t clock, uint32_t rate); 99 | void y8950_shutdown(void *chip); 100 | void y8950_reset_chip(void *chip); 101 | int y8950_write(void *chip, int a, int v); 102 | unsigned char y8950_read (void *chip, int a); 103 | int y8950_timer_over(void *chip, int c); 104 | void y8950_update_one(void *chip, OPLSAMPLE *buffer, int length); 105 | 106 | void y8950_set_timer_handler(void *chip, OPL_TIMERHANDLER TimerHandler, device_t *device); 107 | void y8950_set_irq_handler(void *chip, OPL_IRQHANDLER IRQHandler, device_t *device); 108 | void y8950_set_update_handler(void *chip, OPL_UPDATEHANDLER UpdateHandler, device_t *device); 109 | 110 | #endif /* BUILD_Y8950 */ 111 | 112 | 113 | #endif // MAME_SOUND_FMOPL_H 114 | -------------------------------------------------------------------------------- /src/hardware/mame/saa1099.h: -------------------------------------------------------------------------------- 1 | // license:BSD-3-Clause 2 | // copyright-holders:Juergen Buchmueller, Manuel Abadia 3 | /********************************************** 4 | Philips SAA1099 Sound driver 5 | **********************************************/ 6 | 7 | #ifndef MAME_SOUND_SAA1099_H 8 | #define MAME_SOUND_SAA1099_H 9 | 10 | #pragma once 11 | 12 | //************************************************************************** 13 | // INTERFACE CONFIGURATION MACROS 14 | //************************************************************************** 15 | 16 | #define MCFG_SAA1099_ADD(_tag, _clock) \ 17 | MCFG_DEVICE_ADD(_tag, SAA1099, _clock) 18 | #define MCFG_SAA1099_REPLACE(_tag, _clock) \ 19 | MCFG_DEVICE_REPLACE(_tag, SAA1099, _clock) 20 | 21 | 22 | //************************************************************************** 23 | // TYPE DEFINITIONS 24 | //************************************************************************** 25 | 26 | //Container class for int that just initalizes to 0 27 | class NullInt { 28 | int value; 29 | public: 30 | operator int& () { 31 | return value; 32 | } 33 | 34 | int& operator= ( int set ) { 35 | value = set; 36 | return value; 37 | } 38 | 39 | NullInt( int set = 0 ) : value( set ) { 40 | } 41 | }; 42 | 43 | // ======================> saa1099_device 44 | 45 | class saa1099_device : public device_t, 46 | public device_sound_interface 47 | { 48 | public: 49 | saa1099_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); 50 | 51 | DECLARE_WRITE8_MEMBER( control_w ); 52 | DECLARE_WRITE8_MEMBER( data_w ); 53 | 54 | DECLARE_WRITE8_MEMBER( write ); 55 | 56 | //protected: 57 | // device-level overrides 58 | virtual void device_start(); 59 | 60 | // sound stream update overrides 61 | virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); 62 | 63 | private: 64 | struct saa1099_channel 65 | { 66 | saa1099_channel() { 67 | //Quite hacky, but let's see how it goes 68 | memset( this, 0, sizeof( *this ) ); 69 | } 70 | 71 | int frequency ; /* frequency (0x00..0xff) */ 72 | int freq_enable ; /* frequency enable */ 73 | int noise_enable ; /* noise enable */ 74 | int octave ; /* octave (0x00..0x07) */ 75 | int amplitude[2]; /* amplitude (0x00..0x0f) */ 76 | int envelope[2]; /* envelope (0x00..0x0f or 0x10 == off) */ 77 | 78 | /* vars to simulate the square wave */ 79 | double counter ; 80 | double freq ; 81 | int level ; 82 | 83 | }; 84 | 85 | struct saa1099_noise 86 | { 87 | saa1099_noise() { 88 | counter = 0; 89 | freq = 0; 90 | level = 0xFFFFFFFF; 91 | } 92 | 93 | /* vars to simulate the noise generator output */ 94 | double counter; 95 | double freq; 96 | uint32_t level; /* noise polynomial shifter */ 97 | }; 98 | 99 | void envelope_w(int ch); 100 | 101 | sound_stream *m_stream; /* our stream */ 102 | int m_noise_params[2]; /* noise generators parameters */ 103 | int m_env_enable[2]; /* envelope generators enable */ 104 | int m_env_reverse_right[2]; /* envelope reversed for right channel */ 105 | int m_env_mode[2]; /* envelope generators mode */ 106 | int m_env_bits[2]; /* non zero = 3 bits resolution */ 107 | int m_env_clock[2]; /* envelope clock mode (non-zero external) */ 108 | int m_env_step[2]; /* current envelope step */ 109 | int m_all_ch_enable; /* all channels enable */ 110 | int m_sync_state; /* sync all channels */ 111 | int m_selected_reg; /* selected register */ 112 | saa1099_channel m_channels[6]; /* channels */ 113 | saa1099_noise m_noise[2]; /* noise generators */ 114 | double m_sample_rate; 115 | int m_master_clock; 116 | }; 117 | 118 | DECLARE_DEVICE_TYPE(SAA1099, saa1099_device) 119 | 120 | #endif // MAME_SOUND_SAA1099_H 121 | -------------------------------------------------------------------------------- /src/hardware/mame/ymdeltat.h: -------------------------------------------------------------------------------- 1 | // license:GPL-2.0+ 2 | // copyright-holders:Jarek Burczynski 3 | #ifndef MAME_SOUND_YMDELTAT_H 4 | #define MAME_SOUND_YMDELTAT_H 5 | 6 | #pragma once 7 | 8 | 9 | typedef void (*STATUS_CHANGE_HANDLER)(void *chip, uint8_t status_bits); 10 | 11 | 12 | /* DELTA-T (adpcm type B) struct */ 13 | struct YM_DELTAT { /* AT: rearranged and tightened structure */ 14 | enum { 15 | EMULATION_MODE_NORMAL = 0, 16 | EMULATION_MODE_YM2610 = 1, 17 | }; 18 | 19 | uint8_t *memory; 20 | int32_t *output_pointer;/* pointer of output pointers */ 21 | int32_t *pan; /* pan : &output_pointer[pan] */ 22 | double freqbase; 23 | #if 0 24 | double write_time; /* Y8950: 10 cycles of main clock; YM2608: 20 cycles of main clock */ 25 | double read_time; /* Y8950: 8 cycles of main clock; YM2608: 18 cycles of main clock */ 26 | #endif 27 | uint32_t memory_size; 28 | int output_range; 29 | uint32_t now_addr; /* current address */ 30 | uint32_t now_step; /* correct step */ 31 | uint32_t step; /* step */ 32 | uint32_t start; /* start address */ 33 | uint32_t limit; /* limit address */ 34 | uint32_t end; /* end address */ 35 | uint32_t delta; /* delta scale */ 36 | int32_t volume; /* current volume */ 37 | int32_t acc; /* shift Measurement value*/ 38 | int32_t adpcmd; /* next Forecast */ 39 | int32_t adpcml; /* current value */ 40 | int32_t prev_acc; /* leveling value */ 41 | uint8_t now_data; /* current rom data */ 42 | uint8_t CPU_data; /* current data from reg 08 */ 43 | uint8_t portstate; /* port status */ 44 | uint8_t control2; /* control reg: SAMPLE, DA/AD, RAM TYPE (x8bit / x1bit), ROM/RAM */ 45 | uint8_t portshift; /* address bits shift-left: 46 | ** 8 for YM2610, 47 | ** 5 for Y8950 and YM2608 */ 48 | 49 | uint8_t DRAMportshift; /* address bits shift-right: 50 | ** 0 for ROM and x8bit DRAMs, 51 | ** 3 for x1 DRAMs */ 52 | 53 | uint8_t memread; /* needed for reading/writing external memory */ 54 | 55 | /* handlers and parameters for the status flags support */ 56 | STATUS_CHANGE_HANDLER status_set_handler; 57 | STATUS_CHANGE_HANDLER status_reset_handler; 58 | 59 | /* note that different chips have these flags on different 60 | ** bits of the status register 61 | */ 62 | void * status_change_which_chip; /* this chip id */ 63 | uint8_t status_change_EOS_bit; /* 1 on End Of Sample (record/playback/cycle time of AD/DA converting has passed)*/ 64 | uint8_t status_change_BRDY_bit; /* 1 after recording 2 datas (2x4bits) or after reading/writing 1 data */ 65 | uint8_t status_change_ZERO_bit; /* 1 if silence lasts for more than 290 milliseconds on ADPCM recording */ 66 | 67 | /* neither Y8950 nor YM2608 can generate IRQ when PCMBSY bit changes, so instead of above, 68 | ** the statusflag gets ORed with PCM_BSY (below) (on each read of statusflag of Y8950 and YM2608) 69 | */ 70 | uint8_t PCM_BSY; /* 1 when ADPCM is playing; Y8950/YM2608 only */ 71 | 72 | uint8_t reg[16]; /* adpcm registers */ 73 | uint8_t emulation_mode; /* which chip we're emulating */ 74 | device_t *device; 75 | 76 | /*void BRDY_callback();*/ 77 | 78 | uint8_t ADPCM_Read(); 79 | void ADPCM_Write(int r, int v); 80 | void ADPCM_Reset(int panidx, int mode, device_t *dev); 81 | void ADPCM_CALC(); 82 | 83 | void postload(uint8_t *regs); 84 | void savestate(device_t *device); 85 | }; 86 | 87 | #endif // MAME_SOUND_YMDELTAT_H 88 | -------------------------------------------------------------------------------- /src/hardware/mame/ymf262.h: -------------------------------------------------------------------------------- 1 | // license:GPL-2.0+ 2 | // copyright-holders:Jarek Burczynski 3 | #ifndef MAME_SOUND_YMF262_H 4 | #define MAME_SOUND_YMF262_H 5 | 6 | #pragma once 7 | 8 | /* select number of output bits: 8 or 16 */ 9 | #define OPL3_SAMPLE_BITS 16 10 | 11 | typedef stream_sample_t OPL3SAMPLE; 12 | /* 13 | #if (OPL3_SAMPLE_BITS==16) 14 | typedef int16_t OPL3SAMPLE; 15 | #endif 16 | #if (OPL3_SAMPLE_BITS==8) 17 | typedef int8_t OPL3SAMPLE; 18 | #endif 19 | */ 20 | 21 | typedef void (*OPL3_TIMERHANDLER)(device_t *device,int timer,const attotime &period); 22 | typedef void (*OPL3_IRQHANDLER)(device_t *device,int irq); 23 | typedef void (*OPL3_UPDATEHANDLER)(device_t *device,int min_interval_us); 24 | 25 | 26 | void *ymf262_init(device_t *device, int clock, int rate); 27 | void ymf262_post_load(void *chip); 28 | void ymf262_shutdown(void *chip); 29 | void ymf262_reset_chip(void *chip); 30 | int ymf262_write(void *chip, int a, int v); 31 | unsigned char ymf262_read(void *chip, int a); 32 | int ymf262_timer_over(void *chip, int c); 33 | void ymf262_update_one(void *chip, OPL3SAMPLE **buffers, int length); 34 | 35 | void ymf262_set_timer_handler(void *chip, OPL3_TIMERHANDLER TimerHandler, device_t *device); 36 | void ymf262_set_irq_handler(void *chip, OPL3_IRQHANDLER IRQHandler, device_t *device); 37 | void ymf262_set_update_handler(void *chip, OPL3_UPDATEHANDLER UpdateHandler, device_t *device); 38 | 39 | 40 | #endif // MAME_SOUND_YMF262_H 41 | -------------------------------------------------------------------------------- /src/hardware/pci_devices.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | -------------------------------------------------------------------------------- /src/hardware/serialport/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = -I$(top_srcdir)/include 2 | 3 | noinst_LIBRARIES = libserial.a 4 | 5 | libserial_a_SOURCES = directserial.cpp directserial.h \ 6 | libserial.cpp libserial.h \ 7 | serialdummy.cpp serialdummy.h serialport.cpp \ 8 | softmodem.cpp softmodem.h misc_util.cpp misc_util.h \ 9 | nullmodem.cpp nullmodem.h 10 | -------------------------------------------------------------------------------- /src/hardware/serialport/directserial.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | 20 | // include guard 21 | #ifndef DOSBOX_DIRECTSERIAL_WIN32_H 22 | #define DOSBOX_DIRECTSERIAL_WIN32_H 23 | 24 | #include "dosbox.h" 25 | 26 | #if C_DIRECTSERIAL 27 | 28 | #define DIRECTSERIAL_AVAILIBLE 29 | #include "serialport.h" 30 | 31 | #include "libserial.h" 32 | 33 | class CDirectSerial : public CSerial { 34 | public: 35 | CDirectSerial(Bitu id, CommandLine* cmd); 36 | ~CDirectSerial(); 37 | 38 | void updatePortConfig(Bit16u divider, Bit8u lcr); 39 | void updateMSR(); 40 | void transmitByte(Bit8u val, bool first); 41 | void setBreak(bool value); 42 | 43 | void setRTSDTR(bool rts, bool dtr); 44 | void setRTS(bool val); 45 | void setDTR(bool val); 46 | void handleUpperEvent(Bit16u type); 47 | 48 | private: 49 | COMPORT comport; 50 | 51 | Bitu rx_state; 52 | #define D_RX_IDLE 0 53 | #define D_RX_WAIT 1 54 | #define D_RX_BLOCKED 2 55 | #define D_RX_FASTWAIT 3 56 | 57 | Bitu rx_retry; // counter of retries (every millisecond) 58 | Bitu rx_retry_max; // how many POLL_EVENTS to wait before causing 59 | // an overrun error. 60 | bool doReceive(); 61 | 62 | #if SERIAL_DEBUG 63 | bool dbgmsg_poll_block; 64 | bool dbgmsg_rx_block; 65 | #endif 66 | 67 | }; 68 | 69 | #endif // C_DIRECTSERIAL 70 | #endif // include guard 71 | -------------------------------------------------------------------------------- /src/hardware/serialport/libserial.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | 20 | typedef struct _COMPORT *COMPORT; 21 | 22 | bool SERIAL_open(const char* portname, COMPORT* port); 23 | void SERIAL_close(COMPORT port); 24 | void SERIAL_getErrorString(char* buffer, int length); 25 | 26 | #define SERIAL_1STOP 1 27 | #define SERIAL_2STOP 2 28 | #define SERIAL_15STOP 0 29 | 30 | // parity: n, o, e, m, s 31 | 32 | bool SERIAL_setCommParameters(COMPORT port, 33 | int baudrate, char parity, int stopbits, int length); 34 | 35 | void SERIAL_setDTR(COMPORT port, bool value); 36 | void SERIAL_setRTS(COMPORT port, bool value); 37 | void SERIAL_setBREAK(COMPORT port, bool value); 38 | 39 | #define SERIAL_CTS 0x10 40 | #define SERIAL_DSR 0x20 41 | #define SERIAL_RI 0x40 42 | #define SERIAL_CD 0x80 43 | 44 | int SERIAL_getmodemstatus(COMPORT port); 45 | bool SERIAL_setmodemcontrol(COMPORT port, int flags); 46 | 47 | bool SERIAL_sendchar(COMPORT port, char data); 48 | 49 | // 0-7 char data, higher=flags 50 | #define SERIAL_BREAK_ERR 0x10 51 | #define SERIAL_FRAMING_ERR 0x08 52 | #define SERIAL_PARITY_ERR 0x04 53 | #define SERIAL_OVERRUN_ERR 0x02 54 | 55 | int SERIAL_getextchar(COMPORT port); 56 | -------------------------------------------------------------------------------- /src/hardware/serialport/misc_util.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | 20 | #ifndef SDLNETWRAPPER_H 21 | #define SDLNETWRAPPER_H 22 | 23 | #ifndef DOSBOX_DOSBOX_H 24 | #include "dosbox.h" 25 | #endif 26 | 27 | #if C_MODEM 28 | 29 | # ifndef DOSBOX_SUPPORT_H 30 | #include "support.h" 31 | #endif 32 | 33 | // Netwrapper Capabilities 34 | #define NETWRAPPER_TCP 1 35 | #define NETWRAPPER_TCP_NATIVESOCKET 2 36 | 37 | #if defined WIN32 38 | #define NATIVESOCKETS 39 | #include 40 | #include //for socklen_t 41 | //typedef int socklen_t; 42 | 43 | //Tests for BSD/OS2/LINUX 44 | #elif defined HAVE_STDLIB_H && defined HAVE_SYS_TYPES_H && defined HAVE_SYS_SOCKET_H && defined HAVE_NETINET_IN_H 45 | #define NATIVESOCKETS 46 | #define SOCKET int 47 | #include //darwin 48 | #include //darwin 49 | #include 50 | #include 51 | #include 52 | //socklen_t should be handled by configure 53 | #endif 54 | 55 | #ifdef NATIVESOCKETS 56 | #define CAPWORD (NETWRAPPER_TCP|NETWRAPPER_TCP_NATIVESOCKET) 57 | #else 58 | #define CAPWORD NETWRAPPER_TCP 59 | #endif 60 | 61 | #include "SDL_net.h" 62 | 63 | 64 | 65 | Bit32u Netwrapper_GetCapabilities(); 66 | 67 | 68 | class TCPClientSocket { 69 | public: 70 | TCPClientSocket(TCPsocket source); 71 | TCPClientSocket(const char* destination, Bit16u port); 72 | #ifdef NATIVESOCKETS 73 | Bit8u* nativetcpstruct; 74 | TCPClientSocket(int platformsocket); 75 | #endif 76 | ~TCPClientSocket(); 77 | 78 | // return: 79 | // -1: no data 80 | // -2: socket closed 81 | // >0: data char 82 | Bits GetcharNonBlock(); 83 | 84 | 85 | bool Putchar(Bit8u data); 86 | bool SendArray(Bit8u* data, Bitu bufsize); 87 | bool ReceiveArray(Bit8u* data, Bitu* size); 88 | bool isopen; 89 | 90 | bool GetRemoteAddressString(Bit8u* buffer); 91 | 92 | void FlushBuffer(); 93 | void SetSendBufferSize(Bitu bufsize); 94 | 95 | // buffered send functions 96 | bool SendByteBuffered(Bit8u data); 97 | bool SendArrayBuffered(Bit8u* data, Bitu bufsize); 98 | 99 | private: 100 | TCPsocket mysock; 101 | SDLNet_SocketSet listensocketset; 102 | 103 | // Items for send buffering 104 | Bitu sendbuffersize; 105 | Bitu sendbufferindex; 106 | 107 | Bit8u* sendbuffer; 108 | }; 109 | 110 | class TCPServerSocket { 111 | public: 112 | bool isopen; 113 | TCPsocket mysock; 114 | TCPServerSocket(Bit16u port); 115 | ~TCPServerSocket(); 116 | TCPClientSocket* Accept(); 117 | }; 118 | 119 | 120 | #endif //C_MODEM 121 | 122 | #endif //# SDLNETWRAPPER_H 123 | -------------------------------------------------------------------------------- /src/hardware/serialport/nullmodem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | 20 | // include guard 21 | #ifndef DOSBOX_NULLMODEM_WIN32_H 22 | #define DOSBOX_NULLMODEM_WIN32_H 23 | 24 | #include "dosbox.h" 25 | 26 | #if C_MODEM 27 | 28 | #include "misc_util.h" 29 | #include "serialport.h" 30 | 31 | #define SERIAL_SERVER_POLLING_EVENT SERIAL_BASE_EVENT_COUNT+1 32 | #define SERIAL_TX_REDUCTION SERIAL_BASE_EVENT_COUNT+2 33 | #define SERIAL_NULLMODEM_DTR_EVENT SERIAL_BASE_EVENT_COUNT+3 34 | #define SERIAL_NULLMODEM_EVENT_COUNT SERIAL_BASE_EVENT_COUNT+3 35 | 36 | class CNullModem : public CSerial { 37 | public: 38 | CNullModem(Bitu id, CommandLine* cmd); 39 | ~CNullModem(); 40 | 41 | void updatePortConfig(Bit16u divider, Bit8u lcr); 42 | void updateMSR(); 43 | void transmitByte(Bit8u val, bool first); 44 | void setBreak(bool value); 45 | 46 | void setRTSDTR(bool rts, bool dtr); 47 | void setRTS(bool val); 48 | void setDTR(bool val); 49 | void handleUpperEvent(Bit16u type); 50 | 51 | private: 52 | TCPServerSocket* serversocket; 53 | TCPClientSocket* clientsocket; 54 | 55 | bool receiveblock; // It's not a block of data it rather blocks 56 | Bit16u serverport; // we are a server if this is nonzero 57 | Bit16u clientport; 58 | 59 | Bit8u hostnamebuffer[128]; // the name passed to us by the user 60 | 61 | Bitu rx_state; 62 | #define N_RX_IDLE 0 63 | #define N_RX_WAIT 1 64 | #define N_RX_BLOCKED 2 65 | #define N_RX_FASTWAIT 3 66 | #define N_RX_DISC 4 67 | 68 | bool doReceive(); 69 | bool ClientConnect(TCPClientSocket* newsocket); 70 | bool ServerListen(); 71 | bool ServerConnect(); 72 | void Disconnect(); 73 | Bits readChar(); 74 | void WriteChar(Bit8u data); 75 | 76 | bool DTR_delta; // with dtrrespect, we try to establish a connection 77 | // whenever DTR switches to 1. This variable is 78 | // used to remember the old state. 79 | 80 | bool tx_block; // true while the SERIAL_TX_REDUCTION event 81 | // is pending 82 | 83 | Bitu rx_retry; // counter of retries 84 | 85 | Bitu rx_retry_max; // how many POLL_EVENTS to wait before causing 86 | // a overrun error. 87 | 88 | Bitu tx_gather; // how long to gather tx data before 89 | // sending all of them [milliseconds] 90 | 91 | 92 | bool dtrrespect; // dtr behavior - only send data to the serial 93 | // port when DTR is on 94 | 95 | bool transparent; // if true, don't send 0xff 0xXX to toggle 96 | // DSR/CTS. 97 | 98 | bool telnet; // Do Telnet parsing. 99 | 100 | // Telnet's brain 101 | #define TEL_CLIENT 0 102 | #define TEL_SERVER 1 103 | 104 | Bits TelnetEmulation(Bit8u data); 105 | 106 | // Telnet's memory 107 | struct { 108 | bool binary[2]; 109 | bool echo[2]; 110 | bool supressGA[2]; 111 | bool timingMark[2]; 112 | 113 | bool inIAC; 114 | bool recCommand; 115 | Bit8u command; 116 | } telClient; 117 | }; 118 | 119 | #endif // C_MODEM 120 | #endif // include guard 121 | -------------------------------------------------------------------------------- /src/hardware/serialport/serialdummy.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | 20 | #include "dosbox.h" 21 | 22 | #include "setup.h" 23 | #include "serialdummy.h" 24 | #include "serialport.h" 25 | 26 | CSerialDummy::CSerialDummy(Bitu id, CommandLine* cmd):CSerial(id, cmd) { 27 | CSerial::Init_Registers(); 28 | setRI(false); 29 | setDSR(false); 30 | setCD(false); 31 | setCTS(false); 32 | InstallationSuccessful=true; 33 | } 34 | 35 | CSerialDummy::~CSerialDummy() { 36 | // clear events 37 | removeEvent(SERIAL_TX_EVENT); 38 | } 39 | 40 | void CSerialDummy::handleUpperEvent(Bit16u type) { 41 | if(type==SERIAL_TX_EVENT) { 42 | //LOG_MSG("SERIAL_TX_EVENT"); 43 | #ifdef CHECKIT_TESTPLUG 44 | receiveByte(loopbackdata); 45 | #endif 46 | ByteTransmitted(); // tx timeout 47 | } 48 | else if(type==SERIAL_THR_EVENT){ 49 | //LOG_MSG("SERIAL_THR_EVENT"); 50 | ByteTransmitting(); 51 | setEvent(SERIAL_TX_EVENT,bytetime); 52 | } 53 | 54 | } 55 | 56 | /*****************************************************************************/ 57 | /* updatePortConfig is called when emulated app changes the serial port **/ 58 | /* parameters baudrate, stopbits, number of databits, parity. **/ 59 | /*****************************************************************************/ 60 | void CSerialDummy::updatePortConfig(Bit16u divider, Bit8u lcr) { 61 | //LOG_MSG("Serial port at 0x%x: Port params changed: %d Baud", base,dcb.BaudRate); 62 | } 63 | 64 | void CSerialDummy::updateMSR() { 65 | } 66 | void CSerialDummy::transmitByte(Bit8u val, bool first) { 67 | 68 | if(first) setEvent(SERIAL_THR_EVENT, bytetime/10); 69 | else setEvent(SERIAL_TX_EVENT, bytetime); 70 | 71 | #ifdef CHECKIT_TESTPLUG 72 | loopbackdata=val; 73 | #endif 74 | } 75 | 76 | /*****************************************************************************/ 77 | /* setBreak(val) switches break on or off **/ 78 | /*****************************************************************************/ 79 | 80 | void CSerialDummy::setBreak(bool value) { 81 | //LOG_MSG("UART 0x%x: Break toggeled: %d", base, value); 82 | } 83 | 84 | /*****************************************************************************/ 85 | /* setRTSDTR sets the modem control lines **/ 86 | /*****************************************************************************/ 87 | void CSerialDummy::setRTSDTR(bool rts, bool dtr) { 88 | setRTS(rts); 89 | setDTR(dtr); 90 | } 91 | void CSerialDummy::setRTS(bool val) { 92 | #ifdef CHECKIT_TESTPLUG 93 | setCTS(val); 94 | #endif 95 | } 96 | void CSerialDummy::setDTR(bool val) { 97 | #ifdef CHECKIT_TESTPLUG 98 | setDSR(val); 99 | setRI(val); 100 | setCD(val); 101 | #endif 102 | } 103 | -------------------------------------------------------------------------------- /src/hardware/serialport/serialdummy.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | 20 | #ifndef INCLUDEGUARD_SERIALDUMMY_H 21 | #define INCLUDEGUARD_SERIALDUMMY_H 22 | 23 | #include "serialport.h" 24 | 25 | //#define CHECKIT_TESTPLUG 26 | 27 | class CSerialDummy : public CSerial { 28 | public: 29 | CSerialDummy(Bitu id, CommandLine* cmd); 30 | ~CSerialDummy(); 31 | 32 | void setRTSDTR(bool rts, bool dtr); 33 | void setRTS(bool val); 34 | void setDTR(bool val); 35 | 36 | void updatePortConfig(Bit16u, Bit8u lcr); 37 | void updateMSR(); 38 | void transmitByte(Bit8u val, bool first); 39 | void setBreak(bool value); 40 | void handleUpperEvent(Bit16u type); 41 | 42 | #ifdef CHECKIT_TESTPLUG 43 | Bit8u loopbackdata; 44 | #endif 45 | 46 | }; 47 | 48 | #endif // INCLUDEGUARD 49 | -------------------------------------------------------------------------------- /src/ints/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = -I$(top_srcdir)/include 2 | 3 | noinst_LIBRARIES = libints.a 4 | libints_a_SOURCES = mouse.cpp xms.cpp xms.h ems.cpp \ 5 | int10.cpp int10.h int10_char.cpp int10_memory.cpp int10_misc.cpp int10_modes.cpp \ 6 | int10_vesa.cpp int10_pal.cpp int10_put_pixel.cpp int10_video_state.cpp int10_vptable.cpp \ 7 | bios.cpp bios_disk.cpp bios_keyboard.cpp 8 | -------------------------------------------------------------------------------- /src/ints/xms.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | #ifndef __XMS_H__ 20 | #define __XMS_H__ 21 | 22 | Bitu XMS_QueryFreeMemory (Bit16u& largestFree, Bit16u& totalFree); 23 | Bitu XMS_AllocateMemory (Bitu size, Bit16u& handle); 24 | Bitu XMS_FreeMemory (Bitu handle); 25 | Bitu XMS_MoveMemory (PhysPt bpt); 26 | Bitu XMS_LockMemory (Bitu handle, Bit32u& address); 27 | Bitu XMS_UnlockMemory (Bitu handle); 28 | Bitu XMS_GetHandleInformation(Bitu handle, Bit8u& lockCount, Bit8u& numFree, Bit16u& size); 29 | Bitu XMS_ResizeMemory (Bitu handle, Bitu newSize); 30 | 31 | Bitu XMS_EnableA20 (bool enable); 32 | Bitu XMS_GetEnabledA20 (void); 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/libs/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = -I$(top_srcdir)/include 2 | 3 | SUBDIRS = zmbv gui_tk 4 | -------------------------------------------------------------------------------- /src/libs/gui_tk/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = -I$(top_srcdir)/include 2 | 3 | noinst_LIBRARIES = libgui_tk.a 4 | libgui_tk_a_SOURCES = gui_tk.cpp gui_tk.h 5 | -------------------------------------------------------------------------------- /src/libs/zmbv/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = zmbv.cpp zmbv.h 2 | -------------------------------------------------------------------------------- /src/libs/zmbv/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by zmbv_vfw.rc 4 | // 5 | #define IDD_ABOUT 101 6 | #define IDD_CONFIGURE 102 7 | #define IDC_HOMEPAGE 1000 8 | #define IDC_EMAIL 1001 9 | #define IDC_SLIDER1 1008 10 | 11 | // Next default values for new objects 12 | // 13 | #ifdef APSTUDIO_INVOKED 14 | #ifndef APSTUDIO_READONLY_SYMBOLS 15 | #define _APS_NO_MFC 1 16 | #define _APS_NEXT_RESOURCE_VALUE 103 17 | #define _APS_NEXT_COMMAND_VALUE 40001 18 | #define _APS_NEXT_CONTROL_VALUE 1009 19 | #define _APS_NEXT_SYMED_VALUE 101 20 | #endif 21 | #endif 22 | -------------------------------------------------------------------------------- /src/libs/zmbv/zmbv.def: -------------------------------------------------------------------------------- 1 | LIBRARY ZMBV 2 | 3 | EXPORTS 4 | DriverProc 5 | -------------------------------------------------------------------------------- /src/libs/zmbv/zmbv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | #ifndef DOSBOX_DOSBOX_H 20 | #ifdef _MSC_VER 21 | #define INLINE __forceinline 22 | #else 23 | #define INLINE inline 24 | #endif 25 | #endif 26 | 27 | #define CODEC_4CC "ZMBV" 28 | 29 | typedef enum { 30 | ZMBV_FORMAT_NONE = 0x00, 31 | ZMBV_FORMAT_1BPP = 0x01, 32 | ZMBV_FORMAT_2BPP = 0x02, 33 | ZMBV_FORMAT_4BPP = 0x03, 34 | ZMBV_FORMAT_8BPP = 0x04, 35 | ZMBV_FORMAT_15BPP = 0x05, 36 | ZMBV_FORMAT_16BPP = 0x06, 37 | ZMBV_FORMAT_24BPP = 0x07, 38 | ZMBV_FORMAT_32BPP = 0x08 39 | } zmbv_format_t; 40 | 41 | void Msg(const char fmt[], ...); 42 | class VideoCodec { 43 | private: 44 | struct FrameBlock { 45 | int start; 46 | int dx,dy; 47 | }; 48 | struct CodecVector { 49 | int x,y; 50 | int slot; 51 | }; 52 | struct KeyframeHeader { 53 | unsigned char high_version; 54 | unsigned char low_version; 55 | unsigned char compression; 56 | unsigned char format; 57 | unsigned char blockwidth,blockheight; 58 | }; 59 | 60 | struct { 61 | int linesDone; 62 | int writeSize; 63 | int writeDone; 64 | unsigned char *writeBuf; 65 | } compress; 66 | 67 | CodecVector VectorTable[512]; 68 | int VectorCount; 69 | 70 | unsigned char *oldframe, *newframe; 71 | unsigned char *buf1, *buf2, *work; 72 | int bufsize; 73 | 74 | int blockcount; 75 | FrameBlock * blocks; 76 | 77 | int workUsed, workPos; 78 | 79 | int palsize; 80 | char palette[256*4]; 81 | int height, width, pitch; 82 | zmbv_format_t format; 83 | int pixelsize; 84 | 85 | z_stream zstream; 86 | 87 | // methods 88 | void FreeBuffers(void); 89 | void CreateVectorTable(void); 90 | bool SetupBuffers(zmbv_format_t format, int blockwidth, int blockheight); 91 | 92 | template 93 | void AddXorFrame(void); 94 | template 95 | void UnXorFrame(void); 96 | template 97 | INLINE int PossibleBlock(int vx,int vy,FrameBlock * block); 98 | template 99 | INLINE int CompareBlock(int vx,int vy,FrameBlock * block); 100 | template 101 | INLINE void AddXorBlock(int vx,int vy,FrameBlock * block); 102 | template 103 | INLINE void UnXorBlock(int vx,int vy,FrameBlock * block); 104 | template 105 | INLINE void CopyBlock(int vx, int vy,FrameBlock * block); 106 | public: 107 | VideoCodec(); 108 | bool SetupCompress( int _width, int _height); 109 | bool SetupDecompress( int _width, int _height); 110 | zmbv_format_t BPPFormat( int bpp ); 111 | int NeededSize( int _width, int _height, zmbv_format_t _format); 112 | 113 | void CompressLines(int lineCount, void *lineData[]); 114 | bool PrepareCompressFrame(int flags, zmbv_format_t _format, char * pal, void *writeBuf, int writeSize); 115 | int FinishCompressFrame( void ); 116 | bool DecompressFrame(void * framedata, int size); 117 | void Output_UpsideDown_24(void * output); 118 | }; 119 | -------------------------------------------------------------------------------- /src/libs/zmbv/zmbv.inf: -------------------------------------------------------------------------------- 1 | [Version] 2 | Signature="$CHICAGO$" 3 | Provider=%ZMBV_PUBLISHER% 4 | Class=MEDIA 5 | 6 | 7 | [DefaultInstall] 8 | CopyFiles=ZMBV.Files.Inf,ZMBV.Files.Dll 9 | AddReg=ZMBV.Reg9x 10 | UpdateInis=ZMBV.INIs 11 | 12 | [DefaultInstall.ntx86] 13 | CopyFiles=ZMBV.Files.Inf,ZMBV.Files.Dll 14 | AddReg=ZMBV.RegNTx86 15 | UpdateInis=ZMBV.INIs 16 | 17 | [DefaultInstall.ntamd64] 18 | CopyFiles=ZMBV.Files.Inf,ZMBV.Files.Dll.NTamd64 19 | AddReg=ZMBV.RegNTamd64 20 | UpdateInis=ZMBV.INIs 21 | 22 | [DefaultUnInstall] 23 | DelFiles=ZMBV.Files.Dll,ZMBV.Files.Inf,ZMBV.Files.Ini 24 | DelReg=ZMBV.Reg9x 25 | UpdateInis=ZMBV.INIs.Del 26 | 27 | [DefaultUnInstall.ntx86] 28 | DelFiles=ZMBV.Files.Dll,ZMBV.Files.Inf,ZMBV.Files.Ini 29 | DelReg=ZMBV.RegNTx86 30 | UpdateInis=ZMBV.INIs.Del 31 | 32 | [DefaultUnInstall.ntamd64] 33 | DelFiles=ZMBV.Files.Dll.NTamd64,ZMBV.Files.Inf,ZMBV.Files.Ini 34 | DelReg=ZMBV.RegNTamd64 35 | UpdateInis=ZMBV.INIs.Del 36 | 37 | [SourceDisksNames] 38 | 1="Zip Motion Block Video codec","",1 39 | 40 | [SourceDisksFiles] 41 | ZMBV.INF=1 42 | 43 | [DestinationDirs] 44 | ZMBV.Files.Inf=17 45 | ZMBV.Files.Dll=11 46 | ZMBV.Files.Dll.NTamd64=10,SysWOW64 47 | ZMBV.Files.Ini=25 48 | 49 | [ZMBV.Files.Inf] 50 | zmbv.inf 51 | 52 | [ZMBV.Files.Dll] 53 | zmbv.dll 54 | 55 | [ZMBV.Files.Dll.NTamd64] 56 | zmbv.dll 57 | 58 | [ZMBV.Files.Ini] 59 | zmbv.ini 60 | 61 | [ZMBV.Reg9x] 62 | HKLM,SYSTEM\CurrentControlSet\Control\MediaResources\icm\VIDC.ZMBV,Description,,"%ZMBV_DISPLAY_NAME%" 63 | HKLM,SYSTEM\CurrentControlSet\Control\MediaResources\icm\VIDC.ZMBV,Driver,,"zmbv.dll" 64 | HKLM,SYSTEM\CurrentControlSet\Control\MediaResources\icm\VIDC.ZMBV,FriendlyName,,"%ZMBV_DISPLAY_NAME%" 65 | 66 | HKLM,Software\Microsoft\Windows\CurrentVersion\Uninstall\ZMBV 67 | HKLM,Software\Microsoft\Windows\CurrentVersion\Uninstall\ZMBV,DisplayName,,"%ZMBV_UNINST_DISPLAY_NAME%" 68 | HKLM,Software\Microsoft\Windows\CurrentVersion\Uninstall\ZMBV,UninstallString,,"rundll.exe setupx.dll,InstallHinfSection DefaultUninstall 132 %17%\ZMBV.INF" 69 | 70 | [ZMBV.RegNTx86] 71 | HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion\drivers.desc,zmbv.dll,,"%ZMBV_DISPLAY_NAME%" 72 | HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion\drivers32,vidc.zmbv,,zmbv.dll 73 | 74 | HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ZMBV 75 | HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ZMBV,DisplayName,,"%ZMBV_UNINST_DISPLAY_NAME%" 76 | HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ZMBV,Publisher,,"%ZMBV_PUBLISHER%" 77 | HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ZMBV,URLInfoAbout,,"%ZMBV_URL_HOMEPAGE%" 78 | HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ZMBV,NoRepair,0x10001,01,00,00,00 79 | HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ZMBV,NoModify,0x10001,01,00,00,00 80 | HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ZMBV,UninstallString,,"rundll32.exe setupapi,InstallHinfSection DefaultUninstall 132 %17%\ZMBV.INF" 81 | 82 | [ZMBV.RegNTamd64] 83 | HKLM,SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\drivers.desc,zmbv.dll,,"%ZMBV_DISPLAY_NAME%" 84 | HKLM,SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\drivers32,vidc.zmbv,,zmbv.dll 85 | 86 | HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ZMBV 87 | HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ZMBV,DisplayName,,"%ZMBV_UNINST_DISPLAY_NAME%" 88 | HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ZMBV,Publisher,,"%ZMBV_PUBLISHER%" 89 | HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ZMBV,URLInfoAbout,,"%ZMBV_URL_HOMEPAGE%" 90 | HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ZMBV,NoRepair,0x10001,01,00,00,00 91 | HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ZMBV,NoModify,0x10001,01,00,00,00 92 | HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ZMBV,UninstallString,,"rundll32.exe setupapi.dll,InstallHinfSection DefaultUninstall 132 %17%\ZMBV.INF" 93 | 94 | [ZMBV.INIs] 95 | system.ini, drivers32,, "VIDC.ZMBV=zmbv.dll" 96 | 97 | [ZMBV.INIs.Del] 98 | system.ini, drivers32, "VIDC.ZMBV=zmbv.dll" 99 | 100 | [Strings] 101 | ZMBV_PUBLISHER = "DOSBox Team" 102 | ZMBV_DISPLAY_NAME = "Zip Motion Block Video [ZMBV]" 103 | ZMBV_UNINST_DISPLAY_NAME = "Zip Motion Block Video codec (Remove Only)" 104 | ZMBV_URL_HOMEPAGE = "http://www.dosbox.com/" 105 | CODEC_INSTALLATION_FINISHED = "Zip Motion Block Video codec installation is complete." 106 | -------------------------------------------------------------------------------- /src/libs/zmbv/zmbv.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 8.00 2 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zmbv", "zmbv.vcproj", "{619CF3F9-C373-4BD5-93DA-025F5E16F8FA}" 3 | ProjectSection(ProjectDependencies) = postProject 4 | EndProjectSection 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfiguration) = preSolution 8 | Debug = Debug 9 | Release = Release 10 | EndGlobalSection 11 | GlobalSection(ProjectConfiguration) = postSolution 12 | {619CF3F9-C373-4BD5-93DA-025F5E16F8FA}.Debug.ActiveCfg = Debug|Win32 13 | {619CF3F9-C373-4BD5-93DA-025F5E16F8FA}.Debug.Build.0 = Debug|Win32 14 | {619CF3F9-C373-4BD5-93DA-025F5E16F8FA}.Release.ActiveCfg = Release|Win32 15 | {619CF3F9-C373-4BD5-93DA-025F5E16F8FA}.Release.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(ExtensibilityGlobals) = postSolution 18 | EndGlobalSection 19 | GlobalSection(ExtensibilityAddIns) = postSolution 20 | EndGlobalSection 21 | EndGlobal 22 | -------------------------------------------------------------------------------- /src/libs/zmbv/zmbv.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 11 | 12 | 13 | 19 | 31 | 33 | 43 | 45 | 47 | 49 | 51 | 53 | 55 | 57 | 59 | 61 | 63 | 64 | 70 | 78 | 80 | 92 | 94 | 96 | 98 | 100 | 102 | 104 | 106 | 108 | 110 | 112 | 113 | 114 | 115 | 116 | 117 | 119 | 120 | 122 | 123 | 125 | 126 | 128 | 129 | 131 | 132 | 134 | 135 | 137 | 138 | 139 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /src/libs/zmbv/zmbv_vfw.h: -------------------------------------------------------------------------------- 1 | // 2 | // Huffyuv v2.1.1, by Ben Rudiak-Gould. 3 | // http://www.math.berkeley.edu/~benrg/huffyuv.html 4 | // 5 | // This file is copyright 2000 Ben Rudiak-Gould, and distributed under 6 | // the terms of the GNU General Public License, v2 or later. See 7 | // http://www.gnu.org/copyleft/gpl.html. 8 | // 9 | // I edit these files in 10-point Verdana, a proportionally-spaced font. 10 | // You may notice formatting oddities if you use a monospaced font. 11 | // 12 | 13 | 14 | #include 15 | #include 16 | #include 17 | #include "zmbv.h" 18 | #pragma hdrstop 19 | 20 | extern HMODULE hmoduleCodec; 21 | 22 | 23 | // huffyuv.cpp 24 | 25 | class CodecInst { 26 | private: 27 | VideoCodec * codec; 28 | public: 29 | CodecInst(); 30 | ~CodecInst(); 31 | 32 | BOOL QueryAbout(); 33 | DWORD About(HWND hwnd); 34 | 35 | BOOL QueryConfigure(); 36 | DWORD Configure(HWND hwnd); 37 | 38 | DWORD GetState(LPVOID pv, DWORD dwSize); 39 | DWORD SetState(LPVOID pv, DWORD dwSize); 40 | 41 | DWORD GetInfo(ICINFO* icinfo, DWORD dwSize); 42 | 43 | DWORD CompressQuery(LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut); 44 | DWORD CompressGetFormat(LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut); 45 | DWORD CompressBegin(LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut); 46 | DWORD CompressGetSize(LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut); 47 | DWORD Compress(ICCOMPRESS* icinfo, DWORD dwSize); 48 | DWORD CompressEnd(); 49 | 50 | DWORD DecompressQuery(LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut); 51 | DWORD DecompressGetFormat(LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut); 52 | DWORD DecompressBegin(LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut); 53 | 54 | DWORD Decompress(ICDECOMPRESS* icinfo, DWORD dwSize); 55 | DWORD DecompressGetPalette(LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut); 56 | DWORD DecompressEnd(); 57 | }; 58 | 59 | CodecInst* Open(ICOPEN* icinfo); 60 | DWORD Close(CodecInst* pinst); 61 | 62 | -------------------------------------------------------------------------------- /src/libs/zmbv/zmbv_vfw.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #include "winres.h" 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | #undef APSTUDIO_READONLY_SYMBOLS 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // English (U.S.) resources 17 | 18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 19 | #ifdef _WIN32 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | #pragma code_page(1252) 22 | #endif //_WIN32 23 | 24 | #ifdef APSTUDIO_INVOKED 25 | ///////////////////////////////////////////////////////////////////////////// 26 | // 27 | // TEXTINCLUDE 28 | // 29 | 30 | 1 TEXTINCLUDE 31 | BEGIN 32 | "resource.h\0" 33 | END 34 | 35 | 2 TEXTINCLUDE 36 | BEGIN 37 | "#include ""winres.h""\r\n" 38 | "\0" 39 | END 40 | 41 | 3 TEXTINCLUDE 42 | BEGIN 43 | "\r\n" 44 | "\0" 45 | END 46 | 47 | #endif // APSTUDIO_INVOKED 48 | 49 | 50 | ///////////////////////////////////////////////////////////////////////////// 51 | // 52 | // Dialog 53 | // 54 | 55 | IDD_ABOUT DIALOGEX 0, 0, 167, 55 56 | STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | 57 | WS_SYSMENU 58 | CAPTION "DOSBox Video Codec v0.1" 59 | FONT 8, "MS Sans Serif", 0, 0, 0x0 60 | BEGIN 61 | DEFPUSHBUTTON "OK",IDOK,131,34,29,14 62 | CTEXT "Zipped Motion Block Video v 0.1\nCopyright 2009-2019 DOSBox Team", 63 | IDC_STATIC,7,7,153,25,SS_NOPREFIX 64 | PUSHBUTTON "Email author",IDC_EMAIL,7,34,50,14 65 | PUSHBUTTON "Visit home page",IDC_HOMEPAGE,59,34,58,14 66 | END 67 | 68 | IDD_CONFIGURE DIALOGEX 0, 0, 213, 146 69 | STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | 70 | WS_SYSMENU 71 | CAPTION "ZMBV configuration dialog" 72 | FONT 8, "MS Sans Serif", 0, 0, 0x0 73 | BEGIN 74 | PUSHBUTTON "Email author",IDC_EMAIL,44,86,50,14 75 | PUSHBUTTON "Visit home page",IDC_HOMEPAGE,109,87,58,14 76 | DEFPUSHBUTTON "OK",IDOK,44,125,50,14 77 | PUSHBUTTON "Cancel",IDCANCEL,117,125,50,14 78 | CONTROL "",IDC_SLIDER1,"msctls_trackbar32",TBS_BOTH | 79 | TBS_NOTICKS | WS_TABSTOP,57,30,92,18 80 | END 81 | 82 | 83 | ///////////////////////////////////////////////////////////////////////////// 84 | // 85 | // DESIGNINFO 86 | // 87 | 88 | #ifdef APSTUDIO_INVOKED 89 | GUIDELINES DESIGNINFO 90 | BEGIN 91 | IDD_ABOUT, DIALOG 92 | BEGIN 93 | LEFTMARGIN, 7 94 | RIGHTMARGIN, 160 95 | TOPMARGIN, 7 96 | BOTTOMMARGIN, 48 97 | END 98 | 99 | IDD_CONFIGURE, DIALOG 100 | BEGIN 101 | LEFTMARGIN, 44 102 | RIGHTMARGIN, 167 103 | TOPMARGIN, 6 104 | BOTTOMMARGIN, 139 105 | END 106 | END 107 | #endif // APSTUDIO_INVOKED 108 | 109 | #endif // English (U.S.) resources 110 | ///////////////////////////////////////////////////////////////////////////// 111 | 112 | 113 | 114 | #ifndef APSTUDIO_INVOKED 115 | ///////////////////////////////////////////////////////////////////////////// 116 | // 117 | // Generated from the TEXTINCLUDE 3 resource. 118 | // 119 | 120 | 121 | ///////////////////////////////////////////////////////////////////////////// 122 | #endif // not APSTUDIO_INVOKED 123 | 124 | -------------------------------------------------------------------------------- /src/misc/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = -I$(top_srcdir)/include 2 | 3 | noinst_LIBRARIES = libmisc.a 4 | libmisc_a_SOURCES = cross.cpp messages.cpp programs.cpp setup.cpp support.cpp 5 | -------------------------------------------------------------------------------- /src/misc/messages.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2002-2019 The DOSBox Team 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License along 15 | * with this program; if not, write to the Free Software Foundation, Inc., 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | 20 | #include 21 | #include 22 | #include 23 | #include "dosbox.h" 24 | #include "cross.h" 25 | #include "support.h" 26 | #include "setup.h" 27 | #include "control.h" 28 | #include 29 | #include 30 | using namespace std; 31 | 32 | 33 | 34 | #define LINE_IN_MAXLEN 2048 35 | 36 | struct MessageBlock { 37 | string name; 38 | string val; 39 | MessageBlock(const char* _name, const char* _val): 40 | name(_name),val(_val){} 41 | }; 42 | 43 | static list Lang; 44 | typedef list::iterator itmb; 45 | 46 | void MSG_Add(const char * _name, const char* _val) { 47 | /* Find the message */ 48 | for(itmb tel=Lang.begin();tel!=Lang.end();tel++) { 49 | if((*tel).name==_name) { 50 | // LOG_MSG("double entry for %s",_name); //Message file might be loaded before default text messages 51 | return; 52 | } 53 | } 54 | /* if the message doesn't exist add it */ 55 | Lang.push_back(MessageBlock(_name,_val)); 56 | } 57 | 58 | void MSG_Replace(const char * _name, const char* _val) { 59 | /* Find the message */ 60 | for(itmb tel=Lang.begin();tel!=Lang.end();tel++) { 61 | if((*tel).name==_name) { 62 | Lang.erase(tel); 63 | break; 64 | } 65 | } 66 | /* Even if the message doesn't exist add it */ 67 | Lang.push_back(MessageBlock(_name,_val)); 68 | } 69 | 70 | static void LoadMessageFile(const char * fname) { 71 | if (!fname) return; 72 | if(*fname=='\0') return;//empty string=no languagefile 73 | FILE * mfile=fopen(fname,"rt"); 74 | /* This should never happen and since other modules depend on this use a normal printf */ 75 | if (!mfile) { 76 | E_Exit("MSG:Can't load messages: %s",fname); 77 | } 78 | char linein[LINE_IN_MAXLEN]; 79 | char name[LINE_IN_MAXLEN]; 80 | char string[LINE_IN_MAXLEN*10]; 81 | /* Start out with empty strings */ 82 | name[0]=0;string[0]=0; 83 | while(fgets(linein, LINE_IN_MAXLEN, mfile)!=0) { 84 | /* Parse the read line */ 85 | /* First remove characters 10 and 13 from the line */ 86 | char * parser=linein; 87 | char * writer=linein; 88 | while (*parser) { 89 | if (*parser!=10 && *parser!=13) { 90 | *writer++=*parser; 91 | } 92 | parser++; 93 | } 94 | *writer=0; 95 | /* New string name */ 96 | if (linein[0]==':') { 97 | string[0]=0; 98 | strcpy(name,linein+1); 99 | /* End of string marker */ 100 | } else if (linein[0]=='.') { 101 | /* Replace/Add the string to the internal languagefile */ 102 | /* Remove last newline (marker is \n.\n) */ 103 | size_t ll = strlen(string); 104 | if(ll && string[ll - 1] == '\n') string[ll - 1] = 0; //Second if should not be needed, but better be safe. 105 | MSG_Replace(name,string); 106 | } else { 107 | /* Normal string to be added */ 108 | strcat(string,linein); 109 | strcat(string,"\n"); 110 | } 111 | } 112 | fclose(mfile); 113 | } 114 | 115 | const char * MSG_Get(char const * msg) { 116 | for(itmb tel=Lang.begin();tel!=Lang.end();tel++){ 117 | if((*tel).name==msg) 118 | { 119 | return (*tel).val.c_str(); 120 | } 121 | } 122 | return "Message not Found!\n"; 123 | } 124 | 125 | 126 | bool MSG_Write(const char * location) { 127 | FILE* out=fopen(location,"w+t"); 128 | if(out==NULL) return false;//maybe an error? 129 | for(itmb tel=Lang.begin();tel!=Lang.end();tel++){ 130 | fprintf(out,":%s\n%s\n.\n",(*tel).name.c_str(),(*tel).val.c_str()); 131 | } 132 | fclose(out); 133 | return true; 134 | } 135 | 136 | void MSG_Init(Section_prop * section) { 137 | std::string file_name; 138 | if (control->cmdline->FindString("-lang",file_name,true)) { 139 | LoadMessageFile(file_name.c_str()); 140 | } else { 141 | Prop_path* pathprop = section->Get_path("language"); 142 | if(pathprop) LoadMessageFile(pathprop->realpath.c_str()); 143 | } 144 | } 145 | -------------------------------------------------------------------------------- /src/platform/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = visualc 2 | 3 | EXTRA_DIST = sdl-win32.diff -------------------------------------------------------------------------------- /src/platform/sdl-win32.diff: -------------------------------------------------------------------------------- 1 | diff -ru SDL-1.2.12/src/main/win32/version.rc SDL-1.2.12release/src/main/win32/version.rc 2 | --- SDL-1.2.12/src/main/win32/version.rc 2007-07-20 07:52:05.000000000 +0200 3 | +++ SDL-1.2.12release/src/main/win32/version.rc 2007-08-17 19:03:42.000000000 +0200 4 | @@ -13,7 +13,7 @@ 5 | FILEVERSION 1,2,12,0 6 | PRODUCTVERSION 1,2,12,0 7 | FILEFLAGSMASK 0x3fL 8 | - FILEFLAGS 0x0L 9 | + FILEFLAGS 0x4L 10 | FILEOS 0x40004L 11 | FILETYPE 0x2L 12 | FILESUBTYPE 0x0L 13 | diff -ru SDL-1.2.12/src/video/SDL_video.c SDL-1.2.12release/src/video/SDL_video.c 14 | --- SDL-1.2.12/src/video/SDL_video.c 2007-07-20 07:52:25.000000000 +0200 15 | +++ SDL-1.2.12release/src/video/SDL_video.c 2007-08-17 02:51:52.000000000 +0200 16 | @@ -75,12 +75,12 @@ 17 | #if SDL_VIDEO_DRIVER_GAPI 18 | &GAPI_bootstrap, 19 | #endif 20 | -#if SDL_VIDEO_DRIVER_WINDIB 21 | - &WINDIB_bootstrap, 22 | -#endif 23 | #if SDL_VIDEO_DRIVER_DDRAW 24 | &DIRECTX_bootstrap, 25 | #endif 26 | +#if SDL_VIDEO_DRIVER_WINDIB 27 | + &WINDIB_bootstrap, 28 | +#endif 29 | #if SDL_VIDEO_DRIVER_BWINDOW 30 | &BWINDOW_bootstrap, 31 | #endif 32 | diff -ru SDL-1.2.12/src/video/windx5/SDL_dx5events.c SDL-1.2.12release/src/video/windx5/SDL_dx5events.c 33 | --- SDL-1.2.12/src/video/windx5/SDL_dx5events.c 2007-07-20 07:52:25.000000000 +0200 34 | +++ SDL-1.2.12release/src/video/windx5/SDL_dx5events.c 2007-08-17 02:51:52.000000000 +0200 35 | @@ -519,7 +519,7 @@ 36 | case WM_SYSKEYDOWN: { 37 | /* Pass syskey to DefWindwoProc (ALT-F4, etc.) */ 38 | } 39 | - break; 40 | +// break; 41 | case WM_KEYUP: 42 | case WM_KEYDOWN: { 43 | /* Ignore windows keyboard messages */; 44 | diff -ru SDL-1.2.12/src/video/windx5/SDL_dx5video.c SDL-1.2.12release/src/video/windx5/SDL_dx5video.c 45 | --- SDL-1.2.12/src/video/windx5/SDL_dx5video.c 2007-07-20 07:52:25.000000000 +0200 46 | +++ SDL-1.2.12release/src/video/windx5/SDL_dx5video.c 2007-08-17 02:51:52.000000000 +0200 47 | @@ -1496,7 +1496,7 @@ 48 | } 49 | } 50 | dd_surface3 = NULL; 51 | -#if 0 /* FIXME: enable this when SDL consistently reports lost surfaces */ 52 | +#if 1 /* FIXME: enable this when SDL consistently reports lost surfaces */ 53 | if ( (flags & SDL_HWSURFACE) == SDL_HWSURFACE ) { 54 | video->flags |= SDL_HWSURFACE; 55 | } else { 56 | -------------------------------------------------------------------------------- /src/platform/visualc/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = unistd.h config.h ntddscsi.h ntddcdrm.h 2 | -------------------------------------------------------------------------------- /src/platform/visualc/config.h: -------------------------------------------------------------------------------- 1 | #define VERSION "SVN" 2 | 3 | /* Define to 1 to enable internal debugger, requires libcurses */ 4 | #define C_DEBUG 0 5 | 6 | /* Define to 1 to enable output=ddraw */ 7 | #define C_DDRAW 1 8 | 9 | /* Define to 1 to enable screenshots, requires libpng */ 10 | #define C_SSHOT 1 11 | 12 | /* Define to 1 to use opengl display output support */ 13 | #define C_OPENGL 1 14 | 15 | /* Define to 1 to enable internal modem support, requires SDL_net */ 16 | #define C_MODEM 1 17 | 18 | /* Define to 1 to enable IPX networking support, requires SDL_net */ 19 | #define C_IPX 1 20 | 21 | /* Enable some heavy debugging options */ 22 | #define C_HEAVY_DEBUG 0 23 | 24 | /* The type of cpu this host has */ 25 | #define C_TARGETCPU X86 26 | //#define C_TARGETCPU X86_64 27 | 28 | /* Define to 1 to use x86 dynamic cpu core */ 29 | #define C_DYNAMIC_X86 1 30 | 31 | /* Define to 1 to use recompiling cpu core. Can not be used together with the dynamic-x86 core */ 32 | #define C_DYNREC 0 33 | 34 | /* Enable memory function inlining in */ 35 | #define C_CORE_INLINE 0 36 | 37 | /* Enable the FPU module, still only for beta testing */ 38 | #define C_FPU 1 39 | 40 | /* Define to 1 to use a x86 assembly fpu core */ 41 | #define C_FPU_X86 1 42 | 43 | /* Define to 1 to use a unaligned memory access */ 44 | #define C_UNALIGNED_MEMORY 1 45 | 46 | /* environ is defined */ 47 | #define ENVIRON_INCLUDED 1 48 | 49 | /* environ can be linked */ 50 | #define ENVIRON_LINKED 1 51 | 52 | /* Define to 1 if you want serial passthrough support. */ 53 | #define C_DIRECTSERIAL 1 54 | 55 | #define GCC_ATTRIBUTE(x) /* attribute not supported */ 56 | #define GCC_UNLIKELY(x) (x) 57 | #define GCC_LIKELY(x) (x) 58 | 59 | #define INLINE __forceinline 60 | #define DB_FASTCALL __fastcall 61 | 62 | #if defined(_MSC_VER) && (_MSC_VER >= 1400) 63 | #pragma warning(disable : 4996) 64 | #endif 65 | 66 | typedef double Real64; 67 | /* The internal types */ 68 | typedef unsigned char Bit8u; 69 | typedef signed char Bit8s; 70 | typedef unsigned short Bit16u; 71 | typedef signed short Bit16s; 72 | typedef unsigned long Bit32u; 73 | typedef signed long Bit32s; 74 | typedef unsigned __int64 Bit64u; 75 | typedef signed __int64 Bit64s; 76 | typedef unsigned int Bitu; 77 | typedef signed int Bits; 78 | 79 | -------------------------------------------------------------------------------- /src/platform/visualc/unistd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the Mingw32 package. 3 | * 4 | * unistd.h maps (roughly) to io.h 5 | */ 6 | 7 | #ifndef __STRICT_ANSI__ 8 | #include 9 | #endif 10 | 11 | -------------------------------------------------------------------------------- /src/shell/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = -I$(top_srcdir)/include 2 | 3 | noinst_LIBRARIES = libshell.a 4 | libshell_a_SOURCES = shell.cpp shell_batch.cpp shell_cmds.cpp shell_misc.cpp 5 | -------------------------------------------------------------------------------- /src/winres.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/svn2github/dosbox/acd380bcde72db74f3b476253899016f686bc0ef/src/winres.rc -------------------------------------------------------------------------------- /visualc_net/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = dosbox.sln dosbox.vcproj -------------------------------------------------------------------------------- /visualc_net/dosbox.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 8.00 2 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dosbox", "dosbox.vcproj", "{7FCFFB9B-8629-4D51-849C-8490CECF8AB7}" 3 | ProjectSection(ProjectDependencies) = postProject 4 | EndProjectSection 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfiguration) = preSolution 8 | Debug = Debug 9 | Release = Release 10 | EndGlobalSection 11 | GlobalSection(ProjectConfiguration) = postSolution 12 | {7FCFFB9B-8629-4D51-849C-8490CECF8AB7}.Debug.ActiveCfg = Debug|Win32 13 | {7FCFFB9B-8629-4D51-849C-8490CECF8AB7}.Debug.Build.0 = Debug|Win32 14 | {7FCFFB9B-8629-4D51-849C-8490CECF8AB7}.Release.ActiveCfg = Release|Win32 15 | {7FCFFB9B-8629-4D51-849C-8490CECF8AB7}.Release.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(ExtensibilityGlobals) = postSolution 18 | EndGlobalSection 19 | GlobalSection(ExtensibilityAddIns) = postSolution 20 | EndGlobalSection 21 | EndGlobal 22 | --------------------------------------------------------------------------------