ESP32 tweaks

This commit is contained in:
folkert van heusden 2022-03-15 22:37:23 +01:00
parent 707d017330
commit 320d61551b
3 changed files with 26 additions and 7 deletions

View file

@ -214,6 +214,8 @@ uint16_t loadbin(bus *const b)
uint16_t exec_addr = 0; uint16_t exec_addr = 0;
uint32_t start_ts = 0;
void setup() { void setup() {
Serial.begin(115200); Serial.begin(115200);
@ -240,6 +242,8 @@ void setup() {
exec_addr = loadbin(b); exec_addr = loadbin(b);
c->setRegister(7, exec_addr); c->setRegister(7, exec_addr);
pinMode(LED_BUILTIN, OUTPUT);
Serial.println(F("Press <enter> to start")); Serial.println(F("Press <enter> to start"));
for(;;) { for(;;) {
@ -253,27 +257,36 @@ void setup() {
} }
Serial.println(F("Emulation starting!")); Serial.println(F("Emulation starting!"));
start_ts = millis();
} }
unsigned int icount = 0; uint32_t icount = 0;
void loop() { void loop() {
icount++; icount++;
if (icount % 1000 == 0 && Serial.available()) { if ((icount & 1023) == 0) {
char c = Serial.read(); if (Serial.available()) {
char c = Serial.read();
if (c > 0 && c < 127) if (c > 0 && c < 127)
tty_->sendChar(c); tty_->sendChar(c);
}
} }
if (c->step()) { if (c->step()) {
Serial.println(F("")); Serial.println(F(""));
Serial.println(F(" *** EMULATION STOPPED *** ")); Serial.println(F(" *** EMULATION STOPPED *** "));
Serial.print(F("Instructions per second: "));
Serial.println(icount * 1000.0 / (millis() - start_ts));
delay(1000); delay(1000);
Serial.println(F(" *** EMULATION RESTARTING *** ")); Serial.println(F(" *** EMULATION RESTARTING *** "));
c->setRegister(7, exec_addr); c->setRegister(7, exec_addr);
c->resetHalt(); c->resetHalt();
start_ts = millis();
icount = 0;
} }
} }

View file

@ -30,8 +30,8 @@ framework = arduino
monitor_speed = 115200 monitor_speed = 115200
upload_speed = 1000000 upload_speed = 1000000
lib_deps = lib_deps =
build_flags = -std=c++17 build_flags = -std=c++17 -Ofast
build_unflags = -std=gnu++11 build_unflags = -std=gnu++11 -Os
[env:serial32_debug] [env:serial32_debug]
platform = espressif32 platform = espressif32

View file

@ -52,6 +52,12 @@ uint16_t tty::readWord(const uint16_t addr)
if (addr == PDP11TTY_TKS) { if (addr == PDP11TTY_TKS) {
vtemp = c ? 128 : 0; vtemp = c ? 128 : 0;
#if defined(ESP32)
static bool led_state = true;
digitalWrite(LED_BUILTIN, led_state);
led_state = !led_state;
#endif
} }
else if (addr == PDP11TTY_TKB) { else if (addr == PDP11TTY_TKB) {
vtemp = c | (parity(c) << 7); vtemp = c | (parity(c) << 7);