Merge branch 'master' into d_i
This commit is contained in:
commit
6449ef6c8c
5 changed files with 23 additions and 10 deletions
7
bus.cpp
7
bus.cpp
|
@ -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)
|
if (rl02_ && a >= RL02_BASE && a < RL02_END)
|
||||||
return word_mode ? rl02_ -> readByte(a) : rl02_ -> readWord(a);
|
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);
|
return word_mode ? tty_ -> readByte(a) : tty_ -> readWord(a);
|
||||||
|
}
|
||||||
|
|
||||||
// LO size register field must be all 1s, so subtract 1
|
// LO size register field must be all 1s, so subtract 1
|
||||||
const uint32_t system_size = n_pages * 8192 / 64 - 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 {
|
else {
|
||||||
m_offset = a;
|
m_offset = a;
|
||||||
DOLOG(debug, !peek_only, "virtual address %06o maps to physical address %08o", a, m_offset);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_offset;
|
return m_offset;
|
||||||
|
|
|
@ -88,6 +88,8 @@ int console::wait_char(const int timeout_ms)
|
||||||
|
|
||||||
void console::flush_input()
|
void console::flush_input()
|
||||||
{
|
{
|
||||||
|
std::unique_lock<std::mutex> lck(input_lock);
|
||||||
|
|
||||||
input_buffer.clear();
|
input_buffer.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,7 +212,7 @@ void console::put_string(const std::string & what)
|
||||||
|
|
||||||
void console::operator()()
|
void console::operator()()
|
||||||
{
|
{
|
||||||
DOLOG(::debug, true, "Console thread started");
|
DOLOG(::info, true, "Console thread started");
|
||||||
|
|
||||||
set_thread_name("kek::console");
|
set_thread_name("kek::console");
|
||||||
|
|
||||||
|
@ -229,11 +231,13 @@ void console::operator()()
|
||||||
else if (running_flag == false && c == 12) // ^l
|
else if (running_flag == false && c == 12) // ^l
|
||||||
refresh_virtual_terminal();
|
refresh_virtual_terminal();
|
||||||
else {
|
else {
|
||||||
|
std::unique_lock<std::mutex> lck(input_lock);
|
||||||
|
|
||||||
input_buffer.push_back(c);
|
input_buffer.push_back(c);
|
||||||
|
|
||||||
have_data.notify_all();
|
have_data.notify_all();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DOLOG(::debug, true, "Console thread terminating");
|
DOLOG(::info, true, "Console thread terminating");
|
||||||
}
|
}
|
||||||
|
|
14
cpu.cpp
14
cpu.cpp
|
@ -1011,7 +1011,7 @@ bool cpu::single_operand_instructions(const uint16_t instr)
|
||||||
|
|
||||||
setPSW_n(SIGN(v, word_mode));
|
setPSW_n(SIGN(v, word_mode));
|
||||||
setPSW_z(IS_0(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);
|
setPSW_c((word_mode ? (vo & 0xff) == 0xff : vo == 0xffff) && org_c);
|
||||||
|
|
||||||
setRegister(dst_reg, false, v);
|
setRegister(dst_reg, false, v);
|
||||||
|
@ -1029,7 +1029,7 @@ bool cpu::single_operand_instructions(const uint16_t instr)
|
||||||
if (set_flags) {
|
if (set_flags) {
|
||||||
setPSW_n(SIGN(v, word_mode));
|
setPSW_n(SIGN(v, word_mode));
|
||||||
setPSW_z(IS_0(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);
|
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_n(SIGN(v, word_mode));
|
||||||
setPSW_z(IS_0(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)
|
if (IS_0(vo, word_mode) && org_c)
|
||||||
setPSW_c(true);
|
setPSW_c(true);
|
||||||
|
else
|
||||||
|
setPSW_c(false);
|
||||||
|
|
||||||
|
setRegister(dst_reg, false, v);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
uint16_t a = getGAMAddress(dst_mode, dst_reg, word_mode, false);
|
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) {
|
if (set_flags) {
|
||||||
setPSW_n(SIGN(v, word_mode));
|
setPSW_n(SIGN(v, word_mode));
|
||||||
setPSW_z(IS_0(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)
|
if (IS_0(vo, word_mode) && org_c)
|
||||||
setPSW_c(true);
|
setPSW_c(true);
|
||||||
|
else
|
||||||
|
setPSW_c(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -66,7 +66,7 @@ uint64_t get_us()
|
||||||
|
|
||||||
int parity(int v)
|
int parity(int v)
|
||||||
{
|
{
|
||||||
return __builtin_parity(v); // FIXME
|
return __builtin_parity(v); // TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
void myusleep(uint64_t us)
|
void myusleep(uint64_t us)
|
||||||
|
|
Loading…
Add table
Reference in a new issue