From 68a7b851055f266db1519baa30a9d84dac6978e5 Mon Sep 17 00:00:00 2001 From: oldwoman37 Date: Sat, 7 Sep 2024 15:42:13 +0000 Subject: [PATCH] Fix for RAMLINK: IO1 wouldn't bet setup properly after RAMLINK was turned back on git-svn-id: https://svn.code.sf.net/p/vice-emu/code/trunk@45333 379a1393-f5fb-40a0-bcee-ef074d9b53f7 --- vice/src/c64/cart/ramlink.c | 46 +++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/vice/src/c64/cart/ramlink.c b/vice/src/c64/cart/ramlink.c index 9a01b97591..b47e894640 100644 --- a/vice/src/c64/cart/ramlink.c +++ b/vice/src/c64/cart/ramlink.c @@ -656,14 +656,36 @@ static void ramlink_off(void) cart_port_config_changed_slot0(); } +/* Turn on or off devices based on port access settings */ +static void ramlink_update_io1mode(void) +{ + if (rl_io1mode == 0) { /* internal RAM */ + ramlink_other1_off(); + ramlink_ramport_off(); + ramlink_io1_on(); + } else if ((rl_io1mode == 1) && (rl_cardsizemb != 0) && rl_card && + rl_enabled) { /* RAMCard */ + ramlink_other1_off(); + ramlink_ramport_off(); + ramlink_io1_on(); + } else if (rl_io1mode == 2) { /* GEORAM or RAMDRIVE */ + ramlink_other1_off(); + ramlink_io1_off(); + ramlink_ramport_on(); + } else { /* PASSTHRU */ + ramlink_ramport_off(); + ramlink_io1_off(); + ramlink_other1_on(); + } +} + /* Turn on RL */ static void ramlink_on(void) { - ramlink_io1_on(); ramlink_io2_on(); - ramlink_other1_off(); ramlink_reu_on(); ramlink_georam2_on(); + ramlink_update_io1mode(); rl_on = 1; cart_port_config_changed_slot0(); } @@ -1448,24 +1470,7 @@ static void ramlink_io2_b0_bf_store(uint16_t addr, uint8_t value) static void ramlink_io2_c0_c3_store(uint16_t addr, uint8_t value) { rl_io1mode = addr & 0x3; - if (rl_io1mode == 0) { /* internal RAM */ - ramlink_other1_off(); - ramlink_ramport_off(); - ramlink_io1_on(); - } else if ((rl_io1mode == 1) && (rl_cardsizemb != 0) && rl_card && - rl_enabled) { /* RAMCard */ - ramlink_other1_off(); - ramlink_ramport_off(); - ramlink_io1_on(); - } else if (rl_io1mode == 2) { /* GEORAM or RAMDRIVE */ - ramlink_other1_off(); - ramlink_io1_off(); - ramlink_ramport_on(); - } else { /* PASSTHRU */ - ramlink_ramport_off(); - ramlink_io1_off(); - ramlink_other1_on(); - } + ramlink_update_io1mode(); IDBG((LOG, "RAMLINK: io2 w %04x < %02x at 0x%04x", addr, value, reg_pc)); } @@ -1482,6 +1487,7 @@ static int ramlink_io2_dump(void) mon_out("DOS mapped?: %s\n", rl_dos ? "Yes" : "No"); mon_out("Mode: %s\n", rl_normal ? "Normal" : "Direct"); mon_out("RAMCard Size: %d MiB\n", rl_cardsizemb); + mon_out("IO1 source: %u\n", rl_io1mode); mon_out("I8255A at $DF40\n"); i8255a_dump(&rl_i8255a);