Merge branch 'master' into d_i

This commit is contained in:
folkert van heusden 2022-06-12 22:16:15 +02:00
commit 6449ef6c8c
5 changed files with 23 additions and 10 deletions

View file

@ -255,8 +255,12 @@ uint16_t bus::read(const uint16_t a, const bool word_mode, const bool use_prev,
if (rl02_ && a >= RL02_BASE && a < RL02_END)
return word_mode ? rl02_ -> readByte(a) : rl02_ -> readWord(a);
if (tty_ && a >= PDP11TTY_BASE && a < PDP11TTY_END)
if (tty_ && a >= PDP11TTY_BASE && a < PDP11TTY_END) {
if (peek_only)
return 012345;
return word_mode ? tty_ -> readByte(a) : tty_ -> readWord(a);
}
// LO size register field must be all 1s, so subtract 1
const uint32_t system_size = n_pages * 8192 / 64 - 1;
@ -374,7 +378,6 @@ uint32_t bus::calculate_physical_address(const int run_mode, const uint16_t a, c
}
else {
m_offset = a;
DOLOG(debug, !peek_only, "virtual address %06o maps to physical address %08o", a, m_offset);
}
return m_offset;

2
bus.h
View file

@ -54,7 +54,7 @@ public:
void add_tm11(tm_11 *tm11) { this -> tm11 = tm11; }
void add_rk05(rk05 *rk05_) { this -> rk05_ = rk05_; }
void add_rl02(rl02 *rl02_) { this -> rl02_ = rl02_; }
void add_tty(tty *tty_) { this -> tty_ = tty_; }
void add_tty(tty *tty_) { this -> tty_ = tty_; }
cpu *getCpu() { return this->c; }

View file

@ -88,6 +88,8 @@ int console::wait_char(const int timeout_ms)
void console::flush_input()
{
std::unique_lock<std::mutex> lck(input_lock);
input_buffer.clear();
}
@ -210,7 +212,7 @@ void console::put_string(const std::string & what)
void console::operator()()
{
DOLOG(::debug, true, "Console thread started");
DOLOG(::info, true, "Console thread started");
set_thread_name("kek::console");
@ -229,11 +231,13 @@ void console::operator()()
else if (running_flag == false && c == 12) // ^l
refresh_virtual_terminal();
else {
std::unique_lock<std::mutex> lck(input_lock);
input_buffer.push_back(c);
have_data.notify_all();
}
}
DOLOG(::debug, true, "Console thread terminating");
DOLOG(::info, true, "Console thread terminating");
}

14
cpu.cpp
View file

@ -1011,7 +1011,7 @@ bool cpu::single_operand_instructions(const uint16_t instr)
setPSW_n(SIGN(v, word_mode));
setPSW_z(IS_0(v, word_mode));
setPSW_v((word_mode ? (vo & 0xff) == 0x80 : vo == 0x8000) && org_c);
setPSW_v((word_mode ? (vo & 0xff) == 0x7f : vo == 0x7fff) && org_c);
setPSW_c((word_mode ? (vo & 0xff) == 0xff : vo == 0xffff) && org_c);
setRegister(dst_reg, false, v);
@ -1029,7 +1029,7 @@ bool cpu::single_operand_instructions(const uint16_t instr)
if (set_flags) {
setPSW_n(SIGN(v, word_mode));
setPSW_z(IS_0(v, word_mode));
setPSW_v((word_mode ? (vo & 0xff) == 0x80 : vo == 0x8000) && org_c);
setPSW_v((word_mode ? (vo & 0xff) == 0x7f : vo == 0x7fff) && org_c);
setPSW_c((word_mode ? (vo & 0xff) == 0xff : vo == 0xffff) && org_c);
}
}
@ -1049,10 +1049,14 @@ bool cpu::single_operand_instructions(const uint16_t instr)
setPSW_n(SIGN(v, word_mode));
setPSW_z(IS_0(v, word_mode));
setPSW_v(word_mode ? (v & 0xff) == 0x80 : v == 0x8000);
setPSW_v(word_mode ? (vo & 0xff) == 0x80 : vo == 0x8000);
if (IS_0(vo, word_mode) && org_c)
setPSW_c(true);
else
setPSW_c(false);
setRegister(dst_reg, false, v);
}
else {
uint16_t a = getGAMAddress(dst_mode, dst_reg, word_mode, false);
@ -1067,10 +1071,12 @@ bool cpu::single_operand_instructions(const uint16_t instr)
if (set_flags) {
setPSW_n(SIGN(v, word_mode));
setPSW_z(IS_0(v, word_mode));
setPSW_v(word_mode? (v & 0xff) == 0x80 : v == 0x8000);
setPSW_v(word_mode? (vo & 0xff) == 0x80 : v == 0x8000);
if (IS_0(vo, word_mode) && org_c)
setPSW_c(true);
else
setPSW_c(false);
}
}
break;

View file

@ -66,7 +66,7 @@ uint64_t get_us()
int parity(int v)
{
return __builtin_parity(v); // FIXME
return __builtin_parity(v); // TODO
}
void myusleep(uint64_t us)