summaryrefslogtreecommitdiff
path: root/opcode.h
blob: 1fb06ff8548139f3065bffab3de90185967f4faf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

#include <inttypes.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

#include "tables.h"

#define getclk 0
#define keypoll 0

#define OPNUM 90

#define C (1 << 0) /* Carry flag. */
#define Z (1 << 1) /* Zero flag. */
#define I (1 << 2) /* Interrupt flag. */
#define V (1 << 6) /* oVerflow flag. */
#define N (1 << 7) /* Negative flag. */

extern uint8_t *addr; /* Address Space. */

union reg {
	uint8_t u8[8];
	uint16_t u16[4];
	uint32_t u32[2];
	uint64_t u64;
};

struct sux {
	union reg ps; /* The processor status register. */
	uint64_t a[8], b[8], y[8], x[8]; /* Registers A, B, X, and Y. */
	uint64_t pc[8]; /* Program counter. */
	uint16_t sp[8]; /* Stack pointer. */
	uint16_t stk_st[8]; /* Starting address of each threads stack. */
	uint8_t crt; /* Current running threads. */
};

extern int asmmon();