summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2023-04-15 23:44:44 +0200
committerBad Diode <bd@badd10de.dev>2023-04-15 23:44:44 +0200
commit6c5d2b5a6e71645f2fb3b48c26ed5b061a061fee (patch)
treea951d91c158d3ed22cd53c4d9fda1a37bb5ed11a
parent11f0ac686707000900f6ef4f7ce4e8047d623c7e (diff)
downloadgba-link-cable-tester-6c5d2b5a6e71645f2fb3b48c26ed5b061a061fee.tar.gz
gba-link-cable-tester-6c5d2b5a6e71645f2fb3b48c26ed5b061a061fee.zip
Fix a bug with flickering
-rw-r--r--src/main.c9
-rw-r--r--src/renderer_m0.c21
2 files changed, 9 insertions, 21 deletions
diff --git a/src/main.c b/src/main.c
index 129493b..8d88b83 100644
--- a/src/main.c
+++ b/src/main.c
@@ -144,11 +144,10 @@ int main(void) {
144 // inc = 1; 144 // inc = 1;
145 // } 145 // }
146 146
147 // draw_rect(50, 10, 200, 110, 1); 147 PROF(test_rect(), test_rect_cycles);
148 // PROF(test_rect(), test_rect_cycles); 148 PROF(test_fill_rect(), test_fill_rect_cycles);
149 // PROF(test_fill_rect(), test_fill_rect_cycles); 149 PROF(test_chr(), test_chr_cycles);
150 // PROF(test_chr(), test_chr_cycles); 150 PROF(test_icn(), test_icn_cycles);
151 // PROF(test_icn(), test_icn_cycles);
152 draw_filled_rect(0, 0, 140, 60, 0); 151 draw_filled_rect(0, 0, 140, 60, 0);
153 PROF_SHOW(); 152 PROF_SHOW();
154 PROF(flip_buffer(), flip_cycles); 153 PROF(flip_buffer(), flip_cycles);
diff --git a/src/renderer_m0.c b/src/renderer_m0.c
index 3d1a4d0..1d28fb9 100644
--- a/src/renderer_m0.c
+++ b/src/renderer_m0.c
@@ -448,12 +448,12 @@ flip_buffer(void) {
448 if (backbuf == BUF_0) { 448 if (backbuf == BUF_0) {
449 backbuf = BUF_1; 449 backbuf = BUF_1;
450 BG_H_SCROLL_0 = 0; 450 BG_H_SCROLL_0 = 0;
451 BG_H_SCROLL_1 = 240; 451 BG_H_SCROLL_1 = -240;
452 BG_CTRL(0) = BG_CHARBLOCK(CB_0) | BG_SCREENBLOCK(SB_0) | BG_PRIORITY(0) | BG_SIZE(1); 452 BG_CTRL(0) = BG_CHARBLOCK(CB_0) | BG_SCREENBLOCK(SB_0) | BG_PRIORITY(0) | BG_SIZE(1);
453 BG_CTRL(1) = BG_CHARBLOCK(CB_1) | BG_SCREENBLOCK(SB_1) | BG_PRIORITY(2) | BG_SIZE(1); 453 BG_CTRL(1) = BG_CHARBLOCK(CB_1) | BG_SCREENBLOCK(SB_1) | BG_PRIORITY(2) | BG_SIZE(1);
454 } else { 454 } else {
455 backbuf = BUF_0; 455 backbuf = BUF_0;
456 BG_H_SCROLL_0 = 240; 456 BG_H_SCROLL_0 = -240;
457 BG_H_SCROLL_1 = 0; 457 BG_H_SCROLL_1 = 0;
458 BG_CTRL(0) = BG_CHARBLOCK(CB_0) | BG_SCREENBLOCK(SB_0) | BG_PRIORITY(2) | BG_SIZE(1); 458 BG_CTRL(0) = BG_CHARBLOCK(CB_0) | BG_SCREENBLOCK(SB_0) | BG_PRIORITY(2) | BG_SIZE(1);
459 BG_CTRL(1) = BG_CHARBLOCK(CB_1) | BG_SCREENBLOCK(SB_1) | BG_PRIORITY(0) | BG_SIZE(1); 459 BG_CTRL(1) = BG_CHARBLOCK(CB_1) | BG_SCREENBLOCK(SB_1) | BG_PRIORITY(0) | BG_SIZE(1);
@@ -645,23 +645,12 @@ renderer_init(void) {
645 mem_map_fg[i] = i; 645 mem_map_fg[i] = i;
646 mem_map_fg_blank[i] = 32 * 20 - 1; 646 mem_map_fg_blank[i] = 32 * 20 - 1;
647 mem_map_bg[i] = i + 32 * 4; 647 mem_map_bg[i] = i + 32 * 4;
648 mem_map_bg_blank[i] = 32 * 20 - 1; 648 mem_map_bg_blank[i] = (32 * 20 - 1) + 32 * 4;
649 } 649 }
650 650
651 // Setup initial background state. 651 // Setup initial background state.
652 BG_H_SCROLL_0 = 240; 652 BG_H_SCROLL_0 = -240;
653 BG_H_SCROLL_1 = 240; 653 BG_H_SCROLL_1 = -240;
654
655 // FIXME: clean this up.
656 // u32 *clr_tile =((u32*)(MEM_VRAM) + 0xC000 / 4);
657 // clr_tile[0] = 0x22222222;
658 // clr_tile[1] = 0x22222222;
659 // clr_tile[2] = 0x22222222;
660 // clr_tile[3] = 0x22222222;
661 // clr_tile[4] = 0x22222222;
662 // clr_tile[5] = 0x22222222;
663 // clr_tile[6] = 0x22222222;
664 // clr_tile[7] = 0x22222222;
665 654
666 // Initialize default palette. 655 // Initialize default palette.
667 PAL_BUFFER_BG[0] = COLOR_BLACK; 656 PAL_BUFFER_BG[0] = COLOR_BLACK;