alpha68k.cpp: Add addressable latch for type II and V configurations (nw)

This commit is contained in:
AJR 2018-05-26 22:35:20 -04:00
parent 87aae394f6
commit a37321a6fb
3 changed files with 100 additions and 125 deletions

View File

@ -280,6 +280,11 @@ READ16_MEMBER(alpha68k_state::jongbou_inputs_r)
return ioport("IN0")->read() | inp1 | inp2 << 4;
}
WRITE8_MEMBER(alpha68k_state::outlatch_w)
{
m_outlatch->write_bit((offset >> 2) & 7, BIT(offset, 5));
}
/******************************************************************************/
@ -646,11 +651,12 @@ void alpha68k_state::alpha68k_I_map(address_map &map)
void alpha68k_state::alpha68k_II_map(address_map &map)
{
map(0x000000, 0x03ffff).rom();
map(0x008ffe, 0x008fff).nopw();
map(0x040000, 0x040fff).ram().share("shared_ram");
map(0x080000, 0x080001).r(this, FUNC(alpha68k_state::control_1_r)); /* Joysticks */
map(0x080001, 0x080001).w("soundlatch", FUNC(generic_latch_8_device::write));
map(0x0c0000, 0x0c0001).r(this, FUNC(alpha68k_state::control_2_r)); /* CN1 & Dip 1 */
map(0x0c0000, 0x0c00ff).w(this, FUNC(alpha68k_state::alpha68k_II_video_bank_w));
map(0x0c0001, 0x0c0001).select(0x78).w(this, FUNC(alpha68k_state::outlatch_w));
map(0x0c8000, 0x0c8001).r(this, FUNC(alpha68k_state::control_3_r)); /* Bottom of CN2 */
map(0x0d0000, 0x0d0001).r(this, FUNC(alpha68k_state::control_4_r)); /* Top of CN1 & CN2 */
map(0x0d8000, 0x0d8001).nopr(); /* IRQ ack? */
@ -668,10 +674,10 @@ void alpha68k_state::alpha68k_V_map(address_map &map)
map(0x000000, 0x03ffff).rom();
map(0x040000, 0x043fff).ram().share("shared_ram");
map(0x080000, 0x080001).r(this, FUNC(alpha68k_state::control_1_r)); /* Joysticks */
map(0x080000, 0x080000).w(this, FUNC(alpha68k_state::alpha68k_V_video_bank_w));
map(0x080000, 0x080000).w(this, FUNC(alpha68k_state::video_bank_w));
map(0x080001, 0x080001).w("soundlatch", FUNC(generic_latch_8_device::write));
map(0x0c0000, 0x0c0001).r(this, FUNC(alpha68k_state::control_2_V_r)); /* Dip 2 */
map(0x0c0000, 0x0c00ff).w(this, FUNC(alpha68k_state::alpha68k_V_video_control_w));
map(0x0c0001, 0x0c0001).select(0x78).w(this, FUNC(alpha68k_state::outlatch_w));
map(0x0d8000, 0x0d8001).nopr(); /* IRQ ack? */
map(0x0e0000, 0x0e0001).nopr(); /* IRQ ack? */
map(0x0e8000, 0x0e8001).nopr(); /* watchdog? */
@ -1843,6 +1849,7 @@ MACHINE_RESET_MEMBER(alpha68k_state,common)
m_microcontroller_data = 0;
m_latch = 0;
m_flipscreen = 0;
m_last_bank = 0;
}
MACHINE_START_MEMBER(alpha68k_state,alpha68k_V)
@ -1864,18 +1871,11 @@ MACHINE_RESET_MEMBER(alpha68k_state,alpha68k_V)
MACHINE_RESET_CALL_MEMBER(common);
m_bank_base = 0;
m_last_bank = 0;
}
MACHINE_RESET_MEMBER(alpha68k_state,alpha68k_II)
{
MACHINE_RESET_CALL_MEMBER(common);
m_bank_base = 0;
m_last_bank = 0;
m_buffer_28 = 0;
m_buffer_60 = 0;
m_buffer_68 = 0;
}
MACHINE_START_MEMBER(alpha68k_state,alpha68k_II)
@ -1888,9 +1888,6 @@ MACHINE_START_MEMBER(alpha68k_state,alpha68k_II)
save_item(NAME(m_bank_base));
save_item(NAME(m_last_bank));
save_item(NAME(m_buffer_28));
save_item(NAME(m_buffer_60));
save_item(NAME(m_buffer_68));
save_item(NAME(m_sound_nmi_mask));
save_item(NAME(m_sound_pa_latch));
}
@ -2117,6 +2114,11 @@ MACHINE_CONFIG_START(alpha68k_state::alpha68k_II)
MCFG_DEVICE_IO_MAP(sound_portmap)
MCFG_DEVICE_PERIODIC_INT_DRIVER(alpha68k_state, alpha68k_sound_nmi, 7614)
MCFG_DEVICE_ADD("outlatch", LS259, 0) // 14A
MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(*this, alpha68k_state, video_control2_w))
MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(*this, alpha68k_state, video_control3_w))
MCFG_ADDRESSABLE_LATCH_PARALLEL_OUT_CB(WRITE8(*this, alpha68k_state, video_bank_w)) MCFG_DEVCB_MASK(0x70) MCFG_DEVCB_RSHIFT(-4)
MCFG_MACHINE_START_OVERRIDE(alpha68k_state,alpha68k_II)
MCFG_MACHINE_RESET_OVERRIDE(alpha68k_state,alpha68k_II)
@ -2179,6 +2181,10 @@ MACHINE_CONFIG_START(alpha68k_state::alpha68k_V)
MCFG_DEVICE_IO_MAP(sound_portmap)
MCFG_DEVICE_PERIODIC_INT_DRIVER(alpha68k_state, alpha68k_sound_nmi, ALPHA68K_PIXEL_CLOCK / ALPHA68K_HTOTAL / 2)
MCFG_DEVICE_ADD("outlatch", LS259, 0) // 13C
MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(*this, alpha68k_state, video_control2_w))
MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(*this, alpha68k_state, video_control3_w))
MCFG_MACHINE_START_OVERRIDE(alpha68k_state,alpha68k_V)
MCFG_MACHINE_RESET_OVERRIDE(alpha68k_state,alpha68k_V)

View File

@ -6,6 +6,7 @@
*************************************************************************/
#include "machine/74259.h"
#include "machine/gen_latch.h"
class alpha68k_state : public driver_device
@ -20,60 +21,20 @@ public:
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_outlatch(*this, "outlatch"),
m_soundlatch(*this, "soundlatch") { }
/* memory pointers */
optional_shared_ptr<uint16_t> m_shared_ram;
required_shared_ptr<uint16_t> m_spriteram;
optional_shared_ptr<uint16_t> m_videoram;
void tnextspc(machine_config &config);
void alpha68k_II(machine_config &config);
void btlfieldb(machine_config &config);
void alpha68k_I(machine_config &config);
void kyros(machine_config &config);
void alpha68k_V_sb(machine_config &config);
void sstingry(machine_config &config);
void jongbou(machine_config &config);
void alpha68k_V(machine_config &config);
void alpha68k_II_gm(machine_config &config);
/* video-related */
tilemap_t *m_fix_tilemap;
int m_bank_base;
int m_flipscreen;
int m_last_bank;
int m_buffer_28;
int m_buffer_60;
int m_buffer_68;
/* misc */
int m_invert_controls;
int m_microcontroller_id;
int m_coin_id;
unsigned m_trigstate;
unsigned m_deposits1;
unsigned m_deposits2;
unsigned m_credits;
unsigned m_coinvalue;
unsigned m_microcontroller_data;
int m_latch;
unsigned m_game_id; // see below
/* devices */
required_device<cpu_device> m_audiocpu;
uint8_t m_sound_nmi_mask;
uint8_t m_sound_pa_latch;
DECLARE_WRITE16_MEMBER(tnextspc_coin_counters_w);
DECLARE_WRITE16_MEMBER(tnextspc_unknown_w);
DECLARE_WRITE16_MEMBER(alpha_microcontroller_w);
DECLARE_READ16_MEMBER(kyros_dip_r);
DECLARE_READ16_MEMBER(control_1_r);
DECLARE_READ16_MEMBER(control_2_r);
DECLARE_READ16_MEMBER(control_2_V_r);
DECLARE_READ16_MEMBER(control_3_r);
DECLARE_READ16_MEMBER(control_4_r);
DECLARE_READ16_MEMBER(jongbou_inputs_r);
DECLARE_WRITE8_MEMBER(paddlema_soundlatch_w);
DECLARE_WRITE8_MEMBER(tnextspc_soundlatch_w);
DECLARE_READ16_MEMBER(kyros_alpha_trigger_r);
DECLARE_READ16_MEMBER(alpha_II_trigger_r);
DECLARE_READ16_MEMBER(alpha_V_trigger_r);
DECLARE_READ16_MEMBER(sound_cpu_r);
DECLARE_WRITE8_MEMBER(sound_bank_w);
DECLARE_WRITE8_MEMBER(porta_w);
DECLARE_WRITE16_MEMBER(alpha68k_videoram_w);
DECLARE_WRITE16_MEMBER(alpha68k_II_video_bank_w);
DECLARE_WRITE16_MEMBER(alpha68k_V_video_control_w);
void init_paddlema();
void init_btlfield();
void init_jongbou();
@ -92,6 +53,31 @@ public:
void init_timesold();
void init_kyros();
void init_sstingry();
private:
DECLARE_WRITE16_MEMBER(tnextspc_coin_counters_w);
DECLARE_WRITE16_MEMBER(tnextspc_unknown_w);
DECLARE_WRITE16_MEMBER(alpha_microcontroller_w);
DECLARE_READ16_MEMBER(kyros_dip_r);
DECLARE_READ16_MEMBER(control_1_r);
DECLARE_READ16_MEMBER(control_2_r);
DECLARE_READ16_MEMBER(control_2_V_r);
DECLARE_READ16_MEMBER(control_3_r);
DECLARE_READ16_MEMBER(control_4_r);
DECLARE_READ16_MEMBER(jongbou_inputs_r);
DECLARE_WRITE8_MEMBER(outlatch_w);
DECLARE_WRITE8_MEMBER(paddlema_soundlatch_w);
DECLARE_WRITE8_MEMBER(tnextspc_soundlatch_w);
DECLARE_READ16_MEMBER(kyros_alpha_trigger_r);
DECLARE_READ16_MEMBER(alpha_II_trigger_r);
DECLARE_READ16_MEMBER(alpha_V_trigger_r);
DECLARE_READ16_MEMBER(sound_cpu_r);
DECLARE_WRITE8_MEMBER(sound_bank_w);
DECLARE_WRITE8_MEMBER(porta_w);
DECLARE_WRITE16_MEMBER(alpha68k_videoram_w);
DECLARE_WRITE_LINE_MEMBER(video_control2_w);
DECLARE_WRITE_LINE_MEMBER(video_control3_w);
TILE_GET_INFO_MEMBER(get_tile_info);
DECLARE_MACHINE_START(common);
DECLARE_MACHINE_RESET(common);
@ -110,7 +96,7 @@ public:
uint32_t screen_update_alpha68k_V_sb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(alpha68k_sound_nmi);
void alpha68k_flipscreen_w( int flip );
DECLARE_WRITE8_MEMBER(alpha68k_V_video_bank_w);
DECLARE_WRITE8_MEMBER(video_bank_w);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int j, int s, int e );
void draw_sprites_V( bitmap_ind16 &bitmap, const rectangle &cliprect, int j, int s, int e, int fx_mask, int fy_mask, int sprite_mask );
void draw_sprites_I( bitmap_ind16 &bitmap, const rectangle &cliprect, int c, int d, int yshift );
@ -118,20 +104,6 @@ public:
void jongbou_video_banking(int *bank, int data);
void kyros_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int c, int d );
void sstingry_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int c, int d );
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
required_device<generic_latch_8_device> m_soundlatch;
void tnextspc(machine_config &config);
void alpha68k_II(machine_config &config);
void btlfieldb(machine_config &config);
void alpha68k_I(machine_config &config);
void kyros(machine_config &config);
void alpha68k_V_sb(machine_config &config);
void sstingry(machine_config &config);
void jongbou(machine_config &config);
void alpha68k_V(machine_config &config);
void alpha68k_II_gm(machine_config &config);
void alpha68k_II_map(address_map &map);
void alpha68k_I_map(address_map &map);
void alpha68k_I_s_map(address_map &map);
@ -147,6 +119,41 @@ public:
void tnextspc_map(address_map &map);
void tnextspc_sound_map(address_map &map);
void tnextspc_sound_portmap(address_map &map);
/* memory pointers */
optional_shared_ptr<uint16_t> m_shared_ram;
required_shared_ptr<uint16_t> m_spriteram;
optional_shared_ptr<uint16_t> m_videoram;
/* devices */
required_device<cpu_device> m_audiocpu;
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
optional_device<ls259_device> m_outlatch;
required_device<generic_latch_8_device> m_soundlatch;
uint8_t m_sound_nmi_mask;
uint8_t m_sound_pa_latch;
/* video-related */
tilemap_t *m_fix_tilemap;
int m_bank_base;
int m_flipscreen;
int m_last_bank;
/* misc */
int m_invert_controls;
int m_microcontroller_id;
int m_coin_id;
unsigned m_trigstate;
unsigned m_deposits1;
unsigned m_deposits2;
unsigned m_credits;
unsigned m_coinvalue;
unsigned m_microcontroller_data;
int m_latch;
unsigned m_game_id; // see below
};
/* game_id - used to deal with a few game specific situations */

View File

@ -15,7 +15,7 @@ void alpha68k_state::alpha68k_flipscreen_w( int flip )
m_flipscreen = flip;
}
WRITE8_MEMBER(alpha68k_state::alpha68k_V_video_bank_w)
WRITE8_MEMBER(alpha68k_state::video_bank_w)
{
m_bank_base = data & 0xf;
}
@ -140,57 +140,19 @@ uint32_t alpha68k_state::screen_update_alpha68k_II(screen_device &screen, bitmap
*/
WRITE16_MEMBER(alpha68k_state::alpha68k_II_video_bank_w)
/* Graphics flags? Not related to fix chars anyway */
WRITE_LINE_MEMBER(alpha68k_state::video_control2_w)
{
switch (offset)
{
case 0x10: /* Reset */
m_bank_base = m_buffer_28 = m_buffer_60 = m_buffer_68 = 0;
return;
case 0x14:
if (m_buffer_60) m_bank_base=1; else m_bank_base=0;
m_buffer_28 = 1;
return;
case 0x18:
if (m_buffer_68) {if (m_buffer_60) m_bank_base = 3; else m_bank_base = 2; }
if (m_buffer_28) {if (m_buffer_60) m_bank_base = 1; else m_bank_base = 0; }
return;
case 0x30:
m_buffer_28 = m_buffer_68 = 0; m_bank_base = 1;
m_buffer_60 = 1;
return;
case 0x34:
if (m_buffer_60) m_bank_base = 3; else m_bank_base = 2;
m_buffer_68 = 1;
return;
case 0x38:
if (m_buffer_68) {if (m_buffer_60) m_bank_base = 7; else m_bank_base = 6; }
if (m_buffer_28) {if (m_buffer_60) m_bank_base = 5; else m_bank_base = 4; }
return;
case 0x08: /* Graphics flags? Not related to fix chars anyway */
case 0x0c:
case 0x28:
case 0x2c:
return;
}
logerror("%s: Q2 changed to %d\n", machine().describe_context(), state);
}
logerror("%04x \n",offset);
WRITE_LINE_MEMBER(alpha68k_state::video_control3_w)
{
logerror("%s: Q3 changed to %d\n", machine().describe_context(), state);
}
/******************************************************************************/
WRITE16_MEMBER(alpha68k_state::alpha68k_V_video_control_w)
{
switch (offset)
{
case 0x08: /* Graphics flags? Not related to fix chars anyway */
case 0x0c:
case 0x28:
case 0x2c:
return;
}
}
void alpha68k_state::draw_sprites_V( bitmap_ind16 &bitmap, const rectangle &cliprect, int j, int s, int e, int fx_mask, int fy_mask, int sprite_mask )
{
uint16_t *spriteram = m_spriteram;