goodejan.cpp: add difficulty dip, converted screen refresh rate to set_raw [Angelo Salese]

toki.cpp: converted screen refresh rate to set_raw [Angelo Salese]
This commit is contained in:
angelosa 2020-02-14 21:22:22 +01:00
parent 6207664384
commit bd5252fa62
2 changed files with 38 additions and 94 deletions

View File

@ -87,16 +87,17 @@ class goodejan_state : public driver_device, public seibu_sound_common
{
public:
goodejan_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_crtc(*this, "crtc"),
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_spriteram16(*this, "sprite_ram")
driver_device(mconfig, type, tag)
, m_maincpu(*this, "maincpu")
, m_gfxdecode(*this, "gfxdecode")
, m_palette(*this, "palette")
, m_crtc(*this, "crtc")
, 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_spriteram16(*this, "sprite_ram")
, m_key(*this, "KEY%u", 0)
{ }
void totmejan(machine_config &config);
@ -117,6 +118,8 @@ private:
required_shared_ptr<uint16_t> m_sc3_vram;
required_shared_ptr<uint16_t> m_spriteram16;
required_ioport_array<5> m_key;
tilemap_t *m_sc0_tilemap;
tilemap_t *m_sc1_tilemap;
tilemap_t *m_sc2_tilemap;
@ -196,65 +199,6 @@ private:
************************************/
#define SEIBU_CRTC_SC2_SY (m_scrollram[3])
#if 0
/*******************************
* 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])
#endif
/*******************************
*
* Write RAM accesses
@ -425,16 +369,13 @@ WRITE16_MEMBER(goodejan_state::gfxbank_w)
/* Multiplexer device for the mahjong panel */
READ16_MEMBER(goodejan_state::mahjong_panel_r)
{
uint16_t ret;
u16 ret;
ret = 0xffff;
switch(m_mux_data)
for (int i=0; i<5; i++)
{
case 1: ret = ioport("KEY0")->read(); break;
case 2: ret = ioport("KEY1")->read(); break;
case 4: ret = ioport("KEY2")->read(); break;
case 8: ret = ioport("KEY3")->read(); break;
case 0x10: ret = ioport("KEY4")->read(); break;
if (m_mux_data & (1 << i))
ret &= m_key[i]->read();
}
return ret;
@ -572,19 +513,22 @@ static INPUT_PORTS_START( goodejan )
PORT_DIPSETTING( 0x0040, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPUNKNOWN_DIPLOC( 0x0080, 0x0080, "DSWA:8" )
PORT_DIPNAME( 0x0300, 0x0300, "Starting Points" ) PORT_DIPLOCATION("DSWB:1,2")
PORT_DIPSETTING( 0x0300, "1500" )
PORT_DIPSETTING( 0x0200, "2000" )
PORT_DIPSETTING( 0x0100, "1000" )
PORT_DIPSETTING( 0x0000, "3000" )
/* [totmejan] Game definitely uses these, reads these 2 bits and stores at address 01A28h as 0-1st bit;
Sub-routine at E7C19h does some arithmetic operations depending on these.
I cound't understand whats going on. Call performs just before dealing tiles. */
// TODO: difficulty dips ofc
PORT_DIPUNKNOWN_DIPLOC( 0x0400, 0x0400, "DSWB:3" )
PORT_DIPUNKNOWN_DIPLOC( 0x0800, 0x0800, "DSWB:4" )
/*
* [totmejan]
* Before every hand game calls a subroutine at 0xe7c19, and reads these 2 bits from 0x01A28 work RAM buffer.
* This affects the tile distribution RNG via a complex algo for the end goal of giving the player a more or less
* favorable hand depending on the setting.
*/
PORT_DIPNAME( 0x0c00, 0x0c00, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("DSWB:3,4")
PORT_DIPSETTING( 0x0800, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x0c00, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x0400, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) )
PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("DSWB:5")
PORT_DIPSETTING( 0x1000, DEF_STR( On ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
@ -596,7 +540,8 @@ static INPUT_PORTS_START( goodejan )
PORT_START("DSW2")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_SERVICE1 )
PORT_BIT( 0xfffe, IP_ACTIVE_LOW, IPT_UNKNOWN ) // 0x0002 must be kept low to work as service coin
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_SERVICE2 )
PORT_BIT( 0xfffc, IP_ACTIVE_LOW, IPT_UNKNOWN ) // 0x0002 must be kept low to work as service coin
INPUT_PORTS_END
@ -668,10 +613,9 @@ void goodejan_state::goodejan(machine_config &config)
/* video hardware */
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_refresh_hz(60);
screen.set_vblank_time(ATTOSECONDS_IN_USEC(0));
screen.set_size(32*8, 32*8);
screen.set_visarea(0*8, 32*8-1, 2*8, 30*8-1); //TODO: dynamic resolution
// guess: assume ~59.61 Hz like toki, assume clock coming from the otherwise unused 12 MHz XTal
// (audio one don't give valid ranges for the provided HSync)
screen.set_raw(GOODEJAN_MHZ3/2, 390, 0, 256, 258, 16, 240);
screen.set_screen_update(FUNC(goodejan_state::screen_update));
screen.set_palette(m_palette);
screen.screen_vblank().set(FUNC(goodejan_state::vblank_irq));
@ -681,7 +625,7 @@ void goodejan_state::goodejan(machine_config &config)
m_crtc->layer_scroll_callback().set(FUNC(goodejan_state::layer_scroll_w));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_goodejan);
PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 0x1000);
PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 0x800);
/* sound hardware */
SPEAKER(config, "mono").front_center();

View File

@ -492,7 +492,8 @@ GFXDECODE_END
/*****************************************************************************/
void toki_state::toki(machine_config &config) /* KOYO 20.000MHz near the cpu */
/* KOYO 20.000MHz near the cpu */
void toki_state::toki(machine_config &config)
{
/* basic machine hardware */
M68000(config, m_maincpu, XTAL(20'000'000) / 2); /* verified on pcb */
@ -510,9 +511,7 @@ void toki_state::toki(machine_config &config) /* KOYO 20.000MHz near the cpu */
BUFFERED_SPRITERAM16(config, m_spriteram);
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_refresh_hz(59.61); /* verified on pcb */
m_screen->set_size(32*8, 32*8);
m_screen->set_visarea(0*8, 32*8-1, 2*8, 30*8-1); /* verified */
m_screen->set_raw(XTAL(12'000'000)/2, 390, 0, 256, 258, 16, 240);
m_screen->set_screen_update(FUNC(toki_state::screen_update_toki));
m_screen->screen_vblank().set("spriteram", FUNC(buffered_spriteram16_device::vblank_copy_rising));
m_screen->set_palette(m_palette);
@ -563,6 +562,7 @@ void toki_state::tokib(machine_config &config)
BUFFERED_SPRITERAM16(config, m_spriteram);
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
// TODO: refresh rate is unknown for bootlegs
m_screen->set_refresh_hz(60);
m_screen->set_size(32*8, 32*8);
m_screen->set_visarea(0*8, 32*8-1, 2*8, 30*8-1); /* verified */