mirror of
https://github.com/libretro/FBNeo.git
synced 2024-11-27 02:50:29 +00:00
add driver mcr68 [iq_132, dink]
This commit is contained in:
parent
c834bd0675
commit
d1686b916b
@ -62,7 +62,7 @@ drvsrc = d_akkaarrh.o d_arcadecl.o d_atarig1.o d_badlands.o d_batman.o d_blstro
|
||||
d_dynduke.o d_efdt.o d_epos.o d_espial.o d_ettrivia.o d_exedexes.o d_exerion.o d_exprraid.o d_exterm.o d_fantland.o d_fastfred.o d_firetrap.o d_flipjack.o d_flower.o d_foodf.o \
|
||||
d_freekick.o d_funkybee.o d_galaga.o d_galivan.o d_gaplus.o d_ginganin.o d_gng.o d_goindol.o d_gunsmoke.o d_headonb.o d_higemaru.o \
|
||||
d_himesiki.o d_holeland.o d_hvyunit.o d_invaders.o d_iqblock.o d_jack.o d_jedi.o d_jrpacman.o d_kangaroo.o d_kingofbox.o d_kncljoe.o d_kyugo.o d_ladybug.o d_lasso.o \
|
||||
d_lastduel.o d_lwings.o d_mainsnk.o d_mappy.o d_marineb.o d_mario.o d_madmotor.o d_magmax.o d_markham.o d_mastboyo.o d_matmania.o d_mcr.o d_mcr3.o d_megasys1.o d_meijinsn.o \
|
||||
d_lastduel.o d_lwings.o d_mainsnk.o d_mappy.o d_marineb.o d_mario.o d_madmotor.o d_magmax.o d_markham.o d_mastboyo.o d_matmania.o d_mcr.o d_mcr3.o d_mcr68.o d_megasys1.o d_meijinsn.o \
|
||||
d_metlfrzr.o d_mhavoc.o d_millipede.o d_mirax.o d_mitchell.o d_mjkjidai.o d_mole.o d_momoko.o d_mmagic.o d_mouser.o d_mrdo.o d_mrflea.o d_mrjong.o d_munchmo.o \
|
||||
d_mustache.o d_mystston.o d_namcona1.o d_namconb1.o d_namcos1.o d_namcos86.o d_ninjakd2.o d_nitedrvr.o d_naughtyb.o d_olibochu.o d_omegrace.o d_pacland.o d_pacman.o \
|
||||
d_pbaction.o d_pac2650.o d_pengadvb.o d_phoenix.o d_pitnrun.o d_pkunwar.o d_popeye.o d_popper.o d_prehisle.o d_psychic5.o d_pturn.o d_punchout.o \
|
||||
@ -102,7 +102,7 @@ depobj = burn.o burn_bitmap.o burn_gun.o burn_led.o burn_shift.o burn_memory.o
|
||||
load.o tilemap_generic.o tiles_generic.o timer.o vector.o \
|
||||
\
|
||||
6821pia.o 6840ptm.o 8255ppi.o 8257dma.o c169.o atariic.o atarijsa.o atarimo.o atarirle.o atarivad.o avgdvg.o bsmt2000.o decobsmt.o ds2404.o earom.o eeprom.o epic12.o gaelco_crypt.o i4x00.o intelfsh.o \
|
||||
joyprocess.o nb1414m4.o nb1414m4_8bit.o nmk004.o nmk112.o k1ge.o kaneko_tmap.o mathbox.o mb87078.o mermaid.o midcsd.o midsat.o midsg.o midssio.o midtcs.o \
|
||||
joyprocess.o nb1414m4.o nb1414m4_8bit.o nmk004.o nmk112.o k1ge.o kaneko_tmap.o mathbox.o mb87078.o mermaid.o midcsd.o midsat.o midsg.o midcvsd.o midssio.o midtcs.o \
|
||||
namco_c45.o namcoio.o pandora.o poly.o qs1000.o resnet.o rtc9701.o seibucop.o seibusnd.o serflash.o sknsspr.o slapstic.o st0020.o t5182.o timekpr.o tlc34076.o tms34061.o v3021.o vdc.o \
|
||||
tms9928a.o watchdog.o x2212.o \
|
||||
\
|
||||
|
278
src/burn/devices/midcvsd.cpp
Normal file
278
src/burn/devices/midcvsd.cpp
Normal file
@ -0,0 +1,278 @@
|
||||
|
||||
#include "burnint.h"
|
||||
#include "m6809_intf.h"
|
||||
#include "burn_ym2151.h"
|
||||
#include "6821pia.h"
|
||||
#include "dac.h"
|
||||
#include "hc55516.h"
|
||||
|
||||
static UINT8 *mainrom;
|
||||
static INT32 pia_select;
|
||||
static INT32 dac_select;
|
||||
static INT32 cpu_select;
|
||||
|
||||
static UINT8 audio_talkback;
|
||||
static INT32 cpu_bank;
|
||||
static INT32 cvsd_is_initialized = 0;
|
||||
static INT32 cvsd_in_reset;
|
||||
|
||||
static void bankswitch(INT32 data)
|
||||
{
|
||||
INT32 bank = (0x8000 * ((data >> 2) & 3) + 0x20000 * (data & 3));
|
||||
|
||||
cpu_bank = data;
|
||||
|
||||
M6809MapMemory(mainrom + bank, 0x8000, 0xffff, MAP_ROM);
|
||||
}
|
||||
|
||||
static void cvsd_write(UINT16 address, UINT8 data)
|
||||
{
|
||||
if ((address & 0xe000) == 0x2000) {
|
||||
BurnYM2151Write(address & 1, data);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((address & 0xe000) == 0x4000) {
|
||||
pia_write(pia_select, address & 3, data);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((address & 0xf800) == 0x6000) {
|
||||
hc55516_digit_w(data);
|
||||
hc55516_clock_w(0);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((address & 0xf800) == 0x6800) {
|
||||
hc55516_clock_w(1);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((address & 0xf800) == 0x7800) {
|
||||
bankswitch(data);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static UINT8 cvsd_read(UINT16 address)
|
||||
{
|
||||
if ((address & 0xe001) == 0x2001) {
|
||||
return BurnYM2151Read();
|
||||
}
|
||||
|
||||
if ((address & 0xe000) == 0x4000) {
|
||||
return pia_read(pia_select, address & 3);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void pia_out_a(UINT16 , UINT8 data)
|
||||
{
|
||||
DACWrite(dac_select, data); // signed??
|
||||
}
|
||||
|
||||
static void pia_out_b(UINT16 , UINT8 data)
|
||||
{
|
||||
audio_talkback = data;
|
||||
}
|
||||
|
||||
static void pia_irq0(INT32 state)
|
||||
{
|
||||
M6809SetIRQLine(0x1/*firq*/, state ? CPU_IRQSTATUS_ACK : CPU_IRQSTATUS_NONE);
|
||||
}
|
||||
|
||||
static void pia_irq1(INT32 state)
|
||||
{
|
||||
M6809SetIRQLine(0x20/*nmi*/, state ? CPU_IRQSTATUS_ACK : CPU_IRQSTATUS_NONE);
|
||||
}
|
||||
|
||||
static pia6821_interface pia_0 = {
|
||||
NULL, NULL,
|
||||
NULL, NULL, NULL, NULL,
|
||||
pia_out_a, pia_out_b, NULL, NULL,
|
||||
pia_irq0, pia_irq1
|
||||
};
|
||||
|
||||
static void CVSDYM2151IrqHandler(INT32 state)
|
||||
{
|
||||
pia_set_input_ca1(pia_select, !state);
|
||||
}
|
||||
|
||||
// external
|
||||
|
||||
void cvsd_reset_write(INT32 state)
|
||||
{
|
||||
if (cvsd_is_initialized == 0) return;
|
||||
|
||||
cvsd_in_reset = state;
|
||||
|
||||
if (state)
|
||||
{
|
||||
INT32 cpunum = M6809GetActive();
|
||||
if (cpunum == -1) M6809Open(cpu_select);
|
||||
else if (cpunum != cpu_select)
|
||||
{
|
||||
M6809Close();
|
||||
M6809Open(cpu_select);
|
||||
}
|
||||
M6809Reset();
|
||||
M6809SetIRQLine(0, CPU_IRQSTATUS_NONE);
|
||||
M6809SetIRQLine(1, CPU_IRQSTATUS_NONE);
|
||||
M6809SetIRQLine(0x20, CPU_IRQSTATUS_NONE);
|
||||
bankswitch(0);
|
||||
DACReset();
|
||||
BurnYM2151Reset();
|
||||
if (cpunum == -1) M6809Close();
|
||||
else if (cpunum != cpu_select)
|
||||
{
|
||||
M6809Close();
|
||||
M6809Open(cpunum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cvsd_data_write(UINT16 data)
|
||||
{
|
||||
if (cvsd_is_initialized == 0) return;
|
||||
|
||||
INT32 cpunum = M6809GetActive();
|
||||
if (cpunum == -1) M6809Open(cpu_select);
|
||||
else if (cpunum != cpu_select)
|
||||
{
|
||||
M6809Close();
|
||||
M6809Open(cpu_select);
|
||||
}
|
||||
pia_set_input_b(pia_select, (data & 0x00ff));
|
||||
pia_set_input_cb1(pia_select, (data & 0x0100) >> 8);
|
||||
pia_set_input_cb2(pia_select, (data & 0x0200) >> 9);
|
||||
if (cpunum == -1) M6809Close();
|
||||
else if (cpunum != cpu_select)
|
||||
{
|
||||
M6809Close();
|
||||
M6809Open(cpunum);
|
||||
}
|
||||
}
|
||||
|
||||
UINT8 cvsd_talkback_read()
|
||||
{
|
||||
return audio_talkback;
|
||||
}
|
||||
|
||||
INT32 cvsd_reset_status()
|
||||
{
|
||||
if (cvsd_is_initialized == 0) return 0;
|
||||
return cvsd_in_reset;
|
||||
}
|
||||
|
||||
void cvsd_reset()
|
||||
{
|
||||
if (cvsd_is_initialized == 0) return;
|
||||
|
||||
M6809Open(cpu_select);
|
||||
bankswitch(0);
|
||||
M6809Reset();
|
||||
BurnYM2151Reset();
|
||||
if (pia_select == 0) pia_reset();
|
||||
hc55516_reset();
|
||||
if (dac_select == 0) DACReset();
|
||||
pia_set_input_ca1(pia_select,1); // ??
|
||||
M6809Close();
|
||||
|
||||
audio_talkback = 0;
|
||||
cvsd_in_reset = 0;
|
||||
}
|
||||
|
||||
void cvsd_init(INT32 m6809num, INT32 dacnum, INT32 pianum, UINT8 *rom, UINT8 *ram) // cpu is 2000000 hz
|
||||
{
|
||||
mainrom = rom;
|
||||
pia_select = pianum;
|
||||
dac_select = dacnum;
|
||||
cpu_select = m6809num;
|
||||
cvsd_is_initialized = 1;
|
||||
|
||||
M6809Init(cpu_select);
|
||||
M6809Open(cpu_select);
|
||||
M6809MapMemory(ram, 0x0000, 0x07ff, MAP_RAM);
|
||||
M6809MapMemory(ram, 0x0800, 0x0fff, MAP_RAM);
|
||||
M6809MapMemory(ram, 0x1000, 0x17ff, MAP_RAM);
|
||||
M6809MapMemory(ram, 0x1800, 0x1fff, MAP_RAM);
|
||||
M6809MapMemory(ram + 0x8000, 0x8000, 0xffff, MAP_ROM);
|
||||
M6809SetWriteHandler(cvsd_write);
|
||||
M6809SetReadHandler(cvsd_read);
|
||||
M6809Close();
|
||||
|
||||
if (pia_select == 0) pia_init();
|
||||
pia_config(pia_select, 0, &pia_0);
|
||||
|
||||
BurnYM2151InitBuffered(3579545, 1, NULL, 0);
|
||||
BurnYM2151SetIrqHandler(&CVSDYM2151IrqHandler);
|
||||
BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_1, 0.15, BURN_SND_ROUTE_LEFT);
|
||||
BurnYM2151SetRoute(BURN_SND_YM2151_YM2151_ROUTE_2, 0.15, BURN_SND_ROUTE_RIGHT);
|
||||
BurnTimerAttachM6809(2000000);
|
||||
|
||||
DACInit(dacnum, 0, 1, M6809TotalCycles, 2000000);
|
||||
DACSetRoute(dacnum, 0.50, BURN_SND_ROUTE_BOTH);
|
||||
|
||||
hc55516_init(M6809TotalCycles, 2000000);
|
||||
}
|
||||
|
||||
void cvsd_exit()
|
||||
{
|
||||
if (cvsd_is_initialized == 0) return;
|
||||
|
||||
if (cpu_select == 0) M6809Exit();
|
||||
if (pia_select == 0) pia_exit();
|
||||
BurnYM2151Exit();
|
||||
hc55516_exit();
|
||||
if (dac_select == 0) DACExit();
|
||||
|
||||
cvsd_is_initialized = 0;
|
||||
}
|
||||
|
||||
void cvsd_update(INT16 *samples, INT32 length)
|
||||
{
|
||||
if (cvsd_is_initialized == 0) return;
|
||||
|
||||
INT32 cpunum = M6809GetActive();
|
||||
if (cpunum == -1) M6809Open(cpu_select);
|
||||
if (length) BurnYM2151Render(samples, length);
|
||||
if (((samples + length * 2) - (pBurnSoundOut + (nBurnSoundLen * 2))) == 0)
|
||||
{
|
||||
DACUpdate(pBurnSoundOut, nBurnSoundLen);
|
||||
hc55516_update(pBurnSoundOut, nBurnSoundLen);
|
||||
}
|
||||
if (cpunum == -1) M6809Close();
|
||||
}
|
||||
|
||||
INT32 cvsd_initialized()
|
||||
{
|
||||
return cvsd_is_initialized;
|
||||
}
|
||||
|
||||
void cvsd_scan(INT32 nAction, INT32 *pnMin)
|
||||
{
|
||||
if (cvsd_is_initialized == 0) return;
|
||||
|
||||
if (pnMin) {
|
||||
*pnMin = 0x029702;
|
||||
}
|
||||
|
||||
if (nAction & ACB_VOLATILE) {
|
||||
if (cpu_select == 0) M6809Scan(nAction);
|
||||
|
||||
BurnYM2151Scan(nAction, pnMin);
|
||||
if (dac_select == 0) DACScan(nAction,pnMin);
|
||||
if (pia_select == 0) pia_scan(nAction,pnMin);
|
||||
hc55516_scan(nAction, pnMin);
|
||||
|
||||
SCAN_VAR(audio_talkback);
|
||||
SCAN_VAR(cpu_bank);
|
||||
}
|
||||
|
||||
if (nAction & ACB_WRITE) {
|
||||
M6809Open(cpu_select);
|
||||
bankswitch(cpu_bank);
|
||||
M6809Close();
|
||||
}
|
||||
}
|
11
src/burn/devices/midcvsd.h
Normal file
11
src/burn/devices/midcvsd.h
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
void cvsd_reset_write(INT32 state);
|
||||
void cvsd_data_write(UINT16 data);
|
||||
INT32 cvsd_reset_status();
|
||||
UINT8 cvsd_talkback_read();
|
||||
void cvsd_reset();
|
||||
void cvsd_init(INT32 m6809num, INT32 dacnum, INT32 pianum, UINT8 *rom /*0x80000 size!*/, UINT8 *ram/*0x800 size!*/); // cpu is 2000000 hz
|
||||
void cvsd_exit();
|
||||
void cvsd_update(INT16 *samples, INT32 length);
|
||||
INT32 cvsd_initialized();
|
||||
void cvsd_scan(INT32 nAction, INT32 *pnMin);
|
@ -17,10 +17,16 @@ static UINT16 *sg_ram = NULL;
|
||||
struct anti_pop {
|
||||
UINT16 last_tval;
|
||||
INT32 booting;
|
||||
UINT16 mask;
|
||||
};
|
||||
|
||||
static anti_pop ml;
|
||||
|
||||
void soundsgood_set_antipop_mask(UINT16 nMask)
|
||||
{
|
||||
ml.mask = nMask;
|
||||
}
|
||||
|
||||
static void soundsgood_porta_w(UINT16, UINT8 data)
|
||||
{
|
||||
dacvalue = (dacvalue & 3) | (data << 2);
|
||||
@ -28,7 +34,7 @@ static void soundsgood_porta_w(UINT16, UINT8 data)
|
||||
// After boot-up & it plays a sample, one of these locations will go from
|
||||
// 0x00 to above 0x10. We'll use that logic to un-mute to avoid the nasty
|
||||
// pops and clicks this soundboard makes while booting.
|
||||
INT32 tval = (sg_ram[0x80/2] | sg_ram[0x82/2] | sg_ram[0x90/2] | sg_ram[0xa0/2] | sg_ram[0xb0/2] | sg_ram[0xc2/2]);
|
||||
INT32 tval = (sg_ram[0x80/2] | sg_ram[0x82/2] | sg_ram[0x90/2] | sg_ram[0xa0/2] | sg_ram[0xb0/2] | sg_ram[0xc2/2]) & ml.mask;
|
||||
|
||||
if (ml.booting && tval > 0x10 && ml.last_tval == 0) {
|
||||
bprintf(0, _T("*** soundsgood: un-muting\n"));
|
||||
@ -146,6 +152,11 @@ static const pia6821_interface pia_intf = {
|
||||
soundsgood_irq, soundsgood_irq
|
||||
};
|
||||
|
||||
static INT32 DACSync()
|
||||
{
|
||||
return (INT32)(float)(nBurnSoundLen * (SekTotalCycles() / (8000000 / (nBurnFPS / 100.0000))));
|
||||
}
|
||||
|
||||
void soundsgood_init(INT32 n68knum, INT32 dacnum, UINT8 *rom, UINT8 *ram)
|
||||
{
|
||||
sg_ram = (UINT16*)ram;
|
||||
@ -164,18 +175,19 @@ void soundsgood_init(INT32 n68knum, INT32 dacnum, UINT8 *rom, UINT8 *ram)
|
||||
pia_init();
|
||||
pia_config(0, PIA_ALTERNATE_ORDERING, &pia_intf);
|
||||
|
||||
DACInit(dacnum, 0, 0, SekTotalCycles, 8000000);
|
||||
DACInit(dacnum, 0, 0, DACSync);
|
||||
DACSetRoute(dacnum, 1.00, BURN_SND_ROUTE_BOTH);
|
||||
DACDCBlock(1);
|
||||
|
||||
soundsgood_is_initialized = 1;
|
||||
ml.mask = 0xffff;
|
||||
}
|
||||
|
||||
void soundsgood_exit()
|
||||
{
|
||||
if (soundsgood_is_initialized == 0) return;
|
||||
|
||||
SekExit();
|
||||
if (which_cpu == 0) SekExit();
|
||||
pia_init();
|
||||
DACExit();
|
||||
|
||||
|
@ -11,3 +11,5 @@ void soundsgood_exit();
|
||||
void soundsgood_scan(INT32 nAction, INT32 *pnMin);
|
||||
INT32 soundsgood_reset_status();
|
||||
INT32 soundsgood_initialized();
|
||||
|
||||
void soundsgood_set_antipop_mask(UINT16 nMask);
|
||||
|
@ -133,6 +133,11 @@ static const pia6821_interface pia_intf = {
|
||||
tcs_irq, tcs_irq
|
||||
};
|
||||
|
||||
static INT32 DACSync()
|
||||
{
|
||||
return (INT32)(float)(nBurnSoundLen * (M6809TotalCycles() / (2000000 / (nBurnFPS / 100.0000))));
|
||||
}
|
||||
|
||||
void tcs_init(INT32 cpunum, INT32 pianum, INT32 dacnum, UINT8 *rom, UINT8 *ram)
|
||||
{
|
||||
cpu_select = cpunum;
|
||||
@ -152,7 +157,7 @@ void tcs_init(INT32 cpunum, INT32 pianum, INT32 dacnum, UINT8 *rom, UINT8 *ram)
|
||||
if (pia_select == 0) pia_init();
|
||||
pia_config(pia_select, PIA_ALTERNATE_ORDERING, &pia_intf);
|
||||
|
||||
DACInit(dacnum, 0, 0, M6809TotalCycles, 2000000);
|
||||
DACInit(dacnum, 0, 0, DACSync);
|
||||
DACSetRoute(dacnum, 1.00, BURN_SND_ROUTE_BOTH);
|
||||
DACDCBlock(1);
|
||||
|
||||
|
2233
src/burn/drv/pre90s/d_mcr68.cpp
Normal file
2233
src/burn/drv/pre90s/d_mcr68.cpp
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user