mirror of
https://github.com/mamedev/mame.git
synced 2024-11-16 07:48:32 +01:00
Added driver_data struct to 4enraya.c
This commit is contained in:
parent
2aa28ef3d9
commit
1a9e28c419
4 changed files with 72 additions and 26 deletions
1
.gitattributes
vendored
1
.gitattributes
vendored
|
@ -2290,6 +2290,7 @@ src/mame/drivers/zr107.c svneol=native#text/plain
|
|||
src/mame/etc/fd1094dp.c svneol=native#text/plain
|
||||
src/mame/etc/jrcrypt.c svneol=native#text/plain
|
||||
src/mame/includes/20pacgal.h svneol=native#text/plain
|
||||
src/mame/includes/4enraya.h svneol=native#text/plain
|
||||
src/mame/includes/8080bw.h svneol=native#text/plain
|
||||
src/mame/includes/aerofgt.h svneol=native#text/plain
|
||||
src/mame/includes/ajax.h svneol=native#text/plain
|
||||
|
|
|
@ -52,31 +52,28 @@ Sound :
|
|||
#include "deprecat.h"
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "sound/ay8910.h"
|
||||
|
||||
VIDEO_START( 4enraya );
|
||||
VIDEO_UPDATE( 4enraya );
|
||||
|
||||
WRITE8_HANDLER( fenraya_videoram_w );
|
||||
|
||||
static int soundlatch;
|
||||
#include "includes/4enraya.h"
|
||||
|
||||
static WRITE8_HANDLER( sound_data_w )
|
||||
{
|
||||
soundlatch = data;
|
||||
_4enraya_state *state = (_4enraya_state *)space->machine->driver_data;
|
||||
state->soundlatch = data;
|
||||
}
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( sound_control_w )
|
||||
{
|
||||
static int last;
|
||||
if ((last & 0x04) == 0x04 && (data & 0x4) == 0x00)
|
||||
ay8910_data_address_w(device, last, soundlatch);
|
||||
last=data;
|
||||
_4enraya_state *state = (_4enraya_state *)device->machine->driver_data;
|
||||
|
||||
if ((state->last_snd_ctrl & 0x04) == 0x04 && (data & 0x4) == 0x00)
|
||||
ay8910_data_address_w(device, state->last_snd_ctrl, state->soundlatch);
|
||||
|
||||
state->last_snd_ctrl = data;
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0xbfff) AM_ROM
|
||||
AM_RANGE(0xc000, 0xcfff) AM_RAM
|
||||
AM_RANGE(0xd000, 0xdfff) AM_WRITE(fenraya_videoram_w) AM_BASE(&videoram) AM_SIZE(&videoram_size)
|
||||
AM_RANGE(0xd000, 0xdfff) AM_WRITE(fenraya_videoram_w) AM_BASE_MEMBER(_4enraya_state, videoram) AM_SIZE(&videoram_size)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( main_portmap, ADDRESS_SPACE_IO, 8 )
|
||||
|
@ -152,17 +149,33 @@ GFXDECODE_END
|
|||
|
||||
static MACHINE_START( 4enraya )
|
||||
{
|
||||
state_save_register_global(machine, soundlatch);
|
||||
_4enraya_state *state = (_4enraya_state *)machine->driver_data;
|
||||
|
||||
state_save_register_global(machine, state->soundlatch);
|
||||
state_save_register_global(machine, state->last_snd_ctrl);
|
||||
}
|
||||
|
||||
static MACHINE_RESET( 4enraya )
|
||||
{
|
||||
_4enraya_state *state = (_4enraya_state *)machine->driver_data;
|
||||
|
||||
state->soundlatch = 0;
|
||||
state->last_snd_ctrl = 0;
|
||||
}
|
||||
|
||||
static MACHINE_DRIVER_START( 4enraya )
|
||||
|
||||
MDRV_DRIVER_DATA(_4enraya_state)
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("maincpu",Z80,8000000/2)
|
||||
MDRV_CPU_PROGRAM_MAP(main_map)
|
||||
MDRV_CPU_IO_MAP(main_portmap)
|
||||
MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,4)
|
||||
|
||||
MDRV_MACHINE_START(4enraya)
|
||||
MDRV_MACHINE_RESET(4enraya)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_SCREEN_ADD("screen", RASTER)
|
||||
MDRV_SCREEN_REFRESH_RATE(60)
|
||||
|
@ -176,8 +189,6 @@ static MACHINE_DRIVER_START( 4enraya )
|
|||
MDRV_VIDEO_START(4enraya)
|
||||
MDRV_VIDEO_UPDATE(4enraya)
|
||||
|
||||
MDRV_MACHINE_START(4enraya)
|
||||
|
||||
/* sound hardware */
|
||||
MDRV_SPEAKER_STANDARD_MONO("mono")
|
||||
MDRV_SOUND_ADD("aysnd", AY8910, 8000000/4 /* guess */)
|
||||
|
@ -204,4 +215,4 @@ ROM_START( 4enraya )
|
|||
ROM_LOAD( "1.bpr", 0x0000, 0x0020, CRC(dcbd2352) SHA1(ce72e84129ed1b455aaf648e1dfaa4333e7e7628) ) /* not used */
|
||||
ROM_END
|
||||
|
||||
GAME( 1990, 4enraya, 0, 4enraya, 4enraya, 0, ROT0, "IDSA", "4 En Raya", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1990, 4enraya, 0, 4enraya, 4enraya, 0, ROT0, "IDSA", "4 En Raya", GAME_SUPPORTS_SAVE )
|
||||
|
|
27
src/mame/includes/4enraya.h
Normal file
27
src/mame/includes/4enraya.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*************************************************************************
|
||||
|
||||
4enraya
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
typedef struct __4enraya_state _4enraya_state;
|
||||
struct __4enraya_state
|
||||
{
|
||||
/* memory pointers */
|
||||
UINT8 * videoram;
|
||||
|
||||
/* video-related */
|
||||
tilemap *bg_tilemap;
|
||||
|
||||
/* sound-related */
|
||||
int soundlatch;
|
||||
int last_snd_ctrl;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/4enraya.c -----------*/
|
||||
|
||||
WRITE8_HANDLER( fenraya_videoram_w );
|
||||
|
||||
VIDEO_START( 4enraya );
|
||||
VIDEO_UPDATE( 4enraya );
|
|
@ -7,19 +7,22 @@
|
|||
***************************************************************************/
|
||||
|
||||
#include "driver.h"
|
||||
|
||||
static tilemap *bg_tilemap;
|
||||
#include "includes/4enraya.h"
|
||||
|
||||
WRITE8_HANDLER( fenraya_videoram_w )
|
||||
{
|
||||
videoram[(offset&0x3ff)*2]=data;
|
||||
videoram[(offset&0x3ff)*2+1]=(offset&0xc00)>>10;
|
||||
tilemap_mark_tile_dirty(bg_tilemap,offset&0x3ff);
|
||||
_4enraya_state *state = (_4enraya_state *)space->machine->driver_data;
|
||||
|
||||
state->videoram[(offset & 0x3ff) * 2] = data;
|
||||
state->videoram[(offset & 0x3ff) * 2 + 1] = (offset & 0xc00) >> 10;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset & 0x3ff);
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( get_tile_info )
|
||||
{
|
||||
int code = videoram[tile_index*2]+(videoram[tile_index*2+1]<<8);
|
||||
_4enraya_state *state = (_4enraya_state *)machine->driver_data;
|
||||
|
||||
int code = state->videoram[tile_index * 2] + (state->videoram[tile_index * 2 + 1] << 8);
|
||||
SET_TILE_INFO(
|
||||
0,
|
||||
code,
|
||||
|
@ -29,11 +32,15 @@ static TILE_GET_INFO( get_tile_info )
|
|||
|
||||
VIDEO_START( 4enraya )
|
||||
{
|
||||
bg_tilemap = tilemap_create( machine, get_tile_info,tilemap_scan_rows,8,8,32,32 );
|
||||
_4enraya_state *state = (_4enraya_state *)machine->driver_data;
|
||||
|
||||
state->bg_tilemap = tilemap_create(machine, get_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
}
|
||||
|
||||
VIDEO_UPDATE( 4enraya)
|
||||
VIDEO_UPDATE( 4enraya )
|
||||
{
|
||||
tilemap_draw(bitmap,cliprect,bg_tilemap, 0,0);
|
||||
_4enraya_state *state = (_4enraya_state *)screen->machine->driver_data;
|
||||
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue