Fixed layer enable,flip x & x/y position in goodejan.c driver [Angelo Salese]

=============

Several Seibu games (i.e. D-Con,sdgndmps,Sengoku Mahjong,goodejan/totmejan and the raiden2.c/legionna.c games) all have a standard 0x48 (0x50?) 
regs-wide C.R.T.C. 

I wonder if it is a custom Seibu crap or a known video chip,would be good if somebody can do tests on it. For sure,it should be abstracted,this 
commit was made by looking mostly at Sengoku Mahjong.
This commit is contained in:
Angelo Salese 2009-01-02 20:08:54 +00:00
parent 84618c3f7a
commit 99103e89bb
2 changed files with 87 additions and 25 deletions

View File

@ -68,6 +68,7 @@ WRITE16_HANDLER( goodejan_bgvram_w );
WRITE16_HANDLER( goodejan_txvram_w );
WRITE16_HANDLER( goodejan_bg_scrollx_w );
WRITE16_HANDLER( goodejan_bg_scrolly_w );
WRITE16_HANDLER( goodejan_layer_en_w );
VIDEO_START( goodejan );
VIDEO_UPDATE( goodejan );
@ -95,11 +96,6 @@ static WRITE16_HANDLER( mahjong_panel_w )
goodejan_mux_data = data;
}
static READ16_HANDLER( goodejan_read_ff )
{
return 0xff;
}
static ADDRESS_MAP_START( goodejan_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x00000, 0x0afff) AM_RAM
AM_RANGE(0x0c000, 0x0c7ff) AM_RAM_WRITE(goodejan_bgvram_w) AM_BASE(&goodejan_bgvram)
@ -109,16 +105,19 @@ static ADDRESS_MAP_START( goodejan_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0xc0000, 0xfffff) AM_ROM
ADDRESS_MAP_END
/*totmejan CRT is at 8000-804f,goodejan is at 8040-807f(808f but not tested)*/
static ADDRESS_MAP_START( goodejan_io_map, ADDRESS_SPACE_IO, 16 )
AM_RANGE(0x801c, 0x801d) AM_WRITE(goodejan_layer_en_w )
AM_RANGE(0x805c, 0x805d) AM_WRITE(goodejan_layer_en_w )
AM_RANGE(0x8060, 0x8061) AM_WRITE(goodejan_bg_scrollx_w )
AM_RANGE(0x8062, 0x8063) AM_WRITE(goodejan_bg_scrolly_w )
AM_RANGE(0xb004, 0xb005) AM_WRITE(mahjong_panel_w)
AM_RANGE(0xc000, 0xc001) AM_READ(goodejan_read_ff)
AM_RANGE(0xc000, 0xc001) AM_READ_PORT("DSW1")
AM_RANGE(0xc002, 0xc003) AM_READ(mahjong_panel_r)
AM_RANGE(0xc004, 0xc005) AM_READ_PORT("DSW2") // maybe it's a seibu_main_word mirror?
// AM_RANGE(0xc004, 0xc005) AM_READ(random_reading)
AM_RANGE(0xd000, 0xd00f) AM_READWRITE(seibu_main_word_r, seibu_main_word_w)
@ -177,8 +176,8 @@ static INPUT_PORTS_START( goodejan )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("DSW")
PORT_DIPNAME( 0x0001, 0x0001, "4" )
PORT_START("DSW1")
PORT_DIPNAME( 0x0001, 0x0001, "0" )
PORT_DIPSETTING( 0x0001, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) )
@ -190,7 +189,56 @@ static INPUT_PORTS_START( goodejan )
PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x0008, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0010, 0x0000, DEF_STR( Unknown ) ) // Freezes if off?
PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x0010, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x0020, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0040, 0x0040, "Cross Hatch Test" )
PORT_DIPSETTING( 0x0040, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x0080, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x0100, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x0200, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x0400, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x0800, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x1000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x2000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x4000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x8000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_START("DSW2")
PORT_DIPNAME( 0x0001, 0x0001, "1" )
PORT_DIPSETTING( 0x0001, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x0002, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x0004, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x0008, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0010, 0x0000, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x0010, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) )
@ -318,8 +366,7 @@ ROM_START( totmejan )
ROM_LOAD16_BYTE( "4.061", 0x00001, 0x10000, CRC(29fb6ad2) SHA1(8a9c4625472daefca7fb73a9ef3717e86c3d632f) )
ROM_REGION( 0x100000, "gfx2", ROMREGION_DISPOSE )
ROM_LOAD( "e-jan.064", 0x080000, 0x080000, CRC(5f6185ee) SHA1(599e4a574672cd1571032e879b3032d06b70e4e2) )
ROM_CONTINUE(0x00000,0x80000)
ROM_LOAD( "e-jan.064", 0x000000, 0x100000, CRC(5f6185ee) SHA1(599e4a574672cd1571032e879b3032d06b70e4e2) )
ROM_REGION( 0x080000, "gfx3", ROMREGION_DISPOSE )
ROM_LOAD( "e-jan.078", 0x000000, 0x080000, CRC(ff9ee9d8) SHA1(5e49e9a666630ca9867ee96b9d2b8d6f503b25df) )
@ -346,7 +393,8 @@ ROM_START( goodejan )
ROM_LOAD16_BYTE( "4.061", 0x00001, 0x10000, CRC(5bdf7225) SHA1(a8eded9dc5be1db20cddbed1ae8c22de1674de2a) )
ROM_REGION( 0x100000, "gfx2", ROMREGION_DISPOSE )
ROM_LOAD( "e_jan2scr.064", 0x000000, 0x100000, CRC(71654822) SHA1(fe2a128413999085e321e455aeebda0360d38cb8) )
ROM_LOAD( "e_jan2scr.064", 0x080000, 0x080000, CRC(71654822) SHA1(fe2a128413999085e321e455aeebda0360d38cb8) )
ROM_CONTINUE( 0x000000, 0x080000 )
ROM_REGION( 0x080000, "gfx3", ROMREGION_DISPOSE )
ROM_LOAD( "e_jan2obj.078", 0x000000, 0x080000, CRC(0f892ef2) SHA1(188ae43db1c48fb6870aa45c64718e901831499b) )
@ -373,7 +421,8 @@ ROM_START( goodejaa )
ROM_LOAD16_BYTE( "4.061", 0x00001, 0x10000, CRC(5bdf7225) SHA1(a8eded9dc5be1db20cddbed1ae8c22de1674de2a) )
ROM_REGION( 0x100000, "gfx2", ROMREGION_DISPOSE )
ROM_LOAD( "e_jan2scr.064", 0x000000, 0x100000, CRC(71654822) SHA1(fe2a128413999085e321e455aeebda0360d38cb8) )
ROM_LOAD( "e_jan2scr.064", 0x080000, 0x080000, CRC(71654822) SHA1(fe2a128413999085e321e455aeebda0360d38cb8) )
ROM_CONTINUE( 0x000000, 0x080000 )
ROM_REGION( 0x080000, "gfx3", ROMREGION_DISPOSE )
ROM_LOAD( "e_jan2obj.078", 0x000000, 0x080000, CRC(0f892ef2) SHA1(188ae43db1c48fb6870aa45c64718e901831499b) )

View File

@ -2,6 +2,7 @@
static tilemap *bg_tilemap, *tx_tilemap;
UINT16 *goodejan_bgvram,*goodejan_txvram;
static UINT16 goodejan_layer_en;
WRITE16_HANDLER( goodejan_bgvram_w )
{
@ -15,13 +16,21 @@ WRITE16_HANDLER( goodejan_txvram_w )
tilemap_mark_tile_dirty(tx_tilemap,offset);
}
WRITE16_HANDLER( goodejan_layer_en_w )
{
/*---- ---- ---x ---- enable sprites*/
/*---- ---- ---- xxxx enable layers*/
goodejan_layer_en = data;
}
static TILE_GET_INFO( goodejan_bg_tile_info )
{
int tile = goodejan_bgvram[tile_index]&0x0fff;
int color = (goodejan_bgvram[tile_index]&0xf000)>>12;
// WRONG!
if ((goodejan_bgvram[tile_index]&0x8000)==0x0000) tile+=0x1000;
tile|= (goodejan_bgvram[tile_index]&0x8000)>>3;
// if ((goodejan_bgvram[tile_index]&0x8000)==0x0000) tile+=0x1000;
SET_TILE_INFO(1, tile, color, 0);
}
@ -48,11 +57,13 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan
y = spriteram16[offs+3];//&0x1ff;
x = spriteram16[offs+2];//&0x1ff;
if (spriteram16[offs+2]&0x8000) x=0x10000-x;
if (spriteram16[offs+3]&0x8000) y=0x10000-y;
if (x&0x8000) x=0-(0x200-(x&0x1ff));
//else x&=0x1ff;
if (y&0x8000) y=0-(0x200-(y&0x1ff));
//else y&=0x1ff;
color = spriteram16[offs+0]&0x3f;
fx = spriteram16[offs+0]&0x40;
fx = spriteram16[offs+0]&0x4000;
fy = 0; /* To do - probably 0x2000 */
dy = ((spriteram16[offs+0]&0x0380)>>7) + 1;
dx = ((spriteram16[offs+0]&0x1c00)>>10) + 1;
@ -86,19 +97,21 @@ WRITE16_HANDLER( goodejan_bg_scrolly_w )
VIDEO_START( goodejan )
{
bg_tilemap = tilemap_create(machine, goodejan_bg_tile_info,tilemap_scan_rows, 16,16,32,32);
bg_tilemap = tilemap_create(machine, goodejan_bg_tile_info,tilemap_scan_rows, 16,16,32,32);
tx_tilemap = tilemap_create(machine, goodejan_tx_tile_info,tilemap_scan_rows, 8, 8,32,32);
tilemap_set_transparent_pen(tx_tilemap,15);
}
VIDEO_UPDATE( goodejan )
{
tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
draw_sprites(screen->machine, bitmap,cliprect, 2);
draw_sprites(screen->machine, bitmap,cliprect, 1);
draw_sprites(screen->machine, bitmap,cliprect, 0);
tilemap_draw(bitmap,cliprect,tx_tilemap,0,0);
draw_sprites(screen->machine, bitmap,cliprect, 3);
bitmap_fill(bitmap, cliprect, screen->machine->pens[0]); //black pen,likely to be selectable by a crt register
if(!(goodejan_layer_en & 1)) { tilemap_draw(bitmap,cliprect,bg_tilemap,0,0); }
if(!(goodejan_layer_en & 0x10)) { draw_sprites(screen->machine, bitmap,cliprect, 2); }
if(!(goodejan_layer_en & 0x10)) { draw_sprites(screen->machine, bitmap,cliprect, 1); }
if(!(goodejan_layer_en & 0x10)) { draw_sprites(screen->machine, bitmap,cliprect, 0); }
if(!(goodejan_layer_en & 8)) { tilemap_draw(bitmap,cliprect,tx_tilemap,0,0); }
if(!(goodejan_layer_en & 0x10)) { draw_sprites(screen->machine, bitmap,cliprect, 3); }
return 0;
}