aboutsummaryrefslogtreecommitdiff
path: root/src/ahoy/emulator.h
blob: 24aa8ce8574a0cc7228ba08a1c62dae1f78fbe26 (plain) (blame)
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
#ifndef AHOY_AHOY_EMULATOR_H
#define AHOY_AHOY_EMULATOR_H

#include <stdint.h>

#include <mbstring.h>

/* Uppercase variables represent registers.  The following registers exist:

   Vx — 16 general-purpose registers
   DT — delay timer
   ST — sound timer
   SP — stack pointer
   PC — program counter
   I  — register to hold addresses
   */
struct chip8 {
	bool needs_redraw;
	bool kbd[16];
	uint8_t V[16];
	uint8_t DT, ST, SP;
	uint16_t PC, I;
	uint16_t callstack[16];
	uint64_t screen[32];
};

void emuinit(struct u8view, const char *);
void emutick(void);

extern struct chip8 c8;

#endif /* !AHOY_AHOY_EMULATOR_H */