bus::calculate_physical_address did not handle non-mmu case

This commit is contained in:
folkert van heusden 2023-03-24 09:12:37 +01:00
parent fe191c7483
commit 2f69f287ef
Signed by untrusted user who does not match committer: folkert
GPG key ID: 6B6455EDFEED3BD1
2 changed files with 7 additions and 12 deletions

11
bus.cpp
View file

@ -429,6 +429,9 @@ memory_addresses_t bus::calculate_physical_address(const int run_mode, const uin
{ {
const uint8_t apf = a >> 13; // active page field const uint8_t apf = a >> 13; // active page field
if ((MMR0 & 1) == 0)
return { a, apf, a, a };
uint32_t physical_instruction = pages[run_mode][0][apf].par * 64; uint32_t physical_instruction = pages[run_mode][0][apf].par * 64;
uint32_t physical_data = pages[run_mode][1][apf].par * 64; uint32_t physical_data = pages[run_mode][1][apf].par * 64;
@ -437,11 +440,9 @@ memory_addresses_t bus::calculate_physical_address(const int run_mode, const uin
physical_instruction += p_offset; physical_instruction += p_offset;
physical_data += p_offset; physical_data += p_offset;
if (MMR0 & 1) { // MMU enabled? if ((MMR3 & 16) == 0) { // offset is 18bit
if ((MMR3 & 16) == 0) { // offset is 18bit physical_instruction &= 0x3ffff;
physical_instruction &= 0x3ffff; physical_data &= 0x3ffff;
physical_data &= 0x3ffff;
}
} }
return { a, apf, physical_instruction, physical_data }; return { a, apf, physical_instruction, physical_data };

View file

@ -1276,13 +1276,7 @@ bool cpu::single_operand_instructions(const uint16_t instr)
int run_mode = (getPSW() >> 12) & 3; int run_mode = (getPSW() >> 12) & 3;
auto phys = b->calculate_physical_address(run_mode, a.addr.value()); auto phys = b->calculate_physical_address(run_mode, a.addr.value());
DOLOG(debug, true, "MTPI/D %06o -> %o / %o", a, phys.physical_instruction, phys.physical_data); DOLOG(debug, true, "%lu %06o MTP%c %06o: %06o", mtpi_count, pc-2, word_mode ? 'D' : 'I', a.addr.value(), v);
// FILE *fh = fopen("og2-kek.dat", "a+");
// fprintf(fh, "%lu %06o MTPI %06o: %06o\n", mtpi_count, oldpc, a, v);
// fclose(fh);
DOLOG(debug, true, "%lu %06o MTPI %06o: %06o", mtpi_count, pc-2, a.addr.value(), v);
mtpi_count++; mtpi_count++;
uint32_t a = word_mode ? phys.physical_data : phys.physical_instruction; uint32_t a = word_mode ? phys.physical_data : phys.physical_instruction;