mirror of
https://github.com/holub/mame
synced 2025-05-25 23:35:26 +03:00
Added driver data struct and save state support to pandoras.c
This commit is contained in:
parent
0ce54a4eda
commit
112a759ceb
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -2507,6 +2507,7 @@ src/mame/includes/offtwall.h svneol=native#text/plain
|
|||||||
src/mame/includes/oneshot.h svneol=native#text/plain
|
src/mame/includes/oneshot.h svneol=native#text/plain
|
||||||
src/mame/includes/orbit.h svneol=native#text/plain
|
src/mame/includes/orbit.h svneol=native#text/plain
|
||||||
src/mame/includes/pacman.h svneol=native#text/plain
|
src/mame/includes/pacman.h svneol=native#text/plain
|
||||||
|
src/mame/includes/pandoras.h svneol=native#text/plain
|
||||||
src/mame/includes/paradise.h svneol=native#text/plain
|
src/mame/includes/paradise.h svneol=native#text/plain
|
||||||
src/mame/includes/pgm.h svneol=native#text/plain
|
src/mame/includes/pgm.h svneol=native#text/plain
|
||||||
src/mame/includes/phoenix.h svneol=native#text/plain
|
src/mame/includes/phoenix.h svneol=native#text/plain
|
||||||
|
@ -24,29 +24,21 @@ Added dsw locations and verified factory setting based on Guru's notes
|
|||||||
#include "sound/ay8910.h"
|
#include "sound/ay8910.h"
|
||||||
#include "sound/dac.h"
|
#include "sound/dac.h"
|
||||||
#include "konamipt.h"
|
#include "konamipt.h"
|
||||||
|
#include "pandoras.h"
|
||||||
static int irq_enable_a, irq_enable_b;
|
|
||||||
static int firq_old_data_a, firq_old_data_b;
|
|
||||||
static int i8039_status;
|
|
||||||
|
|
||||||
/* from video */
|
|
||||||
PALETTE_INIT( pandoras );
|
|
||||||
WRITE8_HANDLER( pandoras_vram_w );
|
|
||||||
WRITE8_HANDLER( pandoras_cram_w );
|
|
||||||
WRITE8_HANDLER( pandoras_flipscreen_w );
|
|
||||||
WRITE8_HANDLER( pandoras_scrolly_w );
|
|
||||||
VIDEO_START( pandoras );
|
|
||||||
VIDEO_UPDATE( pandoras );
|
|
||||||
|
|
||||||
static INTERRUPT_GEN( pandoras_master_interrupt )
|
static INTERRUPT_GEN( pandoras_master_interrupt )
|
||||||
{
|
{
|
||||||
if (irq_enable_a)
|
pandoras_state *state = (pandoras_state *)device->machine->driver_data;
|
||||||
|
|
||||||
|
if (state->irq_enable_a)
|
||||||
cpu_set_input_line(device, M6809_IRQ_LINE, HOLD_LINE);
|
cpu_set_input_line(device, M6809_IRQ_LINE, HOLD_LINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static INTERRUPT_GEN( pandoras_slave_interrupt )
|
static INTERRUPT_GEN( pandoras_slave_interrupt )
|
||||||
{
|
{
|
||||||
if (irq_enable_b)
|
pandoras_state *state = (pandoras_state *)device->machine->driver_data;
|
||||||
|
|
||||||
|
if (state->irq_enable_b)
|
||||||
cpu_set_input_line(device, M6809_IRQ_LINE, HOLD_LINE);
|
cpu_set_input_line(device, M6809_IRQ_LINE, HOLD_LINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,10 +53,13 @@ static WRITE8_HANDLER( pandoras_int_control_w )
|
|||||||
|
|
||||||
other bytes unknown */
|
other bytes unknown */
|
||||||
|
|
||||||
|
pandoras_state *state = (pandoras_state *)space->machine->driver_data;
|
||||||
|
|
||||||
switch (offset)
|
switch (offset)
|
||||||
{
|
{
|
||||||
case 0x00: if (!data) cputag_set_input_line(space->machine, "maincpu", M6809_IRQ_LINE, CLEAR_LINE);
|
case 0x00: if (!data)
|
||||||
irq_enable_a = data;
|
cputag_set_input_line(space->machine, "maincpu", M6809_IRQ_LINE, CLEAR_LINE);
|
||||||
|
state->irq_enable_a = data;
|
||||||
break;
|
break;
|
||||||
case 0x02: coin_counter_w(0,data & 0x01);
|
case 0x02: coin_counter_w(0,data & 0x01);
|
||||||
break;
|
break;
|
||||||
@ -72,35 +67,40 @@ static WRITE8_HANDLER( pandoras_int_control_w )
|
|||||||
break;
|
break;
|
||||||
case 0x05: pandoras_flipscreen_w(space, 0, data);
|
case 0x05: pandoras_flipscreen_w(space, 0, data);
|
||||||
break;
|
break;
|
||||||
case 0x06: if (!data) cputag_set_input_line(space->machine, "sub", M6809_IRQ_LINE, CLEAR_LINE);
|
case 0x06: if (!data)
|
||||||
irq_enable_b = data;
|
cputag_set_input_line(space->machine, "sub", M6809_IRQ_LINE, CLEAR_LINE);
|
||||||
|
state->irq_enable_b = data;
|
||||||
break;
|
break;
|
||||||
case 0x07: cputag_set_input_line(space->machine, "sub",INPUT_LINE_NMI,PULSE_LINE);
|
case 0x07: cputag_set_input_line(space->machine, "sub",INPUT_LINE_NMI,PULSE_LINE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default: logerror("%04x: (irq_ctrl) write %02x to %02x\n",cpu_get_pc(space->cpu), data, offset);
|
||||||
logerror("%04x: (irq_ctrl) write %02x to %02x\n",cpu_get_pc(space->cpu), data, offset);
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static WRITE8_HANDLER( pandoras_cpua_irqtrigger_w )
|
static WRITE8_HANDLER( pandoras_cpua_irqtrigger_w )
|
||||||
{
|
{
|
||||||
if (!firq_old_data_a && data)
|
pandoras_state *state = (pandoras_state *)space->machine->driver_data;
|
||||||
|
|
||||||
|
if (!state->firq_old_data_a && data)
|
||||||
{
|
{
|
||||||
cputag_set_input_line(space->machine, "maincpu", M6809_FIRQ_LINE, HOLD_LINE);
|
cputag_set_input_line(space->machine, "maincpu", M6809_FIRQ_LINE, HOLD_LINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
firq_old_data_a = data;
|
state->firq_old_data_a = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static WRITE8_HANDLER( pandoras_cpub_irqtrigger_w )
|
static WRITE8_HANDLER( pandoras_cpub_irqtrigger_w )
|
||||||
{
|
{
|
||||||
if (!firq_old_data_b && data)
|
pandoras_state *state = (pandoras_state *)space->machine->driver_data;
|
||||||
|
|
||||||
|
if (!state->firq_old_data_b && data)
|
||||||
{
|
{
|
||||||
cputag_set_input_line(space->machine, "sub", M6809_FIRQ_LINE, HOLD_LINE);
|
cputag_set_input_line(space->machine, "sub", M6809_FIRQ_LINE, HOLD_LINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
firq_old_data_b = data;
|
state->firq_old_data_b = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static WRITE8_HANDLER( pandoras_i8039_irqtrigger_w )
|
static WRITE8_HANDLER( pandoras_i8039_irqtrigger_w )
|
||||||
@ -110,12 +110,14 @@ static WRITE8_HANDLER( pandoras_i8039_irqtrigger_w )
|
|||||||
|
|
||||||
static WRITE8_HANDLER( i8039_irqen_and_status_w )
|
static WRITE8_HANDLER( i8039_irqen_and_status_w )
|
||||||
{
|
{
|
||||||
|
pandoras_state *state = (pandoras_state *)space->machine->driver_data;
|
||||||
|
|
||||||
/* bit 7 enables IRQ */
|
/* bit 7 enables IRQ */
|
||||||
if ((data & 0x80) == 0)
|
if ((data & 0x80) == 0)
|
||||||
cputag_set_input_line(space->machine, "mcu", 0, CLEAR_LINE);
|
cputag_set_input_line(space->machine, "mcu", 0, CLEAR_LINE);
|
||||||
|
|
||||||
/* bit 5 goes to 8910 port A */
|
/* bit 5 goes to 8910 port A */
|
||||||
i8039_status = (data & 0x20) >> 5;
|
state->i8039_status = (data & 0x20) >> 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
static WRITE8_HANDLER( pandoras_z80_irqtrigger_w )
|
static WRITE8_HANDLER( pandoras_z80_irqtrigger_w )
|
||||||
@ -126,9 +128,9 @@ static WRITE8_HANDLER( pandoras_z80_irqtrigger_w )
|
|||||||
|
|
||||||
|
|
||||||
static ADDRESS_MAP_START( pandoras_master_map, ADDRESS_SPACE_PROGRAM, 8 )
|
static ADDRESS_MAP_START( pandoras_master_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||||
AM_RANGE(0x0000, 0x0fff) AM_RAM AM_SHARE(1) AM_BASE(&spriteram) /* Work RAM (Shared with CPU B) */
|
AM_RANGE(0x0000, 0x0fff) AM_RAM AM_SHARE(1) AM_BASE_MEMBER(pandoras_state, spriteram) /* Work RAM (Shared with CPU B) */
|
||||||
AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(pandoras_cram_w) AM_SHARE(2) AM_BASE(&colorram) /* Color RAM (shared with CPU B) */
|
AM_RANGE(0x1000, 0x13ff) AM_RAM_WRITE(pandoras_cram_w) AM_SHARE(2) AM_BASE_MEMBER(pandoras_state, colorram) /* Color RAM (shared with CPU B) */
|
||||||
AM_RANGE(0x1400, 0x17ff) AM_RAM_WRITE(pandoras_vram_w) AM_SHARE(3) AM_BASE(&videoram) /* Video RAM (shared with CPU B) */
|
AM_RANGE(0x1400, 0x17ff) AM_RAM_WRITE(pandoras_vram_w) AM_SHARE(3) AM_BASE_MEMBER(pandoras_state, videoram) /* Video RAM (shared with CPU B) */
|
||||||
AM_RANGE(0x1800, 0x1807) AM_WRITE(pandoras_int_control_w) /* INT control */
|
AM_RANGE(0x1800, 0x1807) AM_WRITE(pandoras_int_control_w) /* INT control */
|
||||||
AM_RANGE(0x1a00, 0x1a00) AM_WRITE(pandoras_scrolly_w) /* bg scroll */
|
AM_RANGE(0x1a00, 0x1a00) AM_WRITE(pandoras_scrolly_w) /* bg scroll */
|
||||||
AM_RANGE(0x1c00, 0x1c00) AM_WRITE(pandoras_z80_irqtrigger_w) /* cause INT on the Z80 */
|
AM_RANGE(0x1c00, 0x1c00) AM_WRITE(pandoras_z80_irqtrigger_w) /* cause INT on the Z80 */
|
||||||
@ -289,15 +291,34 @@ GFXDECODE_END
|
|||||||
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
static MACHINE_START( pandoras )
|
||||||
|
{
|
||||||
|
pandoras_state *state = (pandoras_state *)machine->driver_data;
|
||||||
|
|
||||||
|
state_save_register_global(machine, state->firq_old_data_a);
|
||||||
|
state_save_register_global(machine, state->firq_old_data_b);
|
||||||
|
state_save_register_global(machine, state->irq_enable_a);
|
||||||
|
state_save_register_global(machine, state->irq_enable_b);
|
||||||
|
state_save_register_global(machine, state->i8039_status);
|
||||||
|
}
|
||||||
|
|
||||||
static MACHINE_RESET( pandoras )
|
static MACHINE_RESET( pandoras )
|
||||||
{
|
{
|
||||||
firq_old_data_a = firq_old_data_b = 0;
|
pandoras_state *state = (pandoras_state *)machine->driver_data;
|
||||||
irq_enable_a = irq_enable_b = 0;
|
|
||||||
|
state->firq_old_data_a = 0;
|
||||||
|
state->firq_old_data_b = 0;
|
||||||
|
state->irq_enable_a = 0;
|
||||||
|
state->irq_enable_b = 0;
|
||||||
|
state->i8039_status = 0;
|
||||||
|
|
||||||
|
state->flipscreen = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static READ8_DEVICE_HANDLER( pandoras_portA_r )
|
static READ8_DEVICE_HANDLER( pandoras_portA_r )
|
||||||
{
|
{
|
||||||
return i8039_status;
|
pandoras_state *state = (pandoras_state *)device->machine->driver_data;
|
||||||
|
return state->i8039_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static READ8_DEVICE_HANDLER( pandoras_portB_r )
|
static READ8_DEVICE_HANDLER( pandoras_portB_r )
|
||||||
@ -317,6 +338,9 @@ static const ay8910_interface ay8910_config =
|
|||||||
|
|
||||||
static MACHINE_DRIVER_START( pandoras )
|
static MACHINE_DRIVER_START( pandoras )
|
||||||
|
|
||||||
|
/* driver data */
|
||||||
|
MDRV_DRIVER_DATA(pandoras_state)
|
||||||
|
|
||||||
/* basic machine hardware */
|
/* basic machine hardware */
|
||||||
MDRV_CPU_ADD("maincpu", M6809,18432000/6) /* CPU A */
|
MDRV_CPU_ADD("maincpu", M6809,18432000/6) /* CPU A */
|
||||||
MDRV_CPU_PROGRAM_MAP(pandoras_master_map)
|
MDRV_CPU_PROGRAM_MAP(pandoras_master_map)
|
||||||
@ -335,6 +359,7 @@ static MACHINE_DRIVER_START( pandoras )
|
|||||||
|
|
||||||
MDRV_QUANTUM_TIME(HZ(3000)) /* slices per frame */
|
MDRV_QUANTUM_TIME(HZ(3000)) /* slices per frame */
|
||||||
|
|
||||||
|
MDRV_MACHINE_START(pandoras)
|
||||||
MDRV_MACHINE_RESET(pandoras)
|
MDRV_MACHINE_RESET(pandoras)
|
||||||
|
|
||||||
/* video hardware */
|
/* video hardware */
|
||||||
@ -402,4 +427,4 @@ ROM_START( pandoras )
|
|||||||
ROM_END
|
ROM_END
|
||||||
|
|
||||||
|
|
||||||
GAME( 1984, pandoras, 0, pandoras, pandoras, 0, ROT90, "Konami/Interlogic", "Pandora's Palace", 0 )
|
GAME( 1984, pandoras, 0, pandoras, pandoras, 0, ROT90, "Konami/Interlogic", "Pandora's Palace", GAME_SUPPORTS_SAVE )
|
||||||
|
35
src/mame/includes/pandoras.h
Normal file
35
src/mame/includes/pandoras.h
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/*************************************************************************
|
||||||
|
|
||||||
|
Pandora's Palace
|
||||||
|
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
typedef struct _pandoras_state pandoras_state;
|
||||||
|
struct _pandoras_state
|
||||||
|
{
|
||||||
|
/* memory pointers */
|
||||||
|
UINT8 * videoram;
|
||||||
|
UINT8 * colorram;
|
||||||
|
UINT8 * spriteram;
|
||||||
|
|
||||||
|
/* video-related */
|
||||||
|
tilemap *layer0;
|
||||||
|
int flipscreen;
|
||||||
|
|
||||||
|
int irq_enable_a, irq_enable_b;
|
||||||
|
int firq_old_data_a, firq_old_data_b;
|
||||||
|
int i8039_status;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* defined in video/pandoras.c */
|
||||||
|
PALETTE_INIT( pandoras );
|
||||||
|
|
||||||
|
WRITE8_HANDLER( pandoras_vram_w );
|
||||||
|
WRITE8_HANDLER( pandoras_cram_w );
|
||||||
|
WRITE8_HANDLER( pandoras_flipscreen_w );
|
||||||
|
WRITE8_HANDLER( pandoras_scrolly_w );
|
||||||
|
|
||||||
|
VIDEO_START( pandoras );
|
||||||
|
VIDEO_UPDATE( pandoras );
|
||||||
|
|
@ -1,9 +1,7 @@
|
|||||||
#include "driver.h"
|
#include "driver.h"
|
||||||
|
#include "pandoras.h"
|
||||||
#include "video/resnet.h"
|
#include "video/resnet.h"
|
||||||
|
|
||||||
static int flipscreen;
|
|
||||||
static tilemap *layer0;
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
|
||||||
Convert the color PROMs into a more useable format.
|
Convert the color PROMs into a more useable format.
|
||||||
@ -22,6 +20,7 @@ static tilemap *layer0;
|
|||||||
bit 0 -- 1 kohm resistor -- RED
|
bit 0 -- 1 kohm resistor -- RED
|
||||||
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
PALETTE_INIT( pandoras )
|
PALETTE_INIT( pandoras )
|
||||||
{
|
{
|
||||||
static const int resistances_rg[3] = { 1000, 470, 220 };
|
static const int resistances_rg[3] = { 1000, 470, 220 };
|
||||||
@ -90,10 +89,11 @@ PALETTE_INIT( pandoras )
|
|||||||
|
|
||||||
static TILE_GET_INFO( get_tile_info0 )
|
static TILE_GET_INFO( get_tile_info0 )
|
||||||
{
|
{
|
||||||
UINT8 attr = colorram[tile_index];
|
pandoras_state *state = (pandoras_state *)machine->driver_data;
|
||||||
|
UINT8 attr = state->colorram[tile_index];
|
||||||
SET_TILE_INFO(
|
SET_TILE_INFO(
|
||||||
1,
|
1,
|
||||||
videoram[tile_index] + ((attr & 0x10) << 4),
|
state->videoram[tile_index] + ((attr & 0x10) << 4),
|
||||||
attr & 0x0f,
|
attr & 0x0f,
|
||||||
TILE_FLIPYX((attr & 0xc0) >> 6));
|
TILE_FLIPYX((attr & 0xc0) >> 6));
|
||||||
tileinfo->category = (attr & 0x20) >> 5;
|
tileinfo->category = (attr & 0x20) >> 5;
|
||||||
@ -107,7 +107,10 @@ static TILE_GET_INFO( get_tile_info0 )
|
|||||||
|
|
||||||
VIDEO_START( pandoras )
|
VIDEO_START( pandoras )
|
||||||
{
|
{
|
||||||
layer0 = tilemap_create(machine, get_tile_info0,tilemap_scan_rows,8,8,32,32);
|
pandoras_state *state = (pandoras_state *)machine->driver_data;
|
||||||
|
state->layer0 = tilemap_create(machine, get_tile_info0, tilemap_scan_rows, 8, 8, 32, 32);
|
||||||
|
|
||||||
|
state_save_register_global(machine, state->flipscreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
@ -118,25 +121,33 @@ VIDEO_START( pandoras )
|
|||||||
|
|
||||||
WRITE8_HANDLER( pandoras_vram_w )
|
WRITE8_HANDLER( pandoras_vram_w )
|
||||||
{
|
{
|
||||||
tilemap_mark_tile_dirty(layer0,offset);
|
pandoras_state *state = (pandoras_state *)space->machine->driver_data;
|
||||||
videoram[offset] = data;
|
|
||||||
|
tilemap_mark_tile_dirty(state->layer0, offset);
|
||||||
|
state->videoram[offset] = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
WRITE8_HANDLER( pandoras_cram_w )
|
WRITE8_HANDLER( pandoras_cram_w )
|
||||||
{
|
{
|
||||||
tilemap_mark_tile_dirty(layer0,offset);
|
pandoras_state *state = (pandoras_state *)space->machine->driver_data;
|
||||||
colorram[offset] = data;
|
|
||||||
|
tilemap_mark_tile_dirty(state->layer0, offset);
|
||||||
|
state->colorram[offset] = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
WRITE8_HANDLER( pandoras_scrolly_w )
|
WRITE8_HANDLER( pandoras_scrolly_w )
|
||||||
{
|
{
|
||||||
tilemap_set_scrolly(layer0,0,data);
|
pandoras_state *state = (pandoras_state *)space->machine->driver_data;
|
||||||
|
|
||||||
|
tilemap_set_scrolly(state->layer0, 0, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
WRITE8_HANDLER( pandoras_flipscreen_w )
|
WRITE8_HANDLER( pandoras_flipscreen_w )
|
||||||
{
|
{
|
||||||
flipscreen = data;
|
pandoras_state *state = (pandoras_state *)space->machine->driver_data;
|
||||||
tilemap_set_flip_all(space->machine, flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
|
|
||||||
|
state->flipscreen = data;
|
||||||
|
tilemap_set_flip_all(space->machine, state->flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
@ -145,7 +156,7 @@ WRITE8_HANDLER( pandoras_flipscreen_w )
|
|||||||
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT8* sr)
|
static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT8* sr )
|
||||||
{
|
{
|
||||||
int offs;
|
int offs;
|
||||||
|
|
||||||
@ -168,8 +179,9 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
|||||||
|
|
||||||
VIDEO_UPDATE( pandoras )
|
VIDEO_UPDATE( pandoras )
|
||||||
{
|
{
|
||||||
tilemap_draw(bitmap,cliprect, layer0, 1 ,0);
|
pandoras_state *state = (pandoras_state *)screen->machine->driver_data;
|
||||||
draw_sprites(screen->machine, bitmap,cliprect, &spriteram[0x800] );
|
tilemap_draw(bitmap,cliprect, state->layer0, 1 ,0);
|
||||||
tilemap_draw(bitmap,cliprect, layer0, 0 ,0);
|
draw_sprites(screen->machine, bitmap, cliprect, &state->spriteram[0x800] );
|
||||||
|
tilemap_draw(bitmap,cliprect, state->layer0, 0 ,0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user