Skip to content
This repository was archived by the owner on Nov 16, 2022. It is now read-only.

Commit b928b03

Browse files
committedApr 15, 2019
spif rampage dac
1 parent c70f4e1 commit b928b03

File tree

4 files changed

+96
-23
lines changed

4 files changed

+96
-23
lines changed
 

‎src/burn/devices/midsg.cpp

+57-6
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,61 @@ static UINT16 dacvalue;
1010
static UINT16 soundsgood_status;
1111
static INT32 soundsgood_in_reset;
1212
static INT32 soundsgood_is_initialized;
13+
static UINT16 *sg_ram = NULL;
14+
15+
INT32 soundsgood_rampage = 0;
16+
17+
// muting & pop-supression logic (rampage only)
18+
struct anti_pop {
19+
UINT16 last80;
20+
INT32 booting;
21+
};
22+
23+
static anti_pop ml;
1324

1425
static void soundsgood_porta_w(UINT16, UINT8 data)
1526
{
1627
dacvalue = (dacvalue & 3) | (data << 2);
17-
// if (dacvalue !=0) bprintf(0, _T("%X,"), dacvalue);
18-
DACWrite16Signed(0, dacvalue << 6);
28+
29+
if (ml.booting) {
30+
// for Rampage
31+
// The game holds the dac at full +dc for nearly 2 seconds while
32+
// booting up; this is a problem when using headphones or a very
33+
// powerfull amp/speaker system - or - if one doesn't want the added
34+
// noise.
35+
// 0x80 - 0x82 are 2 sound-code "fifo" buffers. some sounds are
36+
// played in 0x80,0x81, and others in 0x82,0x83. Simply put - we're
37+
// waiting for the soundcpu to fully bootup and play its first sound
38+
// before unmuting the dac. This gets past all the nasty clicking
39+
// and popping noises that gets written to the dac @ bootup.
40+
// - dink April 2019
41+
if (ml.booting == 1 && sg_ram[0x80/2] == 1 && ml.last80 == 1) {
42+
ml.booting = 2;
43+
//bprintf(0, _T("booting pt.2.\n"));
44+
}
45+
if (ml.booting == 2 && sg_ram[0x80/2] == 0 && ml.last80 == 1) {
46+
//bprintf(0, _T("booting pt.3\n"));
47+
ml.booting = 3;
48+
}
49+
if (ml.booting == 3 && (sg_ram[0x80/2] != 0 || sg_ram[0x82/2] != 0) && ml.last80 == 0) {
50+
bprintf(0, _T("*** soundsgood[rampage]: un-muting\n"));
51+
ml.booting = 0;
52+
}
53+
ml.last80 = sg_ram[0x80/2];
54+
}
55+
56+
if (!ml.booting) {
57+
DACWrite16Signed(0, 0x4000 + (dacvalue << 6));
58+
}
1959
}
2060

2161
static void soundsgood_portb_w(UINT16, UINT8 data)
2262
{
2363
dacvalue = (dacvalue & ~3) | (data >> 6);
24-
// if (dacvalue !=0) bprintf(0, _T("%X,"), dacvalue);
25-
DACWrite16Signed(0, dacvalue << 6);
64+
65+
if (!ml.booting) {
66+
DACWrite16Signed(0, 0x4000 + (dacvalue << 6));
67+
}
2668

2769
if (pia_get_ddr_b(0) & 0x30) soundsgood_status = (data >> 4) & 3;
2870
}
@@ -112,6 +154,10 @@ void soundsgood_reset()
112154
soundsgood_status = 0;
113155
soundsgood_in_reset = 0;
114156
dacvalue = 0;
157+
158+
// pop-suppression
159+
ml.booting = (soundsgood_rampage) ? 1 : 0;
160+
ml.last80 = -1;
115161
}
116162

117163
static const pia6821_interface pia_intf = {
@@ -122,6 +168,7 @@ static const pia6821_interface pia_intf = {
122168

123169
void soundsgood_init(UINT8 *rom, UINT8 *ram)
124170
{
171+
sg_ram = (UINT16*)ram;
125172
SekInit(0, 0x68000);
126173
SekOpen(0);
127174
SekMapMemory(rom, 0x000000, 0x03ffff, MAP_ROM);
@@ -150,7 +197,9 @@ void soundsgood_exit()
150197
pia_init();
151198
DACExit();
152199

153-
soundsgood_is_initialized = 0;
200+
soundsgood_is_initialized = 0;
201+
202+
soundsgood_rampage = 0;
154203
}
155204

156205
void soundsgood_scan(INT32 nAction, INT32 *pnMin)
@@ -165,7 +214,9 @@ void soundsgood_scan(INT32 nAction, INT32 *pnMin)
165214

166215
SCAN_VAR(soundsgood_status);
167216
SCAN_VAR(soundsgood_in_reset);
168-
SCAN_VAR(dacvalue);
217+
SCAN_VAR(dacvalue);
218+
219+
SCAN_VAR(ml);
169220
}
170221
}
171222

‎src/burn/devices/midsg.h

+2
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ void soundsgood_exit();
88
void soundsgood_scan(INT32 nAction, INT32 *pnMin);
99
INT32 soundsgood_reset_status();
1010
INT32 soundsgood_initialized();
11+
12+
extern INT32 soundsgood_rampage;

‎src/burn/drv/pre90s/d_mcr3.cpp

+35-15
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ static INT32 sprite_color_mask = 0;
7171
static INT32 flip_screen_x = 0;
7272
static INT32 nGraphicsLen[3];
7373

74+
static INT32 nExtraCycles[3];
75+
7476
static UINT8 DrvJoy1[8];
7577
static UINT8 DrvJoy2[8];
7678
static UINT8 DrvJoy3[8];
@@ -707,7 +709,8 @@ static UINT8 __fastcall spyhunt_read_port(UINT16 address)
707709

708710
static void ctc_interrupt(INT32 state)
709711
{
710-
ZetSetIRQLine(0, state ? CPU_IRQSTATUS_ACK : CPU_IRQSTATUS_NONE);
712+
if (state) ZetSetIRQLine(0, CPU_IRQSTATUS_HOLD);
713+
//ZetSetIRQLine(0, state ? CPU_IRQSTATUS_ACK : CPU_IRQSTATUS_NONE);
711714
}
712715

713716
static tilemap_callback( bg )
@@ -763,7 +766,9 @@ static INT32 DrvDoReset(INT32 clear_mem)
763766
lamp = 0;
764767
last_op4 = 0;
765768

766-
return 0;
769+
nExtraCycles[0] = nExtraCycles[1] = nExtraCycles[2] = 0;
770+
771+
return 0;
767772
}
768773

769774
static INT32 MemIndex()
@@ -1372,7 +1377,7 @@ static INT32 DrvFrame()
13721377

13731378
INT32 nInterleave = 480;
13741379
INT32 nCyclesTotal[2] = { 5000000 / 30, 8000000 / 30 };
1375-
INT32 nCyclesDone[2] = { 0, 0 };
1380+
INT32 nCyclesDone[2] = { nExtraCycles[0], 0 };
13761381

13771382
ZetOpen(0);
13781383
SekOpen(0);
@@ -1402,6 +1407,8 @@ static INT32 DrvFrame()
14021407
SekClose();
14031408
ZetClose();
14041409

1410+
nExtraCycles[0] = nCyclesDone[0] - nCyclesTotal[0];
1411+
14051412
if (pBurnDraw) {
14061413
BurnDrvRedraw();
14071414
}
@@ -1424,7 +1431,7 @@ static INT32 TcsFrame()
14241431

14251432
INT32 nInterleave = 480;
14261433
INT32 nCyclesTotal[2] = { 5000000 / 30, 2000000 / 30 };
1427-
INT32 nCyclesDone[2] = { 0, 0 };
1434+
INT32 nCyclesDone[2] = { nExtraCycles[0], 0 };
14281435

14291436
ZetOpen(0);
14301437
M6809Open(0);
@@ -1452,6 +1459,8 @@ static INT32 TcsFrame()
14521459
M6809Close();
14531460
ZetClose();
14541461

1462+
nExtraCycles[0] = nCyclesDone[0] - nCyclesTotal[0];
1463+
14551464
if (pBurnDraw) {
14561465
BurnDrvRedraw();
14571466
}
@@ -1477,10 +1486,14 @@ static INT32 CSDSSIOFrame()
14771486

14781487
INT32 nInterleave = 480;
14791488
INT32 nCyclesTotal[3] = { 5000000 / 30, 8000000 / 30, 2000000 / 30 };
1480-
INT32 nCyclesDone[3] = { 0, 0, 0};
1489+
INT32 nCyclesDone[3] = { nExtraCycles[0], nExtraCycles[1], nExtraCycles[2] };
14811490
INT32 nSoundBufferPos = 0;
14821491

1483-
if (has_csd) SekOpen(0);
1492+
if (has_csd) {
1493+
SekOpen(0);
1494+
SekIdle(nExtraCycles[1]);
1495+
nExtraCycles[1] = 0;
1496+
}
14841497

14851498
for (INT32 i = 0; i < nInterleave; i++)
14861499
{
@@ -1506,7 +1519,7 @@ static INT32 CSDSSIOFrame()
15061519
if (has_ssio)
15071520
{
15081521
ZetOpen(1);
1509-
nCyclesDone[2] += ZetRun(nCyclesTotal[2] / nInterleave);
1522+
nCyclesDone[2] += ZetRun(((i + 1) * nCyclesTotal[2] / nInterleave) - nCyclesDone[2]);
15101523
ssio_14024_clock(nInterleave);
15111524
ZetClose();
15121525
}
@@ -1555,7 +1568,13 @@ static INT32 CSDSSIOFrame()
15551568
}
15561569
}
15571570

1558-
if (has_csd) SekClose();
1571+
if (has_csd) {
1572+
nExtraCycles[1] = nCyclesDone[1] - SekTotalCycles();
1573+
SekClose();
1574+
}
1575+
1576+
nExtraCycles[0] = nCyclesDone[0] - nCyclesTotal[0];
1577+
nExtraCycles[2] = nCyclesDone[2] - nCyclesTotal[2];
15591578

15601579
if (pBurnDraw) {
15611580
BurnDrvRedraw();
@@ -1580,8 +1599,9 @@ static INT32 DrvScan(INT32 nAction, INT32 *pnMin)
15801599
ba.szName = "All Ram";
15811600
BurnAcb(&ba);
15821601

1602+
ScanVar(DrvNVRAM, 0x800, "WORK RAM"); // also nv...
1603+
15831604
ZetScan(nAction);
1584-
z80ctc_scan(nAction);
15851605

15861606
tcs_scan(nAction, pnMin);
15871607
csd_scan(nAction, pnMin);
@@ -1602,14 +1622,12 @@ static INT32 DrvScan(INT32 nAction, INT32 *pnMin)
16021622

16031623
SCAN_VAR(lamp);
16041624
SCAN_VAR(last_op4);
1625+
1626+
SCAN_VAR(nExtraCycles);
16051627
}
16061628

16071629
if (nAction & ACB_NVRAM) {
1608-
ba.Data = DrvNVRAM;
1609-
ba.nLen = 0x00800;
1610-
ba.nAddress = 0;
1611-
ba.szName = "NV RAM";
1612-
BurnAcb(&ba);
1630+
ScanVar(DrvNVRAM, 0x800, "NV RAM");
16131631
}
16141632

16151633
return 0;
@@ -1895,7 +1913,9 @@ static INT32 RampageInit()
18951913
sound_input_bank = 4;
18961914
port_write_handler = rampage_write_callback;
18971915

1898-
return DrvInit(0);
1916+
soundsgood_rampage = 1; // for sound-cleanup in soundsgood
1917+
1918+
return DrvInit(0);
18991919
}
19001920

19011921
struct BurnDriver BurnDrvRampage = {

‎whatsnew.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,6 @@ <h4>Fixes and new features</h4>
329329
<li>Sync romsets with MAME 0.208 [Barry]</li>
330330
<li>Add handy BurnDump(fn, buf, bufsize); to debug builds for driver-dev [dink]</li>
331331
<li> []</li>
332-
<li> []</li>
333332
</ul>
334333
<!-- new drivers -->
335334
<h4>New drivers</h4>
@@ -412,7 +411,8 @@ <h4>New drivers</h4>
412411
<li>Added driver for Taito's Qix, Zookeeper, Slither, Space Dungeon, Complex X, Kram and The Electric Yo-Yo [iq_132, dink]</li>
413412
<li>Added driver for Taito's Kiki KaiKai/Knight Boy and Kick and Run/Mexico '86 [iq_132, dink]</li>
414413
<li>Added driver for Senjyo, Baluba-Louk no Densetsu, Starforce/Megaforce [iq_132]</li>
415-
<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>
414+
<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>
415+
<li>Added driver for Spy Hunter, Rampage, Sarge, Star Guards, and Crater Raider on Bally-Midway MCR3 hardware [iq_132, dink]</li>
416416
</ul>
417417
<!-- new game additions to existing drivers -->
418418
<h4>New additions / updates to existing drivers</h4>

0 commit comments

Comments
 (0)
This repository has been archived.