From 0031cecc5f9d3dac70412527cf27df922b75a1db Mon Sep 17 00:00:00 2001 From: sinamas Date: Sat, 28 Jul 2012 12:19:32 +0000 Subject: [PATCH] reorder fields for easier access on ARM git-svn-id: https://gambatte.svn.sourceforge.net/svnroot/gambatte@328 9dfb2916-2d38-0410-aef4-c5fe6c9ffc24 --- libgambatte/src/cpu.cpp | 18 +++++++++--------- libgambatte/src/memory.h | 2 +- libgambatte/src/video/ppu.cpp | 4 ++-- libgambatte/src/video/ppu.h | 11 +++++------ 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/libgambatte/src/cpu.cpp b/libgambatte/src/cpu.cpp index 2b19eeb5..d36d1d81 100644 --- a/libgambatte/src/cpu.cpp +++ b/libgambatte/src/cpu.cpp @@ -111,16 +111,16 @@ void CPU::loadState(const SaveState &state) { memory.loadState(state/*, cycleCounter_*/); cycleCounter_ = state.cpu.cycleCounter; - PC_ = state.cpu.PC; - SP = state.cpu.SP; - A_ = state.cpu.A; - B = state.cpu.B; - C = state.cpu.C; - D = state.cpu.D; - E = state.cpu.E; + PC_ = state.cpu.PC & 0xFFFF; + SP = state.cpu.SP & 0xFFFF; + A_ = state.cpu.A & 0xFF; + B = state.cpu.B & 0xFF; + C = state.cpu.C & 0xFF; + D = state.cpu.D & 0xFF; + E = state.cpu.E & 0xFF; FROM_F(state.cpu.F); - H = state.cpu.H; - L = state.cpu.L; + H = state.cpu.H & 0xFF; + L = state.cpu.L & 0xFF; skip = state.cpu.skip; } diff --git a/libgambatte/src/memory.h b/libgambatte/src/memory.h index 01d88333..4fc29e08 100644 --- a/libgambatte/src/memory.h +++ b/libgambatte/src/memory.h @@ -30,6 +30,7 @@ class InputGetter; class FilterInfo; class Memory { + Cartridge cart; unsigned char ioamhram[0x200]; InputGetter *getInput; @@ -37,7 +38,6 @@ class Memory { unsigned long lastOamDmaUpdate; InterruptRequester intreq; - Cartridge cart; Tima tima; LCD display; PSG sound; diff --git a/libgambatte/src/video/ppu.cpp b/libgambatte/src/video/ppu.cpp index 4e05239f..1c5f8b9f 100644 --- a/libgambatte/src/video/ppu.cpp +++ b/libgambatte/src/video/ppu.cpp @@ -1443,6 +1443,8 @@ namespace M2 { namespace gambatte { PPUPriv::PPUPriv(NextM0Time &nextM0Time, const unsigned char *const oamram, const unsigned char *const vram) : + nextSprite(0), + currentSprite(0xFF), vram(vram), nextCallPtr(&M2::Ly0::f0_), now(0), @@ -1464,8 +1466,6 @@ PPUPriv::PPUPriv(NextM0Time &nextM0Time, const unsigned char *const oamram, cons reg1(0), attrib(0), nattrib(0), - nextSprite(0), - currentSprite(0xFF), xpos(0), endx(0), cgb(false), diff --git a/libgambatte/src/video/ppu.h b/libgambatte/src/video/ppu.h index a2758242..3e5e853c 100644 --- a/libgambatte/src/video/ppu.h +++ b/libgambatte/src/video/ppu.h @@ -51,6 +51,10 @@ struct PPUState { struct PPUPriv { unsigned long bgPalette[8 * 4]; unsigned long spPalette[8 * 4]; + struct Sprite { unsigned char spx, oampos, line, attrib; } spriteList[11]; + unsigned short spwordList[11]; + unsigned char nextSprite; + unsigned char currentSprite; const unsigned char *vram; const PPUState *nextCallPtr; @@ -62,12 +66,9 @@ struct PPUPriv { unsigned tileword; unsigned ntileword; - LyCounter lyCounter; SpriteMapper spriteMapper; + LyCounter lyCounter; PPUFrameBuf framebuf; - - struct Sprite { unsigned char spx, oampos, line, attrib; } spriteList[11]; - unsigned short spwordList[11]; unsigned char lcdc; unsigned char scy; @@ -82,8 +83,6 @@ struct PPUPriv { unsigned char reg1; unsigned char attrib; unsigned char nattrib; - unsigned char nextSprite; - unsigned char currentSprite; unsigned char xpos; unsigned char endx;