Rewritten Speed Attack video routines from scratch, also fixed screen flipping in it [Angelo Salese]

This commit is contained in:
Angelo Salese 2011-02-10 03:27:05 +00:00
parent d1bf6e94ca
commit dd574a314a
3 changed files with 52 additions and 45 deletions

View File

@ -188,7 +188,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( speedatk_io, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_DEVWRITE("crtc", mc6845_address_w)
AM_RANGE(0x00, 0x01) AM_WRITE( speedatk_6845_w)
AM_RANGE(0x01, 0x01) AM_DEVWRITE("crtc", mc6845_register_w)
AM_RANGE(0x24, 0x24) AM_WRITE(watchdog_reset_w) //watchdog
AM_RANGE(0x40, 0x40) AM_DEVREAD("aysnd", ay8910_r)
@ -308,10 +308,12 @@ static const mc6845_interface mc6845_intf =
static WRITE8_DEVICE_HANDLER( speedatk_output_w )
{
//flip_screen_set(device->machine, data & 0x80);
speedatk_state *state = device->machine->driver_data<speedatk_state>();
//if((data & 0x7f) != 0x7f)
//popmessage("%02x",data);
state->flip_scr = data & 0x80;
if((data & 0x7f) != 0x7f)
logerror("%02x\n",data);
}
static const ay8910_interface ay8910_config =
@ -379,5 +381,5 @@ ROM_START( speedatk )
ROM_LOAD( "cb2.bpr", 0x0020, 0x0100, CRC(a604cf96) SHA1(a4ef6e77dcd3abe4c27e8e636222a5ee711a51f5) ) /* lookup table */
ROM_END
GAME( 1984, speedatk, 0, speedatk, speedatk, 0, ROT0, "Seta Kikaku Corp.", "Speed Attack! (Japan)", GAME_NO_COCKTAIL )
GAME( 1984, speedatk, 0, speedatk, speedatk, 0, ROT0, "Seta Kikaku Corp.", "Speed Attack! (Japan)", 0 )

View File

@ -6,7 +6,8 @@ public:
UINT8 *videoram;
UINT8 *colorram;
tilemap_t *bg_tilemap;
UINT8 crtc_vreg[0x100],crtc_index;
UINT8 flip_scr;
UINT8 mux_data;
UINT8 km_status;
@ -19,6 +20,7 @@ public:
WRITE8_HANDLER( speedatk_videoram_w );
WRITE8_HANDLER( speedatk_colorram_w );
WRITE8_HANDLER( speedatk_6845_w );
PALETTE_INIT( speedatk );
VIDEO_START( speedatk );
VIDEO_UPDATE( speedatk );

View File

@ -5,30 +5,9 @@
*****************************************************************************************/
#include "emu.h"
#include "includes/speedatk.h"
#include "video/mc6845.h"
/*
Color prom dump(only 0x00-0x10 range has valid data)
0:---- ---- 0x00 Black
1:---- -x-- 0x04
2:---- -xxx 0x07
3:x-x- -xxx 0xa7
4:--x- x--- 0x28
5:xxxx x--- 0xf8
6:--xx xxxx 0x3f
7:xxxx xxxx 0xff White
8:x--- -x-- 0x84
9:x-x- xx-x 0xad
a:--x- -x-x 0x25
b:-xxx xxx- 0x7e
c:--x- xxxx 0x2f
d:xx-- ---- 0xc0
e:--xx -xx- 0x36
f:xxx- x--- 0xe8
*/
PALETTE_INIT( speedatk )
{
int i;
@ -78,7 +57,6 @@ WRITE8_HANDLER( speedatk_videoram_w )
speedatk_state *state = space->machine->driver_data<speedatk_state>();
state->videoram[offset] = data;
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
}
WRITE8_HANDLER( speedatk_colorram_w )
@ -86,32 +64,57 @@ WRITE8_HANDLER( speedatk_colorram_w )
speedatk_state *state = space->machine->driver_data<speedatk_state>();
state->colorram[offset] = data;
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
}
static TILE_GET_INFO( get_tile_info )
{
speedatk_state *state = machine->driver_data<speedatk_state>();
int code, color, region;
code = state->videoram[tile_index] + ((state->colorram[tile_index] & 0xe0) << 3);
color = state->colorram[tile_index] & 0x1f;
region = (state->colorram[tile_index] & 0x10) >> 4;
SET_TILE_INFO(region, code, color, 0);
}
VIDEO_START( speedatk )
{
speedatk_state *state = machine->driver_data<speedatk_state>();
state->bg_tilemap = tilemap_create(machine, get_tile_info, tilemap_scan_rows, 8, 8, 34, 30);
}
WRITE8_HANDLER( speedatk_6845_w )
{
speedatk_state *state = space->machine->driver_data<speedatk_state>();
if(offset == 0)
{
state->crtc_index = data;
mc6845_address_w(space->machine->device("crtc"),0,data);
}
else
{
state->crtc_vreg[state->crtc_index] = data;
mc6845_register_w(space->machine->device("crtc"),0,data);
}
}
VIDEO_UPDATE( speedatk )
{
speedatk_state *state = screen->machine->driver_data<speedatk_state>();
int x,y;
int count;
UINT16 tile;
UINT8 color, region;
bitmap_fill(bitmap, cliprect, 0);
count = (state->crtc_vreg[0x0c]<<8)|(state->crtc_vreg[0x0d] & 0xff);
if(state->flip_scr) { count = 0x3ff - count; }
for(y=0;y<state->crtc_vreg[6];y++)
{
for(x=0;x<state->crtc_vreg[1];x++)
{
tile = state->videoram[count] + ((state->colorram[count] & 0xe0) << 3);
color = state->colorram[count] & 0x1f;
region = (state->colorram[count] & 0x10) >> 4;
drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[region],tile,color,state->flip_scr,state->flip_scr,x*8,y*8);
count = (state->flip_scr) ? count-1 : count+1;
count&=0x3ff;
}
}
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
return 0;
}