From 4a059d63145d077fe0340ac7935ec23daeb2ad83 Mon Sep 17 00:00:00 2001 From: Jamiras <32680403+Jamiras@users.noreply.github.com> Date: Sat, 2 Nov 2024 09:49:52 -0600 Subject: [PATCH] add notes about C64 memory banking (#381) --- src/rcheevos/consoleinfo.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/rcheevos/consoleinfo.c b/src/rcheevos/consoleinfo.c index 98b43b6d..6410e227 100644 --- a/src/rcheevos/consoleinfo.c +++ b/src/rcheevos/consoleinfo.c @@ -380,14 +380,18 @@ static const rc_memory_regions_t rc_memory_regions_colecovision = { _rc_memory_r /* ===== Commodore 64 ===== */ /* https://www.c64-wiki.com/wiki/Memory_Map */ /* https://sta.c64.org/cbm64mem.html */ +/* NOTE: Several blocks of C64 memory can be bank-switched for ROM data (see https://www.c64-wiki.com/wiki/Bank_Switching). + * Achievement triggers rely on values changing, so we don't really need to look at the ROM data. + * The achievement logic assumes the RAM data is always present in the bankable blocks. As such, + * clients providing memory to achievements should always return the RAM values at the queried address. */ static const rc_memory_region_t _rc_memory_regions_c64[] = { { 0x000000U, 0x0003FFU, 0x000000U, RC_MEMORY_TYPE_SYSTEM_RAM, "Kernel RAM" }, { 0x000400U, 0x0007FFU, 0x000400U, RC_MEMORY_TYPE_VIDEO_RAM, "Screen RAM" }, - { 0x000800U, 0x009FFFU, 0x000800U, RC_MEMORY_TYPE_SYSTEM_RAM, "System RAM" }, /* BASIC Program Storage Area */ - { 0x00A000U, 0x00BFFFU, 0x00A000U, RC_MEMORY_TYPE_SYSTEM_RAM, "System RAM" }, /* Machine Language Storage Area / BASIC ROM Area */ - { 0x00C000U, 0x00CFFFU, 0x00C000U, RC_MEMORY_TYPE_SYSTEM_RAM, "System RAM" }, /* Machine Language Storage Area */ - { 0x00D000U, 0x00DFFFU, 0x00D000U, RC_MEMORY_TYPE_SYSTEM_RAM, "I/O Area" }, /* also Character ROM */ - { 0x00E000U, 0x00FFFFU, 0x00E000U, RC_MEMORY_TYPE_SYSTEM_RAM, "System RAM" }, /* Machine Language Storage Area / Kernal ROM */ + { 0x000800U, 0x009FFFU, 0x000800U, RC_MEMORY_TYPE_SYSTEM_RAM, "System RAM" }, /* BASIC area. $8000-$9FFF can bank to cartridge ROM */ + { 0x00A000U, 0x00BFFFU, 0x00A000U, RC_MEMORY_TYPE_SYSTEM_RAM, "System RAM" }, /* can bank to BASIC ROM or cartridge ROM */ + { 0x00C000U, 0x00CFFFU, 0x00C000U, RC_MEMORY_TYPE_SYSTEM_RAM, "System RAM" }, + { 0x00D000U, 0x00DFFFU, 0x00D000U, RC_MEMORY_TYPE_SYSTEM_RAM, "System RAM" }, /* can bank to I/O Area or character ROM */ + { 0x00E000U, 0x00FFFFU, 0x00E000U, RC_MEMORY_TYPE_SYSTEM_RAM, "System RAM" }, /* can bank to kernel ROM */ }; static const rc_memory_regions_t rc_memory_regions_c64 = { _rc_memory_regions_c64, 7 };