diff options
author | Bad Diode <bd@badd10de.dev> | 2023-08-31 09:57:45 +0200 |
---|---|---|
committer | Bad Diode <bd@badd10de.dev> | 2023-08-31 09:57:45 +0200 |
commit | 66daaf81e953bc0d44cf0309f945f76c97d0ede4 (patch) | |
tree | d0794be583460ac39e365ab2ddd348c4f0a5d699 | |
parent | ea85184fdadf08760aa8f88871f96ddf8dde2914 (diff) | |
download | uxngba-66daaf81e953bc0d44cf0309f945f76c97d0ede4.tar.gz uxngba-66daaf81e953bc0d44cf0309f945f76c97d0ede4.zip |
Fix bank switching
-rw-r--r-- | src/devices.c | 6 | ||||
-rw-r--r-- | src/main.c | 2 | ||||
-rw-r--r-- | src/ppu.c | 1 |
3 files changed, 5 insertions, 4 deletions
diff --git a/src/devices.c b/src/devices.c index 2146bd3..49fc4ac 100644 --- a/src/devices.c +++ b/src/devices.c | |||
@@ -108,9 +108,9 @@ deo_screen(u8 *dev, u8 port) { | |||
108 | void | 108 | void |
109 | deo_system(u8 *dev, u8 port) { | 109 | deo_system(u8 *dev, u8 port) { |
110 | switch(port) { | 110 | switch(port) { |
111 | case 0x3: { | 111 | case 0x2: { |
112 | // Rom bank switching (Needs testing). | 112 | // Rom bank switching. |
113 | u16 addr = PEEK2(dev + 0x2); | 113 | u16 addr = PEEK2(dev + port); |
114 | if(uxn_ram[addr] == 0x01) { | 114 | if(uxn_ram[addr] == 0x01) { |
115 | u16 length = PEEK2(uxn_ram + addr + 1); | 115 | u16 length = PEEK2(uxn_ram + addr + 1); |
116 | u16 a_page = PEEK2(uxn_ram + addr + 1 + 2); | 116 | u16 a_page = PEEK2(uxn_ram + addr + 1 + 2); |
@@ -105,7 +105,7 @@ 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); | 108 | // txt_position(0, 0); |
109 | // print_debug_info(0); | 109 | // print_debug_info(0); |
110 | bios_vblank_wait(); | 110 | bios_vblank_wait(); |
111 | FRAME_START(); | 111 | FRAME_START(); |
@@ -40,6 +40,7 @@ WITH REGARD TO THIS SOFTWARE. | |||
40 | // Keyboard. | 40 | // Keyboard. |
41 | #define SPRITE_START_IDX 640 | 41 | #define SPRITE_START_IDX 640 |
42 | 42 | ||
43 | // TODO: Can we put these tables on the VRAM for extra speed? | ||
43 | static u32 dec_byte_flip_x[256] = { | 44 | static u32 dec_byte_flip_x[256] = { |
44 | 0x00000000, 0x00000001, 0x00000010, 0x00000011, 0x00000100, | 45 | 0x00000000, 0x00000001, 0x00000010, 0x00000011, 0x00000100, |
45 | 0x00000101, 0x00000110, 0x00000111, 0x00001000, 0x00001001, | 46 | 0x00000101, 0x00000110, 0x00000111, 0x00001000, 0x00001001, |