From 2e8473ff8e2d07a0ecc23eadf39d9c860dda8772 Mon Sep 17 00:00:00 2001 From: scawful Date: Sat, 11 May 2024 13:57:08 -0400 Subject: [PATCH] use callbacks directly to reduce stack frame impact of writes --- src/app/emu/cpu/cpu.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/app/emu/cpu/cpu.h b/src/app/emu/cpu/cpu.h index d8ff3220..a9168a69 100644 --- a/src/app/emu/cpu/cpu.h +++ b/src/app/emu/cpu/cpu.h @@ -179,23 +179,23 @@ class Cpu : public Loggable, public core::ExperimentFlags { void WriteWord(uint32_t address, uint32_t address_high, uint16_t value, bool reversed = false, bool int_check = false) { if (reversed) { - WriteByte(address_high, value >> 8); + callbacks_.write_byte(address_high, value >> 8); if (int_check) CheckInt(); - WriteByte(address, value & 0xFF); + callbacks_.write_byte(address, value & 0xFF); } else { - WriteByte(address, value & 0xFF); + callbacks_.write_byte(address, value & 0xFF); if (int_check) CheckInt(); - WriteByte(address_high, value >> 8); + callbacks_.write_byte(address_high, value >> 8); } } void WriteLong(uint32_t address, uint32_t value) { - WriteByte(address, value & 0xFF); - WriteByte(address + 1, (value >> 8) & 0xFF); - WriteByte(address + 2, value >> 16); + callbacks_.write_byte(address, value & 0xFF); + callbacks_.write_byte(address + 1, (value >> 8) & 0xFF); + callbacks_.write_byte(address + 2, value >> 16); } void PushByte(uint8_t value) { - WriteByte(SP(), value); + callbacks_.write_byte(SP(), value); SetSP(SP() - 1); if (E) SetSP((SP() & 0xff) | 0x100); }