mirror of
https://github.com/holub/mame
synced 2025-05-28 08:33:05 +03:00
Added common driver data struct to timeplt.c, tutankhm.c, junofrst.c, pooyan.c, rallyx.c and rocnrope.c (these drivers all use audio/timeplt.c). As a side effect, we now have save states in junofrst.c and rallyx.c.
Added driver data struct to jackal.c out of the whatsnew, a couple of remarks: - rallyx and nrallyx might require a separate driver data struct to deal with namco_soundregs, but I'll take care of this eventually (if really needed) - jackal does not properly save the work ram banks atm, hence no SUPPORTS_SAVE flag, but I keep looking for a clean solution to the problem
This commit is contained in:
parent
fa9e91f866
commit
eb9e1e53e5
5
.gitattributes
vendored
5
.gitattributes
vendored
@ -1237,7 +1237,6 @@ src/mame/audio/tank8.c svneol=native#text/plain
|
||||
src/mame/audio/targ.c svneol=native#text/plain
|
||||
src/mame/audio/tiamc1.c svneol=native#text/plain
|
||||
src/mame/audio/timeplt.c svneol=native#text/plain
|
||||
src/mame/audio/timeplt.h svneol=native#text/plain
|
||||
src/mame/audio/toaplan2.c svneol=native#text/plain
|
||||
src/mame/audio/trackfld.c svneol=native#text/plain
|
||||
src/mame/audio/triplhnt.c svneol=native#text/plain
|
||||
@ -2603,7 +2602,6 @@ src/mame/includes/polepos.h svneol=native#text/plain
|
||||
src/mame/includes/policetr.h svneol=native#text/plain
|
||||
src/mame/includes/polyplay.h svneol=native#text/plain
|
||||
src/mame/includes/poolshrk.h svneol=native#text/plain
|
||||
src/mame/includes/pooyan.h svneol=native#text/plain
|
||||
src/mame/includes/popper.h svneol=native#text/plain
|
||||
src/mame/includes/psikyosh.h svneol=native#text/plain
|
||||
src/mame/includes/psx.h svneol=native#text/plain
|
||||
@ -2614,7 +2612,6 @@ src/mame/includes/realbrk.h svneol=native#text/plain
|
||||
src/mame/includes/redalert.h svneol=native#text/plain
|
||||
src/mame/includes/relief.h svneol=native#text/plain
|
||||
src/mame/includes/retofinv.h svneol=native#text/plain
|
||||
src/mame/includes/rocnrope.h svneol=native#text/plain
|
||||
src/mame/includes/segag80r.h svneol=native#text/plain
|
||||
src/mame/includes/segag80v.h svneol=native#text/plain
|
||||
src/mame/includes/segas24.h svneol=native#text/plain
|
||||
@ -2680,7 +2677,6 @@ src/mame/includes/triplhnt.h svneol=native#text/plain
|
||||
src/mame/includes/tubep.h svneol=native#text/plain
|
||||
src/mame/includes/tumbleb.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/twin16.h svneol=native#text/plain
|
||||
src/mame/includes/twincobr.h svneol=native#text/plain
|
||||
src/mame/includes/tx1.h svneol=native#text/plain
|
||||
@ -2891,7 +2887,6 @@ src/mame/machine/harddriv.c svneol=native#text/plain
|
||||
src/mame/machine/irem_cpu.c svneol=native#text/plain
|
||||
src/mame/machine/irem_cpu.h svneol=native#text/plain
|
||||
src/mame/machine/irobot.c svneol=native#text/plain
|
||||
src/mame/machine/jackal.c svneol=native#text/plain
|
||||
src/mame/machine/jumpshot.c svneol=native#text/plain
|
||||
src/mame/machine/kabuki.c svneol=native#text/plain
|
||||
src/mame/machine/kaneko16.c svneol=native#text/plain
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
timeplt.c
|
||||
pooyan.c
|
||||
locomotn.c
|
||||
rallyx.c (for locomotn)
|
||||
tutankhm.c
|
||||
rocnrope.c
|
||||
|
||||
@ -14,13 +14,10 @@
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "sound/ay8910.h"
|
||||
#include "sound/flt_rc.h"
|
||||
#include "timeplt.h"
|
||||
#include "includes/timeplt.h"
|
||||
|
||||
|
||||
#define MASTER_CLOCK XTAL_14_31818MHz
|
||||
|
||||
|
||||
static UINT8 timeplt_last_irq_state;
|
||||
#define MASTER_CLOCK XTAL_14_31818MHz
|
||||
|
||||
|
||||
/*************************************
|
||||
@ -31,8 +28,18 @@ static UINT8 timeplt_last_irq_state;
|
||||
|
||||
static SOUND_START( timeplt )
|
||||
{
|
||||
timeplt_last_irq_state = 0;
|
||||
state_save_register_global(machine, timeplt_last_irq_state);
|
||||
timeplt_state *state = (timeplt_state *)machine->driver_data;
|
||||
|
||||
state->soundcpu = devtag_get_device(machine, "tpsound");
|
||||
state->filter_0_0 = devtag_get_device(machine, "filter.0.0");
|
||||
state->filter_0_1 = devtag_get_device(machine, "filter.0.1");
|
||||
state->filter_0_2 = devtag_get_device(machine, "filter.0.2");
|
||||
state->filter_1_0 = devtag_get_device(machine, "filter.1.0");
|
||||
state->filter_1_1 = devtag_get_device(machine, "filter.1.1");
|
||||
state->filter_1_2 = devtag_get_device(machine, "filter.1.2");
|
||||
|
||||
state->last_irq_state = 0;
|
||||
state_save_register_global(machine, state->last_irq_state);
|
||||
}
|
||||
|
||||
|
||||
@ -62,11 +69,14 @@ static SOUND_START( timeplt )
|
||||
|
||||
static READ8_DEVICE_HANDLER( timeplt_portB_r )
|
||||
{
|
||||
timeplt_state *state = (timeplt_state *)device->machine->driver_data;
|
||||
|
||||
static const int timeplt_timer[10] =
|
||||
{
|
||||
0x00, 0x10, 0x20, 0x30, 0x40, 0x90, 0xa0, 0xb0, 0xa0, 0xd0
|
||||
};
|
||||
return timeplt_timer[(cputag_get_total_cycles(device->machine, "tpsound") / 512) % 10];
|
||||
|
||||
return timeplt_timer[(cpu_get_total_cycles(state->soundcpu) / 512) % 10];
|
||||
}
|
||||
|
||||
|
||||
@ -77,24 +87,28 @@ static READ8_DEVICE_HANDLER( timeplt_portB_r )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static void filter_w(const device_config *device, int data)
|
||||
static void filter_w( const device_config *device, int data )
|
||||
{
|
||||
int C = 0;
|
||||
|
||||
if (data & 1) C += 220000; /* 220000pF = 0.220uF */
|
||||
if (data & 2) C += 47000; /* 47000pF = 0.047uF */
|
||||
filter_rc_set_RC(device,FLT_RC_LOWPASS, 1000,5100,0,CAP_P(C));
|
||||
if (data & 1)
|
||||
C += 220000; /* 220000pF = 0.220uF */
|
||||
if (data & 2)
|
||||
C += 47000; /* 47000pF = 0.047uF */
|
||||
|
||||
filter_rc_set_RC(device, FLT_RC_LOWPASS, 1000, 5100, 0, CAP_P(C));
|
||||
}
|
||||
|
||||
|
||||
static WRITE8_HANDLER( timeplt_filter_w )
|
||||
{
|
||||
filter_w(devtag_get_device(space->machine, "filter.0.0"), (offset >> 6) & 3);
|
||||
filter_w(devtag_get_device(space->machine, "filter.0.1"), (offset >> 8) & 3);
|
||||
filter_w(devtag_get_device(space->machine, "filter.0.2"), (offset >> 10) & 3);
|
||||
filter_w(devtag_get_device(space->machine, "filter.1.0"), (offset >> 0) & 3);
|
||||
filter_w(devtag_get_device(space->machine, "filter.1.1"), (offset >> 2) & 3);
|
||||
filter_w(devtag_get_device(space->machine, "filter.1.2"), (offset >> 4) & 3);
|
||||
timeplt_state *state = (timeplt_state *)space->machine->driver_data;
|
||||
filter_w(state->filter_1_0, (offset >> 0) & 3);
|
||||
filter_w(state->filter_1_1, (offset >> 2) & 3);
|
||||
filter_w(state->filter_1_2, (offset >> 4) & 3);
|
||||
filter_w(state->filter_0_0, (offset >> 6) & 3);
|
||||
filter_w(state->filter_0_1, (offset >> 8) & 3);
|
||||
filter_w(state->filter_0_2, (offset >> 10) & 3);
|
||||
}
|
||||
|
||||
|
||||
@ -107,13 +121,15 @@ static WRITE8_HANDLER( timeplt_filter_w )
|
||||
|
||||
WRITE8_HANDLER( timeplt_sh_irqtrigger_w )
|
||||
{
|
||||
if (timeplt_last_irq_state == 0 && data)
|
||||
timeplt_state *state = (timeplt_state *)space->machine->driver_data;
|
||||
|
||||
if (state->last_irq_state == 0 && data)
|
||||
{
|
||||
/* setting bit 0 low then high triggers IRQ on the sound CPU */
|
||||
cputag_set_input_line_and_vector(space->machine, "tpsound", 0, HOLD_LINE, 0xff);
|
||||
cpu_set_input_line_and_vector(state->soundcpu, 0, HOLD_LINE, 0xff);
|
||||
}
|
||||
|
||||
timeplt_last_irq_state = data;
|
||||
state->last_irq_state = data;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,4 +0,0 @@
|
||||
WRITE8_HANDLER( timeplt_sh_irqtrigger_w );
|
||||
|
||||
MACHINE_DRIVER_EXTERN( timeplt_sound );
|
||||
MACHINE_DRIVER_EXTERN( locomotn_sound );
|
@ -74,31 +74,97 @@ Address Dir Data Description
|
||||
#include "cpu/m6809/m6809.h"
|
||||
#include "sound/2151intf.h"
|
||||
#include "includes/jackal.h"
|
||||
#include "konamipt.h"
|
||||
|
||||
#define MASTER_CLOCK XTAL_18_432MHz
|
||||
#define SOUND_CLOCK XTAL_3_579545MHz
|
||||
#include "includes/konamipt.h"
|
||||
|
||||
|
||||
static int irq_enable;
|
||||
|
||||
/* Read/Write Handlers */
|
||||
/*************************************
|
||||
*
|
||||
* Memory handlers
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static READ8_HANDLER( topgunbl_rotary_r )
|
||||
{
|
||||
return (1 << input_port_read(space->machine, offset ? "DIAL1" : "DIAL0")) ^ 0xff;
|
||||
return (1 << input_port_read_safe(space->machine, offset ? "DIAL1" : "DIAL0", 0x00)) ^ 0xff;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( jackal_flipscreen_w )
|
||||
{
|
||||
irq_enable = data & 0x02;
|
||||
jackal_state *state = (jackal_state *)space->machine->driver_data;
|
||||
state->irq_enable = data & 0x02;
|
||||
flip_screen_set(space->machine, data & 0x08);
|
||||
}
|
||||
|
||||
/* Memory Maps */
|
||||
READ8_HANDLER( jackal_zram_r )
|
||||
{
|
||||
jackal_state *state = (jackal_state *)space->machine->driver_data;
|
||||
return state->rambank[0x0020 + offset];
|
||||
}
|
||||
|
||||
|
||||
READ8_HANDLER( jackal_voram_r )
|
||||
{
|
||||
jackal_state *state = (jackal_state *)space->machine->driver_data;
|
||||
return state->rambank[0x2000 + offset];
|
||||
}
|
||||
|
||||
|
||||
READ8_HANDLER( jackal_spriteram_r )
|
||||
{
|
||||
jackal_state *state = (jackal_state *)space->machine->driver_data;
|
||||
return state->spritebank[0x3000 + offset];
|
||||
}
|
||||
|
||||
|
||||
WRITE8_HANDLER( jackal_rambank_w )
|
||||
{
|
||||
jackal_state *state = (jackal_state *)space->machine->driver_data;
|
||||
UINT8 *rgn = memory_region(space->machine, "master");
|
||||
|
||||
if (data & 0x04)
|
||||
popmessage("jackal_rambank_w %02x", data);
|
||||
|
||||
coin_counter_w(space->machine, 0, data & 0x01);
|
||||
coin_counter_w(space->machine, 1, data & 0x02);
|
||||
|
||||
state->spritebank = &rgn[((data & 0x08) << 13)];
|
||||
state->rambank = &rgn[((data & 0x10) << 12)];
|
||||
memory_set_bank(space->machine, "bank1", (data & 0x20) ? 1 : 0);
|
||||
}
|
||||
|
||||
|
||||
WRITE8_HANDLER( jackal_zram_w )
|
||||
{
|
||||
jackal_state *state = (jackal_state *)space->machine->driver_data;
|
||||
state->rambank[0x0020 + offset] = data;
|
||||
}
|
||||
|
||||
|
||||
WRITE8_HANDLER( jackal_voram_w )
|
||||
{
|
||||
jackal_state *state = (jackal_state *)space->machine->driver_data;
|
||||
|
||||
if ((offset & 0xf800) == 0)
|
||||
jackal_mark_tile_dirty(space->machine, offset & 0x3ff);
|
||||
|
||||
state->rambank[0x2000 + offset] = data;
|
||||
}
|
||||
|
||||
|
||||
WRITE8_HANDLER( jackal_spriteram_w )
|
||||
{
|
||||
jackal_state *state = (jackal_state *)space->machine->driver_data;
|
||||
state->spritebank[0x3000 + offset] = data;
|
||||
}
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Address maps
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static ADDRESS_MAP_START( master_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x0003) AM_RAM AM_BASE(&jackal_videoctrl) // scroll + other things
|
||||
AM_RANGE(0x0000, 0x0003) AM_RAM AM_BASE_MEMBER(jackal_state, videoctrl) // scroll + other things
|
||||
AM_RANGE(0x0004, 0x0004) AM_WRITE(jackal_flipscreen_w)
|
||||
AM_RANGE(0x0010, 0x0010) AM_READ_PORT("DSW1")
|
||||
AM_RANGE(0x0011, 0x0011) AM_READ_PORT("IN1")
|
||||
@ -109,7 +175,7 @@ static ADDRESS_MAP_START( master_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0019, 0x0019) AM_WRITE(watchdog_reset_w)
|
||||
AM_RANGE(0x001c, 0x001c) AM_WRITE(jackal_rambank_w)
|
||||
AM_RANGE(0x0020, 0x005f) AM_READWRITE(jackal_zram_r, jackal_zram_w) // MAIN Z RAM,SUB Z RAM
|
||||
AM_RANGE(0x0060, 0x1fff) AM_RAM AM_SHARE("share1") // M COMMON RAM,S COMMON RAM
|
||||
AM_RANGE(0x0060, 0x1fff) AM_RAM AM_SHARE("share1") // M COMMON RAM,S COMMON RAM
|
||||
AM_RANGE(0x2000, 0x2fff) AM_READWRITE(jackal_voram_r, jackal_voram_w) // MAIN V O RAM,SUB V O RAM
|
||||
AM_RANGE(0x3000, 0x3fff) AM_READWRITE(jackal_spriteram_r, jackal_spriteram_w) // MAIN V O RAM,SUB V O RAM
|
||||
AM_RANGE(0x4000, 0xbfff) AM_ROMBANK("bank1")
|
||||
@ -118,13 +184,17 @@ ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( slave_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x2000, 0x2001) AM_DEVREADWRITE("ymsnd", ym2151_r, ym2151_w)
|
||||
AM_RANGE(0x4000, 0x43ff) AM_RAM AM_BASE_GENERIC(paletteram) // self test only checks 0x4000-0x423f, 007327 should actually go up to 4fff
|
||||
AM_RANGE(0x6000, 0x605f) AM_RAM // SOUND RAM (Self test check 0x6000-605f, 0x7c00-0x7fff)
|
||||
AM_RANGE(0x4000, 0x43ff) AM_RAM AM_BASE_MEMBER(jackal_state, paletteram) // self test only checks 0x4000-0x423f, 007327 should actually go up to 4fff
|
||||
AM_RANGE(0x6000, 0x605f) AM_RAM // SOUND RAM (Self test check 0x6000-605f, 0x7c00-0x7fff)
|
||||
AM_RANGE(0x6060, 0x7fff) AM_RAM AM_SHARE("share1")
|
||||
AM_RANGE(0x8000, 0xffff) AM_ROM
|
||||
ADDRESS_MAP_END
|
||||
|
||||
/* Input Ports */
|
||||
/*************************************
|
||||
*
|
||||
* Input ports
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static INPUT_PORTS_START( jackal )
|
||||
PORT_START("DSW1")
|
||||
@ -189,7 +259,12 @@ static INPUT_PORTS_START( topgunbl )
|
||||
PORT_BIT( 0xff, 0x00, IPT_POSITIONAL ) PORT_POSITIONS(8) PORT_WRAPS PORT_SENSITIVITY(15) PORT_KEYDELTA(1) PORT_CODE_DEC(KEYCODE_N) PORT_CODE_INC(KEYCODE_M) PORT_PLAYER(2) PORT_FULL_TURN_COUNT(8)
|
||||
INPUT_PORTS_END
|
||||
|
||||
/* Graphics Layouts */
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Graphics definitions
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static const gfx_layout charlayout =
|
||||
{
|
||||
@ -226,8 +301,6 @@ static const gfx_layout spritelayout8 =
|
||||
32*8
|
||||
};
|
||||
|
||||
/* Graphics Decode Information */
|
||||
|
||||
static GFXDECODE_START( jackal )
|
||||
GFXDECODE_ENTRY( "gfx1", 0x00000, charlayout, 0, 1 ) // colors 256-511 without lookup
|
||||
GFXDECODE_ENTRY( "gfx1", 0x20000, spritelayout, 0x100, 16 ) // colors 0- 15 with lookup
|
||||
@ -236,21 +309,66 @@ static GFXDECODE_START( jackal )
|
||||
GFXDECODE_ENTRY( "gfx1", 0x60000, spritelayout8, 0x200, 16 ) // to handle 8x8 sprites
|
||||
GFXDECODE_END
|
||||
|
||||
/* Interrupt Generator */
|
||||
/*************************************
|
||||
*
|
||||
* Interrupt generator
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static INTERRUPT_GEN( jackal_interrupt )
|
||||
{
|
||||
if (irq_enable)
|
||||
jackal_state *state = (jackal_state *)device->machine->driver_data;
|
||||
|
||||
if (state->irq_enable)
|
||||
{
|
||||
cpu_set_input_line(device, 0, HOLD_LINE);
|
||||
cputag_set_input_line(device->machine, "slave", INPUT_LINE_NMI, PULSE_LINE);
|
||||
cpu_set_input_line(state->slavecpu, INPUT_LINE_NMI, PULSE_LINE);
|
||||
}
|
||||
}
|
||||
|
||||
/* Machine Driver */
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Machine driver
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static MACHINE_START( jackal )
|
||||
{
|
||||
jackal_state *state = (jackal_state *)machine->driver_data;
|
||||
UINT8 *ROM = memory_region(machine, "master");
|
||||
|
||||
memory_configure_bank(machine, "bank1", 0, 1, &ROM[0x04000], 0x8000);
|
||||
memory_configure_bank(machine, "bank1", 1, 1, &ROM[0x14000], 0x8000);
|
||||
memory_set_bank(machine, "bank1", 0);
|
||||
|
||||
state->mastercpu = devtag_get_device(machine, "master");
|
||||
state->slavecpu = devtag_get_device(machine, "slave");
|
||||
|
||||
state_save_register_global(machine, state->irq_enable);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( jackal )
|
||||
{
|
||||
jackal_state *state = (jackal_state *)machine->driver_data;
|
||||
UINT8 *rgn = memory_region(machine, "master");
|
||||
|
||||
// HACK: running at the nominal clock rate, music stops working
|
||||
// at the beginning of the game. This fixes it.
|
||||
cpu_set_clockscale(cputag_get_cpu(machine, "slave"), 1.2f);
|
||||
|
||||
state->rambank = rgn;
|
||||
state->spritebank = rgn;
|
||||
|
||||
state->irq_enable = 0;
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( jackal )
|
||||
// basic machine hardware
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(jackal_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("master", M6809, MASTER_CLOCK/12) // verified on pcb
|
||||
MDRV_CPU_PROGRAM_MAP(master_map)
|
||||
MDRV_CPU_VBLANK_INT("screen", jackal_interrupt)
|
||||
@ -260,10 +378,10 @@ static MACHINE_DRIVER_START( jackal )
|
||||
|
||||
MDRV_QUANTUM_TIME(HZ(6000))
|
||||
|
||||
MDRV_MACHINE_START(jackal)
|
||||
MDRV_MACHINE_RESET(jackal)
|
||||
|
||||
// video hardware
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
MDRV_SCREEN_REFRESH_RATE(60)
|
||||
MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
|
||||
@ -278,7 +396,7 @@ static MACHINE_DRIVER_START( jackal )
|
||||
MDRV_VIDEO_START(jackal)
|
||||
MDRV_VIDEO_UPDATE(jackal)
|
||||
|
||||
// sound hardware
|
||||
/* sound hardware */
|
||||
MDRV_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
|
||||
MDRV_SOUND_ADD("ymsnd", YM2151, SOUND_CLOCK) // verified on pcb
|
||||
@ -286,7 +404,11 @@ static MACHINE_DRIVER_START( jackal )
|
||||
MDRV_SOUND_ROUTE(1, "rspeaker", 0.50)
|
||||
MACHINE_DRIVER_END
|
||||
|
||||
/* ROMs */
|
||||
/*************************************
|
||||
*
|
||||
* ROM definition(s)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
ROM_START( jackal )
|
||||
ROM_REGION( 0x20000, "master", 0 ) /* Banked 64k for 1st CPU */
|
||||
@ -388,7 +510,12 @@ ROM_START( topgunbl )
|
||||
ROM_LOAD( "631r09.bpr", 0x0100, 0x0100, CRC(a74dd86c) SHA1(571f606f8fc0fd3d98d26761de79ccb4cc9ab044) )
|
||||
ROM_END
|
||||
|
||||
/* Game Drivers */
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Game driver(s)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
GAME( 1986, jackal, 0, jackal, jackal, 0, ROT90, "Konami", "Jackal (World)", 0 )
|
||||
GAME( 1986, topgunr, jackal, jackal, jackal, 0, ROT90, "Konami", "Top Gunner (US)", 0 )
|
||||
|
@ -78,17 +78,16 @@ Blitter source graphics
|
||||
|
||||
|
||||
#include "driver.h"
|
||||
#include "tutankhm.h"
|
||||
#include "machine/konami1.h"
|
||||
#include "cpu/m6809/m6809.h"
|
||||
#include "cpu/mcs48/mcs48.h"
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "sound/ay8910.h"
|
||||
#include "sound/dac.h"
|
||||
#include "sound/flt_rc.h"
|
||||
#include "konamipt.h"
|
||||
#include "machine/konami1.h"
|
||||
#include "includes/timeplt.h"
|
||||
#include "includes/konamipt.h"
|
||||
|
||||
static int i8039_status;
|
||||
|
||||
static WRITE8_HANDLER( junofrst_bankselect_w )
|
||||
{
|
||||
@ -98,67 +97,70 @@ static WRITE8_HANDLER( junofrst_bankselect_w )
|
||||
|
||||
static READ8_DEVICE_HANDLER( junofrst_portA_r )
|
||||
{
|
||||
timeplt_state *state = (timeplt_state *)device->machine->driver_data;
|
||||
int timer;
|
||||
|
||||
|
||||
/* main xtal 14.318MHz, divided by 8 to get the CPU clock, further */
|
||||
/* divided by 1024 to get this timer */
|
||||
/* (divide by (1024/2), and not 1024, because the CPU cycle counter is */
|
||||
/* incremented every other state change of the clock) */
|
||||
timer = (cputag_get_total_cycles(device->machine, "audiocpu") / (1024/2)) & 0x0f;
|
||||
timer = (cpu_get_total_cycles(state->soundcpu) / (1024 / 2)) & 0x0f;
|
||||
|
||||
/* low three bits come from the 8039 */
|
||||
|
||||
return (timer << 4) | i8039_status;
|
||||
return (timer << 4) | state->i8039_status;
|
||||
}
|
||||
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( junofrst_portB_w )
|
||||
{
|
||||
static const char *const fltname[] = { "filter.0.0", "filter.0.1", "filter.0.2" };
|
||||
timeplt_state *state = (timeplt_state *)device->machine->driver_data;
|
||||
const device_config *filter[3] = { state->filter_0_0, state->filter_0_1, state->filter_0_2 };
|
||||
int i;
|
||||
|
||||
|
||||
for (i = 0;i < 3;i++)
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
int C;
|
||||
int C = 0;
|
||||
|
||||
if (data & 1)
|
||||
C += 47000; /* 47000pF = 0.047uF */
|
||||
if (data & 2)
|
||||
C += 220000; /* 220000pF = 0.22uF */
|
||||
|
||||
C = 0;
|
||||
if (data & 1) C += 47000; /* 47000pF = 0.047uF */
|
||||
if (data & 2) C += 220000; /* 220000pF = 0.22uF */
|
||||
data >>= 2;
|
||||
filter_rc_set_RC(devtag_get_device(device->machine, fltname[i]),FLT_RC_LOWPASS,1000,2200,200,CAP_P(C));
|
||||
filter_rc_set_RC(filter[i], FLT_RC_LOWPASS, 1000, 2200, 200, CAP_P(C));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static WRITE8_HANDLER( junofrst_sh_irqtrigger_w )
|
||||
{
|
||||
static int last;
|
||||
timeplt_state *state = (timeplt_state *)space->machine->driver_data;
|
||||
|
||||
|
||||
if (last == 0 && data == 1)
|
||||
if (state->last_irq == 0 && data == 1)
|
||||
{
|
||||
/* setting bit 0 low then high triggers IRQ on the sound CPU */
|
||||
cputag_set_input_line_and_vector(space->machine, "audiocpu", 0, HOLD_LINE, 0xff);
|
||||
cpu_set_input_line_and_vector(state->soundcpu, 0, HOLD_LINE, 0xff);
|
||||
}
|
||||
|
||||
last = data;
|
||||
state->last_irq = data;
|
||||
}
|
||||
|
||||
|
||||
static WRITE8_HANDLER( junofrst_i8039_irq_w )
|
||||
{
|
||||
cputag_set_input_line(space->machine, "mcu", 0, ASSERT_LINE);
|
||||
timeplt_state *state = (timeplt_state *)space->machine->driver_data;
|
||||
cpu_set_input_line(state->i8039, 0, ASSERT_LINE);
|
||||
}
|
||||
|
||||
|
||||
static WRITE8_HANDLER( i8039_irqen_and_status_w )
|
||||
{
|
||||
timeplt_state *state = (timeplt_state *)space->machine->driver_data;
|
||||
|
||||
if ((data & 0x80) == 0)
|
||||
cputag_set_input_line(space->machine, "mcu", 0, CLEAR_LINE);
|
||||
i8039_status = (data & 0x70) >> 4;
|
||||
cpu_set_input_line(state->i8039, 0, CLEAR_LINE);
|
||||
state->i8039_status = (data & 0x70) >> 4;
|
||||
}
|
||||
|
||||
|
||||
@ -171,14 +173,14 @@ static WRITE8_HANDLER( flip_screen_w )
|
||||
|
||||
static WRITE8_HANDLER( junofrst_coin_counter_w )
|
||||
{
|
||||
coin_counter_w(space->machine, offset,data);
|
||||
coin_counter_w(space->machine, offset, data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x7fff) AM_RAM AM_BASE_GENERIC(videoram) AM_SIZE_GENERIC(videoram)
|
||||
AM_RANGE(0x8000, 0x800f) AM_RAM AM_BASE_GENERIC(paletteram)
|
||||
AM_RANGE(0x0000, 0x7fff) AM_RAM AM_BASE_SIZE_MEMBER(timeplt_state, videoram, videoram_size)
|
||||
AM_RANGE(0x8000, 0x800f) AM_RAM AM_BASE_MEMBER(timeplt_state, paletteram)
|
||||
AM_RANGE(0x8010, 0x8010) AM_READ_PORT("DSW2")
|
||||
AM_RANGE(0x801c, 0x801c) AM_READ(watchdog_reset_r)
|
||||
AM_RANGE(0x8020, 0x8020) AM_READ_PORT("SYSTEM")
|
||||
@ -187,7 +189,7 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x802c, 0x802c) AM_READ_PORT("DSW1")
|
||||
AM_RANGE(0x8030, 0x8030) AM_WRITE(interrupt_enable_w)
|
||||
AM_RANGE(0x8031, 0x8032) AM_WRITE(junofrst_coin_counter_w)
|
||||
AM_RANGE(0x8033, 0x8033) AM_WRITEONLY AM_BASE(&tutankhm_scroll) /* not used in Juno */
|
||||
AM_RANGE(0x8033, 0x8033) AM_WRITEONLY AM_BASE_MEMBER(timeplt_state, scroll) /* not used in Juno */
|
||||
AM_RANGE(0x8034, 0x8035) AM_WRITE(flip_screen_w)
|
||||
AM_RANGE(0x8040, 0x8040) AM_WRITE(junofrst_sh_irqtrigger_w)
|
||||
AM_RANGE(0x8050, 0x8050) AM_WRITE(soundlatch_w)
|
||||
@ -276,8 +278,43 @@ static const ay8910_interface ay8910_config =
|
||||
};
|
||||
|
||||
|
||||
static MACHINE_START( junofrst )
|
||||
{
|
||||
timeplt_state *state = (timeplt_state *)machine->driver_data;
|
||||
|
||||
state->maincpu = devtag_get_device(machine, "maincpu");
|
||||
state->i8039 = devtag_get_device(machine, "mcu");
|
||||
state->soundcpu = devtag_get_device(machine, "audiocpu");
|
||||
state->filter_0_0 = devtag_get_device(machine, "filter.0.0");
|
||||
state->filter_0_1 = devtag_get_device(machine, "filter.0.1");
|
||||
state->filter_0_2 = devtag_get_device(machine, "filter.0.2");
|
||||
|
||||
state_save_register_global(machine, state->i8039_status);
|
||||
state_save_register_global(machine, state->last_irq);
|
||||
state_save_register_global(machine, state->flip_x);
|
||||
state_save_register_global(machine, state->flip_y);
|
||||
state_save_register_global_array(machine, state->blitterdata);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( junofrst )
|
||||
{
|
||||
timeplt_state *state = (timeplt_state *)machine->driver_data;
|
||||
|
||||
state->i8039_status = 0;
|
||||
state->last_irq = 0;
|
||||
state->flip_x = 0;
|
||||
state->flip_y = 0;
|
||||
state->blitterdata[0] = 0;
|
||||
state->blitterdata[1] = 0;
|
||||
state->blitterdata[2] = 0;
|
||||
state->blitterdata[3] = 0;
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( junofrst )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(timeplt_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", M6809, 1500000) /* 1.5 MHz ??? */
|
||||
MDRV_CPU_PROGRAM_MAP(main_map)
|
||||
@ -290,6 +327,9 @@ static MACHINE_DRIVER_START( junofrst )
|
||||
MDRV_CPU_PROGRAM_MAP(mcu_map)
|
||||
MDRV_CPU_IO_MAP(mcu_io_map)
|
||||
|
||||
MDRV_MACHINE_START(junofrst)
|
||||
MDRV_MACHINE_RESET(junofrst)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
MDRV_SCREEN_REFRESH_RATE(30)
|
||||
@ -298,7 +338,6 @@ 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 */
|
||||
|
@ -10,43 +10,35 @@
|
||||
|
||||
#include "driver.h"
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "pooyan.h"
|
||||
#include "audio/timeplt.h"
|
||||
#include "includes/timeplt.h"
|
||||
|
||||
|
||||
#define MASTER_CLOCK XTAL_18_432MHz
|
||||
|
||||
|
||||
|
||||
static UINT8 irq_enable;
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Interrupts
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static MACHINE_START( pooyan )
|
||||
{
|
||||
state_save_register_global(machine, irq_enable);
|
||||
}
|
||||
|
||||
|
||||
static INTERRUPT_GEN( pooyan_interrupt )
|
||||
{
|
||||
if (irq_enable)
|
||||
timeplt_state *state = (timeplt_state *)device->machine->driver_data;
|
||||
|
||||
if (state->irq_enable)
|
||||
cpu_set_input_line(device, INPUT_LINE_NMI, ASSERT_LINE);
|
||||
}
|
||||
|
||||
|
||||
static WRITE8_HANDLER( irq_enable_w )
|
||||
{
|
||||
irq_enable = data & 1;
|
||||
if (!irq_enable)
|
||||
cputag_set_input_line(space->machine, "maincpu", INPUT_LINE_NMI, CLEAR_LINE);
|
||||
}
|
||||
timeplt_state *state = (timeplt_state *)space->machine->driver_data;
|
||||
|
||||
state->irq_enable = data & 1;
|
||||
if (!state->irq_enable)
|
||||
cpu_set_input_line(state->maincpu, INPUT_LINE_NMI, CLEAR_LINE);
|
||||
}
|
||||
|
||||
|
||||
/*************************************
|
||||
@ -57,11 +49,11 @@ static WRITE8_HANDLER( irq_enable_w )
|
||||
|
||||
static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x7fff) AM_ROM
|
||||
AM_RANGE(0x8000, 0x83ff) AM_RAM_WRITE(pooyan_colorram_w) AM_BASE_GENERIC(colorram)
|
||||
AM_RANGE(0x8400, 0x87ff) AM_RAM_WRITE(pooyan_videoram_w) AM_BASE_GENERIC(videoram)
|
||||
AM_RANGE(0x8000, 0x83ff) AM_RAM_WRITE(pooyan_colorram_w) AM_BASE_MEMBER(timeplt_state, colorram)
|
||||
AM_RANGE(0x8400, 0x87ff) AM_RAM_WRITE(pooyan_videoram_w) AM_BASE_MEMBER(timeplt_state, videoram)
|
||||
AM_RANGE(0x8800, 0x8fff) AM_RAM
|
||||
AM_RANGE(0x9000, 0x90ff) AM_MIRROR(0x0b00) AM_RAM AM_BASE_GENERIC(spriteram)
|
||||
AM_RANGE(0x9400, 0x94ff) AM_MIRROR(0x0b00) AM_RAM AM_BASE_GENERIC(spriteram2)
|
||||
AM_RANGE(0x9000, 0x90ff) AM_MIRROR(0x0b00) AM_RAM AM_BASE_MEMBER(timeplt_state, spriteram)
|
||||
AM_RANGE(0x9400, 0x94ff) AM_MIRROR(0x0b00) AM_RAM AM_BASE_MEMBER(timeplt_state, spriteram2)
|
||||
AM_RANGE(0xa000, 0xa000) AM_MIRROR(0x5e7f) AM_READ_PORT("DSW1")
|
||||
AM_RANGE(0xa080, 0xa080) AM_MIRROR(0x5e1f) AM_READ_PORT("IN0")
|
||||
AM_RANGE(0xa0a0, 0xa0a0) AM_MIRROR(0x5e1f) AM_READ_PORT("IN1")
|
||||
@ -213,14 +205,35 @@ GFXDECODE_END
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static MACHINE_START( pooyan )
|
||||
{
|
||||
timeplt_state *state = (timeplt_state *)machine->driver_data;
|
||||
|
||||
state->maincpu = devtag_get_device(machine, "maincpu");
|
||||
|
||||
state_save_register_global(machine, state->irq_enable);
|
||||
}
|
||||
|
||||
|
||||
static MACHINE_RESET( pooyan )
|
||||
{
|
||||
timeplt_state *state = (timeplt_state *)machine->driver_data;
|
||||
state->irq_enable = 0;
|
||||
}
|
||||
|
||||
|
||||
static MACHINE_DRIVER_START( pooyan )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(timeplt_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", Z80, MASTER_CLOCK/3/2)
|
||||
MDRV_CPU_PROGRAM_MAP(main_map)
|
||||
MDRV_CPU_VBLANK_INT("screen", pooyan_interrupt)
|
||||
|
||||
MDRV_MACHINE_START(pooyan)
|
||||
MDRV_MACHINE_RESET(pooyan)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
@ -241,7 +254,6 @@ static MACHINE_DRIVER_START( pooyan )
|
||||
MACHINE_DRIVER_END
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* ROM definitions
|
||||
|
@ -190,67 +190,58 @@ TODO:
|
||||
|
||||
#include "driver.h"
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "audio/timeplt.h"
|
||||
#include "sound/namco.h"
|
||||
#include "sound/samples.h"
|
||||
#include "includes/timeplt.h"
|
||||
|
||||
#define MASTER_CLOCK XTAL_18_432MHz
|
||||
|
||||
extern UINT8 *rallyx_videoram,*rallyx_radarattr;
|
||||
WRITE8_HANDLER( rallyx_videoram_w );
|
||||
WRITE8_HANDLER( rallyx_scrollx_w );
|
||||
WRITE8_HANDLER( rallyx_scrolly_w );
|
||||
WRITE8_HANDLER( tactcian_starson_w );
|
||||
PALETTE_INIT( rallyx );
|
||||
PALETTE_INIT( jungler );
|
||||
VIDEO_START( rallyx );
|
||||
VIDEO_START( jungler );
|
||||
VIDEO_START( locomotn );
|
||||
VIDEO_START( commsega );
|
||||
VIDEO_UPDATE( rallyx );
|
||||
VIDEO_UPDATE( jungler );
|
||||
VIDEO_UPDATE( locomotn );
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Memory handlers
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static WRITE8_HANDLER( rallyx_interrupt_vector_w )
|
||||
{
|
||||
cpu_set_input_line_vector(cputag_get_cpu(space->machine, "maincpu"), 0, data);
|
||||
cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE);
|
||||
}
|
||||
timeplt_state *state = (timeplt_state *)space->machine->driver_data;
|
||||
|
||||
cpu_set_input_line_vector(state->maincpu, 0, data);
|
||||
cpu_set_input_line(state->maincpu, 0, CLEAR_LINE);
|
||||
}
|
||||
|
||||
|
||||
static WRITE8_HANDLER( rallyx_bang_w )
|
||||
{
|
||||
const device_config *samples = devtag_get_device(space->machine, "samples");
|
||||
static int last;
|
||||
timeplt_state *state = (timeplt_state *)space->machine->driver_data;
|
||||
|
||||
if (data == 0 && last != 0)
|
||||
sample_start(samples,0,0,0);
|
||||
if (data == 0 && state->last_bang != 0)
|
||||
sample_start(state->samples, 0, 0, 0);
|
||||
|
||||
last = data;
|
||||
state->last_bang = data;
|
||||
}
|
||||
|
||||
|
||||
static WRITE8_HANDLER( rallyx_latch_w )
|
||||
{
|
||||
timeplt_state *state = (timeplt_state *)space->machine->driver_data;
|
||||
int bit = data & 1;
|
||||
|
||||
switch (offset)
|
||||
{
|
||||
case 0x00: /* BANG */
|
||||
rallyx_bang_w(space,0,bit);
|
||||
rallyx_bang_w(space, 0, bit);
|
||||
break;
|
||||
|
||||
case 0x01: /* INT ON */
|
||||
cpu_interrupt_enable(cputag_get_cpu(space->machine, "maincpu"), bit);
|
||||
cpu_interrupt_enable(state->maincpu, bit);
|
||||
if (!bit)
|
||||
cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE);
|
||||
cpu_set_input_line(state->maincpu, 0, CLEAR_LINE);
|
||||
break;
|
||||
|
||||
case 0x02: /* SOUND ON */
|
||||
/* this doesn't work in New Rally X so I'm not supporting it */
|
||||
// pacman_sound_enable_w(devtag_get_device(space->machine, "namco"),bit);
|
||||
// pacman_sound_enable_w(devtag_get_device(space->machine, "namco"), bit);
|
||||
break;
|
||||
|
||||
case 0x03: /* FLIP */
|
||||
@ -258,19 +249,19 @@ static WRITE8_HANDLER( rallyx_latch_w )
|
||||
break;
|
||||
|
||||
case 0x04:
|
||||
set_led_status(space->machine, 0,bit);
|
||||
set_led_status(space->machine, 0, bit);
|
||||
break;
|
||||
|
||||
case 0x05:
|
||||
set_led_status(space->machine, 1,bit);
|
||||
set_led_status(space->machine, 1, bit);
|
||||
break;
|
||||
|
||||
case 0x06:
|
||||
coin_lockout_w(space->machine, 0,!bit);
|
||||
coin_lockout_w(space->machine, 0, !bit);
|
||||
break;
|
||||
|
||||
case 0x07:
|
||||
coin_counter_w(space->machine, 0,bit);
|
||||
coin_counter_w(space->machine, 0, bit);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -278,6 +269,7 @@ static WRITE8_HANDLER( rallyx_latch_w )
|
||||
|
||||
static WRITE8_HANDLER( locomotn_latch_w )
|
||||
{
|
||||
timeplt_state *state = (timeplt_state *)space->machine->driver_data;
|
||||
int bit = data & 1;
|
||||
|
||||
switch (offset)
|
||||
@ -287,7 +279,7 @@ static WRITE8_HANDLER( locomotn_latch_w )
|
||||
break;
|
||||
|
||||
case 0x01: /* INTST */
|
||||
cpu_interrupt_enable(cputag_get_cpu(space->machine, "maincpu"), bit);
|
||||
cpu_interrupt_enable(state->maincpu, bit);
|
||||
break;
|
||||
|
||||
case 0x02: /* MUT */
|
||||
@ -299,7 +291,7 @@ static WRITE8_HANDLER( locomotn_latch_w )
|
||||
break;
|
||||
|
||||
case 0x04: /* OUT1 */
|
||||
coin_counter_w(space->machine, 0,bit);
|
||||
coin_counter_w(space->machine, 0, bit);
|
||||
break;
|
||||
|
||||
case 0x05: /* OUT2 */
|
||||
@ -310,21 +302,26 @@ static WRITE8_HANDLER( locomotn_latch_w )
|
||||
break;
|
||||
|
||||
case 0x07: /* STARSON */
|
||||
tactcian_starson_w(space,offset,bit);
|
||||
tactcian_starson_w(space, offset, bit);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Address maps
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static ADDRESS_MAP_START( rallyx_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x3fff) AM_ROM
|
||||
AM_RANGE(0x8000, 0x8fff) AM_RAM_WRITE(rallyx_videoram_w) AM_BASE(&rallyx_videoram)
|
||||
AM_RANGE(0x8000, 0x8fff) AM_RAM_WRITE(rallyx_videoram_w) AM_BASE_MEMBER(timeplt_state, videoram)
|
||||
AM_RANGE(0x9800, 0x9fff) AM_RAM
|
||||
AM_RANGE(0xa000, 0xa000) AM_READ_PORT("P1")
|
||||
AM_RANGE(0xa080, 0xa080) AM_READ_PORT("P2")
|
||||
AM_RANGE(0xa100, 0xa100) AM_READ_PORT("DSW")
|
||||
AM_RANGE(0xa000, 0xa00f) AM_WRITEONLY AM_BASE(&rallyx_radarattr)
|
||||
AM_RANGE(0xa000, 0xa00f) AM_WRITEONLY AM_BASE_MEMBER(timeplt_state, radarattr)
|
||||
AM_RANGE(0xa080, 0xa080) AM_WRITE(watchdog_reset_w)
|
||||
AM_RANGE(0xa100, 0xa11f) AM_DEVWRITE("namco", pacman_sound_w) AM_BASE(&namco_soundregs)
|
||||
AM_RANGE(0xa130, 0xa130) AM_WRITE(rallyx_scrollx_w)
|
||||
@ -341,13 +338,13 @@ ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( jungler_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x7fff) AM_ROM
|
||||
AM_RANGE(0x8000, 0x8fff) AM_RAM_WRITE(rallyx_videoram_w) AM_BASE(&rallyx_videoram)
|
||||
AM_RANGE(0x8000, 0x8fff) AM_RAM_WRITE(rallyx_videoram_w) AM_BASE_MEMBER(timeplt_state, videoram)
|
||||
AM_RANGE(0x9800, 0x9fff) AM_RAM
|
||||
AM_RANGE(0xa000, 0xa000) AM_READ_PORT("P1")
|
||||
AM_RANGE(0xa080, 0xa080) AM_READ_PORT("P2")
|
||||
AM_RANGE(0xa100, 0xa100) AM_READ_PORT("DSW1")
|
||||
AM_RANGE(0xa180, 0xa180) AM_READ_PORT("DSW2")
|
||||
AM_RANGE(0xa000, 0xa00f) AM_MIRROR(0x00f0) AM_WRITEONLY AM_BASE(&rallyx_radarattr) // jungler writes to a03x
|
||||
AM_RANGE(0xa000, 0xa00f) AM_MIRROR(0x00f0) AM_WRITEONLY AM_BASE_MEMBER(timeplt_state, radarattr) // jungler writes to a03x
|
||||
AM_RANGE(0xa080, 0xa080) AM_WRITE(watchdog_reset_w)
|
||||
AM_RANGE(0xa100, 0xa100) AM_WRITE(soundlatch_w)
|
||||
AM_RANGE(0xa130, 0xa130) AM_WRITE(rallyx_scrollx_w) /* only jungler and tactcian */
|
||||
@ -356,6 +353,11 @@ static ADDRESS_MAP_START( jungler_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Input ports
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static INPUT_PORTS_START( rallyx )
|
||||
PORT_START("P1")
|
||||
@ -759,6 +761,11 @@ static INPUT_PORTS_START( commsega )
|
||||
INPUT_PORTS_END
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Graphics definitions
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static const gfx_layout rallyx_charlayout =
|
||||
{
|
||||
@ -832,6 +839,12 @@ static GFXDECODE_START( jungler )
|
||||
GFXDECODE_END
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Sound interfaces
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static const namco_interface namco_config =
|
||||
{
|
||||
3, /* number of voices */
|
||||
@ -853,14 +866,45 @@ static const samples_interface rallyx_samples_interface =
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Machine driver
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static MACHINE_START( rallyx )
|
||||
{
|
||||
timeplt_state *state = (timeplt_state *)machine->driver_data;
|
||||
|
||||
state->maincpu = devtag_get_device(machine, "maincpu");
|
||||
state->samples = devtag_get_device(machine, "samples");
|
||||
|
||||
state_save_register_global(machine, state->last_bang);
|
||||
state_save_register_global(machine, state->stars_enable);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( rallyx )
|
||||
{
|
||||
timeplt_state *state = (timeplt_state *)machine->driver_data;
|
||||
|
||||
state->last_bang = 0;
|
||||
state->stars_enable = 0;
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( rallyx )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(timeplt_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", Z80, MASTER_CLOCK/6) /* 3.072 MHz */
|
||||
MDRV_CPU_PROGRAM_MAP(rallyx_map)
|
||||
MDRV_CPU_IO_MAP(io_map)
|
||||
MDRV_CPU_VBLANK_INT("screen", irq0_line_assert)
|
||||
|
||||
MDRV_MACHINE_START(rallyx)
|
||||
MDRV_MACHINE_RESET(rallyx)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_VIDEO_ATTRIBUTES(VIDEO_HAS_SHADOWS)
|
||||
|
||||
@ -893,11 +937,17 @@ MACHINE_DRIVER_END
|
||||
|
||||
static MACHINE_DRIVER_START( jungler )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(timeplt_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", Z80, MASTER_CLOCK/6) /* 3.072 MHz */
|
||||
MDRV_CPU_PROGRAM_MAP(jungler_map)
|
||||
MDRV_CPU_VBLANK_INT("screen", nmi_line_pulse)
|
||||
|
||||
MDRV_MACHINE_START(rallyx)
|
||||
MDRV_MACHINE_RESET(rallyx)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_VIDEO_ATTRIBUTES(VIDEO_HAS_SHADOWS)
|
||||
|
||||
@ -957,12 +1007,11 @@ static MACHINE_DRIVER_START( commsega )
|
||||
MACHINE_DRIVER_END
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
Game driver(s)
|
||||
|
||||
***************************************************************************/
|
||||
/*************************************
|
||||
*
|
||||
* ROM definition(s)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
ROM_START( rallyx )
|
||||
ROM_REGION( 0x10000, "maincpu", 0 )
|
||||
@ -1328,18 +1377,23 @@ ROM_START( commsega )
|
||||
ROM_END
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Game driver(s)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
GAME( 1980, rallyx, 0, rallyx, rallyx, 0, ROT0, "Namco", "Rally X (32k Ver.?)", GAME_IMPERFECT_SOUND )
|
||||
GAME( 1980, rallyxa, rallyx, rallyx, rallyx, 0, ROT0, "Namco", "Rally X", GAME_IMPERFECT_SOUND )
|
||||
GAME( 1980, rallyxm, rallyx, rallyx, rallyx, 0, ROT0, "[Namco] (Midway license)", "Rally X (Midway)", GAME_IMPERFECT_SOUND )
|
||||
GAME( 1981, nrallyx, 0, rallyx, nrallyx, 0, ROT0, "Namco", "New Rally X", GAME_IMPERFECT_SOUND )
|
||||
GAME( 1981, nrallyxb, nrallyx, rallyx, nrallyx, 0, ROT0, "Namco", "New Rally X (bootleg?) ", GAME_IMPERFECT_SOUND )
|
||||
GAME( 1981, jungler, 0, jungler, jungler, 0, ROT90, "Konami", "Jungler", 0 )
|
||||
GAME( 1981, junglers, jungler, jungler, jungler, 0, ROT90, "[Konami] (Stern license)", "Jungler (Stern)", 0 )
|
||||
GAME( 1982, tactcian, 0, tactcian, tactcian, 0, ROT90, "[Konami] (Sega license)", "Tactician (set 1)", 0 )
|
||||
GAME( 1981, tactcian2,tactcian, tactcian, tactcian, 0, ROT90, "[Konami] (Sega license)", "Tactician (set 2)", 0 )
|
||||
GAME( 1982, locomotn, 0, locomotn, locomotn, 0, ROT90, "Konami (Centuri license)", "Loco-Motion", 0 )
|
||||
GAME( 1982, gutangtn, locomotn, locomotn, locomotn, 0, ROT90, "Konami (Sega license)", "Guttang Gottong", 0 )
|
||||
GAME( 1982, cottong, locomotn, locomotn, locomotn, 0, ROT90, "bootleg", "Cotocoto Cottong", 0 )
|
||||
GAME( 1982, locoboot, locomotn, locomotn, locomotn, 0, ROT90, "bootleg", "Loco-Motion (bootleg)", 0 )
|
||||
GAME( 1983, commsega, 0, commsega, commsega, 0, ROT90, "Sega", "Commando (Sega)", GAME_IMPERFECT_SOUND )
|
||||
GAME( 1980, rallyx, 0, rallyx, rallyx, 0, ROT0, "Namco", "Rally X (32k Ver.?)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
|
||||
GAME( 1980, rallyxa, rallyx, rallyx, rallyx, 0, ROT0, "Namco", "Rally X", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
|
||||
GAME( 1980, rallyxm, rallyx, rallyx, rallyx, 0, ROT0, "[Namco] (Midway license)", "Rally X (Midway)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
|
||||
GAME( 1981, nrallyx, 0, rallyx, nrallyx, 0, ROT0, "Namco", "New Rally X", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
|
||||
GAME( 1981, nrallyxb, nrallyx, rallyx, nrallyx, 0, ROT0, "Namco", "New Rally X (bootleg?) ", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
|
||||
GAME( 1981, jungler, 0, jungler, jungler, 0, ROT90, "Konami", "Jungler", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1981, junglers, jungler, jungler, jungler, 0, ROT90, "[Konami] (Stern license)", "Jungler (Stern)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1982, tactcian, 0, tactcian, tactcian, 0, ROT90, "[Konami] (Sega license)", "Tactician (set 1)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1981, tactcian2,tactcian, tactcian, tactcian, 0, ROT90, "[Konami] (Sega license)", "Tactician (set 2)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1982, locomotn, 0, locomotn, locomotn, 0, ROT90, "Konami (Centuri license)", "Loco-Motion", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1982, gutangtn, locomotn, locomotn, locomotn, 0, ROT90, "Konami (Sega license)", "Guttang Gottong", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1982, cottong, locomotn, locomotn, locomotn, 0, ROT90, "bootleg", "Cotocoto Cottong", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1982, locoboot, locomotn, locomotn, locomotn, 0, ROT90, "bootleg", "Loco-Motion (bootleg)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1983, commsega, 0, commsega, commsega, 0, ROT90, "Sega", "Commando (Sega)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
|
||||
|
@ -1,17 +1,16 @@
|
||||
/***************************************************************************
|
||||
|
||||
Roc'n Rope (c) 1983 Konami
|
||||
Roc'n Rope (c) 1983 Konami
|
||||
|
||||
Based on drivers from Juno First emulator by Chris Hardy (chrish@kcbbs.gen.nz)
|
||||
Based on drivers from Juno First emulator by Chris Hardy (chrish@kcbbs.gen.nz)
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "driver.h"
|
||||
#include "cpu/m6809/m6809.h"
|
||||
#include "machine/konami1.h"
|
||||
#include "audio/timeplt.h"
|
||||
#include "konamipt.h"
|
||||
#include "rocnrope.h"
|
||||
#include "includes/timeplt.h"
|
||||
#include "includes/konamipt.h"
|
||||
|
||||
#define MASTER_CLOCK XTAL_18_432MHz
|
||||
|
||||
@ -44,11 +43,11 @@ static ADDRESS_MAP_START( rocnrope_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x3083, 0x3083) AM_READ_PORT("DSW1")
|
||||
AM_RANGE(0x3000, 0x3000) AM_READ_PORT("DSW2")
|
||||
AM_RANGE(0x3100, 0x3100) AM_READ_PORT("DSW3")
|
||||
AM_RANGE(0x4000, 0x402f) AM_RAM AM_BASE_MEMBER(rocnrope_state, spriteram2)
|
||||
AM_RANGE(0x4400, 0x442f) AM_RAM AM_BASE_SIZE_MEMBER(rocnrope_state, spriteram, spriteram_size)
|
||||
AM_RANGE(0x4000, 0x402f) AM_RAM AM_BASE_MEMBER(timeplt_state, spriteram2)
|
||||
AM_RANGE(0x4400, 0x442f) AM_RAM AM_BASE_SIZE_MEMBER(timeplt_state, spriteram, spriteram_size)
|
||||
AM_RANGE(0x4000, 0x47ff) AM_RAM
|
||||
AM_RANGE(0x4800, 0x4bff) AM_RAM_WRITE(rocnrope_colorram_w) AM_BASE_MEMBER(rocnrope_state, colorram)
|
||||
AM_RANGE(0x4c00, 0x4fff) AM_RAM_WRITE(rocnrope_videoram_w) AM_BASE_MEMBER(rocnrope_state, videoram)
|
||||
AM_RANGE(0x4800, 0x4bff) AM_RAM_WRITE(rocnrope_colorram_w) AM_BASE_MEMBER(timeplt_state, colorram)
|
||||
AM_RANGE(0x4c00, 0x4fff) AM_RAM_WRITE(rocnrope_videoram_w) AM_BASE_MEMBER(timeplt_state, videoram)
|
||||
AM_RANGE(0x5000, 0x5fff) AM_RAM
|
||||
AM_RANGE(0x8000, 0x8000) AM_WRITE(watchdog_reset_w)
|
||||
AM_RANGE(0x8080, 0x8080) AM_WRITE(rocnrope_flipscreen_w)
|
||||
@ -186,7 +185,7 @@ GFXDECODE_END
|
||||
static MACHINE_DRIVER_START( rocnrope )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(rocnrope_state)
|
||||
MDRV_DRIVER_DATA(timeplt_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", M6809, MASTER_CLOCK / 3 / 4) /* Verified in schematics */
|
||||
|
@ -46,14 +46,10 @@
|
||||
|
||||
#include "driver.h"
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "timeplt.h"
|
||||
#include "audio/timeplt.h"
|
||||
#include "konamipt.h"
|
||||
|
||||
#define MASTER_CLOCK XTAL_18_432MHz
|
||||
|
||||
static UINT8 nmi_enable;
|
||||
#include "includes/timeplt.h"
|
||||
#include "includes/konamipt.h"
|
||||
|
||||
#define MASTER_CLOCK XTAL_18_432MHz
|
||||
|
||||
/*************************************
|
||||
*
|
||||
@ -61,24 +57,22 @@ static UINT8 nmi_enable;
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static MACHINE_START( timeplt )
|
||||
{
|
||||
state_save_register_global(machine, nmi_enable);
|
||||
}
|
||||
|
||||
|
||||
static INTERRUPT_GEN( timeplt_interrupt )
|
||||
{
|
||||
if (nmi_enable)
|
||||
timeplt_state *state = (timeplt_state *)device->machine->driver_data;
|
||||
|
||||
if (state->nmi_enable)
|
||||
cpu_set_input_line(device, INPUT_LINE_NMI, ASSERT_LINE);
|
||||
}
|
||||
|
||||
|
||||
static WRITE8_HANDLER( timeplt_nmi_enable_w )
|
||||
{
|
||||
nmi_enable = data & 1;
|
||||
if (!nmi_enable)
|
||||
cputag_set_input_line(space->machine, "maincpu", INPUT_LINE_NMI, CLEAR_LINE);
|
||||
timeplt_state *state = (timeplt_state *)space->machine->driver_data;
|
||||
|
||||
state->nmi_enable = data & 1;
|
||||
if (!state->nmi_enable)
|
||||
cpu_set_input_line(state->maincpu, INPUT_LINE_NMI, CLEAR_LINE);
|
||||
}
|
||||
|
||||
|
||||
@ -121,11 +115,11 @@ static READ8_HANDLER( psurge_protection_r )
|
||||
static ADDRESS_MAP_START( timeplt_main_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
ADDRESS_MAP_UNMAP_HIGH
|
||||
AM_RANGE(0x0000, 0x5fff) AM_ROM
|
||||
AM_RANGE(0xa000, 0xa3ff) AM_RAM_WRITE(timeplt_colorram_w) AM_BASE_GENERIC(colorram)
|
||||
AM_RANGE(0xa400, 0xa7ff) AM_RAM_WRITE(timeplt_videoram_w) AM_BASE_GENERIC(videoram)
|
||||
AM_RANGE(0xa000, 0xa3ff) AM_RAM_WRITE(timeplt_colorram_w) AM_BASE_MEMBER(timeplt_state, colorram)
|
||||
AM_RANGE(0xa400, 0xa7ff) AM_RAM_WRITE(timeplt_videoram_w) AM_BASE_MEMBER(timeplt_state, videoram)
|
||||
AM_RANGE(0xa800, 0xafff) AM_RAM
|
||||
AM_RANGE(0xb000, 0xb0ff) AM_MIRROR(0x0b00) AM_RAM AM_BASE_GENERIC(spriteram)
|
||||
AM_RANGE(0xb400, 0xb4ff) AM_MIRROR(0x0b00) AM_RAM AM_BASE_GENERIC(spriteram2)
|
||||
AM_RANGE(0xb000, 0xb0ff) AM_MIRROR(0x0b00) AM_RAM AM_BASE_MEMBER(timeplt_state, spriteram)
|
||||
AM_RANGE(0xb400, 0xb4ff) AM_MIRROR(0x0b00) AM_RAM AM_BASE_MEMBER(timeplt_state, spriteram2)
|
||||
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(timeplt_nmi_enable_w)
|
||||
@ -145,11 +139,11 @@ static ADDRESS_MAP_START( psurge_main_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
ADDRESS_MAP_UNMAP_HIGH
|
||||
AM_RANGE(0x0000, 0x5fff) AM_ROM
|
||||
AM_RANGE(0x6004, 0x6004) AM_READ(psurge_protection_r)
|
||||
AM_RANGE(0xa000, 0xa3ff) AM_RAM_WRITE(timeplt_colorram_w) AM_BASE_GENERIC(colorram)
|
||||
AM_RANGE(0xa400, 0xa7ff) AM_RAM_WRITE(timeplt_videoram_w) AM_BASE_GENERIC(videoram)
|
||||
AM_RANGE(0xa000, 0xa3ff) AM_RAM_WRITE(timeplt_colorram_w) AM_BASE_MEMBER(timeplt_state, colorram)
|
||||
AM_RANGE(0xa400, 0xa7ff) AM_RAM_WRITE(timeplt_videoram_w) AM_BASE_MEMBER(timeplt_state, videoram)
|
||||
AM_RANGE(0xa800, 0xafff) AM_RAM
|
||||
AM_RANGE(0xb000, 0xb0ff) AM_MIRROR(0x0b00) AM_RAM AM_BASE_GENERIC(spriteram)
|
||||
AM_RANGE(0xb400, 0xb4ff) AM_MIRROR(0x0b00) AM_RAM AM_BASE_GENERIC(spriteram2)
|
||||
AM_RANGE(0xb000, 0xb0ff) AM_MIRROR(0x0b00) AM_RAM AM_BASE_MEMBER(timeplt_state, spriteram)
|
||||
AM_RANGE(0xb400, 0xb4ff) AM_MIRROR(0x0b00) AM_RAM AM_BASE_MEMBER(timeplt_state, spriteram2)
|
||||
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(0xc302, 0xc302) AM_MIRROR(0x0cf1) AM_WRITE(timeplt_flipscreen_w)
|
||||
@ -307,14 +301,41 @@ GFXDECODE_END
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static MACHINE_START( common )
|
||||
{
|
||||
timeplt_state *state = (timeplt_state *)machine->driver_data;
|
||||
|
||||
state->maincpu = devtag_get_device(machine, "maincpu");
|
||||
}
|
||||
|
||||
static MACHINE_START( timeplt )
|
||||
{
|
||||
timeplt_state *state = (timeplt_state *)machine->driver_data;
|
||||
|
||||
MACHINE_START_CALL(common);
|
||||
|
||||
state_save_register_global(machine, state->nmi_enable);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( timeplt )
|
||||
{
|
||||
timeplt_state *state = (timeplt_state *)machine->driver_data;
|
||||
|
||||
state->nmi_enable = 0;
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( timeplt )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(timeplt_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", Z80, MASTER_CLOCK/3/2) /* not confirmed, but common for Konami games of the era */
|
||||
MDRV_CPU_PROGRAM_MAP(timeplt_main_map)
|
||||
MDRV_CPU_VBLANK_INT("screen", timeplt_interrupt)
|
||||
|
||||
MDRV_MACHINE_START(timeplt)
|
||||
MDRV_MACHINE_RESET(timeplt)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_VIDEO_ATTRIBUTES(VIDEO_UPDATE_SCANLINE)
|
||||
@ -345,7 +366,8 @@ static MACHINE_DRIVER_START( psurge )
|
||||
MDRV_CPU_PROGRAM_MAP(psurge_main_map)
|
||||
MDRV_CPU_VBLANK_INT("screen", nmi_line_pulse)
|
||||
|
||||
MDRV_MACHINE_START(0)
|
||||
MDRV_MACHINE_START(common)
|
||||
MDRV_MACHINE_RESET(0)
|
||||
MACHINE_DRIVER_END
|
||||
|
||||
|
||||
|
@ -21,13 +21,9 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "driver.h"
|
||||
#include "tutankhm.h"
|
||||
#include "cpu/m6809/m6809.h"
|
||||
#include "audio/timeplt.h"
|
||||
#include "konamipt.h"
|
||||
|
||||
static UINT8 irq_toggle;
|
||||
static UINT8 irq_enable;
|
||||
#include "includes/timeplt.h"
|
||||
#include "includes/konamipt.h"
|
||||
|
||||
|
||||
/*************************************
|
||||
@ -38,20 +34,23 @@ static UINT8 irq_enable;
|
||||
|
||||
static INTERRUPT_GEN( tutankhm_interrupt )
|
||||
{
|
||||
timeplt_state *state = (timeplt_state *)device->machine->driver_data;
|
||||
|
||||
/* flip flops cause the interrupt to be signalled every other frame */
|
||||
irq_toggle ^= 1;
|
||||
if (irq_toggle && irq_enable)
|
||||
state->irq_toggle ^= 1;
|
||||
if (state->irq_toggle && state->irq_enable)
|
||||
cpu_set_input_line(device, 0, ASSERT_LINE);
|
||||
}
|
||||
|
||||
|
||||
static WRITE8_HANDLER( irq_enable_w )
|
||||
{
|
||||
irq_enable = data & 1;
|
||||
if (!irq_enable)
|
||||
cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE);
|
||||
}
|
||||
timeplt_state *state = (timeplt_state *)space->machine->driver_data;
|
||||
|
||||
state->irq_enable = data & 1;
|
||||
if (!state->irq_enable)
|
||||
cpu_set_input_line(state->maincpu, 0, CLEAR_LINE);
|
||||
}
|
||||
|
||||
|
||||
/*************************************
|
||||
@ -60,21 +59,12 @@ static WRITE8_HANDLER( irq_enable_w )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static MACHINE_START( tutankhm )
|
||||
{
|
||||
memory_configure_bank(machine, "bank1", 0, 16, memory_region(machine, "maincpu") + 0x10000, 0x1000);
|
||||
state_save_register_global(machine, irq_toggle);
|
||||
state_save_register_global(machine, irq_enable);
|
||||
}
|
||||
|
||||
|
||||
static WRITE8_HANDLER( tutankhm_bankselect_w )
|
||||
{
|
||||
memory_set_bank(space->machine, "bank1", data & 0x0f);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Outputs
|
||||
@ -93,7 +83,6 @@ static WRITE8_HANDLER( tutankhm_coin_counter_w )
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Main CPU memory handlers
|
||||
@ -101,9 +90,9 @@ static WRITE8_HANDLER( tutankhm_coin_counter_w )
|
||||
*************************************/
|
||||
|
||||
static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x7fff) AM_RAM AM_BASE_GENERIC(videoram) AM_SIZE_GENERIC(videoram)
|
||||
AM_RANGE(0x8000, 0x800f) AM_MIRROR(0x00f0) AM_RAM AM_BASE_GENERIC(paletteram)
|
||||
AM_RANGE(0x8100, 0x8100) AM_MIRROR(0x000f) AM_RAM AM_BASE(&tutankhm_scroll)
|
||||
AM_RANGE(0x0000, 0x7fff) AM_RAM AM_BASE_SIZE_MEMBER(timeplt_state, videoram, videoram_size)
|
||||
AM_RANGE(0x8000, 0x800f) AM_MIRROR(0x00f0) AM_RAM AM_BASE_MEMBER(timeplt_state, paletteram)
|
||||
AM_RANGE(0x8100, 0x8100) AM_MIRROR(0x000f) AM_RAM AM_BASE_MEMBER(timeplt_state, 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 */
|
||||
@ -124,7 +113,6 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Port definitions
|
||||
@ -171,21 +159,48 @@ static INPUT_PORTS_START( tutankhm )
|
||||
INPUT_PORTS_END
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Machine drivers
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static MACHINE_START( tutankhm )
|
||||
{
|
||||
timeplt_state *state = (timeplt_state *)machine->driver_data;
|
||||
|
||||
memory_configure_bank(machine, "bank1", 0, 16, memory_region(machine, "maincpu") + 0x10000, 0x1000);
|
||||
|
||||
state->maincpu = devtag_get_device(machine, "maincpu");
|
||||
|
||||
state_save_register_global(machine, state->irq_toggle);
|
||||
state_save_register_global(machine, state->irq_enable);
|
||||
state_save_register_global(machine, state->flip_x);
|
||||
state_save_register_global(machine, state->flip_y);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( tutankhm )
|
||||
{
|
||||
timeplt_state *state = (timeplt_state *)machine->driver_data;
|
||||
|
||||
state->irq_toggle = 0;
|
||||
state->irq_enable = 0;
|
||||
state->flip_x = 0;
|
||||
state->flip_y = 0;
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( tutankhm )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(timeplt_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", M6809, 1500000) /* 1.5 MHz ??? */
|
||||
MDRV_CPU_PROGRAM_MAP(main_map)
|
||||
MDRV_CPU_VBLANK_INT("screen", tutankhm_interrupt)
|
||||
|
||||
MDRV_MACHINE_START(tutankhm)
|
||||
MDRV_MACHINE_RESET(tutankhm)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
@ -195,7 +210,6 @@ 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 */
|
||||
@ -203,7 +217,6 @@ static MACHINE_DRIVER_START( tutankhm )
|
||||
MACHINE_DRIVER_END
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* ROM definitions
|
||||
|
@ -1,22 +1,35 @@
|
||||
/*----------- defined in machine/jackal.c -----------*/
|
||||
|
||||
MACHINE_RESET( jackal );
|
||||
#define MASTER_CLOCK XTAL_18_432MHz
|
||||
#define SOUND_CLOCK XTAL_3_579545MHz
|
||||
|
||||
READ8_HANDLER( jackal_zram_r );
|
||||
READ8_HANDLER( jackal_voram_r );
|
||||
READ8_HANDLER( jackal_spriteram_r );
|
||||
|
||||
WRITE8_HANDLER( jackal_rambank_w );
|
||||
WRITE8_HANDLER( jackal_zram_w );
|
||||
WRITE8_HANDLER( jackal_voram_w );
|
||||
WRITE8_HANDLER( jackal_spriteram_w );
|
||||
|
||||
typedef struct _jackal_state jackal_state;
|
||||
struct _jackal_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * videoctrl;
|
||||
UINT8 * scrollram;
|
||||
UINT8 * paletteram;
|
||||
|
||||
/* video-related */
|
||||
tilemap *bg_tilemap;
|
||||
|
||||
/* misc */
|
||||
int irq_enable;
|
||||
UINT8 *rambank;
|
||||
UINT8 *spritebank;
|
||||
|
||||
/* devices */
|
||||
const device_config *mastercpu;
|
||||
const device_config *slavecpu;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/jackal.c -----------*/
|
||||
|
||||
extern UINT8 *jackal_videoctrl;
|
||||
void jackal_mark_tile_dirty(running_machine *machine, int offset);
|
||||
|
||||
void jackal_mark_tile_dirty(int offset);
|
||||
PALETTE_INIT( jackal );
|
||||
VIDEO_START( jackal );
|
||||
VIDEO_UPDATE( jackal );
|
||||
|
@ -1,15 +0,0 @@
|
||||
/***************************************************************************
|
||||
|
||||
Pooyan
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
/*----------- defined in video/pooyan.c -----------*/
|
||||
|
||||
WRITE8_HANDLER( pooyan_videoram_w );
|
||||
WRITE8_HANDLER( pooyan_colorram_w );
|
||||
WRITE8_HANDLER( pooyan_flipscreen_w );
|
||||
|
||||
PALETTE_INIT( pooyan );
|
||||
VIDEO_START( pooyan );
|
||||
VIDEO_UPDATE( pooyan );
|
@ -1,26 +0,0 @@
|
||||
|
||||
|
||||
typedef struct _rocnrope_state rocnrope_state;
|
||||
struct _rocnrope_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * videoram;
|
||||
UINT8 * colorram;
|
||||
UINT8 * spriteram;
|
||||
UINT8 * spriteram2;
|
||||
size_t spriteram_size;
|
||||
|
||||
/* video-related */
|
||||
tilemap *bg_tilemap;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/rocnrope.c -----------*/
|
||||
|
||||
WRITE8_HANDLER( rocnrope_videoram_w );
|
||||
WRITE8_HANDLER( rocnrope_colorram_w );
|
||||
WRITE8_HANDLER( rocnrope_flipscreen_w );
|
||||
|
||||
PALETTE_INIT( rocnrope );
|
||||
VIDEO_START( rocnrope );
|
||||
VIDEO_UPDATE( rocnrope );
|
@ -1,17 +1,133 @@
|
||||
/***************************************************************************
|
||||
|
||||
Time Pilot
|
||||
Tutankham
|
||||
Pooyan
|
||||
Roc'n Rope
|
||||
Rally X (because of Loco-Motion, Jungler, etc.)
|
||||
|
||||
These drivers share the sound emulation, and hence driver data struct
|
||||
|
||||
Juno First (this shares Tutankham video code, but not Time Pilot sound hw)
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
struct jungler_star
|
||||
{
|
||||
int x, y, color;
|
||||
};
|
||||
|
||||
#define MAX_STARS 1000
|
||||
|
||||
typedef struct _timeplt_state timeplt_state;
|
||||
struct _timeplt_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * videoram; // timeplt, tutankham, junofrst, rocnrope, pooyan, rallyx
|
||||
UINT8 * colorram; // timeplt, rocnrope, pooyan
|
||||
UINT8 * spriteram; // timeplt, rocnrope, pooyan, rallyx
|
||||
UINT8 * spriteram2; // timeplt, rocnrope, pooyan, rallyx
|
||||
UINT8 * paletteram; // tutankham, junofrst
|
||||
UINT8 * scroll; // tutankham, junofrst
|
||||
UINT8 * radarattr; // jungler
|
||||
UINT8 * radarx; // jungler
|
||||
UINT8 * radary; // jungler
|
||||
// UINT8 * namco_soundregs; // rallyx - these are dealt with in emu/sound/namco.c
|
||||
size_t videoram_size; // tutankham, junofrst
|
||||
size_t spriteram_size; // rocnrope
|
||||
|
||||
/* video-related */
|
||||
tilemap *bg_tilemap;
|
||||
tilemap *fg_tilemap; // jungler
|
||||
UINT8 blitterdata[4]; // junofrst
|
||||
UINT8 flip_x, flip_y; // tutankham, junofrst
|
||||
|
||||
/* sound-related */
|
||||
UINT8 last_irq_state;
|
||||
|
||||
/* misc */
|
||||
UINT8 nmi_enable; // timeplt
|
||||
UINT8 irq_toggle, irq_enable; // tutankham, pooyan
|
||||
int i8039_status, last_irq; // junofrst
|
||||
int last_bang; // jungler
|
||||
int spriteram_base, stars_enable, total_stars; // jungler
|
||||
UINT8 drawmode_table[4]; // jungler
|
||||
struct jungler_star stars[MAX_STARS]; // jungler
|
||||
|
||||
/* devices */
|
||||
const device_config *maincpu;
|
||||
const device_config *soundcpu;
|
||||
const device_config *i8039; // junofrst
|
||||
const device_config *samples; // rallyx
|
||||
const device_config *filter_0_0;
|
||||
const device_config *filter_0_1;
|
||||
const device_config *filter_0_2;
|
||||
const device_config *filter_1_0;
|
||||
const device_config *filter_1_1;
|
||||
const device_config *filter_1_2;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in audio/timeplt.c -----------*/
|
||||
|
||||
WRITE8_HANDLER( timeplt_sh_irqtrigger_w );
|
||||
|
||||
MACHINE_DRIVER_EXTERN( timeplt_sound );
|
||||
MACHINE_DRIVER_EXTERN( locomotn_sound );
|
||||
|
||||
/*----------- defined in video/pooyan.c -----------*/
|
||||
|
||||
WRITE8_HANDLER( pooyan_videoram_w );
|
||||
WRITE8_HANDLER( pooyan_colorram_w );
|
||||
WRITE8_HANDLER( pooyan_flipscreen_w );
|
||||
|
||||
PALETTE_INIT( pooyan );
|
||||
VIDEO_START( pooyan );
|
||||
VIDEO_UPDATE( pooyan );
|
||||
|
||||
/*----------- defined in video/rallyx.c -----------*/
|
||||
|
||||
WRITE8_HANDLER( rallyx_videoram_w );
|
||||
WRITE8_HANDLER( rallyx_scrollx_w );
|
||||
WRITE8_HANDLER( rallyx_scrolly_w );
|
||||
WRITE8_HANDLER( tactcian_starson_w );
|
||||
|
||||
PALETTE_INIT( rallyx );
|
||||
PALETTE_INIT( jungler );
|
||||
VIDEO_START( rallyx );
|
||||
VIDEO_START( jungler );
|
||||
VIDEO_START( locomotn );
|
||||
VIDEO_START( commsega );
|
||||
VIDEO_UPDATE( rallyx );
|
||||
VIDEO_UPDATE( jungler );
|
||||
VIDEO_UPDATE( locomotn );
|
||||
|
||||
/*----------- defined in video/rocnrope.c -----------*/
|
||||
|
||||
WRITE8_HANDLER( rocnrope_videoram_w );
|
||||
WRITE8_HANDLER( rocnrope_colorram_w );
|
||||
WRITE8_HANDLER( rocnrope_flipscreen_w );
|
||||
|
||||
PALETTE_INIT( rocnrope );
|
||||
VIDEO_START( rocnrope );
|
||||
VIDEO_UPDATE( rocnrope );
|
||||
|
||||
/*----------- 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_START( timeplt );
|
||||
VIDEO_UPDATE( timeplt );
|
||||
|
||||
/*----------- defined in video/tutankhm.c -----------*/
|
||||
|
||||
WRITE8_HANDLER( junofrst_blitter_w );
|
||||
|
||||
WRITE8_HANDLER( tutankhm_flip_screen_x_w );
|
||||
WRITE8_HANDLER( tutankhm_flip_screen_y_w );
|
||||
|
||||
VIDEO_UPDATE( tutankhm );
|
||||
|
@ -1,17 +0,0 @@
|
||||
/***************************************************************************
|
||||
|
||||
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 );
|
@ -1,85 +0,0 @@
|
||||
/***************************************************************************
|
||||
|
||||
machine.c
|
||||
|
||||
Written by Kenneth Lin (kenneth_lin@ai.vancouver.bc.ca)
|
||||
|
||||
Functions to emulate general aspects of the machine (RAM, ROM, interrupts,
|
||||
I/O ports)
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "driver.h"
|
||||
#include "cpu/m6809/m6809.h"
|
||||
#include "includes/jackal.h"
|
||||
|
||||
static UINT8 *jackal_rambank = 0;
|
||||
static UINT8 *jackal_spritebank = 0;
|
||||
|
||||
|
||||
MACHINE_RESET( jackal )
|
||||
{
|
||||
UINT8 *rgn = memory_region(machine, "master");
|
||||
|
||||
// HACK: running at the nominal clock rate, music stops working
|
||||
// at the beginning of the game. This fixes it.
|
||||
cpu_set_clockscale(cputag_get_cpu(machine, "slave"), 1.2f);
|
||||
|
||||
memory_set_bankptr(machine, "bank1",&rgn[0x4000]);
|
||||
jackal_rambank = rgn;
|
||||
jackal_spritebank = rgn;
|
||||
}
|
||||
|
||||
|
||||
|
||||
READ8_HANDLER( jackal_zram_r )
|
||||
{
|
||||
return jackal_rambank[0x0020+offset];
|
||||
}
|
||||
|
||||
|
||||
READ8_HANDLER( jackal_voram_r )
|
||||
{
|
||||
return jackal_rambank[0x2000+offset];
|
||||
}
|
||||
|
||||
|
||||
READ8_HANDLER( jackal_spriteram_r )
|
||||
{
|
||||
return jackal_spritebank[0x3000+offset];
|
||||
}
|
||||
|
||||
|
||||
WRITE8_HANDLER( jackal_rambank_w )
|
||||
{
|
||||
UINT8 *rgn = memory_region(space->machine, "master");
|
||||
|
||||
if (data & 0x04) popmessage("jackal_rambank_w %02x",data);
|
||||
coin_counter_w(space->machine, 0,data & 0x01);
|
||||
coin_counter_w(space->machine, 1,data & 0x02);
|
||||
jackal_spritebank = &rgn[((data & 0x08) << 13)];
|
||||
jackal_rambank = &rgn[((data & 0x10) << 12)];
|
||||
memory_set_bankptr(space->machine, "bank1",&rgn[((data & 0x20) << 11) + 0x4000]);
|
||||
}
|
||||
|
||||
|
||||
WRITE8_HANDLER( jackal_zram_w )
|
||||
{
|
||||
jackal_rambank[0x0020+offset] = data;
|
||||
}
|
||||
|
||||
|
||||
WRITE8_HANDLER( jackal_voram_w )
|
||||
{
|
||||
if ((offset & 0xF800) == 0)
|
||||
{
|
||||
jackal_mark_tile_dirty(offset & 0x3ff);
|
||||
}
|
||||
jackal_rambank[0x2000+offset] = data;
|
||||
}
|
||||
|
||||
|
||||
WRITE8_HANDLER( jackal_spriteram_w )
|
||||
{
|
||||
jackal_spritebank[0x3000+offset] = data;
|
||||
}
|
@ -790,7 +790,7 @@ $(MAMEOBJ)/konami.a: \
|
||||
$(DRIVERS)/hornet.o $(MACHINE)/konppc.o \
|
||||
$(DRIVERS)/hyperspt.o $(VIDEO)/hyperspt.o \
|
||||
$(DRIVERS)/ironhors.o $(VIDEO)/ironhors.o \
|
||||
$(DRIVERS)/jackal.o $(MACHINE)/jackal.o $(VIDEO)/jackal.o \
|
||||
$(DRIVERS)/jackal.o $(VIDEO)/jackal.o \
|
||||
$(DRIVERS)/jailbrek.o $(VIDEO)/jailbrek.o \
|
||||
$(DRIVERS)/junofrst.o \
|
||||
$(DRIVERS)/konamigq.o \
|
||||
|
@ -11,11 +11,6 @@
|
||||
#include "driver.h"
|
||||
#include "includes/jackal.h"
|
||||
|
||||
static UINT8 *jackal_scrollram;
|
||||
UINT8 *jackal_videoctrl;
|
||||
|
||||
static tilemap *bg_tilemap;
|
||||
|
||||
|
||||
PALETTE_INIT( jackal )
|
||||
{
|
||||
@ -44,13 +39,14 @@ PALETTE_INIT( jackal )
|
||||
}
|
||||
|
||||
|
||||
static void set_pens(running_machine *machine)
|
||||
static void set_pens( running_machine *machine )
|
||||
{
|
||||
jackal_state *state = (jackal_state *)machine->driver_data;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 0x400; i += 2)
|
||||
{
|
||||
UINT16 data = machine->generic.paletteram.u8[i] | (machine->generic.paletteram.u8[i | 1] << 8);
|
||||
UINT16 data = state->paletteram[i] | (state->paletteram[i | 1] << 8);
|
||||
|
||||
rgb_t color = MAKE_RGB(pal5bit(data >> 0), pal5bit(data >> 5), pal5bit(data >> 10));
|
||||
|
||||
@ -59,9 +55,10 @@ static void set_pens(running_machine *machine)
|
||||
}
|
||||
|
||||
|
||||
void jackal_mark_tile_dirty(int offset)
|
||||
void jackal_mark_tile_dirty( running_machine *machine, int offset )
|
||||
{
|
||||
tilemap_mark_tile_dirty(bg_tilemap, offset);
|
||||
jackal_state *state = (jackal_state *)machine->driver_data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( get_bg_tile_info )
|
||||
@ -78,65 +75,67 @@ static TILE_GET_INFO( get_bg_tile_info )
|
||||
|
||||
VIDEO_START( jackal )
|
||||
{
|
||||
bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
jackal_state *state = (jackal_state *)machine->driver_data;
|
||||
state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
}
|
||||
|
||||
static void draw_background( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
{
|
||||
jackal_state *state = (jackal_state *)machine->driver_data;
|
||||
UINT8 *RAM = memory_region(machine, "master");
|
||||
int i;
|
||||
|
||||
jackal_scrollram = &RAM[0x0020];
|
||||
state->scrollram = &RAM[0x0020];
|
||||
|
||||
tilemap_set_scroll_rows(bg_tilemap, 1);
|
||||
tilemap_set_scroll_cols(bg_tilemap, 1);
|
||||
tilemap_set_scroll_rows(state->bg_tilemap, 1);
|
||||
tilemap_set_scroll_cols(state->bg_tilemap, 1);
|
||||
|
||||
tilemap_set_scrolly(bg_tilemap, 0, jackal_videoctrl[0]);
|
||||
tilemap_set_scrollx(bg_tilemap, 0, jackal_videoctrl[1]);
|
||||
tilemap_set_scrolly(state->bg_tilemap, 0, state->videoctrl[0]);
|
||||
tilemap_set_scrollx(state->bg_tilemap, 0, state->videoctrl[1]);
|
||||
|
||||
if (jackal_videoctrl[2] & 0x02)
|
||||
if (state->videoctrl[2] & 0x02)
|
||||
{
|
||||
if (jackal_videoctrl[2] & 0x08)
|
||||
if (state->videoctrl[2] & 0x08)
|
||||
{
|
||||
tilemap_set_scroll_rows(bg_tilemap, 32);
|
||||
tilemap_set_scroll_rows(state->bg_tilemap, 32);
|
||||
|
||||
for (i = 0; i < 32; i++)
|
||||
tilemap_set_scrollx(bg_tilemap, i, jackal_scrollram[i]);
|
||||
tilemap_set_scrollx(state->bg_tilemap, i, state->scrollram[i]);
|
||||
}
|
||||
|
||||
if (jackal_videoctrl[2] & 0x04)
|
||||
if (state->videoctrl[2] & 0x04)
|
||||
{
|
||||
tilemap_set_scroll_cols(bg_tilemap, 32);
|
||||
tilemap_set_scroll_cols(state->bg_tilemap, 32);
|
||||
|
||||
for (i = 0; i < 32; i++)
|
||||
{
|
||||
tilemap_set_scrolly(bg_tilemap, i, jackal_scrollram[i]);
|
||||
}
|
||||
tilemap_set_scrolly(state->bg_tilemap, i, state->scrollram[i]);
|
||||
}
|
||||
}
|
||||
|
||||
tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
|
||||
}
|
||||
|
||||
#define DRAW_SPRITE(bank, code, sx, sy) drawgfx_transpen(bitmap, cliprect, machine->gfx[bank], code, color, flipx, flipy, sx, sy, 0);
|
||||
|
||||
static void draw_sprites_region(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, const UINT8 *sram, int length, int bank )
|
||||
static void draw_sprites_region( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, const UINT8 *sram, int length, int bank )
|
||||
{
|
||||
int offs;
|
||||
|
||||
for (offs = 0; offs < length; offs += 5)
|
||||
{
|
||||
int sn1 = sram[offs];
|
||||
int sn2 = sram[offs+1];
|
||||
int sy = sram[offs+2];
|
||||
int sx = sram[offs+3];
|
||||
int attr = sram[offs+4];
|
||||
int sn2 = sram[offs + 1];
|
||||
int sy = sram[offs + 2];
|
||||
int sx = sram[offs + 3];
|
||||
int attr = sram[offs + 4];
|
||||
int flipx = attr & 0x20;
|
||||
int flipy = attr & 0x40;
|
||||
int color = ((sn2 & 0xf0) >> 4);
|
||||
|
||||
if (attr & 0x01) sx = sx - 256;
|
||||
if (sy > 0xf0) sy = sy - 256;
|
||||
if (attr & 0x01)
|
||||
sx = sx - 256;
|
||||
if (sy > 0xf0)
|
||||
sy = sy - 256;
|
||||
|
||||
if (flip_screen_get(machine))
|
||||
{
|
||||
@ -148,7 +147,7 @@ static void draw_sprites_region(running_machine *machine, bitmap_t *bitmap, cons
|
||||
|
||||
if (attr & 0xC) // half-size sprite
|
||||
{
|
||||
int spritenum = sn1*4 + ((sn2 & (8+4)) >> 2) + ((sn2 & (2+1)) << 10);
|
||||
int spritenum = sn1 * 4 + ((sn2 & (8 + 4)) >> 2) + ((sn2 & (2 + 1)) << 10);
|
||||
int mod = -8;
|
||||
|
||||
if (flip_screen_get(machine))
|
||||
@ -202,12 +201,13 @@ static void draw_sprites_region(running_machine *machine, bitmap_t *bitmap, cons
|
||||
}
|
||||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
jackal_state *state = (jackal_state *)machine->driver_data;
|
||||
UINT8 *RAM = memory_region(machine, "master");
|
||||
UINT8 *sr, *ss;
|
||||
|
||||
if (jackal_videoctrl[0x03] & 0x08)
|
||||
if (state->videoctrl[0x03] & 0x08)
|
||||
{
|
||||
sr = &RAM[0x03800]; // Sprite 2
|
||||
ss = &RAM[0x13800]; // Additional Sprite 2
|
||||
|
@ -6,12 +6,7 @@
|
||||
|
||||
#include "driver.h"
|
||||
#include "video/resnet.h"
|
||||
#include "pooyan.h"
|
||||
|
||||
|
||||
static tilemap *bg_tilemap;
|
||||
|
||||
|
||||
#include "includes/timeplt.h"
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
@ -40,7 +35,7 @@ PALETTE_INIT( pooyan )
|
||||
int i;
|
||||
|
||||
/* compute the color output resistor weights */
|
||||
compute_resistor_weights(0, 255, -1.0,
|
||||
compute_resistor_weights(0, 255, -1.0,
|
||||
3, resistances_rg, rweights, 1000, 0,
|
||||
3, resistances_rg, gweights, 1000, 0,
|
||||
2, resistances_b, bweights, 1000, 0);
|
||||
@ -102,8 +97,9 @@ PALETTE_INIT( pooyan )
|
||||
|
||||
static TILE_GET_INFO( get_bg_tile_info )
|
||||
{
|
||||
int attr = machine->generic.colorram.u8[tile_index];
|
||||
int code = machine->generic.videoram.u8[tile_index];
|
||||
timeplt_state *state = (timeplt_state *)machine->driver_data;
|
||||
int attr = state->colorram[tile_index];
|
||||
int code = state->videoram[tile_index];
|
||||
int color = attr & 0x0f;
|
||||
int flags = TILE_FLIPYX(attr >> 6);
|
||||
|
||||
@ -120,7 +116,8 @@ static TILE_GET_INFO( get_bg_tile_info )
|
||||
|
||||
VIDEO_START( pooyan )
|
||||
{
|
||||
bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8,8, 32,32);
|
||||
timeplt_state *state = (timeplt_state *)machine->driver_data;
|
||||
state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
}
|
||||
|
||||
|
||||
@ -133,15 +130,17 @@ VIDEO_START( pooyan )
|
||||
|
||||
WRITE8_HANDLER( pooyan_videoram_w )
|
||||
{
|
||||
space->machine->generic.videoram.u8[offset] = data;
|
||||
tilemap_mark_tile_dirty(bg_tilemap, offset);
|
||||
timeplt_state *state = (timeplt_state *)space->machine->driver_data;
|
||||
state->videoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
|
||||
}
|
||||
|
||||
|
||||
WRITE8_HANDLER( pooyan_colorram_w )
|
||||
{
|
||||
space->machine->generic.colorram.u8[offset] = data;
|
||||
tilemap_mark_tile_dirty(bg_tilemap, offset);
|
||||
timeplt_state *state = (timeplt_state *)space->machine->driver_data;
|
||||
state->colorram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
|
||||
}
|
||||
|
||||
|
||||
@ -158,13 +157,14 @@ WRITE8_HANDLER( pooyan_flipscreen_w )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
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 )
|
||||
{
|
||||
UINT8 *spriteram = machine->generic.spriteram.u8;
|
||||
UINT8 *spriteram_2 = machine->generic.spriteram2.u8;
|
||||
timeplt_state *state = (timeplt_state *)machine->driver_data;
|
||||
UINT8 *spriteram = state->spriteram;
|
||||
UINT8 *spriteram_2 = state->spriteram2;
|
||||
int offs;
|
||||
|
||||
for (offs = 0x10;offs < 0x40;offs += 2)
|
||||
for (offs = 0x10; offs < 0x40; offs += 2)
|
||||
{
|
||||
int sx = spriteram[offs];
|
||||
int sy = 240 - spriteram_2[offs + 1];
|
||||
@ -194,7 +194,9 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
|
||||
VIDEO_UPDATE( pooyan )
|
||||
{
|
||||
tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
|
||||
timeplt_state *state = (timeplt_state *)screen->machine->driver_data;
|
||||
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
@ -29,29 +29,10 @@ needs more color combination to render its graphics.
|
||||
|
||||
#include "driver.h"
|
||||
#include "video/resnet.h"
|
||||
#include "includes/timeplt.h"
|
||||
|
||||
|
||||
|
||||
UINT8 *rallyx_videoram,*rallyx_radarattr;
|
||||
|
||||
static UINT8 *rallyx_radarx,*rallyx_radary;
|
||||
static int spriteram_base;
|
||||
|
||||
static tilemap *bg_tilemap,*fg_tilemap;
|
||||
|
||||
#define MAX_STARS 1000
|
||||
#define STARS_COLOR_BASE (0x104)
|
||||
|
||||
static int stars_enable;
|
||||
|
||||
struct star
|
||||
{
|
||||
int x,y,color;
|
||||
};
|
||||
static struct star stars[MAX_STARS];
|
||||
static int total_stars;
|
||||
static UINT8 drawmode_table[4];
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
@ -73,6 +54,7 @@ static UINT8 drawmode_table[4];
|
||||
1 kohm pull-down is an all three RGB outputs.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
PALETTE_INIT( rallyx )
|
||||
{
|
||||
static const int resistances_rg[3] = { 1000, 470, 220 };
|
||||
@ -238,33 +220,35 @@ static TILEMAP_MAPPER( fg_tilemap_scan )
|
||||
}
|
||||
|
||||
|
||||
INLINE void rallyx_get_tile_info(running_machine *machine,tile_data *tileinfo,int tile_index,int ram_offs)
|
||||
INLINE void rallyx_get_tile_info( running_machine *machine, tile_data *tileinfo, int tile_index, int ram_offs)
|
||||
{
|
||||
UINT8 attr = rallyx_videoram[ram_offs + tile_index + 0x800];
|
||||
timeplt_state *state = (timeplt_state *)machine->driver_data;
|
||||
UINT8 attr = state->videoram[ram_offs + tile_index + 0x800];
|
||||
tileinfo->category = (attr & 0x20) >> 5;
|
||||
SET_TILE_INFO(
|
||||
0,
|
||||
rallyx_videoram[ram_offs + tile_index],
|
||||
state->videoram[ram_offs + tile_index],
|
||||
attr & 0x3f,
|
||||
TILE_FLIPYX(attr >> 6) ^ TILE_FLIPX);
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( rallyx_bg_get_tile_info )
|
||||
{
|
||||
rallyx_get_tile_info(machine,tileinfo,tile_index,0x400);
|
||||
rallyx_get_tile_info(machine, tileinfo, tile_index, 0x400);
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( rallyx_fg_get_tile_info )
|
||||
{
|
||||
rallyx_get_tile_info(machine,tileinfo,tile_index,0x000);
|
||||
rallyx_get_tile_info(machine, tileinfo, tile_index, 0x000);
|
||||
}
|
||||
|
||||
|
||||
INLINE void locomotn_get_tile_info(running_machine *machine,tile_data *tileinfo,int tile_index,int ram_offs)
|
||||
{
|
||||
UINT8 attr = rallyx_videoram[ram_offs + tile_index + 0x800];
|
||||
int code = rallyx_videoram[ram_offs + tile_index];
|
||||
code = (code & 0x7f) + 2*(attr & 0x40) + 2*(code & 0x80);
|
||||
timeplt_state *state = (timeplt_state *)machine->driver_data;
|
||||
UINT8 attr = state->videoram[ram_offs + tile_index + 0x800];
|
||||
int code = state->videoram[ram_offs + tile_index];
|
||||
code = (code & 0x7f) + 2 * (attr & 0x40) + 2 * (code & 0x80);
|
||||
tileinfo->category = (attr & 0x20) >> 5;
|
||||
SET_TILE_INFO(
|
||||
0,
|
||||
@ -275,12 +259,12 @@ INLINE void locomotn_get_tile_info(running_machine *machine,tile_data *tileinfo,
|
||||
|
||||
static TILE_GET_INFO( locomotn_bg_get_tile_info )
|
||||
{
|
||||
locomotn_get_tile_info(machine,tileinfo,tile_index,0x400);
|
||||
locomotn_get_tile_info(machine, tileinfo, tile_index, 0x400);
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( locomotn_fg_get_tile_info )
|
||||
{
|
||||
locomotn_get_tile_info(machine,tileinfo,tile_index,0x000);
|
||||
locomotn_get_tile_info(machine, tileinfo, tile_index, 0x000);
|
||||
}
|
||||
|
||||
|
||||
@ -291,177 +275,138 @@ static TILE_GET_INFO( locomotn_fg_get_tile_info )
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
static void calculate_star_field(void)
|
||||
static void calculate_star_field( running_machine *machine )
|
||||
{
|
||||
timeplt_state *state = (timeplt_state *)machine->driver_data;
|
||||
int generator;
|
||||
int x,y;
|
||||
int x, y;
|
||||
|
||||
/* precalculate the star background */
|
||||
total_stars = 0;
|
||||
state->total_stars = 0;
|
||||
generator = 0;
|
||||
|
||||
for (y = 0;y < 256;y++)
|
||||
for (y = 0; y < 256; y++)
|
||||
{
|
||||
for (x = 0;x < 288;x++)
|
||||
for (x = 0; x < 288; x++)
|
||||
{
|
||||
int bit1,bit2;
|
||||
int bit1, bit2;
|
||||
|
||||
generator <<= 1;
|
||||
bit1 = (~generator >> 17) & 1;
|
||||
bit2 = (generator >> 5) & 1;
|
||||
|
||||
if (bit1 ^ bit2) generator |= 1;
|
||||
if (bit1 ^ bit2)
|
||||
generator |= 1;
|
||||
|
||||
if (((~generator >> 16) & 1) &&
|
||||
(generator & 0xfe) == 0xfe)
|
||||
if (((~generator >> 16) & 1) && (generator & 0xfe) == 0xfe)
|
||||
{
|
||||
int color;
|
||||
int color = (~(generator >> 8)) & 0x3f;
|
||||
|
||||
color = (~(generator >> 8)) & 0x3f;
|
||||
|
||||
if (color && total_stars < MAX_STARS)
|
||||
if (color && state->total_stars < MAX_STARS)
|
||||
{
|
||||
stars[total_stars].x = x;
|
||||
stars[total_stars].y = y;
|
||||
stars[total_stars].color = color;
|
||||
state->stars[state->total_stars].x = x;
|
||||
state->stars[state->total_stars].y = y;
|
||||
state->stars[state->total_stars].color = color;
|
||||
|
||||
total_stars++;
|
||||
state->total_stars++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void rallyx_video_start_common( running_machine *machine )
|
||||
{
|
||||
timeplt_state *state = (timeplt_state *)machine->driver_data;
|
||||
int i;
|
||||
|
||||
state->spriteram = state->videoram + 0x00;
|
||||
state->spriteram2 = state->spriteram + 0x800;
|
||||
state->radarx = state->videoram + 0x20;
|
||||
state->radary = state->radarx + 0x800;
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
machine->shadow_table[i] = i + 16;
|
||||
|
||||
for (i = 16; i < 32; i++)
|
||||
machine->shadow_table[i] = i;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
state->drawmode_table[i] = DRAWMODE_SHADOW;
|
||||
|
||||
state->drawmode_table[3] = DRAWMODE_NONE;
|
||||
}
|
||||
|
||||
VIDEO_START( rallyx )
|
||||
{
|
||||
int i;
|
||||
timeplt_state *state = (timeplt_state *)machine->driver_data;
|
||||
|
||||
bg_tilemap = tilemap_create(machine, rallyx_bg_get_tile_info,tilemap_scan_rows,8,8,32,32);
|
||||
fg_tilemap = tilemap_create(machine, rallyx_fg_get_tile_info,fg_tilemap_scan, 8,8, 8,32);
|
||||
state->bg_tilemap = tilemap_create(machine, rallyx_bg_get_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
state->fg_tilemap = tilemap_create(machine, rallyx_fg_get_tile_info, fg_tilemap_scan, 8, 8, 8, 32);
|
||||
|
||||
/* the scrolling tilemap is slightly misplaced in Rally X */
|
||||
tilemap_set_scrolldx(bg_tilemap,3,3);
|
||||
tilemap_set_scrolldx(state->bg_tilemap, 3, 3);
|
||||
|
||||
spriteram_base = 0x14;
|
||||
state->spriteram_base = 0x14;
|
||||
|
||||
machine->generic.spriteram.u8 = rallyx_videoram + 0x00;
|
||||
machine->generic.spriteram2.u8 = machine->generic.spriteram.u8 + 0x800;
|
||||
rallyx_radarx = rallyx_videoram + 0x20;
|
||||
rallyx_radary = rallyx_radarx + 0x800;
|
||||
|
||||
for (i = 0;i < 16;i++)
|
||||
machine->shadow_table[i] = i+16;
|
||||
|
||||
for (i = 16;i < 32;i++)
|
||||
machine->shadow_table[i] = i;
|
||||
|
||||
for (i = 0;i < 3;i++)
|
||||
drawmode_table[i] = DRAWMODE_SHADOW;
|
||||
|
||||
drawmode_table[3] = DRAWMODE_NONE;
|
||||
rallyx_video_start_common(machine);
|
||||
}
|
||||
|
||||
|
||||
VIDEO_START( jungler )
|
||||
{
|
||||
int i;
|
||||
timeplt_state *state = (timeplt_state *)machine->driver_data;
|
||||
|
||||
bg_tilemap = tilemap_create(machine, rallyx_bg_get_tile_info,tilemap_scan_rows,8,8,32,32);
|
||||
fg_tilemap = tilemap_create(machine, rallyx_fg_get_tile_info,fg_tilemap_scan, 8,8, 8,32);
|
||||
state->bg_tilemap = tilemap_create(machine, rallyx_bg_get_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
state->fg_tilemap = tilemap_create(machine, rallyx_fg_get_tile_info, fg_tilemap_scan, 8, 8, 8, 32);
|
||||
|
||||
spriteram_base = 0x14;
|
||||
state->spriteram_base = 0x14;
|
||||
|
||||
machine->generic.spriteram.u8 = rallyx_videoram + 0x00;
|
||||
machine->generic.spriteram2.u8 = machine->generic.spriteram.u8 + 0x800;
|
||||
rallyx_radarx = rallyx_videoram + 0x20;
|
||||
rallyx_radary = rallyx_radarx + 0x800;
|
||||
|
||||
for (i = 0;i < 16;i++)
|
||||
machine->shadow_table[i] = i+16;
|
||||
|
||||
for (i = 16;i < 32;i++)
|
||||
machine->shadow_table[i] = i;
|
||||
|
||||
for (i = 0;i < 3;i++)
|
||||
drawmode_table[i] = DRAWMODE_SHADOW;
|
||||
|
||||
drawmode_table[3] = DRAWMODE_NONE;
|
||||
|
||||
calculate_star_field();
|
||||
rallyx_video_start_common(machine);
|
||||
calculate_star_field(machine);
|
||||
}
|
||||
|
||||
|
||||
VIDEO_START( locomotn )
|
||||
{
|
||||
int i;
|
||||
timeplt_state *state = (timeplt_state *)machine->driver_data;
|
||||
|
||||
bg_tilemap = tilemap_create(machine, locomotn_bg_get_tile_info,tilemap_scan_rows,8,8,32,32);
|
||||
fg_tilemap = tilemap_create(machine, locomotn_fg_get_tile_info,fg_tilemap_scan, 8,8, 8,32);
|
||||
state->bg_tilemap = tilemap_create(machine, locomotn_bg_get_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
state->fg_tilemap = tilemap_create(machine, locomotn_fg_get_tile_info, fg_tilemap_scan, 8, 8, 8, 32);
|
||||
|
||||
/* handle reduced visible area in some games */
|
||||
if (video_screen_get_visible_area(machine->primary_screen)->max_x == 32*8-1)
|
||||
if (video_screen_get_visible_area(machine->primary_screen)->max_x == 32 * 8 - 1)
|
||||
{
|
||||
tilemap_set_scrolldx(bg_tilemap,0,32);
|
||||
tilemap_set_scrolldx(fg_tilemap,0,32);
|
||||
tilemap_set_scrolldx(state->bg_tilemap, 0, 32);
|
||||
tilemap_set_scrolldx(state->fg_tilemap, 0, 32);
|
||||
}
|
||||
|
||||
spriteram_base = 0x14;
|
||||
state->spriteram_base = 0x14;
|
||||
|
||||
machine->generic.spriteram.u8 = rallyx_videoram + 0x00;
|
||||
machine->generic.spriteram2.u8 = machine->generic.spriteram.u8 + 0x800;
|
||||
rallyx_radarx = rallyx_videoram + 0x20;
|
||||
rallyx_radary = rallyx_radarx + 0x800;
|
||||
|
||||
for (i = 0;i < 16;i++)
|
||||
machine->shadow_table[i] = i+16;
|
||||
|
||||
for (i = 16;i < 32;i++)
|
||||
machine->shadow_table[i] = i;
|
||||
|
||||
for (i = 0;i < 3;i++)
|
||||
drawmode_table[i] = DRAWMODE_SHADOW;
|
||||
|
||||
drawmode_table[3] = DRAWMODE_NONE;
|
||||
|
||||
calculate_star_field();
|
||||
rallyx_video_start_common(machine);
|
||||
calculate_star_field(machine);
|
||||
}
|
||||
|
||||
|
||||
VIDEO_START( commsega )
|
||||
{
|
||||
int i;
|
||||
timeplt_state *state = (timeplt_state *)machine->driver_data;
|
||||
|
||||
bg_tilemap = tilemap_create(machine, locomotn_bg_get_tile_info,tilemap_scan_rows,8,8,32,32);
|
||||
fg_tilemap = tilemap_create(machine, locomotn_fg_get_tile_info,fg_tilemap_scan, 8,8, 8,32);
|
||||
state->bg_tilemap = tilemap_create(machine, locomotn_bg_get_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
state->fg_tilemap = tilemap_create(machine, locomotn_fg_get_tile_info, fg_tilemap_scan, 8, 8, 8, 32);
|
||||
|
||||
/* handle reduced visible area in some games */
|
||||
if (video_screen_get_visible_area(machine->primary_screen)->max_x == 32*8-1)
|
||||
if (video_screen_get_visible_area(machine->primary_screen)->max_x == 32 * 8 - 1)
|
||||
{
|
||||
tilemap_set_scrolldx(bg_tilemap,0,32);
|
||||
tilemap_set_scrolldx(fg_tilemap,0,32);
|
||||
tilemap_set_scrolldx(state->bg_tilemap, 0, 32);
|
||||
tilemap_set_scrolldx(state->fg_tilemap, 0, 32);
|
||||
}
|
||||
|
||||
/* commsega has more sprites and bullets than the other games */
|
||||
spriteram_base = 0x00;
|
||||
state->spriteram_base = 0x00;
|
||||
|
||||
machine->generic.spriteram.u8 = rallyx_videoram + 0x00;
|
||||
machine->generic.spriteram2.u8 = machine->generic.spriteram.u8 + 0x800;
|
||||
rallyx_radarx = rallyx_videoram + 0x20;
|
||||
rallyx_radary = rallyx_radarx + 0x800;
|
||||
|
||||
for (i = 0;i < 16;i++)
|
||||
machine->shadow_table[i] = i+16;
|
||||
|
||||
for (i = 16;i < 32;i++)
|
||||
machine->shadow_table[i] = i;
|
||||
|
||||
for (i = 0;i < 3;i++)
|
||||
drawmode_table[i] = DRAWMODE_SHADOW;
|
||||
|
||||
drawmode_table[3] = DRAWMODE_NONE;
|
||||
|
||||
calculate_star_field();
|
||||
rallyx_video_start_common(machine);
|
||||
calculate_star_field(machine);
|
||||
}
|
||||
|
||||
|
||||
@ -473,36 +418,38 @@ VIDEO_START( commsega )
|
||||
|
||||
WRITE8_HANDLER( rallyx_videoram_w )
|
||||
{
|
||||
rallyx_videoram[offset] = data;
|
||||
timeplt_state *state = (timeplt_state *)space->machine->driver_data;
|
||||
|
||||
state->videoram[offset] = data;
|
||||
if (offset & 0x400)
|
||||
tilemap_mark_tile_dirty(bg_tilemap,offset & 0x3ff);
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset & 0x3ff);
|
||||
else
|
||||
tilemap_mark_tile_dirty(fg_tilemap,offset & 0x3ff);
|
||||
tilemap_mark_tile_dirty(state->fg_tilemap, offset & 0x3ff);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( rallyx_scrollx_w )
|
||||
{
|
||||
tilemap_set_scrollx(bg_tilemap,0,data);
|
||||
timeplt_state *state = (timeplt_state *)space->machine->driver_data;
|
||||
tilemap_set_scrollx(state->bg_tilemap, 0, data);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( rallyx_scrolly_w )
|
||||
{
|
||||
tilemap_set_scrolly(bg_tilemap,0,data);
|
||||
timeplt_state *state = (timeplt_state *)space->machine->driver_data;
|
||||
tilemap_set_scrolly(state->bg_tilemap, 0, data);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( tactcian_starson_w )
|
||||
{
|
||||
stars_enable = data & 1;
|
||||
timeplt_state *state = (timeplt_state *)space->machine->driver_data;
|
||||
state->stars_enable = data & 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void plot_star(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int x, int y, int color)
|
||||
static void plot_star( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int x, int y, int color )
|
||||
{
|
||||
if (y < cliprect->min_y ||
|
||||
y > cliprect->max_y ||
|
||||
x < cliprect->min_x ||
|
||||
x > cliprect->max_x)
|
||||
if (y < cliprect->min_y || y > cliprect->max_y ||
|
||||
x < cliprect->min_x || x > cliprect->max_x)
|
||||
return;
|
||||
|
||||
if (flip_screen_x_get(machine))
|
||||
@ -515,35 +462,38 @@ static void plot_star(running_machine *machine, bitmap_t *bitmap, const rectangl
|
||||
*BITMAP_ADDR16(bitmap, y, x) = STARS_COLOR_BASE + color;
|
||||
}
|
||||
|
||||
static void draw_stars(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
static void draw_stars( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
{
|
||||
timeplt_state *state = (timeplt_state *)machine->driver_data;
|
||||
int offs;
|
||||
|
||||
for (offs = 0;offs < total_stars;offs++)
|
||||
for (offs = 0; offs < state->total_stars; offs++)
|
||||
{
|
||||
int x = stars[offs].x;
|
||||
int y = stars[offs].y;
|
||||
int x = state->stars[offs].x;
|
||||
int y = state->stars[offs].y;
|
||||
|
||||
if ((y & 0x01) ^ ((x >> 3) & 0x01))
|
||||
plot_star(machine, bitmap, cliprect, x, y, stars[offs].color);
|
||||
plot_star(machine, bitmap, cliprect, x, y, state->stars[offs].color);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void rallyx_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int displacement )
|
||||
static void rallyx_draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int displacement )
|
||||
{
|
||||
UINT8 *spriteram = machine->generic.spriteram.u8;
|
||||
UINT8 *spriteram_2 = machine->generic.spriteram2.u8;
|
||||
timeplt_state *state = (timeplt_state *)machine->driver_data;
|
||||
UINT8 *spriteram = state->spriteram;
|
||||
UINT8 *spriteram_2 = state->spriteram2;
|
||||
int offs;
|
||||
|
||||
for (offs = 0x20-2;offs >= spriteram_base;offs -= 2)
|
||||
for (offs = 0x20 - 2; offs >= state->spriteram_base; offs -= 2)
|
||||
{
|
||||
int sx = spriteram[offs + 1] + ((spriteram_2[offs + 1] & 0x80) << 1) - displacement;
|
||||
int sy = 241 - spriteram_2[offs] - displacement;
|
||||
int color = spriteram_2[offs + 1] & 0x3f;
|
||||
int flipx = spriteram[offs] & 1;
|
||||
int flipy = spriteram[offs] & 2;
|
||||
if (flip_screen_get(machine)) sx -= 2*displacement;
|
||||
if (flip_screen_get(machine))
|
||||
sx -= 2 * displacement;
|
||||
|
||||
pdrawgfx_transmask(bitmap,cliprect,machine->gfx[1],
|
||||
(spriteram[offs] & 0xfc) >> 2,
|
||||
@ -555,13 +505,14 @@ static void rallyx_draw_sprites(running_machine *machine, bitmap_t *bitmap, cons
|
||||
}
|
||||
}
|
||||
|
||||
static void locomotn_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int displacement )
|
||||
static void locomotn_draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int displacement )
|
||||
{
|
||||
UINT8 *spriteram = machine->generic.spriteram.u8;
|
||||
UINT8 *spriteram_2 = machine->generic.spriteram2.u8;
|
||||
timeplt_state *state = (timeplt_state *)machine->driver_data;
|
||||
UINT8 *spriteram = state->spriteram;
|
||||
UINT8 *spriteram_2 = state->spriteram2;
|
||||
int offs;
|
||||
|
||||
for (offs = 0x20-2;offs >= spriteram_base;offs -= 2)
|
||||
for (offs = 0x20 - 2; offs >= state->spriteram_base; offs -= 2)
|
||||
{
|
||||
int sx = spriteram[offs + 1] + ((spriteram_2[offs + 1] & 0x80) << 1);
|
||||
int sy = 241 - spriteram_2[offs] - displacement;
|
||||
@ -578,70 +529,74 @@ static void locomotn_draw_sprites(running_machine *machine, bitmap_t *bitmap, co
|
||||
}
|
||||
}
|
||||
|
||||
static void rallyx_draw_bullets(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int transpen )
|
||||
static void rallyx_draw_bullets( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int transpen )
|
||||
{
|
||||
timeplt_state *state = (timeplt_state *)machine->driver_data;
|
||||
int offs;
|
||||
|
||||
for (offs = spriteram_base; offs < 0x20;offs++)
|
||||
for (offs = state->spriteram_base; offs < 0x20; offs++)
|
||||
{
|
||||
int x,y;
|
||||
int x, y;
|
||||
|
||||
x = rallyx_radarx[offs] + ((~rallyx_radarattr[offs & 0x0f] & 0x01) << 8);
|
||||
y = 253 - rallyx_radary[offs];
|
||||
if (flip_screen_get(machine)) x -= 3;
|
||||
x = state->radarx[offs] + ((~state->radarattr[offs & 0x0f] & 0x01) << 8);
|
||||
y = 253 - state->radary[offs];
|
||||
if (flip_screen_get(machine))
|
||||
x -= 3;
|
||||
|
||||
if (transpen)
|
||||
drawgfx_transpen(bitmap,cliprect,machine->gfx[2],
|
||||
((rallyx_radarattr[offs & 0x0f] & 0x0e) >> 1) ^ 0x07,
|
||||
((state->radarattr[offs & 0x0f] & 0x0e) >> 1) ^ 0x07,
|
||||
0,
|
||||
0,0,
|
||||
x,y,
|
||||
3);
|
||||
else
|
||||
drawgfx_transtable(bitmap,cliprect,machine->gfx[2],
|
||||
((rallyx_radarattr[offs & 0x0f] & 0x0e) >> 1) ^ 0x07,
|
||||
((state->radarattr[offs & 0x0f] & 0x0e) >> 1) ^ 0x07,
|
||||
0,
|
||||
0,0,
|
||||
x,y,
|
||||
drawmode_table,machine->shadow_table);
|
||||
state->drawmode_table,machine->shadow_table);
|
||||
}
|
||||
}
|
||||
|
||||
static void jungler_draw_bullets(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int transpen )
|
||||
static void jungler_draw_bullets( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int transpen )
|
||||
{
|
||||
timeplt_state *state = (timeplt_state *)machine->driver_data;
|
||||
int offs;
|
||||
|
||||
for (offs = spriteram_base; offs < 0x20;offs++)
|
||||
for (offs = state->spriteram_base; offs < 0x20; offs++)
|
||||
{
|
||||
int x,y;
|
||||
int x, y;
|
||||
|
||||
x = rallyx_radarx[offs] + ((~rallyx_radarattr[offs & 0x0f] & 0x08) << 5);
|
||||
y = 253 - rallyx_radary[offs];
|
||||
x = state->radarx[offs] + ((~state->radarattr[offs & 0x0f] & 0x08) << 5);
|
||||
y = 253 - state->radary[offs];
|
||||
|
||||
if (transpen)
|
||||
drawgfx_transpen(bitmap,cliprect,machine->gfx[2],
|
||||
(rallyx_radarattr[offs & 0x0f] & 0x07) ^ 0x07,
|
||||
(state->radarattr[offs & 0x0f] & 0x07) ^ 0x07,
|
||||
0,
|
||||
0,0,
|
||||
x,y,
|
||||
3);
|
||||
else
|
||||
drawgfx_transtable(bitmap,cliprect,machine->gfx[2],
|
||||
(rallyx_radarattr[offs & 0x0f] & 0x07) ^ 0x07,
|
||||
(state->radarattr[offs & 0x0f] & 0x07) ^ 0x07,
|
||||
0,
|
||||
0,0,
|
||||
x,y,
|
||||
drawmode_table,machine->shadow_table);
|
||||
state->drawmode_table,machine->shadow_table);
|
||||
}
|
||||
}
|
||||
|
||||
static void locomotn_draw_bullets(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int transpen )
|
||||
static void locomotn_draw_bullets( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int transpen )
|
||||
{
|
||||
timeplt_state *state = (timeplt_state *)machine->driver_data;
|
||||
int offs;
|
||||
|
||||
for (offs = spriteram_base; offs < 0x20;offs++)
|
||||
for (offs = state->spriteram_base; offs < 0x20; offs++)
|
||||
{
|
||||
int x,y;
|
||||
int x, y;
|
||||
|
||||
|
||||
/* it looks like in commsega the addresses used are
|
||||
@ -651,54 +606,56 @@ static void locomotn_draw_bullets(running_machine *machine, bitmap_t *bitmap, co
|
||||
so 8024-8033 and 8824-8833 are not used
|
||||
*/
|
||||
|
||||
x = rallyx_radarx[offs] + ((~rallyx_radarattr[offs & 0x0f] & 0x08) << 5);
|
||||
y = 252 - rallyx_radary[offs];
|
||||
x = state->radarx[offs] + ((~state->radarattr[offs & 0x0f] & 0x08) << 5);
|
||||
y = 252 - state->radary[offs];
|
||||
|
||||
if (transpen)
|
||||
drawgfx_transpen(bitmap,cliprect,machine->gfx[2],
|
||||
(rallyx_radarattr[offs & 0x0f] & 0x07) ^ 0x07,
|
||||
(state->radarattr[offs & 0x0f] & 0x07) ^ 0x07,
|
||||
0,
|
||||
0,0,
|
||||
x,y,
|
||||
3);
|
||||
else
|
||||
drawgfx_transtable(bitmap,cliprect,machine->gfx[2],
|
||||
(rallyx_radarattr[offs & 0x0f] & 0x07) ^ 0x07,
|
||||
(state->radarattr[offs & 0x0f] & 0x07) ^ 0x07,
|
||||
0,
|
||||
0,0,
|
||||
x,y,
|
||||
drawmode_table,machine->shadow_table);
|
||||
state->drawmode_table,machine->shadow_table);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
VIDEO_UPDATE( rallyx )
|
||||
{
|
||||
timeplt_state *state = (timeplt_state *)screen->machine->driver_data;
|
||||
/* the radar tilemap is just 8x32. We rely on the tilemap code to repeat it across
|
||||
the screen, and clip it to only the position where it is supposed to be shown */
|
||||
rectangle fg_clip = *cliprect;
|
||||
rectangle bg_clip = *cliprect;
|
||||
|
||||
if (flip_screen_get(screen->machine))
|
||||
{
|
||||
bg_clip.min_x = 8*8;
|
||||
fg_clip.max_x = 8*8-1;
|
||||
bg_clip.min_x = 8 * 8;
|
||||
fg_clip.max_x = 8 * 8 - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
bg_clip.max_x = 28*8-1;
|
||||
fg_clip.min_x = 28*8;
|
||||
bg_clip.max_x = 28 * 8 - 1;
|
||||
fg_clip.min_x = 28 * 8;
|
||||
}
|
||||
|
||||
bitmap_fill(screen->machine->priority_bitmap,cliprect,0);
|
||||
bitmap_fill(screen->machine->priority_bitmap, cliprect, 0);
|
||||
|
||||
tilemap_draw(bitmap,&bg_clip,bg_tilemap,0,0);
|
||||
tilemap_draw(bitmap,&fg_clip,fg_tilemap,0,0);
|
||||
tilemap_draw(bitmap,&bg_clip,bg_tilemap,1,1);
|
||||
tilemap_draw(bitmap,&fg_clip,fg_tilemap,1,1);
|
||||
tilemap_draw(bitmap, &bg_clip, state->bg_tilemap, 0, 0);
|
||||
tilemap_draw(bitmap, &fg_clip, state->fg_tilemap, 0, 0);
|
||||
tilemap_draw(bitmap, &bg_clip, state->bg_tilemap, 1, 1);
|
||||
tilemap_draw(bitmap, &fg_clip, state->fg_tilemap, 1, 1);
|
||||
|
||||
rallyx_draw_bullets(screen->machine,bitmap,cliprect,TRUE);
|
||||
rallyx_draw_sprites(screen->machine,bitmap,cliprect,1);
|
||||
rallyx_draw_bullets(screen->machine,bitmap,cliprect,FALSE);
|
||||
rallyx_draw_bullets(screen->machine, bitmap, cliprect, TRUE);
|
||||
rallyx_draw_sprites(screen->machine, bitmap, cliprect, 1);
|
||||
rallyx_draw_bullets(screen->machine, bitmap, cliprect, FALSE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -706,34 +663,36 @@ VIDEO_UPDATE( rallyx )
|
||||
|
||||
VIDEO_UPDATE( jungler )
|
||||
{
|
||||
timeplt_state *state = (timeplt_state *)screen->machine->driver_data;
|
||||
/* the radar tilemap is just 8x32. We rely on the tilemap code to repeat it across
|
||||
the screen, and clip it to only the position where it is supposed to be shown */
|
||||
rectangle fg_clip = *cliprect;
|
||||
rectangle bg_clip = *cliprect;
|
||||
|
||||
if (flip_screen_get(screen->machine))
|
||||
{
|
||||
bg_clip.min_x = 8*8;
|
||||
fg_clip.max_x = 8*8-1;
|
||||
bg_clip.min_x = 8 * 8;
|
||||
fg_clip.max_x = 8 * 8 - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
bg_clip.max_x = 28*8-1;
|
||||
fg_clip.min_x = 28*8;
|
||||
bg_clip.max_x = 28 * 8 - 1;
|
||||
fg_clip.min_x = 28 * 8;
|
||||
}
|
||||
|
||||
bitmap_fill(screen->machine->priority_bitmap,cliprect,0);
|
||||
bitmap_fill(screen->machine->priority_bitmap, cliprect, 0);
|
||||
|
||||
/* tile priority doesn't seem to be supported in Jungler */
|
||||
tilemap_draw(bitmap,&bg_clip,bg_tilemap,0,0);
|
||||
tilemap_draw(bitmap,&fg_clip,fg_tilemap,0,0);
|
||||
tilemap_draw(bitmap,&bg_clip,bg_tilemap,1,0);
|
||||
tilemap_draw(bitmap,&fg_clip,fg_tilemap,1,0);
|
||||
tilemap_draw(bitmap,&bg_clip, state->bg_tilemap, 0, 0);
|
||||
tilemap_draw(bitmap,&fg_clip, state->fg_tilemap, 0, 0);
|
||||
tilemap_draw(bitmap,&bg_clip, state->bg_tilemap, 1, 0);
|
||||
tilemap_draw(bitmap,&fg_clip, state->fg_tilemap, 1, 0);
|
||||
|
||||
jungler_draw_bullets(screen->machine,bitmap,cliprect,TRUE);
|
||||
rallyx_draw_sprites(screen->machine,bitmap,cliprect,0);
|
||||
jungler_draw_bullets(screen->machine,bitmap,cliprect,FALSE);
|
||||
jungler_draw_bullets(screen->machine, bitmap, cliprect, TRUE);
|
||||
rallyx_draw_sprites(screen->machine, bitmap, cliprect, 0);
|
||||
jungler_draw_bullets(screen->machine, bitmap, cliprect, FALSE);
|
||||
|
||||
if (stars_enable)
|
||||
if (state->stars_enable)
|
||||
draw_stars(screen->machine, bitmap, cliprect);
|
||||
|
||||
return 0;
|
||||
@ -742,44 +701,45 @@ VIDEO_UPDATE( jungler )
|
||||
|
||||
VIDEO_UPDATE( locomotn )
|
||||
{
|
||||
timeplt_state *state = (timeplt_state *)screen->machine->driver_data;
|
||||
/* the radar tilemap is just 8x32. We rely on the tilemap code to repeat it across
|
||||
the screen, and clip it to only the position where it is supposed to be shown */
|
||||
rectangle fg_clip = *cliprect;
|
||||
rectangle bg_clip = *cliprect;
|
||||
|
||||
if (flip_screen_get(screen->machine))
|
||||
{
|
||||
/* handle reduced visible area in some games */
|
||||
if (video_screen_get_visible_area(screen)->max_x == 32*8-1)
|
||||
if (video_screen_get_visible_area(screen)->max_x == 32 * 8 - 1)
|
||||
{
|
||||
bg_clip.min_x = 4*8;
|
||||
fg_clip.max_x = 4*8-1;
|
||||
bg_clip.min_x = 4 * 8;
|
||||
fg_clip.max_x = 4 * 8 - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
bg_clip.min_x = 8*8;
|
||||
fg_clip.max_x = 8*8-1;
|
||||
bg_clip.min_x = 8 * 8;
|
||||
fg_clip.max_x = 8 * 8-1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bg_clip.max_x = 28*8-1;
|
||||
fg_clip.min_x = 28*8;
|
||||
bg_clip.max_x = 28 * 8 - 1;
|
||||
fg_clip.min_x = 28 * 8;
|
||||
}
|
||||
|
||||
bitmap_fill(screen->machine->priority_bitmap,cliprect,0);
|
||||
bitmap_fill(screen->machine->priority_bitmap, cliprect, 0);
|
||||
|
||||
tilemap_draw(bitmap,&bg_clip,bg_tilemap,0,0);
|
||||
tilemap_draw(bitmap,&fg_clip,fg_tilemap,0,0);
|
||||
tilemap_draw(bitmap,&bg_clip,bg_tilemap,1,1);
|
||||
tilemap_draw(bitmap,&fg_clip,fg_tilemap,1,1);
|
||||
tilemap_draw(bitmap, &bg_clip, state->bg_tilemap, 0, 0);
|
||||
tilemap_draw(bitmap, &fg_clip, state->fg_tilemap, 0, 0);
|
||||
tilemap_draw(bitmap, &bg_clip, state->bg_tilemap, 1, 1);
|
||||
tilemap_draw(bitmap, &fg_clip, state->fg_tilemap, 1, 1);
|
||||
|
||||
locomotn_draw_bullets(screen->machine,bitmap,cliprect,TRUE);
|
||||
locomotn_draw_sprites(screen->machine,bitmap,cliprect,0);
|
||||
locomotn_draw_bullets(screen->machine,bitmap,cliprect,FALSE);
|
||||
locomotn_draw_bullets(screen->machine, bitmap, cliprect, TRUE);
|
||||
locomotn_draw_sprites(screen->machine, bitmap, cliprect, 0);
|
||||
locomotn_draw_bullets(screen->machine, bitmap, cliprect, FALSE);
|
||||
|
||||
if (stars_enable)
|
||||
if (state->stars_enable)
|
||||
draw_stars(screen->machine, bitmap, cliprect);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include "driver.h"
|
||||
#include "video/resnet.h"
|
||||
#include "rocnrope.h"
|
||||
#include "includes/timeplt.h"
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
@ -84,14 +84,14 @@ PALETTE_INIT( rocnrope )
|
||||
|
||||
WRITE8_HANDLER( rocnrope_videoram_w )
|
||||
{
|
||||
rocnrope_state *state = (rocnrope_state *)space->machine->driver_data;
|
||||
timeplt_state *state = (timeplt_state *)space->machine->driver_data;
|
||||
state->videoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( rocnrope_colorram_w )
|
||||
{
|
||||
rocnrope_state *state = (rocnrope_state *)space->machine->driver_data;
|
||||
timeplt_state *state = (timeplt_state *)space->machine->driver_data;
|
||||
state->colorram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
|
||||
}
|
||||
@ -107,7 +107,7 @@ WRITE8_HANDLER( rocnrope_flipscreen_w )
|
||||
|
||||
static TILE_GET_INFO( get_bg_tile_info )
|
||||
{
|
||||
rocnrope_state *state = (rocnrope_state *)machine->driver_data;
|
||||
timeplt_state *state = (timeplt_state *)machine->driver_data;
|
||||
int attr = state->colorram[tile_index];
|
||||
int code = state->videoram[tile_index] + 2 * (attr & 0x80);
|
||||
int color = attr & 0x0f;
|
||||
@ -118,13 +118,13 @@ static TILE_GET_INFO( get_bg_tile_info )
|
||||
|
||||
VIDEO_START( rocnrope )
|
||||
{
|
||||
rocnrope_state *state = (rocnrope_state *)machine->driver_data;
|
||||
timeplt_state *state = (timeplt_state *)machine->driver_data;
|
||||
state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
}
|
||||
|
||||
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
{
|
||||
rocnrope_state *state = (rocnrope_state *)machine->driver_data;
|
||||
timeplt_state *state = (timeplt_state *)machine->driver_data;
|
||||
UINT8 *spriteram = state->spriteram;
|
||||
UINT8 *spriteram_2 = state->spriteram2;
|
||||
int offs;
|
||||
@ -144,7 +144,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
|
||||
VIDEO_UPDATE( rocnrope )
|
||||
{
|
||||
rocnrope_state *state = (rocnrope_state *)screen->machine->driver_data;
|
||||
timeplt_state *state = (timeplt_state *)screen->machine->driver_data;
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
return 0;
|
||||
|
@ -7,10 +7,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "driver.h"
|
||||
#include "timeplt.h"
|
||||
|
||||
static tilemap *bg_tilemap;
|
||||
|
||||
#include "includes/timeplt.h"
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
@ -45,30 +42,30 @@ PALETTE_INIT( timeplt )
|
||||
rgb_t palette[32];
|
||||
int i;
|
||||
|
||||
for (i = 0;i < 32;i++)
|
||||
for (i = 0; i < 32; i++)
|
||||
{
|
||||
int bit0,bit1,bit2,bit3,bit4,r,g,b;
|
||||
int bit0, bit1, bit2, bit3, bit4, r, g, b;
|
||||
|
||||
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;
|
||||
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 + 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;
|
||||
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 + 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;
|
||||
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[i] = MAKE_RGB(r,g,b);
|
||||
palette[i] = MAKE_RGB(r, g, b);
|
||||
}
|
||||
|
||||
color_prom += 2*32;
|
||||
@ -76,11 +73,11 @@ PALETTE_INIT( timeplt )
|
||||
|
||||
|
||||
/* sprites */
|
||||
for (i = 0;i < 64*4;i++)
|
||||
palette_set_color(machine, 32*4 + i, palette[*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 < 32*4;i++)
|
||||
for (i = 0; i < 32 * 4; i++)
|
||||
palette_set_color(machine, i, palette[(*color_prom++ & 0x0f) + 0x10]);
|
||||
}
|
||||
|
||||
@ -94,8 +91,9 @@ PALETTE_INIT( timeplt )
|
||||
|
||||
static TILE_GET_INFO( get_tile_info )
|
||||
{
|
||||
int attr = machine->generic.colorram.u8[tile_index];
|
||||
int code = machine->generic.videoram.u8[tile_index] + 8 * (attr & 0x20);
|
||||
timeplt_state *state = (timeplt_state *)machine->driver_data;
|
||||
int attr = state->colorram[tile_index];
|
||||
int code = state->videoram[tile_index] + 8 * (attr & 0x20);
|
||||
int color = attr & 0x1f;
|
||||
int flags = TILE_FLIPYX(attr >> 6);
|
||||
|
||||
@ -113,7 +111,8 @@ static TILE_GET_INFO( get_tile_info )
|
||||
|
||||
VIDEO_START( timeplt )
|
||||
{
|
||||
bg_tilemap = tilemap_create(machine, get_tile_info,tilemap_scan_rows,8,8,32,32);
|
||||
timeplt_state *state = (timeplt_state *)machine->driver_data;
|
||||
state->bg_tilemap = tilemap_create(machine, get_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
}
|
||||
|
||||
|
||||
@ -126,15 +125,17 @@ VIDEO_START( timeplt )
|
||||
|
||||
WRITE8_HANDLER( timeplt_videoram_w )
|
||||
{
|
||||
space->machine->generic.videoram.u8[offset] = data;
|
||||
tilemap_mark_tile_dirty(bg_tilemap,offset);
|
||||
timeplt_state *state = (timeplt_state *)space->machine->driver_data;
|
||||
state->videoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
|
||||
}
|
||||
|
||||
|
||||
WRITE8_HANDLER( timeplt_colorram_w )
|
||||
{
|
||||
space->machine->generic.colorram.u8[offset] = data;
|
||||
tilemap_mark_tile_dirty(bg_tilemap,offset);
|
||||
timeplt_state *state = (timeplt_state *)space->machine->driver_data;
|
||||
state->colorram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
|
||||
}
|
||||
|
||||
|
||||
@ -157,10 +158,11 @@ READ8_HANDLER( timeplt_scanline_r )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
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 )
|
||||
{
|
||||
UINT8 *spriteram = machine->generic.spriteram.u8;
|
||||
UINT8 *spriteram_2 = machine->generic.spriteram2.u8;
|
||||
timeplt_state *state = (timeplt_state *)machine->driver_data;
|
||||
UINT8 *spriteram = state->spriteram;
|
||||
UINT8 *spriteram_2 = state->spriteram2;
|
||||
int offs;
|
||||
|
||||
for (offs = 0x3e;offs >= 0x10;offs -= 2)
|
||||
@ -191,8 +193,10 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan
|
||||
|
||||
VIDEO_UPDATE( timeplt )
|
||||
{
|
||||
tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
|
||||
draw_sprites(screen->machine, bitmap,cliprect);
|
||||
tilemap_draw(bitmap,cliprect,bg_tilemap,1,0);
|
||||
timeplt_state *state = (timeplt_state *)screen->machine->driver_data;
|
||||
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 1, 0);
|
||||
return 0;
|
||||
}
|
||||
|
@ -6,22 +6,13 @@
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "driver.h"
|
||||
#include "tutankhm.h"
|
||||
#include "includes/timeplt.h"
|
||||
|
||||
|
||||
#define NUM_PENS (0x10)
|
||||
|
||||
|
||||
UINT8 *tutankhm_scroll;
|
||||
|
||||
static UINT8 junofrst_blitterdata[4];
|
||||
static UINT8 tutankhm_flip_screen_x;
|
||||
static UINT8 tutankhm_flip_screen_y;
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Write handlers
|
||||
@ -30,52 +21,38 @@ static UINT8 tutankhm_flip_screen_y;
|
||||
|
||||
WRITE8_HANDLER( tutankhm_flip_screen_x_w )
|
||||
{
|
||||
tutankhm_flip_screen_x = data & 0x01;
|
||||
timeplt_state *state = (timeplt_state *)space->machine->driver_data;
|
||||
state->flip_x = data & 0x01;
|
||||
}
|
||||
|
||||
|
||||
WRITE8_HANDLER( tutankhm_flip_screen_y_w )
|
||||
{
|
||||
tutankhm_flip_screen_y = data & 0x01;
|
||||
timeplt_state *state = (timeplt_state *)space->machine->driver_data;
|
||||
state->flip_y = data & 0x01;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Palette management
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static void get_pens(running_machine *machine, pen_t *pens)
|
||||
static void get_pens( running_machine *machine, pen_t *pens )
|
||||
{
|
||||
timeplt_state *state = (timeplt_state *)machine->driver_data;
|
||||
offs_t i;
|
||||
|
||||
for (i = 0; i < NUM_PENS; i++)
|
||||
{
|
||||
UINT8 data = machine->generic.paletteram.u8[i];
|
||||
UINT8 data = state->paletteram[i];
|
||||
|
||||
pens[i] = MAKE_RGB(pal3bit(data >> 0), pal3bit(data >> 3), pal2bit(data >> 6));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Video startup
|
||||
*
|
||||
*************************************/
|
||||
|
||||
VIDEO_START( tutankhm )
|
||||
{
|
||||
state_save_register_global_array(machine, junofrst_blitterdata);
|
||||
state_save_register_global(machine, tutankhm_flip_screen_x);
|
||||
state_save_register_global(machine, tutankhm_flip_screen_y);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Video update
|
||||
@ -84,8 +61,9 @@ VIDEO_START( tutankhm )
|
||||
|
||||
VIDEO_UPDATE( tutankhm )
|
||||
{
|
||||
int xorx = tutankhm_flip_screen_x ? 255 : 0;
|
||||
int xory = tutankhm_flip_screen_y ? 255 : 0;
|
||||
timeplt_state *state = (timeplt_state *)screen->machine->driver_data;
|
||||
int xorx = state->flip_x ? 255 : 0;
|
||||
int xory = state->flip_y ? 255 : 0;
|
||||
pen_t pens[NUM_PENS];
|
||||
int x, y;
|
||||
|
||||
@ -98,9 +76,9 @@ VIDEO_UPDATE( tutankhm )
|
||||
for (x = cliprect->min_x; x <= cliprect->max_x; x++)
|
||||
{
|
||||
UINT8 effx = x ^ xorx;
|
||||
UINT8 yscroll = (effx < 192) ? *tutankhm_scroll : 0;
|
||||
UINT8 yscroll = (effx < 192) ? *state->scroll : 0;
|
||||
UINT8 effy = (y ^ xory) + yscroll;
|
||||
UINT8 vrambyte = screen->machine->generic.videoram.u8[effy * 128 + effx / 2];
|
||||
UINT8 vrambyte = state->videoram[effy * 128 + effx / 2];
|
||||
UINT8 shifted = vrambyte >> (4 * (effx % 2));
|
||||
dst[x] = pens[shifted & 0x0f];
|
||||
}
|
||||
@ -131,7 +109,8 @@ VIDEO_UPDATE( tutankhm )
|
||||
|
||||
WRITE8_HANDLER( junofrst_blitter_w )
|
||||
{
|
||||
junofrst_blitterdata[offset] = data;
|
||||
timeplt_state *state = (timeplt_state *)space->machine->driver_data;
|
||||
state->blitterdata[offset] = data;
|
||||
|
||||
/* blitter is triggered by $8073 */
|
||||
if (offset == 3)
|
||||
@ -139,10 +118,10 @@ WRITE8_HANDLER( junofrst_blitter_w )
|
||||
int i;
|
||||
UINT8 *gfx_rom = memory_region(space->machine, "gfx1");
|
||||
|
||||
offs_t src = ((junofrst_blitterdata[2] << 8) | junofrst_blitterdata[3]) & 0xfffc;
|
||||
offs_t dest = (junofrst_blitterdata[0] << 8) | junofrst_blitterdata[1];
|
||||
offs_t src = ((state->blitterdata[2] << 8) | state->blitterdata[3]) & 0xfffc;
|
||||
offs_t dest = (state->blitterdata[0] << 8) | state->blitterdata[1];
|
||||
|
||||
int copy = junofrst_blitterdata[3] & 0x01;
|
||||
int copy = state->blitterdata[3] & 0x01;
|
||||
|
||||
/* 16x16 graphics */
|
||||
for (i = 0; i < 16; i++)
|
||||
@ -158,25 +137,25 @@ WRITE8_HANDLER( junofrst_blitter_w )
|
||||
else
|
||||
data = gfx_rom[src >> 1] >> 4;
|
||||
|
||||
src = src + 1;
|
||||
src += 1;
|
||||
|
||||
/* if there is a source pixel either copy the pixel or clear the pixel depending on the copy flag */
|
||||
|
||||
if (data)
|
||||
{
|
||||
if (copy==0)
|
||||
if (copy == 0)
|
||||
data = 0;
|
||||
|
||||
if (dest & 1)
|
||||
space->machine->generic.videoram.u8[dest >> 1] = (space->machine->generic.videoram.u8[dest >> 1] & 0x0f) | (data << 4);
|
||||
state->videoram[dest >> 1] = (state->videoram[dest >> 1] & 0x0f) | (data << 4);
|
||||
else
|
||||
space->machine->generic.videoram.u8[dest >> 1] = (space->machine->generic.videoram.u8[dest >> 1] & 0xf0) | data;
|
||||
state->videoram[dest >> 1] = (state->videoram[dest >> 1] & 0xf0) | data;
|
||||
}
|
||||
|
||||
dest = dest + 1;
|
||||
dest += 1;
|
||||
}
|
||||
|
||||
dest = dest + 240;
|
||||
dest += 240;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user