i8275x: Delegated. (nw)
This commit is contained in:
parent
364e86072d
commit
a204ff15d6
@ -93,7 +93,6 @@ i8275x_device::i8275x_device(const machine_config &mconfig, const char *tag, dev
|
||||
m_write_drq(*this),
|
||||
m_write_hrtc(*this),
|
||||
m_write_vrtc(*this),
|
||||
m_display_cb(NULL),
|
||||
m_status(0),
|
||||
m_param_idx(0),
|
||||
m_param_end(0),
|
||||
@ -124,6 +123,7 @@ void i8275x_device::device_start()
|
||||
m_screen->register_screen_bitmap(m_bitmap);
|
||||
|
||||
// resolve callbacks
|
||||
m_display_cb.bind_relative_to(*owner());
|
||||
m_write_drq.resolve_safe();
|
||||
m_write_irq.resolve_safe();
|
||||
m_write_hrtc.resolve_safe();
|
||||
@ -334,8 +334,8 @@ void i8275x_device::device_timer(emu_timer &timer, device_timer_id id, int param
|
||||
lc = (lc - 1) & 0x0f;
|
||||
}
|
||||
|
||||
if (m_display_cb)
|
||||
m_display_cb(this, m_bitmap,
|
||||
if (!m_display_cb.isnull())
|
||||
m_display_cb(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
|
||||
|
@ -45,11 +45,14 @@
|
||||
// INTERFACE CONFIGURATION MACROS
|
||||
//**************************************************************************
|
||||
|
||||
#define I8275_DRAW_CHARACTER_MEMBER(_name) void _name(bitmap_rgb32 &bitmap, int x, int y, UINT8 linecount, UINT8 charcode, UINT8 lineattr, UINT8 lten, UINT8 rvv, UINT8 vsp, UINT8 gpa, UINT8 hlgt)
|
||||
|
||||
|
||||
#define MCFG_I8275_CHARACTER_WIDTH(_value) \
|
||||
i8275x_device::static_set_character_width(*device, _value);
|
||||
|
||||
#define MCFG_I8275_DISPLAY_CALLBACK(_func) \
|
||||
i8275x_device::static_set_display_callback(*device, _func);
|
||||
#define MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(_class, _method) \
|
||||
i8275x_device::static_set_display_callback(*device, i8275_draw_character_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
|
||||
|
||||
#define MCFG_I8275_DRQ_CALLBACK(_write) \
|
||||
devcb = &i8275x_device::set_drq_wr_callback(*device, DEVCB2_##_write);
|
||||
@ -70,13 +73,7 @@
|
||||
// TYPE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
class i8275x_device;
|
||||
|
||||
|
||||
// ======================> i8275_display_pixels_func
|
||||
|
||||
typedef void (*i8275_display_pixels_func)(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);
|
||||
#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)
|
||||
typedef device_delegate<void (bitmap_rgb32 &bitmap, int x, int y, UINT8 linecount, UINT8 charcode, UINT8 lineattr, UINT8 lten, UINT8 rvv, UINT8 vsp, UINT8 gpa, UINT8 hlgt)> i8275_draw_character_delegate;
|
||||
|
||||
|
||||
// ======================> i8275x_device
|
||||
@ -89,7 +86,7 @@ public:
|
||||
i8275x_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
static void static_set_character_width(device_t &device, int value) { downcast<i8275x_device &>(device).m_hpixels_per_column = value; }
|
||||
static void static_set_display_callback(device_t &device, i8275_display_pixels_func func) { downcast<i8275x_device &>(device).m_display_cb = func; }
|
||||
static void static_set_display_callback(device_t &device, i8275_draw_character_delegate callback) { downcast<i8275x_device &>(device).m_display_cb = callback; }
|
||||
|
||||
template<class _Object> static devcb2_base &set_drq_wr_callback(device_t &device, _Object object) { return downcast<i8275x_device &>(device).m_write_drq.set_callback(object); }
|
||||
template<class _Object> static devcb2_base &set_irq_wr_callback(device_t &device, _Object object) { return downcast<i8275x_device &>(device).m_write_irq.set_callback(object); }
|
||||
@ -178,7 +175,7 @@ protected:
|
||||
devcb2_write_line m_write_hrtc;
|
||||
devcb2_write_line m_write_vrtc;
|
||||
|
||||
i8275_display_pixels_func m_display_cb;
|
||||
i8275_draw_character_delegate m_display_cb;
|
||||
int m_hpixels_per_column;
|
||||
|
||||
bitmap_rgb32 m_bitmap;
|
||||
|
@ -87,6 +87,7 @@ public:
|
||||
DECLARE_READ16_MEMBER(via_r);
|
||||
DECLARE_WRITE16_MEMBER(via_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(kb_data_ready);
|
||||
I8275_DRAW_CHARACTER_MEMBER(wicat_display_pixels);
|
||||
|
||||
required_shared_ptr<UINT8> m_vram;
|
||||
required_device<m68000_device> m_maincpu;
|
||||
@ -730,12 +731,10 @@ WRITE_LINE_MEMBER(wicat_state::crtc_cb)
|
||||
m_videocpu->set_input_line(INPUT_LINE_IRQ0,m_crtc_irq);
|
||||
}
|
||||
|
||||
I8275_DISPLAY_PIXELS(wicat_display_pixels)
|
||||
I8275_DRAW_CHARACTER_MEMBER(wicat_state::wicat_display_pixels)
|
||||
{
|
||||
wicat_state *state = device->machine().driver_data<wicat_state>();
|
||||
|
||||
UINT8 romdata = state->m_chargen->base()[((charcode << 4) | linecount) + 1];
|
||||
const pen_t *pen = state->m_palette->pens();
|
||||
UINT8 romdata = m_chargen->base()[((charcode << 4) | linecount) + 1];
|
||||
const pen_t *pen = m_palette->pens();
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
@ -889,7 +888,7 @@ static MACHINE_CONFIG_START( wicat, wicat_state )
|
||||
|
||||
MCFG_DEVICE_ADD("video", I8275x, XTAL_19_6608MHz/8)
|
||||
MCFG_I8275_CHARACTER_WIDTH(9)
|
||||
MCFG_I8275_DISPLAY_CALLBACK(wicat_display_pixels)
|
||||
MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(wicat_state, wicat_display_pixels)
|
||||
MCFG_I8275_DRQ_CALLBACK(DEVWRITELINE("videodma",am9517a_device, dreq0_w))
|
||||
MCFG_I8275_IRQ_CALLBACK(WRITELINE(wicat_state,crtc_cb))
|
||||
MCFG_VIDEO_SET_SCREEN("screen")
|
||||
|
@ -82,6 +82,8 @@ public:
|
||||
DECLARE_WRITE8_MEMBER(pia0_porta_w);
|
||||
DECLARE_WRITE8_MEMBER(kbd_put);
|
||||
DECLARE_READ8_MEMBER(keyboard_r);
|
||||
I8275_DRAW_CHARACTER_MEMBER( zorba_update_chr );
|
||||
|
||||
private:
|
||||
UINT8 m_term_data;
|
||||
required_device<cpu_device> m_maincpu;
|
||||
@ -258,12 +260,11 @@ PALETTE_INIT_MEMBER( zorba_state, zorba )
|
||||
palette.set_pen_color(2, 0, 128, 0 ); /* Dimmed */
|
||||
}
|
||||
|
||||
static I8275_DISPLAY_PIXELS( zorba_update_chr )
|
||||
I8275_DRAW_CHARACTER_MEMBER( zorba_state::zorba_update_chr )
|
||||
{
|
||||
int i;
|
||||
zorba_state *state = device->machine().driver_data<zorba_state>();
|
||||
const rgb_t *palette = state->m_palette->palette()->entry_list_raw();
|
||||
UINT8 gfx = state->m_p_chargen[(linecount & 15) + (charcode << 4)];
|
||||
const rgb_t *palette = m_palette->palette()->entry_list_raw();
|
||||
UINT8 gfx = m_p_chargen[(linecount & 15) + (charcode << 4)];
|
||||
|
||||
if (vsp)
|
||||
gfx = 0;
|
||||
@ -396,7 +397,7 @@ static MACHINE_CONFIG_START( zorba, zorba_state )
|
||||
|
||||
MCFG_DEVICE_ADD("crtc", I8275x, XTAL_14_31818MHz/7)
|
||||
MCFG_I8275_CHARACTER_WIDTH(8)
|
||||
MCFG_I8275_DISPLAY_CALLBACK(zorba_update_chr)
|
||||
MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(zorba_state, zorba_update_chr)
|
||||
MCFG_I8275_DRQ_CALLBACK(DEVWRITELINE("dma", z80dma_device, rdy_w))
|
||||
MCFG_I8275_IRQ_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_IRQ0))
|
||||
MCFG_FD1793x_ADD("fdc", XTAL_24MHz / 24)
|
||||
|
@ -125,6 +125,7 @@ public:
|
||||
int m_fdc_tc;
|
||||
|
||||
DECLARE_FLOPPY_FORMATS( floppy_formats );
|
||||
I8275_DRAW_CHARACTER_MEMBER( crtc_display_pixels );
|
||||
UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels );
|
||||
};
|
||||
|
||||
|
@ -8,16 +8,14 @@
|
||||
// i8275_interface crtc_intf
|
||||
//-------------------------------------------------
|
||||
|
||||
static I8275_DISPLAY_PIXELS( crtc_display_pixels )
|
||||
I8275_DRAW_CHARACTER_MEMBER( mm1_state::crtc_display_pixels )
|
||||
{
|
||||
mm1_state *state = device->machine().driver_data<mm1_state>();
|
||||
|
||||
UINT8 romdata = state->m_char_rom->base()[(charcode << 4) | linecount];
|
||||
UINT8 romdata = m_char_rom->base()[(charcode << 4) | linecount];
|
||||
|
||||
int d0 = BIT(romdata, 0);
|
||||
int d7 = BIT(romdata, 7);
|
||||
int gpa0 = BIT(gpa, 0);
|
||||
int llen = state->m_llen;
|
||||
int llen = m_llen;
|
||||
int i;
|
||||
|
||||
UINT8 data = (romdata << 1) | (d7 & d0);
|
||||
@ -31,7 +29,7 @@ static I8275_DISPLAY_PIXELS( crtc_display_pixels )
|
||||
|
||||
int color = hlt_in ? 2 : (video_in ^ compl_in);
|
||||
|
||||
bitmap.pix32(y, x + i) = state->m_palette->pen(color);
|
||||
bitmap.pix32(y, x + i) = m_palette->pen(color);
|
||||
}
|
||||
}
|
||||
|
||||
@ -116,7 +114,7 @@ MACHINE_CONFIG_FRAGMENT( mm1m6_video )
|
||||
|
||||
MCFG_DEVICE_ADD(I8275_TAG, I8275x, XTAL_18_720MHz/8)
|
||||
MCFG_I8275_CHARACTER_WIDTH(8)
|
||||
MCFG_I8275_DISPLAY_CALLBACK(crtc_display_pixels)
|
||||
MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(mm1_state, crtc_display_pixels)
|
||||
MCFG_I8275_DRQ_CALLBACK(DEVWRITELINE(I8237_TAG, am9517a_device, dreq0_w))
|
||||
MCFG_I8275_VRTC_CALLBACK(DEVWRITELINE(UPD7220_TAG, upd7220_device, ext_sync_w))
|
||||
MCFG_VIDEO_SET_SCREEN(SCREEN_TAG)
|
||||
|
Loading…
Reference in New Issue
Block a user