Add GROMCLK pin; optionally provides clock for GROMs

This commit is contained in:
Michael Zapf 2016-03-30 22:58:20 +02:00
parent 05d20888a4
commit bd1f1358a5
2 changed files with 23 additions and 0 deletions

View File

@ -59,6 +59,7 @@ tms9928a_device::tms9928a_device( const machine_config &mconfig, device_type typ
device_memory_interface(mconfig, *this),
device_video_interface(mconfig, *this),
m_out_int_line_cb(*this),
m_out_gromclk_cb(*this),
m_space_config("vram",ENDIANNESS_BIG, 8, 14, 0, nullptr, *ADDRESS_MAP_NAME(memmap))
{
m_50hz = is_50hz;
@ -74,6 +75,7 @@ tms9928a_device::tms9928a_device( const machine_config &mconfig, const char *tag
device_video_interface(mconfig, *this),
m_vram_size(0),
m_out_int_line_cb(*this),
m_out_gromclk_cb(*this),
m_space_config("vram",ENDIANNESS_BIG, 8, 14, 0, nullptr, *ADDRESS_MAP_NAME(memmap))
{
m_50hz = false;
@ -302,6 +304,15 @@ WRITE8_MEMBER( tms9928a_device::register_write )
void tms9928a_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
// Handle GROM clock if present
if (id==GROMCLK)
{
// Pulse it
m_out_gromclk_cb(ASSERT_LINE);
m_out_gromclk_cb(CLEAR_LINE);
return;
}
int raw_vpos = m_screen->vpos();
int vpos = raw_vpos * m_vertical_size / m_screen->height();
UINT16 BackColour = m_Regs[7] & 15;
@ -669,6 +680,7 @@ void tms9928a_device::device_start()
m_vertical_size = m_50hz ? TMS9928A_TOTAL_VERT_PAL : TMS9928A_TOTAL_VERT_NTSC;
m_out_int_line_cb.resolve();
m_out_gromclk_cb.resolve();
// Video RAM is allocated as an own address space
m_vram_space = &space(AS_DATA);
@ -677,6 +689,7 @@ void tms9928a_device::device_start()
m_tmpbmp.allocate(TMS9928A_TOTAL_HORZ, TMS9928A_TOTAL_VERT_PAL);
m_line_timer = timer_alloc(TIMER_LINE);
m_gromclk_timer = timer_alloc(GROMCLK);
set_palette();
@ -728,4 +741,7 @@ void tms9928a_device::device_reset()
m_mode = 0;
m_line_timer->adjust( m_screen->time_until_pos( 0, TMS9928A_HORZ_DISPLAY_START ) );
// TODO: Check clock freq settings in all drivers
if (!m_out_gromclk_cb.isnull() && m_99) m_gromclk_timer->adjust(attotime::zero, 0, attotime::from_hz(clock()/12));
}

View File

@ -51,6 +51,9 @@
#define MCFG_TMS9928A_SET_SCREEN MCFG_VIDEO_SET_SCREEN
#define MCFG_TMS9928A_OUT_GROMCLK_CB(_devcb) \
devcb = &tms9928a_device::set_out_gromclk_callback(*device, DEVCB_##_devcb);
#define MCFG_TMS9928A_SCREEN_ADD_NTSC(_screen_tag) \
MCFG_VIDEO_SET_SCREEN(_screen_tag) \
@ -87,6 +90,7 @@ public:
static void set_vram_size(device_t &device, int vram_size) { downcast<tms9928a_device &>(device).m_vram_size = vram_size; }
template<class _Object> static devcb_base &set_out_int_line_callback(device_t &device, _Object object) { return downcast<tms9928a_device &>(device).m_out_int_line_cb.set_callback(object); }
template<class _Object> static devcb_base &set_out_gromclk_callback(device_t &device, _Object object) { return downcast<tms9928a_device &>(device).m_out_gromclk_cb.set_callback(object); }
DECLARE_READ8_MEMBER( vram_read );
DECLARE_WRITE8_MEMBER( vram_write );
@ -117,9 +121,11 @@ private:
void set_palette();
static const device_timer_id TIMER_LINE = 0;
static const device_timer_id GROMCLK = 1;
int m_vram_size; /* 4K, 8K, or 16K. This should be replaced by fetching data from an address space? */
devcb_write_line m_out_int_line_cb; /* Callback is called whenever the state of the INT output changes */
devcb_write_line m_out_gromclk_cb; // GROMCLK line is optional; if present, pulse it by XTAL/24 rate
/* TMS9928A internal settings */
UINT8 m_ReadAhead;
@ -147,6 +153,7 @@ private:
bitmap_rgb32 m_tmpbmp;
emu_timer *m_line_timer;
emu_timer *m_gromclk_timer;
UINT8 m_mode;
/* emulation settings */