push/popstack now do the MMR1 updating

This commit is contained in:
folkert van heusden 2023-03-23 08:55:52 +01:00
parent b020fea67d
commit 8a3594ec47
Signed by untrusted user who does not match committer: folkert
GPG key ID: 6B6455EDFEED3BD1

12
cpu.cpp
View file

@ -1203,8 +1203,6 @@ bool cpu::single_operand_instructions(const uint16_t instr)
case 0b00110101: { // MFPD/MFPI
// always words: word_mode-bit is to select between MFPI and MFPD
b->addToMMR1(-2, 6);
bool set_flags = true;
uint16_t v = 0xffff;
@ -1244,8 +1242,6 @@ bool cpu::single_operand_instructions(const uint16_t instr)
case 0b00110110: { // MTPI/MTPD
// always words: word_mode-bit is to select between MTPI and MTPD
b->addToMMR1(2, 6);
// retrieve word from '15/14'-stack
uint16_t v = popStack();
@ -1471,17 +1467,21 @@ void cpu::pushStack(const uint16_t v)
else {
uint16_t a = addRegister(6, false, -2);
b -> writeWord(a, v);
b->writeWord(a, v);
b->addToMMR1(-2, 6);
}
}
uint16_t cpu::popStack()
{
uint16_t a = getRegister(6);
uint16_t temp = b -> readWord(a);
uint16_t temp = b->readWord(a);
addRegister(6, false, 2);
b->addToMMR1(2, 6);
return temp;
}