micro-opt
This commit is contained in:
parent
54b9ac8eae
commit
a90547c3d1
2 changed files with 11 additions and 13 deletions
22
cpu.cpp
22
cpu.cpp
|
@ -146,19 +146,19 @@ void cpu::put_result(const uint16_t a, const uint8_t dst_mode, const uint8_t dst
|
|||
b->write(a, word_mode, value, false);
|
||||
}
|
||||
|
||||
void cpu::addRegister(const int nr, const bool prev_mode, const uint16_t value)
|
||||
uint16_t cpu::addRegister(const int nr, const bool prev_mode, const uint16_t value)
|
||||
{
|
||||
if (nr < 6)
|
||||
regs0_5[getBitPSW(11)][nr] += value;
|
||||
else if (nr == 6) {
|
||||
return regs0_5[getBitPSW(11)][nr] += value;
|
||||
|
||||
if (nr == 6) {
|
||||
if (prev_mode)
|
||||
sp[(getPSW() >> 12) & 3] += value;
|
||||
else
|
||||
sp[getPSW() >> 14] += value;
|
||||
}
|
||||
else {
|
||||
pc += value;
|
||||
return sp[(getPSW() >> 12) & 3] += value;
|
||||
|
||||
return sp[getPSW() >> 14] += value;
|
||||
}
|
||||
|
||||
return pc += value;
|
||||
}
|
||||
|
||||
bool cpu::getBitPSW(const int bit) const
|
||||
|
@ -1324,9 +1324,7 @@ void cpu::pushStack(const uint16_t v)
|
|||
exit(1);
|
||||
}
|
||||
|
||||
addRegister(6, false, -2);
|
||||
|
||||
uint16_t a = getRegister(6, false);
|
||||
uint16_t a = addRegister(6, false, -2);
|
||||
|
||||
b -> writeWord(a, v);
|
||||
}
|
||||
|
|
2
cpu.h
2
cpu.h
|
@ -38,7 +38,7 @@ private:
|
|||
|
||||
uint16_t getRegister(const int nr, const bool MF_MT) const;
|
||||
void setRegister(const int nr, const bool MF_MT, const uint16_t value);
|
||||
void addRegister(const int nr, const bool MF_MT, const uint16_t value);
|
||||
uint16_t addRegister(const int nr, const bool MF_MT, const uint16_t value);
|
||||
|
||||
uint16_t getGAMAddress(const uint8_t mode, const int reg, const bool word_mode, const bool MF_MT);
|
||||
uint16_t getGAM(const uint8_t mode, const uint8_t reg, const bool word_mode, const bool MF_MT);
|
||||
|
|
Loading…
Add table
Reference in a new issue