11/34 mode removed
This commit is contained in:
parent
fa9f57caa0
commit
ff40cdc82c
3 changed files with 11 additions and 33 deletions
28
bus.cpp
28
bus.cpp
|
@ -54,9 +54,8 @@ void bus::init()
|
||||||
|
|
||||||
uint16_t bus::read_pdr(const uint32_t a, const int run_mode, const bool word_mode, const bool peek_only)
|
uint16_t bus::read_pdr(const uint32_t a, const int run_mode, const bool word_mode, const bool peek_only)
|
||||||
{
|
{
|
||||||
bool is_11_34 = c->get_34();
|
|
||||||
int page = (a >> 1) & 7;
|
int page = (a >> 1) & 7;
|
||||||
bool is_d = is_11_34 ? false : (a & 16);
|
bool is_d = a & 16;
|
||||||
uint16_t t = pages[run_mode][is_d][page].pdr;
|
uint16_t t = pages[run_mode][is_d][page].pdr;
|
||||||
|
|
||||||
DOLOG(debug, !peek_only, "read run-mode %d: %c PDR for %d: %o", run_mode, is_d ? 'D' : 'I', page, t);
|
DOLOG(debug, !peek_only, "read run-mode %d: %c PDR for %d: %o", run_mode, is_d ? 'D' : 'I', page, t);
|
||||||
|
@ -66,9 +65,8 @@ uint16_t bus::read_pdr(const uint32_t a, const int run_mode, const bool word_mod
|
||||||
|
|
||||||
uint16_t bus::read_par(const uint32_t a, const int run_mode, const bool word_mode, const bool peek_only)
|
uint16_t bus::read_par(const uint32_t a, const int run_mode, const bool word_mode, const bool peek_only)
|
||||||
{
|
{
|
||||||
bool is_11_34 = c->get_34();
|
|
||||||
int page = (a >> 1) & 7;
|
int page = (a >> 1) & 7;
|
||||||
bool is_d = is_11_34 ? false : (a & 16);
|
bool is_d = a & 16;
|
||||||
uint16_t t = pages[run_mode][is_d][page].par;
|
uint16_t t = pages[run_mode][is_d][page].par;
|
||||||
|
|
||||||
DOLOG(debug, !peek_only, "read run-mode %d: %c PAR for %d: %o (phys: %07o)", run_mode, is_d ? 'D' : 'I', page, t, t * 64);
|
DOLOG(debug, !peek_only, "read run-mode %d: %c PAR for %d: %o (phys: %07o)", run_mode, is_d ? 'D' : 'I', page, t, t * 64);
|
||||||
|
@ -417,7 +415,7 @@ uint32_t bus::calculate_physical_address(const int run_mode, const uint16_t a, c
|
||||||
m_offset &= 0x3ffff;
|
m_offset &= 0x3ffff;
|
||||||
|
|
||||||
if (trap_on_failure) {
|
if (trap_on_failure) {
|
||||||
if ((MMR0 & (1 << 9)) || c->get_34()) {
|
if (MMR0 & (1 << 9)) {
|
||||||
const int access_control = pages[run_mode][d][apf].pdr & 7;
|
const int access_control = pages[run_mode][d][apf].pdr & 7;
|
||||||
|
|
||||||
if (is_write && access_control != 6) { // write
|
if (is_write && access_control != 6) { // write
|
||||||
|
@ -488,7 +486,7 @@ uint32_t bus::calculate_physical_address(const int run_mode, const uint16_t a, c
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_write)
|
if (is_write)
|
||||||
pages[run_mode][d][apf].pdr |= 1 << 7; // TODO: D/I
|
pages[run_mode][d][apf].pdr |= 1 << 7;
|
||||||
|
|
||||||
c->schedule_trap(04);
|
c->schedule_trap(04);
|
||||||
|
|
||||||
|
@ -498,7 +496,7 @@ uint32_t bus::calculate_physical_address(const int run_mode, const uint16_t a, c
|
||||||
uint16_t pdr_len = (pages[run_mode][d][apf].pdr >> 8) & 127;
|
uint16_t pdr_len = (pages[run_mode][d][apf].pdr >> 8) & 127;
|
||||||
uint16_t pdr_cmp = (a >> 6) & 127;
|
uint16_t pdr_cmp = (a >> 6) & 127;
|
||||||
|
|
||||||
bool direction = pages[run_mode][d][apf].pdr & 8; // TODO: D/I
|
bool direction = pages[run_mode][d][apf].pdr & 8;
|
||||||
|
|
||||||
// DOLOG(debug, true, "p_offset %06o pdr_len %06o direction %d, run_mode %d, apf %d, pdr: %06o", p_offset, pdr_len, direction, run_mode, apf, pages[run_mode][d][apf].pdr);
|
// DOLOG(debug, true, "p_offset %06o pdr_len %06o direction %d, run_mode %d, apf %d, pdr: %06o", p_offset, pdr_len, direction, run_mode, apf, pages[run_mode][d][apf].pdr);
|
||||||
|
|
||||||
|
@ -519,13 +517,13 @@ uint32_t bus::calculate_physical_address(const int run_mode, const uint16_t a, c
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_write)
|
if (is_write)
|
||||||
pages[run_mode][d][apf].pdr |= 1 << 7; // TODO: D/I
|
pages[run_mode][d][apf].pdr |= 1 << 7;
|
||||||
|
|
||||||
throw 4;
|
throw 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DOLOG(debug, !peek_only, "virtual address %06o maps to physical address %08o (run_mode: %d, apf: %d, par: %08o, poff: %o, AC: %d)", a, m_offset, run_mode, apf, pages[run_mode][d][apf].par * 64, p_offset, pages[run_mode][d][apf].pdr & 7); // TODO: D/I
|
DOLOG(debug, !peek_only, "virtual address %06o maps to physical address %08o (run_mode: %d, apf: %d, par: %08o, poff: %o, AC: %d)", a, m_offset, run_mode, apf, pages[run_mode][d][apf].par * 64, p_offset, pages[run_mode][d][apf].pdr & 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_offset;
|
return m_offset;
|
||||||
|
@ -546,8 +544,7 @@ void bus::addToMMR1(const int8_t delta, const uint8_t reg)
|
||||||
|
|
||||||
void bus::write_pdr(const uint32_t a, const int run_mode, const uint16_t value, const bool word_mode)
|
void bus::write_pdr(const uint32_t a, const int run_mode, const uint16_t value, const bool word_mode)
|
||||||
{
|
{
|
||||||
bool is_11_34 = c->get_34();
|
bool is_d = a & 16;
|
||||||
bool is_d = is_11_34 ? false : (a & 16);
|
|
||||||
int page = (a >> 1) & 7;
|
int page = (a >> 1) & 7;
|
||||||
|
|
||||||
if (word_mode) {
|
if (word_mode) {
|
||||||
|
@ -560,9 +557,6 @@ void bus::write_pdr(const uint32_t a, const int run_mode, const uint16_t value,
|
||||||
pages[run_mode][is_d][page].pdr = value;
|
pages[run_mode][is_d][page].pdr = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_11_34) // 11/34 has no cache bit
|
|
||||||
pages[run_mode][is_d][page].pdr &= 077416;
|
|
||||||
else
|
|
||||||
pages[run_mode][is_d][page].pdr &= ~(128 + 64 + 32 + 16); // set bit 4 & 5 to 0 as they are unused and A/W are set to 0 by writes
|
pages[run_mode][is_d][page].pdr &= ~(128 + 64 + 32 + 16); // set bit 4 & 5 to 0 as they are unused and A/W are set to 0 by writes
|
||||||
|
|
||||||
DOLOG(debug, true, "write run-mode %d: %c PDR for %d: %o [%d]", run_mode, is_d ? 'D' : 'I', page, value, word_mode);
|
DOLOG(debug, true, "write run-mode %d: %c PDR for %d: %o [%d]", run_mode, is_d ? 'D' : 'I', page, value, word_mode);
|
||||||
|
@ -570,8 +564,7 @@ void bus::write_pdr(const uint32_t a, const int run_mode, const uint16_t value,
|
||||||
|
|
||||||
void bus::write_par(const uint32_t a, const int run_mode, const uint16_t value, const bool word_mode)
|
void bus::write_par(const uint32_t a, const int run_mode, const uint16_t value, const bool word_mode)
|
||||||
{
|
{
|
||||||
bool is_11_34 = c->get_34();
|
bool is_d = a & 16;
|
||||||
bool is_d = is_11_34 ? false : (a & 16);
|
|
||||||
int page = (a >> 1) & 7;
|
int page = (a >> 1) & 7;
|
||||||
|
|
||||||
if (word_mode) {
|
if (word_mode) {
|
||||||
|
@ -582,9 +575,6 @@ void bus::write_par(const uint32_t a, const int run_mode, const uint16_t value,
|
||||||
pages[run_mode][is_d][page].par = value;
|
pages[run_mode][is_d][page].par = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_11_34) // 11/34 has 12 bit PARs
|
|
||||||
pages[run_mode][is_d][page].par &= 4095;
|
|
||||||
|
|
||||||
DOLOG(debug, true, "write run-mode %d: %c PAR for %d: %o (%07o)", run_mode, is_d ? 'D' : 'I', page, word_mode ? value & 0xff : value, pages[run_mode][is_d][page].par * 64);
|
DOLOG(debug, true, "write run-mode %d: %c PAR for %d: %o (%07o)", run_mode, is_d ? 'D' : 'I', page, word_mode ? value & 0xff : value, pages[run_mode][is_d][page].par * 64);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
4
cpu.h
4
cpu.h
|
@ -38,7 +38,6 @@ private:
|
||||||
uint8_t scheduled_trap { 0 };
|
uint8_t scheduled_trap { 0 };
|
||||||
uint64_t instruction_count { 0 };
|
uint64_t instruction_count { 0 };
|
||||||
uint64_t running_since { 0 };
|
uint64_t running_since { 0 };
|
||||||
bool mode11_70 { true };
|
|
||||||
|
|
||||||
uint64_t mtpi_count { 0 };
|
uint64_t mtpi_count { 0 };
|
||||||
|
|
||||||
|
@ -83,9 +82,6 @@ public:
|
||||||
explicit cpu(bus *const b, std::atomic_uint32_t *const event);
|
explicit cpu(bus *const b, std::atomic_uint32_t *const event);
|
||||||
~cpu();
|
~cpu();
|
||||||
|
|
||||||
void set_34(const bool v) { mode11_70 = !v; }
|
|
||||||
bool get_34() { return !mode11_70; }
|
|
||||||
|
|
||||||
bool check_breakpoint();
|
bool check_breakpoint();
|
||||||
void set_breakpoint(const uint16_t addr);
|
void set_breakpoint(const uint16_t addr);
|
||||||
void remove_breakpoint(const uint16_t addr);
|
void remove_breakpoint(const uint16_t addr);
|
||||||
|
|
10
main.cpp
10
main.cpp
|
@ -71,8 +71,6 @@ int main(int argc, char *argv[])
|
||||||
log_level_t ll_screen = none;
|
log_level_t ll_screen = none;
|
||||||
log_level_t ll_file = none;
|
log_level_t ll_file = none;
|
||||||
|
|
||||||
bool mode_34 = false;
|
|
||||||
|
|
||||||
uint16_t start_addr= 01000;
|
uint16_t start_addr= 01000;
|
||||||
bool sa_set = false;
|
bool sa_set = false;
|
||||||
|
|
||||||
|
@ -83,7 +81,7 @@ int main(int argc, char *argv[])
|
||||||
std::string test;
|
std::string test;
|
||||||
|
|
||||||
int opt = -1;
|
int opt = -1;
|
||||||
while((opt = getopt(argc, argv, "hm:T:r:R:p:ndtL:b:l:3s:Q:")) != -1)
|
while((opt = getopt(argc, argv, "hm:T:r:R:p:ndtL:b:l:s:Q:")) != -1)
|
||||||
{
|
{
|
||||||
switch(opt) {
|
switch(opt) {
|
||||||
case 'h':
|
case 'h':
|
||||||
|
@ -107,10 +105,6 @@ int main(int argc, char *argv[])
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case '3':
|
|
||||||
mode_34 = true; // switch from 11/70 to 11/34
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'b':
|
case 'b':
|
||||||
if (strcasecmp(optarg, "rk05") == 0)
|
if (strcasecmp(optarg, "rk05") == 0)
|
||||||
bootloader = BL_RK05;
|
bootloader = BL_RK05;
|
||||||
|
@ -182,8 +176,6 @@ int main(int argc, char *argv[])
|
||||||
cpu *c = new cpu(b, &event);
|
cpu *c = new cpu(b, &event);
|
||||||
b->add_cpu(c);
|
b->add_cpu(c);
|
||||||
|
|
||||||
c->set_34(mode_34);
|
|
||||||
|
|
||||||
std::atomic_bool interrupt_emulation { false };
|
std::atomic_bool interrupt_emulation { false };
|
||||||
|
|
||||||
if (tape.empty() == false)
|
if (tape.empty() == false)
|
||||||
|
|
Loading…
Add table
Reference in a new issue