Skip to content

Commit 878081b

Browse files
committed
homelab: fix array OOB crash
1 parent 81362b5 commit 878081b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/mame/homelab/homelab.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,10 @@ u8 homelab2_state::memE000_r(offs_t offset)
251251
u8 gfx;
252252
if (m_screenshadow_is_text_mode)
253253
{
254-
const int vramRelIndex0 = offset % 0x400; // Character address in video ram First character in 0x001
255-
const int row8_index0 = (offset - 1) / 0x400; // Row index in char [0-7]
256-
u8 const chr = m_vram[vramRelIndex0]; // get char in videoram
257-
gfx = m_p_chargen[chr | (row8_index0 << 8)]; // get dot pattern in chargen
254+
const int vramRelIndex0 = offset & 0x3ff; // Character address in video ram First character in 0x001
255+
const int row8_index0 = ((offset - 1) & 0x1c00) >> 10; // Row index in char [0-7]
256+
u8 const chr = m_vram[vramRelIndex0]; // get char in videoram
257+
gfx = m_p_chargen[chr | (row8_index0 << 8)]; // get dot pattern in chargen
258258
}
259259
else
260260
{

0 commit comments

Comments
 (0)