From a124947c4a77e3a4e9328827d98011a17256d080 Mon Sep 17 00:00:00 2001 From: sorgelig Date: Wed, 11 Jul 2018 16:56:39 +0800 Subject: [PATCH] Improved support for Amstrad's boot expansions. --- user_io.cpp | 22 +++++++++++++--------- user_io.h | 2 +- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/user_io.cpp b/user_io.cpp index 22acb31..79c5df9 100644 --- a/user_io.cpp +++ b/user_io.cpp @@ -521,14 +521,18 @@ void user_io_init(const char *path) if (is_cpc_core()) { - sprintf(mainpath, "%s/boot.eZZ", user_io_get_core_name()); - user_io_file_tx(mainpath, 0x40); - sprintf(mainpath, "%s/boot.eZ0", user_io_get_core_name()); - user_io_file_tx(mainpath, 0x40); - for (int i = 0; i < 256; i++) + for (int m = 0; m < 3; m++) { - sprintf(mainpath, "%s/boot.e%02X", user_io_get_core_name(), i); - user_io_file_tx(mainpath, 0x40); + const char *model = !m ? "" : (m == 1) ? "0" : "1"; + sprintf(mainpath, "%s/boot%s.eZZ", user_io_get_core_name(), model); + user_io_file_tx(mainpath, 0x40 * (m + 1),0,1); + sprintf(mainpath, "%s/boot%s.eZ0", user_io_get_core_name(), model); + user_io_file_tx(mainpath, 0x40 * (m + 1),0,1); + for (int i = 0; i < 256; i++) + { + sprintf(mainpath, "%s/boot%s.e%02X", user_io_get_core_name(), model, i); + user_io_file_tx(mainpath, 0x40 * (m + 1),0,1); + } } } @@ -884,12 +888,12 @@ int user_io_file_mount(char *name, unsigned char index) return ret ? 1 : 0; } -int user_io_file_tx(char* name, unsigned char index, char opensave) +int user_io_file_tx(char* name, unsigned char index, char opensave, char mute) { fileTYPE f = { 0 }; static uint8_t buf[1024]; - if (!FileOpen(&f, name)) return 0; + if (!FileOpen(&f, name, mute)) return 0; unsigned long bytes2send = f.size; diff --git a/user_io.h b/user_io.h index 5e3ebb5..e2ba612 100644 --- a/user_io.h +++ b/user_io.h @@ -183,7 +183,7 @@ void user_io_osd_key_enable(char); void user_io_serial_tx(char *, uint16_t); char *user_io_8bit_get_string(char); unsigned long user_io_8bit_set_status(unsigned long, unsigned long); -int user_io_file_tx(char* name, unsigned char index = 0, char opensave = 0); +int user_io_file_tx(char* name, unsigned char index = 0, char opensave = 0, char mute = 0); int user_io_file_mount(char *name, unsigned char index = 0); char user_io_dip_switch1(void); char user_io_serial_status(serial_status_t *, uint8_t);