mirror of
https://github.com/holub/mame
synced 2025-05-29 17:13:05 +03:00
Added driver data struct and save states to fitfight.c, flstory.c and funkybee.c
Also, added driver data struct to flyball.c and merged video emulation
This commit is contained in:
parent
abb8ad1fb6
commit
6ab509cb8d
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -2448,6 +2448,7 @@ src/mame/includes/flstory.h svneol=native#text/plain
|
||||
src/mame/includes/foodf.h svneol=native#text/plain
|
||||
src/mame/includes/fromanc2.h svneol=native#text/plain
|
||||
src/mame/includes/fromance.h svneol=native#text/plain
|
||||
src/mame/includes/funkybee.h svneol=native#text/plain
|
||||
src/mame/includes/gaelco2.h svneol=native#text/plain
|
||||
src/mame/includes/gaelco3d.h svneol=native#text/plain
|
||||
src/mame/includes/gaelcrpt.h svneol=native#text/plain
|
||||
@ -3198,7 +3199,6 @@ src/mame/video/fitfight.c svneol=native#text/plain
|
||||
src/mame/video/flkatck.c svneol=native#text/plain
|
||||
src/mame/video/flower.c svneol=native#text/plain
|
||||
src/mame/video/flstory.c svneol=native#text/plain
|
||||
src/mame/video/flyball.c svneol=native#text/plain
|
||||
src/mame/video/foodf.c svneol=native#text/plain
|
||||
src/mame/video/freekick.c svneol=native#text/plain
|
||||
src/mame/video/fromanc2.c svneol=native#text/plain
|
||||
|
@ -88,55 +88,45 @@ Stephh's notes :
|
||||
#include "includes/fitfight.h"
|
||||
|
||||
|
||||
UINT16 *fitfight_spriteram;
|
||||
static UINT16 *fof_100000;
|
||||
static UINT16 *fof_600000;
|
||||
UINT16 *fof_700000;
|
||||
static UINT16 *fof_800000;
|
||||
UINT16 *fof_900000;
|
||||
UINT16 *fof_a00000;
|
||||
|
||||
UINT16 *fof_bak_tileram;
|
||||
UINT16 *fof_mid_tileram;
|
||||
UINT16 *fof_txt_tileram;
|
||||
char bbprot_kludge;
|
||||
|
||||
static UINT16 fitfight_700000_data = 0;
|
||||
|
||||
static READ16_HANDLER(fitfight_700000_r)
|
||||
{
|
||||
UINT16 data = fitfight_700000_data;
|
||||
fitfight_state *state = (fitfight_state *)space->machine->driver_data;
|
||||
UINT16 data = state->fof_700000_data;
|
||||
return (data << 2);
|
||||
}
|
||||
|
||||
static READ16_HANDLER(histryma_700000_r)
|
||||
{
|
||||
UINT16 data = (fitfight_700000_data & 0x00AA);
|
||||
data |= ((fitfight_700000_data & 0x0055) >> 2);
|
||||
fitfight_state *state = (fitfight_state *)space->machine->driver_data;
|
||||
UINT16 data = (state->fof_700000_data & 0x00AA);
|
||||
data |= ((state->fof_700000_data & 0x0055) >> 2);
|
||||
return (data);
|
||||
}
|
||||
|
||||
static READ16_HANDLER(bbprot_700000_r)
|
||||
{
|
||||
fitfight_state *state = (fitfight_state *)space->machine->driver_data;
|
||||
UINT16 data = 0;
|
||||
data = (fitfight_700000_data & 0x000b);
|
||||
data |= ((fitfight_700000_data & 0x01d0) >> 2);
|
||||
data |= ((fitfight_700000_data & 0x0004) << 6);
|
||||
data |= ((fitfight_700000_data & 0x0020) << 2);
|
||||
data = (state->fof_700000_data & 0x000b);
|
||||
data |= ((state->fof_700000_data & 0x01d0) >> 2);
|
||||
data |= ((state->fof_700000_data & 0x0004) << 6);
|
||||
data |= ((state->fof_700000_data & 0x0020) << 2);
|
||||
return (data);
|
||||
}
|
||||
|
||||
static WRITE16_HANDLER(fitfight_700000_w)
|
||||
{
|
||||
COMBINE_DATA(&fof_700000[offset]); // needed for scrolling
|
||||
fitfight_state *state = (fitfight_state *)space->machine->driver_data;
|
||||
COMBINE_DATA(&state->fof_700000[offset]); // needed for scrolling
|
||||
|
||||
if (data < 0x0200) // to avoid considering writes of 0x0200
|
||||
fitfight_700000_data = data;
|
||||
state->fof_700000_data = data;
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( fitfight_main_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x000000, 0x0fffff) AM_ROM
|
||||
|
||||
AM_RANGE(0x100000, 0x100001) AM_WRITE(SMH_RAM) AM_BASE(&fof_100000)
|
||||
AM_RANGE(0x100000, 0x100001) AM_WRITE(SMH_RAM) AM_BASE_MEMBER(fitfight_state, fof_100000)
|
||||
//written at scanline 5, allways 1. Used by histryma/fitfight @0x0000ec2c/@0x0000f076
|
||||
|
||||
AM_RANGE(0x200000, 0x200001) AM_READ_PORT("P1_P2")
|
||||
@ -144,7 +134,7 @@ static ADDRESS_MAP_START( fitfight_main_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x400000, 0x400001) AM_READ_PORT("SYSTEM_DSW2")
|
||||
AM_RANGE(0x500000, 0x500001) AM_READ_PORT("DSW3_DSW1")
|
||||
|
||||
AM_RANGE(0x600000, 0x600001) AM_WRITE(SMH_RAM) AM_BASE(&fof_600000)
|
||||
AM_RANGE(0x600000, 0x600001) AM_WRITE(SMH_RAM) AM_BASE_MEMBER(fitfight_state, fof_600000)
|
||||
// Is 0x600000 controlling the slave audio CPU? data is 0x1111000zzzzzzzzz (9 sign. bits)
|
||||
// Used by histryma/fitfight:
|
||||
// @0x000031ae/0x00002b3a: 0xF000, once, during POST
|
||||
@ -155,24 +145,24 @@ static ADDRESS_MAP_START( fitfight_main_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
// @0x000037a6/0x000030e6: 0x??dd byte from 0xe08c05, 0xF101 then 0xF001/0xF157 then 0xF057
|
||||
|
||||
// AM_RANGE(0x700000, 0x700001) AM_READ(xxxx) /* see init */
|
||||
AM_RANGE(0x700000, 0x700001) AM_WRITE(fitfight_700000_w) AM_BASE(&fof_700000)
|
||||
AM_RANGE(0x700000, 0x700001) AM_WRITE(fitfight_700000_w) AM_BASE_MEMBER(fitfight_state, fof_700000)
|
||||
// kept at 0xe07900/0xe04c56
|
||||
|
||||
AM_RANGE(0x800000, 0x800001) AM_WRITE(SMH_RAM) AM_BASE(&fof_800000)
|
||||
AM_RANGE(0x800000, 0x800001) AM_WRITE(SMH_RAM) AM_BASE_MEMBER(fitfight_state, fof_800000)
|
||||
//written at scanline 1, allways 0. Used by histryma/fitfight @0x00001d76/@0x00000f6a
|
||||
|
||||
AM_RANGE(0x900000, 0x900001) AM_WRITE(SMH_RAM) AM_BASE(&fof_900000) //mid tilemap scroll
|
||||
AM_RANGE(0x900000, 0x900001) AM_WRITE(SMH_RAM) AM_BASE_MEMBER(fitfight_state, fof_900000) //mid tilemap scroll
|
||||
// fitfigth: @0x00002b42,@0x00000f76
|
||||
// histryma: @0x000031b6,@0x00001d82
|
||||
|
||||
AM_RANGE(0xa00000, 0xa00001) AM_WRITE(SMH_RAM) AM_BASE(&fof_a00000) //bak tilemap scroll
|
||||
AM_RANGE(0xa00000, 0xa00001) AM_WRITE(SMH_RAM) AM_BASE_MEMBER(fitfight_state, fof_a00000) //bak tilemap scroll
|
||||
// fitfight: @0x00002b4a,@0x00000f82
|
||||
// histryma: @0x000031be,@0x00001d8e
|
||||
|
||||
AM_RANGE(0xb00000, 0xb03fff) AM_WRITENOP /* unused layer? */
|
||||
AM_RANGE(0xb04000, 0xb07fff) AM_READWRITE(SMH_RAM,fof_bak_tileram_w) AM_BASE(&fof_bak_tileram)
|
||||
AM_RANGE(0xb08000, 0xb0bfff) AM_READWRITE(SMH_RAM,fof_mid_tileram_w) AM_BASE(&fof_mid_tileram)
|
||||
AM_RANGE(0xb0c000, 0xb0ffff) AM_READWRITE(SMH_RAM,fof_txt_tileram_w) AM_BASE(&fof_txt_tileram)
|
||||
AM_RANGE(0xb04000, 0xb07fff) AM_READWRITE(SMH_RAM, fof_bak_tileram_w) AM_BASE_MEMBER(fitfight_state, fof_bak_tileram)
|
||||
AM_RANGE(0xb08000, 0xb0bfff) AM_READWRITE(SMH_RAM, fof_mid_tileram_w) AM_BASE_MEMBER(fitfight_state, fof_mid_tileram)
|
||||
AM_RANGE(0xb0c000, 0xb0ffff) AM_READWRITE(SMH_RAM, fof_txt_tileram_w) AM_BASE_MEMBER(fitfight_state, fof_txt_tileram)
|
||||
|
||||
AM_RANGE(0xb10000, 0xb13fff) AM_WRITENOP //used by histryma @0x0000b25a
|
||||
AM_RANGE(0xb14000, 0xb17fff) AM_WRITENOP //used by histryma @0x0000b25a,b270
|
||||
@ -180,7 +170,7 @@ static ADDRESS_MAP_START( fitfight_main_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
|
||||
AM_RANGE(0xc00000, 0xc00fff) AM_READWRITE(SMH_RAM,paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE(&paletteram16)
|
||||
|
||||
AM_RANGE(0xd00000, 0xd007ff) AM_RAM AM_BASE(&fitfight_spriteram)
|
||||
AM_RANGE(0xd00000, 0xd007ff) AM_RAM AM_BASE_MEMBER(fitfight_state, spriteram)
|
||||
|
||||
AM_RANGE(0xe00000, 0xe0ffff) AM_RAM
|
||||
ADDRESS_MAP_END
|
||||
@ -188,30 +178,30 @@ ADDRESS_MAP_END
|
||||
static ADDRESS_MAP_START( bbprot_main_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x000000, 0x0fffff) AM_ROM
|
||||
|
||||
AM_RANGE(0x100000, 0x100001) AM_WRITE(SMH_RAM) AM_BASE(&fof_100000)
|
||||
AM_RANGE(0x100000, 0x100001) AM_WRITE(SMH_RAM) AM_BASE_MEMBER(fitfight_state, fof_100000)
|
||||
|
||||
AM_RANGE(0x300000, 0x300001) AM_READ_PORT("P1_P2")
|
||||
AM_RANGE(0x380000, 0x380001) AM_READ_PORT("EXTRA")
|
||||
AM_RANGE(0x400000, 0x400001) AM_READ_PORT("SYSTEM_DSW2")
|
||||
AM_RANGE(0x480000, 0x480001) AM_READ_PORT("DSW3_DSW1")
|
||||
|
||||
AM_RANGE(0x600000, 0x600001) AM_WRITE(SMH_RAM) AM_BASE(&fof_600000)
|
||||
AM_RANGE(0x600000, 0x600001) AM_WRITE(SMH_RAM) AM_BASE_MEMBER(fitfight_state, fof_600000)
|
||||
|
||||
AM_RANGE(0x700000, 0x700001) AM_READWRITE(bbprot_700000_r,fitfight_700000_w) AM_BASE(&fof_700000)
|
||||
AM_RANGE(0x700000, 0x700001) AM_READWRITE(bbprot_700000_r, fitfight_700000_w) AM_BASE_MEMBER(fitfight_state, fof_700000)
|
||||
|
||||
AM_RANGE(0x800000, 0x800001) AM_WRITE(SMH_RAM) AM_BASE(&fof_800000)
|
||||
AM_RANGE(0x900000, 0x900001) AM_WRITE(SMH_RAM) AM_BASE(&fof_900000)
|
||||
AM_RANGE(0xa00000, 0xa00001) AM_WRITE(SMH_RAM) AM_BASE(&fof_a00000)
|
||||
AM_RANGE(0x800000, 0x800001) AM_WRITE(SMH_RAM) AM_BASE_MEMBER(fitfight_state, fof_800000)
|
||||
AM_RANGE(0x900000, 0x900001) AM_WRITE(SMH_RAM) AM_BASE_MEMBER(fitfight_state, fof_900000)
|
||||
AM_RANGE(0xa00000, 0xa00001) AM_WRITE(SMH_RAM) AM_BASE_MEMBER(fitfight_state, fof_a00000)
|
||||
|
||||
AM_RANGE(0xb00000, 0xb03fff) AM_WRITENOP /* unused layer? */
|
||||
AM_RANGE(0xb04000, 0xb07fff) AM_READWRITE(SMH_RAM,fof_bak_tileram_w) AM_BASE(&fof_bak_tileram)
|
||||
AM_RANGE(0xb08000, 0xb0bfff) AM_READWRITE(SMH_RAM,fof_mid_tileram_w) AM_BASE(&fof_mid_tileram)
|
||||
AM_RANGE(0xb0c000, 0xb0ffff) AM_READWRITE(SMH_RAM,fof_txt_tileram_w) AM_BASE(&fof_txt_tileram)
|
||||
AM_RANGE(0xb04000, 0xb07fff) AM_READWRITE(SMH_RAM, fof_bak_tileram_w) AM_BASE_MEMBER(fitfight_state, fof_bak_tileram)
|
||||
AM_RANGE(0xb08000, 0xb0bfff) AM_READWRITE(SMH_RAM, fof_mid_tileram_w) AM_BASE_MEMBER(fitfight_state, fof_mid_tileram)
|
||||
AM_RANGE(0xb0c000, 0xb0ffff) AM_READWRITE(SMH_RAM, fof_txt_tileram_w) AM_BASE_MEMBER(fitfight_state, fof_txt_tileram)
|
||||
|
||||
AM_RANGE(0xc00000, 0xc00fff) AM_READ(SMH_RAM)
|
||||
AM_RANGE(0xc00000, 0xc03fff) AM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE(&paletteram16)
|
||||
|
||||
AM_RANGE(0xd00000, 0xd007ff) AM_RAM AM_BASE(&fitfight_spriteram)
|
||||
AM_RANGE(0xd00000, 0xd007ff) AM_RAM AM_BASE_MEMBER(fitfight_state, spriteram)
|
||||
|
||||
AM_RANGE(0xe00000, 0xe0ffff) AM_RAM
|
||||
ADDRESS_MAP_END
|
||||
@ -267,7 +257,7 @@ ADDRESS_MAP_END
|
||||
|
||||
static INTERRUPT_GEN( snd_irq )
|
||||
{
|
||||
cpu_set_input_line(device,UPD7810_INTF2,HOLD_LINE);
|
||||
cpu_set_input_line(device, UPD7810_INTF2, HOLD_LINE);
|
||||
}
|
||||
|
||||
static const UPD7810_CONFIG sound_cpu_config =
|
||||
@ -727,7 +717,23 @@ static GFXDECODE_START( prot )
|
||||
GFXDECODE_END
|
||||
|
||||
|
||||
static MACHINE_START( fitfight )
|
||||
{
|
||||
fitfight_state *state = (fitfight_state *)machine->driver_data;
|
||||
|
||||
state_save_register_global(machine, state->fof_700000_data);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( fitfight )
|
||||
{
|
||||
fitfight_state *state = (fitfight_state *)machine->driver_data;
|
||||
|
||||
state->fof_700000_data = 0;
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( fitfight )
|
||||
MDRV_DRIVER_DATA(fitfight_state)
|
||||
|
||||
MDRV_CPU_ADD("maincpu",M68000, 12000000)
|
||||
MDRV_CPU_PROGRAM_MAP(fitfight_main_map)
|
||||
MDRV_CPU_VBLANK_INT("screen", irq2_line_hold)
|
||||
@ -738,8 +744,10 @@ static MACHINE_DRIVER_START( fitfight )
|
||||
MDRV_CPU_IO_MAP(snd_io)
|
||||
MDRV_CPU_VBLANK_INT("screen", snd_irq)
|
||||
|
||||
MDRV_GFXDECODE(fitfight)
|
||||
MDRV_MACHINE_START(fitfight)
|
||||
MDRV_MACHINE_RESET(fitfight)
|
||||
|
||||
MDRV_GFXDECODE(fitfight)
|
||||
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
MDRV_SCREEN_REFRESH_RATE(60)
|
||||
@ -761,12 +769,16 @@ static MACHINE_DRIVER_START( fitfight )
|
||||
MACHINE_DRIVER_END
|
||||
|
||||
static MACHINE_DRIVER_START( bbprot )
|
||||
MDRV_DRIVER_DATA(fitfight_state)
|
||||
|
||||
MDRV_CPU_ADD("maincpu",M68000, 12000000)
|
||||
MDRV_CPU_PROGRAM_MAP(bbprot_main_map)
|
||||
MDRV_CPU_VBLANK_INT("screen", irq2_line_hold)
|
||||
|
||||
MDRV_GFXDECODE(prot)
|
||||
MDRV_MACHINE_START(fitfight)
|
||||
MDRV_MACHINE_RESET(fitfight)
|
||||
|
||||
MDRV_GFXDECODE(prot)
|
||||
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
MDRV_SCREEN_REFRESH_RATE(60)
|
||||
@ -969,25 +981,28 @@ static DRIVER_INIT( fitfight )
|
||||
{
|
||||
// UINT16 *mem16 = (UINT16 *)memory_region(machine, "maincpu");
|
||||
// mem16[0x0165B2/2] = 0x4e71; // for now so it boots
|
||||
fitfight_state *state = (fitfight_state *)machine->driver_data;
|
||||
memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x700000, 0x700001, 0, 0, fitfight_700000_r);
|
||||
bbprot_kludge = 0;
|
||||
state->bbprot_kludge = 0;
|
||||
}
|
||||
|
||||
static DRIVER_INIT( histryma )
|
||||
{
|
||||
// UINT16 *mem16 = (UINT16 *)memory_region(machine, "maincpu");
|
||||
// mem16[0x017FDC/2] = 0x4e71; // for now so it boots
|
||||
fitfight_state *state = (fitfight_state *)machine->driver_data;
|
||||
memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x700000, 0x700001, 0, 0, histryma_700000_r);
|
||||
bbprot_kludge = 0;
|
||||
state->bbprot_kludge = 0;
|
||||
}
|
||||
|
||||
static DRIVER_INIT( bbprot )
|
||||
{
|
||||
bbprot_kludge = 1;
|
||||
fitfight_state *state = (fitfight_state *)machine->driver_data;
|
||||
state->bbprot_kludge = 1;
|
||||
}
|
||||
|
||||
/* GAME */
|
||||
|
||||
GAME( 199?, fitfight, 0, fitfight, fitfight, fitfight, ROT0, "bootleg", "Fit of Fighting", GAME_IMPERFECT_GRAPHICS | GAME_NO_SOUND )
|
||||
GAME( 199?, histryma, 0, fitfight, histryma, histryma, ROT0, "bootleg", "The History of Martial Arts", GAME_IMPERFECT_GRAPHICS | GAME_NO_SOUND )
|
||||
GAME( 199?, bbprot, 0, bbprot, bbprot, bbprot, ROT0, "<unknown>", "Untitled Fighter 'BB' (prototype)", GAME_IMPERFECT_GRAPHICS | GAME_NO_SOUND )
|
||||
GAME( 199?, fitfight, 0, fitfight, fitfight, fitfight, ROT0, "bootleg", "Fit of Fighting", GAME_IMPERFECT_GRAPHICS | GAME_NO_SOUND | GAME_SUPPORTS_SAVE )
|
||||
GAME( 199?, histryma, 0, fitfight, histryma, histryma, ROT0, "bootleg", "The History of Martial Arts", GAME_IMPERFECT_GRAPHICS | GAME_NO_SOUND | GAME_SUPPORTS_SAVE )
|
||||
GAME( 199?, bbprot, 0, bbprot, bbprot, bbprot, ROT0, "<unknown>", "Untitled Fighter 'BB' (prototype)", GAME_IMPERFECT_GRAPHICS | GAME_NO_SOUND | GAME_SUPPORTS_SAVE )
|
||||
|
@ -1,11 +1,11 @@
|
||||
/***************************************************************************
|
||||
|
||||
The FairyLand Story
|
||||
The FairyLand Story
|
||||
|
||||
added Victorious Nine by BUT
|
||||
added Victorious Nine by BUT
|
||||
|
||||
TODO:
|
||||
- TA7630 emulation needs filter support (bass sounds from MSM5232 should be about 2 times louder)
|
||||
TODO:
|
||||
- TA7630 emulation needs filter support (bass sounds from MSM5232 should be about 2 times louder)
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
@ -18,37 +18,33 @@ TODO:
|
||||
#include "sound/dac.h"
|
||||
#include "includes/flstory.h"
|
||||
|
||||
UINT8 *onna34ro_workram;
|
||||
UINT8 *victnine_workram;
|
||||
|
||||
static UINT8 snd_data;
|
||||
static UINT8 snd_flag;
|
||||
|
||||
static READ8_HANDLER( from_snd_r )
|
||||
{
|
||||
snd_flag = 0;
|
||||
return snd_data;
|
||||
flstory_state *state = (flstory_state *)space->machine->driver_data;
|
||||
state->snd_flag = 0;
|
||||
return state->snd_data;
|
||||
}
|
||||
|
||||
static READ8_HANDLER( snd_flag_r )
|
||||
{
|
||||
return snd_flag | 0xfd;
|
||||
flstory_state *state = (flstory_state *)space->machine->driver_data;
|
||||
return state->snd_flag | 0xfd;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( to_main_w )
|
||||
{
|
||||
snd_data = data;
|
||||
snd_flag = 2;
|
||||
flstory_state *state = (flstory_state *)space->machine->driver_data;
|
||||
state->snd_data = data;
|
||||
state->snd_flag = 2;
|
||||
}
|
||||
|
||||
|
||||
static int sound_nmi_enable,pending_nmi;
|
||||
|
||||
static TIMER_CALLBACK( nmi_callback )
|
||||
{
|
||||
if (sound_nmi_enable)
|
||||
cputag_set_input_line(machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
|
||||
else pending_nmi = 1;
|
||||
flstory_state *state = (flstory_state *)machine->driver_data;
|
||||
if (state->sound_nmi_enable)
|
||||
cpu_set_input_line(state->audiocpu, INPUT_LINE_NMI, PULSE_LINE);
|
||||
else
|
||||
state->pending_nmi = 1;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( sound_command_w )
|
||||
@ -60,22 +56,24 @@ static WRITE8_HANDLER( sound_command_w )
|
||||
|
||||
static WRITE8_HANDLER( nmi_disable_w )
|
||||
{
|
||||
sound_nmi_enable = 0;
|
||||
flstory_state *state = (flstory_state *)space->machine->driver_data;
|
||||
state->sound_nmi_enable = 0;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( nmi_enable_w )
|
||||
{
|
||||
sound_nmi_enable = 1;
|
||||
if (pending_nmi)
|
||||
flstory_state *state = (flstory_state *)space->machine->driver_data;
|
||||
state->sound_nmi_enable = 1;
|
||||
if (state->pending_nmi)
|
||||
{
|
||||
cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
|
||||
pending_nmi = 0;
|
||||
cpu_set_input_line(state->audiocpu, INPUT_LINE_NMI, PULSE_LINE);
|
||||
state->pending_nmi = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( flstory_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0xbfff) AM_ROM
|
||||
AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(flstory_videoram_w) AM_BASE(&videoram) AM_SIZE(&videoram_size)
|
||||
AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(flstory_videoram_w) AM_BASE_MEMBER(flstory_state, videoram) AM_SIZE(&videoram_size)
|
||||
AM_RANGE(0xc800, 0xcfff) AM_RAM /* unknown */
|
||||
AM_RANGE(0xd000, 0xd000) AM_READWRITE(flstory_mcu_r, flstory_mcu_w)
|
||||
AM_RANGE(0xd001, 0xd001) AM_WRITENOP /* watchdog? */
|
||||
@ -91,8 +89,8 @@ static ADDRESS_MAP_START( flstory_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0xd805, 0xd805) AM_READ(flstory_mcu_status_r)
|
||||
AM_RANGE(0xd806, 0xd806) AM_READ_PORT("P2")
|
||||
// AM_RANGE(0xda00, 0xda00) AM_WRITE(SMH_RAM)
|
||||
AM_RANGE(0xdc00, 0xdc9f) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
|
||||
AM_RANGE(0xdca0, 0xdcbf) AM_RAM_WRITE(flstory_scrlram_w) AM_BASE(&flstory_scrlram)
|
||||
AM_RANGE(0xdc00, 0xdc9f) AM_RAM AM_BASE_MEMBER(flstory_state, spriteram) AM_SIZE(&spriteram_size)
|
||||
AM_RANGE(0xdca0, 0xdcbf) AM_RAM_WRITE(flstory_scrlram_w) AM_BASE_MEMBER(flstory_state, scrlram)
|
||||
AM_RANGE(0xdcc0, 0xdcff) AM_RAM /* unknown */
|
||||
AM_RANGE(0xdd00, 0xdeff) AM_READWRITE(flstory_palette_r, flstory_palette_w)
|
||||
AM_RANGE(0xdf03, 0xdf03) AM_WRITE(flstory_gfxctrl_w)
|
||||
@ -101,7 +99,7 @@ ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( onna34ro_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0xbfff) AM_ROM
|
||||
AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(flstory_videoram_w) AM_BASE(&videoram) AM_SIZE(&videoram_size)
|
||||
AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(flstory_videoram_w) AM_BASE_MEMBER(flstory_state, videoram) AM_SIZE(&videoram_size)
|
||||
AM_RANGE(0xc800, 0xcfff) AM_RAM /* unknown */
|
||||
AM_RANGE(0xd000, 0xd000) AM_READWRITE(onna34ro_mcu_r, onna34ro_mcu_w)
|
||||
AM_RANGE(0xd001, 0xd001) AM_WRITENOP /* watchdog? */
|
||||
@ -117,24 +115,25 @@ static ADDRESS_MAP_START( onna34ro_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0xd805, 0xd805) AM_READ(onna34ro_mcu_status_r)
|
||||
AM_RANGE(0xd806, 0xd806) AM_READ_PORT("P2")
|
||||
// AM_RANGE(0xda00, 0xda00) AM_WRITE(SMH_RAM)
|
||||
AM_RANGE(0xdc00, 0xdc9f) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
|
||||
AM_RANGE(0xdca0, 0xdcbf) AM_RAM_WRITE(flstory_scrlram_w) AM_BASE(&flstory_scrlram)
|
||||
AM_RANGE(0xdc00, 0xdc9f) AM_RAM AM_BASE_MEMBER(flstory_state, spriteram) AM_SIZE(&spriteram_size)
|
||||
AM_RANGE(0xdca0, 0xdcbf) AM_RAM_WRITE(flstory_scrlram_w) AM_BASE_MEMBER(flstory_state, scrlram)
|
||||
AM_RANGE(0xdcc0, 0xdcff) AM_RAM /* unknown */
|
||||
AM_RANGE(0xdd00, 0xdeff) AM_READWRITE(flstory_palette_r, flstory_palette_w)
|
||||
AM_RANGE(0xdf03, 0xdf03) AM_WRITE(flstory_gfxctrl_w)
|
||||
AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_BASE(&onna34ro_workram) /* work RAM */
|
||||
AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_BASE_MEMBER(flstory_state, workram) /* work RAM */
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static CUSTOM_INPUT( victnine_mcu_status_bit01_r )
|
||||
{
|
||||
const address_space *space = cputag_get_address_space(field->port->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
|
||||
flstory_state *state = (flstory_state *)field->port->machine->driver_data;
|
||||
const address_space *space = cpu_get_address_space(state->maincpu, ADDRESS_SPACE_PROGRAM);
|
||||
|
||||
return (victnine_mcu_status_r(space, 0) & 3);
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( victnine_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0xbfff) AM_ROM
|
||||
AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(flstory_videoram_w) AM_BASE(&videoram) AM_SIZE(&videoram_size)
|
||||
AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(flstory_videoram_w) AM_BASE_MEMBER(flstory_state, videoram) AM_SIZE(&videoram_size)
|
||||
AM_RANGE(0xc800, 0xcfff) AM_RAM /* unknown */
|
||||
AM_RANGE(0xd000, 0xd000) AM_READWRITE(victnine_mcu_r, victnine_mcu_w)
|
||||
AM_RANGE(0xd001, 0xd001) AM_WRITENOP /* watchdog? */
|
||||
@ -151,82 +150,84 @@ static ADDRESS_MAP_START( victnine_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0xd806, 0xd806) AM_READ_PORT("P2")
|
||||
AM_RANGE(0xd807, 0xd807) AM_READ_PORT("EXTRA_P2")
|
||||
// AM_RANGE(0xda00, 0xda00) AM_WRITE(SMH_RAM)
|
||||
AM_RANGE(0xdc00, 0xdc9f) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
|
||||
AM_RANGE(0xdca0, 0xdcbf) AM_RAM_WRITE(flstory_scrlram_w) AM_BASE(&flstory_scrlram)
|
||||
AM_RANGE(0xdc00, 0xdc9f) AM_RAM AM_BASE_MEMBER(flstory_state, spriteram) AM_SIZE(&spriteram_size)
|
||||
AM_RANGE(0xdca0, 0xdcbf) AM_RAM_WRITE(flstory_scrlram_w) AM_BASE_MEMBER(flstory_state, scrlram)
|
||||
AM_RANGE(0xdce0, 0xdce0) AM_READWRITE(victnine_gfxctrl_r, victnine_gfxctrl_w)
|
||||
AM_RANGE(0xdce1, 0xdce1) AM_WRITENOP /* unknown */
|
||||
AM_RANGE(0xdd00, 0xdeff) AM_READWRITE(flstory_palette_r, flstory_palette_w)
|
||||
AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_BASE(&victnine_workram) /* work RAM */
|
||||
AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_BASE_MEMBER(flstory_state, workram) /* work RAM */
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static int vol_ctrl[16];
|
||||
|
||||
static MACHINE_RESET( ta7630 )
|
||||
{
|
||||
flstory_state *state = (flstory_state *)machine->driver_data;
|
||||
int i;
|
||||
|
||||
double db = 0.0;
|
||||
double db_step = 1.50; /* 1.50 dB step (at least, maybe more) */
|
||||
double db_step_inc = 0.125;
|
||||
for (i=0; i<16; i++)
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
double max = 100.0 / pow(10.0, db/20.0 );
|
||||
vol_ctrl[ 15-i ] = max;
|
||||
/*logerror("vol_ctrl[%x] = %i (%f dB)\n",15-i,vol_ctrl[ 15-i ],db);*/
|
||||
state->vol_ctrl[15 - i] = max;
|
||||
/*logerror("vol_ctrl[%x] = %i (%f dB)\n", 15 - i, state->vol_ctrl[15 - i], db);*/
|
||||
db += db_step;
|
||||
db_step += db_step_inc;
|
||||
}
|
||||
|
||||
/* for (i=0; i<8; i++)
|
||||
logerror("SOUND Chan#%i name=%s\n", i, mixer_get_name(i) ); */
|
||||
/* for (i = 0; i < 8; i++)
|
||||
logerror("SOUND Chan#%i name=%s\n", i, mixer_get_name(i)); */
|
||||
/*
|
||||
channels 0-2 AY#0
|
||||
channels 3,4 MSM5232 group1,group2
|
||||
*/
|
||||
}
|
||||
|
||||
static UINT8 snd_ctrl0=0;
|
||||
static UINT8 snd_ctrl1=0;
|
||||
static UINT8 snd_ctrl2=0;
|
||||
static UINT8 snd_ctrl3=0;
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( sound_control_0_w )
|
||||
{
|
||||
snd_ctrl0 = data & 0xff;
|
||||
// popmessage("SND0 0=%02x 1=%02x 2=%02x 3=%02x", snd_ctrl0, snd_ctrl1, snd_ctrl2, snd_ctrl3);
|
||||
flstory_state *state = (flstory_state *)device->machine->driver_data;
|
||||
|
||||
state->snd_ctrl0 = data & 0xff;
|
||||
// popmessage("SND0 0=%02x 1=%02x 2=%02x 3=%02x", state->snd_ctrl0, state->snd_ctrl1, state->snd_ctrl2, state->snd_ctrl3);
|
||||
|
||||
/* this definitely controls main melody voice on 2'-1 and 4'-1 outputs */
|
||||
sound_set_output_gain(device, 0, vol_ctrl[ (snd_ctrl0>>4) & 15 ] / 100.0); /* group1 from msm5232 */
|
||||
sound_set_output_gain(device, 1, vol_ctrl[ (snd_ctrl0>>4) & 15 ] / 100.0); /* group1 from msm5232 */
|
||||
sound_set_output_gain(device, 2, vol_ctrl[ (snd_ctrl0>>4) & 15 ] / 100.0); /* group1 from msm5232 */
|
||||
sound_set_output_gain(device, 3, vol_ctrl[ (snd_ctrl0>>4) & 15 ] / 100.0); /* group1 from msm5232 */
|
||||
sound_set_output_gain(device, 0, state->vol_ctrl[(state->snd_ctrl0 >> 4) & 15] / 100.0); /* group1 from msm5232 */
|
||||
sound_set_output_gain(device, 1, state->vol_ctrl[(state->snd_ctrl0 >> 4) & 15] / 100.0); /* group1 from msm5232 */
|
||||
sound_set_output_gain(device, 2, state->vol_ctrl[(state->snd_ctrl0 >> 4) & 15] / 100.0); /* group1 from msm5232 */
|
||||
sound_set_output_gain(device, 3, state->vol_ctrl[(state->snd_ctrl0 >> 4) & 15] / 100.0); /* group1 from msm5232 */
|
||||
|
||||
}
|
||||
static WRITE8_DEVICE_HANDLER( sound_control_1_w )
|
||||
{
|
||||
snd_ctrl1 = data & 0xff;
|
||||
// popmessage("SND1 0=%02x 1=%02x 2=%02x 3=%02x", snd_ctrl0, snd_ctrl1, snd_ctrl2, snd_ctrl3);
|
||||
sound_set_output_gain(device, 4, vol_ctrl[ (snd_ctrl1>>4) & 15 ] / 100.0); /* group2 from msm5232 */
|
||||
sound_set_output_gain(device, 5, vol_ctrl[ (snd_ctrl1>>4) & 15 ] / 100.0); /* group2 from msm5232 */
|
||||
sound_set_output_gain(device, 6, vol_ctrl[ (snd_ctrl1>>4) & 15 ] / 100.0); /* group2 from msm5232 */
|
||||
sound_set_output_gain(device, 7, vol_ctrl[ (snd_ctrl1>>4) & 15 ] / 100.0); /* group2 from msm5232 */
|
||||
flstory_state *state = (flstory_state *)device->machine->driver_data;
|
||||
|
||||
state->snd_ctrl1 = data & 0xff;
|
||||
// popmessage("SND1 0=%02x 1=%02x 2=%02x 3=%02x", state->snd_ctrl0, state->snd_ctrl1, state->snd_ctrl2, state->snd_ctrl3);
|
||||
sound_set_output_gain(device, 4, state->vol_ctrl[(state->snd_ctrl1 >> 4) & 15] / 100.0); /* group2 from msm5232 */
|
||||
sound_set_output_gain(device, 5, state->vol_ctrl[(state->snd_ctrl1 >> 4) & 15] / 100.0); /* group2 from msm5232 */
|
||||
sound_set_output_gain(device, 6, state->vol_ctrl[(state->snd_ctrl1 >> 4) & 15] / 100.0); /* group2 from msm5232 */
|
||||
sound_set_output_gain(device, 7, state->vol_ctrl[(state->snd_ctrl1 >> 4) & 15] / 100.0); /* group2 from msm5232 */
|
||||
}
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( sound_control_2_w )
|
||||
{
|
||||
flstory_state *state = (flstory_state *)device->machine->driver_data;
|
||||
int i;
|
||||
|
||||
snd_ctrl2 = data & 0xff;
|
||||
// popmessage("SND2 0=%02x 1=%02x 2=%02x 3=%02x", snd_ctrl0, snd_ctrl1, snd_ctrl2, snd_ctrl3);
|
||||
state->snd_ctrl2 = data & 0xff;
|
||||
// popmessage("SND2 0=%02x 1=%02x 2=%02x 3=%02x", state->snd_ctrl0, state->snd_ctrl1, state->snd_ctrl2, state->snd_ctrl3);
|
||||
|
||||
for (i=0; i<3; i++)
|
||||
sound_set_output_gain (device, i, vol_ctrl[ (snd_ctrl2>>4) & 15 ] / 100.0); /* ym2149f all */
|
||||
for (i = 0; i < 3; i++)
|
||||
sound_set_output_gain(device, i, state->vol_ctrl[(state->snd_ctrl2 >> 4) & 15] / 100.0); /* ym2149f all */
|
||||
}
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( sound_control_3_w ) /* unknown */
|
||||
{
|
||||
snd_ctrl3 = data & 0xff;
|
||||
// popmessage("SND3 0=%02x 1=%02x 2=%02x 3=%02x", snd_ctrl0, snd_ctrl1, snd_ctrl2, snd_ctrl3);
|
||||
flstory_state *state = (flstory_state *)device->machine->driver_data;
|
||||
|
||||
state->snd_ctrl3 = data & 0xff;
|
||||
// popmessage("SND3 0=%02x 1=%02x 2=%02x 3=%02x", state->snd_ctrl0, state->snd_ctrl1, state->snd_ctrl2, state->snd_ctrl3);
|
||||
}
|
||||
|
||||
|
||||
@ -246,12 +247,12 @@ ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( flstory_m68705_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
ADDRESS_MAP_GLOBAL_MASK(0x7ff)
|
||||
AM_RANGE(0x0000, 0x0000) AM_READWRITE(flstory_68705_portA_r, flstory_68705_portA_w)
|
||||
AM_RANGE(0x0001, 0x0001) AM_READWRITE(flstory_68705_portB_r, flstory_68705_portB_w)
|
||||
AM_RANGE(0x0002, 0x0002) AM_READWRITE(flstory_68705_portC_r, flstory_68705_portC_w)
|
||||
AM_RANGE(0x0004, 0x0004) AM_WRITE(flstory_68705_ddrA_w)
|
||||
AM_RANGE(0x0005, 0x0005) AM_WRITE(flstory_68705_ddrB_w)
|
||||
AM_RANGE(0x0006, 0x0006) AM_WRITE(flstory_68705_ddrC_w)
|
||||
AM_RANGE(0x0000, 0x0000) AM_READWRITE(flstory_68705_port_a_r, flstory_68705_port_a_w)
|
||||
AM_RANGE(0x0001, 0x0001) AM_READWRITE(flstory_68705_port_b_r, flstory_68705_port_b_w)
|
||||
AM_RANGE(0x0002, 0x0002) AM_READWRITE(flstory_68705_port_c_r, flstory_68705_port_c_w)
|
||||
AM_RANGE(0x0004, 0x0004) AM_WRITE(flstory_68705_ddr_a_w)
|
||||
AM_RANGE(0x0005, 0x0005) AM_WRITE(flstory_68705_ddr_b_w)
|
||||
AM_RANGE(0x0006, 0x0006) AM_WRITE(flstory_68705_ddr_c_w)
|
||||
AM_RANGE(0x0010, 0x007f) AM_RAM
|
||||
AM_RANGE(0x0080, 0x07ff) AM_ROM
|
||||
ADDRESS_MAP_END
|
||||
@ -653,8 +654,88 @@ static const msm5232_interface msm5232_config =
|
||||
};
|
||||
|
||||
|
||||
static MACHINE_START( flstory )
|
||||
{
|
||||
flstory_state *state = (flstory_state *)machine->driver_data;
|
||||
|
||||
state->maincpu = devtag_get_device(machine, "maincpu");
|
||||
state->audiocpu = devtag_get_device(machine, "audiocpu");
|
||||
state->mcu = devtag_get_device(machine, "mcu");
|
||||
|
||||
/* video */
|
||||
state_save_register_global(machine, state->char_bank);
|
||||
state_save_register_global(machine, state->palette_bank);
|
||||
state_save_register_global(machine, state->flipscreen);
|
||||
state_save_register_global(machine, state->gfxctrl);
|
||||
/* sound */
|
||||
state_save_register_global(machine, state->snd_data);
|
||||
state_save_register_global(machine, state->snd_flag);
|
||||
state_save_register_global(machine, state->sound_nmi_enable);
|
||||
state_save_register_global(machine, state->pending_nmi);
|
||||
state_save_register_global_array(machine, state->vol_ctrl);
|
||||
state_save_register_global(machine, state->snd_ctrl0);
|
||||
state_save_register_global(machine, state->snd_ctrl1);
|
||||
state_save_register_global(machine, state->snd_ctrl2);
|
||||
state_save_register_global(machine, state->snd_ctrl3);
|
||||
/* mcu */
|
||||
state_save_register_global(machine, state->from_main);
|
||||
state_save_register_global(machine, state->from_mcu);
|
||||
state_save_register_global(machine, state->mcu_sent);
|
||||
state_save_register_global(machine, state->main_sent);
|
||||
state_save_register_global(machine, state->port_a_in);
|
||||
state_save_register_global(machine, state->port_a_out);
|
||||
state_save_register_global(machine, state->ddr_a);
|
||||
state_save_register_global(machine, state->port_b_in);
|
||||
state_save_register_global(machine, state->port_b_out);
|
||||
state_save_register_global(machine, state->ddr_b);
|
||||
state_save_register_global(machine, state->port_c_in);
|
||||
state_save_register_global(machine, state->port_c_out);
|
||||
state_save_register_global(machine, state->ddr_c);
|
||||
state_save_register_global(machine, state->mcu_select);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( flstory )
|
||||
{
|
||||
flstory_state *state = (flstory_state *)machine->driver_data;
|
||||
|
||||
MACHINE_RESET_CALL(ta7630);
|
||||
|
||||
/* video */
|
||||
state->char_bank = 0;
|
||||
state->palette_bank = 0;
|
||||
state->flipscreen = 0;
|
||||
state->gfxctrl = 0;
|
||||
/* sound */
|
||||
state->snd_data = 0;
|
||||
state->snd_flag = 0;
|
||||
state->sound_nmi_enable = 0;
|
||||
state->pending_nmi = 0;
|
||||
state->snd_ctrl0 = 0;
|
||||
state->snd_ctrl1 = 0;
|
||||
state->snd_ctrl2 = 0;
|
||||
state->snd_ctrl3 = 0;
|
||||
/* mcu */
|
||||
state->from_main = 0;
|
||||
state->from_mcu = 0;
|
||||
state->mcu_sent = 0;
|
||||
state->main_sent = 0;
|
||||
state->port_a_in = 0;
|
||||
state->port_a_out = 0;
|
||||
state->ddr_a = 0;
|
||||
state->port_b_in = 0;
|
||||
state->port_b_out = 0;
|
||||
state->ddr_b = 0;
|
||||
state->port_c_in = 0;
|
||||
state->port_c_out = 0;
|
||||
state->ddr_c = 0;
|
||||
state->mcu_select = 0;
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( flstory )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(flstory_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", Z80,XTAL_10_733MHz/2) /* verified on pcb */
|
||||
MDRV_CPU_PROGRAM_MAP(flstory_map)
|
||||
@ -670,7 +751,8 @@ static MACHINE_DRIVER_START( flstory )
|
||||
|
||||
MDRV_QUANTUM_TIME(HZ(6000)) /* 100 CPU slices per frame - an high value to ensure proper */
|
||||
/* synchronization of the CPUs */
|
||||
MDRV_MACHINE_RESET(ta7630)
|
||||
MDRV_MACHINE_START(flstory)
|
||||
MDRV_MACHINE_RESET(flstory)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
@ -713,6 +795,9 @@ MACHINE_DRIVER_END
|
||||
|
||||
static MACHINE_DRIVER_START( onna34ro )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(flstory_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", Z80,10733000/2) /* ??? */
|
||||
MDRV_CPU_PROGRAM_MAP(onna34ro_map)
|
||||
@ -727,7 +812,8 @@ static MACHINE_DRIVER_START( onna34ro )
|
||||
|
||||
MDRV_QUANTUM_TIME(HZ(6000)) /* 100 CPU slices per frame - an high value to ensure proper */
|
||||
/* synchronization of the CPUs */
|
||||
MDRV_MACHINE_RESET(ta7630)
|
||||
MDRV_MACHINE_START(flstory)
|
||||
MDRV_MACHINE_RESET(flstory)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
@ -770,6 +856,9 @@ MACHINE_DRIVER_END
|
||||
|
||||
static MACHINE_DRIVER_START( victnine )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(flstory_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", Z80,8000000/2) /* 4 MHz */
|
||||
MDRV_CPU_PROGRAM_MAP(victnine_map)
|
||||
@ -784,7 +873,8 @@ static MACHINE_DRIVER_START( victnine )
|
||||
|
||||
MDRV_QUANTUM_TIME(HZ(6000)) /* 100 CPU slices per frame - an high value to ensure proper */
|
||||
/* synchronization of the CPUs */
|
||||
MDRV_MACHINE_RESET(ta7630)
|
||||
MDRV_MACHINE_START(flstory)
|
||||
MDRV_MACHINE_RESET(flstory)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
@ -1050,8 +1140,8 @@ ROM_START( victnine )
|
||||
ROM_END
|
||||
|
||||
|
||||
GAME( 1985, flstory, 0, flstory, flstory, 0, ROT180, "Taito", "The FairyLand Story", GAME_IMPERFECT_SOUND )
|
||||
GAME( 1985, flstoryj, flstory, flstory, flstory, 0, ROT180, "Taito", "The FairyLand Story (Japan)", GAME_IMPERFECT_SOUND )
|
||||
GAME( 1985, onna34ro, 0, onna34ro, onna34ro, 0, ROT0, "Taito", "Onna Sansirou - Typhoon Gal (set 1)", GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_SOUND )
|
||||
GAME( 1985, onna34roa,onna34ro, onna34ro, onna34ro, 0, ROT0, "Taito", "Onna Sansirou - Typhoon Gal (set 2)", GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_SOUND )
|
||||
GAME( 1984, victnine, 0, victnine, victnine, 0, ROT0, "Taito", "Victorious Nine", GAME_IMPERFECT_SOUND )
|
||||
GAME( 1985, flstory, 0, flstory, flstory, 0, ROT180, "Taito", "The FairyLand Story", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
|
||||
GAME( 1985, flstoryj, flstory, flstory, flstory, 0, ROT180, "Taito", "The FairyLand Story (Japan)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
|
||||
GAME( 1985, onna34ro, 0, onna34ro, onna34ro, 0, ROT0, "Taito", "Onna Sansirou - Typhoon Gal (set 1)", GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
|
||||
GAME( 1985, onna34roa, onna34ro, onna34ro, onna34ro, 0, ROT0, "Taito", "Onna Sansirou - Typhoon Gal (set 2)", GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
|
||||
GAME( 1984, victnine, 0, victnine, victnine, 0, ROT0, "Taito", "Victorious Nine", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
|
||||
|
@ -9,36 +9,118 @@ Atari Flyball Driver
|
||||
|
||||
#define MASTER_CLOCK ( XTAL_12_096MHz )
|
||||
|
||||
extern VIDEO_START( flyball );
|
||||
extern VIDEO_UPDATE( flyball );
|
||||
|
||||
extern UINT8 flyball_pitcher_pic;
|
||||
extern UINT8 flyball_pitcher_vert;
|
||||
extern UINT8 flyball_pitcher_horz;
|
||||
extern UINT8 flyball_ball_vert;
|
||||
extern UINT8 flyball_ball_horz;
|
||||
|
||||
extern UINT8* flyball_playfield_ram;
|
||||
typedef struct _flyball_state flyball_state;
|
||||
struct _flyball_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * rombase;
|
||||
UINT8 * playfield_ram;
|
||||
|
||||
static UINT8 flyball_potmask;
|
||||
static UINT8 flyball_potsense;
|
||||
/* video-related */
|
||||
tilemap *tmap;
|
||||
UINT8 pitcher_vert;
|
||||
UINT8 pitcher_horz;
|
||||
UINT8 pitcher_pic;
|
||||
UINT8 ball_vert;
|
||||
UINT8 ball_horz;
|
||||
|
||||
static UINT8 *rombase;
|
||||
/* misc */
|
||||
UINT8 potmask;
|
||||
UINT8 potsense;
|
||||
|
||||
/* devices */
|
||||
const device_config *maincpu;
|
||||
};
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Video emulation
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static TILEMAP_MAPPER( flyball_get_memory_offset )
|
||||
{
|
||||
if (col == 0)
|
||||
col = num_cols;
|
||||
|
||||
return num_cols * (num_rows - row) - col;
|
||||
}
|
||||
|
||||
|
||||
static TILE_GET_INFO( flyball_get_tile_info )
|
||||
{
|
||||
flyball_state *state = (flyball_state *)machine->driver_data;
|
||||
UINT8 data = state->playfield_ram[tile_index];
|
||||
int flags = ((data & 0x40) ? TILE_FLIPX : 0) | ((data & 0x80) ? TILE_FLIPY : 0);
|
||||
int code = data & 63;
|
||||
|
||||
if ((flags & TILE_FLIPX) && (flags & TILE_FLIPY))
|
||||
{
|
||||
code += 64;
|
||||
}
|
||||
|
||||
SET_TILE_INFO(0, code, 0, flags);
|
||||
}
|
||||
|
||||
|
||||
VIDEO_START( flyball )
|
||||
{
|
||||
flyball_state *state = (flyball_state *)machine->driver_data;
|
||||
state->tmap = tilemap_create(machine, flyball_get_tile_info, flyball_get_memory_offset, 8, 16, 32, 16);
|
||||
}
|
||||
|
||||
|
||||
VIDEO_UPDATE( flyball )
|
||||
{
|
||||
flyball_state *state = (flyball_state *)screen->machine->driver_data;
|
||||
int pitcherx = state->pitcher_horz;
|
||||
int pitchery = state->pitcher_vert - 31;
|
||||
|
||||
int ballx = state->ball_horz - 1;
|
||||
int bally = state->ball_vert - 17;
|
||||
|
||||
int x;
|
||||
int y;
|
||||
|
||||
tilemap_mark_all_tiles_dirty(state->tmap);
|
||||
|
||||
/* draw playfield */
|
||||
tilemap_draw(bitmap, cliprect, state->tmap, 0, 0);
|
||||
|
||||
/* draw pitcher */
|
||||
drawgfx_transpen(bitmap, cliprect, screen->machine->gfx[1], state->pitcher_pic ^ 0xf, 0, 1, 0, pitcherx, pitchery, 1);
|
||||
|
||||
/* draw ball */
|
||||
|
||||
for (y = bally; y < bally + 2; y++)
|
||||
for (x = ballx; x < ballx + 2; x++)
|
||||
if (x >= cliprect->min_x &&
|
||||
x <= cliprect->max_x &&
|
||||
y >= cliprect->min_y &&
|
||||
y <= cliprect->max_y)
|
||||
*BITMAP_ADDR16(bitmap, y, x) = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static TIMER_CALLBACK( flyball_joystick_callback )
|
||||
{
|
||||
flyball_state *state = (flyball_state *)machine->driver_data;
|
||||
int potsense = param;
|
||||
|
||||
if (potsense & ~flyball_potmask)
|
||||
generic_pulse_irq_line(cputag_get_cpu(machine, "maincpu"), 0);
|
||||
if (potsense & ~state->potmask)
|
||||
generic_pulse_irq_line(state->maincpu, 0);
|
||||
|
||||
flyball_potsense |= potsense;
|
||||
state->potsense |= potsense;
|
||||
}
|
||||
|
||||
|
||||
static TIMER_CALLBACK( flyball_quarter_callback )
|
||||
{
|
||||
flyball_state *state = (flyball_state *)machine->driver_data;
|
||||
int scanline = param;
|
||||
int potsense[64], i;
|
||||
|
||||
@ -58,29 +140,18 @@ static TIMER_CALLBACK( flyball_quarter_callback )
|
||||
|
||||
timer_set(machine, video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), NULL, scanline, flyball_quarter_callback);
|
||||
|
||||
flyball_potsense = 0;
|
||||
flyball_potmask = 0;
|
||||
state->potsense = 0;
|
||||
state->potmask = 0;
|
||||
}
|
||||
|
||||
|
||||
static MACHINE_RESET( flyball )
|
||||
{
|
||||
int i;
|
||||
|
||||
/* address bits 0 through 8 are inverted */
|
||||
|
||||
UINT8* ROM = memory_region(machine, "maincpu") + 0x2000;
|
||||
|
||||
for (i = 0; i < 0x1000; i++)
|
||||
rombase[i] = ROM[i ^ 0x1ff];
|
||||
device_reset(cputag_get_cpu(machine, "maincpu"));
|
||||
|
||||
timer_set(machine, video_screen_get_time_until_pos(machine->primary_screen, 0, 0), NULL, 0, flyball_quarter_callback);
|
||||
}
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Memory handlers
|
||||
*
|
||||
*************************************/
|
||||
|
||||
/* two physical buttons (start game and stop runner) share the same port bit */
|
||||
|
||||
static READ8_HANDLER( flyball_input_r )
|
||||
{
|
||||
return input_port_read(space->machine, "IN0") & input_port_read(space->machine, "IN1");
|
||||
@ -93,37 +164,44 @@ static READ8_HANDLER( flyball_scanline_r )
|
||||
|
||||
static READ8_HANDLER( flyball_potsense_r )
|
||||
{
|
||||
return flyball_potsense & ~flyball_potmask;
|
||||
flyball_state *state = (flyball_state *)space->machine->driver_data;
|
||||
return state->potsense & ~state->potmask;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( flyball_potmask_w )
|
||||
{
|
||||
flyball_potmask |= data & 0xf;
|
||||
flyball_state *state = (flyball_state *)space->machine->driver_data;
|
||||
state->potmask |= data & 0xf;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( flyball_pitcher_pic_w )
|
||||
{
|
||||
flyball_pitcher_pic = data & 0xf;
|
||||
flyball_state *state = (flyball_state *)space->machine->driver_data;
|
||||
state->pitcher_pic = data & 0xf;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( flyball_ball_vert_w )
|
||||
{
|
||||
flyball_ball_vert = data;
|
||||
flyball_state *state = (flyball_state *)space->machine->driver_data;
|
||||
state->ball_vert = data;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( flyball_ball_horz_w )
|
||||
{
|
||||
flyball_ball_horz = data;
|
||||
flyball_state *state = (flyball_state *)space->machine->driver_data;
|
||||
state->ball_horz = data;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( flyball_pitcher_vert_w )
|
||||
{
|
||||
flyball_pitcher_vert = data;
|
||||
flyball_state *state = (flyball_state *)space->machine->driver_data;
|
||||
state->pitcher_vert = data;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( flyball_pitcher_horz_w )
|
||||
{
|
||||
flyball_pitcher_horz = data;
|
||||
flyball_state *state = (flyball_state *)space->machine->driver_data;
|
||||
state->pitcher_horz = data;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( flyball_misc_w )
|
||||
@ -154,6 +232,12 @@ static WRITE8_HANDLER( flyball_misc_w )
|
||||
}
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Address maps
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static ADDRESS_MAP_START( flyball_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
ADDRESS_MAP_GLOBAL_MASK(0x1fff)
|
||||
AM_RANGE(0x0000, 0x00ff) AM_MIRROR(0x100) AM_RAM
|
||||
@ -168,11 +252,17 @@ static ADDRESS_MAP_START( flyball_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0900, 0x0900) AM_WRITE(flyball_potmask_w)
|
||||
AM_RANGE(0x0a00, 0x0a07) AM_WRITE(flyball_misc_w)
|
||||
AM_RANGE(0x0b00, 0x0b00) AM_READ(flyball_input_r)
|
||||
AM_RANGE(0x0d00, 0x0eff) AM_WRITE(SMH_RAM) AM_BASE(&flyball_playfield_ram)
|
||||
AM_RANGE(0x1000, 0x1fff) AM_ROM AM_BASE(&rombase) /* program */
|
||||
AM_RANGE(0x0d00, 0x0eff) AM_WRITE(SMH_RAM) AM_BASE_MEMBER(flyball_state, playfield_ram)
|
||||
AM_RANGE(0x1000, 0x1fff) AM_ROM AM_BASE_MEMBER(flyball_state, rombase) /* program */
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Input ports
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static INPUT_PORTS_START( flyball )
|
||||
PORT_START("IN0") /* IN0 */
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START2 )
|
||||
@ -206,6 +296,12 @@ static INPUT_PORTS_START( flyball )
|
||||
INPUT_PORTS_END
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Graphics definitions
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static const gfx_layout flyball_tiles_layout =
|
||||
{
|
||||
8, 16, /* width, height */
|
||||
@ -254,13 +350,63 @@ static PALETTE_INIT( flyball )
|
||||
}
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Machine driver
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static MACHINE_START( flyball )
|
||||
{
|
||||
flyball_state *state = (flyball_state *)machine->driver_data;
|
||||
|
||||
state->maincpu = devtag_get_device(machine, "maincpu");
|
||||
|
||||
state_save_register_global(machine, state->pitcher_vert);
|
||||
state_save_register_global(machine, state->pitcher_horz);
|
||||
state_save_register_global(machine, state->pitcher_pic);
|
||||
state_save_register_global(machine, state->ball_vert);
|
||||
state_save_register_global(machine, state->ball_horz);
|
||||
state_save_register_global(machine, state->potmask);
|
||||
state_save_register_global(machine, state->potsense);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( flyball )
|
||||
{
|
||||
flyball_state *state = (flyball_state *)machine->driver_data;
|
||||
int i;
|
||||
|
||||
/* address bits 0 through 8 are inverted */
|
||||
UINT8* ROM = memory_region(machine, "maincpu") + 0x2000;
|
||||
|
||||
for (i = 0; i < 0x1000; i++)
|
||||
state->rombase[i] = ROM[i ^ 0x1ff];
|
||||
|
||||
device_reset(devtag_get_device(machine, "maincpu"));
|
||||
|
||||
timer_set(machine, video_screen_get_time_until_pos(machine->primary_screen, 0, 0), NULL, 0, flyball_quarter_callback);
|
||||
|
||||
state->pitcher_vert = 0;
|
||||
state->pitcher_horz = 0;
|
||||
state->pitcher_pic = 0;
|
||||
state->ball_vert = 0;
|
||||
state->ball_horz = 0;
|
||||
state->potmask = 0;
|
||||
state->potsense = 0;
|
||||
}
|
||||
|
||||
|
||||
static MACHINE_DRIVER_START( flyball )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(flyball_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", M6502, MASTER_CLOCK/16)
|
||||
MDRV_CPU_PROGRAM_MAP(flyball_map)
|
||||
MDRV_CPU_VBLANK_INT("screen", nmi_line_pulse)
|
||||
|
||||
MDRV_MACHINE_START(flyball)
|
||||
MDRV_MACHINE_RESET(flyball)
|
||||
|
||||
/* video hardware */
|
||||
@ -281,6 +427,12 @@ static MACHINE_DRIVER_START( flyball )
|
||||
MACHINE_DRIVER_END
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* ROM definition(s)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
ROM_START( flyball )
|
||||
ROM_REGION( 0x3000, "maincpu", 0 ) /* program */
|
||||
ROM_LOAD( "6129.d5", 0x2000, 0x0200, CRC(17eda069) SHA1(e4ef0bf4546cf00668d759a188e0989a4f003825) )
|
||||
@ -304,4 +456,10 @@ ROM_START( flyball )
|
||||
ROM_END
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Game driver(s)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
GAME( 1976, flyball, 0, flyball, flyball, 0, 0, "Atari", "Flyball", GAME_NO_SOUND )
|
||||
|
@ -74,17 +74,7 @@ Stephh's notes (based on the games Z80 code and some tests) :
|
||||
#include "driver.h"
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "sound/ay8910.h"
|
||||
|
||||
|
||||
extern WRITE8_HANDLER( funkybee_videoram_w );
|
||||
extern WRITE8_HANDLER( funkybee_colorram_w );
|
||||
extern WRITE8_HANDLER( funkybee_gfx_bank_w );
|
||||
extern WRITE8_HANDLER( funkybee_scroll_w );
|
||||
extern WRITE8_HANDLER( funkybee_flipscreen_w );
|
||||
|
||||
extern PALETTE_INIT( funkybee );
|
||||
extern VIDEO_START( funkybee );
|
||||
extern VIDEO_UPDATE( funkybee );
|
||||
#include "funkybee.h"
|
||||
|
||||
|
||||
static READ8_HANDLER( funkybee_input_port_0_r )
|
||||
@ -95,14 +85,14 @@ static READ8_HANDLER( funkybee_input_port_0_r )
|
||||
|
||||
static WRITE8_HANDLER( funkybee_coin_counter_w )
|
||||
{
|
||||
coin_counter_w(space->machine, offset,data);
|
||||
coin_counter_w(space->machine, offset, data);
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( funkybee_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x4fff) AM_ROM
|
||||
AM_RANGE(0x8000, 0x87ff) AM_RAM
|
||||
AM_RANGE(0xa000, 0xbfff) AM_RAM_WRITE(funkybee_videoram_w) AM_BASE(&videoram)
|
||||
AM_RANGE(0xc000, 0xdfff) AM_RAM_WRITE(funkybee_colorram_w) AM_BASE(&colorram)
|
||||
AM_RANGE(0xa000, 0xbfff) AM_RAM_WRITE(funkybee_videoram_w) AM_BASE_MEMBER(funkybee_state, videoram)
|
||||
AM_RANGE(0xc000, 0xdfff) AM_RAM_WRITE(funkybee_colorram_w) AM_BASE_MEMBER(funkybee_state, colorram)
|
||||
AM_RANGE(0xe000, 0xe000) AM_WRITE(funkybee_scroll_w)
|
||||
AM_RANGE(0xe800, 0xe800) AM_WRITE(funkybee_flipscreen_w)
|
||||
AM_RANGE(0xe802, 0xe803) AM_WRITE(funkybee_coin_counter_w)
|
||||
@ -288,14 +278,34 @@ static const ay8910_interface ay8910_config =
|
||||
};
|
||||
|
||||
|
||||
static MACHINE_START( funkybee )
|
||||
{
|
||||
funkybee_state *state = (funkybee_state *)machine->driver_data;
|
||||
|
||||
state_save_register_global(machine, state->gfx_bank);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( funkybee )
|
||||
{
|
||||
funkybee_state *state = (funkybee_state *)machine->driver_data;
|
||||
|
||||
state->gfx_bank = 0;
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( funkybee )
|
||||
|
||||
/* driver data */
|
||||
MDRV_DRIVER_DATA(funkybee_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu", Z80, 3072000) /* 3.072 MHz */
|
||||
MDRV_CPU_PROGRAM_MAP(funkybee_map)
|
||||
MDRV_CPU_IO_MAP(io_map)
|
||||
MDRV_CPU_VBLANK_INT("screen", irq0_line_hold)
|
||||
|
||||
MDRV_MACHINE_START(funkybee)
|
||||
MDRV_MACHINE_RESET(funkybee)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
MDRV_SCREEN_REFRESH_RATE(60)
|
||||
@ -425,8 +435,7 @@ ROM_START( skylancre )
|
||||
ROM_LOAD( "18s030.1a", 0x0000, 0x0020, CRC(e645bacb) SHA1(5f4c299c4cf165fd229731c0e5799a34892bf28e) )
|
||||
ROM_END
|
||||
|
||||
GAME( 1982, funkybee, 0, funkybee, funkybee, 0, ROT90, "Orca", "Funky Bee", 0 )
|
||||
GAME( 1982, funkybeeb,funkybee, funkybee, funkbeeb, 0, ROT90, "bootleg", "Funky Bee (bootleg, harder)", 0 )
|
||||
GAME( 1983, skylancr, 0, funkybee, skylancr, 0, ROT90, "Orca", "Sky Lancer", 0 )
|
||||
GAME( 1983, skylancre,skylancr, funkybee, skylance, 0, ROT90, "Orca (Esco Trading Co license)", "Sky Lancer (Esco Trading Co license)", 0 )
|
||||
|
||||
GAME( 1982, funkybee, 0, funkybee, funkybee, 0, ROT90, "Orca", "Funky Bee", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1982, funkybeeb, funkybee, funkybee, funkbeeb, 0, ROT90, "bootleg", "Funky Bee (bootleg, harder)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1983, skylancr, 0, funkybee, skylancr, 0, ROT90, "Orca", "Sky Lancer", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1983, skylancre, skylancr, funkybee, skylance, 0, ROT90, "Orca (Esco Trading Co license)", "Sky Lancer (Esco Trading Co license)", GAME_SUPPORTS_SAVE )
|
||||
|
@ -1,14 +1,27 @@
|
||||
/*----------- defined in drivers/fitfight.c -----------*/
|
||||
|
||||
extern UINT16 *fitfight_spriteram;
|
||||
extern UINT16 *fof_700000;
|
||||
extern UINT16 *fof_900000;
|
||||
extern UINT16 *fof_a00000;
|
||||
typedef struct _fitfight_state fitfight_state;
|
||||
struct _fitfight_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT16 * fof_100000;
|
||||
UINT16 * fof_600000;
|
||||
UINT16 * fof_700000;
|
||||
UINT16 * fof_800000;
|
||||
UINT16 * fof_900000;
|
||||
UINT16 * fof_a00000;
|
||||
UINT16 * fof_bak_tileram;
|
||||
UINT16 * fof_mid_tileram;
|
||||
UINT16 * fof_txt_tileram;
|
||||
UINT16 * spriteram;
|
||||
// UINT16 * paletteram16; // currently this uses generic palette handling
|
||||
|
||||
extern UINT16 *fof_bak_tileram;
|
||||
extern UINT16 *fof_mid_tileram;
|
||||
extern UINT16 *fof_txt_tileram;
|
||||
extern char bbprot_kludge;
|
||||
/* video-related */
|
||||
tilemap *fof_bak_tilemap, *fof_mid_tilemap, *fof_txt_tilemap;
|
||||
|
||||
/* misc */
|
||||
int bbprot_kludge;
|
||||
UINT16 fof_700000_data;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/fitfight.c -----------*/
|
||||
@ -16,5 +29,6 @@ extern char bbprot_kludge;
|
||||
WRITE16_HANDLER( fof_bak_tileram_w );
|
||||
WRITE16_HANDLER( fof_mid_tileram_w );
|
||||
WRITE16_HANDLER( fof_txt_tileram_w );
|
||||
|
||||
VIDEO_START(fitfight);
|
||||
VIDEO_UPDATE(fitfight);
|
||||
|
@ -1,20 +1,55 @@
|
||||
/*----------- defined in drivers/flstory.c -----------*/
|
||||
|
||||
extern UINT8 *onna34ro_workram;
|
||||
extern UINT8 *victnine_workram;
|
||||
typedef struct _flstory_state flstory_state;
|
||||
struct _flstory_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * videoram;
|
||||
UINT8 * workram;
|
||||
UINT8 * scrlram;
|
||||
UINT8 * spriteram;
|
||||
// UINT8 * paletteram; // currently this uses generic palette handling
|
||||
// UINT8 * paletteram_2; // currently this uses generic palette handling
|
||||
|
||||
/* video-related */
|
||||
tilemap *bg_tilemap;
|
||||
int char_bank, palette_bank, flipscreen, gfxctrl;
|
||||
|
||||
/* sound-related */
|
||||
UINT8 snd_data;
|
||||
UINT8 snd_flag;
|
||||
int sound_nmi_enable, pending_nmi;
|
||||
int vol_ctrl[16];
|
||||
UINT8 snd_ctrl0;
|
||||
UINT8 snd_ctrl1;
|
||||
UINT8 snd_ctrl2;
|
||||
UINT8 snd_ctrl3;
|
||||
|
||||
/* protection */
|
||||
UINT8 from_main, from_mcu;
|
||||
int mcu_sent, main_sent;
|
||||
UINT8 port_a_in, port_a_out, ddr_a;
|
||||
UINT8 port_b_in, port_b_out, ddr_b;
|
||||
UINT8 port_c_in, port_c_out, ddr_c;
|
||||
int mcu_select;
|
||||
|
||||
/* devices */
|
||||
const device_config *maincpu;
|
||||
const device_config *audiocpu;
|
||||
const device_config *mcu;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in machine/flstory.c -----------*/
|
||||
|
||||
READ8_HANDLER( flstory_68705_portA_r );
|
||||
WRITE8_HANDLER( flstory_68705_portA_w );
|
||||
READ8_HANDLER( flstory_68705_portB_r );
|
||||
WRITE8_HANDLER( flstory_68705_portB_w );
|
||||
READ8_HANDLER( flstory_68705_portC_r );
|
||||
WRITE8_HANDLER( flstory_68705_portC_w );
|
||||
WRITE8_HANDLER( flstory_68705_ddrA_w );
|
||||
WRITE8_HANDLER( flstory_68705_ddrB_w );
|
||||
WRITE8_HANDLER( flstory_68705_ddrC_w );
|
||||
READ8_HANDLER( flstory_68705_port_a_r );
|
||||
WRITE8_HANDLER( flstory_68705_port_a_w );
|
||||
READ8_HANDLER( flstory_68705_port_b_r );
|
||||
WRITE8_HANDLER( flstory_68705_port_b_w );
|
||||
READ8_HANDLER( flstory_68705_port_c_r );
|
||||
WRITE8_HANDLER( flstory_68705_port_c_w );
|
||||
WRITE8_HANDLER( flstory_68705_ddr_a_w );
|
||||
WRITE8_HANDLER( flstory_68705_ddr_b_w );
|
||||
WRITE8_HANDLER( flstory_68705_ddr_c_w );
|
||||
WRITE8_HANDLER( flstory_mcu_w );
|
||||
READ8_HANDLER( flstory_mcu_r );
|
||||
READ8_HANDLER( flstory_mcu_status_r );
|
||||
@ -28,8 +63,6 @@ READ8_HANDLER( victnine_mcu_status_r );
|
||||
|
||||
/*----------- defined in video/flstory.c -----------*/
|
||||
|
||||
extern UINT8 *flstory_scrlram;
|
||||
|
||||
VIDEO_START( flstory );
|
||||
VIDEO_UPDATE( flstory );
|
||||
VIDEO_START( victnine );
|
||||
|
26
src/mame/includes/funkybee.h
Normal file
26
src/mame/includes/funkybee.h
Normal file
@ -0,0 +1,26 @@
|
||||
|
||||
|
||||
typedef struct _funkybee_state funkybee_state;
|
||||
struct _funkybee_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * videoram;
|
||||
UINT8 * colorram;
|
||||
|
||||
/* video-related */
|
||||
tilemap *bg_tilemap;
|
||||
int gfx_bank;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/funkybee.c -----------*/
|
||||
|
||||
WRITE8_HANDLER( funkybee_videoram_w );
|
||||
WRITE8_HANDLER( funkybee_colorram_w );
|
||||
WRITE8_HANDLER( funkybee_gfx_bank_w );
|
||||
WRITE8_HANDLER( funkybee_scroll_w );
|
||||
WRITE8_HANDLER( funkybee_flipscreen_w );
|
||||
|
||||
PALETTE_INIT( funkybee );
|
||||
VIDEO_START( funkybee );
|
||||
VIDEO_UPDATE( funkybee );
|
@ -10,10 +10,6 @@
|
||||
#include "driver.h"
|
||||
#include "includes/flstory.h"
|
||||
|
||||
static UINT8 from_main,from_mcu;
|
||||
static int mcu_sent = 0,main_sent = 0;
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
Fairy Land Story 68705 protection interface
|
||||
@ -24,23 +20,26 @@ static int mcu_sent = 0,main_sent = 0;
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
static UINT8 portA_in,portA_out,ddrA;
|
||||
|
||||
READ8_HANDLER( flstory_68705_portA_r )
|
||||
READ8_HANDLER( flstory_68705_port_a_r )
|
||||
{
|
||||
//logerror("%04x: 68705 port A read %02x\n",cpu_get_pc(space->cpu),portA_in);
|
||||
return (portA_out & ddrA) | (portA_in & ~ddrA);
|
||||
flstory_state *state = (flstory_state *)space->machine->driver_data;
|
||||
|
||||
//logerror("%04x: 68705 port A read %02x\n", cpu_get_pc(space->cpu), state->port_a_in);
|
||||
return (state->port_a_out & state->ddr_a) | (state->port_a_in & ~state->ddr_a);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( flstory_68705_portA_w )
|
||||
WRITE8_HANDLER( flstory_68705_port_a_w )
|
||||
{
|
||||
//logerror("%04x: 68705 port A write %02x\n",cpu_get_pc(space->cpu),data);
|
||||
portA_out = data;
|
||||
flstory_state *state = (flstory_state *)space->machine->driver_data;
|
||||
|
||||
//logerror("%04x: 68705 port A write %02x\n", cpu_get_pc(space->cpu), data);
|
||||
state->port_a_out = data;
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( flstory_68705_ddrA_w )
|
||||
WRITE8_HANDLER( flstory_68705_ddr_a_w )
|
||||
{
|
||||
ddrA = data;
|
||||
flstory_state *state = (flstory_state *)space->machine->driver_data;
|
||||
state->ddr_a = data;
|
||||
}
|
||||
|
||||
|
||||
@ -54,123 +53,139 @@ WRITE8_HANDLER( flstory_68705_ddrA_w )
|
||||
* 2 W when 0->1, copies port A to the latch for the main CPU
|
||||
*/
|
||||
|
||||
static UINT8 portB_in,portB_out,ddrB;
|
||||
|
||||
READ8_HANDLER( flstory_68705_portB_r )
|
||||
READ8_HANDLER( flstory_68705_port_b_r )
|
||||
{
|
||||
return (portB_out & ddrB) | (portB_in & ~ddrB);
|
||||
flstory_state *state = (flstory_state *)space->machine->driver_data;
|
||||
return (state->port_b_out & state->ddr_b) | (state->port_b_in & ~state->ddr_b);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( flstory_68705_portB_w )
|
||||
WRITE8_HANDLER( flstory_68705_port_b_w )
|
||||
{
|
||||
//logerror("%04x: 68705 port B write %02x\n",cpu_get_pc(space->cpu),data);
|
||||
flstory_state *state = (flstory_state *)space->machine->driver_data;
|
||||
//logerror("%04x: 68705 port B write %02x\n",cpu_get_pc(space->cpu),data);
|
||||
|
||||
if ((ddrB & 0x02) && (~data & 0x02) && (portB_out & 0x02))
|
||||
if ((state->ddr_b & 0x02) && (~data & 0x02) && (state->port_b_out & 0x02))
|
||||
{
|
||||
portA_in = from_main;
|
||||
if (main_sent)
|
||||
cputag_set_input_line(space->machine, "mcu", 0, CLEAR_LINE);
|
||||
main_sent = 0;
|
||||
logerror("read command %02x from main cpu\n", portA_in);
|
||||
state->port_a_in = state->from_main;
|
||||
if (state->main_sent)
|
||||
cpu_set_input_line(state->mcu, 0, CLEAR_LINE);
|
||||
state->main_sent = 0;
|
||||
logerror("read command %02x from main cpu\n", state->port_a_in);
|
||||
}
|
||||
if ((ddrB & 0x04) && (data & 0x04) && (~portB_out & 0x04))
|
||||
if ((state->ddr_b & 0x04) && (data & 0x04) && (~state->port_b_out & 0x04))
|
||||
{
|
||||
logerror("send command %02x to main cpu\n", portA_out);
|
||||
from_mcu = portA_out;
|
||||
mcu_sent = 1;
|
||||
logerror("send command %02x to main cpu\n", state->port_a_out);
|
||||
state->from_mcu = state->port_a_out;
|
||||
state->mcu_sent = 1;
|
||||
}
|
||||
|
||||
portB_out = data;
|
||||
state->port_b_out = data;
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( flstory_68705_ddrB_w )
|
||||
WRITE8_HANDLER( flstory_68705_ddr_b_w )
|
||||
{
|
||||
ddrB = data;
|
||||
flstory_state *state = (flstory_state *)space->machine->driver_data;
|
||||
state->ddr_b = data;
|
||||
}
|
||||
|
||||
|
||||
static UINT8 portC_in,portC_out,ddrC;
|
||||
|
||||
READ8_HANDLER( flstory_68705_portC_r )
|
||||
READ8_HANDLER( flstory_68705_port_c_r )
|
||||
{
|
||||
portC_in = 0;
|
||||
if (main_sent) portC_in |= 0x01;
|
||||
if (!mcu_sent) portC_in |= 0x02;
|
||||
//logerror("%04x: 68705 port C read %02x\n", cpu_get_pc(space->cpu), portC_in);
|
||||
return (portC_out & ddrC) | (portC_in & ~ddrC);
|
||||
flstory_state *state = (flstory_state *)space->machine->driver_data;
|
||||
|
||||
state->port_c_in = 0;
|
||||
if (state->main_sent)
|
||||
state->port_c_in |= 0x01;
|
||||
|
||||
if (!state->mcu_sent)
|
||||
state->port_c_in |= 0x02;
|
||||
|
||||
//logerror("%04x: 68705 port C read %02x\n", cpu_get_pc(space->cpu), port_c_in);
|
||||
return (state->port_c_out & state->ddr_c) | (state->port_c_in & ~state->ddr_c);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( flstory_68705_portC_w )
|
||||
WRITE8_HANDLER( flstory_68705_port_c_w )
|
||||
{
|
||||
logerror("%04x: 68705 port C write %02x\n", cpu_get_pc(space->cpu), data);
|
||||
portC_out = data;
|
||||
flstory_state *state = (flstory_state *)space->machine->driver_data;
|
||||
logerror("%04x: 68705 port C write %02x\n", cpu_get_pc(space->cpu), data);
|
||||
state->port_c_out = data;
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( flstory_68705_ddrC_w )
|
||||
WRITE8_HANDLER( flstory_68705_ddr_c_w )
|
||||
{
|
||||
ddrC = data;
|
||||
flstory_state *state = (flstory_state *)space->machine->driver_data;
|
||||
state->ddr_c = data;
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( flstory_mcu_w )
|
||||
{
|
||||
logerror("%04x: mcu_w %02x\n", cpu_get_pc(space->cpu), data);
|
||||
from_main = data;
|
||||
main_sent = 1;
|
||||
cputag_set_input_line(space->machine, "mcu", 0, ASSERT_LINE);
|
||||
flstory_state *state = (flstory_state *)space->machine->driver_data;
|
||||
|
||||
logerror("%04x: mcu_w %02x\n", cpu_get_pc(space->cpu), data);
|
||||
state->from_main = data;
|
||||
state->main_sent = 1;
|
||||
cpu_set_input_line(state->mcu, 0, ASSERT_LINE);
|
||||
}
|
||||
|
||||
READ8_HANDLER( flstory_mcu_r )
|
||||
{
|
||||
logerror("%04x: mcu_r %02x\n",cpu_get_pc(space->cpu), from_mcu);
|
||||
mcu_sent = 0;
|
||||
return from_mcu;
|
||||
flstory_state *state = (flstory_state *)space->machine->driver_data;
|
||||
|
||||
logerror("%04x: mcu_r %02x\n",cpu_get_pc(space->cpu), state->from_mcu);
|
||||
state->mcu_sent = 0;
|
||||
return state->from_mcu;
|
||||
}
|
||||
|
||||
READ8_HANDLER( flstory_mcu_status_r )
|
||||
{
|
||||
flstory_state *state = (flstory_state *)space->machine->driver_data;
|
||||
int res = 0;
|
||||
|
||||
/* bit 0 = when 1, mcu is ready to receive data from main cpu */
|
||||
/* bit 1 = when 1, mcu has sent data to the main cpu */
|
||||
//logerror("%04x: mcu_status_r\n", cpu_get_pc(space->cpu));
|
||||
if (!main_sent) res |= 0x01;
|
||||
if (mcu_sent) res |= 0x02;
|
||||
//logerror("%04x: mcu_status_r\n", cpu_get_pc(space->cpu));
|
||||
if (!state->main_sent)
|
||||
res |= 0x01;
|
||||
if (state->mcu_sent)
|
||||
res |= 0x02;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( onna34ro_mcu_w )
|
||||
{
|
||||
UINT16 score_adr = onna34ro_workram[0x29e] * 0x100 + onna34ro_workram[0x29d];
|
||||
flstory_state *state = (flstory_state *)space->machine->driver_data;
|
||||
UINT16 score_adr = state->workram[0x29e] * 0x100 + state->workram[0x29d];
|
||||
|
||||
switch (data)
|
||||
{
|
||||
case 0x0e:
|
||||
from_mcu = 0xff;
|
||||
state->from_mcu = 0xff;
|
||||
break;
|
||||
case 0x01:
|
||||
from_mcu = 0x6a;
|
||||
state->from_mcu = 0x6a;
|
||||
break;
|
||||
case 0x40:
|
||||
if(score_adr >= 0xe000 && score_adr < 0xe800)
|
||||
from_mcu = onna34ro_workram[score_adr - 0xe000]; /* score l*/
|
||||
state->from_mcu = state->workram[score_adr - 0xe000]; /* score l*/
|
||||
break;
|
||||
case 0x41:
|
||||
if(score_adr >= 0xe000 && score_adr < 0xe800)
|
||||
from_mcu = onna34ro_workram[(score_adr+1) - 0xe000]; /* score m*/
|
||||
state->from_mcu = state->workram[(score_adr + 1) - 0xe000]; /* score m*/
|
||||
break;
|
||||
case 0x42:
|
||||
if(score_adr >= 0xe000 && score_adr < 0xe800)
|
||||
from_mcu = onna34ro_workram[(score_adr+2) - 0xe000] & 0x0f; /* score h*/
|
||||
state->from_mcu = state->workram[(score_adr + 2) - 0xe000] & 0x0f; /* score h*/
|
||||
break;
|
||||
default:
|
||||
from_mcu = 0x80;
|
||||
state->from_mcu = 0x80;
|
||||
}
|
||||
}
|
||||
|
||||
READ8_HANDLER( onna34ro_mcu_r )
|
||||
{
|
||||
return from_mcu;
|
||||
flstory_state *state = (flstory_state *)space->machine->driver_data;
|
||||
return state->from_mcu;
|
||||
}
|
||||
|
||||
READ8_HANDLER( onna34ro_mcu_status_r )
|
||||
@ -181,7 +196,7 @@ READ8_HANDLER( onna34ro_mcu_status_r )
|
||||
}
|
||||
|
||||
|
||||
#define VICTNINE_MCU_SEED (victnine_workram[0x685])
|
||||
#define VICTNINE_MCU_SEED (state->workram[0x685])
|
||||
|
||||
static const UINT8 victnine_mcu_data[0x100] =
|
||||
{
|
||||
@ -219,15 +234,14 @@ static const UINT8 victnine_mcu_data[0x100] =
|
||||
0x06, 0x07, 0x02, 0x03, 0x15, 0x17, 0x11, 0x13
|
||||
};
|
||||
|
||||
static int mcu_select = 0;
|
||||
|
||||
WRITE8_HANDLER( victnine_mcu_w )
|
||||
{
|
||||
flstory_state *state = (flstory_state *)space->machine->driver_data;
|
||||
UINT8 seed = VICTNINE_MCU_SEED;
|
||||
|
||||
if (!seed && (data & 0x37) == 0x37)
|
||||
{
|
||||
from_mcu = 0xa6;
|
||||
state->from_mcu = 0xa6;
|
||||
logerror("mcu initialize (%02x)\n", data);
|
||||
}
|
||||
else
|
||||
@ -236,19 +250,19 @@ WRITE8_HANDLER( victnine_mcu_w )
|
||||
|
||||
if ((data & ~0x1f) == 0xa0)
|
||||
{
|
||||
mcu_select = data & 0x1f;
|
||||
//logerror("mcu select: 0x%02x\n", mcu_select);
|
||||
state->mcu_select = data & 0x1f;
|
||||
//logerror("mcu select: 0x%02x\n", state->mcu_select);
|
||||
}
|
||||
else if (data < 0x20)
|
||||
{
|
||||
int offset = mcu_select * 8 + data;
|
||||
int offset = state->mcu_select * 8 + data;
|
||||
|
||||
//logerror("mcu fetch: 0x%02x\n", offset);
|
||||
from_mcu = victnine_mcu_data[offset];
|
||||
state->from_mcu = victnine_mcu_data[offset];
|
||||
}
|
||||
else if (data >= 0x38 && data <= 0x3a)
|
||||
{
|
||||
from_mcu = victnine_workram[0x691 - 0x38 + data];
|
||||
state->from_mcu = state->workram[0x691 - 0x38 + data];
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -259,9 +273,10 @@ WRITE8_HANDLER( victnine_mcu_w )
|
||||
|
||||
READ8_HANDLER( victnine_mcu_r )
|
||||
{
|
||||
//logerror("%04x: mcu read (0x%02x)\n", cpu_get_previouspc(space->cpu), from_mcu);
|
||||
flstory_state *state = (flstory_state *)space->machine->driver_data;
|
||||
//logerror("%04x: mcu read (0x%02x)\n", cpu_get_previouspc(space->cpu), state->from_mcu);
|
||||
|
||||
return from_mcu - VICTNINE_MCU_SEED;
|
||||
return state->from_mcu - VICTNINE_MCU_SEED;
|
||||
}
|
||||
|
||||
READ8_HANDLER( victnine_mcu_status_r )
|
||||
|
@ -407,7 +407,7 @@ $(MAMEOBJ)/atari.a: \
|
||||
$(DRIVERS)/eprom.o $(VIDEO)/eprom.o \
|
||||
$(DRIVERS)/firefox.o \
|
||||
$(DRIVERS)/firetrk.o $(AUDIO)/firetrk.o $(VIDEO)/firetrk.o \
|
||||
$(DRIVERS)/flyball.o $(VIDEO)/flyball.o \
|
||||
$(DRIVERS)/flyball.o \
|
||||
$(DRIVERS)/foodf.o $(VIDEO)/foodf.o \
|
||||
$(DRIVERS)/gauntlet.o $(VIDEO)/gauntlet.o \
|
||||
$(DRIVERS)/harddriv.o $(MACHINE)/harddriv.o $(AUDIO)/harddriv.o $(VIDEO)/harddriv.o \
|
||||
|
@ -3,19 +3,17 @@
|
||||
#include "driver.h"
|
||||
#include "includes/fitfight.h"
|
||||
|
||||
static tilemap *fof_bak_tilemap;
|
||||
static tilemap *fof_mid_tilemap;
|
||||
static tilemap *fof_txt_tilemap;
|
||||
|
||||
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int layer )
|
||||
static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int layer )
|
||||
{
|
||||
fitfight_state *state = (fitfight_state *)machine->driver_data;
|
||||
const gfx_element *gfx = machine->gfx[3];
|
||||
UINT16 *source = fitfight_spriteram;
|
||||
UINT16 *finish = source + 0x800/2;
|
||||
UINT16 *source = state->spriteram;
|
||||
UINT16 *finish = source + 0x800 / 2;
|
||||
|
||||
while( source<finish )
|
||||
while (source < finish)
|
||||
{
|
||||
int xpos, ypos, number,xflip,yflip, end, colr, prio;
|
||||
int xpos, ypos, number, xflip, yflip, end, colr, prio;
|
||||
|
||||
ypos = source[0];
|
||||
xpos = source[3];
|
||||
@ -24,137 +22,151 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
yflip = (source[1] & 0x0002);
|
||||
prio = (source[1] & 0x0400) >> 10;
|
||||
colr = (source[1] & 0x00fc) >> 2;
|
||||
if (bbprot_kludge==1) colr = (source[1] & 0x00f8) >> 3;
|
||||
|
||||
if (state->bbprot_kludge == 1)
|
||||
colr = (source[1] & 0x00f8) >> 3;
|
||||
|
||||
end = source[0] & 0x8000;
|
||||
|
||||
ypos = 0xff-ypos;
|
||||
ypos = 0xff - ypos;
|
||||
|
||||
xpos -=38;//48;
|
||||
ypos -=14;//16;
|
||||
xpos -= 38;//48;
|
||||
ypos -= 14;//16;
|
||||
|
||||
if (end) break;
|
||||
if (prio == layer)
|
||||
drawgfx_transpen(bitmap,cliprect,gfx,number,colr,xflip,yflip,xpos,ypos,0);
|
||||
drawgfx_transpen(bitmap, cliprect, gfx, number, colr, xflip, yflip, xpos, ypos, 0);
|
||||
|
||||
source+=4;
|
||||
source += 4;
|
||||
}
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( get_fof_bak_tile_info )
|
||||
{
|
||||
int code = fof_bak_tileram[tile_index*2+1];
|
||||
int colr = fof_bak_tileram[tile_index*2] & 0x1f;
|
||||
int xflip = (fof_bak_tileram[tile_index*2] & 0x0020)>>5;
|
||||
fitfight_state *state = (fitfight_state *)machine->driver_data;
|
||||
int code = state->fof_bak_tileram[tile_index * 2 + 1];
|
||||
int colr = state->fof_bak_tileram[tile_index * 2] & 0x1f;
|
||||
int xflip = (state->fof_bak_tileram[tile_index * 2] & 0x0020) >> 5;
|
||||
xflip ^= 1;
|
||||
|
||||
SET_TILE_INFO(2,code,colr,TILE_FLIPYX(xflip));
|
||||
SET_TILE_INFO(2, code, colr, TILE_FLIPYX(xflip));
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( fof_bak_tileram_w )
|
||||
{
|
||||
COMBINE_DATA(&fof_bak_tileram[offset]);
|
||||
tilemap_mark_tile_dirty(fof_bak_tilemap,offset/2);
|
||||
fitfight_state *state = (fitfight_state *)space->machine->driver_data;
|
||||
|
||||
COMBINE_DATA(&state->fof_bak_tileram[offset]);
|
||||
tilemap_mark_tile_dirty(state->fof_bak_tilemap, offset / 2);
|
||||
}
|
||||
|
||||
|
||||
static TILE_GET_INFO( get_fof_mid_tile_info )
|
||||
{
|
||||
int code = fof_mid_tileram[tile_index*2+1];
|
||||
int colr = fof_mid_tileram[tile_index*2] & 0x1f;
|
||||
int xflip = (fof_mid_tileram[tile_index*2] & 0x0020)>>5;
|
||||
fitfight_state *state = (fitfight_state *)machine->driver_data;
|
||||
int code = state->fof_mid_tileram[tile_index * 2 + 1];
|
||||
int colr = state->fof_mid_tileram[tile_index * 2] & 0x1f;
|
||||
int xflip = (state->fof_mid_tileram[tile_index * 2] & 0x0020) >> 5;
|
||||
xflip ^= 1;
|
||||
|
||||
SET_TILE_INFO(1,code,colr,TILE_FLIPYX(xflip));
|
||||
SET_TILE_INFO(1, code, colr, TILE_FLIPYX(xflip));
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( fof_mid_tileram_w )
|
||||
{
|
||||
COMBINE_DATA(&fof_mid_tileram[offset]);
|
||||
fitfight_state *state = (fitfight_state *)space->machine->driver_data;
|
||||
|
||||
tilemap_mark_tile_dirty(fof_mid_tilemap,offset/2);
|
||||
COMBINE_DATA(&state->fof_mid_tileram[offset]);
|
||||
tilemap_mark_tile_dirty(state->fof_mid_tilemap, offset / 2);
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( get_fof_txt_tile_info )
|
||||
{
|
||||
int code = fof_txt_tileram[tile_index*2+1];
|
||||
int colr = fof_txt_tileram[tile_index*2] & 0x1f;
|
||||
int xflip = (fof_txt_tileram[tile_index*2] & 0x0020)>>5;
|
||||
fitfight_state *state = (fitfight_state *)machine->driver_data;
|
||||
int code = state->fof_txt_tileram[tile_index * 2 + 1];
|
||||
int colr = state->fof_txt_tileram[tile_index * 2] & 0x1f;
|
||||
int xflip = (state->fof_txt_tileram[tile_index * 2] & 0x0020) >> 5;
|
||||
xflip ^= 1;
|
||||
|
||||
SET_TILE_INFO(0,code,colr,TILE_FLIPYX(xflip));
|
||||
SET_TILE_INFO(0, code, colr, TILE_FLIPYX(xflip));
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( fof_txt_tileram_w )
|
||||
{
|
||||
COMBINE_DATA(&fof_txt_tileram[offset]);
|
||||
tilemap_mark_tile_dirty(fof_txt_tilemap,offset/2);
|
||||
fitfight_state *state = (fitfight_state *)space->machine->driver_data;
|
||||
|
||||
COMBINE_DATA(&state->fof_txt_tileram[offset]);
|
||||
tilemap_mark_tile_dirty(state->fof_txt_tilemap, offset / 2);
|
||||
}
|
||||
|
||||
/* video start / update */
|
||||
|
||||
VIDEO_START(fitfight)
|
||||
{
|
||||
fof_bak_tilemap = tilemap_create(machine, get_fof_bak_tile_info,tilemap_scan_cols,8,8,128, 32);
|
||||
fitfight_state *state = (fitfight_state *)machine->driver_data;
|
||||
state->fof_bak_tilemap = tilemap_create(machine, get_fof_bak_tile_info, tilemap_scan_cols, 8, 8, 128, 32);
|
||||
/* opaque */
|
||||
|
||||
fof_mid_tilemap = tilemap_create(machine, get_fof_mid_tile_info,tilemap_scan_cols,8,8,128, 32);
|
||||
tilemap_set_transparent_pen(fof_mid_tilemap,0);
|
||||
state->fof_mid_tilemap = tilemap_create(machine, get_fof_mid_tile_info, tilemap_scan_cols, 8, 8, 128, 32);
|
||||
tilemap_set_transparent_pen(state->fof_mid_tilemap, 0);
|
||||
|
||||
fof_txt_tilemap = tilemap_create(machine, get_fof_txt_tile_info,tilemap_scan_cols,8,8,128, 32);
|
||||
tilemap_set_transparent_pen(fof_txt_tilemap,0);
|
||||
state->fof_txt_tilemap = tilemap_create(machine, get_fof_txt_tile_info, tilemap_scan_cols, 8, 8, 128, 32);
|
||||
tilemap_set_transparent_pen(state->fof_txt_tilemap, 0);
|
||||
}
|
||||
|
||||
VIDEO_UPDATE(fitfight)
|
||||
{
|
||||
fitfight_state *state = (fitfight_state *)screen->machine->driver_data;
|
||||
|
||||
/* scroll isn't right */
|
||||
|
||||
int vblank;
|
||||
int scrollbak,scrollmid;
|
||||
int scrollbak, scrollmid;
|
||||
|
||||
vblank = (fof_700000[0] & 0x8000);
|
||||
vblank = (state->fof_700000[0] & 0x8000);
|
||||
|
||||
if (vblank > 0)
|
||||
bitmap_fill(bitmap, cliprect, get_black_pen(screen->machine));
|
||||
else {
|
||||
// if (input_code_pressed(screen->machine, KEYCODE_Q))
|
||||
// scrollbak = ((fof_a00000[0]&0xff00) >> 5) - ((fof_700000[0] & 0x0038) >> 3);
|
||||
// scrollbak = ((state->fof_a00000[0] & 0xff00) >> 5) - ((state->fof_700000[0] & 0x0038) >> 3);
|
||||
// else if (input_code_pressed(screen->machine, KEYCODE_W))
|
||||
// scrollbak = ((fof_a00000[0]&0xff00) >> 5) + ((fof_700000[0] & 0x01c0) >> 6);
|
||||
// scrollbak = ((state->fof_a00000[0] & 0xff00) >> 5) + ((state->fof_700000[0] & 0x01c0) >> 6);
|
||||
// else if (input_code_pressed(screen->machine, KEYCODE_E))
|
||||
// scrollbak = ((fof_a00000[0]&0xff00) >> 5) - ((fof_700000[0] & 0x01c0) >> 6);
|
||||
// scrollbak = ((state->fof_a00000[0] & 0xff00) >> 5) - ((state->fof_700000[0] & 0x01c0) >> 6);
|
||||
// else if (input_code_pressed(screen->machine, KEYCODE_R))
|
||||
// scrollbak = ((fof_a00000[0]&0xff00) >> 5) + ((fof_700000[0] & 0x0038) >> 3);
|
||||
// scrollbak = ((state->fof_a00000[0] & 0xff00) >> 5) + ((state->fof_700000[0] & 0x0038) >> 3);
|
||||
// else
|
||||
scrollbak = ((fof_a00000[0]&0xff00) >> 5);
|
||||
tilemap_set_scrollx(fof_bak_tilemap,0, scrollbak );
|
||||
tilemap_set_scrolly(fof_bak_tilemap,0, fof_a00000[0]&0xff);
|
||||
tilemap_draw(bitmap,cliprect,fof_bak_tilemap,0,0);
|
||||
scrollbak = ((state->fof_a00000[0] & 0xff00) >> 5);
|
||||
tilemap_set_scrollx(state->fof_bak_tilemap,0, scrollbak );
|
||||
tilemap_set_scrolly(state->fof_bak_tilemap,0, state->fof_a00000[0] & 0xff);
|
||||
tilemap_draw(bitmap, cliprect, state->fof_bak_tilemap, 0, 0);
|
||||
|
||||
draw_sprites(screen->machine,bitmap,cliprect,0);
|
||||
draw_sprites(screen->machine, bitmap, cliprect, 0);
|
||||
|
||||
// if (input_code_pressed(screen->machine, KEYCODE_A))
|
||||
// scrollmid = ((fof_900000[0]&0xff00) >> 5) - ((fof_700000[0] & 0x01c0) >> 6);
|
||||
// scrollmid = ((state->fof_900000[0] & 0xff00) >> 5) - ((state->fof_700000[0] & 0x01c0) >> 6);
|
||||
// else if (input_code_pressed(screen->machine, KEYCODE_S))
|
||||
// scrollmid = ((fof_900000[0]&0xff00) >> 5) + ((fof_700000[0] & 0x0038) >> 3);
|
||||
// scrollmid = ((state->fof_900000[0] & 0xff00) >> 5) + ((state->fof_700000[0] & 0x0038) >> 3);
|
||||
// else if (input_code_pressed(screen->machine, KEYCODE_D))
|
||||
// scrollmid = ((fof_900000[0]&0xff00) >> 5) - ((fof_700000[0] & 0x0038) >> 3);
|
||||
// scrollmid = ((state->fof_900000[0] & 0xff00) >> 5) - ((state->fof_700000[0] & 0x0038) >> 3);
|
||||
// else if (input_code_pressed(screen->machine, KEYCODE_F))
|
||||
// scrollmid = ((fof_900000[0]&0xff00) >> 5) + ((fof_700000[0] & 0x01c0) >> 6);
|
||||
// scrollmid = ((state->fof_900000[0] & 0xff00) >> 5) + ((state->fof_700000[0] & 0x01c0) >> 6);
|
||||
// else
|
||||
scrollmid = ((fof_900000[0]&0xff00) >> 5);
|
||||
tilemap_set_scrollx(fof_mid_tilemap,0, scrollmid );
|
||||
tilemap_set_scrolly(fof_mid_tilemap,0, fof_900000[0]&0xff);
|
||||
scrollmid = ((state->fof_900000[0] & 0xff00) >> 5);
|
||||
tilemap_set_scrollx(state->fof_mid_tilemap, 0, scrollmid );
|
||||
tilemap_set_scrolly(state->fof_mid_tilemap, 0, state->fof_900000[0] & 0xff);
|
||||
// if (!input_code_pressed(screen->machine, KEYCODE_F))
|
||||
tilemap_draw(bitmap,cliprect,fof_mid_tilemap,0,0);
|
||||
tilemap_draw(bitmap, cliprect, state->fof_mid_tilemap, 0, 0);
|
||||
|
||||
draw_sprites(screen->machine,bitmap,cliprect,1);
|
||||
draw_sprites(screen->machine, bitmap, cliprect, 1);
|
||||
|
||||
tilemap_draw(bitmap,cliprect,fof_txt_tilemap,0,0);
|
||||
tilemap_draw(bitmap, cliprect, state->fof_txt_tilemap, 0, 0);
|
||||
}
|
||||
/* popmessage ("Regs %04x %04x %04x %04x %04x %04x",
|
||||
fof_100000[0], fof_600000[0], fof_700000[0],
|
||||
fof_800000[0], fof_900000[0],
|
||||
fof_a00000[0] );
|
||||
state->fof_100000[0], state->fof_600000[0], state->fof_700000[0],
|
||||
state->fof_800000[0], state->fof_900000[0],
|
||||
state->fof_a00000[0] );
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
@ -5,21 +5,16 @@
|
||||
Functions to emulate the video hardware of the machine.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "driver.h"
|
||||
#include "includes/flstory.h"
|
||||
|
||||
|
||||
static tilemap *bg_tilemap;
|
||||
static int char_bank,palette_bank,flipscreen,gfxctrl;
|
||||
|
||||
UINT8 *flstory_scrlram;
|
||||
|
||||
|
||||
static TILE_GET_INFO( get_tile_info )
|
||||
{
|
||||
int code = videoram[tile_index*2];
|
||||
int attr = videoram[tile_index*2+1];
|
||||
int tile_number = code + ((attr & 0xc0) << 2) + 0x400 + 0x800 * char_bank;
|
||||
flstory_state *state = (flstory_state *)machine->driver_data;
|
||||
int code = state->videoram[tile_index * 2];
|
||||
int attr = state->videoram[tile_index * 2 + 1];
|
||||
int tile_number = code + ((attr & 0xc0) << 2) + 0x400 + 0x800 * state->char_bank;
|
||||
int flags = TILE_FLIPYX((attr & 0x18) >> 3);
|
||||
tileinfo->category = (attr & 0x20) >> 5;
|
||||
tileinfo->group = (attr & 0x20) >> 5;
|
||||
@ -32,8 +27,9 @@ static TILE_GET_INFO( get_tile_info )
|
||||
|
||||
static TILE_GET_INFO( victnine_get_tile_info )
|
||||
{
|
||||
int code = videoram[tile_index*2];
|
||||
int attr = videoram[tile_index*2+1];
|
||||
flstory_state *state = (flstory_state *)machine->driver_data;
|
||||
int code = state->videoram[tile_index * 2];
|
||||
int attr = state->videoram[tile_index * 2 + 1];
|
||||
int tile_number = ((attr & 0x38) << 5) + code;
|
||||
int flags = ((attr & 0x40) ? TILE_FLIPX : 0) | ((attr & 0x80) ? TILE_FLIPY : 0);
|
||||
|
||||
@ -47,115 +43,129 @@ static TILE_GET_INFO( victnine_get_tile_info )
|
||||
|
||||
VIDEO_START( flstory )
|
||||
{
|
||||
bg_tilemap = tilemap_create( machine, get_tile_info,tilemap_scan_rows,8,8,32,32 );
|
||||
// tilemap_set_transparent_pen( bg_tilemap,15 );
|
||||
tilemap_set_transmask(bg_tilemap,0,0x3fff,0xc000); /* split type 0 has pens 0-13 transparent in front half */
|
||||
tilemap_set_transmask(bg_tilemap,1,0x8000,0x7fff); /* split type 1 has pen 15 transparent in front half */
|
||||
tilemap_set_scroll_cols(bg_tilemap,32);
|
||||
flstory_state *state = (flstory_state *)machine->driver_data;
|
||||
state->bg_tilemap = tilemap_create(machine, get_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
// tilemap_set_transparent_pen(state->bg_tilemap, 15);
|
||||
tilemap_set_transmask(state->bg_tilemap, 0, 0x3fff, 0xc000); /* split type 0 has pens 0-13 transparent in front half */
|
||||
tilemap_set_transmask(state->bg_tilemap, 1, 0x8000, 0x7fff); /* split type 1 has pen 15 transparent in front half */
|
||||
tilemap_set_scroll_cols(state->bg_tilemap, 32);
|
||||
|
||||
paletteram = auto_alloc_array(machine, UINT8, 0x200);
|
||||
paletteram_2 = auto_alloc_array(machine, UINT8, 0x200);
|
||||
state_save_register_global_pointer(machine, paletteram, 0x200);
|
||||
state_save_register_global_pointer(machine, paletteram_2, 0x200);
|
||||
}
|
||||
|
||||
VIDEO_START( victnine )
|
||||
{
|
||||
bg_tilemap = tilemap_create( machine, victnine_get_tile_info,tilemap_scan_rows,8,8,32,32 );
|
||||
tilemap_set_scroll_cols(bg_tilemap,32);
|
||||
flstory_state *state = (flstory_state *)machine->driver_data;
|
||||
state->bg_tilemap = tilemap_create(machine, victnine_get_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
tilemap_set_scroll_cols(state->bg_tilemap, 32);
|
||||
|
||||
paletteram = auto_alloc_array(machine, UINT8, 0x200);
|
||||
paletteram_2 = auto_alloc_array(machine, UINT8, 0x200);
|
||||
state_save_register_global_pointer(machine, paletteram, 0x200);
|
||||
state_save_register_global_pointer(machine, paletteram_2, 0x200);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( flstory_videoram_w )
|
||||
{
|
||||
videoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(bg_tilemap,offset/2);
|
||||
flstory_state *state = (flstory_state *)space->machine->driver_data;
|
||||
state->videoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset / 2);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( flstory_palette_w )
|
||||
{
|
||||
flstory_state *state = (flstory_state *)space->machine->driver_data;
|
||||
if (offset & 0x100)
|
||||
paletteram_xxxxBBBBGGGGRRRR_split2_w(space, (offset & 0xff) + (palette_bank << 8),data);
|
||||
paletteram_xxxxBBBBGGGGRRRR_split2_w(space, (offset & 0xff) + (state->palette_bank << 8),data);
|
||||
else
|
||||
paletteram_xxxxBBBBGGGGRRRR_split1_w(space, (offset & 0xff) + (palette_bank << 8),data);
|
||||
paletteram_xxxxBBBBGGGGRRRR_split1_w(space, (offset & 0xff) + (state->palette_bank << 8),data);
|
||||
}
|
||||
|
||||
READ8_HANDLER( flstory_palette_r )
|
||||
{
|
||||
flstory_state *state = (flstory_state *)space->machine->driver_data;
|
||||
if (offset & 0x100)
|
||||
return paletteram_2[ (offset & 0xff) + (palette_bank << 8) ];
|
||||
return paletteram_2[ (offset & 0xff) + (state->palette_bank << 8) ];
|
||||
else
|
||||
return paletteram [ (offset & 0xff) + (palette_bank << 8) ];
|
||||
return paletteram [ (offset & 0xff) + (state->palette_bank << 8) ];
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( flstory_gfxctrl_w )
|
||||
{
|
||||
if (gfxctrl == data)
|
||||
flstory_state *state = (flstory_state *)space->machine->driver_data;
|
||||
if (state->gfxctrl == data)
|
||||
return;
|
||||
gfxctrl = data;
|
||||
state->gfxctrl = data;
|
||||
|
||||
flipscreen = (~data & 0x01);
|
||||
if (char_bank != ((data & 0x10) >> 4))
|
||||
state->flipscreen = (~data & 0x01);
|
||||
if (state->char_bank != ((data & 0x10) >> 4))
|
||||
{
|
||||
char_bank = (data & 0x10) >> 4;
|
||||
tilemap_mark_all_tiles_dirty(bg_tilemap);
|
||||
state->char_bank = (data & 0x10) >> 4;
|
||||
tilemap_mark_all_tiles_dirty(state->bg_tilemap);
|
||||
}
|
||||
palette_bank = (data & 0x20) >> 5;
|
||||
state->palette_bank = (data & 0x20) >> 5;
|
||||
|
||||
flip_screen_set(space->machine, flipscreen);
|
||||
flip_screen_set(space->machine, state->flipscreen);
|
||||
|
||||
//popmessage("%04x: gfxctrl = %02x\n",cpu_get_pc(space->cpu),data);
|
||||
//popmessage("%04x: gfxctrl = %02x\n", cpu_get_pc(space->cpu), data);
|
||||
|
||||
}
|
||||
|
||||
READ8_HANDLER( victnine_gfxctrl_r )
|
||||
{
|
||||
return gfxctrl;
|
||||
flstory_state *state = (flstory_state *)space->machine->driver_data;
|
||||
return state->gfxctrl;
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( victnine_gfxctrl_w )
|
||||
{
|
||||
if (gfxctrl == data)
|
||||
flstory_state *state = (flstory_state *)space->machine->driver_data;
|
||||
if (state->gfxctrl == data)
|
||||
return;
|
||||
gfxctrl = data;
|
||||
state->gfxctrl = data;
|
||||
|
||||
palette_bank = (data & 0x20) >> 5;
|
||||
state->palette_bank = (data & 0x20) >> 5;
|
||||
|
||||
if (data & 0x04)
|
||||
{
|
||||
flipscreen = (data & 0x01);
|
||||
flip_screen_set(space->machine, flipscreen);
|
||||
state->flipscreen = (data & 0x01);
|
||||
flip_screen_set(space->machine, state->flipscreen);
|
||||
}
|
||||
|
||||
//popmessage("%04x: gfxctrl = %02x\n",cpu_get_pc(space->cpu),data);
|
||||
//popmessage("%04x: gfxctrl = %02x\n", cpu_get_pc(space->cpu), data);
|
||||
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( flstory_scrlram_w )
|
||||
{
|
||||
flstory_scrlram[offset] = data;
|
||||
tilemap_set_scrolly(bg_tilemap, offset, data );
|
||||
flstory_state *state = (flstory_state *)space->machine->driver_data;
|
||||
state->scrlram[offset] = data;
|
||||
tilemap_set_scrolly(state->bg_tilemap, offset, data);
|
||||
}
|
||||
|
||||
|
||||
static void flstory_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int pri)
|
||||
static void flstory_draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int pri )
|
||||
{
|
||||
flstory_state *state = (flstory_state *)machine->driver_data;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 0x20; i++)
|
||||
{
|
||||
int pr = spriteram[spriteram_size-1 -i];
|
||||
int pr = state->spriteram[spriteram_size - 1 - i];
|
||||
int offs = (pr & 0x1f) * 4;
|
||||
|
||||
if ((pr & 0x80) == pri)
|
||||
{
|
||||
int code,sx,sy,flipx,flipy;
|
||||
int code, sx, sy, flipx, flipy;
|
||||
|
||||
code = spriteram[offs+2] + ((spriteram[offs+1] & 0x30) << 4);
|
||||
sx = spriteram[offs+3];
|
||||
sy = spriteram[offs+0];
|
||||
code = state->spriteram[offs + 2] + ((state->spriteram[offs + 1] & 0x30) << 4);
|
||||
sx = state->spriteram[offs + 3];
|
||||
sy = state->spriteram[offs + 0];
|
||||
|
||||
if (flipscreen)
|
||||
if (state->flipscreen)
|
||||
{
|
||||
sx = (240 - sx) & 0xff ;
|
||||
sy = sy - 1 ;
|
||||
@ -163,19 +173,19 @@ static void flstory_draw_sprites(running_machine *machine, bitmap_t *bitmap, con
|
||||
else
|
||||
sy = 240 - sy - 1 ;
|
||||
|
||||
flipx = ((spriteram[offs+1]&0x40)>>6)^flipscreen;
|
||||
flipy = ((spriteram[offs+1]&0x80)>>7)^flipscreen;
|
||||
flipx = ((state->spriteram[offs + 1] & 0x40) >> 6) ^ state->flipscreen;
|
||||
flipy = ((state->spriteram[offs + 1] & 0x80) >> 7) ^ state->flipscreen;
|
||||
|
||||
drawgfx_transpen(bitmap,cliprect,machine->gfx[1],
|
||||
code,
|
||||
spriteram[offs+1] & 0x0f,
|
||||
state->spriteram[offs + 1] & 0x0f,
|
||||
flipx,flipy,
|
||||
sx,sy,15);
|
||||
/* wrap around */
|
||||
if (sx > 240)
|
||||
drawgfx_transpen(bitmap,cliprect,machine->gfx[1],
|
||||
code,
|
||||
spriteram[offs+1] & 0x0f,
|
||||
state->spriteram[offs + 1] & 0x0f,
|
||||
flipx,flipy,
|
||||
sx-256,sy,15);
|
||||
}
|
||||
@ -184,33 +194,35 @@ static void flstory_draw_sprites(running_machine *machine, bitmap_t *bitmap, con
|
||||
|
||||
VIDEO_UPDATE( flstory )
|
||||
{
|
||||
tilemap_draw(bitmap,cliprect,bg_tilemap,0|TILEMAP_DRAW_LAYER1,0);
|
||||
tilemap_draw(bitmap,cliprect,bg_tilemap,1|TILEMAP_DRAW_LAYER1,0);
|
||||
flstory_draw_sprites(screen->machine,bitmap,cliprect,0x00);
|
||||
tilemap_draw(bitmap,cliprect,bg_tilemap,0|TILEMAP_DRAW_LAYER0,0);
|
||||
flstory_draw_sprites(screen->machine,bitmap,cliprect,0x80);
|
||||
tilemap_draw(bitmap,cliprect,bg_tilemap,1|TILEMAP_DRAW_LAYER0,0);
|
||||
flstory_state *state = (flstory_state *)screen->machine->driver_data;
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0 | TILEMAP_DRAW_LAYER1, 0);
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 1 | TILEMAP_DRAW_LAYER1, 0);
|
||||
flstory_draw_sprites(screen->machine, bitmap, cliprect, 0x00);
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0 | TILEMAP_DRAW_LAYER0, 0);
|
||||
flstory_draw_sprites(screen->machine, bitmap, cliprect, 0x80);
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 1 | TILEMAP_DRAW_LAYER0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void victnine_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
|
||||
static void victnine_draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
{
|
||||
flstory_state *state = (flstory_state *)machine->driver_data;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 0x20; i++)
|
||||
{
|
||||
int pr = spriteram[spriteram_size-1 -i];
|
||||
int pr = state->spriteram[spriteram_size - 1 - i];
|
||||
int offs = (pr & 0x1f) * 4;
|
||||
|
||||
//if ((pr & 0x80) == pri)
|
||||
{
|
||||
int code,sx,sy,flipx,flipy;
|
||||
int code, sx, sy, flipx, flipy;
|
||||
|
||||
code = spriteram[offs+2] + ((spriteram[offs+1] & 0x20) << 3);
|
||||
sx = spriteram[offs+3];
|
||||
sy = spriteram[offs+0];
|
||||
code = state->spriteram[offs + 2] + ((state->spriteram[offs + 1] & 0x20) << 3);
|
||||
sx = state->spriteram[offs + 3];
|
||||
sy = state->spriteram[offs + 0];
|
||||
|
||||
if (flipscreen)
|
||||
if (state->flipscreen)
|
||||
{
|
||||
sx = (240 - sx + 1) & 0xff ;
|
||||
sy = sy + 1 ;
|
||||
@ -218,19 +230,19 @@ static void victnine_draw_sprites(running_machine *machine, bitmap_t *bitmap, co
|
||||
else
|
||||
sy = 240 - sy + 1 ;
|
||||
|
||||
flipx = ((spriteram[offs+1]&0x40)>>6)^flipscreen;
|
||||
flipy = ((spriteram[offs+1]&0x80)>>7)^flipscreen;
|
||||
flipx = ((state->spriteram[offs + 1] & 0x40) >> 6) ^ state->flipscreen;
|
||||
flipy = ((state->spriteram[offs + 1] & 0x80) >> 7) ^ state->flipscreen;
|
||||
|
||||
drawgfx_transpen(bitmap,cliprect,machine->gfx[1],
|
||||
code,
|
||||
spriteram[offs+1] & 0x0f,
|
||||
state->spriteram[offs + 1] & 0x0f,
|
||||
flipx,flipy,
|
||||
sx,sy,15);
|
||||
/* wrap around */
|
||||
if (sx > 240)
|
||||
drawgfx_transpen(bitmap,cliprect,machine->gfx[1],
|
||||
code,
|
||||
spriteram[offs+1] & 0x0f,
|
||||
state->spriteram[offs + 1] & 0x0f,
|
||||
flipx,flipy,
|
||||
sx-256,sy,15);
|
||||
}
|
||||
@ -239,7 +251,8 @@ static void victnine_draw_sprites(running_machine *machine, bitmap_t *bitmap, co
|
||||
|
||||
VIDEO_UPDATE( victnine )
|
||||
{
|
||||
tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
|
||||
victnine_draw_sprites(screen->machine,bitmap,cliprect);
|
||||
flstory_state *state = (flstory_state *)screen->machine->driver_data;
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
|
||||
victnine_draw_sprites(screen->machine, bitmap, cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,89 +0,0 @@
|
||||
/***************************************************************************
|
||||
|
||||
Atari Flyball video emulation
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "driver.h"
|
||||
|
||||
static tilemap* flyball_tilemap;
|
||||
|
||||
UINT8 flyball_pitcher_vert;
|
||||
UINT8 flyball_pitcher_horz;
|
||||
UINT8 flyball_pitcher_pic;
|
||||
UINT8 flyball_ball_vert;
|
||||
UINT8 flyball_ball_horz;
|
||||
|
||||
UINT8* flyball_playfield_ram;
|
||||
|
||||
|
||||
static TILEMAP_MAPPER( flyball_get_memory_offset )
|
||||
{
|
||||
if (col == 0)
|
||||
{
|
||||
col = num_cols;
|
||||
}
|
||||
|
||||
return num_cols * (num_rows - row) - col;
|
||||
}
|
||||
|
||||
|
||||
static TILE_GET_INFO( flyball_get_tile_info )
|
||||
{
|
||||
UINT8 data = flyball_playfield_ram[tile_index];
|
||||
|
||||
int flags =
|
||||
((data & 0x40) ? TILE_FLIPX : 0) |
|
||||
((data & 0x80) ? TILE_FLIPY : 0);
|
||||
|
||||
int code = data & 63;
|
||||
|
||||
if ((flags & TILE_FLIPX) && (flags & TILE_FLIPY))
|
||||
{
|
||||
code += 64;
|
||||
}
|
||||
|
||||
SET_TILE_INFO(0, code, 0, flags);
|
||||
}
|
||||
|
||||
|
||||
VIDEO_START( flyball )
|
||||
{
|
||||
flyball_tilemap = tilemap_create(machine, flyball_get_tile_info,
|
||||
flyball_get_memory_offset, 8, 16, 32, 16);
|
||||
}
|
||||
|
||||
|
||||
VIDEO_UPDATE( flyball )
|
||||
{
|
||||
int pitcherx = flyball_pitcher_horz;
|
||||
int pitchery = flyball_pitcher_vert - 31;
|
||||
|
||||
int ballx = flyball_ball_horz - 1;
|
||||
int bally = flyball_ball_vert - 17;
|
||||
|
||||
int x;
|
||||
int y;
|
||||
|
||||
tilemap_mark_all_tiles_dirty(flyball_tilemap);
|
||||
|
||||
/* draw playfield */
|
||||
|
||||
tilemap_draw(bitmap, cliprect, flyball_tilemap, 0, 0);
|
||||
|
||||
/* draw pitcher */
|
||||
|
||||
drawgfx_transpen(bitmap, cliprect, screen->machine->gfx[1], flyball_pitcher_pic ^ 0xf,
|
||||
0, 1, 0, pitcherx, pitchery, 1);
|
||||
|
||||
/* draw ball */
|
||||
|
||||
for (y = bally; y < bally + 2; y++)
|
||||
for (x = ballx; x < ballx + 2; x++)
|
||||
if (x >= cliprect->min_x &&
|
||||
x <= cliprect->max_x &&
|
||||
y >= cliprect->min_y &&
|
||||
y <= cliprect->max_y)
|
||||
*BITMAP_ADDR16(bitmap, y, x) = 1;
|
||||
return 0;
|
||||
}
|
@ -7,19 +7,16 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "driver.h"
|
||||
|
||||
static int gfx_bank;
|
||||
static tilemap *bg_tilemap;
|
||||
#include "funkybee.h"
|
||||
|
||||
PALETTE_INIT( funkybee )
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
/* first, the character/sprite palette */
|
||||
for (i = 0;i < 32;i++)
|
||||
for (i = 0; i < 32; i++)
|
||||
{
|
||||
int bit0,bit1,bit2,r,g,b;
|
||||
int bit0, bit1, bit2, r, g, b;
|
||||
|
||||
/* red component */
|
||||
bit0 = (*color_prom >> 0) & 0x01;
|
||||
@ -37,35 +34,39 @@ PALETTE_INIT( funkybee )
|
||||
bit2 = (*color_prom >> 7) & 0x01;
|
||||
b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
|
||||
|
||||
palette_set_color(machine,i,MAKE_RGB(r,g,b));
|
||||
palette_set_color(machine, i, MAKE_RGB(r,g,b));
|
||||
color_prom++;
|
||||
}
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( funkybee_videoram_w )
|
||||
{
|
||||
videoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(bg_tilemap, offset);
|
||||
funkybee_state *state = (funkybee_state *)space->machine->driver_data;
|
||||
state->videoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( funkybee_colorram_w )
|
||||
{
|
||||
colorram[offset] = data;
|
||||
tilemap_mark_tile_dirty(bg_tilemap, offset);
|
||||
funkybee_state *state = (funkybee_state *)space->machine->driver_data;
|
||||
state->colorram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( funkybee_gfx_bank_w )
|
||||
{
|
||||
if (gfx_bank != (data & 0x01))
|
||||
funkybee_state *state = (funkybee_state *)space->machine->driver_data;
|
||||
if (state->gfx_bank != (data & 0x01))
|
||||
{
|
||||
gfx_bank = data & 0x01;
|
||||
state->gfx_bank = data & 0x01;
|
||||
tilemap_mark_all_tiles_dirty_all(space->machine);
|
||||
}
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( funkybee_scroll_w )
|
||||
{
|
||||
tilemap_set_scrollx(bg_tilemap, 0, flip_screen_get(space->machine) ? -data : data);
|
||||
funkybee_state *state = (funkybee_state *)space->machine->driver_data;
|
||||
tilemap_set_scrollx(state->bg_tilemap, 0, flip_screen_get(space->machine) ? -data : data);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( funkybee_flipscreen_w )
|
||||
@ -75,10 +76,11 @@ WRITE8_HANDLER( funkybee_flipscreen_w )
|
||||
|
||||
static TILE_GET_INFO( get_bg_tile_info )
|
||||
{
|
||||
int code = videoram[tile_index] + ((colorram[tile_index] & 0x80) << 1);
|
||||
int color = colorram[tile_index] & 0x03;
|
||||
funkybee_state *state = (funkybee_state *)machine->driver_data;
|
||||
int code = state->videoram[tile_index] + ((state->colorram[tile_index] & 0x80) << 1);
|
||||
int color = state->colorram[tile_index] & 0x03;
|
||||
|
||||
SET_TILE_INFO(gfx_bank, code, color, 0);
|
||||
SET_TILE_INFO(state->gfx_bank, code, color, 0);
|
||||
}
|
||||
|
||||
static TILEMAP_MAPPER( funkybee_tilemap_scan )
|
||||
@ -89,23 +91,25 @@ static TILEMAP_MAPPER( funkybee_tilemap_scan )
|
||||
|
||||
VIDEO_START( funkybee )
|
||||
{
|
||||
bg_tilemap = tilemap_create(machine, get_bg_tile_info, funkybee_tilemap_scan, 8, 8, 32, 32);
|
||||
funkybee_state *state = (funkybee_state *)machine->driver_data;
|
||||
state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, funkybee_tilemap_scan, 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 )
|
||||
{
|
||||
funkybee_state *state = (funkybee_state *)machine->driver_data;
|
||||
int offs;
|
||||
|
||||
for (offs = 0x0f; offs >= 0; offs--)
|
||||
{
|
||||
int offs2 = offs + 0x1e00;
|
||||
int attr = videoram[offs2];
|
||||
int attr = state->videoram[offs2];
|
||||
int code = (attr >> 2) | ((attr & 2) << 5);
|
||||
int color = colorram[offs2 + 0x10];
|
||||
int color = state->colorram[offs2 + 0x10];
|
||||
int flipx = 0;
|
||||
int flipy = attr & 0x01;
|
||||
int sx = videoram[offs2 + 0x10];
|
||||
int sy = 224 - colorram[offs2];
|
||||
int sx = state->videoram[offs2 + 0x10];
|
||||
int sy = 224 - state->colorram[offs2];
|
||||
|
||||
if (flip_screen_get(machine))
|
||||
{
|
||||
@ -113,42 +117,43 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
flipx = !flipx;
|
||||
}
|
||||
|
||||
drawgfx_transpen(bitmap,cliprect, machine->gfx[2+gfx_bank],
|
||||
drawgfx_transpen(bitmap,cliprect, machine->gfx[2 + state->gfx_bank],
|
||||
code, color,
|
||||
flipx, flipy,
|
||||
sx, sy, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void draw_columns(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
|
||||
static void draw_columns( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect )
|
||||
{
|
||||
funkybee_state *state = (funkybee_state *)machine->driver_data;
|
||||
int offs;
|
||||
|
||||
for (offs = 0x1f;offs >= 0;offs--)
|
||||
for (offs = 0x1f; offs >= 0; offs--)
|
||||
{
|
||||
int const flip = flip_screen_get(machine);
|
||||
int code = videoram[0x1c00 + offs];
|
||||
int color = colorram[0x1f10] & 0x03;
|
||||
int sx = flip ? videoram[0x1f1f] : videoram[0x1f10];
|
||||
int code = state->videoram[0x1c00 + offs];
|
||||
int color = state->colorram[0x1f10] & 0x03;
|
||||
int sx = flip ? state->videoram[0x1f1f] : state->videoram[0x1f10];
|
||||
int sy = offs * 8;
|
||||
|
||||
if (flip)
|
||||
sy = 248 - sy;
|
||||
|
||||
drawgfx_transpen(bitmap,cliprect,machine->gfx[gfx_bank],
|
||||
drawgfx_transpen(bitmap,cliprect,machine->gfx[state->gfx_bank],
|
||||
code, color,
|
||||
flip, flip,
|
||||
sx, sy,0);
|
||||
|
||||
code = videoram[0x1d00 + offs];
|
||||
color = colorram[0x1f11] & 0x03;
|
||||
sx = flip ? videoram[0x1f1e] : videoram[0x1f11];
|
||||
code = state->videoram[0x1d00 + offs];
|
||||
color = state->colorram[0x1f11] & 0x03;
|
||||
sx = flip ? state->videoram[0x1f1e] : state->videoram[0x1f11];
|
||||
sy = offs * 8;
|
||||
|
||||
if (flip)
|
||||
sy = 248 - sy;
|
||||
|
||||
drawgfx_transpen(bitmap,cliprect,machine->gfx[gfx_bank],
|
||||
drawgfx_transpen(bitmap,cliprect,machine->gfx[state->gfx_bank],
|
||||
code, color,
|
||||
flip, flip,
|
||||
sx, sy,0);
|
||||
@ -157,7 +162,8 @@ static void draw_columns(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
|
||||
VIDEO_UPDATE( funkybee )
|
||||
{
|
||||
tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
|
||||
funkybee_state *state = (funkybee_state *)screen->machine->driver_data;
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
draw_columns(screen->machine, bitmap, cliprect);
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user