Compile fixes for ESP32
This commit is contained in:
parent
d01b628015
commit
28958a9945
7 changed files with 35 additions and 42 deletions
|
@ -24,8 +24,8 @@ add_executable(
|
|||
include(CheckIPOSupported)
|
||||
check_ipo_supported(RESULT supported)
|
||||
|
||||
#set(CMAKE_BUILD_TYPE RelWithDebInfo)
|
||||
set(CMAKE_BUILD_TYPE Debug)
|
||||
set(CMAKE_BUILD_TYPE RelWithDebInfo)
|
||||
#set(CMAKE_BUILD_TYPE Debug)
|
||||
|
||||
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
||||
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
|
||||
|
|
|
@ -22,6 +22,8 @@ bus *b = nullptr;
|
|||
cpu *c = nullptr;
|
||||
tty *tty_ = nullptr;
|
||||
|
||||
uint32_t event = 0;
|
||||
|
||||
uint16_t exec_addr = 0;
|
||||
|
||||
uint32_t start_ts = 0;
|
||||
|
@ -113,6 +115,8 @@ void telnet_terminal(void *p) {
|
|||
|
||||
xQueueReceive(tty_->getTerminalQueue(), &cc, portMAX_DELAY);
|
||||
|
||||
Serial.print(cc);
|
||||
|
||||
// update terminal buffer
|
||||
xSemaphoreTake(terminal_mutex, portMAX_DELAY);
|
||||
|
||||
|
@ -145,8 +149,6 @@ void telnet_terminal(void *p) {
|
|||
void wifi(void *p) {
|
||||
Serial.println(F("wifi task started"));
|
||||
|
||||
uint32_t ulNotifiedValue = 0;
|
||||
|
||||
int fd = socket(AF_INET, SOCK_STREAM, 0);
|
||||
|
||||
struct sockaddr_in server { 0 };
|
||||
|
@ -283,7 +285,7 @@ void setup() {
|
|||
b = new bus();
|
||||
|
||||
Serial.println(F("Init CPU"));
|
||||
c = new cpu(b);
|
||||
c = new cpu(b, &event);
|
||||
|
||||
Serial.println(F("Connect CPU to BUS"));
|
||||
b->add_cpu(c);
|
||||
|
@ -291,7 +293,7 @@ void setup() {
|
|||
c->setEmulateMFPT(true);
|
||||
|
||||
Serial.println(F("Init TTY"));
|
||||
tty_ = new tty(false);
|
||||
tty_ = new tty(poll_char, get_char, put_char);
|
||||
Serial.println(F("Connect TTY to bus"));
|
||||
b->add_tty(tty_);
|
||||
|
||||
|
@ -365,21 +367,32 @@ void dump_state(bus *const b) {
|
|||
Serial.println(t_diff);
|
||||
}
|
||||
|
||||
bool poll_char()
|
||||
{
|
||||
return Serial.available() > 0;
|
||||
}
|
||||
|
||||
char get_char()
|
||||
{
|
||||
char c = Serial.read();
|
||||
|
||||
if (c == 5)
|
||||
dump_state(b);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
void put_char(char c)
|
||||
{
|
||||
Serial.print(c);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
icount++;
|
||||
|
||||
if ((icount & 1023) == 0) {
|
||||
if (Serial.available()) {
|
||||
char c = Serial.read();
|
||||
c->step();
|
||||
|
||||
if (c == 5)
|
||||
dump_state(b);
|
||||
else if (c > 0 && c < 127)
|
||||
tty_->sendChar(c);
|
||||
}
|
||||
}
|
||||
|
||||
if (c->step()) {
|
||||
if (event) {
|
||||
Serial.println(F(""));
|
||||
Serial.println(F(" *** EMULATION STOPPED *** "));
|
||||
dump_state(b);
|
||||
|
|
1
cpu.cpp
1
cpu.cpp
|
@ -1081,7 +1081,6 @@ bool cpu::misc_operations(const uint16_t instr)
|
|||
|
||||
// MOVE link, PC
|
||||
setPC(getRegister(link_reg, false));
|
||||
uint16_t temp = getPC();
|
||||
|
||||
// POP link
|
||||
setRegister(link_reg, false, popStack());
|
||||
|
|
3
cpu.h
3
cpu.h
|
@ -18,12 +18,13 @@ private:
|
|||
uint16_t stackLimitRegister { 0 };
|
||||
bool haltFlag { false }, resetFlag { false };
|
||||
bool runMode { false };
|
||||
uint32_t *const event { nullptr };
|
||||
|
||||
bool emulateMFPT { false };
|
||||
|
||||
bus *const b { nullptr };
|
||||
|
||||
uint32_t *const event { nullptr };
|
||||
|
||||
uint16_t getRegister(const int nr, const bool MF_MT) const;
|
||||
void setRegister(const int nr, const bool MF_MT, const uint16_t value);
|
||||
void addRegister(const int nr, const bool MF_MT, const uint16_t value);
|
||||
|
|
12
main.cpp
12
main.cpp
|
@ -213,8 +213,7 @@ void put_char_ui(char c)
|
|||
void help()
|
||||
{
|
||||
printf("-h this help\n");
|
||||
printf("-m mode \"test\": for running xxdp (stop on bell)\n");
|
||||
printf(" \"tc\": run testcases\n");
|
||||
printf("-m mode \"tc\": run testcases\n");
|
||||
printf("-T t.bin load file as a binary tape file (like simh \"load\" command)\n");
|
||||
printf("-R d.rk load file as a RK05 disk device\n");
|
||||
printf("-p 123 set CPU start pointer to decimal(!) value\n");
|
||||
|
@ -233,7 +232,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
c -> setEmulateMFPT(true);
|
||||
|
||||
bool testMode = false, testCases = false;
|
||||
bool testCases = false;
|
||||
int opt = -1;
|
||||
while((opt = getopt(argc, argv, "hm:T:R:p:ndL:")) != -1)
|
||||
{
|
||||
|
@ -251,9 +250,7 @@ int main(int argc, char *argv[])
|
|||
break;
|
||||
|
||||
case 'm':
|
||||
if (strcasecmp(optarg, "test") == 0)
|
||||
testMode = true;
|
||||
else if (strcasecmp(optarg, "tc") == 0)
|
||||
if (strcasecmp(optarg, "tc") == 0)
|
||||
testCases = true;
|
||||
else {
|
||||
fprintf(stderr, "\"-m %s\" is not known\n", optarg);
|
||||
|
@ -294,9 +291,6 @@ int main(int argc, char *argv[])
|
|||
|
||||
b->add_tty(tty_);
|
||||
|
||||
if (testMode)
|
||||
tty_->setTest();
|
||||
|
||||
if (testCases)
|
||||
tests(c);
|
||||
|
||||
|
|
11
tty.cpp
11
tty.cpp
|
@ -109,21 +109,10 @@ void tty::writeWord(const uint16_t addr, uint16_t v)
|
|||
|
||||
D(fprintf(stderr, "PDP11TTY write %o (%s): %o\n", addr, regnames[reg], v);)
|
||||
|
||||
if (v == 0207 && testMode) {
|
||||
D(fprintf(stderr, "TestMode: TTY 0207 char\n");)
|
||||
|
||||
#if !defined(ESP32)
|
||||
exit(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
// FIXME
|
||||
if (addr == PDP11TTY_TPB) {
|
||||
char c = v & 127;
|
||||
|
||||
#if defined(ESP32)
|
||||
Serial.print(c);
|
||||
|
||||
if (xQueueSend(queue, &c, portMAX_DELAY) != pdTRUE)
|
||||
Serial.println(F("queue TTY character failed"));
|
||||
#else
|
||||
|
|
3
tty.h
3
tty.h
|
@ -24,7 +24,6 @@ private:
|
|||
std::function<void(char c)> put_char;
|
||||
bool have_char { false };
|
||||
uint16_t registers[4] { 0 };
|
||||
bool testMode { false };
|
||||
bool withUI { false };
|
||||
|
||||
#if defined(ESP32)
|
||||
|
@ -35,8 +34,6 @@ public:
|
|||
tty(std::function<bool()> poll_char, std::function<uint8_t()> get_char, std::function<void(char c)> put_char);
|
||||
virtual ~tty();
|
||||
|
||||
void setTest() { testMode = true; }
|
||||
|
||||
#if defined(ESP32)
|
||||
QueueHandle_t & getTerminalQueue() { return queue; }
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue