implemented timer, opcode decoding
This commit is contained in:
parent
5a06b2bc0b
commit
76b2c711ef
2 changed files with 384 additions and 1 deletions
|
|
@ -2,6 +2,8 @@
|
|||
#define MACHINE_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <thread>
|
||||
#include <atomic>
|
||||
|
||||
#include "Device.h"
|
||||
|
||||
|
|
@ -24,6 +26,11 @@ class Machine {
|
|||
int PC; // Program Counter (24-bit)
|
||||
int SW; // Status Word (24-bit)
|
||||
|
||||
// timer simulation
|
||||
std::atomic<bool> running;
|
||||
std::thread* timerThread;
|
||||
int speed; // kHz
|
||||
|
||||
public:
|
||||
Machine();
|
||||
~Machine();
|
||||
|
|
@ -62,12 +69,31 @@ class Machine {
|
|||
|
||||
int getByte(int addr) const;
|
||||
void setByte(int addr, int val);
|
||||
|
||||
|
||||
int getWord(int addr) const;
|
||||
void setWord(int addr, int val);
|
||||
|
||||
Device* getDevice(int num) const;
|
||||
void setDevice(int num, Device* device);
|
||||
|
||||
// error handling
|
||||
void notImplemented(const char* mnemonic);
|
||||
void invalidOpcode(int opcode);
|
||||
void invalidAddressing();
|
||||
|
||||
// execution
|
||||
int fetch();
|
||||
void execute();
|
||||
bool execF1(int opcode);
|
||||
bool execF2(int opcode, int operand);
|
||||
bool execSICF3F4(int opcode, int ni, int operand);
|
||||
|
||||
// timer simulation
|
||||
void start();
|
||||
void stop();
|
||||
bool isRunning() const;
|
||||
int getSpeed() const;
|
||||
void setSpeed(int kHz);
|
||||
};
|
||||
|
||||
#endif // MACHINE_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue