mirror of
https://github.com/jscrane/r65emu.git
synced 2024-06-10 06:29:30 +00:00
renaming
This commit is contained in:
parent
984692ad95
commit
397f580add
6
acia.h
6
acia.h
|
@ -7,7 +7,7 @@ enum parity {
|
||||||
odd,
|
odd,
|
||||||
};
|
};
|
||||||
|
|
||||||
class SerialDevice {
|
class serialio {
|
||||||
public:
|
public:
|
||||||
virtual void reset() {}
|
virtual void reset() {}
|
||||||
virtual void framing(unsigned data_bits, unsigned stop_bits, parity p) {}
|
virtual void framing(unsigned data_bits, unsigned stop_bits, parity p) {}
|
||||||
|
@ -23,7 +23,7 @@ public:
|
||||||
void operator= (uint8_t);
|
void operator= (uint8_t);
|
||||||
operator uint8_t();
|
operator uint8_t();
|
||||||
|
|
||||||
acia(SerialDevice *d): Memory::Device(256), _device(d) {}
|
acia(serialio &d): Memory::Device(256), _device(&d) {}
|
||||||
|
|
||||||
// status bits
|
// status bits
|
||||||
//
|
//
|
||||||
|
@ -63,6 +63,6 @@ public:
|
||||||
static const uint8_t eri = 1 << 7; // enable receive interrupt
|
static const uint8_t eri = 1 << 7; // enable receive interrupt
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SerialDevice *_device;
|
serialio *_device;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "hardware.h"
|
#include "hardware.h"
|
||||||
#include "sdtape.h"
|
#include "filer.h"
|
||||||
#include "checkpoint.h"
|
#include "checkpoint.h"
|
||||||
|
|
||||||
#if defined(USE_SD)
|
#if defined(USE_SD)
|
||||||
|
@ -17,9 +17,9 @@ static char buf[32];
|
||||||
static char chkpt[] = { "CHKPOINT" };
|
static char chkpt[] = { "CHKPOINT" };
|
||||||
static int cpid = 0;
|
static int cpid = 0;
|
||||||
|
|
||||||
const char *checkpoint(sdtape &tape, const char *dir) {
|
const char *checkpoint(filer &f, const char *dir) {
|
||||||
#if defined(USE_SD) || defined(USE_SPIFFS) || defined(ESP8266)
|
#if defined(USE_SD) || defined(USE_SPIFFS) || defined(ESP8266)
|
||||||
tape.stop();
|
f.stop();
|
||||||
snprintf(buf, sizeof(buf), "%s%s.%03d", dir, chkpt, cpid++);
|
snprintf(buf, sizeof(buf), "%s%s.%03d", dir, chkpt, cpid++);
|
||||||
|
|
||||||
#if defined(USE_SD)
|
#if defined(USE_SD)
|
||||||
|
@ -31,14 +31,14 @@ const char *checkpoint(sdtape &tape, const char *dir) {
|
||||||
#endif
|
#endif
|
||||||
hardware_checkpoint(file);
|
hardware_checkpoint(file);
|
||||||
file.close();
|
file.close();
|
||||||
tape.start(dir);
|
f.start(dir);
|
||||||
#endif
|
#endif
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
void restore(sdtape &tape, const char *dir, const char *filename) {
|
void restore(filer &f, const char *dir, const char *filename) {
|
||||||
#if defined(USE_SD) || defined(USE_SPIFFS) || defined(ESP8266)
|
#if defined(USE_SD) || defined(USE_SPIFFS) || defined(ESP8266)
|
||||||
tape.stop();
|
f.stop();
|
||||||
snprintf(buf, sizeof(buf), "%s%s", dir, filename);
|
snprintf(buf, sizeof(buf), "%s%s", dir, filename);
|
||||||
|
|
||||||
#if defined(USE_SD)
|
#if defined(USE_SD)
|
||||||
|
@ -53,5 +53,5 @@ void restore(sdtape &tape, const char *dir, const char *filename) {
|
||||||
int n = sscanf(buf + strlen(dir), "%[A-Z0-9].%d", chkpt, &cpid);
|
int n = sscanf(buf + strlen(dir), "%[A-Z0-9].%d", chkpt, &cpid);
|
||||||
cpid = (n == 1)? 0: cpid+1;
|
cpid = (n == 1)? 0: cpid+1;
|
||||||
#endif
|
#endif
|
||||||
tape.start(dir);
|
f.start(dir);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#define __CHECKPOINT_H__
|
#define __CHECKPOINT_H__
|
||||||
|
|
||||||
// utility checkpoint functions
|
// utility checkpoint functions
|
||||||
const char *checkpoint(sdtape &tape, const char *dir);
|
const char *checkpoint(filer &f, const char *dir);
|
||||||
void restore(sdtape &tape, const char *dir, const char *filename);
|
void restore(filer &f, const char *dir, const char *filename);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include <FS.h>
|
#include <FS.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "sdtape.h"
|
#include "filer.h"
|
||||||
|
|
||||||
#if defined(DISK)
|
#if defined(DISK)
|
||||||
static File file, dir;
|
static File file, dir;
|
||||||
|
@ -23,7 +23,7 @@ static const char *programs;
|
||||||
|
|
||||||
#define STORAGE defined(USE_SD) || defined(USE_SPIFFS) || defined(USE_FS)
|
#define STORAGE defined(USE_SD) || defined(USE_SPIFFS) || defined(USE_FS)
|
||||||
|
|
||||||
bool sdtape::start(const char *programs)
|
bool flash_filer::start(const char *programs)
|
||||||
{
|
{
|
||||||
#if defined(USE_FS)
|
#if defined(USE_FS)
|
||||||
::programs = programs;
|
::programs = programs;
|
||||||
|
@ -38,14 +38,14 @@ bool sdtape::start(const char *programs)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sdtape::stop()
|
void flash_filer::stop()
|
||||||
{
|
{
|
||||||
#if STORAGE
|
#if STORAGE
|
||||||
file.close();
|
file.close();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool sdtape::more()
|
bool flash_filer::more()
|
||||||
{
|
{
|
||||||
if (_pos >= _len) {
|
if (_pos >= _len) {
|
||||||
_pos = 0;
|
_pos = 0;
|
||||||
|
@ -58,7 +58,7 @@ bool sdtape::more()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *sdtape::advance() {
|
const char *flash_filer::advance() {
|
||||||
#if STORAGE
|
#if STORAGE
|
||||||
bool rewound = false;
|
bool rewound = false;
|
||||||
file.close();
|
file.close();
|
||||||
|
@ -94,7 +94,7 @@ const char *sdtape::advance() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *sdtape::rewind() {
|
const char *flash_filer::rewind() {
|
||||||
#if defined(DISK)
|
#if defined(DISK)
|
||||||
dir.rewindDirectory();
|
dir.rewindDirectory();
|
||||||
#endif
|
#endif
|
28
filer.h
Normal file
28
filer.h
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
#ifndef __FILER_H__
|
||||||
|
#define __FILER_H__
|
||||||
|
|
||||||
|
class filer {
|
||||||
|
public:
|
||||||
|
virtual const char *advance() =0;
|
||||||
|
virtual const char *rewind() =0;
|
||||||
|
|
||||||
|
virtual bool start(const char *) =0;
|
||||||
|
virtual void stop() =0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class flash_filer: public filer {
|
||||||
|
public:
|
||||||
|
const char *advance();
|
||||||
|
const char *rewind();
|
||||||
|
|
||||||
|
bool start(const char *);
|
||||||
|
void stop();
|
||||||
|
|
||||||
|
uint8_t read() { return _buf[_pos++]; }
|
||||||
|
bool more();
|
||||||
|
|
||||||
|
private:
|
||||||
|
unsigned _pos, _len;
|
||||||
|
uint8_t _buf[128];
|
||||||
|
};
|
||||||
|
#endif
|
2
r65emu.h
2
r65emu.h
|
@ -9,7 +9,7 @@
|
||||||
#include "ps2drv.h"
|
#include "ps2drv.h"
|
||||||
#include "tftdisplay.h"
|
#include "tftdisplay.h"
|
||||||
#include "keyboard.h"
|
#include "keyboard.h"
|
||||||
#include "sdtape.h"
|
#include "filer.h"
|
||||||
#include "timed.h"
|
#include "timed.h"
|
||||||
#include "hardware.h"
|
#include "hardware.h"
|
||||||
#include "checkpoint.h"
|
#include "checkpoint.h"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user