scn2674: More standard device configuration (nw)

This commit is contained in:
AJR 2017-11-25 09:36:51 -05:00
parent 00560a3184
commit fcb37e122f
7 changed files with 26 additions and 22 deletions

View File

@ -13,7 +13,7 @@
#include "logmacro.h"
DEFINE_DEVICE_TYPE(SCN2674_VIDEO, scn2674_device, "scn2674", "Signetics SCN2674 AVDC")
DEFINE_DEVICE_TYPE(SCN2674, scn2674_device, "scn2674", "Signetics SCN2674 AVDC")
// default address map
@ -22,10 +22,10 @@ static ADDRESS_MAP_START( scn2674_vram, 0, 8, scn2674_device )
ADDRESS_MAP_END
scn2674_device::scn2674_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, SCN2674_VIDEO, tag, owner, clock)
: device_t(mconfig, SCN2674, tag, owner, clock)
, device_video_interface(mconfig, *this)
, device_memory_interface(mconfig, *this)
, m_irq_cb(*this)
, m_intr_cb(*this)
, m_IR_pointer(0)
, m_screen1_l(0), m_screen1_h(0), m_cursor_l(0), m_cursor_h(0), m_screen2_l(0), m_screen2_h(0)
, m_irq_register(0), m_status_register(0), m_irq_mask(0)
@ -64,7 +64,7 @@ void scn2674_device::device_start()
{
// resolve callbacks
m_display_cb.bind_relative_to(*owner());
m_irq_cb.resolve_safe();
m_intr_cb.resolve_safe();
m_scanline_timer = timer_alloc(TIMER_SCANLINE);
m_screen->register_screen_bitmap(m_bitmap);
@ -410,7 +410,7 @@ void scn2674_device::write_command(uint8_t data)
m_irq_state = 1;
}
}
m_irq_cb(m_irq_register ? 1 : 0);
m_intr_cb(m_irq_register ? ASSERT_LINE : CLEAR_LINE);
}
if ((data&0xe0)==0x80)
@ -685,7 +685,7 @@ void scn2674_device::device_timer(emu_timer &timer, device_timer_id id, int para
LOG("vblank irq\n");
m_irq_state = 1;
m_irq_register |= 0x10;
m_irq_cb(1);
m_intr_cb(ASSERT_LINE);
}
}
@ -704,7 +704,7 @@ void scn2674_device::device_timer(emu_timer &timer, device_timer_id id, int para
LOG("SCN2674 Line Zero\n");
m_irq_state = 1;
m_irq_register |= 0x08;
m_irq_cb(1);
m_intr_cb(ASSERT_LINE);
}
}
@ -716,7 +716,7 @@ void scn2674_device::device_timer(emu_timer &timer, device_timer_id id, int para
LOG("SCN2674 Split Screen 1 irq\n");
m_irq_state = 1;
m_irq_register |= 0x04;
m_irq_cb(1);
m_intr_cb(ASSERT_LINE);
}
if(m_spl1)
m_address = (m_screen2_h << 8) | m_screen2_l;
@ -732,7 +732,7 @@ void scn2674_device::device_timer(emu_timer &timer, device_timer_id id, int para
LOG("SCN2674 Split Screen 2 irq\n");
m_irq_state = 1;
m_irq_register |= 0x01;
m_irq_cb(1);
m_intr_cb(ASSERT_LINE);
}
if(m_spl2)
m_address = (m_screen2_h << 8) | m_screen2_l;

View File

@ -6,9 +6,8 @@
#pragma once
#define MCFG_SCN2674_VIDEO_ADD(_tag, _clock, _irq) \
MCFG_DEVICE_ADD(_tag, SCN2674_VIDEO, _clock) \
devcb = &scn2674_device::set_irq_callback(*device, DEVCB_##_irq);
#define MCFG_SCN2674_INTR_CALLBACK(_intr) \
devcb = &scn2674_device::set_intr_callback(*device, DEVCB_##_intr);
#define MCFG_SCN2674_TEXT_CHARACTER_WIDTH(_value) \
scn2674_device::static_set_character_width(*device, _value);
@ -31,7 +30,7 @@ public:
typedef device_delegate<void (bitmap_rgb32 &bitmap, int x, int y, uint8_t linecount, uint8_t charcode, uint16_t address, uint8_t cursor, uint8_t dw, uint8_t lg, uint8_t ul, uint8_t blink)> draw_character_delegate;
// static configuration
template <class Object> static devcb_base &set_irq_callback(device_t &device, Object &&cb) { return downcast<scn2674_device &>(device).m_irq_cb.set_callback(std::forward<Object>(cb)); }
template <class Object> static devcb_base &set_intr_callback(device_t &device, Object &&cb) { return downcast<scn2674_device &>(device).m_intr_cb.set_callback(std::forward<Object>(cb)); }
static void static_set_character_width(device_t &device, int value) { downcast<scn2674_device &>(device).m_text_hpixels_per_column = value; }
static void static_set_gfx_character_width(device_t &device, int value) { downcast<scn2674_device &>(device).m_gfx_hpixels_per_column = value; }
static void static_set_display_callback(device_t &device, draw_character_delegate &&cb) { downcast<scn2674_device &>(device).m_display_cb = std::move(cb); }
@ -51,7 +50,7 @@ protected:
private:
bitmap_rgb32 m_bitmap;
devcb_write_line m_irq_cb;
devcb_write_line m_intr_cb;
uint8_t m_IR_pointer;
uint8_t m_screen1_l;
@ -129,6 +128,6 @@ private:
};
DECLARE_DEVICE_TYPE(SCN2674_VIDEO, scn2674_device)
DECLARE_DEVICE_TYPE(SCN2674, scn2674_device)
#endif // MAME_VIDEO_SCN2674_H

View File

@ -39,7 +39,7 @@ private:
WRITE_LINE_MEMBER(cit220_state::sod_w)
{
// controls access to memory at Exxx?
// probably asserts PBREQ on SCN2674 to access memory at Exxx
}
static ADDRESS_MAP_START( mem_map, AS_PROGRAM, 8, cit220_state )
@ -85,7 +85,8 @@ static MACHINE_CONFIG_START( cit220p )
MCFG_SCREEN_VISIBLE_AREA(0, 720-1, 0, 360-1)
MCFG_SCREEN_UPDATE_DEVICE("avdc", scn2674_device, screen_update)
MCFG_SCN2674_VIDEO_ADD("avdc", 4000000, INPUTLINE("maincpu", I8085_RST65_LINE))
MCFG_DEVICE_ADD("avdc", SCN2674, 4000000)
MCFG_SCN2674_INTR_CALLBACK(INPUTLINE("maincpu", I8085_RST65_LINE))
MCFG_SCN2674_TEXT_CHARACTER_WIDTH(8)
MCFG_SCN2674_GFX_CHARACTER_WIDTH(8)
MCFG_SCN2674_DRAW_CHARACTER_CALLBACK_OWNER(cit220_state, draw_character)

View File

@ -1281,7 +1281,8 @@ static MACHINE_CONFIG_START( mpu4_vid )
MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty)
MCFG_SCN2674_VIDEO_ADD("scn2674_vid", 0, INPUTLINE("video", 3))
MCFG_DEVICE_ADD("scn2674_vid", SCN2674, 0)
MCFG_SCN2674_INTR_CALLBACK(INPUTLINE("video", M68K_IRQ_3))
MCFG_SCN2674_TEXT_CHARACTER_WIDTH(8)
MCFG_SCN2674_GFX_CHARACTER_WIDTH(8)
MCFG_SCN2674_DRAW_CHARACTER_CALLBACK_OWNER(mpu4vid_state, display_pixels)

View File

@ -991,7 +991,8 @@ static MACHINE_CONFIG_START( octopus )
// MCFG_SCREEN_PALETTE("palette")
// MCFG_PALETTE_ADD_MONOCHROME("palette")
MCFG_SCN2674_VIDEO_ADD("crtc", 0, DEVWRITELINE("pic_slave",pic8259_device,ir0_w)) // character clock can be selectable, either 16MHz or 17.6MHz
MCFG_DEVICE_ADD("crtc", SCN2674, 0) // character clock can be selectable, either 16MHz or 17.6MHz
MCFG_SCN2674_INTR_CALLBACK(DEVWRITELINE("pic_slave", pic8259_device, ir0_w))
MCFG_SCN2674_TEXT_CHARACTER_WIDTH(8)
MCFG_SCN2674_GFX_CHARACTER_WIDTH(8)
MCFG_SCN2674_DRAW_CHARACTER_CALLBACK_OWNER(octopus_state, display_pixels)

View File

@ -77,7 +77,8 @@ static MACHINE_CONFIG_START( vp122 )
MCFG_SCREEN_VISIBLE_AREA(0, 720-1, 0, 360-1)
MCFG_SCREEN_UPDATE_DEVICE("avdc", scn2674_device, screen_update)
MCFG_SCN2674_VIDEO_ADD("avdc", 4000000, INPUTLINE("maincpu", I8085_RST65_LINE))
MCFG_DEVICE_ADD("avdc", SCN2674, 4000000)
MCFG_SCN2674_INTR_CALLBACK(INPUTLINE("maincpu", I8085_RST65_LINE))
MCFG_SCN2674_TEXT_CHARACTER_WIDTH(8)
MCFG_SCN2674_GFX_CHARACTER_WIDTH(8)
MCFG_SCN2674_DRAW_CHARACTER_CALLBACK_OWNER(vp122_state, draw_character)

View File

@ -115,7 +115,7 @@ MACHINE_CONFIG_MEMBER( pcd_video_device::device_add_mconfig )
MCFG_PALETTE_ADD("palette", 3)
MCFG_PALETTE_INIT_OWNER(pcdx_video_device, pcdx)
MCFG_SCN2674_VIDEO_ADD("crtc", 0, NOOP);
MCFG_DEVICE_ADD("crtc", SCN2674, 0)
MCFG_SCN2674_TEXT_CHARACTER_WIDTH(8)
MCFG_SCN2674_GFX_CHARACTER_WIDTH(16)
MCFG_SCN2674_DRAW_CHARACTER_CALLBACK_OWNER(pcd_video_device, display_pixels)
@ -157,7 +157,8 @@ MACHINE_CONFIG_MEMBER( pcx_video_device::device_add_mconfig )
MCFG_PALETTE_ADD_MONOCHROME("palette")
MCFG_SCN2674_VIDEO_ADD("crtc", 0, INPUTLINE("graphics", MCS51_INT0_LINE));
MCFG_DEVICE_ADD("crtc", SCN2674, 0)
MCFG_SCN2674_INTR_CALLBACK(INPUTLINE("graphics", MCS51_INT0_LINE))
MCFG_SCN2674_TEXT_CHARACTER_WIDTH(8)
MCFG_SCN2674_GFX_CHARACTER_WIDTH(16)
MCFG_SCN2674_DRAW_CHARACTER_CALLBACK_OWNER(pcx_video_device, display_pixels)