All: Unfortunate evils committed in the name of pycparser

This commit is contained in:
Jeffrey Pfau 2016-10-11 17:06:08 -07:00
parent 227cbea37a
commit bd7b394e49
7 changed files with 42 additions and 43 deletions

View File

@ -119,7 +119,6 @@ void GBHalt(struct LR35902Core* cpu);
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);

View File

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

View File

@ -116,7 +116,7 @@ struct GBAMemory {
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;

View File

@ -19,13 +19,13 @@ enum {
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 @@ struct GBAVideo {
// VCOUNT
int vcount;
uint16_t palette[SIZE_PALETTE_RAM >> 1];
uint16_t palette[512];
uint16_t* vram;
union GBAOAM oam;

View File

@ -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); \

View File

@ -21,9 +21,9 @@ union FlagRegister {
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;
@ -125,36 +125,6 @@ struct LR35902Core {
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);
void LR35902SetComponents(struct LR35902Core* cpu, struct mCPUComponent* master, int extra, struct mCPUComponent** extras);

View File

@ -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* );