fixed backup memory support in Bill Walsh College Football (this game uses I2C EEPROM saves)

modified Action replay (Pro) memory map
This commit is contained in:
ekeeke31 2009-08-11 17:25:38 +00:00
parent 8834abaa74
commit f2e43c9f8f
6 changed files with 87 additions and 45 deletions

View File

@ -35,12 +35,14 @@ static struct
uint32 addr[4];
} action_replay;
static void ar_write_regs(uint32 address, uint32 data);
static void wram_write_byte(uint32 address, uint32 data);
static void wram_write_word(uint32 address, uint32 data);
static void ar_write_regs(uint32 address, uint32 data);
static void ar_write_regs_pro2(uint32 address, uint32 data);
void datel_init(void)
{
int i;
memset(&action_replay,0,sizeof(action_replay));
/* load Action Replay ROM program */
@ -61,22 +63,52 @@ void datel_init(void)
switch (action_replay.enabled)
{
case TYPE_AR:
{
/* internal registers mapped at $0000-$ffff */
m68k_memory_map[0x01].write16 = ar_write_regs;
/* $0000-$7fff mirrored into $8000-$ffff */
memcpy(action_replay.rom+0x8000,action_replay.rom,0x8000);
m68k_memory_map[1].write16 = ar_write_regs;
break;
}
case TYPE_PRO1:
m68k_memory_map[1].write16 = ar_write_regs;
break;
{
/* internal registers mapped at $0000-$ffff */
m68k_memory_map[0x01].write16 = ar_write_regs;
case TYPE_PRO2: /* todo */
/* RAM (64k) mapped at $400000-$7fffff */
for (i=0x40; i<0x80; i++)
{
m68k_memory_map[i].base = action_replay.ram;
m68k_memory_map[i].read8 = NULL;
m68k_memory_map[i].read16 = NULL;
m68k_memory_map[i].write8 = NULL;
m68k_memory_map[i].write16 = NULL;
}
break;
}
case TYPE_PRO2:
{
/* internal registers mapped at $100000-$10ffff */
m68k_memory_map[0x10].write16 = ar_write_regs_pro2;
/* RAM (64k) mapped at $400000-$7fffff */
for (i=0x40; i<0x80; i++)
{
m68k_memory_map[i].base = action_replay.ram;
m68k_memory_map[i].read8 = NULL;
m68k_memory_map[i].read16 = NULL;
m68k_memory_map[i].write8 = NULL;
m68k_memory_map[i].write16 = NULL;
}
break;
}
}
#ifdef LSB_FIRST
/* Byteswap ROM */
int i;
uint8 temp;
for(i = 0; i < 0x20000; i += 2)
{
@ -100,31 +132,29 @@ void datel_reset(void)
memset(action_replay.data,0,sizeof(action_replay.data));
memset(action_replay.addr,0,sizeof(action_replay.addr));
/* reset memory map */
/* ROM mapped at $000000-$3fffff */
int i;
switch (action_replay.enabled)
{
case TYPE_AR:
m68k_memory_map[0].base = action_replay.rom;
{
case TYPE_AR: /* 32k ROM */
case TYPE_PRO2: /* 64k ROM */
{
for (i=0x00; i<0x40; i++)
{
m68k_memory_map[i].base = action_replay.rom;
}
break;
}
case TYPE_PRO1:
m68k_memory_map[0].base = action_replay.rom;
m68k_memory_map[1].base = action_replay.rom + 0x10000;
m68k_memory_map[0x42].base = action_replay.ram;
m68k_memory_map[0x42].read8 = NULL;
m68k_memory_map[0x42].read16 = NULL;
m68k_memory_map[0x42].write8 = NULL;
m68k_memory_map[0x42].write16 = NULL;
break;
case TYPE_PRO2:
m68k_memory_map[0].base = action_replay.rom;
m68k_memory_map[0x60].base = action_replay.ram;
m68k_memory_map[0x60].read8 = NULL;
m68k_memory_map[0x60].read16 = NULL;
m68k_memory_map[0x60].write8 = NULL;
m68k_memory_map[0x60].write16 = NULL;
case TYPE_PRO1: /* 128k ROM */
{
for (i=0x00; i<0x40; i+=2)
{
m68k_memory_map[i].base = action_replay.rom;
m68k_memory_map[i+1].base = action_replay.rom + 0x10000;
}
break;
}
}
}
}
@ -167,8 +197,8 @@ void datel_switch(uint8 enable)
/* set RAM write handlers */
for (i=0xe0; i<0x100; i++)
{
m68k_memory_map[i].write8 = wram_write_byte;
m68k_memory_map[i].write16 = wram_write_word;
m68k_memory_map[i].write8 = wram_write_byte;
m68k_memory_map[i].write16 = wram_write_word;
}
}
else
@ -250,8 +280,18 @@ static void ar_write_regs(uint32 address, uint32 data)
action_replay.addr[2] = (action_replay.regs[8] | ((action_replay.regs[9] & 0x7f00) << 8)) << 1;
action_replay.addr[3] = (action_replay.regs[11] | ((action_replay.regs[12] & 0x7f00) << 8)) << 1;
/* reads are mapped to Cartridge ROM */
/* Cartridge ROM mapped to $000000-$3fffff */
/* NOTE: codes should be disabled on startup */
m68k_memory_map[0].base = cart.rom;
int i;
for (i=0x00; i<0x40; i++)
{
m68k_memory_map[i].base = cart.rom + ((i<<16) & cart.mask);
}
}
}
static void ar_write_regs_pro2(uint32 address, uint32 data)
{
/* TODO */
}

View File

@ -21,7 +21,7 @@
#include "shared.h"
#define GAME_CNT 25
#define GAME_CNT 26
T_EEPROM eeprom;
@ -49,8 +49,9 @@ static const T_GAME_ENTRY database[GAME_CNT] =
{{"T-81476" }, 0, {16, 0x1FFF, 0x1FFF, 0x200001, 0x200001, 0x200000, 0, 0, 0}}, /* Frank Thomas Big Hurt Baseball */
/* EA mapper (24C01 only) */
{{"T-50396" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 7, 7, 6}}, /* NHLPA Hockey 93 (UE) */
{{"T-50176" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 7, 7, 6}}, /* Rings of Power */
{{"T-50396" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 7, 7, 6}}, /* NHLPA Hockey 93 */
{{"T-50606" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 7, 7, 6}}, /* Bill Walsh College Football */
/* SEGA mapper (24C01 only) */
{{"T-12046" }, 0, {7, 0x7F, 0x7F, 0x200001, 0x200001, 0x200001, 0, 0, 1}}, /* Megaman - The Wily Wars */

View File

@ -3,8 +3,8 @@
*
* IPL FONT Engine, using GX hardware
*
* Softdev (2006)
* Eke-Eke (2007,2008,2009)
* original font engine by Softdev (2006)
* GX engine by Eke-Eke (2008,2009)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -75,7 +75,7 @@ int FONT_Init(void)
/* default font height */
fheight = fontHeader->cell_height;
/* initialize texture data */
fontTexture = memalign(32, fontHeader->cell_width * fontHeader->cell_height / 2);
if (!fontTexture)

View File

@ -623,7 +623,7 @@ static INT32 m2,c1,c2; /* Phase Modulation input for operators 2,3,4 */
static INT32 mem; /* one sample delay memory */
static INT32 out_fm[8]; /* outputs of working channels */
/* limitter */
/* limiter */
#define Limit(val, max,min) { \
if ( val > max ) val = max; \
else if ( val < min ) val = min; \
@ -1021,8 +1021,8 @@ INLINE void advance_lfo()
/* when LFO is disabled, current level is held (fix Spider-Man & Venom : Separation Anxiety) */
/*else
{
LFO_AM = 0;
LFO_PM = 0;
ym2612.OPN.LFO_AM = 0;
ym2612.OPN.LFO_PM = 0;
}*/
}
@ -1490,6 +1490,8 @@ static int init_tables(void)
n = n>>1;
/* 11 bits here (rounded) */
n <<= 2; /* 13 bits here (as in real chip) */
/* 14 bits (with sign bit) */
tl_tab[ x*2 + 0 ] = n;
tl_tab[ x*2 + 1 ] = -tl_tab[ x*2 + 0 ];
@ -1615,7 +1617,7 @@ static void OPNSetPres(int pres)
/* YM2612 running at original frequency (~53267 Hz) */
if (config.hq_fm) freqbase = 1.0;
ym2612.OPN.eg_timer_add = (UINT32)((1<<EG_SH) * freqbase);
ym2612.OPN.eg_timer_add = (UINT32)((1<<EG_SH) * freqbase);
ym2612.OPN.eg_timer_overflow = ( 3 ) * (1<<EG_SH);
/* timer increment in usecs (timers are incremented after each updated samples) */
@ -2071,8 +2073,8 @@ int YM2612ResetChip(void)
ym2612.OPN.LFO_AM = 0;
ym2612.OPN.LFO_PM = 0;
ym2612.OPN.ST.TAC = 0;
ym2612.OPN.ST.TBC = 0;
ym2612.OPN.ST.TAC = 0;
ym2612.OPN.ST.TBC = 0;
OPNWriteMode(0x27,0x30);
OPNWriteMode(0x26,0x00);

View File

@ -102,8 +102,8 @@ void audio_update (int size)
if (filter & 1)
{
/* single-pole low-pass filter (6 dB/octave) */
ll = (ll>>16)*factorb + l*factora;
rr = (rr>>16)*factorb + r*factora;
ll = (ll>>16)*factora + l*factorb;
rr = (rr>>16)*factora + r*factorb;
l = ll >> 16;
r = rr >> 16;
}

View File

@ -85,7 +85,6 @@ extern uint32 count_z80;
extern uint32 line_z80;
extern int32 current_z80;
extern uint8 system_hw;
extern uint32 count_z80;
/* Function prototypes */
extern int audio_init (int rate);