spif rampage dac

This commit is contained in:
dinkc64 committed 2019-04-14 23:09:25 -04:00
1 parent c70f4e1a0b
commit b928b03120
4 files changed
+96 -23

No files matched your search

+57 -6
View File
@@ -10,19 +10,61 @@ static UINT16 dacvalue;
static UINT16 soundsgood_status;
static INT32 soundsgood_in_reset;
static INT32 soundsgood_is_initialized;
static UINT16 *sg_ram = NULL;
INT32 soundsgood_rampage = 0;
// muting & pop-supression logic (rampage only)
struct anti_pop {
UINT16 last80;
INT32 booting;
};
static anti_pop ml;
static void soundsgood_porta_w(UINT16, UINT8 data)
{
dacvalue = (dacvalue & 3) | (data << 2);
// if (dacvalue !=0) bprintf(0, _T("%X,"), dacvalue);
DACWrite16Signed(0, dacvalue << 6);
if (ml.booting) {
// for Rampage
// The game holds the dac at full +dc for nearly 2 seconds while
// booting up; this is a problem when using headphones or a very
// powerfull amp/speaker system - or - if one doesn't want the added
// noise.
// 0x80 - 0x82 are 2 sound-code "fifo" buffers. some sounds are
// played in 0x80,0x81, and others in 0x82,0x83. Simply put - we're
// waiting for the soundcpu to fully bootup and play its first sound
// before unmuting the dac. This gets past all the nasty clicking
// and popping noises that gets written to the dac @ bootup.
// - dink April 2019
if (ml.booting == 1 && sg_ram[0x80/2] == 1 && ml.last80 == 1) {
ml.booting = 2;
//bprintf(0, _T("booting pt.2.\n"));
}
if (ml.booting == 2 && sg_ram[0x80/2] == 0 && ml.last80 == 1) {
//bprintf(0, _T("booting pt.3\n"));
ml.booting = 3;
}
if (ml.booting == 3 && (sg_ram[0x80/2] != 0 || sg_ram[0x82/2] != 0) && ml.last80 == 0) {
bprintf(0, _T("*** soundsgood[rampage]: un-muting\n"));
ml.booting = 0;
}
ml.last80 = sg_ram[0x80/2];
}
if (!ml.booting) {
DACWrite16Signed(0, 0x4000 + (dacvalue << 6));
}
}
static void soundsgood_portb_w(UINT16, UINT8 data)
{
dacvalue = (dacvalue & ~3) | (data >> 6);
// if (dacvalue !=0) bprintf(0, _T("%X,"), dacvalue);
DACWrite16Signed(0, dacvalue << 6);
if (!ml.booting) {
DACWrite16Signed(0, 0x4000 + (dacvalue << 6));
}
if (pia_get_ddr_b(0) & 0x30) soundsgood_status = (data >> 4) & 3;
}
@@ -112,6 +154,10 @@ void soundsgood_reset()
soundsgood_status = 0;
soundsgood_in_reset = 0;
dacvalue = 0;
// pop-suppression
ml.booting = (soundsgood_rampage) ? 1 : 0;
ml.last80 = -1;
}
static const pia6821_interface pia_intf = {
@@ -122,6 +168,7 @@ static const pia6821_interface pia_intf = {
void soundsgood_init(UINT8 *rom, UINT8 *ram)
{
sg_ram = (UINT16*)ram;
SekInit(0, 0x68000);
SekOpen(0);
SekMapMemory(rom, 0x000000, 0x03ffff, MAP_ROM);
@@ -150,7 +197,9 @@ void soundsgood_exit()
pia_init();
DACExit();
soundsgood_is_initialized = 0;
soundsgood_is_initialized = 0;
soundsgood_rampage = 0;
}
void soundsgood_scan(INT32 nAction, INT32 *pnMin)
@@ -165,7 +214,9 @@ void soundsgood_scan(INT32 nAction, INT32 *pnMin)
SCAN_VAR(soundsgood_status);
SCAN_VAR(soundsgood_in_reset);
SCAN_VAR(dacvalue);
SCAN_VAR(dacvalue);
SCAN_VAR(ml);
}
}
+2
View File
@@ -8,3 +8,5 @@ void soundsgood_exit();
void soundsgood_scan(INT32 nAction, INT32 *pnMin);
INT32 soundsgood_reset_status();
INT32 soundsgood_initialized();
extern INT32 soundsgood_rampage;
+35 -15
View File
@@ -71,6 +71,8 @@ static INT32 sprite_color_mask = 0;
static INT32 flip_screen_x = 0;
static INT32 nGraphicsLen[3];
static INT32 nExtraCycles[3];
static UINT8 DrvJoy1[8];
static UINT8 DrvJoy2[8];
static UINT8 DrvJoy3[8];
@@ -707,7 +709,8 @@ static UINT8 __fastcall spyhunt_read_port(UINT16 address)
static void ctc_interrupt(INT32 state)
{
ZetSetIRQLine(0, state ? CPU_IRQSTATUS_ACK : CPU_IRQSTATUS_NONE);
if (state) ZetSetIRQLine(0, CPU_IRQSTATUS_HOLD);
//ZetSetIRQLine(0, state ? CPU_IRQSTATUS_ACK : CPU_IRQSTATUS_NONE);
}
static tilemap_callback( bg )
@@ -763,7 +766,9 @@ static INT32 DrvDoReset(INT32 clear_mem)
lamp = 0;
last_op4 = 0;
return 0;
nExtraCycles[0] = nExtraCycles[1] = nExtraCycles[2] = 0;
return 0;
}
static INT32 MemIndex()
@@ -1372,7 +1377,7 @@ static INT32 DrvFrame()
INT32 nInterleave = 480;
INT32 nCyclesTotal[2] = { 5000000 / 30, 8000000 / 30 };
INT32 nCyclesDone[2] = { 0, 0 };
INT32 nCyclesDone[2] = { nExtraCycles[0], 0 };
ZetOpen(0);
SekOpen(0);
@@ -1402,6 +1407,8 @@ static INT32 DrvFrame()
SekClose();
ZetClose();
nExtraCycles[0] = nCyclesDone[0] - nCyclesTotal[0];
if (pBurnDraw) {
BurnDrvRedraw();
}
@@ -1424,7 +1431,7 @@ static INT32 TcsFrame()
INT32 nInterleave = 480;
INT32 nCyclesTotal[2] = { 5000000 / 30, 2000000 / 30 };
INT32 nCyclesDone[2] = { 0, 0 };
INT32 nCyclesDone[2] = { nExtraCycles[0], 0 };
ZetOpen(0);
M6809Open(0);
@@ -1452,6 +1459,8 @@ static INT32 TcsFrame()
M6809Close();
ZetClose();
nExtraCycles[0] = nCyclesDone[0] - nCyclesTotal[0];
if (pBurnDraw) {
BurnDrvRedraw();
}
@@ -1477,10 +1486,14 @@ static INT32 CSDSSIOFrame()
INT32 nInterleave = 480;
INT32 nCyclesTotal[3] = { 5000000 / 30, 8000000 / 30, 2000000 / 30 };
INT32 nCyclesDone[3] = { 0, 0, 0};
INT32 nCyclesDone[3] = { nExtraCycles[0], nExtraCycles[1], nExtraCycles[2] };
INT32 nSoundBufferPos = 0;
if (has_csd) SekOpen(0);
if (has_csd) {
SekOpen(0);
SekIdle(nExtraCycles[1]);
nExtraCycles[1] = 0;
}
for (INT32 i = 0; i < nInterleave; i++)
{
@@ -1506,7 +1519,7 @@ static INT32 CSDSSIOFrame()
if (has_ssio)
{
ZetOpen(1);
nCyclesDone[2] += ZetRun(nCyclesTotal[2] / nInterleave);
nCyclesDone[2] += ZetRun(((i + 1) * nCyclesTotal[2] / nInterleave) - nCyclesDone[2]);
ssio_14024_clock(nInterleave);
ZetClose();
}
@@ -1555,7 +1568,13 @@ static INT32 CSDSSIOFrame()
}
}
if (has_csd) SekClose();
if (has_csd) {
nExtraCycles[1] = nCyclesDone[1] - SekTotalCycles();
SekClose();
}
nExtraCycles[0] = nCyclesDone[0] - nCyclesTotal[0];
nExtraCycles[2] = nCyclesDone[2] - nCyclesTotal[2];
if (pBurnDraw) {
BurnDrvRedraw();
@@ -1580,8 +1599,9 @@ static INT32 DrvScan(INT32 nAction, INT32 *pnMin)
ba.szName = "All Ram";
BurnAcb(&ba);
ScanVar(DrvNVRAM, 0x800, "WORK RAM"); // also nv...
ZetScan(nAction);
z80ctc_scan(nAction);
tcs_scan(nAction, pnMin);
csd_scan(nAction, pnMin);
@@ -1602,14 +1622,12 @@ static INT32 DrvScan(INT32 nAction, INT32 *pnMin)
SCAN_VAR(lamp);
SCAN_VAR(last_op4);
SCAN_VAR(nExtraCycles);
}
if (nAction & ACB_NVRAM) {
ba.Data = DrvNVRAM;
ba.nLen = 0x00800;
ba.nAddress = 0;
ba.szName = "NV RAM";
BurnAcb(&ba);
ScanVar(DrvNVRAM, 0x800, "NV RAM");
}
return 0;
@@ -1895,7 +1913,9 @@ static INT32 RampageInit()
sound_input_bank = 4;
port_write_handler = rampage_write_callback;
return DrvInit(0);
soundsgood_rampage = 1; // for sound-cleanup in soundsgood
return DrvInit(0);
}
struct BurnDriver BurnDrvRampage = {
+2 -2
View File
@@ -329,7 +329,6 @@
<li>Sync romsets with MAME 0.208 [Barry]</li>
<li>Add handy BurnDump(fn, buf, bufsize); to debug builds for driver-dev [dink]</li>
<li> []</li>
<li> []</li>
</ul>
<!-- new drivers -->
<h4>New drivers</h4>
@@ -412,7 +411,8 @@
<li>Added driver for Taito's Qix, Zookeeper, Slither, Space Dungeon, Complex X, Kram and The Electric Yo-Yo [iq_132, dink]</li>
<li>Added driver for Taito's Kiki KaiKai/Knight Boy and Kick and Run/Mexico '86 [iq_132, dink]</li>
<li>Added driver for Senjyo, Baluba-Louk no Densetsu, Starforce/Megaforce [iq_132]</li>
<li>Added driver for Bally-Midway MCR: Tapper, Timber, Tron, Discs of Tron, Solar Fox, Satan's Hollow, Kick/Kickman, Kozmik Krooz'r, Wacko, Domino Man, Two Tigers, Journey and Demolition Derby [iq_132, dink]</li>
<li>Added driver for Tapper, Timber, Tron, Discs of Tron, Solar Fox, Satan's Hollow, Kick/Kickman, Kozmik Krooz'r, Wacko, Domino Man, Two Tigers, Journey and Demolition Derby on Bally-Midway MCR hardware [iq_132, dink]</li>
<li>Added driver for Spy Hunter, Rampage, Sarge, Star Guards, and Crater Raider on Bally-Midway MCR3 hardware [iq_132, dink]</li>
</ul>
<!-- new game additions to existing drivers -->
<h4>New additions / updates to existing drivers</h4>