Previous 199869 Revisions Next

r29245 Friday 4th April, 2014 at 07:50:57 UTC by Curt Coder
i8275x: Delegated. (nw)
[src/emu/video]i8275x.c i8275x.h
[src/mess/drivers]wicat.c zorba.c
[src/mess/includes]mikromik.h
[src/mess/video]mikromik.c

trunk/src/emu/video/i8275x.c
r29244r29245
9393   m_write_drq(*this),
9494   m_write_hrtc(*this),
9595   m_write_vrtc(*this),
96   m_display_cb(NULL),
9796   m_status(0),
9897   m_param_idx(0),
9998   m_param_end(0),
r29244r29245
124123   m_screen->register_screen_bitmap(m_bitmap);
125124
126125   // resolve callbacks
126   m_display_cb.bind_relative_to(*owner());
127127   m_write_drq.resolve_safe();
128128   m_write_irq.resolve_safe();
129129   m_write_hrtc.resolve_safe();
r29244r29245
334334               lc = (lc - 1) & 0x0f;
335335            }
336336
337            if (m_display_cb)
338            m_display_cb(this, m_bitmap,
337            if (!m_display_cb.isnull())
338            m_display_cb(m_bitmap,
339339               sx * m_hpixels_per_column, // x position on screen of starting point
340340               m_scanline, // y position on screen
341341               lc, // current line of char
trunk/src/emu/video/i8275x.h
r29244r29245
4545//  INTERFACE CONFIGURATION MACROS
4646//**************************************************************************
4747
48#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)
49
50
4851#define MCFG_I8275_CHARACTER_WIDTH(_value) \
4952   i8275x_device::static_set_character_width(*device, _value);
5053
51#define MCFG_I8275_DISPLAY_CALLBACK(_func) \
52   i8275x_device::static_set_display_callback(*device, _func);
54#define MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(_class, _method) \
55   i8275x_device::static_set_display_callback(*device, i8275_draw_character_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
5356
5457#define MCFG_I8275_DRQ_CALLBACK(_write) \
5558   devcb = &i8275x_device::set_drq_wr_callback(*device, DEVCB2_##_write);
r29244r29245
7073//  TYPE DEFINITIONS
7174//**************************************************************************
7275
73class i8275x_device;
76typedef 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;
7477
7578
76// ======================> i8275_display_pixels_func
77
78typedef 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);
79#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)
80
81
8279// ======================> i8275x_device
8380
8481class i8275x_device :   public device_t,
r29244r29245
8986   i8275x_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
9087
9188   static void static_set_character_width(device_t &device, int value) { downcast<i8275x_device &>(device).m_hpixels_per_column = value; }
92   static void static_set_display_callback(device_t &device, i8275_display_pixels_func func) { downcast<i8275x_device &>(device).m_display_cb = func; }
89   static void static_set_display_callback(device_t &device, i8275_draw_character_delegate callback) { downcast<i8275x_device &>(device).m_display_cb = callback; }
9390
9491   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); }
9592   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); }
r29244r29245
178175   devcb2_write_line   m_write_hrtc;
179176   devcb2_write_line   m_write_vrtc;
180177
181   i8275_display_pixels_func m_display_cb;
178   i8275_draw_character_delegate m_display_cb;
182179   int m_hpixels_per_column;
183180
184181   bitmap_rgb32 m_bitmap;
trunk/src/mess/includes/mikromik.h
r29244r29245
125125   int m_fdc_tc;
126126
127127   DECLARE_FLOPPY_FORMATS( floppy_formats );
128   I8275_DRAW_CHARACTER_MEMBER( crtc_display_pixels );
128129   UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels );
129130};
130131
trunk/src/mess/video/mikromik.c
r29244r29245
88//  i8275_interface crtc_intf
99//-------------------------------------------------
1010
11static I8275_DISPLAY_PIXELS( crtc_display_pixels )
11I8275_DRAW_CHARACTER_MEMBER( mm1_state::crtc_display_pixels )
1212{
13   mm1_state *state = device->machine().driver_data<mm1_state>();
13   UINT8 romdata = m_char_rom->base()[(charcode << 4) | linecount];
1414
15   UINT8 romdata = state->m_char_rom->base()[(charcode << 4) | linecount];
16
1715   int d0 = BIT(romdata, 0);
1816   int d7 = BIT(romdata, 7);
1917   int gpa0 = BIT(gpa, 0);
20   int llen = state->m_llen;
18   int llen = m_llen;
2119   int i;
2220
2321   UINT8 data = (romdata << 1) | (d7 & d0);
r29244r29245
3129
3230      int color = hlt_in ? 2 : (video_in ^ compl_in);
3331
34      bitmap.pix32(y, x + i) = state->m_palette->pen(color);
32      bitmap.pix32(y, x + i) = m_palette->pen(color);
3533   }
3634}
3735
r29244r29245
116114
117115   MCFG_DEVICE_ADD(I8275_TAG, I8275x, XTAL_18_720MHz/8)
118116   MCFG_I8275_CHARACTER_WIDTH(8)
119   MCFG_I8275_DISPLAY_CALLBACK(crtc_display_pixels)
117   MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(mm1_state, crtc_display_pixels)
120118   MCFG_I8275_DRQ_CALLBACK(DEVWRITELINE(I8237_TAG, am9517a_device, dreq0_w))
121119   MCFG_I8275_VRTC_CALLBACK(DEVWRITELINE(UPD7220_TAG, upd7220_device, ext_sync_w))
122120   MCFG_VIDEO_SET_SCREEN(SCREEN_TAG)
trunk/src/mess/drivers/wicat.c
r29244r29245
8787   DECLARE_READ16_MEMBER(via_r);
8888   DECLARE_WRITE16_MEMBER(via_w);
8989   DECLARE_WRITE_LINE_MEMBER(kb_data_ready);
90   I8275_DRAW_CHARACTER_MEMBER(wicat_display_pixels);
9091
9192   required_shared_ptr<UINT8> m_vram;
9293   required_device<m68000_device> m_maincpu;
r29244r29245
730731   m_videocpu->set_input_line(INPUT_LINE_IRQ0,m_crtc_irq);
731732}
732733
733I8275_DISPLAY_PIXELS(wicat_display_pixels)
734I8275_DRAW_CHARACTER_MEMBER(wicat_state::wicat_display_pixels)
734735{
735   wicat_state *state = device->machine().driver_data<wicat_state>();
736   UINT8 romdata = m_chargen->base()[((charcode << 4) | linecount) + 1];
737   const pen_t *pen = m_palette->pens();
736738
737   UINT8 romdata = state->m_chargen->base()[((charcode << 4) | linecount) + 1];
738   const pen_t *pen = state->m_palette->pens();
739
740739   for (int i = 0; i < 8; i++)
741740   {
742741      int color = (romdata >> (7-i)) & 0x01;
r29244r29245
889888
890889   MCFG_DEVICE_ADD("video", I8275x, XTAL_19_6608MHz/8)
891890   MCFG_I8275_CHARACTER_WIDTH(9)
892   MCFG_I8275_DISPLAY_CALLBACK(wicat_display_pixels)
891   MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(wicat_state, wicat_display_pixels)
893892   MCFG_I8275_DRQ_CALLBACK(DEVWRITELINE("videodma",am9517a_device, dreq0_w))
894893   MCFG_I8275_IRQ_CALLBACK(WRITELINE(wicat_state,crtc_cb))
895894   MCFG_VIDEO_SET_SCREEN("screen")
trunk/src/mess/drivers/zorba.c
r29244r29245
8282   DECLARE_WRITE8_MEMBER(pia0_porta_w);
8383   DECLARE_WRITE8_MEMBER(kbd_put);
8484   DECLARE_READ8_MEMBER(keyboard_r);
85   I8275_DRAW_CHARACTER_MEMBER( zorba_update_chr );
86
8587private:
8688   UINT8 m_term_data;
8789   required_device<cpu_device> m_maincpu;
r29244r29245
258260   palette.set_pen_color(2, 0, 128, 0 );   /* Dimmed */
259261}
260262
261static I8275_DISPLAY_PIXELS( zorba_update_chr )
263I8275_DRAW_CHARACTER_MEMBER( zorba_state::zorba_update_chr )
262264{
263265   int i;
264   zorba_state *state = device->machine().driver_data<zorba_state>();
265   const rgb_t *palette = state->m_palette->palette()->entry_list_raw();
266   UINT8 gfx = state->m_p_chargen[(linecount & 15) + (charcode << 4)];
266   const rgb_t *palette = m_palette->palette()->entry_list_raw();
267   UINT8 gfx = m_p_chargen[(linecount & 15) + (charcode << 4)];
267268
268269   if (vsp)
269270      gfx = 0;
r29244r29245
396397
397398   MCFG_DEVICE_ADD("crtc", I8275x, XTAL_14_31818MHz/7)
398399   MCFG_I8275_CHARACTER_WIDTH(8)
399   MCFG_I8275_DISPLAY_CALLBACK(zorba_update_chr)
400   MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(zorba_state, zorba_update_chr)
400401   MCFG_I8275_DRQ_CALLBACK(DEVWRITELINE("dma", z80dma_device, rdy_w))
401402   MCFG_I8275_IRQ_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_IRQ0))
402403   MCFG_FD1793x_ADD("fdc", XTAL_24MHz / 24)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team