-
Notifications
You must be signed in to change notification settings - Fork 0
/
chip8.h
57 lines (47 loc) · 1.4 KB
/
chip8.h
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
* File: chip8.h
* Author: Bryan
* Description: Chip8 emulator header file
* Created on February 15, 2016, 12:31 PM
*/
#ifndef CHIP8_H
#define CHIP8_H
#include "common.h"
#include "chip8mem.h"
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include "rom.h"
/* Chip8 Memory Constants */
#define CH8MEM_SYSRESERVED 0x0
#define CH8MEM_ENTRYPOINT 0x200
#define CH8MEM_ETI_ENTRYPOINT 0x600
#define CH8MEM_MAXSIZE 0x1000
/* Chip8 Memory API */
#define CH8_MEMORY_CLEAR() Ch8MemInit();
#define CH8_MEMORY_GETBYTE(address) Ch8MemReadByte(address)
#define CH8_MEMORY_SETBYTE(address, byte) Ch8MemWriteByte(address, byte)
///////////////////////////////////////////
/* Chip8 Registers */
/* Vx are general purpose */
/* I Register is a 16-bit register for addresses */
/* PC stores the program counter
SP stores stack pointer
DT is delay timer
AT is audio timer */
///////////////////////////////////////////
extern byte g_Ch8VRegisters[16];
extern uint16 g_Ch8IRegister;
extern uint16 g_Ch8PCRegister;
extern byte g_Ch8DelayRegister;
extern byte g_Ch8AudioRegister;
extern byte g_Ch8LastKeyPress;
extern byte g_WaitForKey;
extern byte g_RplRegs[16]; // HP48 Calculator RPL Registers
#define CH8_VREG g_Ch8VRegisters
#define PC g_Ch8PCRegister
/* Chip8 Function API */
void Ch8Init (void);
void Ch8LoadRom(const Chip8Rom * chip8rom, const uint16 dstAddress);
void Ch8Run(void);
#endif /* CHIP8_H */