summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2022-04-02 20:35:15 -0400
committer AJR <ajrhacker@users.noreply.github.com>2022-04-02 20:35:15 -0400
commitc127f891cbb2a6d86f4a8efd319947a4bf9ea4d2 (patch)
tree7fd7586225964212c799add2e786c742b6e862fe
parent7faf626342d19de47772dde062bfdbc1619c253c (diff)
v9938: Fix out-of-bounds errors from invalid command writes in certain modes
-rw-r--r--src/devices/video/v9938.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/devices/video/v9938.cpp b/src/devices/video/v9938.cpp
index 187192b85fb..9aa2d4b0aa8 100644
--- a/src/devices/video/v9938.cpp
+++ b/src/devices/video/v9938.cpp
@@ -2915,13 +2915,11 @@ void v99x8_device::report_vdp_command(uint8_t Op)
/*************************************************************/
uint8_t v99x8_device::command_unit_w(uint8_t Op)
{
- int SM;
-
// V9938 ops only work in SCREENs 5-8
- if (m_mode<5)
+ if (m_mode<5 || m_mode>8)
return(0);
- SM = m_mode-5; // Screen mode index 0..3
+ int SM = m_mode-5; // Screen mode index 0..3
m_mmc.CM = Op>>4;
if ((m_mmc.CM & 0x0C) != 0x0C && m_mmc.CM != 0)