mirror of
https://github.com/holub/mame
synced 2025-06-07 13:23:50 +03:00
Death to sei_crtc dummy device, state-ized Sengoku Mahjong and Good e Jan video functions, skelly for Seibu CRTC, nw (for now ...)
This commit is contained in:
parent
5919be052a
commit
083463dab8
3
.gitattributes
vendored
3
.gitattributes
vendored
@ -5805,7 +5805,8 @@ src/mame/video/segas24.c svneol=native#text/plain
|
|||||||
src/mame/video/segas32.c svneol=native#text/plain
|
src/mame/video/segas32.c svneol=native#text/plain
|
||||||
src/mame/video/segaxbd.c svneol=native#text/plain
|
src/mame/video/segaxbd.c svneol=native#text/plain
|
||||||
src/mame/video/segaybd.c svneol=native#text/plain
|
src/mame/video/segaybd.c svneol=native#text/plain
|
||||||
src/mame/video/sei_crtc.c svneol=native#text/plain
|
src/mame/video/seibu_crtc.c svneol=native#text/plain
|
||||||
|
src/mame/video/seibu_crtc.h svneol=native#text/plain
|
||||||
src/mame/video/seibuspi.c svneol=native#text/plain
|
src/mame/video/seibuspi.c svneol=native#text/plain
|
||||||
src/mame/video/seicross.c svneol=native#text/plain
|
src/mame/video/seicross.c svneol=native#text/plain
|
||||||
src/mame/video/senjyo.c svneol=native#text/plain
|
src/mame/video/senjyo.c svneol=native#text/plain
|
||||||
|
@ -144,7 +144,7 @@ const address_space_config *m50458_device::memory_space_config(address_spacenum
|
|||||||
//**************************************************************************
|
//**************************************************************************
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
// readbyte - read a byte at the given address
|
// read_word - read a word at the given address
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
|
|
||||||
inline UINT16 m50458_device::read_word(offs_t address)
|
inline UINT16 m50458_device::read_word(offs_t address)
|
||||||
@ -153,7 +153,7 @@ inline UINT16 m50458_device::read_word(offs_t address)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
// writebyte - write a byte at the given address
|
// write_word - write a word at the given address
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
|
|
||||||
inline void m50458_device::write_word(offs_t address, UINT16 data)
|
inline void m50458_device::write_word(offs_t address, UINT16 data)
|
||||||
|
@ -54,7 +54,7 @@ Notes:
|
|||||||
#include "cpu/nec/nec.h"
|
#include "cpu/nec/nec.h"
|
||||||
#include "audio/seibu.h"
|
#include "audio/seibu.h"
|
||||||
#include "sound/3812intf.h"
|
#include "sound/3812intf.h"
|
||||||
#include "includes/sei_crtc.h"
|
//#include "includes/sei_crtc.h"
|
||||||
|
|
||||||
|
|
||||||
class goodejan_state : public driver_device
|
class goodejan_state : public driver_device
|
||||||
@ -62,16 +62,276 @@ class goodejan_state : public driver_device
|
|||||||
public:
|
public:
|
||||||
goodejan_state(const machine_config &mconfig, device_type type, const char *tag)
|
goodejan_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||||
: driver_device(mconfig, type, tag),
|
: driver_device(mconfig, type, tag),
|
||||||
|
m_sc0_vram(*this, "sc0_vram"),
|
||||||
|
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") { }
|
m_maincpu(*this, "maincpu") { }
|
||||||
|
|
||||||
|
required_shared_ptr<UINT16> m_sc0_vram;
|
||||||
|
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;
|
||||||
UINT16 m_mux_data;
|
UINT16 m_mux_data;
|
||||||
|
UINT16 m_seibucrtc_sc0bank;
|
||||||
DECLARE_WRITE16_MEMBER(goodejan_gfxbank_w);
|
DECLARE_WRITE16_MEMBER(goodejan_gfxbank_w);
|
||||||
DECLARE_READ16_MEMBER(mahjong_panel_r);
|
DECLARE_READ16_MEMBER(mahjong_panel_r);
|
||||||
DECLARE_WRITE16_MEMBER(mahjong_panel_w);
|
DECLARE_WRITE16_MEMBER(mahjong_panel_w);
|
||||||
|
DECLARE_WRITE16_MEMBER(seibucrtc_sc0vram_w);
|
||||||
|
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);
|
INTERRUPT_GEN_MEMBER(goodejan_irq);
|
||||||
required_device<cpu_device> m_maincpu;
|
void seibucrtc_sc0bank_w(UINT16 data);
|
||||||
|
void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int pri);
|
||||||
|
virtual void video_start();
|
||||||
|
UINT32 screen_update_goodejan(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*******************************
|
||||||
|
*
|
||||||
|
* Macros for the video registers
|
||||||
|
*
|
||||||
|
*******************************/
|
||||||
|
|
||||||
|
/*******************************
|
||||||
|
* 0x1a - Layer Dynamic Paging?
|
||||||
|
*******************************/
|
||||||
|
#define SEIBU_CRTC_DYN_PAGING (m_seibucrtc_vregs[0x001a/2])
|
||||||
|
#define SEIBU_CRTC_SC3_PAGE_SEL (SEIBU_CRTC_DYN_PAGING & 0x0002)
|
||||||
|
|
||||||
|
/*******************************
|
||||||
|
* 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)
|
||||||
|
************************************/
|
||||||
|
#define SEIBU_CRTC_FIX_SX (m_seibucrtc_vregs[0x002c/2])
|
||||||
|
|
||||||
|
/************************************
|
||||||
|
* 0x2e - Fix screen scroll y (global)
|
||||||
|
************************************/
|
||||||
|
#define SEIBU_CRTC_FIX_SY (m_seibucrtc_vregs[0x002e/2])
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************
|
||||||
|
*
|
||||||
|
* Write RAM accesses
|
||||||
|
*
|
||||||
|
*******************************/
|
||||||
|
|
||||||
|
WRITE16_MEMBER( goodejan_state::seibucrtc_sc0vram_w )
|
||||||
|
{
|
||||||
|
COMBINE_DATA(&m_sc0_vram[offset]);
|
||||||
|
m_sc0_tilemap->mark_tile_dirty(offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
WRITE16_MEMBER( goodejan_state::seibucrtc_sc2vram_w )
|
||||||
|
{
|
||||||
|
COMBINE_DATA(&m_sc2_vram[offset]);
|
||||||
|
m_sc2_tilemap->mark_tile_dirty(offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
WRITE16_MEMBER( goodejan_state::seibucrtc_sc1vram_w )
|
||||||
|
{
|
||||||
|
COMBINE_DATA(&m_sc1_vram[offset]);
|
||||||
|
m_sc1_tilemap->mark_tile_dirty(offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
m_sc0_tilemap->mark_all_dirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************
|
||||||
|
*
|
||||||
|
* Tilemap info accesses
|
||||||
|
*
|
||||||
|
*******************************/
|
||||||
|
|
||||||
|
TILE_GET_INFO_MEMBER( goodejan_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);
|
||||||
|
SET_TILE_INFO_MEMBER(1, tile, color, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
TILE_GET_INFO_MEMBER( goodejan_state::seibucrtc_sc2_tile_info )
|
||||||
|
{
|
||||||
|
int tile = m_sc2_vram[tile_index] & 0xfff;
|
||||||
|
int color = (m_sc2_vram[tile_index] >> 12) & 0x0f;
|
||||||
|
SET_TILE_INFO_MEMBER(2, tile, color, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
TILE_GET_INFO_MEMBER( goodejan_state::seibucrtc_sc1_tile_info )
|
||||||
|
{
|
||||||
|
int tile = m_sc1_vram[tile_index] & 0xfff;
|
||||||
|
int color = (m_sc1_vram[tile_index] >> 12) & 0x0f;
|
||||||
|
SET_TILE_INFO_MEMBER(3, tile, color, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
TILE_GET_INFO_MEMBER( goodejan_state::seibucrtc_sc3_tile_info )
|
||||||
|
{
|
||||||
|
int tile = m_sc3_vram[tile_index] & 0xfff;
|
||||||
|
int color = (m_sc3_vram[tile_index] >> 12) & 0x0f;
|
||||||
|
SET_TILE_INFO_MEMBER(4, tile, color, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void goodejan_state::draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int pri)
|
||||||
|
{
|
||||||
|
int offs,fx,fy,x,y,color,sprite;
|
||||||
|
int dx,dy,ax,ay;
|
||||||
|
|
||||||
|
for (offs = 0x400-4;offs >= 0;offs -= 4)
|
||||||
|
{
|
||||||
|
if ((m_spriteram16[offs+0]&0x8000)!=0x8000) continue;
|
||||||
|
sprite = m_spriteram16[offs+1];
|
||||||
|
if ((sprite>>14)!=pri) continue;
|
||||||
|
sprite &= 0x1fff;
|
||||||
|
|
||||||
|
y = m_spriteram16[offs+3];
|
||||||
|
x = m_spriteram16[offs+2];
|
||||||
|
|
||||||
|
if (x&0x8000) x=0-(0x200-(x&0x1ff));
|
||||||
|
else x&=0x1ff;
|
||||||
|
if (y&0x8000) y=0-(0x200-(y&0x1ff));
|
||||||
|
else y&=0x1ff;
|
||||||
|
|
||||||
|
color = m_spriteram16[offs+0]&0x3f;
|
||||||
|
fx = m_spriteram16[offs+0]&0x4000;
|
||||||
|
fy = m_spriteram16[offs+0]&0x2000;
|
||||||
|
dy=((m_spriteram16[offs+0]&0x0380)>>7)+1;
|
||||||
|
dx=((m_spriteram16[offs+0]&0x1c00)>>10)+1;
|
||||||
|
|
||||||
|
for (ax=0; ax<dx; ax++)
|
||||||
|
for (ay=0; ay<dy; ay++) {
|
||||||
|
if (!fx)
|
||||||
|
drawgfx_transpen(bitmap,cliprect,machine.gfx[0],
|
||||||
|
sprite++,
|
||||||
|
color,fx,fy,x+ax*16,y+ay*16,15);
|
||||||
|
else
|
||||||
|
drawgfx_transpen(bitmap,cliprect,machine.gfx[0],
|
||||||
|
sprite++,
|
||||||
|
color,fx,fy,x+(dx-1-ax)*16,y+ay*16,15);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************
|
||||||
|
*
|
||||||
|
* VIDEO_START/VIDEO_UPDATE functions
|
||||||
|
*
|
||||||
|
***********************************/
|
||||||
|
|
||||||
|
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_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;
|
||||||
|
}
|
||||||
|
|
||||||
|
UINT32 goodejan_state::screen_update_goodejan(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 );
|
||||||
|
|
||||||
|
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); }
|
||||||
|
if(SEIBU_CRTC_ENABLE_SC2) { m_sc2_tilemap->draw(bitmap, cliprect, 0,0); }
|
||||||
|
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_SPR) { draw_sprites(screen.machine(), bitmap,cliprect, 3); }
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#define GOODEJAN_MHZ1 7159090
|
#define GOODEJAN_MHZ1 7159090
|
||||||
#define GOODEJAN_MHZ2 16000000
|
#define GOODEJAN_MHZ2 16000000
|
||||||
@ -108,13 +368,13 @@ WRITE16_MEMBER(goodejan_state::mahjong_panel_w)
|
|||||||
|
|
||||||
static ADDRESS_MAP_START( goodejan_map, AS_PROGRAM, 16, goodejan_state )
|
static ADDRESS_MAP_START( goodejan_map, AS_PROGRAM, 16, goodejan_state )
|
||||||
AM_RANGE(0x00000, 0x0afff) AM_RAM
|
AM_RANGE(0x00000, 0x0afff) AM_RAM
|
||||||
AM_RANGE(0x0c000, 0x0c7ff) AM_RAM_WRITE_LEGACY(seibucrtc_sc0vram_w) AM_SHARE("crtc_sc0vram")
|
AM_RANGE(0x0c000, 0x0c7ff) AM_RAM_WRITE(seibucrtc_sc0vram_w) AM_SHARE("sc0_vram")
|
||||||
AM_RANGE(0x0c800, 0x0cfff) AM_RAM_WRITE_LEGACY(seibucrtc_sc3vram_w) AM_SHARE("crtc_sc3vram")
|
AM_RANGE(0x0c800, 0x0cfff) AM_RAM_WRITE(seibucrtc_sc3vram_w) AM_SHARE("sc3_vram")
|
||||||
AM_RANGE(0x0d000, 0x0dfff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
|
AM_RANGE(0x0d000, 0x0dfff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_word_w) AM_SHARE("paletteram")
|
||||||
/*Guess: these two aren't used/initialized at all.*/
|
/*Guess: these two aren't used/initialized at all.*/
|
||||||
AM_RANGE(0x0e000, 0x0e7ff) AM_RAM_WRITE_LEGACY(seibucrtc_sc1vram_w) AM_SHARE("crtc_sc1vram")
|
AM_RANGE(0x0e000, 0x0e7ff) AM_RAM_WRITE(seibucrtc_sc1vram_w) AM_SHARE("sc1_vram")
|
||||||
AM_RANGE(0x0e800, 0x0efff) AM_RAM_WRITE_LEGACY(seibucrtc_sc2vram_w) AM_SHARE("crtc_sc2vram")
|
AM_RANGE(0x0e800, 0x0efff) AM_RAM_WRITE(seibucrtc_sc2vram_w) AM_SHARE("sc2_vram")
|
||||||
AM_RANGE(0x0f800, 0x0ffff) AM_RAM AM_SHARE("spriteram")
|
AM_RANGE(0x0f800, 0x0ffff) AM_RAM AM_SHARE("sprite_ram")
|
||||||
AM_RANGE(0xc0000, 0xfffff) AM_ROM
|
AM_RANGE(0xc0000, 0xfffff) AM_ROM
|
||||||
ADDRESS_MAP_END
|
ADDRESS_MAP_END
|
||||||
|
|
||||||
@ -131,12 +391,12 @@ static ADDRESS_MAP_START( common_io_map, AS_IO, 16, goodejan_state )
|
|||||||
ADDRESS_MAP_END
|
ADDRESS_MAP_END
|
||||||
|
|
||||||
static ADDRESS_MAP_START( totmejan_io_map, AS_IO, 16, goodejan_state )
|
static ADDRESS_MAP_START( totmejan_io_map, AS_IO, 16, goodejan_state )
|
||||||
AM_RANGE(0x8000, 0x804f) AM_RAM_WRITE_LEGACY(seibucrtc_vregs_w) AM_SHARE("crtc_vregs")
|
AM_RANGE(0x8000, 0x804f) AM_RAM_WRITE(seibucrtc_vregs_w) AM_SHARE("crtc_vregs")
|
||||||
AM_IMPORT_FROM(common_io_map)
|
AM_IMPORT_FROM(common_io_map)
|
||||||
ADDRESS_MAP_END
|
ADDRESS_MAP_END
|
||||||
|
|
||||||
static ADDRESS_MAP_START( goodejan_io_map, AS_IO, 16, goodejan_state )
|
static ADDRESS_MAP_START( goodejan_io_map, AS_IO, 16, goodejan_state )
|
||||||
AM_RANGE(0x8040, 0x807f) AM_RAM_WRITE_LEGACY(seibucrtc_vregs_w) AM_SHARE("crtc_vregs")
|
AM_RANGE(0x8040, 0x807f) AM_RAM_WRITE(seibucrtc_vregs_w) AM_SHARE("crtc_vregs")
|
||||||
AM_IMPORT_FROM(common_io_map)
|
AM_IMPORT_FROM(common_io_map)
|
||||||
ADDRESS_MAP_END
|
ADDRESS_MAP_END
|
||||||
|
|
||||||
@ -356,13 +616,11 @@ static MACHINE_CONFIG_START( goodejan, goodejan_state )
|
|||||||
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
|
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
|
||||||
MCFG_SCREEN_SIZE(32*8, 32*8)
|
MCFG_SCREEN_SIZE(32*8, 32*8)
|
||||||
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) //TODO: dynamic resolution
|
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) //TODO: dynamic resolution
|
||||||
MCFG_SCREEN_UPDATE_STATIC(seibu_crtc)
|
MCFG_SCREEN_UPDATE_DRIVER(goodejan_state, screen_update_goodejan)
|
||||||
|
|
||||||
MCFG_GFXDECODE(goodejan)
|
MCFG_GFXDECODE(goodejan)
|
||||||
MCFG_PALETTE_LENGTH(0x1000)
|
MCFG_PALETTE_LENGTH(0x1000)
|
||||||
|
|
||||||
MCFG_VIDEO_START(seibu_crtc)
|
|
||||||
|
|
||||||
/* sound hardware */
|
/* sound hardware */
|
||||||
SEIBU_SOUND_SYSTEM_YM3812_INTERFACE(GOODEJAN_MHZ1/2,GOODEJAN_MHZ2/16)
|
SEIBU_SOUND_SYSTEM_YM3812_INTERFACE(GOODEJAN_MHZ1/2,GOODEJAN_MHZ2/16)
|
||||||
MACHINE_CONFIG_END
|
MACHINE_CONFIG_END
|
||||||
|
@ -55,7 +55,7 @@ RSSENGO2.72 chr.
|
|||||||
#include "cpu/nec/nec.h"
|
#include "cpu/nec/nec.h"
|
||||||
#include "audio/seibu.h"
|
#include "audio/seibu.h"
|
||||||
#include "sound/3812intf.h"
|
#include "sound/3812intf.h"
|
||||||
#include "includes/sei_crtc.h"
|
//#include "includes/sei_crtc.h"
|
||||||
#include "machine/nvram.h"
|
#include "machine/nvram.h"
|
||||||
|
|
||||||
|
|
||||||
@ -64,19 +64,281 @@ class sengokmj_state : public driver_device
|
|||||||
public:
|
public:
|
||||||
sengokmj_state(const machine_config &mconfig, device_type type, const char *tag)
|
sengokmj_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||||
: driver_device(mconfig, type, tag),
|
: driver_device(mconfig, type, tag),
|
||||||
|
m_sc0_vram(*this, "sc0_vram"),
|
||||||
|
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") { }
|
m_maincpu(*this, "maincpu") { }
|
||||||
|
|
||||||
|
required_shared_ptr<UINT16> m_sc0_vram;
|
||||||
|
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;
|
||||||
UINT16 m_sengokumj_mux_data;
|
UINT16 m_sengokumj_mux_data;
|
||||||
UINT8 m_hopper_io;
|
UINT8 m_hopper_io;
|
||||||
|
UINT16 m_seibucrtc_sc0bank;
|
||||||
DECLARE_READ16_MEMBER(mahjong_panel_r);
|
DECLARE_READ16_MEMBER(mahjong_panel_r);
|
||||||
DECLARE_WRITE16_MEMBER(mahjong_panel_w);
|
DECLARE_WRITE16_MEMBER(mahjong_panel_w);
|
||||||
DECLARE_WRITE16_MEMBER(sengokmj_out_w);
|
DECLARE_WRITE16_MEMBER(sengokmj_out_w);
|
||||||
DECLARE_READ16_MEMBER(sengokmj_system_r);
|
DECLARE_READ16_MEMBER(sengokmj_system_r);
|
||||||
|
DECLARE_WRITE16_MEMBER(seibucrtc_sc0vram_w);
|
||||||
|
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);
|
INTERRUPT_GEN_MEMBER(sengokmj_interrupt);
|
||||||
required_device<cpu_device> m_maincpu;
|
void seibucrtc_sc0bank_w(UINT16 data);
|
||||||
|
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);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************
|
||||||
|
*
|
||||||
|
* Macros for the video registers
|
||||||
|
*
|
||||||
|
*******************************/
|
||||||
|
|
||||||
|
/*******************************
|
||||||
|
* 0x1a - Layer Dynamic Paging?
|
||||||
|
*******************************/
|
||||||
|
#define SEIBU_CRTC_DYN_PAGING (m_seibucrtc_vregs[0x001a/2])
|
||||||
|
#define SEIBU_CRTC_SC3_PAGE_SEL (SEIBU_CRTC_DYN_PAGING & 0x0002)
|
||||||
|
|
||||||
|
/*******************************
|
||||||
|
* 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)
|
||||||
|
************************************/
|
||||||
|
#define SEIBU_CRTC_FIX_SX (m_seibucrtc_vregs[0x002c/2])
|
||||||
|
|
||||||
|
/************************************
|
||||||
|
* 0x2e - Fix screen scroll y (global)
|
||||||
|
************************************/
|
||||||
|
#define SEIBU_CRTC_FIX_SY (m_seibucrtc_vregs[0x002e/2])
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************
|
||||||
|
*
|
||||||
|
* Write RAM accesses
|
||||||
|
*
|
||||||
|
*******************************/
|
||||||
|
|
||||||
|
WRITE16_MEMBER( sengokmj_state::seibucrtc_sc0vram_w )
|
||||||
|
{
|
||||||
|
COMBINE_DATA(&m_sc0_vram[offset]);
|
||||||
|
m_sc0_tilemap->mark_tile_dirty(offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
WRITE16_MEMBER( sengokmj_state::seibucrtc_sc2vram_w )
|
||||||
|
{
|
||||||
|
COMBINE_DATA(&m_sc2_vram[offset]);
|
||||||
|
m_sc2_tilemap->mark_tile_dirty(offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
WRITE16_MEMBER( sengokmj_state::seibucrtc_sc1vram_w )
|
||||||
|
{
|
||||||
|
COMBINE_DATA(&m_sc1_vram[offset]);
|
||||||
|
m_sc1_tilemap->mark_tile_dirty(offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
*
|
||||||
|
*******************************/
|
||||||
|
|
||||||
|
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);
|
||||||
|
SET_TILE_INFO_MEMBER(1, tile, color, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
TILE_GET_INFO_MEMBER( sengokmj_state::seibucrtc_sc2_tile_info )
|
||||||
|
{
|
||||||
|
int tile = m_sc2_vram[tile_index] & 0xfff;
|
||||||
|
int color = (m_sc2_vram[tile_index] >> 12) & 0x0f;
|
||||||
|
SET_TILE_INFO_MEMBER(2, tile, color, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
TILE_GET_INFO_MEMBER( sengokmj_state::seibucrtc_sc1_tile_info )
|
||||||
|
{
|
||||||
|
int tile = m_sc1_vram[tile_index] & 0xfff;
|
||||||
|
int color = (m_sc1_vram[tile_index] >> 12) & 0x0f;
|
||||||
|
SET_TILE_INFO_MEMBER(3, tile, color, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
TILE_GET_INFO_MEMBER( sengokmj_state::seibucrtc_sc3_tile_info )
|
||||||
|
{
|
||||||
|
int tile = m_sc3_vram[tile_index] & 0xfff;
|
||||||
|
int color = (m_sc3_vram[tile_index] >> 12) & 0x0f;
|
||||||
|
SET_TILE_INFO_MEMBER(4, tile, color, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sengokmj_state::draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int pri)
|
||||||
|
{
|
||||||
|
int offs,fx,fy,x,y,color,sprite;
|
||||||
|
int dx,dy,ax,ay;
|
||||||
|
|
||||||
|
for (offs = 0x400-4;offs >= 0;offs -= 4)
|
||||||
|
{
|
||||||
|
if ((m_spriteram16[offs+0]&0x8000)!=0x8000) continue;
|
||||||
|
sprite = m_spriteram16[offs+1];
|
||||||
|
if ((sprite>>14)!=pri) continue;
|
||||||
|
sprite &= 0x1fff;
|
||||||
|
|
||||||
|
y = m_spriteram16[offs+3];
|
||||||
|
x = m_spriteram16[offs+2];
|
||||||
|
|
||||||
|
if (x&0x8000) x=0-(0x200-(x&0x1ff));
|
||||||
|
else x&=0x1ff;
|
||||||
|
if (y&0x8000) y=0-(0x200-(y&0x1ff));
|
||||||
|
else y&=0x1ff;
|
||||||
|
|
||||||
|
color = m_spriteram16[offs+0]&0x3f;
|
||||||
|
fx = m_spriteram16[offs+0]&0x4000;
|
||||||
|
fy = m_spriteram16[offs+0]&0x2000;
|
||||||
|
dy=((m_spriteram16[offs+0]&0x0380)>>7)+1;
|
||||||
|
dx=((m_spriteram16[offs+0]&0x1c00)>>10)+1;
|
||||||
|
|
||||||
|
for (ax=0; ax<dx; ax++)
|
||||||
|
for (ay=0; ay<dy; ay++) {
|
||||||
|
if (!fx)
|
||||||
|
drawgfx_transpen(bitmap,cliprect,machine.gfx[0],
|
||||||
|
sprite++,
|
||||||
|
color,fx,fy,x+ax*16,y+ay*16,15);
|
||||||
|
else
|
||||||
|
drawgfx_transpen(bitmap,cliprect,machine.gfx[0],
|
||||||
|
sprite++,
|
||||||
|
color,fx,fy,x+(dx-1-ax)*16,y+ay*16,15);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************
|
||||||
|
*
|
||||||
|
* VIDEO_START/VIDEO_UPDATE functions
|
||||||
|
*
|
||||||
|
***********************************/
|
||||||
|
|
||||||
|
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_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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 );
|
||||||
|
|
||||||
|
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); }
|
||||||
|
if(SEIBU_CRTC_ENABLE_SC2) { m_sc2_tilemap->draw(bitmap, cliprect, 0,0); }
|
||||||
|
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_SPR) { draw_sprites(screen.machine(), bitmap,cliprect, 3); }
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Multiplexer device for the mahjong panel */
|
/* Multiplexer device for the mahjong panel */
|
||||||
READ16_MEMBER(sengokmj_state::mahjong_panel_r)
|
READ16_MEMBER(sengokmj_state::mahjong_panel_r)
|
||||||
@ -123,19 +385,19 @@ READ16_MEMBER(sengokmj_state::sengokmj_system_r)
|
|||||||
static ADDRESS_MAP_START( sengokmj_map, AS_PROGRAM, 16, sengokmj_state )
|
static ADDRESS_MAP_START( sengokmj_map, AS_PROGRAM, 16, sengokmj_state )
|
||||||
AM_RANGE(0x00000, 0x07fff) AM_RAM
|
AM_RANGE(0x00000, 0x07fff) AM_RAM
|
||||||
AM_RANGE(0x08000, 0x09fff) AM_RAM AM_SHARE("nvram")
|
AM_RANGE(0x08000, 0x09fff) AM_RAM AM_SHARE("nvram")
|
||||||
AM_RANGE(0x0c000, 0x0c7ff) AM_RAM_WRITE_LEGACY(seibucrtc_sc0vram_w) AM_SHARE("crtc_sc0vram")
|
AM_RANGE(0x0c000, 0x0c7ff) AM_RAM_WRITE(seibucrtc_sc0vram_w) AM_SHARE("sc0_vram")
|
||||||
AM_RANGE(0x0c800, 0x0cfff) AM_RAM_WRITE_LEGACY(seibucrtc_sc1vram_w) AM_SHARE("crtc_sc1vram")
|
AM_RANGE(0x0c800, 0x0cfff) AM_RAM_WRITE(seibucrtc_sc1vram_w) AM_SHARE("sc1_vram")
|
||||||
AM_RANGE(0x0d000, 0x0d7ff) AM_RAM_WRITE_LEGACY(seibucrtc_sc2vram_w) AM_SHARE("crtc_sc2vram")
|
AM_RANGE(0x0d000, 0x0d7ff) AM_RAM_WRITE(seibucrtc_sc2vram_w) AM_SHARE("sc2_vram")
|
||||||
AM_RANGE(0x0d800, 0x0e7ff) AM_RAM_WRITE_LEGACY(seibucrtc_sc3vram_w) AM_SHARE("crtc_sc3vram")
|
AM_RANGE(0x0d800, 0x0e7ff) AM_RAM_WRITE(seibucrtc_sc3vram_w) AM_SHARE("sc3_vram")
|
||||||
AM_RANGE(0x0e800, 0x0f7ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
|
AM_RANGE(0x0e800, 0x0f7ff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
|
||||||
AM_RANGE(0x0f800, 0x0ffff) AM_RAM AM_SHARE("spriteram")
|
AM_RANGE(0x0f800, 0x0ffff) AM_RAM AM_SHARE("sprite_ram")
|
||||||
AM_RANGE(0xc0000, 0xfffff) AM_ROM
|
AM_RANGE(0xc0000, 0xfffff) AM_ROM
|
||||||
ADDRESS_MAP_END
|
ADDRESS_MAP_END
|
||||||
|
|
||||||
static ADDRESS_MAP_START( sengokmj_io_map, AS_IO, 16, sengokmj_state )
|
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)
|
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.*/
|
/*Areas from 8000-804f are for the custom Seibu CRTC.*/
|
||||||
AM_RANGE(0x8000, 0x804f) AM_RAM_WRITE_LEGACY(seibucrtc_vregs_w) AM_SHARE("crtc_vregs")
|
AM_RANGE(0x8000, 0x804f) AM_RAM_WRITE(seibucrtc_vregs_w) AM_SHARE("crtc_vregs")
|
||||||
|
|
||||||
// AM_RANGE(0x8080, 0x8081) CRTC extra register?
|
// AM_RANGE(0x8080, 0x8081) CRTC extra register?
|
||||||
// AM_RANGE(0x80c0, 0x80c1) CRTC extra register?
|
// AM_RANGE(0x80c0, 0x80c1) CRTC extra register?
|
||||||
@ -315,13 +577,11 @@ static MACHINE_CONFIG_START( sengokmj, sengokmj_state )
|
|||||||
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
|
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
|
||||||
MCFG_SCREEN_SIZE(64*8, 32*8)
|
MCFG_SCREEN_SIZE(64*8, 32*8)
|
||||||
MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 16, 256-1) //TODO: dynamic resolution
|
MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 16, 256-1) //TODO: dynamic resolution
|
||||||
MCFG_SCREEN_UPDATE_STATIC(seibu_crtc)
|
MCFG_SCREEN_UPDATE_DRIVER(sengokmj_state, screen_update_sengokmj)
|
||||||
|
|
||||||
MCFG_GFXDECODE(sengokmj)
|
MCFG_GFXDECODE(sengokmj)
|
||||||
MCFG_PALETTE_LENGTH(0x800)
|
MCFG_PALETTE_LENGTH(0x800)
|
||||||
|
|
||||||
MCFG_VIDEO_START(seibu_crtc)
|
|
||||||
|
|
||||||
/* sound hardware */
|
/* sound hardware */
|
||||||
SEIBU_SOUND_SYSTEM_YM3812_INTERFACE(14318180/4,1320000)
|
SEIBU_SOUND_SYSTEM_YM3812_INTERFACE(14318180/4,1320000)
|
||||||
MACHINE_CONFIG_END
|
MACHINE_CONFIG_END
|
||||||
|
@ -26,7 +26,7 @@ const device_type XXX = &device_creator<xxx_device>;
|
|||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
|
|
||||||
xxx_device::xxx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
xxx_device::xxx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||||
: device_t(mconfig, XXX, "xxx", tag, owner, clock)
|
: device_t(mconfig, XXX, "xxx_longname", tag, owner, clock, "xxx", __FILE__)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1602,7 +1602,7 @@ $(MAMEOBJ)/seibu.a: \
|
|||||||
$(MACHINE)/seicop.o \
|
$(MACHINE)/seicop.o \
|
||||||
$(MACHINE)/spisprit.o \
|
$(MACHINE)/spisprit.o \
|
||||||
$(AUDIO)/seibu.o \
|
$(AUDIO)/seibu.o \
|
||||||
$(VIDEO)/sei_crtc.o \
|
$(VIDEO)/seibu_crtc.o \
|
||||||
|
|
||||||
$(MAMEOBJ)/seta.a: \
|
$(MAMEOBJ)/seta.a: \
|
||||||
$(DRIVERS)/aleck64.o $(MACHINE)/n64.o $(VIDEO)/n64.o $(VIDEO)/rdpblend.o $(VIDEO)/rdpspn16.o $(VIDEO)/rdptpipe.o \
|
$(DRIVERS)/aleck64.o $(MACHINE)/n64.o $(VIDEO)/n64.o $(VIDEO)/rdpblend.o $(VIDEO)/rdpspn16.o $(VIDEO)/rdptpipe.o \
|
||||||
|
@ -1,341 +0,0 @@
|
|||||||
/******************************************************************************************
|
|
||||||
|
|
||||||
Seibu Custom "CRT Controller" emulation
|
|
||||||
|
|
||||||
by Angelo Salese,based off the old D-Con video HW part by Bryan McPhail
|
|
||||||
|
|
||||||
The (likely) custom Seibu CRTC is used at least in the following games:
|
|
||||||
Raiden (probably the first game to use it)
|
|
||||||
*Sengoku Mahjong
|
|
||||||
*Good e Jong
|
|
||||||
*Tottemo de Jong
|
|
||||||
Blood Bros.
|
|
||||||
Sky Smasher
|
|
||||||
D-Con
|
|
||||||
SD Gundam Psycho Salamander no Kyoui
|
|
||||||
(all games in legionna.c)
|
|
||||||
(all games in raiden2.c)
|
|
||||||
(all games in seibuspi.c)
|
|
||||||
|
|
||||||
The name "Seibu CRTC" is actually an agglomerate of all the Seibu Customs that are on the
|
|
||||||
single boards, most if not all of them are shared video chips in the aforementioned games.
|
|
||||||
|
|
||||||
TODO:
|
|
||||||
- Needs a full device rewrite, presumably device split too (where CRTC and tilemap are on different chip emulation).
|
|
||||||
- Dynamic Resolution Change (xx10 register?)
|
|
||||||
- Dynamic Paging register probably incorrect,needs further investigation;
|
|
||||||
- Merge the aforementioned games and clean-up the code in these drivers;
|
|
||||||
- Merge the gfxdecode too?
|
|
||||||
- Fully understand remaining video registers;
|
|
||||||
- Are the xx80/xxc0 in some games (D-Con/Sengoku Mahjong) another bunch of registers?
|
|
||||||
- Investigate about the real name(s) of this Seibu "CRT Controller",and if it is really
|
|
||||||
custom.
|
|
||||||
|
|
||||||
===========================================================================================
|
|
||||||
|
|
||||||
List of default vregs (title screen):
|
|
||||||
|
|
||||||
*Sengoku Mahjong:
|
|
||||||
8000: 000F 0013 009F 00BF 00FA 000F 00FA 00FF
|
|
||||||
8010: 007D 0006 0000 0002 0000 0000 0000 0000
|
|
||||||
8020: 0000 0000 0004 0000 0000 0000 0040 01FF
|
|
||||||
8030: 003E 01FF 003F 01FF 0040 0001 0034 0035
|
|
||||||
8040: 0000 A8A8 0003 1C37 0001 0000 0000 0000
|
|
||||||
|
|
||||||
*Tottemo de Jong
|
|
||||||
8000: 000F 000F 009F 00BF 00FA 000F 00FA 00FF
|
|
||||||
8010: 0076 0006 0000 0002 0000 0002 0006 0000
|
|
||||||
8020: 0000 0000 0000 0000 0000 0000 01C0 01FF
|
|
||||||
8030: 003E 01FF 003F 01FF 00C0 01FF 0034 003F
|
|
||||||
8040: 0000 A8A8 0003 1830 0001 0000 0000 0000
|
|
||||||
|
|
||||||
*Good e Jong
|
|
||||||
8040: 000F 000F 009F 00BF 00FA 000F 00FA 00FF
|
|
||||||
8050: 0076 0006 0000 0002 0000 0002 0006 0000
|
|
||||||
8060: 0000 00FA 0000 0000 0000 0000 01C0 01FF
|
|
||||||
8070: 003E 01FF 003F 01FF 00C0 01FF 0034 003F
|
|
||||||
8080: 0000 0000 0000 0000 0000 0000 0000 0000
|
|
||||||
|
|
||||||
*SD Gundam Sangokushi Rainbow Tairiku Senki (320 x 224 normal, @ service mode)
|
|
||||||
100600: 000F 0013 00A7 00C7 00E0 000F 00E7 00F3
|
|
||||||
100610: 007E 01FE 0000 0002 0000 0000 0017 0000
|
|
||||||
100620: 0000 0000 0000 0000 0000 0000 01C8 01FF
|
|
||||||
100630: 01CA 01FF 01C9 01FF 01C8 01FF 0034 003F
|
|
||||||
100640: 0000 A8A8 001E 1C37 0008 0000 0000 FFFF
|
|
||||||
(320 x 224, flipped)
|
|
||||||
100600: 000F 0013 00A7 00C7 00E0 000F 00E7 00F3
|
|
||||||
100610: 007E 01FE 0000 0002 0000 0001 0017 0000
|
|
||||||
100620: 0001 0000 0000 0000 0000 0000 0177 0100
|
|
||||||
100630: 0175 0100 0176 0100 0177 0100 0034 003F
|
|
||||||
100640: 0000 A8A8 00E1 1C37 0018 0000 013F FFFF
|
|
||||||
(320 x 256, normal)
|
|
||||||
100600: 000F 0013 00A7 00C7 00E0 000F 00E1 00E9
|
|
||||||
100610: 0076 01FE 0000 0002 0000 0000 0017 0000
|
|
||||||
100620: 0002 0000 0000 0000 0000 0000 01C8 0207
|
|
||||||
100630: 01CA 0207 01C9 0207 01C8 0207 0034 003F
|
|
||||||
100640: 0000 A8A8 0016 1C37 0008 0000 0000 FFFF
|
|
||||||
(320 x 256, flipped)
|
|
||||||
100600: 000F 0013 00A7 00C7 00E0 000F 00E1 00E9
|
|
||||||
100610: 0076 01FE 0000 0002 0000 0001 0017 0000
|
|
||||||
100620: 0003 0000 0000 0000 0000 0000 0178 02F8
|
|
||||||
100630: 0175 02F8 0176 02F8 0177 02F8 0034 003F
|
|
||||||
100640: 0000 A8A8 00E9 1C37 0018 0000 013F FFFF
|
|
||||||
(320 x 240, normal)
|
|
||||||
100600: 000F 0013 00A7 00C7 00FA 000F 00FA 00FF
|
|
||||||
100610: 0076 0006 0000 0002 0000 0000 0017 0000
|
|
||||||
100620: 0004 0000 0000 0000 0000 0000 01D8 01FF
|
|
||||||
100630: 01DA 01FF 01D9 01FF 01D8 01FF 0034 003F
|
|
||||||
100640: 0000 A8A8 0004 1C37 0008 0000 0000 FFFF
|
|
||||||
(320 x 240, flipped)
|
|
||||||
100600: 000F 0013 00A7 00C7 00FA 000F 00FA 00FF
|
|
||||||
100610: 0076 0006 0000 0002 0000 0001 0017 0000
|
|
||||||
100620: 0005 0000 0000 0000 0000 0000 0187 0300
|
|
||||||
100630: 0185 0300 0186 0300 0185 0300 0034 003F
|
|
||||||
100640: 0000 A8A8 00FB 1C37 0018 0000 013F FFFF
|
|
||||||
|
|
||||||
|
|
||||||
*******************************************************************************************/
|
|
||||||
|
|
||||||
#include "emu.h"
|
|
||||||
#include "includes/sei_crtc.h"
|
|
||||||
|
|
||||||
static tilemap_t *sc0_tilemap,*sc2_tilemap,*sc1_tilemap,*sc3_tilemap_0,*sc3_tilemap_1;
|
|
||||||
static UINT16 *seibucrtc_sc0vram,*seibucrtc_sc1vram,*seibucrtc_sc2vram,*seibucrtc_sc3vram;
|
|
||||||
static UINT16 *seibucrtc_vregs;
|
|
||||||
UINT16 seibucrtc_sc0bank;
|
|
||||||
|
|
||||||
/*******************************
|
|
||||||
*
|
|
||||||
* Macros for the video registers
|
|
||||||
*
|
|
||||||
*******************************/
|
|
||||||
|
|
||||||
/*******************************
|
|
||||||
* 0x1a - Layer Dynamic Paging?
|
|
||||||
*******************************/
|
|
||||||
#define SEIBU_CRTC_DYN_PAGING (seibucrtc_vregs[0x001a/2])
|
|
||||||
#define SEIBU_CRTC_SC3_PAGE_SEL (SEIBU_CRTC_DYN_PAGING & 0x0002)
|
|
||||||
|
|
||||||
/*******************************
|
|
||||||
* 0x1c - Layer Enable
|
|
||||||
*******************************/
|
|
||||||
#define SEIBU_CRTC_LAYER_EN (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 (seibucrtc_vregs[0x0020/2])
|
|
||||||
|
|
||||||
/************************************
|
|
||||||
* 0x22 - Screen 0 (BG) scroll y
|
|
||||||
************************************/
|
|
||||||
#define SEIBU_CRTC_SC0_SY (seibucrtc_vregs[0x0022/2])
|
|
||||||
|
|
||||||
/************************************
|
|
||||||
* 0x24 - Screen 1 (FG) scroll x
|
|
||||||
************************************/
|
|
||||||
#define SEIBU_CRTC_SC1_SX (seibucrtc_vregs[0x0028/2])
|
|
||||||
|
|
||||||
/************************************
|
|
||||||
* 0x26 - Screen 1 (FG) scroll y
|
|
||||||
************************************/
|
|
||||||
#define SEIBU_CRTC_SC1_SY (seibucrtc_vregs[0x002a/2])
|
|
||||||
|
|
||||||
/************************************
|
|
||||||
* 0x28 - Screen 2 (MD) scroll x
|
|
||||||
************************************/
|
|
||||||
#define SEIBU_CRTC_SC2_SX (seibucrtc_vregs[0x0024/2])
|
|
||||||
|
|
||||||
/************************************
|
|
||||||
* 0x2a - Screen 2 (MD) scroll y
|
|
||||||
************************************/
|
|
||||||
#define SEIBU_CRTC_SC2_SY (seibucrtc_vregs[0x0026/2])
|
|
||||||
|
|
||||||
/************************************
|
|
||||||
* 0x2c - Fix screen scroll x (global)
|
|
||||||
************************************/
|
|
||||||
#define SEIBU_CRTC_FIX_SX (seibucrtc_vregs[0x002c/2])
|
|
||||||
|
|
||||||
/************************************
|
|
||||||
* 0x2e - Fix screen scroll y (global)
|
|
||||||
************************************/
|
|
||||||
#define SEIBU_CRTC_FIX_SY (seibucrtc_vregs[0x002e/2])
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************
|
|
||||||
*
|
|
||||||
* Write RAM accesses
|
|
||||||
*
|
|
||||||
*******************************/
|
|
||||||
|
|
||||||
WRITE16_HANDLER( seibucrtc_sc0vram_w )
|
|
||||||
{
|
|
||||||
COMBINE_DATA(&seibucrtc_sc0vram[offset]);
|
|
||||||
sc0_tilemap->mark_tile_dirty(offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
WRITE16_HANDLER( seibucrtc_sc2vram_w )
|
|
||||||
{
|
|
||||||
COMBINE_DATA(&seibucrtc_sc2vram[offset]);
|
|
||||||
sc2_tilemap->mark_tile_dirty(offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
WRITE16_HANDLER( seibucrtc_sc1vram_w )
|
|
||||||
{
|
|
||||||
COMBINE_DATA(&seibucrtc_sc1vram[offset]);
|
|
||||||
sc1_tilemap->mark_tile_dirty(offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
WRITE16_HANDLER( seibucrtc_sc3vram_w )
|
|
||||||
{
|
|
||||||
COMBINE_DATA(&seibucrtc_sc3vram[offset]);
|
|
||||||
sc3_tilemap_0->mark_tile_dirty(offset);
|
|
||||||
sc3_tilemap_1->mark_tile_dirty(offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
WRITE16_HANDLER( seibucrtc_vregs_w )
|
|
||||||
{
|
|
||||||
COMBINE_DATA(&seibucrtc_vregs[offset]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Actually external from the CRTC */
|
|
||||||
void seibucrtc_sc0bank_w(UINT16 data)
|
|
||||||
{
|
|
||||||
seibucrtc_sc0bank = data & 1;
|
|
||||||
sc0_tilemap->mark_all_dirty();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************
|
|
||||||
*
|
|
||||||
* Tilemap info accesses
|
|
||||||
*
|
|
||||||
*******************************/
|
|
||||||
|
|
||||||
static TILE_GET_INFO( seibucrtc_sc0_tile_info )
|
|
||||||
{
|
|
||||||
int tile = seibucrtc_sc0vram[tile_index] & 0xfff;
|
|
||||||
int color = (seibucrtc_sc0vram[tile_index] >> 12) & 0x0f;
|
|
||||||
tile+=(seibucrtc_sc0bank<<12);
|
|
||||||
SET_TILE_INFO(1, tile, color, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static TILE_GET_INFO( seibucrtc_sc2_tile_info )
|
|
||||||
{
|
|
||||||
int tile = seibucrtc_sc2vram[tile_index] & 0xfff;
|
|
||||||
int color = (seibucrtc_sc2vram[tile_index] >> 12) & 0x0f;
|
|
||||||
SET_TILE_INFO(2, tile, color, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static TILE_GET_INFO( seibucrtc_sc1_tile_info )
|
|
||||||
{
|
|
||||||
int tile = seibucrtc_sc1vram[tile_index] & 0xfff;
|
|
||||||
int color = (seibucrtc_sc1vram[tile_index] >> 12) & 0x0f;
|
|
||||||
SET_TILE_INFO(3, tile, color, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static TILE_GET_INFO( seibucrtc_sc3_tile_info )
|
|
||||||
{
|
|
||||||
int tile = seibucrtc_sc3vram[tile_index] & 0xfff;
|
|
||||||
int color = (seibucrtc_sc3vram[tile_index] >> 12) & 0x0f;
|
|
||||||
SET_TILE_INFO(4, tile, color, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int pri)
|
|
||||||
{
|
|
||||||
UINT16 *spriteram16 = reinterpret_cast<UINT16 *>(machine.root_device().memshare("spriteram")->ptr());
|
|
||||||
int offs,fx,fy,x,y,color,sprite;
|
|
||||||
int dx,dy,ax,ay;
|
|
||||||
|
|
||||||
for (offs = 0x400-4;offs >= 0;offs -= 4)
|
|
||||||
{
|
|
||||||
if ((spriteram16[offs+0]&0x8000)!=0x8000) continue;
|
|
||||||
sprite = spriteram16[offs+1];
|
|
||||||
if ((sprite>>14)!=pri) continue;
|
|
||||||
sprite &= 0x1fff;
|
|
||||||
|
|
||||||
y = spriteram16[offs+3];
|
|
||||||
x = spriteram16[offs+2];
|
|
||||||
|
|
||||||
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]&0x4000;
|
|
||||||
fy = spriteram16[offs+0]&0x2000;
|
|
||||||
dy=((spriteram16[offs+0]&0x0380)>>7)+1;
|
|
||||||
dx=((spriteram16[offs+0]&0x1c00)>>10)+1;
|
|
||||||
|
|
||||||
for (ax=0; ax<dx; ax++)
|
|
||||||
for (ay=0; ay<dy; ay++) {
|
|
||||||
if (!fx)
|
|
||||||
drawgfx_transpen(bitmap,cliprect,machine.gfx[0],
|
|
||||||
sprite++,
|
|
||||||
color,fx,fy,x+ax*16,y+ay*16,15);
|
|
||||||
else
|
|
||||||
drawgfx_transpen(bitmap,cliprect,machine.gfx[0],
|
|
||||||
sprite++,
|
|
||||||
color,fx,fy,x+(dx-1-ax)*16,y+ay*16,15);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/***********************************
|
|
||||||
*
|
|
||||||
* VIDEO_START/VIDEO_UPDATE functions
|
|
||||||
*
|
|
||||||
***********************************/
|
|
||||||
|
|
||||||
VIDEO_START( seibu_crtc )
|
|
||||||
{
|
|
||||||
seibucrtc_sc0vram = reinterpret_cast<UINT16 *>(machine.root_device().memshare("crtc_sc0vram")->ptr());
|
|
||||||
seibucrtc_sc1vram = reinterpret_cast<UINT16 *>(machine.root_device().memshare("crtc_sc1vram")->ptr());
|
|
||||||
seibucrtc_sc2vram = reinterpret_cast<UINT16 *>(machine.root_device().memshare("crtc_sc2vram")->ptr());
|
|
||||||
seibucrtc_sc3vram = reinterpret_cast<UINT16 *>(machine.root_device().memshare("crtc_sc3vram")->ptr());
|
|
||||||
seibucrtc_vregs = reinterpret_cast<UINT16 *>(machine.root_device().memshare("crtc_vregs")->ptr());
|
|
||||||
|
|
||||||
sc0_tilemap = tilemap_create(machine, seibucrtc_sc0_tile_info,TILEMAP_SCAN_ROWS,16,16,32,32);
|
|
||||||
sc2_tilemap = tilemap_create(machine, seibucrtc_sc2_tile_info,TILEMAP_SCAN_ROWS,16,16,32,32);
|
|
||||||
sc1_tilemap = tilemap_create(machine, seibucrtc_sc1_tile_info,TILEMAP_SCAN_ROWS,16,16,32,32);
|
|
||||||
sc3_tilemap_0 = tilemap_create(machine, seibucrtc_sc3_tile_info,TILEMAP_SCAN_ROWS, 8, 8,32,32);
|
|
||||||
sc3_tilemap_1 = tilemap_create(machine, seibucrtc_sc3_tile_info,TILEMAP_SCAN_ROWS, 8, 8,64,32);
|
|
||||||
|
|
||||||
sc2_tilemap->set_transparent_pen(15);
|
|
||||||
sc1_tilemap->set_transparent_pen(15);
|
|
||||||
sc3_tilemap_0->set_transparent_pen(15);
|
|
||||||
sc3_tilemap_1->set_transparent_pen(15);
|
|
||||||
|
|
||||||
seibucrtc_sc0bank = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
SCREEN_UPDATE_IND16( seibu_crtc )
|
|
||||||
{
|
|
||||||
bitmap.fill(screen.machine().pens[0x7ff], cliprect); //black pen
|
|
||||||
|
|
||||||
sc0_tilemap->set_scrollx(0, (SEIBU_CRTC_SC0_SX + SEIBU_CRTC_FIX_SX+64) & 0x1ff );
|
|
||||||
sc0_tilemap->set_scrolly(0, (SEIBU_CRTC_SC0_SY + SEIBU_CRTC_FIX_SY+1) & 0x1ff );
|
|
||||||
sc2_tilemap->set_scrollx(0, (SEIBU_CRTC_SC2_SX + SEIBU_CRTC_FIX_SX+64) & 0x1ff );
|
|
||||||
sc2_tilemap->set_scrolly(0, (SEIBU_CRTC_SC2_SY + SEIBU_CRTC_FIX_SY+1) & 0x1ff );
|
|
||||||
sc1_tilemap->set_scrollx(0, (SEIBU_CRTC_SC1_SX + SEIBU_CRTC_FIX_SX+64) & 0x1ff );
|
|
||||||
sc1_tilemap->set_scrolly(0, (SEIBU_CRTC_SC1_SY + SEIBU_CRTC_FIX_SY+1) & 0x1ff );
|
|
||||||
(SEIBU_CRTC_SC3_PAGE_SEL ? sc3_tilemap_0 : sc3_tilemap_1)->set_scrollx(0, (SEIBU_CRTC_FIX_SX+64) & 0x1ff );
|
|
||||||
(SEIBU_CRTC_SC3_PAGE_SEL ? sc3_tilemap_0 : sc3_tilemap_1)->set_scrolly(0, (SEIBU_CRTC_FIX_SY+1) & 0x1ff );
|
|
||||||
|
|
||||||
if(SEIBU_CRTC_ENABLE_SC0) { sc0_tilemap->draw(bitmap, cliprect, 0,0); }
|
|
||||||
if(SEIBU_CRTC_ENABLE_SPR) { draw_sprites(screen.machine(), bitmap,cliprect, 2); }
|
|
||||||
if(SEIBU_CRTC_ENABLE_SC2) { sc2_tilemap->draw(bitmap, cliprect, 0,0); }
|
|
||||||
if(SEIBU_CRTC_ENABLE_SPR) { draw_sprites(screen.machine(), bitmap,cliprect, 1); }
|
|
||||||
if(SEIBU_CRTC_ENABLE_SC1) { 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 ? sc3_tilemap_0 : sc3_tilemap_1)->draw(bitmap, cliprect, 0,0); }
|
|
||||||
if(SEIBU_CRTC_ENABLE_SPR) { draw_sprites(screen.machine(), bitmap,cliprect, 3); }
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
202
src/mame/video/seibu_crtc.c
Normal file
202
src/mame/video/seibu_crtc.c
Normal file
@ -0,0 +1,202 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
|
||||||
|
Seibu Custom "CRT Controller" emulation
|
||||||
|
|
||||||
|
Template to replace "legacy" version.
|
||||||
|
|
||||||
|
written by Angelo Salese
|
||||||
|
|
||||||
|
preliminary memory map:
|
||||||
|
(screen 0 -> Background)
|
||||||
|
(screen 1 -> Foreground)
|
||||||
|
(screen 2 -> Midground)
|
||||||
|
(screen 3 -> Text layer)
|
||||||
|
[0x00]: Single cell H size +1?
|
||||||
|
[0x02]: Total number of visible cells +1?
|
||||||
|
[0x1a]: Layer Dynamic Paging?
|
||||||
|
[0x1c]: Layer Enable
|
||||||
|
---x ---- sprite enable
|
||||||
|
---- x--- tilemap screen 3 enable
|
||||||
|
---- -x-- tilemap screen 1 enable
|
||||||
|
---- --x- tilemap screen 2 enable
|
||||||
|
---- ---x tilemap screen 0 enable
|
||||||
|
[0x20]: Tilemap Screen 0 scroll X
|
||||||
|
[0x22]: Tilemap Screen 0 scroll Y
|
||||||
|
[0x24]: Tilemap Screen 2 scroll X
|
||||||
|
[0x26]: Tilemap Screen 2 scroll Y
|
||||||
|
[0x28]: Tilemap Screen 1 scroll X
|
||||||
|
[0x2a]: Tilemap Screen 1 scroll Y
|
||||||
|
[0x2c]: Tilemap Screen 0 base scroll X
|
||||||
|
[0x2e]: Tilemap Screen 0 base scroll Y
|
||||||
|
[0x30]: Tilemap Screen 2 base scroll X
|
||||||
|
[0x32]: Tilemap Screen 2 base scroll Y
|
||||||
|
[0x34]: Tilemap Screen 1 base scroll X
|
||||||
|
[0x36]: Tilemap Screen 1 base scroll Y
|
||||||
|
[0x38]: Tilemap Screen 3 base scroll X
|
||||||
|
[0x3a]: Tilemap Screen 3 base scroll Y
|
||||||
|
|
||||||
|
===========================================================================================
|
||||||
|
|
||||||
|
List of default vregs (title screen):
|
||||||
|
|
||||||
|
*Sengoku Mahjong:
|
||||||
|
8000: 000F 0013 009F 00BF 00FA 000F 00FA 00FF
|
||||||
|
8010: 007D 0006 0000 0002 0000 0000 0000 0000
|
||||||
|
8020: 0000 0000 0004 0000 0000 0000 0040 01FF
|
||||||
|
8030: 003E 01FF 003F 01FF 0040 0001 0034 0035
|
||||||
|
8040: 0000 A8A8 0003 1C37 0001 0000 0000 0000
|
||||||
|
|
||||||
|
*Tottemo de Jong
|
||||||
|
8000: 000F 000F 009F 00BF 00FA 000F 00FA 00FF
|
||||||
|
8010: 0076 0006 0000 0002 0000 0002 0006 0000
|
||||||
|
8020: 0000 0000 0000 0000 0000 0000 01C0 01FF
|
||||||
|
8030: 003E 01FF 003F 01FF 00C0 01FF 0034 003F
|
||||||
|
8040: 0000 A8A8 0003 1830 0001 0000 0000 0000
|
||||||
|
|
||||||
|
*Good e Jong
|
||||||
|
8040: 000F 000F 009F 00BF 00FA 000F 00FA 00FF
|
||||||
|
8050: 0076 0006 0000 0002 0000 0002 0006 0000
|
||||||
|
8060: 0000 00FA 0000 0000 0000 0000 01C0 01FF
|
||||||
|
8070: 003E 01FF 003F 01FF 00C0 01FF 0034 003F
|
||||||
|
8080: 0000 0000 0000 0000 0000 0000 0000 0000
|
||||||
|
|
||||||
|
*SD Gundam Sangokushi Rainbow Tairiku Senki (320 x 224 normal, @ service mode)
|
||||||
|
100600: 000F 0013 00A7 00C7 00E0 000F 00E7 00F3
|
||||||
|
100610: 007E 01FE 0000 0002 0000 0000 0017 0000
|
||||||
|
100620: 0000 0000 0000 0000 0000 0000 01C8 01FF
|
||||||
|
100630: 01CA 01FF 01C9 01FF 01C8 01FF 0034 003F
|
||||||
|
100640: 0000 A8A8 001E 1C37 0008 0000 0000 FFFF
|
||||||
|
(320 x 224, flipped)
|
||||||
|
100600: 000F 0013 00A7 00C7 00E0 000F 00E7 00F3
|
||||||
|
100610: 007E 01FE 0000 0002 0000 0001 0017 0000
|
||||||
|
100620: 0001 0000 0000 0000 0000 0000 0177 0100
|
||||||
|
100630: 0175 0100 0176 0100 0177 0100 0034 003F
|
||||||
|
100640: 0000 A8A8 00E1 1C37 0018 0000 013F FFFF
|
||||||
|
(320 x 256, normal)
|
||||||
|
100600: 000F 0013 00A7 00C7 00E0 000F 00E1 00E9
|
||||||
|
100610: 0076 01FE 0000 0002 0000 0000 0017 0000
|
||||||
|
100620: 0002 0000 0000 0000 0000 0000 01C8 0207
|
||||||
|
100630: 01CA 0207 01C9 0207 01C8 0207 0034 003F
|
||||||
|
100640: 0000 A8A8 0016 1C37 0008 0000 0000 FFFF
|
||||||
|
(320 x 256, flipped)
|
||||||
|
100600: 000F 0013 00A7 00C7 00E0 000F 00E1 00E9
|
||||||
|
100610: 0076 01FE 0000 0002 0000 0001 0017 0000
|
||||||
|
100620: 0003 0000 0000 0000 0000 0000 0178 02F8
|
||||||
|
100630: 0175 02F8 0176 02F8 0177 02F8 0034 003F
|
||||||
|
100640: 0000 A8A8 00E9 1C37 0018 0000 013F FFFF
|
||||||
|
(320 x 240, normal)
|
||||||
|
100600: 000F 0013 00A7 00C7 00FA 000F 00FA 00FF
|
||||||
|
100610: 0076 0006 0000 0002 0000 0000 0017 0000
|
||||||
|
100620: 0004 0000 0000 0000 0000 0000 01D8 01FF
|
||||||
|
100630: 01DA 01FF 01D9 01FF 01D8 01FF 0034 003F
|
||||||
|
100640: 0000 A8A8 0004 1C37 0008 0000 0000 FFFF
|
||||||
|
(320 x 240, flipped)
|
||||||
|
100600: 000F 0013 00A7 00C7 00FA 000F 00FA 00FF
|
||||||
|
100610: 0076 0006 0000 0002 0000 0001 0017 0000
|
||||||
|
100620: 0005 0000 0000 0000 0000 0000 0187 0300
|
||||||
|
100630: 0185 0300 0186 0300 0185 0300 0034 003F
|
||||||
|
100640: 0000 A8A8 00FB 1C37 0018 0000 013F FFFF
|
||||||
|
*Legionnaire (attract mode, that definitely runs with an horizontal res of 256)
|
||||||
|
100600: 000F 000F 00B0 00D7 00FA 000F 00FA 00FF
|
||||||
|
100610: 0076 0006 0000 0002 0000 0000 0000 0000
|
||||||
|
100620: 0000 0000 0000 0000 0000 0000 01D8 01FF
|
||||||
|
100630: 01DA 01FF 01D9 01FF 01D8 01FF 0034 003F
|
||||||
|
100640: 0000 A8A8 0004 1830 0009 0000 0000 FFFF
|
||||||
|
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "emu.h"
|
||||||
|
#include "video/seibu_crtc.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//**************************************************************************
|
||||||
|
// GLOBAL VARIABLES
|
||||||
|
//**************************************************************************
|
||||||
|
|
||||||
|
// device type definition
|
||||||
|
const device_type SEIBU_CRTC = &device_creator<seibu_crtc_device>;
|
||||||
|
|
||||||
|
//**************************************************************************
|
||||||
|
// LIVE DEVICE
|
||||||
|
//**************************************************************************
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// seibu_crtc_device - constructor
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
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_validity_check - perform validity checks
|
||||||
|
// on this device
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
void seibu_crtc_device::device_validity_check(validity_checker &valid) const
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// device_config_complete - perform any
|
||||||
|
// operations now that the configuration is
|
||||||
|
// complete
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
void seibu_crtc_device::device_config_complete()
|
||||||
|
{
|
||||||
|
// inherit a copy of the static data
|
||||||
|
const seibu_crtc_interface *intf = reinterpret_cast<const seibu_crtc_interface *>(static_config());
|
||||||
|
if (intf != NULL)
|
||||||
|
*static_cast<seibu_crtc_interface *>(this) = *intf;
|
||||||
|
|
||||||
|
// or initialize to defaults if none provided
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_screen_tag = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// device_start - device-specific startup
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
void seibu_crtc_device::device_start()
|
||||||
|
{
|
||||||
|
m_screen = machine().device<screen_device>(m_screen_tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// device_reset - device-specific reset
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
void seibu_crtc_device::device_reset()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//**************************************************************************
|
||||||
|
// INLINE HELPERS
|
||||||
|
//**************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
//**************************************************************************
|
||||||
|
// READ/WRITE HANDLERS
|
||||||
|
//**************************************************************************
|
||||||
|
|
||||||
|
READ16_MEMBER( seibu_crtc_device::read )
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
WRITE16_MEMBER( seibu_crtc_device::write )
|
||||||
|
{
|
||||||
|
// ...
|
||||||
|
}
|
74
src/mame/video/seibu_crtc.h
Normal file
74
src/mame/video/seibu_crtc.h
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
|
||||||
|
Template for skeleton device
|
||||||
|
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef __SEIBU_CRTCDEV_H__
|
||||||
|
#define __SEIBU_CRTCDEV_H__
|
||||||
|
|
||||||
|
struct seibu_crtc_interface
|
||||||
|
{
|
||||||
|
const char *m_screen_tag;
|
||||||
|
// TODO: layer enable, scrolling
|
||||||
|
};
|
||||||
|
|
||||||
|
//**************************************************************************
|
||||||
|
// INTERFACE CONFIGURATION MACROS
|
||||||
|
//**************************************************************************
|
||||||
|
|
||||||
|
#define MCFG_SEIBU_CRTC_ADD(_tag,_config,_freq) \
|
||||||
|
MCFG_DEVICE_ADD(_tag, SEIBU_CRTC, _freq) \
|
||||||
|
MCFG_DEVICE_CONFIG(_config)
|
||||||
|
|
||||||
|
#define SEIBU_CRTC_INTERFACE(name) \
|
||||||
|
const seibu_crtc_interface (name) =
|
||||||
|
|
||||||
|
|
||||||
|
//**************************************************************************
|
||||||
|
// TYPE DEFINITIONS
|
||||||
|
//**************************************************************************
|
||||||
|
|
||||||
|
// ======================> seibu_crtc_device
|
||||||
|
|
||||||
|
class seibu_crtc_device : public device_t,
|
||||||
|
public seibu_crtc_interface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// construction/destruction
|
||||||
|
seibu_crtc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||||
|
|
||||||
|
// I/O operations
|
||||||
|
DECLARE_WRITE16_MEMBER( write );
|
||||||
|
DECLARE_READ16_MEMBER( read );
|
||||||
|
|
||||||
|
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();
|
||||||
|
|
||||||
|
screen_device *m_screen;
|
||||||
|
|
||||||
|
private:
|
||||||
|
const address_space_config m_space_config;
|
||||||
|
inline UINT16 read_word(offs_t address);
|
||||||
|
inline void write_word(offs_t address, UINT16 data);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// device type definition
|
||||||
|
extern const device_type SEIBU_CRTC;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//**************************************************************************
|
||||||
|
// GLOBAL VARIABLES
|
||||||
|
//**************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue
Block a user