From c3c4e2ea3ee04b77bad3542112410d3e2a67e0c0 Mon Sep 17 00:00:00 2001 From: sorgelig Date: Sun, 8 Sep 2019 08:40:06 +0800 Subject: [PATCH] some flags for dual-sdr cores. --- fpga_io.cpp | 6 ++++++ fpga_io.h | 1 + support/neogeo/loader.cpp | 3 ++- user_io.cpp | 12 ++++++++++++ user_io.h | 4 +++- 5 files changed, 24 insertions(+), 2 deletions(-) diff --git a/fpga_io.cpp b/fpga_io.cpp index 01cc2f3..32d2c05 100644 --- a/fpga_io.cpp +++ b/fpga_io.cpp @@ -605,6 +605,12 @@ int fpga_get_buttons() return (gpi >> 29) & 3; } +int fpga_get_io_type() +{ + fpga_gpo_write(fpga_gpo_read() | 0x80000000); + return (fpga_gpi_read() >> 28) & 1; +} + void reboot(int cold) { sync(); diff --git a/fpga_io.h b/fpga_io.h index 44cfb36..5eca6ad 100644 --- a/fpga_io.h +++ b/fpga_io.h @@ -15,6 +15,7 @@ int fpga_gpi_read(); void fpga_set_led(uint32_t on); int fpga_get_buttons(); +int fpga_get_io_type(); void fpga_core_reset(int reset); void fpga_core_write(uint32_t offset, uint32_t value); diff --git a/support/neogeo/loader.cpp b/support/neogeo/loader.cpp index 6ebfebb..f462971 100644 --- a/support/neogeo/loader.cpp +++ b/support/neogeo/loader.cpp @@ -9,6 +9,7 @@ #include "loader.h" #include "../../sxmlc.h" #include "../../user_io.h" +#include "../../fpga_io.h" #include "../../osd.h" #include "../../menu.h" @@ -1016,7 +1017,7 @@ int neogeo_romset_tx(char* name) if (crom_start < 0x300000) crom_start = 0x300000; uint32_t crom_max = crom_start + crom_sz_max; uint16_t ram_sz = sdram_sz() & 3; - if ((ram_sz == 2 && crom_max > 0x4000000) || (ram_sz == 1 && crom_max > 0x2000000) || !ram_sz) + if ((!user_io_is_dualsdr() || !fpga_get_io_type()) && ((ram_sz == 2 && crom_max > 0x4000000) || (ram_sz == 1 && crom_max > 0x2000000) || !ram_sz)) { Info("Not enough memory!\nGraphics will be corrupted"); sleep(2); diff --git a/user_io.cpp b/user_io.cpp index 2c2aa15..a523c97 100644 --- a/user_io.cpp +++ b/user_io.cpp @@ -47,6 +47,7 @@ static int emu_mode = EMU_NONE; // keep state over core type and its capabilities static unsigned char core_type = CORE_TYPE_UNKNOWN; +static unsigned char dual_sdr = 0; static int fio_size = 0; static int io_ver = 0; @@ -608,6 +609,11 @@ uint16_t sdram_sz(int sz) return res; } +int user_io_is_dualsdr() +{ + return dual_sdr; +} + void user_io_init(const char *path) { char *name; @@ -622,6 +628,12 @@ void user_io_init(const char *path) fio_size = fpga_get_fio_size(); io_ver = fpga_get_io_version(); + if (core_type == CORE_TYPE_8BIT2) + { + dual_sdr = 1; + core_type = CORE_TYPE_8BIT; + } + if ((core_type != CORE_TYPE_DUMB) && (core_type != CORE_TYPE_MINIMIG2) && (core_type != CORE_TYPE_MIST) && diff --git a/user_io.h b/user_io.h index f87cbec..bfbc361 100644 --- a/user_io.h +++ b/user_io.h @@ -137,10 +137,11 @@ #define CORE_TYPE_UNKNOWN 0x55 #define CORE_TYPE_DUMB 0xa0 // core without any io controller interaction #define CORE_TYPE_MIST 0xa3 // mist atari st core -#define CORE_TYPE_8BIT 0xa4 // atari 800/c64 like core +#define CORE_TYPE_8BIT 0xa4 // generic core #define CORE_TYPE_MINIMIG2 0xa5 // new Minimig with AGA #define CORE_TYPE_ARCHIE 0xa6 // Acorn Archimedes #define CORE_TYPE_SHARPMZ 0xa7 // Sharp MZ Series +#define CORE_TYPE_8BIT2 0xa8 // generic core using dual SDRAM #define UART_FLG_PPP 0x0001 #define UART_FLG_TERM 0x0002 @@ -236,6 +237,7 @@ const char* get_rbf_name(); const char* get_rbf_path(); uint16_t sdram_sz(int sz = -1); +int user_io_is_dualsdr(); int GetUARTMode(); int GetMidiLinkMode();