1
0
mirror of https://github.com/jscrane/r65emu.git synced 2024-07-17 08:28:59 +00:00
r65emu/cpu.h

30 lines
601 B
C
Raw Normal View History

2014-11-10 14:16:45 +00:00
#ifndef __CPU_H__
#define __CPU_H__
2014-10-18 11:33:48 +00:00
#ifndef _SETJMP_H
#include <setjmp.h>
#endif
2014-10-21 18:41:44 +00:00
class CPU: public Checkpointable {
2014-10-18 11:33:48 +00:00
public:
2014-11-20 08:28:01 +00:00
virtual void run(unsigned instructions) =0;
2014-10-18 11:33:48 +00:00
virtual void reset () =0;
virtual void raise (int level) =0;
virtual char *status () =0;
typedef void (*statfn) (const char *, ...);
2014-10-21 18:41:44 +00:00
virtual void checkpoint(Stream &s) = 0;
virtual void restore(Stream &s) = 0;
2014-10-31 08:18:15 +00:00
void debug() { _debug = !_debug; }
2014-10-18 11:33:48 +00:00
protected:
2014-12-10 12:02:47 +00:00
CPU (Memory &mem, jmp_buf &e, statfn s): _mem(mem), _err(e), _status(s), _debug(false) {}
2014-11-21 12:44:52 +00:00
Memory &_mem;
2014-12-10 12:02:47 +00:00
jmp_buf &_err;
2014-10-18 11:33:48 +00:00
statfn _status;
2014-10-31 08:18:15 +00:00
bool _debug;
2014-10-18 11:33:48 +00:00
};
#endif