From 878081bcba2ec1165f7d1dfabb3ed1b180486f38 Mon Sep 17 00:00:00 2001 From: hap Date: Fri, 4 Oct 2024 18:03:40 +0200 Subject: homelab: fix array OOB crash --- src/mame/homelab/homelab.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mame/homelab/homelab.cpp b/src/mame/homelab/homelab.cpp index 92780a676cf..314752d1d6f 100644 --- a/src/mame/homelab/homelab.cpp +++ b/src/mame/homelab/homelab.cpp @@ -251,10 +251,10 @@ u8 homelab2_state::memE000_r(offs_t offset) u8 gfx; if (m_screenshadow_is_text_mode) { - const int vramRelIndex0 = offset % 0x400; // Character address in video ram First character in 0x001 - const int row8_index0 = (offset - 1) / 0x400; // Row index in char [0-7] - u8 const chr = m_vram[vramRelIndex0]; // get char in videoram - gfx = m_p_chargen[chr | (row8_index0 << 8)]; // get dot pattern in chargen + const int vramRelIndex0 = offset & 0x3ff; // Character address in video ram First character in 0x001 + const int row8_index0 = ((offset - 1) & 0x1c00) >> 10; // Row index in char [0-7] + u8 const chr = m_vram[vramRelIndex0]; // get char in videoram + gfx = m_p_chargen[chr | (row8_index0 << 8)]; // get dot pattern in chargen } else { -- cgit v1.2.3