From dff87ac6d5d825f19f416c172b36ba44ed2942b7 Mon Sep 17 00:00:00 2001 From: TurBoss Date: Fri, 10 May 2024 05:00:58 +0200 Subject: [PATCH 1/7] [WIP] Implement iobyte from moxhamj's issue code --- RunCPM/RunCPM.ino | 2 + RunCPM/abstraction_arduino.h | 336 +++++++++++++++++++++++++++++++++-- 2 files changed, 326 insertions(+), 12 deletions(-) diff --git a/RunCPM/RunCPM.ino b/RunCPM/RunCPM.ino index cf10b70..1b4d59f 100644 --- a/RunCPM/RunCPM.ino +++ b/RunCPM/RunCPM.ino @@ -45,6 +45,8 @@ void setup(void) { pinMode(LED, OUTPUT); digitalWrite(LED, LOW); Serial.begin(SERIALSPD); + Serial1.begin(SERIALSPD); + Serial2.begin(SERIALSPD); while (!Serial) { // Wait until serial is connected digitalWrite(LED, HIGH^LEDinv); delay(sDELAY); diff --git a/RunCPM/abstraction_arduino.h b/RunCPM/abstraction_arduino.h index 2d46f3d..20d3e74 100644 --- a/RunCPM/abstraction_arduino.h +++ b/RunCPM/abstraction_arduino.h @@ -491,30 +491,342 @@ uint32 _HardwareIn(const uint32 Port) { return 0; } +// ***************************** Physical Device List ************************************** +//CON: = TTY: CRT: BAT: UC1: +//RDR: = TTY: PTR: UR1: UR2: +//PUN: = TTY: PTP: UP1: UP2: +//LST: = TTY: CRT: LPT: UL1: + +// TTY + +void deviceTTYout(uint8_t ch) // same as _putch +{ + Serial1.write(ch); // same as _putch but with buffer overflow protection + while (Serial1.availableForWrite() < 20) { + delay(100); // at 9600 baud, ESP32 output buffer is 128 bytes, if stops when only 20 chars left in the output buffer, and pause 100ms, then have about 115 left as sending about 1 per ms. + } +} + +uint8_t deviceTTYavailable(void) { // same as _kbhit + return(Serial1.available()); +} + +uint8_t deviceTTYin(void) { // same as _getch + while (!Serial1.available()); + return(Serial1.read()); +} + +uint8_t deviceTTYinEcho(void) { // same as _getche + uint8_t ch = deviceTTYin(); + deviceTTYout(ch); + return(ch); +} + +// CRT + +void deviceCRTout(uint8_t ch) // same as _putch +{ + Serial.write(ch); // same as _putch but with buffer overflow protection + while (Serial.availableForWrite() < 20) { + delay(100); // at 9600 baud, ESP32 output buffer is 128 bytes, if stop when only 20 chars left in the output buffer, and pause 100ms, then have about 115 left as sending about 1 per ms. + } +} + +uint8_t deviceCRTavailable(void) { // same as _kbhit + return(Serial.available()); +} + +uint8_t deviceCRTin(void) { // same as _getch + while (!Serial.available()); + return(Serial.read()); +} + +uint8_t deviceCRTinEcho(void) { // same as _getche + uint8_t ch = deviceCRTin(); + deviceCRTout(ch); + return(ch); +} + +// UR1 + +uint8_t deviceUR1in(void) { + uint8_t ch = 26; + return ch; +} + +// UP1 + +void deviceUP1out(uint8_t ch) { + // add code here +} + +// BAT, console device, input and output and can see if characters waiting, input used by Kermit as the default input device + +void deviceBATout(uint8_t ch) +{ + Serial2.write(ch); // same as _putch but with buffer overflow protection + while (Serial2.availableForWrite() < 20) { + delay(100); // at 9600 baud, ESP32 output buffer is 128 bytes, if stop when only 20 chars left in the output buffer, and pause 100ms, then have about 115 left as sending about 1 per ms. + } +} + +uint8_t deviceBATavailable(void) { + return(Serial2.available()); +} + +uint8_t deviceBATin(void) { + while (!Serial2.available()); + return(Serial2.read()); +} + +uint8_t deviceBATinEcho(void) { + uint8_t ch = deviceBATin(); + deviceBATout(ch); + return(ch); +} + +// UC1, console device + +void deviceUC1out(uint8_t ch) +{ + // add code here +} + +uint8_t deviceUC1available(void) { + return(1); // add code here +} + +uint8_t deviceUC1in(void) { + return(26); // add code here +} + +uint8_t deviceUC1inEcho(void) { + uint8_t ch = deviceUC1in(); + deviceUC1out(ch); + return(ch); +} + +// PTR, reader device + +uint8_t devicePTRin(void) { + return 26; // add code here +} + +// UR2, reader device + +uint8_t deviceUR2in(void) { + return 26; // add code here +} + +// PTP, punch device + +void devicePTPout(uint8_t ch) { + Serial2.write(ch); // used by Kermit as the default output device + while (Serial2.availableForWrite() < 20) { + delay(100); // at 9600 baud, if stop when only 20 chars left, and pause 100ms, then have about 115 left, as sending about 1 per ms. Should not need to do this if using small packets with Kermit + } +} + +// UP2, punch device + +void deviceUP2out(uint8_t ch) { + // add code here - eg write to file +} + +// UL1, LST device + +void deviceUL1out(uint8_t ch) { + // add code here - eg write to file +} + + +// LPT, LST device + +void deviceLPTout(uint8_t ch) { + // add code here +} + +// ************************************* + +// redirection for CON RDR PUN and LST eg CONin, CONout, CONavailable directed to one of four places depending on IOBYTE. + +uint8_t iobyteCON() +{ + uint8_t iobyte; + iobyte = _RamRead(0x0003); + iobyte = iobyte & 0x03; // mask off 00000011 + return iobyte; +} + +uint8_t iobyteRDR() +{ + uint8_t iobyte; + iobyte = _RamRead(0x0003); + iobyte = iobyte & 0x0C; // mask off 00001100 + iobyte = iobyte >> 2; // bitshift so low 2 bits + return iobyte; +} + +uint8_t iobytePUN() +{ + uint8_t iobyte; + iobyte = _RamRead(0x0003); + iobyte = iobyte & 0x30; // mask off 00110000 + iobyte = iobyte >> 4; // bitshift so low 2 bits + return iobyte; +} + +uint8_t iobyteLST() +{ + uint8_t iobyte; + iobyte = _RamRead(0x0003); + iobyte = iobyte & 0xC0; // mask off 11000000 + iobyte = iobyte >> 6; // bitshift so low 2 bits + return iobyte; +} + +//CON: = TTY: CRT: BAT: UC1: +void outCON(uint8_t ch) +{ + uint8_t iobyte; + iobyte = iobyteCON(); // 00, 01 10, 11 + switch (iobyte) { + case 0: deviceTTYout(ch); + break; + case 1: deviceCRTout(ch); + break; + case 2: deviceBATout(ch); + break; + case 3: deviceUC1out(ch); + break; + } +} + +uint8_t availableCON() +{ + uint8_t iobyte; + uint8_t dataAvailable; + iobyte = iobyteCON(); // 00, 01 10, 11 + switch (iobyte) { + case 0: dataAvailable = deviceTTYavailable(); + break; + case 1: dataAvailable = deviceCRTavailable(); + break; + case 2: dataAvailable = deviceBATavailable(); + break; + case 3: dataAvailable = deviceUC1available(); + break; + } + return dataAvailable; +} + +uint8_t inCON(void) +{ + uint8_t iobyte; + uint8_t dataIn; + iobyte = iobyteCON(); // 00, 01 10, 11 + switch (iobyte) { + case 0: dataIn = deviceTTYin(); + break; + case 1: dataIn = deviceCRTin(); + break; + case 2: dataIn = deviceBATin(); + break; + case 3: dataIn = deviceUC1in(); + break; + } + return dataIn; +} + +uint8_t echoCON() +{ + uint8_t ch; + ch = inCON(); + outCON(ch); + return(ch); +} + +//RDR: = TTY: PTR: UR1: UR2: +uint8_t inRDR(void) +{ + uint8_t iobyte; + uint8_t dataIn; + iobyte = iobyteRDR(); // 00, 01 10, 11 + switch (iobyte) { + case 0: dataIn = deviceTTYin(); + break; + case 1: dataIn = devicePTRin(); + break; + case 2: dataIn = deviceUR1in(); + break; + case 3: dataIn = deviceUR2in(); + break; + } + return dataIn; +} + +//PUN: = TTY: PTP: UP1: UP2: +void outPUN(uint8_t ch) +{ + uint8_t iobyte; + iobyte = iobytePUN(); // 00, 01 10, 11 + switch (iobyte) { + case 0: deviceTTYout(ch); + break; + case 1: devicePTPout(ch); + break; + case 2: deviceUP1out(ch); + break; + case 3: deviceUP2out(ch); + break; + } +} + +//LST: = TTY: CRT: LPT: UL1: +void outLST(uint8_t ch) +{ + uint8_t iobyte; + iobyte = iobyteLST(); // 00, 01 10, 11 + switch (iobyte) { + case 0: deviceTTYout(ch); + break; + case 1: deviceCRTout(ch); + break; + case 2: deviceLPTout(ch); + break; + case 3: deviceUL1out(ch); + break; + } +} + /* Console abstraction functions */ /*===============================================================================*/ -int _kbhit(void) { - return(Serial.available()); +uint8_t _kbhit(void) { + //return(Serial.available()); + return availableCON(); // redirect based on iobyte } -uint8 _getch(void) { - while (!Serial.available()); - return(Serial.read()); +uint8_t _getch(void) { + //while (!Serial.available()); + //return(Serial.read()); + return inCON(); // redirect based on iobyte } -uint8 _getche(void) { - uint8 ch = _getch(); - Serial.write(ch); - return(ch); +uint8_t _getche(void) { + //uint8_t ch = _getch(); + //Serial.write(ch); + //return(ch); + return echoCON(); // redirect based on iobyte } -void _putch(uint8 ch) { - Serial.write(ch); +void _putch(uint8_t ch) { + //Serial.write(ch); + outCON(ch); // redirect based on iobyte } void _clrscr(void) { - Serial.println("\e[H\e[J"); + Serial.println("\e[H\e[J"); // done once at startup so left as is } #endif From f71761c096c3f7fa1ed8241e9c9163c7ee179274 Mon Sep 17 00:00:00 2001 From: MockbaTheBorg Date: Mon, 13 May 2024 10:50:45 -0400 Subject: [PATCH 2/7] sFlag doesn't apply to regular CCPs --- RunCPM/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RunCPM/main.c b/RunCPM/main.c index 9a33a09..9df4db3 100644 --- a/RunCPM/main.c +++ b/RunCPM/main.c @@ -102,7 +102,7 @@ int main(int argc, char* argv[]) { // Loads an autoexec file if it exists and this is the first boot // The file contents are loaded at ccpAddr+8 up to 126 bytes then the size loaded is stored at ccpAddr+7 - if (firstBoot an not sFlag) { + if (firstBoot) { uint8 dmabuf[128]; uint8 bytesread; uint16 cmd = CCPaddr + 7; From f4e25a972d6058d9e1c74d4624a1a5cabd54211a Mon Sep 17 00:00:00 2001 From: MockbaTheBorg Date: Tue, 14 May 2024 12:29:11 -0400 Subject: [PATCH 3/7] Make debugger key configurable --- RunCPM/cpm.h | 8 ++++---- RunCPM/globals.h | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/RunCPM/cpm.h b/RunCPM/cpm.h index e2511fb..2c925cf 100644 --- a/RunCPM/cpm.h +++ b/RunCPM/cpm.h @@ -538,7 +538,7 @@ void _Bios(void) { case B_CONIN: { // 3 - Console input SET_HIGH_REGISTER(AF, _getcon()); #ifdef DEBUG - if (HIGH_REGISTER(AF) == 4) + if (HIGH_REGISTER(AF) == DEBUGKEY) Debug = 1; #endif // ifdef DEBUG break; @@ -700,7 +700,7 @@ void _Bdos(void) { case C_READ: { HL = _getconE(); #ifdef DEBUG - if (HL == 4) + if (HL == DEBUGKEY) Debug = 1; #endif // ifdef DEBUG break; @@ -768,7 +768,7 @@ void _Bdos(void) { if (LOW_REGISTER(DE) == 0xff) { HL = _getconNB(); #ifdef DEBUG - if (HL == 4) + if (HL == DEBUGKEY) Debug = 1; #endif // ifdef DEBUG } else { @@ -878,7 +878,7 @@ void _Bdos(void) { } #ifdef DEBUG - if (chr == 4) { // ^D - DEBUG + if (chr == DEBUGKEY) { // Enter debugger Debug = 1; break; } diff --git a/RunCPM/globals.h b/RunCPM/globals.h index 20401e6..3130fc7 100644 --- a/RunCPM/globals.h +++ b/RunCPM/globals.h @@ -18,6 +18,8 @@ //#define DEBUGONHALT // Enables the internal debugger when the CPU halts //#define iDEBUG // Enables instruction logging onto iDebug.log (for development debug only) //#define DEBUGLOG // Writes extensive call trace information to RunCPM.log +#define DEBUGKEY 4 // Key to trigger the debugger. 4 = ^D + //#define CONSOLELOG // Writes debug information to console instead of file //#define LOGBIOS_NOT 01 // If defined will not log this BIOS function number //#define LOGBIOS_ONLY 02 // If defined will log only this BIOS function number From ab4879640ec172213f1ff8876a14fa3af1345ed3 Mon Sep 17 00:00:00 2001 From: MockbaTheBorg Date: Tue, 14 May 2024 13:52:42 -0400 Subject: [PATCH 4/7] Added option to exit RunCPM from the debugger --- RunCPM/cpu.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/RunCPM/cpu.h b/RunCPM/cpu.h index a86df88..ebeeaac 100644 --- a/RunCPM/cpu.h +++ b/RunCPM/cpu.h @@ -1358,7 +1358,7 @@ void Z80debug(void) { _puts("\r\nDebug Mode - Press '?' for help"); - while (loop) { + while (loop && Debug) { pos = PC; _puts("\r\n"); _puts("BC:"); _puthex16(BC); @@ -1485,6 +1485,11 @@ void Z80debug(void) { _puts("\r\n"); } break; + case 'X': + _puts("\r\nExiting...\r\n"); + Debug = 0; + Status = 1; + break; case '?': _puts("\r\n"); _puts("Lowercase commands:\r\n"); @@ -1506,6 +1511,7 @@ void Z80debug(void) { _puts(" L - Disassembles at address\r\n"); _puts(" T - Steps over a call\r\n"); _puts(" W - Sets a byte/word watch\r\n"); + _puts(" X - Exit RunCPM\r\n"); break; default: _puts(" ???\r\n"); @@ -1538,6 +1544,8 @@ static inline void Z80run(void) { } if (Debug) Z80debug(); + if (Status) + break; #endif PCX = PC; From 94d7459f7a85bdf02f29723c6e7381313f89e7c4 Mon Sep 17 00:00:00 2001 From: MockbaTheBorg Date: Thu, 16 May 2024 16:58:02 -0400 Subject: [PATCH 5/7] Fix (?) autoexec bugs preventing Arduino build --- RunCPM/abstraction_arduino.h | 15 ++++++++++++++ RunCPM/abstraction_posix.h | 13 ++++++++++++ RunCPM/abstraction_vstudio.h | 13 ++++++++++++ RunCPM/ccp.h | 38 +++++++++++++----------------------- RunCPM/main.c | 25 +++++++----------------- 5 files changed, 62 insertions(+), 42 deletions(-) diff --git a/RunCPM/abstraction_arduino.h b/RunCPM/abstraction_arduino.h index 20d3e74..e8e71c4 100644 --- a/RunCPM/abstraction_arduino.h +++ b/RunCPM/abstraction_arduino.h @@ -32,6 +32,21 @@ bool _RamLoad(char* filename, uint16 address) { } return(result); } +uint16 _RamLoadSz(char* filename, uint16 address, uint16 maxsize) { + File f; + bool result = false; + uint16 bytesread = 0; + + if (f = SD.open(filename, FILE_READ)) { + while (f.available()) { + _RamWrite(address++, f.read()); + bytesread++; + } + f.close(); + result = true; + } + return(bytesread); +} /* Filesystem (disk) abstraction functions */ /*===============================================================================*/ diff --git a/RunCPM/abstraction_posix.h b/RunCPM/abstraction_posix.h index b164693..d924f02 100644 --- a/RunCPM/abstraction_posix.h +++ b/RunCPM/abstraction_posix.h @@ -53,6 +53,19 @@ void _RamLoad(uint8* filename, uint16 address) { _sys_fclose(file); } +uint16 _RamLoadSz(uint8* filename, uint16 address, uint16 maxsize) { + long l; + FILE* file = _sys_fopen_r(filename); + _sys_fseek(file, 0, SEEK_END); + l = _sys_ftell(file); + if (l > maxsize) + l = maxsize; + _sys_fseek(file, 0, SEEK_SET); + _sys_fread(_RamSysAddr(address), 1, l, file); // (todo) This can overwrite past RAM space + + _sys_fclose(file); + return l; +} /* Filesystem (disk) abstraction functions */ /*===============================================================================*/ diff --git a/RunCPM/abstraction_vstudio.h b/RunCPM/abstraction_vstudio.h index fd55ad0..af7bcd9 100644 --- a/RunCPM/abstraction_vstudio.h +++ b/RunCPM/abstraction_vstudio.h @@ -45,6 +45,19 @@ void _RamLoad(uint8* filename, uint16 address) { _sys_fclose(file); } +uint16 _RamLoadSz(uint8* filename, uint16 address, uint16 maxsize) { + long l; + FILE* file = _sys_fopen_r(filename); + _sys_fseek(file, 0, SEEK_END); + l = _sys_ftell(file); + if (l > maxsize) + l = maxsize; + _sys_fseek(file, 0, SEEK_SET); + _sys_fread(_RamSysAddr(address), 1, l, file); // (todo) This can overwrite past RAM space + + _sys_fclose(file); + return l; +} /* Filesystem (disk) abstraction functions */ /*===============================================================================*/ diff --git a/RunCPM/ccp.h b/RunCPM/ccp.h index 88137ca..20a8c03 100644 --- a/RunCPM/ccp.h +++ b/RunCPM/ccp.h @@ -692,28 +692,18 @@ void _ccp(void) { // Loads an autoexec file if it exists and this is the first boot // The file contents are loaded at ccpAddr+8 up to 126 bytes then the size loaded is stored at ccpAddr+7 if (firstBoot && !sFlag) { - uint8 dmabuf[128]; - uint16 cmd = inBuf + 1; - if (_sys_exists((uint8*)AUTOEXEC)) { - FILE* file = _sys_fopen_r((uint8*)AUTOEXEC); - blen = (uint8)_sys_fread(&dmabuf[0], 1, 128, file); - int count = 0; - if (blen) { - for (int i = 0; i < 126; ++i) { - _RamWrite(cmd + 1 + i, 0x00); - if (dmabuf[i] == 0x0D || dmabuf[i] == 0x0A || dmabuf[i] == 0x1A || dmabuf[i] == 0x00) { - break; - } - _RamWrite(cmd + 1 + i, dmabuf[i]); - count++; - } - } - _RamWrite(cmd, count); - _sys_fclose(file); - } - if (BOOTONLY) - firstBoot = FALSE; - } else { + if (_sys_exists((uint8*)AUTOEXEC)) { + uint16 cmd = inBuf + 2; + uint8 bytesread = (uint8)_RamLoadSz((uint8*)AUTOEXEC, cmd, 125); + blen = 0; + while (blen < bytesread && _RamRead(cmd + blen) > 31) + blen++; + _RamWrite(cmd + blen, 0x00); + _RamWrite(--cmd, blen); + } + if (BOOTONLY) + firstBoot = FALSE; + } else { _RamWrite(inBuf, 0); // Clears the buffer _RamWrite(inBuf + 1, 0); // Clears the buffer blen = 0; @@ -732,9 +722,9 @@ void _ccp(void) { _RamWrite(inBuf, cmdLen); // Sets the buffer size to read the command line _ccp_readInput(); + blen = _RamRead(inBuf + 1); // Obtains the number of bytes read } - blen = _RamRead(inBuf + 1); // Obtains the number of bytes read - + _ccp_bdos(F_DMAOFF, defDMA); // Reset current DMA if (blen) { _RamWrite(inBuf + 2 + blen, 0); // "Closes" the read buffer with a \0 diff --git a/RunCPM/main.c b/RunCPM/main.c index 9df4db3..b6b6298 100644 --- a/RunCPM/main.c +++ b/RunCPM/main.c @@ -103,25 +103,14 @@ int main(int argc, char* argv[]) { // Loads an autoexec file if it exists and this is the first boot // The file contents are loaded at ccpAddr+8 up to 126 bytes then the size loaded is stored at ccpAddr+7 if (firstBoot) { - uint8 dmabuf[128]; - uint8 bytesread; - uint16 cmd = CCPaddr + 7; if (_sys_exists((uint8*)AUTOEXEC)) { - FILE* file = _sys_fopen_r((uint8*)AUTOEXEC); - bytesread = (uint8)_sys_fread(&dmabuf[0], 1, 128, file); - int count = 0; - if (bytesread) { - for (int i = 0; i < 126; ++i) { - _RamWrite(cmd + 1 + i, 0x00); - if (dmabuf[i] == 0x0D || dmabuf[i] == 0x0A || dmabuf[i] == 0x1A || dmabuf[i] == 0x00) { - break; - } - _RamWrite(cmd + 1 + i, dmabuf[i]); - count++; - } - } - _RamWrite(cmd, count); - _sys_fclose(file); + uint16 cmd = CCPaddr + 8; + uint8 bytesread = (uint8)_RamLoadSz((uint8*)AUTOEXEC, cmd, 125); + uint8 blen = 0; + while (blen < bytesread && _RamRead(cmd + blen) > 31) + blen++; + _RamWrite(cmd + blen, 0x00); + _RamWrite(--cmd, blen); } if (BOOTONLY) firstBoot = FALSE; From 1e2e7c56f5e1b40d95147ef6a9439e1b09191984 Mon Sep 17 00:00:00 2001 From: MockbaTheBorg Date: Thu, 16 May 2024 17:17:43 -0400 Subject: [PATCH 6/7] Fixing(?) the autoexec fix --- RunCPM/RunCPM.ino | 17 ++++++++++++++++- RunCPM/abstraction_arduino.h | 8 ++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/RunCPM/RunCPM.ino b/RunCPM/RunCPM.ino index 1b4d59f..023ad29 100644 --- a/RunCPM/RunCPM.ino +++ b/RunCPM/RunCPM.ino @@ -81,10 +81,25 @@ void setup(void) { _PatchCPM(); Status = 0; #ifndef CCP_INTERNAL - if (!_RamLoad((char *)CCPname, CCPaddr)) { + if (!_RamLoad((uint8 *)CCPname, CCPaddr)) { _puts("Unable to load the CCP.\r\nCPU halted.\r\n"); break; } + // Loads an autoexec file if it exists and this is the first boot + // The file contents are loaded at ccpAddr+8 up to 126 bytes then the size loaded is stored at ccpAddr+7 + if (firstBoot) { + if (_sys_exists((uint8*)AUTOEXEC)) { + uint16 cmd = CCPaddr + 8; + uint8 bytesread = (uint8)_RamLoadSz((uint8*)AUTOEXEC, cmd, 125); + uint8 blen = 0; + while (blen < bytesread && _RamRead(cmd + blen) > 31) + blen++; + _RamWrite(cmd + blen, 0x00); + _RamWrite(--cmd, blen); + } + if (BOOTONLY) + firstBoot = FALSE; + } Z80reset(); SET_LOW_REGISTER(BC, _RamRead(DSKByte)); PC = CCPaddr; diff --git a/RunCPM/abstraction_arduino.h b/RunCPM/abstraction_arduino.h index e8e71c4..3811170 100644 --- a/RunCPM/abstraction_arduino.h +++ b/RunCPM/abstraction_arduino.h @@ -20,11 +20,11 @@ /* Memory abstraction functions */ /*===============================================================================*/ -bool _RamLoad(char* filename, uint16 address) { +bool _RamLoad(uint8* filename, uint16 address) { File f; bool result = false; - if (f = SD.open(filename, FILE_READ)) { + if (f = SD.open((char*)filename, FILE_READ)) { while (f.available()) _RamWrite(address++, f.read()); f.close(); @@ -32,12 +32,12 @@ bool _RamLoad(char* filename, uint16 address) { } return(result); } -uint16 _RamLoadSz(char* filename, uint16 address, uint16 maxsize) { +uint16 _RamLoadSz(uint8* filename, uint16 address, uint16 maxsize) { File f; bool result = false; uint16 bytesread = 0; - if (f = SD.open(filename, FILE_READ)) { + if (f = SD.open((char*)filename, FILE_READ)) { while (f.available()) { _RamWrite(address++, f.read()); bytesread++; From 898cb0063ee8ca3ff7d20c658ddb171f10c58ac9 Mon Sep 17 00:00:00 2001 From: TurBoss Date: Sat, 18 May 2024 10:54:50 +0200 Subject: [PATCH 7/7] add esp32s3 wroom1 to esp32 boards --- RunCPM/hardware/esp32/esp32s3_devkit.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 RunCPM/hardware/esp32/esp32s3_devkit.h diff --git a/RunCPM/hardware/esp32/esp32s3_devkit.h b/RunCPM/hardware/esp32/esp32s3_devkit.h new file mode 100644 index 0000000..61e145a --- /dev/null +++ b/RunCPM/hardware/esp32/esp32s3_devkit.h @@ -0,0 +1,20 @@ +#ifndef ESP32_H +#define ESP32_H + +// SPI_DRIVER_SELECT must be set to 0 in SdFat/SdFatConfig.h (default is 0) + +SdFat SD; +#define SPIINIT 12,13,11,10 // sck, miso, mosi, cs +#define SDMHZ 20 +#define SDINIT SS, SD_SCK_MHZ(SDMHZ) +#define LED 46 +#define LEDinv 0 +#define BOARD "ESP32S3 Devkit" +#define board_esp32s3 +#define board_digital_io + +uint8 esp32bdos(uint16 dmaaddr) { + return(0x00); +} + +#endif