m6502: Fixed paged variants tracing and breakpoints [O. Galibert]

This commit is contained in:
Olivier Galibert 2018-02-07 18:20:33 +01:00
parent 870695380c
commit 38306e6b27
8 changed files with 26 additions and 35 deletions

View File

@ -50,8 +50,10 @@ void m6502_device::init()
sync_w.resolve_safe();
state_add(STATE_GENPC, "GENPC", NPC).noshow();
state_add(STATE_GENPCBASE, "CURPC", PPC).noshow();
XPC = 0;
state_add(STATE_GENPC, "GENPC", XPC).callexport().noshow();
state_add(STATE_GENPCBASE, "CURPC", XPC).callexport().noshow();
state_add(STATE_GENSP, "GENSP", SP).noshow();
state_add(STATE_GENFLAGS, "GENFLAGS", P).callimport().formatstr("%6s").noshow();
state_add(M6502_PC, "PC", NPC).callimport();
@ -373,6 +375,11 @@ uint8_t m6502_device::do_asr(uint8_t v)
return v;
}
offs_t m6502_device::pc_to_external(u16 pc)
{
return pc;
}
void m6502_device::execute_run()
{
if(inst_substate)
@ -383,7 +390,7 @@ void m6502_device::execute_run()
PPC = NPC;
inst_state = IR | inst_state_base;
if(machine().debug_flags & DEBUG_FLAG_ENABLED)
debugger_instruction_hook(this, NPC);
debugger_instruction_hook(this, pc_to_external(NPC));
}
do_exec_full();
}
@ -437,6 +444,10 @@ void m6502_device::state_import(const device_state_entry &entry)
void m6502_device::state_export(const device_state_entry &entry)
{
switch(entry.index()) {
case STATE_GENPC: XPC = pc_to_external(PPC); break;
case STATE_GENPCBASE: XPC = pc_to_external(NPC); break;
}
}
void m6502_device::state_string_export(const device_state_entry &entry, std::string &str) const

View File

@ -140,6 +140,8 @@ protected:
void prefetch_noirq();
void set_nz(uint8_t v);
u32 XPC;
virtual offs_t pc_to_external(u16 pc); // For paged PCs
virtual void do_exec_full();
virtual void do_exec_partial();

View File

@ -15,7 +15,7 @@
DEFINE_DEVICE_TYPE(M6509, m6509_device, "m6509", "M6509")
m6509_device::m6509_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
m6502_device(mconfig, M6509, tag, owner, clock), XPC(0), bank_i(0), bank_y(0)
m6502_device(mconfig, M6509, tag, owner, clock), bank_i(0), bank_y(0)
{
program_config.m_addr_width = 20;
program_config.m_logaddr_width = 20;
@ -45,14 +45,9 @@ void m6509_device::device_reset()
bank_y = 0x0f;
}
void m6509_device::state_export(const device_state_entry &entry)
offs_t m6509_device::pc_to_external(u16 pc)
{
switch(entry.index()) {
case STATE_GENPC:
case STATE_GENPCBASE:
XPC = adr_in_bank_i(NPC);
break;
}
return adr_in_bank_i(pc);
}
util::disasm_interface *m6509_device::create_disassembler()

View File

@ -46,9 +46,7 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void state_export(const device_state_entry &entry) override;
uint32_t XPC;
virtual offs_t pc_to_external(u16 pc) override;
uint8_t bank_i, bank_y;

View File

@ -72,10 +72,6 @@ void m65ce02_device::state_import(const device_state_entry &entry)
}
}
void m65ce02_device::state_export(const device_state_entry &entry)
{
}
void m65ce02_device::state_string_export(const device_state_entry &entry, std::string &str) const
{
switch(entry.index()) {

View File

@ -33,7 +33,6 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void state_import(const device_state_entry &entry) override;
virtual void state_export(const device_state_entry &entry) override;
virtual void state_string_export(const device_state_entry &entry, std::string &str) const override;
inline void dec_SP_ce() { if(P & F_E) SP = set_l(SP, SP-1); else SP--; }

View File

@ -32,6 +32,11 @@ util::disasm_interface *xavix_device::create_disassembler()
}
offs_t xavix_device::pc_to_external(u16 pc)
{
return adr_with_bank(pc);
}
void xavix_device::device_start()
{
if(direct_disabled)
@ -43,26 +48,11 @@ void xavix_device::device_start()
m_vector_callback.bind_relative_to(*owner());
init();
state_add(STATE_GENPC, "GENPC", XPC).callexport().noshow();
state_add(STATE_GENPCBASE, "CURPC", XPC).callexport().noshow();
}
void xavix_device::state_export(const device_state_entry &entry)
{
switch(entry.index()) {
case STATE_GENPC:
case STATE_GENPCBASE:
XPC = adr_with_bank(NPC);
break;
}
}
void xavix_device::device_reset()
{
m_farbank = 0;
XPC = 0;
m6502_device::device_reset();
}

View File

@ -70,7 +70,7 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void state_export(const device_state_entry &entry) override;
virtual offs_t pc_to_external(u16 pc) override;
private:
xavix_interrupt_vector_delegate m_vector_callback;