Converted Seibu CRTC to a proper device [Angelo Salese]

This commit is contained in:
Angelo Salese 2013-07-12 00:47:07 +00:00
parent c18ea1ae34
commit 4dbe2037c8
6 changed files with 223 additions and 124 deletions

1
.gitattributes vendored
View File

@ -4480,7 +4480,6 @@ src/mame/includes/segas24.h svneol=native#text/plain
src/mame/includes/segas32.h svneol=native#text/plain
src/mame/includes/segaxbd.h svneol=native#text/plain
src/mame/includes/segaybd.h svneol=native#text/plain
src/mame/includes/sei_crtc.h svneol=native#text/plain
src/mame/includes/seibuspi.h svneol=native#text/plain
src/mame/includes/seicross.h svneol=native#text/plain
src/mame/includes/senjyo.h svneol=native#text/plain

View File

@ -54,7 +54,7 @@ Notes:
#include "cpu/nec/nec.h"
#include "audio/seibu.h"
#include "sound/3812intf.h"
//#include "includes/sei_crtc.h"
#include "video/seibu_crtc.h"
class goodejan_state : public driver_device
@ -66,7 +66,6 @@ public:
m_sc1_vram(*this, "sc1_vram"),
m_sc2_vram(*this, "sc2_vram"),
m_sc3_vram(*this, "sc3_vram"),
m_seibucrtc_vregs(*this, "crtc_vregs"),
m_spriteram16(*this, "sprite_ram"),
m_maincpu(*this, "maincpu") { }
@ -74,14 +73,12 @@ public:
required_shared_ptr<UINT16> m_sc1_vram;
required_shared_ptr<UINT16> m_sc2_vram;
required_shared_ptr<UINT16> m_sc3_vram;
required_shared_ptr<UINT16> m_seibucrtc_vregs;
required_shared_ptr<UINT16> m_spriteram16;
required_device<cpu_device> m_maincpu;
tilemap_t *m_sc0_tilemap;
tilemap_t *m_sc1_tilemap;
tilemap_t *m_sc2_tilemap;
tilemap_t *m_sc3_tilemap_0;
tilemap_t *m_sc3_tilemap_1;
tilemap_t *m_sc3_tilemap;
UINT16 m_mux_data;
UINT16 m_seibucrtc_sc0bank;
DECLARE_WRITE16_MEMBER(goodejan_gfxbank_w);
@ -91,12 +88,15 @@ public:
DECLARE_WRITE16_MEMBER(seibucrtc_sc1vram_w);
DECLARE_WRITE16_MEMBER(seibucrtc_sc2vram_w);
DECLARE_WRITE16_MEMBER(seibucrtc_sc3vram_w);
DECLARE_WRITE16_MEMBER(seibucrtc_vregs_w);
TILE_GET_INFO_MEMBER(seibucrtc_sc0_tile_info);
TILE_GET_INFO_MEMBER(seibucrtc_sc1_tile_info);
TILE_GET_INFO_MEMBER(seibucrtc_sc2_tile_info);
TILE_GET_INFO_MEMBER(seibucrtc_sc3_tile_info);
INTERRUPT_GEN_MEMBER(goodejan_irq);
DECLARE_WRITE16_MEMBER(layer_en_w);
DECLARE_WRITE16_MEMBER(layer_scroll_w);
UINT16 m_layer_en;
UINT16 m_scrollram[6];
void seibucrtc_sc0bank_w(UINT16 data);
void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int pri);
virtual void video_start();
@ -109,6 +109,43 @@ public:
*
*******************************/
#define SEIBU_CRTC_ENABLE_SC0 (!(m_layer_en & 0x0001))
#define SEIBU_CRTC_ENABLE_SC2 (!(m_layer_en & 0x0002))
#define SEIBU_CRTC_ENABLE_SC1 (!(m_layer_en & 0x0004))
#define SEIBU_CRTC_ENABLE_SC3 (!(m_layer_en & 0x0008))
#define SEIBU_CRTC_ENABLE_SPR (!(m_layer_en & 0x0010))
/************************************
* 0x20 - Screen 0 (BG) scroll x
************************************/
#define SEIBU_CRTC_SC0_SX (m_scrollram[0])
/************************************
* 0x22 - Screen 0 (BG) scroll y
************************************/
#define SEIBU_CRTC_SC0_SY (m_scrollram[1])
/************************************
* 0x24 - Screen 1 (FG) scroll x
************************************/
#define SEIBU_CRTC_SC1_SX (m_scrollram[4])
/************************************
* 0x26 - Screen 1 (FG) scroll y
************************************/
#define SEIBU_CRTC_SC1_SY (m_scrollram[5])
/************************************
* 0x28 - Screen 2 (MD) scroll x
************************************/
#define SEIBU_CRTC_SC2_SX (m_scrollram[2])
/************************************
* 0x2a - Screen 2 (MD) scroll y
************************************/
#define SEIBU_CRTC_SC2_SY (m_scrollram[3])
#if 0
/*******************************
* 0x1a - Layer Dynamic Paging?
*******************************/
@ -165,6 +202,7 @@ public:
************************************/
#define SEIBU_CRTC_FIX_SY (m_seibucrtc_vregs[0x002e/2])
#endif
/*******************************
*
@ -193,16 +231,9 @@ WRITE16_MEMBER( goodejan_state::seibucrtc_sc1vram_w )
WRITE16_MEMBER( goodejan_state::seibucrtc_sc3vram_w )
{
COMBINE_DATA(&m_sc3_vram[offset]);
m_sc3_tilemap_0->mark_tile_dirty(offset);
m_sc3_tilemap_1->mark_tile_dirty(offset);
m_sc3_tilemap->mark_tile_dirty(offset);
}
WRITE16_MEMBER( goodejan_state::seibucrtc_vregs_w )
{
COMBINE_DATA(&m_seibucrtc_vregs[offset]);
}
/* Actually external from the CRTC */
void goodejan_state::seibucrtc_sc0bank_w(UINT16 data)
{
m_seibucrtc_sc0bank = data & 1;
@ -296,13 +327,11 @@ void goodejan_state::video_start()
m_sc0_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(goodejan_state::seibucrtc_sc0_tile_info),this),TILEMAP_SCAN_ROWS,16,16,32,32);
m_sc2_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(goodejan_state::seibucrtc_sc2_tile_info),this),TILEMAP_SCAN_ROWS,16,16,32,32);
m_sc1_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(goodejan_state::seibucrtc_sc1_tile_info),this),TILEMAP_SCAN_ROWS,16,16,32,32);
m_sc3_tilemap_0 = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(goodejan_state::seibucrtc_sc3_tile_info),this),TILEMAP_SCAN_ROWS,8,8,32,32);
m_sc3_tilemap_1 = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(goodejan_state::seibucrtc_sc3_tile_info),this),TILEMAP_SCAN_ROWS,8,8,64,32);
m_sc3_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(goodejan_state::seibucrtc_sc3_tile_info),this),TILEMAP_SCAN_ROWS,8,8,32,32);
m_sc2_tilemap->set_transparent_pen(15);
m_sc1_tilemap->set_transparent_pen(15);
m_sc3_tilemap_0->set_transparent_pen(15);
m_sc3_tilemap_1->set_transparent_pen(15);
m_sc3_tilemap->set_transparent_pen(15);
m_seibucrtc_sc0bank = 0;
}
@ -311,14 +340,14 @@ UINT32 goodejan_state::screen_update_goodejan(screen_device &screen, bitmap_ind1
{
bitmap.fill(screen.machine().pens[0x7ff], cliprect); //black pen
m_sc0_tilemap->set_scrollx(0, (SEIBU_CRTC_SC0_SX + SEIBU_CRTC_FIX_SX+64) & 0x1ff );
m_sc0_tilemap->set_scrolly(0, (SEIBU_CRTC_SC0_SY + SEIBU_CRTC_FIX_SY+1) & 0x1ff );
m_sc2_tilemap->set_scrollx(0, (SEIBU_CRTC_SC2_SX + SEIBU_CRTC_FIX_SX+64) & 0x1ff );
m_sc2_tilemap->set_scrolly(0, (SEIBU_CRTC_SC2_SY + SEIBU_CRTC_FIX_SY+1) & 0x1ff );
m_sc1_tilemap->set_scrollx(0, (SEIBU_CRTC_SC1_SX + SEIBU_CRTC_FIX_SX+64) & 0x1ff );
m_sc1_tilemap->set_scrolly(0, (SEIBU_CRTC_SC1_SY + SEIBU_CRTC_FIX_SY+1) & 0x1ff );
(SEIBU_CRTC_SC3_PAGE_SEL ? m_sc3_tilemap_0 : m_sc3_tilemap_1)->set_scrollx(0, (SEIBU_CRTC_FIX_SX+64) & 0x1ff );
(SEIBU_CRTC_SC3_PAGE_SEL ? m_sc3_tilemap_0 : m_sc3_tilemap_1)->set_scrolly(0, (SEIBU_CRTC_FIX_SY+1) & 0x1ff );
m_sc0_tilemap->set_scrollx(0, (SEIBU_CRTC_SC0_SX) & 0x1ff );
m_sc0_tilemap->set_scrolly(0, (SEIBU_CRTC_SC0_SY) & 0x1ff );
m_sc2_tilemap->set_scrollx(0, (SEIBU_CRTC_SC2_SX) & 0x1ff );
m_sc2_tilemap->set_scrolly(0, (SEIBU_CRTC_SC2_SY) & 0x1ff );
m_sc1_tilemap->set_scrollx(0, (SEIBU_CRTC_SC1_SX) & 0x1ff );
m_sc1_tilemap->set_scrolly(0, (SEIBU_CRTC_SC1_SY) & 0x1ff );
m_sc3_tilemap->set_scrollx(0, (0) & 0x1ff );
m_sc3_tilemap->set_scrolly(0, (0) & 0x1ff );
if(SEIBU_CRTC_ENABLE_SC0) { m_sc0_tilemap->draw(bitmap, cliprect, 0,0); }
if(SEIBU_CRTC_ENABLE_SPR) { draw_sprites(screen.machine(), bitmap,cliprect, 2); }
@ -326,7 +355,7 @@ UINT32 goodejan_state::screen_update_goodejan(screen_device &screen, bitmap_ind1
if(SEIBU_CRTC_ENABLE_SPR) { draw_sprites(screen.machine(), bitmap,cliprect, 1); }
if(SEIBU_CRTC_ENABLE_SC1) { m_sc1_tilemap->draw(bitmap, cliprect, 0,0); }
if(SEIBU_CRTC_ENABLE_SPR) { draw_sprites(screen.machine(), bitmap,cliprect, 0); }
if(SEIBU_CRTC_ENABLE_SC3) { (SEIBU_CRTC_SC3_PAGE_SEL ? m_sc3_tilemap_0 : m_sc3_tilemap_1)->draw(bitmap, cliprect, 0,0); }
if(SEIBU_CRTC_ENABLE_SC3) { m_sc3_tilemap->draw(bitmap, cliprect, 0,0); }
if(SEIBU_CRTC_ENABLE_SPR) { draw_sprites(screen.machine(), bitmap,cliprect, 3); }
return 0;
@ -340,7 +369,7 @@ UINT32 goodejan_state::screen_update_goodejan(screen_device &screen, bitmap_ind1
WRITE16_MEMBER(goodejan_state::goodejan_gfxbank_w)
{
seibucrtc_sc0bank_w((data & 0x100)>>8);// = (data & 0x100)>>8;
seibucrtc_sc0bank_w((data & 0x100)>>8);
}
/* Multiplexer device for the mahjong panel */
@ -391,12 +420,12 @@ static ADDRESS_MAP_START( common_io_map, AS_IO, 16, goodejan_state )
ADDRESS_MAP_END
static ADDRESS_MAP_START( totmejan_io_map, AS_IO, 16, goodejan_state )
AM_RANGE(0x8000, 0x804f) AM_RAM_WRITE(seibucrtc_vregs_w) AM_SHARE("crtc_vregs")
AM_RANGE(0x8000, 0x804f) AM_DEVREADWRITE("crtc", seibu_crtc_device, read, write)
AM_IMPORT_FROM(common_io_map)
ADDRESS_MAP_END
static ADDRESS_MAP_START( goodejan_io_map, AS_IO, 16, goodejan_state )
AM_RANGE(0x8040, 0x807f) AM_RAM_WRITE(seibucrtc_vregs_w) AM_SHARE("crtc_vregs")
AM_RANGE(0x8040, 0x807f) AM_DEVREADWRITE("crtc", seibu_crtc_device, read, write)
AM_IMPORT_FROM(common_io_map)
ADDRESS_MAP_END
@ -598,6 +627,25 @@ INTERRUPT_GEN_MEMBER(goodejan_state::goodejan_irq)
/* vector 0x00c is just a reti */
}
WRITE16_MEMBER( goodejan_state::layer_en_w )
{
m_layer_en = data;
}
WRITE16_MEMBER( goodejan_state::layer_scroll_w )
{
COMBINE_DATA(&m_scrollram[offset]);
}
SEIBU_CRTC_INTERFACE(crtc_intf)
{
"screen",
DEVCB_DRIVER_MEMBER16(goodejan_state, layer_en_w),
DEVCB_DRIVER_MEMBER16(goodejan_state, layer_scroll_w),
};
static MACHINE_CONFIG_START( goodejan, goodejan_state )
/* basic machine hardware */
@ -618,6 +666,8 @@ static MACHINE_CONFIG_START( goodejan, goodejan_state )
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) //TODO: dynamic resolution
MCFG_SCREEN_UPDATE_DRIVER(goodejan_state, screen_update_goodejan)
MCFG_SEIBU_CRTC_ADD("crtc",crtc_intf,0)
MCFG_GFXDECODE(goodejan)
MCFG_PALETTE_LENGTH(0x1000)

View File

@ -55,7 +55,7 @@ RSSENGO2.72 chr.
#include "cpu/nec/nec.h"
#include "audio/seibu.h"
#include "sound/3812intf.h"
//#include "includes/sei_crtc.h"
#include "video/seibu_crtc.h"
#include "machine/nvram.h"
@ -68,7 +68,6 @@ public:
m_sc1_vram(*this, "sc1_vram"),
m_sc2_vram(*this, "sc2_vram"),
m_sc3_vram(*this, "sc3_vram"),
m_seibucrtc_vregs(*this, "crtc_vregs"),
m_spriteram16(*this, "sprite_ram"),
m_maincpu(*this, "maincpu") { }
@ -76,17 +75,16 @@ public:
required_shared_ptr<UINT16> m_sc1_vram;
required_shared_ptr<UINT16> m_sc2_vram;
required_shared_ptr<UINT16> m_sc3_vram;
required_shared_ptr<UINT16> m_seibucrtc_vregs;
required_shared_ptr<UINT16> m_spriteram16;
required_device<cpu_device> m_maincpu;
tilemap_t *m_sc0_tilemap;
tilemap_t *m_sc1_tilemap;
tilemap_t *m_sc2_tilemap;
tilemap_t *m_sc3_tilemap_0;
tilemap_t *m_sc3_tilemap_1;
tilemap_t *m_sc3_tilemap;
UINT16 m_sengokumj_mux_data;
UINT8 m_hopper_io;
UINT16 m_seibucrtc_sc0bank;
UINT16 m_layer_en;
UINT16 m_scrollram[6];
DECLARE_READ16_MEMBER(mahjong_panel_r);
DECLARE_WRITE16_MEMBER(mahjong_panel_w);
DECLARE_WRITE16_MEMBER(sengokmj_out_w);
@ -95,13 +93,14 @@ public:
DECLARE_WRITE16_MEMBER(seibucrtc_sc1vram_w);
DECLARE_WRITE16_MEMBER(seibucrtc_sc2vram_w);
DECLARE_WRITE16_MEMBER(seibucrtc_sc3vram_w);
DECLARE_WRITE16_MEMBER(seibucrtc_vregs_w);
TILE_GET_INFO_MEMBER(seibucrtc_sc0_tile_info);
TILE_GET_INFO_MEMBER(seibucrtc_sc1_tile_info);
TILE_GET_INFO_MEMBER(seibucrtc_sc2_tile_info);
TILE_GET_INFO_MEMBER(seibucrtc_sc3_tile_info);
INTERRUPT_GEN_MEMBER(sengokmj_interrupt);
void seibucrtc_sc0bank_w(UINT16 data);
DECLARE_WRITE16_MEMBER(layer_en_w);
DECLARE_WRITE16_MEMBER(layer_scroll_w);
void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int pri);
virtual void video_start();
UINT32 screen_update_sengokmj(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@ -114,6 +113,43 @@ public:
*
*******************************/
#define SEIBU_CRTC_ENABLE_SC0 (!(m_layer_en & 0x0001))
#define SEIBU_CRTC_ENABLE_SC2 (!(m_layer_en & 0x0002))
#define SEIBU_CRTC_ENABLE_SC1 (!(m_layer_en & 0x0004))
#define SEIBU_CRTC_ENABLE_SC3 (!(m_layer_en & 0x0008))
#define SEIBU_CRTC_ENABLE_SPR (!(m_layer_en & 0x0010))
/************************************
* 0x20 - Screen 0 (BG) scroll x
************************************/
#define SEIBU_CRTC_SC0_SX (m_scrollram[0])
/************************************
* 0x22 - Screen 0 (BG) scroll y
************************************/
#define SEIBU_CRTC_SC0_SY (m_scrollram[1])
/************************************
* 0x24 - Screen 1 (FG) scroll x
************************************/
#define SEIBU_CRTC_SC1_SX (m_scrollram[4])
/************************************
* 0x26 - Screen 1 (FG) scroll y
************************************/
#define SEIBU_CRTC_SC1_SY (m_scrollram[5])
/************************************
* 0x28 - Screen 2 (MD) scroll x
************************************/
#define SEIBU_CRTC_SC2_SX (m_scrollram[2])
/************************************
* 0x2a - Screen 2 (MD) scroll y
************************************/
#define SEIBU_CRTC_SC2_SY (m_scrollram[3])
#if 0
/*******************************
* 0x1a - Layer Dynamic Paging?
*******************************/
@ -123,42 +159,8 @@ public:
/*******************************
* 0x1c - Layer Enable
*******************************/
#define SEIBU_CRTC_LAYER_EN (m_seibucrtc_vregs[0x001c/2])
#define SEIBU_CRTC_ENABLE_SC0 (!(SEIBU_CRTC_LAYER_EN & 0x0001))
#define SEIBU_CRTC_ENABLE_SC2 (!(SEIBU_CRTC_LAYER_EN & 0x0002))
#define SEIBU_CRTC_ENABLE_SC1 (!(SEIBU_CRTC_LAYER_EN & 0x0004))
#define SEIBU_CRTC_ENABLE_SC3 (!(SEIBU_CRTC_LAYER_EN & 0x0008))
#define SEIBU_CRTC_ENABLE_SPR (!(SEIBU_CRTC_LAYER_EN & 0x0010))
/************************************
* 0x20 - Screen 0 (BG) scroll x
************************************/
#define SEIBU_CRTC_SC0_SX (m_seibucrtc_vregs[0x0020/2])
/************************************
* 0x22 - Screen 0 (BG) scroll y
************************************/
#define SEIBU_CRTC_SC0_SY (m_seibucrtc_vregs[0x0022/2])
/************************************
* 0x24 - Screen 1 (FG) scroll x
************************************/
#define SEIBU_CRTC_SC1_SX (m_seibucrtc_vregs[0x0028/2])
/************************************
* 0x26 - Screen 1 (FG) scroll y
************************************/
#define SEIBU_CRTC_SC1_SY (m_seibucrtc_vregs[0x002a/2])
/************************************
* 0x28 - Screen 2 (MD) scroll x
************************************/
#define SEIBU_CRTC_SC2_SX (m_seibucrtc_vregs[0x0024/2])
/************************************
* 0x2a - Screen 2 (MD) scroll y
************************************/
#define SEIBU_CRTC_SC2_SY (m_seibucrtc_vregs[0x0026/2])
/************************************
* 0x2c - Fix screen scroll x (global)
@ -169,7 +171,7 @@ public:
* 0x2e - Fix screen scroll y (global)
************************************/
#define SEIBU_CRTC_FIX_SY (m_seibucrtc_vregs[0x002e/2])
#endif
/*******************************
*
@ -198,23 +200,9 @@ WRITE16_MEMBER( sengokmj_state::seibucrtc_sc1vram_w )
WRITE16_MEMBER( sengokmj_state::seibucrtc_sc3vram_w )
{
COMBINE_DATA(&m_sc3_vram[offset]);
m_sc3_tilemap_0->mark_tile_dirty(offset);
m_sc3_tilemap_1->mark_tile_dirty(offset);
m_sc3_tilemap->mark_tile_dirty(offset);
}
WRITE16_MEMBER( sengokmj_state::seibucrtc_vregs_w )
{
COMBINE_DATA(&m_seibucrtc_vregs[offset]);
}
/* Actually external from the CRTC */
void sengokmj_state::seibucrtc_sc0bank_w(UINT16 data)
{
m_seibucrtc_sc0bank = data & 1;
m_sc0_tilemap->mark_all_dirty();
}
/*******************************
*
* Tilemap info accesses
@ -225,7 +213,7 @@ TILE_GET_INFO_MEMBER( sengokmj_state::seibucrtc_sc0_tile_info )
{
int tile = m_sc0_vram[tile_index] & 0xfff;
int color = (m_sc0_vram[tile_index] >> 12) & 0x0f;
tile+=(m_seibucrtc_sc0bank<<12);
// tile+=(m_seibucrtc_sc0bank<<12);
SET_TILE_INFO_MEMBER(1, tile, color, 0);
}
@ -301,29 +289,26 @@ void sengokmj_state::video_start()
m_sc0_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(sengokmj_state::seibucrtc_sc0_tile_info),this),TILEMAP_SCAN_ROWS,16,16,32,32);
m_sc2_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(sengokmj_state::seibucrtc_sc2_tile_info),this),TILEMAP_SCAN_ROWS,16,16,32,32);
m_sc1_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(sengokmj_state::seibucrtc_sc1_tile_info),this),TILEMAP_SCAN_ROWS,16,16,32,32);
m_sc3_tilemap_0 = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(sengokmj_state::seibucrtc_sc3_tile_info),this),TILEMAP_SCAN_ROWS,8,8,32,32);
m_sc3_tilemap_1 = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(sengokmj_state::seibucrtc_sc3_tile_info),this),TILEMAP_SCAN_ROWS,8,8,64,32);
m_sc3_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(sengokmj_state::seibucrtc_sc3_tile_info),this),TILEMAP_SCAN_ROWS,8,8,64,32);
m_sc2_tilemap->set_transparent_pen(15);
m_sc1_tilemap->set_transparent_pen(15);
m_sc3_tilemap_0->set_transparent_pen(15);
m_sc3_tilemap_1->set_transparent_pen(15);
m_seibucrtc_sc0bank = 0;
m_sc3_tilemap->set_transparent_pen(15);
}
UINT32 sengokmj_state::screen_update_sengokmj(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
bitmap.fill(screen.machine().pens[0x7ff], cliprect); //black pen
m_sc0_tilemap->set_scrollx(0, (SEIBU_CRTC_SC0_SX + SEIBU_CRTC_FIX_SX+64) & 0x1ff );
m_sc0_tilemap->set_scrolly(0, (SEIBU_CRTC_SC0_SY + SEIBU_CRTC_FIX_SY+1) & 0x1ff );
m_sc2_tilemap->set_scrollx(0, (SEIBU_CRTC_SC2_SX + SEIBU_CRTC_FIX_SX+64) & 0x1ff );
m_sc2_tilemap->set_scrolly(0, (SEIBU_CRTC_SC2_SY + SEIBU_CRTC_FIX_SY+1) & 0x1ff );
m_sc1_tilemap->set_scrollx(0, (SEIBU_CRTC_SC1_SX + SEIBU_CRTC_FIX_SX+64) & 0x1ff );
m_sc1_tilemap->set_scrolly(0, (SEIBU_CRTC_SC1_SY + SEIBU_CRTC_FIX_SY+1) & 0x1ff );
(SEIBU_CRTC_SC3_PAGE_SEL ? m_sc3_tilemap_0 : m_sc3_tilemap_1)->set_scrollx(0, (SEIBU_CRTC_FIX_SX+64) & 0x1ff );
(SEIBU_CRTC_SC3_PAGE_SEL ? m_sc3_tilemap_0 : m_sc3_tilemap_1)->set_scrolly(0, (SEIBU_CRTC_FIX_SY+1) & 0x1ff );
/* TODO: offsetted? */
m_sc0_tilemap->set_scrollx(0, (SEIBU_CRTC_SC0_SX + 128) & 0x1ff );
m_sc0_tilemap->set_scrolly(0, (SEIBU_CRTC_SC0_SY) & 0x1ff );
m_sc2_tilemap->set_scrollx(0, (SEIBU_CRTC_SC2_SX + 128) & 0x1ff );
m_sc2_tilemap->set_scrolly(0, (SEIBU_CRTC_SC2_SY) & 0x1ff );
m_sc1_tilemap->set_scrollx(0, (SEIBU_CRTC_SC1_SX + 128) & 0x1ff );
m_sc1_tilemap->set_scrolly(0, (SEIBU_CRTC_SC1_SY) & 0x1ff );
m_sc3_tilemap->set_scrollx(0, (128) & 0x1ff );
m_sc3_tilemap->set_scrolly(0, (0) & 0x1ff );
if(SEIBU_CRTC_ENABLE_SC0) { m_sc0_tilemap->draw(bitmap, cliprect, 0,0); }
if(SEIBU_CRTC_ENABLE_SPR) { draw_sprites(screen.machine(), bitmap,cliprect, 2); }
@ -331,7 +316,7 @@ UINT32 sengokmj_state::screen_update_sengokmj(screen_device &screen, bitmap_ind1
if(SEIBU_CRTC_ENABLE_SPR) { draw_sprites(screen.machine(), bitmap,cliprect, 1); }
if(SEIBU_CRTC_ENABLE_SC1) { m_sc1_tilemap->draw(bitmap, cliprect, 0,0); }
if(SEIBU_CRTC_ENABLE_SPR) { draw_sprites(screen.machine(), bitmap,cliprect, 0); }
if(SEIBU_CRTC_ENABLE_SC3) { (SEIBU_CRTC_SC3_PAGE_SEL ? m_sc3_tilemap_0 : m_sc3_tilemap_1)->draw(bitmap, cliprect, 0,0); }
if(SEIBU_CRTC_ENABLE_SC3) { m_sc3_tilemap->draw(bitmap, cliprect, 0,0); }
if(SEIBU_CRTC_ENABLE_SPR) { draw_sprites(screen.machine(), bitmap,cliprect, 3); }
return 0;
@ -397,7 +382,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sengokmj_io_map, AS_IO, 16, sengokmj_state )
AM_RANGE(0x4000, 0x400f) AM_READWRITE_LEGACY(seibu_main_word_r, seibu_main_word_w)
/*Areas from 8000-804f are for the custom Seibu CRTC.*/
AM_RANGE(0x8000, 0x804f) AM_RAM_WRITE(seibucrtc_vregs_w) AM_SHARE("crtc_vregs")
AM_RANGE(0x8000, 0x804f) AM_DEVREADWRITE("crtc", seibu_crtc_device, read, write)
// AM_RANGE(0x8080, 0x8081) CRTC extra register?
// AM_RANGE(0x80c0, 0x80c1) CRTC extra register?
@ -558,6 +543,24 @@ INTERRUPT_GEN_MEMBER(sengokmj_state::sengokmj_interrupt)
device.execute().set_input_line_and_vector(0,HOLD_LINE,0xc8/4);
}
WRITE16_MEMBER( sengokmj_state::layer_en_w )
{
m_layer_en = data;
}
WRITE16_MEMBER( sengokmj_state::layer_scroll_w )
{
COMBINE_DATA(&m_scrollram[offset]);
}
SEIBU_CRTC_INTERFACE(crtc_intf)
{
"screen",
DEVCB_DRIVER_MEMBER16(sengokmj_state, layer_en_w),
DEVCB_DRIVER_MEMBER16(sengokmj_state, layer_scroll_w),
};
static MACHINE_CONFIG_START( sengokmj, sengokmj_state )
/* basic machine hardware */
@ -579,6 +582,8 @@ static MACHINE_CONFIG_START( sengokmj, sengokmj_state )
MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 16, 256-1) //TODO: dynamic resolution
MCFG_SCREEN_UPDATE_DRIVER(sengokmj_state, screen_update_sengokmj)
MCFG_SEIBU_CRTC_ADD("crtc",crtc_intf,0)
MCFG_GFXDECODE(sengokmj)
MCFG_PALETTE_LENGTH(0x800)

View File

@ -1,12 +0,0 @@
/*----------- defined in video/sei_crtc.c -----------*/
extern UINT16 seibucrtc_sc0bank;
DECLARE_WRITE16_HANDLER( seibucrtc_sc0vram_w );
DECLARE_WRITE16_HANDLER( seibucrtc_sc1vram_w );
DECLARE_WRITE16_HANDLER( seibucrtc_sc2vram_w );
DECLARE_WRITE16_HANDLER( seibucrtc_sc3vram_w );
DECLARE_WRITE16_HANDLER( seibucrtc_vregs_w );
void seibucrtc_sc0bank_w(UINT16 data);
VIDEO_START( seibu_crtc );
SCREEN_UPDATE_IND16( seibu_crtc );

View File

@ -117,6 +117,24 @@ List of default vregs (title screen):
// device type definition
const device_type SEIBU_CRTC = &device_creator<seibu_crtc_device>;
static ADDRESS_MAP_START( seibu_crtc_vregs, AS_0, 16, seibu_crtc_device )
AM_RANGE(0x001c, 0x001d) AM_WRITE(layer_en_w)
AM_RANGE(0x0020, 0x002b) AM_WRITE(layer_scroll_w)
ADDRESS_MAP_END
WRITE16_MEMBER( seibu_crtc_device::layer_en_w)
{
if (!m_layer_en_func.isnull())
m_layer_en_func(0,data,mem_mask);
}
WRITE16_MEMBER( seibu_crtc_device::layer_scroll_w)
{
if (!m_layer_scroll_func.isnull())
m_layer_scroll_func(offset,data,mem_mask);
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
@ -126,7 +144,10 @@ const device_type SEIBU_CRTC = &device_creator<seibu_crtc_device>;
//-------------------------------------------------
seibu_crtc_device::seibu_crtc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, SEIBU_CRTC, "Seibu CRT Controller", tag, owner, clock, "seibu_crtc", __FILE__)
: device_t(mconfig, SEIBU_CRTC, "Seibu CRT Controller", tag, owner, clock, "seibu_crtc", __FILE__),
device_memory_interface(mconfig, *this),
m_space_config("vregs", ENDIANNESS_LITTLE, 16, 16, 0, NULL, *ADDRESS_MAP_NAME(seibu_crtc_vregs))
{
}
@ -158,6 +179,7 @@ void seibu_crtc_device::device_config_complete()
else
{
m_screen_tag = "";
// memset(&m_layer_en, 0, sizeof(m_layer_en));
}
}
@ -168,6 +190,9 @@ void seibu_crtc_device::device_config_complete()
void seibu_crtc_device::device_start()
{
m_screen = machine().device<screen_device>(m_screen_tag);
m_layer_en_func.resolve(m_layer_en_cb, *this);
m_layer_scroll_func.resolve(m_layer_scroll_cb, *this);
}
@ -179,6 +204,15 @@ void seibu_crtc_device::device_reset()
{
}
//-------------------------------------------------
// memory_space_config - return a description of
// any address spaces owned by this device
//-------------------------------------------------
const address_space_config *seibu_crtc_device::memory_space_config(address_spacenum spacenum) const
{
return (spacenum == AS_0) ? &m_space_config : NULL;
}
@ -186,6 +220,23 @@ void seibu_crtc_device::device_reset()
// INLINE HELPERS
//**************************************************************************
//-------------------------------------------------
// read_word - read a word at the given address
//-------------------------------------------------
inline UINT16 seibu_crtc_device::read_word(offs_t address)
{
return space().read_word(address << 1);
}
//-------------------------------------------------
// write_word - write a word at the given address
//-------------------------------------------------
inline void seibu_crtc_device::write_word(offs_t address, UINT16 data)
{
space().write_word(address << 1, data);
}
//**************************************************************************
// READ/WRITE HANDLERS
@ -193,10 +244,10 @@ void seibu_crtc_device::device_reset()
READ16_MEMBER( seibu_crtc_device::read )
{
return 0;
return read_word(offset);
}
WRITE16_MEMBER( seibu_crtc_device::write )
{
// ...
write_word(offset,data);
}

View File

@ -12,7 +12,9 @@ Template for skeleton device
struct seibu_crtc_interface
{
const char *m_screen_tag;
// TODO: layer enable, scrolling
devcb_write16 m_layer_en_cb;
devcb_write16 m_layer_scroll_cb;
};
//**************************************************************************
@ -34,6 +36,7 @@ struct seibu_crtc_interface
// ======================> seibu_crtc_device
class seibu_crtc_device : public device_t,
public device_memory_interface,
public seibu_crtc_interface
{
public:
@ -43,16 +46,19 @@ public:
// I/O operations
DECLARE_WRITE16_MEMBER( write );
DECLARE_READ16_MEMBER( read );
DECLARE_WRITE16_MEMBER(layer_en_w);
DECLARE_WRITE16_MEMBER(layer_scroll_w);
protected:
// device-level overrides
virtual void device_validity_check(validity_checker &valid) const;
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
screen_device *m_screen;
devcb_resolved_write16 m_layer_en_func;
devcb_resolved_write16 m_layer_scroll_func;
private:
const address_space_config m_space_config;
inline UINT16 read_word(offs_t address);