phoenix and clones:

* video timing from schematics
* palette from schematics (resnet.h)
* no more colortable
* added save state
This commit is contained in:
Couriersud 2008-01-16 18:50:35 +00:00
parent 29543d154b
commit db15d4cacb
4 changed files with 153 additions and 77 deletions

View File

@ -48,7 +48,7 @@
#define VMIN 0
#define VMAX 32767
static int sound_latch_a;
static UINT8 sound_latch_a;
static sound_stream * channel;
@ -386,6 +386,11 @@ WRITE8_HANDLER( phoenix_sound_control_a_w )
sound_latch_a = data;
}
SOUND_START( phoenix)
{
state_save_register_global(sound_latch_a);
}
WRITE8_HANDLER( phoenix_sound_control_b_w )
{
discrete_sound_w(PHOENIX_EFFECT_1_DATA, data & 0x0f);
@ -420,6 +425,8 @@ void *phoenix_sh_start(int clock, const struct CustomSound_interface *config)
channel = stream_create(0, 1, Machine->sample_rate, 0, phoenix_sound_update);
state_save_register_global_pointer(poly18, (1ul << (18-5)) );
/* a dummy token */
return auto_malloc(1);
}

View File

@ -664,8 +664,8 @@ static const gfx_layout charlayout =
};
static GFXDECODE_START( phoenix )
GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout, 0, 16 )
GFXDECODE_ENTRY( REGION_GFX2, 0, charlayout, 16*4, 16 )
GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout, 0, 16 )
GFXDECODE_ENTRY( REGION_GFX2, 0, charlayout, 0, 16 )
GFXDECODE_END
static GFXDECODE_START( pleiads )
@ -720,27 +720,25 @@ static MACHINE_RESET( phoenix )
static MACHINE_DRIVER_START( phoenix )
/* basic machine hardware */
MDRV_CPU_ADD_TAG("main", 8085A, 11000000/4) /* 2.75 MHz */
MDRV_CPU_ADD_TAG("main", 8085A, CPU_CLOCK) /* 2.75 MHz */
MDRV_CPU_PROGRAM_MAP(phoenix_readmem,phoenix_writemem)
MDRV_SCREEN_REFRESH_RATE(60)
MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION /* frames per second, vblank duration */)
MDRV_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART)
MDRV_MACHINE_RESET(phoenix)
/* video hardware */
MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
MDRV_SCREEN_SIZE(32*8, 32*8)
MDRV_SCREEN_VISIBLE_AREA(0*8, 31*8-1, 0*8, 26*8-1)
MDRV_GFXDECODE(phoenix)
MDRV_PALETTE_LENGTH(256)
MDRV_COLORTABLE_LENGTH(16*4+16*4)
MDRV_PALETTE_INIT(phoenix)
MDRV_VIDEO_START(phoenix)
MDRV_VIDEO_UPDATE(phoenix)
MDRV_SOUND_START(phoenix)
/* sound hardware */
MDRV_SPEAKER_STANDARD_MONO("mono")
@ -770,6 +768,7 @@ static MACHINE_DRIVER_START( pleiads )
MDRV_COLORTABLE_LENGTH(32*4+32*4)
MDRV_PALETTE_INIT(pleiads)
MDRV_VIDEO_START(pleiads)
/* sound hardware */
MDRV_SOUND_REPLACE("tms", TMS36XX, 247)
@ -1307,18 +1306,18 @@ static DRIVER_INIT( survival )
GAME( 1980, phoenix, 0, phoenix, phoenix, 0, ROT90, "Amstar", "Phoenix (Amstar)", 0 )
GAME( 1980, phoenixa, phoenix, phoenix, phoenixa, 0, ROT90, "Amstar (Centuri license)", "Phoenix (Centuri), Set 1", 0 )
GAME( 1980, phoenixb, phoenix, phoenix, phoenixa, 0, ROT90, "Amstar (Centuri license)", "Phoenix (Centuri), Set 2", 0 )
GAME( 1980, phoenixt, phoenix, phoenix, phoenixt, 0, ROT90, "Taito", "Phoenix (Taito)", 0 )
GAME( 1980, phoenix3, phoenix, phoenix, phoenix3, 0, ROT90, "bootleg", "Phoenix (T.P.N.)", 0 )
GAME( 1981, phoenixc, phoenix, phoenix, phoenixt, 0, ROT90, "bootleg?", "Phoenix (IRECSA, G.G.I Corp)", 0 )
GAME( 1980, phoenix, 0, phoenix, phoenix, 0, ROT90, "Amstar", "Phoenix (Amstar)", GAME_SUPPORTS_SAVE )
GAME( 1980, phoenixa, phoenix, phoenix, phoenixa, 0, ROT90, "Amstar (Centuri license)", "Phoenix (Centuri), Set 1", GAME_SUPPORTS_SAVE )
GAME( 1980, phoenixb, phoenix, phoenix, phoenixa, 0, ROT90, "Amstar (Centuri license)", "Phoenix (Centuri), Set 2", GAME_SUPPORTS_SAVE )
GAME( 1980, phoenixt, phoenix, phoenix, phoenixt, 0, ROT90, "Taito", "Phoenix (Taito)", GAME_SUPPORTS_SAVE )
GAME( 1980, phoenix3, phoenix, phoenix, phoenix3, 0, ROT90, "bootleg", "Phoenix (T.P.N.)", GAME_SUPPORTS_SAVE )
GAME( 1981, phoenixc, phoenix, phoenix, phoenixt, 0, ROT90, "bootleg?", "Phoenix (IRECSA, G.G.I Corp)", GAME_SUPPORTS_SAVE )
GAME( 1981, condor, phoenix, condor, condor, condor, ROT90, "Sidam (bootleg)", "Condor (bootleg of Phoenix)", 0 )
// the following 2 were common bootlegs in england & france respectively
GAME( 1980, falcon, phoenix, phoenix, phoenixt, 0, ROT90, "bootleg", "Falcon (bootleg of Phoenix) (set 1)", 0 )
GAME( 1980, vautour, phoenix, phoenix, phoenixt, 0, ROT90, "Jeutel (bootleg)", "Vautour (bootleg of Phoenix) (set 1)", 0 )
GAME( 1980, falcon, phoenix, phoenix, phoenixt, 0, ROT90, "bootleg", "Falcon (bootleg of Phoenix) (set 1)", GAME_SUPPORTS_SAVE )
GAME( 1980, vautour, phoenix, phoenix, phoenixt, 0, ROT90, "Jeutel (bootleg)", "Vautour (bootleg of Phoenix) (set 1)", GAME_SUPPORTS_SAVE )
GAME( 1980, vautour2, phoenix, condor, condor, condor, ROT90, "bootleg", "Vautour (bootleg of Phoenix) (set 2)", 0 )
// fenix is an italian bootleg based on vautour
GAME( 1980, fenix, phoenix, condor, condor, condor, ROT90, "bootleg", "Fenix (bootleg of Phoenix)", GAME_NOT_WORKING )

View File

@ -2,8 +2,23 @@
#include "sound/custom.h"
/*----------- video timing -----------*/
#define MASTER_CLOCK XTAL_11MHz
#define PIXEL_CLOCK (MASTER_CLOCK/2)
#define CPU_CLOCK (PIXEL_CLOCK/2)
#define HTOTAL (512-160)
#define HBSTART (256)
#define HBEND (0)
#define VTOTAL (256)
#define VBSTART (208)
#define VBEND (0)
/*----------- defined in audio/phoenix.c -----------*/
SOUND_START( phoenix );
DISCRETE_SOUND_EXTERN( phoenix );
WRITE8_HANDLER( phoenix_sound_control_a_w );
@ -40,6 +55,7 @@ VIDEO_UPDATE( naughtyb );
PALETTE_INIT( phoenix );
PALETTE_INIT( pleiads );
VIDEO_START( phoenix );
VIDEO_START( pleiads );
VIDEO_UPDATE( phoenix );
WRITE8_HANDLER( phoenix_videoram_w );

View File

@ -7,14 +7,13 @@
***************************************************************************/
#include "driver.h"
#include "video/resnet.h"
#include "phoenix.h"
static UINT8 *videoram_pg1;
static UINT8 *videoram_pg2;
static UINT8 *current_videoram_pg;
static int current_videoram_pg_index;
static int palette_bank;
static int cocktail_mode;
static UINT8 *videoram_pg[2];
static UINT8 videoram_pg_index;
static UINT8 palette_bank;
static UINT8 cocktail_mode;
static int pleiads_protection_question;
static int survival_protection_value;
static tilemap *fg_tilemap, *bg_tilemap;
@ -42,43 +41,47 @@ static tilemap *fg_tilemap, *bg_tilemap;
***************************************************************************/
static const res_net_decode_info phoenix_decode_info =
{
2, // there may be two proms needed to construct color
0, // start at 0
255, // end at 255
// R, G, B, R, G, B
{ 0, 0, 0, 256, 256, 256}, // offsets
{ 0, 2, 1, -1, 1, 0}, // shifts
{0x01,0x01,0x01,0x02,0x02,0x02} // masks
};
static const res_net_info phoenix_net_info =
{
RES_NET_VCC_5V | RES_NET_VBIAS_5V | RES_NET_VIN_OPEN_COL,
{
{ RES_NET_AMP_NONE, 270, 270, 2, { 270, 1 } },
{ RES_NET_AMP_NONE, 270, 270, 2, { 270, 1 } },
{ RES_NET_AMP_NONE, 270, 270, 2, { 270, 1 } }
}
};
PALETTE_INIT( phoenix )
{
int i;
int t[4]= {0,1,2,3};
rgb_t *rgb;
#define COLOR(gfxn,offs) (colortable[machine->drv->gfxdecodeinfo[gfxn].color_codes_start + offs])
for (i = 0;i < machine->drv->total_colors;i++)
rgb = compute_res_net_all(color_prom, &phoenix_decode_info, &phoenix_net_info);
/* native order */
for (i=0;i<256;i++)
{
int bit0,bit1,r,g,b;
bit0 = (color_prom[0] >> 0) & 0x01;
bit1 = (color_prom[machine->drv->total_colors] >> 0) & 0x01;
r = 0x55 * bit0 + 0xaa * bit1;
bit0 = (color_prom[0] >> 2) & 0x01;
bit1 = (color_prom[machine->drv->total_colors] >> 2) & 0x01;
g = 0x55 * bit0 + 0xaa * bit1;
bit0 = (color_prom[0] >> 1) & 0x01;
bit1 = (color_prom[machine->drv->total_colors] >> 1) & 0x01;
b = 0x55 * bit0 + 0xaa * bit1;
palette_set_color(machine,i,MAKE_RGB(r,g,b));
color_prom++;
}
int col;
col = ((t[i & 0x03] << 3 ) & 0x18) | ((i>>2) & 0x07) | (i & 0x60);
palette_set_color(machine,i,rgb[col]);
}
palette_normalize_range(machine->palette, 0, 255, 0, 255);
free(rgb);
/* first bank of characters use colors 0x00-0x1f and 0x40-0x5f */
/* second bank of characters use colors 0x20-0x3f and 0x60-0x7f */
for (i = 0;i < 0x40;i++)
{
int col;
col = ((i & 0x1c) >> 2) | ((i & 0x03) << 3) | ((i & 0x20) << 1);
COLOR(0,i) = col;
COLOR(1,i) = col | 0x20;
}
}
PALETTE_INIT( pleiads )
@ -127,10 +130,38 @@ PALETTE_INIT( pleiads )
***************************************************************************/
static TILE_GET_INFO( get_fg_tile_info )
{
int code, col;
code = videoram_pg[videoram_pg_index][tile_index];
col = (code >> 5);
col = col | 0x08 | (palette_bank << 4);
SET_TILE_INFO(
1,
code,
col,
0);
}
static TILE_GET_INFO( get_bg_tile_info )
{
int code, col;
code = videoram_pg[videoram_pg_index][tile_index + 0x800];
col = (code >> 5);
col = col | 0x00 | (palette_bank << 4);
SET_TILE_INFO(
0,
code,
col,
0);
}
static TILE_GET_INFO( pleiads_get_fg_tile_info )
{
int code;
code = current_videoram_pg[tile_index];
code = videoram_pg[videoram_pg_index][tile_index];
SET_TILE_INFO(
1,
code,
@ -138,11 +169,11 @@ static TILE_GET_INFO( get_fg_tile_info )
(tile_index & 0x1f) ? 0 : TILE_FORCE_LAYER0); /* first row (column) is opaque */
}
static TILE_GET_INFO( get_bg_tile_info )
static TILE_GET_INFO( pleiads_get_bg_tile_info )
{
int code;
code = current_videoram_pg[tile_index + 0x800];
code = videoram_pg[videoram_pg_index][tile_index + 0x800];
SET_TILE_INFO(
0,
code,
@ -150,7 +181,6 @@ static TILE_GET_INFO( get_bg_tile_info )
0);
}
/***************************************************************************
Start the video hardware emulation.
@ -159,27 +189,53 @@ static TILE_GET_INFO( get_bg_tile_info )
VIDEO_START( phoenix )
{
videoram_pg1 = auto_malloc(0x1000);
videoram_pg2 = auto_malloc(0x1000);
videoram_pg[0] = auto_malloc(0x1000);
videoram_pg[1] = auto_malloc(0x1000);
memory_configure_bank(1, 0, 1, videoram_pg1, 0);
memory_configure_bank(1, 1, 1, videoram_pg2, 0);
memory_configure_bank(1, 0, 1, videoram_pg[0], 0);
memory_configure_bank(1, 1, 1, videoram_pg[1], 0);
memory_set_bank(1, 0);
current_videoram_pg_index = -1;
current_videoram_pg = videoram_pg1; /* otherwise, hiscore loading crashes */
videoram_pg_index = 0;
fg_tilemap = tilemap_create(get_fg_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,32,32);
bg_tilemap = tilemap_create(get_bg_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN, 8,8,32,32);
tilemap_set_transparent_pen(fg_tilemap,0);
tilemap_set_scrolldx(fg_tilemap,0,8);
tilemap_set_scrolldy(fg_tilemap,0,48);
tilemap_set_scrolldx(bg_tilemap,0,8);
tilemap_set_scrolldy(bg_tilemap,0,48);
tilemap_set_scrolldx(fg_tilemap, 0, (HTOTAL - HBSTART));
tilemap_set_scrolldx(bg_tilemap, 0, (HTOTAL - HBSTART));
tilemap_set_scrolldy(fg_tilemap, 0, (VTOTAL - VBSTART));
tilemap_set_scrolldy(bg_tilemap, 0, (VTOTAL - VBSTART));
state_save_register_global_pointer(videoram_pg[0], 0x1000);
state_save_register_global_pointer(videoram_pg[1], 0x1000);
state_save_register_global(videoram_pg_index);
state_save_register_global(palette_bank);
state_save_register_global(cocktail_mode);
}
VIDEO_START( pleiads )
{
videoram_pg[0] = auto_malloc(0x1000);
videoram_pg[1] = auto_malloc(0x1000);
memory_configure_bank(1, 0, 1, videoram_pg[0], 0);
memory_configure_bank(1, 1, 1, videoram_pg[1], 0);
memory_set_bank(1, 0);
videoram_pg_index = 0;
fg_tilemap = tilemap_create(pleiads_get_fg_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,32,32);
bg_tilemap = tilemap_create(pleiads_get_bg_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN, 8,8,32,32);
tilemap_set_transparent_pen(fg_tilemap,0);
tilemap_set_scrolldx(fg_tilemap, 0, (HTOTAL - HBSTART));
tilemap_set_scrolldx(bg_tilemap, 0, (HTOTAL - HBSTART));
tilemap_set_scrolldy(fg_tilemap, 0, (VTOTAL - VBSTART));
tilemap_set_scrolldy(bg_tilemap, 0, (VTOTAL - VBSTART));
}
/***************************************************************************
@ -191,7 +247,7 @@ WRITE8_HANDLER( phoenix_videoram_w )
{
UINT8 *rom = memory_region(REGION_CPU1);
current_videoram_pg[offset] = data;
videoram_pg[videoram_pg_index][offset] = data;
if ((offset & 0x7ff) < 0x340)
{
@ -208,14 +264,13 @@ WRITE8_HANDLER( phoenix_videoram_w )
WRITE8_HANDLER( phoenix_videoreg_w )
{
if (current_videoram_pg_index != (data & 1))
if (videoram_pg_index != (data & 1))
{
/* set memory bank */
current_videoram_pg_index = data & 1;
memory_set_bank(1, current_videoram_pg_index);
current_videoram_pg = current_videoram_pg_index ? videoram_pg2 : videoram_pg1;
videoram_pg_index = data & 1;
memory_set_bank(1, videoram_pg_index);
cocktail_mode = current_videoram_pg_index && (input_port_3_r(0) & 0x01);
cocktail_mode = videoram_pg_index && (input_port_3_r(0) & 0x01);
tilemap_set_flip(ALL_TILEMAPS, cocktail_mode ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0);
tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
@ -232,14 +287,13 @@ WRITE8_HANDLER( phoenix_videoreg_w )
WRITE8_HANDLER( pleiads_videoreg_w )
{
if (current_videoram_pg_index != (data & 1))
if (videoram_pg_index != (data & 1))
{
/* set memory bank */
current_videoram_pg_index = data & 1;
memory_set_bank(1, current_videoram_pg_index);
current_videoram_pg = current_videoram_pg_index ? videoram_pg2 : videoram_pg1;
videoram_pg_index = data & 1;
memory_set_bank(1, videoram_pg_index);
cocktail_mode = current_videoram_pg_index && (input_port_3_r(0) & 0x01);
cocktail_mode = videoram_pg_index && (input_port_3_r(0) & 0x01);
tilemap_set_flip(ALL_TILEMAPS, cocktail_mode ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0);
tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);