From bd2212c8e403c5ca38756cbe7fca45db0c900bc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Sat, 18 Apr 2020 00:10:24 +0200 Subject: [PATCH 1/5] Add a documentation folder --- README.md | 24 +----------------------- doc/README | 1 + doc/build.md | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 23 deletions(-) create mode 100644 doc/README create mode 100644 doc/build.md diff --git a/README.md b/README.md index 9defdb0d2..a207eaf31 100644 --- a/README.md +++ b/README.md @@ -28,29 +28,7 @@ See [this](https://86box.github.io/gettingstarted) page on our website for a qui Building -------- -In order to compile 86Box from this repository, please follow this step-by-step -guide: -1. Install the [MSYS2](https://www.msys2.org/) environment. The rest of the guide will refer to the directory that you install it to (C:\msys32 or C:\msys64 by default) as the MSYS2 root. -2. Launch your MSYS2 environment using the `MSYS2 MinGW 32-bit` shortcut. If you do not want to use the shortcut, launch it with `\mingw32.exe`. -3. Once launched, run `pacman -Syu` in order to update the environment. You may need to do this twice, just follow the on-screen instructions. Make sure you re-run `pacman -Syu` periodically to keep the environment up-to-date. -4. Run the following command to install all of the dependencies: `pacman -S gdb make git mingw-w64-i686-toolchain mingw-w64-i686-openal mingw-w64-i686-freetype mingw-w64-i686-SDL2 mingw-w64-i686-zlib mingw-w64-i686-libpng`. Additionally, you will need to download the developer's pack of WinPcap [from here](https://www.winpcap.org/devel.htm), and extract it into `\mingw32\`. -5. Once the environment is fully updated and all dependencies are installed, `cd` into your cloned `86box\src` - directory. -6. Run `make -jN -f win/makefile.mingw` to start the actual compilation process. - Substitute `N` with the number of threads you want to use for the compilation - process. The optimal number depends entirely on your processor, and it is - up to you to determine it. A good starting point is the total - number of threads (AKA Logical Processors) you have available. -7. If the compilation succeeded (which it almost always should), you will find - `86Box.exe` in the src directory. -8. In order to test your fresh build, replace the `86Box.exe` in your current - 86Box environment with your freshly built one. If you do not have a - pre-existing 86Box environment, download the latest successful build from - http://ci.86box.net, and the latest ROM set from https://github.com/86Box/roms. -9. Enjoy using and testing the emulator! :) - -If you encounter issues at any step or have additional questions, please join -the IRC channel or the appropriate channel on our Discord server and wait patiently for someone to help you. +See the [build guide](doc/build.md). Automatic builds -------------- diff --git a/doc/README b/doc/README new file mode 100644 index 000000000..dff34b92d --- /dev/null +++ b/doc/README @@ -0,0 +1 @@ +This directory contains 86Box documentation. \ No newline at end of file diff --git a/doc/build.md b/doc/build.md new file mode 100644 index 000000000..4d1f7b088 --- /dev/null +++ b/doc/build.md @@ -0,0 +1,38 @@ +Building +======== +In order to compile 86Box from this repository, please follow this step-by-step guide: + +1. Install the [MSYS2](https://www.msys2.org/) environment. The rest of the guide will refer to the directory that you install it to (C:\msys32 or C:\msys64 by default) as the MSYS2 root. + +2. Launch your MSYS2 environment using the `MSYS2 MinGW 32-bit` shortcut. If you do not want to use the shortcut, launch it using the `mingw32.exe` executable in the MSYS2 root. + +3. Once launched, you should update the environment: + ```console + $ pacman -Syu + ``` + You may need to do this twice, just follow the on-screen instructions. Make sure you re-run the command periodically to keep the environment up-to-date. + +4. Run the following command to install all of the dependencies: + ```console + $ pacman -S gdb make git mingw-w64-i686-toolchain mingw-w64-i686-openal mingw-w64-i686-freetype mingw-w64-i686-SDL2 mingw-w64-i686-zlib mingw-w64-i686-libpng + ``` + +5. Once the environment is fully updated and all dependencies are installed, switch into the `src` directory of the 86Box source: + ```console + $ cd path/to/86Box/src + ``` + +6. Start the actual compilation process: + ```console + $ make -f win/Makefile.mingw + ``` + By default, `make` does not run parallely. If you want it to use more threads, use the `-j` with the number of threads you want to use for the compilation process, i.e. `-j4`. + +7. If the compilation succeeded (which it almost always should), you will find `86Box.exe` in the `src` directory. + +8. In order to test your fresh build, replace the `86Box.exe` in your current 86Box environment with your freshly built one. If you do not have a pre-existing 86Box environment, download the latest successful build from http://ci.86box.net, and the latest ROM set from https://github.com/86Box/roms. + +9. Enjoy using and testing the emulator! :) + +If you encounter issues at any step or have additional questions, please join +the IRC channel or the appropriate channel on our Discord server and wait patiently for someone to help you. \ No newline at end of file From c108e486293a25354b05e3271abc99b244e52374 Mon Sep 17 00:00:00 2001 From: Daniel Gurney Date: Sat, 18 Apr 2020 12:29:04 +0300 Subject: [PATCH 2/5] switch -> change to --- doc/build.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/build.md b/doc/build.md index 4d1f7b088..a405c1eb2 100644 --- a/doc/build.md +++ b/doc/build.md @@ -17,7 +17,7 @@ In order to compile 86Box from this repository, please follow this step-by-step $ pacman -S gdb make git mingw-w64-i686-toolchain mingw-w64-i686-openal mingw-w64-i686-freetype mingw-w64-i686-SDL2 mingw-w64-i686-zlib mingw-w64-i686-libpng ``` -5. Once the environment is fully updated and all dependencies are installed, switch into the `src` directory of the 86Box source: +5. Once the environment is fully updated and all dependencies are installed, change to the `src` directory of the 86Box source: ```console $ cd path/to/86Box/src ``` @@ -35,4 +35,4 @@ In order to compile 86Box from this repository, please follow this step-by-step 9. Enjoy using and testing the emulator! :) If you encounter issues at any step or have additional questions, please join -the IRC channel or the appropriate channel on our Discord server and wait patiently for someone to help you. \ No newline at end of file +the IRC channel or the appropriate channel on our Discord server and wait patiently for someone to help you. From 3178a5507f3fd92ebbc038f8ac4aa91269c14e39 Mon Sep 17 00:00:00 2001 From: Daniel Gurney Date: Sat, 18 Apr 2020 12:43:31 +0300 Subject: [PATCH 3/5] Miscellaneous spelling fixes and clarifications --- doc/build.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/build.md b/doc/build.md index a405c1eb2..0b226dc33 100644 --- a/doc/build.md +++ b/doc/build.md @@ -17,7 +17,7 @@ In order to compile 86Box from this repository, please follow this step-by-step $ pacman -S gdb make git mingw-w64-i686-toolchain mingw-w64-i686-openal mingw-w64-i686-freetype mingw-w64-i686-SDL2 mingw-w64-i686-zlib mingw-w64-i686-libpng ``` -5. Once the environment is fully updated and all dependencies are installed, change to the `src` directory of the 86Box source: +5. Once the environment is fully updated and all dependencies are installed, change directory to `src`: ```console $ cd path/to/86Box/src ``` @@ -26,7 +26,7 @@ In order to compile 86Box from this repository, please follow this step-by-step ```console $ make -f win/Makefile.mingw ``` - By default, `make` does not run parallely. If you want it to use more threads, use the `-j` with the number of threads you want to use for the compilation process, i.e. `-j4`. + By default, `make` does not run in parallel. If you want it to use more threads, use the `-j` switch with the number of threads, e.g. `-j4`. However, keep in mind that you should not exceed your thread (logical processor) count, since that just uses more resources for little to no gain. 7. If the compilation succeeded (which it almost always should), you will find `86Box.exe` in the `src` directory. From 2146101637a9c654ade4fac629a183ffd358ce7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Sat, 18 Apr 2020 11:51:54 +0200 Subject: [PATCH 4/5] Remove VNC from regular builds for the time being --- src/include/86box/resource.h | 4 +++- src/include/86box/win.h | 4 ++++ src/win/86Box.rc | 2 ++ src/win/Makefile.mingw | 12 ++++++++++++ src/win/Makefile_ndr.mingw | 12 ++++++++++++ src/win/win.c | 19 ++++++++++++++----- src/win/win_ui.c | 4 ++++ 7 files changed, 51 insertions(+), 6 deletions(-) diff --git a/src/include/86box/resource.h b/src/include/86box/resource.h index a72822b99..60990f691 100644 --- a/src/include/86box/resource.h +++ b/src/include/86box/resource.h @@ -1,4 +1,4 @@ -/* +/* * 86Box A hypervisor and IBM PC system emulator that specializes in * running old operating systems and software designed for IBM * PC systems and compatibles from 1981 through fairly recent @@ -275,7 +275,9 @@ #define IDM_VID_REMEMBER 40041 #define IDM_VID_SDL_SW 40050 #define IDM_VID_SDL_HW 40051 +#ifdef USE_VNC #define IDM_VID_VNC 40052 +#endif #define IDM_VID_SCALE_1X 40055 #define IDM_VID_SCALE_2X 40056 #define IDM_VID_SCALE_3X 40057 diff --git a/src/include/86box/win.h b/src/include/86box/win.h index 33d38a175..597ebaa59 100644 --- a/src/include/86box/win.h +++ b/src/include/86box/win.h @@ -64,7 +64,11 @@ /* The emulator has shut down. */ #define WM_HAS_SHUTDOWN 0x8897 +#ifdef USE_VNC #define RENDERERS_NUM 3 +#else +#define RENDERERS_NUM 2 +#endif #ifdef __cplusplus diff --git a/src/win/86Box.rc b/src/win/86Box.rc index 049fd5412..432a0b8c1 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -68,7 +68,9 @@ BEGIN BEGIN MENUITEM "&SDL (Software)", IDM_VID_SDL_SW MENUITEM "&SDL (Hardware)", IDM_VID_SDL_HW +#ifdef USE_VNC MENUITEM "&VNC", IDM_VID_VNC +#endif END MENUITEM SEPARATOR MENUITEM "F&orce 4:3 display ratio", IDM_VID_FORCE43 diff --git a/src/win/Makefile.mingw b/src/win/Makefile.mingw index 73cad4331..b1da998a4 100644 --- a/src/win/Makefile.mingw +++ b/src/win/Makefile.mingw @@ -80,6 +80,9 @@ ifeq ($(DEV_BUILD), y) ifndef VGAWONDER VGAWONDER := y endif + ifndef VNC + VNC := y + endif ifndef XL24 XL24 := y endif @@ -129,6 +132,9 @@ else ifndef VGAWONDER VGAWONDER := n endif + ifndef VNC + VNC := n + endif ifndef XL24 XL24 := n endif @@ -373,12 +379,16 @@ MUNTOBJ := midi_mt32.o \ Tables.o TVA.o TVF.o TVP.o sha1.o c_interface.o endif +ifeq ($(VNC), y) +OPTS += -DUSE_VNC +RFLAGS += -DUSE_VNC ifneq ($(VNC_PATH), ) OPTS += -I$(VNC_PATH)\INCLUDE VNCLIB := -L$(VNC_PATH)\LIB endif VNCLIB += -lvncserver VNCOBJ := vnc.o vnc_keymap.o +endif ifeq ($(DISCORD), y) OPTS += -DUSE_DISCORD @@ -667,7 +677,9 @@ ifeq ($(DEBUG), y) LIBS += -lssp endif +ifeq ($(VNC), y) LIBS += $(VNCLIB) -lws2_32 +endif ifneq ($(WX), n) LIBS += $(WX_LIBS) -lm endif diff --git a/src/win/Makefile_ndr.mingw b/src/win/Makefile_ndr.mingw index e8bdacd58..63aa78608 100644 --- a/src/win/Makefile_ndr.mingw +++ b/src/win/Makefile_ndr.mingw @@ -80,6 +80,9 @@ ifeq ($(DEV_BUILD), y) ifndef VGAWONDER VGAWONDER := y endif + ifndef VNC + VNC := y + endif ifndef XL24 XL24 := y endif @@ -132,6 +135,9 @@ else ifndef VGAWONDER VGAWONDER := n endif + ifndef VNC + VNC := n + endif ifndef XL24 XL24 := n endif @@ -382,12 +388,16 @@ MUNTOBJ := midi_mt32.o \ Tables.o TVA.o TVF.o TVP.o sha1.o c_interface.o endif +ifeq ($(VNC), y) +OPTS += -DUSE_VNC +RFLAGS += -DUSE_VNC ifneq ($(VNC_PATH), ) OPTS += -I$(VNC_PATH)\INCLUDE VNCLIB := -L$(VNC_PATH)\LIB endif VNCLIB += -lvncserver VNCOBJ := vnc.o vnc_keymap.o +endif ifeq ($(DISCORD), y) OPTS += -DUSE_DISCORD @@ -668,7 +678,9 @@ endif LIBS := -mwindows -lcomctl32 \ -lopenal -lole32 +ifeq ($(VNC), y) LIBS += $(VNCLIB) -lws2_32 +endif ifneq ($(WX), n) LIBS += $(WX_LIBS) -lm endif diff --git a/src/win/win.c b/src/win/win.c index 7323e13b7..e79844528 100644 --- a/src/win/win.c +++ b/src/win/win.c @@ -42,7 +42,9 @@ #include <86box/plat.h> #include <86box/plat_midi.h> #include <86box/ui.h> -#include <86box/vnc.h> +#ifdef USE_VNC +# include <86box/vnc.h> +#endif #include <86box/win_sdl.h> #include <86box/win.h> @@ -86,13 +88,17 @@ static const struct { } vid_apis[2][RENDERERS_NUM] = { { { "SDL_Software", 1, (int(*)(void*))sdl_inits, sdl_close, NULL, sdl_pause, sdl_enable }, - { "SDL_Hardware", 1, (int(*)(void*))sdl_inith, sdl_close, NULL, sdl_pause, sdl_enable }, - { "VNC", 0, vnc_init, vnc_close, vnc_resize, vnc_pause, NULL } + { "SDL_Hardware", 1, (int(*)(void*))sdl_inith, sdl_close, NULL, sdl_pause, sdl_enable } +#ifdef USE_VNC + ,{ "VNC", 0, vnc_init, vnc_close, vnc_resize, vnc_pause, NULL } +#endif }, { { "SDL_Software", 1, (int(*)(void*))sdl_inits_fs, sdl_close, sdl_resize, sdl_pause, sdl_enable }, - { "SDL_Hardware", 1, (int(*)(void*))sdl_inith_fs, sdl_close, sdl_resize, sdl_pause, sdl_enable }, - { "VNC", 0, vnc_init, vnc_close, vnc_resize, vnc_pause, NULL } + { "SDL_Hardware", 1, (int(*)(void*))sdl_inith_fs, sdl_close, sdl_resize, sdl_pause, sdl_enable } +#ifdef USE_VNC + ,{ "VNC", 0, vnc_init, vnc_close, vnc_resize, vnc_pause, NULL } +#endif }, }; @@ -685,9 +691,12 @@ plat_vidapi_name(int api) break; case 1: break; + +#ifdef USE_VNC case 2: name = "vnc"; break; +#endif default: fatal("Unknown renderer: %i\n", api); break; diff --git a/src/win/win_ui.c b/src/win/win_ui.c index 900fb137a..2a9099c3f 100644 --- a/src/win/win_ui.c +++ b/src/win/win_ui.c @@ -154,7 +154,9 @@ ResetAllMenus(void) CheckMenuItem(menuMain, IDM_VID_RESIZE, MF_UNCHECKED); CheckMenuItem(menuMain, IDM_VID_SDL_SW, MF_UNCHECKED); CheckMenuItem(menuMain, IDM_VID_SDL_HW, MF_UNCHECKED); +#ifdef USE_VNC CheckMenuItem(menuMain, IDM_VID_VNC, MF_UNCHECKED); +#endif CheckMenuItem(menuMain, IDM_VID_FS_FULL+0, MF_UNCHECKED); CheckMenuItem(menuMain, IDM_VID_FS_FULL+1, MF_UNCHECKED); CheckMenuItem(menuMain, IDM_VID_FS_FULL+2, MF_UNCHECKED); @@ -436,7 +438,9 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) case IDM_VID_SDL_SW: case IDM_VID_SDL_HW: +#ifdef USE_VNC case IDM_VID_VNC: +#endif CheckMenuItem(hmenu, IDM_VID_SDL_SW + vid_api, MF_UNCHECKED); plat_setvid(LOWORD(wParam) - IDM_VID_SDL_SW); CheckMenuItem(hmenu, IDM_VID_SDL_SW + vid_api, MF_CHECKED); From 600bb09f172bb1c0fc109030136c8eac1e7432e9 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sat, 18 Apr 2020 18:03:02 +0200 Subject: [PATCH 5/5] Added PS/2 Intel AMI keyboard controller type that always returns bit 6 of the input port as 1, fixes Intel Advanced/EV and Advanced/ZP SMM errors (with high-low beeps), and also IDE not found error behavior to fix IDE with some i686 BIOS'es. --- src/cpu_common/386_common.c | 7 ------- src/cpu_common/cpu.c | 3 ++- src/cpu_common/x86_ops_misc.h | 2 +- src/disk/hdc_ide.c | 15 +++++++------- src/include/86box/keyboard.h | 1 + src/intel_piix.c | 37 ++++++++++++++++------------------- src/keyboard_at.c | 30 ++++++++++++++++++++++------ src/machine/m_at_socket4_5.c | 4 ++-- src/win/win_crashdump.c | 2 +- 9 files changed, 56 insertions(+), 45 deletions(-) diff --git a/src/cpu_common/386_common.c b/src/cpu_common/386_common.c index d11257cce..c8b065c2a 100644 --- a/src/cpu_common/386_common.c +++ b/src/cpu_common/386_common.c @@ -1100,9 +1100,6 @@ enter_smm(int in_hlt) smm_in_hlt = in_hlt; CPU_BLOCK_END(); - - // if (smbase == 0x000a0000) - // leave_smm(); } @@ -1161,10 +1158,6 @@ leave_smm(void) else if (is_p6) /* Intel P6 (Pentium Pro, Pentium II, Celeron) */ smram_restore_state_p6(saved_state); - /* Maybe we need this? */ - // if (smbase == 0x00030000) - // smbase = 0x000a0000; - in_smm = 0; mem_mapping_recalc(0x00030000, 0x00020000); mem_mapping_recalc(0x000a0000, 0x00060000); diff --git a/src/cpu_common/cpu.c b/src/cpu_common/cpu.c index 5005fd5e4..bff70e6b1 100644 --- a/src/cpu_common/cpu.c +++ b/src/cpu_common/cpu.c @@ -2377,7 +2377,6 @@ void cpu_ven_reset(void) void cpu_RDMSR() { - cpu_log("RDMSR %08X\n", ECX); switch (machines[machine].cpu[cpu_manufacturer].cpus[cpu_effective].cpu_type) { case CPU_WINCHIP: @@ -2850,6 +2849,8 @@ i686_invalid_rdmsr: } break; } + + cpu_log("RDMSR %08X %08X%08X\n", ECX, EDX, EAX); } void cpu_WRMSR() diff --git a/src/cpu_common/x86_ops_misc.h b/src/cpu_common/x86_ops_misc.h index 16a628fd1..8f23e503a 100644 --- a/src/cpu_common/x86_ops_misc.h +++ b/src/cpu_common/x86_ops_misc.h @@ -625,7 +625,7 @@ static int opHLT(uint32_t fetchdat) CPU_BLOCK_END(); PREFETCH_RUN(100, 1, -1, 0,0,0,0, 0); - + return 0; } diff --git a/src/disk/hdc_ide.c b/src/disk/hdc_ide.c index 374f9d0c5..4b2e46b13 100644 --- a/src/disk/hdc_ide.c +++ b/src/disk/hdc_ide.c @@ -671,8 +671,8 @@ loadhd(ide_t *ide, int d, const wchar_t *fn) return; } - ide->spt = hdd[d].spt; - ide->hpc = hdd[d].hpc; + ide->spt = ide->cfg_spt = hdd[d].spt; + ide->hpc = ide->cfg_hpc = hdd[d].hpc; ide->tracks = hdd[d].tracks; ide->type = IDE_HDD; ide->hdd_num = d; @@ -1183,7 +1183,7 @@ ide_writew(uint16_t addr, uint16_t val, void *priv) ch = dev->cur_dev; ide = ide_drives[ch]; - /* ide_log("ide_writew %04X %04X from %04X(%08X):%08X\n", addr, val, CS, cs, cpu_state.pc); */ + ide_log("ide_writew %04X %04X from %04X(%08X):%08X\n", addr, val, CS, cs, cpu_state.pc); addr &= 0x7; @@ -1216,7 +1216,7 @@ ide_writel(uint16_t addr, uint32_t val, void *priv) ch = dev->cur_dev; ide = ide_drives[ch]; - /* ide_log("ide_writel %04X %08X from %04X(%08X):%08X\n", addr, val, CS, cs, cpu_state.pc); */ + ide_log("ide_writel %04X %08X from %04X(%08X):%08X\n", addr, val, CS, cs, cpu_state.pc); addr &= 0x7; @@ -1905,7 +1905,7 @@ ide_readw(uint16_t addr, void *priv) break; } - /* ide_log("ide_readw(%04X, %08X) = %04X\n", addr, priv, temp); */ + ide_log("ide_readw(%04X, %08X) = %04X\n", addr, priv, temp); return temp; } @@ -1940,7 +1940,7 @@ ide_readl(uint16_t addr, void *priv) break; } - /* ide_log("ide_readl(%04X, %08X) = %04X\n", addr, priv, temp); */ + ide_log("ide_readl(%04X, %08X) = %04X\n", addr, priv, temp); return temp; } @@ -2596,7 +2596,8 @@ ide_board_setup(int board) dev->mdma_mode = (1 << ide_get_max(dev, TYPE_PIO)); dev->error = 1; - dev->cfg_spt = dev->cfg_hpc = 0; + if (dev->type != IDE_HDD) + dev->cfg_spt = dev->cfg_hpc = 0; } } diff --git a/src/include/86box/keyboard.h b/src/include/86box/keyboard.h index 429e14712..d90fff256 100644 --- a/src/include/86box/keyboard.h +++ b/src/include/86box/keyboard.h @@ -81,6 +81,7 @@ extern const device_t keyboard_ps2_mca_2_device; extern const device_t keyboard_ps2_quadtel_device; extern const device_t keyboard_ps2_pci_device; extern const device_t keyboard_ps2_ami_pci_device; +extern const device_t keyboard_ps2_intel_ami_pci_device; #endif extern void keyboard_init(void); diff --git a/src/intel_piix.c b/src/intel_piix.c index ebd3d83ff..8e83e0f0e 100644 --- a/src/intel_piix.c +++ b/src/intel_piix.c @@ -1371,8 +1371,6 @@ piix_close(void *p) static void *piix_init(const device_t *info) { - CPU *cpu_s = &machines[machine].cpu[cpu_manufacturer].cpus[cpu]; - piix_t *dev = (piix_t *) malloc(sizeof(piix_t)); memset(dev, 0, sizeof(piix_t)); @@ -1443,13 +1441,13 @@ static void 1000 = 150 MHz, 1010 = 200 MHz, 1100 = 180 MHz, 1110 = ??? MHz; 1001 = 75 MHz, 1011 = 100 MHz, 1101 = 90 MHz, 1111 = ??? MHz */ - if (cpu_busspeed <= 0x40000000) + if (cpu_busspeed <= 40000000) dev->readout_regs[1] |= 0x30; - else if ((cpu_busspeed > 0x40000000) && (cpu_busspeed <= 0x50000000)) + else if ((cpu_busspeed > 40000000) && (cpu_busspeed <= 50000000)) dev->readout_regs[1] |= 0x00; - else if ((cpu_busspeed > 0x50000000) && (cpu_busspeed <= 0x60000000)) + else if ((cpu_busspeed > 50000000) && (cpu_busspeed <= 60000000)) dev->readout_regs[1] |= 0x20; - else if (cpu_busspeed > 0x60000000) + else if (cpu_busspeed > 60000000) dev->readout_regs[1] |= 0x10; if (cpu_dmulti <= 1.5) @@ -1467,7 +1465,7 @@ static void dev->board_config[0] = 0xff; dev->board_config[0] = 0x00; /* Register 0x0079: */ - /* Bit 7: 0 = Keep password, 0 = Clear password. */ + /* Bit 7: 0 = Clear password, 1 = Keep password. */ /* Bit 6: 0 = NVRAM cleared by jumper, 1 = NVRAM normal. */ /* Bit 5: 0 = CMOS Setup disabled, 1 = CMOS Setup enabled. */ /* Bit 4: External CPU clock (Switch 8). */ @@ -1476,22 +1474,21 @@ static void /* 60 MHz: Switch 7 = On, Switch 8 = Off. */ /* 66 MHz: Switch 7 = Off, Switch 8 = On. */ /* Bit 2: 0 = On-board audio absent, 1 = On-board audio present. */ - /* Bit 0: 0 = 1.5x multiplier, 0 = 2x multiplier. */ + /* Bit 0: 0 = 1.5x multiplier, 1 = 2x multiplier (Switch 6). */ + /* NOTE: A bit is read as 1 if switch is off, and as 0 if switch is on. */ dev->board_config[1] = 0xe0; - if ((cpu_s->rspeed == 75000000) && (cpu_busspeed == 50000000)) + + if (cpu_busspeed <= 50000000) + dev->board_config[1] |= 0x10; + else if ((cpu_busspeed > 50000000) && (cpu_busspeed <= 60000000)) + dev->board_config[1] |= 0x18; + else if (cpu_busspeed > 60000000) + dev->board_config[1] |= 0x00; + + if (cpu_dmulti <= 1.5) dev->board_config[1] |= 0x01; - else if ((cpu_s->rspeed == 90000000) && (cpu_busspeed == 60000000)) - dev->board_config[1] |= (0x01 | 0x08); - else if ((cpu_s->rspeed == 100000000) && (cpu_busspeed == 50000000)) - dev->board_config[1] |= 0x00; - else if ((cpu_s->rspeed == 100000000) && (cpu_busspeed == 66666666)) - dev->board_config[1] |= (0x01 | 0x10); - else if ((cpu_s->rspeed == 120000000) && (cpu_busspeed == 60000000)) - dev->board_config[1] |= 0x08; - else if ((cpu_s->rspeed == 133333333) && (cpu_busspeed == 66666666)) - dev->board_config[1] |= 0x10; else - dev->board_config[1] |= 0x10; /* TODO: how are the overdrive processors configured? */ + dev->board_config[1] |= 0x00; return dev; } diff --git a/src/keyboard_at.c b/src/keyboard_at.c index a24c1fea2..dc2a01378 100644 --- a/src/keyboard_at.c +++ b/src/keyboard_at.c @@ -85,7 +85,8 @@ #define KBC_VEN_XI8088 0x14 #define KBC_VEN_IBM_PS1 0x18 #define KBC_VEN_ACER 0x1c -#define KBC_VEN_MASK 0x1c +#define KBC_VEN_INTEL_AMI 0x20 +#define KBC_VEN_MASK 0x3c typedef struct { @@ -1074,6 +1075,7 @@ write_cmd(atkbd_t *dev, uint8_t val) /* ISA AT keyboard controllers use bit 5 for keyboard mode (1 = PC/XT, 2 = AT); PS/2 (and EISA/PCI) keyboard controllers use it as the PS/2 mouse enable switch. */ if (((dev->flags & KBC_VEN_MASK) == KBC_VEN_AMI) || + ((dev->flags & KBC_VEN_MASK) == KBC_VEN_INTEL_AMI) || ((dev->flags & KBC_TYPE_MASK) >= KBC_TYPE_PS2_NOREF)) { keyboard_mode &= ~CCB_PCMODE; @@ -1133,7 +1135,7 @@ static uint8_t write64_generic(void *priv, uint8_t val) { atkbd_t *dev = (atkbd_t *)priv; - uint8_t current_drive; + uint8_t current_drive, fixed_bits; switch (val) { case 0xa4: /* check if password installed */ @@ -1206,17 +1208,21 @@ write64_generic(void *priv, uint8_t val) #ifdef ENABLE_KEYBOARD_AT_LOG kbd_log("ATkbd: read input port\n"); #endif + fixed_bits = 4; + /* The SMM handlers of Intel AMI Pentium BIOS'es expect bit 6 to be set. */ + if ((dev->flags & KBC_VEN_MASK) == KBC_VEN_INTEL_AMI) + fixed_bits |= 0x40; if ((dev->flags & KBC_VEN_MASK) == KBC_VEN_IBM_PS1) { current_drive = fdc_get_current_drive(); - add_data(dev, dev->input_port | 4 | (fdd_is_525(current_drive) ? 0x40 : 0x00)); + add_data(dev, dev->input_port | fixed_bits | (fdd_is_525(current_drive) ? 0x40 : 0x00)); dev->input_port = ((dev->input_port + 1) & 3) | (dev->input_port & 0xfc) | (fdd_is_525(current_drive) ? 0x40 : 0x00); } else { if ((dev->flags & KBC_TYPE_MASK) >= KBC_TYPE_PS2_NOREF) - add_data(dev, (dev->input_port | 4) & 0xef); + add_data(dev, (dev->input_port | fixed_bits) & 0xef); else - add_data(dev, dev->input_port | 4); + add_data(dev, dev->input_port | fixed_bits); dev->input_port = ((dev->input_port + 1) & 3) | (dev->input_port & 0xfc); } @@ -1774,7 +1780,8 @@ kbd_write(uint16_t port, uint8_t val, void *priv) if (mouse_write && ((dev->flags & KBC_TYPE_MASK) >= KBC_TYPE_PS2_NOREF)) mouse_write(val, mouse_p); else if (!mouse_write && ((dev->flags & KBC_TYPE_MASK) >= KBC_TYPE_PS2_NOREF) && - ((dev->flags & KBC_VEN_MASK) == KBC_VEN_AMI)) + (((dev->flags & KBC_VEN_MASK) == KBC_VEN_AMI) || + ((dev->flags & KBC_VEN_MASK) == KBC_VEN_INTEL_AMI))) keyboard_at_adddata_mouse(0xff); break; @@ -2413,6 +2420,7 @@ kbd_init(const device_t *info) break; case KBC_VEN_AMI: + case KBC_VEN_INTEL_AMI: dev->write60_ven = write60_ami; dev->write64_ven = write64_ami; break; @@ -2574,6 +2582,16 @@ const device_t keyboard_ps2_ami_pci_device = { NULL, NULL, NULL }; +const device_t keyboard_ps2_intel_ami_pci_device = { + "PS/2 Keyboard (AMI)", + DEVICE_PCI, + KBC_TYPE_PS2_NOREF | KBC_VEN_INTEL_AMI, + kbd_init, + kbd_close, + kbd_reset, + NULL, NULL, NULL +}; + const device_t keyboard_ps2_acer_device = { "PS/2 Keyboard (Acer 90M002A)", DEVICE_PCI, diff --git a/src/machine/m_at_socket4_5.c b/src/machine/m_at_socket4_5.c index aa32c2fc6..b86c3fe4b 100644 --- a/src/machine/m_at_socket4_5.c +++ b/src/machine/m_at_socket4_5.c @@ -278,7 +278,7 @@ machine_at_endeavor_init(const machine_t *model) if (gfxcard == VID_INTERNAL) device_add(&s3_phoenix_trio64_onboard_pci_device); - device_add(&keyboard_ps2_ami_pci_device); + device_add(&keyboard_ps2_intel_ami_pci_device); device_add(&i430fx_device); device_add(&piix_device); device_add(&pc87306_device); @@ -314,7 +314,7 @@ machine_at_zappa_init(const machine_t *model) pci_register_slot(0x0E, PCI_CARD_NORMAL, 3, 4, 1, 2); pci_register_slot(0x0F, PCI_CARD_NORMAL, 2, 3, 4, 1); pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0); - device_add(&keyboard_ps2_ami_pci_device); + device_add(&keyboard_ps2_intel_ami_pci_device); device_add(&i430fx_device); device_add(&piix_device); device_add(&pc87306_device); diff --git a/src/win/win_crashdump.c b/src/win/win_crashdump.c index 6ca80963d..e1123c1e5 100644 --- a/src/win/win_crashdump.c +++ b/src/win/win_crashdump.c @@ -145,7 +145,7 @@ LONG CALLBACK MakeCrashDump(PEXCEPTION_POINTERS ExceptionInfo) hMods[i], &modInfo, sizeof(MODULEINFO)); /* If the exception address is in the range of this module.. */ if ( (ExceptionInfo->ExceptionRecord->ExceptionAddress >= modInfo.lpBaseOfDll) && - (ExceptionInfo->ExceptionRecord->ExceptionAddress < (modInfo.lpBaseOfDll + modInfo.SizeOfImage))) { + (ExceptionInfo->ExceptionRecord->ExceptionAddress < (void*)((char*)modInfo.lpBaseOfDll + modInfo.SizeOfImage))) { /* ...this is the module we're looking for! */ ipModule = hMods[i]; break;