mirror of
https://github.com/holub/mame
synced 2025-05-06 22:35:43 +03:00
i8275x: devcb2. (nw)
This commit is contained in:
parent
f9e5685e45
commit
0ee2899480
@ -82,6 +82,11 @@ const device_type I8275x = &device_creator<i8275x_device>;
|
||||
i8275x_device::i8275x_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: device_t(mconfig, I8275x, "I8275", tag, owner, clock, "i8275x", __FILE__),
|
||||
device_video_interface(mconfig, *this),
|
||||
m_write_irq(*this),
|
||||
m_write_drq(*this),
|
||||
m_write_hrtc(*this),
|
||||
m_write_vrtc(*this),
|
||||
m_display_pixels(NULL),
|
||||
m_status(0),
|
||||
m_param_idx(0),
|
||||
m_param_end(0),
|
||||
@ -102,30 +107,6 @@ i8275x_device::i8275x_device(const machine_config &mconfig, const char *tag, dev
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_config_complete - perform any
|
||||
// operations now that the configuration is
|
||||
// complete
|
||||
//-------------------------------------------------
|
||||
|
||||
void i8275x_device::device_config_complete()
|
||||
{
|
||||
// inherit a copy of the static data
|
||||
const i8275_interface *intf = reinterpret_cast<const i8275_interface *>(static_config());
|
||||
if (intf != NULL)
|
||||
*static_cast<i8275_interface *>(this) = *intf;
|
||||
|
||||
// or initialize to defaults if none provided
|
||||
else
|
||||
{
|
||||
memset(&m_out_drq_cb, 0, sizeof(m_out_drq_cb));
|
||||
memset(&m_out_irq_cb, 0, sizeof(m_out_irq_cb));
|
||||
memset(&m_out_hrtc_cb, 0, sizeof(m_out_hrtc_cb));
|
||||
memset(&m_out_vrtc_cb, 0, sizeof(m_out_vrtc_cb));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
@ -136,10 +117,10 @@ void i8275x_device::device_start()
|
||||
m_screen->register_screen_bitmap(m_bitmap);
|
||||
|
||||
// resolve callbacks
|
||||
m_out_drq_func.resolve(m_out_drq_cb, *this);
|
||||
m_out_irq_func.resolve(m_out_irq_cb, *this);
|
||||
m_out_hrtc_func.resolve(m_out_hrtc_cb, *this);
|
||||
m_out_vrtc_func.resolve(m_out_vrtc_cb, *this);
|
||||
m_write_drq.resolve_safe();
|
||||
m_write_irq.resolve_safe();
|
||||
m_write_hrtc.resolve_safe();
|
||||
m_write_vrtc.resolve_safe();
|
||||
|
||||
// allocate timers
|
||||
m_hrtc_on_timer = timer_alloc(TIMER_HRTC_ON);
|
||||
@ -172,7 +153,7 @@ void i8275x_device::device_reset()
|
||||
|
||||
m_status &= ~ST_IE;
|
||||
|
||||
m_out_irq_func(CLEAR_LINE);
|
||||
m_write_irq(CLEAR_LINE);
|
||||
}
|
||||
|
||||
|
||||
@ -191,12 +172,12 @@ void i8275x_device::device_timer(emu_timer &timer, device_timer_id id, int param
|
||||
{
|
||||
case TIMER_HRTC_ON:
|
||||
//logerror("I8275 '%s' y %u x %u HRTC 1\n", tag(), y, x);
|
||||
m_out_hrtc_func(1);
|
||||
m_write_hrtc(1);
|
||||
break;
|
||||
|
||||
case TIMER_DRQ_ON:
|
||||
//logerror("I8275 '%s' y %u x %u DRQ 1\n", tag(), y, x);
|
||||
m_out_drq_func(1);
|
||||
m_write_drq(1);
|
||||
m_drq_off_timer->adjust(clocks_to_attotime(DMA_BURST_COUNT));
|
||||
break;
|
||||
|
||||
@ -206,17 +187,17 @@ void i8275x_device::device_timer(emu_timer &timer, device_timer_id id, int param
|
||||
m_status |= ST_DU;
|
||||
m_du = true;
|
||||
//logerror("I8275 '%s' y %u x %u DRQ 0\n", tag(), y, x);
|
||||
m_out_drq_func(0);
|
||||
m_write_drq(0);
|
||||
}
|
||||
else if (m_buffer_idx == CHARACTERS_PER_ROW)
|
||||
{
|
||||
//logerror("I8275 '%s' y %u x %u DRQ 0\n", tag(), y, x);
|
||||
m_out_drq_func(0);
|
||||
m_write_drq(0);
|
||||
}
|
||||
else if (DMA_BURST_SPACE > 0)
|
||||
{
|
||||
//logerror("I8275 '%s' y %u x %u DRQ 0\n", tag(), y, x);
|
||||
m_out_drq_func(0);
|
||||
m_write_drq(0);
|
||||
m_drq_on_timer->adjust(clocks_to_attotime(DMA_BURST_SPACE));
|
||||
}
|
||||
break;
|
||||
@ -225,12 +206,12 @@ void i8275x_device::device_timer(emu_timer &timer, device_timer_id id, int param
|
||||
if (!(m_status & ST_VE)) break;
|
||||
|
||||
//logerror("I8275 '%s' y %u x %u HRTC 0\n", tag(), y, x);
|
||||
m_out_hrtc_func(0);
|
||||
m_write_hrtc(0);
|
||||
|
||||
if (m_scanline == 0)
|
||||
{
|
||||
//logerror("I8275 '%s' y %u x %u VRTC 0\n", tag(), y, x);
|
||||
m_out_vrtc_func(0);
|
||||
m_write_vrtc(0);
|
||||
}
|
||||
else if (m_scanline == m_irq_scanline)
|
||||
{
|
||||
@ -238,13 +219,13 @@ void i8275x_device::device_timer(emu_timer &timer, device_timer_id id, int param
|
||||
{
|
||||
//logerror("I8275 '%s' y %u x %u IRQ 1\n", tag(), y, x);
|
||||
m_status |= ST_IR;
|
||||
m_out_irq_func(ASSERT_LINE);
|
||||
m_write_irq(ASSERT_LINE);
|
||||
}
|
||||
}
|
||||
else if (m_scanline == m_vrtc_scanline)
|
||||
{
|
||||
//logerror("I8275 '%s' y %u x %u VRTC 1\n", tag(), y, x);
|
||||
m_out_vrtc_func(1);
|
||||
m_write_vrtc(1);
|
||||
|
||||
// reset field attributes
|
||||
m_hlgt = 0;
|
||||
@ -346,7 +327,8 @@ void i8275x_device::device_timer(emu_timer &timer, device_timer_id id, int param
|
||||
lc = (lc - 1) & 0x0f;
|
||||
}
|
||||
|
||||
m_display_pixels_func(this, m_bitmap,
|
||||
if (m_display_pixels)
|
||||
m_display_pixels(this, m_bitmap,
|
||||
sx * m_hpixels_per_column, // x position on screen of starting point
|
||||
m_scanline, // y position on screen
|
||||
lc, // current line of char
|
||||
@ -383,7 +365,7 @@ READ8_MEMBER( i8275x_device::read )
|
||||
if (m_status & ST_IR)
|
||||
{
|
||||
//logerror("I8275 '%s' IRQ 0\n", tag());
|
||||
m_out_irq_func(CLEAR_LINE);
|
||||
m_write_irq(CLEAR_LINE);
|
||||
}
|
||||
|
||||
m_status &= ~(ST_IR | ST_LP | ST_IC | ST_DU | ST_FO);
|
||||
@ -420,7 +402,7 @@ WRITE8_MEMBER( i8275x_device::write )
|
||||
|
||||
m_status &= ~ST_IE;
|
||||
logerror("I8275 '%s' IRQ 0\n", tag());
|
||||
m_out_irq_func(CLEAR_LINE);
|
||||
m_write_irq(CLEAR_LINE);
|
||||
|
||||
m_param_idx = REG_SCN1;
|
||||
m_param_end = REG_SCN4;
|
||||
|
@ -43,13 +43,20 @@
|
||||
// INTERFACE CONFIGURATION MACROS
|
||||
//**************************************************************************
|
||||
|
||||
#define MCFG_I8275_ADD(_tag, _clock, _config) \
|
||||
#define MCFG_I8275_ADD(_tag, _clock, _hpixels_per_column, _display_func, _drq) \
|
||||
MCFG_DEVICE_ADD(_tag, I8275x, _clock) \
|
||||
MCFG_DEVICE_CONFIG(_config)
|
||||
downcast<i8275x_device *>(device)->set_hpixels_per_column(_hpixels_per_column); \
|
||||
downcast<i8275x_device *>(device)->set_display_func(_display_func); \
|
||||
downcast<i8275x_device *>(device)->set_drq_callback(DEVCB2_##_drq);
|
||||
|
||||
#define MCFG_I8275_IRQ_CALLBACK(_irq) \
|
||||
downcast<i8275x_device *>(device)->set_irq_callback(DEVCB2_##_irq); \
|
||||
|
||||
#define I8275_INTERFACE(name) \
|
||||
const i8275_interface (name) =
|
||||
#define MCFG_I8275_HRTC_CALLBACK(_hrtc) \
|
||||
downcast<i8275x_device *>(device)->set_hrtc_callback(DEVCB2_##_hrtc); \
|
||||
|
||||
#define MCFG_I8275_VRTC_CALLBACK(_vrtc) \
|
||||
downcast<i8275x_device *>(device)->set_vrtc_callback(DEVCB2_##_vrtc);
|
||||
|
||||
|
||||
|
||||
@ -66,34 +73,22 @@ typedef void (*i8275_display_pixels_func)(i8275x_device *device, bitmap_rgb32 &b
|
||||
#define I8275_DISPLAY_PIXELS(name) void name(i8275x_device *device, bitmap_rgb32 &bitmap, int x, int y, UINT8 linecount, UINT8 charcode, UINT8 lineattr, UINT8 lten, UINT8 rvv, UINT8 vsp, UINT8 gpa, UINT8 hlgt)
|
||||
|
||||
|
||||
// ======================> i8275_interface
|
||||
|
||||
struct i8275_interface
|
||||
{
|
||||
int m_hpixels_per_column;
|
||||
int m_dummy;
|
||||
|
||||
devcb_write_line m_out_drq_cb;
|
||||
devcb_write_line m_out_irq_cb;
|
||||
|
||||
devcb_write_line m_out_hrtc_cb;
|
||||
devcb_write_line m_out_vrtc_cb;
|
||||
|
||||
i8275_display_pixels_func m_display_pixels_func;
|
||||
};
|
||||
|
||||
|
||||
|
||||
// ======================> i8275x_device
|
||||
|
||||
class i8275x_device : public device_t,
|
||||
public device_video_interface,
|
||||
public i8275_interface
|
||||
public device_video_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
i8275x_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
template<class _irq> void set_irq_callback(_irq irq) { m_write_irq.set_callback(irq); }
|
||||
template<class _drq> void set_drq_callback(_drq drq) { m_write_drq.set_callback(drq); }
|
||||
template<class _hrtc> void set_hrtc_callback(_hrtc hrtc) { m_write_hrtc.set_callback(hrtc); }
|
||||
template<class _vrtc> void set_vrtc_callback(_vrtc vrtc) { m_write_vrtc.set_callback(vrtc); }
|
||||
void set_hpixels_per_column(int hpixels_per_column) { m_hpixels_per_column = hpixels_per_column; }
|
||||
void set_display_func(i8275_display_pixels_func func) { m_display_pixels = func; }
|
||||
|
||||
DECLARE_READ8_MEMBER( read );
|
||||
DECLARE_WRITE8_MEMBER( write );
|
||||
|
||||
@ -105,7 +100,6 @@ public:
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_config_complete();
|
||||
virtual void device_start();
|
||||
virtual void device_reset();
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
|
||||
@ -172,10 +166,13 @@ protected:
|
||||
FAC_U = 0x20
|
||||
};
|
||||
|
||||
devcb_resolved_write_line m_out_drq_func;
|
||||
devcb_resolved_write_line m_out_irq_func;
|
||||
devcb_resolved_write_line m_out_hrtc_func;
|
||||
devcb_resolved_write_line m_out_vrtc_func;
|
||||
devcb2_write_line m_write_irq;
|
||||
devcb2_write_line m_write_drq;
|
||||
devcb2_write_line m_write_hrtc;
|
||||
devcb2_write_line m_write_vrtc;
|
||||
|
||||
i8275_display_pixels_func m_display_pixels;
|
||||
int m_hpixels_per_column;
|
||||
|
||||
bitmap_rgb32 m_bitmap;
|
||||
|
||||
|
@ -360,19 +360,6 @@ static I8275_DISPLAY_PIXELS( zorba_update_chr )
|
||||
bitmap.pix32(y, x + 7 - i) = palette[BIT(gfx, i) ? (hlgt ? 2 : 1) : 0];
|
||||
}
|
||||
|
||||
// dack connects to busack on cpu
|
||||
// drq connects to pin 25 "RDY" on z80dma
|
||||
const i8275_interface crtc_intf =
|
||||
{
|
||||
8, // pixels in each char
|
||||
0, // delay
|
||||
DEVCB_NULL,//DEVCB_DEVICE_LINE_MEMBER("dma", z80dma_device, rdy_w), //wrln drq
|
||||
DEVCB_CPU_INPUT_LINE("maincpu", INPUT_LINE_IRQ0), //wrln irq
|
||||
DEVCB_NULL, //wrln h
|
||||
DEVCB_NULL, //wrln v
|
||||
zorba_update_chr // output func
|
||||
};
|
||||
|
||||
MACHINE_RESET_MEMBER( zorba_state, zorba )
|
||||
{
|
||||
m_beep->set_frequency(800);
|
||||
@ -466,7 +453,8 @@ static MACHINE_CONFIG_START( zorba, zorba_state )
|
||||
MCFG_PIA6821_ADD("pia0", pia0_intf)
|
||||
MCFG_PIA6821_ADD("pia1", pia1_intf)
|
||||
MCFG_PIT8254_ADD( "pit", pit_intf)
|
||||
MCFG_I8275_ADD ( "crtc", XTAL_14_31818MHz/7, crtc_intf)
|
||||
MCFG_I8275_ADD("crtc", XTAL_14_31818MHz/7, 8, zorba_update_chr, DEVWRITELINE("dma", z80dma_device, rdy_w))
|
||||
MCFG_I8275_IRQ_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_IRQ0))
|
||||
MCFG_FD1793x_ADD("fdc", XTAL_24MHz / 24)
|
||||
MCFG_FLOPPY_DRIVE_ADD("fdc:0", zorba_floppies, "525dd", floppy_image_device::default_floppy_formats)
|
||||
MCFG_FLOPPY_DRIVE_ADD("fdc:1", zorba_floppies, "525dd", floppy_image_device::default_floppy_formats)
|
||||
|
@ -33,17 +33,6 @@ static I8275_DISPLAY_PIXELS( crtc_display_pixels )
|
||||
}
|
||||
}
|
||||
|
||||
static const i8275_interface crtc_intf =
|
||||
{
|
||||
8,
|
||||
0,
|
||||
DEVCB_DEVICE_LINE_MEMBER(I8237_TAG, am9517a_device, dreq0_w),
|
||||
DEVCB_NULL,
|
||||
DEVCB_NULL,
|
||||
DEVCB_NULL,
|
||||
crtc_display_pixels
|
||||
};
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// ADDRESS_MAP( mm1_upd7220_map )
|
||||
@ -133,6 +122,6 @@ MACHINE_CONFIG_FRAGMENT( mm1m6_video )
|
||||
|
||||
MCFG_GFXDECODE(mm1)
|
||||
|
||||
MCFG_I8275_ADD(I8275_TAG, XTAL_18_720MHz/8, crtc_intf)
|
||||
MCFG_I8275_ADD(I8275_TAG, XTAL_18_720MHz/8, 8, crtc_display_pixels, DEVWRITELINE(I8237_TAG, am9517a_device, dreq0_w))
|
||||
MCFG_UPD7220_ADD(UPD7220_TAG, XTAL_18_720MHz/8, hgdc_intf, mm1_upd7220_map)
|
||||
MACHINE_CONFIG_END
|
||||
|
Loading…
Reference in New Issue
Block a user