mirror of
https://github.com/holub/mame
synced 2025-10-05 16:50:57 +03:00
Added driver data struct and save states to: hnayayoi.c, hanaawas.c, higemaru.c, himesiki.c and sonson.c
Also, added driver data struct to: alpha68k.c, amspdwy.c, gng.c, gunsmoke.c, hotblock.c Finally, removed a couple of memory_set_bankptr I hadn't noticed in ddrible.c and gberet.c
This commit is contained in:
parent
1340ff28dc
commit
9ac246d99d
9
.gitattributes
vendored
9
.gitattributes
vendored
@ -2308,8 +2308,10 @@ src/mame/includes/actfancr.h svneol=native#text/plain
|
||||
src/mame/includes/aeroboto.h svneol=native#text/plain
|
||||
src/mame/includes/aerofgt.h svneol=native#text/plain
|
||||
src/mame/includes/ajax.h svneol=native#text/plain
|
||||
src/mame/includes/alpha68k.h svneol=native#text/plain
|
||||
src/mame/includes/ambush.h svneol=native#text/plain
|
||||
src/mame/includes/amiga.h svneol=native#text/plain
|
||||
src/mame/includes/amspdwy.h svneol=native#text/plain
|
||||
src/mame/includes/angelkds.h svneol=native#text/plain
|
||||
src/mame/includes/appoooh.h svneol=native#text/plain
|
||||
src/mame/includes/aquarium.h svneol=native#text/plain
|
||||
@ -2470,15 +2472,21 @@ src/mame/includes/gauntlet.h svneol=native#text/plain
|
||||
src/mame/includes/gberet.h svneol=native#text/plain
|
||||
src/mame/includes/gcpinbal.h svneol=native#text/plain
|
||||
src/mame/includes/genesis.h svneol=native#text/plain
|
||||
src/mame/includes/gng.h svneol=native#text/plain
|
||||
src/mame/includes/gomoku.h svneol=native#text/plain
|
||||
src/mame/includes/gottlieb.h svneol=native#text/plain
|
||||
src/mame/includes/gotya.h svneol=native#text/plain
|
||||
src/mame/includes/grchamp.h svneol=native#text/plain
|
||||
src/mame/includes/gridlee.h svneol=native#text/plain
|
||||
src/mame/includes/gstriker.h svneol=native#text/plain
|
||||
src/mame/includes/gunsmoke.h svneol=native#text/plain
|
||||
src/mame/includes/hanaawas.h svneol=native#text/plain
|
||||
src/mame/includes/harddriv.h svneol=native#text/plain
|
||||
src/mame/includes/hexa.h svneol=native#text/plain
|
||||
src/mame/includes/higemaru.h svneol=native#text/plain
|
||||
src/mame/includes/himesiki.h svneol=native#text/plain
|
||||
src/mame/includes/hitme.h svneol=native#text/plain
|
||||
src/mame/includes/hnayayoi.h svneol=native#text/plain
|
||||
src/mame/includes/hng64.h svneol=native#text/plain
|
||||
src/mame/includes/homedata.h svneol=native#text/plain
|
||||
src/mame/includes/hyprduel.h svneol=native#text/plain
|
||||
@ -2612,6 +2620,7 @@ src/mame/includes/slapstic.h svneol=native#text/plain
|
||||
src/mame/includes/snes.h svneol=native#text/plain
|
||||
src/mame/includes/snk.h svneol=native#text/plain
|
||||
src/mame/includes/snk6502.h svneol=native#text/plain
|
||||
src/mame/includes/sonson.h svneol=native#text/plain
|
||||
src/mame/includes/spacefb.h svneol=native#text/plain
|
||||
src/mame/includes/spiders.h svneol=native#text/plain
|
||||
src/mame/includes/sprint2.h svneol=native#text/plain
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -16,17 +16,7 @@ Sound: YM2151
|
||||
#include "driver.h"
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "sound/2151intf.h"
|
||||
|
||||
/* Variables & functions defined in video: */
|
||||
|
||||
WRITE8_HANDLER( amspdwy_videoram_w );
|
||||
WRITE8_HANDLER( amspdwy_colorram_w );
|
||||
WRITE8_HANDLER( amspdwy_paletteram_w );
|
||||
WRITE8_HANDLER( amspdwy_flipscreen_w );
|
||||
|
||||
VIDEO_START( amspdwy );
|
||||
VIDEO_UPDATE( amspdwy );
|
||||
|
||||
#include "includes/amspdwy.h"
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
@ -44,50 +34,51 @@ VIDEO_UPDATE( amspdwy );
|
||||
Or last value when wheel delta = 0
|
||||
*/
|
||||
|
||||
static UINT8 wheel_old[2];
|
||||
static UINT8 wheel_return[2];
|
||||
|
||||
static UINT8 amspdwy_wheel_r(running_machine *machine, int index)
|
||||
static UINT8 amspdwy_wheel_r( running_machine *machine, int index )
|
||||
{
|
||||
static const char *const portnames[] = { "WHEEL1", "WHEEL2", "AN1", "AN2" };
|
||||
UINT8 wheel;
|
||||
wheel = input_port_read(machine, portnames[2 + index]);
|
||||
if (wheel != wheel_old[index])
|
||||
{
|
||||
wheel = (wheel & 0x7fff) - (wheel & 0x8000);
|
||||
if (wheel > wheel_old[index]) wheel_return[index] = ((+wheel) & 0xf) | 0x00;
|
||||
else wheel_return[index] = ((-wheel) & 0xf) | 0x10;
|
||||
wheel_old[index] = wheel;
|
||||
}
|
||||
return wheel_return[index] | input_port_read(machine, portnames[index]);
|
||||
amspdwy_state *state = (amspdwy_state *)machine->driver_data;
|
||||
static const char *const portnames[] = { "WHEEL1", "WHEEL2", "AN1", "AN2" };
|
||||
UINT8 wheel = input_port_read(machine, portnames[2 + index]);
|
||||
if (wheel != state->wheel_old[index])
|
||||
{
|
||||
wheel = (wheel & 0x7fff) - (wheel & 0x8000);
|
||||
if (wheel > state->wheel_old[index])
|
||||
state->wheel_return[index] = ((+wheel) & 0xf) | 0x00;
|
||||
else
|
||||
state->wheel_return[index] = ((-wheel) & 0xf) | 0x10;
|
||||
|
||||
state->wheel_old[index] = wheel;
|
||||
}
|
||||
return state->wheel_return[index] | input_port_read(machine, portnames[index]);
|
||||
}
|
||||
|
||||
static READ8_HANDLER( amspdwy_wheel_0_r )
|
||||
{
|
||||
return amspdwy_wheel_r(space->machine, 0);
|
||||
return amspdwy_wheel_r(space->machine, 0);
|
||||
}
|
||||
|
||||
static READ8_HANDLER( amspdwy_wheel_1_r )
|
||||
{
|
||||
return amspdwy_wheel_r(space->machine, 1);
|
||||
return amspdwy_wheel_r(space->machine, 1);
|
||||
}
|
||||
|
||||
static READ8_DEVICE_HANDLER( amspdwy_sound_r )
|
||||
{
|
||||
return (ym2151_status_port_r(device,0) & ~ 0x30) | input_port_read(device->machine, "IN0");
|
||||
return (ym2151_status_port_r(device, 0) & ~ 0x30) | input_port_read(device->machine, "IN0");
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( amspdwy_sound_w )
|
||||
{
|
||||
amspdwy_state *state = (amspdwy_state *)space->machine->driver_data;
|
||||
soundlatch_w(space, 0, data);
|
||||
cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
|
||||
cpu_set_input_line(state->audiocpu, INPUT_LINE_NMI, PULSE_LINE);
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( amspdwy_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x7fff) AM_ROM // ROM
|
||||
AM_RANGE(0x8000, 0x801f) AM_WRITE(amspdwy_paletteram_w) AM_BASE_GENERIC(paletteram)// Palette
|
||||
AM_RANGE(0x9000, 0x93ff) AM_MIRROR(0x0400) AM_RAM_WRITE(amspdwy_videoram_w) AM_BASE_GENERIC(videoram) // Layer, mirrored?
|
||||
AM_RANGE(0x9800, 0x9bff) AM_RAM_WRITE(amspdwy_colorram_w) AM_BASE_GENERIC(colorram) // Layer
|
||||
AM_RANGE(0x9000, 0x93ff) AM_MIRROR(0x0400) AM_RAM_WRITE(amspdwy_videoram_w) AM_BASE_MEMBER(amspdwy_state, videoram) // Layer, mirrored?
|
||||
AM_RANGE(0x9800, 0x9bff) AM_RAM_WRITE(amspdwy_colorram_w) AM_BASE_MEMBER(amspdwy_state, colorram) // Layer
|
||||
AM_RANGE(0x9c00, 0x9fff) AM_RAM // Unused?
|
||||
// AM_RANGE(0xa000, 0xa000) AM_WRITENOP // ?
|
||||
AM_RANGE(0xa000, 0xa000) AM_READ_PORT("DSW1")
|
||||
@ -96,15 +87,15 @@ static ADDRESS_MAP_START( amspdwy_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0xac00, 0xac00) AM_READ(amspdwy_wheel_1_r) // Player 2
|
||||
AM_RANGE(0xb000, 0xb000) AM_WRITENOP // ? Exiting IRQ
|
||||
AM_RANGE(0xb400, 0xb400) AM_DEVREAD("ymsnd", amspdwy_sound_r) AM_WRITE(amspdwy_sound_w) // YM2151 status, To Sound CPU
|
||||
AM_RANGE(0xc000, 0xc0ff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)// Sprites
|
||||
AM_RANGE(0xc000, 0xc0ff) AM_RAM AM_BASE_SIZE_MEMBER(amspdwy_state, spriteram, spriteram_size)// Sprites
|
||||
AM_RANGE(0xe000, 0xe7ff) AM_RAM // Work RAM
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
static READ8_HANDLER( amspdwy_port_r )
|
||||
{
|
||||
UINT8 *Tracks = memory_region(space->machine, "maincpu")+0x10000;
|
||||
return Tracks[offset];
|
||||
UINT8 *tracks = memory_region(space->machine, "maincpu") + 0x10000;
|
||||
return tracks[offset];
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( amspdwy_portmap, ADDRESS_SPACE_IO, 8 )
|
||||
@ -248,9 +239,10 @@ GFXDECODE_END
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
static void irq_handler(const device_config *device, int irq)
|
||||
static void irq_handler( const device_config *device, int irq )
|
||||
{
|
||||
cputag_set_input_line(device->machine, "audiocpu", 0, irq ? ASSERT_LINE : CLEAR_LINE);
|
||||
amspdwy_state *state = (amspdwy_state *)device->machine->driver_data;
|
||||
cpu_set_input_line(state->audiocpu, 0, irq ? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
static const ym2151_interface amspdwy_ym2151_interface =
|
||||
@ -260,14 +252,30 @@ static const ym2151_interface amspdwy_ym2151_interface =
|
||||
|
||||
static MACHINE_START( amspdwy )
|
||||
{
|
||||
wheel_old[0] = wheel_old[1] = 0;
|
||||
wheel_return[0] = wheel_return[1] = 0;
|
||||
state_save_register_global_array(machine, wheel_old);
|
||||
state_save_register_global_array(machine, wheel_return);
|
||||
amspdwy_state *state = (amspdwy_state *)machine->driver_data;
|
||||
|
||||
state->audiocpu = devtag_get_device(machine, "audiocpu");
|
||||
|
||||
state_save_register_global(machine, state->flipscreen);
|
||||
state_save_register_global_array(machine, state->wheel_old);
|
||||
state_save_register_global_array(machine, state->wheel_return);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( amspdwy )
|
||||
{
|
||||
amspdwy_state *state = (amspdwy_state *)machine->driver_data;
|
||||
state->flipscreen = 0;
|
||||
state->wheel_old[0] = 0;
|
||||
state->wheel_old[1] = 0;
|
||||
state->wheel_return[0] = 0;
|
||||
state->wheel_return[1] = 0;
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( amspdwy )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(amspdwy_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", Z80,3000000)
|
||||
MDRV_CPU_PROGRAM_MAP(amspdwy_map)
|
||||
@ -277,7 +285,8 @@ static MACHINE_DRIVER_START( amspdwy )
|
||||
MDRV_CPU_ADD("audiocpu", Z80,3000000) /* Can't be disabled: the YM2151 timers must work */
|
||||
MDRV_CPU_PROGRAM_MAP(amspdwy_sound_map)
|
||||
|
||||
MDRV_MACHINE_START(amspdwy)
|
||||
MDRV_MACHINE_START(amspdwy)
|
||||
MDRV_MACHINE_RESET(amspdwy)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
|
@ -35,11 +35,7 @@ static INTERRUPT_GEN( ddrible_interrupt_1 )
|
||||
|
||||
static WRITE8_HANDLER( ddrible_bankswitch_w )
|
||||
{
|
||||
int bankaddress;
|
||||
UINT8 *RAM = memory_region(space->machine, "maincpu");
|
||||
|
||||
bankaddress = 0x10000 + (data & 0x0f) * 0x2000;
|
||||
memory_set_bankptr(space->machine, 1, &RAM[bankaddress]);
|
||||
memory_set_bank(space->machine, 1, data & 0x0f);
|
||||
}
|
||||
|
||||
|
||||
@ -256,6 +252,8 @@ static const vlm5030_interface vlm5030_config =
|
||||
static MACHINE_START( ddrible )
|
||||
{
|
||||
ddrible_state *state = (ddrible_state *)machine->driver_data;
|
||||
UINT8 *ROM = memory_region(machine, "maincpu");
|
||||
memory_configure_bank(machine, 1, 0, 5, &ROM[0x10000], 0x2000);
|
||||
|
||||
state->filter1 = devtag_get_device(machine, "filter1");
|
||||
state->filter2 = devtag_get_device(machine, "filter2");
|
||||
|
@ -120,15 +120,12 @@ static WRITE8_HANDLER( gberet_flipscreen_w )
|
||||
|
||||
static WRITE8_HANDLER( mrgoemon_coin_counter_w )
|
||||
{
|
||||
int offs;
|
||||
|
||||
/* bits 0/1 = coin counters */
|
||||
coin_counter_w(space->machine, 0, data & 0x01);
|
||||
coin_counter_w(space->machine, 1, data & 0x02);
|
||||
|
||||
/* bits 5-7 = ROM bank select */
|
||||
offs = 0x10000 + ((data & 0xe0) >> 5) * 0x800;
|
||||
memory_set_bankptr(space->machine, 1, &memory_region(space->machine, "maincpu")[offs]);
|
||||
memory_set_bank(space->machine, 1, ((data & 0xe0) >> 5));
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( mrgoemon_flipscreen_w )
|
||||
@ -537,13 +534,26 @@ ROM_START( mrgoemon )
|
||||
ROM_LOAD( "621a07.6f", 0x0120, 0x0100, CRC(3980acdc) SHA1(f4e0bd74bccd77b84096c38bc70cf488a42d9562) ) // sprites
|
||||
ROM_END
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Driver initialization
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static DRIVER_INIT( mrgoemon )
|
||||
{
|
||||
UINT8 *ROM = memory_region(machine, "maincpu");
|
||||
memory_configure_bank(machine, 1, 0, 8, &ROM[0x10000], 0x800);
|
||||
}
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Game driver(s)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
GAME( 1985, gberet, 0, gberet, gberet, 0, ROT0, "Konami", "Green Beret", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1985, rushatck, gberet, gberet, gberet, 0, ROT0, "Konami", "Rush'n Attack (US)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1985, gberetb, gberet, gberetb, gberetb, 0, ROT0, "bootleg", "Green Beret (bootleg)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1986, mrgoemon, 0, mrgoemon, mrgoemon, 0, ROT0, "Konami", "Mr. Goemon (Japan)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1985, gberet, 0, gberet, gberet, 0, ROT0, "Konami", "Green Beret", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1985, rushatck, gberet, gberet, gberet, 0, ROT0, "Konami", "Rush'n Attack (US)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1985, gberetb, gberet, gberetb, gberetb, 0, ROT0, "bootleg", "Green Beret (bootleg)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1986, mrgoemon, 0, mrgoemon, mrgoemon, mrgoemon, ROT0, "Konami", "Mr. Goemon (Japan)", GAME_SUPPORTS_SAVE )
|
||||
|
@ -25,52 +25,27 @@ Notes:
|
||||
#include "deprecat.h"
|
||||
#include "cpu/m6809/m6809.h"
|
||||
#include "sound/2203intf.h"
|
||||
|
||||
|
||||
|
||||
extern UINT8 *gng_fgvideoram;
|
||||
extern UINT8 *gng_bgvideoram;
|
||||
WRITE8_HANDLER( gng_fgvideoram_w );
|
||||
WRITE8_HANDLER( gng_bgvideoram_w );
|
||||
WRITE8_HANDLER( gng_bgscrollx_w );
|
||||
WRITE8_HANDLER( gng_bgscrolly_w );
|
||||
WRITE8_HANDLER( gng_flipscreen_w );
|
||||
VIDEO_START( gng );
|
||||
VIDEO_UPDATE( gng );
|
||||
VIDEO_EOF( gng );
|
||||
|
||||
#include "includes/gng.h"
|
||||
|
||||
|
||||
static WRITE8_HANDLER( gng_bankswitch_w )
|
||||
{
|
||||
if (data == 4)
|
||||
{
|
||||
memory_set_bank(space->machine, 1,4);
|
||||
}
|
||||
memory_set_bank(space->machine, 1, 4);
|
||||
else
|
||||
{
|
||||
memory_set_bank(space->machine, 1,(data & 0x03));
|
||||
}
|
||||
memory_set_bank(space->machine, 1, (data & 0x03));
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( gng_coin_counter_w )
|
||||
{
|
||||
coin_counter_w(space->machine, offset,data);
|
||||
}
|
||||
|
||||
static MACHINE_START( gng )
|
||||
{
|
||||
/* configure ROM banking */
|
||||
UINT8 *rombase = memory_region(machine, "maincpu");
|
||||
memory_configure_bank(machine, 1,0,4,&rombase[0x10000],0x2000);
|
||||
memory_configure_bank(machine, 1,4,1,&rombase[0x4000],0x2000);
|
||||
coin_counter_w(space->machine, offset, data);
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( gng_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x1dff) AM_RAM
|
||||
AM_RANGE(0x1e00, 0x1fff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
|
||||
AM_RANGE(0x2000, 0x27ff) AM_RAM_WRITE(gng_fgvideoram_w) AM_BASE(&gng_fgvideoram)
|
||||
AM_RANGE(0x2800, 0x2fff) AM_RAM_WRITE(gng_bgvideoram_w) AM_BASE(&gng_bgvideoram)
|
||||
AM_RANGE(0x2000, 0x27ff) AM_RAM_WRITE(gng_fgvideoram_w) AM_BASE_MEMBER(gng_state, fgvideoram)
|
||||
AM_RANGE(0x2800, 0x2fff) AM_RAM_WRITE(gng_bgvideoram_w) AM_BASE_MEMBER(gng_state, bgvideoram)
|
||||
AM_RANGE(0x3000, 0x3000) AM_READ_PORT("SYSTEM")
|
||||
AM_RANGE(0x3001, 0x3001) AM_READ_PORT("P1")
|
||||
AM_RANGE(0x3002, 0x3002) AM_READ_PORT("P2")
|
||||
@ -326,8 +301,33 @@ GFXDECODE_END
|
||||
|
||||
|
||||
|
||||
static MACHINE_START( gng )
|
||||
{
|
||||
gng_state *state = (gng_state *)machine->driver_data;
|
||||
|
||||
UINT8 *rombase = memory_region(machine, "maincpu");
|
||||
memory_configure_bank(machine, 1, 0, 4, &rombase[0x10000], 0x2000);
|
||||
memory_configure_bank(machine, 1, 4, 1, &rombase[0x4000], 0x2000);
|
||||
|
||||
state_save_register_global_array(machine, state->scrollx);
|
||||
state_save_register_global_array(machine, state->scrolly);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( gng )
|
||||
{
|
||||
gng_state *state = (gng_state *)machine->driver_data;
|
||||
|
||||
state->scrollx[0] = 0;
|
||||
state->scrollx[1] = 0;
|
||||
state->scrolly[0] = 0;
|
||||
state->scrolly[1] = 0;
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( gng )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(gng_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", M6809, XTAL_12MHz/8) /* verified on pcb */
|
||||
MDRV_CPU_PROGRAM_MAP(gng_map)
|
||||
@ -338,6 +338,7 @@ static MACHINE_DRIVER_START( gng )
|
||||
MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4)
|
||||
|
||||
MDRV_MACHINE_START(gng)
|
||||
MDRV_MACHINE_RESET(gng)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
|
||||
|
@ -70,18 +70,8 @@ Stephh's notes (based on the games Z80 code and some tests) :
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "deprecat.h"
|
||||
#include "sound/2203intf.h"
|
||||
#include "includes/gunsmoke.h"
|
||||
|
||||
extern UINT8 *gunsmoke_scrollx;
|
||||
extern UINT8 *gunsmoke_scrolly;
|
||||
|
||||
extern WRITE8_HANDLER( gunsmoke_c804_w );
|
||||
extern WRITE8_HANDLER( gunsmoke_d806_w );
|
||||
extern WRITE8_HANDLER( gunsmoke_videoram_w );
|
||||
extern WRITE8_HANDLER( gunsmoke_colorram_w );
|
||||
|
||||
extern PALETTE_INIT( gunsmoke );
|
||||
extern VIDEO_START( gunsmoke );
|
||||
extern VIDEO_UPDATE( gunsmoke );
|
||||
|
||||
/* Read/Write Handlers */
|
||||
|
||||
@ -103,8 +93,7 @@ static READ8_HANDLER( gunsmoke_protection_r )
|
||||
*/
|
||||
|
||||
static const UINT8 gunsmoke_fixed_data[] = { 0xff, 0x00, 0x00 };
|
||||
|
||||
return gunsmoke_fixed_data[offset];
|
||||
return gunsmoke_fixed_data[offset];
|
||||
}
|
||||
|
||||
/* Memory Maps */
|
||||
@ -121,13 +110,13 @@ static ADDRESS_MAP_START( gunsmoke_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0xc800, 0xc800) AM_WRITE(soundlatch_w)
|
||||
AM_RANGE(0xc804, 0xc804) AM_WRITE(gunsmoke_c804_w) // ROM bank switch, screen flip
|
||||
AM_RANGE(0xc806, 0xc806) AM_WRITE(watchdog_reset_w)
|
||||
AM_RANGE(0xd000, 0xd3ff) AM_RAM_WRITE(gunsmoke_videoram_w) AM_BASE_GENERIC(videoram)
|
||||
AM_RANGE(0xd400, 0xd7ff) AM_RAM_WRITE(gunsmoke_colorram_w) AM_BASE_GENERIC(colorram)
|
||||
AM_RANGE(0xd800, 0xd801) AM_RAM AM_BASE(&gunsmoke_scrollx)
|
||||
AM_RANGE(0xd802, 0xd802) AM_RAM AM_BASE(&gunsmoke_scrolly)
|
||||
AM_RANGE(0xd000, 0xd3ff) AM_RAM_WRITE(gunsmoke_videoram_w) AM_BASE_MEMBER(gunsmoke_state, videoram)
|
||||
AM_RANGE(0xd400, 0xd7ff) AM_RAM_WRITE(gunsmoke_colorram_w) AM_BASE_MEMBER(gunsmoke_state, colorram)
|
||||
AM_RANGE(0xd800, 0xd801) AM_RAM AM_BASE_MEMBER(gunsmoke_state, scrollx)
|
||||
AM_RANGE(0xd802, 0xd802) AM_RAM AM_BASE_MEMBER(gunsmoke_state, scrolly)
|
||||
AM_RANGE(0xd806, 0xd806) AM_WRITE(gunsmoke_d806_w) // sprites and bg enable
|
||||
AM_RANGE(0xe000, 0xefff) AM_RAM
|
||||
AM_RANGE(0xf000, 0xffff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
|
||||
AM_RANGE(0xf000, 0xffff) AM_RAM AM_BASE_SIZE_MEMBER(gunsmoke_state, spriteram, spriteram_size)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
@ -283,8 +272,35 @@ GFXDECODE_END
|
||||
|
||||
/* Machine Driver */
|
||||
|
||||
static MACHINE_START( gunsmoke )
|
||||
{
|
||||
gunsmoke_state *state = (gunsmoke_state *)machine->driver_data;
|
||||
UINT8 *rombase = memory_region(machine, "maincpu");
|
||||
|
||||
memory_configure_bank(machine, 1, 0, 4, &rombase[0x10000], 0x4000);
|
||||
|
||||
state_save_register_global(machine, state->chon);
|
||||
state_save_register_global(machine, state->objon);
|
||||
state_save_register_global(machine, state->bgon);
|
||||
state_save_register_global(machine, state->sprite3bank);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( gunsmoke )
|
||||
{
|
||||
gunsmoke_state *state = (gunsmoke_state *)machine->driver_data;
|
||||
|
||||
state->chon = 0;
|
||||
state->objon = 0;
|
||||
state->bgon = 0;
|
||||
state->sprite3bank = 0;
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( gunsmoke )
|
||||
// basic machine hardware
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(gunsmoke_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", Z80, 4000000) // 4 MHz
|
||||
MDRV_CPU_PROGRAM_MAP(gunsmoke_map)
|
||||
MDRV_CPU_VBLANK_INT("screen", irq0_line_hold)
|
||||
@ -293,8 +309,10 @@ static MACHINE_DRIVER_START( gunsmoke )
|
||||
MDRV_CPU_PROGRAM_MAP(sound_map)
|
||||
MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold, 4)
|
||||
|
||||
// video hardware
|
||||
MDRV_MACHINE_START(gunsmoke)
|
||||
MDRV_MACHINE_RESET(gunsmoke)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
MDRV_SCREEN_REFRESH_RATE(60)
|
||||
MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
|
||||
@ -309,7 +327,7 @@ static MACHINE_DRIVER_START( gunsmoke )
|
||||
MDRV_VIDEO_START(gunsmoke)
|
||||
MDRV_VIDEO_UPDATE(gunsmoke)
|
||||
|
||||
// sound hardware
|
||||
/* sound hardware */
|
||||
MDRV_SPEAKER_STANDARD_MONO("mono")
|
||||
|
||||
MDRV_SOUND_ADD("ym1", YM2203, 1500000)
|
||||
|
@ -28,24 +28,15 @@
|
||||
#include "driver.h"
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "sound/ay8910.h"
|
||||
|
||||
|
||||
extern WRITE8_HANDLER( hanaawas_videoram_w );
|
||||
extern WRITE8_HANDLER( hanaawas_colorram_w );
|
||||
extern WRITE8_DEVICE_HANDLER( hanaawas_portB_w );
|
||||
|
||||
extern PALETTE_INIT( hanaawas );
|
||||
extern VIDEO_START( hanaawas );
|
||||
extern VIDEO_UPDATE( hanaawas );
|
||||
|
||||
static int mux;
|
||||
#include "includes/hanaawas.h"
|
||||
|
||||
static READ8_HANDLER( hanaawas_input_port_0_r )
|
||||
{
|
||||
int i,ordinal = 0;
|
||||
hanaawas_state *state = (hanaawas_state *)space->machine->driver_data;
|
||||
int i, ordinal = 0;
|
||||
UINT16 buttons = 0;
|
||||
|
||||
switch( mux )
|
||||
switch (state->mux)
|
||||
{
|
||||
case 1: /* start buttons */
|
||||
buttons = input_port_read(space->machine, "START");
|
||||
@ -75,15 +66,16 @@ static READ8_HANDLER( hanaawas_input_port_0_r )
|
||||
|
||||
static WRITE8_HANDLER( hanaawas_inputs_mux_w )
|
||||
{
|
||||
mux = data;
|
||||
hanaawas_state *state = (hanaawas_state *)space->machine->driver_data;
|
||||
state->mux = data;
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( hanaawas_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x2fff) AM_ROM
|
||||
AM_RANGE(0x4000, 0x4fff) AM_ROM
|
||||
AM_RANGE(0x6000, 0x6fff) AM_ROM
|
||||
AM_RANGE(0x8000, 0x83ff) AM_RAM_WRITE(hanaawas_videoram_w) AM_BASE_GENERIC(videoram)
|
||||
AM_RANGE(0x8400, 0x87ff) AM_RAM_WRITE(hanaawas_colorram_w) AM_BASE_GENERIC(colorram)
|
||||
AM_RANGE(0x8000, 0x83ff) AM_RAM_WRITE(hanaawas_videoram_w) AM_BASE_MEMBER(hanaawas_state, videoram)
|
||||
AM_RANGE(0x8400, 0x87ff) AM_RAM_WRITE(hanaawas_colorram_w) AM_BASE_MEMBER(hanaawas_state, colorram)
|
||||
AM_RANGE(0x8800, 0x8bff) AM_RAM
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -192,14 +184,34 @@ static const ay8910_interface ay8910_config =
|
||||
};
|
||||
|
||||
|
||||
static MACHINE_START( hanaawas )
|
||||
{
|
||||
hanaawas_state *state = (hanaawas_state *)machine->driver_data;
|
||||
|
||||
state_save_register_global(machine, state->mux);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( hanaawas )
|
||||
{
|
||||
hanaawas_state *state = (hanaawas_state *)machine->driver_data;
|
||||
|
||||
state->mux = 0;
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( hanaawas )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(hanaawas_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", Z80,18432000/6) /* 3.072 MHz ??? */
|
||||
MDRV_CPU_PROGRAM_MAP(hanaawas_map)
|
||||
MDRV_CPU_IO_MAP(io_map)
|
||||
MDRV_CPU_VBLANK_INT("screen", irq0_line_hold)
|
||||
|
||||
MDRV_MACHINE_START(hanaawas)
|
||||
MDRV_MACHINE_RESET(hanaawas)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
MDRV_SCREEN_REFRESH_RATE(60)
|
||||
@ -250,4 +262,4 @@ ROM_START( hanaawas )
|
||||
ROM_END
|
||||
|
||||
|
||||
GAME( 1982, hanaawas, 0, hanaawas, hanaawas, 0, ROT0, "Setakikaku, Ltd.", "Hana Awase", 0 )
|
||||
GAME( 1982, hanaawas, 0, hanaawas, hanaawas, 0, ROT0, "Setakikaku, Ltd.", "Hana Awase", GAME_SUPPORTS_SAVE )
|
||||
|
@ -14,23 +14,15 @@ Use Player 1 joystick and button, then press START1 to go to next screen.
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "deprecat.h"
|
||||
#include "sound/ay8910.h"
|
||||
|
||||
|
||||
extern WRITE8_HANDLER( higemaru_videoram_w );
|
||||
extern WRITE8_HANDLER( higemaru_colorram_w );
|
||||
extern WRITE8_HANDLER( higemaru_c800_w );
|
||||
|
||||
extern PALETTE_INIT( higemaru );
|
||||
extern VIDEO_START( higemaru );
|
||||
extern VIDEO_UPDATE( higemaru );
|
||||
#include "includes/higemaru.h"
|
||||
|
||||
|
||||
static INTERRUPT_GEN( higemaru_interrupt )
|
||||
{
|
||||
if (cpu_getiloops(device) == 0)
|
||||
cpu_set_input_line_and_vector(device,0,HOLD_LINE,0xcf); /* RST 08h */
|
||||
cpu_set_input_line_and_vector(device, 0, HOLD_LINE, 0xcf); /* RST 08h */
|
||||
else
|
||||
cpu_set_input_line_and_vector(device,0,HOLD_LINE,0xd7); /* RST 10h */
|
||||
cpu_set_input_line_and_vector(device, 0, HOLD_LINE, 0xd7); /* RST 10h */
|
||||
}
|
||||
|
||||
|
||||
@ -44,9 +36,9 @@ static ADDRESS_MAP_START( higemaru_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0xc800, 0xc800) AM_WRITE(higemaru_c800_w)
|
||||
AM_RANGE(0xc801, 0xc802) AM_DEVWRITE("ay1", ay8910_address_data_w)
|
||||
AM_RANGE(0xc803, 0xc804) AM_DEVWRITE("ay2", ay8910_address_data_w)
|
||||
AM_RANGE(0xd000, 0xd3ff) AM_RAM_WRITE(higemaru_videoram_w) AM_BASE_GENERIC(videoram)
|
||||
AM_RANGE(0xd400, 0xd7ff) AM_RAM_WRITE(higemaru_colorram_w) AM_BASE_GENERIC(colorram)
|
||||
AM_RANGE(0xd880, 0xd9ff) AM_RAM_WRITE(SMH_RAM) AM_BASE_SIZE_GENERIC(spriteram)
|
||||
AM_RANGE(0xd000, 0xd3ff) AM_RAM_WRITE(higemaru_videoram_w) AM_BASE_MEMBER(higemaru_state, videoram)
|
||||
AM_RANGE(0xd400, 0xd7ff) AM_RAM_WRITE(higemaru_colorram_w) AM_BASE_MEMBER(higemaru_state, colorram)
|
||||
AM_RANGE(0xd880, 0xd9ff) AM_RAM_WRITE(SMH_RAM) AM_BASE_SIZE_MEMBER(higemaru_state, spriteram, spriteram_size)
|
||||
AM_RANGE(0xe000, 0xefff) AM_RAM
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -165,6 +157,9 @@ GFXDECODE_END
|
||||
|
||||
static MACHINE_DRIVER_START( higemaru )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(higemaru_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", Z80, XTAL_12MHz/4) /* 3 MHz Sharp LH0080A Z80A-CPU-D */
|
||||
MDRV_CPU_PROGRAM_MAP(higemaru_map)
|
||||
@ -224,4 +219,4 @@ ROM_START( higemaru )
|
||||
ROM_END
|
||||
|
||||
|
||||
GAME( 1984, higemaru, 0, higemaru, higemaru, 0, ROT0, "Capcom", "Pirate Ship Higemaru", 0 )
|
||||
GAME( 1984, higemaru, 0, higemaru, higemaru, 0, ROT0, "Capcom", "Pirate Ship Higemaru", GAME_SUPPORTS_SAVE )
|
||||
|
@ -86,31 +86,23 @@ A 12.000MHz
|
||||
#include "deprecat.h"
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "sound/2203intf.h"
|
||||
#include "includes/himesiki.h"
|
||||
|
||||
#define MCLK XTAL_12MHz
|
||||
|
||||
VIDEO_START( himesiki );
|
||||
VIDEO_UPDATE( himesiki );
|
||||
|
||||
WRITE8_HANDLER( himesiki_bg_ram_w );
|
||||
WRITE8_HANDLER( himesiki_scrollx_w );
|
||||
WRITE8_HANDLER( himesiki_flip_w );
|
||||
|
||||
extern UINT8 *himesiki_bg_ram;
|
||||
|
||||
static WRITE8_HANDLER( himesiki_rombank_w )
|
||||
{
|
||||
UINT8 *ROM = memory_region(space->machine, "maincpu");
|
||||
memory_set_bankptr(space->machine, 1, &ROM[0x10000 + 0x800 * (data & 8)]);
|
||||
memory_set_bank(space->machine, 1, ((data & 0x08) >> 3));
|
||||
|
||||
if (data & 0xf7)
|
||||
logerror("p06_w %02x\n",data);
|
||||
logerror("p06_w %02x\n", data);
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( himesiki_sound_w )
|
||||
{
|
||||
himesiki_state *state = (himesiki_state *)space->machine->driver_data;
|
||||
soundlatch_w(space, offset, data);
|
||||
cputag_set_input_line(space->machine, "sub", INPUT_LINE_NMI, PULSE_LINE);
|
||||
cpu_set_input_line(state->subcpu, INPUT_LINE_NMI, PULSE_LINE);
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
@ -118,9 +110,9 @@ static WRITE8_HANDLER( himesiki_sound_w )
|
||||
static ADDRESS_MAP_START( himesiki_prm0, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x7fff) AM_ROM
|
||||
AM_RANGE(0x8000, 0x9fff) AM_RAM
|
||||
AM_RANGE(0xa000, 0xa7ff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
|
||||
AM_RANGE(0xa000, 0xa7ff) AM_RAM AM_BASE_MEMBER(himesiki_state, spriteram)
|
||||
AM_RANGE(0xa800, 0xafff) AM_RAM AM_WRITE(paletteram_xRRRRRGGGGGBBBBB_le_w) AM_BASE_GENERIC(paletteram)
|
||||
AM_RANGE(0xb000, 0xbfff) AM_RAM AM_WRITE(himesiki_bg_ram_w) AM_BASE(&himesiki_bg_ram)
|
||||
AM_RANGE(0xb000, 0xbfff) AM_RAM AM_WRITE(himesiki_bg_ram_w) AM_BASE_MEMBER(himesiki_state, bg_ram)
|
||||
AM_RANGE(0xc000, 0xffff) AM_ROMBANK(1)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -153,7 +145,7 @@ ADDRESS_MAP_END
|
||||
/****************************************************************************/
|
||||
|
||||
static INPUT_PORTS_START( himesiki )
|
||||
PORT_START("DSW1") /* DSW1 (0) */
|
||||
PORT_START("DSW1")
|
||||
PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:1")
|
||||
PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
|
||||
@ -177,7 +169,7 @@ static INPUT_PORTS_START( himesiki )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
|
||||
PORT_SERVICE_DIPLOC(0x80, IP_ACTIVE_LOW, "SW1:8" )
|
||||
|
||||
PORT_START("DSW2") /* DSW2 (1) */
|
||||
PORT_START("DSW2")
|
||||
PORT_DIPNAME( 0x01, 0x01, "2-1" ) PORT_DIPLOCATION("SW2:1")
|
||||
PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
|
||||
@ -203,7 +195,7 @@ static INPUT_PORTS_START( himesiki )
|
||||
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
|
||||
|
||||
PORT_START("1P") /* 1P (2) */
|
||||
PORT_START("1P")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
|
||||
@ -213,7 +205,7 @@ static INPUT_PORTS_START( himesiki )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
|
||||
PORT_START("2P") /* 2P (3) */
|
||||
PORT_START("2P")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
|
||||
@ -223,7 +215,7 @@ static INPUT_PORTS_START( himesiki )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
|
||||
PORT_START("OTHERS") /* OTHERS (4) */
|
||||
PORT_START("OTHERS")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_COIN1 )
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
@ -276,8 +268,33 @@ static GFXDECODE_START( himesiki )
|
||||
GFXDECODE_END
|
||||
|
||||
|
||||
static MACHINE_START( himesiki )
|
||||
{
|
||||
himesiki_state *state = (himesiki_state *)machine->driver_data;
|
||||
UINT8 *ROM = memory_region(machine, "maincpu");
|
||||
|
||||
memory_configure_bank(machine, 1, 0, 2, &ROM[0x10000], 0x4000);
|
||||
|
||||
state->subcpu = devtag_get_device(machine, "sub");
|
||||
|
||||
state_save_register_global_array(machine, state->scrollx);
|
||||
state_save_register_global(machine, state->flipscreen);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( himesiki )
|
||||
{
|
||||
himesiki_state *state = (himesiki_state *)machine->driver_data;
|
||||
|
||||
state->scrollx[0] = 0;
|
||||
state->scrollx[1] = 0;
|
||||
state->flipscreen = 0;
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( himesiki )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(himesiki_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", Z80, MCLK/2) /* 6.000 MHz */
|
||||
MDRV_CPU_PROGRAM_MAP(himesiki_prm0)
|
||||
@ -288,6 +305,9 @@ static MACHINE_DRIVER_START( himesiki )
|
||||
MDRV_CPU_PROGRAM_MAP(himesiki_prm1)
|
||||
MDRV_CPU_IO_MAP(himesiki_iom1)
|
||||
|
||||
MDRV_MACHINE_START(himesiki)
|
||||
MDRV_MACHINE_RESET(himesiki)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
MDRV_SCREEN_REFRESH_RATE(60)
|
||||
@ -340,4 +360,4 @@ ROM_START( himesiki )
|
||||
ROM_LOAD16_BYTE( "14.8c", 0x020001, 0x010000, CRC(8103a207) SHA1(0dde8a0aaf2618d9c1589f35841db210439d0388) )
|
||||
ROM_END
|
||||
|
||||
GAME( 1989, himesiki, 0, himesiki, himesiki, 0, ROT90, "Hi-Soft", "Himeshikibu (Japan)", 0 )
|
||||
GAME( 1989, himesiki, 0, himesiki, himesiki, 0, ROT90, "Hi-Soft", "Himeshikibu (Japan)", GAME_SUPPORTS_SAVE )
|
||||
|
@ -36,29 +36,21 @@ TODO:
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "sound/2203intf.h"
|
||||
#include "sound/msm5205.h"
|
||||
#include "includes/hnayayoi.h"
|
||||
|
||||
|
||||
VIDEO_START( hnayayoi );
|
||||
VIDEO_START( untoucha );
|
||||
VIDEO_UPDATE( hnayayoi );
|
||||
|
||||
WRITE8_HANDLER( dynax_blitter_rev1_param_w );
|
||||
WRITE8_HANDLER( dynax_blitter_rev1_start_w );
|
||||
WRITE8_HANDLER( dynax_blitter_rev1_clear_w );
|
||||
WRITE8_HANDLER( hnayayoi_palbank_w );
|
||||
|
||||
|
||||
|
||||
static int keyb;
|
||||
|
||||
static READ8_HANDLER( keyboard_0_r )
|
||||
{
|
||||
hnayayoi_state *state = (hnayayoi_state *)space->machine->driver_data;
|
||||
int res = 0x3f;
|
||||
int i;
|
||||
static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4" };
|
||||
|
||||
for (i = 0;i < 5;i++)
|
||||
if (~keyb & (1 << i)) res &= input_port_read(space->machine, keynames[i]);
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
if (~state->keyb & (1 << i))
|
||||
res &= input_port_read(space->machine, keynames[i]);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -71,37 +63,31 @@ static READ8_HANDLER( keyboard_1_r )
|
||||
|
||||
static WRITE8_HANDLER( keyboard_w )
|
||||
{
|
||||
keyb = data;
|
||||
hnayayoi_state *state = (hnayayoi_state *)space->machine->driver_data;
|
||||
state->keyb = data;
|
||||
}
|
||||
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( adpcm_data_w )
|
||||
{
|
||||
msm5205_data_w(device,data);
|
||||
msm5205_data_w(device, data);
|
||||
}
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( adpcm_vclk_w )
|
||||
{
|
||||
msm5205_vclk_w(device,data & 1);
|
||||
msm5205_vclk_w(device, data & 1);
|
||||
}
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( adpcm_reset_w )
|
||||
{
|
||||
msm5205_reset_w(device,data & 1);
|
||||
msm5205_reset_w(device, data & 1);
|
||||
}
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( adpcm_reset_inv_w )
|
||||
{
|
||||
msm5205_reset_w(device,~data & 1);
|
||||
msm5205_reset_w(device, ~data & 1);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( hnayayoi )
|
||||
{
|
||||
/* start with the MSM5205 reset */
|
||||
msm5205_reset_w(devtag_get_device(machine, "msm"),1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static ADDRESS_MAP_START( hnayayoi_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x77ff) AM_ROM
|
||||
@ -516,7 +502,7 @@ INPUT_PORTS_END
|
||||
static void irqhandler(const device_config *device, int irq)
|
||||
{
|
||||
popmessage("irq");
|
||||
// cputag_set_input_line(device->machine, "maincpu",0,irq ? ASSERT_LINE : CLEAR_LINE);
|
||||
// cputag_set_input_line(device->machine, "maincpu", 0, irq ? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
|
||||
@ -541,7 +527,37 @@ static const msm5205_interface msm5205_config =
|
||||
|
||||
|
||||
|
||||
static MACHINE_START( hnayayoi )
|
||||
{
|
||||
hnayayoi_state *state = (hnayayoi_state *)machine->driver_data;
|
||||
|
||||
state_save_register_global(machine, state->palbank);
|
||||
state_save_register_global(machine, state->blit_layer);
|
||||
state_save_register_global(machine, state->blit_dest);
|
||||
state_save_register_global(machine, state->blit_src);
|
||||
state_save_register_global(machine, state->keyb);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( hnayayoi )
|
||||
{
|
||||
hnayayoi_state *state = (hnayayoi_state *)machine->driver_data;
|
||||
|
||||
/* start with the MSM5205 reset */
|
||||
msm5205_reset_w(devtag_get_device(machine, "msm"), 1);
|
||||
|
||||
state->palbank = 0;
|
||||
state->blit_layer = 0;
|
||||
state->blit_dest = 0;
|
||||
state->blit_src = 0;
|
||||
state->keyb = 0;
|
||||
}
|
||||
|
||||
|
||||
static MACHINE_DRIVER_START( hnayayoi )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(hnayayoi_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", Z80, 20000000/4 ) /* 5 MHz ???? */
|
||||
MDRV_CPU_PROGRAM_MAP(hnayayoi_map)
|
||||
@ -549,6 +565,7 @@ static MACHINE_DRIVER_START( hnayayoi )
|
||||
MDRV_CPU_VBLANK_INT("screen", irq0_line_hold)
|
||||
MDRV_CPU_PERIODIC_INT(nmi_line_pulse, 8000)
|
||||
|
||||
MDRV_MACHINE_START(hnayayoi)
|
||||
MDRV_MACHINE_RESET(hnayayoi)
|
||||
|
||||
MDRV_NVRAM_HANDLER(generic_0fill)
|
||||
@ -666,14 +683,14 @@ static DRIVER_INIT( hnfubuki )
|
||||
{
|
||||
UINT8 *rom = memory_region(machine, "gfx1");
|
||||
int len = memory_region_length(machine, "gfx1");
|
||||
int i,j;
|
||||
int i, j;
|
||||
|
||||
/* interestingly, the blitter data has a slight encryption */
|
||||
|
||||
/* swap address bits 4 and 5 */
|
||||
for (i = 0;i < len;i += 0x40)
|
||||
for (i = 0; i < len; i += 0x40)
|
||||
{
|
||||
for (j = 0;j < 0x10;j++)
|
||||
for (j = 0; j < 0x10; j++)
|
||||
{
|
||||
UINT8 t = rom[i + j + 0x10];
|
||||
rom[i + j + 0x10] = rom[i + j + 0x20];
|
||||
@ -682,13 +699,13 @@ static DRIVER_INIT( hnfubuki )
|
||||
}
|
||||
|
||||
/* swap data bits 0 and 1 */
|
||||
for (i = 0;i < len;i++)
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
rom[i] = BITSWAP8(rom[i],7,6,5,4,3,2,0,1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GAME( 1987, hnayayoi, 0, hnayayoi, hnayayoi, 0, ROT0, "Dyna Electronics", "Hana Yayoi (Japan)", 0 )
|
||||
GAME( 1987, hnfubuki, hnayayoi, hnfubuki, hnfubuki, hnfubuki, ROT0, "Dynax", "Hana Fubuki [BET] (Japan)", 0 )
|
||||
GAME( 1987, untoucha, 0, untoucha, untoucha, 0, ROT0, "Dynax", "Untouchable (Japan)", 0 )
|
||||
GAME( 1987, hnayayoi, 0, hnayayoi, hnayayoi, 0, ROT0, "Dyna Electronics", "Hana Yayoi (Japan)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1987, hnfubuki, hnayayoi, hnfubuki, hnfubuki, hnfubuki, ROT0, "Dynax", "Hana Fubuki [BET] (Japan)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1987, untoucha, 0, untoucha, untoucha, 0, ROT0, "Dynax", "Untouchable (Japan)", GAME_SUPPORTS_SAVE )
|
||||
|
@ -45,28 +45,37 @@ so it could be by them instead
|
||||
#include "cpu/i86/i86.h"
|
||||
#include "sound/ay8910.h"
|
||||
|
||||
static UINT8 *hotblock_ram;
|
||||
static UINT8 *hotblock_pal;
|
||||
static int hotblock_port0;
|
||||
static int hotblock_port4;
|
||||
typedef struct _hotblock_state hotblock_state;
|
||||
struct _hotblock_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * vram;
|
||||
UINT8 * pal;
|
||||
|
||||
/* misc */
|
||||
int port0;
|
||||
int port4;
|
||||
};
|
||||
|
||||
|
||||
|
||||
static READ8_HANDLER( hotblock_video_read )
|
||||
{
|
||||
hotblock_state *state = (hotblock_state *)space->machine->driver_data;
|
||||
/* right?, anything else?? */
|
||||
if(hotblock_port0 &0x20) // port 0 = a8 e8 -- palette
|
||||
if (state->port0 & 0x20) // port 0 = a8 e8 -- palette
|
||||
{
|
||||
return hotblock_pal[offset];
|
||||
return state->pal[offset];
|
||||
}
|
||||
else // port 0 = 88 c8
|
||||
{
|
||||
return hotblock_ram[offset];
|
||||
return state->vram[offset];
|
||||
}
|
||||
}
|
||||
|
||||
/* port 4 is some kind of eeprom / storage .. used to store the scores */
|
||||
static READ8_HANDLER( hotblock_port4_r )
|
||||
{
|
||||
|
||||
// mame_printf_debug("port4_r\n");
|
||||
return 0x00;
|
||||
}
|
||||
@ -74,41 +83,44 @@ static READ8_HANDLER( hotblock_port4_r )
|
||||
|
||||
static WRITE8_HANDLER( hotblock_port4_w )
|
||||
{
|
||||
// mame_printf_debug("port4_w: pc = %06x : data %04x\n",cpu_get_pc(space->cpu),data);
|
||||
// popmessage("port4_w: pc = %06x : data %04x",cpu_get_pc(space->cpu),data);
|
||||
hotblock_port4=data;
|
||||
// mame_printf_debug("port4_w: pc = %06x : data %04x\n", cpu_get_pc(space->cpu), data);
|
||||
// popmessage("port4_w: pc = %06x : data %04x", cpu_get_pc(space->cpu), data);
|
||||
hotblock_state *state = (hotblock_state *)space->machine->driver_data;
|
||||
state->port4 = data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static WRITE8_HANDLER( hotblock_port0_w )
|
||||
{
|
||||
// popmessage("port4_w: pc = %06x : data %04x",cpu_get_pc(space->cpu),data);
|
||||
hotblock_port0=data;
|
||||
// popmessage("port4_w: pc = %06x : data %04x", cpu_get_pc(space->cpu), data);
|
||||
hotblock_state *state = (hotblock_state *)space->machine->driver_data;
|
||||
state->port0 = data;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( hotblock_video_write )
|
||||
{
|
||||
hotblock_state *state = (hotblock_state *)space->machine->driver_data;
|
||||
/* right?, anything else?? */
|
||||
if(hotblock_port0 &0x20) // port 0 = a8 e8 -- palette
|
||||
if (state->port0 & 0x20) // port 0 = a8 e8 -- palette
|
||||
{
|
||||
hotblock_pal[offset]=data;
|
||||
state->pal[offset] = data;
|
||||
}
|
||||
else // port 0 = 88 c8
|
||||
{
|
||||
hotblock_ram[offset]=data;
|
||||
state->vram[offset] = data;
|
||||
}
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( hotblock_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x00000, 0x0ffff) AM_RAM
|
||||
AM_RANGE(0x10000, 0x1ffff) AM_READ(hotblock_video_read) AM_WRITE(hotblock_video_write) AM_BASE(&hotblock_ram)
|
||||
AM_RANGE(0x10000, 0x1ffff) AM_READWRITE(hotblock_video_read, hotblock_video_write) AM_BASE_MEMBER(hotblock_state, vram)
|
||||
AM_RANGE(0x20000, 0xfffff) AM_ROM
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( hotblock_io, ADDRESS_SPACE_IO, 8 )
|
||||
AM_RANGE(0x0000, 0x0000) AM_WRITE(hotblock_port0_w)
|
||||
AM_RANGE(0x0004, 0x0004) AM_READ(hotblock_port4_r) AM_WRITE(hotblock_port4_w)
|
||||
AM_RANGE(0x0004, 0x0004) AM_READWRITE(hotblock_port4_r, hotblock_port4_w)
|
||||
AM_RANGE(0x8000, 0x8001) AM_DEVWRITE("aysnd", ay8910_address_data_w)
|
||||
AM_RANGE(0x8001, 0x8001) AM_DEVREAD("aysnd", ay8910_r)
|
||||
ADDRESS_MAP_END
|
||||
@ -117,41 +129,43 @@ ADDRESS_MAP_END
|
||||
|
||||
static VIDEO_START(hotblock)
|
||||
{
|
||||
hotblock_pal=auto_alloc_array(machine, UINT8, 0x10000);
|
||||
hotblock_state *state = (hotblock_state *)machine->driver_data;
|
||||
state->pal = auto_alloc_array(machine, UINT8, 0x10000);
|
||||
state_save_register_global_pointer(machine, state->pal, 0x10000);
|
||||
}
|
||||
|
||||
static VIDEO_UPDATE(hotblock)
|
||||
{
|
||||
|
||||
int y,x,count;
|
||||
hotblock_state *state = (hotblock_state *)screen->machine->driver_data;
|
||||
int y, x, count;
|
||||
int i;
|
||||
static const int xxx=320,yyy=204;
|
||||
static const int xxx = 320, yyy = 204;
|
||||
|
||||
bitmap_fill(bitmap, 0, get_black_pen(screen->machine));
|
||||
|
||||
for (i=0;i<256;i++)
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
int dat=(hotblock_pal[i*2+1]<<8)|hotblock_pal[i*2];
|
||||
palette_set_color_rgb(screen->machine,i,pal5bit(dat>>0),pal5bit(dat>>5),pal5bit(dat>>10));
|
||||
int dat = (state->pal[i * 2 + 1] << 8) | state->pal[i * 2];
|
||||
palette_set_color_rgb(screen->machine, i, pal5bit(dat >> 0), pal5bit(dat >> 5), pal5bit(dat >> 10));
|
||||
}
|
||||
|
||||
count=0;
|
||||
for (y=0;y<yyy;y++)
|
||||
count = 0;
|
||||
for (y = 0; y < yyy; y++)
|
||||
{
|
||||
for(x=0;x<xxx;x++)
|
||||
for(x = 0; x < xxx; x++)
|
||||
{
|
||||
if(hotblock_port0&0x40) *BITMAP_ADDR16(bitmap, y, x) = hotblock_ram[count];
|
||||
if (state->port0 & 0x40)
|
||||
*BITMAP_ADDR16(bitmap, y, x) = state->vram[count];
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static INPUT_PORTS_START(hotblock)
|
||||
PORT_START("P1") /* 8bit */
|
||||
static INPUT_PORTS_START( hotblock )
|
||||
PORT_START("P1")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 )
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY
|
||||
@ -161,7 +175,7 @@ static INPUT_PORTS_START(hotblock)
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) // unused?
|
||||
|
||||
PORT_START("P2") /* 8bit */
|
||||
PORT_START("P2")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN2 )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_8WAY
|
||||
@ -172,6 +186,7 @@ static INPUT_PORTS_START(hotblock)
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) // used to get test mode
|
||||
INPUT_PORTS_END
|
||||
|
||||
|
||||
static INTERRUPT_GEN( hotblocks_irq ) /* right? */
|
||||
{
|
||||
cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE);
|
||||
@ -189,6 +204,10 @@ static const ay8910_interface ay8910_config =
|
||||
|
||||
|
||||
static MACHINE_DRIVER_START( hotblock )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(hotblock_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", I8088, 10000000)
|
||||
MDRV_CPU_PROGRAM_MAP(hotblock_map)
|
||||
|
@ -52,47 +52,38 @@ TODO:
|
||||
#include "deprecat.h"
|
||||
#include "cpu/m6809/m6809.h"
|
||||
#include "sound/ay8910.h"
|
||||
#include "includes/sonson.h"
|
||||
|
||||
|
||||
WRITE8_HANDLER( sonson_videoram_w );
|
||||
WRITE8_HANDLER( sonson_colorram_w );
|
||||
WRITE8_HANDLER( sonson_scrollx_w );
|
||||
WRITE8_HANDLER( sonson_flipscreen_w );
|
||||
|
||||
PALETTE_INIT( sonson );
|
||||
VIDEO_START( sonson );
|
||||
VIDEO_UPDATE( sonson );
|
||||
|
||||
static WRITE8_HANDLER( sonson_sh_irqtrigger_w )
|
||||
{
|
||||
static int last;
|
||||
|
||||
sonson_state *state = (sonson_state *)space->machine->driver_data;
|
||||
data &= 1;
|
||||
|
||||
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(space->machine, "audiocpu", M6809_FIRQ_LINE, HOLD_LINE);
|
||||
cpu_set_input_line(state->audiocpu, M6809_FIRQ_LINE, HOLD_LINE);
|
||||
}
|
||||
|
||||
last = data;
|
||||
state->last_irq = data;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( sonson_coin1_counter_w )
|
||||
{
|
||||
coin_counter_w(space->machine, 0,data & 1);
|
||||
coin_counter_w(space->machine, 0, data & 1);
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( sonson_coin2_counter_w )
|
||||
{
|
||||
coin_counter_w(space->machine, 1,data & 1);
|
||||
coin_counter_w(space->machine, 1, data & 1);
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x0fff) AM_RAM
|
||||
AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(sonson_videoram_w) AM_BASE_GENERIC(videoram) AM_SIZE_GENERIC(videoram)
|
||||
AM_RANGE(0x1400, 0x17ff) AM_RAM_WRITE(sonson_colorram_w) AM_BASE_GENERIC(colorram)
|
||||
AM_RANGE(0x2020, 0x207f) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
|
||||
AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(sonson_videoram_w) AM_BASE_SIZE_MEMBER(sonson_state, videoram, videoram_size)
|
||||
AM_RANGE(0x1400, 0x17ff) AM_RAM_WRITE(sonson_colorram_w) AM_BASE_MEMBER(sonson_state, colorram)
|
||||
AM_RANGE(0x2020, 0x207f) AM_RAM AM_BASE_SIZE_MEMBER(sonson_state, spriteram, spriteram_size)
|
||||
AM_RANGE(0x3000, 0x3000) AM_WRITE(sonson_scrollx_w)
|
||||
AM_RANGE(0x3002, 0x3002) AM_READ_PORT("P1")
|
||||
AM_RANGE(0x3003, 0x3003) AM_READ_PORT("P2")
|
||||
@ -236,8 +227,27 @@ GFXDECODE_END
|
||||
|
||||
|
||||
|
||||
static MACHINE_START( sonson )
|
||||
{
|
||||
sonson_state *state = (sonson_state *)machine->driver_data;
|
||||
|
||||
state->audiocpu = devtag_get_device(machine, "audiocpu");
|
||||
|
||||
state_save_register_global(machine, state->last_irq);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( sonson )
|
||||
{
|
||||
sonson_state *state = (sonson_state *)machine->driver_data;
|
||||
|
||||
state->last_irq = 0;
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( sonson )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(sonson_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", M6809,12000000/6) /* 2 MHz ??? */
|
||||
MDRV_CPU_PROGRAM_MAP(main_map)
|
||||
@ -247,6 +257,8 @@ static MACHINE_DRIVER_START( sonson )
|
||||
MDRV_CPU_PROGRAM_MAP(sound_map)
|
||||
MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4) /* FIRQs are triggered by the main CPU */
|
||||
|
||||
MDRV_MACHINE_START(sonson)
|
||||
MDRV_MACHINE_RESET(sonson)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
@ -342,5 +354,5 @@ ROM_START( sonsonj )
|
||||
ROM_END
|
||||
|
||||
|
||||
GAME( 1984, sonson, 0, sonson, sonson, 0, ROT0, "Capcom", "Son Son", 0 )
|
||||
GAME( 1984, sonsonj, sonson, sonson, sonson, 0, ROT0, "Capcom", "Son Son (Japan)", 0 )
|
||||
GAME( 1984, sonson, 0, sonson, sonson, 0, ROT0, "Capcom", "Son Son", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1984, sonsonj, sonson, sonson, sonson, 0, ROT0, "Capcom", "Son Son (Japan)", GAME_SUPPORTS_SAVE )
|
||||
|
64
src/mame/includes/alpha68k.h
Normal file
64
src/mame/includes/alpha68k.h
Normal file
@ -0,0 +1,64 @@
|
||||
/*************************************************************************
|
||||
|
||||
SNK/Alpha 68000 based games
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
typedef struct _alpha68k_state alpha68k_state;
|
||||
struct _alpha68k_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT16 * videoram;
|
||||
UINT16 * spriteram;
|
||||
UINT16 * shared_ram;
|
||||
UINT16 * paletteram;
|
||||
|
||||
/* video-related */
|
||||
tilemap *fix_tilemap;
|
||||
int bank_base, flipscreen, last_bank;
|
||||
int buffer_28, buffer_60, buffer_68;
|
||||
|
||||
/* misc */
|
||||
int invert_controls;
|
||||
int microcontroller_id;
|
||||
int coin_id;
|
||||
unsigned trigstate, deposits1, deposits2, credits;
|
||||
unsigned coinvalue;
|
||||
unsigned microcontroller_data;
|
||||
int latch;
|
||||
unsigned game_id; // see below
|
||||
|
||||
/* devices */
|
||||
const device_config *audiocpu;
|
||||
};
|
||||
|
||||
/* game_id - used to deal with a few game specific situations */
|
||||
enum
|
||||
{
|
||||
ALPHA68K_BTLFIELDB = 0, // used in alpha_II_trigger_r
|
||||
ALPHA68K_JONGBOU, // used in kyros_alpha_trigger_r & kyros_draw_sprites
|
||||
ALPHA68K_KYROS // used in kyros_draw_sprites
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/alpha68k.c -----------*/
|
||||
|
||||
PALETTE_INIT( kyros );
|
||||
PALETTE_INIT( paddlem );
|
||||
|
||||
VIDEO_START( alpha68k );
|
||||
|
||||
VIDEO_UPDATE( kyros );
|
||||
VIDEO_UPDATE( sstingry );
|
||||
VIDEO_UPDATE( alpha68k_I );
|
||||
VIDEO_UPDATE( alpha68k_II );
|
||||
VIDEO_UPDATE( alpha68k_V );
|
||||
VIDEO_UPDATE( alpha68k_V_sb );
|
||||
|
||||
void alpha68k_V_video_bank_w(running_machine *machine, int bank);
|
||||
void alpha68k_flipscreen_w(running_machine *machine, int flip);
|
||||
|
||||
WRITE16_HANDLER( alpha68k_paletteram_w );
|
||||
WRITE16_HANDLER( alpha68k_videoram_w );
|
||||
WRITE16_HANDLER( alpha68k_II_video_bank_w );
|
||||
WRITE16_HANDLER( alpha68k_V_video_control_w );
|
38
src/mame/includes/amspdwy.h
Normal file
38
src/mame/includes/amspdwy.h
Normal file
@ -0,0 +1,38 @@
|
||||
/*************************************************************************
|
||||
|
||||
American Speedway
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
typedef struct _amspdwy_state amspdwy_state;
|
||||
struct _amspdwy_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * videoram;
|
||||
UINT8 * spriteram;
|
||||
UINT8 * colorram;
|
||||
// UINT8 * paletteram; // currently this uses generic palette handling
|
||||
size_t spriteram_size;
|
||||
|
||||
/* video-related */
|
||||
tilemap *bg_tilemap;
|
||||
int flipscreen;
|
||||
|
||||
/* misc */
|
||||
UINT8 wheel_old[2];
|
||||
UINT8 wheel_return[2];
|
||||
|
||||
/* devices */
|
||||
const device_config *audiocpu;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/amspdwy.c -----------*/
|
||||
|
||||
WRITE8_HANDLER( amspdwy_videoram_w );
|
||||
WRITE8_HANDLER( amspdwy_colorram_w );
|
||||
WRITE8_HANDLER( amspdwy_paletteram_w );
|
||||
WRITE8_HANDLER( amspdwy_flipscreen_w );
|
||||
|
||||
VIDEO_START( amspdwy );
|
||||
VIDEO_UPDATE( amspdwy );
|
34
src/mame/includes/gng.h
Normal file
34
src/mame/includes/gng.h
Normal file
@ -0,0 +1,34 @@
|
||||
/*************************************************************************
|
||||
|
||||
Ghosts'n Goblins
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
typedef struct _gng_state gng_state;
|
||||
struct _gng_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * bgvideoram;
|
||||
UINT8 * fgvideoram;
|
||||
// UINT8 * paletteram; // currently this uses generic palette handling
|
||||
// UINT8 * paletteram2; // currently this uses generic palette handling
|
||||
// UINT8 * spriteram; // currently this uses generic buffered spriteram
|
||||
|
||||
/* video-related */
|
||||
tilemap *bg_tilemap, *fg_tilemap;
|
||||
UINT8 scrollx[2];
|
||||
UINT8 scrolly[2];
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/gng.c -----------*/
|
||||
|
||||
WRITE8_HANDLER( gng_fgvideoram_w );
|
||||
WRITE8_HANDLER( gng_bgvideoram_w );
|
||||
WRITE8_HANDLER( gng_bgscrollx_w );
|
||||
WRITE8_HANDLER( gng_bgscrolly_w );
|
||||
WRITE8_HANDLER( gng_flipscreen_w );
|
||||
|
||||
VIDEO_START( gng );
|
||||
VIDEO_UPDATE( gng );
|
||||
VIDEO_EOF( gng );
|
35
src/mame/includes/gunsmoke.h
Normal file
35
src/mame/includes/gunsmoke.h
Normal file
@ -0,0 +1,35 @@
|
||||
/*************************************************************************
|
||||
|
||||
Gun.Smoke
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
typedef struct _gunsmoke_state gunsmoke_state;
|
||||
struct _gunsmoke_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * videoram;
|
||||
UINT8 * colorram;
|
||||
UINT8 * spriteram;
|
||||
UINT8 * scrollx;
|
||||
UINT8 * scrolly;
|
||||
size_t spriteram_size;
|
||||
|
||||
/* video-related */
|
||||
tilemap *bg_tilemap, *fg_tilemap;
|
||||
UINT8 chon, objon, bgon;
|
||||
UINT8 sprite3bank;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/gunsmoke.c -----------*/
|
||||
|
||||
WRITE8_HANDLER( gunsmoke_c804_w );
|
||||
WRITE8_HANDLER( gunsmoke_d806_w );
|
||||
WRITE8_HANDLER( gunsmoke_videoram_w );
|
||||
WRITE8_HANDLER( gunsmoke_colorram_w );
|
||||
|
||||
PALETTE_INIT( gunsmoke );
|
||||
VIDEO_START( gunsmoke );
|
||||
VIDEO_UPDATE( gunsmoke );
|
||||
|
30
src/mame/includes/hanaawas.h
Normal file
30
src/mame/includes/hanaawas.h
Normal file
@ -0,0 +1,30 @@
|
||||
/*************************************************************************
|
||||
|
||||
Hana Awase
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
typedef struct _hanaawas_state hanaawas_state;
|
||||
struct _hanaawas_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * videoram;
|
||||
UINT8 * colorram;
|
||||
|
||||
/* video-related */
|
||||
tilemap *bg_tilemap;
|
||||
|
||||
/* misc */
|
||||
int mux;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/hanaawas.c -----------*/
|
||||
|
||||
WRITE8_HANDLER( hanaawas_videoram_w );
|
||||
WRITE8_HANDLER( hanaawas_colorram_w );
|
||||
WRITE8_DEVICE_HANDLER( hanaawas_portB_w );
|
||||
|
||||
PALETTE_INIT( hanaawas );
|
||||
VIDEO_START( hanaawas );
|
||||
VIDEO_UPDATE( hanaawas );
|
29
src/mame/includes/higemaru.h
Normal file
29
src/mame/includes/higemaru.h
Normal file
@ -0,0 +1,29 @@
|
||||
/*************************************************************************
|
||||
|
||||
Pirate Ship Higemaru
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
typedef struct _higemaru_state higemaru_state;
|
||||
struct _higemaru_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * videoram;
|
||||
UINT8 * colorram;
|
||||
UINT8 * spriteram;
|
||||
size_t spriteram_size;
|
||||
|
||||
/* video-related */
|
||||
tilemap *bg_tilemap;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/higemaru.c -----------*/
|
||||
|
||||
WRITE8_HANDLER( higemaru_videoram_w );
|
||||
WRITE8_HANDLER( higemaru_colorram_w );
|
||||
WRITE8_HANDLER( higemaru_c800_w );
|
||||
|
||||
PALETTE_INIT( higemaru );
|
||||
VIDEO_START( higemaru );
|
||||
VIDEO_UPDATE( higemaru );
|
32
src/mame/includes/himesiki.h
Normal file
32
src/mame/includes/himesiki.h
Normal file
@ -0,0 +1,32 @@
|
||||
/*************************************************************************
|
||||
|
||||
Himeshikibu
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
typedef struct _himesiki_state himesiki_state;
|
||||
struct _himesiki_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * bg_ram;
|
||||
UINT8 * spriteram;
|
||||
// UINT8 * paletteram; // currently this uses generic palette handling
|
||||
|
||||
/* video-related */
|
||||
tilemap *bg_tilemap;
|
||||
int scrollx[2];
|
||||
int flipscreen;
|
||||
|
||||
/* devices */
|
||||
const device_config *subcpu;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/himesiki.c -----------*/
|
||||
|
||||
VIDEO_START( himesiki );
|
||||
VIDEO_UPDATE( himesiki );
|
||||
|
||||
WRITE8_HANDLER( himesiki_bg_ram_w );
|
||||
WRITE8_HANDLER( himesiki_scrollx_w );
|
||||
WRITE8_HANDLER( himesiki_flip_w );
|
32
src/mame/includes/hnayayoi.h
Normal file
32
src/mame/includes/hnayayoi.h
Normal file
@ -0,0 +1,32 @@
|
||||
/*************************************************************************
|
||||
|
||||
Hana Yayoi & other Dynax games (using 1st version of their blitter)
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
typedef struct _hnayayoi_state hnayayoi_state;
|
||||
struct _hnayayoi_state
|
||||
{
|
||||
/* video-related */
|
||||
UINT8 *pixmap[8];
|
||||
int palbank;
|
||||
int total_pixmaps;
|
||||
UINT8 blit_layer;
|
||||
UINT16 blit_dest;
|
||||
UINT32 blit_src;
|
||||
|
||||
/* misc */
|
||||
int keyb;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/hnayayoi.c -----------*/
|
||||
|
||||
VIDEO_START( hnayayoi );
|
||||
VIDEO_START( untoucha );
|
||||
VIDEO_UPDATE( hnayayoi );
|
||||
|
||||
WRITE8_HANDLER( dynax_blitter_rev1_param_w );
|
||||
WRITE8_HANDLER( dynax_blitter_rev1_start_w );
|
||||
WRITE8_HANDLER( dynax_blitter_rev1_clear_w );
|
||||
WRITE8_HANDLER( hnayayoi_palbank_w );
|
37
src/mame/includes/sonson.h
Normal file
37
src/mame/includes/sonson.h
Normal file
@ -0,0 +1,37 @@
|
||||
/*************************************************************************
|
||||
|
||||
Son Son
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
typedef struct _sonson_state sonson_state;
|
||||
struct _sonson_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * videoram;
|
||||
UINT8 * colorram;
|
||||
UINT8 * spriteram;
|
||||
size_t videoram_size;
|
||||
size_t spriteram_size;
|
||||
|
||||
/* video-related */
|
||||
tilemap *bg_tilemap;
|
||||
|
||||
/* misc */
|
||||
int last_irq;
|
||||
|
||||
/* devices */
|
||||
const device_config *audiocpu;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/sonson.c -----------*/
|
||||
|
||||
WRITE8_HANDLER( sonson_videoram_w );
|
||||
WRITE8_HANDLER( sonson_colorram_w );
|
||||
WRITE8_HANDLER( sonson_scrollx_w );
|
||||
WRITE8_HANDLER( sonson_flipscreen_w );
|
||||
|
||||
PALETTE_INIT( sonson );
|
||||
VIDEO_START( sonson );
|
||||
VIDEO_UPDATE( sonson );
|
@ -5,115 +5,110 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "driver.h"
|
||||
#include "includes/alpha68k.h"
|
||||
|
||||
static tilemap *fix_tilemap;
|
||||
static int bank_base,flipscreen;
|
||||
|
||||
extern void (*alpha68k_video_banking)(int *bank, int data);
|
||||
|
||||
extern int alpha68k_microcontroller_id;
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
VIDEO_START( alpha68k_common_vh )
|
||||
void alpha68k_flipscreen_w( running_machine *machine, int flip )
|
||||
{
|
||||
state_save_register_global(machine, flipscreen);
|
||||
alpha68k_state *state = (alpha68k_state *)machine->driver_data;
|
||||
state->flipscreen = flip;
|
||||
}
|
||||
|
||||
void alpha68k_flipscreen_w(int flip)
|
||||
void alpha68k_V_video_bank_w( running_machine *machine, int bank )
|
||||
{
|
||||
flipscreen = flip;
|
||||
}
|
||||
|
||||
void alpha68k_V_video_bank_w(int bank)
|
||||
{
|
||||
bank_base = bank&0xf;
|
||||
alpha68k_state *state = (alpha68k_state *)machine->driver_data;
|
||||
state->bank_base = bank & 0xf;
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( alpha68k_paletteram_w )
|
||||
{
|
||||
alpha68k_state *state = (alpha68k_state *)space->machine->driver_data;
|
||||
int newword;
|
||||
int r,g,b;
|
||||
int r, g, b;
|
||||
|
||||
COMBINE_DATA(space->machine->generic.paletteram.u16 + offset);
|
||||
newword = space->machine->generic.paletteram.u16[offset];
|
||||
COMBINE_DATA(state->paletteram + offset);
|
||||
newword = state->paletteram[offset];
|
||||
|
||||
r = ((newword >> 7) & 0x1e) | ((newword >> 14) & 0x01);
|
||||
g = ((newword >> 3) & 0x1e) | ((newword >> 13) & 0x01);
|
||||
b = ((newword << 1) & 0x1e) | ((newword >> 12) & 0x01);
|
||||
|
||||
palette_set_color_rgb(space->machine,offset,pal5bit(r),pal5bit(g),pal5bit(b));
|
||||
palette_set_color_rgb(space->machine, offset, pal5bit(r), pal5bit(g), pal5bit(b));
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
static TILE_GET_INFO( get_tile_info )
|
||||
{
|
||||
int tile = machine->generic.videoram.u16[2*tile_index] &0xff;
|
||||
int color = machine->generic.videoram.u16[2*tile_index+1] &0x0f;
|
||||
alpha68k_state *state = (alpha68k_state *)machine->driver_data;
|
||||
int tile = state->videoram[2 * tile_index] & 0xff;
|
||||
int color = state->videoram[2 * tile_index + 1] & 0x0f;
|
||||
|
||||
tile=tile | (bank_base<<8);
|
||||
tile = tile | (state->bank_base << 8);
|
||||
|
||||
SET_TILE_INFO(0, tile, color, 0);
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( alpha68k_videoram_w )
|
||||
{
|
||||
alpha68k_state *state = (alpha68k_state *)space->machine->driver_data;
|
||||
/* Doh. */
|
||||
if(ACCESSING_BITS_0_7)
|
||||
if(ACCESSING_BITS_8_15)
|
||||
space->machine->generic.videoram.u16[offset] = data;
|
||||
state->videoram[offset] = data;
|
||||
else
|
||||
space->machine->generic.videoram.u16[offset] = data & 0xff;
|
||||
state->videoram[offset] = data & 0xff;
|
||||
else
|
||||
space->machine->generic.videoram.u16[offset] = (data >> 8) & 0xff;
|
||||
state->videoram[offset] = (data >> 8) & 0xff;
|
||||
|
||||
tilemap_mark_tile_dirty(fix_tilemap,offset/2);
|
||||
tilemap_mark_tile_dirty(state->fix_tilemap, offset / 2);
|
||||
}
|
||||
|
||||
VIDEO_START( alpha68k )
|
||||
{
|
||||
fix_tilemap = tilemap_create(machine, get_tile_info,tilemap_scan_cols,8,8,32,32);
|
||||
alpha68k_state *state = (alpha68k_state *)machine->driver_data;
|
||||
|
||||
tilemap_set_transparent_pen(fix_tilemap,0);
|
||||
|
||||
state_save_register_global(machine, bank_base);
|
||||
|
||||
VIDEO_START_CALL(alpha68k_common_vh);
|
||||
state->fix_tilemap = tilemap_create(machine, get_tile_info, tilemap_scan_cols, 8, 8, 32, 32);
|
||||
tilemap_set_transparent_pen(state->fix_tilemap, 0);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
//AT
|
||||
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int j, int s, int e)
|
||||
static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int j, int s, int e )
|
||||
{
|
||||
UINT16 *spriteram16 = machine->generic.spriteram.u16;
|
||||
int offs,mx,my,color,tile,fx,fy,i;
|
||||
alpha68k_state *state = (alpha68k_state *)machine->driver_data;
|
||||
UINT16 *spriteram = state->spriteram;
|
||||
int offs, mx, my, color, tile, fx, fy, i;
|
||||
|
||||
for (offs = s; offs < e; offs += 0x40 )
|
||||
for (offs = s; offs < e; offs += 0x40)
|
||||
{
|
||||
my = spriteram16[offs+3+(j<<1)];
|
||||
mx = spriteram16[offs+2+(j<<1)]<<1 | my>>15;
|
||||
my = spriteram[offs + 3 + (j << 1)];
|
||||
mx = spriteram[offs + 2 + (j << 1)] << 1 | my >> 15;
|
||||
my = -my & 0x1ff;
|
||||
mx = ((mx + 0x100) & 0x1ff) - 0x100;
|
||||
if (j==0 && s==0x7c0) my++;
|
||||
if (j == 0 && s == 0x7c0)
|
||||
my++;
|
||||
//ZT
|
||||
if (flipscreen) {
|
||||
mx=240-mx;
|
||||
my=240-my;
|
||||
if (state->flipscreen)
|
||||
{
|
||||
mx = 240 - mx;
|
||||
my = 240 - my;
|
||||
}
|
||||
|
||||
for (i=0; i<0x40; i+=2) {
|
||||
tile = spriteram16[offs+1+i+(0x800*j)+0x800];
|
||||
color = spriteram16[offs +i+(0x800*j)+0x800]&0x7f;
|
||||
for (i = 0; i < 0x40; i += 2)
|
||||
{
|
||||
tile = spriteram[offs + 1 + i + (0x800 * j) + 0x800];
|
||||
color = spriteram[offs + i + (0x800 * j) + 0x800] & 0x7f;
|
||||
|
||||
fy=tile&0x8000;
|
||||
fx=tile&0x4000;
|
||||
tile&=0x3fff;
|
||||
fy = tile & 0x8000;
|
||||
fx = tile & 0x4000;
|
||||
tile &= 0x3fff;
|
||||
|
||||
if (flipscreen) {
|
||||
if (fx) fx=0; else fx=1;
|
||||
if (fy) fy=0; else fy=1;
|
||||
if (state->flipscreen)
|
||||
{
|
||||
if (fx) fx = 0; else fx = 1;
|
||||
if (fy) fy = 0; else fy = 1;
|
||||
}
|
||||
|
||||
if (color)
|
||||
@ -123,10 +118,10 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
fx,fy,
|
||||
mx,my,0);
|
||||
|
||||
if (flipscreen)
|
||||
my=(my-16)&0x1ff;
|
||||
if (state->flipscreen)
|
||||
my = (my - 16) & 0x1ff;
|
||||
else
|
||||
my=(my+16)&0x1ff;
|
||||
my = (my + 16) & 0x1ff;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -135,21 +130,22 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
|
||||
VIDEO_UPDATE( alpha68k_II )
|
||||
{
|
||||
static int last_bank=0;
|
||||
alpha68k_state *state = (alpha68k_state *)screen->machine->driver_data;
|
||||
|
||||
if (last_bank!=bank_base)
|
||||
if (state->last_bank != state->bank_base)
|
||||
tilemap_mark_all_tiles_dirty_all(screen->machine);
|
||||
last_bank=bank_base;
|
||||
tilemap_set_flip_all(screen->machine,flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
|
||||
|
||||
bitmap_fill(bitmap,cliprect,2047);
|
||||
state->last_bank = state->bank_base;
|
||||
tilemap_set_flip_all(screen->machine, state->flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
|
||||
|
||||
bitmap_fill(bitmap, cliprect, 2047);
|
||||
//AT
|
||||
draw_sprites(screen->machine, bitmap,cliprect,0,0x07c0,0x0800);
|
||||
draw_sprites(screen->machine, bitmap,cliprect,1,0x0000,0x0800);
|
||||
draw_sprites(screen->machine, bitmap,cliprect,2,0x0000,0x0800);
|
||||
draw_sprites(screen->machine, bitmap,cliprect,0,0x0000,0x07c0);
|
||||
draw_sprites(screen->machine, bitmap, cliprect, 0, 0x07c0, 0x0800);
|
||||
draw_sprites(screen->machine, bitmap, cliprect, 1, 0x0000, 0x0800);
|
||||
draw_sprites(screen->machine, bitmap, cliprect, 2, 0x0000, 0x0800);
|
||||
draw_sprites(screen->machine, bitmap, cliprect, 0, 0x0000, 0x07c0);
|
||||
//ZT
|
||||
tilemap_draw(bitmap,cliprect,fix_tilemap,0,0);
|
||||
tilemap_draw(bitmap, cliprect, state->fix_tilemap, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -175,31 +171,31 @@ VIDEO_UPDATE( alpha68k_II )
|
||||
|
||||
WRITE16_HANDLER( alpha68k_II_video_bank_w )
|
||||
{
|
||||
static int buffer_28,buffer_60,buffer_68;
|
||||
|
||||
switch (offset) {
|
||||
alpha68k_state *state = (alpha68k_state *)space->machine->driver_data;
|
||||
switch (offset)
|
||||
{
|
||||
case 0x10: /* Reset */
|
||||
bank_base=buffer_28=buffer_60=buffer_68=0;
|
||||
state->bank_base = state->buffer_28 = state->buffer_60 = state->buffer_68 = 0;
|
||||
return;
|
||||
case 0x14:
|
||||
if (buffer_60) bank_base=1; else bank_base=0;
|
||||
buffer_28=1;
|
||||
if (state->buffer_60) state->bank_base=1; else state->bank_base=0;
|
||||
state->buffer_28 = 1;
|
||||
return;
|
||||
case 0x18:
|
||||
if (buffer_68) {if (buffer_60) bank_base=3; else bank_base=2; }
|
||||
if (buffer_28) {if (buffer_60) bank_base=1; else bank_base=0; }
|
||||
if (state->buffer_68) {if (state->buffer_60) state->bank_base = 3; else state->bank_base = 2; }
|
||||
if (state->buffer_28) {if (state->buffer_60) state->bank_base = 1; else state->bank_base = 0; }
|
||||
return;
|
||||
case 0x30:
|
||||
buffer_28=buffer_68=0; bank_base=1;
|
||||
buffer_60=1;
|
||||
state->buffer_28 = state->buffer_68 = 0; state->bank_base = 1;
|
||||
state->buffer_60 = 1;
|
||||
return;
|
||||
case 0x34:
|
||||
if (buffer_60) bank_base=3; else bank_base=2;
|
||||
buffer_68=1;
|
||||
if (state->buffer_60) state->bank_base = 3; else state->bank_base = 2;
|
||||
state->buffer_68 = 1;
|
||||
return;
|
||||
case 0x38:
|
||||
if (buffer_68) {if (buffer_60) bank_base=7; else bank_base=6; }
|
||||
if (buffer_28) {if (buffer_60) bank_base=5; else bank_base=4; }
|
||||
if (state->buffer_68) {if (state->buffer_60) state->bank_base = 7; else state->bank_base = 6; }
|
||||
if (state->buffer_28) {if (state->buffer_60) state->bank_base = 5; else state->bank_base = 4; }
|
||||
return;
|
||||
case 0x08: /* Graphics flags? Not related to fix chars anyway */
|
||||
case 0x0c:
|
||||
@ -215,7 +211,8 @@ WRITE16_HANDLER( alpha68k_II_video_bank_w )
|
||||
|
||||
WRITE16_HANDLER( alpha68k_V_video_control_w )
|
||||
{
|
||||
switch (offset) {
|
||||
switch (offset)
|
||||
{
|
||||
case 0x08: /* Graphics flags? Not related to fix chars anyway */
|
||||
case 0x0c:
|
||||
case 0x28:
|
||||
@ -224,37 +221,43 @@ WRITE16_HANDLER( alpha68k_V_video_control_w )
|
||||
}
|
||||
}
|
||||
|
||||
static void draw_sprites_V(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int j, int s, int e, int fx_mask, int fy_mask, int sprite_mask)
|
||||
static void draw_sprites_V( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int j, int s, int e, int fx_mask, int fy_mask, int sprite_mask )
|
||||
{
|
||||
UINT16 *spriteram16 = machine->generic.spriteram.u16;
|
||||
int offs,mx,my,color,tile,fx,fy,i;
|
||||
alpha68k_state *state = (alpha68k_state *)machine->driver_data;
|
||||
UINT16 *spriteram = state->spriteram;
|
||||
int offs, mx, my, color, tile, fx, fy, i;
|
||||
|
||||
for (offs = s; offs < e; offs += 0x40 )
|
||||
for (offs = s; offs < e; offs += 0x40)
|
||||
{
|
||||
//AT
|
||||
my = spriteram16[offs+3+(j<<1)];
|
||||
mx = spriteram16[offs+2+(j<<1)]<<1 | my>>15;
|
||||
my = spriteram[offs + 3 + (j << 1)];
|
||||
mx = spriteram[offs + 2 + (j << 1)] << 1 | my >> 15;
|
||||
my = -my & 0x1ff;
|
||||
mx = ((mx + 0x100) & 0x1ff) - 0x100;
|
||||
if (j==0 && s==0x7c0) my++;
|
||||
if (j == 0 && s == 0x7c0)
|
||||
my++;
|
||||
//ZT
|
||||
if (flipscreen) {
|
||||
mx=240-mx;
|
||||
my=240-my;
|
||||
if (state->flipscreen)
|
||||
{
|
||||
mx = 240 - mx;
|
||||
my = 240 - my;
|
||||
}
|
||||
|
||||
for (i=0; i<0x40; i+=2) {
|
||||
tile = spriteram16[offs+1+i+(0x800*j)+0x800];
|
||||
color = spriteram16[offs +i+(0x800*j)+0x800]&0xff;
|
||||
for (i = 0; i < 0x40; i += 2)
|
||||
{
|
||||
tile = spriteram[offs + 1 + i + (0x800 * j) + 0x800];
|
||||
color = spriteram[offs + i + (0x800 * j) + 0x800] & 0xff;
|
||||
|
||||
fx=tile&fx_mask;
|
||||
fy=tile&fy_mask;
|
||||
tile=tile&sprite_mask;
|
||||
if (tile>0x4fff) continue;
|
||||
fx = tile & fx_mask;
|
||||
fy = tile & fy_mask;
|
||||
tile = tile & sprite_mask;
|
||||
if (tile > 0x4fff)
|
||||
continue;
|
||||
|
||||
if (flipscreen) {
|
||||
if (fx) fx=0; else fx=1;
|
||||
if (fy) fy=0; else fy=1;
|
||||
if (state->flipscreen)
|
||||
{
|
||||
if (fx) fx = 0; else fx = 1;
|
||||
if (fy) fy = 0; else fy = 1;
|
||||
}
|
||||
|
||||
if (color)
|
||||
@ -264,93 +267,99 @@ static void draw_sprites_V(running_machine *machine, bitmap_t *bitmap, const rec
|
||||
fx,fy,
|
||||
mx,my,0);
|
||||
|
||||
if (flipscreen)
|
||||
my=(my-16)&0x1ff;
|
||||
if (state->flipscreen)
|
||||
my = (my - 16) & 0x1ff;
|
||||
else
|
||||
my=(my+16)&0x1ff;
|
||||
my = (my + 16) & 0x1ff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VIDEO_UPDATE( alpha68k_V )
|
||||
{
|
||||
UINT16 *spriteram16 = screen->machine->generic.spriteram.u16;
|
||||
static int last_bank=0;
|
||||
alpha68k_state *state = (alpha68k_state *)screen->machine->driver_data;
|
||||
UINT16 *spriteram = state->spriteram;
|
||||
|
||||
if (last_bank!=bank_base)
|
||||
if (state->last_bank != state->bank_base)
|
||||
tilemap_mark_all_tiles_dirty_all(screen->machine);
|
||||
last_bank=bank_base;
|
||||
tilemap_set_flip_all(screen->machine,flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
|
||||
|
||||
bitmap_fill(bitmap,cliprect,4095);
|
||||
state->last_bank = state->bank_base;
|
||||
tilemap_set_flip_all(screen->machine, state->flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
|
||||
|
||||
bitmap_fill(bitmap, cliprect, 4095);
|
||||
|
||||
/* This appears to be correct priority */
|
||||
if (alpha68k_microcontroller_id == 0x8814) /* Sky Adventure */
|
||||
if (state->microcontroller_id == 0x8814) /* Sky Adventure */
|
||||
{
|
||||
draw_sprites_V(screen->machine, bitmap,cliprect,0,0x07c0,0x0800,0,0x8000,0x7fff);
|
||||
draw_sprites_V(screen->machine, bitmap,cliprect,1,0x0000,0x0800,0,0x8000,0x7fff);
|
||||
draw_sprites_V(screen->machine, bitmap, cliprect, 0, 0x07c0, 0x0800, 0, 0x8000, 0x7fff);
|
||||
draw_sprites_V(screen->machine, bitmap, cliprect, 1, 0x0000, 0x0800, 0, 0x8000, 0x7fff);
|
||||
//AT: *KLUDGE* fixes priest priority in level 1(could be a game bug)
|
||||
if (spriteram16[0x1bde]==0x24 && (spriteram16[0x1bdf]>>8)==0x3b) {
|
||||
draw_sprites_V(screen->machine, bitmap,cliprect,2,0x03c0,0x0800,0,0x8000,0x7fff);
|
||||
draw_sprites_V(screen->machine, bitmap,cliprect,2,0x0000,0x03c0,0,0x8000,0x7fff);
|
||||
} else
|
||||
draw_sprites_V(screen->machine, bitmap,cliprect,2,0x0000,0x0800,0,0x8000,0x7fff);
|
||||
draw_sprites_V(screen->machine, bitmap,cliprect,0,0x0000,0x07c0,0,0x8000,0x7fff);
|
||||
if (spriteram[0x1bde] == 0x24 && (spriteram[0x1bdf] >> 8) == 0x3b)
|
||||
{
|
||||
draw_sprites_V(screen->machine, bitmap, cliprect, 2, 0x03c0, 0x0800, 0, 0x8000, 0x7fff);
|
||||
draw_sprites_V(screen->machine, bitmap, cliprect, 2, 0x0000, 0x03c0, 0, 0x8000, 0x7fff);
|
||||
}
|
||||
else
|
||||
draw_sprites_V(screen->machine, bitmap, cliprect, 2, 0x0000, 0x0800, 0, 0x8000, 0x7fff);
|
||||
|
||||
draw_sprites_V(screen->machine, bitmap, cliprect, 0, 0x0000, 0x07c0, 0, 0x8000, 0x7fff);
|
||||
}
|
||||
else /* gangwars */
|
||||
{
|
||||
draw_sprites_V(screen->machine, bitmap,cliprect,0,0x07c0,0x0800,0x8000,0,0x7fff);
|
||||
draw_sprites_V(screen->machine, bitmap,cliprect,1,0x0000,0x0800,0x8000,0,0x7fff);
|
||||
draw_sprites_V(screen->machine, bitmap,cliprect,2,0x0000,0x0800,0x8000,0,0x7fff);
|
||||
draw_sprites_V(screen->machine, bitmap,cliprect,0,0x0000,0x07c0,0x8000,0,0x7fff);
|
||||
draw_sprites_V(screen->machine, bitmap, cliprect, 0, 0x07c0, 0x0800, 0x8000, 0, 0x7fff);
|
||||
draw_sprites_V(screen->machine, bitmap, cliprect, 1, 0x0000, 0x0800, 0x8000, 0, 0x7fff);
|
||||
draw_sprites_V(screen->machine, bitmap, cliprect, 2, 0x0000, 0x0800, 0x8000, 0, 0x7fff);
|
||||
draw_sprites_V(screen->machine, bitmap, cliprect, 0, 0x0000, 0x07c0, 0x8000, 0, 0x7fff);
|
||||
}
|
||||
|
||||
tilemap_draw(bitmap,cliprect,fix_tilemap,0,0);
|
||||
tilemap_draw(bitmap, cliprect, state->fix_tilemap, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
VIDEO_UPDATE( alpha68k_V_sb )
|
||||
{
|
||||
static int last_bank=0;
|
||||
alpha68k_state *state = (alpha68k_state *)screen->machine->driver_data;
|
||||
|
||||
if (last_bank!=bank_base)
|
||||
if (state->last_bank != state->bank_base)
|
||||
tilemap_mark_all_tiles_dirty_all(screen->machine);
|
||||
last_bank=bank_base;
|
||||
tilemap_set_flip_all(screen->machine,flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
|
||||
|
||||
bitmap_fill(bitmap,cliprect,4095);
|
||||
state->last_bank = state->bank_base;
|
||||
tilemap_set_flip_all(screen->machine, state->flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
|
||||
|
||||
bitmap_fill(bitmap, cliprect, 4095);
|
||||
|
||||
/* This appears to be correct priority */
|
||||
draw_sprites_V(screen->machine,bitmap,cliprect,0,0x07c0,0x0800,0x4000,0x8000,0x3fff);
|
||||
draw_sprites_V(screen->machine,bitmap,cliprect,1,0x0000,0x0800,0x4000,0x8000,0x3fff);
|
||||
draw_sprites_V(screen->machine,bitmap,cliprect,2,0x0000,0x0800,0x4000,0x8000,0x3fff);
|
||||
draw_sprites_V(screen->machine,bitmap,cliprect,0,0x0000,0x07c0,0x4000,0x8000,0x3fff);
|
||||
draw_sprites_V(screen->machine, bitmap, cliprect, 0, 0x07c0, 0x0800, 0x4000, 0x8000, 0x3fff);
|
||||
draw_sprites_V(screen->machine, bitmap, cliprect, 1, 0x0000, 0x0800, 0x4000, 0x8000, 0x3fff);
|
||||
draw_sprites_V(screen->machine, bitmap, cliprect, 2, 0x0000, 0x0800, 0x4000, 0x8000, 0x3fff);
|
||||
draw_sprites_V(screen->machine, bitmap, cliprect, 0, 0x0000, 0x07c0, 0x4000, 0x8000, 0x3fff);
|
||||
|
||||
tilemap_draw(bitmap,cliprect,fix_tilemap,0,0);
|
||||
tilemap_draw(bitmap, cliprect, state->fix_tilemap, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
//AT
|
||||
static void draw_sprites_I(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int c, int d, int yshift)
|
||||
static void draw_sprites_I( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int c, int d, int yshift )
|
||||
{
|
||||
UINT16 *spriteram16 = machine->generic.spriteram.u16;
|
||||
alpha68k_state *state = (alpha68k_state *)machine->driver_data;
|
||||
UINT16 *spriteram = state->spriteram;
|
||||
int data, offs, mx, my, tile, color, fy, i;
|
||||
UINT8 *color_prom = memory_region(machine, "user1");
|
||||
gfx_element *gfx = machine->gfx[0];
|
||||
|
||||
for (offs=0; offs<0x400; offs+=0x20)
|
||||
for (offs = 0; offs < 0x400; offs += 0x20)
|
||||
{
|
||||
mx = spriteram16[offs+c];
|
||||
my = (yshift-(mx>>8)) & 0xff;
|
||||
mx = spriteram[offs + c];
|
||||
my = (yshift - (mx >> 8)) & 0xff;
|
||||
mx &= 0xff;
|
||||
|
||||
for (i=0; i<0x20; i++)
|
||||
for (i = 0; i < 0x20; i++)
|
||||
{
|
||||
data = spriteram16[offs+d+i];
|
||||
data = spriteram[offs + d + i];
|
||||
tile = data & 0x3fff;
|
||||
fy = data & 0x4000;
|
||||
color = color_prom[tile<<1|data>>15];
|
||||
color = color_prom[tile << 1 | data >> 15];
|
||||
|
||||
drawgfx_transpen(bitmap, cliprect, gfx, tile, color, 0, fy, mx, my, 0);
|
||||
|
||||
@ -361,14 +370,15 @@ static void draw_sprites_I(running_machine *machine, bitmap_t *bitmap, const rec
|
||||
|
||||
VIDEO_UPDATE( alpha68k_I )
|
||||
{
|
||||
int yshift = (alpha68k_microcontroller_id == 0x890a) ? 1 : 0; // The Next Space is 1 pixel off
|
||||
alpha68k_state *state = (alpha68k_state *)screen->machine->driver_data;
|
||||
int yshift = (state->microcontroller_id == 0x890a) ? 1 : 0; // The Next Space is 1 pixel off
|
||||
|
||||
bitmap_fill(bitmap,cliprect,get_black_pen(screen->machine));
|
||||
bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine));
|
||||
|
||||
/* This appears to be correct priority */
|
||||
draw_sprites_I(screen->machine, bitmap,cliprect,2,0x0800,yshift);
|
||||
draw_sprites_I(screen->machine, bitmap,cliprect,3,0x0c00,yshift);
|
||||
draw_sprites_I(screen->machine, bitmap,cliprect,1,0x0400,yshift);
|
||||
draw_sprites_I(screen->machine, bitmap, cliprect, 2, 0x0800, yshift);
|
||||
draw_sprites_I(screen->machine, bitmap, cliprect, 3, 0x0c00, yshift);
|
||||
draw_sprites_I(screen->machine, bitmap, cliprect, 1, 0x0400, yshift);
|
||||
return 0;
|
||||
}
|
||||
//ZT
|
||||
@ -428,130 +438,137 @@ PALETTE_INIT( paddlem )
|
||||
}
|
||||
}
|
||||
|
||||
void kyros_video_banking(int *bank, int data)
|
||||
static void kyros_video_banking(int *bank, int data)
|
||||
{
|
||||
*bank = (data>>13 & 4) | (data>>10 & 3);
|
||||
*bank = (data >> 13 & 4) | (data >> 10 & 3);
|
||||
}
|
||||
|
||||
void jongbou_video_banking(int *bank, int data)
|
||||
static void jongbou_video_banking(int *bank, int data)
|
||||
{
|
||||
*bank = (data>>11 & 4) | (data>>10 & 3);
|
||||
*bank = (data >> 11 & 4) | (data >> 10 & 3);
|
||||
}
|
||||
|
||||
static void kyros_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int c,int d)
|
||||
static void kyros_draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int c, int d )
|
||||
{
|
||||
UINT16 *spriteram16 = machine->generic.spriteram.u16;
|
||||
int offs,mx,my,color,tile,i,bank,fy,fx;
|
||||
alpha68k_state *state = (alpha68k_state *)machine->driver_data;
|
||||
UINT16 *spriteram = state->spriteram;
|
||||
int offs, mx, my, color, tile, i, bank, fy, fx;
|
||||
int data;
|
||||
UINT8 *color_prom = memory_region(machine, "user1");
|
||||
|
||||
//AT
|
||||
for (offs=0; offs<0x400; offs+=0x20)
|
||||
for (offs = 0; offs < 0x400; offs += 0x20)
|
||||
{
|
||||
mx = spriteram16[offs+c];
|
||||
my = -(mx>>8) & 0xff;
|
||||
mx = spriteram[offs + c];
|
||||
my = -(mx >> 8) & 0xff;
|
||||
mx &= 0xff;
|
||||
|
||||
if (flipscreen) {
|
||||
my=249-my;
|
||||
}
|
||||
if (state->flipscreen)
|
||||
my = 249 - my;
|
||||
|
||||
for (i=0; i<0x20; i++)
|
||||
for (i = 0; i < 0x20; i++)
|
||||
{
|
||||
data = spriteram16[offs+d+i];
|
||||
data = spriteram[offs + d + i];
|
||||
if (data!=0x20)
|
||||
{
|
||||
color = color_prom[(data>>1&0x1000)|(data&0xffc)|(data>>14&3)];
|
||||
if (color!=0xff)
|
||||
color = color_prom[(data >> 1 & 0x1000) | (data & 0xffc) | (data >> 14 & 3)];
|
||||
if (color != 0xff)
|
||||
{
|
||||
fy = data & 0x1000;
|
||||
fx = 0;
|
||||
|
||||
if(flipscreen)
|
||||
if(state->flipscreen)
|
||||
{
|
||||
if (fy) fy=0; else fy=1;
|
||||
if (fy) fy = 0; else fy = 1;
|
||||
fx = 1;
|
||||
}
|
||||
|
||||
tile = (data>>3 & 0x400) | (data & 0x3ff);
|
||||
alpha68k_video_banking(&bank, data);
|
||||
tile = (data >> 3 & 0x400) | (data & 0x3ff);
|
||||
if (state->game_id == ALPHA68K_KYROS)
|
||||
kyros_video_banking(&bank, data);
|
||||
else
|
||||
jongbou_video_banking(&bank, data);
|
||||
|
||||
drawgfx_transpen(bitmap, cliprect, machine->gfx[bank], tile, color, fx, fy, mx, my, 0);
|
||||
}
|
||||
}
|
||||
//ZT
|
||||
if(flipscreen)
|
||||
my=(my-8)&0xff;
|
||||
if (state->flipscreen)
|
||||
my = (my - 8) & 0xff;
|
||||
else
|
||||
my=(my+8)&0xff;
|
||||
my = (my + 8) & 0xff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VIDEO_UPDATE( kyros )
|
||||
{
|
||||
colortable_entry_set_value(screen->machine->colortable, 0x100, *screen->machine->generic.videoram.u16 & 0xff);
|
||||
alpha68k_state *state = (alpha68k_state *)screen->machine->driver_data;
|
||||
colortable_entry_set_value(screen->machine->colortable, 0x100, *state->videoram & 0xff);
|
||||
bitmap_fill(bitmap, cliprect, 0x100); //AT
|
||||
|
||||
kyros_draw_sprites(screen->machine, bitmap,cliprect,2,0x0800);
|
||||
kyros_draw_sprites(screen->machine, bitmap,cliprect,3,0x0c00);
|
||||
kyros_draw_sprites(screen->machine, bitmap,cliprect,1,0x0400);
|
||||
kyros_draw_sprites(screen->machine, bitmap, cliprect, 2, 0x0800);
|
||||
kyros_draw_sprites(screen->machine, bitmap, cliprect, 3, 0x0c00);
|
||||
kyros_draw_sprites(screen->machine, bitmap, cliprect, 1, 0x0400);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
static void sstingry_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int c,int d)
|
||||
static void sstingry_draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int c, int d )
|
||||
{
|
||||
//AT
|
||||
UINT16 *spriteram16 = machine->generic.spriteram.u16;
|
||||
int data,offs,mx,my,color,tile,i,bank,fy,fx;
|
||||
alpha68k_state *state = (alpha68k_state *)machine->driver_data;
|
||||
UINT16 *spriteram = state->spriteram;
|
||||
int data, offs, mx, my, color, tile, i, bank, fy, fx;
|
||||
|
||||
for (offs=0; offs<0x400; offs+=0x20)
|
||||
for (offs = 0; offs < 0x400; offs += 0x20)
|
||||
{
|
||||
mx = spriteram16[offs+c];
|
||||
my = -(mx>>8) & 0xff;
|
||||
mx = spriteram[offs + c];
|
||||
my = -(mx >> 8) & 0xff;
|
||||
mx &= 0xff;
|
||||
if (mx > 0xf8) mx -= 0x100;
|
||||
if (mx > 0xf8)
|
||||
mx -= 0x100;
|
||||
|
||||
if (flipscreen) {
|
||||
my=249-my;
|
||||
}
|
||||
if (state->flipscreen)
|
||||
my = 249 - my;
|
||||
|
||||
for (i=0; i<0x20; i++)
|
||||
for (i = 0; i < 0x20; i++)
|
||||
{
|
||||
data = spriteram16[offs+d+i];
|
||||
if (data!=0x40)
|
||||
data = spriteram[offs + d + i];
|
||||
if (data != 0x40)
|
||||
{
|
||||
fy = data & 0x1000;
|
||||
fx = 0;
|
||||
|
||||
if(flipscreen)
|
||||
if(state->flipscreen)
|
||||
{
|
||||
if (fy) fy=0; else fy=1;
|
||||
if (fy) fy = 0; else fy = 1;
|
||||
fx = 1;
|
||||
}
|
||||
|
||||
color = (data>>7 & 0x18) | (data>>13 & 7);
|
||||
color = (data >> 7 & 0x18) | (data >> 13 & 7);
|
||||
tile = data & 0x3ff;
|
||||
bank = data>>10 & 3;
|
||||
bank = data >> 10 & 3;
|
||||
drawgfx_transpen(bitmap, cliprect, machine->gfx[bank], tile, color, fx, fy, mx, my, 0);
|
||||
}
|
||||
//ZT
|
||||
if(flipscreen)
|
||||
my=(my-8)&0xff;
|
||||
if(state->flipscreen)
|
||||
my = (my - 8) & 0xff;
|
||||
else
|
||||
my=(my+8)&0xff;
|
||||
my = (my + 8) & 0xff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VIDEO_UPDATE( sstingry )
|
||||
{
|
||||
colortable_entry_set_value(screen->machine->colortable, 0x100, *screen->machine->generic.videoram.u16 & 0xff);
|
||||
alpha68k_state *state = (alpha68k_state *)screen->machine->driver_data;
|
||||
colortable_entry_set_value(screen->machine->colortable, 0x100, *state->videoram & 0xff);
|
||||
bitmap_fill(bitmap, cliprect, 0x100); //AT
|
||||
|
||||
sstingry_draw_sprites(screen->machine, bitmap,cliprect,2,0x0800);
|
||||
sstingry_draw_sprites(screen->machine, bitmap,cliprect,3,0x0c00);
|
||||
sstingry_draw_sprites(screen->machine, bitmap,cliprect,1,0x0400);
|
||||
sstingry_draw_sprites(screen->machine, bitmap, cliprect, 2, 0x0800);
|
||||
sstingry_draw_sprites(screen->machine, bitmap, cliprect, 3, 0x0c00);
|
||||
sstingry_draw_sprites(screen->machine, bitmap, cliprect, 1, 0x0400);
|
||||
return 0;
|
||||
}
|
||||
|
@ -11,25 +11,23 @@
|
||||
- 64 (32?) Sprites
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "driver.h"
|
||||
|
||||
/* Variables only used here: */
|
||||
|
||||
static tilemap *bg_tilemap;
|
||||
#include "includes/amspdwy.h"
|
||||
|
||||
|
||||
WRITE8_HANDLER( amspdwy_paletteram_w )
|
||||
{
|
||||
data ^= 0xff;
|
||||
paletteram_BBGGGRRR_w(space,offset,data);
|
||||
// paletteram_RRRGGGBB_w(offset,data);
|
||||
paletteram_BBGGGRRR_w(space, offset, data);
|
||||
// paletteram_RRRGGGBB_w(offset, data);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( amspdwy_flipscreen_w )
|
||||
{
|
||||
static int flip = 0;
|
||||
flip ^= 1;
|
||||
flip_screen_set(space->machine, flip );
|
||||
amspdwy_state *state = (amspdwy_state *)space->machine->driver_data;
|
||||
state->flipscreen ^= 1;
|
||||
flip_screen_set(space->machine, state->flipscreen);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
@ -47,8 +45,9 @@ WRITE8_HANDLER( amspdwy_flipscreen_w )
|
||||
|
||||
static TILE_GET_INFO( get_tile_info )
|
||||
{
|
||||
UINT8 code = machine->generic.videoram.u8[ tile_index ];
|
||||
UINT8 color = machine->generic.colorram.u8[ tile_index ];
|
||||
amspdwy_state *state = (amspdwy_state *)machine->driver_data;
|
||||
UINT8 code = state->videoram[tile_index];
|
||||
UINT8 color = state->colorram[tile_index];
|
||||
SET_TILE_INFO(
|
||||
0,
|
||||
code + ((color & 0x18)<<5),
|
||||
@ -58,28 +57,30 @@ static TILE_GET_INFO( get_tile_info )
|
||||
|
||||
WRITE8_HANDLER( amspdwy_videoram_w )
|
||||
{
|
||||
space->machine->generic.videoram.u8[offset] = data;
|
||||
tilemap_mark_tile_dirty(bg_tilemap, offset);
|
||||
amspdwy_state *state = (amspdwy_state *)space->machine->driver_data;
|
||||
state->videoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( amspdwy_colorram_w )
|
||||
{
|
||||
space->machine->generic.colorram.u8[offset] = data;
|
||||
tilemap_mark_tile_dirty(bg_tilemap, offset);
|
||||
amspdwy_state *state = (amspdwy_state *)space->machine->driver_data;
|
||||
state->colorram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
|
||||
}
|
||||
|
||||
|
||||
/* logical (col,row) -> memory offset */
|
||||
static TILEMAP_MAPPER( tilemap_scan_cols_back )
|
||||
{
|
||||
return col*num_rows + (num_rows - row - 1);
|
||||
return col * num_rows + (num_rows - row - 1);
|
||||
}
|
||||
|
||||
|
||||
VIDEO_START( amspdwy )
|
||||
{
|
||||
bg_tilemap = tilemap_create( machine, get_tile_info, tilemap_scan_cols_back,
|
||||
8,8, 0x20, 0x20 );
|
||||
amspdwy_state *state = (amspdwy_state *)machine->driver_data;
|
||||
state->bg_tilemap = tilemap_create(machine, get_tile_info, tilemap_scan_cols_back, 8, 8, 0x20, 0x20);
|
||||
}
|
||||
|
||||
|
||||
@ -102,26 +103,29 @@ Offset: Format: Value:
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
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;
|
||||
amspdwy_state *state = (amspdwy_state *)machine->driver_data;
|
||||
UINT8 *spriteram = state->spriteram;
|
||||
int i;
|
||||
int max_x = video_screen_get_width(machine->primary_screen) - 1;
|
||||
int max_y = video_screen_get_height(machine->primary_screen) - 1;
|
||||
|
||||
for (i = 0; i < machine->generic.spriteram_size ; i += 4)
|
||||
for (i = 0; i < state->spriteram_size ; i += 4)
|
||||
{
|
||||
int y = spriteram[i+0];
|
||||
int x = spriteram[i+1];
|
||||
int code = spriteram[i+2];
|
||||
int attr = spriteram[i+3];
|
||||
int flipx = attr & 0x80;
|
||||
int flipy = attr & 0x40;
|
||||
int y = spriteram[i + 0];
|
||||
int x = spriteram[i + 1];
|
||||
int code = spriteram[i + 2];
|
||||
int attr = spriteram[i + 3];
|
||||
int flipx = attr & 0x80;
|
||||
int flipy = attr & 0x40;
|
||||
|
||||
if (flip_screen_get(machine))
|
||||
{
|
||||
x = max_x - x - 8; y = max_y - y - 8;
|
||||
flipx = !flipx; flipy = !flipy;
|
||||
x = max_x - x - 8;
|
||||
y = max_y - y - 8;
|
||||
flipx = !flipx;
|
||||
flipy = !flipy;
|
||||
}
|
||||
|
||||
drawgfx_transpen(bitmap,cliprect,machine->gfx[0],
|
||||
@ -144,7 +148,8 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan
|
||||
|
||||
VIDEO_UPDATE( amspdwy )
|
||||
{
|
||||
tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
|
||||
draw_sprites(screen->machine, bitmap,cliprect);
|
||||
amspdwy_state *state = (amspdwy_state *)screen->machine->driver_data;
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
@ -7,15 +7,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "driver.h"
|
||||
|
||||
|
||||
UINT8 *gng_fgvideoram;
|
||||
UINT8 *gng_bgvideoram;
|
||||
|
||||
static tilemap *bg_tilemap,*fg_tilemap;
|
||||
|
||||
static UINT8 scrollx[2];
|
||||
static UINT8 scrolly[2];
|
||||
#include "includes/gng.h"
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
@ -26,20 +18,22 @@ static UINT8 scrolly[2];
|
||||
|
||||
static TILE_GET_INFO( get_fg_tile_info )
|
||||
{
|
||||
UINT8 attr = gng_fgvideoram[tile_index + 0x400];
|
||||
gng_state *state = (gng_state *)machine->driver_data;
|
||||
UINT8 attr = state->fgvideoram[tile_index + 0x400];
|
||||
SET_TILE_INFO(
|
||||
0,
|
||||
gng_fgvideoram[tile_index] + ((attr & 0xc0) << 2),
|
||||
state->fgvideoram[tile_index] + ((attr & 0xc0) << 2),
|
||||
attr & 0x0f,
|
||||
TILE_FLIPYX((attr & 0x30) >> 4));
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( get_bg_tile_info )
|
||||
{
|
||||
UINT8 attr = gng_bgvideoram[tile_index + 0x400];
|
||||
gng_state *state = (gng_state *)machine->driver_data;
|
||||
UINT8 attr = state->bgvideoram[tile_index + 0x400];
|
||||
SET_TILE_INFO(
|
||||
1,
|
||||
gng_bgvideoram[tile_index] + ((attr & 0xc0) << 2),
|
||||
state->bgvideoram[tile_index] + ((attr & 0xc0) << 2),
|
||||
attr & 0x07,
|
||||
TILE_FLIPYX((attr & 0x30) >> 4));
|
||||
tileinfo->group = (attr & 0x08) >> 3;
|
||||
@ -55,17 +49,13 @@ static TILE_GET_INFO( get_bg_tile_info )
|
||||
|
||||
VIDEO_START( gng )
|
||||
{
|
||||
fg_tilemap = tilemap_create(machine, get_fg_tile_info,tilemap_scan_rows,8,8,32,32);
|
||||
bg_tilemap = tilemap_create(machine, get_bg_tile_info,tilemap_scan_cols, 16,16,32,32);
|
||||
gng_state *state = (gng_state *)machine->driver_data;
|
||||
state->fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_cols, 16, 16, 32, 32);
|
||||
|
||||
tilemap_set_transparent_pen(fg_tilemap,3);
|
||||
|
||||
tilemap_set_transmask(bg_tilemap,0,0xff,0x00); /* split type 0 is totally transparent in front half */
|
||||
tilemap_set_transmask(bg_tilemap,1,0x41,0xbe); /* split type 1 has pens 0 and 6 transparent in front half */
|
||||
|
||||
/* register to save state */
|
||||
state_save_register_global_array(machine, scrollx);
|
||||
state_save_register_global_array(machine, scrolly);
|
||||
tilemap_set_transparent_pen(state->fg_tilemap, 3);
|
||||
tilemap_set_transmask(state->bg_tilemap, 0, 0xff, 0x00); /* split type 0 is totally transparent in front half */
|
||||
tilemap_set_transmask(state->bg_tilemap, 1, 0x41, 0xbe); /* split type 1 has pens 0 and 6 transparent in front half */
|
||||
}
|
||||
|
||||
|
||||
@ -77,27 +67,31 @@ VIDEO_START( gng )
|
||||
|
||||
WRITE8_HANDLER( gng_fgvideoram_w )
|
||||
{
|
||||
gng_fgvideoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(fg_tilemap,offset & 0x3ff);
|
||||
gng_state *state = (gng_state *)space->machine->driver_data;
|
||||
state->fgvideoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->fg_tilemap, offset & 0x3ff);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( gng_bgvideoram_w )
|
||||
{
|
||||
gng_bgvideoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(bg_tilemap,offset & 0x3ff);
|
||||
gng_state *state = (gng_state *)space->machine->driver_data;
|
||||
state->bgvideoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset & 0x3ff);
|
||||
}
|
||||
|
||||
|
||||
WRITE8_HANDLER( gng_bgscrollx_w )
|
||||
{
|
||||
scrollx[offset] = data;
|
||||
tilemap_set_scrollx( bg_tilemap, 0, scrollx[0] + 256 * scrollx[1] );
|
||||
gng_state *state = (gng_state *)space->machine->driver_data;
|
||||
state->scrollx[offset] = data;
|
||||
tilemap_set_scrollx(state->bg_tilemap, 0, state->scrollx[0] + 256 * state->scrollx[1]);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( gng_bgscrolly_w )
|
||||
{
|
||||
scrolly[offset] = data;
|
||||
tilemap_set_scrolly( bg_tilemap, 0, scrolly[0] + 256 * scrolly[1] );
|
||||
gng_state *state = (gng_state *)space->machine->driver_data;
|
||||
state->scrolly[offset] = data;
|
||||
tilemap_set_scrolly(state->bg_tilemap, 0, state->scrolly[0] + 256 * state->scrolly[1]);
|
||||
}
|
||||
|
||||
|
||||
@ -114,16 +108,16 @@ WRITE8_HANDLER( gng_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 *buffered_spriteram = machine->generic.buffered_spriteram.u8;
|
||||
const gfx_element *gfx = machine->gfx[2];
|
||||
int offs;
|
||||
|
||||
|
||||
for (offs = machine->generic.spriteram_size - 4;offs >= 0;offs -= 4)
|
||||
for (offs = machine->generic.spriteram_size - 4; offs >= 0; offs -= 4)
|
||||
{
|
||||
UINT8 attributes = buffered_spriteram[offs+1];
|
||||
UINT8 attributes = buffered_spriteram[offs + 1];
|
||||
int sx = buffered_spriteram[offs + 3] - 0x100 * (attributes & 0x01);
|
||||
int sy = buffered_spriteram[offs + 2];
|
||||
int flipx = attributes & 0x04;
|
||||
@ -138,7 +132,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
}
|
||||
|
||||
drawgfx_transpen(bitmap,cliprect,gfx,
|
||||
buffered_spriteram[offs] + ((attributes<<2) & 0x300),
|
||||
buffered_spriteram[offs] + ((attributes << 2) & 0x300),
|
||||
(attributes >> 4) & 3,
|
||||
flipx,flipy,
|
||||
sx,sy,15);
|
||||
@ -147,10 +141,12 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
|
||||
VIDEO_UPDATE( gng )
|
||||
{
|
||||
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER1,0);
|
||||
draw_sprites(screen->machine,bitmap,cliprect);
|
||||
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER0,0);
|
||||
tilemap_draw(bitmap,cliprect,fg_tilemap,0,0);
|
||||
gng_state *state = (gng_state *)screen->machine->driver_data;
|
||||
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER1, 0);
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER0, 0);
|
||||
tilemap_draw(bitmap, cliprect, state->fg_tilemap, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -158,5 +154,5 @@ VIDEO_EOF( gng )
|
||||
{
|
||||
const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
|
||||
|
||||
buffer_spriteram_w(space,0,0);
|
||||
buffer_spriteram_w(space, 0, 0);
|
||||
}
|
||||
|
@ -1,12 +1,5 @@
|
||||
#include "driver.h"
|
||||
|
||||
UINT8 *gunsmoke_scrollx;
|
||||
UINT8 *gunsmoke_scrolly;
|
||||
|
||||
static UINT8 chon, objon, bgon;
|
||||
static UINT8 sprite3bank;
|
||||
|
||||
static tilemap *bg_tilemap, *fg_tilemap;
|
||||
#include "includes/gunsmoke.h"
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
@ -22,6 +15,7 @@ static tilemap *bg_tilemap, *fg_tilemap;
|
||||
bit 0 -- 2.2kohm resistor -- RED/GREEN/BLUE
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
PALETTE_INIT( gunsmoke )
|
||||
{
|
||||
int i;
|
||||
@ -66,18 +60,22 @@ PALETTE_INIT( gunsmoke )
|
||||
|
||||
WRITE8_HANDLER( gunsmoke_videoram_w )
|
||||
{
|
||||
space->machine->generic.videoram.u8[offset] = data;
|
||||
tilemap_mark_tile_dirty(fg_tilemap, offset);
|
||||
gunsmoke_state *state = (gunsmoke_state *)space->machine->driver_data;
|
||||
state->videoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->fg_tilemap, offset);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( gunsmoke_colorram_w )
|
||||
{
|
||||
space->machine->generic.colorram.u8[offset] = data;
|
||||
tilemap_mark_tile_dirty(fg_tilemap, offset);
|
||||
gunsmoke_state *state = (gunsmoke_state *)space->machine->driver_data;
|
||||
state->colorram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->fg_tilemap, offset);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( gunsmoke_c804_w )
|
||||
{
|
||||
gunsmoke_state *state = (gunsmoke_state *)space->machine->driver_data;
|
||||
|
||||
/* bits 0 and 1 are for coin counters */
|
||||
coin_counter_w(space->machine, 1, data & 0x01);
|
||||
coin_counter_w(space->machine, 0, data & 0x02);
|
||||
@ -91,19 +89,21 @@ WRITE8_HANDLER( gunsmoke_c804_w )
|
||||
flip_screen_set(space->machine, data & 0x40);
|
||||
|
||||
/* bit 7 enables characters? */
|
||||
chon = data & 0x80;
|
||||
state->chon = data & 0x80;
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( gunsmoke_d806_w )
|
||||
{
|
||||
gunsmoke_state *state = (gunsmoke_state *)space->machine->driver_data;
|
||||
|
||||
/* bits 0-2 select the sprite 3 bank */
|
||||
sprite3bank = data & 0x07;
|
||||
state->sprite3bank = data & 0x07;
|
||||
|
||||
/* bit 4 enables bg 1? */
|
||||
bgon = data & 0x10;
|
||||
state->bgon = data & 0x10;
|
||||
|
||||
/* bit 5 enables sprites? */
|
||||
objon = data & 0x20;
|
||||
state->objon = data & 0x20;
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( get_bg_tile_info )
|
||||
@ -121,8 +121,9 @@ static TILE_GET_INFO( get_bg_tile_info )
|
||||
|
||||
static TILE_GET_INFO( get_fg_tile_info )
|
||||
{
|
||||
int attr = machine->generic.colorram.u8[tile_index];
|
||||
int code = machine->generic.videoram.u8[tile_index] + ((attr & 0xe0) << 2);
|
||||
gunsmoke_state *state = (gunsmoke_state *)machine->driver_data;
|
||||
int attr = state->colorram[tile_index];
|
||||
int code = state->videoram[tile_index] + ((attr & 0xe0) << 2);
|
||||
int color = attr & 0x1f;
|
||||
|
||||
tileinfo->group = color;
|
||||
@ -132,29 +133,20 @@ static TILE_GET_INFO( get_fg_tile_info )
|
||||
|
||||
VIDEO_START( gunsmoke )
|
||||
{
|
||||
/* configure ROM banking */
|
||||
UINT8 *rombase = memory_region(machine, "maincpu");
|
||||
memory_configure_bank(machine, 1, 0, 4, &rombase[0x10000], 0x4000);
|
||||
gunsmoke_state *state = (gunsmoke_state *)machine->driver_data;
|
||||
state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_cols, 32, 32, 2048, 8);
|
||||
state->fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
|
||||
/* create tilemaps */
|
||||
bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_cols, 32, 32, 2048, 8);
|
||||
fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
|
||||
colortable_configure_tilemap_groups(machine->colortable, fg_tilemap, machine->gfx[0], 0x4f);
|
||||
|
||||
/* register for saving */
|
||||
state_save_register_global(machine, chon);
|
||||
state_save_register_global(machine, objon);
|
||||
state_save_register_global(machine, bgon);
|
||||
state_save_register_global(machine, sprite3bank);
|
||||
colortable_configure_tilemap_groups(machine->colortable, state->fg_tilemap, machine->gfx[0], 0x4f);
|
||||
}
|
||||
|
||||
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;
|
||||
gunsmoke_state *state = (gunsmoke_state *)machine->driver_data;
|
||||
UINT8 *spriteram = state->spriteram;
|
||||
int offs;
|
||||
|
||||
for (offs = machine->generic.spriteram_size - 32; offs >= 0; offs -= 32)
|
||||
for (offs = state->spriteram_size - 32; offs >= 0; offs -= 32)
|
||||
{
|
||||
int attr = spriteram[offs + 1];
|
||||
int bank = (attr & 0xc0) >> 6;
|
||||
@ -165,7 +157,9 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
int sx = spriteram[offs + 3] - ((attr & 0x20) << 3);
|
||||
int sy = spriteram[offs + 2];
|
||||
|
||||
if (bank == 3) bank += sprite3bank;
|
||||
if (bank == 3)
|
||||
bank += state->sprite3bank;
|
||||
|
||||
code += 256 * bank;
|
||||
|
||||
if (flip_screen_get(machine))
|
||||
@ -176,22 +170,26 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
flipy = !flipy;
|
||||
}
|
||||
|
||||
drawgfx_transpen(bitmap, cliprect, machine->gfx[2], code, color, flipx, flipy,
|
||||
sx, sy, 0);
|
||||
drawgfx_transpen(bitmap, cliprect, machine->gfx[2], code, color, flipx, flipy, sx, sy, 0);
|
||||
}
|
||||
}
|
||||
|
||||
VIDEO_UPDATE( gunsmoke )
|
||||
{
|
||||
tilemap_set_scrollx(bg_tilemap, 0, gunsmoke_scrollx[0] + 256 * gunsmoke_scrollx[1]);
|
||||
tilemap_set_scrolly(bg_tilemap, 0, gunsmoke_scrolly[0]);
|
||||
gunsmoke_state *state = (gunsmoke_state *)screen->machine->driver_data;
|
||||
tilemap_set_scrollx(state->bg_tilemap, 0, state->scrollx[0] + 256 * state->scrollx[1]);
|
||||
tilemap_set_scrolly(state->bg_tilemap, 0, state->scrolly[0]);
|
||||
|
||||
if (bgon)
|
||||
tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
|
||||
if (state->bgon)
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
|
||||
else
|
||||
bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine));
|
||||
|
||||
if (objon) draw_sprites(screen->machine, bitmap, cliprect);
|
||||
if (chon) tilemap_draw(bitmap, cliprect, fg_tilemap, 0, 0);
|
||||
if (state->objon)
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
|
||||
if (state->chon)
|
||||
tilemap_draw(bitmap, cliprect, state->fg_tilemap, 0, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -7,8 +7,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "driver.h"
|
||||
|
||||
static tilemap *bg_tilemap;
|
||||
#include "includes/hanaawas.h"
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
@ -65,17 +64,19 @@ PALETTE_INIT( hanaawas )
|
||||
|
||||
WRITE8_HANDLER( hanaawas_videoram_w )
|
||||
{
|
||||
space->machine->generic.videoram.u8[offset] = data;
|
||||
tilemap_mark_tile_dirty(bg_tilemap, offset);
|
||||
hanaawas_state *state = (hanaawas_state *)space->machine->driver_data;
|
||||
state->videoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( hanaawas_colorram_w )
|
||||
{
|
||||
space->machine->generic.colorram.u8[offset] = data;
|
||||
hanaawas_state *state = (hanaawas_state *)space->machine->driver_data;
|
||||
state->colorram[offset] = data;
|
||||
|
||||
/* dirty both current and next offsets */
|
||||
tilemap_mark_tile_dirty(bg_tilemap, offset);
|
||||
tilemap_mark_tile_dirty(bg_tilemap, (offset + (flip_screen_get(space->machine) ? -1 : 1)) & 0x03ff);
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, (offset + (flip_screen_get(space->machine) ? -1 : 1)) & 0x03ff);
|
||||
}
|
||||
|
||||
WRITE8_DEVICE_HANDLER( hanaawas_portB_w )
|
||||
@ -90,23 +91,26 @@ WRITE8_DEVICE_HANDLER( hanaawas_portB_w )
|
||||
|
||||
static TILE_GET_INFO( get_bg_tile_info )
|
||||
{
|
||||
hanaawas_state *state = (hanaawas_state *)machine->driver_data;
|
||||
/* the color is determined by the current color byte, but the bank is via the previous one!!! */
|
||||
int offset = (tile_index + (flip_screen_get(machine) ? 1 : -1)) & 0x3ff;
|
||||
int attr = machine->generic.colorram.u8[offset];
|
||||
int attr = state->colorram[offset];
|
||||
int gfxbank = (attr & 0x40) >> 6;
|
||||
int code = machine->generic.videoram.u8[tile_index] + ((attr & 0x20) << 3);
|
||||
int color = machine->generic.colorram.u8[tile_index] & 0x1f;
|
||||
int code = state->videoram[tile_index] + ((attr & 0x20) << 3);
|
||||
int color = state->colorram[tile_index] & 0x1f;
|
||||
|
||||
SET_TILE_INFO(gfxbank, code, color, 0);
|
||||
}
|
||||
|
||||
VIDEO_START( hanaawas )
|
||||
{
|
||||
bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
hanaawas_state *state = (hanaawas_state *)machine->driver_data;
|
||||
state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
}
|
||||
|
||||
VIDEO_UPDATE( hanaawas )
|
||||
{
|
||||
tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
|
||||
hanaawas_state *state = (hanaawas_state *)screen->machine->driver_data;
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,17 +1,18 @@
|
||||
#include "driver.h"
|
||||
|
||||
static tilemap *bg_tilemap;
|
||||
#include "includes/higemaru.h"
|
||||
|
||||
WRITE8_HANDLER( higemaru_videoram_w )
|
||||
{
|
||||
space->machine->generic.videoram.u8[offset] = data;
|
||||
tilemap_mark_tile_dirty(bg_tilemap, offset);
|
||||
higemaru_state *state = (higemaru_state *)space->machine->driver_data;
|
||||
state->videoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( higemaru_colorram_w )
|
||||
{
|
||||
space->machine->generic.colorram.u8[offset] = data;
|
||||
tilemap_mark_tile_dirty(bg_tilemap, offset);
|
||||
higemaru_state *state = (higemaru_state *)space->machine->driver_data;
|
||||
state->colorram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
@ -19,6 +20,7 @@ WRITE8_HANDLER( higemaru_colorram_w )
|
||||
Convert the color PROMs into a more useable format.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
PALETTE_INIT( higemaru )
|
||||
{
|
||||
int i;
|
||||
@ -73,7 +75,9 @@ PALETTE_INIT( higemaru )
|
||||
|
||||
WRITE8_HANDLER( higemaru_c800_w )
|
||||
{
|
||||
if (data & 0x7c) logerror("c800 = %02x\n",data);
|
||||
higemaru_state *state = (higemaru_state *)space->machine->driver_data;
|
||||
if (data & 0x7c)
|
||||
logerror("c800 = %02x\n",data);
|
||||
|
||||
/* bits 0 and 1 are coin counters */
|
||||
coin_counter_w(space->machine, 0,data & 2);
|
||||
@ -83,29 +87,32 @@ WRITE8_HANDLER( higemaru_c800_w )
|
||||
if (flip_screen_get(space->machine) != (data & 0x80))
|
||||
{
|
||||
flip_screen_set(space->machine, data & 0x80);
|
||||
tilemap_mark_all_tiles_dirty(bg_tilemap);
|
||||
tilemap_mark_all_tiles_dirty(state->bg_tilemap);
|
||||
}
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( get_bg_tile_info )
|
||||
{
|
||||
int code = machine->generic.videoram.u8[tile_index] + ((machine->generic.colorram.u8[tile_index] & 0x80) << 1);
|
||||
int color = machine->generic.colorram.u8[tile_index] & 0x1f;
|
||||
higemaru_state *state = (higemaru_state *)machine->driver_data;
|
||||
int code = state->videoram[tile_index] + ((state->colorram[tile_index] & 0x80) << 1);
|
||||
int color = state->colorram[tile_index] & 0x1f;
|
||||
|
||||
SET_TILE_INFO(0, code, color, 0);
|
||||
}
|
||||
|
||||
VIDEO_START( higemaru )
|
||||
{
|
||||
bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
higemaru_state *state = (higemaru_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)
|
||||
static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
{
|
||||
UINT8 *spriteram = machine->generic.spriteram.u8;
|
||||
higemaru_state *state = (higemaru_state *)machine->driver_data;
|
||||
UINT8 *spriteram = state->spriteram;
|
||||
int offs;
|
||||
|
||||
for (offs = machine->generic.spriteram_size - 16;offs >= 0;offs -= 16)
|
||||
for (offs = state->spriteram_size - 16; offs >= 0; offs -= 16)
|
||||
{
|
||||
int code,col,sx,sy,flipx,flipy;
|
||||
|
||||
@ -140,7 +147,8 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
|
||||
VIDEO_UPDATE( higemaru )
|
||||
{
|
||||
tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
|
||||
higemaru_state *state = (higemaru_state *)screen->machine->driver_data;
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
@ -8,18 +8,12 @@ Video hardware
|
||||
******************************************************************************/
|
||||
|
||||
#include "driver.h"
|
||||
#include "video/generic.h"
|
||||
|
||||
UINT8 *himesiki_bg_ram;
|
||||
static tilemap *himesiki_bg_tilemap;
|
||||
|
||||
static int himesiki_scrollx[2];
|
||||
static int himesiki_flip;
|
||||
|
||||
#include "includes/himesiki.h"
|
||||
|
||||
static TILE_GET_INFO( get_bg_tile_info )
|
||||
{
|
||||
int code = himesiki_bg_ram[tile_index*2] + himesiki_bg_ram[tile_index*2+1]*0x100 ;
|
||||
himesiki_state *state = (himesiki_state *)machine->driver_data;
|
||||
int code = state->bg_ram[tile_index * 2] + state->bg_ram[tile_index * 2 + 1] * 0x100 ;
|
||||
int col = code >> 12;
|
||||
|
||||
code &= 0xfff;
|
||||
@ -29,36 +23,40 @@ static TILE_GET_INFO( get_bg_tile_info )
|
||||
|
||||
VIDEO_START( himesiki )
|
||||
{
|
||||
himesiki_bg_ram = auto_alloc_array(machine, UINT8, 0x1000);
|
||||
himesiki_bg_tilemap = tilemap_create( machine, get_bg_tile_info,tilemap_scan_rows,8,8,64,32 );
|
||||
himesiki_state *state = (himesiki_state *)machine->driver_data;
|
||||
state->bg_tilemap = tilemap_create( machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 64, 32);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( himesiki_bg_ram_w )
|
||||
{
|
||||
himesiki_bg_ram[offset] = data;
|
||||
tilemap_mark_tile_dirty( himesiki_bg_tilemap, offset / 2 );
|
||||
himesiki_state *state = (himesiki_state *)space->machine->driver_data;
|
||||
state->bg_ram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset / 2);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( himesiki_scrollx_w )
|
||||
{
|
||||
himesiki_scrollx[offset] = data;
|
||||
himesiki_state *state = (himesiki_state *)space->machine->driver_data;
|
||||
state->scrollx[offset] = data;
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( himesiki_flip_w )
|
||||
{
|
||||
himesiki_flip = data & 0xc0;
|
||||
flip_screen_set(space->machine, himesiki_flip);
|
||||
himesiki_state *state = (himesiki_state *)space->machine->driver_data;
|
||||
state->flipscreen = data & 0xc0;
|
||||
flip_screen_set(space->machine, state->flipscreen);
|
||||
|
||||
if (data & 0x3f)
|
||||
logerror("p08_w %02x\n",data);
|
||||
}
|
||||
|
||||
static void himesiki_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
|
||||
static void himesiki_draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
{
|
||||
UINT8 *spriteram = machine->generic.spriteram.u8;
|
||||
himesiki_state *state = (himesiki_state *)machine->driver_data;
|
||||
UINT8 *spriteram = state->spriteram;
|
||||
int offs;
|
||||
|
||||
for (offs = 0x100; offs<0x160; offs+=4)
|
||||
for (offs = 0x100; offs < 0x160; offs += 4)
|
||||
{
|
||||
int attr = spriteram[offs + 1];
|
||||
int code = spriteram[offs + 0] | (attr & 3) << 8;
|
||||
@ -72,24 +70,24 @@ static void himesiki_draw_sprites(running_machine *machine, bitmap_t *bitmap, co
|
||||
if (x > 0x1e0)
|
||||
x -= 0x200;
|
||||
|
||||
if (himesiki_flip)
|
||||
if (state->flipscreen)
|
||||
{
|
||||
y = (y + 33) & 0xff;
|
||||
x = 224-x;
|
||||
x = 224 - x;
|
||||
fx ^= 4;
|
||||
fy = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
y = 257-y;
|
||||
y = 257 - y;
|
||||
if (y > 0xc0)
|
||||
y -= 0x100;
|
||||
}
|
||||
|
||||
drawgfx_transpen(bitmap,cliprect,machine->gfx[1],code,col,fx,fy,x,y,15);
|
||||
drawgfx_transpen(bitmap, cliprect, machine->gfx[1], code, col, fx, fy, x, y, 15);
|
||||
}
|
||||
|
||||
for (offs = 0; offs<0x100; offs+=4)
|
||||
for (offs = 0; offs < 0x100; offs += 4)
|
||||
{
|
||||
int attr = spriteram[offs + 1];
|
||||
int code = spriteram[offs + 0] | (attr & 7) << 8;
|
||||
@ -102,29 +100,30 @@ static void himesiki_draw_sprites(running_machine *machine, bitmap_t *bitmap, co
|
||||
if (x > 0x1e0)
|
||||
x -= 0x200;
|
||||
|
||||
if (himesiki_flip)
|
||||
if (state->flipscreen)
|
||||
{
|
||||
y += 49;
|
||||
x = 240-x;
|
||||
x = 240 - x;
|
||||
f = 1;
|
||||
}
|
||||
else
|
||||
y = 257-y;
|
||||
y = 257 - y;
|
||||
|
||||
y &= 0xff;
|
||||
if (y > 0xf0)
|
||||
y -= 0x100;
|
||||
|
||||
drawgfx_transpen(bitmap,cliprect,machine->gfx[2],code,col,f,f,x,y,15);
|
||||
drawgfx_transpen(bitmap, cliprect, machine->gfx[2], code, col, f, f, x, y, 15);
|
||||
}
|
||||
}
|
||||
|
||||
VIDEO_UPDATE( himesiki )
|
||||
{
|
||||
int x = -(himesiki_scrollx[0] << 8 | himesiki_scrollx[1]) & 0x1ff;
|
||||
tilemap_set_scrolldx( himesiki_bg_tilemap, x, x);
|
||||
himesiki_state *state = (himesiki_state *)screen->machine->driver_data;
|
||||
int x = -(state->scrollx[0] << 8 | state->scrollx[1]) & 0x1ff;
|
||||
tilemap_set_scrolldx(state->bg_tilemap, x, x);
|
||||
|
||||
tilemap_draw(bitmap, cliprect, himesiki_bg_tilemap, TILEMAP_DRAW_OPAQUE, 0);
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_OPAQUE, 0);
|
||||
himesiki_draw_sprites(screen->machine, bitmap, cliprect);
|
||||
|
||||
return 0;
|
||||
|
@ -10,38 +10,50 @@ The blitter reads compressed data from ROM and copies it to the bitmap RAM.
|
||||
***************************************************************************/
|
||||
|
||||
#include "driver.h"
|
||||
#include "includes/hnayayoi.h"
|
||||
|
||||
|
||||
static UINT8 *pixmap[8];
|
||||
static int palbank;
|
||||
static int total_pixmaps;
|
||||
|
||||
|
||||
static void common_vh_start(running_machine *machine, int num_pixmaps)
|
||||
static void common_vh_start( running_machine *machine, int num_pixmaps )
|
||||
{
|
||||
hnayayoi_state *state = (hnayayoi_state *)machine->driver_data;
|
||||
int i;
|
||||
|
||||
total_pixmaps = num_pixmaps;
|
||||
state->total_pixmaps = num_pixmaps;
|
||||
|
||||
for (i = 0;i < 8;i++)
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
if (i < total_pixmaps)
|
||||
if (i < state->total_pixmaps)
|
||||
{
|
||||
pixmap[i] = auto_alloc_array(machine, UINT8, 256*256);
|
||||
state->pixmap[i] = auto_alloc_array(machine, UINT8, 256 * 256);
|
||||
}
|
||||
else
|
||||
pixmap[i] = NULL;
|
||||
state->pixmap[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
VIDEO_START( hnayayoi )
|
||||
{
|
||||
hnayayoi_state *state = (hnayayoi_state *)machine->driver_data;
|
||||
common_vh_start(machine, 4); /* 4 bitmaps -> 2 layers */
|
||||
|
||||
state_save_register_global_pointer(machine, state->pixmap[0], 256 * 256);
|
||||
state_save_register_global_pointer(machine, state->pixmap[1], 256 * 256);
|
||||
state_save_register_global_pointer(machine, state->pixmap[2], 256 * 256);
|
||||
state_save_register_global_pointer(machine, state->pixmap[3], 256 * 256);
|
||||
}
|
||||
|
||||
VIDEO_START( untoucha )
|
||||
{
|
||||
hnayayoi_state *state = (hnayayoi_state *)machine->driver_data;
|
||||
common_vh_start(machine, 8); /* 8 bitmaps -> 4 layers */
|
||||
|
||||
state_save_register_global_pointer(machine, state->pixmap[0], 256 * 256);
|
||||
state_save_register_global_pointer(machine, state->pixmap[1], 256 * 256);
|
||||
state_save_register_global_pointer(machine, state->pixmap[2], 256 * 256);
|
||||
state_save_register_global_pointer(machine, state->pixmap[3], 256 * 256);
|
||||
state_save_register_global_pointer(machine, state->pixmap[4], 256 * 256);
|
||||
state_save_register_global_pointer(machine, state->pixmap[5], 256 * 256);
|
||||
state_save_register_global_pointer(machine, state->pixmap[6], 256 * 256);
|
||||
state_save_register_global_pointer(machine, state->pixmap[7], 256 * 256);
|
||||
}
|
||||
|
||||
|
||||
@ -88,53 +100,52 @@ up blit_src for the second call.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
static UINT8 blit_layer;
|
||||
static UINT16 blit_dest;
|
||||
static UINT32 blit_src;
|
||||
|
||||
WRITE8_HANDLER( dynax_blitter_rev1_param_w )
|
||||
{
|
||||
hnayayoi_state *state = (hnayayoi_state *)space->machine->driver_data;
|
||||
switch (offset)
|
||||
{
|
||||
case 0: blit_dest = (blit_dest & 0xff00) | (data << 0); break;
|
||||
case 1: blit_dest = (blit_dest & 0x00ff) | (data << 8); break;
|
||||
case 2: blit_layer = data; break;
|
||||
case 3: blit_src = (blit_src & 0xffff00) | (data << 0); break;
|
||||
case 4: blit_src = (blit_src & 0xff00ff) | (data << 8); break;
|
||||
case 5: blit_src = (blit_src & 0x00ffff) | (data <<16); break;
|
||||
case 0: state->blit_dest = (state->blit_dest & 0xff00) | (data << 0); break;
|
||||
case 1: state->blit_dest = (state->blit_dest & 0x00ff) | (data << 8); break;
|
||||
case 2: state->blit_layer = data; break;
|
||||
case 3: state->blit_src = (state->blit_src & 0xffff00) | (data << 0); break;
|
||||
case 4: state->blit_src = (state->blit_src & 0xff00ff) | (data << 8); break;
|
||||
case 5: state->blit_src = (state->blit_src & 0x00ffff) | (data <<16); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void copy_pixel(int x,int y,int pen)
|
||||
static void copy_pixel( running_machine *machine, int x, int y, int pen )
|
||||
{
|
||||
hnayayoi_state *state = (hnayayoi_state *)machine->driver_data;
|
||||
if (x >= 0 && x <= 255 && y >= 0 && y <= 255)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0;i < 8;i++)
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
if ((~blit_layer & (1 << i)) && (pixmap[i]))
|
||||
pixmap[i][256*y+x] = pen;
|
||||
if ((~state->blit_layer & (1 << i)) && (state->pixmap[i]))
|
||||
state->pixmap[i][256 * y + x] = pen;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( dynax_blitter_rev1_start_w )
|
||||
{
|
||||
hnayayoi_state *state = (hnayayoi_state *)space->machine->driver_data;
|
||||
UINT8 *rom = memory_region(space->machine, "gfx1");
|
||||
int romlen = memory_region_length(space->machine, "gfx1");
|
||||
int sx = blit_dest & 0xff;
|
||||
int sy = blit_dest >> 8;
|
||||
int x,y;
|
||||
int sx = state->blit_dest & 0xff;
|
||||
int sy = state->blit_dest >> 8;
|
||||
int x, y;
|
||||
|
||||
x = sx;
|
||||
y = sy;
|
||||
while (blit_src < romlen)
|
||||
while (state->blit_src < romlen)
|
||||
{
|
||||
int cmd = rom[blit_src] & 0x0f;
|
||||
int pen = rom[blit_src] >> 4;
|
||||
int cmd = rom[state->blit_src] & 0x0f;
|
||||
int pen = rom[state->blit_src] >> 4;
|
||||
|
||||
blit_src++;
|
||||
state->blit_src++;
|
||||
|
||||
switch (cmd)
|
||||
{
|
||||
@ -144,31 +155,31 @@ WRITE8_HANDLER( dynax_blitter_rev1_start_w )
|
||||
break;
|
||||
|
||||
case 0xe:
|
||||
if (blit_src >= romlen)
|
||||
if (state->blit_src >= romlen)
|
||||
{
|
||||
popmessage("GFXROM OVER %06x",blit_src);
|
||||
popmessage("GFXROM OVER %06x", state->blit_src);
|
||||
return;
|
||||
}
|
||||
x = sx;
|
||||
blit_layer = rom[blit_src++];
|
||||
state->blit_layer = rom[state->blit_src++];
|
||||
break;
|
||||
|
||||
case 0xd:
|
||||
if (blit_src >= romlen)
|
||||
if (state->blit_src >= romlen)
|
||||
{
|
||||
popmessage("GFXROM OVER %06x",blit_src);
|
||||
popmessage("GFXROM OVER %06x", state->blit_src);
|
||||
return;
|
||||
}
|
||||
x = sx + rom[blit_src++];
|
||||
x = sx + rom[state->blit_src++];
|
||||
/* fall through into next case */
|
||||
|
||||
case 0xc:
|
||||
if (blit_src >= romlen)
|
||||
if (state->blit_src >= romlen)
|
||||
{
|
||||
popmessage("GFXROM OVER %06x",blit_src);
|
||||
popmessage("GFXROM OVER %06x", state->blit_src);
|
||||
return;
|
||||
}
|
||||
cmd = rom[blit_src++];
|
||||
cmd = rom[state->blit_src++];
|
||||
/* fall through into next case */
|
||||
|
||||
case 0xb:
|
||||
@ -183,7 +194,7 @@ WRITE8_HANDLER( dynax_blitter_rev1_start_w )
|
||||
case 0x2:
|
||||
case 0x1:
|
||||
while (cmd--)
|
||||
copy_pixel(x++,y,pen);
|
||||
copy_pixel(space->machine, x++, y, pen);
|
||||
break;
|
||||
|
||||
case 0x0:
|
||||
@ -191,35 +202,37 @@ WRITE8_HANDLER( dynax_blitter_rev1_start_w )
|
||||
}
|
||||
}
|
||||
|
||||
popmessage("GFXROM OVER %06x",blit_src);
|
||||
popmessage("GFXROM OVER %06x", state->blit_src);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( dynax_blitter_rev1_clear_w )
|
||||
{
|
||||
hnayayoi_state *state = (hnayayoi_state *)space->machine->driver_data;
|
||||
int pen = data >> 4;
|
||||
int i;
|
||||
|
||||
for (i = 0;i < 8;i++)
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
if ((~blit_layer & (1 << i)) && (pixmap[i]))
|
||||
memset(pixmap[i] + blit_dest, pen, 0x10000 - blit_dest);
|
||||
if ((~state->blit_layer & (1 << i)) && (state->pixmap[i]))
|
||||
memset(state->pixmap[i] + state->blit_dest, pen, 0x10000 - state->blit_dest);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
WRITE8_HANDLER( hnayayoi_palbank_w )
|
||||
{
|
||||
hnayayoi_state *state = (hnayayoi_state *)space->machine->driver_data;
|
||||
offset *= 8;
|
||||
palbank = (palbank & (0xff00 >> offset)) | (data << offset);
|
||||
state->palbank = (state->palbank & (0xff00 >> offset)) | (data << offset);
|
||||
}
|
||||
|
||||
|
||||
static void draw_layer_interleaved(bitmap_t *bitmap, const rectangle *cliprect,
|
||||
int left_pixmap, int right_pixmap, int palbase, int transp)
|
||||
static void draw_layer_interleaved( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int left_pixmap, int right_pixmap, int palbase, int transp )
|
||||
{
|
||||
int county,countx,pen,offs;
|
||||
UINT8 *src1 = pixmap[left_pixmap];
|
||||
UINT8 *src2 = pixmap[right_pixmap];
|
||||
hnayayoi_state *state = (hnayayoi_state *)machine->driver_data;
|
||||
int county, countx, pen, offs;
|
||||
UINT8 *src1 = state->pixmap[left_pixmap];
|
||||
UINT8 *src2 = state->pixmap[right_pixmap];
|
||||
UINT16 *dstbase = (UINT16 *)bitmap->base;
|
||||
|
||||
palbase *= 16;
|
||||
@ -234,17 +247,17 @@ static void draw_layer_interleaved(bitmap_t *bitmap, const rectangle *cliprect,
|
||||
for (countx = 255; countx >= 0; countx--, dst += 2)
|
||||
{
|
||||
pen = *(src1++);
|
||||
if (pen) *dst = palbase + pen;
|
||||
if (pen) *dst = palbase + pen;
|
||||
pen = *(src2++);
|
||||
if (pen) *(dst+1) = palbase + pen;
|
||||
if (pen) *(dst + 1) = palbase + pen;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (countx = 255; countx >= 0; countx--, dst += 2)
|
||||
{
|
||||
*dst = palbase + *(src1++);
|
||||
*(dst+1) = palbase + *(src2++);
|
||||
*dst = palbase + *(src1++);
|
||||
*(dst + 1) = palbase + *(src2++);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -253,22 +266,23 @@ static void draw_layer_interleaved(bitmap_t *bitmap, const rectangle *cliprect,
|
||||
|
||||
VIDEO_UPDATE( hnayayoi )
|
||||
{
|
||||
int col0 = (palbank >> 0) & 0x0f;
|
||||
int col1 = (palbank >> 4) & 0x0f;
|
||||
int col2 = (palbank >> 8) & 0x0f;
|
||||
int col3 = (palbank >> 12) & 0x0f;
|
||||
hnayayoi_state *state = (hnayayoi_state *)screen->machine->driver_data;
|
||||
int col0 = (state->palbank >> 0) & 0x0f;
|
||||
int col1 = (state->palbank >> 4) & 0x0f;
|
||||
int col2 = (state->palbank >> 8) & 0x0f;
|
||||
int col3 = (state->palbank >> 12) & 0x0f;
|
||||
|
||||
if (total_pixmaps == 4)
|
||||
if (state->total_pixmaps == 4)
|
||||
{
|
||||
draw_layer_interleaved(bitmap,cliprect,3,2,col1,0);
|
||||
draw_layer_interleaved(bitmap,cliprect,1,0,col0,1);
|
||||
draw_layer_interleaved(screen->machine, bitmap, cliprect, 3, 2, col1, 0);
|
||||
draw_layer_interleaved(screen->machine, bitmap, cliprect, 1, 0, col0, 1);
|
||||
}
|
||||
else /* total_pixmaps == 8 */
|
||||
{
|
||||
draw_layer_interleaved(bitmap,cliprect,7,6,col3,0);
|
||||
draw_layer_interleaved(bitmap,cliprect,5,4,col2,1);
|
||||
draw_layer_interleaved(bitmap,cliprect,3,2,col1,1);
|
||||
draw_layer_interleaved(bitmap,cliprect,1,0,col0,1);
|
||||
draw_layer_interleaved(screen->machine, bitmap, cliprect, 7, 6, col3, 0);
|
||||
draw_layer_interleaved(screen->machine, bitmap, cliprect, 5, 4, col2, 1);
|
||||
draw_layer_interleaved(screen->machine, bitmap, cliprect, 3, 2, col1, 1);
|
||||
draw_layer_interleaved(screen->machine, bitmap, cliprect, 1, 0, col0, 1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -7,8 +7,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "driver.h"
|
||||
|
||||
static tilemap *bg_tilemap;
|
||||
#include "includes/sonson.h"
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
@ -39,6 +38,7 @@ static tilemap *bg_tilemap;
|
||||
bit 0 -- 2.2kohm resistor -- RED
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
PALETTE_INIT( sonson )
|
||||
{
|
||||
int i;
|
||||
@ -96,22 +96,25 @@ PALETTE_INIT( sonson )
|
||||
|
||||
WRITE8_HANDLER( sonson_videoram_w )
|
||||
{
|
||||
space->machine->generic.videoram.u8[offset] = data;
|
||||
tilemap_mark_tile_dirty(bg_tilemap, offset);
|
||||
sonson_state *state = (sonson_state *)space->machine->driver_data;
|
||||
state->videoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( sonson_colorram_w )
|
||||
{
|
||||
space->machine->generic.colorram.u8[offset] = data;
|
||||
tilemap_mark_tile_dirty(bg_tilemap, offset);
|
||||
sonson_state *state = (sonson_state *)space->machine->driver_data;
|
||||
state->colorram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( sonson_scrollx_w )
|
||||
{
|
||||
sonson_state *state = (sonson_state *)space->machine->driver_data;
|
||||
int row;
|
||||
|
||||
for (row = 5; row < 32; row++)
|
||||
tilemap_set_scrollx(bg_tilemap, row, data);
|
||||
tilemap_set_scrollx(state->bg_tilemap, row, data);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( sonson_flipscreen_w )
|
||||
@ -121,8 +124,9 @@ WRITE8_HANDLER( sonson_flipscreen_w )
|
||||
|
||||
static TILE_GET_INFO( get_bg_tile_info )
|
||||
{
|
||||
int attr = machine->generic.colorram.u8[tile_index];
|
||||
int code = machine->generic.videoram.u8[tile_index] + 256 * (attr & 0x03);
|
||||
sonson_state *state = (sonson_state *)machine->driver_data;
|
||||
int attr = state->colorram[tile_index];
|
||||
int code = state->videoram[tile_index] + 256 * (attr & 0x03);
|
||||
int color = attr >> 2;
|
||||
|
||||
SET_TILE_INFO(0, code, color, 0);
|
||||
@ -130,17 +134,19 @@ static TILE_GET_INFO( get_bg_tile_info )
|
||||
|
||||
VIDEO_START( sonson )
|
||||
{
|
||||
bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
sonson_state *state = (sonson_state *)machine->driver_data;
|
||||
|
||||
tilemap_set_scroll_rows(bg_tilemap, 32);
|
||||
state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
tilemap_set_scroll_rows(state->bg_tilemap, 32);
|
||||
}
|
||||
|
||||
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;
|
||||
sonson_state *state = (sonson_state *)machine->driver_data;
|
||||
UINT8 *spriteram = state->spriteram;
|
||||
int offs;
|
||||
|
||||
for (offs = machine->generic.spriteram_size - 4; offs >= 0; offs -= 4)
|
||||
for (offs = state->spriteram_size - 4; offs >= 0; offs -= 4)
|
||||
{
|
||||
int code = spriteram[offs + 2] + ((spriteram[offs + 1] & 0x20) << 3);
|
||||
int color = spriteram[offs + 1] & 0x1f;
|
||||
@ -171,7 +177,8 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
|
||||
VIDEO_UPDATE( sonson )
|
||||
{
|
||||
tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
|
||||
sonson_state *state = (sonson_state *)screen->machine->driver_data;
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user