docastle.c: hook up slave CPU IRQ according to schematics [Alex Jackson]

This commit is contained in:
Alex W. Jackson 2014-01-07 16:36:22 +00:00
parent 4a0d5a4c65
commit 60c5be899a
3 changed files with 41 additions and 40 deletions

View File

@ -153,14 +153,23 @@ Dip locations verified with manual for docastle, dorunrun and dowild.
#include "emu.h"
#include "cpu/z80/z80.h"
#include "video/mc6845.h"
#include "sound/msm5205.h"
#include "sound/sn76496.h"
#include "includes/docastle.h"
/* Read/Write Handlers */
WRITE_LINE_MEMBER(docastle_state::docastle_tint)
{
if (state)
{
int ma6 = m_crtc->get_ma() & 0x40;
if (ma6 & ~m_prev_ma6) // MA6 rising edge
m_slave->set_input_line(0, HOLD_LINE);
m_prev_ma6 = ma6;
}
}
WRITE_LINE_MEMBER(docastle_state::idsoccer_adpcm_int)
{
if (m_adpcm_pos >= memregion("adpcm")->bytes())
@ -221,10 +230,9 @@ static ADDRESS_MAP_START( docastle_map2, AS_PROGRAM, 8, docastle_state )
AM_RANGE(0xc001, 0xc001) AM_MIRROR(0x0080) AM_READ_PORT("DSW2")
AM_RANGE(0xc002, 0xc002) AM_MIRROR(0x0080) AM_READ_PORT("DSW1")
AM_RANGE(0xc003, 0xc003) AM_MIRROR(0x0080) AM_READ_PORT("JOYS")
AM_RANGE(0xc004, 0xc004) AM_READWRITE(docastle_flipscreen_off_r, docastle_flipscreen_off_w)
AM_RANGE(0xc004, 0xc004) AM_MIRROR(0x0080) AM_MASK(0x0080) AM_READWRITE(flipscreen_r, flipscreen_w)
AM_RANGE(0xc005, 0xc005) AM_MIRROR(0x0080) AM_READ_PORT("BUTTONS")
AM_RANGE(0xc007, 0xc007) AM_MIRROR(0x0080) AM_READ_PORT("SYSTEM")
AM_RANGE(0xc084, 0xc084) AM_READWRITE(docastle_flipscreen_on_r, docastle_flipscreen_on_w)
AM_RANGE(0xe000, 0xe000) AM_DEVWRITE("sn1", sn76489a_device, write)
AM_RANGE(0xe400, 0xe400) AM_DEVWRITE("sn2", sn76489a_device, write)
AM_RANGE(0xe800, 0xe800) AM_DEVWRITE("sn3", sn76489a_device, write)
@ -268,10 +276,9 @@ static ADDRESS_MAP_START( dorunrun_map2, AS_PROGRAM, 8, docastle_state )
AM_RANGE(0xc001, 0xc001) AM_MIRROR(0x0080) AM_READ_PORT("DSW2")
AM_RANGE(0xc002, 0xc002) AM_MIRROR(0x0080) AM_READ_PORT("DSW1")
AM_RANGE(0xc003, 0xc003) AM_MIRROR(0x0080) AM_READ_PORT("JOYS")
AM_RANGE(0xc004, 0xc004) AM_READWRITE(docastle_flipscreen_off_r, docastle_flipscreen_off_w)
AM_RANGE(0xc004, 0xc004) AM_MIRROR(0x0080) AM_MASK(0x0080) AM_READWRITE(flipscreen_r, flipscreen_w)
AM_RANGE(0xc005, 0xc005) AM_MIRROR(0x0080) AM_READ_PORT("BUTTONS")
AM_RANGE(0xc007, 0xc007) AM_MIRROR(0x0080) AM_READ_PORT("SYSTEM")
AM_RANGE(0xc084, 0xc084) AM_READWRITE(docastle_flipscreen_on_r, docastle_flipscreen_on_w)
AM_RANGE(0xe000, 0xe008) AM_READWRITE(docastle_shared1_r, docastle_shared0_w)
ADDRESS_MAP_END
@ -296,10 +303,9 @@ static ADDRESS_MAP_START( idsoccer_map2, AS_PROGRAM, 8, docastle_state )
AM_RANGE(0xc001, 0xc001) AM_MIRROR(0x0080) AM_READ_PORT("DSW2")
AM_RANGE(0xc002, 0xc002) AM_MIRROR(0x0080) AM_READ_PORT("DSW1")
AM_RANGE(0xc003, 0xc003) AM_MIRROR(0x0080) AM_READ_PORT("JOYS")
AM_RANGE(0xc004, 0xc004) AM_READ_PORT("JOYS_RIGHT") AM_WRITE(docastle_flipscreen_off_w)
AM_RANGE(0xc004, 0xc004) AM_MIRROR(0x0080) AM_MASK(0x0080) AM_READ_PORT("JOYS_RIGHT") AM_WRITE(flipscreen_w)
AM_RANGE(0xc005, 0xc005) AM_MIRROR(0x0080) AM_READ_PORT("BUTTONS")
AM_RANGE(0xc007, 0xc007) AM_MIRROR(0x0080) AM_READ_PORT("SYSTEM")
AM_RANGE(0xc084, 0xc084) AM_READ_PORT("JOYS_RIGHT") AM_WRITE(docastle_flipscreen_on_w)
AM_RANGE(0xe000, 0xe000) AM_DEVWRITE("sn1", sn76489a_device, write)
AM_RANGE(0xe400, 0xe400) AM_DEVWRITE("sn2", sn76489a_device, write)
AM_RANGE(0xe800, 0xe800) AM_DEVWRITE("sn3", sn76489a_device, write)
@ -555,14 +561,14 @@ GFXDECODE_END
static MC6845_INTERFACE( crtc_intf )
{
false, /* show border area */
8,-8,32,32, /* visarea adjustment */
8,-8,0,0, /* visarea adjustment */
8, /* number of pixels per video memory address */
NULL, /* before pixel update callback */
NULL, /* row update callback */
NULL, /* after pixel update callback */
DEVCB_NULL, /* callback for display state changes */
DEVCB_NULL, /* callback for cursor state changes */
DEVCB_NULL, /* HSYNC callback */
DEVCB_DRIVER_LINE_MEMBER(docastle_state, docastle_tint), /* HSYNC callback */
DEVCB_NULL, /* VSYNC callback */
NULL /* update address callback */
};
@ -599,6 +605,7 @@ void docastle_state::machine_reset()
m_buffer1[i] = 0;
}
m_prev_ma6 = 0;
m_adpcm_pos = m_adpcm_idle = 0;
m_adpcm_data = -1;
m_adpcm_status = 0;
@ -606,6 +613,7 @@ void docastle_state::machine_reset()
void docastle_state::machine_start()
{
save_item(NAME(m_prev_ma6));
save_item(NAME(m_adpcm_pos));
save_item(NAME(m_adpcm_data));
save_item(NAME(m_adpcm_idle));
@ -624,7 +632,6 @@ static MACHINE_CONFIG_START( docastle, docastle_state )
MCFG_CPU_ADD("slave", Z80, XTAL_4MHz)
MCFG_CPU_PROGRAM_MAP(docastle_map2)
MCFG_CPU_PERIODIC_INT_DRIVER(docastle_state, irq0_line_hold, 8*60) // ?
MCFG_CPU_ADD("cpu3", Z80, XTAL_4MHz)
MCFG_CPU_PROGRAM_MAP(docastle_map3)
@ -634,7 +641,7 @@ static MACHINE_CONFIG_START( docastle, docastle_state )
MCFG_MC6845_ADD("crtc", H46505, "screen", XTAL_9_828MHz / 16, crtc_intf)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(XTAL_9_828MHz/2, 0x138, 0+8, 0x110-24, 0x108, 0+32, 0xe0) // from crtc
MCFG_SCREEN_RAW_PARAMS(XTAL_9_828MHz/2, 0x138, 0, 0x100, 0x108, 0, 0xc0) // from crtc
MCFG_SCREEN_UPDATE_DRIVER(docastle_state, screen_update_docastle)
MCFG_GFXDECODE(docastle)

View File

@ -4,6 +4,7 @@
***************************************************************************/
#include "video/mc6845.h"
#include "sound/msm5205.h"
class docastle_state : public driver_device
@ -13,6 +14,8 @@ public:
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_slave(*this, "slave"),
m_cpu3(*this, "cpu3"),
m_crtc(*this, "crtc"),
m_msm(*this, "msm"),
m_videoram(*this, "videoram"),
m_colorram(*this, "colorram"),
@ -22,6 +25,8 @@ public:
/* devices */
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_slave;
required_device<cpu_device> m_cpu3;
required_device<h46505_device> m_crtc;
optional_device<msm5205_device> m_msm;
/* memory pointers */
@ -33,6 +38,7 @@ public:
tilemap_t *m_do_tilemap;
/* misc */
int m_prev_ma6;
int m_adpcm_pos;
int m_adpcm_idle;
int m_adpcm_data;
@ -47,10 +53,8 @@ public:
DECLARE_WRITE8_MEMBER(docastle_nmitrigger_w);
DECLARE_WRITE8_MEMBER(docastle_videoram_w);
DECLARE_WRITE8_MEMBER(docastle_colorram_w);
DECLARE_READ8_MEMBER(docastle_flipscreen_off_r);
DECLARE_READ8_MEMBER(docastle_flipscreen_on_r);
DECLARE_WRITE8_MEMBER(docastle_flipscreen_off_w);
DECLARE_WRITE8_MEMBER(docastle_flipscreen_on_w);
DECLARE_READ8_MEMBER(flipscreen_r);
DECLARE_WRITE8_MEMBER(flipscreen_w);
DECLARE_READ8_MEMBER(idsoccer_adpcm_status_r);
DECLARE_WRITE8_MEMBER(idsoccer_adpcm_w);
TILE_GET_INFO_MEMBER(get_tile_info);
@ -62,5 +66,6 @@ public:
UINT32 screen_update_docastle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void video_start_common( UINT32 tile_transmask );
void draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect );
DECLARE_WRITE_LINE_MEMBER(docastle_tint);
DECLARE_WRITE_LINE_MEMBER(idsoccer_adpcm_int);
};

View File

@ -73,30 +73,17 @@ WRITE8_MEMBER(docastle_state::docastle_colorram_w)
m_do_tilemap->mark_tile_dirty(offset);
}
READ8_MEMBER(docastle_state::docastle_flipscreen_off_r)
READ8_MEMBER(docastle_state::flipscreen_r)
{
flip_screen_set(0);
m_do_tilemap->mark_all_dirty();
return 0;
flip_screen_set_no_update(offset);
m_do_tilemap->set_flip(offset ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0);
return (offset ? 1 : 0); // is this really needed?
}
READ8_MEMBER(docastle_state::docastle_flipscreen_on_r)
WRITE8_MEMBER(docastle_state::flipscreen_w)
{
flip_screen_set(1);
m_do_tilemap->mark_all_dirty();
return 1;
}
WRITE8_MEMBER(docastle_state::docastle_flipscreen_off_w)
{
flip_screen_set(0);
m_do_tilemap->mark_all_dirty();
}
WRITE8_MEMBER(docastle_state::docastle_flipscreen_on_w)
{
flip_screen_set(1);
m_do_tilemap->mark_all_dirty();
flip_screen_set_no_update(offset);
m_do_tilemap->set_flip(offset ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0);
}
TILE_GET_INFO_MEMBER(docastle_state::get_tile_info)
@ -110,6 +97,8 @@ TILE_GET_INFO_MEMBER(docastle_state::get_tile_info)
void docastle_state::video_start_common( UINT32 tile_transmask )
{
m_do_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(docastle_state::get_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
m_do_tilemap->set_scrolldx(0, 0x138 - 0x100);
m_do_tilemap->set_scrolldy(-32, 0x108 - 0x100 - (-32));
m_do_tilemap->set_transmask(0, tile_transmask, 0x0000);
}
@ -155,7 +144,7 @@ void docastle_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap,
code = m_spriteram[offs + 3];
color = m_spriteram[offs + 2] & 0x0f;
sx = ((m_spriteram[offs + 1] + 8) & 0xff) - 8;
sy = m_spriteram[offs];
sy = m_spriteram[offs] - 32;
flipx = m_spriteram[offs + 2] & 0x40;
flipy = 0;
if (m_spriteram[offs + 2] & 0x10) code += 0x100;
@ -181,15 +170,15 @@ void docastle_state::draw_sprites( screen_device &screen, bitmap_ind16 &bitmap,
code = m_spriteram[offs + 3];
color = m_spriteram[offs + 2] & 0x1f;
sx = ((m_spriteram[offs + 1] + 8) & 0xff) - 8;
sy = m_spriteram[offs];
sy = m_spriteram[offs] - 32;
flipx = m_spriteram[offs + 2] & 0x40;
flipy = m_spriteram[offs + 2] & 0x80;
}
if (flip_screen())
{
sx = 296 - sx;
sy = 248 - sy;
sx = 240 - sx;
sy = 176 - sy;
flipx = !flipx;
flipy = !flipy;
}