From 643f9b46ea5ba2e3f2ff6d183de6e5188d262829 Mon Sep 17 00:00:00 2001 From: EngiNerd89 Date: Sat, 19 Dec 2020 12:16:42 +0100 Subject: [PATCH 1/2] Added the following new machines: - Zenith Data Systems Z-151/152/161 - Zenith Data Systems Z-159 - Columbia Data Products MPC-1600 - Eagle PC Spirit Minor tweaks and renamings --- src/device/keyboard_xt.c | 145 +++++++++++++++++++++++++++-------- src/include/86box/keyboard.h | 1 + src/include/86box/machine.h | 14 +++- src/machine/m_xt.c | 45 ++++++++++- src/machine/m_xt_zenith.c | 91 +++++++++++++++++++--- src/machine/machine_table.c | 6 +- 6 files changed, 255 insertions(+), 47 deletions(-) diff --git a/src/device/keyboard_xt.c b/src/device/keyboard_xt.c index 9a234b6eb..9c8a9351b 100644 --- a/src/device/keyboard_xt.c +++ b/src/device/keyboard_xt.c @@ -352,6 +352,34 @@ kbd_log(const char *fmt, ...) #define kbd_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 kbd_poll(void *priv) @@ -530,6 +558,7 @@ kbd_read(uint16_t port, void *priv) { xtkbd_t *kbd = (xtkbd_t *)priv; uint8_t ret = 0xff; + switch (port) { case 0x60: @@ -537,9 +566,28 @@ kbd_read(uint16_t port, void *priv) ret = (kbd->pd & ~0x02) | (hasfpu ? 0x02 : 0x00); else if (((kbd->type == 2) || (kbd->type == 3)) && (kbd->pb & 0x80)) ret = 0xff; /* According to Ruud on the PCem forum, this is supposed to return 0xFF on the XT. */ - else - ret = kbd->pa; - break; + else if ((kbd->type == 9) && (kbd->pb & 0x80)) { + /* Zenith Data Systems Z-151 + * SW1 switch settings: + * bits 6-7: floppy drive number + * bits 4-5: video mode + * bit 2-3: base memory size + * bit 1: fpu enable + * bit 0: fdc enable + */ + ret = get_fdd_switch_settings(); + + ret |= get_videomode_switch_settings(); + + /* base memory size should always be 64k */ + ret |= 0x0c; + + if (hasfpu) + ret |= 0x02; + + } else + ret = kbd->pa; + break; case 0x61: ret = kbd->pb; @@ -548,18 +596,20 @@ kbd_read(uint16_t port, void *priv) case 0x62: if (kbd->type == 0) ret = 0x00; - else if (kbd->type == 1) { + else if (kbd->type == 1) { if (kbd->pb & 0x04) ret = ((mem_size-64) / 32) & 0x0f; else ret = ((mem_size-64) / 32) >> 4; } - else if (kbd->type == 8) { - /* Olivetti M19 */ + else if (kbd->type == 8 || kbd->type == 9) { + /* Olivetti M19 or Zenith Data Systems Z-151*/ if (kbd->pb & 0x04) - ret = kbd->pd; + ret = kbd->pd & 0xbf; + //return 0x00; else ret = kbd->pd >> 4; + //return 0x00; } else { if (kbd->pb & 0x08) @@ -589,6 +639,7 @@ kbd_read(uint16_t port, void *priv) case 0x63: if ((kbd->type == 2) || (kbd->type == 3) || (kbd->type == 4) || (kbd->type == 6)) ret = kbd->pd; + break; } @@ -616,8 +667,6 @@ kbd_reset(void *priv) static void * kbd_init(const device_t *info) { - int i, fdd_count = 0; - xtkbd_t *kbd; kbd = (xtkbd_t *)malloc(sizeof(xtkbd_t)); @@ -634,33 +683,21 @@ kbd_init(const device_t *info) video_reset(gfxcard); if (kbd->type <= 3 || kbd-> type == 8) { - for (i = 0; i < FDD_NUM; i++) { - if (fdd_get_flags(i)) - fdd_count++; - } - + /* DIP switch readout: bit set = OFF, clear = ON. */ if (kbd->type != 8) /* Switches 7, 8 - floppy drives. */ - if (!fdd_count) - kbd->pd = 0x00; - else - kbd->pd = ((fdd_count - 1) << 6) | 0x01; + kbd->pd = get_fdd_switch_settings(); else - /* Jumpers J1, J2 - monitor type. - * 01 - mono (high-res) - * 10 - color (low-res, disables 640x400x2 mode) - * 00 - autoswitching - */ + /* Olivetti M19 + * Jumpers J1, J2 - monitor type. + * 01 - mono (high-res) + * 10 - color (low-res, disables 640x400x2 mode) + * 00 - autoswitching + */ kbd->pd |= 0x00; - /* Switches 5, 6 - video. */ - if (video_is_mda()) - kbd->pd |= 0x30; - else if (video_is_cga()) - kbd->pd |= 0x20; /* 0x10 would be 40x25 */ - else - kbd->pd |= 0x00; + kbd->pd |= get_videomode_switch_settings(); /* Switches 3, 4 - memory size. */ // Note to Compaq/Toshiba keyboard maintainers: type 4 and 6 will never be activated in this block @@ -721,6 +758,44 @@ kbd_init(const device_t *info) /* Switch 1 - always off. */ kbd->pd |= 0x01; + } else if (kbd-> type == 9) { + /* Zenith Data Systems Z-151 + * SW2 switch settings: + * bit 7: monitor frequency + * bits 5-6: autoboot (00-11 resident monitor, 10 hdd, 01 fdd) + * bits 0-4: installed memory + */ + kbd->pd = 0x20; + switch (mem_size) { + case 128: + kbd->pd |= 0x02; + break; + case 192: + kbd->pd |= 0x04; + break; + case 256: + kbd->pd |= 0x02|0x04; + break; + case 320: + kbd->pd |= 0x08; + break; + case 384: + kbd->pd |= 0x02|0x08; + break; + case 448: + kbd->pd |= 0x04|0x08; + break; + case 512: + kbd->pd |= 0x02|0x04|0x08; + break; + case 576: + kbd->pd |= 0x10; + break; + case 640: + default: + kbd->pd |= 0x02|0x10; + break; + } } timer_add(&kbd->send_delay_timer, kbd_poll, kbd, 1); @@ -844,3 +919,13 @@ const device_t keyboard_xt_olivetti_device = { kbd_reset, { NULL }, NULL, NULL }; + +const device_t keyboard_xt_zenith_device = { + "Zenith XT Keyboard", + 0, + 9, + kbd_init, + kbd_close, + kbd_reset, + { NULL }, NULL, NULL +}; diff --git a/src/include/86box/keyboard.h b/src/include/86box/keyboard.h index 3785a8f6d..126e50afc 100644 --- a/src/include/86box/keyboard.h +++ b/src/include/86box/keyboard.h @@ -69,6 +69,7 @@ extern const device_t keyboard_tandy_device; extern const device_t keyboard_xt_lxt3_device; #endif extern const device_t keyboard_xt_olivetti_device; +extern const device_t keyboard_xt_zenith_device; extern const device_t keyboard_at_device; extern const device_t keyboard_at_ami_device; extern const device_t keyboard_at_toshiba_device; diff --git a/src/include/86box/machine.h b/src/include/86box/machine.h index d920ef494..25811a9c6 100644 --- a/src/include/86box/machine.h +++ b/src/include/86box/machine.h @@ -511,10 +511,13 @@ extern const device_t europc_device; /* m_xt_olivetti.c */ extern int machine_xt_olim24_init(const machine_t *); +#ifdef EMU_DEVICE_H +extern const device_t *m24_get_device(void); +#endif extern int machine_xt_olim240_init(const machine_t *); extern int machine_xt_olim19_init(const machine_t *); #ifdef EMU_DEVICE_H -extern const device_t *m24_get_device(void); +extern const device_t *m19_get_device(void); #endif /* m_pcjr.c */ @@ -579,6 +582,8 @@ extern int machine_xt_jukopc_init(const machine_t *); extern int machine_xt_open_xt_init(const machine_t *); extern int machine_xt_pxxt_init(const machine_t *); extern int machine_xt_ncrpc4i_init(const machine_t *); +extern int machine_xt_mpc1600_init(const machine_t *); +extern int machine_xt_eaglepcspirit_init(const machine_t *); extern int machine_xt_iskra3104_init(const machine_t *); @@ -606,7 +611,12 @@ extern const device_t *t1200_get_device(void); #endif /* m_xt_zenith.c */ -extern int machine_xt_zenith_init(const machine_t *); +extern int machine_xt_z184_init(const machine_t *); +#ifdef EMU_DEVICE_H +extern const device_t *z184_get_device(void); +#endif +extern int machine_xt_z151_init(const machine_t *); +extern int machine_xt_z159_init(const machine_t *); /* m_xt_xi8088.c */ extern int machine_xt_xi8088_init(const machine_t *); diff --git a/src/machine/m_xt.c b/src/machine/m_xt.c index e94c7bc28..c5c1acc1c 100644 --- a/src/machine/m_xt.c +++ b/src/machine/m_xt.c @@ -26,11 +26,11 @@ machine_xt_common_init(const machine_t *model) pit_ctr_set_out_func(&pit->counters[1], pit_refresh_timer_xt); if (fdc_type == FDC_INTERNAL) - device_add(&fdc_xt_device); + device_add(&fdc_xt_device); nmi_init(); if (joystick_type) - device_add(&gameport_device); + device_add(&gameport_device); } @@ -332,12 +332,51 @@ machine_xt_ncrpc4i_init(const machine_t *model) 0x000fc000, 16384, 0); if (bios_only || !ret) - return ret; + return ret; machine_xt_clone_init(model); return ret; } +int +machine_xt_mpc1600_init(const machine_t *model) +{ + int ret; + + ret = bios_load_linear(L"roms/machines/mpc1600/mpc4.34_merged.bin", + 0x000fc000, 16384, 0); + + if (bios_only || !ret) + return ret; + + device_add(&keyboard_pc82_device); + + machine_xt_common_init(model); + + return ret; +} +int +machine_xt_eaglepcspirit_init(const machine_t *model) +{ + int ret; + + ret = bios_load_linear(L"roms/machines/eagle_pcspirit/u1101.bin", + 0x000fe000, 16384, 0); + + if (ret) { + bios_load_aux_linear(L"roms/machines/eagle_pcspirit/u1103.bin", + 0x000fc000, 8192, 0); + } + + if (bios_only || !ret) + return ret; + + device_add(&keyboard_pc82_device); + + machine_xt_common_init(model); + + return ret; +} \ No newline at end of file diff --git a/src/machine/m_xt_zenith.c b/src/machine/m_xt_zenith.c index 7b7ea2409..6e5ac1729 100644 --- a/src/machine/m_xt_zenith.c +++ b/src/machine/m_xt_zenith.c @@ -42,6 +42,8 @@ #include <86box/lpt.h> #include <86box/serial.h> #include <86box/machine.h> +#include <86box/io.h> +#include <86box/vid_cga.h> typedef struct { @@ -105,8 +107,36 @@ static const device_t zenith_scratchpad_device = { }; +void +machine_zenith_init(const machine_t *model){ + + machine_common_init(model); + + if (fdc_type == FDC_INTERNAL) + device_add(&fdc_xt_device); + + device_add(&zenith_scratchpad_device); + + pit_ctr_set_out_func(&pit->counters[1], pit_refresh_timer_xt); + + device_add(&keyboard_xt_zenith_device); + + nmi_init(); + +} + +const device_t * +z184_get_device(void) +{ + return &cga_device; +} + +/* + * Current bugs and limitations: + * - missing NVRAM implementation + */ int -machine_xt_zenith_init(const machine_t *model) +machine_xt_z184_init(const machine_t *model) { int ret; @@ -114,22 +144,61 @@ machine_xt_zenith_init(const machine_t *model) 0x000f8000, 32768, 0); if (bios_only || !ret) - return ret; + return ret; - machine_common_init(model); - - if (fdc_type == FDC_INTERNAL) - device_add(&fdc_xt_device); + machine_zenith_init(model); lpt1_remove(); /* only one parallel port */ lpt2_remove(); lpt1_init(0x278); device_add(&i8250_device); serial_set_next_inst(2); /* So that serial_standalone_init() won't do anything. */ - device_add(&zenith_scratchpad_device); - pit_ctr_set_out_func(&pit->counters[1], pit_refresh_timer_xt); - device_add(&keyboard_xt_compaq_device); - nmi_init(); - + + device_add(&cga_device); + return ret; } + +int +machine_xt_z151_init(const machine_t *model) +{ + int ret; + ret = bios_load_linear(L"roms/machines/zdsz151/444-229-18.bin", + 0x000fc000, 32768, 0); + if (ret) { + bios_load_aux_linear(L"roms/machines/zdsz151/444-260-18.bin", + 0x000f8000, 16384, 0); + } + + if (bios_only || !ret) + return ret; + + machine_zenith_init(model); + + return ret; +} + +/* + * Current bugs and limitations: + * - Memory board support for EMS currently missing + */ +int +machine_xt_z159_init(const machine_t *model) +{ + int ret; + + ret = bios_load_linear(L"roms/machines/zdsz159/z159m v2.9e.10d", + 0x000f8000, 32768, 0); + + if (bios_only || !ret) + return ret; + + machine_zenith_init(model); + + /* parallel port is on the memory board */ + lpt1_remove(); /* only one parallel port */ + lpt2_remove(); + lpt1_init(0x278); + + return ret; +} \ No newline at end of file diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index c852b0057..5504b69a3 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -56,6 +56,8 @@ const machine_type_t machine_types[] = { const machine_t machines[] = { /* 8088 Machines */ + { "[8088] Columbia Data Products MPC-1600", "mpc1600", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 128, 512, 64, 0, machine_xt_mpc1600_init, NULL }, + { "[8088] Eagle PC Spirit", "eagle_pcspirit", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 128, 640, 64, 0, machine_xt_eaglepcspirit_init, NULL }, { "[8088] IBM PC (1981)", "ibmpc", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 16, 64, 16, 0, machine_pc_init, NULL }, { "[8088] IBM PC (1982)", "ibmpc82", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 256, 256, 256, 0, machine_pc82_init, NULL }, { "[8088] IBM PCjr", "ibmpcjr", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC | MACHINE_VIDEO_FIXED, 128, 640, 128, 0, machine_pcjr_init, pcjr_get_device }, @@ -79,7 +81,9 @@ const machine_t machines[] = { { "[8088] VTech Laser Turbo XT", "ltxt", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 256, 640, 256, 0, machine_xt_laserxt_init, NULL }, #endif { "[8088] Xi8088", "xi8088", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_AT | MACHINE_BUS_PS2, 64, 1024, 128, 127, machine_xt_xi8088_init, xi8088_get_device }, - { "[8088] Zenith Data SupersPort", "zdsupers", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 128, 640, 128, 0, machine_xt_zenith_init, NULL }, + { "[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 }, /* 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 }, From 51009d8e2850b1ffa158f7a648cfc5732361b04a Mon Sep 17 00:00:00 2001 From: EngiNerd89 Date: Sat, 19 Dec 2020 21:17:11 +0100 Subject: [PATCH 2/2] Added the following new machines: - Multitech pc-700 - Philips P3105/NMS9100 - Philips P3120 --- src/include/86box/machine.h | 3 ++ src/machine/m_xt.c | 74 +++++++++++++++++++++++++++++++++++++ src/machine/machine_table.c | 3 ++ 3 files changed, 80 insertions(+) diff --git a/src/include/86box/machine.h b/src/include/86box/machine.h index 25811a9c6..e2dc4aee6 100644 --- a/src/include/86box/machine.h +++ b/src/include/86box/machine.h @@ -584,6 +584,9 @@ extern int machine_xt_pxxt_init(const machine_t *); extern int machine_xt_ncrpc4i_init(const machine_t *); extern int machine_xt_mpc1600_init(const machine_t *); extern int machine_xt_eaglepcspirit_init(const machine_t *); +extern int machine_xt_multitechpc700_init(const machine_t *); +extern int machine_xt_p3105_init(const machine_t *); +extern int machine_xt_p3120_init(const machine_t *); extern int machine_xt_iskra3104_init(const machine_t *); diff --git a/src/machine/m_xt.c b/src/machine/m_xt.c index c5c1acc1c..7640b0932 100644 --- a/src/machine/m_xt.c +++ b/src/machine/m_xt.c @@ -378,5 +378,79 @@ machine_xt_eaglepcspirit_init(const machine_t *model) machine_xt_common_init(model); + return ret; +} + +int +machine_xt_multitechpc700_init(const machine_t *model) +{ + int ret; + + ret = bios_load_linear(L"roms/machines/multitech_pc700/multitech pc-700 3.1.bin", + 0x000fe000, 8192, 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) + */ +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/machine_table.c b/src/machine/machine_table.c index 5504b69a3..1ff1b99ee 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -69,9 +69,12 @@ const machine_t machines[] = { { "[8088] DTK XT clone", "dtk", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 64, 640, 64, 0, machine_xt_dtk_init, NULL }, { "[8088] Generic XT clone", "genxt", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 64, 640, 64, 0, machine_genxt_init, NULL }, { "[8088] Juko XT clone", "jukopc", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 64, 640, 64, 0, machine_xt_jukopc_init, NULL }, + { "[8088] Multitech PC-700", "multitech_pc700", MACHINE_TYPE_8088, CPU_PKG_8088, 0, 0, 0, 0, 0, 0, 0, MACHINE_PC, 128, 640, 64, 0, machine_xt_multitechpc700_init, NULL }, { "[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, 0, 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] 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 },