Previous 15994 Revisions Next

r6363 Wednesday 11th November, 2009 at 20:49:36 UTC by Curt Coder
[UPD3301] Use character width from interface, added end-of-screen interrupt.
[src/mess/video]upd3301.c

src/mess/video/upd3301.c
r6362r6363
4242#define UPD3301_STATUS_VE                  0x10
4343#define UPD3301_STATUS_U                  0x08   /* not supported */
4444#define UPD3301_STATUS_N                  0x04   /* not supported */
45#define UPD3301_STATUS_E                  0x02   /* not supported */
45#define UPD3301_STATUS_E                  0x02
4646#define UPD3301_STATUS_LP                  0x01   /* not supported */
4747 
4848enum
r6362r6363
5050   MODE_NONE,
5151   MODE_RESET,
5252   MODE_READ_LIGHT_PEN,
53   MODE_LOAD_CURSOR_POSITION
53   MODE_LOAD_CURSOR_POSITION,
54   MODE_RESET_COUNTERS
5455};
5556 
5657/***************************************************************************
r6362r6363
6667   devcb_resolved_write_line   out_vrtc_func;
6768 
6869   const device_config *screen;   /* screen */
70   int width;                  /* character width */
6971 
70   int disp;
7172   int mode;
7273   UINT8 status;
7374   int param_count;
r6362r6363
133134   if (LOG) logerror("UPD3301 '%s' Interrupt: %u\n", device->tag, state);
134135 
135136   devcb_call_write_line(&upd3301->out_int_func, state);
137 
138   if (!state)
139   {
140      upd3301->status &= ~(UPD3301_STATUS_N | UPD3301_STATUS_E);
141   }
136142}
137143 
138144/*-------------------------------------------------
r6362r6363
151157   {
152158      upd3301->status &= ~UPD3301_STATUS_VE;
153159   }
154 
155   upd3301->disp = state;
156160}
157161 
158162/*-------------------------------------------------
r6362r6363
173177   int y = video_screen_get_vpos(upd3301->screen);
174178 
175179   int next_x = state ? upd3301->h : 0;
176   int next_y = state ? y : ((y + 1) % ((upd3301->l + upd3301->v) * 8));
180   int next_y = state ? y : ((y + 1) % ((upd3301->l + upd3301->v) * upd3301->width));
177181 
178182   attotime duration = video_screen_get_time_until_pos(upd3301->screen, next_y, next_x);
179183 
r6362r6363
201205{
202206   upd3301_t *upd3301 = get_safe_token(device);
203207 
204   int horiz_pix_total = (upd3301->h + upd3301->z) * 8;
208   int horiz_pix_total = (upd3301->h + upd3301->z) * upd3301->width;
205209   int vert_pix_total = (upd3301->l + upd3301->v) * upd3301->r;
206210 
207211   attoseconds_t refresh = HZ_TO_ATTOSECONDS(device->clock) * horiz_pix_total * vert_pix_total;
r6362r6363
210214 
211215   visarea.min_x = 0;
212216   visarea.min_y = 0;
213   visarea.max_x = (upd3301->h * 8) - 1;
217   visarea.max_x = (upd3301->h * upd3301->width) - 1;
214218   visarea.max_y = (upd3301->l * upd3301->r) - 1;
215219 
216220   if (LOG)
r6362r6363
238242 
239243   devcb_call_write_line(&upd3301->out_vrtc_func, param);
240244 
245   if (param && !upd3301->me)
246   {
247      upd3301->status |= UPD3301_STATUS_E;
248      set_interrupt(device, 1);
249   }
250 
241251   update_vrtc_timer(upd3301, param);
242252}
243253 
r6362r6363
434444 
435445WRITE8_DEVICE_HANDLER( upd3301_dack_w )
436446{
447   logerror("DMA WRITE %02x\n", data);
437448}
438449 
439450/*-------------------------------------------------
r6362r6363
442453 
443454void upd3301_update(const device_config *device, bitmap_t *bitmap, const rectangle *cliprect)
444455{
456   upd3301_t *upd3301 = get_safe_token(device);
457 
458   if (upd3301->status & UPD3301_STATUS_VE)
459   {
460      /* start DMA transfer */
461      //devcb_call_write_line(&upd3301->out_drq_func, 1);
462   }
463   else
464   {
465      bitmap_fill(bitmap, cliprect, get_black_pen(device->machine));
466   }
445467}
446468 
447469/*-------------------------------------------------
r6362r6363
463485   upd3301->screen = devtag_get_device(device->machine, intf->screen_tag);
464486   assert(upd3301->screen != NULL);
465487 
488   /* get character width */
489   upd3301->width = intf->width;
490 
466491   /* create the timers */
467492   upd3301->vrtc_timer = timer_alloc(device->machine, vrtc_tick, (void *)device);
468493   upd3301->hrtc_timer = timer_alloc(device->machine, hrtc_tick, (void *)device);

Previous 15994 Revisions Next


© 1998-2018 The MESS Team