diff options
author | Bad Diode <bd@badd10de.dev> | 2023-08-31 12:17:09 +0200 |
---|---|---|
committer | Bad Diode <bd@badd10de.dev> | 2023-08-31 12:17:09 +0200 |
commit | e7c567fcb695722b9e88866bf4216ff425daac9a (patch) | |
tree | faae4937d2f46483eeed04eb4fee2e002e2b0ba9 /src | |
parent | 4f745d03e1717120e1c7502a9033ee8b95ab462f (diff) | |
download | uxngba-e7c567fcb695722b9e88866bf4216ff425daac9a.tar.gz uxngba-e7c567fcb695722b9e88866bf4216ff425daac9a.zip |
Fix issue with bank switching
Diffstat (limited to 'src')
-rw-r--r-- | src/debug.c | 6 | ||||
-rw-r--r-- | src/devices.c | 6 | ||||
-rw-r--r-- | src/main.c | 2 |
3 files changed, 8 insertions, 6 deletions
diff --git a/src/debug.c b/src/debug.c index 17c1c73..fe3077f 100644 --- a/src/debug.c +++ b/src/debug.c | |||
@@ -9,13 +9,17 @@ typedef enum DebugFlags { | |||
9 | 9 | ||
10 | void | 10 | void |
11 | print_debug_info(u8 flags) { | 11 | print_debug_info(u8 flags) { |
12 | txt_position(0, 0); | ||
12 | if (flags & SHOW_ROM) { | 13 | if (flags & SHOW_ROM) { |
13 | txt_printf("\nROM"); | 14 | txt_printf("\nROM"); |
14 | for (size_t i = 0; i < 128; i++) { | 15 | for (size_t i = 0; i < 128; i++) { |
15 | if (i % 8 == 0) { | 16 | if (i % 8 == 0) { |
16 | txt_printf("\n"); | 17 | txt_printf("\n"); |
17 | } | 18 | } |
18 | txt_printf("%02x ", uxn_ram[i + PAGE_PROGRAM]); | 19 | if (i % 2 == 0) { |
20 | txt_printf(" "); | ||
21 | } | ||
22 | txt_printf("%02x", uxn_ram[i + PAGE_PROGRAM]); | ||
19 | } | 23 | } |
20 | txt_printf("\n"); | 24 | txt_printf("\n"); |
21 | } | 25 | } |
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 @@ | |||
1 | static time_t seconds = 0; | 1 | static 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 | } |
@@ -105,8 +105,6 @@ main(void) { | |||
105 | u8 frame_counter = 0; | 105 | u8 frame_counter = 0; |
106 | PROF(uxn_eval_asm(PAGE_PROGRAM), eval_cycles); | 106 | PROF(uxn_eval_asm(PAGE_PROGRAM), eval_cycles); |
107 | while(true) { | 107 | while(true) { |
108 | // txt_position(0, 0); | ||
109 | // print_debug_info(0); | ||
110 | bios_vblank_wait(); | 108 | bios_vblank_wait(); |
111 | FRAME_START(); | 109 | FRAME_START(); |
112 | PROF(handle_input(), input_cycles); | 110 | PROF(handle_input(), input_cycles); |