Define memory regions

This commit is contained in:
Jeffrey Pfau 2013-04-19 23:34:26 -07:00
parent f72c195739
commit 1972e73bec
1 changed files with 71 additions and 0 deletions

View File

@ -1,6 +1,8 @@
#ifndef GBA_VIDEO_H
#define GBA_VIDEO_H
#include "gba-memory.h"
#include <stdint.h>
enum {
@ -21,6 +23,71 @@ enum {
REG_DISPSTAT_MASK = 0xFF38
};
enum ObjMode {
OBJ_MODE_NORMAL = 0,
OBJ_MODE_SEMITRANSPARENT = 1,
OBJ_MODE_OBJWIN = 2
};
enum ObjShape {
OBJ_SHAPE_SQUARE = 0,
OBJ_SHAPE_HORIZONTAL = 1,
OBJ_SHAPE_VERTICAL = 2
};
union GBAOAM {
struct {
int y : 8;
unsigned transformed : 1;
union {
unsigned doublesize : 1;
unsigned disable : 1;
};
enum ObjMode mode : 2;
unsigned mosaic : 1;
unsigned multipalette : 1;
enum ObjShape shape : 2;
int x : 9;
union {
unsigned matIndex : 5;
struct {
int : 3;
unsigned hflip : 1;
unsigned vflip : 1;
};
};
unsigned size : 2;
unsigned tile : 10;
unsigned priority : 2;
unsigned palette : 4;
int : 16;
} obj[128];
struct {
int : 16;
int : 16;
int : 16;
int a : 16;
int : 16;
int : 16;
int : 16;
int b : 16;
int : 16;
int : 16;
int : 16;
int c : 16;
int : 16;
int : 16;
int : 16;
int d : 16;
} mat[32];
uint16_t raw[512];
};
struct GBAVideoRenderer {
void (*init)(struct GBAVideoRenderer* renderer);
void (*deinit)(struct GBAVideoRenderer* renderer);
@ -28,6 +95,10 @@ struct GBAVideoRenderer {
uint16_t (*writeVideoRegister)(struct GBAVideoRenderer* renderer, uint32_t address, uint16_t value);
void (*drawScanline)(struct GBAVideoRenderer* renderer, int y);
void (*finishFrame)(struct GBAVideoRenderer* renderer);
uint16_t palette[SIZE_PALETTE_RAM >> 1];
uint16_t vram[SIZE_VRAM >> 1];
union GBAOAM oam;
};
struct GBAVideo {