all repos — mgba @ 487c54f0accad7f4bc8c16ad2e13928c3bfb2762

mGBA Game Boy Advance Emulator

src/gb/io.h (view raw)

 1/* Copyright (c) 2013-2016 Jeffrey Pfau
 2 *
 3 * This Source Code Form is subject to the terms of the Mozilla Public
 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 6#ifndef GB_IO_H
 7#define GB_IO_H
 8
 9#include "util/common.h"
10
11enum GBIORegisters {
12	REG_JOYP = 0x00,
13	REG_SB = 0x01,
14	REG_SC = 0x02,
15
16	// Timing
17	REG_DIV = 0x04,
18	REG_TIMA = 0x05,
19	REG_TMA = 0x06,
20	REG_TAC = 0x07,
21
22	// Interrupts
23	REG_IF = 0x0F,
24	REG_IE = 0xFF,
25
26	// Audio
27	REG_NR10 = 0x10,
28	REG_NR11 = 0x11,
29	REG_NR12 = 0x12,
30	REG_NR13 = 0x13,
31	REG_NR14 = 0x14,
32	REG_NR21 = 0x16,
33	REG_NR22 = 0x17,
34	REG_NR23 = 0x18,
35	REG_NR24 = 0x19,
36	REG_NR30 = 0x1A,
37	REG_NR31 = 0x1B,
38	REG_NR32 = 0x1C,
39	REG_NR33 = 0x1D,
40	REG_NR34 = 0x1E,
41	REG_NR41 = 0x20,
42	REG_NR42 = 0x21,
43	REG_NR43 = 0x22,
44	REG_NR44 = 0x23,
45	REG_NR50 = 0x24,
46	REG_NR51 = 0x25,
47	REG_NR52 = 0x26,
48
49	REG_WAVE_0 = 0x30,
50	REG_WAVE_1 = 0x31,
51	REG_WAVE_2 = 0x32,
52	REG_WAVE_3 = 0x33,
53	REG_WAVE_4 = 0x34,
54	REG_WAVE_5 = 0x35,
55	REG_WAVE_6 = 0x36,
56	REG_WAVE_7 = 0x37,
57	REG_WAVE_8 = 0x38,
58	REG_WAVE_9 = 0x39,
59	REG_WAVE_A = 0x3A,
60	REG_WAVE_B = 0x3B,
61	REG_WAVE_C = 0x3C,
62	REG_WAVE_D = 0x3D,
63	REG_WAVE_E = 0x3E,
64	REG_WAVE_F = 0x3F,
65
66	// Video
67	REG_LCDC = 0x40,
68	REG_STAT = 0x41,
69	REG_SCY = 0x42,
70	REG_SCX = 0x43,
71	REG_LY = 0x44,
72	REG_LYC = 0x45,
73	REG_DMA = 0x46,
74	REG_BGP = 0x47,
75	REG_OBP0 = 0x48,
76	REG_OBP1 = 0x49,
77	REG_WY = 0x4A,
78	REG_WX = 0x4B,
79};
80
81struct GB;
82void GBIOInit(struct GB* gb);
83void GBIOReset(struct GB* gb);
84
85void GBIOWrite(struct GB* gb, unsigned address, uint8_t value);
86uint8_t GBIORead(struct GB* gb, unsigned address);
87
88#endif