removed redundant asserts
This commit is contained in:
parent
fd1172b946
commit
daabdc7604
4 changed files with 3 additions and 39 deletions
|
@ -8,21 +8,6 @@ lib_ldf_mode = deep+
|
||||||
lib_deps =
|
lib_deps =
|
||||||
src_filter = +<*> -<.git/> -<.svn/> -<example/> -<examples/> -<test/> -<tests/> -<build> -<player.cpp>
|
src_filter = +<*> -<.git/> -<.svn/> -<example/> -<examples/> -<test/> -<tests/> -<build> -<player.cpp>
|
||||||
|
|
||||||
[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]
|
[env:serial32]
|
||||||
platform = espressif32
|
platform = espressif32
|
||||||
board = wemos_d1_mini32
|
board = wemos_d1_mini32
|
||||||
|
@ -32,13 +17,3 @@ upload_speed = 1000000
|
||||||
lib_deps =
|
lib_deps =
|
||||||
build_flags = -std=c++17 -Ofast
|
build_flags = -std=c++17 -Ofast
|
||||||
build_unflags = -std=gnu++11 -Os
|
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
|
|
||||||
|
|
5
bus.cpp
5
bus.cpp
|
@ -18,7 +18,7 @@ bus::bus() : c(nullptr), tm11(nullptr), rk05_(nullptr), rx02_(nullptr), tty_(nul
|
||||||
#if defined(ESP32)
|
#if defined(ESP32)
|
||||||
// ESP32 goes in a crash-loop when allocating 128kB
|
// ESP32 goes in a crash-loop when allocating 128kB
|
||||||
// see also https://github.com/espressif/esp-idf/issues/1934
|
// see also https://github.com/espressif/esp-idf/issues/1934
|
||||||
int n = 14;
|
int n = 12;
|
||||||
#else
|
#else
|
||||||
int n = 16;
|
int n = 16;
|
||||||
#endif
|
#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);)
|
//D(fprintf(stderr, "write bus %o(%d): %o\n", a, word_mode, value);)
|
||||||
|
|
||||||
assert(word_mode == 0 || value < 256);
|
|
||||||
|
|
||||||
if (a >= 0160000) {
|
if (a >= 0160000) {
|
||||||
D(fprintf(stderr, "write%c %o to I/O %o\n", word_mode ? 'b' : ' ', value, a);)
|
D(fprintf(stderr, "write%c %o to I/O %o\n", word_mode ? 'b' : ' ', value, a);)
|
||||||
|
|
||||||
if (word_mode) {
|
if (word_mode) {
|
||||||
if (a == 0177776 || a == 0177777) { // PSW
|
if (a == 0177776 || a == 0177777) { // PSW
|
||||||
D(fprintf(stderr, "writeb PSW %s\n", a & 1 ? "MSB" : "LSB");)
|
D(fprintf(stderr, "writeb PSW %s\n", a & 1 ? "MSB" : "LSB");)
|
||||||
assert(value < 256);
|
|
||||||
uint16_t vtemp = c -> getPSW();
|
uint16_t vtemp = c -> getPSW();
|
||||||
|
|
||||||
if (a & 1)
|
if (a & 1)
|
||||||
|
|
8
cpu.cpp
8
cpu.cpp
|
@ -35,8 +35,6 @@ void cpu::reset()
|
||||||
|
|
||||||
uint16_t cpu::getRegister(const int nr, const bool prev_mode) const
|
uint16_t cpu::getRegister(const int nr, const bool prev_mode) const
|
||||||
{
|
{
|
||||||
assert(nr >= 0 && nr <= 7);
|
|
||||||
|
|
||||||
if (nr < 6)
|
if (nr < 6)
|
||||||
return regs0_5[getBitPSW(11)][nr];
|
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)
|
void cpu::setRegister(const int nr, const bool prev_mode, const uint16_t value)
|
||||||
{
|
{
|
||||||
assert(nr >= 0 && nr <= 7);
|
|
||||||
|
|
||||||
if (nr < 6)
|
if (nr < 6)
|
||||||
regs0_5[getBitPSW(11)][nr] = value;
|
regs0_5[getBitPSW(11)][nr] = value;
|
||||||
else if (nr == 6) {
|
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)
|
void cpu::addRegister(const int nr, const bool prev_mode, const uint16_t value)
|
||||||
{
|
{
|
||||||
assert(nr >= 0 && nr <= 7);
|
|
||||||
|
|
||||||
if (nr < 6)
|
if (nr < 6)
|
||||||
regs0_5[getBitPSW(11)][nr] += value;
|
regs0_5[getBitPSW(11)][nr] += value;
|
||||||
else if (nr == 6) {
|
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) {
|
if (word_mode) {
|
||||||
uint16_t temp = getRegister(reg, prev_mode);
|
uint16_t temp = getRegister(reg, prev_mode);
|
||||||
temp &= 0xff00;
|
temp &= 0xff00;
|
||||||
assert(value < 256);
|
|
||||||
temp |= value;
|
temp |= value;
|
||||||
setRegister(reg, prev_mode, temp);
|
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?
|
uint16_t oldPC = getPC(); // FIXME gaat dit wel goed voor R7?
|
||||||
addRegister(reg, false, -1);
|
addRegister(reg, false, -1);
|
||||||
if (getRegister(reg, false)) {
|
if (getRegister(reg, false)) {
|
||||||
assert(dst >= 0);
|
|
||||||
uint16_t newPC = oldPC - dst * 2;
|
uint16_t newPC = oldPC - dst * 2;
|
||||||
D(fprintf(stderr, " jump back from %o to %o\n", oldPC, newPC);)
|
D(fprintf(stderr, " jump back from %o to %o\n", oldPC, newPC);)
|
||||||
setPC(newPC);
|
setPC(newPC);
|
||||||
|
|
4
cpu.h
4
cpu.h
|
@ -79,11 +79,11 @@ public:
|
||||||
uint16_t getStackLimitRegister() { return stackLimitRegister; }
|
uint16_t getStackLimitRegister() { return stackLimitRegister; }
|
||||||
void setStackLimitRegister(const uint16_t v) { stackLimitRegister = v; }
|
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 getStackPointer(const int which) const { assert(which >= 0 && which < 4); return sp[which]; }
|
||||||
uint16_t getPC() const { return pc; }
|
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 setStackPointer(const int which, const uint16_t value) { assert(which >= 0 && which < 4); sp[which] = value; }
|
||||||
void setPC(const uint16_t value) { pc = value; }
|
void setPC(const uint16_t value) { pc = value; }
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue