From 14d3ad3e69f6808c88a4d12bf9d9e433c269d357 Mon Sep 17 00:00:00 2001 From: Stephen Crane Date: Thu, 6 Sep 2018 14:21:17 +0100 Subject: [PATCH] return status from tape start --- sdtape.cpp | 6 +++++- sdtape.h | 6 ++---- 2 files changed, 7 insertions(+), 5 deletions(-) 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