From 4df513c8dd4aa40f7931213d4dc6b90756d014d4 Mon Sep 17 00:00:00 2001 From: celerizer <33245078+celerizer@users.noreply.github.com> Date: Tue, 29 Oct 2024 06:40:12 -0500 Subject: [PATCH] and lcd too --- devices/lcd.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/devices/lcd.c b/devices/lcd.c index c9e53e5..8d239a6 100644 --- a/devices/lcd.c +++ b/devices/lcd.c @@ -95,9 +95,11 @@ void h8_lcd_read(h8_device_t *device, h8_byte_t *dst) else if (m_lcd->data_mode) { /* Data mode read -- retreive raw VRAM bytes */ - dst->u = m_lcd->vram[m_lcd->y * 0x0100 + - m_lcd->x * 2 + - m_lcd->second_read ? 1 : 0]; + unsigned offset = m_lcd->y * 0x0100 + + m_lcd->x * 2 + + (m_lcd->second_write_data ? 1 : 0); + + dst->u = m_lcd->vram[offset]; /* If we are retreiving the second byte, increment only the X address */ if (m_lcd->second_read)