use from previous-addresspace was not implemented

This commit is contained in:
folkert van heusden 2022-03-22 13:15:59 +01:00
parent 42c065056c
commit 04eb498f88
2 changed files with 17 additions and 9 deletions

View file

@ -297,6 +297,8 @@ uint16_t bus::read(const uint16_t a, const bool word_mode, const bool use_prev)
if (a < 01000)
run_mode = 0;
else if (use_prev)
run_mode = (c->getPSW() >> 12) & 3;
uint32_t m_offset = pages[run_mode][apf].par * 64;
@ -556,6 +558,8 @@ uint16_t bus::write(const uint16_t a, const bool word_mode, uint16_t value, cons
if (a < 01000)
run_mode = 0;
else if (use_prev)
run_mode = (c->getPSW() >> 12) & 3;
uint32_t m_offset = pages[run_mode][apf].par * 64;

22
cpu.cpp
View file

@ -857,20 +857,22 @@ bool cpu::single_operand_instructions(const uint16_t instr)
}
case 0b00110101: { // MFPD/MFPI
// FIXME
uint16_t v = getGAM(dst_mode, dst_reg, word_mode, true);
// for MFPD versus MFPI
uint16_t a = getGAMAddress(dst_mode, dst_reg, false, false);
uint16_t v = b -> read(a, false, true);
setPSW_n(word_mode ? v & 0x80 : v & 0x8000);
setPSW_z(v == 0);
setPSW_v(false);
pushStack(v);
break;
}
case 0b00110110: { // MTPI/MTPD
// always words: word_mode-bit is to select between MTPI and MTPD
// calculate address in '13/12'-address-space
uint16_t a = getGAMAddress(dst_mode, dst_reg, false, true);
// retrieve word from '15/14'-stack
uint16_t v = popStack();
@ -878,12 +880,14 @@ bool cpu::single_operand_instructions(const uint16_t instr)
setPSW_z(v == 0);
setPSW_v(false);
D(fprintf(stderr, "MTP%c: address %06o, value %06o\n", word_mode ? 'D' : 'I', a, v);)
if (dst_mode == 0)
putGAM(dst_mode, dst_reg, false, v, false); // ???
else
b -> write(a, false, v);
putGAM(dst_mode, dst_reg, false, v, true);
else {
uint16_t a = getGAMAddress(dst_mode, dst_reg, false, false);
// put in '13/12' address space
b -> write(a, false, v, true);
}
break;
}