From 2f41bae9f899a07e086d87d6b5fd0ddda3f3bbf4 Mon Sep 17 00:00:00 2001 From: Stefan Arentz Date: Tue, 27 Dec 2016 14:51:05 -0500 Subject: [PATCH 1/2] Fixes #102 Colors in hires mode are incorrect --- src/scr.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/scr.c b/src/scr.c index 2ae579f..9d5b6e7 100644 --- a/src/scr.c +++ b/src/scr.c @@ -180,10 +180,10 @@ static uint16_t hgr_line_offsets[192] = { static SDL_Color hgr_colors[16] = { { 0, 0, 0, 0 }, // 0 Black - { 0, 0, 204, 0 }, // 1 Blue - { 128, 0, 128, 0 }, // 2 Purple - { 0, 100, 0, 0 }, // 3 Green - { 0, 100, 0, 0 }, // 4 Red + { 0, 150, 255, 0 }, // 1 Light Blue + { 255, 64, 255, 0 }, // 2 Purple + { 0, 249, 0, 0 }, // 3 Green + { 255, 147, 0, 0 }, // 4 Orange { 255, 255, 255, 0 } // 5 White }; @@ -225,7 +225,7 @@ static void inline scr_render_hgr_line_color(struct scr_t *scr, int line, uint16 } } else { if (c & 0x80) { - pixels[x] = 4; // Red + pixels[x] = 4; // Orange } else { pixels[x] = 3; // Green } @@ -245,6 +245,14 @@ static void inline scr_render_hgr_line_color(struct scr_t *scr, int line, uint16 } } + // Fill black pixels with same neighbours + + for (int i = 0; i < (280-1); i++) { + if (pixels[i] == pixels[i+2] && pixels[i] != 0) { + pixels[i+1] = pixels[i]; + } + } + // Now draw them for (x = 0; x < 280; x++) { From 07bcaecfb467ce798a1704da0cff0cc3599b4b49 Mon Sep 17 00:00:00 2001 From: Stefan Arentz Date: Thu, 29 Dec 2016 11:28:38 -0500 Subject: [PATCH 2/2] Add color and monochrome tests to scr_test --- src/scr_test.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/scr_test.c b/src/scr_test.c index e8363a1..57ccb97 100644 --- a/src/scr_test.c +++ b/src/scr_test.c @@ -62,11 +62,24 @@ void lgr_full_refresh_test(struct scr_t *scr) { ewm_scr_update(scr, 0, 0); } -void hgr_full_refresh_setup(struct scr_t *scr) { +void hgr_full_refresh_setup_monochrome(struct scr_t *scr) { scr->two->screen_mode = EWM_A2P_SCREEN_MODE_GRAPHICS; scr->two->screen_page = EWM_A2P_SCREEN_PAGE1; scr->two->screen_graphics_mode = EWM_A2P_SCREEN_GRAPHICS_MODE_HGR; scr->two->screen_graphics_style = EWM_A2P_SCREEN_GRAPHICS_STYLE_FULL; + scr->color_scheme = EWM_SCR_COLOR_SCHEME_MONOCHROME; + + for (uint16_t a = 0x2000; a <= 0x5fff; a++) { + mem_set_byte(scr->two->cpu, a, rand()); + } +} + +void hgr_full_refresh_setup_color(struct scr_t *scr) { + scr->two->screen_mode = EWM_A2P_SCREEN_MODE_GRAPHICS; + scr->two->screen_page = EWM_A2P_SCREEN_PAGE1; + scr->two->screen_graphics_mode = EWM_A2P_SCREEN_GRAPHICS_MODE_HGR; + scr->two->screen_graphics_style = EWM_A2P_SCREEN_GRAPHICS_STYLE_FULL; + scr->color_scheme = EWM_SCR_COLOR_SCHEME_COLOR; for (uint16_t a = 0x2000; a <= 0x5fff; a++) { mem_set_byte(scr->two->cpu, a, rand()); @@ -120,7 +133,8 @@ int main() { test(two->scr, "txt_full_refresh", txt_full_refresh_setup, txt_full_refresh_test); test(two->scr, "lgr_full_refresh", lgr_full_refresh_setup, lgr_full_refresh_test); - test(two->scr, "hgr_full_refresh", hgr_full_refresh_setup, hgr_full_refresh_test); + test(two->scr, "hgr_full_refresh_mono", hgr_full_refresh_setup_monochrome, hgr_full_refresh_test); + test(two->scr, "hgr_full_refresh_color", hgr_full_refresh_setup_color, hgr_full_refresh_test); // Destroy DSL things