mirror of
https://github.com/holub/mame
synced 2025-04-09 18:17:44 +03:00
cpu/z80: Improved z80 code generation
Some checks are pending
CI (Linux) / build-linux (-U_FORTIFY_SOURCE, gcc, gcc, g++, mametiny, tiny) (push) Waiting to run
CI (Linux) / build-linux (clang, clang, clang++, mame, mame) (push) Waiting to run
CI (macOS) / build-macos (push) Waiting to run
CI (Windows) / build-windows (clang, clang, clang++, mametiny, tiny) (push) Waiting to run
CI (Windows) / build-windows (gcc, gcc, g++, mame, mame) (push) Waiting to run
Some checks are pending
CI (Linux) / build-linux (-U_FORTIFY_SOURCE, gcc, gcc, g++, mametiny, tiny) (push) Waiting to run
CI (Linux) / build-linux (clang, clang, clang++, mame, mame) (push) Waiting to run
CI (macOS) / build-macos (push) Waiting to run
CI (Windows) / build-windows (clang, clang, clang++, mametiny, tiny) (push) Waiting to run
CI (Windows) / build-windows (gcc, gcc, g++, mame, mame) (push) Waiting to run
before: ~/workspace/mame (z80-perf*) » ./mame pacman -bench 300 Average speed: 11871.24% (299 seconds) after: ~/workspace/mame (z80-perf*) » ./mame pacman -bench 300 Average speed: 12235.35% (299 seconds)
This commit is contained in:
parent
d914e2a574
commit
a9bc46cb17
@ -47,8 +47,7 @@ void nsc800_device::device_reset()
|
||||
//-------------------------------------------------
|
||||
// execute
|
||||
//-------------------------------------------------
|
||||
|
||||
void nsc800_device::do_op()
|
||||
void nsc800_device::execute_run()
|
||||
{
|
||||
#include "cpu/z80/ncs800.hxx"
|
||||
}
|
||||
|
@ -26,9 +26,9 @@ protected:
|
||||
virtual void device_reset() override ATTR_COLD;
|
||||
|
||||
// device_execute_interface implementation
|
||||
virtual void execute_run() override;
|
||||
virtual void execute_set_input(int inputnum, int state) override;
|
||||
|
||||
virtual void do_op() override;
|
||||
u8 m_nsc800_irq_state[3]; // state of NSC800 restart interrupts A, B, C
|
||||
};
|
||||
|
||||
|
@ -97,7 +97,7 @@ void r800_device::muluw(u16 value)
|
||||
set_f((F & (HF|NF)) | z | c);
|
||||
}
|
||||
|
||||
void r800_device::do_op()
|
||||
void r800_device::execute_run()
|
||||
{
|
||||
#include "cpu/z80/r800.hxx"
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ protected:
|
||||
// device_execute_interface overrides
|
||||
virtual u64 execute_clocks_to_cycles(u64 clocks) const noexcept override { return (clocks + 4 - 1) / 4; }
|
||||
virtual u64 execute_cycles_to_clocks(u64 cycles) const noexcept override { return (cycles * 4); }
|
||||
virtual void execute_run() override;
|
||||
|
||||
// device_disasm_interface implementation
|
||||
virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
|
||||
@ -40,8 +41,6 @@ protected:
|
||||
u8 r800_sll(u8 value);
|
||||
void mulub(u8 value);
|
||||
void muluw(u16 value);
|
||||
|
||||
virtual void do_op() override;
|
||||
};
|
||||
|
||||
// device type declaration
|
||||
|
@ -699,26 +699,12 @@ void z80_device::device_reset()
|
||||
m_iff2 = 0;
|
||||
}
|
||||
|
||||
void z80_device::do_op()
|
||||
{
|
||||
#include "cpu/z80/z80.hxx"
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Execute 'cycles' T-states.
|
||||
****************************************************************************/
|
||||
void z80_device::execute_run()
|
||||
{
|
||||
if (m_wait_state)
|
||||
{
|
||||
m_icount = 0; // stalled
|
||||
return;
|
||||
}
|
||||
|
||||
while (m_icount > 0)
|
||||
{
|
||||
do_op();
|
||||
}
|
||||
#include "cpu/z80/z80.hxx"
|
||||
}
|
||||
|
||||
void z80_device::execute_set_input(int inputnum, int state)
|
||||
|
@ -121,8 +121,6 @@ protected:
|
||||
void set_f(u8 f);
|
||||
void block_io_interrupted_flags();
|
||||
|
||||
virtual void do_op();
|
||||
|
||||
virtual u8 data_read(u16 addr);
|
||||
virtual void data_write(u16 addr, u8 value);
|
||||
virtual u8 stack_read(u16 addr) { return data_read(addr); }
|
||||
|
@ -508,11 +508,11 @@ macro r800:otdr
|
||||
|
||||
macro jump %opcode
|
||||
m_ref = 0x%opcode00;
|
||||
if (true) return;
|
||||
goto start;
|
||||
|
||||
macro jump_prefixed %prefix
|
||||
m_ref = (%prefix << 16) | (TDAT8 << 8);
|
||||
if (true) return;
|
||||
goto start;
|
||||
|
||||
macro take_nmi
|
||||
// Check if processor was halted
|
||||
@ -671,6 +671,9 @@ macro ncs800:check_interrupts
|
||||
# ROP
|
||||
##########################################################
|
||||
ffff
|
||||
rop:
|
||||
m_ref = 0xffff00;
|
||||
if (m_icount <= 0) return;
|
||||
if (m_busrq_state) {
|
||||
if (!m_busack_state) {
|
||||
m_busack_state = 1;
|
||||
@ -691,13 +694,13 @@ ffff
|
||||
call rop
|
||||
PC--;
|
||||
m_ref = 0xffff00;
|
||||
return;
|
||||
goto rop;
|
||||
} else {
|
||||
PRVPC = PC;
|
||||
debugger_instruction_hook(PC);
|
||||
call rop
|
||||
m_ref = (0x00 << 16) | (TDAT8 << 8);
|
||||
return;
|
||||
goto start;
|
||||
}
|
||||
|
||||
|
||||
|
@ -220,6 +220,13 @@ class OpcodeList:
|
||||
|
||||
def save_exec(self, f):
|
||||
prefix = None
|
||||
print("if (m_wait_state)", file=f)
|
||||
print("{", file=f)
|
||||
print(" m_icount = 0; // stalled", file=f)
|
||||
print(" return;", file=f)
|
||||
print("}", file=f)
|
||||
print("while (true) {", file=f)
|
||||
print("start:", file=f)
|
||||
print("switch (u8(m_ref >> 16)) // prefix", file=f)
|
||||
print("{", file=f)
|
||||
for opc in self.opcode_info:
|
||||
@ -237,10 +244,8 @@ class OpcodeList:
|
||||
print("\tswitch (u8(m_ref >> 8)) // opcode", file=f)
|
||||
print("\t{", file=f)
|
||||
print("\tcase 0x%s:" % (opc.code[2:]), file=f)
|
||||
#print("\t{", file=f)
|
||||
opc.save_dasm(f)
|
||||
#print("\t}", file=f)
|
||||
print("\t\tbreak;", file=f)
|
||||
print("\t\tgoto rop;", file=f)
|
||||
print("", file=f)
|
||||
print("\t} // switch opcode", file=f)
|
||||
print("}", file=f)
|
||||
@ -248,7 +253,7 @@ class OpcodeList:
|
||||
print("", file=f)
|
||||
print("} // switch prefix", file=f)
|
||||
print("", file=f)
|
||||
print("m_ref = 0xffff00;", file=f)
|
||||
print("} // while (true)", file=f)
|
||||
|
||||
def main(argv):
|
||||
if len(argv) != 3 and len(argv) != 4:
|
||||
|
@ -31,7 +31,7 @@ z80n_device::z80n_device(const machine_config &mconfig, const char *tag, device_
|
||||
{
|
||||
}
|
||||
|
||||
void z80n_device::do_op()
|
||||
void z80n_device::execute_run()
|
||||
{
|
||||
#include "cpu/z80/z80n.hxx"
|
||||
}
|
||||
|
@ -26,7 +26,8 @@ protected:
|
||||
virtual void device_start() override ATTR_COLD;
|
||||
virtual void device_reset() override ATTR_COLD;
|
||||
|
||||
virtual void do_op() override;
|
||||
// device_execute_interface implementation
|
||||
virtual void execute_run() override;
|
||||
|
||||
devcb_write8 m_out_retn_seen_cb;
|
||||
devcb_read8 m_in_nextreg_cb;
|
||||
|
Loading…
Reference in New Issue
Block a user