From cea86cdab1bb06ace8092a09e36bb7bb7ff924ba Mon Sep 17 00:00:00 2001 From: mariuszw1 Date: Tue, 10 Feb 2009 22:19:15 +0000 Subject: [PATCH] Driver for TomCat New games added or promoted from NOT_WORKING status --------------------------------------------------- TomCat (prototype) [Mariusz Wojcieszek] There are still some small issues (complete list in driver), if somebody with more experience with Atari and/or vector hardware wants to take a look, feel free. --- .gitattributes | 1 + src/mame/drivers/starwars.c | 2 +- src/mame/drivers/tomcat.c | 345 ++++++++++++++++++++++++++++++++++++ src/mame/mame.mak | 1 + src/mame/mamedriv.c | 1 + src/mame/video/avgdvg.c | 22 +++ src/mame/video/avgdvg.h | 1 + 7 files changed, 372 insertions(+), 1 deletion(-) create mode 100644 src/mame/drivers/tomcat.c diff --git a/.gitattributes b/.gitattributes index d61d15267b8..988c801e0b6 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2118,6 +2118,7 @@ src/mame/drivers/tnzs.c svneol=native#text/plain src/mame/drivers/toaplan1.c svneol=native#text/plain src/mame/drivers/toaplan2.c svneol=native#text/plain src/mame/drivers/toki.c svneol=native#text/plain +src/mame/drivers/tomcat.c svneol=native#text/plain src/mame/drivers/toobin.c svneol=native#text/plain src/mame/drivers/topshoot.c svneol=native#text/plain src/mame/drivers/topspeed.c svneol=native#text/plain diff --git a/src/mame/drivers/starwars.c b/src/mame/drivers/starwars.c index 45a8386bce5..bfa08651f8d 100644 --- a/src/mame/drivers/starwars.c +++ b/src/mame/drivers/starwars.c @@ -555,5 +555,5 @@ static DRIVER_INIT( esb ) GAME( 1983, starwars, 0, starwars, starwars, starwars, ROT0, "Atari", "Star Wars (rev 2)", 0 ) GAME( 1983, starwar1, starwars, starwars, starwars, starwars, ROT0, "Atari", "Star Wars (rev 1)", 0 ) -GAME( 1983, tomcatsw, 0, starwars, starwars, starwars, ROT0, "Atari", "TomCat (Star Wars hardware, prototype)", GAME_NO_SOUND ) +GAME( 1983, tomcatsw, tomcat, starwars, starwars, starwars, ROT0, "Atari", "TomCat (Star Wars hardware, prototype)", GAME_NO_SOUND ) GAME( 1985, esb, 0, starwars, esb, esb, ROT0, "Atari Games", "The Empire Strikes Back", 0 ) diff --git a/src/mame/drivers/tomcat.c b/src/mame/drivers/tomcat.c new file mode 100644 index 00000000000..037386393c7 --- /dev/null +++ b/src/mame/drivers/tomcat.c @@ -0,0 +1,345 @@ +/* + + Atari Tomcat prototype hardware + + Driver by Mariusz Wojcieszek + + Notes/ToDo: + - add proper timing of interrupts and framerate (currently commented out, + as they cause test mode to hang) + - vector quality appears to be worse than original game (compared to original + game videos) + - verify controls + - sound hardware (6502, 2xPOKEY, YM2151, TMS5220, 6532) is not emulated, program + for sound was not written and game actually has no sound + - implement game linking (after MAME supports network) + - current implementation of 68010 <-> tms32010 is a little bit hacky, after + tms32010 is started by 68010, 68010 is suspended until tms32010 reads command + and starts executing + +*/ + +#include "driver.h" +#include "deprecat.h" +#include "cpu/m68000/m68000.h" +#include "cpu/tms32010/tms32010.h" +#include "video/vector.h" +#include "video/avgdvg.h" +#include "machine/timekpr.h" + +static int tomcat_control_num; +static UINT16 *tomcat_shared_ram; +static UINT8 *tomcat_nvram; +static int dsp_BIO; +static int dsp_idle; + +static WRITE16_HANDLER(tomcat_adcon_w) +{ + tomcat_control_num = data; +} + +static READ16_HANDLER(tomcat_adcread_r) +{ + switch( tomcat_control_num ) + { + case 0: return input_port_read(space->machine, "STICKY"); + case 1: return input_port_read(space->machine, "STICKX"); + default: return 0x7f7f; + } +} + +static READ16_HANDLER(tomcat_inputs_r) +{ + UINT16 result = 0; + if (ACCESSING_BITS_8_15) + result |= input_port_read(space->machine, "IN0") << 8; + + return result; +} + +static WRITE16_HANDLER(tomcat_led1on_w) +{ + set_led_status(1, 1); +} + +static WRITE16_HANDLER(tomcat_led2on_w) +{ + set_led_status(2, 1); +} + +static WRITE16_HANDLER(tomcat_led2off_w) +{ + set_led_status(2, 0); +} + +static WRITE16_HANDLER(tomcat_led1off_w) +{ + set_led_status(1, 0); +} + +static WRITE16_HANDLER(tomcat_lnkmodel_w) +{ + // Link Mode Low (address strobe) + // Master does not respond to Interrupts +} + +static WRITE16_HANDLER(tomcat_errl_w) +{ + // Link Error Flag Low (address strobe) +} + +static WRITE16_HANDLER(tomcat_errh_w) +{ + // Link Error Flag High (address strobe) +} + +static WRITE16_HANDLER(tomcat_ackl_w) +{ + // Link ACK Flag Low (address strobe) +} + +static WRITE16_HANDLER(tomcat_ackh_w) +{ + // Link ACK Flag High (address strobe) +} + +static WRITE16_HANDLER(tomcat_lnkmodeh_w) +{ + // Link Mode high (address strobe) +} + +static WRITE16_HANDLER(tomcat_txbuffl_w) +{ + // Link Buffer Control (address strobe) +} + +static WRITE16_HANDLER(tomcat_txbuffh_w) +{ + // Link Buffer Control high (address strobe) + // Turn off TX (Link) Buffer +} + +static WRITE16_HANDLER(tomcat_sndresl_w) +{ + // Sound Reset Low (Address Strobe) + // Reset Sound System +} + +static WRITE16_HANDLER(tomcat_sndresh_w) +{ + // Sound Reset high (Address Strobe) + // Release reset of sound system +} + +static WRITE16_HANDLER(tomcat_mresl_w) +{ + // 320 Reset Low (Address Strobe) + // Reset TMS320 + cpu_set_input_line(cputag_get_cpu(space->machine, "dsp"), INPUT_LINE_RESET, ASSERT_LINE); +} + +static WRITE16_HANDLER(tomcat_mresh_w) +{ + // 320 Reset high (Address Strobe) + // Release reset of TMS320 + dsp_BIO = 0; + cpu_set_input_line(cputag_get_cpu(space->machine, "dsp"), INPUT_LINE_RESET, CLEAR_LINE); +} + +static WRITE16_HANDLER(tomcat_irqclr_w) +{ + // Clear IRQ Latch (Address Strobe) + cpu_set_input_line(space->machine->cpu[0], 1, CLEAR_LINE); +} + +static READ16_HANDLER(tomcat_inputs2_r) +{ +/* +* D15 LNKFLAG (Game Link) +* D14 PC3 " " +* D13 PC2 " " +* D12 PC0 " " +* D11 MAINFLAG (Sound System) +* D10 SOUNDFLAG " " +* D9 /IDLE* (TMS320 System) +* D8 +*/ + return dsp_idle ? 0 : (1 << 9); +} + +static READ16_HANDLER(tomcat_320bio_r) +{ + dsp_BIO = 1; + cpu_suspend(space->machine->cpu[0], SUSPEND_REASON_SPIN, 1); + return 0; +} + +static READ16_HANDLER(dsp_BIO_r) +{ + if ( cpu_get_pc(space->cpu) == 0x0001 ) + { + if ( dsp_idle == 0 ) + { + dsp_idle = 1; + dsp_BIO = 0; + } + return !dsp_BIO; + } + else if ( cpu_get_pc(space->cpu) == 0x0003 ) + { + if ( dsp_BIO == 1 ) + { + dsp_idle = 0; + dsp_BIO = 0; + cpu_resume(space->machine->cpu[0], SUSPEND_REASON_SPIN ); + return 0; + } + else + { + assert(0); + } + } + else + { + return !dsp_BIO; + } +} + +static READ16_HANDLER(tomcat_shared_ram_r) +{ + return tomcat_shared_ram[offset]; +} + +static WRITE16_HANDLER(tomcat_shared_ram_w) +{ + COMBINE_DATA(&tomcat_shared_ram[offset]); +} + +static READ8_HANDLER(tomcat_nvram_r) +{ + return tomcat_nvram[offset]; +} + +static WRITE8_HANDLER(tomcat_nvram_w) +{ + tomcat_nvram[offset] = data; +} + +static ADDRESS_MAP_START( tomcat_map, ADDRESS_SPACE_PROGRAM, 16 ) + AM_RANGE(0x000000, 0x00ffff) AM_ROM + AM_RANGE(0x402000, 0x402001) AM_READ(tomcat_adcread_r) AM_WRITE(tomcat_adcon_w) + AM_RANGE(0x404000, 0x404001) AM_READ(tomcat_inputs_r) AM_WRITE(avgdvg_go_word_w) + AM_RANGE(0x406000, 0x406001) AM_WRITE(avgdvg_reset_word_w) + AM_RANGE(0x408000, 0x408001) AM_READWRITE(tomcat_inputs2_r, watchdog_reset16_w) + AM_RANGE(0x40a000, 0x40a001) AM_READWRITE(tomcat_320bio_r, tomcat_irqclr_w) + AM_RANGE(0x40e000, 0x40e001) AM_WRITE(tomcat_led1on_w) + AM_RANGE(0x40e002, 0x40e003) AM_WRITE(tomcat_led2on_w) + AM_RANGE(0x40e004, 0x40e005) AM_WRITE(tomcat_mresl_w) + AM_RANGE(0x40e006, 0x40e007) AM_WRITE(tomcat_sndresl_w) + AM_RANGE(0x40e008, 0x40e009) AM_WRITE(tomcat_lnkmodel_w) + AM_RANGE(0x40e00a, 0x40e00b) AM_WRITE(tomcat_errl_w) + AM_RANGE(0x40e00c, 0x40e00d) AM_WRITE(tomcat_ackl_w) + AM_RANGE(0x40e00e, 0x40e00f) AM_WRITE(tomcat_txbuffl_w) + AM_RANGE(0x40e010, 0x40e011) AM_WRITE(tomcat_led1off_w) + AM_RANGE(0x40e012, 0x40e013) AM_WRITE(tomcat_led2off_w) + AM_RANGE(0x40e014, 0x40e015) AM_WRITE(tomcat_mresh_w) + AM_RANGE(0x40e016, 0x40e017) AM_WRITE(tomcat_sndresh_w) + AM_RANGE(0x40e018, 0x40e019) AM_WRITE(tomcat_lnkmodeh_w) + AM_RANGE(0x40e01a, 0x40e01b) AM_WRITE(tomcat_errh_w) + AM_RANGE(0x40e01c, 0x40e01d) AM_WRITE(tomcat_ackh_w) + AM_RANGE(0x40e01e, 0x40e01f) AM_WRITE(tomcat_txbuffh_w) + AM_RANGE(0x800000, 0x803fff) AM_RAM AM_BASE((UINT16**)&vectorram) AM_SIZE(&vectorram_size) + AM_RANGE(0xffa000, 0xffbfff) AM_READWRITE(tomcat_shared_ram_r, tomcat_shared_ram_w) + AM_RANGE(0xffc000, 0xffcfff) AM_RAM + AM_RANGE(0xffd000, 0xffdfff) AM_DEVREADWRITE8(M48T02, "m48t02", timekeeper_r, timekeeper_w, 0xff00) + AM_RANGE(0xffd000, 0xffdfff) AM_READWRITE8(tomcat_nvram_r, tomcat_nvram_w, 0x00ff) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( dsp_map, ADDRESS_SPACE_PROGRAM, 16 ) + AM_RANGE(0x0000, 0x1fff) AM_RAM AM_BASE(&tomcat_shared_ram) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( dsp_io_map, ADDRESS_SPACE_IO, 16 ) + AM_RANGE(TMS32010_BIO, TMS32010_BIO) AM_READ(dsp_BIO_r) +ADDRESS_MAP_END + +INPUT_PORTS_START( tomcat ) + PORT_START("IN0") /* INPUTS */ + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(avgdvg_done_r, NULL) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) // SPARE + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON5 ) // DIAGNOSTIC + PORT_SERVICE( 0x08, IP_ACTIVE_LOW ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) // R FIRE + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) // L FIRE + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON4 ) // R THUMB + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) // L THUMB + + PORT_START("STICKY") + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(70) PORT_KEYDELTA(30) + + PORT_START("STICKX") + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(30) +INPUT_PORTS_END + +ROM_START( tomcat ) + ROM_REGION( 0x10000, "main", 0) + ROM_LOAD16_BYTE( "rom1k.bin", 0x00001, 0x8000, CRC(5535a1ff) SHA1(b9807c749a8e6b5ddec3ff494130abda09f0baab) ) + ROM_LOAD16_BYTE( "rom2k.bin", 0x00000, 0x8000, CRC(021a01d2) SHA1(01d99aab54ad57a664e8aaa91296bb879fc6e422) ) + + ROM_REGION( 0x100, "user1", 0 ) + ROM_LOAD( "136021-105.1l", 0x0000, 0x0100, CRC(82fc3eb2) SHA1(184231c7baef598294860a7d2b8a23798c5c7da6) ) /* AVG PROM */ +ROM_END + +static MACHINE_START(tomcat) +{ + ((UINT16*)tomcat_shared_ram)[0x0000] = 0xf600; + ((UINT16*)tomcat_shared_ram)[0x0001] = 0x0000; + ((UINT16*)tomcat_shared_ram)[0x0002] = 0xf600; + ((UINT16*)tomcat_shared_ram)[0x0003] = 0x0000; + + tomcat_nvram = auto_malloc(0x800); + + dsp_BIO = 0; +} + +static NVRAM_HANDLER(tomcat) +{ + if (read_or_write) + mame_fwrite(file, tomcat_nvram, 0x800); + else + if (file) + mame_fread(file, tomcat_nvram, 0x800); + else + memset(tomcat_nvram, 0x00, 0x800); +} + +static MACHINE_DRIVER_START(tomcat) + MDRV_CPU_ADD("main", M68010, XTAL_12MHz / 2) + MDRV_CPU_PROGRAM_MAP(tomcat_map, 0) + MDRV_CPU_VBLANK_INT_HACK(irq1_line_assert, 5) + //MDRV_CPU_PERIODIC_INT(irq1_line_assert, (double)XTAL_12MHz / 16 / 16 / 16 / 12) + + MDRV_CPU_ADD("dsp", TMS32010, XTAL_16MHz) + MDRV_CPU_PROGRAM_MAP( dsp_map, 0 ) + MDRV_CPU_IO_MAP( dsp_io_map, 0 ) + + MDRV_QUANTUM_TIME(HZ(4000)) + + MDRV_MACHINE_START(tomcat) + + MDRV_NVRAM_HANDLER(tomcat) + + MDRV_M48T02_ADD( "m48t02" ) + + MDRV_SCREEN_ADD("main", VECTOR) + MDRV_SCREEN_REFRESH_RATE(40) + //MDRV_SCREEN_REFRESH_RATE((double)XTAL_12MHz / 16 / 16 / 16 / 12 / 5 ) + MDRV_SCREEN_SIZE(400, 300) + MDRV_SCREEN_VISIBLE_AREA(0, 280, 0, 250) + + MDRV_VIDEO_START(avg_tomcat) + MDRV_VIDEO_UPDATE(vector) + +MACHINE_DRIVER_END + +GAME( 1985, tomcat, 0, tomcat, tomcat, 0, ROT0, "Atari", "TomCat (prototype)", GAME_NO_SOUND ) diff --git a/src/mame/mame.mak b/src/mame/mame.mak index b46f2df0ac5..7523bfde091 100644 --- a/src/mame/mame.mak +++ b/src/mame/mame.mak @@ -527,6 +527,7 @@ $(MAMEOBJ)/atari.a: \ $(DRIVERS)/tank8.o $(AUDIO)/tank8.o $(VIDEO)/tank8.o \ $(DRIVERS)/tempest.o \ $(DRIVERS)/thunderj.o $(VIDEO)/thunderj.o \ + $(DRIVERS)/tomcat.o \ $(DRIVERS)/toobin.o $(VIDEO)/toobin.o \ $(DRIVERS)/tourtabl.o $(VIDEO)/tia.o \ $(DRIVERS)/triplhnt.o $(AUDIO)/triplhnt.o $(VIDEO)/triplhnt.o \ diff --git a/src/mame/mamedriv.c b/src/mame/mamedriv.c index a7481350df5..0db73727a38 100644 --- a/src/mame/mamedriv.c +++ b/src/mame/mamedriv.c @@ -5226,6 +5226,7 @@ BOMULEUL CHAJARA SEGA ST-V 1997/04/11 DRIVER( alphaone ) /* (proto) (c) 1983 */ DRIVER( alphaona ) /* (proto) (c) 1983 */ DRIVER( esb ) /* 136031 (c) 1985 */ + DRIVER( tomcat ) /* (proto) (c) 1985 */ /* Atari "Centipede hardware" games */ DRIVER( warlords ) /* 037153-037159 (c) 1980 */ diff --git a/src/mame/video/avgdvg.c b/src/mame/video/avgdvg.c index 03486023718..5fec689a26a 100644 --- a/src/mame/video/avgdvg.c +++ b/src/mame/video/avgdvg.c @@ -1409,6 +1409,23 @@ static const vgconf avg_quantum = avg_vgrst }; +static vgconf avg_tomcat = +{ + { + avg_latch0, + avg_latch1, + avg_latch2, + avg_latch3, + avg_strobe0, + avg_strobe1, + starwars_strobe2, + starwars_strobe3 + }, + avg_state_addr, + avg_data, + avg_vggo, + avg_vgrst +}; /************************************* * @@ -1537,3 +1554,8 @@ VIDEO_START( avg_quantum ) VIDEO_START_CALL(avg_common); } +VIDEO_START( avg_tomcat ) +{ + vgc = &avg_tomcat; + VIDEO_START_CALL(avg_common); +} diff --git a/src/mame/video/avgdvg.h b/src/mame/video/avgdvg.h index 4170b329270..47497ba605b 100644 --- a/src/mame/video/avgdvg.h +++ b/src/mame/video/avgdvg.h @@ -23,6 +23,7 @@ VIDEO_START( avg_mhavoc ); VIDEO_START( avg_starwars ); VIDEO_START( avg_quantum ); VIDEO_START( avg_bzone ); +VIDEO_START( avg_tomcat ); MACHINE_RESET( avgdvg );