mirror of
https://github.com/holub/mame
synced 2025-07-04 17:38:08 +03:00
Further code cleanup.
Flipped Pooyan so it behaves more like Time Pilot. Fixed Time Pilot sprite offset. Changed tutankhm video rendering to be destination-based.
This commit is contained in:
parent
b7c8c89e4e
commit
dc7e9bba99
@ -20,12 +20,14 @@
|
|||||||
#define MASTER_CLOCK XTAL_14_31818MHz
|
#define MASTER_CLOCK XTAL_14_31818MHz
|
||||||
|
|
||||||
|
|
||||||
static READ8_HANDLER( timeplt_portB_r );
|
static UINT8 timeplt_last_irq_state;
|
||||||
static WRITE8_HANDLER( timeplt_filter_w );
|
|
||||||
|
|
||||||
|
|
||||||
static int timeplt_last_irq_state;
|
/*************************************
|
||||||
|
*
|
||||||
|
* Initialization
|
||||||
|
*
|
||||||
|
*************************************/
|
||||||
|
|
||||||
static SOUND_START( timeplt )
|
static SOUND_START( timeplt )
|
||||||
{
|
{
|
||||||
@ -34,6 +36,94 @@ static SOUND_START( timeplt )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************
|
||||||
|
*
|
||||||
|
* Sound timer
|
||||||
|
*
|
||||||
|
*************************************/
|
||||||
|
|
||||||
|
/* The timer clock which feeds the upper 4 bits of */
|
||||||
|
/* AY-3-8910 port A is based on the same clock */
|
||||||
|
/* feeding the sound CPU Z80. It is a divide by */
|
||||||
|
/* 5120, formed by a standard divide by 512, */
|
||||||
|
/* followed by a divide by 10 using a 4 bit */
|
||||||
|
/* bi-quinary count sequence. (See LS90 data sheet */
|
||||||
|
/* for an example). */
|
||||||
|
/* */
|
||||||
|
/* Bit 4 comes from the output of the divide by 1024 */
|
||||||
|
/* 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 */
|
||||||
|
/* Bit 5 comes from the QC output of the LS90 producing a sequence of */
|
||||||
|
/* 0, 0, 1, 1, 0, 0, 1, 1, 1, 0 */
|
||||||
|
/* Bit 6 comes from the QD output of the LS90 producing a sequence of */
|
||||||
|
/* 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 */
|
||||||
|
/* Bit 7 comes from the QA output of the LS90 producing a sequence of */
|
||||||
|
/* 0, 0, 0, 0, 0, 1, 1, 1, 1, 1 */
|
||||||
|
|
||||||
|
static READ8_HANDLER( timeplt_portB_r )
|
||||||
|
{
|
||||||
|
static const int timeplt_timer[10] =
|
||||||
|
{
|
||||||
|
0x00, 0x10, 0x20, 0x30, 0x40, 0x90, 0xa0, 0xb0, 0xa0, 0xd0
|
||||||
|
};
|
||||||
|
return timeplt_timer[(activecpu_gettotalcycles64() / 512) % 10];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************
|
||||||
|
*
|
||||||
|
* Filter controls
|
||||||
|
*
|
||||||
|
*************************************/
|
||||||
|
|
||||||
|
static void filter_w(int chip, int channel, int data)
|
||||||
|
{
|
||||||
|
int C = 0;
|
||||||
|
|
||||||
|
if (data & 1) C += 220000; /* 220000pF = 0.220uF */
|
||||||
|
if (data & 2) C += 47000; /* 47000pF = 0.047uF */
|
||||||
|
filter_rc_set_RC(3*chip + channel,FLT_RC_LOWPASS, 1000,5100,0,CAP_P(C));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static WRITE8_HANDLER( timeplt_filter_w )
|
||||||
|
{
|
||||||
|
filter_w(0, 0, (offset >> 6) & 3);
|
||||||
|
filter_w(0, 1, (offset >> 8) & 3);
|
||||||
|
filter_w(0, 2, (offset >> 10) & 3);
|
||||||
|
filter_w(1, 0, (offset >> 0) & 3);
|
||||||
|
filter_w(1, 1, (offset >> 2) & 3);
|
||||||
|
filter_w(1, 2, (offset >> 4) & 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************
|
||||||
|
*
|
||||||
|
* External interfaces
|
||||||
|
*
|
||||||
|
*************************************/
|
||||||
|
|
||||||
|
WRITE8_HANDLER( timeplt_sh_irqtrigger_w )
|
||||||
|
{
|
||||||
|
if (timeplt_last_irq_state == 0 && data)
|
||||||
|
{
|
||||||
|
/* setting bit 0 low then high triggers IRQ on the sound CPU */
|
||||||
|
cpunum_set_input_line_and_vector(Machine, 1,0,HOLD_LINE,0xff);
|
||||||
|
}
|
||||||
|
|
||||||
|
timeplt_last_irq_state = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************
|
||||||
|
*
|
||||||
|
* Memory maps
|
||||||
|
*
|
||||||
|
*************************************/
|
||||||
|
|
||||||
static ADDRESS_MAP_START( timeplt_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
|
static ADDRESS_MAP_START( timeplt_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||||
AM_RANGE(0x0000, 0x2fff) AM_ROM
|
AM_RANGE(0x0000, 0x2fff) AM_ROM
|
||||||
AM_RANGE(0x3000, 0x33ff) AM_MIRROR(0x0c00) AM_RAM
|
AM_RANGE(0x3000, 0x33ff) AM_MIRROR(0x0c00) AM_RAM
|
||||||
@ -56,6 +146,13 @@ static ADDRESS_MAP_START( locomotn_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
|
|||||||
ADDRESS_MAP_END
|
ADDRESS_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************
|
||||||
|
*
|
||||||
|
* Sound chip interfaces
|
||||||
|
*
|
||||||
|
*************************************/
|
||||||
|
|
||||||
static const struct AY8910interface timeplt_ay8910_interface =
|
static const struct AY8910interface timeplt_ay8910_interface =
|
||||||
{
|
{
|
||||||
soundlatch_r,
|
soundlatch_r,
|
||||||
@ -63,66 +160,12 @@ static const struct AY8910interface timeplt_ay8910_interface =
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* The timer clock which feeds the upper 4 bits of */
|
|
||||||
/* AY-3-8910 port A is based on the same clock */
|
|
||||||
/* feeding the sound CPU Z80. It is a divide by */
|
|
||||||
/* 5120, formed by a standard divide by 512, */
|
|
||||||
/* followed by a divide by 10 using a 4 bit */
|
|
||||||
/* bi-quinary count sequence. (See LS90 data sheet */
|
|
||||||
/* for an example). */
|
|
||||||
/* */
|
|
||||||
/* Bit 4 comes from the output of the divide by 1024 */
|
|
||||||
/* 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 */
|
|
||||||
/* Bit 5 comes from the QC output of the LS90 producing a sequence of */
|
|
||||||
/* 0, 0, 1, 1, 0, 0, 1, 1, 1, 0 */
|
|
||||||
/* Bit 6 comes from the QD output of the LS90 producing a sequence of */
|
|
||||||
/* 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 */
|
|
||||||
/* Bit 7 comes from the QA output of the LS90 producing a sequence of */
|
|
||||||
/* 0, 0, 0, 0, 0, 1, 1, 1, 1, 1 */
|
|
||||||
|
|
||||||
static const int timeplt_timer[10] =
|
|
||||||
{
|
|
||||||
0x00, 0x10, 0x20, 0x30, 0x40, 0x90, 0xa0, 0xb0, 0xa0, 0xd0
|
|
||||||
};
|
|
||||||
|
|
||||||
static READ8_HANDLER( timeplt_portB_r )
|
|
||||||
{
|
|
||||||
return timeplt_timer[(activecpu_gettotalcycles64() / 512) % 10];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void filter_w(int chip, int channel, int data)
|
|
||||||
{
|
|
||||||
int C = 0;
|
|
||||||
|
|
||||||
if (data & 1) C += 220000; /* 220000pF = 0.220uF */
|
|
||||||
if (data & 2) C += 47000; /* 47000pF = 0.047uF */
|
|
||||||
filter_rc_set_RC(3*chip + channel,FLT_RC_LOWPASS, 1000,5100,0,CAP_P(C));
|
|
||||||
}
|
|
||||||
|
|
||||||
static WRITE8_HANDLER( timeplt_filter_w )
|
|
||||||
{
|
|
||||||
filter_w(0, 0, (offset >> 6) & 3);
|
|
||||||
filter_w(0, 1, (offset >> 8) & 3);
|
|
||||||
filter_w(0, 2, (offset >> 10) & 3);
|
|
||||||
filter_w(1, 0, (offset >> 0) & 3);
|
|
||||||
filter_w(1, 1, (offset >> 2) & 3);
|
|
||||||
filter_w(1, 2, (offset >> 4) & 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
WRITE8_HANDLER( timeplt_sh_irqtrigger_w )
|
|
||||||
{
|
|
||||||
if (timeplt_last_irq_state == 0 && data)
|
|
||||||
{
|
|
||||||
/* setting bit 0 low then high triggers IRQ on the sound CPU */
|
|
||||||
cpunum_set_input_line_and_vector(Machine, 1,0,HOLD_LINE,0xff);
|
|
||||||
}
|
|
||||||
|
|
||||||
timeplt_last_irq_state = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************
|
||||||
|
*
|
||||||
|
* Machine drivers
|
||||||
|
*
|
||||||
|
*************************************/
|
||||||
|
|
||||||
MACHINE_DRIVER_START( timeplt_sound )
|
MACHINE_DRIVER_START( timeplt_sound )
|
||||||
|
|
||||||
|
@ -329,6 +329,6 @@ ROM_END
|
|||||||
*
|
*
|
||||||
*************************************/
|
*************************************/
|
||||||
|
|
||||||
GAME( 1982, pooyan, 0, pooyan, pooyan, 0, ROT270, "Konami", "Pooyan", GAME_SUPPORTS_SAVE )
|
GAME( 1982, pooyan, 0, pooyan, pooyan, 0, ROT90, "Konami", "Pooyan", GAME_SUPPORTS_SAVE )
|
||||||
GAME( 1982, pooyans, pooyan, pooyan, pooyan, 0, ROT270, "[Konami] (Stern license)", "Pooyan (Stern)", GAME_SUPPORTS_SAVE )
|
GAME( 1982, pooyans, pooyan, pooyan, pooyan, 0, ROT90, "[Konami] (Stern license)", "Pooyan (Stern)", GAME_SUPPORTS_SAVE )
|
||||||
GAME( 1982, pootan, pooyan, pooyan, pooyan, 0, ROT270, "bootleg", "Pootan", GAME_SUPPORTS_SAVE )
|
GAME( 1982, pootan, pooyan, pooyan, pooyan, 0, ROT90, "bootleg", "Pootan", GAME_SUPPORTS_SAVE )
|
||||||
|
@ -29,6 +29,7 @@ static tilemap *bg_tilemap;
|
|||||||
bit 0 -- 1 kohm resistor -- RED
|
bit 0 -- 1 kohm resistor -- RED
|
||||||
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
PALETTE_INIT( pooyan )
|
PALETTE_INIT( pooyan )
|
||||||
{
|
{
|
||||||
rgb_t palette[32];
|
rgb_t palette[32];
|
||||||
@ -69,42 +70,71 @@ PALETTE_INIT( pooyan )
|
|||||||
palette_set_color(machine, i, palette[(*color_prom++ & 0x0f) + 0x10]);
|
palette_set_color(machine, i, palette[(*color_prom++ & 0x0f) + 0x10]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************
|
||||||
|
*
|
||||||
|
* Tilemap info callback
|
||||||
|
*
|
||||||
|
*************************************/
|
||||||
|
|
||||||
|
static TILE_GET_INFO( get_bg_tile_info )
|
||||||
|
{
|
||||||
|
int attr = colorram[tile_index];
|
||||||
|
int code = videoram[tile_index];
|
||||||
|
int color = attr & 0x0f;
|
||||||
|
int flags = TILE_FLIPYX(attr >> 6);
|
||||||
|
|
||||||
|
SET_TILE_INFO(0, code, color, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************
|
||||||
|
*
|
||||||
|
* Video startup
|
||||||
|
*
|
||||||
|
*************************************/
|
||||||
|
|
||||||
|
VIDEO_START( pooyan )
|
||||||
|
{
|
||||||
|
bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, TILEMAP_TYPE_PEN, 8,8, 32,32);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************
|
||||||
|
*
|
||||||
|
* Memory write handlers
|
||||||
|
*
|
||||||
|
*************************************/
|
||||||
|
|
||||||
WRITE8_HANDLER( pooyan_videoram_w )
|
WRITE8_HANDLER( pooyan_videoram_w )
|
||||||
{
|
{
|
||||||
videoram[offset] = data;
|
videoram[offset] = data;
|
||||||
tilemap_mark_tile_dirty(bg_tilemap, offset);
|
tilemap_mark_tile_dirty(bg_tilemap, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WRITE8_HANDLER( pooyan_colorram_w )
|
WRITE8_HANDLER( pooyan_colorram_w )
|
||||||
{
|
{
|
||||||
colorram[offset] = data;
|
colorram[offset] = data;
|
||||||
tilemap_mark_tile_dirty(bg_tilemap, offset);
|
tilemap_mark_tile_dirty(bg_tilemap, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WRITE8_HANDLER( pooyan_flipscreen_w )
|
WRITE8_HANDLER( pooyan_flipscreen_w )
|
||||||
{
|
{
|
||||||
if (flip_screen != (data & 0x01))
|
flip_screen_set(~data & 0x01);
|
||||||
{
|
|
||||||
flip_screen_set(data & 0x01);
|
|
||||||
tilemap_mark_all_tiles_dirty(ALL_TILEMAPS);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static TILE_GET_INFO( get_bg_tile_info )
|
|
||||||
{
|
|
||||||
int attr = colorram[tile_index];
|
|
||||||
int code = videoram[tile_index] + 8 * (attr & 0x20);
|
|
||||||
int color = attr & 0x0f;
|
|
||||||
int flags = ((attr & 0x40) ? TILE_FLIPX : 0) | ((attr & 0x80) ? TILE_FLIPY : 0);
|
|
||||||
|
|
||||||
SET_TILE_INFO(0, code, color, flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
VIDEO_START( pooyan )
|
/*************************************
|
||||||
{
|
*
|
||||||
bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows,
|
* Sprite rendering
|
||||||
TILEMAP_TYPE_PEN, 8, 8, 32, 32);
|
*
|
||||||
}
|
*************************************/
|
||||||
|
|
||||||
static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
|
static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
|
||||||
{
|
{
|
||||||
@ -112,17 +142,33 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const re
|
|||||||
|
|
||||||
for (offs = 0x10;offs < 0x40;offs += 2)
|
for (offs = 0x10;offs < 0x40;offs += 2)
|
||||||
{
|
{
|
||||||
|
int sx = spriteram[offs];
|
||||||
|
int sy = 240 - spriteram_2[offs + 1];
|
||||||
|
|
||||||
|
int code = spriteram[offs + 1];
|
||||||
|
int color = spriteram_2[offs] & 0x0f;
|
||||||
|
int flipx = ~spriteram_2[offs] & 0x40;
|
||||||
|
int flipy = spriteram_2[offs] & 0x80;
|
||||||
|
|
||||||
/* Sprite flipscreen is supported by software */
|
/* Sprite flipscreen is supported by software */
|
||||||
drawgfx(bitmap,machine->gfx[1],
|
drawgfx(bitmap,machine->gfx[1],
|
||||||
spriteram[offs + 1],
|
code,
|
||||||
spriteram_2[offs] & 0x0f,
|
color,
|
||||||
spriteram_2[offs] & 0x40, ~spriteram_2[offs] & 0x80,
|
flipx, flipy,
|
||||||
240-spriteram[offs], spriteram_2[offs + 1],
|
sx, sy,
|
||||||
cliprect,
|
cliprect,
|
||||||
TRANSPARENCY_PEN, 0);
|
TRANSPARENCY_PEN, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************
|
||||||
|
*
|
||||||
|
* Video update
|
||||||
|
*
|
||||||
|
*************************************/
|
||||||
|
|
||||||
VIDEO_UPDATE( pooyan )
|
VIDEO_UPDATE( pooyan )
|
||||||
{
|
{
|
||||||
tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
|
tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
|
||||||
|
Time Pilot
|
||||||
|
|
||||||
|
driver by Nicola Salmoria
|
||||||
|
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
#include "driver.h"
|
#include "driver.h"
|
||||||
#include "timeplt.h"
|
#include "timeplt.h"
|
||||||
|
|
||||||
@ -32,6 +40,7 @@ static emu_timer *scanline_timer;
|
|||||||
bit 0 -- not connected
|
bit 0 -- not connected
|
||||||
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
PALETTE_INIT( timeplt )
|
PALETTE_INIT( timeplt )
|
||||||
{
|
{
|
||||||
rgb_t palette[32];
|
rgb_t palette[32];
|
||||||
@ -78,37 +87,39 @@ PALETTE_INIT( timeplt )
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/*************************************
|
||||||
|
*
|
||||||
Callbacks for the TileMap code
|
* Tilemap info callback
|
||||||
|
*
|
||||||
***************************************************************************/
|
*************************************/
|
||||||
|
|
||||||
static TILE_GET_INFO( get_tile_info )
|
static TILE_GET_INFO( get_tile_info )
|
||||||
{
|
{
|
||||||
UINT8 attr = colorram[tile_index];
|
int attr = colorram[tile_index];
|
||||||
|
int code = videoram[tile_index] + 8 * (attr & 0x20);
|
||||||
|
int color = attr & 0x1f;
|
||||||
|
int flags = TILE_FLIPYX(attr >> 6);
|
||||||
|
|
||||||
tileinfo->category = (attr & 0x10) >> 4;
|
tileinfo->category = (attr & 0x10) >> 4;
|
||||||
SET_TILE_INFO(
|
SET_TILE_INFO(0, code, color, flags);
|
||||||
0,
|
|
||||||
videoram[tile_index] + ((attr & 0x20) << 3),
|
|
||||||
attr & 0x1f,
|
|
||||||
TILE_FLIPYX(attr >> 6));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/*************************************
|
||||||
|
*
|
||||||
Start the video hardware emulation.
|
* Per-scanline callback
|
||||||
|
*
|
||||||
***************************************************************************/
|
*************************************/
|
||||||
|
|
||||||
static TIMER_CALLBACK( scanline_interrupt )
|
static TIMER_CALLBACK( scanline_interrupt )
|
||||||
{
|
{
|
||||||
int scanline = param;
|
int scanline = param;
|
||||||
|
|
||||||
video_screen_update_partial(0, scanline - 1);
|
/* we need to use partial updates to handle multiplexed sprites */
|
||||||
|
video_screen_update_partial(0, scanline);
|
||||||
|
|
||||||
|
/* only need to hit on visible scanlines */
|
||||||
scanline++;
|
scanline++;
|
||||||
if (scanline > machine->screen[0].visarea.max_y)
|
if (scanline > machine->screen[0].visarea.max_y)
|
||||||
scanline = machine->screen[0].visarea.min_y;
|
scanline = machine->screen[0].visarea.min_y;
|
||||||
@ -116,21 +127,29 @@ static TIMER_CALLBACK( scanline_interrupt )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************
|
||||||
|
*
|
||||||
|
* Video startup
|
||||||
|
*
|
||||||
|
*************************************/
|
||||||
|
|
||||||
VIDEO_START( timeplt )
|
VIDEO_START( timeplt )
|
||||||
{
|
{
|
||||||
bg_tilemap = tilemap_create(get_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,32,32);
|
bg_tilemap = tilemap_create(get_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,32,32);
|
||||||
|
|
||||||
|
/* create a timer for scanline updates */
|
||||||
scanline_timer = timer_alloc(scanline_interrupt, NULL);
|
scanline_timer = timer_alloc(scanline_interrupt, NULL);
|
||||||
timer_adjust(scanline_timer, video_screen_get_time_until_pos(0, 0, 0), 0, attotime_never);
|
timer_adjust(scanline_timer, video_screen_get_time_until_pos(0, 0, 0), 0, attotime_never);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/*************************************
|
||||||
|
*
|
||||||
Memory handlers
|
* Memory write handlers
|
||||||
|
*
|
||||||
***************************************************************************/
|
*************************************/
|
||||||
|
|
||||||
WRITE8_HANDLER( timeplt_videoram_w )
|
WRITE8_HANDLER( timeplt_videoram_w )
|
||||||
{
|
{
|
||||||
@ -138,17 +157,20 @@ WRITE8_HANDLER( timeplt_videoram_w )
|
|||||||
tilemap_mark_tile_dirty(bg_tilemap,offset);
|
tilemap_mark_tile_dirty(bg_tilemap,offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WRITE8_HANDLER( timeplt_colorram_w )
|
WRITE8_HANDLER( timeplt_colorram_w )
|
||||||
{
|
{
|
||||||
colorram[offset] = data;
|
colorram[offset] = data;
|
||||||
tilemap_mark_tile_dirty(bg_tilemap,offset);
|
tilemap_mark_tile_dirty(bg_tilemap,offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WRITE8_HANDLER( timeplt_flipscreen_w )
|
WRITE8_HANDLER( timeplt_flipscreen_w )
|
||||||
{
|
{
|
||||||
flip_screen_set(~data & 1);
|
flip_screen_set(~data & 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
READ8_HANDLER( timeplt_scanline_r )
|
READ8_HANDLER( timeplt_scanline_r )
|
||||||
{
|
{
|
||||||
return video_screen_get_vpos(0);
|
return video_screen_get_vpos(0);
|
||||||
@ -156,30 +178,27 @@ READ8_HANDLER( timeplt_scanline_r )
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/*************************************
|
||||||
|
*
|
||||||
Display refresh
|
* Sprite rendering
|
||||||
|
*
|
||||||
***************************************************************************/
|
*************************************/
|
||||||
|
|
||||||
static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
|
static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
|
||||||
{
|
{
|
||||||
const gfx_element *gfx = machine->gfx[1];
|
|
||||||
int offs;
|
int offs;
|
||||||
|
|
||||||
for (offs = 0x3e;offs >= 0x10;offs -= 2)
|
for (offs = 0x3e;offs >= 0x10;offs -= 2)
|
||||||
{
|
{
|
||||||
int code,color,sx,sy,flipx,flipy;
|
int sx = spriteram[offs];
|
||||||
|
int sy = 241 - spriteram_2[offs + 1];
|
||||||
|
|
||||||
sx = spriteram[offs];
|
int code = spriteram[offs + 1];
|
||||||
sy = 240 - spriteram_2[offs + 1];
|
int color = spriteram_2[offs] & 0x3f;
|
||||||
|
int flipx = ~spriteram_2[offs] & 0x40;
|
||||||
|
int flipy = spriteram_2[offs] & 0x80;
|
||||||
|
|
||||||
code = spriteram[offs + 1];
|
drawgfx(bitmap,machine->gfx[1],
|
||||||
color = spriteram_2[offs] & 0x3f;
|
|
||||||
flipx = ~spriteram_2[offs] & 0x40;
|
|
||||||
flipy = spriteram_2[offs] & 0x80;
|
|
||||||
|
|
||||||
drawgfx(bitmap,gfx,
|
|
||||||
code,
|
code,
|
||||||
color,
|
color,
|
||||||
flipx,flipy,
|
flipx,flipy,
|
||||||
@ -188,6 +207,14 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rec
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************
|
||||||
|
*
|
||||||
|
* Video update
|
||||||
|
*
|
||||||
|
*************************************/
|
||||||
|
|
||||||
VIDEO_UPDATE( timeplt )
|
VIDEO_UPDATE( timeplt )
|
||||||
{
|
{
|
||||||
tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
|
tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
|
||||||
|
@ -22,6 +22,12 @@ static UINT8 tutankhm_flip_screen_y;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************
|
||||||
|
*
|
||||||
|
* Write handlers
|
||||||
|
*
|
||||||
|
*************************************/
|
||||||
|
|
||||||
WRITE8_HANDLER( tutankhm_flip_screen_x_w )
|
WRITE8_HANDLER( tutankhm_flip_screen_x_w )
|
||||||
{
|
{
|
||||||
tutankhm_flip_screen_x = data & 0x01;
|
tutankhm_flip_screen_x = data & 0x01;
|
||||||
@ -34,6 +40,13 @@ WRITE8_HANDLER( tutankhm_flip_screen_y_w )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************
|
||||||
|
*
|
||||||
|
* Palette management
|
||||||
|
*
|
||||||
|
*************************************/
|
||||||
|
|
||||||
static void get_pens(pen_t *pens)
|
static void get_pens(pen_t *pens)
|
||||||
{
|
{
|
||||||
offs_t i;
|
offs_t i;
|
||||||
@ -47,6 +60,13 @@ static void get_pens(pen_t *pens)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************
|
||||||
|
*
|
||||||
|
* Video startup
|
||||||
|
*
|
||||||
|
*************************************/
|
||||||
|
|
||||||
VIDEO_START( tutankhm )
|
VIDEO_START( tutankhm )
|
||||||
{
|
{
|
||||||
state_save_register_global_array(junofrst_blitterdata);
|
state_save_register_global_array(junofrst_blitterdata);
|
||||||
@ -55,42 +75,34 @@ VIDEO_START( tutankhm )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************
|
||||||
|
*
|
||||||
|
* Video update
|
||||||
|
*
|
||||||
|
*************************************/
|
||||||
|
|
||||||
VIDEO_UPDATE( tutankhm )
|
VIDEO_UPDATE( tutankhm )
|
||||||
{
|
{
|
||||||
|
int xorx = tutankhm_flip_screen_x ? 255 : 0;
|
||||||
|
int xory = tutankhm_flip_screen_y ? 255 : 0;
|
||||||
pen_t pens[NUM_PENS];
|
pen_t pens[NUM_PENS];
|
||||||
offs_t offs;
|
int x, y;
|
||||||
|
|
||||||
get_pens(pens);
|
get_pens(pens);
|
||||||
|
|
||||||
for (offs = 0; offs < videoram_size; offs++)
|
for (y = cliprect->min_y; y <= cliprect->max_y; y++)
|
||||||
{
|
{
|
||||||
int i;
|
UINT32 *dst = BITMAP_ADDR32(bitmap, y, 0);
|
||||||
|
|
||||||
UINT8 data = videoram[offs];
|
for (x = cliprect->min_x; x <= cliprect->max_x; x++)
|
||||||
|
|
||||||
UINT8 y = offs >> 7;
|
|
||||||
UINT8 x = offs << 1;
|
|
||||||
|
|
||||||
for (i = 0; i < 2; i++)
|
|
||||||
{
|
{
|
||||||
UINT8 sy = y;
|
UINT8 effx = x ^ xorx;
|
||||||
UINT8 sx = x;
|
UINT8 yscroll = (effx < 192) ? *tutankhm_scroll : 0;
|
||||||
|
UINT8 effy = (y ^ xory) + yscroll;
|
||||||
pen_t pen = pens[data & 0x0f];
|
UINT8 vrambyte = videoram[effy * 128 + effx / 2];
|
||||||
|
UINT8 shifted = vrambyte >> (4 * (effx % 2));
|
||||||
/* adjust for scrolling */
|
dst[x] = pens[shifted & 0x0f];
|
||||||
if (x < 192)
|
|
||||||
{
|
|
||||||
sy = sy - *tutankhm_scroll;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tutankhm_flip_screen_y) sy = 255 - sy;
|
|
||||||
if (tutankhm_flip_screen_x) sx = 255 - sx;
|
|
||||||
|
|
||||||
*BITMAP_ADDR32(bitmap, sy, sx) = pen;
|
|
||||||
|
|
||||||
x = x + 1;
|
|
||||||
data = data >> 4;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user