From 41ba4ee86b8d84ba176dee1fde4e827f55732f08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laci=20b=C3=A1?= Date: Sun, 5 Dec 2021 11:48:31 +0100 Subject: [PATCH 1/5] Fix that POST card's message is disappearing when language/iconset change occurs --- src/include/86box/ui.h | 1 + src/unix/unix.c | 6 ++++++ src/win/win_preferences.c | 3 ++- src/win/win_stbar.c | 8 +++++++- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/include/86box/ui.h b/src/include/86box/ui.h index 8b4e77fcd..256ae6002 100644 --- a/src/include/86box/ui.h +++ b/src/include/86box/ui.h @@ -66,6 +66,7 @@ extern void ui_status_update(void); extern int ui_sb_find_part(int tag); extern void ui_sb_set_ready(int ready); extern void ui_sb_update_panes(void); +extern void ui_sb_update_text(void); extern void ui_sb_update_tip(int meaning); extern void ui_sb_timer_callback(int pane); extern void ui_sb_update_icon(int tag, int val); diff --git a/src/unix/unix.c b/src/unix/unix.c index 2b949ea5f..47a65944d 100644 --- a/src/unix/unix.c +++ b/src/unix/unix.c @@ -453,6 +453,12 @@ ui_sb_update_panes() } +void +ui_sb_update_text() +{ + +} + void plat_get_dirname(char *dest, const char *path) { diff --git a/src/win/win_preferences.c b/src/win/win_preferences.c index 6bec48282..0c3e95892 100644 --- a/src/win/win_preferences.c +++ b/src/win/win_preferences.c @@ -193,8 +193,9 @@ preferences_settings_save(void) /* Update status bar */ config_changed = 1; - ui_sb_set_ready(0); + ui_sb_set_ready(-1); ui_sb_update_panes(); + ui_sb_update_text(); /* Save the language changes */ config_save(); diff --git a/src/win/win_stbar.c b/src/win/win_stbar.c index 17178a6bf..4eb4b98a1 100644 --- a/src/win/win_stbar.c +++ b/src/win/win_stbar.c @@ -485,6 +485,9 @@ StatusBarDestroyTips(void) /* API: mark the status bar as not ready. */ +/* Values: -1 - not ready, but don't clear POST text + 0 - not ready + 1 - ready */ void ui_sb_set_ready(int ready) { @@ -493,6 +496,9 @@ ui_sb_set_ready(int ready) ui_sb_set_text(NULL); } + if (ready == -1) + ready = 0; + sb_ready = ready; } @@ -1022,7 +1028,7 @@ StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst) } -static void +void ui_sb_update_text() { uint8_t part = 0xff; From 23a04c3f5530d798fea03d0b8203a9c618f1cd63 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Mon, 6 Dec 2021 15:55:05 +0600 Subject: [PATCH 2/5] Fix wrong copyright information --- src/rtmidi_midi.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rtmidi_midi.cpp b/src/rtmidi_midi.cpp index af9fc5439..45e34197a 100644 --- a/src/rtmidi_midi.cpp +++ b/src/rtmidi_midi.cpp @@ -8,9 +8,9 @@ * * MIDI backend implemented using the RtMidi library. * - * Author: jgilje, + * Author: Cacodemon345, * Miran Grca, - * Copyright 2021 jgilje. + * Copyright 2021 Cacodemon345. * Copyright 2021 Miran Grca. */ #if defined __has_include From 00e00fa5c608c57ac1a058071e622b086bc863ab Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 6 Dec 2021 22:33:52 +0100 Subject: [PATCH 3/5] Attempted fix for PS/2 Model 55SX. --- src/machine/m_ps2_mca.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/machine/m_ps2_mca.c b/src/machine/m_ps2_mca.c index ed44b35a7..ef73c2a44 100644 --- a/src/machine/m_ps2_mca.c +++ b/src/machine/m_ps2_mca.c @@ -432,6 +432,8 @@ static void model_50_write(uint16_t port, uint8_t val) static void model_55sx_write(uint16_t port, uint8_t val) { + int remap_size; + switch (port) { case 0x100: @@ -477,26 +479,26 @@ static void model_55sx_write(uint16_t port, uint8_t val) case 0x105: ps2_mca_log("Write POS3 %02x\n", val); ps2.option[3] = val; - shadowbios = !(val & 0x10); - shadowbios_write = val & 0x10; + shadowbios = !(val & 0x10) && !(val & 0x20); + shadowbios_write = (val & 0x10) && !(val & 0x20); if (shadowbios) { mem_set_mem_state(0xe0000, 0x20000, MEM_READ_INTERNAL | MEM_WRITE_DISABLED); - mem_set_mem_state((mem_size+256) * 1024, 128 * 1024, MEM_READ_EXTANY | MEM_WRITE_EXTANY); mem_mapping_disable(&ps2.shadow_mapping); } else { - mem_set_mem_state(0xe0000, 0x20000, MEM_READ_EXTANY | MEM_WRITE_INTERNAL); - mem_set_mem_state((mem_size+256) * 1024, 128 * 1024, MEM_READ_INTERNAL | MEM_WRITE_INTERNAL); + mem_set_mem_state(0xe0000, 0x20000, MEM_READ_EXTANY | MEM_WRITE_DISABLED); mem_mapping_enable(&ps2.shadow_mapping); } - if ((ps2.option[1] & 1) && !(ps2.option[3] & 0x20)) - mem_set_mem_state(mem_size * 1024, 256 * 1024, MEM_READ_INTERNAL | MEM_WRITE_INTERNAL); + remap_size = (val & 0x10) ? 384 : 256; + + if (val & 0x20) + mem_set_mem_state(mem_size * 1024, remap_size * 1024, MEM_READ_EXTANY | MEM_WRITE_EXTANY); else - mem_set_mem_state(mem_size * 1024, 256 * 1024, MEM_READ_EXTANY | MEM_WRITE_EXTANY); + mem_set_mem_state(mem_size * 1024, remap_size * 1024, MEM_READ_INTERNAL | MEM_WRITE_INTERNAL); flushmmucache_nopc(); break; From ba6a27b15afc1a2e6363f8599cd8d5df83edf974 Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 6 Dec 2021 22:36:42 +0100 Subject: [PATCH 4/5] And a fix for the fix. --- src/machine/m_ps2_mca.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/machine/m_ps2_mca.c b/src/machine/m_ps2_mca.c index ef73c2a44..a71d0d65e 100644 --- a/src/machine/m_ps2_mca.c +++ b/src/machine/m_ps2_mca.c @@ -494,6 +494,7 @@ static void model_55sx_write(uint16_t port, uint8_t val) } remap_size = (val & 0x10) ? 384 : 256; + mem_set_mem_state(mem_size * 1024, 384 * 1024, MEM_READ_EXTANY | MEM_WRITE_EXTANY); if (val & 0x20) mem_set_mem_state(mem_size * 1024, remap_size * 1024, MEM_READ_EXTANY | MEM_WRITE_EXTANY); From 732399ed429f4704d6c59df2f5003ad9084f01de Mon Sep 17 00:00:00 2001 From: OBattler Date: Tue, 7 Dec 2021 11:24:56 +0100 Subject: [PATCH 5/5] Properly fixed the IBM PS/2 Model 55SX. --- src/machine/m_ps2_mca.c | 167 +++++++++++++++++++++------------------- 1 file changed, 89 insertions(+), 78 deletions(-) diff --git a/src/machine/m_ps2_mca.c b/src/machine/m_ps2_mca.c index a71d0d65e..305005592 100644 --- a/src/machine/m_ps2_mca.c +++ b/src/machine/m_ps2_mca.c @@ -82,9 +82,8 @@ static struct uint8_t memory_bank[8]; uint8_t io_id; - uint16_t planar_id; - - mem_mapping_t shadow_mapping; + uint16_t planar_id; + mem_mapping_t split_mapping; mem_mapping_t expansion_mapping; mem_mapping_t cache_mapping; @@ -212,37 +211,6 @@ void ps2_cache_clean(void) memset(ps2_cache_valid, 0, sizeof(ps2_cache_valid)); } -static uint8_t ps2_read_shadow_ram(uint32_t addr, void *priv) -{ - addr = (addr & 0x1ffff) + 0xe0000; - return mem_read_ram(addr, priv); -} -static uint16_t ps2_read_shadow_ramw(uint32_t addr, void *priv) -{ - addr = (addr & 0x1ffff) + 0xe0000; - return mem_read_ramw(addr, priv); -} -static uint32_t ps2_read_shadow_raml(uint32_t addr, void *priv) -{ - addr = (addr & 0x1ffff) + 0xe0000; - return mem_read_raml(addr, priv); -} -static void ps2_write_shadow_ram(uint32_t addr, uint8_t val, void *priv) -{ - addr = (addr & 0x1ffff) + 0xe0000; - mem_write_ram(addr, val, priv); -} -static void ps2_write_shadow_ramw(uint32_t addr, uint16_t val, void *priv) -{ - addr = (addr & 0x1ffff) + 0xe0000; - mem_write_ramw(addr, val, priv); -} -static void ps2_write_shadow_raml(uint32_t addr, uint32_t val, void *priv) -{ - addr = (addr & 0x1ffff) + 0xe0000; - mem_write_raml(addr, val, priv); -} - static uint8_t ps2_read_split_ram(uint32_t addr, void *priv) { addr = (addr % (ps2.split_size << 10)) + ps2.split_phys; @@ -430,10 +398,83 @@ static void model_50_write(uint16_t port, uint8_t val) } } + +static void model_55sx_mem_recalc(void) +{ + int i, j, state, enabled_mem = 0; + /* WARNING: Undocumented behavior - when bit 3 of POS5 is set (ie. memory has been configured), + bit 1 of POS5 behaves like bit 4. */ + int base = 0, remap_size = (ps2.option[3] & 0x11) ? 384 : 256; + int bit_mask = 0x00; + + ps2_mca_log("%02X %02X\n", ps2.option[1], ps2.option[3]); + + mem_remap_top(remap_size); + mem_set_mem_state(0x00000000, (mem_size + 384) * 1024, MEM_READ_EXTERNAL | MEM_WRITE_EXTERNAL); + mem_set_mem_state(0x000e0000, 0x00020000, MEM_READ_EXTANY | MEM_WRITE_DISABLED); + + if (!(ps2.option[3] & 0x08)) + { + ps2_mca_log("Memory not yet configured\n"); + return; + } + + for (i = 0; i < 2; i++) + { + for (j = 0; j < 4; j++) + { + if (ps2.memory_bank[i] & (1 << j)) { + ps2_mca_log("Set memory at %06X-%06X to internal\n", (base * 1024), (base * 1024) + (((base > 0) ? 1024 : 640) * 1024) - 1); + mem_set_mem_state(base * 1024, ((base > 0) ? 1024 : 640) * 1024, MEM_READ_INTERNAL | MEM_WRITE_INTERNAL); + enabled_mem += 1024; + bit_mask |= (1 << (j + (i << 2))); + } + base += 1024; + } + } + + ps2_mca_log("Enabled memory: %i kB (%02X)\n", enabled_mem, bit_mask); + + if (ps2.option[3] & 0x11) + { + /* Enable ROM. */ + ps2_mca_log("Enable ROM\n"); + state = MEM_READ_EXTANY; + } + else + { + /* Disable ROM. */ + if ((ps2.option[1] & 1) && !(ps2.option[3] & 0x20) && (bit_mask & 0x01) && (ps2.option[3] & 0x08)) + { + /* Disable RAM between 640 kB and 1 MB. */ + ps2_mca_log("Disable ROM, enable RAM\n"); + state = MEM_READ_INTERNAL; + } + else + { + ps2_mca_log("Disable ROM, disable RAM\n"); + state = MEM_READ_DISABLED; + } + } + + /* Write always disabled. */ + state |= MEM_WRITE_DISABLED; + + mem_set_mem_state(0xe0000, 0x20000, state); + + ps2_mca_log("Enable shadow mapping at %06X-%06X\n", (mem_size * 1024), (mem_size * 1024) + (remap_size * 1024) - 1); + + if ((ps2.option[1] & 1) && !(ps2.option[3] & 0x20)) { + ps2_mca_log("Set memory at %06X-%06X to internal\n", (mem_size * 1024), (mem_size * 1024) + (remap_size * 1024) - 1); + mem_set_mem_state(mem_size * 1024, remap_size * 1024, MEM_READ_INTERNAL | MEM_WRITE_INTERNAL); + } + + flushmmucache_nopc(); +} + + static void model_55sx_write(uint16_t port, uint8_t val) { - int remap_size; - switch (port) { case 0x100: @@ -469,39 +510,20 @@ static void model_55sx_write(uint16_t port, uint8_t val) ps2.option[0] = val; break; case 0x103: + ps2_mca_log("Write POS1: %02X\n", val); ps2.option[1] = val; - break; + model_55sx_mem_recalc(); + break; case 0x104: ps2.memory_bank[ps2.option[3] & 7] &= ~0xf; ps2.memory_bank[ps2.option[3] & 7] |= (val & 0xf); - ps2_mca_log("Write memory bank %i %02x\n", ps2.option[3] & 7, val); + ps2_mca_log("Write memory bank %i: %02X\n", ps2.option[3] & 7, val); + model_55sx_mem_recalc(); break; case 0x105: - ps2_mca_log("Write POS3 %02x\n", val); + ps2_mca_log("Write POS3: %02X\n", val); ps2.option[3] = val; - shadowbios = !(val & 0x10) && !(val & 0x20); - shadowbios_write = (val & 0x10) && !(val & 0x20); - - if (shadowbios) - { - mem_set_mem_state(0xe0000, 0x20000, MEM_READ_INTERNAL | MEM_WRITE_DISABLED); - mem_mapping_disable(&ps2.shadow_mapping); - } - else - { - mem_set_mem_state(0xe0000, 0x20000, MEM_READ_EXTANY | MEM_WRITE_DISABLED); - mem_mapping_enable(&ps2.shadow_mapping); - } - - remap_size = (val & 0x10) ? 384 : 256; - mem_set_mem_state(mem_size * 1024, 384 * 1024, MEM_READ_EXTANY | MEM_WRITE_EXTANY); - - if (val & 0x20) - mem_set_mem_state(mem_size * 1024, remap_size * 1024, MEM_READ_EXTANY | MEM_WRITE_EXTANY); - else - mem_set_mem_state(mem_size * 1024, remap_size * 1024, MEM_READ_INTERNAL | MEM_WRITE_INTERNAL); - - flushmmucache_nopc(); + model_55sx_mem_recalc(); break; case 0x106: ps2.subaddr_lo = val; @@ -917,23 +939,10 @@ static void ps2_mca_board_model_50_init() static void ps2_mca_board_model_55sx_init() { ps2_mca_board_common_init(); - - mem_mapping_add(&ps2.shadow_mapping, - (mem_size+256) * 1024, - 128*1024, - ps2_read_shadow_ram, - ps2_read_shadow_ramw, - ps2_read_shadow_raml, - ps2_write_shadow_ram, - ps2_write_shadow_ramw, - ps2_write_shadow_raml, - &ram[0xe0000], - MEM_MAPPING_INTERNAL, - NULL); - - mem_remap_top(256); - ps2.option[3] = 0x10; + ps2.option[1] = 0x00; + ps2.option[2] = 0x00; + ps2.option[3] = 0x30; memset(ps2.memory_bank, 0xf0, 8); switch (mem_size/1024) @@ -978,6 +987,8 @@ static void ps2_mca_board_model_55sx_init() if (gfxcard == VID_INTERNAL) device_add(&ps1vga_mca_device); + + model_55sx_mem_recalc(); } static void mem_encoding_update()