mirror of
https://github.com/holub/mame
synced 2025-04-23 08:49:55 +03:00
circusc: Add 74LS259 latch (nw)
This commit is contained in:
parent
97c4f2065d
commit
98c6e4c253
@ -56,6 +56,7 @@ This bug is due to 380_r02.6h, it differs from 380_q02.6h by 2 bytes, at
|
||||
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "cpu/m6809/m6809.h"
|
||||
#include "machine/74259.h"
|
||||
#include "machine/gen_latch.h"
|
||||
#include "machine/konami1.h"
|
||||
#include "machine/watchdog.h"
|
||||
@ -101,9 +102,14 @@ WRITE8_MEMBER(circusc_state::circusc_sh_irqtrigger_w)
|
||||
m_audiocpu->set_input_line_and_vector(0, HOLD_LINE, 0xff);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(circusc_state::circusc_coin_counter_w)
|
||||
WRITE_LINE_MEMBER(circusc_state::coin_counter_1_w)
|
||||
{
|
||||
machine().bookkeeping().coin_counter_w(offset, data);
|
||||
machine().bookkeeping().coin_counter_w(0, state);
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER(circusc_state::coin_counter_2_w)
|
||||
{
|
||||
machine().bookkeeping().coin_counter_w(1, state);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(circusc_state::circusc_sound_w)
|
||||
@ -139,17 +145,15 @@ WRITE8_MEMBER(circusc_state::circusc_sound_w)
|
||||
}
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(circusc_state::irq_mask_w)
|
||||
WRITE_LINE_MEMBER(circusc_state::irq_mask_w)
|
||||
{
|
||||
m_irq_mask = data & 1;
|
||||
m_irq_mask = state;
|
||||
if (!m_irq_mask)
|
||||
m_maincpu->set_input_line(M6809_IRQ_LINE, CLEAR_LINE);
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( circusc_map, AS_PROGRAM, 8, circusc_state )
|
||||
AM_RANGE(0x0000, 0x0000) AM_MIRROR(0x03f8) AM_WRITE(circusc_flipscreen_w) /* FLIP */
|
||||
AM_RANGE(0x0001, 0x0001) AM_MIRROR(0x03f8) AM_WRITE(irq_mask_w) /* INTST */
|
||||
// AM_RANGE(0x0002, 0x0002) AM_MIRROR(0x03f8) AM_WRITENOP /* MUT - not used /*
|
||||
AM_RANGE(0x0003, 0x0004) AM_MIRROR(0x03f8) AM_WRITE(circusc_coin_counter_w) /* COIN1, COIN2 */
|
||||
AM_RANGE(0x0005, 0x0005) AM_MIRROR(0x03f8) AM_WRITEONLY AM_SHARE("spritebank") /* OBJ CHENG */
|
||||
AM_RANGE(0x0000, 0x0007) AM_MIRROR(0x03f8) AM_DEVWRITE("mainlatch", ls259_device, write_d0)
|
||||
AM_RANGE(0x0400, 0x0400) AM_MIRROR(0x03ff) AM_DEVWRITE("watchdog", watchdog_timer_device, reset_w) /* WDOG */
|
||||
AM_RANGE(0x0800, 0x0800) AM_MIRROR(0x03ff) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) /* SOUND DATA */
|
||||
AM_RANGE(0x0c00, 0x0c00) AM_MIRROR(0x03ff) AM_WRITE(circusc_sh_irqtrigger_w) /* SOUND-ON causes interrupt on audio CPU */
|
||||
@ -333,8 +337,8 @@ DISCRETE_SOUND_END
|
||||
|
||||
INTERRUPT_GEN_MEMBER(circusc_state::vblank_irq)
|
||||
{
|
||||
if(m_irq_mask)
|
||||
device.execute().set_input_line(0, HOLD_LINE);
|
||||
if (m_irq_mask)
|
||||
device.execute().set_input_line(M6809_IRQ_LINE, ASSERT_LINE);
|
||||
}
|
||||
|
||||
static MACHINE_CONFIG_START( circusc )
|
||||
@ -344,6 +348,14 @@ static MACHINE_CONFIG_START( circusc )
|
||||
MCFG_CPU_PROGRAM_MAP(circusc_map)
|
||||
MCFG_CPU_VBLANK_INT_DRIVER("screen", circusc_state, vblank_irq)
|
||||
|
||||
MCFG_DEVICE_ADD("mainlatch", LS259, 0) // 2C
|
||||
MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(circusc_state, flipscreen_w)) // FLIP
|
||||
MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(circusc_state, irq_mask_w)) // INTST
|
||||
MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(NOOP) // MUT - not used
|
||||
MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(circusc_state, coin_counter_1_w)) // COIN1
|
||||
MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(WRITELINE(circusc_state, coin_counter_2_w)) // COIN2
|
||||
MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(WRITELINE(circusc_state, spritebank_w)) // OBJ CHENG
|
||||
|
||||
MCFG_WATCHDOG_ADD("watchdog")
|
||||
MCFG_WATCHDOG_VBLANK_INIT("screen", 8)
|
||||
|
||||
|
@ -14,7 +14,6 @@ class circusc_state : public driver_device
|
||||
public:
|
||||
circusc_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_spritebank(*this, "spritebank"),
|
||||
m_scroll(*this, "scroll"),
|
||||
m_colorram(*this, "colorram"),
|
||||
m_videoram(*this, "videoram"),
|
||||
@ -30,7 +29,6 @@ public:
|
||||
m_palette(*this, "palette") { }
|
||||
|
||||
/* memory pointers */
|
||||
required_shared_ptr<uint8_t> m_spritebank;
|
||||
required_shared_ptr<uint8_t> m_scroll;
|
||||
required_shared_ptr<uint8_t> m_colorram;
|
||||
required_shared_ptr<uint8_t> m_videoram;
|
||||
@ -39,6 +37,7 @@ public:
|
||||
|
||||
/* video-related */
|
||||
tilemap_t *m_bg_tilemap;
|
||||
bool m_spritebank;
|
||||
|
||||
/* sound-related */
|
||||
uint8_t m_sn_latch;
|
||||
@ -50,15 +49,18 @@ public:
|
||||
required_device<dac_byte_interface> m_dac;
|
||||
required_device<discrete_device> m_discrete;
|
||||
|
||||
uint8_t m_irq_mask;
|
||||
bool m_irq_mask;
|
||||
|
||||
DECLARE_READ8_MEMBER(circusc_sh_timer_r);
|
||||
DECLARE_WRITE8_MEMBER(circusc_sh_irqtrigger_w);
|
||||
DECLARE_WRITE8_MEMBER(circusc_coin_counter_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(coin_counter_1_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(coin_counter_2_w);
|
||||
DECLARE_WRITE8_MEMBER(circusc_sound_w);
|
||||
DECLARE_WRITE8_MEMBER(irq_mask_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(irq_mask_w);
|
||||
DECLARE_WRITE8_MEMBER(circusc_videoram_w);
|
||||
DECLARE_WRITE8_MEMBER(circusc_colorram_w);
|
||||
DECLARE_WRITE8_MEMBER(circusc_flipscreen_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(flipscreen_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(spritebank_w);
|
||||
DECLARE_DRIVER_INIT(circusc);
|
||||
TILE_GET_INFO_MEMBER(get_tile_info);
|
||||
virtual void machine_start() override;
|
||||
|
@ -122,6 +122,8 @@ void circusc_state::video_start()
|
||||
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(circusc_state::get_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
|
||||
|
||||
m_bg_tilemap->set_scroll_cols(32);
|
||||
|
||||
save_item(NAME(m_spritebank));
|
||||
}
|
||||
|
||||
|
||||
@ -144,9 +146,14 @@ WRITE8_MEMBER(circusc_state::circusc_colorram_w)
|
||||
m_bg_tilemap->mark_tile_dirty(offset);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(circusc_state::circusc_flipscreen_w)
|
||||
WRITE_LINE_MEMBER(circusc_state::flipscreen_w)
|
||||
{
|
||||
flip_screen_set(data & 1);
|
||||
flip_screen_set(state);
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER(circusc_state::spritebank_w)
|
||||
{
|
||||
m_spritebank = state;
|
||||
}
|
||||
|
||||
|
||||
@ -160,12 +167,7 @@ WRITE8_MEMBER(circusc_state::circusc_flipscreen_w)
|
||||
void circusc_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
{
|
||||
int offs;
|
||||
uint8_t *sr;
|
||||
|
||||
if ((*m_spritebank & 0x01) != 0)
|
||||
sr = m_spriteram;
|
||||
else
|
||||
sr = m_spriteram_2;
|
||||
uint8_t *sr = m_spritebank ? m_spriteram : m_spriteram_2;
|
||||
|
||||
for (offs = 0; offs < m_spriteram.bytes(); offs += 4)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user