Cleaned up Time Pilot sound board implementation:

* full memory maps
 * partial machine driver removes need for replicating filtering logic
 * updated all relevant drivers

Cleaned up Time Pilot and Tutankham drivers:
 * correct clocks where possible
 * merged memory maps
 * fully decoded memory maps
 * replaced hacky sprite rendering in Time Pilot with partial updates
 * save state support
 * removed Power Surge kludge, replaced with unmapped handler control
 * Tutankham runs at 60fps, with IRQs every other frame
 * Proper IRQ ack in Tutankham
This commit is contained in:
Aaron Giles 2008-01-29 02:14:44 +00:00
parent 04dc9d1025
commit f394a31d0e
16 changed files with 494 additions and 675 deletions

2
.gitattributes vendored
View File

@ -2284,12 +2284,14 @@ src/mame/includes/tatsumi.h svneol=native#text/plain
src/mame/includes/taxidrvr.h svneol=native#text/plain
src/mame/includes/thedeep.h svneol=native#text/plain
src/mame/includes/thunderj.h svneol=native#text/plain
src/mame/includes/timeplt.h svneol=native#text/plain
src/mame/includes/tnzs.h svneol=native#text/plain
src/mame/includes/toaplan1.h svneol=native#text/plain
src/mame/includes/toobin.h svneol=native#text/plain
src/mame/includes/triplhnt.h svneol=native#text/plain
src/mame/includes/tubep.h svneol=native#text/plain
src/mame/includes/turbo.h svneol=native#text/plain
src/mame/includes/tutankhm.h svneol=native#text/plain
src/mame/includes/twincobr.h svneol=native#text/plain
src/mame/includes/tx1.h svneol=native#text/plain
src/mame/includes/ultratnk.h svneol=native#text/plain

View File

@ -67,6 +67,7 @@ enum
XTAL_12_096MHz = 12096000, /* Some early 80's Atari games */
XTAL_12_288MHz = 12288000, /* Sega Model 3 digital audio board */
XTAL_12_5MHz = 12500000, /* Red Alert audio board */
XTAL_12_9792MHz = 12979200, /* Exidy 440 */
XTAL_13_3MHz = 13300000, /* BMC bowling */
XTAL_13_33056MHz = 13330560, /* Taito L */
XTAL_13_4MHz = 13400000, /* TNK3, Ikari Warriors h/w */

View File

@ -16,47 +16,47 @@
#include "sound/flt_rc.h"
#include "timeplt.h"
#define MASTER_CLOCK XTAL_14_31818MHz
static READ8_HANDLER( timeplt_portB_r );
static WRITE8_HANDLER( timeplt_filter_w );
ADDRESS_MAP_START( timeplt_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_READ(MRA8_ROM)
AM_RANGE(0x2000, 0x23ff) AM_READ(MRA8_RAM)
AM_RANGE(0x3000, 0x33ff) AM_READ(MRA8_RAM)
AM_RANGE(0x4000, 0x4000) AM_READ(AY8910_read_port_0_r)
AM_RANGE(0x6000, 0x6000) AM_READ(AY8910_read_port_1_r)
static int timeplt_last_irq_state;
static SOUND_START( timeplt )
{
timeplt_last_irq_state = 0;
state_save_register_global(timeplt_last_irq_state);
}
static ADDRESS_MAP_START( timeplt_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x2fff) AM_ROM
AM_RANGE(0x3000, 0x33ff) AM_MIRROR(0x0c00) AM_RAM
AM_RANGE(0x4000, 0x4000) AM_MIRROR(0x0fff) AM_READWRITE(AY8910_read_port_0_r, AY8910_write_port_0_w)
AM_RANGE(0x5000, 0x5000) AM_MIRROR(0x0fff) AM_WRITE(AY8910_control_port_0_w)
AM_RANGE(0x6000, 0x6000) AM_MIRROR(0x0fff) AM_READWRITE(AY8910_read_port_1_r, AY8910_write_port_1_w)
AM_RANGE(0x7000, 0x7000) AM_MIRROR(0x0fff) AM_WRITE(AY8910_control_port_1_w)
AM_RANGE(0x8000, 0xffff) AM_WRITE(timeplt_filter_w)
ADDRESS_MAP_END
ADDRESS_MAP_START( timeplt_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_WRITE(MWA8_ROM)
AM_RANGE(0x2000, 0x23ff) AM_WRITE(MWA8_RAM)
AM_RANGE(0x3000, 0x33ff) AM_WRITE(MWA8_RAM)
AM_RANGE(0x4000, 0x4000) AM_WRITE(AY8910_write_port_0_w)
AM_RANGE(0x5000, 0x5000) AM_WRITE(AY8910_control_port_0_w)
AM_RANGE(0x6000, 0x6000) AM_WRITE(AY8910_write_port_1_w)
AM_RANGE(0x7000, 0x7000) AM_WRITE(AY8910_control_port_1_w)
AM_RANGE(0x8000, 0x8fff) AM_WRITE(timeplt_filter_w)
ADDRESS_MAP_END
ADDRESS_MAP_START( locomotn_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_READ(MRA8_ROM)
AM_RANGE(0x2000, 0x23ff) AM_READ(MRA8_RAM)
AM_RANGE(0x4000, 0x4000) AM_READ(AY8910_read_port_0_r)
AM_RANGE(0x6000, 0x6000) AM_READ(AY8910_read_port_1_r)
ADDRESS_MAP_END
ADDRESS_MAP_START( locomotn_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_WRITE(MWA8_ROM)
AM_RANGE(0x2000, 0x23ff) AM_WRITE(MWA8_RAM)
static ADDRESS_MAP_START( locomotn_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x1fff) AM_ROM
AM_RANGE(0x2000, 0x23ff) AM_MIRROR(0x0c00) AM_RAM
AM_RANGE(0x3000, 0x3fff) AM_WRITE(timeplt_filter_w)
AM_RANGE(0x4000, 0x4000) AM_WRITE(AY8910_write_port_0_w)
AM_RANGE(0x5000, 0x5000) AM_WRITE(AY8910_control_port_0_w)
AM_RANGE(0x6000, 0x6000) AM_WRITE(AY8910_write_port_1_w)
AM_RANGE(0x7000, 0x7000) AM_WRITE(AY8910_control_port_1_w)
AM_RANGE(0x4000, 0x4000) AM_MIRROR(0x0fff) AM_READWRITE(AY8910_read_port_0_r, AY8910_write_port_0_w)
AM_RANGE(0x5000, 0x5000) AM_MIRROR(0x0fff) AM_WRITE(AY8910_control_port_0_w)
AM_RANGE(0x6000, 0x6000) AM_MIRROR(0x0fff) AM_READWRITE(AY8910_read_port_1_r, AY8910_write_port_1_w)
AM_RANGE(0x7000, 0x7000) AM_MIRROR(0x0fff) AM_WRITE(AY8910_control_port_1_w)
ADDRESS_MAP_END
const struct AY8910interface timeplt_ay8910_interface =
static const struct AY8910interface timeplt_ay8910_interface =
{
soundlatch_r,
timeplt_portB_r
@ -87,20 +87,7 @@ static const int timeplt_timer[10] =
static READ8_HANDLER( timeplt_portB_r )
{
/* need to protect from totalcycles overflow */
static int last_totalcycles = 0;
/* number of Z80 clock cycles to count */
static int clock;
int current_totalcycles;
current_totalcycles = activecpu_gettotalcycles();
clock = (clock + (current_totalcycles-last_totalcycles)) % 5120;
last_totalcycles = current_totalcycles;
return timeplt_timer[clock/512];
return timeplt_timer[(activecpu_gettotalcycles64() / 512) % 10];
}
@ -126,14 +113,59 @@ static WRITE8_HANDLER( timeplt_filter_w )
WRITE8_HANDLER( timeplt_sh_irqtrigger_w )
{
static int last;
if (last == 0 && data)
if (timeplt_last_irq_state == 0 && data)
{
/* setting bit 0 low then high triggers IRQ on the sound CPU */
cpunum_set_input_line_and_vector(Machine, 1,0,HOLD_LINE,0xff);
}
last = data;
timeplt_last_irq_state = data;
}
MACHINE_DRIVER_START( timeplt_sound )
/* basic machine hardware */
MDRV_CPU_ADD_TAG("tpsound",Z80,MASTER_CLOCK/8)
MDRV_CPU_PROGRAM_MAP(timeplt_sound_map,0)
MDRV_SOUND_START(timeplt)
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
MDRV_SOUND_ADD(AY8910, MASTER_CLOCK/8)
MDRV_SOUND_CONFIG(timeplt_ay8910_interface)
MDRV_SOUND_ROUTE(0, "filter.0.0", 0.60)
MDRV_SOUND_ROUTE(1, "filter.0.1", 0.60)
MDRV_SOUND_ROUTE(2, "filter.0.2", 0.60)
MDRV_SOUND_ADD(AY8910, MASTER_CLOCK/8)
MDRV_SOUND_ROUTE(0, "filter.1.0", 0.60)
MDRV_SOUND_ROUTE(1, "filter.1.1", 0.60)
MDRV_SOUND_ROUTE(2, "filter.1.2", 0.60)
MDRV_SOUND_ADD_TAG("filter.0.0", FILTER_RC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_SOUND_ADD_TAG("filter.0.1", FILTER_RC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_SOUND_ADD_TAG("filter.0.2", FILTER_RC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_SOUND_ADD_TAG("filter.1.0", FILTER_RC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_SOUND_ADD_TAG("filter.1.1", FILTER_RC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_SOUND_ADD_TAG("filter.1.2", FILTER_RC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_DRIVER_END
MACHINE_DRIVER_START( locomotn_sound )
MDRV_IMPORT_FROM(timeplt_sound)
/* basic machine hardware */
MDRV_CPU_MODIFY("tpsound")
MDRV_CPU_PROGRAM_MAP(locomotn_sound_map,0)
MACHINE_DRIVER_END

View File

@ -1,6 +1,4 @@
ADDRESS_MAP_EXTERN(timeplt_sound_readmem);
ADDRESS_MAP_EXTERN(timeplt_sound_writemem);
ADDRESS_MAP_EXTERN(locomotn_sound_readmem);
ADDRESS_MAP_EXTERN(locomotn_sound_writemem);
extern const struct AY8910interface timeplt_ay8910_interface;
WRITE8_HANDLER( timeplt_sh_irqtrigger_w );
MACHINE_DRIVER_EXTERN( timeplt_sound );
MACHINE_DRIVER_EXTERN( locomotn_sound );

View File

@ -1062,7 +1062,7 @@ static MACHINE_DRIVER_START( exidy440 )
MDRV_CPU_PROGRAM_MAP(cpu1_map,0)
MDRV_CPU_VBLANK_INT(main_interrupt,1)
MDRV_CPU_ADD(M6809,12979200/4/4)
MDRV_CPU_ADD(M6809,EXIDY440_MASTER_CLOCK/4/4)
MDRV_CPU_PROGRAM_MAP(cpu2_map,0)
MDRV_CPU_VBLANK_INT(irq0_line_assert,1)
@ -1082,7 +1082,7 @@ static MACHINE_DRIVER_START( exidy440 )
/* sound hardware */
MDRV_SPEAKER_STANDARD_STEREO("left", "right")
MDRV_SOUND_ADD(CUSTOM, 12979200/256)
MDRV_SOUND_ADD(CUSTOM, EXIDY440_MASTER_CLOCK/256)
MDRV_SOUND_CONFIG(custom_interface)
MDRV_SOUND_ROUTE(0, "left", 1.0)
MDRV_SOUND_ROUTE(1, "right", 1.0)

View File

@ -79,6 +79,7 @@ Blitter source graphics
#include "driver.h"
#include "deprecat.h"
#include "tutankhm.h"
#include "cpu/m6809/m6809.h"
#include "cpu/i8039/i8039.h"
#include "cpu/z80/z80.h"
@ -89,18 +90,8 @@ Blitter source graphics
void konami1_decode(void);
extern UINT8 *tutankhm_videoram;
extern size_t tutankhm_videoram_size;
extern UINT8 *tutankhm_paletteram;
extern UINT8 *tutankhm_scroll;
static int i8039_status;
WRITE8_HANDLER( tutankhm_flip_screen_x_w );
WRITE8_HANDLER( tutankhm_flip_screen_y_w );
WRITE8_HANDLER( junofrst_blitter_w );
VIDEO_UPDATE( tutankhm );
WRITE8_HANDLER( tutankhm_sh_irqtrigger_w );
@ -190,8 +181,8 @@ static WRITE8_HANDLER( junofrst_coin_counter_w )
static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_RAM AM_BASE(&tutankhm_videoram) AM_SIZE(&tutankhm_videoram_size)
AM_RANGE(0x8000, 0x800f) AM_RAM AM_BASE(&tutankhm_paletteram)
AM_RANGE(0x0000, 0x7fff) AM_RAM AM_BASE(&videoram) AM_SIZE(&videoram_size)
AM_RANGE(0x8000, 0x800f) AM_RAM AM_BASE(&paletteram)
AM_RANGE(0x8010, 0x8010) AM_READ(input_port_0_r) /* DSW2 (inverted bits) */
AM_RANGE(0x801c, 0x801c) AM_READ(watchdog_reset_r)
AM_RANGE(0x8020, 0x8020) AM_READ(input_port_1_r) /* IN0 I/O: Coin slots, service, 1P/2P buttons */
@ -366,6 +357,7 @@ static MACHINE_DRIVER_START( junofrst )
MDRV_SCREEN_SIZE(32*8, 32*8)
MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) /* not sure about the visible area */
MDRV_VIDEO_START(tutankhm)
MDRV_VIDEO_UPDATE(tutankhm)
/* sound hardware */

View File

@ -221,10 +221,6 @@ static MACHINE_DRIVER_START( pooyan )
MDRV_CPU_PROGRAM_MAP(pooyan_map, 0)
MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
MDRV_CPU_ADD(Z80,14318180/8)
/* audio CPU */ /* 1.789772727 MHz */
MDRV_CPU_PROGRAM_MAP(timeplt_sound_readmem,timeplt_sound_writemem)
MDRV_SCREEN_REFRESH_RATE(60)
MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
@ -242,32 +238,7 @@ static MACHINE_DRIVER_START( pooyan )
MDRV_VIDEO_UPDATE(pooyan)
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
MDRV_SOUND_ADD(AY8910, 14318180/8)
MDRV_SOUND_CONFIG(timeplt_ay8910_interface)
MDRV_SOUND_ROUTE(0, "filter.0.0", 0.60)
MDRV_SOUND_ROUTE(1, "filter.0.1", 0.60)
MDRV_SOUND_ROUTE(2, "filter.0.2", 0.60)
MDRV_SOUND_ADD(AY8910, 14318180/8)
MDRV_SOUND_ROUTE(0, "filter.1.0", 0.60)
MDRV_SOUND_ROUTE(1, "filter.1.1", 0.60)
MDRV_SOUND_ROUTE(2, "filter.1.2", 0.60)
MDRV_SOUND_ADD_TAG("filter.0.0", FILTER_RC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_SOUND_ADD_TAG("filter.0.1", FILTER_RC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_SOUND_ADD_TAG("filter.0.2", FILTER_RC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_SOUND_ADD_TAG("filter.1.0", FILTER_RC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_SOUND_ADD_TAG("filter.1.1", FILTER_RC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_SOUND_ADD_TAG("filter.1.2", FILTER_RC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_IMPORT_FROM(timeplt_sound)
MACHINE_DRIVER_END

View File

@ -877,10 +877,6 @@ static MACHINE_DRIVER_START( tactcian )
MDRV_CPU_PROGRAM_MAP(locomotn_map,0)
MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
MDRV_CPU_ADD(Z80, 14318180/8) /* 1.789772727 MHz */
/* audio CPU */
MDRV_CPU_PROGRAM_MAP(locomotn_sound_readmem,locomotn_sound_writemem)
MDRV_SCREEN_REFRESH_RATE(60)
MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION /* frames per second, vblank duration */)
@ -898,32 +894,7 @@ static MACHINE_DRIVER_START( tactcian )
MDRV_VIDEO_UPDATE(rallyx)
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
MDRV_SOUND_ADD(AY8910, 14318180/8)
MDRV_SOUND_CONFIG(timeplt_ay8910_interface)
MDRV_SOUND_ROUTE(0, "filter.0.0", 0.60)
MDRV_SOUND_ROUTE(1, "filter.0.1", 0.60)
MDRV_SOUND_ROUTE(2, "filter.0.2", 0.60)
MDRV_SOUND_ADD(AY8910, 14318180/8)
MDRV_SOUND_ROUTE(0, "filter.1.0", 0.60)
MDRV_SOUND_ROUTE(1, "filter.1.1", 0.60)
MDRV_SOUND_ROUTE(2, "filter.1.2", 0.60)
MDRV_SOUND_ADD_TAG("filter.0.0", FILTER_RC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_SOUND_ADD_TAG("filter.0.1", FILTER_RC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_SOUND_ADD_TAG("filter.0.2", FILTER_RC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_SOUND_ADD_TAG("filter.1.0", FILTER_RC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_SOUND_ADD_TAG("filter.1.1", FILTER_RC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_SOUND_ADD_TAG("filter.1.2", FILTER_RC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_IMPORT_FROM(locomotn_sound)
MACHINE_DRIVER_END

View File

@ -225,10 +225,6 @@ static MACHINE_DRIVER_START( rocnrope )
MDRV_CPU_PROGRAM_MAP(readmem,writemem)
MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
MDRV_CPU_ADD(Z80,14318180/8)
/* audio CPU */ /* 1.789772727 MHz */ \
MDRV_CPU_PROGRAM_MAP(timeplt_sound_readmem,timeplt_sound_writemem)
MDRV_SCREEN_REFRESH_RATE(60)
MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
@ -246,32 +242,7 @@ static MACHINE_DRIVER_START( rocnrope )
MDRV_VIDEO_UPDATE(rocnrope)
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
MDRV_SOUND_ADD(AY8910, 14318180/8)
MDRV_SOUND_CONFIG(timeplt_ay8910_interface)
MDRV_SOUND_ROUTE(0, "filter.0.0", 0.60)
MDRV_SOUND_ROUTE(1, "filter.0.1", 0.60)
MDRV_SOUND_ROUTE(2, "filter.0.2", 0.60)
MDRV_SOUND_ADD(AY8910, 14318180/8)
MDRV_SOUND_ROUTE(0, "filter.1.0", 0.60)
MDRV_SOUND_ROUTE(1, "filter.1.1", 0.60)
MDRV_SOUND_ROUTE(2, "filter.1.2", 0.60)
MDRV_SOUND_ADD_TAG("filter.0.0", FILTER_RC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_SOUND_ADD_TAG("filter.0.1", FILTER_RC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_SOUND_ADD_TAG("filter.0.2", FILTER_RC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_SOUND_ADD_TAG("filter.1.0", FILTER_RC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_SOUND_ADD_TAG("filter.1.1", FILTER_RC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_SOUND_ADD_TAG("filter.1.2", FILTER_RC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_IMPORT_FROM(timeplt_sound)
MACHINE_DRIVER_END
/***************************************************************************

View File

@ -1,137 +1,131 @@
/***************************************************************************
Time Pilot memory map (preliminary)
Time Pilot
driver by Nicola Salmoria
driver by Nicola Salmoria
Main processor memory map.
0000-5fff ROM
a000-a3ff Color RAM
a400-a7ff Video RAM
a800-afff RAM
b000-b7ff sprite RAM (only areas 0xb010 and 0xb410 are used).
****************************************************************************
memory mapped ports:
memory map (preliminary)
read:
c000 video scan line. This is used by the program to multiplex the cloud
sprites, drawing them twice offset by 128 pixels.
c200 DSW2
c300 IN0
c320 IN1
c340 IN2
c360 DSW1
Main processor memory map.
0000-5fff ROM
a000-a3ff Color RAM
a400-a7ff Video RAM
a800-afff RAM
b000-b7ff sprite RAM (only areas 0xb010 and 0xb410 are used).
write:
c000 command for the audio CPU
c200 watchdog reset
c300 interrupt enable
c302 flip screen
c304 trigger interrupt on audio CPU
c308 Protection ??? Stuffs in some values computed from ROM content
c30a coin counter 1
c30c coin counter 2
memory mapped ports:
interrupts:
standard NMI at 0x66
read:
c000 video scan line. This is used by the program to multiplex the cloud
sprites, drawing them twice offset by 128 pixels.
c200 DSW2
c300 IN0
c320 IN1
c340 IN2
c360 DSW1
SOUND BOARD:
same as Pooyan
write:
c000 command for the audio CPU
c200 watchdog reset
c300 interrupt enable
c302 flip screen
c304 trigger interrupt on audio CPU
c308 Protection ??? Stuffs in some values computed from ROM content
c30a coin counter 1
c30c coin counter 2
interrupts:
standard NMI at 0x66
SOUND BOARD:
same as Pooyan
***************************************************************************/
#include "driver.h"
#include "timeplt.h"
#include "audio/timeplt.h"
extern UINT8 *timeplt_videoram,*timeplt_colorram;
READ8_HANDLER( timeplt_scanline_r );
WRITE8_HANDLER( timeplt_videoram_w );
WRITE8_HANDLER( timeplt_colorram_w );
WRITE8_HANDLER( timeplt_flipscreen_w );
VIDEO_START( timeplt );
PALETTE_INIT( timeplt );
VIDEO_UPDATE( timeplt );
INTERRUPT_GEN( timeplt_interrupt );
#define MASTER_CLOCK XTAL_18_432MHz
/*************************************
*
* Memory maps
*
*************************************/
static WRITE8_HANDLER( timeplt_coin_counter_w )
{
coin_counter_w(offset >> 1, data);
}
static READ8_HANDLER( psurge_protection_r )
{
return 0x80;
}
/*************************************
*
* Memory maps
*
*************************************/
static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x5fff) AM_READ(MRA8_ROM)
AM_RANGE(0x6004, 0x6004) AM_READ(psurge_protection_r) /* psurge only */
AM_RANGE(0xa000, 0xbfff) AM_READ(MRA8_RAM)
AM_RANGE(0xc000, 0xc000) AM_READ(timeplt_scanline_r)
AM_RANGE(0xc200, 0xc200) AM_READ(input_port_4_r) /* DSW2 */
AM_RANGE(0xc300, 0xc300) AM_READ(input_port_0_r) /* IN0 */
AM_RANGE(0xc320, 0xc320) AM_READ(input_port_1_r) /* IN1 */
AM_RANGE(0xc340, 0xc340) AM_READ(input_port_2_r) /* IN2 */
AM_RANGE(0xc360, 0xc360) AM_READ(input_port_3_r) /* DSW1 */
static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_FLAGS( AMEF_UNMAP(1) )
AM_RANGE(0x0000, 0x5fff) AM_ROM
AM_RANGE(0xa000, 0xa3ff) AM_READWRITE(MRA8_RAM, timeplt_colorram_w) AM_BASE(&colorram)
AM_RANGE(0xa400, 0xa7ff) AM_READWRITE(MRA8_RAM, timeplt_videoram_w) AM_BASE(&videoram)
AM_RANGE(0xa800, 0xafff) AM_RAM
AM_RANGE(0xb000, 0xb0ff) AM_MIRROR(0x0b00) AM_RAM AM_BASE(&spriteram)
AM_RANGE(0xb400, 0xb4ff) AM_MIRROR(0x0b00) AM_RAM AM_BASE(&spriteram_2)
AM_RANGE(0xc000, 0xc000) AM_MIRROR(0x0cff) AM_WRITE(soundlatch_w)
AM_RANGE(0xc200, 0xc200) AM_MIRROR(0x0cff) AM_WRITE(watchdog_reset_w)
AM_RANGE(0xc300, 0xc300) AM_MIRROR(0x0cf1) AM_WRITE(interrupt_enable_w)
AM_RANGE(0xc302, 0xc302) AM_MIRROR(0x0cf1) AM_WRITE(timeplt_flipscreen_w)
AM_RANGE(0xc304, 0xc304) AM_MIRROR(0x0cf1) AM_WRITE(timeplt_sh_irqtrigger_w)
AM_RANGE(0xc30a, 0xc30c) AM_MIRROR(0x0cf1) AM_WRITE(timeplt_coin_counter_w)
AM_RANGE(0xc000, 0xc000) AM_MIRROR(0x0cff) AM_READ(timeplt_scanline_r)
AM_RANGE(0xc200, 0xc200) AM_MIRROR(0x0cff) AM_READ_PORT("DSW1")
AM_RANGE(0xc300, 0xc300) AM_MIRROR(0x0c9f) AM_READ_PORT("IN0")
AM_RANGE(0xc320, 0xc320) AM_MIRROR(0x0c9f) AM_READ_PORT("IN1")
AM_RANGE(0xc340, 0xc340) AM_MIRROR(0x0c9f) AM_READ_PORT("IN2")
AM_RANGE(0xc360, 0xc360) AM_MIRROR(0x0c9f) AM_READ_PORT("DSW0")
ADDRESS_MAP_END
static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x5fff) AM_WRITE(MWA8_ROM)
AM_RANGE(0xa000, 0xa3ff) AM_WRITE(timeplt_colorram_w) AM_BASE(&timeplt_colorram)
AM_RANGE(0xa400, 0xa7ff) AM_WRITE(timeplt_videoram_w) AM_BASE(&timeplt_videoram)
AM_RANGE(0xa800, 0xafff) AM_WRITE(MWA8_RAM)
AM_RANGE(0xb000, 0xb00f) AM_WRITE(MWA8_RAM)
AM_RANGE(0xb010, 0xb03f) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
AM_RANGE(0xb040, 0xb40f) AM_WRITE(MWA8_RAM)
AM_RANGE(0xb410, 0xb43f) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram_2)
AM_RANGE(0xb440, 0xbfff) AM_WRITE(MWA8_RAM)
AM_RANGE(0xc000, 0xc000) AM_WRITE(soundlatch_w)
AM_RANGE(0xc200, 0xc200) AM_WRITE(watchdog_reset_w)
AM_RANGE(0xc300, 0xc300) AM_WRITE(interrupt_enable_w)
AM_RANGE(0xc302, 0xc302) AM_WRITE(timeplt_flipscreen_w)
AM_RANGE(0xc304, 0xc304) AM_WRITE(timeplt_sh_irqtrigger_w)
AM_RANGE(0xc30a, 0xc30c) AM_WRITE(timeplt_coin_counter_w) /* c30b is not used */
ADDRESS_MAP_END
#define TIMEPILOT_INPUTS \
PORT_START_TAG("IN0")\
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )\
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )\
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )\
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )\
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )\
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )\
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )\
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )\
PORT_START_TAG("IN1")\
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY\
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY\
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY\
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY\
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )\
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )\
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )\
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )\
PORT_START_TAG("IN2")\
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL\
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL\
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL\
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL\
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL\
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )\
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )\
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
/*************************************
*
* Port definitions
*
*************************************/
static INPUT_PORTS_START( timeplt )
TIMEPILOT_INPUTS
PORT_START_TAG("IN0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START_TAG("IN1")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START_TAG("IN2")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START_TAG("DSW0")
PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) )
@ -196,9 +190,9 @@ TIMEPILOT_INPUTS
INPUT_PORTS_END
static INPUT_PORTS_START( psurge )
TIMEPILOT_INPUTS
PORT_INCLUDE(timeplt)
PORT_START_TAG("DSW0")
PORT_MODIFY("DSW0")
PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
@ -223,7 +217,7 @@ TIMEPILOT_INPUTS
PORT_DIPSETTING( 0x80, DEF_STR( Upright ) )
PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) )
PORT_START_TAG("DSW1")
PORT_MODIFY("DSW1")
PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
PORT_DIPSETTING( 0x02, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x03, DEF_STR( 1C_1C ) )
@ -250,27 +244,32 @@ INPUT_PORTS_END
/*************************************
*
* Graphics layouts
*
*************************************/
static const gfx_layout charlayout =
{
8,8, /* 8*8 characters */
512, /* 512 characters */
2, /* 2 bits per pixel */
8,8,
RGN_FRAC(1,1),
2,
{ 4, 0 },
{ 0, 1, 2, 3, 8*8+0,8*8+1,8*8+2,8*8+3 },
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
16*8 /* every char takes 16 consecutive bytes */
{ STEP4(0,1), STEP4(8*8,1) },
{ STEP8(0,8) },
16*8
};
static const gfx_layout spritelayout =
{
16,16, /* 16*16 sprites */
256, /* 256 sprites */
2, /* 2 bits per pixel */
16,16,
RGN_FRAC(1,1),
2,
{ 4, 0 },
{ 0, 1, 2, 3, 8*8, 8*8+1, 8*8+2, 8*8+3,
16*8+0, 16*8+1, 16*8+2, 16*8+3, 24*8+0, 24*8+1, 24*8+2, 24*8+3 },
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
32*8, 33*8, 34*8, 35*8, 36*8, 37*8, 38*8, 39*8 },
64*8 /* every sprite takes 64 consecutive bytes */
{ STEP4(0,1), STEP4(8*8,1), STEP4(16*8,1), STEP4(24*8,1) },
{ STEP8(0,8), STEP8(32*8,8) },
64*8
};
@ -281,19 +280,20 @@ GFXDECODE_END
/*************************************
*
* Machine drivers
*
*************************************/
static MACHINE_DRIVER_START( timeplt )
/* basic machine hardware */
MDRV_CPU_ADD(Z80, 3072000) /* 3.072 MHz (?) */
MDRV_CPU_PROGRAM_MAP(readmem,writemem)
MDRV_CPU_VBLANK_INT(timeplt_interrupt,256)
MDRV_CPU_ADD(Z80,14318180/8)
/* audio CPU */ /* 1.789772727 MHz */ \
MDRV_CPU_PROGRAM_MAP(timeplt_sound_readmem,timeplt_sound_writemem)
MDRV_CPU_ADD(Z80, MASTER_CLOCK/3/2) /* not confirmed, but common for Konami games of the era */
MDRV_CPU_PROGRAM_MAP(main_map,0)
MDRV_CPU_VBLANK_INT(nmi_line_pulse,1)
MDRV_SCREEN_REFRESH_RATE(60)
MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
/* video hardware */
MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
@ -301,49 +301,23 @@ static MACHINE_DRIVER_START( timeplt )
MDRV_SCREEN_SIZE(32*8, 32*8)
MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MDRV_GFXDECODE(timeplt)
MDRV_PALETTE_LENGTH(32)
MDRV_COLORTABLE_LENGTH(32*4+64*4)
MDRV_PALETTE_LENGTH(32*4+64*4)
MDRV_PALETTE_INIT(timeplt)
MDRV_VIDEO_START(timeplt)
MDRV_VIDEO_UPDATE(timeplt)
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
MDRV_SOUND_ADD(AY8910, 14318180/8)
MDRV_SOUND_CONFIG(timeplt_ay8910_interface)
MDRV_SOUND_ROUTE(0, "filter.0.0", 0.60)
MDRV_SOUND_ROUTE(1, "filter.0.1", 0.60)
MDRV_SOUND_ROUTE(2, "filter.0.2", 0.60)
MDRV_SOUND_ADD(AY8910, 14318180/8)
MDRV_SOUND_ROUTE(0, "filter.1.0", 0.60)
MDRV_SOUND_ROUTE(1, "filter.1.1", 0.60)
MDRV_SOUND_ROUTE(2, "filter.1.2", 0.60)
MDRV_SOUND_ADD_TAG("filter.0.0", FILTER_RC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_SOUND_ADD_TAG("filter.0.1", FILTER_RC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_SOUND_ADD_TAG("filter.0.2", FILTER_RC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_SOUND_ADD_TAG("filter.1.0", FILTER_RC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_SOUND_ADD_TAG("filter.1.1", FILTER_RC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_SOUND_ADD_TAG("filter.1.2", FILTER_RC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_IMPORT_FROM(timeplt_sound)
MACHINE_DRIVER_END
/***************************************************************************
Game driver(s)
***************************************************************************/
/*************************************
*
* ROM definitions
*
*************************************/
ROM_START( timeplt )
ROM_REGION( 0x10000, REGION_CPU1, 0 )
@ -368,6 +342,29 @@ ROM_START( timeplt )
ROM_LOAD( "timeplt.e12", 0x0140, 0x0100, CRC(f7b7663e) SHA1(151bd2dff4e4ef76d6438c1ab2cae71f987b9dad) ) /* char lookup table */
ROM_END
ROM_START( timeplta )
ROM_REGION( 0x10000, REGION_CPU1, 0 )
ROM_LOAD( "cd_e1.bin", 0x0000, 0x2000, CRC(a4513b35) SHA1(1b1944ec5317d71af86e21e0691caae180dee7b5) )
ROM_LOAD( "cd_e2.bin", 0x2000, 0x2000, CRC(38b0c72a) SHA1(8f0950deb2f9e2b65714318b9e837a1c837f52a9) )
ROM_LOAD( "cd_e3.bin", 0x4000, 0x2000, CRC(83846870) SHA1(b1741e7e5674f9e63e113ead0cb7f5ef874eac5f) )
ROM_REGION( 0x10000, REGION_CPU2, 0 )
ROM_LOAD( "tm7", 0x0000, 0x1000, CRC(d66da813) SHA1(408fca4515e8af84211df3e204c8776b2f8adb23) )
ROM_REGION( 0x2000, REGION_GFX1, ROMREGION_DISPOSE )
ROM_LOAD( "tm6", 0x0000, 0x2000, CRC(c2507f40) SHA1(07221875e3f81d9def67c57a7ccd82d52ce65e01) )
ROM_REGION( 0x4000, REGION_GFX2, ROMREGION_DISPOSE )
ROM_LOAD( "tm4", 0x0000, 0x2000, CRC(7e437c3e) SHA1(cbe2ccd2cd503af62f009cd5aab73aa7366230b1) )
ROM_LOAD( "tm5", 0x2000, 0x2000, CRC(e8ca87b9) SHA1(5dd30d3fb9fd8cf9e6a8e37e7ea858c7fd038a7e) )
ROM_REGION( 0x0240, REGION_PROMS, 0 )
ROM_LOAD( "timeplt.b4", 0x0000, 0x0020, CRC(34c91839) SHA1(f62e279e21fce171231d3139be7adabe1f4b8c2e) ) /* palette */
ROM_LOAD( "timeplt.b5", 0x0020, 0x0020, CRC(463b2b07) SHA1(9ad275365eba4869f94749f39ff8705d92056a10) ) /* palette */
ROM_LOAD( "timeplt.e9", 0x0040, 0x0100, CRC(4bbb2150) SHA1(678433b21aae1daa938e32d3293eeed529a42ef9) ) /* sprite lookup table */
ROM_LOAD( "timeplt.e12", 0x0140, 0x0100, CRC(f7b7663e) SHA1(151bd2dff4e4ef76d6438c1ab2cae71f987b9dad) ) /* char lookup table */
ROM_END
ROM_START( timepltc )
ROM_REGION( 0x10000, REGION_CPU1, 0 )
ROM_LOAD( "cd1y", 0x0000, 0x2000, CRC(83ec72c2) SHA1(f3dbc8362f6bdad1baa65cf5d95611e79de381a4) )
@ -414,6 +411,7 @@ ROM_START( spaceplt )
ROM_LOAD( "timeplt.e12", 0x0140, 0x0100, CRC(f7b7663e) SHA1(151bd2dff4e4ef76d6438c1ab2cae71f987b9dad) ) /* char lookup table */
ROM_END
ROM_START( psurge )
ROM_REGION( 0x10000, REGION_CPU1, 0 )
ROM_LOAD( "p1", 0x0000, 0x2000, CRC(05f9ba12) SHA1(ad88838d1a0c64830281e425d4ad2498ba959098) )
@ -438,33 +436,16 @@ ROM_START( psurge )
ROM_LOAD( "timeplt.e12", 0x0140, 0x0100, BAD_DUMP CRC(f7b7663e) SHA1(151bd2dff4e4ef76d6438c1ab2cae71f987b9dad) ) /* char lookup table */
ROM_END
ROM_START( timeplta )
ROM_REGION( 0x10000, REGION_CPU1, 0 )
ROM_LOAD( "cd_e1.bin", 0x0000, 0x2000, CRC(a4513b35) SHA1(1b1944ec5317d71af86e21e0691caae180dee7b5) )
ROM_LOAD( "cd_e2.bin", 0x2000, 0x2000, CRC(38b0c72a) SHA1(8f0950deb2f9e2b65714318b9e837a1c837f52a9) )
ROM_LOAD( "cd_e3.bin", 0x4000, 0x2000, CRC(83846870) SHA1(b1741e7e5674f9e63e113ead0cb7f5ef874eac5f) )
ROM_REGION( 0x10000, REGION_CPU2, 0 )
ROM_LOAD( "tm7", 0x0000, 0x1000, CRC(d66da813) SHA1(408fca4515e8af84211df3e204c8776b2f8adb23) )
ROM_REGION( 0x2000, REGION_GFX1, ROMREGION_DISPOSE )
ROM_LOAD( "tm6", 0x0000, 0x2000, CRC(c2507f40) SHA1(07221875e3f81d9def67c57a7ccd82d52ce65e01) )
ROM_REGION( 0x4000, REGION_GFX2, ROMREGION_DISPOSE )
ROM_LOAD( "tm4", 0x0000, 0x2000, CRC(7e437c3e) SHA1(cbe2ccd2cd503af62f009cd5aab73aa7366230b1) )
ROM_LOAD( "tm5", 0x2000, 0x2000, CRC(e8ca87b9) SHA1(5dd30d3fb9fd8cf9e6a8e37e7ea858c7fd038a7e) )
ROM_REGION( 0x0240, REGION_PROMS, 0 )
ROM_LOAD( "timeplt.b4", 0x0000, 0x0020, CRC(34c91839) SHA1(f62e279e21fce171231d3139be7adabe1f4b8c2e) ) /* palette */
ROM_LOAD( "timeplt.b5", 0x0020, 0x0020, CRC(463b2b07) SHA1(9ad275365eba4869f94749f39ff8705d92056a10) ) /* palette */
ROM_LOAD( "timeplt.e9", 0x0040, 0x0100, CRC(4bbb2150) SHA1(678433b21aae1daa938e32d3293eeed529a42ef9) ) /* sprite lookup table */
ROM_LOAD( "timeplt.e12", 0x0140, 0x0100, CRC(f7b7663e) SHA1(151bd2dff4e4ef76d6438c1ab2cae71f987b9dad) ) /* char lookup table */
ROM_END
/*************************************
*
* Game drivers
*
*************************************/
GAME( 1982, timeplt, 0, timeplt, timeplt, 0, ROT90, "Konami", "Time Pilot", 0 )
GAME( 1982, timepltc, timeplt, timeplt, timeplt, 0, ROT90, "Konami (Centuri license)", "Time Pilot (Centuri)", 0 )
GAME( 1982, timeplta, timeplt, timeplt, timeplt, 0, ROT90, "Konami (Atari license)", "Time Pilot (Atari)", 0 )
GAME( 1982, spaceplt, timeplt, timeplt, timeplt, 0, ROT90, "bootleg", "Space Pilot", 0 )
GAME( 1988, psurge, 0, timeplt, psurge, 0, ROT270, "<unknown>", "Power Surge", 0 )
GAME( 1982, timeplt, 0, timeplt, timeplt, 0, ROT90, "Konami", "Time Pilot", GAME_SUPPORTS_SAVE )
GAME( 1982, timepltc, timeplt, timeplt, timeplt, 0, ROT90, "Konami (Centuri license)", "Time Pilot (Centuri)", GAME_SUPPORTS_SAVE )
GAME( 1982, timeplta, timeplt, timeplt, timeplt, 0, ROT90, "Konami (Atari license)", "Time Pilot (Atari)", GAME_SUPPORTS_SAVE )
GAME( 1982, spaceplt, timeplt, timeplt, timeplt, 0, ROT90, "bootleg", "Space Pilot", GAME_SUPPORTS_SAVE )
GAME( 1988, psurge, 0, timeplt, psurge, 0, ROT270, "<unknown>", "Power Surge", GAME_SUPPORTS_SAVE )

View File

@ -1,205 +1,84 @@
/***************************************************************************
Tutankham : memory map (preliminary)
Tutankham
driver by Mirko Buffoni
driver by Mirko Buffoni
based on original work by Rob Jarrett
I include here the document based on Rob Jarrett's research because it's
really exaustive.
I include here the document based on Rob Jarrett's research because it's
really exaustive.
Tutankham Emu Info
------------------
By Rob Jarrett
robj@astound.com (until June 20, 1997)
or robncait@inforamp.net
Special thanks go to Pete Custerson for the schematics!!
I've recently been working on an emulator for Tutankham. Unfortunately,
time and resources are not on my side so I'd like to provide anyone with
the technical information I've gathered so far, that way someone can
finish the project.
First of all, I'd like to say that I've had no prior experience in
writing an emulator, and my hardware knowledge is weak. I've managed to
find out a fair amount by looking at the schematics of the game and the
disassembled ROMs. Using the USim C++ 6809 core I have the game sort of
up and running, albeit in a pathetic state. It's not playable, and
crashes after a short amount of time. I don't feel the source code is
worth releasing because of the bad design; I was using it as a testing
bed and anticipated rewriting everything in the future.
Here's all the info I know about Tutankham:
Processor: 6809
Sound: Z80 slave w/2 AY3910 sound chips
Graphics: Bitmapped display, no sprites (!)
Memory Map:
Address R/W Bits Function
------------------------------------------------------------------------------------------------------
$0000-$7fff Video RAM
- Screen is stored sideways, 256x256 pixels
- 1 byte=2 pixels
R/W aaaaxxxx - leftmost pixel palette index
R/W xxxxbbbb - rightmost pixel palette index
- **** not correct **** Looks like some of this memory is for I/O state, (I think < $0100)
so you might want to blit from $0100-$7fff
$8000-$800f R/W aaaaaaaa Palette colors
- Don't know how to decode them into RGB values
$8100 W Not sure
- Video chip function of some sort
( split screen y pan position -- TT )
$8120 R Not sure
- Read from quite frequently
- Some sort of video or interrupt thing?
- Or a random number seed?
( watchdog reset -- NS )
$8160 Dip Switch 2
- Inverted bits (ie. 1=off)
R xxxxxxxa DSWI1
R
R .
R .
R .
R
R
R axxxxxxx DSWI8
$8180 I/O: Coin slots, service, 1P/2P buttons
R
$81a0 Player 1 I/O
R
$81c0 Player 2 I/O
R
$81e0 Dip Switch 1
- Inverted bits
R xxxxxxxa DSWI1
R
R .
R .
R .
R
R
R axxxxxxx DSWI8
$8200 IST on schematics
- Enable/disable IRQ
R/W xxxxxxxa - a=1 IRQ can be fired, a=0 IRQ can't be fired
$8202 OUT2 (Coin counter)
W xxxxxxxa - Increment coin counter
$8203 OUT1 (Coin counter)
W xxxxxxxa - Increment coin counter
$8204 Not sure - 401 on schematics
W
$8205 MUT on schematics
R/W xxxxxxxa - Sound amplification on/off?
$8206 HFF on schematics
W - Don't know what it does
( horizontal screen flip -- NS )
$8207 Not sure - can't resolve on schematics
W
( vertical screen flip -- NS )
$8300 Graphics bank select
W xxxxxaaa - Selects graphics ROM 0-11 that appears at $9000-9fff
- But wait! There's only 9 ROMs not 12! I think the PCB allows 12
ROMs for patches/mods to the game. Just make 9-11 return 0's
$8600 W SON on schematics
( trigger interrupt on audio CPU -- NS )
$8608 R/W SON on schematics
- Sound on/off? i.e. Run/halt Z80 sound CPU?
$8700 W aaaaaaaa SDA on schematics
- Sound data? Maybe Z80 polls here and plays the appropriate sound?
- If so, easy to trigger samples here
$8800-$8fff RAM
R/W - Memory for the program ROMs
$9000-$9fff Graphics ROMs ra1_1i.cpu - ra1_9i.cpu
R aaaaaaaa - See address $8300 for usage
$a000-$afff ROM ra1_1h.cpu
R aaaaaaaa - 6809 Code
$b000-$bfff ROM ra1_2h.cpu
R aaaaaaaa - 6809 Code
$c000-$cfff ROM ra1_3h.cpu
R aaaaaaaa - 6809 Code
$d000-$dfff ROM ra1_4h.cpu
R aaaaaaaa - 6809 Code
$e000-$efff ROM ra1_5h.cpu
R aaaaaaaa - 6809 Code
$f000-$ffff ROM ra1_6h.cpu
R aaaaaaaa - 6809 Code
Programming notes:
I found that generating an IRQ every 4096 instructions seemed to kinda work. Again, I know
little about emu writing and I think some fooling with this number might be needed.
Sorry I didn't supply the DSW and I/O bits, this info is available elsewhere on the net, I
think at tant or something. I just couldn't remember what they were at this writing!!
If there are any questions at all, please feel free to email me at robj@astound.com (until
June 20, 1997) or robncait@inforamp.net.
BTW, this information is completely free - do as you wish with it. I'm not even sure if it's
correct! (Most of it seems to be). Giving me some credit if credit is due would be nice,
and please let me know about your emulator if you release it.
Sound board: uses the same board as Pooyan.
Sound board: uses the same board as Pooyan.
***************************************************************************/
#include "driver.h"
#include "deprecat.h"
#include "tutankhm.h"
#include "cpu/m6809/m6809.h"
#include "audio/timeplt.h"
extern UINT8 *tutankhm_videoram;
extern size_t tutankhm_videoram_size;
extern UINT8 *tutankhm_paletteram;
extern UINT8 *tutankhm_scroll;
static UINT8 irq_toggle;
static UINT8 irq_enable;
WRITE8_HANDLER( tutankhm_flip_screen_x_w );
WRITE8_HANDLER( tutankhm_flip_screen_y_w );
VIDEO_UPDATE( tutankhm );
/*************************************
*
* Interrupts
*
*************************************/
static INTERRUPT_GEN( tutankhm_interrupt )
{
/* flip flops cause the interrupt to be signalled every other frame */
irq_toggle ^= 1;
if (irq_toggle && irq_enable)
cpunum_set_input_line(machine, 0, 0, ASSERT_LINE);
}
static WRITE8_HANDLER( irq_enable_w )
{
irq_enable = data & 1;
if (!irq_enable)
cpunum_set_input_line(Machine, 0, 0, CLEAR_LINE);
}
/*************************************
*
* Bank selection
*
*************************************/
static MACHINE_START( tutankhm )
{
memory_configure_bank(1, 0, 16, memory_region(REGION_CPU1) + 0x10000, 0x1000);
state_save_register_global(irq_toggle);
state_save_register_global(irq_enable);
}
static WRITE8_HANDLER( tutankhm_bankselect_w )
{
offs_t bankaddress;
UINT8 *RAM = memory_region(REGION_CPU1);
memory_set_bank(1, data & 0x0f);
}
bankaddress = 0x10000 + (data & 0x0f) * 0x1000;
memory_set_bankptr(1,&RAM[bankaddress]);
/*************************************
*
* Outputs
*
*************************************/
static WRITE8_HANDLER( sound_mute_w )
{
sound_global_enable(~data & 1);
}
@ -209,30 +88,44 @@ static WRITE8_HANDLER( tutankhm_coin_counter_w )
}
/*************************************
*
* Main CPU memory handlers
*
*************************************/
static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_RAM AM_BASE(&tutankhm_videoram) AM_SIZE(&tutankhm_videoram_size)
AM_RANGE(0x8000, 0x800f) AM_RAM AM_BASE(&tutankhm_paletteram)
AM_RANGE(0x8100, 0x8100) AM_RAM AM_BASE(&tutankhm_scroll)
AM_RANGE(0x8120, 0x8120) AM_READ(watchdog_reset_r)
AM_RANGE(0x8160, 0x8160) AM_READ(input_port_0_r) /* DSW2 (inverted bits) */
AM_RANGE(0x8180, 0x8180) AM_READ(input_port_1_r) /* IN0 I/O: Coin slots, service, 1P/2P buttons */
AM_RANGE(0x81a0, 0x81a0) AM_READ(input_port_2_r) /* IN1: Player 1 I/O */
AM_RANGE(0x81c0, 0x81c0) AM_READ(input_port_3_r) /* IN2: Player 2 I/O */
AM_RANGE(0x81e0, 0x81e0) AM_READ(input_port_4_r) /* DSW1 (inverted bits) */
AM_RANGE(0x8200, 0x8200) AM_WRITE(interrupt_enable_w)
AM_RANGE(0x8202, 0x8203) AM_WRITE(tutankhm_coin_counter_w)
AM_RANGE(0x8205, 0x8205) AM_WRITE(MWA8_NOP) /* ??? */
AM_RANGE(0x8206, 0x8206) AM_WRITE(tutankhm_flip_screen_x_w)
AM_RANGE(0x8207, 0x8207) AM_WRITE(tutankhm_flip_screen_y_w)
AM_RANGE(0x8300, 0x8300) AM_WRITE(tutankhm_bankselect_w)
AM_RANGE(0x8600, 0x8600) AM_WRITE(timeplt_sh_irqtrigger_w)
AM_RANGE(0x8700, 0x8700) AM_WRITE(soundlatch_w)
AM_RANGE(0x0000, 0x7fff) AM_RAM AM_BASE(&videoram) AM_SIZE(&videoram_size)
AM_RANGE(0x8000, 0x800f) AM_MIRROR(0x00f0) AM_RAM AM_BASE(&paletteram)
AM_RANGE(0x8100, 0x8100) AM_MIRROR(0x000f) AM_RAM AM_BASE(&tutankhm_scroll)
AM_RANGE(0x8120, 0x8120) AM_MIRROR(0x000f) AM_READ(watchdog_reset_r)
AM_RANGE(0x8160, 0x8160) AM_MIRROR(0x000f) AM_READ_PORT("DSW2") /* DSW2 (inverted bits) */
AM_RANGE(0x8180, 0x8180) AM_MIRROR(0x000f) AM_READ_PORT("IN0") /* IN0 I/O: Coin slots, service, 1P/2P buttons */
AM_RANGE(0x81a0, 0x81a0) AM_MIRROR(0x000f) AM_READ_PORT("IN1") /* IN1: Player 1 I/O */
AM_RANGE(0x81c0, 0x81c0) AM_MIRROR(0x000f) AM_READ_PORT("IN2") /* IN2: Player 2 I/O */
AM_RANGE(0x81e0, 0x81e0) AM_MIRROR(0x000f) AM_READ_PORT("DSW1") /* DSW1 (inverted bits) */
AM_RANGE(0x8200, 0x8200) AM_MIRROR(0x00f8) AM_READWRITE(MRA8_NOP, irq_enable_w)
AM_RANGE(0x8202, 0x8203) AM_MIRROR(0x00f8) AM_WRITE(tutankhm_coin_counter_w)
AM_RANGE(0x8205, 0x8205) AM_MIRROR(0x00f8) AM_WRITE(sound_mute_w)
AM_RANGE(0x8206, 0x8206) AM_MIRROR(0x00f8) AM_WRITE(tutankhm_flip_screen_x_w)
AM_RANGE(0x8207, 0x8207) AM_MIRROR(0x00f8) AM_WRITE(tutankhm_flip_screen_y_w)
AM_RANGE(0x8300, 0x8300) AM_MIRROR(0x00ff) AM_WRITE(tutankhm_bankselect_w)
AM_RANGE(0x8600, 0x8600) AM_MIRROR(0x00ff) AM_WRITE(timeplt_sh_irqtrigger_w)
AM_RANGE(0x8700, 0x8700) AM_MIRROR(0x00ff) AM_WRITE(soundlatch_w)
AM_RANGE(0x8800, 0x8fff) AM_RAM
AM_RANGE(0x9000, 0x9fff) AM_READ(MRA8_BANK1)
AM_RANGE(0x9000, 0x9fff) AM_ROMBANK(1)
AM_RANGE(0xa000, 0xffff) AM_ROM
ADDRESS_MAP_END
/*************************************
*
* Port definitions
*
*************************************/
static INPUT_PORTS_START( tutankhm )
PORT_START_TAG("DSW2")
PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
@ -328,19 +221,23 @@ INPUT_PORTS_END
/*************************************
*
* Machine drivers
*
*************************************/
static MACHINE_DRIVER_START( tutankhm )
/* basic machine hardware */
MDRV_CPU_ADD(M6809, 1500000) /* 1.5 MHz ??? */
MDRV_CPU_PROGRAM_MAP(main_map,0)
MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
MDRV_CPU_VBLANK_INT(tutankhm_interrupt,1)
MDRV_CPU_ADD(Z80,14318180/8)
/* audio CPU */ /* 1.789772727 MHz */ \
MDRV_CPU_PROGRAM_MAP(timeplt_sound_readmem,timeplt_sound_writemem)
MDRV_MACHINE_START(tutankhm)
MDRV_SCREEN_REFRESH_RATE(30)
MDRV_SCREEN_VBLANK_TIME(DEFAULT_30HZ_VBLANK_DURATION)
MDRV_SCREEN_REFRESH_RATE(60)
MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
/* video hardware */
MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
@ -348,38 +245,21 @@ static MACHINE_DRIVER_START( tutankhm )
MDRV_SCREEN_SIZE(32*8, 32*8)
MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) /* not sure about the visible area */
MDRV_VIDEO_START(tutankhm)
MDRV_VIDEO_UPDATE(tutankhm)
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
MDRV_SOUND_ADD(AY8910, 14318180/8)
MDRV_SOUND_CONFIG(timeplt_ay8910_interface)
MDRV_SOUND_ROUTE(0, "filter.0.0", 0.60)
MDRV_SOUND_ROUTE(1, "filter.0.1", 0.60)
MDRV_SOUND_ROUTE(2, "filter.0.2", 0.60)
MDRV_SOUND_ADD(AY8910, 14318180/8)
MDRV_SOUND_ROUTE(0, "filter.1.0", 0.60)
MDRV_SOUND_ROUTE(1, "filter.1.1", 0.60)
MDRV_SOUND_ROUTE(2, "filter.1.2", 0.60)
MDRV_SOUND_ADD_TAG("filter.0.0", FILTER_RC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_SOUND_ADD_TAG("filter.0.1", FILTER_RC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_SOUND_ADD_TAG("filter.0.2", FILTER_RC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_SOUND_ADD_TAG("filter.1.0", FILTER_RC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_SOUND_ADD_TAG("filter.1.1", FILTER_RC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_SOUND_ADD_TAG("filter.1.2", FILTER_RC, 0)
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MDRV_IMPORT_FROM(timeplt_sound)
MACHINE_DRIVER_END
/*************************************
*
* ROM definitions
*
*************************************/
ROM_START( tutankhm )
ROM_REGION( 0x20000, REGION_CPU1, 0 ) /* 64k for M6809 CPU code + 64k for ROM banks */
ROM_LOAD( "h1.bin", 0x0a000, 0x1000, CRC(da18679f) SHA1(8d2a3665db937d0e1d19300ae22277d9db61fcbc) ) /* program ROMs */
@ -431,5 +311,11 @@ ROM_END
GAME( 1982, tutankhm, 0, tutankhm, tutankhm, 0, ROT90, "Konami", "Tutankham", 0 )
GAME( 1982, tutankst, tutankhm, tutankhm, tutankhm, 0, ROT90, "[Konami] (Stern license)", "Tutankham (Stern)", 0 )
/*************************************
*
* Game drivers
*
*************************************/
GAME( 1982, tutankhm, 0, tutankhm, tutankhm, 0, ROT90, "Konami", "Tutankham", GAME_SUPPORTS_SAVE )
GAME( 1982, tutankst, tutankhm, tutankhm, tutankhm, 0, ROT90, "[Konami] (Stern license)", "Tutankham (Stern)", GAME_SUPPORTS_SAVE )

View File

@ -7,7 +7,7 @@
#include "sound/custom.h"
#define EXIDY440_MASTER_CLOCK (12979200)
#define EXIDY440_MASTER_CLOCK (XTAL_12_9792MHz)
#define EXIDY440_MAIN_CPU_CLOCK (EXIDY440_MASTER_CLOCK / 8)
#define EXIDY440_PIXEL_CLOCK (EXIDY440_MASTER_CLOCK / 2)
#define EXIDY440_HTOTAL (0x1a0)

View File

@ -0,0 +1,18 @@
/***************************************************************************
Time Pilot
***************************************************************************/
/*----------- defined in video/timeplt.c -----------*/
READ8_HANDLER( timeplt_scanline_r );
WRITE8_HANDLER( timeplt_videoram_w );
WRITE8_HANDLER( timeplt_colorram_w );
WRITE8_HANDLER( timeplt_flipscreen_w );
VIDEO_START( timeplt );
PALETTE_INIT( timeplt );
VIDEO_UPDATE( timeplt );
INTERRUPT_GEN( timeplt_interrupt );

View File

@ -0,0 +1,17 @@
/***************************************************************************
Tutankham
***************************************************************************/
/*----------- defined in video/tutankhm.c -----------*/
extern UINT8 *tutankhm_scroll;
WRITE8_HANDLER( tutankhm_flip_screen_x_w );
WRITE8_HANDLER( tutankhm_flip_screen_y_w );
VIDEO_START( tutankhm );
VIDEO_UPDATE( tutankhm );
WRITE8_HANDLER( junofrst_blitter_w );

View File

@ -1,14 +1,8 @@
#include "driver.h"
#include "timeplt.h"
UINT8 *timeplt_videoram,*timeplt_colorram;
static tilemap *bg_tilemap;
/*
sprites are multiplexed, so we have to buffer the spriteram
scanline by scanline.
*/
static UINT8 *sprite_mux_buffer,*sprite_mux_buffer_2;
static int scanline;
static emu_timer *scanline_timer;
/***************************************************************************
@ -40,49 +34,46 @@ static int scanline;
***************************************************************************/
PALETTE_INIT( timeplt )
{
rgb_t palette[32];
int i;
#define TOTAL_COLORS(gfxn) (machine->gfx[gfxn]->total_colors * machine->gfx[gfxn]->color_granularity)
#define COLOR(gfxn,offs) (colortable[machine->drv->gfxdecodeinfo[gfxn].color_codes_start + offs])
for (i = 0;i < machine->drv->total_colors;i++)
for (i = 0;i < 32;i++)
{
int bit0,bit1,bit2,bit3,bit4,r,g,b;
bit0 = (color_prom[i + machine->drv->total_colors] >> 1) & 0x01;
bit1 = (color_prom[i + machine->drv->total_colors] >> 2) & 0x01;
bit2 = (color_prom[i + machine->drv->total_colors] >> 3) & 0x01;
bit3 = (color_prom[i + machine->drv->total_colors] >> 4) & 0x01;
bit4 = (color_prom[i + machine->drv->total_colors] >> 5) & 0x01;
bit0 = (color_prom[i + 1*32] >> 1) & 0x01;
bit1 = (color_prom[i + 1*32] >> 2) & 0x01;
bit2 = (color_prom[i + 1*32] >> 3) & 0x01;
bit3 = (color_prom[i + 1*32] >> 4) & 0x01;
bit4 = (color_prom[i + 1*32] >> 5) & 0x01;
r = 0x19 * bit0 + 0x24 * bit1 + 0x35 * bit2 + 0x40 * bit3 + 0x4d * bit4;
bit0 = (color_prom[i + machine->drv->total_colors] >> 6) & 0x01;
bit1 = (color_prom[i + machine->drv->total_colors] >> 7) & 0x01;
bit2 = (color_prom[i] >> 0) & 0x01;
bit3 = (color_prom[i] >> 1) & 0x01;
bit4 = (color_prom[i] >> 2) & 0x01;
bit0 = (color_prom[i + 1*32] >> 6) & 0x01;
bit1 = (color_prom[i + 1*32] >> 7) & 0x01;
bit2 = (color_prom[i + 0*32] >> 0) & 0x01;
bit3 = (color_prom[i + 0*32] >> 1) & 0x01;
bit4 = (color_prom[i + 0*32] >> 2) & 0x01;
g = 0x19 * bit0 + 0x24 * bit1 + 0x35 * bit2 + 0x40 * bit3 + 0x4d * bit4;
bit0 = (color_prom[i] >> 3) & 0x01;
bit1 = (color_prom[i] >> 4) & 0x01;
bit2 = (color_prom[i] >> 5) & 0x01;
bit3 = (color_prom[i] >> 6) & 0x01;
bit4 = (color_prom[i] >> 7) & 0x01;
bit0 = (color_prom[i + 0*32] >> 3) & 0x01;
bit1 = (color_prom[i + 0*32] >> 4) & 0x01;
bit2 = (color_prom[i + 0*32] >> 5) & 0x01;
bit3 = (color_prom[i + 0*32] >> 6) & 0x01;
bit4 = (color_prom[i + 0*32] >> 7) & 0x01;
b = 0x19 * bit0 + 0x24 * bit1 + 0x35 * bit2 + 0x40 * bit3 + 0x4d * bit4;
palette_set_color(machine,i,MAKE_RGB(r,g,b));
palette[i] = MAKE_RGB(r,g,b);
}
color_prom += 2*machine->drv->total_colors;
color_prom += 2*32;
/* color_prom now points to the beginning of the lookup table */
/* sprites */
for (i = 0;i < TOTAL_COLORS(1);i++)
COLOR(1,i) = *(color_prom++) & 0x0f;
for (i = 0;i < 64*4;i++)
palette_set_color(machine, 32*4 + i, palette[*color_prom++ & 0x0f]);
/* characters */
for (i = 0;i < TOTAL_COLORS(0);i++)
COLOR(0,i) = (*(color_prom++) & 0x0f) + 0x10;
for (i = 0;i < 32*4;i++)
palette_set_color(machine, i, palette[(*color_prom++ & 0x0f) + 0x10]);
}
@ -95,13 +86,13 @@ PALETTE_INIT( timeplt )
static TILE_GET_INFO( get_tile_info )
{
UINT8 attr = timeplt_colorram[tile_index];
UINT8 attr = colorram[tile_index];
tileinfo->category = (attr & 0x10) >> 4;
SET_TILE_INFO(
0,
timeplt_videoram[tile_index] + ((attr & 0x20) << 3),
videoram[tile_index] + ((attr & 0x20) << 3),
attr & 0x1f,
TILE_FLIPYX((attr & 0xc0) >> 6));
TILE_FLIPYX(attr >> 6));
}
@ -112,12 +103,25 @@ static TILE_GET_INFO( get_tile_info )
***************************************************************************/
static TIMER_CALLBACK( scanline_interrupt )
{
int scanline = param;
video_screen_update_partial(0, scanline - 1);
scanline++;
if (scanline > machine->screen[0].visarea.max_y)
scanline = machine->screen[0].visarea.min_y;
timer_adjust(scanline_timer, video_screen_get_time_until_pos(0, scanline, 0), scanline, attotime_never);
}
VIDEO_START( timeplt )
{
bg_tilemap = tilemap_create(get_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,32,32);
sprite_mux_buffer = auto_malloc(256 * spriteram_size);
sprite_mux_buffer_2 = auto_malloc(256 * spriteram_size);
scanline_timer = timer_alloc(scanline_interrupt, NULL);
timer_adjust(scanline_timer, video_screen_get_time_until_pos(0, 0, 0), 0, attotime_never);
}
@ -130,13 +134,13 @@ VIDEO_START( timeplt )
WRITE8_HANDLER( timeplt_videoram_w )
{
timeplt_videoram[offset] = data;
videoram[offset] = data;
tilemap_mark_tile_dirty(bg_tilemap,offset);
}
WRITE8_HANDLER( timeplt_colorram_w )
{
timeplt_colorram[offset] = data;
colorram[offset] = data;
tilemap_mark_tile_dirty(bg_tilemap,offset);
}
@ -145,10 +149,9 @@ WRITE8_HANDLER( timeplt_flipscreen_w )
flip_screen_set(~data & 1);
}
/* Return the current video scan line */
READ8_HANDLER( timeplt_scanline_r )
{
return scanline;
return video_screen_get_vpos(0);
}
@ -162,44 +165,26 @@ READ8_HANDLER( timeplt_scanline_r )
static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
{
const gfx_element *gfx = machine->gfx[1];
rectangle clip = *cliprect;
int offs;
int line;
for (line = 0;line < 256;line++)
for (offs = 0x3e;offs >= 0x10;offs -= 2)
{
if (line >= cliprect->min_y && line <= cliprect->max_y)
{
UINT8 *sr,*sr2;
int code,color,sx,sy,flipx,flipy;
sr = sprite_mux_buffer + line * spriteram_size;
sr2 = sprite_mux_buffer_2 + line * spriteram_size;
clip.min_y = clip.max_y = line;
sx = spriteram[offs];
sy = 240 - spriteram_2[offs + 1];
for (offs = spriteram_size - 2;offs >= 0;offs -= 2)
{
int code,color,sx,sy,flipx,flipy;
code = spriteram[offs + 1];
color = spriteram_2[offs] & 0x3f;
flipx = ~spriteram_2[offs] & 0x40;
flipy = spriteram_2[offs] & 0x80;
sx = sr[offs];
sy = 241 - sr2[offs + 1];
if (sy > line-16 && sy <= line)
{
code = sr[offs + 1];
color = sr2[offs] & 0x3f;
flipx = ~sr2[offs] & 0x40;
flipy = sr2[offs] & 0x80;
drawgfx(bitmap,gfx,
code,
color,
flipx,flipy,
sx,sy,
&clip,TRANSPARENCY_PEN,0);
}
}
}
drawgfx(bitmap,gfx,
code,
color,
flipx,flipy,
sx,sy,
cliprect,TRANSPARENCY_PEN,0);
}
}
@ -210,15 +195,3 @@ VIDEO_UPDATE( timeplt )
tilemap_draw(bitmap,cliprect,bg_tilemap,1,0);
return 0;
}
INTERRUPT_GEN( timeplt_interrupt )
{
scanline = 255 - cpu_getiloops();
memcpy(sprite_mux_buffer + scanline * spriteram_size,spriteram,spriteram_size);
memcpy(sprite_mux_buffer_2 + scanline * spriteram_size,spriteram_2,spriteram_size);
if (scanline == 255)
nmi_line_pulse(machine, cpunum);
}

View File

@ -8,14 +8,12 @@
#include "driver.h"
#include "tutankhm.h"
#define NUM_PENS (0x10)
UINT8 *tutankhm_videoram;
size_t tutankhm_videoram_size;
UINT8 *tutankhm_paletteram;
UINT8 *tutankhm_scroll;
static UINT8 junofrst_blitterdata[4];
@ -42,13 +40,21 @@ static void get_pens(pen_t *pens)
for (i = 0; i < NUM_PENS; i++)
{
UINT8 data = tutankhm_paletteram[i];
UINT8 data = paletteram[i];
pens[i] = MAKE_RGB(pal3bit(data >> 0), pal3bit(data >> 3), pal2bit(data >> 6));
}
}
VIDEO_START( tutankhm )
{
state_save_register_global_array(junofrst_blitterdata);
state_save_register_global(tutankhm_flip_screen_x);
state_save_register_global(tutankhm_flip_screen_y);
}
VIDEO_UPDATE( tutankhm )
{
pen_t pens[NUM_PENS];
@ -56,11 +62,11 @@ VIDEO_UPDATE( tutankhm )
get_pens(pens);
for (offs = 0; offs < tutankhm_videoram_size; offs++)
for (offs = 0; offs < videoram_size; offs++)
{
int i;
UINT8 data = tutankhm_videoram[offs];
UINT8 data = videoram[offs];
UINT8 y = offs >> 7;
UINT8 x = offs << 1;
@ -150,9 +156,9 @@ WRITE8_HANDLER( junofrst_blitter_w )
data = 0;
if (dest & 1)
tutankhm_videoram[dest >> 1] = (tutankhm_videoram[dest >> 1] & 0x0f) | (data << 4);
videoram[dest >> 1] = (videoram[dest >> 1] & 0x0f) | (data << 4);
else
tutankhm_videoram[dest >> 1] = (tutankhm_videoram[dest >> 1] & 0xf0) | data;
videoram[dest >> 1] = (videoram[dest >> 1] & 0xf0) | data;
}
dest = dest + 1;