testcases fixes

This commit is contained in:
folkert van heusden 2022-03-20 22:52:10 +01:00
parent be738f9652
commit 6ff0e6a0f3
4 changed files with 17 additions and 13 deletions

View file

@ -24,8 +24,8 @@ add_executable(
include(CheckIPOSupported) include(CheckIPOSupported)
check_ipo_supported(RESULT supported) check_ipo_supported(RESULT supported)
set(CMAKE_BUILD_TYPE RelWithDebInfo) #set(CMAKE_BUILD_TYPE RelWithDebInfo)
#set(CMAKE_BUILD_TYPE Debug) set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_THREAD_PREFER_PTHREAD TRUE) set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE) set(THREADS_PREFER_PTHREAD_FLAG TRUE)

View file

@ -139,7 +139,7 @@ void cpu::setPSW_n(const bool v)
void cpu::setPSW_spl(const int v) void cpu::setPSW_spl(const int v)
{ {
psw &= 7 << 5; psw &= ~(7 << 5);
psw |= v << 5; psw |= v << 5;
} }

View file

@ -69,27 +69,27 @@ void test__registers(cpu *const c)
// PSW // PSW
c -> reset(); c -> reset();
assert(c -> getPSW() == 0); assert(c -> getPSW() == 0 | (7 << 5));
c -> reset(); c -> reset();
c -> setPSW_c(true); c -> setPSW_c(true);
assert(c -> getPSW() == 1); assert(c -> getPSW() == 1 | (7 << 5));
c -> reset(); c -> reset();
c -> setPSW_v(true); c -> setPSW_v(true);
assert(c -> getPSW() == 2); assert(c -> getPSW() == 2 | (7 << 5));
c -> reset(); c -> reset();
c -> setPSW_z(true); c -> setPSW_z(true);
assert(c -> getPSW() == 4); assert(c -> getPSW() == 4 | (7 << 5));
c -> reset(); c -> reset();
c -> setPSW_n(true); c -> setPSW_n(true);
assert(c -> getPSW() == 8); assert(c -> getPSW() == 8 | (7 << 5));
c -> reset(); c -> reset();
c -> setPSW_spl(7); c -> setPSW_spl(1);
assert(c -> getPSW() == (7 << 5)); assert(c -> getPSW() == (1 << 5));
} }
void test_cmp(cpu *const c) void test_cmp(cpu *const c)
@ -1391,9 +1391,11 @@ void test_rts(cpu *const c)
c -> setRegister(6, 01000); c -> setRegister(6, 01000);
b -> writeWord(0, 0004010); b -> writeWord(0, 0004010);
b -> writeWord(10, 0b0000000010000000); b -> writeWord(10, 0b0000000010000000);
do_test(c, 2); do_test(c, 1);
assert(c -> getRegister(0) == 10);
assert(c -> getRegister(6) == 0776); assert(c -> getRegister(6) == 0776);
do_test(c, 1);
assert(c -> getRegister(0) == 10);
assert(c -> getRegister(6) == 01000);
assert(c -> getRegister(7) == 2); assert(c -> getRegister(7) == 2);
// //
c -> reset(); c -> reset();
@ -1698,7 +1700,7 @@ void test_swab(cpu *const c)
b -> writeWord(0, 000301); // SWAB R1 b -> writeWord(0, 000301); // SWAB R1
do_test(c, 1); do_test(c, 1);
assert(c -> getRegister(1) == 0177577); assert(c -> getRegister(1) == 0177577);
assert(c -> getPSW_n()); assert(!c -> getPSW_n());
assert(!c -> getPSW_z()); assert(!c -> getPSW_z());
assert(!c -> getPSW_v()); assert(!c -> getPSW_v());
assert(!c -> getPSW_c()); assert(!c -> getPSW_c());

View file

@ -112,6 +112,8 @@ void tty::writeWord(const uint16_t addr, uint16_t v)
if (addr == PDP11TTY_TPB) { if (addr == PDP11TTY_TPB) {
char c = v & 127; char c = v & 127;
D(fprintf(stderr, "PDP11TTY print '%c'\n", c);)
#if defined(ESP32) #if defined(ESP32)
if (xQueueSend(queue, &c, portMAX_DELAY) != pdTRUE) if (xQueueSend(queue, &c, portMAX_DELAY) != pdTRUE)
Serial.println(F("queue TTY character failed")); Serial.println(F("queue TTY character failed"));