2017-02-19 23:55:54 +00:00
|
|
|
#ifndef __VM_H
|
|
|
|
#define __VM_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdlib.h> // for calloc
|
|
|
|
|
|
|
|
#include "mmu.h"
|
|
|
|
#include "vmdisplay.h"
|
|
|
|
#include "vmkeyboard.h"
|
|
|
|
|
2017-02-26 16:00:41 +00:00
|
|
|
#define DISPLAYWIDTH 320
|
|
|
|
#define DISPLAYHEIGHT 240
|
2017-02-28 13:15:11 +00:00
|
|
|
#define DISPLAYRUN 320 // how wide each row is in pixels in the buffer (for faster math)
|
2017-02-26 16:00:41 +00:00
|
|
|
|
2017-02-19 23:55:54 +00:00
|
|
|
class VM {
|
|
|
|
public:
|
2017-02-28 13:15:11 +00:00
|
|
|
VM() { mmu=NULL; vmdisplay = NULL; videoBuffer = (uint8_t *)calloc(DISPLAYRUN * DISPLAYHEIGHT / 2, 1); hasIRQ = false;}
|
2017-02-19 23:55:54 +00:00
|
|
|
virtual ~VM() { if (mmu) delete mmu; if (vmdisplay) delete vmdisplay; free(videoBuffer); }
|
|
|
|
|
|
|
|
virtual void SetMMU(MMU *mmu) { this->mmu = mmu; }
|
|
|
|
virtual MMU *getMMU() { return mmu; }
|
|
|
|
virtual VMKeyboard *getKeyboard() = 0;
|
|
|
|
|
|
|
|
virtual void Reset() = 0;
|
|
|
|
|
|
|
|
virtual void triggerPaddleInCycles(uint8_t paddleNum, uint16_t cycleCount) = 0;
|
|
|
|
|
|
|
|
uint8_t *videoBuffer;
|
|
|
|
VMDisplay *vmdisplay;
|
|
|
|
MMU *mmu;
|
|
|
|
bool hasIRQ;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|