misc esp32 tweaks
This commit is contained in:
parent
5184c100d9
commit
d9a56801f7
4 changed files with 24 additions and 20 deletions
14
bus.cpp
14
bus.cpp
|
@ -13,19 +13,19 @@
|
|||
#include "tm-11.h"
|
||||
#include "tty.h"
|
||||
|
||||
bus::bus() : c(nullptr), tm11(nullptr), rk05_(nullptr), rx02_(nullptr), tty_(nullptr)
|
||||
{
|
||||
#if defined(ESP32)
|
||||
// ESP32 goes in a crash-loop when allocating 128kB
|
||||
// see also https://github.com/espressif/esp-idf/issues/1934
|
||||
int n = 12;
|
||||
constexpr int n_pages = 12;
|
||||
#else
|
||||
int n = 16;
|
||||
constexpr int n_pages = 16;
|
||||
#endif
|
||||
|
||||
m = new memory(n * 8192);
|
||||
bus::bus() : c(nullptr), tm11(nullptr), rk05_(nullptr), rx02_(nullptr), tty_(nullptr)
|
||||
{
|
||||
m = new memory(n_pages * 8192);
|
||||
|
||||
for(int i=0; i<n; i++) {
|
||||
for(int i=0; i<n_pages; i++) {
|
||||
pages[i].par = (i & 7) * 8192 / 64;
|
||||
pages[i].pdr = (3 << 1) | (0 << 4) | (0 << 6) | ((8192 / (32 * 2)) << 8);
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ uint16_t bus::read(const uint16_t a, const bool word_mode, const bool use_prev)
|
|||
D(fprintf(stderr, "UNHANDLED read %o(%c)\n", a, word_mode ? 'B' : ' ');)
|
||||
|
||||
if (a == 0177760)
|
||||
return 0167777; // TODO; get this from memory.cpp min(memsize, 64kB - 4kB)
|
||||
return std::min(n_pages * 8192, 65536) - 4096;
|
||||
|
||||
// c -> busError();
|
||||
|
||||
|
|
10
cpu.cpp
10
cpu.cpp
|
@ -1517,14 +1517,6 @@ bool cpu::step()
|
|||
if (getPC() & 1)
|
||||
busError();
|
||||
|
||||
if (getPC() == 06746)
|
||||
{
|
||||
FILE *fh = fopen("debug.dat", "wb");
|
||||
for(int i=0; i<256; i++)
|
||||
fputc(b -> readByte(getPC() + i), fh);
|
||||
fclose(fh);
|
||||
}
|
||||
|
||||
disassemble();
|
||||
|
||||
b -> setMMR2(getPC());
|
||||
|
@ -1547,10 +1539,12 @@ bool cpu::step()
|
|||
|
||||
{
|
||||
FILE *fh = fopen("fail.dat", "wb");
|
||||
if (fh) {
|
||||
for(int i=0; i<256; i++)
|
||||
fputc(b -> readByte(getPC() - 2 + i), fh);
|
||||
fclose(fh);
|
||||
}
|
||||
}
|
||||
busError();
|
||||
exit(1);
|
||||
return false;
|
||||
|
|
|
@ -1,11 +1,19 @@
|
|||
// (C) 2018 by Folkert van Heusden
|
||||
// Released under Apache License v2.0
|
||||
#if defined(ESP32)
|
||||
#include <Arduino.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
|
||||
#include "memory.h"
|
||||
|
||||
memory::memory(const uint32_t size) : size(size)
|
||||
{
|
||||
#if defined(ESP32)
|
||||
Serial.print(F("Memory size (in bytes, decimal): "));
|
||||
Serial.println(size);
|
||||
#endif
|
||||
|
||||
m = new uint8_t[size]();
|
||||
}
|
||||
|
||||
|
|
2
rk05.cpp
2
rk05.cpp
|
@ -199,6 +199,8 @@ void rk05::writeWord(const uint16_t addr, uint16_t v)
|
|||
while(temp > 0) {
|
||||
uint32_t cur = std::min(uint32_t(sizeof xfer_buffer), temp);
|
||||
|
||||
yield();
|
||||
|
||||
#if defined(ESP32)
|
||||
if (fh.read(xfer_buffer, cur) != size_t(cur))
|
||||
D(fprintf(stderr, "RK05 fread error: %s\n", strerror(errno));)
|
||||
|
|
Loading…
Add table
Reference in a new issue