mirror of
https://github.com/jscrane/r65emu.git
synced 2024-12-21 12:29:51 +00:00
add Keyboard and Checkpointable abstractions
This commit is contained in:
parent
270af3b930
commit
0744c03f88
11
keyboard.h
Normal file
11
keyboard.h
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#ifndef _KEYBOARD_H
|
||||||
|
#define _KEYBOARD_H
|
||||||
|
|
||||||
|
class Keyboard {
|
||||||
|
public:
|
||||||
|
virtual void up(byte) = 0;
|
||||||
|
virtual void down(byte) = 0;
|
||||||
|
virtual void reset() = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
8
memory.h
8
memory.h
@ -6,6 +6,14 @@
|
|||||||
|
|
||||||
typedef unsigned char byte;
|
typedef unsigned char byte;
|
||||||
|
|
||||||
|
class Stream;
|
||||||
|
|
||||||
|
class Checkpointable {
|
||||||
|
public:
|
||||||
|
virtual void checkpoint(Stream &s) = 0;
|
||||||
|
virtual void restore(Stream &s) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
class Memory {
|
class Memory {
|
||||||
public:
|
public:
|
||||||
typedef unsigned short address;
|
typedef unsigned short address;
|
||||||
|
1
r65emu.h
1
r65emu.h
@ -9,6 +9,7 @@
|
|||||||
#include "prom.h"
|
#include "prom.h"
|
||||||
#include "ps2drv.h"
|
#include "ps2drv.h"
|
||||||
#include "utftdisplay.h"
|
#include "utftdisplay.h"
|
||||||
|
#include "keyboard.h"
|
||||||
#include "hardware.h"
|
#include "hardware.h"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
6
ram.h
6
ram.h
@ -1,13 +1,13 @@
|
|||||||
#ifndef _RAM_H
|
#ifndef _RAM_H
|
||||||
#define _RAM_H
|
#define _RAM_H
|
||||||
|
|
||||||
class ram: public Memory::Device {
|
class ram: public Memory::Device, public Checkpointable {
|
||||||
public:
|
public:
|
||||||
virtual void operator= (byte c) { _mem[_acc] = c; }
|
virtual void operator= (byte c) { _mem[_acc] = c; }
|
||||||
virtual operator byte () { return _mem[_acc]; }
|
virtual operator byte () { return _mem[_acc]; }
|
||||||
|
|
||||||
void checkpoint(Stream &s) { s.write(_mem, sizeof(_mem)); }
|
virtual void checkpoint(Stream &s) { s.write(_mem, sizeof(_mem)); }
|
||||||
void restore(Stream &s) { s.readBytes((char *)_mem, sizeof(_mem)); }
|
virtual void restore(Stream &s) { s.readBytes((char *)_mem, sizeof(_mem)); }
|
||||||
|
|
||||||
ram (): Memory::Device(sizeof(_mem)) {}
|
ram (): Memory::Device(sizeof(_mem)) {}
|
||||||
|
|
||||||
|
6
spiram.h
6
spiram.h
@ -1,13 +1,13 @@
|
|||||||
#ifndef __SPIRAM_H__
|
#ifndef __SPIRAM_H__
|
||||||
#define __SPIRAM_H__
|
#define __SPIRAM_H__
|
||||||
|
|
||||||
class spiram: public Memory::Device {
|
class spiram: public Memory::Device, public Checkpointable {
|
||||||
public:
|
public:
|
||||||
virtual void operator= (byte c);
|
virtual void operator= (byte c);
|
||||||
virtual operator byte ();
|
virtual operator byte ();
|
||||||
|
|
||||||
void checkpoint(Stream &s);
|
virtual void checkpoint(Stream &s);
|
||||||
void restore(Stream &s);
|
virtual void restore(Stream &s);
|
||||||
|
|
||||||
spiram(int bytes): Memory::Device(bytes) {}
|
spiram(int bytes): Memory::Device(bytes) {}
|
||||||
void begin(byte cs, int module);
|
void begin(byte cs, int module);
|
||||||
|
@ -3,13 +3,16 @@
|
|||||||
|
|
||||||
class Stream;
|
class Stream;
|
||||||
|
|
||||||
class UTFTDisplay: public Memory::Device {
|
class UTFTDisplay: public Memory::Device, public Checkpointable {
|
||||||
public:
|
public:
|
||||||
void begin(unsigned bg, unsigned fg);
|
void begin(unsigned bg, unsigned fg);
|
||||||
void clear();
|
void clear();
|
||||||
void error(char *);
|
void error(char *);
|
||||||
void status(const char *);
|
void status(const char *);
|
||||||
|
|
||||||
|
virtual void checkpoint(Stream &s) = 0;
|
||||||
|
virtual void restore(Stream &s) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
UTFTDisplay(unsigned size): Memory::Device(size) {}
|
UTFTDisplay(unsigned size): Memory::Device(size) {}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user