DSC Engine
Loading...
Searching...
No Matches
hardware.hpp
1#pragma once
2
3namespace DSC
4{
5 enum class Engine
6 {
7 Main,
8 Sub
9 };
10}
11
12namespace DSC::Hardware
13{
14 typedef short ExtendedPalette[256];
15
16 int tellExtendedPaletteIndex(void* pal_offset);
17 ExtendedPalette* tellExtendedPaletteBase(void* pal_offset);
18
19 namespace MainEngine
20 {
21 inline static volatile unsigned int* const DISPCNT = (volatile unsigned int* const)0x04000000;
22
23 inline static short* const BgPalette = (short* const)0x05000000;
24 inline static short* const ObjPalette = (short* const)0x05000200;
25
26 inline static short* const Oam = (short* const)0x07000000;
27
28 inline static short* const BgVram = (short* const)0x06000000;
29 inline static short* const ObjVram = (short* const)0x06400000;
30
31 ExtendedPalette* BgExtendedPalette();
32 ExtendedPalette* ObjExtendedPalette();
33
34 ExtendedPalette* BgExtendedPalette(int index);
35 ExtendedPalette* ObjExtendedPalette(int index);
36
37
38 void objEnable(int mapping_size, bool use_ext_palette=false);
39 void objDisable();
40 bool objIsEnabled();
41 bool objIsExtPaletteEnabled();
42 int objGetMappingSize();
43 }
44
45 namespace SubEngine
46 {
47 inline static volatile unsigned int* const DISPCNT = (volatile unsigned int* const)0x04001000;
48
49 inline static short* const BgPalette = (short* const)0x05000400;
50 inline static short* const ObjPalette = (short* const)0x05000600;
51
52 inline static short* const Oam = (short* const)0x07000400;
53
54 inline static short* const BgVram = (short* const)0x06200000;
55 inline static short* const ObjVram = (short* const)0x06600000;
56
57 ExtendedPalette* BgExtendedPalette();
58 ExtendedPalette* ObjExtendedPalette();
59
60 ExtendedPalette* BgExtendedPalette(int index);
61 ExtendedPalette* ObjExtendedPalette(int index);
62
63 void objEnable(int mapping_size, bool use_ext_palette=false);
64 void objDisable();
65 bool objIsEnabled();
66 bool objIsExtPaletteEnabled();
67 int objGetMappingSize();
68 }
69
70 extern volatile char* const BanksReg;
71
73 {
74 private:
75 char bank_name; // 'A'..'I'
76 bool is_lcd = true;
77 bool is_main = true;
78 bool is_background = true;
79 bool is_vram = true;
80 int ofs = 0;
81
82 char backup = 0;
83 public:
84 VramBank(char bank_name);
85
86 VramBank& lcd();
87
88 VramBank& main();
89 VramBank& sub();
90
91 VramBank& background();
92 VramBank& sprite();
93
94 VramBank& vram();
95 VramBank& ext_palette();
96
97 VramBank& slot(int slot_number);
98
99 void config();
100
101 void enable();
102 void disable();
103 bool is_enabled() const;
104
105 VramBank& save_state();
106 void restore();
107
108 void* lcd_offset() const;
109 };
110
111}
Definition: hardware.hpp:73