Previous 199869 Revisions Next

r29183 Wednesday 2nd April, 2014 at 13:17:56 UTC by Curt Coder
upd7220: devcb2 and delegates. (nw)
[src/emu/bus/wangpc]tig.c tig.h
[src/emu/video]upd7220.c upd7220.h
[src/mess/drivers]a5105.c apc.c compis.c dmv.c if800.c mz3500.c mz6500.c pc9801.c qx10.c vt240.c
[src/mess/includes]compis.h mikromik.h
[src/mess/video]mikromik.c

trunk/src/emu/video/upd7220.c
r29182r29183
182182}
183183
184184
185//-------------------------------------------------
186//  device_config_complete - perform any
187//  operations now that the configuration is
188//  complete
189//-------------------------------------------------
190185
191void upd7220_device::device_config_complete()
192{
193   // inherit a copy of the static data
194   const upd7220_interface *intf = reinterpret_cast<const upd7220_interface *>(static_config());
195   if (intf != NULL)
196      *static_cast<upd7220_interface *>(this) = *intf;
197
198   // or initialize to defaults if none provided
199   else
200   {
201      memset(&m_out_drq_cb, 0, sizeof(m_out_drq_cb));
202      memset(&m_out_hsync_cb, 0, sizeof(m_out_hsync_cb));
203      memset(&m_out_vsync_cb, 0, sizeof(m_out_vsync_cb));
204      memset(&m_out_blank_cb, 0, sizeof(m_out_blank_cb));
205   }
206}
207
208
209
210186//**************************************************************************
211187//  INLINE HELPERS
212188//**************************************************************************
r29182r29183
681657//  upd7220_device - constructor
682658//-------------------------------------------------
683659
684upd7220_device::upd7220_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
685   : device_t(mconfig, UPD7220, "uPD7220", tag, owner, clock, "upd7220", __FILE__),
686      device_memory_interface(mconfig, *this),
687      device_video_interface(mconfig, *this),
688      m_mask(0),
689      m_pitch(0),
690      m_ead(0),
691      m_dad(0),
692      m_lad(0),
693      m_ra_addr(0),
694      m_sr(UPD7220_SR_FIFO_EMPTY),
695      m_cr(0),
696      m_param_ptr(0),
697      m_fifo_ptr(-1),
698      m_fifo_dir(0),
699      m_mode(0),
700      m_draw_mode(0),
701      m_de(0),
702      m_m(0),
703      m_aw(0),
704      m_al(0),
705      m_vs(0),
706      m_vfp(0),
707      m_vbp(0),
708      m_hs(0),
709      m_hfp(0),
710      m_hbp(0),
711      m_dc(0),
712      m_sc(0),
713      m_br(0),
714      m_ctop(0),
715      m_cbot(0),
716      m_lr(0),
717      m_disp(0),
718      m_gchr(0),
719      m_bitmap_mod(0),
720      m_space_config("videoram", ENDIANNESS_LITTLE, 8, 18, 0, NULL, *ADDRESS_MAP_NAME(upd7220_vram))
660upd7220_device::upd7220_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
661   device_t(mconfig, UPD7220, "uPD7220", tag, owner, clock, "upd7220", __FILE__),
662   device_memory_interface(mconfig, *this),
663   device_video_interface(mconfig, *this),
664   m_write_drq(*this),
665   m_write_hsync(*this),
666   m_write_vsync(*this),
667   m_write_blank(*this),
668   m_mask(0),
669   m_pitch(0),
670   m_ead(0),
671   m_dad(0),
672   m_lad(0),
673   m_ra_addr(0),
674   m_sr(UPD7220_SR_FIFO_EMPTY),
675   m_cr(0),
676   m_param_ptr(0),
677   m_fifo_ptr(-1),
678   m_fifo_dir(0),
679   m_mode(0),
680   m_draw_mode(0),
681   m_de(0),
682   m_m(0),
683   m_aw(0),
684   m_al(0),
685   m_vs(0),
686   m_vfp(0),
687   m_vbp(0),
688   m_hs(0),
689   m_hfp(0),
690   m_hbp(0),
691   m_dc(0),
692   m_sc(0),
693   m_br(0),
694   m_ctop(0),
695   m_cbot(0),
696   m_lr(0),
697   m_disp(0),
698   m_gchr(0),
699   m_bitmap_mod(0),
700   m_space_config("videoram", ENDIANNESS_LITTLE, 8, 18, 0, NULL, *ADDRESS_MAP_NAME(upd7220_vram))
721701{
722702   for (int i = 0; i < 16; i++)
723703   {
r29182r29183
748728
749729void upd7220_device::device_start()
750730{
731   // resolve callbacks
732   m_display_cb.bind_relative_to(*owner());
733   m_draw_text_cb.bind_relative_to(*owner());
734
735   m_write_drq.resolve_safe();
736   m_write_hsync.resolve_safe();
737   m_write_vsync.resolve_safe();
738   m_write_blank.resolve_safe();
739
751740   // allocate timers
752741   m_vsync_timer = timer_alloc(TIMER_VSYNC);
753742   m_hsync_timer = timer_alloc(TIMER_HSYNC);
754743   m_blank_timer = timer_alloc(TIMER_BLANK);
755744
756   // resolve callbacks
757   m_out_drq_func.resolve(m_out_drq_cb, *this);
758   m_out_hsync_func.resolve(m_out_hsync_cb, *this);
759   m_out_vsync_func.resolve(m_out_vsync_cb, *this);
760   m_out_blank_func.resolve(m_out_blank_cb, *this);
761
762745   // register for state saving
763746   save_item(NAME(m_ra));
764747   save_item(NAME(m_sr));
r29182r29183
795778
796779void upd7220_device::device_reset()
797780{
798   m_out_drq_func(CLEAR_LINE);
781   m_write_drq(CLEAR_LINE);
799782}
800783
801784
r29182r29183
817800         m_sr &= ~UPD7220_SR_HBLANK_ACTIVE;
818801      }
819802
820      m_out_hsync_func(param);
803      m_write_hsync(param);
821804
822805      update_hsync_timer(param);
823806      break;
r29182r29183
832815         m_sr &= ~UPD7220_SR_VSYNC_ACTIVE;
833816      }
834817
835      m_out_vsync_func(param);
818      m_write_vsync(param);
836819
837820      update_vsync_timer(param);
838821      break;
r29182r29183
847830         m_sr &= ~UPD7220_SR_HBLANK_ACTIVE;
848831      }
849832
850      m_out_blank_func(param);
833      m_write_blank(param);
851834
852835      update_blank_timer(param);
853836      break;
r29182r29183
15561539      {
15571540         addr = sad + (y * m_pitch);
15581541
1559         if (m_draw_text_cb)
1560            m_draw_text_cb(this, bitmap, addr, y, wd, m_pitch, m_lr, m_dc, m_ead);
1542         if (!m_draw_text_cb.isnull())
1543            m_draw_text_cb(bitmap, addr, y, wd, m_pitch, m_lr, m_dc, m_ead);
15611544      }
15621545
15631546      sy = y + 1;
r29182r29183
15761559   for (sx = 0; sx < 80; sx++)
15771560   {
15781561      if((sx << 3) < m_aw * 16 && y < m_al)
1579         m_display_cb(this, bitmap, y, sx << 3, addr);
1562         m_display_cb(bitmap, y, sx << 3, addr);
15801563
15811564      addr+= wd + 1;
15821565   }
r29182r29183
16131596                     Dragon Buster (PC-98xx) contradicts with Xevious with regards of the pitch tho ... */
16141597            addr = ((sad << 1) & 0x3ffff) + (y * m_pitch * 2);
16151598
1616            if (m_display_cb)
1599            if (!m_display_cb.isnull())
16171600               draw_graphics_line(bitmap, addr, y + bsy/((m_pitch == 40)+1), wd);
16181601         }
16191602      }
r29182r29183
16271610            {
16281611               addr = (sad & 0x3ffff) + ((y / m_lr) * m_pitch);
16291612
1630               if (m_draw_text_cb)
1631                  m_draw_text_cb(this, bitmap, addr, (y + tsy) / m_lr, wd, m_pitch, m_lr, m_dc, m_ead);
1613               if (!m_draw_text_cb.isnull())
1614                  m_draw_text_cb(bitmap, addr, (y + tsy) / m_lr, wd, m_pitch, m_lr, m_dc, m_ead);
16321615            }
16331616         }
16341617      }
trunk/src/emu/video/upd7220.h
r29182r29183
4040
4141
4242//**************************************************************************
43//  MACROS / CONSTANTS
43//  INTERFACE CONFIGURATION MACROS
4444//**************************************************************************
4545
46#define UPD7220_DISPLAY_PIXELS_MEMBER(_name) void _name(bitmap_rgb32 &bitmap, int y, int x, UINT32 address)
47#define UPD7220_DRAW_TEXT_LINE_MEMBER(_name) void _name(bitmap_rgb32 &bitmap, UINT32 addr, int y, int wd, int pitch, int lr, int cursor_on, int cursor_addr)
4648
4749
50#define MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(_class, _method) \
51   upd7220_device::static_set_display_pixels_callback(*device, upd7220_display_pixels_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
4852
49//**************************************************************************
50//  INTERFACE CONFIGURATION MACROS
51//**************************************************************************
53#define MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(_class, _method) \
54   upd7220_device::static_set_draw_text_callback(*device, upd7220_draw_text_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
5255
53#define MCFG_UPD7220_ADD(_tag, _clock, _config, _map) \
54   MCFG_DEVICE_ADD(_tag, UPD7220, _clock) \
55   MCFG_DEVICE_CONFIG(_config) \
56   MCFG_DEVICE_ADDRESS_MAP(AS_0, _map)
56#define MCFG_UPD7220_DRQ_CALLBACK(_write) \
57   devcb = &upd7220_device::set_drq_wr_callback(*device, DEVCB2_##_write);
5758
58#define UPD7220_INTERFACE(name) \
59   const upd7220_interface (name) =
59#define MCFG_UPD7220_HSYNC_CALLBACK(_write) \
60   devcb = &upd7220_device::set_hsync_wr_callback(*device, DEVCB2_##_write);
6061
62#define MCFG_UPD7220_VSYNC_CALLBACK(_write) \
63   devcb = &upd7220_device::set_vsync_wr_callback(*device, DEVCB2_##_write);
6164
65#define MCFG_UPD7220_BLANK_CALLBACK(_write) \
66   devcb = &upd7220_device::set_blank_wr_callback(*device, DEVCB2_##_write);
6267
68
69
6370//**************************************************************************
6471//  TYPE DEFINITIONS
6572//**************************************************************************
6673
67typedef void (*upd7220_display_pixels_func)(device_t *device, bitmap_rgb32 &bitmap, int y, int x, UINT32 address);
68#define UPD7220_DISPLAY_PIXELS(name) void name(device_t *device, bitmap_rgb32 &bitmap, int y, int x, UINT32 address)
74typedef device_delegate<void (bitmap_rgb32 &bitmap, int y, int x, UINT32 address)> upd7220_display_pixels_delegate;
75typedef device_delegate<void (bitmap_rgb32 &bitmap, UINT32 addr, int y, int wd, int pitch, int lr, int cursor_on, int cursor_addr)> upd7220_draw_text_delegate;
6976
70typedef void (*upd7220_draw_text_line)(device_t *device, bitmap_rgb32 &bitmap, UINT32 addr, int y, int wd, int pitch, int lr, int cursor_on, int cursor_addr);
71#define UPD7220_DRAW_TEXT_LINE(name) void name(device_t *device, bitmap_rgb32 &bitmap, UINT32 addr, int y, int wd, int pitch, int lr, int cursor_on, int cursor_addr)
7277
73
74// ======================> upd7220_interface
75
76struct upd7220_interface
77{
78   upd7220_display_pixels_func m_display_cb;
79   upd7220_draw_text_line m_draw_text_cb;
80
81   devcb_write_line        m_out_drq_cb;
82   devcb_write_line        m_out_hsync_cb;
83   devcb_write_line        m_out_vsync_cb;
84   devcb_write_line        m_out_blank_cb;
85};
86
8778// ======================> upd7220_device
8879
8980class upd7220_device :  public device_t,
9081                  public device_memory_interface,
91                  public device_video_interface,
92                  public upd7220_interface
82                  public device_video_interface
9383{
9484public:
9585   // construction/destruction
9686   upd7220_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
9787
88   static void static_set_display_pixels_callback(device_t &device, upd7220_display_pixels_delegate callback) { downcast<upd7220_device &>(device).m_display_cb = callback; }
89   static void static_set_draw_text_callback(device_t &device, upd7220_draw_text_delegate callback) { downcast<upd7220_device &>(device).m_draw_text_cb = callback; }
90
91   template<class _Object> static devcb2_base &set_drq_wr_callback(device_t &device, _Object object) { return downcast<upd7220_device &>(device).m_write_drq.set_callback(object); }
92   template<class _Object> static devcb2_base &set_hsync_wr_callback(device_t &device, _Object object) { return downcast<upd7220_device &>(device).m_write_hsync.set_callback(object); }
93   template<class _Object> static devcb2_base &set_vsync_wr_callback(device_t &device, _Object object) { return downcast<upd7220_device &>(device).m_write_vsync.set_callback(object); }
94   template<class _Object> static devcb2_base &set_blank_wr_callback(device_t &device, _Object object) { return downcast<upd7220_device &>(device).m_write_blank.set_callback(object); }
95
9896   DECLARE_READ8_MEMBER( read );
9997   DECLARE_WRITE8_MEMBER( write );
10098
r29182r29183
117115   virtual void device_start();
118116   virtual void device_reset();
119117   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
120   virtual void device_config_complete();
121118
122119private:
123   static const device_timer_id TIMER_VSYNC = 0;
124   static const device_timer_id TIMER_HSYNC = 1;
125   static const device_timer_id TIMER_BLANK = 2;
120   enum
121   {
122      TIMER_VSYNC,
123      TIMER_HSYNC,
124      TIMER_BLANK
125   };
126126
127127   inline UINT8 readbyte(offs_t address);
128128   inline void writebyte(offs_t address, UINT8 data);
r29182r29183
153153   void draw_graphics_line(bitmap_rgb32 &bitmap, UINT32 addr, int y, int wd);
154154   void update_graphics(bitmap_rgb32 &bitmap, const rectangle &cliprect, int force_bitmap);
155155
156   devcb_resolved_write_line   m_out_drq_func;
157   devcb_resolved_write_line   m_out_hsync_func;
158   devcb_resolved_write_line   m_out_vsync_func;
159   devcb_resolved_write_line   m_out_blank_func;
156   upd7220_display_pixels_delegate      m_display_cb;
157   upd7220_draw_text_delegate         m_draw_text_cb;
160158
159   devcb2_write_line   m_write_drq;
160   devcb2_write_line   m_write_hsync;
161   devcb2_write_line   m_write_vsync;
162   devcb2_write_line   m_write_blank;
163
161164   UINT16 m_mask;                  // mask register
162165   UINT8 m_pitch;                  // number of word addresses in display memory in the horizontal direction
163166   UINT32 m_ead;                   // execute word address
trunk/src/emu/bus/wangpc/tig.c
r29182r29183
8989   AM_RANGE(0x4000, 0x7fff) AM_RAM // font memory
9090ADDRESS_MAP_END
9191
92static UPD7220_DRAW_TEXT_LINE( hgdc_display_text)
92UPD7220_DRAW_TEXT_LINE_MEMBER( wangpc_tig_device::hgdc_draw_text )
9393{
9494}
9595
96static UPD7220_INTERFACE( hgdc0_intf )
97{
98   NULL,
99   hgdc_display_text,
100   DEVCB_NULL,
101   DEVCB_NULL,
102   DEVCB_NULL
103};
10496
105
10697//-------------------------------------------------
10798//  UPD7220_INTERFACE( hgdc1_intf )
10899//-------------------------------------------------
r29182r29183
112103   AM_RANGE(0x0000, 0xffff) AM_RAM // graphics memory
113104ADDRESS_MAP_END
114105
115static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels )
106UPD7220_DISPLAY_PIXELS_MEMBER( wangpc_tig_device::hgdc_display_pixels )
116107{
117108}
118109
119static UPD7220_INTERFACE( hgdc1_intf )
120{
121   hgdc_display_pixels,
122   NULL,
123   DEVCB_NULL,
124   DEVCB_NULL,
125   DEVCB_NULL
126};
127110
128
129111//-------------------------------------------------
130112//  MACHINE_CONFIG_FRAGMENT( wangpc_tig )
131113//-------------------------------------------------
r29182r29183
140122
141123   MCFG_PALETTE_ADD_MONOCHROME_GREEN_HIGHLIGHT("palette")
142124
143   MCFG_UPD7220_ADD(UPD7720_0_TAG, XTAL_52_832MHz/28, hgdc0_intf, upd7220_0_map) // was /10?
125   MCFG_DEVICE_ADD(UPD7720_0_TAG, UPD7220, XTAL_52_832MHz/28)
126   MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_0_map)
127   MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(wangpc_tig_device, hgdc_draw_text)   
144128   MCFG_VIDEO_SET_SCREEN(SCREEN_TAG)
145   MCFG_UPD7220_ADD(UPD7720_1_TAG, XTAL_52_832MHz/28, hgdc1_intf, upd7220_1_map) // was /16?
129
130   MCFG_DEVICE_ADD(UPD7720_1_TAG, UPD7220, XTAL_52_832MHz/28)
131   MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_1_map)
132   MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(wangpc_tig_device, hgdc_display_pixels)   
146133   MCFG_VIDEO_SET_SCREEN(SCREEN_TAG)
147134MACHINE_CONFIG_END
148135
trunk/src/emu/bus/wangpc/tig.h
r29182r29183
3838   virtual machine_config_constructor device_mconfig_additions() const;
3939   UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
4040
41   UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text );
42   UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels );
43
4144protected:
4245   // device-level overrides
4346   virtual void device_start();
trunk/src/mess/drivers/compis.c
r29182r29183
453453//  UPD7220_INTERFACE( hgdc_intf )
454454//-------------------------------------------------
455455
456static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels )
456UPD7220_DISPLAY_PIXELS_MEMBER( compis_state::hgdc_display_pixels )
457457{
458   compis_state *state = device->machine().driver_data<compis_state>();
459   UINT8 i,gfx = state->m_video_ram[address];
460   const pen_t *pen = state->m_palette->pens();
458   UINT8 i,gfx = m_video_ram[address];
459   const pen_t *pen = m_palette->pens();
461460
462461   for(i=0; i<8; i++)
463462      bitmap.pix32(y, x + i) = pen[BIT(gfx, i)];
464463}
465464
466static UPD7220_INTERFACE( hgdc_intf )
467{
468   hgdc_display_pixels,
469   NULL,
470   DEVCB_NULL,
471   DEVCB_NULL,
472   DEVCB_NULL
473};
474465
475
476466//-------------------------------------------------
477467//  I80186_INTERFACE( cpu_intf )
478468//-------------------------------------------------
r29182r29183
722712   MCFG_SCREEN_SIZE(640, 400)
723713   MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 400-1)
724714   MCFG_SCREEN_UPDATE_DEVICE("upd7220", upd7220_device, screen_update)
725   MCFG_UPD7220_ADD("upd7220", XTAL_4_433619MHz/2, hgdc_intf, upd7220_map) //unknown clock
715   
716   MCFG_DEVICE_ADD("upd7220", UPD7220, XTAL_4_433619MHz/2) // unknown clock
717   MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_map)
718   MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(compis_state, hgdc_display_pixels)   
726719   MCFG_VIDEO_SET_SCREEN(SCREEN_TAG)
720   
727721   MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette")
728722
729723   // devices
trunk/src/mess/drivers/mz3500.c
r29182r29183
9797   // screen updates
9898   UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
9999   DECLARE_PALETTE_INIT(mz3500);
100   UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels );
101   UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text );
102
100103protected:
101104   // driver_device overrides
102105   virtual void machine_start();
r29182r29183
137140(mirror of [5]?)
138141*/
139142
140static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels )
143UPD7220_DISPLAY_PIXELS_MEMBER( mz3500_state::hgdc_display_pixels )
141144{
142145   // ...
143146}
144147
145static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
148UPD7220_DRAW_TEXT_LINE_MEMBER( mz3500_state::hgdc_draw_text )
146149{
147   mz3500_state *state = device->machine().driver_data<mz3500_state>();
148   const rgb_t *palette = state->m_palette->palette()->entry_list_raw();
150   const rgb_t *palette = m_palette->palette()->entry_list_raw();
149151   int x;
150152   int xi,yi;
151153   int tile;
r29182r29183
156158   UINT8 hires;
157159   UINT8 color_mode;
158160
159//  popmessage("%02x",state->m_crtc[6]);
161//  popmessage("%02x",m_crtc[6]);
160162
161   color_mode = state->m_crtc[4] & 1;
162   width80 = (state->m_crtc[5] & 2) >> 1;
163   hires = (state->m_crtc[6] & 1);
163   color_mode = m_crtc[4] & 1;
164   width80 = (m_crtc[5] & 2) >> 1;
165   hires = (m_crtc[6] & 1);
164166   char_size = (hires) ? 16 : 8;
165167
166168   for( x = 0; x < pitch; x++ )
167169   {
168      tile = (state->m_video_ram[((addr+x)*2) & 0x1fff] & 0xff);
169      attr = (state->m_video_ram[((addr+x)*2+1) & 0x3ffff] & 0x0f);
170      tile = (m_video_ram[((addr+x)*2) & 0x1fff] & 0xff);
171      attr = (m_video_ram[((addr+x)*2+1) & 0x3ffff] & 0x0f);
170172
171173      //if(hires)
172174      //  tile <<= 1;
173175
174176      for( yi = 0; yi < lr; yi++)
175177      {
176         tile_data = state->m_char_rom[((tile*16+yi) & 0xfff) | (hires*0x1000)];
178         tile_data = m_char_rom[((tile*16+yi) & 0xfff) | (hires*0x1000)];
177179
178180         for( xi = 0; xi < 8; xi++)
179181         {
r29182r29183
234236   return 0;
235237}
236238
237
238
239static UPD7220_INTERFACE( hgdc_1_intf )
240{
241   NULL,
242   hgdc_draw_text,
243   DEVCB_NULL,
244   DEVCB_DEVICE_LINE_MEMBER("upd7220_gfx", upd7220_device, ext_sync_w),
245   DEVCB_NULL
246};
247
248static UPD7220_INTERFACE( hgdc_2_intf )
249{
250   hgdc_display_pixels,
251   NULL,
252   DEVCB_NULL,
253   DEVCB_NULL,
254   DEVCB_NULL
255};
256
257239READ8_MEMBER(mz3500_state::mz3500_ipl_r)
258240{
259241   return m_ipl_rom[offset];
r29182r29183
852834   MCFG_FLOPPY_DRIVE_ADD("upd765a:2", mz3500_floppies, "525ssdd", floppy_image_device::default_floppy_formats)
853835   MCFG_FLOPPY_DRIVE_ADD("upd765a:3", mz3500_floppies, "525ssdd", floppy_image_device::default_floppy_formats)
854836
855   MCFG_UPD7220_ADD("upd7220_chr", MAIN_CLOCK/5, hgdc_1_intf, upd7220_1_map)
856   MCFG_UPD7220_ADD("upd7220_gfx", MAIN_CLOCK/5, hgdc_2_intf, upd7220_2_map)
837   MCFG_DEVICE_ADD("upd7220_chr", UPD7220, MAIN_CLOCK/5)
838   MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_1_map)
839   MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(mz3500_state, hgdc_draw_text)
840   MCFG_UPD7220_VSYNC_CALLBACK(DEVWRITELINE("upd7220_gfx", upd7220_device, ext_sync_w))   
857841
842   MCFG_DEVICE_ADD("upd7220_gfx", UPD7220, MAIN_CLOCK/5)
843   MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_2_map)
844   MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(mz3500_state, hgdc_display_pixels)
845
858846   /* video hardware */
859847   MCFG_SCREEN_ADD("screen", RASTER)
860848   MCFG_SCREEN_REFRESH_RATE(60)
trunk/src/mess/drivers/if800.c
r29182r29183
2828   virtual void machine_reset();
2929   required_device<cpu_device> m_maincpu;
3030   required_device<palette_device> m_palette;
31   UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels );
3132};
3233
33static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels )
34UPD7220_DISPLAY_PIXELS_MEMBER( if800_state::hgdc_display_pixels )
3435{
35   if800_state *state = device->machine().driver_data<if800_state>();
36   const rgb_t *palette = state->m_palette->palette()->entry_list_raw();
36   const rgb_t *palette = m_palette->palette()->entry_list_raw();
3737
3838   int xi,gfx;
3939   UINT8 pen;
4040
41   gfx = state->m_video_ram[address];
41   gfx = m_video_ram[address];
4242
4343   for(xi=0;xi<8;xi++)
4444   {
r29182r29183
7373{
7474}
7575
76static UPD7220_INTERFACE( hgdc_intf )
77{
78   hgdc_display_pixels,
79   NULL,
80   DEVCB_NULL,
81   DEVCB_NULL,
82   DEVCB_NULL
83};
84
8576static ADDRESS_MAP_START( upd7220_map, AS_0, 8, if800_state )
8677   AM_RANGE(0x00000, 0x3ffff) AM_RAM AM_SHARE("video_ram")
8778ADDRESS_MAP_END
r29182r29183
9485
9586
9687//  MCFG_PIC8259_ADD( "pic8259", if800_pic8259_config )
97   MCFG_UPD7220_ADD("upd7220", 8000000/4, hgdc_intf, upd7220_map)
88   MCFG_DEVICE_ADD("upd7220", UPD7220, 8000000/4)
89   MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_map)
90   MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(if800_state, hgdc_display_pixels)
9891
9992   /* video hardware */
10093   MCFG_SCREEN_ADD("screen", RASTER)
trunk/src/mess/drivers/apc.c
r29182r29183
151151   UINT8 m_dma_offset[4];
152152
153153   IRQ_CALLBACK_MEMBER(irq_callback);
154   
155   UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels );
156   UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text );
154157
155158protected:
156159   // driver_device overrides
r29182r29183
179182}
180183
181184
182static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels )
185UPD7220_DISPLAY_PIXELS_MEMBER( apc_state::hgdc_display_pixels )
183186{
184187   // ...
185188}
186189
187static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
190UPD7220_DRAW_TEXT_LINE_MEMBER( apc_state::hgdc_draw_text )
188191{
189   apc_state *state = device->machine().driver_data<apc_state>();
190   const rgb_t *palette = state->m_palette->palette()->entry_list_raw();
192   const rgb_t *palette = m_palette->palette()->entry_list_raw();
191193   int xi,yi,yi_trans;
192194   int x;
193195   UINT8 char_size;
194196//  UINT8 interlace_on;
195197
196//  if(state->m_video_ff[DISPLAY_REG] == 0) //screen is off
198//  if(m_video_ff[DISPLAY_REG] == 0) //screen is off
197199//      return;
198200
199//  interlace_on = state->m_video_reg[2] == 0x10; /* TODO: correct? */
201//  interlace_on = m_video_reg[2] == 0x10; /* TODO: correct? */
200202   char_size = 19;
201203
202204   for(x=0;x<pitch;x++)
r29182r29183
208210      UINT32 tile_addr;
209211      UINT8 tile_sel;
210212
211//      tile_addr = addr+(x*(state->m_video_ff[WIDTH40_REG]+1));
213//      tile_addr = addr+(x*(m_video_ff[WIDTH40_REG]+1));
212214      tile_addr = addr+(x*(1));
213215
214      tile = state->m_video_ram_1[(tile_addr*2+1) & 0x1fff] & 0x00ff;
215      tile_sel = state->m_video_ram_1[(tile_addr*2) & 0x1fff] & 0x00ff;
216      attr = (state->m_video_ram_1[(tile_addr*2 & 0x1fff) | 0x2000] & 0x00ff);
216      tile = m_video_ram_1[(tile_addr*2+1) & 0x1fff] & 0x00ff;
217      tile_sel = m_video_ram_1[(tile_addr*2) & 0x1fff] & 0x00ff;
218      attr = (m_video_ram_1[(tile_addr*2 & 0x1fff) | 0x2000] & 0x00ff);
217219
218220      u_line = attr & 0x01;
219221      o_line = attr & 0x02;
r29182r29183
233235            res_x = (x*8+xi);
234236            res_y = y*lr+yi;
235237
236            if(!device->machine().first_screen()->visible_area().contains(res_x, res_y))
238            if(!machine().first_screen()->visible_area().contains(res_x, res_y))
237239               continue;
238240
239241            /*
r29182r29183
257259               if(yi & 0x10)
258260                  tile_data = 0;
259261               else
260                  tile_data = state->m_aux_pcg[(tile & 0xff)*0x20+yi*2];
262                  tile_data = m_aux_pcg[(tile & 0xff)*0x20+yi*2];
261263            }
262264            else
263               tile_data = state->m_char_rom[(tile & 0x7f)+((tile & 0x80)<<4)+((yi_trans & 0xf)*0x80)+((yi_trans & 0x10)<<8)];
265               tile_data = m_char_rom[(tile & 0x7f)+((tile & 0x80)<<4)+((yi_trans & 0xf)*0x80)+((yi_trans & 0x10)<<8)];
264266
265267            if(reverse) { tile_data^=0xff; }
266268            if(u_line && yi == lr-1) { tile_data = 0xff; }
267269            if(o_line && yi == 0) { tile_data = 0xff; }
268270            if(v_line)  { tile_data|=1; }
269            if(blink && device->machine().first_screen()->frame_number() & 0x20) { tile_data = 0; } // TODO: rate & correct behaviour
271            if(blink && machine().first_screen()->frame_number() & 0x20) { tile_data = 0; } // TODO: rate & correct behaviour
270272
271            if(cursor_on && cursor_addr == tile_addr && device->machine().first_screen()->frame_number() & 0x10)
273            if(cursor_on && cursor_addr == tile_addr && machine().first_screen()->frame_number() & 0x10)
272274               tile_data^=0xff;
273275
274276            if(yi >= char_size)
r29182r29183
758760   m_keyb.sig = 0;
759761}
760762
761
762static UPD7220_INTERFACE( hgdc_1_intf )
763{
764   NULL,
765   hgdc_draw_text,
766   DEVCB_NULL,
767   DEVCB_NULL,
768   DEVCB_NULL
769};
770
771
772static UPD7220_INTERFACE( hgdc_2_intf )
773{
774   hgdc_display_pixels,
775   NULL,
776   DEVCB_NULL,
777   DEVCB_NULL,
778   DEVCB_NULL
779};
780
781763static const gfx_layout charset_8x16 =
782764{
783765   8, 16,
r29182r29183
1000982
1001983   MCFG_GFXDECODE_ADD("gfxdecode", "palette", apc)
1002984
1003   MCFG_UPD7220_ADD("upd7220_chr", XTAL_3_579545MHz, hgdc_1_intf, upd7220_1_map) // unk clock
1004   MCFG_UPD7220_ADD("upd7220_btm", XTAL_3_579545MHz, hgdc_2_intf, upd7220_2_map) // unk clock
985   MCFG_DEVICE_ADD("upd7220_chr", UPD7220, 3579545) // unk clock
986   MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_1_map)
987   MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(apc_state, hgdc_draw_text)   
1005988
989   MCFG_DEVICE_ADD("upd7220_btm", UPD7220, 3579545) // unk clock
990   MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_2_map)
991   MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(apc_state, hgdc_display_pixels)   
992
1006993   MCFG_PALETTE_ADD("palette", 16)
1007994   MCFG_PALETTE_INIT_OWNER(apc_state,apc)
1008995
trunk/src/mess/drivers/mz6500.c
r29182r29183
3333   virtual void video_start();
3434   required_device<cpu_device> m_maincpu;
3535   required_device<palette_device> m_palette;
36   UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels );
3637};
3738
38static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels )
39UPD7220_DISPLAY_PIXELS_MEMBER( mz6500_state::hgdc_display_pixels )
3940{
40   mz6500_state *state = device->machine().driver_data<mz6500_state>();
41   const rgb_t *palette = state->m_palette->palette()->entry_list_raw();
41   const rgb_t *palette = m_palette->palette()->entry_list_raw();
4242   int gfx[3];
4343   UINT8 i,pen;
4444
45   gfx[0] = state->m_video_ram[address + 0x00000];
46   gfx[1] = state->m_video_ram[address + 0x10000];
47   gfx[2] = state->m_video_ram[address + 0x20000];
45   gfx[0] = m_video_ram[address + 0x00000];
46   gfx[1] = m_video_ram[address + 0x10000];
47   gfx[2] = m_video_ram[address + 0x20000];
4848
4949   for(i=0; i<8; i++)
5050   {
r29182r29183
126126   SLOT_INTERFACE( "525hd", FLOPPY_525_HD )
127127SLOT_INTERFACE_END
128128
129static UPD7220_INTERFACE( hgdc_intf )
130{
131   hgdc_display_pixels,
132   NULL,
133   DEVCB_NULL,
134   DEVCB_NULL,
135   DEVCB_NULL
136};
137
138129static ADDRESS_MAP_START( upd7220_map, AS_0, 8, mz6500_state )
139130   AM_RANGE(0x00000, 0x3ffff) AM_RAM AM_SHARE("video_ram")
140131ADDRESS_MAP_END
r29182r29183
157148   MCFG_PALETTE_ADD("palette", 8)
158149
159150   /* Devices */
160   MCFG_UPD7220_ADD("upd7220", 8000000/6, hgdc_intf, upd7220_map) // unk clock
151   MCFG_DEVICE_ADD("upd7220", UPD7220, 8000000/6) // unk clock
152   MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_map)
153   MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(mz6500_state, hgdc_display_pixels)
154
161155   MCFG_UPD765A_ADD("upd765", true, true)
162156   MCFG_FLOPPY_DRIVE_ADD("upd765:0", mz6500_floppies, "525hd", floppy_image_device::default_floppy_formats)
163157   MCFG_FLOPPY_DRIVE_ADD("upd765:1", mz6500_floppies, "525hd", floppy_image_device::default_floppy_formats)
trunk/src/mess/drivers/a5105.c
r29182r29183
8888   required_device<ram_device> m_ram;
8989   required_device<gfxdecode_device> m_gfxdecode;
9090   required_device<palette_device> m_palette;
91   UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels );
92   UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text );
9193};
9294
9395/* TODO */
94static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels )
96UPD7220_DISPLAY_PIXELS_MEMBER( a5105_state::hgdc_display_pixels )
9597{
96   a5105_state *state = device->machine().driver_data<a5105_state>();
97   const rgb_t *palette = state->m_palette->palette()->entry_list_raw();
98   const rgb_t *palette = m_palette->palette()->entry_list_raw();
9899
99100   int xi,gfx;
100101   UINT8 pen;
101102
102   gfx = state->m_video_ram[address & 0x1ffff];
103   gfx = m_video_ram[address & 0x1ffff];
103104
104105   for(xi=0;xi<8;xi++)
105106   {
r29182r29183
109110   }
110111}
111112
112static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
113UPD7220_DRAW_TEXT_LINE_MEMBER( a5105_state::hgdc_draw_text )
113114{
114   a5105_state *state = device->machine().driver_data<a5105_state>();
115   const rgb_t *palette = state->m_palette->palette()->entry_list_raw();
115   const rgb_t *palette = m_palette->palette()->entry_list_raw();
116116   int x;
117117   int xi,yi;
118118   int tile,color;
r29182r29183
120120
121121   for( x = 0; x < pitch; x++ )
122122   {
123      tile = (state->m_video_ram[((addr+x)*2) & 0x1ffff] & 0xff);
124      color = (state->m_video_ram[((addr+x)*2+1) & 0x1ffff] & 0x0f);
123      tile = (m_video_ram[((addr+x)*2) & 0x1ffff] & 0xff);
124      color = (m_video_ram[((addr+x)*2+1) & 0x1ffff] & 0x0f);
125125
126126      for( yi = 0; yi < lr; yi++)
127127      {
128         tile_data = state->m_char_ram[(tile*8+yi) & 0x7ff];
128         tile_data = m_char_ram[(tile*8+yi) & 0x7ff];
129129
130         if(cursor_on && cursor_addr == addr+x && device->machine().first_screen()->frame_number() & 0x10)
130         if(cursor_on && cursor_addr == addr+x && machine().first_screen()->frame_number() & 0x10)
131131            tile_data^=0xff;
132132
133133         for( xi = 0; xi < 8; xi++)
r29182r29183
141141            if(yi >= 8) { pen = 0; }
142142
143143            /* TODO: pitch is currently 40, this should actually go in the upd7220 device */
144            if(!device->machine().first_screen()->visible_area().contains(res_x*2+0, res_y))
144            if(!machine().first_screen()->visible_area().contains(res_x*2+0, res_y))
145145               continue;
146146
147147            bitmap.pix32(res_y, res_x*2+0) = palette[pen];
148148
149            if(!device->machine().first_screen()->visible_area().contains(res_x*2+1, res_y))
149            if(!machine().first_screen()->visible_area().contains(res_x*2+1, res_y))
150150               continue;
151151
152152            bitmap.pix32(res_y, res_x*2+1) = palette[pen];
r29182r29183
539539   m_char_ram = memregion("pcg")->base();
540540}
541541
542static UPD7220_INTERFACE( hgdc_intf )
543{
544   hgdc_display_pixels,
545   hgdc_draw_text,
546   DEVCB_NULL,
547   DEVCB_NULL,
548   DEVCB_NULL
549};
550
551542static ADDRESS_MAP_START( upd7220_map, AS_0, 8, a5105_state)
552543   ADDRESS_MAP_GLOBAL_MASK(0x1ffff)
553544   AM_RANGE(0x00000, 0x1ffff) AM_RAM AM_SHARE("video_ram")
r29182r29183
613604   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
614605
615606   /* Devices */
616   MCFG_UPD7220_ADD("upd7220", XTAL_15MHz / 16, hgdc_intf, upd7220_map) // unk clock
607   MCFG_DEVICE_ADD("upd7220", UPD7220, XTAL_15MHz / 16) // unk clock
608   MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_map)
609   MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(a5105_state, hgdc_display_pixels)
610   MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(a5105_state, hgdc_draw_text)
611
617612   MCFG_Z80CTC_ADD( "z80ctc", XTAL_15MHz / 4, a5105_ctc_intf )
618613   MCFG_Z80PIO_ADD( "z80pio", XTAL_15MHz / 4, a5105_pio_intf )
619614
trunk/src/mess/drivers/vt240.c
r29182r29183
3030   vt240_state(const machine_config &mconfig, device_type type, const char *tag)
3131      : driver_device(mconfig, type, tag),
3232      m_maincpu(*this, "maincpu"),
33      m_hgdc(*this, "upd7220")
34      ,
33      m_hgdc(*this, "upd7220"),
3534      m_video_ram(*this, "video_ram"){ }
3635
3736   required_device<cpu_device> m_maincpu;
r29182r29183
4847   DECLARE_DRIVER_INIT(vt240);
4948   virtual void machine_reset();
5049   INTERRUPT_GEN_MEMBER(vt240_irq);
50   UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text );
5151};
5252
5353/* TODO */
54static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
54UPD7220_DRAW_TEXT_LINE_MEMBER( vt240_state::hgdc_draw_text )
5555{
56   //vt240_state *state = device->machine().driver_data<a5105_state>();
5756   //int x;
5857   //int xi,yi;
5958   //int tile,color;
r29182r29183
6766
6867      for( yi = 0; yi < lr; yi++)
6968      {
70         tile_data = state->m_char_rom[(tile*8+yi) & 0x7ff];
69         tile_data = m_char_rom[(tile*8+yi) & 0x7ff];
7170
7271         if(cursor_on && cursor_addr == addr+x) //TODO
7372            tile_data^=0xff;
r29182r29183
131130{
132131}
133132
134static UPD7220_INTERFACE( hgdc_intf )
135{
136   NULL,
137   hgdc_draw_text,
138   DEVCB_NULL,
139   DEVCB_NULL,
140   DEVCB_NULL
141};
142
143133INTERRUPT_GEN_MEMBER(vt240_state::vt240_irq)
144134{
145135   //device.execute().set_input_line(I8085_RST65_LINE, ASSERT_LINE);
r29182r29183
179169   MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette")
180170   MCFG_GFXDECODE_ADD("gfxdecode", "palette", vt240)
181171
182   MCFG_UPD7220_ADD("upd7220", XTAL_4MHz / 4, hgdc_intf, upd7220_map) //unknown clock
172   MCFG_DEVICE_ADD("upd7220", UPD7220, XTAL_4MHz / 4)
173   MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_map)
174   MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(vt240_state, hgdc_draw_text)
183175MACHINE_CONFIG_END
184176
185177/* ROM definition */
trunk/src/mess/drivers/pc9801.c
r29182r29183
683683   DECLARE_WRITE8_MEMBER(pc9821_ext2_video_ff_w);
684684
685685   DECLARE_FLOPPY_FORMATS( floppy_formats );
686    UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels );
687    UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text );
686688
687689private:
688690   UINT8 m_sdip_read(UINT16 port, UINT8 sdip_offset);
r29182r29183
781783   return 0;
782784}
783785
784static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels )
786UPD7220_DISPLAY_PIXELS_MEMBER( pc9801_state::hgdc_display_pixels )
785787{
786   pc9801_state *state = device->machine().driver_data<pc9801_state>();
787   const rgb_t *palette = state->m_palette->palette()->entry_list_raw();
788   const rgb_t *palette = m_palette->palette()->entry_list_raw();
788789   int xi;
789790   int res_x,res_y;
790791   UINT8 pen;
791792   UINT8 interlace_on;
792793   UINT8 colors16_mode;
793794
794   if(state->m_video_ff[DISPLAY_REG] == 0) //screen is off
795   if(m_video_ff[DISPLAY_REG] == 0) //screen is off
795796      return;
796797
797//  popmessage("%02x %d",state->m_video_ff[INTERLACE_REG],device->machine().first_screen()->visible_area().max_y + 1);
798//  interlace_on = ((device->machine().first_screen()->visible_area().max_y + 1) >= 400) ? 1 : 0;
799   interlace_on = state->m_video_ff[INTERLACE_REG];
800   colors16_mode = (state->m_ex_video_ff[ANALOG_16_MODE]) ? 16 : 8;
798//  popmessage("%02x %d",m_video_ff[INTERLACE_REG],machine().first_screen()->visible_area().max_y + 1);
799//  interlace_on = ((machine().first_screen()->visible_area().max_y + 1) >= 400) ? 1 : 0;
800   interlace_on = m_video_ff[INTERLACE_REG];
801   colors16_mode = (m_ex_video_ff[ANALOG_16_MODE]) ? 16 : 8;
801802
802   if(state->m_ex_video_ff[ANALOG_256_MODE])
803   if(m_ex_video_ff[ANALOG_256_MODE])
803804   {
804805      for(xi=0;xi<8;xi++)
805806      {
806807         res_x = x + xi;
807808         res_y = y;
808809
809         if(!device->machine().first_screen()->visible_area().contains(res_x, res_y*2+0))
810         if(!machine().first_screen()->visible_area().contains(res_x, res_y*2+0))
810811            return;
811812
812         pen = state->m_ext_gvram[(address*8+xi)+(state->m_vram_disp*0x40000)];
813         pen = m_ext_gvram[(address*8+xi)+(m_vram_disp*0x40000)];
813814
814815         bitmap.pix32(res_y*2+0, res_x) = palette[pen + 0x20];
815         if(device->machine().first_screen()->visible_area().contains(res_x, res_y*2+1))
816         if(machine().first_screen()->visible_area().contains(res_x, res_y*2+1))
816817            bitmap.pix32(res_y*2+1, res_x) = palette[pen + 0x20];
817818      }
818819   }
r29182r29183
823824         res_x = x + xi;
824825         res_y = y;
825826
826         pen = ((state->m_video_ram_2[(address & 0x7fff) + (0x08000) + (state->m_vram_disp*0x20000)] >> (7-xi)) & 1) ? 1 : 0;
827         pen|= ((state->m_video_ram_2[(address & 0x7fff) + (0x10000) + (state->m_vram_disp*0x20000)] >> (7-xi)) & 1) ? 2 : 0;
828         pen|= ((state->m_video_ram_2[(address & 0x7fff) + (0x18000) + (state->m_vram_disp*0x20000)] >> (7-xi)) & 1) ? 4 : 0;
829         if(state->m_ex_video_ff[ANALOG_16_MODE])
830            pen|= ((state->m_video_ram_2[(address & 0x7fff) + (0) + (state->m_vram_disp*0x20000)] >> (7-xi)) & 1) ? 8 : 0;
827         pen = ((m_video_ram_2[(address & 0x7fff) + (0x08000) + (m_vram_disp*0x20000)] >> (7-xi)) & 1) ? 1 : 0;
828         pen|= ((m_video_ram_2[(address & 0x7fff) + (0x10000) + (m_vram_disp*0x20000)] >> (7-xi)) & 1) ? 2 : 0;
829         pen|= ((m_video_ram_2[(address & 0x7fff) + (0x18000) + (m_vram_disp*0x20000)] >> (7-xi)) & 1) ? 4 : 0;
830         if(m_ex_video_ff[ANALOG_16_MODE])
831            pen|= ((m_video_ram_2[(address & 0x7fff) + (0) + (m_vram_disp*0x20000)] >> (7-xi)) & 1) ? 8 : 0;
831832
832833         if(interlace_on)
833834         {
834            if(device->machine().first_screen()->visible_area().contains(res_x, res_y*2+0))
835            if(machine().first_screen()->visible_area().contains(res_x, res_y*2+0))
835836               bitmap.pix32(res_y*2+0, res_x) = palette[pen + colors16_mode];
836837            /* TODO: it looks like that PC-98xx can only display even lines ... */
837            if(device->machine().first_screen()->visible_area().contains(res_x, res_y*2+1))
838            if(machine().first_screen()->visible_area().contains(res_x, res_y*2+1))
838839               bitmap.pix32(res_y*2+1, res_x) = palette[pen + colors16_mode];
839840         }
840841         else
r29182r29183
843844   }
844845}
845846
846static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
847UPD7220_DRAW_TEXT_LINE_MEMBER( pc9801_state::hgdc_draw_text )
847848{
848   pc9801_state *state = device->machine().driver_data<pc9801_state>();
849   const rgb_t *palette = state->m_palette->palette()->entry_list_raw();
849   const rgb_t *palette = m_palette->palette()->entry_list_raw();
850850   int xi,yi;
851851   int x;
852852   UINT8 char_size;
r29182r29183
856856   UINT8 kanji_sel;
857857   UINT8 x_step;
858858
859   if(state->m_video_ff[DISPLAY_REG] == 0) //screen is off
859   if(m_video_ff[DISPLAY_REG] == 0) //screen is off
860860      return;
861861
862//  interlace_on = state->m_video_ff[INTERLACE_REG];
863   char_size = state->m_video_ff[FONTSEL_REG] ? 16 : 8;
862//  interlace_on = m_video_ff[INTERLACE_REG];
863   char_size = m_video_ff[FONTSEL_REG] ? 16 : 8;
864864   tile = 0;
865865
866866   for(x=0;x<pitch;x+=x_step)
r29182r29183
873873      UINT8 knj_tile;
874874      UINT8 gfx_mode;
875875
876      tile_addr = addr+(x*(state->m_video_ff[WIDTH40_REG]+1));
876      tile_addr = addr+(x*(m_video_ff[WIDTH40_REG]+1));
877877
878878      kanji_sel = 0;
879879      kanji_lr = 0;
880880
881      tile = state->m_video_ram_1[(tile_addr*2) & 0x1fff] & 0xff;
882      knj_tile = state->m_video_ram_1[(tile_addr*2+1) & 0x1fff] & 0xff;
881      tile = m_video_ram_1[(tile_addr*2) & 0x1fff] & 0xff;
882      knj_tile = m_video_ram_1[(tile_addr*2+1) & 0x1fff] & 0xff;
883883      if(knj_tile)
884884      {
885885         /* Note: bit 7 doesn't really count, if a kanji is enabled then the successive tile is always the second part of it.
r29182r29183
900900      else
901901         x_step = 1;
902902
903      attr = (state->m_video_ram_1[(tile_addr*2 & 0x1fff) | 0x2000] & 0xff);
903      attr = (m_video_ram_1[(tile_addr*2 & 0x1fff) | 0x2000] & 0xff);
904904
905905      secret = (attr & 1) ^ 1;
906906      blink = attr & 2;
907907      reverse = attr & 4;
908908      u_line = attr & 8;
909      v_line = (state->m_video_ff[ATTRSEL_REG]) ? 0 : attr & 0x10;
910      gfx_mode = (state->m_video_ff[ATTRSEL_REG]) ? attr & 0x10 : 0;
909      v_line = (m_video_ff[ATTRSEL_REG]) ? 0 : attr & 0x10;
910      gfx_mode = (m_video_ff[ATTRSEL_REG]) ? attr & 0x10 : 0;
911911      color = (attr & 0xe0) >> 5;
912912
913913      for(kanji_lr=0;kanji_lr<x_step;kanji_lr++)
r29182r29183
918918            {
919919               int res_x,res_y;
920920
921               res_x = ((x+kanji_lr)*8+xi) * (state->m_video_ff[WIDTH40_REG]+1);
922               res_y = y*lr+yi - (state->m_txt_scroll_reg[3] & 0xf);
921               res_x = ((x+kanji_lr)*8+xi) * (m_video_ff[WIDTH40_REG]+1);
922               res_y = y*lr+yi - (m_txt_scroll_reg[3] & 0xf);
923923
924               if(!device->machine().first_screen()->visible_area().contains(res_x, res_y))
924               if(!machine().first_screen()->visible_area().contains(res_x, res_y))
925925                  continue;
926926
927927               tile_data = 0;
r29182r29183
952952                     tile_data = ((tile >> gfx_bit) & 1) ? 0xff : 0x00;
953953                  }
954954                  else if(kanji_sel)
955                     tile_data = (state->m_kanji_rom[tile*0x20+yi*2+kanji_lr]);
955                     tile_data = (m_kanji_rom[tile*0x20+yi*2+kanji_lr]);
956956                  else
957                     tile_data = (state->m_char_rom[tile*char_size+state->m_video_ff[FONTSEL_REG]*0x800+yi]);
957                     tile_data = (m_char_rom[tile*char_size+m_video_ff[FONTSEL_REG]*0x800+yi]);
958958               }
959959
960960               if(reverse) { tile_data^=0xff; }
r29182r29183
962962               if(v_line)  { tile_data|=8; }
963963
964964               /* TODO: proper blink rate for these two */
965               if(cursor_on && cursor_addr == tile_addr && device->machine().first_screen()->frame_number() & 0x10)
965               if(cursor_on && cursor_addr == tile_addr && machine().first_screen()->frame_number() & 0x10)
966966                  tile_data^=0xff;
967967
968               if(blink && device->machine().first_screen()->frame_number() & 0x10)
968               if(blink && machine().first_screen()->frame_number() & 0x10)
969969                  tile_data^=0xff;
970970
971971               if(yi >= char_size)
r29182r29183
976976               if(pen != -1)
977977                  bitmap.pix32(res_y, res_x) = palette[pen];
978978
979               if(state->m_video_ff[WIDTH40_REG])
979               if(m_video_ff[WIDTH40_REG])
980980               {
981                  if(!device->machine().first_screen()->visible_area().contains(res_x+1, res_y))
981                  if(!machine().first_screen()->visible_area().contains(res_x+1, res_y))
982982                     continue;
983983
984984                  if(pen != -1)
r29182r29183
990990   }
991991}
992992
993static UPD7220_INTERFACE( hgdc_1_intf )
994{
995   NULL,
996   hgdc_draw_text,
997   DEVCB_NULL,
998   DEVCB_DEVICE_LINE_MEMBER("upd7220_btm", upd7220_device, ext_sync_w),
999   DEVCB_NULL
1000};
1001993
1002static UPD7220_INTERFACE( hgdc_2_intf )
1003{
1004   hgdc_display_pixels,
1005   NULL,
1006   DEVCB_NULL,
1007   DEVCB_NULL,
1008   DEVCB_NULL
1009};
1010
1011
1012994#if 0
1013995READ8_MEMBER(pc9801_state::pc9801_xx_r)
1014996{
r29182r29183
36723654   MCFG_SCREEN_SIZE(640, 480)
36733655   MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1)
36743656
3675   MCFG_UPD7220_ADD("upd7220_chr", 5000000/2, hgdc_1_intf, upd7220_1_map)
3676   MCFG_UPD7220_ADD("upd7220_btm", 5000000/2, hgdc_2_intf, upd7220_2_map)
3657    MCFG_DEVICE_ADD("upd7220_chr", UPD7220, 5000000/2)
3658    MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_1_map)
3659    MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(pc9801_state, hgdc_draw_text)
3660    MCFG_UPD7220_VSYNC_CALLBACK(DEVWRITELINE("upd7220_btm", upd7220_device, ext_sync_w))   
36773661
3662    MCFG_DEVICE_ADD("upd7220_btm", UPD7220, 5000000/2)
3663    MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_2_map)
3664    MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(pc9801_state, hgdc_display_pixels)
3665
36783666   MCFG_PALETTE_ADD("palette", 16)
36793667   MCFG_PALETTE_INIT_OWNER(pc9801_state,pc9801)
36803668   MCFG_GFXDECODE_ADD("gfxdecode", "palette", pc9801)
r29182r29183
37443732   MCFG_SCREEN_SIZE(640, 480)
37453733   MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1)
37463734
3747   MCFG_UPD7220_ADD("upd7220_chr", 5000000/2, hgdc_1_intf, upd7220_1_map)
3748   MCFG_UPD7220_ADD("upd7220_btm", 5000000/2, hgdc_2_intf, upd7220_2_map)
3735    MCFG_DEVICE_ADD("upd7220_chr", UPD7220, 5000000/2)
3736    MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_1_map)
3737    MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(pc9801_state, hgdc_draw_text)
3738    MCFG_UPD7220_VSYNC_CALLBACK(DEVWRITELINE("upd7220_btm", upd7220_device, ext_sync_w))   
37493739
3740    MCFG_DEVICE_ADD("upd7220_btm", UPD7220, 5000000/2)
3741    MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_2_map)
3742    MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(pc9801_state, hgdc_display_pixels)
3743
37503744   MCFG_PALETTE_ADD("palette", 16+16)
37513745   MCFG_PALETTE_INIT_OWNER(pc9801_state,pc9801)
37523746   MCFG_GFXDECODE_ADD("gfxdecode", "palette", pc9801)
r29182r29183
38303824   MCFG_SCREEN_SIZE(640, 480)
38313825   MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1)
38323826
3833   MCFG_UPD7220_ADD("upd7220_chr", 5000000/2, hgdc_1_intf, upd7220_1_map)
3834   MCFG_UPD7220_ADD("upd7220_btm", 5000000/2, hgdc_2_intf, upd7220_2_map)
3827    MCFG_DEVICE_ADD("upd7220_chr", UPD7220, 5000000/2)
3828    MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_1_map)
3829    MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(pc9801_state, hgdc_draw_text)
3830    MCFG_UPD7220_VSYNC_CALLBACK(DEVWRITELINE("upd7220_btm", upd7220_device, ext_sync_w))   
38353831
3832    MCFG_DEVICE_ADD("upd7220_btm", UPD7220, 5000000/2)
3833    MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_2_map)
3834    MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(pc9801_state, hgdc_display_pixels)
3835
38363836   MCFG_PALETTE_ADD("palette", 16+16+256)
38373837   MCFG_PALETTE_INIT_OWNER(pc9801_state,pc9801)
38383838   MCFG_GFXDECODE_ADD("gfxdecode", "palette", pc9801)
trunk/src/mess/drivers/qx10.c
r29182r29183
148148   required_device<cpu_device> m_maincpu;
149149   required_device<ram_device> m_ram;
150150   required_device<palette_device> m_palette;
151   UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels );
152   UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text );
151153};
152154
153static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels )
155UPD7220_DISPLAY_PIXELS_MEMBER( qx10_state::hgdc_display_pixels )
154156{
155   qx10_state *state = device->machine().driver_data<qx10_state>();
156   const rgb_t *palette = state->m_palette->palette()->entry_list_raw();
157   const rgb_t *palette = m_palette->palette()->entry_list_raw();
157158   int xi,gfx[3];
158159   UINT8 pen;
159160
160   if(state->m_color_mode)
161   if(m_color_mode)
161162   {
162      gfx[0] = state->m_video_ram[(address) + 0x00000];
163      gfx[1] = state->m_video_ram[(address) + 0x20000];
164      gfx[2] = state->m_video_ram[(address) + 0x40000];
163      gfx[0] = m_video_ram[(address) + 0x00000];
164      gfx[1] = m_video_ram[(address) + 0x20000];
165      gfx[2] = m_video_ram[(address) + 0x40000];
165166   }
166167   else
167168   {
168      gfx[0] = state->m_video_ram[address];
169      gfx[0] = m_video_ram[address];
169170      gfx[1] = 0;
170171      gfx[2] = 0;
171172   }
r29182r29183
180181   }
181182}
182183
183static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
184UPD7220_DRAW_TEXT_LINE_MEMBER( qx10_state::hgdc_draw_text )
184185{
185   qx10_state *state = device->machine().driver_data<qx10_state>();
186   const rgb_t *palette = state->m_palette->palette()->entry_list_raw();
186   const rgb_t *palette = m_palette->palette()->entry_list_raw();
187187   int x;
188188   int xi,yi;
189189   int tile;
r29182r29183
194194
195195   for( x = 0; x < pitch; x++ )
196196   {
197      tile = state->m_video_ram[(addr+x)*2];
198      attr = state->m_video_ram[(addr+x)*2+1];
197      tile = m_video_ram[(addr+x)*2];
198      attr = m_video_ram[(addr+x)*2+1];
199199
200      color = (state->m_color_mode) ? 1 : (attr & 4) ? 2 : 1; /* TODO: color mode */
200      color = (m_color_mode) ? 1 : (attr & 4) ? 2 : 1; /* TODO: color mode */
201201
202202      for( yi = 0; yi < lr; yi++)
203203      {
204         tile_data = (state->m_char_rom[tile*16+yi]);
204         tile_data = (m_char_rom[tile*16+yi]);
205205
206206         if(attr & 8)
207207            tile_data^=0xff;
r29182r29183
209209         if(cursor_on && cursor_addr == addr+x) //TODO
210210            tile_data^=0xff;
211211
212         if(attr & 0x80 && device->machine().first_screen()->frame_number() & 0x10) //TODO: check for blinking interval
212         if(attr & 0x80 && machine().first_screen()->frame_number() & 0x10) //TODO: check for blinking interval
213213            tile_data=0;
214214
215215         for( xi = 0; xi < 8; xi++)
r29182r29183
219219            res_x = x * 8 + xi;
220220            res_y = y * lr + yi;
221221
222            if(!device->machine().first_screen()->visible_area().contains(res_x, res_y))
222            if(!machine().first_screen()->visible_area().contains(res_x, res_y))
223223               continue;
224224
225225            if(yi >= 16)
r29182r29183
766766   m_char_rom = memregion("chargen")->base();
767767}
768768
769static UPD7220_INTERFACE( hgdc_intf )
770{
771   hgdc_display_pixels,
772   hgdc_draw_text,
773   DEVCB_NULL,
774   DEVCB_NULL,
775   DEVCB_NULL
776};
777
778769PALETTE_INIT_MEMBER(qx10_state, qx10)
779770{
780771   // ...
r29182r29183
858849   MCFG_I8255_ADD("i8255", qx10_i8255_interface)
859850   MCFG_I8237_ADD("8237dma_1", MAIN_CLK/4, qx10_dma8237_1_interface)
860851   MCFG_I8237_ADD("8237dma_2", MAIN_CLK/4, qx10_dma8237_2_interface)
861   MCFG_UPD7220_ADD("upd7220", MAIN_CLK/6, hgdc_intf, upd7220_map) // unk clock
852   
853   MCFG_DEVICE_ADD("upd7220", UPD7220, MAIN_CLK/6) // unk clock
854   MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_map)
855   MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(qx10_state, hgdc_display_pixels)
856   MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(qx10_state, hgdc_draw_text)
862857   MCFG_VIDEO_SET_SCREEN("screen")
858
863859   MCFG_MC146818_ADD( "rtc", XTAL_32_768kHz )
864860   MCFG_MC146818_IRQ_HANDLER(DEVWRITELINE("pic8259_slave", pic8259_device, ir2_w))
865861   MCFG_UPD765A_ADD("upd765", true, true)
trunk/src/mess/drivers/dmv.c
r29182r29183
5656
5757   required_shared_ptr<UINT8> m_video_ram;
5858   required_device<palette_device> m_palette;
59
60   UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels );
61   UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text );
5962};
6063
6164
r29182r29183
131134   machine().device<upi41_cpu_device>("kb_ctrl_mcu")->upi41_master_w(space, offset, data);
132135}
133136
134static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels )
137UPD7220_DISPLAY_PIXELS_MEMBER( dmv_state::hgdc_display_pixels )
135138{
136139   //TODO
137140}
138141
139static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
142UPD7220_DRAW_TEXT_LINE_MEMBER( dmv_state::hgdc_draw_text )
140143{
141   dmv_state *state = device->machine().driver_data<dmv_state>();
142   const rgb_t *palette = state->m_palette->palette()->entry_list_raw();
143   UINT8 * chargen = state->memregion("maincpu")->base() + 0x1000;
144   const rgb_t *palette = m_palette->palette()->entry_list_raw();
145   UINT8 * chargen = memregion("maincpu")->base() + 0x1000;
144146
145147   for( int x = 0; x < pitch; x++ )
146148   {
147      UINT8 tile = state->m_video_ram[((addr+x)*2) & 0x1ffff] & 0xff;
149      UINT8 tile = m_video_ram[((addr+x)*2) & 0x1ffff] & 0xff;
148150
149151      for( int yi = 0; yi < lr; yi++)
150152      {
r29182r29183
161163            res_x = x * 8 + xi;
162164            res_y = y * lr + yi;
163165
164            if(!device->machine().first_screen()->visible_area().contains(res_x, res_y))
166            if(!machine().first_screen()->visible_area().contains(res_x, res_y))
165167               continue;
166168
167169            if(yi >= 16) { pen = 0; }
r29182r29183
250252GFXDECODE_END
251253
252254
253static UPD7220_INTERFACE( hgdc_intf )
254{
255   hgdc_display_pixels,
256   hgdc_draw_text,
257   DEVCB_NULL,
258   DEVCB_NULL,
259   DEVCB_NULL
260};
261
262
263255//------------------------------------------------------------------------------------
264256//   I8237_INTERFACE
265257//------------------------------------------------------------------------------------
r29182r29183
322314   MCFG_DEFAULT_LAYOUT(layout_dmv)
323315
324316   // devices
325   MCFG_UPD7220_ADD( "upd7220", XTAL_5MHz/2, hgdc_intf, upd7220_map ) // unk clock
317   MCFG_DEVICE_ADD("upd7220", UPD7220, XTAL_5MHz/2) // unk clock
318   MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_map)
319   MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(dmv_state, hgdc_display_pixels)
320   MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(dmv_state, hgdc_draw_text)
321
326322   MCFG_I8237_ADD( "dma8237", XTAL_4MHz, dmv_dma8237_config )
327323   MCFG_UPD765A_ADD( "upd765", true, true )
328324   MCFG_UPD765_DRQ_CALLBACK(DEVWRITELINE("dma8237", am9517a_device, dreq3_w))
trunk/src/mess/includes/mikromik.h
r29182r29183
125125   int m_fdc_tc;
126126
127127   DECLARE_FLOPPY_FORMATS( floppy_formats );
128   UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels );
128129};
129130
130131
trunk/src/mess/includes/compis.h
r29182r29183
125125   DECLARE_WRITE_LINE_MEMBER(write_centronics_select);
126126
127127   int m_tmr0;
128
129   UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels );
128130};
129131
130132
trunk/src/mess/video/mikromik.c
r29182r29183
5050//  UPD7220_INTERFACE( hgdc_intf )
5151//-------------------------------------------------
5252
53static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels )
53UPD7220_DISPLAY_PIXELS_MEMBER( mm1_state::hgdc_display_pixels )
5454{
55   mm1_state *state = device->machine().driver_data<mm1_state>();
55   UINT8 data = m_video_ram[address];
5656
57   UINT8 data = state->m_video_ram[address];
58
5957   for (int i = 0; i < 8; i++)
6058   {
61      if (BIT(data, 7-i)) bitmap.pix32(y, x + i) = state->m_palette->pen(1);
59      if (BIT(data, 7 - i)) bitmap.pix32(y, x + i) = m_palette->pen(1);
6260   }
6361}
6462
65static UPD7220_INTERFACE( hgdc_intf )
66{
67   hgdc_display_pixels,
68   NULL,
69   DEVCB_NULL,
70   DEVCB_NULL,
71   DEVCB_NULL
72};
7363
74
7564UINT32 mm1_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
7665{
7766   /* text */
r29182r29183
127116
128117   MCFG_I8275_ADD(I8275_TAG, XTAL_18_720MHz/8, 8, crtc_display_pixels, DEVWRITELINE(I8237_TAG, am9517a_device, dreq0_w))
129118   MCFG_VIDEO_SET_SCREEN(SCREEN_TAG)
130   MCFG_UPD7220_ADD(UPD7220_TAG, XTAL_18_720MHz/8, hgdc_intf, mm1_upd7220_map)
119
120   MCFG_DEVICE_ADD(UPD7220_TAG, UPD7220, XTAL_18_720MHz/8)
121   MCFG_DEVICE_ADDRESS_MAP(AS_0, mm1_upd7220_map)
122   MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(mm1_state, hgdc_display_pixels)   
131123   MCFG_VIDEO_SET_SCREEN(SCREEN_TAG)
132124MACHINE_CONFIG_END

Previous 199869 Revisions Next


© 1997-2024 The MAME Team