From bd8b58b5e9007ac9c27f3f15d80bb2aba2d6f95f Mon Sep 17 00:00:00 2001 From: OBattler Date: Thu, 14 Apr 2022 00:18:58 +0200 Subject: [PATCH] Fixed the warnings in the SC1184x RAMDAC code. --- src/video/vid_sc1148x_ramdac.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/video/vid_sc1148x_ramdac.c b/src/video/vid_sc1148x_ramdac.c index fcd314743..202147d14 100644 --- a/src/video/vid_sc1148x_ramdac.c +++ b/src/video/vid_sc1148x_ramdac.c @@ -42,12 +42,11 @@ void sc1148x_ramdac_out(uint16_t addr, int rs2, uint8_t val, void *p, svga_t *svga) { sc1148x_ramdac_t *ramdac = (sc1148x_ramdac_t *) p; - uint8_t rs = (addr & 0x03); - rs |= ((!!rs2) << 2); - int oldbpp = 0; + uint8_t rs = (addr & 0x03) | ((!!rs2) << 2); + int oldbpp = 0; - switch (addr) { - case 0x3c6: + switch (rs) { + case 2: case 6: switch (ramdac->state) { case 4: ramdac->state = 0; @@ -84,8 +83,7 @@ sc1148x_ramdac_out(uint16_t addr, int rs2, uint8_t val, void *p, svga_t *svga) } break; - case 0x3c7: case 0x3c8: - case 0x3c9: + default: ramdac->state = 0; svga_out(addr, val, svga); break; @@ -97,12 +95,10 @@ uint8_t sc1148x_ramdac_in(uint16_t addr, int rs2, void *p, svga_t *svga) { sc1148x_ramdac_t *ramdac = (sc1148x_ramdac_t *) p; - uint8_t ret = 0xff; - uint8_t rs = (addr & 0x03); - rs |= ((!!rs2) << 2); + uint8_t ret = 0xff, rs = (addr & 0x03) | ((!!rs2) << 2); - switch (addr) { - case 0x3c6: + switch (rs) { + case 2: case 6: switch (ramdac->state) { case 1: case 2: case 3: @@ -120,8 +116,7 @@ sc1148x_ramdac_in(uint16_t addr, int rs2, void *p, svga_t *svga) } break; - case 0x3c7: case 0x3c8: - case 0x3c9: + default: ret = svga_in(addr, svga); ramdac->state = 0; break;