summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/emu/cpu/m6502/m6502.c7
-rw-r--r--src/emu/cpu/m6502/m6502.h3
-rwxr-xr-xsrc/emu/cpu/m6502/m6502make.py22
3 files changed, 19 insertions, 13 deletions
diff --git a/src/emu/cpu/m6502/m6502.c b/src/emu/cpu/m6502/m6502.c
index d944a433415..2d15dadd967 100644
--- a/src/emu/cpu/m6502/m6502.c
+++ b/src/emu/cpu/m6502/m6502.c
@@ -100,6 +100,7 @@ void m6502_device::init()
save_item(NAME(v_state));
save_item(NAME(inst_state));
save_item(NAME(inst_substate));
+ save_item(NAME(inst_state_base));
save_item(NAME(irq_taken));
save_item(NAME(inhibit_interrupts));
@@ -122,6 +123,7 @@ void m6502_device::init()
v_state = false;
inst_state = STATE_RESET;
inst_substate = 0;
+ inst_state_base = 0;
sync = false;
end_cycles = 0;
inhibit_interrupts = false;
@@ -131,6 +133,7 @@ void m6502_device::device_reset()
{
inst_state = STATE_RESET;
inst_substate = 0;
+ inst_state_base = 0;
nmi_state = false;
irq_state = false;
apu_irq_state = false;
@@ -406,7 +409,7 @@ void m6502_device::execute_run()
while(icount > 0) {
if(inst_state < 0x100) {
PPC = NPC;
- inst_state = IR;
+ inst_state = IR | inst_state_base;
if(machine().debug_flags & DEBUG_FLAG_ENABLED)
debugger_instruction_hook(this, NPC);
}
@@ -479,7 +482,7 @@ UINT32 m6502_device::disasm_max_opcode_bytes() const
offs_t m6502_device::disassemble_generic(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options, const disasm_entry *table)
{
- const disasm_entry &e = table[oprom[0]];
+ const disasm_entry &e = table[oprom[0] | inst_state_base];
UINT32 flags = e.flags | DASMFLAG_SUPPORTED;
buffer += sprintf(buffer, "%s", e.opcode);
diff --git a/src/emu/cpu/m6502/m6502.h b/src/emu/cpu/m6502/m6502.h
index 766f30a1fe3..0588442e9bd 100644
--- a/src/emu/cpu/m6502/m6502.h
+++ b/src/emu/cpu/m6502/m6502.h
@@ -97,7 +97,7 @@ protected:
};
enum {
- STATE_RESET = 0x100,
+ STATE_RESET = 0xff00,
};
enum {
@@ -182,6 +182,7 @@ protected:
UINT8 Y; /* Y index register */
UINT8 P; /* Processor status */
UINT8 IR; /* Prefetched instruction register */
+ int inst_state_base; /* Current instruction bank */
memory_interface *mintf;
int inst_state, inst_substate;
diff --git a/src/emu/cpu/m6502/m6502make.py b/src/emu/cpu/m6502/m6502make.py
index e6da2f2e992..38ac41841d9 100755
--- a/src/emu/cpu/m6502/m6502make.py
+++ b/src/emu/cpu/m6502/m6502make.py
@@ -7,7 +7,7 @@ Usage:
import sys
import logging
-MAX_STATES = 0x101
+MAX_STATES = 0
def load_opcodes(fname):
"""Load opcodes from .lst file"""
@@ -174,7 +174,7 @@ DO_EXEC_PARTIAL_EPILOG="""\
"""
DISASM_PROLOG="""\
-const %(device)s::disasm_entry %(device)s::disasm_entries[0x100] = {
+const %(device)s::disasm_entry %(device)s::disasm_entries[0x%(disasm_count)x] = {
"""
DISASM_EPILOG="""\
@@ -182,15 +182,17 @@ DISASM_EPILOG="""\
"""
def save_tables(f, device, states):
+ total_states = len(states)
+
d = { "device": device,
+ "disasm_count": total_states-1
}
-
- assert len(states) == MAX_STATES
-
+
+
emit(f, DO_EXEC_FULL_PROLOG % d)
for n, state in enumerate(states):
if state == ".": continue
- if n < MAX_STATES - 1:
+ if n < total_states - 1:
emit(f, "\tcase 0x%02x: %s_full(); break;\n" % (n, state))
else:
emit(f, "\tcase %s: %s_full(); break;\n" % ("STATE_RESET", state))
@@ -199,16 +201,16 @@ def save_tables(f, device, states):
emit(f, DO_EXEC_PARTIAL_PROLOG % d)
for n, state in enumerate(states):
if state == ".": continue
- if n < MAX_STATES - 1:
+ if n < total_states - 1:
emit(f, "\tcase 0x%02x: %s_partial(); break;\n" % (n, state))
else:
emit(f, "\tcase %s: %s_partial(); break;\n" % ("STATE_RESET", state))
emit(f, DO_EXEC_PARTIAL_EPILOG % d)
- emit(f, DISASM_PROLOG % d)
+ emit(f, DISASM_PROLOG % d )
for n, state in enumerate(states):
if state == ".": continue
- if n == MAX_STATES - 1: break
+ if n == total_states - 1: break
tokens = state.split("_")
opc = tokens[0]
mode = tokens[-1]
@@ -262,8 +264,8 @@ def main(argv):
states = load_disp(argv[3])
logging.info("loaded %s states", len(states))
- assert len(states) == MAX_STATES
+ assert (len(states) & 0xff) == 1
save(argv[4], device_name, opcodes, states)