diff --git a/sdtape.cpp b/sdtape.cpp index 1564d5a..08e727f 100644 --- a/sdtape.cpp +++ b/sdtape.cpp @@ -12,10 +12,14 @@ static File file, dir; -void sdtape::start(const char *programs) +bool sdtape::start(const char *programs) { dir = DISK.open(programs); + if (!dir) + return false; + _pos = _len = 0; + return true; } void sdtape::stop() diff --git a/sdtape.h b/sdtape.h index b8794b5..5ba9aa0 100644 --- a/sdtape.h +++ b/sdtape.h @@ -6,16 +6,14 @@ public: const char *advance(); const char *rewind(); - void start(const char *); + bool start(const char *); void stop(); - sdtape(): _pos(0), _len(0) {} - uint8_t read() { return _buf[_pos++]; } bool more(); private: - unsigned int _pos, _len; + unsigned _pos, _len; uint8_t _buf[128]; }; #endif