From 680f0e2294f87deaf43d01b500988f5c81d7d8d2 Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 6 Sep 2021 13:48:07 +0200 Subject: [PATCH] Fixed Hercules overscan in graphics mode, fixes #1666. --- src/video/vid_hercules.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/video/vid_hercules.c b/src/video/vid_hercules.c index 650d9e5b0..4e1d4e8b9 100644 --- a/src/video/vid_hercules.c +++ b/src/video/vid_hercules.c @@ -279,11 +279,17 @@ static void hercules_render_overscan_left(hercules_t *dev) { int i; + uint32_t width; + + if (dev->ctrl & 0x02) + width = (((uint32_t) dev->crtc[1]) << 4); + else + width = (((uint32_t) dev->crtc[1]) * 9); if ((dev->displine + 14) < 0) return; - if ((((uint32_t) dev->crtc[1]) * 9) == 0) + if (width == 0) return; for (i = 0; i < 8; i++) @@ -295,15 +301,21 @@ static void hercules_render_overscan_right(hercules_t *dev) { int i; + uint32_t width; + + if (dev->ctrl & 0x02) + width = (((uint32_t) dev->crtc[1]) << 4); + else + width = (((uint32_t) dev->crtc[1]) * 9); if ((dev->displine + 14) < 0) return; - if ((((uint32_t) dev->crtc[1]) * 9) == 0) + if (width == 0) return; for (i = 0; i < 8; i++) - buffer32->line[dev->displine + 14][8 + (((uint32_t) dev->crtc[1]) * 9) + i] = 0x00000000; + buffer32->line[dev->displine + 14][8 + width + i] = 0x00000000; }