Add emulate constants and machine state, w/ T

This commit is contained in:
sBubshait 2024-05-30 15:02:00 +01:00
parent 4b10d18e26
commit 74bf3ed910
2 changed files with 24 additions and 2 deletions

View File

@ -3,8 +3,6 @@
#include <stdlib.h>
#include "decode.h"
#define BYTE_BITS 8
// Retrieve the bits between positions 'lsb' (inclusive) and 'msb' (exclusive) from a given word
// as a new zero-extended word.
static word getBits(word wrd, uint8_t lsb, uint8_t msb) {

24
src/emulator.h Normal file
View File

@ -0,0 +1,24 @@
#include "global.h"
/************************************
* DEFINITIONS
************************************/
#define BYTE_BITS 8
/************************************
* STRUCTS
************************************/
typedef struct {
bool Negative;
bool Zero;
bool Carry;
bool Overflow;
} PState;
typedef struct {
word registers[REGISTER_COUNT];
word pc;
byte memory[MEMORY_SIZE];
PState conditionCodes;
} Machine;