50 lines
755 B
C
50 lines
755 B
C
|
#ifndef asm_defined
|
||
|
#define asm_defined
|
||
|
|
||
|
//#include <math.h>
|
||
|
|
||
|
#include "opcode.h"
|
||
|
#include "stack.h"
|
||
|
#include "debug.h"
|
||
|
|
||
|
typedef struct asm_t {
|
||
|
|
||
|
//the stack for this processor
|
||
|
stack_t stack;
|
||
|
|
||
|
//the registers for this processor
|
||
|
stack_element_t registers[256];
|
||
|
|
||
|
//this processor's rom, can't be written
|
||
|
char* rom;
|
||
|
int romSize;
|
||
|
|
||
|
//this processor's ram, can be written but not executed
|
||
|
char* ram;
|
||
|
int ramSize;
|
||
|
|
||
|
//this status
|
||
|
int status;
|
||
|
|
||
|
} asm_t;
|
||
|
|
||
|
typedef struct opcode_data_t {
|
||
|
|
||
|
unsigned nArgs:2;
|
||
|
unsigned op:6;
|
||
|
|
||
|
stack_element_t arg0;
|
||
|
stack_element_t arg1;
|
||
|
|
||
|
} opcode_data_t;
|
||
|
|
||
|
int tick(asm_t *state);
|
||
|
int run(asm_t *state, int cycles);
|
||
|
void initAsm(asm_t *state);
|
||
|
|
||
|
//BEGIN status defines
|
||
|
#define ASM_RUNNING 0x01
|
||
|
//END status defines
|
||
|
|
||
|
#endif
|