1
0
mirror of https://github.com/jscrane/r65emu.git synced 2025-01-17 18:29:55 +00:00

minor fixes

This commit is contained in:
Stephen Crane 2018-11-16 12:35:07 +00:00
parent 5cceb03cc7
commit a43a529fe7

View File

@ -22,10 +22,15 @@ static Dir dir;
#define STORAGE defined(USE_SD) || defined(USE_SPIFFS) || defined(USE_FS) #define STORAGE defined(USE_SD) || defined(USE_SPIFFS) || defined(USE_FS)
#if defined(USE_FS)
static const char *programs;
#endif
bool sdtape::start(const char *programs) bool sdtape::start(const char *programs)
{ {
#if defined(USE_FS) #if defined(USE_FS)
dir = SPIFFS.openDir("/"); ::programs = programs;
dir = SPIFFS.openDir(programs);
#elif defined(DISK) #elif defined(DISK)
dir = DISK.open(programs); dir = DISK.open(programs);
if (!dir) if (!dir)
@ -45,15 +50,14 @@ void sdtape::stop()
bool sdtape::more() bool sdtape::more()
{ {
#if defined(STORAGE)
if (_pos >= _len) { if (_pos >= _len) {
_pos = 0; _pos = 0;
#if defined(STORAGE)
_len = file.read(_buf, sizeof(_buf)); _len = file.read(_buf, sizeof(_buf));
#endif
if (_len == 0) // eof if (_len == 0) // eof
return false; return false;
} }
#endif
return true; return true;
} }
@ -68,7 +72,7 @@ const char *sdtape::advance() {
file = dir.openFile("r"); file = dir.openFile("r");
break; break;
} }
dir = SPIFFS.openDir("/"); dir = SPIFFS.openDir(programs);
} }
strncpy(buf, dir.fileName().c_str(), sizeof(buf)); strncpy(buf, dir.fileName().c_str(), sizeof(buf));
return buf; return buf;