From 42b57a9e8b55148ce2a8843c90278f08f89f7985 Mon Sep 17 00:00:00 2001 From: sorgelig Date: Mon, 5 Jul 2021 00:20:52 +0800 Subject: [PATCH] minimig: Fast-IDE option. --- menu.cpp | 44 +++++++++++++++++++----------- support/minimig/minimig_config.cpp | 10 +++---- support/minimig/minimig_config.h | 2 +- support/minimig/minimig_hdd.cpp | 2 +- 4 files changed, 35 insertions(+), 23 deletions(-) diff --git a/menu.cpp b/menu.cpp index 880a8ca..bb5710e 100644 --- a/menu.cpp +++ b/menu.cpp @@ -5119,7 +5119,7 @@ void HandleUI(void) config_cpu_msg[minimig_config.cpu & 0x03] + 2, config_chipset_msg[(minimig_config.chipset >> 2) & 7], minimig_config.chipset & CONFIG_NTSC ? "N" : "P", - (minimig_config.enable_ide && (minimig_config.hardfile[0].cfg || + ((minimig_config.ide_cfg & 1) && (minimig_config.hardfile[0].cfg || minimig_config.hardfile[1].cfg || minimig_config.hardfile[2].cfg || minimig_config.hardfile[3].cfg)) ? "/HD" : "", @@ -5351,22 +5351,26 @@ void HandleUI(void) m = 0; parentstate = menustate; - menumask = 0x601; // b001000000001 - On/off & exit enabled by default... - if (minimig_config.enable_ide) menumask |= 0xAA; // b010101010 - HD0/1/2/3 type + menumask = 0xC01; + if (minimig_config.ide_cfg & 1) menumask |= 0x156; OsdWrite(m++, "", 0, 0); strcpy(s, " IDE A600/A1200 : "); - strcat(s, minimig_config.enable_ide ? "On " : "Off"); + strcat(s, (minimig_config.ide_cfg & 1) ? "On " : "Off"); OsdWrite(m++, s, menusub == 0, 0); + strcpy(s, " Fast-IDE (68020) : "); + strcat(s, (minimig_config.ide_cfg & 0x20) ? "Off" : "On"); + OsdWrite(m++, s, menusub == 1, !(minimig_config.ide_cfg & 1) || !(minimig_config.cpu & 2)); + if (!(minimig_config.cpu & 2)) menumask &= ~2; OsdWrite(m++); { - uint n = 1, t = 4; + uint n = 2, t = 8; for (uint i = 0; i < 4; i++) { strcpy(s, (i & 2) ? " Sec. " : " Pri. "); strcat(s, (i & 1) ? " Slave: " : "Master: "); strcat(s, (minimig_config.hardfile[i].cfg == 2) ? "Removable/CD" : minimig_config.hardfile[i].cfg ? "Fixed/HDD" : "Disabled"); - OsdWrite(m++, s, minimig_config.enable_ide ? (menusub == n++) : 0, minimig_config.enable_ide ==0); + OsdWrite(m++, s, (minimig_config.ide_cfg & 1) ? (menusub == n++) : 0, !(minimig_config.ide_cfg & 1)); if (minimig_config.hardfile[i].filename[0]) { strcpy(s, " "); @@ -5380,7 +5384,7 @@ void HandleUI(void) { strcpy(s, " ** not selected **"); } - enable = minimig_config.enable_ide && minimig_config.hardfile[i].cfg; + enable = (minimig_config.ide_cfg & 1) && minimig_config.hardfile[i].cfg; if (enable) menumask |= t; // Make hardfile selectable OsdWrite(m++, s, menusub == n++, enable == 0); t <<= 2; @@ -5390,10 +5394,10 @@ void HandleUI(void) OsdWrite(m++); sprintf(s, " Floppy Disk Turbo : %s", minimig_config.floppy.speed ? "On" : "Off"); - OsdWrite(m++, s, menusub == 9, 0); + OsdWrite(m++, s, menusub == 10, 0); OsdWrite(m++); - OsdWrite(OsdGetSize() - 1, STD_BACK, menusub == 10, 0); + OsdWrite(OsdGetSize() - 1, STD_BACK, menusub == 11, 0); menustate = MENU_MINIMIG_DISK2; break; @@ -5406,17 +5410,25 @@ void HandleUI(void) { if (select) { - minimig_config.enable_ide = (minimig_config.enable_ide == 0); + minimig_config.ide_cfg ^= 1; menustate = MENU_MINIMIG_DISK1; } } - else if (menusub < 9) + else if (menusub == 1) { - if(menusub&1) + if (select) + { + minimig_config.ide_cfg ^= 0x20; + menustate = MENU_MINIMIG_DISK1; + } + } + else if (menusub < 10) + { + if (!(menusub & 1)) { if (select || minus || plus) { - int idx = (menusub - 1) / 2; + int idx = (menusub - 2) / 2; if (minus) { if (!minimig_config.hardfile[idx].cfg) minimig_config.hardfile[idx].cfg = 2; @@ -5435,7 +5447,7 @@ void HandleUI(void) fs_Options = SCANO_DIR | SCANO_UMOUNT; fs_MenuSelect = MENU_MINIMIG_HDFFILE_SELECTED; fs_MenuCancel = MENU_MINIMIG_DISK1; - int idx = (menusub - 2) / 2; + int idx = (menusub - 3) / 2; strcpy(fs_pFileExt, (minimig_config.hardfile[idx].cfg == 2) ? "ISOCUECHDIMG" : "HDFVHDIMGDSK"); if (select) { @@ -5445,13 +5457,13 @@ void HandleUI(void) else if (recent_init(500)) menustate = MENU_RECENT1; } } - else if (menusub == 9 && select) // return to previous menu + else if (menusub == 10 && select) // return to previous menu { minimig_config.floppy.speed ^= 1; minimig_ConfigFloppy(minimig_config.floppy.drives, minimig_config.floppy.speed); menustate = MENU_MINIMIG_DISK1; } - else if (menusub == 10 && select) // return to previous menu + else if (menusub == 11 && select) // return to previous menu { menustate = MENU_MINIMIG_MAIN1; menusub = 5; diff --git a/support/minimig/minimig_config.cpp b/support/minimig/minimig_config.cpp index 9e79018..9e654c9 100644 --- a/support/minimig/minimig_config.cpp +++ b/support/minimig/minimig_config.cpp @@ -226,7 +226,7 @@ static char UploadActionReplay() spi8((data >> 0) & 0xff); data = 0xff; // key, 1 byte spi8((data >> 0) & 0xff); - data = minimig_config.enable_ide ? 0xff : 0; // ide, 1 byte + data = (minimig_config.ide_cfg & 1) ? 0xff : 0; // ide, 1 byte spi8((data >> 0) & 0xff); data = 0xff; // a1200, 1 byte spi8((data >> 0) & 0xff); @@ -323,8 +323,8 @@ static void ApplyConfiguration(char reloadkickstart) printf("\n"); - printf("\nIDE state: %s.\n", minimig_config.enable_ide ? "enabled" : "disabled"); - if (minimig_config.enable_ide) + printf("\nIDE state: %s.\n", (minimig_config.ide_cfg & 1) ? "enabled" : "disabled"); + if (minimig_config.ide_cfg & 1) { printf("Primary Master HDD is %s.\n", (minimig_config.hardfile[0].cfg == 2) ? "CD" : minimig_config.hardfile[0].cfg ? "HDD" : "disabled"); printf("Primary Slave HDD is %s.\n", (minimig_config.hardfile[1].cfg == 2) ? "CD" : minimig_config.hardfile[1].cfg ? "HDD" : "disabled"); @@ -342,7 +342,7 @@ static void ApplyConfiguration(char reloadkickstart) rstval = SPI_CPU_HLT; spi_uio_cmd8(UIO_MM2_RST, rstval); - spi_uio_cmd8(UIO_MM2_HDD, (minimig_config.enable_ide ? 1 : 0) | (OpenHardfile(0) ? 2 : 0) | (OpenHardfile(1) ? 4 : 0) | (OpenHardfile(2) ? 8 : 0) | (OpenHardfile(3) ? 16 : 0)); + spi_uio_cmd8(UIO_MM2_HDD, (minimig_config.ide_cfg & 0x21) | (OpenHardfile(0) ? 2 : 0) | (OpenHardfile(1) ? 4 : 0) | (OpenHardfile(2) ? 8 : 0) | (OpenHardfile(3) ? 16 : 0)); minimig_ConfigMemory(memcfg); minimig_ConfigCPU(minimig_config.cpu); @@ -469,7 +469,7 @@ int minimig_cfg_load(int num) minimig_config.chipset = 0; minimig_config.floppy.speed = CONFIG_FLOPPY2X; minimig_config.floppy.drives = 1; - minimig_config.enable_ide = 0; + minimig_config.ide_cfg = 0; minimig_config.hardfile[0].cfg = 1; minimig_config.hardfile[0].filename[0] = 0; minimig_config.hardfile[1].cfg = 1; diff --git a/support/minimig/minimig_config.h b/support/minimig/minimig_config.h index a5cabdb..a1590a1 100644 --- a/support/minimig/minimig_config.h +++ b/support/minimig/minimig_config.h @@ -50,7 +50,7 @@ typedef struct unsigned char chipset; mm_floppyTYPE floppy; unsigned char disable_ar3; - unsigned char enable_ide; + unsigned char ide_cfg; unsigned char scanlines; unsigned char audio; mm_hardfileTYPE hardfile[4]; diff --git a/support/minimig/minimig_hdd.cpp b/support/minimig/minimig_hdd.cpp index 610a753..f966b0b 100644 --- a/support/minimig/minimig_hdd.cpp +++ b/support/minimig/minimig_hdd.cpp @@ -729,7 +729,7 @@ uint8_t OpenHardfile(uint8_t unit, const char* filename) if (is_minimig()) { - if (minimig_config.enable_ide && minimig_config.hardfile[unit].cfg) + if ((minimig_config.ide_cfg & 1) && minimig_config.hardfile[unit].cfg) { printf("\nChecking HDD %d\n", unit); if (minimig_config.hardfile[unit].filename[0])