From 26ba4a362e3ad433ad34b996d2b32d7cddc03e3c Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Tue, 26 Apr 2022 19:13:55 +0200 Subject: [PATCH] Init cleanups and gnet fix --- src/devices/cpu/mn10200/mn10200.cpp | 11 +++++++++++ src/devices/cpu/psx/psx.cpp | 4 ++++ src/devices/machine/ataflash.cpp | 2 +- src/mame/machine/cat702.cpp | 2 ++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/devices/cpu/mn10200/mn10200.cpp b/src/devices/cpu/mn10200/mn10200.cpp index 17c45aa0cc1..0dcc3aef4ec 100644 --- a/src/devices/cpu/mn10200/mn10200.cpp +++ b/src/devices/cpu/mn10200/mn10200.cpp @@ -225,6 +225,17 @@ void mn10200_device::device_start() save_item(NAME(m_port[i].dir), i); } + // registering reads the value, so clear it before + m_pc = 0; + m_mdr = 0; + m_nmicr = 0; + m_iagr = 0; + for (int i=0; i != 4; i++) + { + m_d[i] = 0; + m_a[i] = 0; + } + // register for debugger state_add( MN10200_PC, "PC", m_pc ).mask(0xffffff).formatstr("%06X"); state_add( MN10200_MDR, "MDR", m_mdr).formatstr("%04X"); diff --git a/src/devices/cpu/psx/psx.cpp b/src/devices/cpu/psx/psx.cpp index 88c1e61aad9..7e1ce6bd6a0 100644 --- a/src/devices/cpu/psx/psx.cpp +++ b/src/devices/cpu/psx/psx.cpp @@ -1982,6 +1982,10 @@ void psxcpu_device::device_start() state_add( PSXCPU_CP2CR30, "zsf4", m_gte.m_cp2cr[ 30 ].d ); state_add( PSXCPU_CP2CR31, "flag", m_gte.m_cp2cr[ 31 ].d ); + // initialize the registers once + for(int i=0; i != 32; i++) + m_r[i] = 0; + // set our instruction counter set_icountptr(m_icount); diff --git a/src/devices/machine/ataflash.cpp b/src/devices/machine/ataflash.cpp index d1fb49054d9..892031e2052 100644 --- a/src/devices/machine/ataflash.cpp +++ b/src/devices/machine/ataflash.cpp @@ -160,7 +160,7 @@ void taito_pccard1_device::write_reg(offs_t offset, uint16_t data, uint16_t mem_ { uint8_t v = data; int pos = offset - 0x280; - uint8_t k = pos < sizeof(m_key) ? m_key[pos] : 0; + uint8_t k = pos < m_key.size() ? m_key[pos] : 0; // TODO: find out if unlocking the key then using an incorrect key will re-lock the card. if (v == k) diff --git a/src/mame/machine/cat702.cpp b/src/mame/machine/cat702.cpp index 38c51950e6f..a9b586ab06c 100644 --- a/src/mame/machine/cat702.cpp +++ b/src/mame/machine/cat702.cpp @@ -121,6 +121,8 @@ void cat702_device::device_start() m_dataout_handler.resolve_safe(); save_item(NAME(m_select)); + save_item(NAME(m_clock)); + save_item(NAME(m_datain)); save_item(NAME(m_state)); save_item(NAME(m_bit));