mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2025-02-02 08:29:45 +00:00
Simplifying the Z80 halt implementation looks better.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
parent
2efd53d33a
commit
4f47f3fc4d
@ -56,8 +56,7 @@ void EightBit::Z80::handleRESET() {
|
||||
|
||||
void EightBit::Z80::handleNMI() {
|
||||
raiseNMI();
|
||||
if (halted())
|
||||
proceed();
|
||||
raiseHALT();
|
||||
IFF1() = false;
|
||||
restart(0x66);
|
||||
tick(13);
|
||||
@ -65,8 +64,7 @@ void EightBit::Z80::handleNMI() {
|
||||
|
||||
void EightBit::Z80::handleINT() {
|
||||
IntelProcessor::handleINT();
|
||||
if (halted())
|
||||
proceed();
|
||||
raiseHALT();
|
||||
if (IFF1()) {
|
||||
di();
|
||||
switch (IM()) {
|
||||
@ -675,7 +673,7 @@ int EightBit::Z80::step() {
|
||||
handleNMI();
|
||||
} else if (UNLIKELY(lowered(INT()))) {
|
||||
handleINT();
|
||||
} else if (UNLIKELY(halted())) {
|
||||
} else if (UNLIKELY(lowered(HALT()))) {
|
||||
IntelProcessor::execute(0); // NOP
|
||||
} else {
|
||||
IntelProcessor::execute(fetchByte());
|
||||
@ -1274,7 +1272,7 @@ void EightBit::Z80::executeOther(const int x, const int y, const int z, const in
|
||||
if (UNLIKELY(memoryY || memoryZ)) // M operations
|
||||
tick(3);
|
||||
} else { // Exception (replaces LD (HL), (HL))
|
||||
halt();
|
||||
lowerHALT();
|
||||
}
|
||||
tick(4);
|
||||
break;
|
||||
|
@ -171,10 +171,6 @@ namespace EightBit {
|
||||
|
||||
void ret() final;
|
||||
|
||||
[[nodiscard]] auto halted() noexcept { return lowered(HALT()); }
|
||||
void halt() noexcept { --PC(); lowerHALT(); }
|
||||
void proceed() noexcept { ++PC(); raiseHALT(); }
|
||||
|
||||
private:
|
||||
std::array<opcode_decoded_t, 0x100> m_decodedOpcodes;
|
||||
register16_t m_sp = Mask16;
|
||||
|
Loading…
x
Reference in New Issue
Block a user