From aa1effc34514da85f77241e5f04321b7d87d8743 Mon Sep 17 00:00:00 2001 From: dborth Date: Wed, 22 Jun 2011 04:18:55 +0000 Subject: [PATCH] sync to latest DOSBox SVN --- INSTALL | 6 +- acinclude.m4 | 2 +- configure.in | 24 +- docs/dosbox.1 | 2 +- include/Makefile.am | 1 + include/bios.h | 3 +- include/bios_disk.h | 3 +- include/callback.h | 5 +- include/control.h | 3 +- include/cpu.h | 3 +- include/cross.h | 3 +- include/debug.h | 2 +- include/dma.h | 3 +- include/dos_inc.h | 10 +- include/dos_system.h | 5 +- include/dosbox.h | 9 +- include/fpu.h | 2 +- include/hardware.h | 3 +- include/inout.h | 5 +- include/ipx.h | 3 +- include/ipxserver.h | 2 +- include/joystick.h | 3 +- include/keyboard.h | 2 +- include/logging.h | 25 +- include/mapper.h | 2 +- include/mem.h | 2 +- include/mixer.h | 3 +- include/mouse.h | 3 +- include/paging.h | 3 +- include/pci_bus.h | 85 ++++ include/pic.h | 2 +- include/programs.h | 3 +- include/regs.h | 4 +- include/render.h | 2 +- include/serialport.h | 3 +- include/setup.h | 3 +- include/shell.h | 5 +- include/support.h | 3 +- include/timer.h | 2 +- include/vga.h | 7 +- include/video.h | 3 +- scripts/dosbox-installer.nsi | 2 +- src/cpu/callback.cpp | 54 +-- src/cpu/core_dyn_x86.cpp | 10 +- src/cpu/core_dyn_x86/cache.h | 3 +- src/cpu/core_dyn_x86/decoder.h | 11 +- src/cpu/core_dyn_x86/dyn_fpu.h | 3 +- src/cpu/core_dyn_x86/dyn_fpu_dh.h | 3 +- src/cpu/core_dyn_x86/helpers.h | 18 + src/cpu/core_dyn_x86/risc_x86.h | 3 +- src/cpu/core_dyn_x86/string.h | 2 +- src/cpu/core_dynrec.cpp | 11 +- src/cpu/core_dynrec/cache.h | 2 +- src/cpu/core_dynrec/decoder.h | 11 +- src/cpu/core_dynrec/decoder_basic.h | 3 +- src/cpu/core_dynrec/decoder_opcodes.h | 3 +- src/cpu/core_dynrec/dyn_fpu.h | 3 +- src/cpu/core_dynrec/operators.h | 3 +- src/cpu/core_dynrec/risc_armv4le-common.h | 3 +- src/cpu/core_dynrec/risc_armv4le-o3.h | 3 +- src/cpu/core_dynrec/risc_armv4le-s3.h | 3 +- src/cpu/core_dynrec/risc_armv4le-thumb-iw.h | 3 +- src/cpu/core_dynrec/risc_armv4le-thumb-niw.h | 3 +- src/cpu/core_dynrec/risc_armv4le-thumb.h | 3 +- src/cpu/core_dynrec/risc_armv4le.h | 3 +- src/cpu/core_dynrec/risc_mipsel32.h | 3 +- src/cpu/core_dynrec/risc_x64.h | 129 ++++-- src/cpu/core_dynrec/risc_x86.h | 3 +- src/cpu/core_full.cpp | 2 +- src/cpu/core_full/ea_lookup.h | 18 + src/cpu/core_full/load.h | 25 ++ src/cpu/core_full/loadwrite.h | 18 + src/cpu/core_full/op.h | 18 + src/cpu/core_full/optable.h | 22 +- src/cpu/core_full/save.h | 18 + src/cpu/core_full/string.h | 18 + src/cpu/core_full/support.h | 19 + src/cpu/core_normal.cpp | 2 +- src/cpu/core_normal/helpers.h | 2 +- src/cpu/core_normal/prefix_0f.h | 2 +- src/cpu/core_normal/prefix_66.h | 2 +- src/cpu/core_normal/prefix_66_0f.h | 2 +- src/cpu/core_normal/prefix_none.h | 4 +- src/cpu/core_normal/string.h | 18 + src/cpu/core_normal/support.h | 2 +- src/cpu/core_normal/table_ea.h | 2 +- src/cpu/core_prefetch.cpp | 3 +- src/cpu/core_simple.cpp | 2 +- src/cpu/cpu.cpp | 15 +- src/cpu/flags.cpp | 2 +- src/cpu/instructions.h | 2 +- src/cpu/lazyflags.h | 2 +- src/cpu/modrm.cpp | 2 +- src/cpu/modrm.h | 2 +- src/cpu/paging.cpp | 19 +- src/debug/debug.cpp | 14 +- src/debug/debug_gui.cpp | 25 +- src/debug/debug_inc.h | 3 +- src/debug/debug_win32.cpp | 2 +- src/debug/disasm_tables.h | 2 +- src/dos/cdrom.cpp | 3 +- src/dos/cdrom.h | 18 + src/dos/cdrom_aspi_win32.cpp | 3 +- src/dos/cdrom_image.cpp | 4 +- src/dos/cdrom_ioctl_linux.cpp | 6 +- src/dos/cdrom_ioctl_os2.cpp | 3 +- src/dos/cdrom_ioctl_win32.cpp | 4 +- src/dos/dev_con.h | 3 +- src/dos/dos.cpp | 114 +++-- src/dos/dos_classes.cpp | 7 +- src/dos/dos_devices.cpp | 3 +- src/dos/dos_execute.cpp | 3 +- src/dos/dos_files.cpp | 48 +- src/dos/dos_ioctl.cpp | 3 +- src/dos/dos_keyboard_layout.cpp | 12 +- src/dos/dos_memory.cpp | 3 +- src/dos/dos_misc.cpp | 3 +- src/dos/dos_mscdex.cpp | 103 +++-- src/dos/dos_programs.cpp | 25 +- src/dos/dos_tables.cpp | 3 +- src/dos/drive_cache.cpp | 3 +- src/dos/drive_fat.cpp | 14 +- src/dos/drive_iso.cpp | 9 +- src/dos/drive_local.cpp | 12 +- src/dos/drive_virtual.cpp | 10 +- src/dos/drives.cpp | 3 +- src/dos/drives.h | 5 +- src/dos/scsidefs.h | 5 - src/dosbox.cpp | 21 +- src/fpu/fpu.cpp | 3 +- src/fpu/fpu_instructions.h | 3 +- src/fpu/fpu_instructions_x86.h | 3 +- src/gui/dosbox_logo.h | 3 +- src/gui/midi.cpp | 48 +- src/gui/midi_alsa.h | 3 +- src/gui/midi_coreaudio.h | 3 +- src/gui/midi_oss.h | 2 +- src/gui/midi_win32.h | 3 +- src/gui/render.cpp | 3 +- src/gui/render_loops.h | 2 +- src/gui/render_scalers.cpp | 2 +- src/gui/render_scalers.h | 2 +- src/gui/render_simple.h | 3 +- src/gui/render_templates.h | 2 +- src/gui/render_templates_hq.h | 2 +- src/gui/render_templates_hq2x.h | 2 +- src/gui/render_templates_hq3x.h | 2 +- src/gui/render_templates_sai.h | 2 +- src/gui/sdl_gui.cpp | 5 +- src/gui/sdl_mapper.cpp | 11 +- src/gui/sdlmain.cpp | 12 +- src/hardware/Makefile.am | 4 +- src/hardware/adlib.cpp | 3 +- src/hardware/adlib.h | 3 +- src/hardware/cmos.cpp | 3 +- src/hardware/dbopl.cpp | 3 +- src/hardware/dbopl.h | 2 +- src/hardware/disney.cpp | 3 +- src/hardware/dma.cpp | 3 +- src/hardware/gameblaster.cpp | 2 +- src/hardware/gus.cpp | 5 +- src/hardware/hardware.cpp | 3 +- src/hardware/iohandler.cpp | 45 +- src/hardware/ipx.cpp | 5 +- src/hardware/ipxserver.cpp | 3 +- src/hardware/joystick.cpp | 3 +- src/hardware/keyboard.cpp | 3 +- src/hardware/memory.cpp | 17 +- src/hardware/mixer.cpp | 3 +- src/hardware/mpu401.cpp | 3 +- src/hardware/opl.cpp | 2 +- src/hardware/opl.h | 2 +- src/hardware/pci_bus.cpp | 438 +++++++++++++++++++ src/hardware/pci_devices.h | 18 + src/hardware/pcspeaker.cpp | 3 +- src/hardware/pic.cpp | 20 +- src/hardware/sblaster.cpp | 12 +- src/hardware/serialport/directserial.cpp | 3 +- src/hardware/serialport/directserial.h | 3 +- src/hardware/serialport/libserial.cpp | 4 +- src/hardware/serialport/libserial.h | 3 +- src/hardware/serialport/misc_util.cpp | 2 +- src/hardware/serialport/misc_util.h | 3 +- src/hardware/serialport/nullmodem.cpp | 7 +- src/hardware/serialport/nullmodem.h | 3 +- src/hardware/serialport/serialdummy.cpp | 3 +- src/hardware/serialport/serialdummy.h | 3 +- src/hardware/serialport/serialport.cpp | 3 +- src/hardware/serialport/softmodem.cpp | 3 +- src/hardware/serialport/softmodem.h | 3 +- src/hardware/tandy_sound.cpp | 2 +- src/hardware/timer.cpp | 34 +- src/hardware/vga.cpp | 3 +- src/hardware/vga_attr.cpp | 3 +- src/hardware/vga_crtc.cpp | 3 +- src/hardware/vga_dac.cpp | 2 +- src/hardware/vga_draw.cpp | 3 +- src/hardware/vga_gfx.cpp | 3 +- src/hardware/vga_memory.cpp | 96 ++-- src/hardware/vga_misc.cpp | 3 +- src/hardware/vga_other.cpp | 3 +- src/hardware/vga_paradise.cpp | 3 +- src/hardware/vga_s3.cpp | 3 +- src/hardware/vga_seq.cpp | 3 +- src/hardware/vga_tseng.cpp | 3 +- src/hardware/vga_xga.cpp | 3 +- src/ints/bios.cpp | 206 ++++++++- src/ints/bios_disk.cpp | 14 +- src/ints/bios_keyboard.cpp | 22 +- src/ints/ems.cpp | 3 +- src/ints/int10.cpp | 3 +- src/ints/int10.h | 3 +- src/ints/int10_char.cpp | 3 +- src/ints/int10_memory.cpp | 3 +- src/ints/int10_misc.cpp | 3 +- src/ints/int10_modes.cpp | 17 +- src/ints/int10_pal.cpp | 2 +- src/ints/int10_put_pixel.cpp | 3 +- src/ints/int10_vesa.cpp | 289 +++++++----- src/ints/int10_video_state.cpp | 3 +- src/ints/int10_vptable.cpp | 3 +- src/ints/mouse.cpp | 3 +- src/ints/xms.cpp | 3 +- src/ints/xms.h | 2 +- src/libs/gui_tk/gui_tk.cpp | 1 - src/libs/gui_tk/gui_tk.h | 1 - src/libs/zmbv/drvproc.cpp | 2 +- src/libs/zmbv/zmbv.cpp | 2 +- src/libs/zmbv/zmbv.h | 2 +- src/libs/zmbv/zmbv_vfw.cpp | 2 +- src/libs/zmbv/zmbv_vfw.rc | 16 +- src/misc/cross.cpp | 3 +- src/misc/messages.cpp | 3 +- src/misc/programs.cpp | 5 +- src/misc/setup.cpp | 3 +- src/misc/support.cpp | 3 +- src/platform/wii/menu.cpp | 2 +- src/shell/shell.cpp | 24 +- src/shell/shell_batch.cpp | 3 +- src/shell/shell_cmds.cpp | 119 ++++- src/shell/shell_misc.cpp | 3 +- src/winres.rc | 4 +- visualc_net/dosbox.vcproj | 6 + 243 files changed, 2175 insertions(+), 866 deletions(-) create mode 100644 include/pci_bus.h create mode 100644 src/hardware/pci_bus.cpp create mode 100644 src/hardware/pci_devices.h diff --git a/INSTALL b/INSTALL index 3a9548f..ef4656b 100644 --- a/INSTALL +++ b/INSTALL @@ -43,11 +43,11 @@ ALSA_Headers for Alsa support under linux. Part of the linux kernel sources Licensed under LGPL -If you want compile from the CVS under a unix system, you'll also need +If you want compile from developer sources (SVN) under a unix system, you'll also need automake (>=1.6), autoconf(>=2.50). Should be available at http://www.gnu.org For building on unix systems. -If you are building from the cvs run ./autogen.sh first before doing the following. +If you are building from developer sources run ./autogen.sh first before doing the following. 1. ./configure 2. make @@ -101,4 +101,4 @@ src/ints/bios_keyboard.cpp and go to line 30 and read there how to fix it. Build instructions for VC++6 Don't use VC++ 6: it creates faulty code in core_normal.cpp -Later Visual Studio versions work fine (vs2003/.net, vs2005, vs2008) +Later Visual Studio versions work fine (vs2003/.net up to vs2010) diff --git a/acinclude.m4 b/acinclude.m4 index 963c391..4e72488 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -305,7 +305,7 @@ AC_SUBST(ALSA_LIBS) AH_TOP([ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/configure.in b/configure.in index cc187d7..32bae8c 100644 --- a/configure.in +++ b/configure.in @@ -38,7 +38,7 @@ CPPFLAGS="$CPPFLAGS $SDL_CFLAGS" dnl Check if SDL is 1.2.x (1.3 not supported) AC_MSG_CHECKING([SDL version only being 1.2.X]) -AC_COMPILE_IFELSE([ +AC_COMPILE_IFELSE([AC_LANG_SOURCE([ #include "SDL.h" void blah(){ #if SDL_MINOR_VERSION != 2 @@ -46,7 +46,7 @@ void blah(){ #endif ; } -],AC_MSG_RESULT([yes]),[ +])],AC_MSG_RESULT([yes]),[ AC_MSG_RESULT([no]) AC_MSG_ERROR([Only libSDL 1.2.X supported])]) @@ -82,7 +82,7 @@ AC_CHECK_HEADERS([sys/socket.h netinet/in.h pwd.h], [], [], ]) dnl check for the socklen_t (darwin doesn't always have it) -AC_COMPILE_IFELSE([ +AC_COMPILE_IFELSE([AC_LANG_SOURCE([ #include #ifdef STDC_HEADERS # include @@ -98,7 +98,7 @@ AC_COMPILE_IFELSE([ #ifdef HAVE_SYS_SOCKET_H #include #endif -],[],[AC_DEFINE([socklen_t],[int],[Define to `int` if you don't have socklen_t])]) +])],[],[AC_DEFINE([socklen_t],[int],[Define to `int` if you don't have socklen_t])]) AC_MSG_CHECKING(if environ can be included) AC_LINK_IFELSE([AC_LANG_PROGRAM([[ @@ -111,13 +111,13 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern char ** environ;]],[[*environ;]])], [AC_MSG_RESULT(yes);AC_DEFINE(ENVIRON_LINKED,1,[environ can be linked])],AC_MSG_RESULT(no)) AC_MSG_CHECKING([if dirent includes d_type]) -AC_COMPILE_IFELSE([ +AC_COMPILE_IFELSE([AC_LANG_SOURCE([ #include #include void blah(){ struct dirent d_test; d_test.d_type = 0; -}],[AC_MSG_RESULT(yes);AC_DEFINE(DIRENT_HAS_D_TYPE,1,[struct dirent has d_type])],AC_MSG_RESULT(no)) +}])],[AC_MSG_RESULT(yes);AC_DEFINE(DIRENT_HAS_D_TYPE,1,[struct dirent has d_type])],AC_MSG_RESULT(no)) dnl Check for powf @@ -146,13 +146,13 @@ CFLAGS="-Werror" AH_TEMPLATE([C_ATTRIBUTE_ALWAYS_INLINE],[Determines if the compilers supports always_inline attribute.]) AC_MSG_CHECKING(if compiler allows __attribute__((always_inline)) ) -AC_COMPILE_IFELSE([ void __attribute__((always_inline)) test(){} -],[ AC_MSG_RESULT(yes);AC_DEFINE(C_ATTRIBUTE_ALWAYS_INLINE)],AC_MSG_RESULT(no)) +AC_COMPILE_IFELSE([AC_LANG_SOURCE([ void __attribute__((always_inline)) test(){} +])],[ AC_MSG_RESULT(yes);AC_DEFINE(C_ATTRIBUTE_ALWAYS_INLINE)],AC_MSG_RESULT(no)) AH_TEMPLATE([C_ATTRIBUTE_FASTCALL],[Determines if the compilers supports fastcall attribute.]) AC_MSG_CHECKING(if compiler allows __attribute__((fastcall)) ) -AC_COMPILE_IFELSE([ void __attribute__((fastcall)) test(){} -],[ AC_MSG_RESULT(yes);AC_DEFINE(C_ATTRIBUTE_FASTCALL)],AC_MSG_RESULT(no)) +AC_COMPILE_IFELSE([AC_LANG_SOURCE([ void __attribute__((fastcall)) test(){} +])],[ AC_MSG_RESULT(yes);AC_DEFINE(C_ATTRIBUTE_FASTCALL)],AC_MSG_RESULT(no)) CFLAGS="$OLDCFLAGS" @@ -439,12 +439,12 @@ AC_CHECK_FUNC([mprotect],[AC_DEFINE(C_HAVE_MPROTECT,1)]) dnl Setpriority AH_TEMPLATE(C_SET_PRIORITY,[Define to 1 if you have setpriority support]) AC_MSG_CHECKING(for setpriority support) -AC_LINK_IFELSE([ +AC_LINK_IFELSE([AC_LANG_SOURCE([ #include int main(int argc,char * argv[]) { return setpriority (PRIO_PROCESS, 0,PRIO_MIN+PRIO_MAX); }; -],AC_MSG_RESULT(yes);AC_DEFINE(C_SET_PRIORITY,1),AC_MSG_RESULT(no)) +])],AC_MSG_RESULT(yes);AC_DEFINE(C_SET_PRIORITY,1),AC_MSG_RESULT(no)) dnl Some target detection and actions for them diff --git a/docs/dosbox.1 b/docs/dosbox.1 index 8330fcd..cffcb38 100644 --- a/docs/dosbox.1 +++ b/docs/dosbox.1 @@ -218,7 +218,7 @@ The configuration file controls various settings of the emulated soundcards and many .RI "more things. It futher allows acces to " AUTOEXEC.BAT . .LP -The language file controls all visible ouput of the internal commands and +The language file controls all visible output of the internal commands and the internal dos. .RB "See the section " FILES " for more information." .TP diff --git a/include/Makefile.am b/include/Makefile.am index 0f692ef..4aafec6 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -24,6 +24,7 @@ mixer.h \ modules.h \ mouse.h \ paging.h \ +pci_bus.h \ pic.h \ programs.h \ render.h \ diff --git a/include/bios.h b/include/bios.h index ad28994..3c4227b 100644 --- a/include/bios.h +++ b/include/bios.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -106,6 +106,7 @@ #define BIOS_DEFAULT_IRQ0_LOCATION (RealMake(0xf000,0xfea5)) #define BIOS_DEFAULT_IRQ1_LOCATION (RealMake(0xf000,0xe987)) #define BIOS_DEFAULT_IRQ2_LOCATION (RealMake(0xf000,0xff55)) +#define BIOS_DEFAULT_RESET_LOCATION (RealMake(0xf000,0xe05b)) /* maximum of scancodes handled by keyboard bios routines */ #define MAX_SCAN_CODE 0x58 diff --git a/include/bios_disk.h b/include/bios_disk.h index 2951821..b43a79f 100644 --- a/include/bios_disk.h +++ b/include/bios_disk.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -65,6 +65,7 @@ public: Bit32u sector_size; Bit32u heads,cylinders,sectors; + Bit32u current_fpos; }; void updateDPT(void); diff --git a/include/callback.h b/include/callback.h index 80711ef..f37395b 100644 --- a/include/callback.h +++ b/include/callback.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: callback.h,v 1.26 2009-08-23 17:24:54 c2woody Exp $ */ #ifndef DOSBOX_CALLBACK_H #define DOSBOX_CALLBACK_H @@ -96,6 +95,8 @@ public: void Install(CallBack_Handler handler,Bitu type,const char* description); void Install(CallBack_Handler handler,Bitu type,PhysPt addr,const char* description); + void Uninstall(); + //Only allocate a callback number void Allocate(CallBack_Handler handler,const char* description=0); Bit16u Get_callback() { diff --git a/include/control.h b/include/control.h index b0b9bf7..6a31ee8 100644 --- a/include/control.h +++ b/include/control.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: control.h,v 1.2 2009-05-27 09:15:40 qbix79 Exp $ */ #ifndef DOSBOX_CONTROL_H #define DOSBOX_CONTROL_H diff --git a/include/cpu.h b/include/cpu.h index 9b41bd9..2835276 100644 --- a/include/cpu.h +++ b/include/cpu.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: cpu.h,v 1.57 2009-05-27 09:15:40 qbix79 Exp $ */ #ifndef DOSBOX_CPU_H #define DOSBOX_CPU_H diff --git a/include/cross.h b/include/cross.h index f688159..1b8839c 100644 --- a/include/cross.h +++ b/include/cross.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: cross.h,v 1.21 2009-03-14 18:02:34 qbix79 Exp $ */ #ifndef DOSBOX_CROSS_H #define DOSBOX_CROSS_H diff --git a/include/debug.h b/include/debug.h index cc8c8c6..d62f748 100644 --- a/include/debug.h +++ b/include/debug.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/include/dma.h b/include/dma.h index c5ff109..6c122a7 100644 --- a/include/dma.h +++ b/include/dma.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dma.h,v 1.20 2009-07-24 09:56:14 c2woody Exp $ */ #ifndef DOSBOX_DMA_H #define DOSBOX_DMA_H diff --git a/include/dos_inc.h b/include/dos_inc.h index 7c751f2..ec3a790 100644 --- a/include/dos_inc.h +++ b/include/dos_inc.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_inc.h,v 1.83 2009-10-28 21:45:12 qbix79 Exp $ */ #ifndef DOSBOX_DOS_INC_H #define DOSBOX_DOS_INC_H @@ -28,6 +27,8 @@ #include "mem.h" #endif +#include //for offsetof + #ifdef _MSC_VER #pragma pack (1) #endif @@ -176,8 +177,8 @@ bool DOS_FCBFindFirst(Bit16u seg,Bit16u offset); bool DOS_FCBFindNext(Bit16u seg,Bit16u offset); Bit8u DOS_FCBRead(Bit16u seg,Bit16u offset, Bit16u numBlocks); Bit8u DOS_FCBWrite(Bit16u seg,Bit16u offset,Bit16u numBlocks); -Bit8u DOS_FCBRandomRead(Bit16u seg,Bit16u offset,Bit16u numRec,bool restore); -Bit8u DOS_FCBRandomWrite(Bit16u seg,Bit16u offset,Bit16u numRec,bool restore); +Bit8u DOS_FCBRandomRead(Bit16u seg,Bit16u offset,Bit16u * numRec,bool restore); +Bit8u DOS_FCBRandomWrite(Bit16u seg,Bit16u offset,Bit16u * numRec,bool restore); bool DOS_FCBGetFileSize(Bit16u seg,Bit16u offset); bool DOS_FCBDeleteFile(Bit16u seg,Bit16u offset); bool DOS_FCBRenameFile(Bit16u seg, Bit16u offset); @@ -506,6 +507,7 @@ public: bool Extended(void); void GetAttr(Bit8u & attr); void SetAttr(Bit8u attr); + void SetResultAttr(Bit8u attr); bool Valid(void); private: bool extended; diff --git a/include/dos_system.h b/include/dos_system.h index 0b6fc22..46e00bd 100644 --- a/include/dos_system.h +++ b/include/dos_system.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_system.h,v 1.47 2009-03-04 21:08:22 c2woody Exp $ */ #ifndef DOSBOX_DOS_SYSTEM_H #define DOSBOX_DOS_SYSTEM_H @@ -250,7 +249,7 @@ public: virtual void Activate(void) {}; }; -enum { OPEN_READ=0,OPEN_WRITE=1,OPEN_READWRITE=2, DOS_NOT_INHERIT=128}; +enum { OPEN_READ=0, OPEN_WRITE=1, OPEN_READWRITE=2, OPEN_READ_NO_MOD=4, DOS_NOT_INHERIT=128}; enum { DOS_SEEK_SET=0,DOS_SEEK_CUR=1,DOS_SEEK_END=2}; diff --git a/include/dosbox.h b/include/dosbox.h index 7cc1cfb..5f5f678 100644 --- a/include/dosbox.h +++ b/include/dosbox.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,17 +16,16 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dosbox.h,v 1.32 2009-05-27 09:15:41 qbix79 Exp $ */ #ifndef DOSBOX_DOSBOX_H #define DOSBOX_DOSBOX_H #include "config.h" -void E_Exit(const char * message,...) GCC_ATTRIBUTE( __format__(__printf__, 1, 2)); +GCC_ATTRIBUTE(noreturn) void E_Exit(const char * message,...) GCC_ATTRIBUTE( __format__(__printf__, 1, 2)); -void MSG_Add(const char*,const char*); //add messages to the internal langaugefile -const char* MSG_Get(char const *); //get messages from the internal langaugafile +void MSG_Add(const char*,const char*); //add messages to the internal languagefile +const char* MSG_Get(char const *); //get messages from the internal languagefile class Section; diff --git a/include/fpu.h b/include/fpu.h index 05005d4..9353aa1 100644 --- a/include/fpu.h +++ b/include/fpu.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/include/hardware.h b/include/hardware.h index b3b5077..0b9896b 100644 --- a/include/hardware.h +++ b/include/hardware.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: hardware.h,v 1.17 2009-06-23 17:46:05 c2woody Exp $ */ #ifndef DOSBOX_HARDWARE_H #define DOSBOX_HARDWARE_H diff --git a/include/inout.h b/include/inout.h index 19c816f..b550ae1 100644 --- a/include/inout.h +++ b/include/inout.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: inout.h,v 1.13 2009-05-27 09:15:41 qbix79 Exp $ */ #ifndef DOSBOX_INOUT_H #define DOSBOX_INOUT_H @@ -60,11 +59,13 @@ public: class IO_ReadHandleObject: private IO_Base{ public: void Install(Bitu port,IO_ReadHandler * handler,Bitu mask,Bitu range=1); + void Uninstall(); ~IO_ReadHandleObject(); }; class IO_WriteHandleObject: private IO_Base{ public: void Install(Bitu port,IO_WriteHandler * handler,Bitu mask,Bitu range=1); + void Uninstall(); ~IO_WriteHandleObject(); }; diff --git a/include/ipx.h b/include/ipx.h index 537f113..440c048 100644 --- a/include/ipx.h +++ b/include/ipx.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: ipx.h,v 1.13 2009-05-27 09:15:41 qbix79 Exp $ */ #ifndef DOSBOX_IPX_H #define DOSBOX_IPX_H diff --git a/include/ipxserver.h b/include/ipxserver.h index 8ee5c9c..d862258 100644 --- a/include/ipxserver.h +++ b/include/ipxserver.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/include/joystick.h b/include/joystick.h index 4087cef..ff3b74f 100644 --- a/include/joystick.h +++ b/include/joystick.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: joystick.h,v 1.13 2009-05-27 09:15:41 qbix79 Exp $ */ #ifndef DOSBOX_JOYSTICK_H #define DOSBOX_JOYSTICK_H void JOYSTICK_Enable(Bitu which,bool enabled); diff --git a/include/keyboard.h b/include/keyboard.h index 27ab83b..fde40d1 100644 --- a/include/keyboard.h +++ b/include/keyboard.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/include/logging.h b/include/logging.h index 53005c8..8005c93 100644 --- a/include/logging.h +++ b/include/logging.h @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2002-2011 The DOSBox Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + #ifndef DOSBOX_LOGGING_H #define DOSBOX_LOGGING_H enum LOG_TYPES { @@ -9,6 +27,7 @@ enum LOG_TYPES { LOG_PIT,LOG_KEYBOARD,LOG_PIC, LOG_MOUSE,LOG_BIOS,LOG_GUI,LOG_MISC, LOG_IO, + LOG_PCI, LOG_MAX }; @@ -47,6 +66,10 @@ struct LOG void operator()(char const* , double , double , double ) { } void operator()(char const* , double , double , double , double ) { } void operator()(char const* , double , double , double , double , double ) { } + void operator()(char const* , double , double , double , double , double , double ) { } + void operator()(char const* , double , double , double , double , double , double , double) { } + + void operator()(char const* , char const* ) { } void operator()(char const* , char const* , double ) { } @@ -55,7 +78,7 @@ struct LOG void operator()(char const* , double , double, char const* ) { } void operator()(char const* , char const*, char const*) { } - + void operator()(char const* , double , double , double , char const* ) { } }; //add missing operators to here //try to avoid anything smaller than bit32... void GFX_ShowMsg(char const* format,...) GCC_ATTRIBUTE(__format__(__printf__, 1, 2)); diff --git a/include/mapper.h b/include/mapper.h index 65039f7..6037d4c 100644 --- a/include/mapper.h +++ b/include/mapper.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/include/mem.h b/include/mem.h index 8990625..7171a1f 100644 --- a/include/mem.h +++ b/include/mem.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/include/mixer.h b/include/mixer.h index 926066c..215b9aa 100644 --- a/include/mixer.h +++ b/include/mixer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: mixer.h,v 1.19 2009-04-28 21:48:24 harekiet Exp $ */ #ifndef DOSBOX_MIXER_H #define DOSBOX_MIXER_H diff --git a/include/mouse.h b/include/mouse.h index bab8a53..f15f9db 100644 --- a/include/mouse.h +++ b/include/mouse.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: mouse.h,v 1.15 2009-05-27 09:15:41 qbix79 Exp $ */ #ifndef DOSBOX_MOUSE_H diff --git a/include/paging.h b/include/paging.h index fd59c70..98455c7 100644 --- a/include/paging.h +++ b/include/paging.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: paging.h,v 1.33 2009-05-27 09:15:41 qbix79 Exp $ */ #ifndef DOSBOX_PAGING_H #define DOSBOX_PAGING_H diff --git a/include/pci_bus.h b/include/pci_bus.h new file mode 100644 index 0000000..470114f --- /dev/null +++ b/include/pci_bus.h @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2002-2011 The DOSBox Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef DOSBOX_PCI_H +#define DOSBOX_PCI_H + +//#define PCI_FUNCTIONALITY_ENABLED 0 + +#if defined PCI_FUNCTIONALITY_ENABLED + +#define PCI_MAX_PCIDEVICES 10 +#define PCI_MAX_PCIFUNCTIONS 8 + + +class PCI_Device { +private: + Bits pci_id, pci_subfunction; + Bit16u vendor_id, device_id; + + // subdevices declarations, they will respond to pci functions 1 to 7 + // (main device is attached to function 0) + Bitu num_subdevices; + PCI_Device* subdevices[PCI_MAX_PCIFUNCTIONS-1]; + +public: + PCI_Device(Bit16u vendor, Bit16u device); + + Bits PCIId(void) { + return pci_id; + } + Bits PCISubfunction(void) { + return pci_subfunction; + } + Bit16u VendorID(void) { + return vendor_id; + } + Bit16u DeviceID(void) { + return device_id; + } + + void SetPCIId(Bitu number, Bits subfct); + + bool AddSubdevice(PCI_Device* dev); + void RemoveSubdevice(Bits subfct); + + PCI_Device* GetSubdevice(Bits subfct); + + Bit16u NumSubdevices(void) { + if (num_subdevices>PCI_MAX_PCIFUNCTIONS-1) return PCI_MAX_PCIFUNCTIONS-1; + return num_subdevices; + } + + Bits GetNextSubdeviceNumber(void) { + if (num_subdevices>=PCI_MAX_PCIFUNCTIONS-1) return -1; + return num_subdevices+1; + } + + virtual Bits ParseReadRegister(Bit8u regnum)=0; + virtual Bits ParseWriteRegister(Bit8u regnum,Bit8u value)=0; + virtual bool InitializeRegisters(Bit8u registers[256])=0; + +}; + +bool PCI_IsInitialized(); + +RealPt PCI_GetPModeInterface(void); + +#endif + +#endif diff --git a/include/pic.h b/include/pic.h index 586bc64..a7bc890 100644 --- a/include/pic.h +++ b/include/pic.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/include/programs.h b/include/programs.h index 027f802..455d546 100644 --- a/include/programs.h +++ b/include/programs.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: programs.h,v 1.19 2009-05-27 09:15:41 qbix79 Exp $ */ #ifndef DOSBOX_PROGRAMS_H #define DOSBOX_PROGRAMS_H diff --git a/include/regs.h b/include/regs.h index 6a4d31e..37ddf5c 100644 --- a/include/regs.h +++ b/include/regs.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -41,7 +41,7 @@ #define FLAG_ID 0x00200000 #define FMASK_TEST (FLAG_CF | FLAG_PF | FLAG_AF | FLAG_ZF | FLAG_SF | FLAG_OF) -#define FMASK_NORMAL (FMASK_TEST | FLAG_DF | FLAG_TF | FLAG_IF | FLAG_AC ) +#define FMASK_NORMAL (FMASK_TEST | FLAG_DF | FLAG_TF | FLAG_IF ) #define FMASK_ALL (FMASK_NORMAL | FLAG_IOPL | FLAG_NT) #define SETFLAGBIT(TYPE,TEST) if (TEST) reg_flags|=FLAG_ ## TYPE; else reg_flags&=~FLAG_ ## TYPE diff --git a/include/render.h b/include/render.h index 3578be2..355dd67 100644 --- a/include/render.h +++ b/include/render.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/include/serialport.h b/include/serialport.h index eae6633..ddf1979 100644 --- a/include/serialport.h +++ b/include/serialport.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: serialport.h,v 1.18 2009-09-25 23:40:48 h-a-l-9000 Exp $ */ #ifndef DOSBOX_SERIALPORT_H #define DOSBOX_SERIALPORT_H diff --git a/include/setup.h b/include/setup.h index 47757f9..7f7954b 100644 --- a/include/setup.h +++ b/include/setup.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: setup.h,v 1.41 2009-05-27 09:15:41 qbix79 Exp $ */ #ifndef DOSBOX_SETUP_H #define DOSBOX_SETUP_H diff --git a/include/shell.h b/include/shell.h index 043b07c..875dffc 100644 --- a/include/shell.h +++ b/include/shell.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: shell.h,v 1.28 2009-07-03 19:36:57 qbix79 Exp $ */ #ifndef DOSBOX_SHELL_H #define DOSBOX_SHELL_H @@ -88,6 +87,8 @@ public: void CMD_HELP(char * args); void CMD_CLS(char * args); void CMD_COPY(char * args); + void CMD_DATE(char * args); + void CMD_TIME(char * args); void CMD_DIR(char * args); void CMD_DELETE(char * args); void CMD_ECHO(char * args); diff --git a/include/support.h b/include/support.h index 023c02b..ab49bad 100644 --- a/include/support.h +++ b/include/support.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: support.h,v 1.18 2009-05-27 09:15:41 qbix79 Exp $ */ #ifndef DOSBOX_SUPPORT_H #define DOSBOX_SUPPORT_H diff --git a/include/timer.h b/include/timer.h index b569186..c4f3c48 100644 --- a/include/timer.h +++ b/include/timer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/include/vga.h b/include/vga.h index f939b4a..6359675 100644 --- a/include/vga.h +++ b/include/vga.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: vga.h,v 1.48 2009-11-03 21:06:59 h-a-l-9000 Exp $ */ #ifndef DOSBOX_VGA_H #define DOSBOX_VGA_H @@ -173,8 +172,8 @@ typedef struct { Bit8u curmode; Bit16u originx, originy; Bit8u fstackpos, bstackpos; - Bit8u forestack[3]; - Bit8u backstack[3]; + Bit8u forestack[4]; + Bit8u backstack[4]; Bit16u startaddr; Bit8u posx, posy; Bit8u mc[64][64]; diff --git a/include/video.h b/include/video.h index ddd9cee..b78186b 100644 --- a/include/video.h +++ b/include/video.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: video.h,v 1.26 2009-05-27 09:15:41 qbix79 Exp $ */ #ifndef DOSBOX_VIDEO_H #define DOSBOX_VIDEO_H diff --git a/scripts/dosbox-installer.nsi b/scripts/dosbox-installer.nsi index d496b0a..d1c7798 100644 --- a/scripts/dosbox-installer.nsi +++ b/scripts/dosbox-installer.nsi @@ -2,7 +2,7 @@ !define VER_MINOR 74 !define APP_NAME "DOSBox ${VER_MAYOR}.${VER_MINOR} Installer" !define COMP_NAME "DOSBox Team" -!define COPYRIGHT "Copyright © 2002-2010 DOSBox Team" +!define COPYRIGHT "Copyright © 2002-2011 DOSBox Team" !define DESCRIPTION "DOSBox Installer" VIProductVersion "${VER_MAYOR}.${VER_MINOR}.0.0" diff --git a/src/cpu/callback.cpp b/src/cpu/callback.cpp index 6c89da6..c0475b1 100644 --- a/src/cpu/callback.cpp +++ b/src/cpu/callback.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: callback.cpp,v 1.42 2009-08-23 17:24:54 c2woody Exp $ */ #include #include @@ -46,7 +45,7 @@ Bitu CALLBACK_Allocate(void) { for (Bitu i=1;(i0) + if (!CPU_CycleAutoAdjust && CPU_Cycles>0) CPU_Cycles=0; } @@ -109,24 +108,24 @@ void CALLBACK_RunRealInt(Bit8u intnum) { } void CALLBACK_SZF(bool val) { - Bit16u tempf = mem_readw(SegPhys(ss)+reg_sp+4); - if (val) tempf |= FLAG_ZF; - else tempf &= ~FLAG_ZF; - mem_writew(SegPhys(ss)+reg_sp+4,tempf); + Bit16u tempf = mem_readw(SegPhys(ss)+reg_sp+4); + if (val) tempf |= FLAG_ZF; + else tempf &= ~FLAG_ZF; + mem_writew(SegPhys(ss)+reg_sp+4,tempf); } void CALLBACK_SCF(bool val) { - Bit16u tempf = mem_readw(SegPhys(ss)+reg_sp+4); - if (val) tempf |= FLAG_CF; - else tempf &= ~FLAG_CF; - mem_writew(SegPhys(ss)+reg_sp+4,tempf); + Bit16u tempf = mem_readw(SegPhys(ss)+reg_sp+4); + if (val) tempf |= FLAG_CF; + else tempf &= ~FLAG_CF; + mem_writew(SegPhys(ss)+reg_sp+4,tempf); } void CALLBACK_SIF(bool val) { - Bit16u tempf = mem_readw(SegPhys(ss)+reg_sp+4); - if (val) tempf |= FLAG_IF; - else tempf &= ~FLAG_IF; - mem_writew(SegPhys(ss)+reg_sp+4,tempf); + Bit16u tempf = mem_readw(SegPhys(ss)+reg_sp+4); + if (val) tempf |= FLAG_IF; + else tempf &= ~FLAG_IF; + mem_writew(SegPhys(ss)+reg_sp+4,tempf); } void CALLBACK_SetDescription(Bitu nr, const char* descr) { @@ -143,7 +142,7 @@ const char* CALLBACK_GetDescription(Bitu nr) { } Bitu CALLBACK_SetupExtra(Bitu callback, Bitu type, PhysPt physAddress, bool use_cb=true) { - if (callback>=CB_MAX) + if (callback>=CB_MAX) return 0; switch (type) { case CB_RETN: @@ -465,14 +464,14 @@ void CALLBACK_RemoveSetup(Bitu callback) { } } -CALLBACK_HandlerObject::~CALLBACK_HandlerObject(){ +void CALLBACK_HandlerObject::Uninstall(){ if(!installed) return; if(m_type == CALLBACK_HandlerObject::SETUP) { if(vectorhandler.installed){ //See if we are the current handler. if so restore the old one if(RealGetVec(vectorhandler.interrupt) == Get_RealPointer()) { RealSetVec(vectorhandler.interrupt,vectorhandler.old_vector); - } else + } else LOG(LOG_MISC,LOG_WARN)("Interrupt vector changed on %X %s",vectorhandler.interrupt,CALLBACK_GetDescription(m_callback)); } CALLBACK_RemoveSetup(m_callback); @@ -484,6 +483,11 @@ CALLBACK_HandlerObject::~CALLBACK_HandlerObject(){ if(CallBack_Description[m_callback]) delete [] CallBack_Description[m_callback]; CallBack_Description[m_callback] = 0; CALLBACK_DeAllocate(m_callback); + installed=false; +} + +CALLBACK_HandlerObject::~CALLBACK_HandlerObject(){ + Uninstall(); } void CALLBACK_HandlerObject::Install(CallBack_Handler handler,Bitu type,const char* description){ @@ -492,7 +496,7 @@ void CALLBACK_HandlerObject::Install(CallBack_Handler handler,Bitu type,const ch m_type=SETUP; m_callback=CALLBACK_Allocate(); CALLBACK_Setup(m_callback,handler,type,description); - } else E_Exit("Allready installed"); + } else E_Exit("Callback handler object already installed"); } void CALLBACK_HandlerObject::Install(CallBack_Handler handler,Bitu type,PhysPt addr,const char* description){ if(!installed) { @@ -500,7 +504,7 @@ void CALLBACK_HandlerObject::Install(CallBack_Handler handler,Bitu type,PhysPt a m_type=SETUP; m_callback=CALLBACK_Allocate(); CALLBACK_Setup(m_callback,handler,type,addr,description); - } else E_Exit("Allready installed"); + } else E_Exit("Callback handler object already installed"); } void CALLBACK_HandlerObject::Allocate(CallBack_Handler handler,const char* description) { @@ -510,7 +514,7 @@ void CALLBACK_HandlerObject::Allocate(CallBack_Handler handler,const char* descr m_callback=CALLBACK_Allocate(); CALLBACK_SetDescription(m_callback,description); CallBack_Handlers[m_callback]=handler; - } else E_Exit("Allready installed"); + } else E_Exit("Callback handler object already installed"); } void CALLBACK_HandlerObject::Set_RealVec(Bit8u vec){ @@ -549,7 +553,7 @@ void CALLBACK_Init(Section* /*sec*/) { CALLBACK_Setup(call_default,&default_handler,CB_IRET,"default"); call_default2=CALLBACK_Allocate(); CALLBACK_Setup(call_default2,&default_handler,CB_IRET,"default"); - + /* Only setup default handler for first part of interrupt table */ for (Bit16u ct=0;ct<0x60;ct++) { real_writed(0,ct*4,CALLBACK_RealPointer(call_default)); diff --git a/src/cpu/core_dyn_x86.cpp b/src/cpu/core_dyn_x86.cpp index 0aa88de..656a749 100644 --- a/src/cpu/core_dyn_x86.cpp +++ b/src/cpu/core_dyn_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: core_dyn_x86.cpp,v 1.36 2009-07-20 17:55:52 c2woody Exp $ */ #include "dosbox.h" @@ -61,11 +60,8 @@ #define DYN_PAGE_HASH (4096>>DYN_HASH_SHIFT) #define DYN_LINKS (16) -#if 0 -#define DYN_LOG LOG_MSG -#else -#define DYN_LOG -#endif +//#define DYN_LOG 1 //Turn logging on + #if C_FPU #define CPU_FPU 1 //Enable FPU escape instructions diff --git a/src/cpu/core_dyn_x86/cache.h b/src/cpu/core_dyn_x86/cache.h index 4519f99..fe5aeaa 100644 --- a/src/cpu/core_dyn_x86/cache.h +++ b/src/cpu/core_dyn_x86/cache.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: cache.h,v 1.20 2009-07-12 20:13:05 c2woody Exp $ */ class CacheBlock { public: diff --git a/src/cpu/core_dyn_x86/decoder.h b/src/cpu/core_dyn_x86/decoder.h index 51a1a07..7e73486 100644 --- a/src/cpu/core_dyn_x86/decoder.h +++ b/src/cpu/core_dyn_x86/decoder.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: decoder.h,v 1.59 2009-10-18 17:52:09 c2woody Exp $ */ #define X86_DYNFPU_DH_ENABLED #define X86_INLINED_MEMACCESS @@ -2104,7 +2103,9 @@ restart_prefix: case 0xbf:dyn_mov_ev_gw(true);break; default: - DYN_LOG("Unhandled dual opcode 0F%02X",dual_code); +#if DYN_LOG + LOG_MSG("Unhandled dual opcode 0F%02X",dual_code); +#endif goto illegalopcode; } }break; @@ -2670,7 +2671,9 @@ restart_prefix: }} break; default: -// DYN_LOG("Dynamic unhandled opcode %X",opcode); +#if DYN_LOG +// LOG_MSG("Dynamic unhandled opcode %X",opcode); +#endif goto illegalopcode; } } diff --git a/src/cpu/core_dyn_x86/dyn_fpu.h b/src/cpu/core_dyn_x86/dyn_fpu.h index 40a4c5f..c43fbe2 100644 --- a/src/cpu/core_dyn_x86/dyn_fpu.h +++ b/src/cpu/core_dyn_x86/dyn_fpu.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dyn_fpu.h,v 1.5 2009-09-23 20:55:19 c2woody Exp $ */ #include "dosbox.h" #if C_FPU diff --git a/src/cpu/core_dyn_x86/dyn_fpu_dh.h b/src/cpu/core_dyn_x86/dyn_fpu_dh.h index 165e896..98f0c0a 100644 --- a/src/cpu/core_dyn_x86/dyn_fpu_dh.h +++ b/src/cpu/core_dyn_x86/dyn_fpu_dh.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dyn_fpu_dh.h,v 1.7 2009-09-23 20:55:19 c2woody Exp $ */ #include "dosbox.h" #if C_FPU diff --git a/src/cpu/core_dyn_x86/helpers.h b/src/cpu/core_dyn_x86/helpers.h index 5e718a5..95a8c00 100644 --- a/src/cpu/core_dyn_x86/helpers.h +++ b/src/cpu/core_dyn_x86/helpers.h @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2002-2011 The DOSBox Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + static bool dyn_helper_divb(Bit8u val) { if (!val) return CPU_PrepareException(0,0); Bitu quo=reg_ax / val; diff --git a/src/cpu/core_dyn_x86/risc_x86.h b/src/cpu/core_dyn_x86/risc_x86.h index b7eb88a..b9e3c3f 100644 --- a/src/cpu/core_dyn_x86/risc_x86.h +++ b/src/cpu/core_dyn_x86/risc_x86.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: risc_x86.h,v 1.32 2009-05-27 09:15:41 qbix79 Exp $ */ static void gen_init(void); diff --git a/src/cpu/core_dyn_x86/string.h b/src/cpu/core_dyn_x86/string.h index 172f70a..fe99b6c 100644 --- a/src/cpu/core_dyn_x86/string.h +++ b/src/cpu/core_dyn_x86/string.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/cpu/core_dynrec.cpp b/src/cpu/core_dynrec.cpp index 148a5b0..b20900e 100644 --- a/src/cpu/core_dynrec.cpp +++ b/src/cpu/core_dynrec.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: core_dynrec.cpp,v 1.15 2009-08-02 16:52:33 c2woody Exp $ */ #include "dosbox.h" @@ -62,11 +61,9 @@ #define DYN_PAGE_HASH (4096>>DYN_HASH_SHIFT) #define DYN_LINKS (16) -#if 0 -#define DYN_LOG LOG_MSG -#else -#define DYN_LOG -#endif + +//#define DYN_LOG 1 //Turn Logging on. + #if C_FPU #define CPU_FPU 1 //Enable FPU escape instructions diff --git a/src/cpu/core_dynrec/cache.h b/src/cpu/core_dynrec/cache.h index 3696427..fd742c7 100644 --- a/src/cpu/core_dynrec/cache.h +++ b/src/cpu/core_dynrec/cache.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/cpu/core_dynrec/decoder.h b/src/cpu/core_dynrec/decoder.h index c05729a..383ef5c 100644 --- a/src/cpu/core_dynrec/decoder.h +++ b/src/cpu/core_dynrec/decoder.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: decoder.h,v 1.8 2009-10-18 17:52:10 c2woody Exp $ */ #include "decoder_basic.h" @@ -242,7 +241,9 @@ restart_prefix: case 0xbf:dyn_movx_ev_gw(true);break; default: -// DYN_LOG("Unhandled dual opcode 0F%02X",dual_code); +#if DYN_LOG +// LOG_MSG("Unhandled dual opcode 0F%02X",dual_code); +#endif goto illegalopcode; } break; @@ -579,7 +580,9 @@ restart_prefix: break; default: -// DYN_LOG("Dynrec unhandled opcode %X",opcode); +#if DYN_LOG +// LOG_MSG("Dynrec unhandled opcode %X",opcode); +#endif goto illegalopcode; } } diff --git a/src/cpu/core_dynrec/decoder_basic.h b/src/cpu/core_dynrec/decoder_basic.h index d50b9e1..e93abdb 100644 --- a/src/cpu/core_dynrec/decoder_basic.h +++ b/src/cpu/core_dynrec/decoder_basic.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: decoder_basic.h,v 1.16 2009-10-08 20:01:31 c2woody Exp $ */ /* diff --git a/src/cpu/core_dynrec/decoder_opcodes.h b/src/cpu/core_dynrec/decoder_opcodes.h index fa54362..78891e5 100644 --- a/src/cpu/core_dynrec/decoder_opcodes.h +++ b/src/cpu/core_dynrec/decoder_opcodes.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: decoder_opcodes.h,v 1.10 2009-10-18 17:52:10 c2woody Exp $ */ /* diff --git a/src/cpu/core_dynrec/dyn_fpu.h b/src/cpu/core_dynrec/dyn_fpu.h index 49e3f6c..fcf0c8c 100644 --- a/src/cpu/core_dynrec/dyn_fpu.h +++ b/src/cpu/core_dynrec/dyn_fpu.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dyn_fpu.h,v 1.8 2009-09-23 20:55:19 c2woody Exp $ */ #include "dosbox.h" diff --git a/src/cpu/core_dynrec/operators.h b/src/cpu/core_dynrec/operators.h index 43cabc5..fa845d8 100644 --- a/src/cpu/core_dynrec/operators.h +++ b/src/cpu/core_dynrec/operators.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: operators.h,v 1.8 2009-06-25 19:31:43 c2woody Exp $ */ static Bit8u DRC_CALL_CONV dynrec_add_byte(Bit8u op1,Bit8u op2) DRC_FC; diff --git a/src/cpu/core_dynrec/risc_armv4le-common.h b/src/cpu/core_dynrec/risc_armv4le-common.h index 7b63b4c..7cf5912 100644 --- a/src/cpu/core_dynrec/risc_armv4le-common.h +++ b/src/cpu/core_dynrec/risc_armv4le-common.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: risc_armv4le-common.h,v 1.3 2009-05-16 21:52:47 c2woody Exp $ */ /* ARMv4 (little endian) backend by M-HT (common data/functions) */ diff --git a/src/cpu/core_dynrec/risc_armv4le-o3.h b/src/cpu/core_dynrec/risc_armv4le-o3.h index 9b8f1a5..2ddd3f9 100644 --- a/src/cpu/core_dynrec/risc_armv4le-o3.h +++ b/src/cpu/core_dynrec/risc_armv4le-o3.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: risc_armv4le-o3.h,v 1.6 2009-06-27 12:51:10 c2woody Exp $ */ /* ARMv4 (little endian) backend by M-HT (size-tweaked arm version) */ diff --git a/src/cpu/core_dynrec/risc_armv4le-s3.h b/src/cpu/core_dynrec/risc_armv4le-s3.h index c9ab402..56ce3ea 100644 --- a/src/cpu/core_dynrec/risc_armv4le-s3.h +++ b/src/cpu/core_dynrec/risc_armv4le-s3.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: risc_armv4le-s3.h,v 1.6 2009-06-27 12:51:10 c2woody Exp $ */ /* ARMv4 (little endian) backend by M-HT (speed-tweaked arm version) */ diff --git a/src/cpu/core_dynrec/risc_armv4le-thumb-iw.h b/src/cpu/core_dynrec/risc_armv4le-thumb-iw.h index 5637896..e7aeea3 100644 --- a/src/cpu/core_dynrec/risc_armv4le-thumb-iw.h +++ b/src/cpu/core_dynrec/risc_armv4le-thumb-iw.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: risc_armv4le-thumb-iw.h,v 1.5 2009-06-27 12:51:10 c2woody Exp $ */ /* ARMv4 (little endian) backend by M-HT (thumb version with data pool, requires -mthumb-interwork switch when compiling dosbox) */ diff --git a/src/cpu/core_dynrec/risc_armv4le-thumb-niw.h b/src/cpu/core_dynrec/risc_armv4le-thumb-niw.h index 4e032a7..6bd185b 100644 --- a/src/cpu/core_dynrec/risc_armv4le-thumb-niw.h +++ b/src/cpu/core_dynrec/risc_armv4le-thumb-niw.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: risc_armv4le-thumb-niw.h,v 1.5 2009-06-27 12:51:10 c2woody Exp $ */ /* ARMv4 (little endian) backend by M-HT (thumb version with data pool) */ diff --git a/src/cpu/core_dynrec/risc_armv4le-thumb.h b/src/cpu/core_dynrec/risc_armv4le-thumb.h index ccd67ff..02237cd 100644 --- a/src/cpu/core_dynrec/risc_armv4le-thumb.h +++ b/src/cpu/core_dynrec/risc_armv4le-thumb.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: risc_armv4le-thumb.h,v 1.6 2009-06-27 12:51:10 c2woody Exp $ */ /* ARMv4 (little endian) backend by M-HT (thumb version) */ diff --git a/src/cpu/core_dynrec/risc_armv4le.h b/src/cpu/core_dynrec/risc_armv4le.h index 3c9b18d..8d2ece8 100644 --- a/src/cpu/core_dynrec/risc_armv4le.h +++ b/src/cpu/core_dynrec/risc_armv4le.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: risc_armv4le.h,v 1.3 2009-05-27 09:15:41 qbix79 Exp $ */ /* ARMv4 (little endian) backend (switcher) by M-HT */ diff --git a/src/cpu/core_dynrec/risc_mipsel32.h b/src/cpu/core_dynrec/risc_mipsel32.h index e67c57e..89a26c9 100644 --- a/src/cpu/core_dynrec/risc_mipsel32.h +++ b/src/cpu/core_dynrec/risc_mipsel32.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: risc_mipsel32.h,v 1.6 2009-06-25 19:31:43 c2woody Exp $ */ /* MIPS32 (little endian) backend by crazyc */ diff --git a/src/cpu/core_dynrec/risc_x64.h b/src/cpu/core_dynrec/risc_x64.h index 6eefde6..c8f9e21 100644 --- a/src/cpu/core_dynrec/risc_x64.h +++ b/src/cpu/core_dynrec/risc_x64.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: risc_x64.h,v 1.13 2009-06-25 19:31:43 c2woody Exp $ */ // some configuring defines that specify the capabilities of this architecture @@ -84,7 +83,7 @@ static void gen_mov_regs(HostReg reg_dst,HostReg reg_src) { } -static INLINE void gen_memaddr(HostReg reg,void* data) { +static INLINE void gen_reg_memaddr(HostReg reg,void* data) { Bit64s diff = (Bit64s)data-((Bit64s)cache.pos+5); if ((diff<0x80000000LL) && (diff>-0x80000000LL)) { cache_addb(0x05+(reg<<3)); @@ -98,13 +97,28 @@ static INLINE void gen_memaddr(HostReg reg,void* data) { } } +static INLINE void gen_memaddr(Bitu op,void* data,Bitu off) { + Bit64s diff; + diff = (Bit64s)data-((Bit64s)cache.pos+off+5); + if ((diff<0x80000000LL) && (diff>-0x80000000LL)) { + // RIP-relative addressing is offset after the instruction + cache_addb(op+1); + cache_addd((Bit32u)(((Bit64u)diff)&0xffffffffLL)); + } else if ((Bit64u)data<0x100000000LL) { + cache_addb(op); + cache_addb(0x25); + cache_addd((Bit32u)(((Bit64u)data)&0xffffffffLL)); + } else { + E_Exit("DRC64:Unhandled memory reference"); + } +} // move a 32bit (dword==true) or 16bit (dword==false) value from memory into dest_reg // 16bit moves may destroy the upper 16bit of the destination register static void gen_mov_word_to_reg(HostReg dest_reg,void* data,bool dword) { if (!dword) cache_addb(0x66); cache_addb(0x8b); // mov reg,[data] - gen_memaddr(dest_reg,data); + gen_reg_memaddr(dest_reg,data); } // move a 16bit constant value into dest_reg @@ -125,7 +139,7 @@ static void gen_mov_dword_to_reg_imm(HostReg dest_reg,Bit32u imm) { static void gen_mov_word_from_reg(HostReg src_reg,void* dest,bool dword) { if (!dword) cache_addb(0x66); cache_addb(0x89); // mov [data],reg - gen_memaddr(src_reg,dest); + gen_reg_memaddr(src_reg,dest); } // move an 8bit value from memory into dest_reg @@ -134,7 +148,7 @@ static void gen_mov_word_from_reg(HostReg src_reg,void* dest,bool dword) { // registers might not be directly byte-accessible on some architectures static void gen_mov_byte_to_reg_low(HostReg dest_reg,void* data) { cache_addb(0x8a); // mov reg,[data] - gen_memaddr(dest_reg,data); + gen_reg_memaddr(dest_reg,data); } // move an 8bit value from memory into dest_reg @@ -144,7 +158,7 @@ static void gen_mov_byte_to_reg_low(HostReg dest_reg,void* data) { static void gen_mov_byte_to_reg_low_canuseword(HostReg dest_reg,void* data) { cache_addb(0x66); cache_addb(0x8b); // mov reg,[data] - gen_memaddr(dest_reg,data); + gen_reg_memaddr(dest_reg,data); } // move an 8bit constant value into dest_reg @@ -169,7 +183,7 @@ static void gen_mov_byte_to_reg_low_imm_canuseword(HostReg dest_reg,Bit8u imm) { // move the lowest 8bit of a register into memory static void gen_mov_byte_from_reg_low(HostReg src_reg,void* dest) { cache_addb(0x88); // mov [data],reg - gen_memaddr(src_reg,dest); + gen_reg_memaddr(src_reg,dest); } @@ -193,7 +207,7 @@ static void gen_extend_word(bool sign,HostReg reg) { // add a 32bit value from memory to a full register static void gen_add(HostReg reg,void* op) { cache_addb(0x03); // add reg,[data] - gen_memaddr(reg,op); + gen_reg_memaddr(reg,op); } // add a 32bit constant value to a full register @@ -212,9 +226,8 @@ static void gen_and_imm(HostReg reg,Bit32u imm) { // move a 32bit constant value into memory static void gen_mov_direct_dword(void* dest,Bit32u imm) { - cache_addw(0x04c7); // mov [data],imm - cache_addb(0x25); - cache_addd((Bit32u)(((Bit64u)dest)&0xffffffffLL)); + cache_addb(0xc7); // mov [data],imm + gen_memaddr(0x04,dest,4); cache_addd(imm); } @@ -235,9 +248,8 @@ static void INLINE gen_mov_direct_ptr(void* dest,DRC_PTR_SIZE_IM imm) { // add an 8bit constant value to a memory value static void gen_add_direct_byte(void* dest,Bit8s imm) { - cache_addw(0x0483); // add [data],imm - cache_addb(0x25); - cache_addd((Bit32u)(((Bit64u)dest)&0xffffffffLL)); + cache_addb(0x83); // add [data],imm + gen_memaddr(0x4,dest,1); cache_addb(imm); } @@ -248,18 +260,20 @@ static void gen_add_direct_word(void* dest,Bit32u imm,bool dword) { return; } if (!dword) cache_addb(0x66); - cache_addw(0x0481); // add [data],imm - cache_addb(0x25); - cache_addd((Bit32u)(((Bit64u)dest)&0xffffffffLL)); - if (dword) cache_addd((Bit32u)imm); - else cache_addw((Bit16u)imm); + cache_addb(0x81); // add [data],imm + if (dword) { + gen_memaddr(0x4,dest,4); // size of following immediate value + cache_addd((Bit32u)imm); + } else { + gen_memaddr(0x4,dest,2); // size of following immediate value + cache_addw((Bit16u)imm); + } } // subtract an 8bit constant value from a memory value static void gen_sub_direct_byte(void* dest,Bit8s imm) { - cache_addw(0x2c83); // sub [data],imm - cache_addb(0x25); - cache_addd((Bit32u)(((Bit64u)dest)&0xffffffffLL)); + cache_addb(0x83); // sub [data],imm + gen_memaddr(0x2c,dest,1); cache_addb(imm); } @@ -270,11 +284,14 @@ static void gen_sub_direct_word(void* dest,Bit32u imm,bool dword) { return; } if (!dword) cache_addb(0x66); - cache_addw(0x2c81); // sub [data],imm - cache_addb(0x25); - cache_addd((Bit32u)(((Bit64u)dest)&0xffffffffLL)); - if (dword) cache_addd((Bit32u)imm); - else cache_addw((Bit16u)imm); + cache_addw(0x81); // sub [data],imm + if (dword) { + gen_memaddr(0x2c,dest,4); // size of following immediate value + cache_addd((Bit32u)imm); + } else { + gen_memaddr(0x2c,dest,2); // size of following immediate value + cache_addw((Bit16u)imm); + } } @@ -324,10 +341,18 @@ static INLINE void gen_lea(HostReg dest_reg,Bitu scale,Bits imm) { // generate a call to a parameterless function static void INLINE gen_call_function_raw(void * func) { + cache_addb(0x48); + cache_addw(0xec83); + cache_addb(0x08); // sub rsp,0x08 (align stack to 16 byte boundary) + cache_addb(0x48); cache_addb(0xb8); // mov reg,imm64 cache_addq((Bit64u)func); cache_addw(0xd0ff); + + cache_addb(0x48); + cache_addw(0xc483); + cache_addb(0x08); // add rsp,0x08 (reset alignment) } // generate a call to a function with paramcount parameters @@ -350,9 +375,13 @@ static Bit64u INLINE gen_call_function_setup(void * func,Bitu paramcount,bool fa cache_addw(0xc483); // add rsp,0x08 cache_addb(0x08); + // stack is 16 byte aligned now + + cache_addb(0x50); // push rax (==old rsp) - Bit64u proc_addr=(Bit64u)cache.pos; + // returned address relates to where the address is stored in gen_call_function_raw + Bit64u proc_addr=(Bit64u)cache.pos-4; // Do the actual call to the procedure cache_addb(0x48); @@ -596,6 +625,8 @@ static void gen_return_function(void) { #ifdef DRC_FLAGS_INVALIDATION // called when a call to a function can be replaced by a // call to a simpler function +// check gen_call_function_raw and gen_call_function_setup +// for the targeted code static void gen_fill_function_ptr(Bit8u * pos,void* fct_ptr,Bitu flags_type) { #ifdef DRC_FLAGS_INVALIDATION_DCODE // try to avoid function calls but rather directly fill in code @@ -604,36 +635,46 @@ static void gen_fill_function_ptr(Bit8u * pos,void* fct_ptr,Bitu flags_type) { case t_ADDw: case t_ADDd: *(Bit32u*)(pos+0)=0xf001f889; // mov eax,edi; add eax,esi - *(Bit32u*)(pos+4)=0x909006eb; // skip + *(Bit32u*)(pos+4)=0x90900eeb; // skip *(Bit32u*)(pos+8)=0x90909090; + *(Bit32u*)(pos+12)=0x90909090; + *(Bit32u*)(pos+16)=0x90909090; break; case t_ORb: case t_ORw: case t_ORd: *(Bit32u*)(pos+0)=0xf009f889; // mov eax,edi; or eax,esi - *(Bit32u*)(pos+4)=0x909006eb; // skip + *(Bit32u*)(pos+4)=0x90900eeb; // skip *(Bit32u*)(pos+8)=0x90909090; + *(Bit32u*)(pos+12)=0x90909090; + *(Bit32u*)(pos+16)=0x90909090; break; case t_ANDb: case t_ANDw: case t_ANDd: *(Bit32u*)(pos+0)=0xf021f889; // mov eax,edi; and eax,esi - *(Bit32u*)(pos+4)=0x909006eb; // skip + *(Bit32u*)(pos+4)=0x90900eeb; // skip *(Bit32u*)(pos+8)=0x90909090; + *(Bit32u*)(pos+12)=0x90909090; + *(Bit32u*)(pos+16)=0x90909090; break; case t_SUBb: case t_SUBw: case t_SUBd: *(Bit32u*)(pos+0)=0xf029f889; // mov eax,edi; sub eax,esi - *(Bit32u*)(pos+4)=0x909006eb; // skip + *(Bit32u*)(pos+4)=0x90900eeb; // skip *(Bit32u*)(pos+8)=0x90909090; + *(Bit32u*)(pos+12)=0x90909090; + *(Bit32u*)(pos+16)=0x90909090; break; case t_XORb: case t_XORw: case t_XORd: *(Bit32u*)(pos+0)=0xf031f889; // mov eax,edi; xor eax,esi - *(Bit32u*)(pos+4)=0x909006eb; // skip + *(Bit32u*)(pos+4)=0x90900eeb; // skip *(Bit32u*)(pos+8)=0x90909090; + *(Bit32u*)(pos+12)=0x90909090; + *(Bit32u*)(pos+16)=0x90909090; break; case t_CMPb: case t_CMPw: @@ -641,37 +682,45 @@ static void gen_fill_function_ptr(Bit8u * pos,void* fct_ptr,Bitu flags_type) { case t_TESTb: case t_TESTw: case t_TESTd: - *(Bit32u*)(pos+0)=0x90900aeb; // skip + *(Bit32u*)(pos+0)=0x909012eb; // skip *(Bit32u*)(pos+4)=0x90909090; *(Bit32u*)(pos+8)=0x90909090; + *(Bit32u*)(pos+12)=0x90909090; + *(Bit32u*)(pos+16)=0x90909090; break; case t_INCb: case t_INCw: case t_INCd: *(Bit32u*)(pos+0)=0xc0fff889; // mov eax,edi; inc eax - *(Bit32u*)(pos+4)=0x909006eb; // skip + *(Bit32u*)(pos+4)=0x90900eeb; // skip *(Bit32u*)(pos+8)=0x90909090; + *(Bit32u*)(pos+12)=0x90909090; + *(Bit32u*)(pos+16)=0x90909090; break; case t_DECb: case t_DECw: case t_DECd: *(Bit32u*)(pos+0)=0xc8fff889; // mov eax,edi; dec eax - *(Bit32u*)(pos+4)=0x909006eb; // skip + *(Bit32u*)(pos+4)=0x90900eeb; // skip *(Bit32u*)(pos+8)=0x90909090; + *(Bit32u*)(pos+12)=0x90909090; + *(Bit32u*)(pos+16)=0x90909090; break; case t_NEGb: case t_NEGw: case t_NEGd: *(Bit32u*)(pos+0)=0xd8f7f889; // mov eax,edi; neg eax - *(Bit32u*)(pos+4)=0x909006eb; // skip + *(Bit32u*)(pos+4)=0x90900eeb; // skip *(Bit32u*)(pos+8)=0x90909090; + *(Bit32u*)(pos+12)=0x90909090; + *(Bit32u*)(pos+16)=0x90909090; break; default: - *(Bit64u*)(pos+2)=(Bit64u)fct_ptr; // fill function pointer + *(Bit64u*)(pos+6)=(Bit64u)fct_ptr; // fill function pointer break; } #else - *(Bit64u*)(pos+2)=(Bit64u)fct_ptr; + *(Bit64u*)(pos+6)=(Bit64u)fct_ptr; // fill function pointer #endif } #endif diff --git a/src/cpu/core_dynrec/risc_x86.h b/src/cpu/core_dynrec/risc_x86.h index 749b28a..68c910e 100644 --- a/src/cpu/core_dynrec/risc_x86.h +++ b/src/cpu/core_dynrec/risc_x86.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: risc_x86.h,v 1.10 2009-06-25 19:31:43 c2woody Exp $ */ // some configuring defines that specify the capabilities of this architecture diff --git a/src/cpu/core_full.cpp b/src/cpu/core_full.cpp index c04d3af..b8de4bc 100644 --- a/src/cpu/core_full.cpp +++ b/src/cpu/core_full.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/cpu/core_full/ea_lookup.h b/src/cpu/core_full/ea_lookup.h index b10d9b5..05353bf 100644 --- a/src/cpu/core_full/ea_lookup.h +++ b/src/cpu/core_full/ea_lookup.h @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2002-2011 The DOSBox Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + { EAPoint seg_base; Bit16u off; diff --git a/src/cpu/core_full/load.h b/src/cpu/core_full/load.h index 6e3fa8d..664a0a6 100644 --- a/src/cpu/core_full/load.h +++ b/src/cpu/core_full/load.h @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2002-2011 The DOSBox Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + switch (inst.code.load) { /* General loading */ case L_POPwRM: @@ -482,6 +500,13 @@ l_M_Ed: case D_ICEBP: CPU_SW_Interrupt_NoIOPLCheck(1,GetIP()); continue; + case D_RDTSC: { + if (CPU_ArchitectureType>32); + reg_eax=(Bit32u)(tsc&0xffffffff); + break; + } default: LOG(LOG_CPU,LOG_ERROR)("LOAD:Unhandled code %d opcode %X",inst.code.load,inst.entry); goto illegalopcode; diff --git a/src/cpu/core_full/loadwrite.h b/src/cpu/core_full/loadwrite.h index 887c2a9..1429f8a 100644 --- a/src/cpu/core_full/loadwrite.h +++ b/src/cpu/core_full/loadwrite.h @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2002-2011 The DOSBox Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + #define SaveIP() reg_eip=(Bit32u)(inst.cseip-SegBase(cs)); #define LoadIP() inst.cseip=SegBase(cs)+reg_eip; #define GetIP() (inst.cseip-SegBase(cs)) diff --git a/src/cpu/core_full/op.h b/src/cpu/core_full/op.h index 432a113..9c45bc7 100644 --- a/src/cpu/core_full/op.h +++ b/src/cpu/core_full/op.h @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2002-2011 The DOSBox Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + /* Do the actual opcode */ switch (inst.code.op) { case t_ADDb: case t_ADDw: case t_ADDd: diff --git a/src/cpu/core_full/optable.h b/src/cpu/core_full/optable.h index 7d1f894..544cf88 100644 --- a/src/cpu/core_full/optable.h +++ b/src/cpu/core_full/optable.h @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2002-2011 The DOSBox Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + /* Big ass opcode table normal,double, 66 normal, 66 double */ static OpCode OpCodeTable[1024]={ /* 0x00 - 0x07 */ @@ -216,7 +234,7 @@ static OpCode OpCodeTable[1024]={ {0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 }, /* 0x130 - 0x137 */ -{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 }, +{0 ,0 ,0 ,0 },{D_RDTSC ,0 ,0 ,0 }, {0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 }, {0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 }, {0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 }, @@ -572,7 +590,7 @@ static OpCode OpCodeTable[1024]={ {0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 }, /* 0x330 - 0x337 */ -{0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 }, +{0 ,0 ,0 ,0 },{D_RDTSC ,0 ,0 ,0 }, {0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 }, {0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 }, {0 ,0 ,0 ,0 },{0 ,0 ,0 ,0 }, diff --git a/src/cpu/core_full/save.h b/src/cpu/core_full/save.h index c79ab26..b4708a4 100644 --- a/src/cpu/core_full/save.h +++ b/src/cpu/core_full/save.h @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2002-2011 The DOSBox Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + /* Write the data from the opcode */ switch (inst.code.save) { /* Byte */ diff --git a/src/cpu/core_full/string.h b/src/cpu/core_full/string.h index 709a155..e276735 100644 --- a/src/cpu/core_full/string.h +++ b/src/cpu/core_full/string.h @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2002-2011 The DOSBox Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + { EAPoint si_base,di_base; Bitu si_index,di_index; diff --git a/src/cpu/core_full/support.h b/src/cpu/core_full/support.h index 14b0964..bbd32c2 100644 --- a/src/cpu/core_full/support.h +++ b/src/cpu/core_full/support.h @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2002-2011 The DOSBox Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + enum { L_N=0, L_SKIP, @@ -46,6 +64,7 @@ enum { D_CPUID, D_HLT,D_CLTS, D_LOCK,D_ICEBP, + D_RDTSC, L_ERROR }; diff --git a/src/cpu/core_normal.cpp b/src/cpu/core_normal.cpp index 5ac403e..64fc1cb 100644 --- a/src/cpu/core_normal.cpp +++ b/src/cpu/core_normal.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/cpu/core_normal/helpers.h b/src/cpu/core_normal/helpers.h index 28ab13c..45bdc45 100644 --- a/src/cpu/core_normal/helpers.h +++ b/src/cpu/core_normal/helpers.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/cpu/core_normal/prefix_0f.h b/src/cpu/core_normal/prefix_0f.h index ea9548a..1be0053 100644 --- a/src/cpu/core_normal/prefix_0f.h +++ b/src/cpu/core_normal/prefix_0f.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/cpu/core_normal/prefix_66.h b/src/cpu/core_normal/prefix_66.h index c36353e..8bb24be 100644 --- a/src/cpu/core_normal/prefix_66.h +++ b/src/cpu/core_normal/prefix_66.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/cpu/core_normal/prefix_66_0f.h b/src/cpu/core_normal/prefix_66_0f.h index 6f2735a..19d87c9 100644 --- a/src/cpu/core_normal/prefix_66_0f.h +++ b/src/cpu/core_normal/prefix_66_0f.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/cpu/core_normal/prefix_none.h b/src/cpu/core_normal/prefix_none.h index 96c651c..2014a5c 100644 --- a/src/cpu/core_normal/prefix_none.h +++ b/src/cpu/core_normal/prefix_none.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -879,7 +879,7 @@ { Bitu port=Fetchb(); if (CPU_IO_Exception(port,2)) RUNEXCEPTION(); - reg_al=IO_ReadW(port); + reg_ax=IO_ReadW(port); break; } CASE_B(0xe6) /* OUT Ib,AL */ diff --git a/src/cpu/core_normal/string.h b/src/cpu/core_normal/string.h index 411fad8..6a33233 100644 --- a/src/cpu/core_normal/string.h +++ b/src/cpu/core_normal/string.h @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2002-2011 The DOSBox Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + enum STRING_OP { R_OUTSB,R_OUTSW,R_OUTSD, R_INSB,R_INSW,R_INSD, diff --git a/src/cpu/core_normal/support.h b/src/cpu/core_normal/support.h index 9ef98aa..79badb0 100644 --- a/src/cpu/core_normal/support.h +++ b/src/cpu/core_normal/support.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/cpu/core_normal/table_ea.h b/src/cpu/core_normal/table_ea.h index 22718e7..c15e127 100644 --- a/src/cpu/core_normal/table_ea.h +++ b/src/cpu/core_normal/table_ea.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/cpu/core_prefetch.cpp b/src/cpu/core_prefetch.cpp index acb2959..f344142 100644 --- a/src/cpu/core_prefetch.cpp +++ b/src/cpu/core_prefetch.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: core_prefetch.cpp,v 1.3 2009-06-26 16:43:30 c2woody Exp $ */ #include diff --git a/src/cpu/core_simple.cpp b/src/cpu/core_simple.cpp index 4fadc3c..e61b84c 100644 --- a/src/cpu/core_simple.cpp +++ b/src/cpu/core_simple.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/cpu/cpu.cpp b/src/cpu/cpu.cpp index 6cdc817..e70a807 100644 --- a/src/cpu/cpu.cpp +++ b/src/cpu/cpu.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: cpu.cpp,v 1.116 2009-03-16 18:10:08 c2woody Exp $ */ #include #include @@ -68,7 +67,7 @@ Bitu CPU_AutoDetermineMode = 0; Bitu CPU_ArchitectureType = CPU_ARCHTYPE_MIXED; -Bitu CPU_flag_id_toggle=0; +Bitu CPU_extflags_toggle=0; // ID and AC flags may be toggled depending on emulated CPU architecture Bitu CPU_PrefetchQueueSize=0; @@ -174,7 +173,7 @@ PhysPt SelBase(Bitu sel) { void CPU_SetFlags(Bitu word,Bitu mask) { - mask|=CPU_flag_id_toggle; // ID-flag can be toggled on cpuid-supporting CPUs + mask|=CPU_extflags_toggle; // ID-flag and AC-flag can be toggled on CPUID-supporting CPUs reg_flags=(reg_flags & ~mask)|(word & mask)|2; cpu.direction=1-((reg_flags & FLAG_DF) >> 9); } @@ -1551,6 +1550,7 @@ void CPU_SET_CRX(Bitu cr,Bitu value) { switch (cr) { case 0: { + value|=CR0_FPUPRESENT; Bitu changed=cpu.cr0 ^ value; if (!changed) return; cpu.cr0=value; @@ -2052,6 +2052,7 @@ static Bits HLT_Decode(void) { if (reg_eip!=cpu.hlt.eip || SegValue(cs) != cpu.hlt.cs) { cpudecoder=cpu.hlt.old_decoder; } else { + CPU_IODelayRemoved += CPU_Cycles; CPU_Cycles=0; } return 0; @@ -2059,6 +2060,7 @@ static Bits HLT_Decode(void) { void CPU_HLT(Bitu oldeip) { reg_eip=oldeip; + CPU_IODelayRemoved += CPU_Cycles; CPU_Cycles=0; cpu.hlt.cs=SegValue(cs); cpu.hlt.eip=reg_eip; @@ -2391,8 +2393,9 @@ public: CPU_ArchitectureType = CPU_ARCHTYPE_PENTIUMSLOW; } - if (CPU_ArchitectureType>=CPU_ARCHTYPE_486NEWSLOW) CPU_flag_id_toggle=FLAG_ID; - else CPU_flag_id_toggle=0; + if (CPU_ArchitectureType>=CPU_ARCHTYPE_486NEWSLOW) CPU_extflags_toggle=(FLAG_ID|FLAG_AC); + else if (CPU_ArchitectureType>=CPU_ARCHTYPE_486OLDSLOW) CPU_extflags_toggle=(FLAG_AC); + else CPU_extflags_toggle=0; if(CPU_CycleMax <= 0) CPU_CycleMax = 3000; diff --git a/src/cpu/flags.cpp b/src/cpu/flags.cpp index af022d7..d293ae3 100644 --- a/src/cpu/flags.cpp +++ b/src/cpu/flags.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/cpu/instructions.h b/src/cpu/instructions.h index f5f89a4..0a4f5ab 100644 --- a/src/cpu/instructions.h +++ b/src/cpu/instructions.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/cpu/lazyflags.h b/src/cpu/lazyflags.h index 84459b9..37cc5cf 100644 --- a/src/cpu/lazyflags.h +++ b/src/cpu/lazyflags.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/cpu/modrm.cpp b/src/cpu/modrm.cpp index 4a70e1d..e524a79 100644 --- a/src/cpu/modrm.cpp +++ b/src/cpu/modrm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/cpu/modrm.h b/src/cpu/modrm.h index 0da13de..8cf9f8f 100644 --- a/src/cpu/modrm.h +++ b/src/cpu/modrm.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/cpu/paging.cpp b/src/cpu/paging.cpp index 0ac0bc5..1b415d7 100644 --- a/src/cpu/paging.cpp +++ b/src/cpu/paging.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: paging.cpp,v 1.36 2009-05-27 09:15:41 qbix79 Exp $ */ #include #include @@ -44,16 +43,16 @@ Bitu PageHandler::readb(PhysPt addr) { return 0; } Bitu PageHandler::readw(PhysPt addr) { - return - (readb(addr+0) << 0) | - (readb(addr+1) << 8); + Bitu ret = (readb(addr+0) << 0); + ret |= (readb(addr+1) << 8); + return ret; } Bitu PageHandler::readd(PhysPt addr) { - return - (readb(addr+0) << 0) | - (readb(addr+1) << 8) | - (readb(addr+2) << 16) | - (readb(addr+3) << 24); + Bitu ret = (readb(addr+0) << 0); + ret |= (readb(addr+1) << 8); + ret |= (readb(addr+2) << 16); + ret |= (readb(addr+3) << 24); + return ret; } void PageHandler::writeb(PhysPt addr,Bitu /*val*/) { diff --git a/src/debug/debug.cpp b/src/debug/debug.cpp index 1e0955a..d7e27a5 100644 --- a/src/debug/debug.cpp +++ b/src/debug/debug.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: debug.cpp,v 1.97 2009-04-11 19:49:52 c2woody Exp $ */ #include "dosbox.h" #if C_DEBUG @@ -1726,7 +1725,10 @@ Bit32u DEBUG_CheckKeys(void) { } if (ret<0) return ret; if (ret>0) { - ret=(*CallBack_Handlers[ret])(); + if (GCC_UNLIKELY(ret >= CB_MAX)) + ret = 0; + else + ret = (*CallBack_Handlers[ret])(); if (ret) { exitLoop=true; CPU_Cycles=CPU_CycleLeft=0; @@ -2174,11 +2176,11 @@ CDebugVar* CDebugVar::FindVar(PhysPt pt) return 0; }; -bool CDebugVar::SaveVars(char* name) -{ +bool CDebugVar::SaveVars(char* name) { + if (varList.size()>65535) return false; + FILE* f = fopen(name,"wb+"); if (!f) return false; - if (varList.size()>65535) return false; // write number of vars Bit16u num = (Bit16u)varList.size(); diff --git a/src/debug/debug_gui.cpp b/src/debug/debug_gui.cpp index 770cc64..8a50ee6 100644 --- a/src/debug/debug_gui.cpp +++ b/src/debug/debug_gui.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: debug_gui.cpp,v 1.38 2009-05-27 09:15:41 qbix79 Exp $ */ #include "dosbox.h" @@ -146,16 +145,17 @@ static void DrawBars(void) { attrset(COLOR_PAIR(PAIR_BLACK_BLUE)); } /* Show the Register bar */ - mvaddstr(dbg.win_reg->_begy-1,0, "---(Register Overview )---"); + mvaddstr(1-1,0, "---(Register Overview )---"); /* Show the Data Overview bar perhaps with more special stuff in the end */ - mvaddstr(dbg.win_data->_begy-1,0,"---(Data Overview Scroll: page up/down)---"); + mvaddstr(6-1,0,"---(Data Overview Scroll: page up/down)---"); /* Show the Code Overview perhaps with special stuff in bar too */ - mvaddstr(dbg.win_code->_begy-1,0,"---(Code Overview Scroll: up/down )---"); + mvaddstr(17-1,0,"---(Code Overview Scroll: up/down )---"); /* Show the Variable Overview bar */ - mvaddstr(dbg.win_var->_begy-1,0, "---(Variable Overview )---"); + mvaddstr(29-1,0, "---(Variable Overview )---"); /* Show the Output OverView */ - mvaddstr(dbg.win_out->_begy-1,0, "---(Output Scroll: home/end )---"); + mvaddstr(34-1,0, "---(Output Scroll: home/end )---"); attrset(0); + //Match values with below. So we don't need to touch the internal window structures } @@ -164,19 +164,19 @@ static void MakeSubWindows(void) { /* The Std output win should go in bottem */ /* Make all the subwindows */ int win_main_maxy, win_main_maxx; getmaxyx(dbg.win_main,win_main_maxy,win_main_maxx); - int outy=1; + int outy=1; //Match values with above /* The Register window */ dbg.win_reg=subwin(dbg.win_main,4,win_main_maxx,outy,0); - outy+=5; + outy+=5; // 6 /* The Data Window */ dbg.win_data=subwin(dbg.win_main,10,win_main_maxx,outy,0); - outy+=11; + outy+=11; // 17 /* The Code Window */ dbg.win_code=subwin(dbg.win_main,11,win_main_maxx,outy,0); - outy+=12; + outy+=12; // 29 /* The Variable Window */ dbg.win_var=subwin(dbg.win_main,4,win_main_maxx,outy,0); - outy+=5; + outy+=5; // 34 /* The Output Window */ dbg.win_out=subwin(dbg.win_main,win_main_maxy-outy,win_main_maxx,outy,0); // dbg.input_y=win_main_maxy-1; @@ -245,6 +245,7 @@ void LOG_StartUp(void) { loggrp[LOG_MISC].front="MISC"; loggrp[LOG_IO].front="IO"; + loggrp[LOG_PCI].front="PCI"; /* Register the log section */ Section_prop * sect=control->AddSection_prop("log",LOG_Init); diff --git a/src/debug/debug_inc.h b/src/debug/debug_inc.h index 377fe33..2d4b144 100644 --- a/src/debug/debug_inc.h +++ b/src/debug/debug_inc.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,7 +18,6 @@ /* Local Debug Function */ -/* $Id: debug_inc.h,v 1.12 2009-05-27 09:15:41 qbix79 Exp $ */ #include #include "mem.h" diff --git a/src/debug/debug_win32.cpp b/src/debug/debug_win32.cpp index a7e4320..85adfd3 100644 --- a/src/debug/debug_win32.cpp +++ b/src/debug/debug_win32.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/debug/disasm_tables.h b/src/debug/disasm_tables.h index 2d3721b..c3ea36a 100644 --- a/src/debug/disasm_tables.h +++ b/src/debug/disasm_tables.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/dos/cdrom.cpp b/src/dos/cdrom.cpp index 6e9f006..a80b6aa 100644 --- a/src/dos/cdrom.cpp +++ b/src/dos/cdrom.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: cdrom.cpp,v 1.27 2009-04-26 18:24:36 qbix79 Exp $ */ // ****************************************************** // SDL CDROM diff --git a/src/dos/cdrom.h b/src/dos/cdrom.h index 69ac2d8..c5d6348 100644 --- a/src/dos/cdrom.h +++ b/src/dos/cdrom.h @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2002-2011 The DOSBox Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + #ifndef __CDROM_INTERFACE__ #define __CDROM_INTERFACE__ diff --git a/src/dos/cdrom_aspi_win32.cpp b/src/dos/cdrom_aspi_win32.cpp index e16deab..db9b2a8 100644 --- a/src/dos/cdrom_aspi_win32.cpp +++ b/src/dos/cdrom_aspi_win32.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: cdrom_aspi_win32.cpp,v 1.21 2009-05-27 09:15:41 qbix79 Exp $ */ #if defined (WIN32) diff --git a/src/dos/cdrom_image.cpp b/src/dos/cdrom_image.cpp index bd575d4..fea8a75 100644 --- a/src/dos/cdrom_image.cpp +++ b/src/dos/cdrom_image.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: cdrom_image.cpp,v 1.24 2009-03-19 20:45:42 c2woody Exp $ */ #include #include @@ -247,7 +246,6 @@ bool CDROM_Interface_Image::PlayAudioSector(unsigned long start,unsigned long le bool CDROM_Interface_Image::PauseAudio(bool resume) { - if (!player.isPlaying) return false; player.isPaused = !resume; return true; } diff --git a/src/dos/cdrom_ioctl_linux.cpp b/src/dos/cdrom_ioctl_linux.cpp index baf060c..0b39e4d 100644 --- a/src/dos/cdrom_ioctl_linux.cpp +++ b/src/dos/cdrom_ioctl_linux.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -37,7 +37,7 @@ CDROM_Interface_Ioctl::CDROM_Interface_Ioctl(void) : CDROM_Interface_SDL() bool CDROM_Interface_Ioctl::GetUPC(unsigned char& attr, char* upc) { int cdrom_fd = open(device_name, O_RDONLY | O_NONBLOCK); - if (cdrom_fd <= 0) return false; + if (cdrom_fd == -1) return false; struct cdrom_mcn cdrom_mcn; int ret = ioctl(cdrom_fd, CDROM_GET_MCN, &cdrom_mcn); @@ -55,7 +55,7 @@ bool CDROM_Interface_Ioctl::GetUPC(unsigned char& attr, char* upc) bool CDROM_Interface_Ioctl::ReadSectors(PhysPt buffer, bool raw, unsigned long sector, unsigned long num) { int cdrom_fd = open(device_name, O_RDONLY | O_NONBLOCK); - if (cdrom_fd <= 0) return false; + if (cdrom_fd == -1) return false; Bits buflen = raw ? num * CD_FRAMESIZE_RAW : num * CD_FRAMESIZE; Bit8u* buf = new Bit8u[buflen]; diff --git a/src/dos/cdrom_ioctl_os2.cpp b/src/dos/cdrom_ioctl_os2.cpp index e4ad2a5..a3ca113 100644 --- a/src/dos/cdrom_ioctl_os2.cpp +++ b/src/dos/cdrom_ioctl_os2.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: cdrom_ioctl_os2.cpp,v 1.4 2009-05-27 09:15:41 qbix79 Exp $ */ #include #include "dosbox.h" diff --git a/src/dos/cdrom_ioctl_win32.cpp b/src/dos/cdrom_ioctl_win32.cpp index 3ac3168..51ae5ef 100644 --- a/src/dos/cdrom_ioctl_win32.cpp +++ b/src/dos/cdrom_ioctl_win32.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: cdrom_ioctl_win32.cpp,v 1.16 2009-01-07 22:39:18 c2woody Exp $ */ #if defined (WIN32) @@ -430,7 +429,6 @@ bool CDROM_Interface_Ioctl::PauseAudio(bool resume) { return false; } if (use_dxplay) { - if (!player.isPlaying) return false; player.isPaused = !resume; return true; } diff --git a/src/dos/dev_con.h b/src/dos/dev_con.h index 499257e..936bfef 100644 --- a/src/dos/dev_con.h +++ b/src/dos/dev_con.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dev_con.h,v 1.35 2009-05-27 09:15:41 qbix79 Exp $ */ #include "dos_inc.h" #include "../ints/int10.h" diff --git a/src/dos/dos.cpp b/src/dos/dos.cpp index 53e92d2..984ed44 100644 --- a/src/dos/dos.cpp +++ b/src/dos/dos.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,12 +16,10 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos.cpp,v 1.121 2009-10-28 21:45:12 qbix79 Exp $ */ #include #include #include -#include #include "dosbox.h" #include "bios.h" #include "mem.h" @@ -42,6 +40,34 @@ void DOS_SetError(Bit16u code) { dos.errorcode=code; } +const Bit8u DOS_DATE_months[] = { + 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 +}; + +static void DOS_AddDays(Bitu days) { + dos.date.day += days; + Bit8u monthlimit = DOS_DATE_months[dos.date.month]; + + if(dos.date.day > monthlimit) { + if((dos.date.year %4 == 0) && (dos.date.month==2)) { + // leap year + if(dos.date.day > 29) { + dos.date.month++; + dos.date.day -= 29; + } + } else { + //not leap year + dos.date.month++; + dos.date.day -= monthlimit; + } + if(dos.date.month > 12) { + // year over + dos.date.month = 1; + dos.date.year++; + } + } +} + #define DATA_TRANSFERS_TAKE_CYCLES 1 #ifdef DATA_TRANSFERS_TAKE_CYCLES @@ -86,6 +112,8 @@ static Bitu DOS_21Handler(void) { char name1[DOSNAMEBUF+2+DOS_NAMELENGTH_ASCII]; char name2[DOSNAMEBUF+2+DOS_NAMELENGTH_ASCII]; + + static Bitu time_start = 0; //For emulating temporary time changes. switch (reg_ah) { case 0x00: /* Terminate Program */ @@ -319,11 +347,17 @@ static Bitu DOS_21Handler(void) { if (!DOS_GetAllocationInfo(reg_dl,®_cx,®_al,®_dx)) reg_al=0xff; break; case 0x21: /* Read random record from FCB */ - reg_al = DOS_FCBRandomRead(SegValue(ds),reg_dx,1,true); + { + Bit16u toread=1; + reg_al = DOS_FCBRandomRead(SegValue(ds),reg_dx,&toread,true); + } LOG(LOG_FCB,LOG_NORMAL)("DOS:0x21 FCB-Random read used, result:al=%d",reg_al); break; case 0x22: /* Write random record to FCB */ - reg_al=DOS_FCBRandomWrite(SegValue(ds),reg_dx,1,true); + { + Bit16u towrite=1; + reg_al=DOS_FCBRandomWrite(SegValue(ds),reg_dx,&towrite,true); + } LOG(LOG_FCB,LOG_NORMAL)("DOS:0x22 FCB-Random write used, result:al=%d",reg_al); break; case 0x23: /* Get file size for FCB */ @@ -334,11 +368,11 @@ static Bitu DOS_21Handler(void) { DOS_FCBSetRandomRecord(SegValue(ds),reg_dx); break; case 0x27: /* Random block read from FCB */ - reg_al = DOS_FCBRandomRead(SegValue(ds),reg_dx,reg_cx,false); + reg_al = DOS_FCBRandomRead(SegValue(ds),reg_dx,®_cx,false); LOG(LOG_FCB,LOG_NORMAL)("DOS:0x27 FCB-Random(block) read used, result:al=%d",reg_al); break; case 0x28: /* Random Block write to FCB */ - reg_al=DOS_FCBRandomWrite(SegValue(ds),reg_dx,reg_cx,false); + reg_al=DOS_FCBRandomWrite(SegValue(ds),reg_dx,®_cx,false); LOG(LOG_FCB,LOG_NORMAL)("DOS:0x28 FCB-Random(block) write used, result:al=%d",reg_al); break; case 0x29: /* Parse filename into FCB */ @@ -366,6 +400,9 @@ static Bitu DOS_21Handler(void) { break; case 0x2a: /* Get System Date */ { + reg_ax=0; // get time + CALLBACK_RunRealInt(0x1a); + if(reg_al) DOS_AddDays(reg_al); int a = (14 - dos.date.month)/12; int y = dos.date.year - a; int m = dos.date.month + 12*a - 2; @@ -378,34 +415,49 @@ static Bitu DOS_21Handler(void) { case 0x2b: /* Set System Date */ if (reg_cx<1980) { reg_al=0xff;break;} if ((reg_dh>12) || (reg_dh==0)) { reg_al=0xff;break;} - if ((reg_dl>31) || (reg_dl==0)) { reg_al=0xff;break;} + if (reg_dl==0) { reg_al=0xff;break;} + if (reg_dl>DOS_DATE_months[reg_dh]) { + if(!((reg_dh==2)&&(reg_cx%4 == 0)&&(reg_dl==29))) // february pass + { reg_al=0xff;break; } + } dos.date.year=reg_cx; dos.date.month=reg_dh; dos.date.day=reg_dl; reg_al=0; break; - case 0x2c: /* Get System Time */ -//TODO Get time through bios calls date is fixed - { -/* Calculate how many miliseconds have passed */ - Bitu ticks=5*mem_readd(BIOS_TIMER); - ticks = ((ticks / 59659u) << 16) + ((ticks % 59659u) << 16) / 59659u; - Bitu seconds=(ticks/100); - reg_ch=(Bit8u)(seconds/3600); - reg_cl=(Bit8u)((seconds % 3600)/60); - reg_dh=(Bit8u)(seconds % 60); - reg_dl=(Bit8u)(ticks % 100); - } + case 0x2c: { /* Get System Time */ + reg_ax=0; // get time + CALLBACK_RunRealInt(0x1a); + if(reg_al) DOS_AddDays(reg_al); + reg_ah=0x2c; + + Bitu ticks=((Bitu)reg_cx<<16)|reg_dx; + if(time_start<=ticks) ticks-=time_start; + Bitu time=(Bitu)((100.0/((double)PIT_TICK_RATE/65536.0)) * (double)ticks); + + reg_dl=(Bit8u)((Bitu)time % 100); // 1/100 seconds + time/=100; + reg_dh=(Bit8u)((Bitu)time % 60); // seconds + time/=60; + reg_cl=(Bit8u)((Bitu)time % 60); // minutes + time/=60; + reg_ch=(Bit8u)((Bitu)time % 24); // hours + //Simulate DOS overhead for timing-sensitive games - //Robomaze 2 + //Robomaze 2 overhead(); break; + } case 0x2d: /* Set System Time */ LOG(LOG_DOSMISC,LOG_ERROR)("DOS:Set System Time not supported"); //Check input parameters nonetheless if( reg_ch > 23 || reg_cl > 59 || reg_dh > 59 || reg_dl > 99 ) reg_al = 0xff; - else reg_al = 0; + else { //Allow time to be set to zero. Restore the orginal time for all other parameters. (QuickBasic) + if (reg_cx == 0 && reg_dx == 0) {time_start = mem_readd(BIOS_TIMER);LOG_MSG("Warning: game messes with DOS time!");} + else time_start = 0; + reg_al = 0; + } break; case 0x2e: /* Set Verify flag */ dos.verify=(reg_al==1); @@ -462,7 +514,9 @@ static Bitu DOS_21Handler(void) { reg_dh=0x10; /* Dos in HMA */ break; default: - E_Exit("DOS:Illegal 0x33 Call %2X",reg_al); + LOG(LOG_DOSMISC,LOG_ERROR)("Weird 0x33 call %2X",reg_al); + reg_al =0xff; + break; } break; case 0x34: /* Get INDos Flag */ @@ -1065,7 +1119,7 @@ static Bitu DOS_21Handler(void) { case 0x71: /* Unknown probably 4dos detection */ reg_ax=0x7100; - CALLBACK_SCF(true); + CALLBACK_SCF(true); //Check this! What needs this ? See default case LOG(LOG_DOSMISC,LOG_NORMAL)("DOS:Windows long file name support call %2X",reg_al); break; @@ -1079,7 +1133,7 @@ static Bitu DOS_21Handler(void) { case 0xEF: /* Used in Ancient Art Of War CGA */ case 0x5e: /* More Network Functions */ default: - LOG(LOG_DOSMISC,LOG_ERROR)("DOS:Unhandled call %02X al=%02X. Set al to default of 0",reg_ah,reg_al); + if (reg_ah < 0x6d) LOG(LOG_DOSMISC,LOG_ERROR)("DOS:Unhandled call %02X al=%02X. Set al to default of 0",reg_ah,reg_al); //Less errors. above 0x6c the functions are simply always skipped, only al is zeroed, all other registers untouched reg_al=0x00; /* default value */ break; }; @@ -1175,16 +1229,6 @@ public: dos.version.major=5; dos.version.minor=0; - - /* Setup time and date */ - time_t curtime;struct tm *loctime; - curtime = time (NULL);loctime = localtime (&curtime); - - dos.date.day=(Bit8u)loctime->tm_mday; - dos.date.month=(Bit8u)loctime->tm_mon+1; - dos.date.year=(Bit16u)loctime->tm_year+1900; - Bit32u ticks=(Bit32u)((loctime->tm_hour*3600+loctime->tm_min*60+loctime->tm_sec)*(float)PIT_TICK_RATE/65536.0); - mem_writed(BIOS_TIMER,ticks); } ~DOS(){ for (Bit16u i=0;i #include @@ -492,6 +491,10 @@ void DOS_FCB::SetAttr(Bit8u attr) { if(extended) mem_writeb(pt - 1,attr); } +void DOS_FCB::SetResultAttr(Bit8u attr) { + mem_writeb(pt + 12,attr); +} + void DOS_SDA::Init() { /* Clear */ for(Bitu i=0;i #include "dosbox.h" diff --git a/src/dos/dos_execute.cpp b/src/dos/dos_execute.cpp index 76b0ee8..f51a15b 100644 --- a/src/dos/dos_execute.cpp +++ b/src/dos/dos_execute.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_execute.cpp,v 1.68 2009-10-04 14:28:07 c2woody Exp $ */ #include #include diff --git a/src/dos/dos_files.cpp b/src/dos/dos_files.cpp index 3d879f7..91cbc71 100644 --- a/src/dos/dos_files.cpp +++ b/src/dos/dos_files.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_files.cpp,v 1.113 2009-08-31 18:03:08 qbix79 Exp $ */ #include #include @@ -93,7 +92,7 @@ bool DOS_MakeName(char const * const name,char * const fullname,Bit8u * drive) { case '!': case '%': case '{': case '}': case '`': case '~': case '_': case '-': case '.': case '*': case '?': case '&': case '\'': case '+': case '^': case 246: case 255: case 0xa0: - case 0xe5: case 0xbd: + case 0xe5: case 0xbd: case 0x9d: upname[w++]=c; break; default: @@ -891,7 +890,7 @@ savefcb: static void DTAExtendName(char * const name,char * const filename,char * const ext) { char * find=strchr(name,'.'); - if (find) { + if (find && find!=name) { strcpy(ext,find+1); *find=0; } else ext[0]=0; @@ -909,12 +908,15 @@ static void SaveFindResult(DOS_FCB & find_fcb) { char file_name[9];char ext[4]; find_dta.GetResult(name,size,date,time,attr); drive=find_fcb.GetDrive()+1; + Bit8u find_attr = DOS_ATTR_ARCHIVE; + find_fcb.GetAttr(find_attr); /* Gets search attributes if extended */ /* Create a correct file and extention */ DTAExtendName(name,file_name,ext); DOS_FCB fcb(RealSeg(dos.dta()),RealOff(dos.dta()));//TODO fcb.Create(find_fcb.Extended()); fcb.SetName(drive,file_name,ext); - fcb.SetAttr(attr); /* Only adds attribute if fcb is extended */ + fcb.SetAttr(find_attr); /* Only adds attribute if fcb is extended */ + fcb.SetResultAttr(attr); fcb.SetSizeDateTime(size,date,time); } @@ -991,6 +993,11 @@ Bit8u DOS_FCBRead(Bit16u seg,Bit16u offset,Bit16u recno) { DOS_FCB fcb(seg,offset); Bit8u fhandle,cur_rec;Bit16u cur_block,rec_size; fcb.GetSeqData(fhandle,rec_size); + if (fhandle==0xff && rec_size!=0) { + if (!DOS_FCBOpen(seg,offset)) return FCB_READ_NODATA; + LOG(LOG_FCB,LOG_WARN)("Reopened closed FCB"); + fcb.GetSeqData(fhandle,rec_size); + } fcb.GetRecord(cur_block,cur_rec); Bit32u pos=((cur_block*128)+cur_rec)*rec_size; if (!DOS_SeekFile(fhandle,&pos,DOS_SEEK_SET)) return FCB_READ_NODATA; @@ -1013,6 +1020,11 @@ Bit8u DOS_FCBWrite(Bit16u seg,Bit16u offset,Bit16u recno) { DOS_FCB fcb(seg,offset); Bit8u fhandle,cur_rec;Bit16u cur_block,rec_size; fcb.GetSeqData(fhandle,rec_size); + if (fhandle==0xff && rec_size!=0) { + if (!DOS_FCBOpen(seg,offset)) return FCB_READ_NODATA; + LOG(LOG_FCB,LOG_WARN)("Reopened closed FCB"); + fcb.GetSeqData(fhandle,rec_size); + } fcb.GetRecord(cur_block,cur_rec); Bit32u pos=((cur_block*128)+cur_rec)*rec_size; if (!DOS_SeekFile(fhandle,&pos,DOS_SEEK_SET)) return FCB_ERR_WRITE; @@ -1067,32 +1079,30 @@ Bit8u DOS_FCBIncreaseSize(Bit16u seg,Bit16u offset) { return FCB_SUCCESS; } -Bit8u DOS_FCBRandomRead(Bit16u seg,Bit16u offset,Bit16u numRec,bool restore) { +Bit8u DOS_FCBRandomRead(Bit16u seg,Bit16u offset,Bit16u * numRec,bool restore) { /* if restore is true :random read else random blok read. * random read updates old block and old record to reflect the random data * before the read!!!!!!!!! and the random data is not updated! (user must do this) * Random block read updates these fields to reflect the state after the read! */ - -/* BUG: numRec should return the amount of records read! - * Not implemented yet as I'm unsure how to count on error states (partial/failed) - */ - DOS_FCB fcb(seg,offset); Bit32u random; Bit16u old_block=0; Bit8u old_rec=0; Bit8u error=0; + Bit16u count; /* Set the correct record from the random data */ fcb.GetRandom(random); fcb.SetRecord((Bit16u)(random / 128),(Bit8u)(random & 127)); if (restore) fcb.GetRecord(old_block,old_rec);//store this for after the read. // Read records - for (int i=0; i0) { /* Write records */ - for (int i=0; i #include "dosbox.h" diff --git a/src/dos/dos_keyboard_layout.cpp b/src/dos/dos_keyboard_layout.cpp index 1855593..0609680 100644 --- a/src/dos/dos_keyboard_layout.cpp +++ b/src/dos/dos_keyboard_layout.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_keyboard_layout.cpp,v 1.22 2009-09-06 19:25:33 c2woody Exp $ */ #include "dosbox.h" #include "bios.h" @@ -443,7 +442,14 @@ Bitu keyboard_layout::read_keyboard_file(const char* keyboard_file_name, Bit32s } } - current_layout[scan*layout_pages+layout_pages-1]=read_buf[read_buf_pos-2]; // flags + // calculate max length of entries, taking into account old number of entries + Bit8u new_flags=current_layout[scan*layout_pages+layout_pages-1]&0x7; + if ((read_buf[read_buf_pos-2]&0x7) > new_flags) new_flags = read_buf[read_buf_pos-2]&0x7; + + // merge flag bits in as well + new_flags |= (read_buf[read_buf_pos-2] | current_layout[scan*layout_pages+layout_pages-1]) & 0xf0; + + current_layout[scan*layout_pages+layout_pages-1]=new_flags; if (read_buf[read_buf_pos-2]&0x80) scan_length*=2; // granularity flag (S) } i+=scan_length; // advance pointer diff --git a/src/dos/dos_memory.cpp b/src/dos/dos_memory.cpp index 4a85e44..a07fc29 100644 --- a/src/dos/dos_memory.cpp +++ b/src/dos/dos_memory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_memory.cpp,v 1.45 2009-07-15 17:05:07 c2woody Exp $ */ #include "dosbox.h" #include "mem.h" diff --git a/src/dos/dos_misc.cpp b/src/dos/dos_misc.cpp index 2ce1dcf..5f02f61 100644 --- a/src/dos/dos_misc.cpp +++ b/src/dos/dos_misc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_misc.cpp,v 1.24 2009-09-25 20:51:21 qbix79 Exp $ */ #include "dosbox.h" #include "callback.h" diff --git a/src/dos/dos_mscdex.cpp b/src/dos/dos_mscdex.cpp index 62d95fa..644db3c 100644 --- a/src/dos/dos_mscdex.cpp +++ b/src/dos/dos_mscdex.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_mscdex.cpp,v 1.59 2009-04-16 12:28:30 qbix79 Exp $ */ #include #include @@ -439,8 +438,7 @@ void CMscdex::GetDriverInfo (PhysPt data) { }; } -bool CMscdex::GetCDInfo(Bit8u subUnit, Bit8u& tr1, Bit8u& tr2, TMSF& leadOut) -{ +bool CMscdex::GetCDInfo(Bit8u subUnit, Bit8u& tr1, Bit8u& tr2, TMSF& leadOut) { if (subUnit>=numDrives) return false; int tr1i,tr2i; // Assume Media change @@ -456,19 +454,17 @@ bool CMscdex::GetCDInfo(Bit8u subUnit, Bit8u& tr1, Bit8u& tr2, TMSF& leadOut) return dinfo[subUnit].lastResult; } -bool CMscdex::GetTrackInfo(Bit8u subUnit, Bit8u track, Bit8u& attr, TMSF& start) -{ +bool CMscdex::GetTrackInfo(Bit8u subUnit, Bit8u track, Bit8u& attr, TMSF& start) { if (subUnit>=numDrives) return false; dinfo[subUnit].lastResult = cdrom[subUnit]->GetAudioTrackInfo(track,start,attr); if (!dinfo[subUnit].lastResult) { attr = 0; memset(&start,0,sizeof(start)); - }; + } return dinfo[subUnit].lastResult; } -bool CMscdex::PlayAudioSector(Bit8u subUnit, Bit32u sector, Bit32u length) -{ +bool CMscdex::PlayAudioSector(Bit8u subUnit, Bit32u sector, Bit32u length) { if (subUnit>=numDrives) return false; // If value from last stop is used, this is meant as a resume // better start using resume command @@ -482,12 +478,11 @@ bool CMscdex::PlayAudioSector(Bit8u subUnit, Bit32u sector, Bit32u length) dinfo[subUnit].audioPaused = false; dinfo[subUnit].audioStart = sector; dinfo[subUnit].audioEnd = length; - }; + } return dinfo[subUnit].lastResult; } -bool CMscdex::PlayAudioMSF(Bit8u subUnit, Bit32u start, Bit32u length) -{ +bool CMscdex::PlayAudioMSF(Bit8u subUnit, Bit32u start, Bit32u length) { if (subUnit>=numDrives) return false; Bit8u min = (Bit8u)(start>>16) & 0xFF; Bit8u sec = (Bit8u)(start>> 8) & 0xFF; @@ -496,20 +491,18 @@ bool CMscdex::PlayAudioMSF(Bit8u subUnit, Bit32u start, Bit32u length) return dinfo[subUnit].lastResult = PlayAudioSector(subUnit,sector,length); } -bool CMscdex::GetSubChannelData(Bit8u subUnit, Bit8u& attr, Bit8u& track, Bit8u &index, TMSF& rel, TMSF& abs) -{ +bool CMscdex::GetSubChannelData(Bit8u subUnit, Bit8u& attr, Bit8u& track, Bit8u &index, TMSF& rel, TMSF& abs) { if (subUnit>=numDrives) return false; dinfo[subUnit].lastResult = cdrom[subUnit]->GetAudioSub(attr,track,index,rel,abs); if (!dinfo[subUnit].lastResult) { attr = track = index = 0; memset(&rel,0,sizeof(rel)); memset(&abs,0,sizeof(abs)); - }; + } return dinfo[subUnit].lastResult; } -bool CMscdex::GetAudioStatus(Bit8u subUnit, bool& playing, bool& pause, TMSF& start, TMSF& end) -{ +bool CMscdex::GetAudioStatus(Bit8u subUnit, bool& playing, bool& pause, TMSF& start, TMSF& end) { if (subUnit>=numDrives) return false; dinfo[subUnit].lastResult = cdrom[subUnit]->GetAudioStatus(playing,pause); if (dinfo[subUnit].lastResult) { @@ -528,16 +521,26 @@ bool CMscdex::GetAudioStatus(Bit8u subUnit, bool& playing, bool& pause, TMSF& st pause = false; memset(&start,0,sizeof(start)); memset(&end,0,sizeof(end)); - }; + } return dinfo[subUnit].lastResult; } -bool CMscdex::StopAudio(Bit8u subUnit) -{ +bool CMscdex::StopAudio(Bit8u subUnit) { if (subUnit>=numDrives) return false; - if (dinfo[subUnit].audioPlay) dinfo[subUnit].lastResult = cdrom[subUnit]->PauseAudio(false); - else dinfo[subUnit].lastResult = cdrom[subUnit]->StopAudio(); + if (dinfo[subUnit].audioPlay) { + // Check if audio is still playing.... + TMSF start,end; + bool playing,pause; + if (GetAudioStatus(subUnit,playing,pause,start,end)) + dinfo[subUnit].audioPlay = playing; + else + dinfo[subUnit].audioPlay = false; + } + if (dinfo[subUnit].audioPlay) + dinfo[subUnit].lastResult = cdrom[subUnit]->PauseAudio(false); + else + dinfo[subUnit].lastResult = cdrom[subUnit]->StopAudio(); if (dinfo[subUnit].lastResult) { if (dinfo[subUnit].audioPlay) { @@ -549,9 +552,9 @@ bool CMscdex::StopAudio(Bit8u subUnit) dinfo[subUnit].audioPaused = false; dinfo[subUnit].audioStart = 0; dinfo[subUnit].audioEnd = 0; - }; + } dinfo[subUnit].audioPlay = false; - }; + } return dinfo[subUnit].lastResult; } @@ -671,8 +674,7 @@ bool CMscdex::ReadSectors(Bit16u drive, Bit32u sector, Bit16u num, PhysPt data) return ReadSectors(GetSubUnit(drive),false,sector,num,data); } -bool CMscdex::GetDirectoryEntry(Bit16u drive, bool copyFlag, PhysPt pathname, PhysPt buffer, Bit16u& error) -{ +bool CMscdex::GetDirectoryEntry(Bit16u drive, bool copyFlag, PhysPt pathname, PhysPt buffer, Bit16u& error) { char volumeID[6] = {0}; char searchName[256]; char entryName[256]; @@ -781,13 +783,12 @@ bool CMscdex::GetDirectoryEntry(Bit16u drive, bool copyFlag, PhysPt pathname, Ph dirEntrySector++; nextPart = false; } - }; + } error = 2; // file not found return false; // not found } -bool CMscdex::GetCurrentPos(Bit8u subUnit, TMSF& pos) -{ +bool CMscdex::GetCurrentPos(Bit8u subUnit, TMSF& pos) { if (subUnit>=numDrives) return false; TMSF rel; Bit8u attr,track,index; @@ -796,31 +797,39 @@ bool CMscdex::GetCurrentPos(Bit8u subUnit, TMSF& pos) return dinfo[subUnit].lastResult; } -bool CMscdex::GetMediaStatus(Bit8u subUnit, bool& media, bool& changed, bool& trayOpen) -{ +bool CMscdex::GetMediaStatus(Bit8u subUnit, bool& media, bool& changed, bool& trayOpen) { if (subUnit>=numDrives) return false; dinfo[subUnit].lastResult = cdrom[subUnit]->GetMediaTrayStatus(media,changed,trayOpen); return dinfo[subUnit].lastResult; } -Bit32u CMscdex::GetDeviceStatus(Bit8u subUnit) -{ +Bit32u CMscdex::GetDeviceStatus(Bit8u subUnit) { if (subUnit>=numDrives) return false; bool media,changed,trayOpen; dinfo[subUnit].lastResult = GetMediaStatus(subUnit,media,changed,trayOpen); - Bit32u status = (trayOpen << 0) | // Drive is open ? - (dinfo[subUnit].locked << 1) | // Drive is locked ? - (1<<2) | // raw + cooked sectors - (1<<4) | // Can read sudio - (1<<8) | // Can control audio - (1<<9) | // Red book & HSG - ((!media) << 11); // Drive is empty ? + if (dinfo[subUnit].audioPlay) { + // Check if audio is still playing.... + TMSF start,end; + bool playing,pause; + if (GetAudioStatus(subUnit,playing,pause,start,end)) + dinfo[subUnit].audioPlay = playing; + else + dinfo[subUnit].audioPlay = false; + } + + Bit32u status = ((trayOpen?1:0) << 0) | // Drive is open ? + ((dinfo[subUnit].locked?1:0) << 1) | // Drive is locked ? + (1<<2) | // raw + cooked sectors + (1<<4) | // Can read sudio + (1<<8) | // Can control audio + (1<<9) | // Red book & HSG + ((dinfo[subUnit].audioPlay?1:0) << 10) | // Audio is playing ? + ((media?0:1) << 11); // Drive is empty ? return status; } -bool CMscdex::GetMediaStatus(Bit8u subUnit, Bit8u& status) -{ +bool CMscdex::GetMediaStatus(Bit8u subUnit, Bit8u& status) { if (subUnit>=numDrives) return false; /* bool media,changed,open,result; result = GetMediaStatus(subUnit,media,changed,open); @@ -830,15 +839,13 @@ bool CMscdex::GetMediaStatus(Bit8u subUnit, Bit8u& status) return true; } -bool CMscdex::LoadUnloadMedia(Bit8u subUnit, bool unload) -{ +bool CMscdex::LoadUnloadMedia(Bit8u subUnit, bool unload) { if (subUnit>=numDrives) return false; dinfo[subUnit].lastResult = cdrom[subUnit]->LoadUnloadMedia(unload); return dinfo[subUnit].lastResult; } -bool CMscdex::SendDriverRequest(Bit16u drive, PhysPt data) -{ +bool CMscdex::SendDriverRequest(Bit16u drive, PhysPt data) { Bit8u subUnit = GetSubUnit(drive); if (subUnit>=numDrives) return false; // Get SubUnit @@ -849,8 +856,7 @@ bool CMscdex::SendDriverRequest(Bit16u drive, PhysPt data) return true; } -Bit16u CMscdex::GetStatusWord(Bit8u subUnit,Bit16u status) -{ +Bit16u CMscdex::GetStatusWord(Bit8u subUnit,Bit16u status) { if (subUnit>=numDrives) return REQUEST_STATUS_ERROR | 0x02; // error : Drive not ready if (dinfo[subUnit].lastResult) status |= REQUEST_STATUS_DONE; // ok @@ -1038,6 +1044,7 @@ static Bit16u MSCDEX_IOCTL_Optput(PhysPt buffer,Bit8u drive_unit) { break; case 0x05 : // load media if (!mscdex->LoadUnloadMedia(drive_unit,false)) return 0x02; + break; default : LOG(LOG_MISC,LOG_ERROR)("MSCDEX: Unsupported IOCTL OUTPUT Subfunction %02X",ioctl_fct); return 0x03; // invalid function } diff --git a/src/dos/dos_programs.cpp b/src/dos/dos_programs.cpp index 8c581b9..62f326c 100644 --- a/src/dos/dos_programs.cpp +++ b/src/dos/dos_programs.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_programs.cpp,v 1.94 2009-06-12 20:10:09 c2woody Exp $ */ #include "dosbox.h" #include @@ -195,12 +194,12 @@ public: str_size="512,1,2880,2880";/* All space free */ mediaid=0xF0; /* Floppy 1.44 media */ } else if (type=="dir") { - // 512*127*16383==~1GB total size - // 512*127*4031==~250MB total free size - str_size="512,127,16383,4031"; + // 512*32*32765==~500MB total size + // 512*32*16000==~250MB total free size + str_size="512,32,32765,16000"; mediaid=0xF8; /* Hard Disk */ } else if (type=="cdrom") { - str_size="2048,1,65535,0"; + str_size="2048,1,32765,0"; mediaid=0xF8; /* Hard Disk */ } else { WriteOut(MSG_Get("PROGAM_MOUNT_ILL_TYPE"),type.c_str()); @@ -210,11 +209,17 @@ public: std::string mb_size; if(cmd->FindString("-freesize",mb_size,true)) { char teststr[1024]; - Bit16u sizemb = static_cast(atoi(mb_size.c_str())); + Bit16u freesize = static_cast(atoi(mb_size.c_str())); if (type=="floppy") { - sprintf(teststr,"512,1,2880,%d",sizemb*1024/(512*1)); + // freesize in kb + sprintf(teststr,"512,1,2880,%d",freesize*1024/(512*1)); } else { - sprintf(teststr,"512,127,16513,%d",sizemb*1024*1024/(512*127)); + Bit32u total_size_cyl=32765; + Bit32u free_size_cyl=(Bit32u)freesize*1024*1024/(512*32); + if (free_size_cyl>65534) free_size_cyl=65534; + if (total_size_cyl65534) total_size_cyl=65534; + sprintf(teststr,"512,32,%d,%d",total_size_cyl,free_size_cyl); } str_size=teststr; } @@ -1097,7 +1102,7 @@ public: if (type=="floppy") { mediaid=0xF0; } else if (type=="iso") { - str_size="650,127,16513,1700"; + str_size=="2048,1,60000,0"; // ignored, see drive_iso.cpp (AllocationInfo) mediaid=0xF8; fstype = "iso"; } diff --git a/src/dos/dos_tables.cpp b/src/dos/dos_tables.cpp index 51167bf..11938f5 100644 --- a/src/dos/dos_tables.cpp +++ b/src/dos/dos_tables.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_tables.cpp,v 1.32 2009-10-28 21:45:12 qbix79 Exp $ */ #include "dosbox.h" #include "mem.h" diff --git a/src/dos/drive_cache.cpp b/src/dos/drive_cache.cpp index 25cc404..7f8d021 100644 --- a/src/dos/drive_cache.cpp +++ b/src/dos/drive_cache.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: drive_cache.cpp,v 1.59 2009-04-16 12:28:30 qbix79 Exp $ */ #include "drives.h" #include "dos_inc.h" diff --git a/src/dos/drive_fat.cpp b/src/dos/drive_fat.cpp index e3c68a8..b2327cb 100644 --- a/src/dos/drive_fat.cpp +++ b/src/dos/drive_fat.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: drive_fat.cpp,v 1.28 2009-06-19 18:28:10 c2woody Exp $ */ #include #include @@ -983,11 +982,13 @@ bool fatDrive::GetFileAttr(char *name, Bit16u *attr) { /* Find directory entry in parent directory */ Bit32s fileidx = 2; if (dirClust==0) fileidx = 0; // root directory - while(directoryBrowse(dirClust, &fileEntry, fileidx)) { + Bit32s last_idx=0; + while(directoryBrowse(dirClust, &fileEntry, fileidx, last_idx)) { if(memcmp(&fileEntry.entryname, &pathName[0], 11) == 0) { *attr=fileEntry.attrib; return true; } + last_idx=fileidx; fileidx++; } return false; @@ -995,12 +996,15 @@ bool fatDrive::GetFileAttr(char *name, Bit16u *attr) { return true; } -bool fatDrive::directoryBrowse(Bit32u dirClustNumber, direntry *useEntry, Bit32s entNum) { +bool fatDrive::directoryBrowse(Bit32u dirClustNumber, direntry *useEntry, Bit32s entNum, Bit32s start/*=0*/) { direntry sectbuf[16]; /* 16 directory entries per sector */ Bit32u logentsector; /* Logical entry sector */ Bit32u entryoffset = 0; /* Index offset within sector */ Bit32u tmpsector; - Bit16u dirPos = 0; + if ((start<0) || (start>65535)) return false; + Bit16u dirPos = (Bit16u)start; + if (entNum=0) { diff --git a/src/dos/drive_iso.cpp b/src/dos/drive_iso.cpp index 9ebfef8..6839b0a 100644 --- a/src/dos/drive_iso.cpp +++ b/src/dos/drive_iso.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: drive_iso.cpp,v 1.27 2009-09-22 21:48:08 c2woody Exp $ */ #include #include @@ -494,13 +493,13 @@ int isoDrive :: readDirEntry(isoDirEntry *de, Bit8u *data) { if (de->ident[tmp - 1] == '.') de->ident[tmp - 1] = 0; } } - const char* dotpos = strchr((char*)de->ident, '.'); + char* dotpos = strchr((char*)de->ident, '.'); if (dotpos!=NULL) { + if (strlen(dotpos)>4) dotpos[4]=0; if (dotpos-(char*)de->ident>8) { strcpy((char*)(&de->ident[8]),dotpos); } - } - if (strlen((char*)de->ident)>12) de->ident[12]=0; + } else if (strlen((char*)de->ident)>8) de->ident[8]=0; return de->length; } diff --git a/src/dos/drive_local.cpp b/src/dos/drive_local.cpp index 3d1ef76..4c6e55b 100644 --- a/src/dos/drive_local.cpp +++ b/src/dos/drive_local.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: drive_local.cpp,v 1.82 2009-07-18 18:42:55 c2woody Exp $ */ #include #include @@ -83,9 +82,10 @@ bool localDrive::FileCreate(DOS_File * * file,char * name,Bit16u /*attributes*/) bool localDrive::FileOpen(DOS_File * * file,char * name,Bit32u flags) { const char* type; switch (flags&0xf) { - case OPEN_READ:type="rb"; break; - case OPEN_WRITE:type="rb+"; break; - case OPEN_READWRITE:type="rb+"; break; + case OPEN_READ: type = "rb" ; break; + case OPEN_WRITE: type = "rb+"; break; + case OPEN_READWRITE: type = "rb+"; break; + case OPEN_READ_NO_MOD: type = "rb" ; break; //No modification of dates. LORD4.07 uses this default: DOS_SetError(DOSERR_ACCESS_CODE_INVALID); return false; @@ -379,8 +379,6 @@ bool localDrive::Rename(char * oldname,char * newname) { } bool localDrive::AllocationInfo(Bit16u * _bytes_sector,Bit8u * _sectors_cluster,Bit16u * _total_clusters,Bit16u * _free_clusters) { - /* Always report 100 mb free should be enough */ - /* Total size is always 1 gb */ *_bytes_sector=allocation.bytes_sector; *_sectors_cluster=allocation.sectors_cluster; *_total_clusters=allocation.total_clusters; diff --git a/src/dos/drive_virtual.cpp b/src/dos/drive_virtual.cpp index e3dd061..a054648 100644 --- a/src/dos/drive_virtual.cpp +++ b/src/dos/drive_virtual.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -248,12 +248,10 @@ bool Virtual_Drive::Rename(char * oldname,char * newname) { } bool Virtual_Drive::AllocationInfo(Bit16u * _bytes_sector,Bit8u * _sectors_cluster,Bit16u * _total_clusters,Bit16u * _free_clusters) { - /* Always report 100 mb free should be enough */ - /* Total size is always 1 gb */ *_bytes_sector=512; - *_sectors_cluster=127; - *_total_clusters=16513; - *_free_clusters=00; + *_sectors_cluster=32; + *_total_clusters=32765; // total size is always 500 mb + *_free_clusters=0; // nothing free here return true; } diff --git a/src/dos/drives.cpp b/src/dos/drives.cpp index 1d00b0d..e70f95c 100644 --- a/src/dos/drives.cpp +++ b/src/dos/drives.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: drives.cpp,v 1.15 2009-05-27 09:15:41 qbix79 Exp $ */ #include "dosbox.h" #include "dos_system.h" diff --git a/src/dos/drives.h b/src/dos/drives.h index 0a0dc8e..e2121a9 100644 --- a/src/dos/drives.h +++ b/src/dos/drives.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: drives.h,v 1.41 2009-05-27 09:15:41 qbix79 Exp $ */ #ifndef _DRIVES_H__ #define _DRIVES_H__ @@ -172,7 +171,7 @@ public: Bit32u appendCluster(Bit32u startCluster); void deleteClustChain(Bit32u startCluster); Bit32u getFirstFreeClust(void); - bool directoryBrowse(Bit32u dirClustNumber, direntry *useEntry, Bit32s entNum); + bool directoryBrowse(Bit32u dirClustNumber, direntry *useEntry, Bit32s entNum, Bit32s start=0); bool directoryChange(Bit32u dirClustNumber, direntry *useEntry, Bit32s entNum); imageDisk *loadedDisk; bool created_successfully; diff --git a/src/dos/scsidefs.h b/src/dos/scsidefs.h index 902be50..b98f851 100644 --- a/src/dos/scsidefs.h +++ b/src/dos/scsidefs.h @@ -1,12 +1,7 @@ /* Got it from Bochs */ -///////////////////////////////////////////////////////////////////////// -// $Id: scsidefs.h,v 1.3 2005-07-21 12:49:52 qbix79 Exp $ -///////////////////////////////////////////////////////////////////////// -// // // iodev/scsidefs.h -// $Id: scsidefs.h,v 1.3 2005-07-21 12:49:52 qbix79 Exp $ // // This file was copied from ... ? // diff --git a/src/dosbox.cpp b/src/dosbox.cpp index 93a802e..b5a1981 100644 --- a/src/dosbox.cpp +++ b/src/dosbox.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dosbox.cpp,v 1.150 2009-11-03 20:17:42 qbix79 Exp $ */ #include #include @@ -42,6 +41,7 @@ #include "mapper.h" #include "ints/int10.h" #include "render.h" +#include "pci_bus.h" Config * control; MachineType machine; @@ -74,6 +74,10 @@ void MIXER_Init(Section*); void MIDI_Init(Section*); void HARDWARE_Init(Section*); +#if defined(PCI_FUNCTIONALITY_ENABLED) +void PCI_Init(Section*); +#endif + void KEYBOARD_Init(Section*); //TODO This should setup INT 16 too but ok ;) void JOYSTICK_Init(Section*); @@ -129,10 +133,11 @@ static Bitu Normal_Loop(void) { Bits ret; while (1) { if (PIC_RunQueue()) { - ret=(*cpudecoder)(); + ret = (*cpudecoder)(); if (GCC_UNLIKELY(ret<0)) return 1; if (ret>0) { - Bitu blah=(*CallBack_Handlers[ret])(); + if (GCC_UNLIKELY(ret >= CB_MAX)) return 0; + Bitu blah = (*CallBack_Handlers[ret])(); if (GCC_UNLIKELY(blah)) return blah; } #if C_DEBUG @@ -451,6 +456,12 @@ void DOSBOX_Init(void) { secprop->AddInitFunction(&VGA_Init); secprop->AddInitFunction(&KEYBOARD_Init); + +#if defined(PCI_FUNCTIONALITY_ENABLED) + secprop=control->AddSection_prop("pci",&PCI_Init,false); //PCI bus +#endif + + secprop=control->AddSection_prop("mixer",&MIXER_Init); Pbool = secprop->Add_bool("nosound",Property::Changeable::OnlyAtStart,false); Pbool->Set_help("Enable silent mode, sound is still emulated though."); @@ -495,6 +506,8 @@ void DOSBOX_Init(void) { Pstring = secprop->Add_string("midiconfig",Property::Changeable::WhenIdle,""); Pstring->Set_help("Special configuration options for the device driver. This is usually the id of the device you want to use.\n" + " When using a Roland MT-32 rev. 0 as midi output device, some games may require a delay in order to prevent 'buffer overflow' issues.\n" + " In that case, add 'delaysysex', for example: midiconfig=2 delaysysex\n" " See the README/Manual for more details."); #if C_DEBUG diff --git a/src/fpu/fpu.cpp b/src/fpu/fpu.cpp index acae274..1c11c6b 100644 --- a/src/fpu/fpu.cpp +++ b/src/fpu/fpu.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: fpu.cpp,v 1.31 2009-09-16 18:01:53 qbix79 Exp $ */ #include "dosbox.h" #if C_FPU diff --git a/src/fpu/fpu_instructions.h b/src/fpu/fpu_instructions.h index 1205bf7..817470c 100644 --- a/src/fpu/fpu_instructions.h +++ b/src/fpu/fpu_instructions.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: fpu_instructions.h,v 1.33 2009-05-27 09:15:41 qbix79 Exp $ */ static void FPU_FINIT(void) { diff --git a/src/fpu/fpu_instructions_x86.h b/src/fpu/fpu_instructions_x86.h index 5adb907..ab78dc7 100644 --- a/src/fpu/fpu_instructions_x86.h +++ b/src/fpu/fpu_instructions_x86.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: fpu_instructions_x86.h,v 1.7 2009-05-27 09:15:41 qbix79 Exp $ */ // #define WEAK_EXCEPTIONS diff --git a/src/gui/dosbox_logo.h b/src/gui/dosbox_logo.h index a38dbda..ddf1aec 100644 --- a/src/gui/dosbox_logo.h +++ b/src/gui/dosbox_logo.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dosbox_logo.h,v 1.5 2009-05-27 09:15:41 qbix79 Exp $ */ /* DOSBox icon designed by Ido Beeri */ diff --git a/src/gui/midi.cpp b/src/gui/midi.cpp index 69c8788..9a8a2ba 100644 --- a/src/gui/midi.cpp +++ b/src/gui/midi.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,6 +19,10 @@ #include #include #include +#include +#include + +#include "SDL.h" #include "dosbox.h" #include "cross.h" @@ -27,6 +31,7 @@ #include "mapper.h" #include "pic.h" #include "hardware.h" +#include "timer.h" #define SYSEX_SIZE 1024 #define RAWBUF 1024 @@ -107,12 +112,19 @@ static struct { struct { Bit8u buf[SYSEX_SIZE]; Bitu used; + Bitu delay; + Bit32u start; } sysex; bool available; MidiHandler * handler; } midi; void MIDI_RawOutByte(Bit8u data) { + if (midi.sysex.start) { + Bit32u passed_ticks = GetTicks() - midi.sysex.start; + if (passed_ticks < midi.sysex.delay) SDL_Delay(midi.sysex.delay - passed_ticks); + } + /* Test for a realtime MIDI message */ if (data>=0xf8) { midi.rt_buf[0]=data; @@ -122,11 +134,28 @@ void MIDI_RawOutByte(Bit8u data) { /* Test for a active sysex tranfer */ if (midi.status==0xf0) { if (!(data&0x80)) { - if (midi.sysex.used<(SYSEX_SIZE-1)) midi.sysex.buf[midi.sysex.used++]=data; + if (midi.sysex.used<(SYSEX_SIZE-1)) midi.sysex.buf[midi.sysex.used++] = data; return; } else { - midi.sysex.buf[midi.sysex.used++]=0xf7; - midi.handler->PlaySysex(midi.sysex.buf,midi.sysex.used); + midi.sysex.buf[midi.sysex.used++] = 0xf7; + + if ((midi.sysex.start) && (midi.sysex.used >= 4) && (midi.sysex.used <= 9) && (midi.sysex.buf[1] == 0x41) && (midi.sysex.buf[3] == 0x16)) { + LOG(LOG_ALL,LOG_ERROR)("MIDI:Skipping invalid MT-32 SysEx midi message (too short to contain a checksum)"); + } else { +// LOG(LOG_ALL,LOG_NORMAL)("Play sysex; address:%02X %02X %02X, length:%4d, delay:%3d", midi.sysex.buf[5], midi.sysex.buf[6], midi.sysex.buf[7], midi.sysex.used, midi.sysex.delay); + midi.handler->PlaySysex(midi.sysex.buf, midi.sysex.used); + if (midi.sysex.start) { + if (midi.sysex.buf[5] == 0x7F) { + midi.sysex.delay = 290; // All Parameters reset + } else if (midi.sysex.buf[5] == 0x10 && midi.sysex.buf[6] == 0x00 && midi.sysex.buf[7] == 0x04) { + midi.sysex.delay = 145; // Viking Child + } else if (midi.sysex.buf[5] == 0x10 && midi.sysex.buf[6] == 0x00 && midi.sysex.buf[7] == 0x01) { + midi.sysex.delay = 30; // Dark Sun 1 + } else midi.sysex.delay = (Bitu)(((float)(midi.sysex.used) * 1.25f) * 1000.0f / 3125.0f) + 2; + midi.sysex.start = GetTicks(); + } + } + LOG(LOG_ALL,LOG_NORMAL)("Sysex message size %d",midi.sysex.used); if (CaptureState & CAPTURE_MIDI) { CAPTURE_AddMidi( true, midi.sysex.used-1, &midi.sysex.buf[1]); @@ -163,10 +192,19 @@ public: MIDI(Section* configuration):Module_base(configuration){ Section_prop * section=static_cast(configuration); const char * dev=section->Get_string("mididevice"); - const char * conf=section->Get_string("midiconfig"); + std::string fullconf=section->Get_string("midiconfig"); /* If device = "default" go for first handler that works */ MidiHandler * handler; // MAPPER_AddHandler(MIDI_SaveRawEvent,MK_f8,MMOD1|MMOD2,"caprawmidi","Cap MIDI"); + midi.sysex.delay = 0; + midi.sysex.start = 0; + if (fullconf.find("delaysysex") != std::string::npos) { + midi.sysex.start = GetTicks(); + fullconf.erase(fullconf.find("delaysysex")); + LOG_MSG("MIDI:Using delayed SysEx processing"); + } + std::remove(fullconf.begin(), fullconf.end(), ' '); + const char * conf = fullconf.c_str(); midi.status=0x00; midi.cmd_pos=0; midi.cmd_len=0; diff --git a/src/gui/midi_alsa.h b/src/gui/midi_alsa.h index f6b9c11..40b4aec 100644 --- a/src/gui/midi_alsa.h +++ b/src/gui/midi_alsa.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: midi_alsa.h,v 1.20 2009-04-27 17:33:12 qbix79 Exp $ */ #define ALSA_PCM_OLD_HW_PARAMS_API #define ALSA_PCM_OLD_SW_PARAMS_API diff --git a/src/gui/midi_coreaudio.h b/src/gui/midi_coreaudio.h index a8312e2..bcd757a 100644 --- a/src/gui/midi_coreaudio.h +++ b/src/gui/midi_coreaudio.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: midi_coreaudio.h,v 1.12 2009-10-18 18:06:28 qbix79 Exp $ */ #include #include diff --git a/src/gui/midi_oss.h b/src/gui/midi_oss.h index 886cdd6..1d6845f 100644 --- a/src/gui/midi_oss.h +++ b/src/gui/midi_oss.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/midi_win32.h b/src/gui/midi_win32.h index 490859c..52e59c9 100644 --- a/src/gui/midi_win32.h +++ b/src/gui/midi_win32.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: midi_win32.h,v 1.16 2009-05-27 09:15:41 qbix79 Exp $ */ #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN diff --git a/src/gui/render.cpp b/src/gui/render.cpp index 8bd9e8c..c20148f 100644 --- a/src/gui/render.cpp +++ b/src/gui/render.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: render.cpp,v 1.60 2009-04-26 19:14:50 harekiet Exp $ */ #include #include diff --git a/src/gui/render_loops.h b/src/gui/render_loops.h index 9a00d50..63e99aa 100644 --- a/src/gui/render_loops.h +++ b/src/gui/render_loops.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/render_scalers.cpp b/src/gui/render_scalers.cpp index 501c773..fba1d9a 100644 --- a/src/gui/render_scalers.cpp +++ b/src/gui/render_scalers.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/render_scalers.h b/src/gui/render_scalers.h index b901636..f830f07 100644 --- a/src/gui/render_scalers.h +++ b/src/gui/render_scalers.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/render_simple.h b/src/gui/render_simple.h index 8ac590d..7f27f3f 100644 --- a/src/gui/render_simple.h +++ b/src/gui/render_simple.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: render_simple.h,v 1.7 2009-05-27 09:15:41 qbix79 Exp $ */ #if defined (SCALERLINEAR) static void conc4d(SCALERNAME,SBPP,DBPP,L)(const void *s) { diff --git a/src/gui/render_templates.h b/src/gui/render_templates.h index 1622592..ea54615 100644 --- a/src/gui/render_templates.h +++ b/src/gui/render_templates.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/render_templates_hq.h b/src/gui/render_templates_hq.h index e1d18cd..9970dca 100644 --- a/src/gui/render_templates_hq.h +++ b/src/gui/render_templates_hq.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/render_templates_hq2x.h b/src/gui/render_templates_hq2x.h index e43f461..1e8cd8f 100644 --- a/src/gui/render_templates_hq2x.h +++ b/src/gui/render_templates_hq2x.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/render_templates_hq3x.h b/src/gui/render_templates_hq3x.h index f68ec6d..51b205d 100644 --- a/src/gui/render_templates_hq3x.h +++ b/src/gui/render_templates_hq3x.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/render_templates_sai.h b/src/gui/render_templates_sai.h index 09a6a59..ed1948f 100644 --- a/src/gui/render_templates_sai.h +++ b/src/gui/render_templates_sai.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/sdl_gui.cpp b/src/gui/sdl_gui.cpp index 34a79af..1cb081b 100644 --- a/src/gui/sdl_gui.cpp +++ b/src/gui/sdl_gui.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: sdl_gui.cpp,v 1.11 2009-02-25 19:58:11 c2woody Exp $ */ #if 0 #include "SDL.h" @@ -575,7 +574,7 @@ public: Section_prop *section = static_cast(sec); new SectionEditor(getScreen(), 50, 30, section); } else if (arg == "About") { - new GUI::MessageBox(getScreen(), 200, 150, 280, "About DOSBox", "\nDOSBox 0.72\nAn emulator for old DOS Games\n\nCopyright 2002-2009\nThe DOSBox Team"); + new GUI::MessageBox(getScreen(), 200, 150, 280, "About DOSBox", "\nDOSBox 0.74\nAn emulator for old DOS Games\n\nCopyright 2002-2011\nThe DOSBox Team"); } else if (arg == "Introduction") { new GUI::MessageBox(getScreen(), 20, 50, 600, "Introduction", MSG_Get("PROGRAM_INTRO")); } else if (arg == "Getting Started") { diff --git a/src/gui/sdl_mapper.cpp b/src/gui/sdl_mapper.cpp index a8ab47c..2110a36 100644 --- a/src/gui/sdl_mapper.cpp +++ b/src/gui/sdl_mapper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: sdl_mapper.cpp,v 1.60 2009-06-01 10:25:51 qbix79 Exp $ */ #include #include @@ -2362,17 +2361,21 @@ void MAPPER_Init(void) { if (!MAPPER_LoadBinds()) CreateDefaultBinds(); if (SDL_GetModState()&KMOD_CAPS) { for (CBindList_it bit=caps_lock_event->bindlist.begin();bit!=caps_lock_event->bindlist.end();bit++) { - (*bit)->ActivateBind(32767,true,true); #if SDL_VERSION_ATLEAST(1, 2, 14) + (*bit)->ActivateBind(32767,true,false); (*bit)->DeActivateBind(false); +#else + (*bit)->ActivateBind(32767,true,true); //Skip the action itself as bios_keyboard.cpp handles the startup state. #endif } } if (SDL_GetModState()&KMOD_NUM) { for (CBindList_it bit=num_lock_event->bindlist.begin();bit!=num_lock_event->bindlist.end();bit++) { - (*bit)->ActivateBind(32767,true,true); #if SDL_VERSION_ATLEAST(1, 2, 14) + (*bit)->ActivateBind(32767,true,false); (*bit)->DeActivateBind(false); +#else + (*bit)->ActivateBind(32767,true,true); #endif } } diff --git a/src/gui/sdlmain.cpp b/src/gui/sdlmain.cpp index 7a5cf60..555c15d 100644 --- a/src/gui/sdlmain.cpp +++ b/src/gui/sdlmain.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: sdlmain.cpp,v 1.154 2009-06-01 10:25:51 qbix79 Exp $ */ #ifndef _GNU_SOURCE #define _GNU_SOURCE @@ -1642,6 +1641,7 @@ void restart_program(std::vector & parameters) { // shutdown curses DEBUG_ShutDown(NULL); #endif + #ifndef HW_RVL execvp(newargs[0], newargs); #endif @@ -1780,7 +1780,7 @@ int main(int argc, char* argv[]) { #endif //defined(WIN32) && !(C_DEBUG) if (control->cmdline->FindExist("-version") || control->cmdline->FindExist("--version") ) { - printf("\nDOSBox version %s, copyright 2002-2010 DOSBox Team.\n\n",VERSION); + printf("\nDOSBox version %s, copyright 2002-2011 DOSBox Team.\n\n",VERSION); printf("DOSBox is written by the DOSBox Team (See AUTHORS file))\n"); printf("DOSBox comes with ABSOLUTELY NO WARRANTY. This is free software,\n"); printf("and you are welcome to redistribute it under certain conditions;\n"); @@ -1808,11 +1808,15 @@ int main(int argc, char* argv[]) { /* Display Welcometext in the console */ LOG_MSG("DOSBox version %s",VERSION); - LOG_MSG("Copyright 2002-2010 DOSBox Team, published under GNU GPL."); + LOG_MSG("Copyright 2002-2011 DOSBox Team, published under GNU GPL."); LOG_MSG("---"); /* Init SDL */ #if SDL_VERSION_ATLEAST(1, 2, 14) + /* Or debian/ubuntu with older libsdl version as they have done this themselves, but then differently. + * with this variable they will work correctly. I've only tested the 1.2.14 behaviour against the windows version + * of libsdl + */ putenv(const_cast("SDL_DISABLE_LOCK_KEYS=1")); #endif if ( SDL_Init( SDL_INIT_AUDIO|SDL_INIT_VIDEO|SDL_INIT_TIMER|SDL_INIT_CDROM diff --git a/src/hardware/Makefile.am b/src/hardware/Makefile.am index 70a1a7a..5e13695 100644 --- a/src/hardware/Makefile.am +++ b/src/hardware/Makefile.am @@ -2,12 +2,12 @@ AM_CPPFLAGS = -I$(top_srcdir)/include SUBDIRS = serialport -EXTRA_DIST = opl.cpp opl.h adlib.h dbopl.h +EXTRA_DIST = opl.cpp opl.h adlib.h dbopl.h pci_devices.h noinst_LIBRARIES = libhardware.a libhardware_a_SOURCES = adlib.cpp dma.cpp gameblaster.cpp hardware.cpp iohandler.cpp joystick.cpp keyboard.cpp \ - memory.cpp mixer.cpp pcspeaker.cpp pic.cpp sblaster.cpp tandy_sound.cpp timer.cpp \ + memory.cpp mixer.cpp pcspeaker.cpp pci_bus.cpp pic.cpp sblaster.cpp tandy_sound.cpp timer.cpp \ vga.cpp vga_attr.cpp vga_crtc.cpp vga_dac.cpp vga_draw.cpp vga_gfx.cpp vga_other.cpp \ vga_memory.cpp vga_misc.cpp vga_seq.cpp vga_xga.cpp vga_s3.cpp vga_tseng.cpp vga_paradise.cpp \ cmos.cpp disney.cpp gus.cpp mpu401.cpp ipx.cpp ipxserver.cpp dbopl.cpp diff --git a/src/hardware/adlib.cpp b/src/hardware/adlib.cpp index 0b1b538..158fb9d 100644 --- a/src/hardware/adlib.cpp +++ b/src/hardware/adlib.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: adlib.cpp,v 1.42 2009-11-03 20:17:42 qbix79 Exp $ */ #include #include diff --git a/src/hardware/adlib.h b/src/hardware/adlib.h index f625007..02ef2f2 100644 --- a/src/hardware/adlib.h +++ b/src/hardware/adlib.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: adlib.h,v 1.5 2009-04-28 21:45:43 c2woody Exp $ */ #ifndef DOSBOX_ADLIB_H #define DOSBOX_ADLIB_H diff --git a/src/hardware/cmos.cpp b/src/hardware/cmos.cpp index 57beb90..f483592 100644 --- a/src/hardware/cmos.cpp +++ b/src/hardware/cmos.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: cmos.cpp,v 1.29 2009-06-16 18:19:18 qbix79 Exp $ */ #include #include diff --git a/src/hardware/dbopl.cpp b/src/hardware/dbopl.cpp index b68679b..646a63a 100644 --- a/src/hardware/dbopl.cpp +++ b/src/hardware/dbopl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -32,7 +32,6 @@ //DUNNO Keyon in 4op, switch to 2op without keyoff. */ -/* $Id: dbopl.cpp,v 1.10 2009-06-10 19:54:51 harekiet Exp $ */ #include diff --git a/src/hardware/dbopl.h b/src/hardware/dbopl.h index 87f6bce..a65035c 100644 --- a/src/hardware/dbopl.h +++ b/src/hardware/dbopl.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/hardware/disney.cpp b/src/hardware/disney.cpp index b28c17f..1083c69 100644 --- a/src/hardware/disney.cpp +++ b/src/hardware/disney.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: disney.cpp,v 1.17 2009-05-14 17:04:37 qbix79 Exp $ */ #include #include "dosbox.h" diff --git a/src/hardware/dma.cpp b/src/hardware/dma.cpp index 8a9ac8c..8b32c2f 100644 --- a/src/hardware/dma.cpp +++ b/src/hardware/dma.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dma.cpp,v 1.41 2009-07-24 09:56:14 c2woody Exp $ */ #include #include "dosbox.h" diff --git a/src/hardware/gameblaster.cpp b/src/hardware/gameblaster.cpp index 8f52de6..1c16f28 100644 --- a/src/hardware/gameblaster.cpp +++ b/src/hardware/gameblaster.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/hardware/gus.cpp b/src/hardware/gus.cpp index e4e4f33..b10546b 100644 --- a/src/hardware/gus.cpp +++ b/src/hardware/gus.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: gus.cpp,v 1.37 2009-09-03 16:03:01 c2woody Exp $ */ #include #include @@ -770,7 +769,7 @@ static void MakeTables(void) { vol16bit[i]=(Bit16s)out; out/=1.002709201; /* 0.0235 dB Steps */ } - pantable[0]=0; + pantable[0] = 4095 << RAMP_FRACT; for (i=1;i<16;i++) { pantable[i]=(Bit32u)(-128.0*(log((double)i/15.0)/log(2.0))*(double)(1 << RAMP_FRACT)); } diff --git a/src/hardware/hardware.cpp b/src/hardware/hardware.cpp index 3e76748..257caf2 100644 --- a/src/hardware/hardware.cpp +++ b/src/hardware/hardware.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: hardware.cpp,v 1.22 2009-04-26 18:24:36 qbix79 Exp $ */ #include #include diff --git a/src/hardware/iohandler.cpp b/src/hardware/iohandler.cpp index 20f3cd2..0b5e106 100644 --- a/src/hardware/iohandler.cpp +++ b/src/hardware/iohandler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: iohandler.cpp,v 1.30 2009-05-27 09:15:41 qbix79 Exp $ */ #include #include "dosbox.h" @@ -45,7 +44,7 @@ static Bitu IO_ReadDefault(Bitu port,Bitu iolen) { io_readhandlers[0][port]=IO_ReadBlocked; return 0xff; case 2: - return + return (io_readhandlers[0][port+0](port+0,1) << 0) | (io_readhandlers[0][port+1](port+1,1) << 8); case 4: @@ -59,7 +58,7 @@ static Bitu IO_ReadDefault(Bitu port,Bitu iolen) { void IO_WriteDefault(Bitu port,Bitu val,Bitu iolen) { switch (iolen) { case 1: - LOG(LOG_IO,LOG_WARN)("Writing %02X to port %04X",val,port); + LOG(LOG_IO,LOG_WARN)("Writing %02X to port %04X",val,port); io_writehandlers[0][port]=IO_WriteBlocked; break; case 2: @@ -116,12 +115,17 @@ void IO_ReadHandleObject::Install(Bitu port,IO_ReadHandler * handler,Bitu mask,B m_mask=mask; m_range=range; IO_RegisterReadHandler(port,handler,mask,range); - } else E_Exit("IO_readHandler allready installed port %x",port); + } else E_Exit("IO_readHandler already installed port %x",port); +} + +void IO_ReadHandleObject::Uninstall(){ + if(!installed) return; + IO_FreeReadHandler(m_port,m_mask,m_range); + installed=false; } IO_ReadHandleObject::~IO_ReadHandleObject(){ - if(!installed) return; - IO_FreeReadHandler(m_port,m_mask,m_range); + Uninstall(); } void IO_WriteHandleObject::Install(Bitu port,IO_WriteHandler * handler,Bitu mask,Bitu range) { @@ -131,12 +135,17 @@ void IO_WriteHandleObject::Install(Bitu port,IO_WriteHandler * handler,Bitu mask m_mask=mask; m_range=range; IO_RegisterWriteHandler(port,handler,mask,range); - } else E_Exit("IO_writeHandler allready installed port %x",port); + } else E_Exit("IO_writeHandler already installed port %x",port); +} + +void IO_WriteHandleObject::Uninstall() { + if(!installed) return; + IO_FreeWriteHandler(m_port,m_mask,m_range); + installed=false; } IO_WriteHandleObject::~IO_WriteHandleObject(){ - if(!installed) return; - IO_FreeWriteHandler(m_port,m_mask,m_range); + Uninstall(); //LOG_MSG("FreeWritehandler called with port %X",m_port); } @@ -157,7 +166,7 @@ static Bits IOFaultCore(void) { Bits ret=CPU_Core_Full_Run(); CPU_CycleLeft+=CPU_Cycles; if (ret<0) E_Exit("Got a dosbox close machine in IO-fault core?"); - if (ret) + if (ret) return ret; if (!iof_queue.used) E_Exit("IO-faul Core without IO-faul"); IOF_Entry * entry=&iof_queue.entries[iof_queue.used-1]; @@ -187,7 +196,7 @@ inline void IO_USEC_read_delay_old() { inline void IO_USEC_write_delay_old() { if(CPU_CycleMax > static_cast((IODELAY_WRITE_MICROS*1000.0))) { // this could be calculated whenever CPU_CycleMax changes - Bits delaycyc = static_cast((CPU_CycleMax/1000)*IODELAY_WRITE_MICROS); + Bits delaycyc = static_cast((CPU_CycleMax/1000)*IODELAY_WRITE_MICROS); if(CPU_Cycles > delaycyc) CPU_Cycles -= delaycyc; else CPU_Cycles = 0; } @@ -205,7 +214,7 @@ inline void IO_USEC_read_delay() { } inline void IO_USEC_write_delay() { - Bits delaycyc = CPU_CycleMax/IODELAY_WRITE_MICROSk; + Bits delaycyc = CPU_CycleMax/IODELAY_WRITE_MICROSk; if(GCC_UNLIKELY(CPU_Cycles < 3*delaycyc)) delaycyc=0; CPU_Cycles -= delaycyc; CPU_IODelayRemoved += delaycyc; @@ -328,7 +337,7 @@ void IO_WriteW(Bitu port,Bitu val) { CPU_Push16(reg_ip); Bit16u old_ax = reg_ax; Bit16u old_dx = reg_dx; - reg_al = val; + reg_ax = val; reg_dx = port; RealPt icb = CALLBACK_RealPointer(call_priv_io); SegSet16(cs,RealSeg(icb)); @@ -364,7 +373,7 @@ void IO_WriteD(Bitu port,Bitu val) { CPU_Push16(reg_ip); Bit32u old_eax = reg_eax; Bit16u old_dx = reg_dx; - reg_al = val; + reg_eax = val; reg_dx = port; RealPt icb = CALLBACK_RealPointer(call_priv_io); SegSet16(cs,RealSeg(icb)); @@ -406,7 +415,7 @@ Bitu IO_ReadB(Bitu port) { iof_queue.used--; retval = reg_al; - reg_dx = old_dx; + reg_dx = old_dx; memcpy(&lflags,&old_lflags,sizeof(LazyFlags)); cpudecoder=old_cpudecoder; return retval; @@ -443,7 +452,7 @@ Bitu IO_ReadW(Bitu port) { iof_queue.used--; retval = reg_ax; - reg_dx = old_dx; + reg_dx = old_dx; memcpy(&lflags,&old_lflags,sizeof(LazyFlags)); cpudecoder=old_cpudecoder; } @@ -479,7 +488,7 @@ Bitu IO_ReadD(Bitu port) { iof_queue.used--; retval = reg_eax; - reg_dx = old_dx; + reg_dx = old_dx; memcpy(&lflags,&old_lflags,sizeof(LazyFlags)); cpudecoder=old_cpudecoder; } else { diff --git a/src/hardware/ipx.cpp b/src/hardware/ipx.cpp index 6049404..3ec21ec 100644 --- a/src/hardware/ipx.cpp +++ b/src/hardware/ipx.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: ipx.cpp,v 1.17 2009-05-27 09:15:41 qbix79 Exp $ */ #include "dosbox.h" @@ -936,7 +935,7 @@ public: if(strcasecmp("startserver", temp_line.c_str()) == 0) { if(!isIpxServer) { if(incomingPacket.connected) { - WriteOut("IPX Tunneling Client alreadu connected to another server. Disconnect first.\n"); + WriteOut("IPX Tunneling Client already connected to another server. Disconnect first.\n"); return; } bool startsuccess; diff --git a/src/hardware/ipxserver.cpp b/src/hardware/ipxserver.cpp index 6508233..9799c54 100644 --- a/src/hardware/ipxserver.cpp +++ b/src/hardware/ipxserver.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: ipxserver.cpp,v 1.10 2009-05-27 09:15:41 qbix79 Exp $ */ #include "dosbox.h" diff --git a/src/hardware/joystick.cpp b/src/hardware/joystick.cpp index 049db4b..bce5a00 100644 --- a/src/hardware/joystick.cpp +++ b/src/hardware/joystick.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: joystick.cpp,v 1.21 2009-05-27 09:15:41 qbix79 Exp $ */ #include #include "dosbox.h" diff --git a/src/hardware/keyboard.cpp b/src/hardware/keyboard.cpp index 80cdde4..779822b 100644 --- a/src/hardware/keyboard.cpp +++ b/src/hardware/keyboard.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: keyboard.cpp,v 1.41 2009-05-27 09:15:41 qbix79 Exp $ */ #include "dosbox.h" #include "keyboard.h" diff --git a/src/hardware/memory.cpp b/src/hardware/memory.cpp index 050330f..80470ba 100644 --- a/src/hardware/memory.cpp +++ b/src/hardware/memory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: memory.cpp,v 1.56 2009-05-27 09:15:41 qbix79 Exp $ */ #include "dosbox.h" #include "mem.h" @@ -428,15 +427,17 @@ void MEM_A20_Enable(bool enabled) { /* Memory access functions */ Bit16u mem_unalignedreadw(PhysPt address) { - return mem_readb_inline(address) | - mem_readb_inline(address+1) << 8; + Bit16u ret = mem_readb_inline(address); + ret |= mem_readb_inline(address+1) << 8; + return ret; } Bit32u mem_unalignedreadd(PhysPt address) { - return mem_readb_inline(address) | - (mem_readb_inline(address+1) << 8) | - (mem_readb_inline(address+2) << 16) | - (mem_readb_inline(address+3) << 24); + Bit32u ret = mem_readb_inline(address); + ret |= mem_readb_inline(address+1) << 8; + ret |= mem_readb_inline(address+2) << 16; + ret |= mem_readb_inline(address+3) << 24; + return ret; } diff --git a/src/hardware/mixer.cpp b/src/hardware/mixer.cpp index 3ec5fb6..52311c9 100644 --- a/src/hardware/mixer.cpp +++ b/src/hardware/mixer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: mixer.cpp,v 1.54 2009-09-05 11:10:04 qbix79 Exp $ */ /* Remove the sdl code from here and have it handeld in the sdlmain. diff --git a/src/hardware/mpu401.cpp b/src/hardware/mpu401.cpp index 8befe78..9730885 100644 --- a/src/hardware/mpu401.cpp +++ b/src/hardware/mpu401.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: mpu401.cpp,v 1.29 2009-05-27 09:15:41 qbix79 Exp $ */ #include #include "dosbox.h" diff --git a/src/hardware/opl.cpp b/src/hardware/opl.cpp index 2dd2c98..48401d4 100644 --- a/src/hardware/opl.cpp +++ b/src/hardware/opl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * OPL2/OPL3 emulation library * * This library is free software; you can redistribute it and/or diff --git a/src/hardware/opl.h b/src/hardware/opl.h index f00f3e8..0ba6cfd 100644 --- a/src/hardware/opl.h +++ b/src/hardware/opl.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * OPL2/OPL3 emulation library * * This library is free software; you can redistribute it and/or diff --git a/src/hardware/pci_bus.cpp b/src/hardware/pci_bus.cpp new file mode 100644 index 0000000..f958cda --- /dev/null +++ b/src/hardware/pci_bus.cpp @@ -0,0 +1,438 @@ +/* + * Copyright (C) 2002-2011 The DOSBox Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + + +#include "dosbox.h" +#include "inout.h" +#include "mem.h" +#include "pci_bus.h" +#include "setup.h" +#include "debug.h" +#include "callback.h" +#include "regs.h" + + +#if defined(PCI_FUNCTIONALITY_ENABLED) + +static Bit32u pci_caddress=0; // current PCI addressing +static Bitu pci_devices_installed=0; // number of registered PCI devices + +static Bit8u pci_cfg_data[PCI_MAX_PCIDEVICES][PCI_MAX_PCIFUNCTIONS][256]; // PCI configuration data +static PCI_Device* pci_devices[PCI_MAX_PCIDEVICES]; // registered PCI devices + + +// PCI address +// 31 - set for a PCI access +// 30-24 - 0 +// 23-16 - bus number (0x00ff0000) +// 15-11 - device number (slot) (0x0000f800) +// 10- 8 - subfunction number (0x00000700) +// 7- 2 - config register # (0x000000fc) + +static void write_pci_addr(Bitu port,Bitu val,Bitu iolen) { + LOG(LOG_PCI,LOG_NORMAL)("Write PCI address :=%x",val); + pci_caddress=val; +} + +static void write_pci_register(PCI_Device* dev,Bit8u regnum,Bit8u value) { + // vendor/device/class IDs/header type/etc. are read-only + if ((regnum<0x04) || ((regnum>=0x06) && (regnum<0x0c)) || (regnum==0x0e)) return; + if (dev==NULL) return; + switch (pci_cfg_data[dev->PCIId()][dev->PCISubfunction()][0x0e]&0x7f) { // header-type specific handling + case 0x00: + if ((regnum>=0x28) && (regnum<0x30)) return; // subsystem information is read-only + break; + case 0x01: + case 0x02: + default: + break; + } + + // call device routine for special actions and the + // possibility to discard/replace the value that is to be written + Bits parsed_register=dev->ParseWriteRegister(regnum,value); + if (parsed_register>=0) + pci_cfg_data[dev->PCIId()][dev->PCISubfunction()][regnum]=(Bit8u)(parsed_register&0xff); +} + +static void write_pci(Bitu port,Bitu val,Bitu iolen) { + LOG(LOG_PCI,LOG_NORMAL)("Write PCI data :=%x (len %d)",port,val,iolen); + + // check for enabled/bus 0 + if ((pci_caddress & 0x80ff0000) == 0x80000000) { + Bit8u devnum = (Bit8u)((pci_caddress >> 11) & 0x1f); + Bit8u fctnum = (Bit8u)((pci_caddress >> 8) & 0x7); + Bit8u regnum = (Bit8u)((pci_caddress & 0xfc) + (port & 0x03)); + LOG(LOG_PCI,LOG_NORMAL)(" Write to device %x register %x (function %x) (:=%x)",devnum,regnum,fctnum,val); + + if (devnum>=pci_devices_installed) return; + PCI_Device* masterdev=pci_devices[devnum]; + if (masterdev==NULL) return; + if (fctnum>masterdev->NumSubdevices()) return; + + PCI_Device* dev=masterdev->GetSubdevice(fctnum); + if (dev==NULL) return; + + // write data to PCI device/configuration + switch (iolen) { + case 1: write_pci_register(dev,regnum+0,(Bit8u)(val&0xff)); break; + case 2: write_pci_register(dev,regnum+0,(Bit8u)(val&0xff)); + write_pci_register(dev,regnum+1,(Bit8u)((val>>8)&0xff)); break; + case 4: write_pci_register(dev,regnum+0,(Bit8u)(val&0xff)); + write_pci_register(dev,regnum+1,(Bit8u)((val>>8)&0xff)); + write_pci_register(dev,regnum+2,(Bit8u)((val>>16)&0xff)); + write_pci_register(dev,regnum+3,(Bit8u)((val>>24)&0xff)); break; + } + } +} + + +static Bitu read_pci_addr(Bitu port,Bitu iolen) { + LOG(LOG_PCI,LOG_NORMAL)("Read PCI address -> %x",pci_caddress); + return pci_caddress; +} + +// read single 8bit value from register file (special register treatment included) +static Bit8u read_pci_register(PCI_Device* dev,Bit8u regnum) { + switch (regnum) { + case 0x00: + return (Bit8u)(dev->VendorID()&0xff); + case 0x01: + return (Bit8u)((dev->VendorID()>>8)&0xff); + case 0x02: + return (Bit8u)(dev->DeviceID()&0xff); + case 0x03: + return (Bit8u)((dev->DeviceID()>>8)&0xff); + + case 0x0e: + return (pci_cfg_data[dev->PCIId()][dev->PCISubfunction()][regnum]&0x7f) | + ((dev->NumSubdevices()>0)?0x80:0x00); + default: + break; + } + + // call device routine for special actions and possibility to discard/remap register + Bits parsed_regnum=dev->ParseReadRegister(regnum); + if ((parsed_regnum>=0) && (parsed_regnum<256)) + return pci_cfg_data[dev->PCIId()][dev->PCISubfunction()][parsed_regnum]; + + return 0xff; +} + +static Bitu read_pci(Bitu port,Bitu iolen) { + LOG(LOG_PCI,LOG_NORMAL)("Read PCI data -> %x",pci_caddress); + + if ((pci_caddress & 0x80ff0000) == 0x80000000) { + Bit8u devnum = (Bit8u)((pci_caddress >> 11) & 0x1f); + Bit8u fctnum = (Bit8u)((pci_caddress >> 8) & 0x7); + Bit8u regnum = (Bit8u)((pci_caddress & 0xfc) + (port & 0x03)); + if (devnum>=pci_devices_installed) return 0xffffffff; + LOG(LOG_PCI,LOG_NORMAL)(" Read from device %x register %x (function %x); addr %x", + devnum,regnum,fctnum,pci_caddress); + + PCI_Device* masterdev=pci_devices[devnum]; + if (masterdev==NULL) return 0xffffffff; + if (fctnum>masterdev->NumSubdevices()) return 0xffffffff; + + PCI_Device* dev=masterdev->GetSubdevice(fctnum); + + if (dev!=NULL) { + switch (iolen) { + case 1: + { + Bit8u val8=read_pci_register(dev,regnum); + return val8; + } + case 2: + { + Bit16u val16=read_pci_register(dev,regnum); + val16|=(read_pci_register(dev,regnum+1)<<8); + return val16; + } + case 4: + { + Bit32u val32=read_pci_register(dev,regnum); + val32|=(read_pci_register(dev,regnum+1)<<8); + val32|=(read_pci_register(dev,regnum+2)<<16); + val32|=(read_pci_register(dev,regnum+3)<<24); + return val32; + } + default: + break; + } + } + } + return 0xffffffff; +} + + +static Bitu PCI_PM_Handler() { + LOG_MSG("PCI PMode handler, function %x",reg_ax); + return CBRET_NONE; +} + + +PCI_Device::PCI_Device(Bit16u vendor, Bit16u device) { + pci_id=-1; + pci_subfunction=-1; + vendor_id=vendor; + device_id=device; + num_subdevices=0; + for (Bitu dct=0;dct=0) && (number=0) && (subfct0) && (subfctNumSubdevices()) { + delete subdevices[subfct-1]; + subdevices[subfct-1]=NULL; + // should adjust things like num_subdevices as well... + } + } +} + +PCI_Device* PCI_Device::GetSubdevice(Bits subfct) { + if (subfct>=PCI_MAX_PCIFUNCTIONS) return NULL; + if (subfct>0) { + if (subfct<=this->NumSubdevices()) return subdevices[subfct-1]; + } else if (subfct==0) { + return this; + } + return NULL; +} + + +// queued devices (PCI device registering requested before the PCI framework was initialized) +static const Bitu max_rqueued_devices=16; +static Bitu num_rqueued_devices=0; +static PCI_Device* rqueued_devices[max_rqueued_devices]; + + +#include "pci_devices.h" + +class PCI:public Module_base{ +private: + bool initialized; + +protected: + IO_WriteHandleObject PCI_WriteHandler[5]; + IO_ReadHandleObject PCI_ReadHandler[5]; + + CALLBACK_HandlerObject callback_pci; + +public: + + PhysPt GetPModeCallbackPointer(void) { + return Real2Phys(callback_pci.Get_RealPointer()); + } + + bool IsInitialized(void) { + return initialized; + } + + // set up port handlers and configuration data + void InitializePCI(void) { + // install PCI-addressing ports + PCI_WriteHandler[0].Install(0xcf8,write_pci_addr,IO_MD); + PCI_ReadHandler[0].Install(0xcf8,read_pci_addr,IO_MD); + // install PCI-register read/write handlers + for (Bitu ct=0;ct<4;ct++) { + PCI_WriteHandler[1+ct].Install(0xcfc+ct,write_pci,IO_MB); + PCI_ReadHandler[1+ct].Install(0xcfc+ct,read_pci,IO_MB); + } + + for (Bitu dev=0; dev=0) { + // specific slot specified, basic check for validity + if (slot>=PCI_MAX_PCIDEVICES) return -1; + } else { + // auto-add to new slot, check if one is still free + if (pci_devices_installed>=PCI_MAX_PCIDEVICES) return -1; + } + + if (!initialized) InitializePCI(); + + if (slot<0) slot=pci_devices_installed; // use next slot + Bits subfunction=0; // main device unless specific already-occupied slot is requested + if (pci_devices[slot]!=NULL) { + subfunction=pci_devices[slot]->GetNextSubdeviceNumber(); + if (subfunction<0) E_Exit("Too many PCI subdevices!"); + } + + if (device->InitializeRegisters(pci_cfg_data[slot][subfunction])) { + device->SetPCIId(slot, subfunction); + if (pci_devices[slot]==NULL) { + pci_devices[slot]=device; + pci_devices_installed++; + } else { + pci_devices[slot]->AddSubdevice(device); + } + + return slot; + } + + return -1; + } + + void Deinitialize(void) { + initialized=false; + pci_devices_installed=0; + num_rqueued_devices=0; + pci_caddress=0; + + for (Bitu dev=0; devNumSubdevices()>0) { + for (Bitu sct=1;sctGetSubdevice(sct); + if (sdev!=NULL) { + if ((sdev->VendorID()==vendor_id) && (sdev->DeviceID()==device_id)) { + pci_devices[dct]->RemoveSubdevice(sct); + } + } + } + } + + if ((pci_devices[dct]->VendorID()==vendor_id) && (pci_devices[dct]->DeviceID()==device_id)) { + delete pci_devices[dct]; + pci_devices[dct]=NULL; + } + } + } + + // check if all devices have been removed + bool any_device_left=false; + for (Bitu dct=0;dct=pci_devices_installed) break; + if (pci_devices[dct]!=NULL) { + any_device_left=true; + break; + } + } + if (!any_device_left) Deinitialize(); + + Bitu last_active_device=PCI_MAX_PCIDEVICES; + for (Bitu dct=0;dct0) { + // register all devices that have been added before the PCI bus was instantiated + for (Bitu dct=0;dctRegisterPCIDevice(rqueued_devices[dct]); + } + num_rqueued_devices=0; + } + } + + ~PCI(){ + initialized=false; + pci_devices_installed=0; + num_rqueued_devices=0; + } + +}; + +static PCI* pci_interface=NULL; + + +PhysPt PCI_GetPModeInterface(void) { + if (pci_interface) { + return pci_interface->GetPModeCallbackPointer(); + } + return 0; +} + +bool PCI_IsInitialized() { + if (pci_interface) return pci_interface->IsInitialized(); + return false; +} + + +void PCI_ShutDown(Section* sec){ + delete pci_interface; + pci_interface=NULL; +} + +void PCI_Init(Section* sec) { + pci_interface = new PCI(sec); + sec->AddDestroyFunction(&PCI_ShutDown,false); +} + +#endif diff --git a/src/hardware/pci_devices.h b/src/hardware/pci_devices.h new file mode 100644 index 0000000..9a02680 --- /dev/null +++ b/src/hardware/pci_devices.h @@ -0,0 +1,18 @@ +/* + * Copyright (C) 2002-2011 The DOSBox Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + diff --git a/src/hardware/pcspeaker.cpp b/src/hardware/pcspeaker.cpp index eafd79b..2c74199 100644 --- a/src/hardware/pcspeaker.cpp +++ b/src/hardware/pcspeaker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - /* $Id: pcspeaker.cpp,v 1.26 2009-05-27 09:15:41 qbix79 Exp $ */ #include #include "dosbox.h" diff --git a/src/hardware/pic.cpp b/src/hardware/pic.cpp index 77823be..cc2beaf 100644 --- a/src/hardware/pic.cpp +++ b/src/hardware/pic.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: pic.cpp,v 1.44 2009-05-27 09:15:41 qbix79 Exp $ */ #include @@ -92,9 +91,9 @@ static void write_command(Bitu port,Bitu val,Bitu iolen) { else pic->request_issr=false; /* select read interrupt request register */ } if (val&0x40) { // special mask select - if (val&0x20) pic->special=true; - else pic->special=false; - if(pic[0].special || pics[1].special) + if (val&0x20) pic->special = true; + else pic->special = false; + if (pics[0].special || pics[1].special) PIC_Special_Mode = true; else PIC_Special_Mode = false; if (PIC_IRQCheck) { //Recheck irqs @@ -244,6 +243,17 @@ static Bitu read_data(Bitu port,Bitu iolen) { void PIC_ActivateIRQ(Bitu irq) { + if (GCC_UNLIKELY(CPU_Cycles)) { + // CPU_Cycles nonzero means the interrupt was triggered by an I/O + // register write rather than an event. + // Real hardware executes 0 to ~13 NOPs or comparable instructions + // before the processor picks up the interrupt. Let's try with 2 + // cycles here. + // Required by Panic demo (irq0), It came from the desert (MPU401) + // Does it matter if CPU_CycleLeft becomes negative? + CPU_CycleLeft += (CPU_Cycles-2); + CPU_Cycles=2; + } if( irq < 8 ) { irqs[irq].active = true; if (!irqs[irq].masked) { diff --git a/src/hardware/sblaster.cpp b/src/hardware/sblaster.cpp index 7c53012..f43ee08 100644 --- a/src/hardware/sblaster.cpp +++ b/src/hardware/sblaster.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: sblaster.cpp,v 1.78 2009-10-25 16:22:22 c2woody Exp $ */ #include #include @@ -900,6 +899,9 @@ static void DSP_DoCommand(void) { case 0xd0: /* Halt 8-bit DMA */ // DSP_ChangeMode(MODE_NONE); // Games sometimes already program a new dma before stopping, gives noise + if (sb.mode==MODE_NONE) { + // possibly different code here that does not switch to MODE_DMA_PAUSE + } sb.mode=MODE_DMA_PAUSE; PIC_RemoveEvents(END_DMA_Event); break; @@ -920,7 +922,7 @@ static void DSP_DoCommand(void) { case 0xd4: /* Continue DMA 8-bit*/ if (sb.mode==MODE_DMA_PAUSE) { sb.mode=MODE_DMA_MASKED; - sb.dma.chan->Register_Callback(DSP_DMA_CallBack); + if (sb.dma.chan!=NULL) sb.dma.chan->Register_Callback(DSP_DMA_CallBack); } break; case 0xd9: /* Exit Autoinitialize 16-bit */ @@ -979,6 +981,10 @@ static void DSP_DoCommand(void) { case 0xf2: /* Trigger 8bit IRQ */ SB_RaiseIRQ(SB_IRQ_8); break; + case 0xf3: /* Trigger 16bit IRQ */ + DSP_SB16_ONLY; + SB_RaiseIRQ(SB_IRQ_16); + break; case 0xf8: /* Undocumented, pre-SB16 only */ DSP_FlushData(); DSP_AddData(0); diff --git a/src/hardware/serialport/directserial.cpp b/src/hardware/serialport/directserial.cpp index ee80e22..de978c2 100644 --- a/src/hardware/serialport/directserial.cpp +++ b/src/hardware/serialport/directserial.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: directserial.cpp,v 1.2 2009-09-26 09:15:19 h-a-l-9000 Exp $ */ #include "dosbox.h" diff --git a/src/hardware/serialport/directserial.h b/src/hardware/serialport/directserial.h index 645e704..ccdb9f8 100644 --- a/src/hardware/serialport/directserial.h +++ b/src/hardware/serialport/directserial.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: directserial.h,v 1.2 2009-09-26 09:15:19 h-a-l-9000 Exp $ */ // include guard #ifndef DOSBOX_DIRECTSERIAL_WIN32_H diff --git a/src/hardware/serialport/libserial.cpp b/src/hardware/serialport/libserial.cpp index 94b5df3..e7631b1 100644 --- a/src/hardware/serialport/libserial.cpp +++ b/src/hardware/serialport/libserial.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: libserial.cpp,v 1.4 2009-11-02 09:51:02 h-a-l-9000 Exp $ */ #include "libserial.h" @@ -45,6 +44,7 @@ bool SERIAL_open(const char* portname, COMPORT* port) { int len = strlen(portname); if(len > 240) { SetLastError(ERROR_BUFFER_OVERFLOW); + free(cp); return false; } char extended_portname[256] = "\\\\.\\"; diff --git a/src/hardware/serialport/libserial.h b/src/hardware/serialport/libserial.h index 3ec85f9..bb74e5b 100644 --- a/src/hardware/serialport/libserial.h +++ b/src/hardware/serialport/libserial.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: libserial.h,v 1.2 2009-09-26 09:15:19 h-a-l-9000 Exp $ */ typedef struct _COMPORT *COMPORT; diff --git a/src/hardware/serialport/misc_util.cpp b/src/hardware/serialport/misc_util.cpp index 8696151..4faf84d 100644 --- a/src/hardware/serialport/misc_util.cpp +++ b/src/hardware/serialport/misc_util.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/hardware/serialport/misc_util.h b/src/hardware/serialport/misc_util.h index d468e8e..ef15036 100644 --- a/src/hardware/serialport/misc_util.h +++ b/src/hardware/serialport/misc_util.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: misc_util.h,v 1.5 2009-09-25 23:40:47 h-a-l-9000 Exp $ */ #ifndef SDLNETWRAPPER_H #define SDLNETWRAPPER_H diff --git a/src/hardware/serialport/nullmodem.cpp b/src/hardware/serialport/nullmodem.cpp index 2a9fe4b..9ecfbff 100644 --- a/src/hardware/serialport/nullmodem.cpp +++ b/src/hardware/serialport/nullmodem.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: nullmodem.cpp,v 1.8 2009-09-25 23:40:47 h-a-l-9000 Exp $ */ #include "dosbox.h" @@ -138,11 +137,13 @@ CNullModem::CNullModem(Bitu id, CommandLine* cmd):CSerial (id, cmd) { } } } else { -#endif LOG_MSG("Serial%d: socket inheritance not supported on this platform.", COMNUMBER); return; } +#else + LOG_MSG("Serial%d: socket inheritance not available.", COMNUMBER); +#endif } std::string tmpstring; if(cmd->FindStringBegin("server:",tmpstring,false)) { diff --git a/src/hardware/serialport/nullmodem.h b/src/hardware/serialport/nullmodem.h index dc0ef50..d8510a8 100644 --- a/src/hardware/serialport/nullmodem.h +++ b/src/hardware/serialport/nullmodem.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: nullmodem.h,v 1.4 2009-09-25 23:40:47 h-a-l-9000 Exp $ */ // include guard #ifndef DOSBOX_NULLMODEM_WIN32_H diff --git a/src/hardware/serialport/serialdummy.cpp b/src/hardware/serialport/serialdummy.cpp index 15d8bbe..9646360 100644 --- a/src/hardware/serialport/serialdummy.cpp +++ b/src/hardware/serialport/serialdummy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: serialdummy.cpp,v 1.5 2009-05-27 09:15:41 qbix79 Exp $ */ #include "dosbox.h" diff --git a/src/hardware/serialport/serialdummy.h b/src/hardware/serialport/serialdummy.h index 956dbab..9848794 100644 --- a/src/hardware/serialport/serialdummy.h +++ b/src/hardware/serialport/serialdummy.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: serialdummy.h,v 1.5 2009-05-27 09:15:41 qbix79 Exp $ */ #ifndef INCLUDEGUARD_SERIALDUMMY_H #define INCLUDEGUARD_SERIALDUMMY_H diff --git a/src/hardware/serialport/serialport.cpp b/src/hardware/serialport/serialport.cpp index e0f4959..2788029 100644 --- a/src/hardware/serialport/serialport.cpp +++ b/src/hardware/serialport/serialport.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: serialport.cpp,v 1.14 2009-10-01 17:25:28 h-a-l-9000 Exp $ */ #include #include diff --git a/src/hardware/serialport/softmodem.cpp b/src/hardware/serialport/softmodem.cpp index 16c86eb..eb95805 100644 --- a/src/hardware/serialport/softmodem.cpp +++ b/src/hardware/serialport/softmodem.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: softmodem.cpp,v 1.12 2009-10-04 20:57:40 h-a-l-9000 Exp $ */ #include "dosbox.h" diff --git a/src/hardware/serialport/softmodem.h b/src/hardware/serialport/softmodem.h index c9a7553..f1fadb2 100644 --- a/src/hardware/serialport/softmodem.h +++ b/src/hardware/serialport/softmodem.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: softmodem.h,v 1.12 2009-10-04 20:57:40 h-a-l-9000 Exp $ */ #ifndef DOSBOX_SERIALMODEM_H #define DOSBOX_SERIALMODEM_H diff --git a/src/hardware/tandy_sound.cpp b/src/hardware/tandy_sound.cpp index dd47336..18b465d 100644 --- a/src/hardware/tandy_sound.cpp +++ b/src/hardware/tandy_sound.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/hardware/timer.cpp b/src/hardware/timer.cpp index 59478ac..c986527 100644 --- a/src/hardware/timer.cpp +++ b/src/hardware/timer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: timer.cpp,v 1.49 2009-04-10 09:53:04 c2woody Exp $ */ #include #include "dosbox.h" @@ -138,8 +137,14 @@ static void counter_latch(Bitu counter) { p->go_read_latch=false; //If gate2 is disabled don't update the read_latch - if(counter == 2 && !gate2 && p->mode !=1) return; - + if (counter == 2 && !gate2 && p->mode !=1) return; + if (GCC_UNLIKELY(p->new_mode)) { + double passed_time = PIC_FullIndex() - p->start; + Bitu ticks_since_then = (Bitu)(passed_time / (1000.0/PIT_TICK_RATE)); + //if (p->mode==3) ticks_since_then /= 2; // TODO figure this out on real hardware + p->read_latch -= ticks_since_then; + return; + } double index=PIC_FullIndex()-p->start; switch (p->mode) { case 4: /* Software Triggered Strobe */ @@ -299,6 +304,10 @@ static void write_p43(Bitu /*port*/,Bitu val,Bitu /*iolen*/) { /* Counter latch command */ counter_latch(latch); } else { + // save output status to be used with timer 0 irq + bool old_output = counter_output(0); + // save the current count value to be re-used in undocumented newmode + counter_latch(latch); pit[latch].bcd = (val&1)>0; if (val & 1) { if(pit[latch].cntr>=9999) pit[latch].cntr=9999; @@ -309,6 +318,8 @@ static void write_p43(Bitu /*port*/,Bitu val,Bitu /*iolen*/) { pit[latch].counterstatus_set=false; latched_timerstatus_locked=false; } + pit[latch].start = PIC_FullIndex(); // for undocumented newmode + pit[latch].go_read_latch = true; pit[latch].update_count = false; pit[latch].counting = false; pit[latch].read_state = (val >> 4) & 0x03; @@ -317,9 +328,7 @@ static void write_p43(Bitu /*port*/,Bitu val,Bitu /*iolen*/) { if (mode > 5) mode -= 4; //6,7 become 2 and 3 - /* Don't set it directly so counter_output uses the old mode */ - /* That's theory. It breaks panic. So set it here again */ - if(!pit[latch].mode) pit[latch].mode = mode; + pit[latch].mode = mode; /* If the line goes from low to up => generate irq. * ( BUT needs to stay up until acknowlegded by the cpu!!! therefore: ) @@ -327,20 +336,17 @@ static void write_p43(Bitu /*port*/,Bitu val,Bitu /*iolen*/) { * Mode 0 starts with a low line. (so always disable irq) * Mode 2,3 start with a high line. * counter_output tells if the current counter is high or low - * So actually a mode 2 timer enables and disables irq al the time. (not handled) */ + * So actually a mode 3 timer enables and disables irq al the time. (not handled) */ if (latch == 0) { PIC_RemoveEvents(PIT0_Event); - if (!counter_output(0) && mode) { + if((mode != 0)&& !old_output) { PIC_ActivateIRQ(0); - //Don't raise instantaniously. (Origamo) - if(CPU_Cycles < 25) CPU_Cycles = 25; - } - if(!mode) + } else { PIC_DeActivateIRQ(0); + } } pit[latch].new_mode = true; - pit[latch].mode = mode; //Set the correct mode (here) } break; case 3: diff --git a/src/hardware/vga.cpp b/src/hardware/vga.cpp index df74704..1169179 100644 --- a/src/hardware/vga.cpp +++ b/src/hardware/vga.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: vga.cpp,v 1.36 2009-05-27 09:15:41 qbix79 Exp $ */ #include "dosbox.h" //#include "setup.h" diff --git a/src/hardware/vga_attr.cpp b/src/hardware/vga_attr.cpp index 8b40d22..a9a9cda 100644 --- a/src/hardware/vga_attr.cpp +++ b/src/hardware/vga_attr.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: vga_attr.cpp,v 1.31 2009-06-28 14:56:13 c2woody Exp $ */ #include "dosbox.h" #include "inout.h" diff --git a/src/hardware/vga_crtc.cpp b/src/hardware/vga_crtc.cpp index ccd5ced..00a86f4 100644 --- a/src/hardware/vga_crtc.cpp +++ b/src/hardware/vga_crtc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: vga_crtc.cpp,v 1.34 2009-03-18 18:08:16 c2woody Exp $ */ #include #include "dosbox.h" diff --git a/src/hardware/vga_dac.cpp b/src/hardware/vga_dac.cpp index d745e44..eb7b372 100644 --- a/src/hardware/vga_dac.cpp +++ b/src/hardware/vga_dac.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/hardware/vga_draw.cpp b/src/hardware/vga_draw.cpp index 9515f01..c63b843 100644 --- a/src/hardware/vga_draw.cpp +++ b/src/hardware/vga_draw.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: vga_draw.cpp,v 1.112 2009-11-03 21:06:59 h-a-l-9000 Exp $ */ #include #include diff --git a/src/hardware/vga_gfx.cpp b/src/hardware/vga_gfx.cpp index 742f8a4..9e2f26d 100644 --- a/src/hardware/vga_gfx.cpp +++ b/src/hardware/vga_gfx.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: vga_gfx.cpp,v 1.19 2009-05-27 09:15:41 qbix79 Exp $ */ #include "dosbox.h" #include "inout.h" diff --git a/src/hardware/vga_memory.cpp b/src/hardware/vga_memory.cpp index a051b34..67adbd1 100644 --- a/src/hardware/vga_memory.cpp +++ b/src/hardware/vga_memory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: vga_memory.cpp,v 1.53 2009-07-04 21:23:35 qbix79 Exp $ */ #include #include @@ -161,19 +160,19 @@ public: addr = PAGING_GetPhysicalAddress(addr) & vgapages.mask; addr += vga.svga.bank_read_full; addr = CHECKED2(addr); - return - (readHandler(addr+0) << 0) | - (readHandler(addr+1) << 8); + Bitu ret = (readHandler(addr+0) << 0); + ret |= (readHandler(addr+1) << 8); + return ret; } Bitu readd(PhysPt addr) { addr = PAGING_GetPhysicalAddress(addr) & vgapages.mask; addr += vga.svga.bank_read_full; addr = CHECKED2(addr); - return - (readHandler(addr+0) << 0) | - (readHandler(addr+1) << 8) | - (readHandler(addr+2) << 16) | - (readHandler(addr+3) << 24); + Bitu ret = (readHandler(addr+0) << 0); + ret |= (readHandler(addr+1) << 8); + ret |= (readHandler(addr+2) << 16); + ret |= (readHandler(addr+3) << 24); + return ret; } }; @@ -247,19 +246,19 @@ public: addr = PAGING_GetPhysicalAddress(addr) & vgapages.mask; addr += vga.svga.bank_read_full; addr = CHECKED(addr); - return - (readHandler(addr+0) << 0) | - (readHandler(addr+1) << 8); + Bitu ret = (readHandler(addr+0) << 0); + ret |= (readHandler(addr+1) << 8); + return ret; } Bitu readd(PhysPt addr) { addr = PAGING_GetPhysicalAddress(addr) & vgapages.mask; addr += vga.svga.bank_read_full; addr = CHECKED(addr); - return - (readHandler(addr+0) << 0) | - (readHandler(addr+1) << 8) | - (readHandler(addr+2) << 16) | - (readHandler(addr+3) << 24); + Bitu ret = (readHandler(addr+0) << 0); + ret |= (readHandler(addr+1) << 8); + ret |= (readHandler(addr+2) << 16); + ret |= (readHandler(addr+3) << 24); + return ret; } }; @@ -356,24 +355,24 @@ public: addr = PAGING_GetPhysicalAddress(addr) & vgapages.mask; addr += vga.svga.bank_read_full; addr = CHECKED(addr); - if (GCC_UNLIKELY(addr & 1)) - return - (readHandler( addr+0 ) << 0 ) | - (readHandler( addr+1 ) << 8 ); - else + if (GCC_UNLIKELY(addr & 1)) { + Bitu ret = (readHandler( addr+0 ) << 0 ); + ret |= (readHandler( addr+1 ) << 8 ); + return ret; + } else return readHandler( addr ); } Bitu readd(PhysPt addr ) { addr = PAGING_GetPhysicalAddress(addr) & vgapages.mask; addr += vga.svga.bank_read_full; addr = CHECKED(addr); - if (GCC_UNLIKELY(addr & 3)) - return - (readHandler( addr+0 ) << 0 ) | - (readHandler( addr+1 ) << 8 ) | - (readHandler( addr+2 ) << 16 ) | - (readHandler( addr+3 ) << 24 ); - else + if (GCC_UNLIKELY(addr & 3)) { + Bitu ret = (readHandler( addr+0 ) << 0 ); + ret |= (readHandler( addr+1 ) << 8 ); + ret |= (readHandler( addr+2 ) << 16 ); + ret |= (readHandler( addr+3 ) << 24 ); + return ret; + } else return readHandler( addr ); } void writeb(PhysPt addr, Bitu val ) { @@ -466,12 +465,29 @@ public: } Bitu readb(PhysPt addr) { addr = PAGING_GetPhysicalAddress(addr) & vgapages.mask; - return vga.draw.font[addr]; + switch(vga.gfx.read_map_select) { + case 0: // character index + return vga.mem.linear[CHECKED3(vga.svga.bank_read_full+addr)]; + case 1: // character attribute + return vga.mem.linear[CHECKED3(vga.svga.bank_read_full+addr+1)]; + case 2: // font map + return vga.draw.font[addr]; + default: // 3=unused, but still RAM that could save values + return 0; + } } void writeb(PhysPt addr,Bitu val){ addr = PAGING_GetPhysicalAddress(addr) & vgapages.mask; - if (vga.seq.map_mask & 0x4) { + + if (GCC_LIKELY(vga.seq.map_mask == 0x4)) { vga.draw.font[addr]=(Bit8u)val; + } else { + if (vga.seq.map_mask & 0x4) // font map + vga.draw.font[addr]=(Bit8u)val; + if (vga.seq.map_mask & 0x2) // character attribute + vga.mem.linear[CHECKED3(vga.svga.bank_read_full+addr+1)]=(Bit8u)val; + if (vga.seq.map_mask & 0x1) // character index + vga.mem.linear[CHECKED3(vga.svga.bank_read_full+addr)]=(Bit8u)val; } } }; @@ -572,18 +588,18 @@ public: Bitu readw(PhysPt addr) { addr = vga.svga.bank_read_full + (PAGING_GetPhysicalAddress(addr) & 0xffff); addr = CHECKED4(addr); - return - (readHandler(addr+0) << 0) | - (readHandler(addr+1) << 8); + Bitu ret = (readHandler(addr+0) << 0); + ret |= (readHandler(addr+1) << 8); + return ret; } Bitu readd(PhysPt addr) { addr = vga.svga.bank_read_full + (PAGING_GetPhysicalAddress(addr) & 0xffff); addr = CHECKED4(addr); - return - (readHandler(addr+0) << 0) | - (readHandler(addr+1) << 8) | - (readHandler(addr+2) << 16) | - (readHandler(addr+3) << 24); + Bitu ret = (readHandler(addr+0) << 0); + ret |= (readHandler(addr+1) << 8); + ret |= (readHandler(addr+2) << 16); + ret |= (readHandler(addr+3) << 24); + return ret; } }; diff --git a/src/hardware/vga_misc.cpp b/src/hardware/vga_misc.cpp index 2b01a6b..8255de6 100644 --- a/src/hardware/vga_misc.cpp +++ b/src/hardware/vga_misc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: vga_misc.cpp,v 1.39 2009-01-25 12:00:49 c2woody Exp $ */ #include "dosbox.h" #include "inout.h" diff --git a/src/hardware/vga_other.cpp b/src/hardware/vga_other.cpp index 5110b4b..a5b3856 100644 --- a/src/hardware/vga_other.cpp +++ b/src/hardware/vga_other.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: vga_other.cpp,v 1.28 2009-07-11 10:25:24 c2woody Exp $ */ #include #include diff --git a/src/hardware/vga_paradise.cpp b/src/hardware/vga_paradise.cpp index 57666c7..ae53c98 100644 --- a/src/hardware/vga_paradise.cpp +++ b/src/hardware/vga_paradise.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: vga_paradise.cpp,v 1.4 2009-05-27 09:15:41 qbix79 Exp $ */ #include "dosbox.h" #include "setup.h" diff --git a/src/hardware/vga_s3.cpp b/src/hardware/vga_s3.cpp index 4b69867..63eddbd 100644 --- a/src/hardware/vga_s3.cpp +++ b/src/hardware/vga_s3.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: vga_s3.cpp,v 1.18 2009-03-15 11:28:35 c2woody Exp $ */ #include "dosbox.h" #include "inout.h" diff --git a/src/hardware/vga_seq.cpp b/src/hardware/vga_seq.cpp index 7bd3469..ab5e31a 100644 --- a/src/hardware/vga_seq.cpp +++ b/src/hardware/vga_seq.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: vga_seq.cpp,v 1.24 2009-05-27 09:15:41 qbix79 Exp $ */ #include "dosbox.h" #include "inout.h" diff --git a/src/hardware/vga_tseng.cpp b/src/hardware/vga_tseng.cpp index 7db80bc..9edcc83 100644 --- a/src/hardware/vga_tseng.cpp +++ b/src/hardware/vga_tseng.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: vga_tseng.cpp,v 1.5 2009-05-27 09:15:41 qbix79 Exp $ */ #include "dosbox.h" diff --git a/src/hardware/vga_xga.cpp b/src/hardware/vga_xga.cpp index 77fe25a..13cba4d 100644 --- a/src/hardware/vga_xga.cpp +++ b/src/hardware/vga_xga.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: vga_xga.cpp,v 1.17 2009-05-27 09:15:41 qbix79 Exp $ */ #include #include "dosbox.h" diff --git a/src/ints/bios.cpp b/src/ints/bios.cpp index a3abe8f..22219d5 100644 --- a/src/ints/bios.cpp +++ b/src/ints/bios.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: bios.cpp,v 1.78 2009-10-10 13:26:46 h-a-l-9000 Exp $ */ #include "dosbox.h" #include "mem.h" @@ -27,10 +26,17 @@ #include "inout.h" #include "pic.h" #include "hardware.h" +#include "pci_bus.h" #include "joystick.h" #include "mouse.h" #include "setup.h" #include "serialport.h" +#include +#include + +#ifdef HW_RVL +#include +#endif /* if mem_systems 0 then size_extended is reported as the real size else @@ -312,7 +318,8 @@ static Bitu INT1A_Handler(void) { case 0x00: /* Get System time */ { Bit32u ticks=mem_readd(BIOS_TIMER); - reg_al=0; /* Midnight never passes :) */ + reg_al=mem_readb(BIOS_24_HOURS_FLAG); + mem_writeb(BIOS_24_HOURS_FLAG,0); // reset the "flag" reg_cx=(Bit16u)(ticks >> 16); reg_dx=(Bit16u)(ticks & 0xffff); break; @@ -352,8 +359,120 @@ static Bitu INT1A_Handler(void) { TandyDAC_Handler(reg_ah); break; case 0xb1: /* PCI Bios Calls */ - LOG(LOG_BIOS,LOG_ERROR)("INT1A:PCI bios call %2X",reg_al); + LOG(LOG_BIOS,LOG_WARN)("INT1A:PCI bios call %2X",reg_al); +#if defined(PCI_FUNCTIONALITY_ENABLED) + switch (reg_al) { + case 0x01: // installation check + if (PCI_IsInitialized()) { + reg_ah=0x00; + reg_al=0x01; // cfg space mechanism 1 supported + reg_bx=0x0210; // ver 2.10 + reg_cx=0x0000; // only one PCI bus + reg_edx=0x20494350; + reg_edi=PCI_GetPModeInterface(); + CALLBACK_SCF(false); + } else { + CALLBACK_SCF(true); + } + break; + case 0x02: { // find device + Bitu devnr=0; + Bitu count=0x100; + Bit32u devicetag=(reg_cx<<16)|reg_dx; + Bits found=-1; + for (Bitu i=0; i<=count; i++) { + IO_WriteD(0xcf8,0x80000000|(i<<8)); // query unique device/subdevice entries + if (IO_ReadD(0xcfc)==devicetag) { + if (devnr==reg_si) { + found=i; + break; + } else { + // device found, but not the SIth device + devnr++; + } + } + } + if (found>=0) { + reg_ah=0x00; + reg_bh=0x00; // bus 0 + reg_bl=(Bit8u)(found&0xff); + CALLBACK_SCF(false); + } else { + reg_ah=0x86; // device not found + CALLBACK_SCF(true); + } + } + break; + case 0x03: { // find device by class code + Bitu devnr=0; + Bitu count=0x100; + Bit32u classtag=reg_ecx&0xffffff; + Bits found=-1; + for (Bitu i=0; i<=count; i++) { + IO_WriteD(0xcf8,0x80000000|(i<<8)); // query unique device/subdevice entries + if (IO_ReadD(0xcfc)!=0xffffffff) { + IO_WriteD(0xcf8,0x80000000|(i<<8)|0x08); + if ((IO_ReadD(0xcfc)>>8)==classtag) { + if (devnr==reg_si) { + found=i; + break; + } else { + // device found, but not the SIth device + devnr++; + } + } + } + } + if (found>=0) { + reg_ah=0x00; + reg_bh=0x00; // bus 0 + reg_bl=(Bit8u)(found&0xff); + CALLBACK_SCF(false); + } else { + reg_ah=0x86; // device not found + CALLBACK_SCF(true); + } + } + break; + case 0x08: // read configuration byte + IO_WriteD(0xcf8,0x80000000|(reg_bx<<8)|(reg_di&0xfc)); + reg_cl=IO_ReadB(0xcfc+(reg_di&3)); + CALLBACK_SCF(false); + break; + case 0x09: // read configuration word + IO_WriteD(0xcf8,0x80000000|(reg_bx<<8)|(reg_di&0xfc)); + reg_cx=IO_ReadW(0xcfc+(reg_di&2)); + CALLBACK_SCF(false); + break; + case 0x0a: // read configuration dword + IO_WriteD(0xcf8,0x80000000|(reg_bx<<8)|(reg_di&0xfc)); + reg_ecx=IO_ReadD(0xcfc+(reg_di&3)); + CALLBACK_SCF(false); + break; + case 0x0b: // write configuration byte + IO_WriteD(0xcf8,0x80000000|(reg_bx<<8)|(reg_di&0xfc)); + IO_WriteB(0xcfc+(reg_di&3),reg_cl); + CALLBACK_SCF(false); + break; + case 0x0c: // write configuration word + IO_WriteD(0xcf8,0x80000000|(reg_bx<<8)|(reg_di&0xfc)); + IO_WriteW(0xcfc+(reg_di&2),reg_cx); + CALLBACK_SCF(false); + break; + case 0x0d: // write configuration dword + IO_WriteD(0xcf8,0x80000000|(reg_bx<<8)|(reg_di&0xfc)); + IO_WriteD(0xcfc+(reg_di&3),reg_ecx); + CALLBACK_SCF(false); + break; + default: + LOG(LOG_BIOS,LOG_ERROR)("INT1A:PCI BIOS: unknown function %x (%x %x %x)", + reg_ax,reg_bx,reg_cx,reg_dx); + CALLBACK_SCF(true); + break; + } +#else CALLBACK_SCF(true); +#endif break; default: LOG(LOG_BIOS,LOG_ERROR)("INT1A:Undefined call %2X",reg_ah); @@ -372,9 +491,64 @@ static Bitu INT11_Handler(void) { #ifndef DOSBOX_CLOCKSYNC #define DOSBOX_CLOCKSYNC 0 #endif + +static void BIOS_HostTimeSync() { + /* Setup time and date */ +#ifdef HW_RVL + time_t rawtime; + time(&rawtime); + + struct tm *loctime; + loctime = localtime (&rawtime); + int millitm = ticks_to_millisecs(gettime()) & 999; + + dos.date.day=(Bit8u)loctime->tm_mday; + dos.date.month=(Bit8u)loctime->tm_mon+1; + dos.date.year=(Bit16u)loctime->tm_year+1900; + + Bit32u ticks=(Bit32u)(((double)( + loctime->tm_hour*3600*1000+ + loctime->tm_min*60*1000+ + loctime->tm_sec*1000+ + millitm))*(((double)PIT_TICK_RATE/65536.0)/1000.0)); +#else + struct timeb timebuffer; + ftime(&timebuffer); + + struct tm *loctime; + loctime = localtime (&timebuffer.time); + + /* + loctime->tm_hour = 23; + loctime->tm_min = 59; + loctime->tm_sec = 45; + loctime->tm_mday = 28; + loctime->tm_mon = 2-1; + loctime->tm_year = 2007 - 1900; + */ + + dos.date.day=(Bit8u)loctime->tm_mday; + dos.date.month=(Bit8u)loctime->tm_mon+1; + dos.date.year=(Bit16u)loctime->tm_year+1900; + + Bit32u ticks=(Bit32u)(((double)( + loctime->tm_hour*3600*1000+ + loctime->tm_min*60*1000+ + loctime->tm_sec*1000+ + timebuffer.millitm))*(((double)PIT_TICK_RATE/65536.0)/1000.0)); +#endif + mem_writed(BIOS_TIMER,ticks); +} + static Bitu INT8_Handler(void) { /* Increase the bios tick counter */ Bit32u value = mem_readd(BIOS_TIMER) + 1; + if(value >= 0x1800B0) { + // time wrap at midnight + mem_writeb(BIOS_24_HOURS_FLAG,mem_readb(BIOS_24_HOURS_FLAG)+1); + value=0; + } + #if DOSBOX_CLOCKSYNC static bool check = false; if((value %50)==0) { @@ -907,14 +1081,29 @@ public: callback[9].Set_RealVec(0x71); /* Reboot */ + // This handler is an exit for more than only reboots, since we + // don't handle these cases callback[10].Install(&Reboot_Handler,CB_IRET,"reboot"); + + // INT 18h: Enter BASIC + // Non-IBM BIOS would display "NO ROM BASIC" here callback[10].Set_RealVec(0x18); RealPt rptr = callback[10].Get_RealPointer(); + + // INT 19h: Boot function + // This is not a complete reboot as it happens after the POST + // We don't handle it, so use the reboot function as exit. RealSetVec(0x19,rptr); - // set system BIOS entry point too - phys_writeb(0xFFFF0,0xEA); // FARJMP - phys_writew(0xFFFF1,RealOff(rptr)); // offset - phys_writew(0xFFFF3,RealSeg(rptr)); // segment + + // The farjump at the processor reset entry point (jumps to POST routine) + phys_writeb(0xFFFF0,0xEA); // FARJMP + phys_writew(0xFFFF1,RealOff(BIOS_DEFAULT_RESET_LOCATION)); // offset + phys_writew(0xFFFF3,RealSeg(BIOS_DEFAULT_RESET_LOCATION)); // segment + + // Compatible POST routine location: jump to the callback + phys_writeb(Real2Phys(BIOS_DEFAULT_RESET_LOCATION)+0,0xEA); // FARJMP + phys_writew(Real2Phys(BIOS_DEFAULT_RESET_LOCATION)+1,RealOff(rptr)); // offset + phys_writew(Real2Phys(BIOS_DEFAULT_RESET_LOCATION)+3,RealSeg(rptr)); // segment /* Irq 2 */ Bitu call_irq2=CALLBACK_Allocate(); @@ -1076,6 +1265,7 @@ public: size_extended=IO_Read(0x71); IO_Write(0x70,0x31); size_extended|=(IO_Read(0x71) << 8); + BIOS_HostTimeSync(); } ~BIOS(){ /* abort DAC playing */ diff --git a/src/ints/bios_disk.cpp b/src/ints/bios_disk.cpp index fcf6328..a298256 100644 --- a/src/ints/bios_disk.cpp +++ b/src/ints/bios_disk.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: bios_disk.cpp,v 1.40 2009-08-23 17:24:54 c2woody Exp $ */ #include "dosbox.h" #include "callback.h" @@ -150,8 +149,9 @@ Bit8u imageDisk::Read_AbsoluteSector(Bit32u sectnum, void * data) { bytenum = sectnum * sector_size; - fseek(diskimg,bytenum,SEEK_SET); - fread(data, 1, sector_size, diskimg); + if (bytenum!=current_fpos) fseek(diskimg,bytenum,SEEK_SET); + size_t ret=fread(data, 1, sector_size, diskimg); + current_fpos=bytenum+ret; return 0x00; } @@ -162,7 +162,6 @@ Bit8u imageDisk::Write_Sector(Bit32u head,Bit32u cylinder,Bit32u sector,void * d sectnum = ( (cylinder * heads + head) * sectors ) + sector - 1L; return Write_AbsoluteSector(sectnum, data); - } @@ -173,8 +172,9 @@ Bit8u imageDisk::Write_AbsoluteSector(Bit32u sectnum, void *data) { //LOG_MSG("Writing sectors to %ld at bytenum %d", sectnum, bytenum); - fseek(diskimg,bytenum,SEEK_SET); + if (bytenum!=current_fpos) fseek(diskimg,bytenum,SEEK_SET); size_t ret=fwrite(data, sector_size, 1, diskimg); + current_fpos=bytenum+ret; return ((ret>0)?0x00:0x05); @@ -185,7 +185,9 @@ imageDisk::imageDisk(FILE *imgFile, Bit8u *imgName, Bit32u imgSizeK, bool isHard cylinders = 0; sectors = 0; sector_size = 512; + current_fpos = 0; diskimg = imgFile; + fseek(diskimg,0,SEEK_SET); memset(diskname,0,512); if(strlen((const char *)imgName) > 511) { diff --git a/src/ints/bios_keyboard.cpp b/src/ints/bios_keyboard.cpp index 8821efb..146668e 100644 --- a/src/ints/bios_keyboard.cpp +++ b/src/ints/bios_keyboard.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: bios_keyboard.cpp,v 1.36 2009-06-11 16:05:17 c2woody Exp $ */ #include "dosbox.h" #include "callback.h" @@ -33,6 +32,8 @@ * Define the following if this is the case */ #if SDL_VERSION_ATLEAST(1, 2, 14) #define CAN_USE_LOCK 1 +/* For lower versions of SDL we also use a slight hack to get the startup states of numclock and capslock right. + * The proper way is in the mapper, but the repeating key is an unwanted side effect for lower versions of SDL */ #endif static Bitu call_int16,call_irq1,call_irq6; @@ -564,8 +565,10 @@ static Bitu INT16_Handler(void) { else reg_al=1; break; case 0x12: /* GET EXTENDED SHIFT STATES */ - reg_al=mem_readb(BIOS_KEYBOARD_FLAGS1); - reg_ah=mem_readb(BIOS_KEYBOARD_FLAGS2); + reg_al = mem_readb(BIOS_KEYBOARD_FLAGS1); + reg_ah = (mem_readb(BIOS_KEYBOARD_FLAGS2)&0x73) | + ((mem_readb(BIOS_KEYBOARD_FLAGS2)&4)<<5) | // SysReq pressed, bit 7 + (mem_readb(BIOS_KEYBOARD_FLAGS3)&0x0c); // Right Ctrl/Alt pressed, bits 2,3 break; case 0x55: /* Weird call used by some dos apps */ @@ -592,9 +595,14 @@ static void InitBiosSegment(void) { mem_writew(BIOS_KEYBOARD_BUFFER_TAIL,0x1e); Bit8u flag1 = 0; Bit8u leds = 16; /* Ack recieved */ -//MAPPER_Init takes care of this now ? -// if(startup_state_capslock) { flag1|=0x40; leds|=0x04;} -// if(startup_state_numlock){ flag1|=0x20; leds|=0x02;} + +#if SDL_VERSION_ATLEAST(1, 2, 14) +//Nothing, mapper handles all. +#else + if (startup_state_capslock) { flag1|=0x40; leds|=0x04;} + if (startup_state_numlock) { flag1|=0x20; leds|=0x02;} +#endif + mem_writeb(BIOS_KEYBOARD_FLAGS1,flag1); mem_writeb(BIOS_KEYBOARD_FLAGS2,0); mem_writeb(BIOS_KEYBOARD_FLAGS3,16); /* Enhanced keyboard installed */ diff --git a/src/ints/ems.cpp b/src/ints/ems.cpp index be34d7d..fc43193 100644 --- a/src/ints/ems.cpp +++ b/src/ints/ems.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: ems.cpp,v 1.65 2009-10-11 17:11:52 c2woody Exp $ */ #include #include diff --git a/src/ints/int10.cpp b/src/ints/int10.cpp index d663858..f60f3a2 100644 --- a/src/ints/int10.cpp +++ b/src/ints/int10.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: int10.cpp,v 1.56 2009-09-06 19:25:34 c2woody Exp $ */ #include "dosbox.h" #include "mem.h" diff --git a/src/ints/int10.h b/src/ints/int10.h index f25f49d..d07451a 100644 --- a/src/ints/int10.h +++ b/src/ints/int10.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: int10.h,v 1.42 2009-09-06 19:25:34 c2woody Exp $ */ #include "vga.h" diff --git a/src/ints/int10_char.cpp b/src/ints/int10_char.cpp index 53c0ed4..a8de2b4 100644 --- a/src/ints/int10_char.cpp +++ b/src/ints/int10_char.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: int10_char.cpp,v 1.60 2009-10-15 20:36:56 c2woody Exp $ */ /* Character displaying moving functions */ diff --git a/src/ints/int10_memory.cpp b/src/ints/int10_memory.cpp index 372afe4..efe3d3f 100644 --- a/src/ints/int10_memory.cpp +++ b/src/ints/int10_memory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: int10_memory.cpp,v 1.30 2009-09-06 19:25:34 c2woody Exp $ */ #include "dosbox.h" #include "mem.h" diff --git a/src/ints/int10_misc.cpp b/src/ints/int10_misc.cpp index a665fbb..d6cdc29 100644 --- a/src/ints/int10_misc.cpp +++ b/src/ints/int10_misc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: int10_misc.cpp,v 1.21 2009-05-27 09:15:42 qbix79 Exp $ */ #include "dosbox.h" #include "mem.h" diff --git a/src/ints/int10_modes.cpp b/src/ints/int10_modes.cpp index b19d455..2b34483 100644 --- a/src/ints/int10_modes.cpp +++ b/src/ints/int10_modes.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: int10_modes.cpp,v 1.91 2009-10-19 16:00:22 h-a-l-9000 Exp $ */ #include @@ -54,8 +53,8 @@ VideoModeBlock ModeList_VGA[]={ { 0x012 ,M_EGA ,640 ,480 ,80 ,30 ,8 ,16 ,1 ,0xA0000 ,0xA000 ,100 ,525 ,80 ,480 ,0 }, { 0x013 ,M_VGA ,320 ,200 ,40 ,25 ,8 ,8 ,1 ,0xA0000 ,0x2000 ,100 ,449 ,80 ,400 ,0 }, -{ 0x054 ,M_TEXT ,1056,688, 132,43, 8, 16, 1 ,0xB8000 ,0x4000, 192, 800, 132,688, 0 }, -{ 0x055 ,M_TEXT ,1056,400, 132,25, 8, 16, 1 ,0xB8000 ,0x2000, 192, 449, 132,400, 0 }, +{ 0x054 ,M_TEXT ,1056,344, 132,43, 8, 8, 1 ,0xB8000 ,0x4000, 160, 449, 132,344, 0 }, +{ 0x055 ,M_TEXT ,1056,400, 132,25, 8, 16, 1 ,0xB8000 ,0x2000, 160, 449, 132,400, 0 }, /* Alias of mode 101 */ { 0x069 ,M_LIN8 ,640 ,480 ,80 ,30 ,8 ,16 ,1 ,0xA0000 ,0x10000,100 ,525 ,80 ,480 ,0 }, @@ -72,6 +71,14 @@ VideoModeBlock ModeList_VGA[]={ { 0x106 ,M_LIN4 ,1280,1024,160,64 ,8 ,16 ,1 ,0xA0000 ,0x10000,212 ,1066,160,1024,0 }, { 0x107 ,M_LIN8 ,1280,1024,160,64 ,8 ,16 ,1 ,0xA0000 ,0x10000,212 ,1066,160,1024,0 }, +/* VESA text modes */ +{ 0x108 ,M_TEXT ,640 ,480, 80,60, 8, 8 ,2 ,0xB8000 ,0x4000, 100 ,525 ,80 ,480 ,0 }, +{ 0x109 ,M_TEXT ,1056,400, 132,25, 8, 16, 1 ,0xB8000 ,0x2000, 160, 449, 132,400, 0 }, +{ 0x10A ,M_TEXT ,1056,688, 132,43, 8, 8, 1 ,0xB8000 ,0x4000, 160, 449, 132,344, 0 }, +{ 0x10B ,M_TEXT ,1056,400, 132,50, 8, 8, 1 ,0xB8000 ,0x4000, 160, 449, 132,400, 0 }, +{ 0x10C ,M_TEXT ,1056,480, 132,60, 8, 8, 2 ,0xB8000 ,0x4000, 160, 531, 132,480, 0 }, + +/* VESA higher color modes */ { 0x10D ,M_LIN15 ,320 ,200 ,40 ,25 ,8 ,8 ,1 ,0xA0000 ,0x10000,100 ,449 ,80 ,400 , _VGA_PIXEL_DOUBLE | _EGA_LINE_DOUBLE }, { 0x10E ,M_LIN16 ,320 ,200 ,40 ,25 ,8 ,8 ,1 ,0xA0000 ,0x10000,100 ,449 ,80 ,400 , _VGA_PIXEL_DOUBLE | _EGA_LINE_DOUBLE }, { 0x10F ,M_LIN32 ,320 ,200 ,40 ,25 ,8 ,8 ,1 ,0xA0000 ,0x10000,50 ,449 ,40 ,400 , _VGA_PIXEL_DOUBLE | _EGA_LINE_DOUBLE }, @@ -81,10 +88,10 @@ VideoModeBlock ModeList_VGA[]={ { 0x113 ,M_LIN15 ,800 ,600 ,100,37 ,8 ,16 ,1 ,0xA0000 ,0x10000,264 ,628 ,200,600 ,0 }, { 0x114 ,M_LIN16 ,800 ,600 ,100,37 ,8 ,16 ,1 ,0xA0000 ,0x10000,264 ,628 ,200,600 ,0 }, { 0x115 ,M_LIN32 ,800 ,600 ,100,37 ,8 ,16 ,1 ,0xA0000 ,0x10000,132 ,628 ,100,600 ,0 }, - { 0x116 ,M_LIN15 ,1024,768 ,128,48 ,8 ,16 ,1 ,0xA0000 ,0x10000,336 ,806 ,256,768 ,0 }, { 0x117 ,M_LIN16 ,1024,768 ,128,48 ,8 ,16 ,1 ,0xA0000 ,0x10000,336 ,806 ,256,768 ,0 }, { 0x118 ,M_LIN32 ,1024,768 ,128,48 ,8 ,16 ,1 ,0xA0000 ,0x10000,168 ,806 ,128,768 ,0 }, + /* those should be interlaced but ok */ //{ 0x119 ,M_LIN15 ,1280,1024,160,64 ,8 ,16 ,1 ,0xA0000 ,0x10000,424 ,1066,320,1024,0 }, //{ 0x11A ,M_LIN16 ,1280,1024,160,64 ,8 ,16 ,1 ,0xA0000 ,0x10000,424 ,1066,320,1024,0 }, diff --git a/src/ints/int10_pal.cpp b/src/ints/int10_pal.cpp index be51bac..eb26ed0 100644 --- a/src/ints/int10_pal.cpp +++ b/src/ints/int10_pal.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/ints/int10_put_pixel.cpp b/src/ints/int10_put_pixel.cpp index 0da5cfd..0bf637d 100644 --- a/src/ints/int10_put_pixel.cpp +++ b/src/ints/int10_put_pixel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: int10_put_pixel.cpp,v 1.23 2009-05-27 09:15:42 qbix79 Exp $ */ #include "dosbox.h" #include "mem.h" diff --git a/src/ints/int10_vesa.cpp b/src/ints/int10_vesa.cpp index cdf7501..a669d46 100644 --- a/src/ints/int10_vesa.cpp +++ b/src/ints/int10_vesa.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: int10_vesa.cpp,v 1.40 2009-07-31 15:36:01 c2woody Exp $ */ #include #include @@ -29,6 +28,13 @@ #include "int10.h" #include "dos_inc.h" +#define VESA_SUCCESS 0x00 +#define VESA_FAIL 0x01 +#define VESA_HW_UNSUPPORTED 0x02 +#define VESA_MODE_UNSUPPORTED 0x03 +// internal definition to pass to the caller +#define VESA_UNIMPLEMENTED 0xFF + static struct { Bitu setwindow; Bitu pmStart; @@ -117,7 +123,7 @@ Bit8u VESA_GetSVGAInformation(Bit16u seg,Bit16u off) { mem_writed(buffer+0x0a,0x0); //Capabilities and flags mem_writed(buffer+0x0e,int10.rom.vesa_modes); //VESA Mode list mem_writew(buffer+0x12,(Bit16u)(vga.vmemsize/(64*1024))); // memory size in 64kb blocks - return 0x00; + return VESA_SUCCESS; } Bit8u VESA_GetSVGAModeInformation(Bit16u mode,Bit16u seg,Bit16u off) { @@ -136,14 +142,13 @@ Bit8u VESA_GetSVGAModeInformation(Bit16u mode,Bit16u seg,Bit16u off) { while (ModeList_VGA[i].mode!=0xffff) { if (mode==ModeList_VGA[i].mode) goto foundit; else i++; } - return 0x01; + return VESA_FAIL; foundit: if ((int10.vesa_oldvbe) && (ModeList_VGA[i].mode>=0x120)) return 0x01; VideoModeBlock * mblock=&ModeList_VGA[i]; switch (mblock->type) { case M_LIN4: pageSize = mblock->sheight * mblock->swidth/2; - pageSize = (pageSize | 15) & ~ 15; var_write(&minfo.BytesPerScanLine,mblock->swidth/8); var_write(&minfo.NumberOfPlanes,0x4); var_write(&minfo.BitsPerPixel,4); @@ -152,7 +157,6 @@ foundit: break; case M_LIN8: pageSize = mblock->sheight * mblock->swidth; - pageSize = (pageSize | 15) & ~ 15; var_write(&minfo.BytesPerScanLine,mblock->swidth); var_write(&minfo.NumberOfPlanes,0x1); var_write(&minfo.BitsPerPixel,8); @@ -162,7 +166,6 @@ foundit: break; case M_LIN15: pageSize = mblock->sheight * mblock->swidth*2; - pageSize = (pageSize | 15) & ~ 15; var_write(&minfo.BytesPerScanLine,mblock->swidth*2); var_write(&minfo.NumberOfPlanes,0x1); var_write(&minfo.BitsPerPixel,15); @@ -180,7 +183,6 @@ foundit: break; case M_LIN16: pageSize = mblock->sheight * mblock->swidth*2; - pageSize = (pageSize | 15) & ~ 15; var_write(&minfo.BytesPerScanLine,mblock->swidth*2); var_write(&minfo.NumberOfPlanes,0x1); var_write(&minfo.BitsPerPixel,16); @@ -196,7 +198,6 @@ foundit: break; case M_LIN32: pageSize = mblock->sheight * mblock->swidth*4; - pageSize = (pageSize | 15) & ~ 15; var_write(&minfo.BytesPerScanLine,mblock->swidth*4); var_write(&minfo.NumberOfPlanes,0x1); var_write(&minfo.BitsPerPixel,32); @@ -212,36 +213,40 @@ foundit: modeAttributes = 0x1b; // Color, graphics if (!int10.vesa_nolfb) modeAttributes |= 0x80; // linear framebuffer break; -/* case M_TEXT: - pageSize = mblock->sheight/8 * mblock->swidth*2/8; - pageSize = (pageSize | 15) & ~ 15; - var_write(&minfo.BytesPerScanLine,mblock->swidth*2/8); + case M_TEXT: + pageSize = 0; + var_write(&minfo.BytesPerScanLine, mblock->twidth * 2); var_write(&minfo.NumberOfPlanes,0x4); var_write(&minfo.BitsPerPixel,4); - var_write(&minfo.MemoryModel,0); //Text + var_write(&minfo.MemoryModel,0); // text modeAttributes = 0x0f; //Color, text, bios output - break; */ + break; default: - return 0x1; + return VESA_FAIL; } - var_write(&minfo.WinAAttributes,0x7); // Exists/readable/writable - - if(pageSize > vga.vmemsize) { - // Mode not supported by current hardware configuration - var_write(&minfo.ModeAttributes, modeAttributes & ~0x1); - var_write(&minfo.NumberOfImagePages,0); - } else { - var_write(&minfo.ModeAttributes, modeAttributes); - Bitu pages = (vga.vmemsize / pageSize)-1; - var_write(&minfo.NumberOfImagePages,pages); + if (pageSize & 0xFFFF) { + // It is documented that many applications assume 64k-aligned page sizes + // VBETEST is one of them + pageSize += 0x10000; + pageSize &= ~0xFFFF; } + Bitu pages = 0; + if (pageSize > vga.vmemsize) { + // mode not supported by current hardware configuration + modeAttributes &= ~0x1; + } else if (pageSize) { + pages = (vga.vmemsize / pageSize)-1; + } + var_write(&minfo.NumberOfImagePages, pages); + var_write(&minfo.ModeAttributes, modeAttributes); + var_write(&minfo.WinAAttributes, 0x7); // Exists/readable/writable if (mblock->type==M_TEXT) { var_write(&minfo.WinGranularity,32); var_write(&minfo.WinSize,32); var_write(&minfo.WinASegment,0xb800); - var_write(&minfo.XResolution,mblock->swidth/8); - var_write(&minfo.YResolution,mblock->sheight/8); + var_write(&minfo.XResolution,mblock->twidth); + var_write(&minfo.YResolution,mblock->theight); } else { var_write(&minfo.WinGranularity,64); var_write(&minfo.WinSize,64); @@ -257,46 +262,46 @@ foundit: if (!int10.vesa_nolfb) var_write(&minfo.PhysBasePtr,S3_LFB_BASE); MEM_BlockWrite(buf,&minfo,sizeof(MODE_INFO)); - return 0x00; + return VESA_SUCCESS; } Bit8u VESA_SetSVGAMode(Bit16u mode) { if (INT10_SetVideoMode(mode)) { int10.vesa_setmode=mode&0x7fff; - return 0x00; + return VESA_SUCCESS; } - return 0x01; + return VESA_FAIL; } Bit8u VESA_GetSVGAMode(Bit16u & mode) { if (int10.vesa_setmode!=0xffff) mode=int10.vesa_setmode; else mode=CurMode->mode; - return 0x00; + return VESA_SUCCESS; } Bit8u VESA_SetCPUWindow(Bit8u window,Bit8u address) { - if (window) return 0x1; + if (window) return VESA_FAIL; if (((Bit32u)(address)*64*1024255) return 0x1; - if (index+count>256) return 0x1; + if (index>255) return VESA_FAIL; + if (index+count>256) return VESA_FAIL; IO_Write(0x3c8,(Bit8u)index); while (count) { b = mem_readb(data++); @@ -308,14 +313,14 @@ Bit8u VESA_SetPalette(PhysPt data,Bitu index,Bitu count) { IO_Write(0x3c9,b); count--; } - return 0x00; + return VESA_SUCCESS; } Bit8u VESA_GetPalette(PhysPt data,Bitu index,Bitu count) { Bit8u r,g,b; - if (index>255) return 0x1; - if (index+count>256) return 0x1; + if (index>255) return VESA_FAIL; + if (index+count>256) return VESA_FAIL; IO_Write(0x3c7,(Bit8u)index); while (count) { r = IO_Read(0x3c9); @@ -327,114 +332,182 @@ Bit8u VESA_GetPalette(PhysPt data,Bitu index,Bitu count) { data++; count--; } - return 0x00; + return VESA_SUCCESS; } +// maximum offset for the S3 Trio64 is 10 bits +#define S3_MAX_OFFSET 0x3ff Bit8u VESA_ScanLineLength(Bit8u subcall,Bit16u val, Bit16u & bytes,Bit16u & pixels,Bit16u & lines) { - Bit8u bpp; + // offset register: virtual scanline length + Bitu pixels_per_offset; + Bitu bytes_per_offset = 8; + Bitu vmemsize = vga.vmemsize; + Bitu new_offset = vga.config.scan_len; + Bitu screen_height = CurMode->sheight; + switch (CurMode->type) { + case M_TEXT: + vmemsize = 0x8000; // we have only the 32kB window here + screen_height = CurMode->theight; + pixels_per_offset = 16; // two characters each 8 pixels wide + bytes_per_offset = 4; // 2 characters + 2 attributes + break; case M_LIN4: - bpp = 1; + pixels_per_offset = 16; break; case M_LIN8: - bpp=1; + pixels_per_offset = 8; break; case M_LIN15: case M_LIN16: - bpp=2; + pixels_per_offset = 4; break; case M_LIN32: - bpp=4; + pixels_per_offset = 2; break; default: - return 0x1; + return VESA_MODE_UNSUPPORTED; } switch (subcall) { - case 0x00: /* Set in pixels */ - if(CurMode->type==M_LIN4) vga.config.scan_len=val/2; - else vga.config.scan_len = (val * bpp); + case 0x00: // set scan length in pixels + new_offset = val / pixels_per_offset; + if (val % pixels_per_offset) new_offset++; + + if (new_offset > S3_MAX_OFFSET) + return VESA_HW_UNSUPPORTED; // scanline too long + vga.config.scan_len = new_offset; + VGA_CheckScanLength(); break; - case 0x02: /* Set in bytes */ - if(CurMode->type==M_LIN4) vga.config.scan_len = val*4; - else vga.config.scan_len = val; + + case 0x01: // get current scanline length + // implemented at the end of this function break; - case 0x03: /* Get maximum */ - bytes=0x400*4; - pixels=bytes/bpp; - lines = (Bit16u)(vga.vmemsize / bytes); - return 0x00; - case 0x01: /* Get lengths */ + + case 0x02: // set scan length in bytes + new_offset = val / bytes_per_offset; + if (val % bytes_per_offset) new_offset++; + + if (new_offset > S3_MAX_OFFSET) + return VESA_HW_UNSUPPORTED; // scanline too long + vga.config.scan_len = new_offset; + VGA_CheckScanLength(); break; + + case 0x03: // get maximum scan line length + // the smaller of either the hardware maximum scanline length or + // the limit to get full y resolution of this mode + new_offset = S3_MAX_OFFSET; + if ((new_offset * bytes_per_offset * screen_height) > vmemsize) + new_offset = vmemsize / (bytes_per_offset * screen_height); + break; + default: - return 0x1; //Illegal call + return VESA_UNIMPLEMENTED; } - if (subcall!=0x01) { - /* Write the scan line to video card the simple way */ - if (vga.config.scan_len & 7) - vga.config.scan_len += 8; - vga.config.scan_len /= 8; - } - if(CurMode->type==M_LIN4) { - pixels=(vga.config.scan_len*16)/bpp; - bytes=vga.config.scan_len*2; - lines = (Bit16u)(vga.vmemsize /( bytes*4)); - } - else { - pixels=(vga.config.scan_len*8)/bpp; - bytes=vga.config.scan_len*8; - lines = (Bit16u)(vga.vmemsize / bytes); - } - VGA_StartResize(); - return 0x0; + + // set up the return values + bytes = (Bit16u)(new_offset * bytes_per_offset); + pixels = (Bit16u)(new_offset * pixels_per_offset); + if (!bytes) + // return failure on division by zero + // some real VESA BIOS implementations may crash here + return VESA_FAIL; + + lines = (Bit16u)(vmemsize / bytes); + + if (CurMode->type==M_TEXT) + lines *= CurMode->cheight; + + return VESA_SUCCESS; } Bit8u VESA_SetDisplayStart(Bit16u x,Bit16u y) { - //TODO Maybe do things differently with lowres double line modes? - Bitu start; + // TODO wait for retrace in case bl==0x80 + Bitu pixels_per_offset; + Bitu panning_factor = 1; + switch (CurMode->type) { + case M_TEXT: case M_LIN4: - start=vga.config.scan_len*16*y+x; - vga.config.display_start=start/8; - IO_Read(0x3da); - IO_Write(0x3c0,0x13+32); - IO_Write(0x3c0,start % 8); + pixels_per_offset = 16; break; case M_LIN8: - start=vga.config.scan_len*8*y+x; - vga.config.display_start=start/4; - IO_Read(0x3da); - IO_Write(0x3c0,0x13+32); - IO_Write(0x3c0,(start % 4)*2); + panning_factor = 2; // the panning register ignores bit0 in this mode + pixels_per_offset = 8; break; - case M_LIN16: case M_LIN15: - start=vga.config.scan_len*8*y+x*2; - vga.config.display_start=start/4; + case M_LIN16: + panning_factor = 2; // this may be DOSBox specific + pixels_per_offset = 4; break; case M_LIN32: - start=vga.config.scan_len*8*y+x*4; - vga.config.display_start=start/4; + pixels_per_offset = 2; break; default: - return 0x1; + return VESA_MODE_UNSUPPORTED; } - return 0x00; + // We would have to divide y by the character height for text modes and + // write the remainder to the CRTC preset row scan register, + // but VBE2 BIOSes that actually get that far also don't. + // Only a VBE3 BIOS got it right. + Bitu virtual_screen_width = vga.config.scan_len * pixels_per_offset; + Bitu new_start_pixel = virtual_screen_width * y + x; + Bitu new_crtc_start = new_start_pixel / (pixels_per_offset/2); + Bitu new_panning = new_start_pixel % (pixels_per_offset/2); + new_panning *= panning_factor; + + vga.config.display_start = new_crtc_start; + + // Setting the panning register is nice as it allows for super smooth + // scrolling, but if we hit the retrace pulse there may be flicker as + // panning and display start are latched at different times. + + IO_Read(0x3da); // reset attribute flipflop + IO_Write(0x3c0,0x13 | 0x20); // panning register, screen on + IO_Write(0x3c0,new_panning); + + return VESA_SUCCESS; } Bit8u VESA_GetDisplayStart(Bit16u & x,Bit16u & y) { - Bitu times=(vga.config.display_start*4)/(vga.config.scan_len*8); - Bitu rem=(vga.config.display_start*4) % (vga.config.scan_len*8); - Bitu pan=vga.config.pel_panning; + Bitu pixels_per_offset; + Bitu panning_factor = 1; + switch (CurMode->type) { + case M_TEXT: + pixels_per_offset = 16; + break; + case M_LIN4: + pixels_per_offset = 16; + break; case M_LIN8: - y=(Bit16u)times; - x=(Bit16u)(rem+pan); + panning_factor = 2; + pixels_per_offset = 8; + break; + case M_LIN15: + case M_LIN16: + panning_factor = 2; + pixels_per_offset = 4; + break; + case M_LIN32: + pixels_per_offset = 2; break; default: - return 0x1; + return VESA_MODE_UNSUPPORTED; } - return 0x00; + + IO_Read(0x3da); // reset attribute flipflop + IO_Write(0x3c0,0x13 | 0x20); // panning register, screen on + Bit8u panning = IO_Read(0x3c1); + + Bitu virtual_screen_width = vga.config.scan_len * pixels_per_offset; + Bitu start_pixel = vga.config.display_start * (pixels_per_offset/2) + + panning / panning_factor; + + y = start_pixel / virtual_screen_width; + x = start_pixel % virtual_screen_width; + return VESA_SUCCESS; } static Bitu VESA_SetWindow(void) { @@ -453,6 +526,10 @@ static Bitu VESA_PMSetPalette(void) { return 0; } static Bitu VESA_PMSetStart(void) { + // This function is from VBE2 and directly sets the VGA + // display start address. + + // TODO wait for retrace in case bl==0x80 Bit32u start = (reg_dx << 16) | reg_cx; vga.config.display_start = start; return 0; diff --git a/src/ints/int10_video_state.cpp b/src/ints/int10_video_state.cpp index 3d20a03..6d0512f 100644 --- a/src/ints/int10_video_state.cpp +++ b/src/ints/int10_video_state.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: int10_video_state.cpp,v 1.3 2009-05-27 09:15:42 qbix79 Exp $ */ #include "dosbox.h" #include "mem.h" diff --git a/src/ints/int10_vptable.cpp b/src/ints/int10_vptable.cpp index ce25559..21fbc12 100644 --- a/src/ints/int10_vptable.cpp +++ b/src/ints/int10_vptable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: int10_vptable.cpp,v 1.6 2009-08-01 13:39:48 c2woody Exp $ */ #include "dosbox.h" #include "mem.h" diff --git a/src/ints/mouse.cpp b/src/ints/mouse.cpp index f322076..8e6f30f 100644 --- a/src/ints/mouse.cpp +++ b/src/ints/mouse.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: mouse.cpp,v 1.80 2009-06-16 19:00:26 qbix79 Exp $ */ #include #include diff --git a/src/ints/xms.cpp b/src/ints/xms.cpp index 8765294..cb11770 100644 --- a/src/ints/xms.cpp +++ b/src/ints/xms.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: xms.cpp,v 1.55 2009-05-27 09:15:42 qbix79 Exp $ */ #include #include diff --git a/src/ints/xms.h b/src/ints/xms.h index 740b5e6..c3b836d 100644 --- a/src/ints/xms.h +++ b/src/ints/xms.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/libs/gui_tk/gui_tk.cpp b/src/libs/gui_tk/gui_tk.cpp index 193efba..72c533f 100644 --- a/src/libs/gui_tk/gui_tk.cpp +++ b/src/libs/gui_tk/gui_tk.cpp @@ -20,7 +20,6 @@ /* TODO: - make menu a bufferedwindow with shadow */ -/* $Id: gui_tk.cpp,v 1.5 2009-02-01 16:06:26 qbix79 Exp $ */ /** \file * \brief Implementation file for gui_tk. diff --git a/src/libs/gui_tk/gui_tk.h b/src/libs/gui_tk/gui_tk.h index fe25a62..9299c4b 100644 --- a/src/libs/gui_tk/gui_tk.h +++ b/src/libs/gui_tk/gui_tk.h @@ -102,7 +102,6 @@ * along with this program. If not, see */ -/* $Id: gui_tk.h,v 1.6 2009-05-17 15:28:05 c2woody Exp $ */ #ifndef GUI__TOOLKIT_H #define GUI__TOOLKIT_H diff --git a/src/libs/zmbv/drvproc.cpp b/src/libs/zmbv/drvproc.cpp index 76bc15c..a24870e 100644 --- a/src/libs/zmbv/drvproc.cpp +++ b/src/libs/zmbv/drvproc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/libs/zmbv/zmbv.cpp b/src/libs/zmbv/zmbv.cpp index 6c33057..d5e69da 100644 --- a/src/libs/zmbv/zmbv.cpp +++ b/src/libs/zmbv/zmbv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/libs/zmbv/zmbv.h b/src/libs/zmbv/zmbv.h index e614cc4..860912a 100644 --- a/src/libs/zmbv/zmbv.h +++ b/src/libs/zmbv/zmbv.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/libs/zmbv/zmbv_vfw.cpp b/src/libs/zmbv/zmbv_vfw.cpp index 2f421ae..72b631b 100644 --- a/src/libs/zmbv/zmbv_vfw.cpp +++ b/src/libs/zmbv/zmbv_vfw.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/libs/zmbv/zmbv_vfw.rc b/src/libs/zmbv/zmbv_vfw.rc index 4d670d5..e98a17a 100644 --- a/src/libs/zmbv/zmbv_vfw.rc +++ b/src/libs/zmbv/zmbv_vfw.rc @@ -27,18 +27,18 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // TEXTINCLUDE // -1 TEXTINCLUDE +1 TEXTINCLUDE BEGIN "resource.h\0" END -2 TEXTINCLUDE +2 TEXTINCLUDE BEGIN "#include ""winres.h""\r\n" "\0" END -3 TEXTINCLUDE +3 TEXTINCLUDE BEGIN "\r\n" "\0" @@ -53,20 +53,20 @@ END // IDD_ABOUT DIALOGEX 0, 0, 167, 55 -STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | +STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "DOSBox Video Codec v0.1" FONT 8, "MS Sans Serif", 0, 0, 0x0 BEGIN DEFPUSHBUTTON "OK",IDOK,131,34,29,14 - CTEXT "Zipped Motion Block Video v 0.1\nCopyright 2009, DOSBox Team", + CTEXT "Zipped Motion Block Video v 0.1\nCopyright 2009-2011 DOSBox Team", IDC_STATIC,7,7,153,25,SS_NOPREFIX PUSHBUTTON "Email author",IDC_EMAIL,7,34,50,14 PUSHBUTTON "Visit home page",IDC_HOMEPAGE,59,34,58,14 END IDD_CONFIGURE DIALOGEX 0, 0, 213, 146 -STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | +STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "ZMBV configuration dialog" FONT 8, "MS Sans Serif", 0, 0, 0x0 @@ -75,7 +75,7 @@ BEGIN PUSHBUTTON "Visit home page",IDC_HOMEPAGE,109,87,58,14 DEFPUSHBUTTON "OK",IDOK,44,125,50,14 PUSHBUTTON "Cancel",IDCANCEL,117,125,50,14 - CONTROL "",IDC_SLIDER1,"msctls_trackbar32",TBS_BOTH | + CONTROL "",IDC_SLIDER1,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,57,30,92,18 END @@ -86,7 +86,7 @@ END // #ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO +GUIDELINES DESIGNINFO BEGIN IDD_ABOUT, DIALOG BEGIN diff --git a/src/misc/cross.cpp b/src/misc/cross.cpp index d7126ae..a1fdc3c 100644 --- a/src/misc/cross.cpp +++ b/src/misc/cross.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: cross.cpp,v 1.7 2009-05-26 17:43:39 qbix79 Exp $ */ #include "dosbox.h" #include "cross.h" diff --git a/src/misc/messages.cpp b/src/misc/messages.cpp index 97d0446..e843df7 100644 --- a/src/misc/messages.cpp +++ b/src/misc/messages.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: messages.cpp,v 1.23 2009-06-17 08:52:35 qbix79 Exp $ */ #include #include diff --git a/src/misc/programs.cpp b/src/misc/programs.cpp index 3417b60..da32ac4 100644 --- a/src/misc/programs.cpp +++ b/src/misc/programs.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: programs.cpp,v 1.37 2009-05-27 09:15:42 qbix79 Exp $ */ #include #include @@ -777,7 +776,7 @@ void PROGRAMS_Init(Section* /*sec*/) { "-l lists configuration parameters.\n"\ "-h, -help, -? sections / sectionname / propertyname\n"\ " Without parameters, displays this help screen. Add \"sections\" for a list of\n sections."\ - " For info about a specific section or property add it's name behind.\n"\ + " For info about a specific section or property add its name behind.\n"\ "-axclear clears the autoexec section.\n"\ "-axadd [line] adds a line to the autoexec section.\n"\ "-axtype prints the content of the autoexec section.\n"\ diff --git a/src/misc/setup.cpp b/src/misc/setup.cpp index a02c99b..5bd21e0 100644 --- a/src/misc/setup.cpp +++ b/src/misc/setup.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: setup.cpp,v 1.56 2009-05-27 09:15:42 qbix79 Exp $ */ #include "dosbox.h" #include "cross.h" diff --git a/src/misc/support.cpp b/src/misc/support.cpp index 213a049..f462076 100644 --- a/src/misc/support.cpp +++ b/src/misc/support.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: support.cpp,v 1.37 2009-05-27 09:15:42 qbix79 Exp $ */ #include #include diff --git a/src/platform/wii/menu.cpp b/src/platform/wii/menu.cpp index 7a868cf..8280089 100644 --- a/src/platform/wii/menu.cpp +++ b/src/platform/wii/menu.cpp @@ -20,7 +20,7 @@ #include "wiihardware.h" #define THREAD_SLEEP 100 -#define APPVERSION "1.5" +#define APPVERSION "1.6" static GuiImageData * pointer[4]; static GuiWindow * mainWindow = NULL; diff --git a/src/shell/shell.cpp b/src/shell/shell.cpp index 6e60596..021c58b 100644 --- a/src/shell/shell.cpp +++ b/src/shell/shell.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: shell.cpp,v 1.100 2009-07-08 20:05:41 c2woody Exp $ */ #include #include @@ -468,6 +467,23 @@ void SHELL_Init() { MSG_Add("SHELL_CMD_CHDIR_HINT","To change to different drive type \033[31m%c:\033[0m\n"); MSG_Add("SHELL_CMD_CHDIR_HINT_2","directoryname is longer than 8 characters and/or contains spaces.\nTry \033[31mcd %s\033[0m\n"); MSG_Add("SHELL_CMD_CHDIR_HINT_3","You are still on drive Z:, change to a mounted drive with \033[31mC:\033[0m.\n"); + MSG_Add("SHELL_CMD_DATE_HELP","Displays or changes the internal date.\n"); + MSG_Add("SHELL_CMD_DATE_ERROR","The specified date is not correct.\n"); + MSG_Add("SHELL_CMD_DATE_DAYS","3SunMonTueWedThuFriSat"); // "2SoMoDiMiDoFrSa" + MSG_Add("SHELL_CMD_DATE_NOW","Current date: "); + MSG_Add("SHELL_CMD_DATE_SETHLP","Type 'date MM-DD-YYYY' to change.\n"); + MSG_Add("SHELL_CMD_DATE_FORMAT","M/D/Y"); + MSG_Add("SHELL_CMD_DATE_HELP_LONG","DATE [[/T] [/H] [/S] | MM-DD-YYYY]\n"\ + " MM-DD-YYYY: new date to set\n"\ + " /S: Permanently use host time and date as DOS time\n"\ + " /F: Switch back to DOSBox internal time (opposite of /S)\n"\ + " /T: Only display date\n"\ + " /H: Synchronize with host\n"); + MSG_Add("SHELL_CMD_TIME_HELP","Displays the internal time.\n"); + MSG_Add("SHELL_CMD_TIME_NOW","Current time: "); + MSG_Add("SHELL_CMD_TIME_HELP_LONG","TIME [/T] [/H]\n"\ + " /T: Display simple time\n"\ + " /H: Synchronize with host\n"); MSG_Add("SHELL_CMD_MKDIR_ERROR","Unable to make: %s.\n"); MSG_Add("SHELL_CMD_RMDIR_ERROR","Unable to remove: %s.\n"); MSG_Add("SHELL_CMD_DEL_ERROR","Unable to delete: %s.\n"); @@ -498,7 +514,7 @@ void SHELL_Init() { "\033[44;1m========================" "========================" "======================\n" - "| \033[32mWelcome to DOSBox v%-8s\033[37m |\n" + "| \033[32mWelcome to DOSBox %-8s\033[37m |\n" "| |\n" // "| DOSBox runs real and protected mode games. |\n" "| For a short introduction for new users type: \033[33mINTRO\033[37m |\n" @@ -533,7 +549,7 @@ void SHELL_Init() { "\033[44;1m\xC9\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD" "\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD" "\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xBB\n" - "\xBA \033[32mWelcome to DOSBox v%-8s\033[37m \xBA\n" + "\xBA \033[32mWelcome to DOSBox %-8s\033[37m \xBA\n" "\xBA \xBA\n" // "\xBA DOSBox runs real and protected mode games. \xBA\n" "\xBA For a short introduction for new users type: \033[33mINTRO\033[37m \xBA\n" diff --git a/src/shell/shell_batch.cpp b/src/shell/shell_batch.cpp index 82d6e60..4078c58 100644 --- a/src/shell/shell_batch.cpp +++ b/src/shell/shell_batch.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: shell_batch.cpp,v 1.36 2009-07-03 19:36:56 qbix79 Exp $ */ #include #include diff --git a/src/shell/shell_cmds.cpp b/src/shell/shell_cmds.cpp index f347975..ab36a59 100644 --- a/src/shell/shell_cmds.cpp +++ b/src/shell/shell_cmds.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: shell_cmds.cpp,v 1.93 2009-09-21 21:04:25 h-a-l-9000 Exp $ */ #include "dosbox.h" #include "shell.h" @@ -30,6 +29,7 @@ #include #include #include +#include static SHELL_Cmd cmd_list[]={ { "DIR", 0, &DOS_Shell::CMD_DIR, "SHELL_CMD_DIR_HELP"}, @@ -40,6 +40,7 @@ static SHELL_Cmd cmd_list[]={ { "CHOICE", 1, &DOS_Shell::CMD_CHOICE, "SHELL_CMD_CHOICE_HELP"}, { "CLS", 0, &DOS_Shell::CMD_CLS, "SHELL_CMD_CLS_HELP"}, { "COPY", 0, &DOS_Shell::CMD_COPY, "SHELL_CMD_COPY_HELP"}, +{ "DATE", 0, &DOS_Shell::CMD_DATE, "SHELL_CMD_DATE_HELP"}, { "DEL", 0, &DOS_Shell::CMD_DELETE, "SHELL_CMD_DELETE_HELP"}, { "DELETE", 1, &DOS_Shell::CMD_DELETE, "SHELL_CMD_DELETE_HELP"}, { "ERASE", 1, &DOS_Shell::CMD_DELETE, "SHELL_CMD_DELETE_HELP"}, @@ -62,6 +63,7 @@ static SHELL_Cmd cmd_list[]={ { "SET", 1, &DOS_Shell::CMD_SET, "SHELL_CMD_SET_HELP"}, { "SHIFT", 1, &DOS_Shell::CMD_SHIFT, "SHELL_CMD_SHIFT_HELP"}, { "SUBST", 1, &DOS_Shell::CMD_SUBST, "SHELL_CMD_SUBST_HELP"}, +{ "TIME", 0, &DOS_Shell::CMD_TIME, "SHELL_CMD_TIME_HELP"}, { "TYPE", 0, &DOS_Shell::CMD_TYPE, "SHELL_CMD_TYPE_HELP"}, { "VER", 0, &DOS_Shell::CMD_VER, "SHELL_CMD_VER_HELP"}, {0,0,0,0} @@ -586,6 +588,14 @@ void DOS_Shell::CMD_COPY(char * args) { while ( (source_p = StripWord(args)) && *source_p ) { do { char* plus = strchr(source_p,'+'); + // If StripWord() previously cut at a space before a plus then + // set concatenate flag on last source and remove leading plus. + if (plus == source_p && sources.size()) { + sources[sources.size()-1].concat = true; + // If spaces also followed plus then item is only a plus. + if (strlen(++source_p)==0) break; + plus = strchr(source_p,'+'); + } if (plus) *plus++ = 0; safe_strncpy(source_x,source_p,CROSS_LEN); bool has_drive_spec = false; @@ -593,10 +603,10 @@ void DOS_Shell::CMD_COPY(char * args) { if (source_x_len>0) { if (source_x[source_x_len-1]==':') has_drive_spec = true; } - if (!has_drive_spec) { + if (!has_drive_spec && !strpbrk(source_p,"*?") ) { //doubt that fu*\*.* is valid if (DOS_FindFirst(source_p,0xffff & ~DOS_ATTR_VOLUME)) { dta.GetResult(name,size,date,time,attr); - if (attr & DOS_ATTR_DIRECTORY && !strstr(source_p,"*.*")) + if (attr & DOS_ATTR_DIRECTORY) strcat(source_x,"\\*.*"); } } @@ -930,6 +940,107 @@ void DOS_Shell::CMD_CALL(char * args){ this->call=false; } +void DOS_Shell::CMD_DATE(char * args) { + HELP("DATE"); + if(ScanCMDBool(args,"h")) { + // synchronize date with host parameter + time_t curtime; + struct tm *loctime; + curtime = time (NULL); + loctime = localtime (&curtime); + + reg_cx = loctime->tm_year+1900; + reg_dh = loctime->tm_mon+1; + reg_dl = loctime->tm_mday; + + reg_ah=0x2b; // set system date + CALLBACK_RunRealInt(0x21); + return; + } + // check if a date was passed in command line + Bitu newday,newmonth,newyear; + if(sscanf(args,"%u-%u-%u",&newmonth,&newday,&newyear)==3) { + reg_cx = newyear; + reg_dh = newmonth; + reg_dl = newday; + + reg_ah=0x2b; // set system date + CALLBACK_RunRealInt(0x21); + if(reg_al==0xff) WriteOut(MSG_Get("SHELL_CMD_DATE_ERROR")); + return; + } + // display the current date + reg_ah=0x2a; // get system date + CALLBACK_RunRealInt(0x21); + + const char* datestring = MSG_Get("SHELL_CMD_DATE_DAYS"); + Bit8u length; + char day[6] = {0}; + if(sscanf(datestring,"%u",&length) && (length<5) && (strlen(datestring)==(length*7+1))) { + // date string appears valid + for(int i = 0; i < length; i++) day[i] = datestring[reg_al*length+1+i]; + } + bool dateonly = ScanCMDBool(args,"t"); + if(!dateonly) WriteOut(MSG_Get("SHELL_CMD_DATE_NOW")); + + const char* formatstring = MSG_Get("SHELL_CMD_DATE_FORMAT"); + if(strlen(formatstring)!=5) return; + char buffer[15] = {0}; + Bitu bufferptr=0; + for(Bitu i = 0; i < 5; i++) { + if(i==1 || i==3) { + buffer[bufferptr] = formatstring[i]; + bufferptr++; + } else { + if(formatstring[i]=='M') bufferptr += sprintf(buffer+bufferptr,"%02u",(Bitu)reg_dh); + if(formatstring[i]=='D') bufferptr += sprintf(buffer+bufferptr,"%02u",(Bitu)reg_dl); + if(formatstring[i]=='Y') bufferptr += sprintf(buffer+bufferptr,"%04u",(Bitu)reg_cx); + } + } + WriteOut("%s %s\n",day, buffer); + if(!dateonly) WriteOut(MSG_Get("SHELL_CMD_DATE_SETHLP")); +}; + +void DOS_Shell::CMD_TIME(char * args) { + HELP("TIME"); + if(ScanCMDBool(args,"h")) { + // synchronize time with host parameter + time_t curtime; + struct tm *loctime; + curtime = time (NULL); + loctime = localtime (&curtime); + + //reg_cx = loctime->; + //reg_dh = loctime->; + //reg_dl = loctime->; + + // reg_ah=0x2d; // set system time TODO + // CALLBACK_RunRealInt(0x21); + + Bit32u ticks=(Bit32u)(((double)(loctime->tm_hour*3600+ + loctime->tm_min*60+ + loctime->tm_sec))*18.206481481); + mem_writed(BIOS_TIMER,ticks); + return; + } + bool timeonly = ScanCMDBool(args,"t"); + + reg_ah=0x2c; // get system time + CALLBACK_RunRealInt(0x21); +/* + reg_dl= // 1/100 seconds + reg_dh= // seconds + reg_cl= // minutes + reg_ch= // hours +*/ + if(timeonly) { + WriteOut("%2u:%02u\n",reg_ch,reg_cl); + } else { + WriteOut(MSG_Get("SHELL_CMD_TIME_NOW")); + WriteOut("%2u:%02u:%02u,%02u\n",reg_ch,reg_cl,reg_dh,reg_dl); + } +}; + void DOS_Shell::CMD_SUBST (char * args) { /* If more that one type can be substed think of something else * E.g. make basedir member dos_drive instead of localdrive diff --git a/src/shell/shell_misc.cpp b/src/shell/shell_misc.cpp index aee9166..dde11a3 100644 --- a/src/shell/shell_misc.cpp +++ b/src/shell/shell_misc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: shell_misc.cpp,v 1.54 2009-05-27 09:15:42 qbix79 Exp $ */ #include #include diff --git a/src/winres.rc b/src/winres.rc index a5b3c36..f8b26b0 100644 --- a/src/winres.rc +++ b/src/winres.rc @@ -19,12 +19,12 @@ BEGIN BEGIN BLOCK "040904b0" BEGIN - VALUE "Comments", "© 2002-2010 DOSBox Team, published under GNU GPL" + VALUE "Comments", "© 2002-2011 DOSBox Team, published under GNU GPL" VALUE "CompanyName", "DOSBox Team" VALUE "FileDescription", "DOSBox DOS Emulator" VALUE "FileVersion", "0, 74, 0, 0" VALUE "InternalName", "DOSBox" - VALUE "LegalCopyright", "Copyright © 2002-2010 DOSBox Team" + VALUE "LegalCopyright", "Copyright © 2002-2011 DOSBox Team" VALUE "OriginalFilename", "dosbox.exe" VALUE "ProductName", "DOSBox DOS Emulator" VALUE "ProductVersion", "0, 74, 0, 0" diff --git a/visualc_net/dosbox.vcproj b/visualc_net/dosbox.vcproj index dffb1c9..ef9cd05 100644 --- a/visualc_net/dosbox.vcproj +++ b/visualc_net/dosbox.vcproj @@ -480,6 +480,9 @@ + + @@ -831,6 +834,9 @@ + +