From 9dc9d774c0c5714d66677687f17c0ca3f0206094 Mon Sep 17 00:00:00 2001 From: AJR Date: Sat, 8 Apr 2023 10:34:28 -0400 Subject: [PATCH] m6809: Read reset vector during execute_run rather than device_reset to facilitate bank switching of vectoro area --- src/devices/cpu/m6809/m6809.cpp | 3 +-- src/devices/cpu/m6809/m6809.h | 2 +- src/devices/cpu/m6809/m6809make.py | 6 +++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/devices/cpu/m6809/m6809.cpp b/src/devices/cpu/m6809/m6809.cpp index 8495d8c27f1..50a5003b8b7 100644 --- a/src/devices/cpu/m6809/m6809.cpp +++ b/src/devices/cpu/m6809/m6809.cpp @@ -245,8 +245,7 @@ void m6809_base_device::device_reset() m_cc |= CC_I; // IRQ disabled m_cc |= CC_F; // FIRQ disabled - m_pc.b.h = space(AS_PROGRAM).read_byte(VECTOR_RESET_FFFE + 0); - m_pc.b.l = space(AS_PROGRAM).read_byte(VECTOR_RESET_FFFE + 1); + set_ea(VECTOR_RESET_FFFE); // reset sub-instruction state reset_state(); diff --git a/src/devices/cpu/m6809/m6809.h b/src/devices/cpu/m6809/m6809.h index 96cfbebe1fd..92e4b1170d2 100644 --- a/src/devices/cpu/m6809/m6809.h +++ b/src/devices/cpu/m6809/m6809.h @@ -204,7 +204,7 @@ protected: // state stack - implemented as a uint32_t void push_state(uint16_t state) { m_state = (m_state << 9) | state; } uint16_t pop_state() { uint16_t result = m_state & 0x1ff; m_state >>= 9; return result; } - void reset_state() { m_state = 0; } + void reset_state() { m_state = 1; } // effective address reading/writing uint8_t read_ea() { return read_memory(m_ea.w); } diff --git a/src/devices/cpu/m6809/m6809make.py b/src/devices/cpu/m6809/m6809make.py index 1f505d22197..4b966005ef9 100644 --- a/src/devices/cpu/m6809/m6809make.py +++ b/src/devices/cpu/m6809/m6809make.py @@ -7,10 +7,10 @@ import re import sys # Initial state -state = 1 text = "" -dispatch_to_states = { "MAIN" : 0 } -states_to_dispatch = { 0 : "MAIN" } +dispatch_to_states = { "MAIN" : 0, "INTERRUPT_VECTOR" : 1 } +states_to_dispatch = { 0 : "MAIN", 1 : "INTERRUPT_VECTOR" } +state = len(states_to_dispatch) def load_file(fname, lines): path = fname.rpartition('/')[0]