From daabdc7604500c81f339181a357dcc56b07b46a0 Mon Sep 17 00:00:00 2001 From: folkert van heusden Date: Wed, 16 Mar 2022 09:55:56 +0100 Subject: [PATCH] removed redundant asserts --- ESP32/platformio.ini | 25 ------------------------- bus.cpp | 5 +---- cpu.cpp | 8 -------- cpu.h | 4 ++-- 4 files changed, 3 insertions(+), 39 deletions(-) diff --git a/ESP32/platformio.ini b/ESP32/platformio.ini index a08cf94..fde7fd8 100644 --- a/ESP32/platformio.ini +++ b/ESP32/platformio.ini @@ -8,21 +8,6 @@ lib_ldf_mode = deep+ lib_deps = src_filter = +<*> -<.git/> -<.svn/> - - - - - - -[env:serial] -platform = espressif8266 -board = d1_mini -framework = arduino -monitor_speed = 57600 -upload_speed = 1000000 - -[env:serial_debug] -platform = espressif8266 -board = d1_mini -framework = arduino -monitor_speed = 57600 -upload_speed = 1000000 -build_flags = -DDEBUG - [env:serial32] platform = espressif32 board = wemos_d1_mini32 @@ -32,13 +17,3 @@ upload_speed = 1000000 lib_deps = build_flags = -std=c++17 -Ofast build_unflags = -std=gnu++11 -Os - -[env:serial32_debug] -platform = espressif32 -board = wemos_d1_mini32 -framework = arduino -monitor_speed = 115200 -upload_speed = 1000000 -lib_deps = -build_flags = -std=c++17 -DDEBUG -build_unflags = -std=gnu++11 diff --git a/bus.cpp b/bus.cpp index 746ce95..8c7e663 100644 --- a/bus.cpp +++ b/bus.cpp @@ -18,7 +18,7 @@ bus::bus() : c(nullptr), tm11(nullptr), rk05_(nullptr), rx02_(nullptr), tty_(nul #if defined(ESP32) // ESP32 goes in a crash-loop when allocating 128kB // see also https://github.com/espressif/esp-idf/issues/1934 - int n = 14; + int n = 12; #else int n = 16; #endif @@ -267,15 +267,12 @@ uint16_t bus::write(const uint16_t a, const bool word_mode, uint16_t value, cons { //D(fprintf(stderr, "write bus %o(%d): %o\n", a, word_mode, value);) - assert(word_mode == 0 || value < 256); - if (a >= 0160000) { D(fprintf(stderr, "write%c %o to I/O %o\n", word_mode ? 'b' : ' ', value, a);) if (word_mode) { if (a == 0177776 || a == 0177777) { // PSW D(fprintf(stderr, "writeb PSW %s\n", a & 1 ? "MSB" : "LSB");) - assert(value < 256); uint16_t vtemp = c -> getPSW(); if (a & 1) diff --git a/cpu.cpp b/cpu.cpp index 470904f..ce187c2 100644 --- a/cpu.cpp +++ b/cpu.cpp @@ -35,8 +35,6 @@ void cpu::reset() uint16_t cpu::getRegister(const int nr, const bool prev_mode) const { - assert(nr >= 0 && nr <= 7); - if (nr < 6) return regs0_5[getBitPSW(11)][nr]; @@ -52,8 +50,6 @@ uint16_t cpu::getRegister(const int nr, const bool prev_mode) const void cpu::setRegister(const int nr, const bool prev_mode, const uint16_t value) { - assert(nr >= 0 && nr <= 7); - if (nr < 6) regs0_5[getBitPSW(11)][nr] = value; else if (nr == 6) { @@ -69,8 +65,6 @@ void cpu::setRegister(const int nr, const bool prev_mode, const uint16_t value) void cpu::addRegister(const int nr, const bool prev_mode, const uint16_t value) { - assert(nr >= 0 && nr <= 7); - if (nr < 6) regs0_5[getBitPSW(11)][nr] += value; else if (nr == 6) { @@ -221,7 +215,6 @@ void cpu::putGAM(const uint8_t mode, const int reg, const bool word_mode, const if (word_mode) { uint16_t temp = getRegister(reg, prev_mode); temp &= 0xff00; - assert(value < 256); temp |= value; setRegister(reg, prev_mode, temp); } @@ -601,7 +594,6 @@ bool cpu::additional_double_operand_instructions(const uint16_t instr) uint16_t oldPC = getPC(); // FIXME gaat dit wel goed voor R7? addRegister(reg, false, -1); if (getRegister(reg, false)) { - assert(dst >= 0); uint16_t newPC = oldPC - dst * 2; D(fprintf(stderr, " jump back from %o to %o\n", oldPC, newPC);) setPC(newPC); diff --git a/cpu.h b/cpu.h index 518a2ba..d3f93a0 100644 --- a/cpu.h +++ b/cpu.h @@ -79,11 +79,11 @@ public: uint16_t getStackLimitRegister() { return stackLimitRegister; } void setStackLimitRegister(const uint16_t v) { stackLimitRegister = v; } - uint16_t getRegister(const bool user, const int nr) const { assert(nr >= 0 && nr < 6); return regs0_5[user][nr]; } + uint16_t getRegister(const bool user, const int nr) const { return regs0_5[user][nr]; } uint16_t getStackPointer(const int which) const { assert(which >= 0 && which < 4); return sp[which]; } uint16_t getPC() const { return pc; } - void setRegister(const bool user, const int nr, const uint16_t value) { assert(nr >= 0 && nr < 6); regs0_5[user][nr] = value; } + void setRegister(const bool user, const int nr, const uint16_t value) { regs0_5[user][nr] = value; } void setStackPointer(const int which, const uint16_t value) { assert(which >= 0 && which < 4); sp[which] = value; } void setPC(const uint16_t value) { pc = value; }