From b7e2e239e849ef109ef5f3198f4051f3825b26d0 Mon Sep 17 00:00:00 2001 From: EngiNerd89 Date: Sat, 6 Feb 2021 23:58:39 +0100 Subject: [PATCH] Added chipset and xta interface to Philips machines. Major refactoring. --- src/chipset/CMakeLists.txt | 1 + src/chipset/gc100.c | 256 +++++++++++++++++++++++++++ src/device/olivetti_m290_registers.c | 117 ------------ src/include/86box/chipset.h | 4 + src/include/86box/machine.h | 13 +- src/machine/CMakeLists.txt | 1 + src/machine/m_at_286_386sx.c | 219 +---------------------- src/machine/m_xt.c | 58 +----- src/machine/m_xt_olivetti.c | 38 +--- src/machine/m_xt_philips.c | 204 +++++++++++++++++++++ src/machine/machine_table.c | 11 +- src/win/Makefile.mingw | 6 +- 12 files changed, 481 insertions(+), 447 deletions(-) create mode 100644 src/chipset/gc100.c delete mode 100644 src/device/olivetti_m290_registers.c create mode 100644 src/machine/m_xt_philips.c diff --git a/src/chipset/CMakeLists.txt b/src/chipset/CMakeLists.txt index c3a0b18e2..f8c01a631 100644 --- a/src/chipset/CMakeLists.txt +++ b/src/chipset/CMakeLists.txt @@ -17,6 +17,7 @@ add_library(chipset OBJECT acc2168.c cs8230.c ali1217.c ali1429.c headland.c int cs4031.c intel_420ex.c intel_4x0.c intel_sio.c intel_piix.c ../ioapic.c neat.c opti495.c opti895.c opti5x7.c scamp.c scat.c via_vt82c49x.c via_vt82c505.c sis_85c310.c sis_85c4xx.c sis_85c496.c sis_85c50x.c + gc100.c opti283.c opti291.c via_apollo.c via_pipc.c wd76c10.c vl82c480.c) diff --git a/src/chipset/gc100.c b/src/chipset/gc100.c new file mode 100644 index 000000000..97c944f74 --- /dev/null +++ b/src/chipset/gc100.c @@ -0,0 +1,256 @@ +/* + * 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 + * system designs based on the PCI bus. + * + * This file is part of the 86Box distribution. + * + * Implementation of the G2 GC100/GC100A chipset. + * NOTE: As documentation is currently available only for the + * CG100 chipset, the GC100A chipset has been reverese-engineered. + * Thus, its behavior may not be fully accurate. + * + * Authors: EngiNerd + * + * Copyright 2020-2021 EngiNerd + */ + +#include +#include +#include +#include +#include +#include +#define HAVE_STDARG_H +#include <86box/86box.h> +#include <86box/nmi.h> +#include <86box/timer.h> +#include <86box/pit.h> +#include <86box/mem.h> +#include <86box/device.h> +#include <86box/fdd.h> +#include <86box/fdc.h> +#include <86box/fdc_ext.h> +#include <86box/hdc.h> +#include <86box/gameport.h> +#include <86box/ibm_5161.h> +#include <86box/keyboard.h> +#include <86box/rom.h> +#include <86box/machine.h> +#include <86box/chipset.h> +#include <86box/io.h> +#include <86box/video.h> + +typedef struct +{ + uint8_t reg[0x10]; +} gc100_t; + +#define ENABLE_GC100_LOG 1 + +#ifdef ENABLE_GC100_LOG +int gc100_do_log = ENABLE_GC100_LOG; +static void +gc100_log(const char *fmt, ...) +{ + va_list ap; + + if (gc100_do_log) { + va_start(ap, fmt); + pclog_ex(fmt, ap); + va_end(ap); + } +} +#else +#define gc100_log(fmt, ...) +#endif + +static uint8_t +get_fdd_switch_settings(){ + + int i, fdd_count = 0; + + for (i = 0; i < FDD_NUM; i++) { + if (fdd_get_flags(i)) + fdd_count++; + } + + if (!fdd_count) + return 0x00; + else + return ((fdd_count - 1) << 6) | 0x01; + +} + +static uint8_t +get_videomode_switch_settings(){ + + if (video_is_mda()) + return 0x30; + else if (video_is_cga()) + return 0x20; /* 0x10 would be 40x25 */ + else + return 0x00; + +} + +static void +gc100_write(uint16_t port, uint8_t val, void *priv) +{ + gc100_t *dev = (gc100_t *) priv; + + uint16_t addr = port & 0xf; + + dev->reg[addr] = val; + + switch (addr) + { + /* addr 0x2 + * bits 5-7: not used + * bit 4: intenal memory wait states + * bits 2-3: external memory wait states + * bits 0-1: i/o access wait states + */ + case 0x2: + break; + + /* addr 0x3 + * bits 1-7: not used + * bit 0: turbo 0 xt 1 + */ + case 0x3: + if (val & 0x1) + cpu_dynamic_switch(0); + else + cpu_dynamic_switch(cpu); + break; + + /* addr 0x5 + * programmable dip-switches + * bits 6-7: floppy drive number + * bits 4-5: video mode + * bits 2-3: memory size + * bit 1: fpu + * bit 0: not used + */ + + /* addr 0x6 */ + + /* addr 0x7 */ + + } + + gc100_log("GC100: Write %02x at %02x\n", val, port); + +} + +static uint8_t +gc100_read(uint16_t port, void *priv) +{ + gc100_t *dev = (gc100_t *) priv; + uint8_t ret = 0xff; + + uint16_t addr = port & 0xf; + + ret = dev->reg[addr]; + + gc100_log("GC100: Read %02x at %02x\n", ret, port); + + switch (addr) + { + /* addr 0x2 + * bits 5-7: not used + * bit 4: intenal memory wait states + * bits 2-3: external memory wait states + * bits 0-1: i/o access wait states + */ + case 0x2: + break; + + /* addr 0x3 + * bits 1-7: not used + * bit 0: turbo 0 xt 1 + */ + case 0x3: + break; + + /* addr 0x5 + * programmable dip-switches + * bits 6-7: floppy drive number + * bits 4-5: video mode + * bits 2-3: memory size + * bit 1: fpu + * bit 0: not used + */ + case 0x5: + ret = ret & 0x0c; + ret |= get_fdd_switch_settings(); + ret |= get_videomode_switch_settings(); + if (hasfpu) + ret |= 0x02; + + break; + + /* addr 0x6 */ + + /* addr 0x7 */ + + } + + return ret; +} + + +static void +gc100_close(void *priv) +{ + gc100_t *dev = (gc100_t *) priv; + + free(dev); +} + +static void * +gc100_init(const device_t *info) +{ + gc100_t *dev = (gc100_t *) malloc(sizeof(gc100_t)); + memset(dev, 0, sizeof(gc100_t)); + + dev->reg[0x2] = 0xff; + dev->reg[0x3] = 0x0; + dev->reg[0x5] = 0x0; + dev->reg[0x6] = 0x0; + dev->reg[0x7] = 0x0; + + /* GC100A */ + if(info->local) { + io_sethandler(0x0c2, 0x02, gc100_read, NULL, NULL, gc100_write, NULL, NULL, dev); + io_sethandler(0x0c5, 0x03, gc100_read, NULL, NULL, gc100_write, NULL, NULL, dev); + } + /* GC100 */ + else { + io_sethandler(0x022, 0x02, gc100_read, NULL, NULL, gc100_write, NULL, NULL, dev); + io_sethandler(0x025, 0x01, gc100_read, NULL, NULL, gc100_write, NULL, NULL, dev); + } + + return dev; +} + +const device_t gc100_device = { + "G2 GC100", + 0, + 0, + gc100_init, gc100_close, NULL, + { NULL }, NULL, NULL, + NULL +}; + +const device_t gc100a_device = { + "G2 GC100A", + 0, + 1, + gc100_init, gc100_close, NULL, + { NULL }, NULL, NULL, + NULL +}; + diff --git a/src/device/olivetti_m290_registers.c b/src/device/olivetti_m290_registers.c deleted file mode 100644 index abe931c91..000000000 --- a/src/device/olivetti_m290_registers.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * 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 - * system designs based on the PCI bus. - * - * This file is part of the 86Box distribution. - * - * Implementation of the Olivetti M290 registers Readout - * - * Authors: EngiNerd - * - * Copyright 2020-2021 EngiNerd - */ - - -#include -#include -#include -#include -#include -#include -#define HAVE_STDARG_H -#include <86box/86box.h> -#include "cpu.h" -#include <86box/timer.h> -#include <86box/io.h> -#include <86box/device.h> -#include <86box/chipset.h> -#include <86box/video.h> - -typedef struct -{ - uint8_t reg_067; - uint8_t reg_069; -} olivetti_m290_registers_t; - -#ifdef ENABLE_OLIVETTI_M290_REGISTERS_LOG -int olivetti_m290_registers_do_log = ENABLE_OLIVETTI_M290_REGISTERS_LOG; -static void -olivetti_m290_registers_log(const char *fmt, ...) -{ - va_list ap; - - if (olivetti_m290_registers_do_log) { - va_start(ap, fmt); - pclog_ex(fmt, ap); - va_end(ap); - } -} -#else -#define olivetti_m290_registers_log(fmt, ...) -#endif - -static void -olivetti_m290_registers_write(uint16_t addr, uint8_t val, void *priv) -{ - olivetti_m290_registers_t *dev = (olivetti_m290_registers_t *) priv; - olivetti_m290_registers_log("Olivetti M290 registers: Write %02x at %02x\n", val, addr); - switch (addr) { - case 0x067: - dev->reg_067 = val; - break; - case 0x069: - dev->reg_069 = val; - break; - } -} - -static uint8_t -olivetti_m290_registers_read(uint16_t addr, void *priv) -{ - olivetti_m290_registers_t *dev = (olivetti_m290_registers_t *) priv; - uint8_t ret = 0xff; - switch (addr) { - case 0x067: - ret = dev->reg_067; - break; - case 0x069: - ret = dev->reg_069; - break; - } - olivetti_m290_registers_log("Olivetti M290 registers: Read %02x at %02x\n", ret, addr); - return ret; -} - - -static void -olivetti_m290_registers_close(void *priv) -{ - olivetti_m290_registers_t *dev = (olivetti_m290_registers_t *) priv; - - free(dev); -} - -static void * -olivetti_m290_registers_init(const device_t *info) -{ - olivetti_m290_registers_t *dev = (olivetti_m290_registers_t *) malloc(sizeof(olivetti_m290_registers_t)); - memset(dev, 0, sizeof(olivetti_m290_registers_t)); - - dev->reg_067 = 0x0; - dev->reg_069 = 0x0; - - io_sethandler(0x0067, 0x0003, olivetti_m290_registers_read, NULL, NULL, olivetti_m290_registers_write, NULL, NULL, dev); - - return dev; -} - -const device_t olivetti_m290_registers_device = { - "Olivetti M290 registers Readout", - 0, - 0, - olivetti_m290_registers_init, olivetti_m290_registers_close, NULL, - { NULL }, NULL, NULL, - NULL -}; diff --git a/src/include/86box/chipset.h b/src/include/86box/chipset.h index c2db87326..449602130 100644 --- a/src/include/86box/chipset.h +++ b/src/include/86box/chipset.h @@ -46,6 +46,10 @@ extern const device_t scat_sx_device; extern const device_t cs8230_device; extern const device_t cs4031_device; +/* G2 */ +extern const device_t gc100_device; +extern const device_t gc100a_device; + /* Headland */ extern const device_t headland_gc10x_device; extern const device_t headland_ht18a_device; diff --git a/src/include/86box/machine.h b/src/include/86box/machine.h index 5ab578d04..1e7bb2cac 100644 --- a/src/include/86box/machine.h +++ b/src/include/86box/machine.h @@ -255,9 +255,6 @@ extern int machine_at_spc4620p_init(const machine_t *); extern int machine_at_kmxc02_init(const machine_t *); extern int machine_at_deskmaster286_init(const machine_t *); -extern int machine_at_olim290_init(const machine_t *); -extern int machine_at_olim290s_init(const machine_t *); - extern int machine_at_ncrpc8_init(const machine_t *); extern int machine_at_ncr3302_init(const machine_t *); @@ -269,13 +266,6 @@ extern int machine_at_spc6033p_init(const machine_t *); extern int machine_at_wd76c10_init(const machine_t *); extern int machine_at_flytech386_init(const machine_t *); -extern int machine_at_olim300_05_init(const machine_t *); -extern int machine_at_olim300_10_init(const machine_t *); -extern int machine_at_olim300_08_init(const machine_t *); -extern int machine_at_olim300_15_init(const machine_t *); - -extern int machine_at_ncrpc916sx_init(const machine_t *); - extern int machine_at_awardsx_init(const machine_t *); #if defined(DEV_BRANCH) && defined(USE_M6117) extern int machine_at_arb1375_init(const machine_t *); @@ -643,6 +633,9 @@ extern int machine_xt_laserxt_init(const machine_t *); extern int machine_xt_lxt3_init(const machine_t *); #endif +/* m_xt_philips.c */ +extern int machine_xt_p3105_init(const machine_t *); +extern int machine_xt_p3120_init(const machine_t *); /* m_xt_t1000.c */ extern int machine_xt_t1000_init(const machine_t *); extern int machine_xt_t1200_init(const machine_t *); diff --git a/src/machine/CMakeLists.txt b/src/machine/CMakeLists.txt index 7576ae130..846ab6074 100644 --- a/src/machine/CMakeLists.txt +++ b/src/machine/CMakeLists.txt @@ -14,6 +14,7 @@ # add_library(mch OBJECT machine.c machine_table.c m_xt.c m_xt_compaq.c + m_xt_philips.c m_xt_t1000.c m_xt_t1000_vid.c m_xt_xi8088.c m_xt_zenith.c m_pcjr.c m_amstrad.c m_europc.c m_xt_olivetti.c m_tandy.c m_at.c m_at_commodore.c m_at_t3100e.c m_at_t3100e_vid.c m_ps1.c m_ps1_hdc.c m_ps2_isa.c diff --git a/src/machine/m_at_286_386sx.c b/src/machine/m_at_286_386sx.c index 1c2b6526c..409f74c3e 100644 --- a/src/machine/m_at_286_386sx.c +++ b/src/machine/m_at_286_386sx.c @@ -40,6 +40,7 @@ #include <86box/sio.h> #include <86box/serial.h> #include <86box/video.h> +#include <86box/vid_cga.h> #include <86box/flash.h> #include <86box/machine.h> @@ -694,7 +695,7 @@ machine_at_ncrpc8_init(const machine_t *model) if (fdc_type == FDC_INTERNAL) device_add(&fdc_at_device); - + return ret; } @@ -735,218 +736,4 @@ machine_at_ncr3302_init(const machine_t *model) device_add(¶dise_pvga1a_ncr3302_device); return ret; -} - - -/* - * Current bugs: - * - soft-reboot after saving CMOS settings/pressing ctrl-alt-del produces an 8042 error - */ -int -machine_at_ncrpc916sx_init(const machine_t *model) -{ - int ret; - - ret = bios_load_interleaved(L"roms/machines/ncr_pc916sx/ncr_386sx_u46-17_7.3.bin", - L"roms/machines/ncr_pc916sx/ncr_386sx_u12-19_7.3.bin", - 0x000f0000, 65536, 0); - - if (bios_only || !ret) - return ret; - - machine_at_common_init(model); - - device_add(&keyboard_at_ncr_device); - mem_remap_top(384); - - if (fdc_type == FDC_INTERNAL) - device_add(&fdc_at_device); - - - return ret; -} - -/* - * Current bugs: - * - no EMS management due to missing chipset implementation (custom ASIC) - */ -int -machine_at_olim290_init(const machine_t *model) -{ - int ret; - - ret = bios_load_linear(L"roms/machines/olivetti_m290/m290_pep3_1.25.bin", - 0x000f0000, 65536, 0); - - if (bios_only || !ret) - return ret; - - machine_at_common_init(model); - device_add(&keyboard_at_olivetti_device); - - if (fdc_type == FDC_INTERNAL) - device_add(&fdc_at_device); - - device_add(&olivetti_m290_registers_device); - - return ret; -} - - -/* - * Current bugs: - * - no EMS management due to missing chipset implementation (unidentified chip) - */ -int -machine_at_olim290s_init(const machine_t *model) -{ - int ret; - - ret = bios_load_interleaved(L"roms/machines/olivetti_m290s/286-olivetti-m203-low.bin", - L"roms/machines/olivetti_m290s/286-olivetti-m203-high.bin", - 0x000e0000, 131072, 0); - - if (bios_only || !ret) - return ret; - - machine_at_common_ide_init(model); - - /* replace with correct chipset implementation */ - mem_remap_top(384); - - device_add(&keyboard_ps2_olivetti_device); - device_add(&fdc_at_device); - - /* should use custom BIOS */ - if (gfxcard == VID_INTERNAL) - device_add(¶dise_pvga1a_device); - - return ret; -} - -const device_t * -at_m300_08_get_device(void) -{ - return &oti067_m300_device; -} - -int -machine_at_olim300_08_init(const machine_t *model) -{ - int ret; - - ret = bios_load_linear(L"roms/machines/olivetti_m300_08/BIOS.ROM", - 0x000f0000, 65536, 0); - - if (bios_only || !ret) - return ret; - - machine_at_common_init(model); - - device_add(&opti283_device); - device_add(&keyboard_ps2_olivetti_device); - device_add(&pc87310_ide_device); - - if (gfxcard == VID_INTERNAL) - device_add(&oti067_m300_device); - - return ret; -} - -/* Almost identical to M300-08, save for CPU speed, VRAM, and BIOS identification string */ -int -machine_at_olim300_15_init(const machine_t *model) -{ - int ret; - - ret = bios_load_linear(L"roms/machines/olivetti_m300_15/BIOS.ROM", - 0x000f0000, 65536, 0); - - if (bios_only || !ret) - return ret; - - machine_at_common_init(model); - - device_add(&opti283_device); - device_add(&keyboard_ps2_olivetti_device); - device_add(&pc87310_ide_device); - - /* Stock VRAM is maxed out, so no need to expose video card config */ - if (gfxcard == VID_INTERNAL) - device_add(&oti067_m300_device); - - return ret; -} - - -/* - * Current bugs: - * - soft-reboot causes a fatal error - * - BIOS complains about FPU if not installed, pressing F1 allows to continue booting. - * - BIOS throws a cache memory error (since L2 cache is not implemented yet), pressing F1 allows to continue booting. - * - no shadow memory due to missing chipset implementation (custom ASIC) - */ -//todo: check if fdc can be disabled -int -machine_at_olim300_10_init(const machine_t *model) -{ - int ret; - - ret = bios_load_linear(L"roms/machines/olivetti_m300_10/BIOS.ROM", - 0x000f0000, 65536, 0); - - if (bios_only || !ret) - return ret; - - machine_at_common_ide_init(model); - - /* replace with correct chipset implementation */ - mem_remap_top(384); - - device_add(&keyboard_ps2_olivetti_device); - /* fdc should be dp8473, however it does not work. Instead, standard AT fdc works. */ - device_add(&fdc_at_device); - - /* should be a PVGA1B/WD90C00 with custom BIOS */ - if (gfxcard == VID_INTERNAL) - device_add(¶dise_wd90c11_device); - - - return ret; -} - -/* - * Current bugs: - * - soft-reboot causes a fatal error - * - BIOS complains about FPU if not installed, pressing F1 allows to continue booting. - * - no shadow memory due to missing chipset implementation (custom ASIC) - */ -int -machine_at_olim300_05_init(const machine_t *model) -{ - int ret; - - ret = bios_load_linear(L"roms/machines/olivetti_m300_05/BIOS.ROM", - 0x000f0000, 65536, 0); - - if (bios_only || !ret) - return ret; - - machine_at_common_ide_init(model); - - /* replace with correct chipset implementation */ - mem_remap_top(384); - - device_add(&keyboard_ps2_olivetti_device); - /* fdc should be dp8473, however it does not work. Instead, standard AT fdc works. */ - device_add(&fdc_at_device); - - /* should be a PVGA1B/WD90C00 with custom BIOS */ - if (gfxcard == VID_INTERNAL) - device_add(¶dise_wd90c11_device); - - - return ret; -} - - +} \ No newline at end of file diff --git a/src/machine/m_xt.c b/src/machine/m_xt.c index 7640b0932..698cc46ca 100644 --- a/src/machine/m_xt.c +++ b/src/machine/m_xt.c @@ -11,12 +11,13 @@ #include <86box/fdd.h> #include <86box/fdc.h> #include <86box/fdc_ext.h> +#include <86box/hdc.h> #include <86box/gameport.h> #include <86box/ibm_5161.h> #include <86box/keyboard.h> #include <86box/rom.h> #include <86box/machine.h> - +#include <86box/chipset.h> static void machine_xt_common_init(const machine_t *model) @@ -399,58 +400,3 @@ machine_xt_multitechpc700_init(const machine_t *model) return ret; } - -/* - * Current bugs and limitations: - * - 640-768 conventional memory not usable (should be mapped at address d0000-effff) - */ -int -machine_xt_p3105_init(const machine_t *model) -{ - int ret; - - ret = bios_load_linear(L"roms/machines/philips_p3105/philipsnms9100.bin", - 0x000fc000, 16384, 0); - - if (bios_only || !ret) - return ret; - - device_add(&keyboard_pc_device); - - machine_xt_common_init(model); - - return ret; -} - -/* - * Current bugs and limitations: - * - 640-768 conventional memory not usable (should be mapped at address d0000-effff) - * - BIOS detects 4 fdds, so hdd letter is E instead of C - */ -int -machine_xt_p3120_init(const machine_t *model) -{ - int ret; - - ret = bios_load_linear(L"roms/machines/philips_p3120/philips_p3120.bin", - 0x000f8000, 32768, 0); - - if (bios_only || !ret) - return ret; - - device_add(&keyboard_pc_device); - - machine_common_init(model); - - pit_ctr_set_out_func(&pit->counters[1], pit_refresh_timer_xt); - - if (fdc_type == FDC_INTERNAL) - device_add(&fdc_at_device); - - nmi_init(); - - if (joystick_type) - device_add(&gameport_device); - - return ret; -} \ No newline at end of file diff --git a/src/machine/m_xt_olivetti.c b/src/machine/m_xt_olivetti.c index 27716cd8c..ec2cfb8e9 100644 --- a/src/machine/m_xt_olivetti.c +++ b/src/machine/m_xt_olivetti.c @@ -771,7 +771,7 @@ machine_xt_olim240_init(const machine_t *model) */ device_add(&keyboard_at_olivetti_device); - /* FIXME: make sure this is correct?? */ + /* FIXME: make sure this is correct?? */ device_add(&at_nvr_device); if (fdc_type == FDC_INTERNAL) @@ -822,39 +822,3 @@ machine_xt_olim19_init(const machine_t *model) return ret; } - - -/* not working, returns timer error */ -/* it appears to be a rebadged Hitachi HL 320 laptop */ -int -machine_xt_olim15_init(const machine_t *model) -{ - int ret; - - ret = bios_load_linear(L"roms/machines/olivetti_m15/oliv_m15.bin", - 0x000fc000, 16384, 0); - - if (bios_only || !ret) - return ret; - - machine_common_init(model); - - pit_ctr_set_out_func(&pit->counters[1], pit_refresh_timer_xt); - - device_add(&keyboard_xt_olivetti_device); - - device_add(&cga_device); - - /* FIXME: make sure this is correct?? */ - //device_add(&at_nvr_device); - - if (fdc_type == FDC_INTERNAL) - device_add(&fdc_xt_device); - - if (joystick_type) - device_add(&gameport_device); - - nmi_init(); - - return ret; -} \ No newline at end of file diff --git a/src/machine/m_xt_philips.c b/src/machine/m_xt_philips.c new file mode 100644 index 000000000..722b117ee --- /dev/null +++ b/src/machine/m_xt_philips.c @@ -0,0 +1,204 @@ +/* + * 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 + * system designs based on the PCI bus. + * + * This file is part of the 86Box distribution. + * + * Emulation of the Philips XT-compatible machines. + * + * + * + * Authors: EngiNerd + * + * Copyright 2020-2021 EngiNerd. + */ + +#include +#include +#include +#include +#include +#include +#define HAVE_STDARG_H +#include <86box/86box.h> +#include <86box/nmi.h> +#include <86box/timer.h> +#include <86box/pit.h> +#include <86box/mem.h> +#include <86box/device.h> +#include <86box/fdd.h> +#include <86box/fdc.h> +#include <86box/fdc_ext.h> +#include <86box/hdc.h> +#include <86box/gameport.h> +#include <86box/ibm_5161.h> +#include <86box/keyboard.h> +#include <86box/rom.h> +#include <86box/machine.h> +#include <86box/chipset.h> +#include <86box/io.h> +#include <86box/video.h> + +typedef struct +{ + uint8_t reg; +} philips_t; + +#define ENABLE_philips_LOG 1 + +#ifdef ENABLE_philips_LOG +int philips_do_log = ENABLE_philips_LOG; +static void +philips_log(const char *fmt, ...) +{ + va_list ap; + + if (philips_do_log) { + va_start(ap, fmt); + pclog_ex(fmt, ap); + va_end(ap); + } +} +#else +#define philips_log(fmt, ...) +#endif + +static void +philips_write(uint16_t port, uint8_t val, void *priv) +{ + philips_t *dev = (philips_t *) priv; + + switch (port) + { + /* port 0xc0 + * bit 7: turbo + * bits 4-5: rtc read/set + * bit 2: parity disabled + */ + case 0xc0: + dev->reg = val; + if (val & 0x80) + cpu_dynamic_switch(cpu); + else + cpu_dynamic_switch(0); + break; + } + + philips_log("Philips XT Mainboard: Write %02x at %02x\n", val, port); + +} + +static uint8_t +philips_read(uint16_t port, void *priv) +{ + philips_t *dev = (philips_t *) priv; + uint8_t ret = 0xff; + + switch (port) + { + /* port 0xc0 + * bit 7: turbo + * bits 4-5: rtc read/set + * bit 2: parity disabled + */ + case 0xc0: + ret = dev->reg; + break; + + } + + philips_log("Philips XT Mainboard: Read %02x at %02x\n", ret, port); + + return ret; +} + + +static void +philips_close(void *priv) +{ + philips_t *dev = (philips_t *) priv; + + free(dev); +} + +static void * +philips_init(const device_t *info) +{ + philips_t *dev = (philips_t *) malloc(sizeof(philips_t)); + memset(dev, 0, sizeof(philips_t)); + + dev->reg = 0x40; + + io_sethandler(0x0c0, 0x01, philips_read, NULL, NULL, philips_write, NULL, NULL, dev); + + return dev; +} + +const device_t philips_device = { + "Philips XT Mainboard", + 0, + 0, + philips_init, philips_close, NULL, + { NULL }, NULL, NULL, + NULL +}; + + +void +machine_xt_philips_common_init(const machine_t *model) +{ + machine_common_init(model); + + pit_ctr_set_out_func(&pit->counters[1], pit_refresh_timer_xt); + + if (fdc_type == FDC_INTERNAL) + device_add(&fdc_xt_device); + + nmi_init(); + + if (joystick_type) + device_add(&gameport_device); + + device_add(&keyboard_pc_device); + + device_add(&philips_device); + + device_add(&xta_hd20_device); + +} + +machine_xt_p3105_init(const machine_t *model) +{ + int ret; + + ret = bios_load_linear(L"roms/machines/philips_p3105/philipsnms9100.bin", + 0x000fc000, 16384, 0); + + if (bios_only || !ret) + return ret; + + machine_xt_philips_common_init(model); + + return ret; +} + +int +machine_xt_p3120_init(const machine_t *model) +{ + int ret; + + ret = bios_load_linear(L"roms/machines/philips_p3120/philips_p3120.bin", + 0x000f8000, 32768, 0); + + if (bios_only || !ret) + return ret; + + machine_xt_philips_common_init(model); + + device_add(&gc100a_device); + + return ret; +} + diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index 6c7928da4..80633bacc 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -73,8 +73,7 @@ const machine_t machines[] = { { "[8088] NCR PC4i", "ncr_pc4i", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 256, 640, 256, 0, machine_xt_ncrpc4i_init, NULL }, { "[8088] Olivetti M19", "olivetti_m19", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 7159092, 0, 0, 0, 0, MACHINE_PC | MACHINE_VIDEO_FIXED, 256, 640, 256, 0, machine_xt_olim19_init, NULL }, { "[8088] OpenXT", "open_xt", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 64, 640, 64, 0, machine_xt_open_xt_init, NULL }, - { "[8088] Philips P3105/NMS9100", "philips_p3105", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 256, 768, 256, 0, machine_xt_p3105_init, NULL }, - { "[8088] Philips P3120", "philips_p3120", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 256, 768, 256, 0, machine_xt_p3120_init, NULL }, + { "[8088] Philips P3105/NMS9100", "philips_p3105", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC | MACHINE_XTA, 256, 768, 128, 0, machine_xt_p3105_init, NULL }, { "[8088] Phoenix XT clone", "pxxt", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 64, 640, 64, 0, machine_xt_pxxt_init, NULL }, { "[8088] Schneider EuroPC", "europc", MACHINE_TYPE_8088, CPU_PKG_8088_EUROPC, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC | MACHINE_XTA | MACHINE_MOUSE, 512, 640, 128, 15, machine_europc_init, NULL }, { "[8088] Tandy 1000", "tandy", MACHINE_TYPE_8088, CPU_PKG_8088_EUROPC, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC | MACHINE_VIDEO_FIXED, 128, 640, 128, 0, machine_tandy_init, tandy1k_get_device }, @@ -87,6 +86,7 @@ const machine_t machines[] = { { "[8088] Zenith Data Systems Z-151/152/161", "zdsz151", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 128, 640, 64, 0, machine_xt_z151_init, NULL }, { "[8088] Zenith Data Systems Z-159", "zdsz159", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 128, 640, 64, 0, machine_xt_z159_init, NULL }, { "[8088] Zenith Data Systems SupersPort (Z-184)", "zdsupers", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC | MACHINE_VIDEO_FIXED, 128, 640, 128, 0, machine_xt_z184_init, z184_get_device }, + { "[GC100A] Philips P3120", "philips_p3120", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC | MACHINE_XTA, 256, 768, 128, 0, machine_xt_p3120_init, NULL }, /* 8086 Machines */ { "[8086] Amstrad PC1512", "pc1512", MACHINE_TYPE_8086, CPU_PKG_8086, 0, 8000000, 8000000, 0, 0, 0, 0, MACHINE_PC | MACHINE_VIDEO_FIXED | MACHINE_MOUSE, 512, 640, 128, 63, machine_pc1512_init, pc1512_get_device }, @@ -122,7 +122,6 @@ const machine_t machines[] = { { "[ISA] Compaq Portable III", "portableiii", MACHINE_TYPE_286, CPU_PKG_286, 0, 0, 0, 0, 0, 0, 0, MACHINE_AT | MACHINE_VIDEO, 640, 16384, 128, 127, machine_at_portableiii_init, at_cpqiii_get_device }, { "[ISA] MR 286 clone", "mr286", MACHINE_TYPE_286, CPU_PKG_286, 0, 0, 0, 0, 0, 0, 0, MACHINE_AT | MACHINE_IDE, 512, 16384, 128, 127, machine_at_mr286_init, NULL }, { "[ISA] NCR PC8/810/710/3390/3392", "ncr_pc8", MACHINE_TYPE_286, CPU_PKG_286, 0, 0, 0, 0, 0, 0, 0, MACHINE_AT, 512, 16384, 128, 127, machine_at_ncrpc8_init, NULL }, - { "[ISA] Olivetti M290", "olivetti_m290", MACHINE_TYPE_286, CPU_PKG_286, 0, 0, 0, 0, 0, 0, 0, MACHINE_AT, 640, 16384, 128, 127, machine_at_olim290_init, NULL }, #if defined(DEV_BRANCH) && defined(USE_OPEN_AT) { "[ISA] OpenAT", "open_at", MACHINE_TYPE_286, CPU_PKG_286, 0, 0, 0, 0, 0, 0, 0, MACHINE_AT, 256, 15872, 128, 63, machine_at_open_at_init, NULL }, #endif @@ -143,7 +142,6 @@ const machine_t machines[] = { { "[SCAT] Samsung SPC-4216P", "spc4216p", MACHINE_TYPE_286, CPU_PKG_286, 0, 0, 0, 0, 0, 0, 0, MACHINE_AT | MACHINE_BUS_PS2, 1024, 5120,1024, 127, machine_at_spc4216p_init, NULL }, { "[SCAT] Samsung SPC-4620P", "spc4620p", MACHINE_TYPE_286, CPU_PKG_286, 0, 0, 0, 0, 0, 0, 0, MACHINE_AT | MACHINE_BUS_PS2 | MACHINE_VIDEO, 1024, 5120,1024, 127, machine_at_spc4620p_init, NULL }, { "[SCAT] Samsung Deskmaster 286", "deskmaster286", MACHINE_TYPE_286, CPU_PKG_286, 0, 0, 0, 0, 0, 0, 0, MACHINE_AT, 512, 16384, 128, 127, machine_at_deskmaster286_init, NULL }, - { "[TACT82300] Olivetti M290S", "olivetti_m290s", MACHINE_TYPE_286, CPU_PKG_286, 0, 16000000, 16000000, 0, 0, 0, 0, MACHINE_AT | MACHINE_BUS_PS2 | MACHINE_IDE | MACHINE_VIDEO, 1024,16384, 512, 127, machine_at_olim290s_init, NULL }, /* 286 machines that utilize the MCA bus */ { "[MCA] IBM PS/2 model 50", "ibmps2_m50", MACHINE_TYPE_286, CPU_PKG_286 | CPU_PKG_486SLC_IBM, 0, 10000000, 0, 0, 0, 0, 0, MACHINE_MCA | MACHINE_BUS_PS2 | MACHINE_VIDEO, 1024, 10240,1024, 63, machine_ps2_model_50_init, NULL }, @@ -151,8 +149,6 @@ const machine_t machines[] = { /* 386SX machines */ { "[ISA] IBM PS/1 model 2121", "ibmps1_2121", MACHINE_TYPE_386SX, CPU_PKG_386SX, 0, 0, 0, 0, 0, 0, 0, MACHINE_AT | MACHINE_BUS_PS2 | MACHINE_IDE | MACHINE_VIDEO_FIXED, 2048, 6144,1024, 63, machine_ps1_m2121_init, NULL }, { "[ISA] IBM PS/1 m.2121+ISA", "ibmps1_2121_isa", MACHINE_TYPE_386SX, CPU_PKG_386SX, 0, 0, 0, 0, 0, 0, 0, MACHINE_AT | MACHINE_BUS_PS2 | MACHINE_IDE | MACHINE_VIDEO, 2048, 6144,1024, 63, machine_ps1_m2121_init, NULL }, - { "[ISA] Olivetti M300-01/05", "olivetti_m300_05", MACHINE_TYPE_386SX, CPU_PKG_386SX, 0, 16000000, 16000000, 0, 0, 0, 0, MACHINE_AT | MACHINE_BUS_PS2 | MACHINE_IDE | MACHINE_VIDEO, 1024, 11264,1024, 127, machine_at_olim300_05_init, NULL }, - { "[ISA] Olivetti M300-10", "olivetti_m300_10", MACHINE_TYPE_386SX, CPU_PKG_386SX, 0, 20000000, 20000000, 0, 0, 0, 0, MACHINE_AT | MACHINE_BUS_PS2 | MACHINE_IDE | MACHINE_VIDEO, 2048, 12288,1024, 127, machine_at_olim300_10_init, NULL }, #if defined(DEV_BRANCH) && defined(USE_M6117) { "[ALi M6117D] Acrosser AR-B1375", "arb1375", MACHINE_TYPE_386SX, CPU_PKG_M6117, 0, 0, 0, 0, 0, 0, 0, MACHINE_AT | MACHINE_BUS_PS2 | MACHINE_IDE, 1024, 32768,1024, 127, machine_at_arb1375_init, NULL }, { "[ALi M6117D] Acrosser PJ-A511M", "pja511m", MACHINE_TYPE_386SX, CPU_PKG_M6117, 0, 0, 0, 0, 0, 0, 0, MACHINE_AT | MACHINE_BUS_PS2 | MACHINE_IDE, 1024, 32768,1024, 127, machine_at_pja511m_init, NULL }, @@ -163,13 +159,10 @@ const machine_t machines[] = { { "[Intel 82335] Shuttle 386SX", "shuttle386sx", MACHINE_TYPE_386SX, CPU_PKG_386SX, 0, 0, 0, 0, 0, 0, 0, MACHINE_AT, 512, 8192, 128, 127, machine_at_shuttle386sx_init, NULL }, { "[NEAT] Commodore SL386SX-16", "cbm_sl386sx16", MACHINE_TYPE_386SX, CPU_PKG_386SX, 0, 0, 0, 0, 0, 0, 0, MACHINE_AT | MACHINE_BUS_PS2 | MACHINE_IDE, 1024, 8192, 512, 127, machine_at_commodore_sl386sx16_init, NULL }, { "[NEAT] DTK 386SX clone", "dtk386", MACHINE_TYPE_386SX, CPU_PKG_386SX, 0, 0, 0, 0, 0, 0, 0, MACHINE_AT, 512, 8192, 128, 127, machine_at_neat_init, NULL }, - { "[OPTi 283] Olivetti M300-08", "olivetti_m300_08", MACHINE_TYPE_386SX, CPU_PKG_386SX, 0, 20000000, 20000000, 0, 0, 0, 0, MACHINE_AT | MACHINE_BUS_PS2 | MACHINE_IDE | MACHINE_VIDEO, 2048, 16384, 2048, 127, machine_at_olim300_08_init, at_m300_08_get_device }, - { "[OPTi 283] Olivetti M300-15", "olivetti_m300_15", MACHINE_TYPE_386SX, CPU_PKG_386SX, 0, 25000000, 25000000, 0, 0, 0, 0, MACHINE_AT | MACHINE_BUS_PS2 | MACHINE_IDE | MACHINE_VIDEO, 2048, 16384, 2048, 127, machine_at_olim300_15_init, NULL }, { "[OPTi 291] DTK PPM-3333P", "awardsx", MACHINE_TYPE_386SX, CPU_PKG_386SX, 0, 0, 0, 0, 0, 0, 0, MACHINE_AT, 1024, 16384, 1024, 127, machine_at_awardsx_init, NULL }, { "[SCAMP] Commodore SL386SX-25", "cbm_sl386sx25", MACHINE_TYPE_386SX, CPU_PKG_386SX, 0, 0, 0, 0, 0, 0, 0, MACHINE_AT | MACHINE_BUS_PS2 | MACHINE_IDE | MACHINE_VIDEO, 1024, 8192, 512, 127, machine_at_commodore_sl386sx25_init, at_commodore_sl386sx25_get_device }, { "[SCAMP] Samsung SPC-6033P", "spc6033p", MACHINE_TYPE_386SX, CPU_PKG_386SX, 0, 0, 0, 0, 0, 0, 0, MACHINE_AT | MACHINE_BUS_PS2 | MACHINE_IDE | MACHINE_VIDEO, 2048, 12288, 2048, 127, machine_at_spc6033p_init, at_spc6033p_get_device }, { "[SCAT] KMX-C-02", "kmxc02", MACHINE_TYPE_386SX, CPU_PKG_386SX, 0, 0, 0, 0, 0, 0, 0, MACHINE_AT, 512, 16384, 512, 127, machine_at_kmxc02_init, NULL }, - { "[TACT82300] NCR PC916SX", "ncr_pc916sx", MACHINE_TYPE_386SX, CPU_PKG_386SX, 0, 0, 0, 0, 0, 0, 0, MACHINE_AT, 1024, 16384, 128, 127, machine_at_ncrpc916sx_init, NULL }, { "[WD76C10] Amstrad MegaPC", "megapc", MACHINE_TYPE_386SX, CPU_PKG_386SX, 0, 0, 0, 0, 0, 0, 0, MACHINE_AT | MACHINE_BUS_PS2 | MACHINE_IDE | MACHINE_VIDEO, 1024, 32768, 1024, 127, machine_at_wd76c10_init, NULL }, /* 386SX machines which utilize the MCA bus */ diff --git a/src/win/Makefile.mingw b/src/win/Makefile.mingw index 241e0e2c2..67247e886 100644 --- a/src/win/Makefile.mingw +++ b/src/win/Makefile.mingw @@ -619,10 +619,12 @@ CHIPSETOBJ := acc2168.o cs8230.o ali1217.o ali1429.o headland.o intel_82335.o cs intel_420ex.o intel_4x0.o intel_sio.o intel_piix.o ioapic.o \ neat.o opti495.o opti895.o opti5x7.o scamp.o scat.o via_vt82c49x.o via_vt82c505.o \ sis_85c310.o sis_85c4xx.o sis_85c496.o sis_85c50x.o opti283.o opti291.o \ + gc100.o \ via_apollo.o via_pipc.o wd76c10.o vl82c480.o MCHOBJ := machine.o machine_table.o \ m_xt.o m_xt_compaq.o \ + m_xt_philips.o \ m_xt_t1000.o m_xt_t1000_vid.o \ m_xt_xi8088.o m_xt_zenith.o \ m_pcjr.o \ @@ -644,9 +646,9 @@ DEVOBJ := bugger.o hwm.o hwm_lm75.o hwm_lm78.o hwm_gl518sm.o hwm_vt82c686.o ibm keyboard.o \ keyboard_xt.o keyboard_at.o \ mouse.o \ - mouse_bus.o \ + mouse_bus.o \ mouse_serial.o mouse_ps2.o \ - phoenix_486_jumper.o olivetti_m290_registers.o + phoenix_486_jumper.o SIOOBJ := sio_acc3221.o \ sio_f82c710.o sio_82091aa.o \