Skip to content

Commit

Permalink
Cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
LibretroAdmin committed Nov 12, 2023
1 parent 9156856 commit b280fbb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 21 deletions.
14 changes: 7 additions & 7 deletions src/boards/hp898f.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ static SFORMAT StateRegs[] =
{ 0 }
};

static void Sync(void) {
static void HP898FSync(void) {
uint8 chr = (regs[0] >> 4) & 7;
uint8 prg = (regs[1] >> 3) & 7;
uint8 dec = (regs[1] >> 4) & 4;
Expand All @@ -44,29 +44,29 @@ static void Sync(void) {
static void HP898FWrite(uint32 A, uint8 V) {
if((A & 0x6000) == 0x6000) {
regs[(A & 4) >> 2] = V;
Sync();
HP898FSync();
}
}

static void HP898FPower(void) {
regs[0] = regs[1] = 0;
Sync();
HP898FSync();
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x6000, 0xFFFF, HP898FWrite);
}

static void HP898FReset(void) {
regs[0] = regs[1] = 0;
Sync();
HP898FSync();
}

static void StateRestore(int version) {
Sync();
static void HP898FStateRestore(int version) {
HP898FSync();
}

void BMCHP898F_Init(CartInfo *info) {
info->Reset = HP898FReset;
info->Power = HP898FPower;
GameStateRestore = StateRestore;
GameStateRestore = HP898FStateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
26 changes: 12 additions & 14 deletions src/ppu.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@

#define PPU_status (PPU[2])

#define Pal (PALRAM)

static void FetchSpriteData(void);
static void RefreshLine(int lastpixel);
static void RefreshSprites(void);
Expand Down Expand Up @@ -452,7 +450,7 @@ static void RefreshLine(int lastpixel) {

if (!ScreenON && !SpriteON) {
uint32 tem;
tem = Pal[0] | (Pal[0] << 8) | (Pal[0] << 16) | (Pal[0] << 24);
tem = PALRAM[0] | (PALRAM[0] << 8) | (PALRAM[0] << 16) | (PALRAM[0] << 24);
tem |= 0x40404040;
FCEU_dwmemset(Pline, tem, numtiles * 8);
P += numtiles * 8;
Expand All @@ -473,10 +471,10 @@ static void RefreshLine(int lastpixel) {
}

/* Priority bits, needed for sprite emulation. */
Pal[0] |= 64;
Pal[4] |= 64;
Pal[8] |= 64;
Pal[0xC] |= 64;
PALRAM[0] |= 64;
PALRAM[4] |= 64;
PALRAM[8] |= 64;
PALRAM[0xC] |= 64;

/* This high-level graphics MMC5 emulation code was written for MMC5 carts in "CL" mode.
* It's probably not totally correct for carts in "SL" mode.
Expand Down Expand Up @@ -552,23 +550,23 @@ static void RefreshLine(int lastpixel) {
#undef RefreshAddr

/* Reverse changes made before. */
Pal[0] &= 63;
Pal[4] &= 63;
Pal[8] &= 63;
Pal[0xC] &= 63;
PALRAM[0] &= 63;
PALRAM[4] &= 63;
PALRAM[8] &= 63;
PALRAM[0xC] &= 63;

RefreshAddr = smorkus;
if (firsttile <= 2 && 2 < lasttile && !(PPU[1] & 2)) {
uint32 tem;
tem = Pal[0] | (Pal[0] << 8) | (Pal[0] << 16) | (Pal[0] << 24);
tem = PALRAM[0] | (PALRAM[0] << 8) | (PALRAM[0] << 16) | (PALRAM[0] << 24);
tem |= 0x40404040;
*(uint32*)Plinef = *(uint32*)(Plinef + 4) = tem;
}

if (!ScreenON) {
uint32 tem;
int tstart, tcount;
tem = Pal[0] | (Pal[0] << 8) | (Pal[0] << 16) | (Pal[0] << 24);
tem = PALRAM[0] | (PALRAM[0] << 8) | (PALRAM[0] << 16) | (PALRAM[0] << 24);
tem |= 0x40404040;

tcount = lasttile - firsttile;
Expand Down Expand Up @@ -648,7 +646,7 @@ static void DoLine(void)

if (rendis & 2) {/* User asked to not display background data. */
uint32 tem;
tem = Pal[0] | (Pal[0] << 8) | (Pal[0] << 16) | (Pal[0] << 24);
tem = PALRAM[0] | (PALRAM[0] << 8) | (PALRAM[0] << 16) | (PALRAM[0] << 24);
tem |= 0x40404040;
FCEU_dwmemset(target, tem, 256);
}
Expand Down

0 comments on commit b280fbb

Please sign in to comment.