aboutsummaryrefslogtreecommitdiffstats
path: root/src/devices.c
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2023-08-31 12:17:09 +0200
committerBad Diode <bd@badd10de.dev>2023-08-31 12:17:09 +0200
commite7c567fcb695722b9e88866bf4216ff425daac9a (patch)
treefaae4937d2f46483eeed04eb4fee2e002e2b0ba9 /src/devices.c
parent4f745d03e1717120e1c7502a9033ee8b95ab462f (diff)
downloaduxngba-e7c567fcb695722b9e88866bf4216ff425daac9a.tar.gz
uxngba-e7c567fcb695722b9e88866bf4216ff425daac9a.zip
Fix issue with bank switching
Diffstat (limited to 'src/devices.c')
-rw-r--r--src/devices.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/devices.c b/src/devices.c
index 6c7f281..6a1ed28 100644
--- a/src/devices.c
+++ b/src/devices.c
@@ -1,4 +1,4 @@
1static time_t seconds = 0; 1static time_t seconds = 1693475007;
2 2
3#define RAM_PAGES 0x10 3#define RAM_PAGES 0x10
4 4
@@ -113,8 +113,8 @@ deo_system(u8 *dev, u8 port) {
113 u16 a_addr = PEEK2(uxn_ram + addr + 1 + 4); 113 u16 a_addr = PEEK2(uxn_ram + addr + 1 + 4);
114 u16 b_page = PEEK2(uxn_ram + addr + 1 + 6); 114 u16 b_page = PEEK2(uxn_ram + addr + 1 + 6);
115 u16 b_addr = PEEK2(uxn_ram + addr + 1 + 8); 115 u16 b_addr = PEEK2(uxn_ram + addr + 1 + 8);
116 u8 *ram = uxn_ram; 116 u8 *ram = uxn_ram + (b_page % RAM_PAGES) * 0x10000;
117 u8 *rom = uxn_rom + (a_page % RAM_PAGES) * 0x10000; 117 u8 *rom = uxn_rom + (a_page % RAM_PAGES) * 0x10000 - PAGE_PROGRAM;
118 for(size_t i = 0; i < length; i++) { 118 for(size_t i = 0; i < length; i++) {
119 ram[b_addr + i] = rom[a_addr + i]; 119 ram[b_addr + i] = rom[a_addr + i];
120 } 120 }