add WIP driver for mcr. tapper, timber, tron, discs of tron, etc.

This commit is contained in:
dinkc64 2019-04-02 00:16:50 -04:00
parent ab525ccdd7
commit c5ba574585
6 changed files with 3749 additions and 2 deletions

View File

@ -58,7 +58,7 @@ drvsrc = d_arcadecl.cpp d_atarig1.cpp d_badlands.cpp d_batman.cpp d_blstroid.cp
d_dynduke.o d_efdt.o d_epos.o d_espial.o d_ettrivia.o d_exedexes.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_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_markham.o d_mastboyo.o d_matmania.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_markham.o d_mastboyo.o d_matmania.o d_mcr.o d_megasys1.o d_meijinsn.o \
d_metlfrzr.o d_mhavoc.o d_millipede.o d_mirax.o d_mitchell.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_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 \
@ -100,7 +100,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 8255ppi.o 8257dma.o c169.o atariic.o atarijsa.o atarimo.o atarirle.o atarivad.o avgdvg.o bsmt2000.o decobsmt.o earom.o eeprom.o \
gaelco_crypt.o joyprocess.o nb1414m4.o nb1414m4_8bit.o nmk004.o nmk112.o kaneko_tmap.o mathbox.o mb87078.o mermaid.o namco_c45.o namcoio.o \
gaelco_crypt.o joyprocess.o nb1414m4.o nb1414m4_8bit.o nmk004.o nmk112.o kaneko_tmap.o mathbox.o mb87078.o mermaid.o midsat.o midssio.o namco_c45.o namcoio.o \
pandora.o resnet.o seibusnd.o sknsspr.o slapstic.o st0020.o t5182.o timekpr.o tms34061.o v3021.o vdc.o tms9928a.o watchdog.o x2212.o \
\
asteroids.o ay8910.o burn_y8950.o burn_ym2151.o burn_ym2203.o burn_ym2413.o burn_ym2608.o burn_ym2610.o burn_ym2612.o burn_md2612.o \

221
src/burn/devices/midsat.cpp Normal file
View File

@ -0,0 +1,221 @@
// Midway Squeak and Talk module
// based on MAME code by Aaron Giles
#include "burnint.h"
#include "m6800_intf.h"
#include "tms5220.h"
#include "6821pia.h"
static UINT8 *M6800RAM;
static INT32 tms_command;
static INT32 tms_strobes;
static INT32 midsat_in_reset;
static INT32 midsat_initialized = 0;
static void midsat_cpu_write(UINT16 address, UINT8 data)
{
if (address < 0x0080) {
M6800RAM[address] = data;
return;
}
if ((address & 0xfffc) == 0x0080) {
pia_write(0, address & 3, data);
return;
}
if ((address & 0xfffc) == 0x0090) {
pia_write(1, address & 3, data);
return;
}
if ((address & 0x9000) == 0x1000) {
// dac write (no chip on this hardware)
return;
}
}
static UINT8 midsat_cpu_read(UINT16 address)
{
if (address < 0x0080) {
return M6800RAM[address];
}
if ((address & 0xfffc) == 0x0080) {
return pia_read(0, address & 3);
}
if ((address & 0xfffc) == 0x0090) {
return pia_read(1, address & 3);
}
return 0xff;
}
static void pia0_out_a(UINT16 , UINT8 )
{
// for ay8912 (no chip on this hardware)
}
static void pia1_out_a(UINT16 , UINT8 data)
{
tms_command = data;
}
static void pia1_out_b(UINT16 , UINT8 data)
{
if (((data ^ tms_strobes) & 2) && (~data & 2))
{
tms5220_write(tms_command);
pia_set_input_ca2(1, 1);
pia_set_input_ca2(1, 0);
}
else if (((data ^ tms_strobes) & 1) && (~data & 1))
{
pia_set_input_a(1, tms5220_status());
pia_set_input_ca2(1, 1);
pia_set_input_ca2(1, 0);
}
tms_strobes = data;
}
static void pia_irq(INT32 state)
{
M6800SetIRQLine(M6800_IRQ_LINE, state ? CPU_IRQSTATUS_ACK : CPU_IRQSTATUS_NONE);
}
static pia6821_interface pia_0 = {
NULL, NULL,
NULL, NULL, NULL, NULL,
pia0_out_a, NULL, NULL, NULL,
pia_irq, pia_irq
};
static pia6821_interface pia_1 = {
NULL, NULL,
NULL, NULL, NULL, NULL,
pia1_out_a, pia1_out_b, NULL, NULL,
pia_irq, pia_irq
};
void midsat_write(UINT8 data)
{
M6800Open(0);
pia_set_input_a(0, ~data & 0x0f);
pia_set_input_cb1(0, (~data & 0x10) >> 4);
M6800Close();
}
void midsat_reset_write(INT32 state)
{
if (state == 0 && midsat_in_reset) {
M6800Reset();
}
midsat_in_reset = state;
}
INT32 midsat_reset_status()
{
return midsat_in_reset;
}
void midsat_reset()
{
memset (M6800RAM, 0x00, 0x80);
M6800Open(0);
M6800Reset();
tms5220_reset();
pia_reset();
M6800Close();
tms_command = 0;
tms_strobes = 0;
midsat_in_reset = 0;
}
void midsat_init(UINT8 *rom)
{
M6800RAM = (UINT8*)BurnMalloc(0x80);
M6800Init(0);
M6800Open(0);
M6800MapMemory(rom + 0x0000, 0xd000, 0xffff, MAP_ROM);
M6800SetWriteHandler(midsat_cpu_write);
M6800SetReadHandler(midsat_cpu_read);
M6800Close();
pia_init();
pia_config(0, 0, &pia_0);
pia_config(1, 0, &pia_1);
tms5220_init(M6800TotalCycles, 3579545/4);
tms5220_set_frequency(640000);
midsat_initialized = 1;
}
void midsat_exit()
{
M6800Exit();
pia_exit();
tms5220_exit();
BurnFree(M6800RAM);
midsat_initialized = 0;
}
INT32 has_midsat()
{
return midsat_initialized;
}
void midsatNewFrame()
{
M6800NewFrame();
}
INT32 midsat_run(INT32 cycles)
{
if (midsat_in_reset) {
return cycles;
}
M6800Open(0);
INT32 cyc = M6800Run(cycles);
M6800Close();
return cyc;
}
void midsat_update(INT16 *samples, INT32 length)
{
M6800Open(0);
tms5220_update(samples, length);
M6800Close();
}
void midsat_scan(INT32 nAction, INT32 *pnMin)
{
struct BurnArea ba;
if (nAction & ACB_VOLATILE) {
memset(&ba, 0, sizeof(ba));
ba.Data = M6800RAM;
ba.nLen = 0x80;
ba.szName = "M6800 Ram";
BurnAcb(&ba);
M6800Scan(nAction);
pia_scan(nAction, pnMin);
tms5220_scan(nAction, pnMin);
SCAN_VAR(tms_strobes);
SCAN_VAR(tms_command);
SCAN_VAR(midsat_in_reset);
}
}

17
src/burn/devices/midsat.h Normal file
View File

@ -0,0 +1,17 @@
// Midway Squeak and Talk module
void midsat_write(UINT8 data);
void midsat_reset_write(INT32 state);
INT32 midsat_reset_status();
void midsat_reset();
void midsat_init(UINT8 *rom);
void midsat_exit();
INT32 has_midsat();
void midsatNewFrame();
INT32 midsat_run(INT32 cycles);
void midsat_update(INT16 *samples, INT32 length);
void midsat_scan(INT32 nAction, INT32 *pnMin);

View File

@ -0,0 +1,334 @@
#include "burnint.h"
#include "z80_intf.h"
#include "ay8910.h"
// #define SSIODEBUG
static INT32 ssio_14024_count;
static INT32 ssio_data[4];
static INT32 ssio_status;
static INT32 ssio_duty_cycle[2][3];
static INT32 ssio_mute;
static INT32 ssio_overall[2];
typedef void (*output_func)(UINT8 offset, UINT8 data);
typedef UINT8 (*input_func)(UINT8 offset);
static double ssio_ayvolume_lookup[16];
static output_func output_handlers[2] = { NULL, NULL };
static input_func input_handlers[5] = { NULL, NULL, NULL, NULL, NULL };
static INT32 output_mask[2] = { 0xff, 0xff };
static INT32 input_mask[5] = { 0, 0, 0, 0, 0 };
UINT8 *ssio_inputs; // 5
UINT8 ssio_dips; // 1
static void __fastcall ssio_cpu_write(UINT16 address, UINT8 data)
{
// bprintf (0, _T("SW: %4.4x, %2.2x!!!!!!\n"), address, data);
if ((address & 0xf000) == 0xc000) {
#ifdef SSIODEBUG
bprintf (0, _T("SSIO Status Write: %2.2x\n"), data);
#endif
ssio_status = data;
return;
}
if ((address & 0xf000) == 0xd000) {
return; // nop
}
switch (address & ~0xffc)
{
case 0xa000:
AY8910Write(0, 0, data);
return;
case 0xa002:
AY8910Write(0, 1, data);
return;
case 0xb000:
AY8910Write(1, 0, data);
return;
case 0xb002:
AY8910Write(1, 1, data);
return;
}
}
static UINT8 __fastcall ssio_cpu_read(UINT16 address)
{
// bprintf (0, _T("SR: %4.4x!!!!!!\n"), address);
if ((address & 0xf000) == 0xc000) {
return 0; // nop
}
if ((address & 0xf000) == 0xe000) {
ssio_14024_count = 0;
ZetSetIRQLine(0, CPU_IRQSTATUS_NONE);
return 0xff;
}
if ((address & 0xf000) == 0xf000) {
return ssio_dips;
}
switch (address & ~0xffc)
{
case 0x9000:
case 0x9001:
case 0x9002:
case 0x9003:
return ssio_data[address & 3];
case 0xa001:
return AY8910Read(0);
case 0xb001:
return AY8910Read(1);
}
return 0;
}
static void ssio_update_volumes()
{
AY8910SetRoute(0, BURN_SND_AY8910_ROUTE_1, ssio_mute ? 0 : ssio_ayvolume_lookup[ssio_duty_cycle[0][0]], BURN_SND_ROUTE_PANLEFT);
AY8910SetRoute(0, BURN_SND_AY8910_ROUTE_2, ssio_mute ? 0 : ssio_ayvolume_lookup[ssio_duty_cycle[0][1]], BURN_SND_ROUTE_PANLEFT);
AY8910SetRoute(0, BURN_SND_AY8910_ROUTE_3, ssio_mute ? 0 : ssio_ayvolume_lookup[ssio_duty_cycle[0][2]], BURN_SND_ROUTE_PANLEFT);
AY8910SetRoute(1, BURN_SND_AY8910_ROUTE_1, ssio_mute ? 0 : ssio_ayvolume_lookup[ssio_duty_cycle[1][0]], BURN_SND_ROUTE_PANRIGHT);
AY8910SetRoute(1, BURN_SND_AY8910_ROUTE_2, ssio_mute ? 0 : ssio_ayvolume_lookup[ssio_duty_cycle[1][1]], BURN_SND_ROUTE_PANRIGHT);
AY8910SetRoute(1, BURN_SND_AY8910_ROUTE_3, ssio_mute ? 0 : ssio_ayvolume_lookup[ssio_duty_cycle[1][2]], BURN_SND_ROUTE_PANRIGHT);
}
static void AY8910_write_0A(UINT32 /*addr*/, UINT32 data)
{
ssio_duty_cycle[0][0] = data & 15;
ssio_duty_cycle[0][1] = data >> 4;
ssio_update_volumes();
}
static void AY8910_write_0B(UINT32 /*addr*/, UINT32 data)
{
ssio_duty_cycle[0][2] = data & 15;
ssio_overall[0] = (data >> 4) & 7;
ssio_update_volumes();
}
static void AY8910_write_1A(UINT32 /*addr*/, UINT32 data)
{
ssio_duty_cycle[1][0] = data & 15;
ssio_duty_cycle[1][1] = data >> 4;
ssio_update_volumes();
}
static void AY8910_write_1B(UINT32 /*addr*/, UINT32 data)
{
ssio_duty_cycle[1][2] = data & 15;
ssio_overall[1] = (data >> 4) & 7;
ssio_mute = data & 0x80;
ssio_update_volumes();
}
void ssio_14024_clock() // interrupt generator
{
// ~26x per frame
if (++ssio_14024_count >= 18) {
ZetSetIRQLine(0, CPU_IRQSTATUS_HOLD);
ssio_14024_count = 0;
}
}
void ssio_reset_write(INT32 state)
{
if (state)
{
ZetSetRESETLine(1, 1);
for (INT32 i = 0; i < 4; i++)
ssio_data[i] = 0;
ssio_status = 0;
ssio_14024_count = 0;
} else {
ZetSetRESETLine(1, 0);
}
}
static void ssio_compute_ay8910_modulation(UINT8 *prom)
{
for (INT32 volval = 0; volval < 16; volval++)
{
INT32 clock;
INT32 remaining_clocks = volval;
INT32 cur = 0, prev = 1;
for (clock = 0; clock < 160 && remaining_clocks; clock++)
{
cur = prom[clock / 8] & (0x80 >> (clock % 8));
if (cur == 0 && prev != 0)
remaining_clocks--;
prev = cur;
}
ssio_ayvolume_lookup[15-volval] = ((double)(clock * 100 / 160) / 100) / 4;
//bprintf(0, _T("vol %02d: %f\n"), 15-volval,ssio_ayvolume_lookup[15-volval]);
}
}
static UINT8 ssio_input_port_read(UINT8 offset)
{
offset &= 7;
// static const char *port[] = { "SSIO.IP0", "SSIO.IP1", "SSIO.IP2", "SSIO.IP3", "SSIO.IP4" };
UINT8 result = ssio_inputs[offset & 7];
if (input_handlers[offset])
result = (result & ~input_mask[offset]) | ((input_handlers[offset])(offset) & input_mask[offset]);
return result;
}
static void ssio_output_port_write(UINT8 offset, UINT8 data)
{
offset &= 7;
int which = offset >> 2;
// if (which == 0) mcr_control_port_w(offset, data);
if (output_handlers[which])
(*output_handlers[which])(offset, data & output_mask[which]);
}
void ssio_write_ports(UINT8 address, UINT8 data)
{
switch (address)
{
case 0x00:
case 0x01:
case 0x02:
case 0x03:
case 0x04:
case 0x05:
case 0x06:
case 0x07:
ssio_output_port_write(address & 7, data);
return;
case 0x1c:
case 0x1d:
case 0x1e:
case 0x1f:
#ifdef SSIODEBUG
bprintf (0, _T("SSIO Write: %2.2x, %2.2x\n"), address & 3, data);
#endif
ssio_data[address & 3] = data;
return;
}
}
UINT8 ssio_read_ports(UINT8 address)
{
switch (address & ~0x18)
{
case 0x00:
case 0x01:
case 0x02:
case 0x03:
case 0x04:
return ssio_input_port_read(address & 7);
case 0x07:
#ifdef SSIODEBUG
bprintf (0, _T("SSIO Status Read: %2.2x\n"), ssio_status);
#endif
return ssio_status;
}
return 0xff;
}
void ssio_set_custom_input(INT32 which, INT32 mask, UINT8 (*handler)(UINT8 offset))
{
input_handlers[which] = handler;
input_mask[which] = mask;
}
void ssio_set_custom_output(INT32 which, INT32 mask, void (*handler)(UINT8 offset, UINT8 data))
{
output_handlers[which/4] = handler;
output_mask[which/4] = mask;
}
void ssio_reset()
{
ssio_reset_write(1);
ssio_reset_write(0);
AY8910Reset(0);
AY8910Reset(1);
}
void ssio_init(UINT8 *rom, UINT8 *ram, UINT8 *prom)
{
ssio_compute_ay8910_modulation(prom);
for (INT32 i = 0; i < 4; i++) {
output_handlers[i>>1] = NULL;
input_handlers[i] = NULL;
output_mask[i>>1] = 0xff;
input_mask[i] = 0;
}
ZetInit(1);
ZetOpen(1);
ZetMapMemory(rom, 0x0000, 0x3fff, MAP_ROM);
ZetMapMemory(ram, 0x8000, 0x83ff, MAP_RAM);
ZetMapMemory(ram, 0x8400, 0x87ff, MAP_RAM);
ZetMapMemory(ram, 0x8800, 0x8bff, MAP_RAM);
ZetMapMemory(ram, 0x8c00, 0x8fff, MAP_RAM);
ZetSetWriteHandler(ssio_cpu_write);
ZetSetReadHandler(ssio_cpu_read);
ZetClose();
AY8910Init(0, 2000000, 0);
AY8910Init(1, 2000000, 0);
AY8910SetPorts(0, NULL, NULL, AY8910_write_0A, AY8910_write_0B);
AY8910SetPorts(1, NULL, NULL, AY8910_write_1A, AY8910_write_1B);
AY8910SetAllRoutes(0, 0.05, BURN_SND_ROUTE_PANLEFT);
AY8910SetAllRoutes(1, 0.05, BURN_SND_ROUTE_PANRIGHT);
}
void ssio_scan(INT32 nAction, INT32 *pnMin)
{
if (nAction & ACB_VOLATILE) {
AY8910Scan(nAction, pnMin);
SCAN_VAR(ssio_14024_count);
SCAN_VAR(ssio_data);
SCAN_VAR(ssio_status);
SCAN_VAR(ssio_duty_cycle);
SCAN_VAR(ssio_mute);
SCAN_VAR(ssio_overall);
}
}
void ssio_exit()
{
AY8910Exit(0);
AY8910Exit(1);
ssio_set_custom_output(0, 0xff, NULL);
ssio_set_custom_output(1, 0xff, NULL);
for (INT32 i = 0; i < 5; i++ ){
ssio_set_custom_input(i, 0, NULL);
}
}

View File

@ -0,0 +1,16 @@
extern UINT8 *ssio_inputs; // 5 - point to inputs
extern UINT8 ssio_dips; // 1 - dips for ssio board
void ssio_14024_clock(); // interrupt generator (480x per frame!)
void ssio_reset_write(INT32 state);
void ssio_write_ports(UINT8 offset, UINT8 data);
UINT8 ssio_read_ports(UINT8 offset);
void ssio_set_custom_input(INT32 which, INT32 mask, UINT8 (*handler)(UINT8 offset));
void ssio_set_custom_output(INT32 which, INT32 mask, void (*handler)(UINT8 offset, UINT8 data));
void ssio_reset();
void ssio_init(UINT8 *rom, UINT8 *ram, UINT8 *prom);
void ssio_exit();
void ssio_scan(INT32 nAction, INT32 *pnMin);

File diff suppressed because it is too large Load Diff