This commit is contained in:
RichardG867
2020-04-18 14:50:09 -03:00
19 changed files with 147 additions and 74 deletions

View File

@@ -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);

View File

@@ -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()

View File

@@ -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;
}

View File

@@ -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;
}
}

View File

@@ -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);

View File

@@ -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

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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,

View File

@@ -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);

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);