From 4b25a22adabbe27cec9b81d0fb812f7ec6371e1a Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 19 Jul 2021 02:41:43 +0200 Subject: [PATCH] Added the ability to invert LCD colors for the Toshiba T1000 and T1200, and the Amstrad PPC512/640. --- src/machine/m_amstrad.c | 19 ++++++++++++++++--- src/machine/m_xt_t1000_vid.c | 28 ++++++++++++++++++++++------ 2 files changed, 38 insertions(+), 9 deletions(-) diff --git a/src/machine/m_amstrad.c b/src/machine/m_amstrad.c index c4ace48f0..be44fa734 100644 --- a/src/machine/m_amstrad.c +++ b/src/machine/m_amstrad.c @@ -108,7 +108,8 @@ typedef struct { stat; uint8_t plane_write, /* 1512/200 */ plane_read, /* 1512/200 */ - border; /* 1512/200 */ + border, /* 1512/200 */ + invert; /* 512/640 */ int fontbase; /* 1512/200 */ int linepos, displine; @@ -1695,8 +1696,17 @@ vid_init_200(amstrad_t *ams) overscan_x = overscan_y = 16; - green = makecol(0x1C, 0x71, 0x31); - blue = makecol(0x0f, 0x21, 0x3f); + if (ams->type == AMS_PC200) + vid->invert = 0; + else + vid->invert = device_get_config_int("invert"); + if (vid->invert) { + blue = makecol(0x1C, 0x71, 0x31); + green = makecol(0x0f, 0x21, 0x3f); + } else { + green = makecol(0x1C, 0x71, 0x31); + blue = makecol(0x0f, 0x21, 0x3f); + } cgapal_rebuild(); set_lcd_cols(0); @@ -1954,6 +1964,9 @@ device_config_t vid_ppc512_config[] = } } }, + { + "invert", "Invert LCD colors", CONFIG_BINARY, "", 0 + }, { "", "", -1 } diff --git a/src/machine/m_xt_t1000_vid.c b/src/machine/m_xt_t1000_vid.c index b0c81eb01..c3930d29e 100644 --- a/src/machine/m_xt_t1000_vid.c +++ b/src/machine/m_xt_t1000_vid.c @@ -118,7 +118,8 @@ typedef struct t1000_t int vc; int dispon; int vsynctime; - uint8_t video_options, backlight; + uint8_t video_options; + uint8_t backlight, invert; uint8_t *vram; } t1000_t; @@ -588,12 +589,22 @@ static void t1000_recalcattrs(t1000_t *t1000) * are bold */ /* Set up colours */ - if (t1000->backlight) { - blue = makecol(0x2D, 0x39, 0x5A); - grey = makecol(0x85, 0xa0, 0xD6); + if (t1000->invert) { + if (t1000->backlight) { + grey = makecol(0x2D, 0x39, 0x5A); + blue = makecol(0x85, 0xa0, 0xD6); + } else { + grey = makecol(0x0f, 0x21, 0x3f); + blue = makecol(0x1C, 0x71, 0x31); + } } else { - blue = makecol(0x0f, 0x21, 0x3f); - grey = makecol(0x1C, 0x71, 0x31); + if (t1000->backlight) { + blue = makecol(0x2D, 0x39, 0x5A); + grey = makecol(0x85, 0xa0, 0xD6); + } else { + blue = makecol(0x0f, 0x21, 0x3f); + grey = makecol(0x1C, 0x71, 0x31); + } } /* Initialise the attribute mapping. Start by defaulting everything @@ -686,7 +697,9 @@ static void *t1000_init(const device_t *info) video_inform(VIDEO_FLAG_TYPE_CGA, &timing_t1000); t1000->internal = 1; + t1000->backlight = device_get_config_int("backlight"); + t1000->invert = device_get_config_int("invert"); /* 16k video RAM */ t1000->vram = malloc(0x4000); @@ -749,6 +762,9 @@ static const device_config_t t1000_config[] = { "backlight", "Enable backlight", CONFIG_BINARY, "", 1 }, + { + "invert", "Invert colors", CONFIG_BINARY, "", 0 + }, { .type = -1 }