mirror of
https://github.com/holub/mame
synced 2025-06-30 07:58:56 +03:00
tp84: Replaces sprite multiplexing hack with video_screen_update_now() on sprite RAM write
General driver clean-up tilemap.h: Deletes no longer applicable comment
This commit is contained in:
parent
2ddf3da8dd
commit
1a0ccf8101
@ -366,7 +366,6 @@
|
|||||||
/* Macros for setting tile attributes in the TILE_GET_INFO callback: */
|
/* Macros for setting tile attributes in the TILE_GET_INFO callback: */
|
||||||
/* TILE_FLIP_YX assumes that flipy is in bit 1 and flipx is in bit 0 */
|
/* TILE_FLIP_YX assumes that flipy is in bit 1 and flipx is in bit 0 */
|
||||||
/* TILE_FLIP_XY assumes that flipy is in bit 0 and flipx is in bit 1 */
|
/* TILE_FLIP_XY assumes that flipy is in bit 0 and flipx is in bit 1 */
|
||||||
/* TILE_GROUP shifts a split group number appropriately to OR into the tile flags */
|
|
||||||
#define TILE_FLIPYX(YX) ((YX) & 3)
|
#define TILE_FLIPYX(YX) ((YX) & 3)
|
||||||
#define TILE_FLIPXY(XY) ((((XY) & 2) >> 1) | (((XY) & 1) << 1))
|
#define TILE_FLIPXY(XY) ((((XY) & 2) >> 1) | (((XY) & 1) << 1))
|
||||||
|
|
||||||
|
@ -4,23 +4,6 @@ Time Pilot 84 (c) 1984 Konami
|
|||||||
|
|
||||||
driver by Marc Lafontaine
|
driver by Marc Lafontaine
|
||||||
|
|
||||||
TODO:
|
|
||||||
- the slave CPU multiplexes sprites. We are cheating now, and reading them
|
|
||||||
from somewhere else.
|
|
||||||
|
|
||||||
|
|
||||||
The schematics are available on the net.
|
|
||||||
|
|
||||||
There is 3 CPU for this game.
|
|
||||||
Two 68A09E for the game.
|
|
||||||
A Z80A for the sound
|
|
||||||
|
|
||||||
As I understand it, the second 6809 is for displaying
|
|
||||||
the sprites. If we do not emulate him, all work well, except
|
|
||||||
that the player cannot die.
|
|
||||||
Address 57ff must read 0 to pass the RAM test if the second CPU
|
|
||||||
is not emulated.
|
|
||||||
|
|
||||||
|
|
||||||
---- Master 6809 ------
|
---- Master 6809 ------
|
||||||
|
|
||||||
@ -57,7 +40,7 @@ Read/Write
|
|||||||
|
|
||||||
------ Slave 6809 --------
|
------ Slave 6809 --------
|
||||||
0000-1fff SAFR Watch dog ?
|
0000-1fff SAFR Watch dog ?
|
||||||
2000 seem to be the beam position (if always 0, no player collision is detected)
|
2000 beam position
|
||||||
4000 enable or reset IRQ
|
4000 enable or reset IRQ
|
||||||
6000-67ff DRA
|
6000-67ff DRA
|
||||||
8000-87ff Ram (Common for the Master and Slave 6809)
|
8000-87ff Ram (Common for the Master and Slave 6809)
|
||||||
@ -87,25 +70,24 @@ C004 76489 #4 trigger
|
|||||||
#include "sound/flt_rc.h"
|
#include "sound/flt_rc.h"
|
||||||
|
|
||||||
|
|
||||||
extern UINT8 *tp84_videoram2, *tp84_colorram2;
|
extern UINT8 *tp84_bg_videoram;
|
||||||
|
extern UINT8 *tp84_bg_colorram;
|
||||||
|
extern UINT8 *tp84_fg_videoram;
|
||||||
|
extern UINT8 *tp84_fg_colorram;
|
||||||
|
extern UINT8 *tp84_spriteram;
|
||||||
|
extern UINT8 *tp84_scroll_x;
|
||||||
|
extern UINT8 *tp84_scroll_y;
|
||||||
|
extern UINT8 *tp84_palette_bank;
|
||||||
|
extern UINT8 *tp84_flipscreen_x;
|
||||||
|
extern UINT8 *tp84_flipscreen_y;
|
||||||
|
|
||||||
WRITE8_HANDLER( tp84_videoram_w );
|
WRITE8_HANDLER( tp84_spriteram_w );
|
||||||
WRITE8_HANDLER( tp84_colorram_w );
|
|
||||||
WRITE8_HANDLER( tp84_videoram2_w );
|
|
||||||
WRITE8_HANDLER( tp84_colorram2_w );
|
|
||||||
WRITE8_HANDLER( tp84_scroll_x_w );
|
|
||||||
WRITE8_HANDLER( tp84_scroll_y_w );
|
|
||||||
WRITE8_HANDLER( tp84_flipscreen_x_w );
|
|
||||||
WRITE8_HANDLER( tp84_flipscreen_y_w );
|
|
||||||
WRITE8_HANDLER( tp84_col0_w );
|
|
||||||
READ8_HANDLER( tp84_scanline_r );
|
READ8_HANDLER( tp84_scanline_r );
|
||||||
|
|
||||||
PALETTE_INIT( tp84 );
|
PALETTE_INIT( tp84 );
|
||||||
VIDEO_START( tp84 );
|
VIDEO_START( tp84 );
|
||||||
VIDEO_UPDATE( tp84 );
|
VIDEO_UPDATE( tp84 );
|
||||||
|
|
||||||
INTERRUPT_GEN( tp84_6809_interrupt );
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static READ8_HANDLER( tp84_sh_timer_r )
|
static READ8_HANDLER( tp84_sh_timer_r )
|
||||||
@ -117,6 +99,7 @@ static READ8_HANDLER( tp84_sh_timer_r )
|
|||||||
return (activecpu_gettotalcycles() / (2048/2)) & 0x0f;
|
return (activecpu_gettotalcycles() / (2048/2)) & 0x0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static WRITE8_HANDLER( tp84_filter_w )
|
static WRITE8_HANDLER( tp84_filter_w )
|
||||||
{
|
{
|
||||||
int C;
|
int C;
|
||||||
@ -151,89 +134,65 @@ static WRITE8_HANDLER( tp84_sh_irqtrigger_w )
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* CPU 1 read addresses */
|
static ADDRESS_MAP_START( tp84_cpu1_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||||
static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
|
AM_RANGE(0x2000, 0x2000) AM_WRITE(watchdog_reset_w)
|
||||||
AM_RANGE(0x2800, 0x2800) AM_READ(input_port_0_r)
|
AM_RANGE(0x2800, 0x2800) AM_READWRITE(input_port_0_r, MWA8_RAM) AM_BASE(&tp84_palette_bank)
|
||||||
AM_RANGE(0x2820, 0x2820) AM_READ(input_port_1_r)
|
AM_RANGE(0x2820, 0x2820) AM_READ(input_port_1_r)
|
||||||
AM_RANGE(0x2840, 0x2840) AM_READ(input_port_2_r)
|
AM_RANGE(0x2840, 0x2840) AM_READ(input_port_2_r)
|
||||||
AM_RANGE(0x2860, 0x2860) AM_READ(input_port_3_r)
|
AM_RANGE(0x2860, 0x2860) AM_READ(input_port_3_r)
|
||||||
AM_RANGE(0x3000, 0x3000) AM_READ(input_port_4_r)
|
AM_RANGE(0x3000, 0x3000) AM_READWRITE(input_port_4_r, MWA8_RAM)
|
||||||
AM_RANGE(0x4000, 0x4fff) AM_READ(MRA8_RAM)
|
AM_RANGE(0x3004, 0x3004) AM_WRITE(MWA8_RAM) AM_BASE(&tp84_flipscreen_x)
|
||||||
AM_RANGE(0x5000, 0x57ff) AM_READ(MRA8_RAM) AM_SHARE(1)
|
AM_RANGE(0x3005, 0x3005) AM_WRITE(MWA8_RAM) AM_BASE(&tp84_flipscreen_y)
|
||||||
AM_RANGE(0x8000, 0xffff) AM_READ(MRA8_ROM)
|
|
||||||
ADDRESS_MAP_END
|
|
||||||
|
|
||||||
/* CPU 1 write addresses */
|
|
||||||
static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
|
|
||||||
AM_RANGE(0x2000, 0x2000) AM_WRITE(watchdog_reset_w)
|
|
||||||
AM_RANGE(0x2800, 0x2800) AM_WRITE(tp84_col0_w)
|
|
||||||
AM_RANGE(0x3000, 0x3000) AM_WRITE(MWA8_RAM)
|
|
||||||
AM_RANGE(0x3004, 0x3004) AM_WRITE(tp84_flipscreen_x_w)
|
|
||||||
AM_RANGE(0x3005, 0x3005) AM_WRITE(tp84_flipscreen_y_w)
|
|
||||||
AM_RANGE(0x3800, 0x3800) AM_WRITE(tp84_sh_irqtrigger_w)
|
AM_RANGE(0x3800, 0x3800) AM_WRITE(tp84_sh_irqtrigger_w)
|
||||||
AM_RANGE(0x3a00, 0x3a00) AM_WRITE(soundlatch_w)
|
AM_RANGE(0x3a00, 0x3a00) AM_WRITE(soundlatch_w)
|
||||||
AM_RANGE(0x3c00, 0x3c00) AM_WRITE(tp84_scroll_x_w)
|
AM_RANGE(0x3c00, 0x3c00) AM_WRITE(MWA8_RAM) AM_BASE(&tp84_scroll_x)
|
||||||
AM_RANGE(0x3e00, 0x3e00) AM_WRITE(tp84_scroll_y_w)
|
AM_RANGE(0x3e00, 0x3e00) AM_WRITE(MWA8_RAM) AM_BASE(&tp84_scroll_y)
|
||||||
AM_RANGE(0x4000, 0x43ff) AM_WRITE(tp84_videoram_w) AM_BASE(&videoram)
|
AM_RANGE(0x4000, 0x43ff) AM_RAM AM_BASE(&tp84_bg_videoram)
|
||||||
AM_RANGE(0x4400, 0x47ff) AM_WRITE(tp84_videoram2_w) AM_BASE(&tp84_videoram2)
|
AM_RANGE(0x4400, 0x47ff) AM_RAM AM_BASE(&tp84_fg_videoram)
|
||||||
AM_RANGE(0x4800, 0x4bff) AM_WRITE(tp84_colorram_w) AM_BASE(&colorram)
|
AM_RANGE(0x4800, 0x4bff) AM_RAM AM_BASE(&tp84_bg_colorram)
|
||||||
AM_RANGE(0x4c00, 0x4fff) AM_WRITE(tp84_colorram2_w) AM_BASE(&tp84_colorram2)
|
AM_RANGE(0x4c00, 0x4fff) AM_RAM AM_BASE(&tp84_fg_colorram)
|
||||||
AM_RANGE(0x5000, 0x57ff) AM_WRITE(MWA8_RAM) AM_SHARE(1)
|
AM_RANGE(0x5000, 0x57ff) AM_RAM AM_SHARE(1)
|
||||||
AM_RANGE(0x8000, 0xffff) AM_WRITE(MWA8_ROM)
|
AM_RANGE(0x8000, 0xffff) AM_ROM
|
||||||
ADDRESS_MAP_END
|
ADDRESS_MAP_END
|
||||||
|
|
||||||
static ADDRESS_MAP_START( tp84b_cpu1_map, ADDRESS_SPACE_PROGRAM, 8 )
|
static ADDRESS_MAP_START( tp84b_cpu1_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||||
AM_RANGE(0x0000, 0x03ff) AM_RAM AM_WRITE(tp84_videoram_w) AM_BASE(&videoram)
|
AM_RANGE(0x0000, 0x03ff) AM_RAM AM_BASE(&tp84_bg_videoram)
|
||||||
AM_RANGE(0x0400, 0x07ff) AM_RAM AM_WRITE(tp84_videoram2_w) AM_BASE(&tp84_videoram2)
|
AM_RANGE(0x0400, 0x07ff) AM_RAM AM_BASE(&tp84_fg_videoram)
|
||||||
AM_RANGE(0x0800, 0x0bff) AM_RAM AM_WRITE(tp84_colorram_w) AM_BASE(&colorram)
|
AM_RANGE(0x0800, 0x0bff) AM_RAM AM_BASE(&tp84_bg_colorram)
|
||||||
AM_RANGE(0x0c00, 0x0fff) AM_RAM AM_WRITE(tp84_colorram2_w) AM_BASE(&tp84_colorram2)
|
AM_RANGE(0x0c00, 0x0fff) AM_RAM AM_BASE(&tp84_fg_colorram)
|
||||||
AM_RANGE(0x1000, 0x17ff) AM_RAM AM_SHARE(1)
|
AM_RANGE(0x1000, 0x17ff) AM_RAM AM_SHARE(1)
|
||||||
AM_RANGE(0x1800, 0x1800) AM_WRITE(watchdog_reset_w)
|
AM_RANGE(0x1800, 0x1800) AM_WRITE(watchdog_reset_w)
|
||||||
AM_RANGE(0x1a00, 0x1a00) AM_READWRITE(input_port_0_r, tp84_col0_w)
|
AM_RANGE(0x1a00, 0x1a00) AM_READWRITE(input_port_0_r, MWA8_RAM) AM_BASE(&tp84_palette_bank)
|
||||||
AM_RANGE(0x1a20, 0x1a20) AM_READ(input_port_1_r)
|
AM_RANGE(0x1a20, 0x1a20) AM_READ(input_port_1_r)
|
||||||
AM_RANGE(0x1a40, 0x1a40) AM_READ(input_port_2_r)
|
AM_RANGE(0x1a40, 0x1a40) AM_READ(input_port_2_r)
|
||||||
AM_RANGE(0x1a60, 0x1a60) AM_READ(input_port_3_r)
|
AM_RANGE(0x1a60, 0x1a60) AM_READ(input_port_3_r)
|
||||||
AM_RANGE(0x1c00, 0x1c00) AM_READWRITE(input_port_4_r, MWA8_NOP)
|
AM_RANGE(0x1c00, 0x1c00) AM_READWRITE(input_port_4_r, MWA8_NOP)
|
||||||
AM_RANGE(0x1c04, 0x1c04) AM_WRITE(tp84_flipscreen_x_w)
|
AM_RANGE(0x1c04, 0x1c04) AM_WRITE(MWA8_RAM) AM_BASE(&tp84_flipscreen_x)
|
||||||
AM_RANGE(0x1c05, 0x1c05) AM_WRITE(tp84_flipscreen_y_w)
|
AM_RANGE(0x1c05, 0x1c05) AM_WRITE(MWA8_RAM) AM_BASE(&tp84_flipscreen_y)
|
||||||
AM_RANGE(0x1e00, 0x1e00) AM_WRITE(tp84_sh_irqtrigger_w)
|
AM_RANGE(0x1e00, 0x1e00) AM_WRITE(tp84_sh_irqtrigger_w)
|
||||||
AM_RANGE(0x1e80, 0x1e80) AM_WRITE(soundlatch_w)
|
AM_RANGE(0x1e80, 0x1e80) AM_WRITE(soundlatch_w)
|
||||||
AM_RANGE(0x1f00, 0x1f00) AM_WRITE(tp84_scroll_x_w)
|
AM_RANGE(0x1f00, 0x1f00) AM_WRITE(MWA8_RAM) AM_BASE(&tp84_scroll_x)
|
||||||
AM_RANGE(0x1f80, 0x1f80) AM_WRITE(tp84_scroll_y_w)
|
AM_RANGE(0x1f80, 0x1f80) AM_WRITE(MWA8_RAM) AM_BASE(&tp84_scroll_y)
|
||||||
AM_RANGE(0x8000, 0xffff) AM_ROM
|
AM_RANGE(0x8000, 0xffff) AM_ROM
|
||||||
ADDRESS_MAP_END
|
ADDRESS_MAP_END
|
||||||
|
|
||||||
|
|
||||||
/* CPU 2 read addresses */
|
static ADDRESS_MAP_START( cpu2_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||||
static ADDRESS_MAP_START( readmem_cpu2, ADDRESS_SPACE_PROGRAM, 8 )
|
// AM_RANGE(0x0000, 0x0000) AM_RAM /* Watch dog ?*/
|
||||||
// AM_RANGE(0x0000, 0x0000) AM_READ(MRA8_RAM)
|
|
||||||
AM_RANGE(0x2000, 0x2000) AM_READ(tp84_scanline_r) /* beam position */
|
AM_RANGE(0x2000, 0x2000) AM_READ(tp84_scanline_r) /* beam position */
|
||||||
AM_RANGE(0x6000, 0x67ff) AM_READ(MRA8_RAM)
|
AM_RANGE(0x4000, 0x4000) AM_WRITE(interrupt_enable_w)
|
||||||
AM_RANGE(0x8000, 0x87ff) AM_READ(MRA8_RAM) AM_SHARE(1)
|
AM_RANGE(0x6000, 0x679f) AM_RAM
|
||||||
AM_RANGE(0xe000, 0xffff) AM_READ(MRA8_ROM)
|
AM_RANGE(0x67a0, 0x67ff) AM_READWRITE(MRA8_RAM, tp84_spriteram_w) AM_BASE(&tp84_spriteram)
|
||||||
ADDRESS_MAP_END
|
AM_RANGE(0x8000, 0x87ff) AM_RAM AM_SHARE(1)
|
||||||
|
AM_RANGE(0xe000, 0xffff) AM_ROM
|
||||||
/* CPU 2 write addresses */
|
|
||||||
static ADDRESS_MAP_START( writemem_cpu2, ADDRESS_SPACE_PROGRAM, 8 )
|
|
||||||
// AM_RANGE(0x0000, 0x0000) AM_WRITE(MWA8_RAM) /* Watch dog ?*/
|
|
||||||
AM_RANGE(0x4000, 0x4000) AM_WRITE(interrupt_enable_w) /* IRQ enable */
|
|
||||||
AM_RANGE(0x6000, 0x679f) AM_WRITE(MWA8_RAM)
|
|
||||||
AM_RANGE(0x67a0, 0x67ff) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size) /* REAL (multiplexed) */
|
|
||||||
AM_RANGE(0x8000, 0x87ff) AM_WRITE(MWA8_RAM) AM_SHARE(1)
|
|
||||||
AM_RANGE(0xe000, 0xffff) AM_WRITE(MWA8_ROM)
|
|
||||||
ADDRESS_MAP_END
|
ADDRESS_MAP_END
|
||||||
|
|
||||||
|
|
||||||
static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
|
static ADDRESS_MAP_START( audio_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||||
AM_RANGE(0x0000, 0x3fff) AM_READ(MRA8_ROM)
|
AM_RANGE(0x0000, 0x3fff) AM_ROM
|
||||||
AM_RANGE(0x4000, 0x43ff) AM_READ(MRA8_RAM)
|
AM_RANGE(0x4000, 0x43ff) AM_RAM
|
||||||
AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_r)
|
AM_RANGE(0x6000, 0x6000) AM_READ(soundlatch_r)
|
||||||
AM_RANGE(0x8000, 0x8000) AM_READ(tp84_sh_timer_r)
|
AM_RANGE(0x8000, 0x8000) AM_READ(tp84_sh_timer_r)
|
||||||
ADDRESS_MAP_END
|
|
||||||
|
|
||||||
static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
|
|
||||||
AM_RANGE(0x0000, 0x3fff) AM_WRITE(MWA8_ROM)
|
|
||||||
AM_RANGE(0x4000, 0x43ff) AM_WRITE(MWA8_RAM)
|
|
||||||
AM_RANGE(0xa000, 0xa1ff) AM_WRITE(tp84_filter_w)
|
AM_RANGE(0xa000, 0xa1ff) AM_WRITE(tp84_filter_w)
|
||||||
AM_RANGE(0xc000, 0xc000) AM_WRITE(MWA8_NOP)
|
AM_RANGE(0xc000, 0xc000) AM_WRITE(MWA8_NOP)
|
||||||
AM_RANGE(0xc001, 0xc001) AM_WRITE(SN76496_0_w)
|
AM_RANGE(0xc001, 0xc001) AM_WRITE(SN76496_0_w)
|
||||||
@ -436,6 +395,7 @@ static const gfx_layout charlayout =
|
|||||||
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
|
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
|
||||||
16*8
|
16*8
|
||||||
};
|
};
|
||||||
|
|
||||||
static const gfx_layout spritelayout =
|
static const gfx_layout spritelayout =
|
||||||
{
|
{
|
||||||
16,16,
|
16,16,
|
||||||
@ -460,20 +420,19 @@ static MACHINE_DRIVER_START( tp84 )
|
|||||||
|
|
||||||
/* basic machine hardware */
|
/* basic machine hardware */
|
||||||
MDRV_CPU_ADD_TAG("cpu1",M6809, XTAL_18_432MHz/12) /* verified on pcb */
|
MDRV_CPU_ADD_TAG("cpu1",M6809, XTAL_18_432MHz/12) /* verified on pcb */
|
||||||
MDRV_CPU_PROGRAM_MAP(readmem,writemem)
|
MDRV_CPU_PROGRAM_MAP(tp84_cpu1_map,0)
|
||||||
MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
|
MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
|
||||||
|
|
||||||
MDRV_CPU_ADD(M6809, XTAL_18_432MHz/12) /* verified on pcb */
|
MDRV_CPU_ADD(M6809, XTAL_18_432MHz/12) /* verified on pcb */
|
||||||
MDRV_CPU_PROGRAM_MAP(readmem_cpu2,writemem_cpu2)
|
MDRV_CPU_PROGRAM_MAP(cpu2_map,0)
|
||||||
MDRV_CPU_VBLANK_INT_HACK(tp84_6809_interrupt,256)
|
MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
|
||||||
|
|
||||||
MDRV_CPU_ADD(Z80,XTAL_14_31818MHz/4) /* verified on pcb */
|
|
||||||
/* audio CPU */
|
/* audio CPU */
|
||||||
MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
|
MDRV_CPU_ADD(Z80,XTAL_14_31818MHz/4) /* verified on pcb */
|
||||||
|
MDRV_CPU_PROGRAM_MAP(audio_map,0)
|
||||||
|
|
||||||
MDRV_INTERLEAVE(100) /* 100 CPU slices per frame - an high value to ensure proper */
|
MDRV_INTERLEAVE(100) /* 100 CPU slices per frame - an high value to ensure proper */
|
||||||
/* synchronization of the CPUs */
|
/* synchronization of the CPUs */
|
||||||
|
|
||||||
/* video hardware */
|
/* video hardware */
|
||||||
MDRV_SCREEN_ADD("main", RASTER)
|
MDRV_SCREEN_ADD("main", RASTER)
|
||||||
MDRV_SCREEN_REFRESH_RATE(60)
|
MDRV_SCREEN_REFRESH_RATE(60)
|
||||||
@ -489,7 +448,7 @@ static MACHINE_DRIVER_START( tp84 )
|
|||||||
MDRV_VIDEO_START(tp84)
|
MDRV_VIDEO_START(tp84)
|
||||||
MDRV_VIDEO_UPDATE(tp84)
|
MDRV_VIDEO_UPDATE(tp84)
|
||||||
|
|
||||||
/* sound hardware */
|
/* audio hardware */
|
||||||
MDRV_SPEAKER_STANDARD_MONO("mono")
|
MDRV_SPEAKER_STANDARD_MONO("mono")
|
||||||
|
|
||||||
MDRV_SOUND_ADD(SN76489A, XTAL_14_31818MHz/8) /* verified on pcb */
|
MDRV_SOUND_ADD(SN76489A, XTAL_14_31818MHz/8) /* verified on pcb */
|
||||||
@ -611,6 +570,6 @@ ROM_START( tp84b )
|
|||||||
ROM_END
|
ROM_END
|
||||||
|
|
||||||
|
|
||||||
GAME( 1984, tp84, 0, tp84, tp84, 0, ROT90, "Konami", "Time Pilot '84 (set 1)", 0 )
|
GAME( 1984, tp84, 0, tp84, tp84, 0, ROT90, "Konami", "Time Pilot '84 (set 1)", GAME_SUPPORTS_SAVE )
|
||||||
GAME( 1984, tp84a, tp84, tp84, tp84a,0, ROT90, "Konami", "Time Pilot '84 (set 2)", 0 )
|
GAME( 1984, tp84a, tp84, tp84, tp84a,0, ROT90, "Konami", "Time Pilot '84 (set 2)", GAME_SUPPORTS_SAVE )
|
||||||
GAME( 1984, tp84b, tp84, tp84b, tp84, 0, ROT90, "Konami", "Time Pilot '84 (set 3)", 0 )
|
GAME( 1984, tp84b, tp84, tp84b, tp84, 0, ROT90, "Konami", "Time Pilot '84 (set 3)", GAME_SUPPORTS_SAVE )
|
||||||
|
@ -8,21 +8,22 @@
|
|||||||
|
|
||||||
#include "driver.h"
|
#include "driver.h"
|
||||||
#include "video/resnet.h"
|
#include "video/resnet.h"
|
||||||
#include "deprecat.h"
|
|
||||||
|
|
||||||
UINT8 *tp84_videoram2, *tp84_colorram2;
|
|
||||||
|
|
||||||
static int col0;
|
UINT8 *tp84_bg_videoram;
|
||||||
|
UINT8 *tp84_bg_colorram;
|
||||||
/*
|
UINT8 *tp84_fg_videoram;
|
||||||
sprites are multiplexed, so we have to buffer the spriteram
|
UINT8 *tp84_fg_colorram;
|
||||||
scanline by scanline.
|
UINT8 *tp84_spriteram;
|
||||||
*/
|
UINT8 *tp84_scroll_x;
|
||||||
static UINT8 *sprite_mux_buffer;
|
UINT8 *tp84_scroll_y;
|
||||||
static int scanline;
|
UINT8 *tp84_palette_bank;
|
||||||
|
UINT8 *tp84_flipscreen_x;
|
||||||
|
UINT8 *tp84_flipscreen_y;
|
||||||
|
|
||||||
static tilemap *bg_tilemap, *fg_tilemap;
|
static tilemap *bg_tilemap, *fg_tilemap;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
-The colortable is divided in 2 part:
|
-The colortable is divided in 2 part:
|
||||||
-The characters colors
|
-The characters colors
|
||||||
@ -30,15 +31,15 @@ static tilemap *bg_tilemap, *fg_tilemap;
|
|||||||
|
|
||||||
-The characters colors are indexed like this:
|
-The characters colors are indexed like this:
|
||||||
-2 bits from the characters
|
-2 bits from the characters
|
||||||
-4 bits from the attribute in colorram
|
-4 bits from the attribute in tp84_bg_colorram
|
||||||
-2 bits from col0 (d3-d4)
|
-2 bits from palette_bank (d3-d4)
|
||||||
-3 bits from col0 (d0-d1-d2)
|
-3 bits from palette_bank (d0-d1-d2)
|
||||||
-So, there is 2048 bytes for the characters
|
-So, there is 2048 bytes for the characters
|
||||||
|
|
||||||
-The sprites colors are indexed like this:
|
-The sprites colors are indexed like this:
|
||||||
-4 bits from the sprites (16 colors)
|
-4 bits from the sprites (16 colors)
|
||||||
-4 bits from the attribute of the sprites
|
-4 bits from the attribute of the sprites
|
||||||
-3 bits from col0 (d0-d1-d2)
|
-3 bits from palette_bank (d0-d1-d2)
|
||||||
-So, there is 2048 bytes for the sprites
|
-So, there is 2048 bytes for the sprites
|
||||||
|
|
||||||
*/
|
*/
|
||||||
@ -53,14 +54,14 @@ static tilemap *bg_tilemap, *fg_tilemap;
|
|||||||
PALETTE_INIT( tp84 )
|
PALETTE_INIT( tp84 )
|
||||||
{
|
{
|
||||||
static const int resistances[4] = { 1000, 470, 220, 100 };
|
static const int resistances[4] = { 1000, 470, 220, 100 };
|
||||||
double rweights[4], gweights[4], bweights[4];
|
double weights[4];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* compute the color output resistor weights */
|
/* compute the color output resistor weights */
|
||||||
compute_resistor_weights(0, 255, -1.0,
|
compute_resistor_weights(0, 255, -1.0,
|
||||||
4, resistances, rweights, 470, 0,
|
4, resistances, weights, 470, 0,
|
||||||
4, resistances, gweights, 470, 0,
|
0, 0, 0, 0, 0,
|
||||||
4, resistances, bweights, 470, 0);
|
0, 0, 0, 0, 0);
|
||||||
|
|
||||||
/* allocate the colortable */
|
/* allocate the colortable */
|
||||||
machine->colortable = colortable_alloc(machine, 0x100);
|
machine->colortable = colortable_alloc(machine, 0x100);
|
||||||
@ -76,21 +77,21 @@ PALETTE_INIT( tp84 )
|
|||||||
bit1 = (color_prom[i + 0x000] >> 1) & 0x01;
|
bit1 = (color_prom[i + 0x000] >> 1) & 0x01;
|
||||||
bit2 = (color_prom[i + 0x000] >> 2) & 0x01;
|
bit2 = (color_prom[i + 0x000] >> 2) & 0x01;
|
||||||
bit3 = (color_prom[i + 0x000] >> 3) & 0x01;
|
bit3 = (color_prom[i + 0x000] >> 3) & 0x01;
|
||||||
r = combine_4_weights(rweights, bit0, bit1, bit2, bit3);
|
r = combine_4_weights(weights, bit0, bit1, bit2, bit3);
|
||||||
|
|
||||||
/* green component */
|
/* green component */
|
||||||
bit0 = (color_prom[i + 0x100] >> 0) & 0x01;
|
bit0 = (color_prom[i + 0x100] >> 0) & 0x01;
|
||||||
bit1 = (color_prom[i + 0x100] >> 1) & 0x01;
|
bit1 = (color_prom[i + 0x100] >> 1) & 0x01;
|
||||||
bit2 = (color_prom[i + 0x100] >> 2) & 0x01;
|
bit2 = (color_prom[i + 0x100] >> 2) & 0x01;
|
||||||
bit3 = (color_prom[i + 0x100] >> 3) & 0x01;
|
bit3 = (color_prom[i + 0x100] >> 3) & 0x01;
|
||||||
g = combine_4_weights(gweights, bit0, bit1, bit2, bit3);
|
g = combine_4_weights(weights, bit0, bit1, bit2, bit3);
|
||||||
|
|
||||||
/* blue component */
|
/* blue component */
|
||||||
bit0 = (color_prom[i + 0x200] >> 0) & 0x01;
|
bit0 = (color_prom[i + 0x200] >> 0) & 0x01;
|
||||||
bit1 = (color_prom[i + 0x200] >> 1) & 0x01;
|
bit1 = (color_prom[i + 0x200] >> 1) & 0x01;
|
||||||
bit2 = (color_prom[i + 0x200] >> 2) & 0x01;
|
bit2 = (color_prom[i + 0x200] >> 2) & 0x01;
|
||||||
bit3 = (color_prom[i + 0x200] >> 3) & 0x01;
|
bit3 = (color_prom[i + 0x200] >> 3) & 0x01;
|
||||||
b = combine_4_weights(bweights, bit0, bit1, bit2, bit3);
|
b = combine_4_weights(weights, bit0, bit1, bit2, bit3);
|
||||||
|
|
||||||
colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b));
|
colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b));
|
||||||
}
|
}
|
||||||
@ -112,175 +113,100 @@ PALETTE_INIT( tp84 )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WRITE8_HANDLER( tp84_videoram_w )
|
WRITE8_HANDLER( tp84_spriteram_w )
|
||||||
{
|
{
|
||||||
videoram[offset] = data;
|
/* the game multiplexes the sprites, so update now */
|
||||||
tilemap_mark_tile_dirty(bg_tilemap, offset);
|
video_screen_update_now(0);
|
||||||
|
tp84_spriteram[offset] = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
WRITE8_HANDLER( tp84_colorram_w )
|
|
||||||
{
|
|
||||||
colorram[offset] = data;
|
|
||||||
tilemap_mark_tile_dirty(bg_tilemap, offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
WRITE8_HANDLER( tp84_videoram2_w )
|
|
||||||
{
|
|
||||||
tp84_videoram2[offset] = data;
|
|
||||||
tilemap_mark_tile_dirty(fg_tilemap, offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
WRITE8_HANDLER( tp84_colorram2_w )
|
|
||||||
{
|
|
||||||
tp84_colorram2[offset] = data;
|
|
||||||
tilemap_mark_tile_dirty(fg_tilemap, offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
WRITE8_HANDLER( tp84_scroll_x_w )
|
|
||||||
{
|
|
||||||
tilemap_set_scrollx(bg_tilemap, 0, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
WRITE8_HANDLER( tp84_scroll_y_w )
|
|
||||||
{
|
|
||||||
tilemap_set_scrolly(bg_tilemap, 0, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
WRITE8_HANDLER( tp84_flipscreen_x_w )
|
|
||||||
{
|
|
||||||
flip_screen_x_set(data & 0x01);
|
|
||||||
}
|
|
||||||
|
|
||||||
WRITE8_HANDLER( tp84_flipscreen_y_w )
|
|
||||||
{
|
|
||||||
flip_screen_y_set(data & 0x01);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****
|
|
||||||
col0 is a register to index the color Proms
|
|
||||||
*****/
|
|
||||||
WRITE8_HANDLER( tp84_col0_w )
|
|
||||||
{
|
|
||||||
if (col0 != data)
|
|
||||||
{
|
|
||||||
col0 = data;
|
|
||||||
tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return the current video scan line */
|
|
||||||
READ8_HANDLER( tp84_scanline_r )
|
READ8_HANDLER( tp84_scanline_r )
|
||||||
{
|
{
|
||||||
return scanline;
|
/* reads 1V - 128V */
|
||||||
|
return video_screen_get_vpos(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static TILE_GET_INFO( get_bg_tile_info )
|
static TILE_GET_INFO( get_bg_tile_info )
|
||||||
{
|
{
|
||||||
int coloffs = ((col0 & 0x18) << 1) + ((col0 & 0x07) << 6);
|
int code = ((tp84_bg_colorram[tile_index] & 0x30) << 4) | tp84_bg_videoram[tile_index];
|
||||||
int attr = colorram[tile_index];
|
int color = ((*tp84_palette_bank & 0x07) << 6) |
|
||||||
int code = videoram[tile_index] + ((attr & 0x30) << 4);
|
((*tp84_palette_bank & 0x18) << 1) |
|
||||||
int color = (attr & 0x0f) + coloffs;
|
(tp84_bg_colorram[tile_index] & 0x0f);
|
||||||
int flags = ((attr & 0x40) ? TILE_FLIPX : 0) | ((attr & 0x80) ? TILE_FLIPY : 0);
|
int flags = TILE_FLIPYX(tp84_bg_colorram[tile_index] >> 6);
|
||||||
|
|
||||||
SET_TILE_INFO(0, code, color, flags);
|
SET_TILE_INFO(0, code, color, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static TILE_GET_INFO( get_fg_tile_info )
|
static TILE_GET_INFO( get_fg_tile_info )
|
||||||
{
|
{
|
||||||
int coloffs = ((col0 & 0x18) << 1) + ((col0 & 0x07) << 6);
|
int code = ((tp84_fg_colorram[tile_index] & 0x30) << 4) | tp84_fg_videoram[tile_index];
|
||||||
int attr = tp84_colorram2[tile_index];
|
int color = ((*tp84_palette_bank & 0x07) << 6) |
|
||||||
int code = tp84_videoram2[tile_index]+ ((attr & 0x30) << 4);
|
((*tp84_palette_bank & 0x18) << 1) |
|
||||||
int color = (attr & 0x0f) + coloffs;
|
(tp84_fg_colorram[tile_index] & 0x0f);
|
||||||
int flags = ((attr & 0x40) ? TILE_FLIPX : 0) | ((attr & 0x80) ? TILE_FLIPY : 0) | TILE_FORCE_LAYER0;
|
int flags = TILE_FLIPYX(tp84_fg_colorram[tile_index] >> 6);
|
||||||
|
|
||||||
SET_TILE_INFO(0, code, color, flags);
|
SET_TILE_INFO(0, code, color, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VIDEO_START( tp84 )
|
VIDEO_START( tp84 )
|
||||||
{
|
{
|
||||||
bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows,
|
bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||||
8, 8, 32, 32);
|
fg_tilemap = tilemap_create(get_fg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||||
|
|
||||||
fg_tilemap = tilemap_create(get_fg_tile_info, tilemap_scan_rows,
|
|
||||||
8, 8, 32, 32);
|
|
||||||
|
|
||||||
tilemap_set_transparent_pen(fg_tilemap, 0);
|
|
||||||
|
|
||||||
sprite_mux_buffer = auto_malloc(256 * spriteram_size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
|
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
|
||||||
{
|
{
|
||||||
const gfx_element *gfx = machine->gfx[1];
|
|
||||||
int offs;
|
int offs;
|
||||||
int line;
|
int palette_base = ((*tp84_palette_bank & 0x07) << 4);
|
||||||
int coloffset = ((col0&0x07) << 4);
|
|
||||||
|
|
||||||
for (line = cliprect->min_y; line <= cliprect->max_y; line++)
|
for (offs = 0x5c; offs >= 0; offs -= 4)
|
||||||
{
|
{
|
||||||
UINT8 *sr;
|
int x = tp84_spriteram[offs];
|
||||||
rectangle clip = *cliprect;
|
int y = 240 - tp84_spriteram[offs + 3];
|
||||||
|
|
||||||
sr = sprite_mux_buffer + line * spriteram_size;
|
int code = tp84_spriteram[offs + 1];
|
||||||
clip.min_y = clip.max_y = line;
|
int color = palette_base | (tp84_spriteram[offs + 2] & 0x0f);
|
||||||
|
int flip_x = ~tp84_spriteram[offs + 2] & 0x40;
|
||||||
|
int flip_y = tp84_spriteram[offs + 2] & 0x80;
|
||||||
|
|
||||||
for (offs = spriteram_size - 4;offs >= 0;offs -= 4)
|
drawgfx(bitmap, machine->gfx[1], code, color, flip_x, flip_y, x, y, cliprect, TRANSPARENCY_PENS,
|
||||||
{
|
colortable_get_transpen_mask(machine->colortable, machine->gfx[1], color, palette_base));
|
||||||
int code,color,sx,sy,flipx,flipy;
|
|
||||||
|
|
||||||
sx = sr[offs];
|
|
||||||
sy = 240 - sr[offs + 3];
|
|
||||||
|
|
||||||
if (sy > line-16 && sy <= line)
|
|
||||||
{
|
|
||||||
code = sr[offs + 1];
|
|
||||||
color = (sr[offs + 2] & 0x0f) + coloffset;
|
|
||||||
flipx = ~sr[offs + 2] & 0x40;
|
|
||||||
flipy = sr[offs + 2] & 0x80;
|
|
||||||
|
|
||||||
drawgfx(bitmap,gfx,
|
|
||||||
code,
|
|
||||||
color,
|
|
||||||
flipx,flipy,
|
|
||||||
sx,sy,
|
|
||||||
&clip,TRANSPARENCY_PENS,
|
|
||||||
colortable_get_transpen_mask(machine->colortable, gfx, color, coloffset));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VIDEO_UPDATE( tp84 )
|
VIDEO_UPDATE( tp84 )
|
||||||
{
|
{
|
||||||
rectangle clip;
|
rectangle clip = *cliprect;
|
||||||
|
|
||||||
|
if (cliprect->min_y == machine->screen[screen].visarea.min_y)
|
||||||
|
{
|
||||||
|
tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
|
||||||
|
|
||||||
|
tilemap_set_scrollx(bg_tilemap, 0, *tp84_scroll_x);
|
||||||
|
tilemap_set_scrolly(bg_tilemap, 0, *tp84_scroll_y);
|
||||||
|
|
||||||
|
tilemap_set_flip(ALL_TILEMAPS, ((*tp84_flipscreen_x & 0x01) ? TILEMAP_FLIPX : 0) |
|
||||||
|
((*tp84_flipscreen_y & 0x01) ? TILEMAP_FLIPY : 0));
|
||||||
|
}
|
||||||
|
|
||||||
tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
|
tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
|
||||||
draw_sprites(machine, bitmap, cliprect);
|
draw_sprites(machine, bitmap, cliprect);
|
||||||
|
|
||||||
/* draw top fg_tilemap status layer part */
|
/* draw top status region */
|
||||||
clip.min_x = machine->screen[0].visarea.min_x;
|
clip.min_x = machine->screen[0].visarea.min_x;
|
||||||
clip.max_x = machine->screen[0].visarea.min_x+15;
|
clip.max_x = machine->screen[0].visarea.min_x + 15;
|
||||||
clip.min_y = machine->screen[0].visarea.min_y;
|
|
||||||
clip.max_y = machine->screen[0].visarea.max_y;
|
|
||||||
tilemap_draw(bitmap, &clip, fg_tilemap, 0, 0);
|
tilemap_draw(bitmap, &clip, fg_tilemap, 0, 0);
|
||||||
|
|
||||||
/* the middle part of fg_tilemap seems to be used as normal ram and is skipped */
|
/* draw bottom status region */
|
||||||
|
clip.min_x = machine->screen[0].visarea.max_x - 15;
|
||||||
/* draw bottom fg_tilemap status layer part */
|
|
||||||
clip.min_x = machine->screen[0].visarea.max_x-15;
|
|
||||||
clip.max_x = machine->screen[0].visarea.max_x;
|
clip.max_x = machine->screen[0].visarea.max_x;
|
||||||
clip.min_y = machine->screen[0].visarea.min_y;
|
|
||||||
clip.max_y = machine->screen[0].visarea.max_y;
|
|
||||||
tilemap_draw(bitmap, &clip, fg_tilemap, 0, 0);
|
tilemap_draw(bitmap, &clip, fg_tilemap, 0, 0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
INTERRUPT_GEN( tp84_6809_interrupt )
|
|
||||||
{
|
|
||||||
scanline = 255 - cpu_getiloops();
|
|
||||||
|
|
||||||
memcpy(sprite_mux_buffer + scanline * spriteram_size,spriteram,spriteram_size);
|
|
||||||
|
|
||||||
if (scanline == 255)
|
|
||||||
irq0_line_hold(machine, cpunum);
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user