all repos — mgba @ 1972e73bec4031a6697784da1111073170a47f01

mGBA Game Boy Advance Emulator

Define memory regions
Jeffrey Pfau jeffrey@endrift.com
Fri, 19 Apr 2013 23:34:26 -0700
commit

1972e73bec4031a6697784da1111073170a47f01

parent

f72c195739c0255b9a5e8b3963cfcc897867e822

1 files changed, 71 insertions(+), 0 deletions(-)

jump to
M src/gba/gba-video.hsrc/gba/gba-video.h

@@ -1,6 +1,8 @@

#ifndef GBA_VIDEO_H #define GBA_VIDEO_H +#include "gba-memory.h" + #include <stdint.h> enum {

@@ -21,6 +23,71 @@

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 @@

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 {