mirror of https://github.com/mgba-emu/mgba.git
Replace BGCNT with bitfield
This commit is contained in:
parent
0a5a099059
commit
14b6393b51
|
@ -141,19 +141,14 @@ DECL_BIT(GBARegisterDISPSTAT, HblankIRQ, 4);
|
||||||
DECL_BIT(GBARegisterDISPSTAT, VcounterIRQ, 5);
|
DECL_BIT(GBARegisterDISPSTAT, VcounterIRQ, 5);
|
||||||
DECL_BITS(GBARegisterDISPSTAT, VcountSetting, 8, 8);
|
DECL_BITS(GBARegisterDISPSTAT, VcountSetting, 8, 8);
|
||||||
|
|
||||||
union GBARegisterBGCNT {
|
DECL_BITFIELD(GBARegisterBGCNT, uint16_t);
|
||||||
struct {
|
DECL_BITS(GBARegisterBGCNT, Priority, 0, 2);
|
||||||
unsigned priority : 2;
|
DECL_BITS(GBARegisterBGCNT, CharBase, 2, 2);
|
||||||
unsigned charBase : 2;
|
DECL_BIT(GBARegisterBGCNT, Mosaic, 6);
|
||||||
unsigned : 2;
|
DECL_BIT(GBARegisterBGCNT, 256Color, 7);
|
||||||
unsigned mosaic : 1;
|
DECL_BITS(GBARegisterBGCNT, ScreenBase, 8, 5);
|
||||||
unsigned multipalette : 1;
|
DECL_BIT(GBARegisterBGCNT, Overflow, 13);
|
||||||
unsigned screenBase : 5;
|
DECL_BITS(GBARegisterBGCNT, Size, 14, 2);
|
||||||
unsigned overflow : 1;
|
|
||||||
unsigned size : 2;
|
|
||||||
};
|
|
||||||
uint16_t packed;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct GBAVideoRenderer {
|
struct GBAVideoRenderer {
|
||||||
void (*init)(struct GBAVideoRenderer* renderer);
|
void (*init)(struct GBAVideoRenderer* renderer);
|
||||||
|
|
|
@ -532,14 +532,13 @@ static void GBAVideoSoftwareRendererUpdateDISPCNT(struct GBAVideoSoftwareRendere
|
||||||
|
|
||||||
static void GBAVideoSoftwareRendererWriteBGCNT(struct GBAVideoSoftwareRenderer* renderer, struct GBAVideoSoftwareBackground* bg, uint16_t value) {
|
static void GBAVideoSoftwareRendererWriteBGCNT(struct GBAVideoSoftwareRenderer* renderer, struct GBAVideoSoftwareBackground* bg, uint16_t value) {
|
||||||
UNUSED(renderer);
|
UNUSED(renderer);
|
||||||
union GBARegisterBGCNT reg = { .packed = value };
|
bg->priority = GBARegisterBGCNTGetPriority(value);
|
||||||
bg->priority = reg.priority;
|
bg->charBase = GBARegisterBGCNTGetCharBase(value) << 14;
|
||||||
bg->charBase = reg.charBase << 14;
|
bg->mosaic = GBARegisterBGCNTGetMosaic(value);
|
||||||
bg->mosaic = reg.mosaic;
|
bg->multipalette = GBARegisterBGCNTGet256Color(value);
|
||||||
bg->multipalette = reg.multipalette;
|
bg->screenBase = GBARegisterBGCNTGetScreenBase(value) << 11;
|
||||||
bg->screenBase = reg.screenBase << 11;
|
bg->overflow = GBARegisterBGCNTGetOverflow(value);
|
||||||
bg->overflow = reg.overflow;
|
bg->size = GBARegisterBGCNTGetSize(value);
|
||||||
bg->size = reg.size;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void GBAVideoSoftwareRendererWriteBGPA(struct GBAVideoSoftwareBackground* bg, uint16_t value) {
|
static void GBAVideoSoftwareRendererWriteBGPA(struct GBAVideoSoftwareBackground* bg, uint16_t value) {
|
||||||
|
|
Loading…
Reference in New Issue