all repos — mgba @ bd7b394e491b65ed397c960c67715ad6a6d52861

mGBA Game Boy Advance Emulator

All: Unfortunate evils committed in the name of pycparser
Jeffrey Pfau jeffrey@endrift.com
Tue, 11 Oct 2016 17:06:08 -0700
commit

bd7b394e491b65ed397c960c67715ad6a6d52861

parent

227cbea37a1196f34e8884a5331f54c5f30c6e01

M src/gb/gb.hsrc/gb/gb.h

@@ -119,7 +119,6 @@

struct VFile; bool GBLoadROM(struct GB* gb, struct VFile* vf); bool GBLoadSave(struct GB* gb, struct VFile* vf); -void GBYankROM(struct GB* gb); void GBUnloadROM(struct GB* gb); void GBSynthesizeROM(struct VFile* vf);
M src/gb/video.hsrc/gb/video.h

@@ -17,17 +17,17 @@ enum {

GB_VIDEO_HORIZONTAL_PIXELS = 160, GB_VIDEO_VERTICAL_PIXELS = 144, GB_VIDEO_VBLANK_PIXELS = 10, - GB_VIDEO_VERTICAL_TOTAL_PIXELS = GB_VIDEO_VERTICAL_PIXELS + GB_VIDEO_VBLANK_PIXELS, + GB_VIDEO_VERTICAL_TOTAL_PIXELS = 154, // TODO: Figure out exact lengths GB_VIDEO_MODE_2_LENGTH = 76, GB_VIDEO_MODE_3_LENGTH_BASE = 171, GB_VIDEO_MODE_0_LENGTH_BASE = 209, - GB_VIDEO_HORIZONTAL_LENGTH = GB_VIDEO_MODE_0_LENGTH_BASE + GB_VIDEO_MODE_2_LENGTH + GB_VIDEO_MODE_3_LENGTH_BASE, + GB_VIDEO_HORIZONTAL_LENGTH = 456, - GB_VIDEO_MODE_1_LENGTH = GB_VIDEO_HORIZONTAL_LENGTH * GB_VIDEO_VBLANK_PIXELS, - GB_VIDEO_TOTAL_LENGTH = GB_VIDEO_HORIZONTAL_LENGTH * GB_VIDEO_VERTICAL_TOTAL_PIXELS, + GB_VIDEO_MODE_1_LENGTH = 65664, + GB_VIDEO_TOTAL_LENGTH = 70224, GB_BASE_MAP = 0x1800, GB_SIZE_MAP = 0x0400
M src/gba/memory.hsrc/gba/memory.h

@@ -116,7 +116,7 @@ uint32_t* bios;

uint32_t* wram; uint32_t* iwram; uint32_t* rom; - uint16_t io[SIZE_IO >> 1]; + uint16_t io[512]; struct GBACartridgeHardware hw; struct GBASavedata savedata;
M src/gba/video.hsrc/gba/video.h

@@ -19,13 +19,13 @@ VIDEO_HORIZONTAL_PIXELS = 240,

VIDEO_HBLANK_PIXELS = 68, VIDEO_HDRAW_LENGTH = 1006, VIDEO_HBLANK_LENGTH = 226, - VIDEO_HORIZONTAL_LENGTH = VIDEO_HDRAW_LENGTH + VIDEO_HBLANK_LENGTH, + VIDEO_HORIZONTAL_LENGTH = 1232, VIDEO_VERTICAL_PIXELS = 160, VIDEO_VBLANK_PIXELS = 68, - VIDEO_VERTICAL_TOTAL_PIXELS = VIDEO_VERTICAL_PIXELS + VIDEO_VBLANK_PIXELS, + VIDEO_VERTICAL_TOTAL_PIXELS = 228, - VIDEO_TOTAL_LENGTH = VIDEO_HORIZONTAL_LENGTH * VIDEO_VERTICAL_TOTAL_PIXELS, + VIDEO_TOTAL_LENGTH = 280896, OBJ_HBLANK_FREE_LENGTH = 954, OBJ_LENGTH = 1210,

@@ -177,7 +177,7 @@

// VCOUNT int vcount; - uint16_t palette[SIZE_PALETTE_RAM >> 1]; + uint16_t palette[512]; uint16_t* vram; union GBAOAM oam;
M src/lr35902/isa-lr35902.csrc/lr35902/isa-lr35902.c

@@ -8,6 +8,36 @@

#include "lr35902/emitter-lr35902.h" #include "lr35902/lr35902.h" +static inline uint16_t LR35902ReadHL(struct LR35902Core* cpu) { + uint16_t hl; + LOAD_16LE(hl, 0, &cpu->hl); + return hl; +} + +static inline void LR35902WriteHL(struct LR35902Core* cpu, uint16_t hl) { + STORE_16LE(hl, 0, &cpu->hl); +} + +static inline uint16_t LR35902ReadBC(struct LR35902Core* cpu) { + uint16_t bc; + LOAD_16LE(bc, 0, &cpu->bc); + return bc; +} + +static inline void LR35902WriteBC(struct LR35902Core* cpu, uint16_t bc) { + STORE_16LE(bc, 0, &cpu->bc); +} + +static inline uint16_t LR35902ReadDE(struct LR35902Core* cpu) { + uint16_t de; + LOAD_16LE(de, 0, &cpu->de); + return de; +} + +static inline void LR35902WriteDE(struct LR35902Core* cpu, uint16_t de) { + STORE_16LE(de, 0, &cpu->de); +} + #define DEFINE_INSTRUCTION_LR35902(NAME, BODY) \ static void _LR35902Instruction ## NAME (struct LR35902Core* cpu) { \ UNUSED(cpu); \
M src/lr35902/lr35902.hsrc/lr35902/lr35902.h

@@ -21,9 +21,9 @@ unsigned z : 1;

unsigned n : 1; unsigned h : 1; unsigned c : 1; - unsigned : 4; + unsigned unused : 4; #else - unsigned : 4; + unsigned unused : 4; unsigned c : 1; unsigned h : 1; unsigned n : 1;

@@ -124,36 +124,6 @@

size_t numComponents; struct mCPUComponent** components; }; - -static inline uint16_t LR35902ReadHL(struct LR35902Core* cpu) { - uint16_t hl; - LOAD_16LE(hl, 0, &cpu->hl); - return hl; -} - -static inline void LR35902WriteHL(struct LR35902Core* cpu, uint16_t hl) { - STORE_16LE(hl, 0, &cpu->hl); -} - -static inline uint16_t LR35902ReadBC(struct LR35902Core* cpu) { - uint16_t bc; - LOAD_16LE(bc, 0, &cpu->bc); - return bc; -} - -static inline void LR35902WriteBC(struct LR35902Core* cpu, uint16_t bc) { - STORE_16LE(bc, 0, &cpu->bc); -} - -static inline uint16_t LR35902ReadDE(struct LR35902Core* cpu) { - uint16_t de; - LOAD_16LE(de, 0, &cpu->de); - return de; -} - -static inline void LR35902WriteDE(struct LR35902Core* cpu, uint16_t de) { - STORE_16LE(de, 0, &cpu->de); -} void LR35902Init(struct LR35902Core* cpu); void LR35902Deinit(struct LR35902Core* cpu);
M src/third-party/blip_buf/blip_buf.hsrc/third-party/blip_buf/blip_buf.h

@@ -24,7 +24,7 @@ void blip_set_rates( blip_t*, double clock_rate, double sample_rate );

enum { /** Maximum clock_rate/sample_rate ratio. For a given sample_rate, clock_rate must not be greater than sample_rate*blip_max_ratio. */ -blip_max_ratio = 1 << 20 }; +blip_max_ratio = 0x100000 }; /** Clears entire buffer. Afterwards, blip_samples_avail() == 0. */ void blip_clear( blip_t* );