Previous 199869 Revisions Next

r29186 Wednesday 2nd April, 2014 at 13:39:36 UTC by Curt Coder
i8275x: Cleanup. (nw)
[src/emu/video]i8275x.c

trunk/src/emu/video/i8275x.c
r29185r29186
2525//  MACROS / CONSTANTS
2626//**************************************************************************
2727
28#define LOG 0
29
30
2831const int DMA_BURST_SPACING[] = { 0, 7, 15, 23, 31, 39, 47, 55 };
2932
33
3034#define DOUBLE_SPACED_ROWS \
3135   BIT(m_param[REG_SCN1], 7)
3236
r29185r29186
6670
6771
6872//**************************************************************************
69//  somethign
73//  DEVICE DEFINITIONS
7074//**************************************************************************
7175
7276// device type definition
7377const device_type I8275x = &device_creator<i8275x_device>;
7478
7579
80
7681//**************************************************************************
7782//  LIVE DEVICE
7883//**************************************************************************
r29185r29186
8186//  i8275x_device - constructor
8287//-------------------------------------------------
8388
84i8275x_device::i8275x_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
85   : device_t(mconfig, I8275x, "I8275", tag, owner, clock, "i8275x", __FILE__),
86      device_video_interface(mconfig, *this),
87      m_write_irq(*this),
88      m_write_drq(*this),
89      m_write_hrtc(*this),
90      m_write_vrtc(*this),
91      m_display_cb(NULL),
92      m_status(0),
93      m_param_idx(0),
94      m_param_end(0),
95      m_buffer_idx(0),
96      m_fifo_next(false),
97      m_buffer_dma(0),
98      m_lpen(0),
99      m_hlgt(0),
100      m_vsp(0),
101      m_gpa(0),
102      m_rvv(0),
103      m_lten(0),
104      m_scanline(0),
105      m_du(false),
106      m_cursor_blink(0),
107      m_char_blink(0)
89i8275x_device::i8275x_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
90   device_t(mconfig, I8275x, "I8275", tag, owner, clock, "i8275x", __FILE__),
91   device_video_interface(mconfig, *this),
92   m_write_irq(*this),
93   m_write_drq(*this),
94   m_write_hrtc(*this),
95   m_write_vrtc(*this),
96   m_display_cb(NULL),
97   m_status(0),
98   m_param_idx(0),
99   m_param_end(0),
100   m_buffer_idx(0),
101   m_fifo_next(false),
102   m_buffer_dma(0),
103   m_lpen(0),
104   m_hlgt(0),
105   m_vsp(0),
106   m_gpa(0),
107   m_rvv(0),
108   m_lten(0),
109   m_scanline(0),
110   m_du(false),
111   m_cursor_blink(0),
112   m_char_blink(0)
108113{
109114}
110115
r29185r29186
173178   switch (id)
174179   {
175180   case TIMER_HRTC_ON:
176      //logerror("I8275 '%s' y %u x %u HRTC 1\n", tag(), y, x);
181      //if (LOG) logerror("I8275 '%s' y %u x %u HRTC 1\n", tag(), y, x);
177182      m_write_hrtc(1);
178183      break;
179184
180185   case TIMER_DRQ_ON:
181      //logerror("I8275 '%s' y %u x %u DRQ 1\n", tag(), y, x);
186      //if (LOG) logerror("I8275 '%s' y %u x %u DRQ 1\n", tag(), y, x);
182187      m_write_drq(1);
183188      m_drq_off_timer->adjust(clocks_to_attotime(DMA_BURST_COUNT));
184189      break;
r29185r29186
188193      {
189194         m_status |= ST_DU;
190195         m_du = true;
191         //logerror("I8275 '%s' y %u x %u DRQ 0\n", tag(), y, x);
196         //if (LOG) logerror("I8275 '%s' y %u x %u DRQ 0\n", tag(), y, x);
192197         m_write_drq(0);
193198      }
194199      else if (m_buffer_idx == CHARACTERS_PER_ROW)
195200      {
196         //logerror("I8275 '%s' y %u x %u DRQ 0\n", tag(), y, x);
201         //if (LOG) logerror("I8275 '%s' y %u x %u DRQ 0\n", tag(), y, x);
197202         m_write_drq(0);
198203      }
199204      else if (DMA_BURST_SPACE > 0)
200205      {
201         //logerror("I8275 '%s' y %u x %u DRQ 0\n", tag(), y, x);
206         //if (LOG) logerror("I8275 '%s' y %u x %u DRQ 0\n", tag(), y, x);
202207         m_write_drq(0);
203208         m_drq_on_timer->adjust(clocks_to_attotime(DMA_BURST_SPACE));
204209      }
r29185r29186
207212   case TIMER_SCANLINE:
208213      if (!(m_status & ST_VE)) break;
209214
210      //logerror("I8275 '%s' y %u x %u HRTC 0\n", tag(), y, x);
215      //if (LOG) logerror("I8275 '%s' y %u x %u HRTC 0\n", tag(), y, x);
211216      m_write_hrtc(0);
212217
213218      if (m_scanline == 0)
214219      {
215         //logerror("I8275 '%s' y %u x %u VRTC 0\n", tag(), y, x);
220         //if (LOG) logerror("I8275 '%s' y %u x %u VRTC 0\n", tag(), y, x);
216221         m_write_vrtc(0);
217222      }
218223      else if (m_scanline == m_irq_scanline)
219224      {
220225         if (m_status & ST_IE)
221226         {
222            //logerror("I8275 '%s' y %u x %u IRQ 1\n", tag(), y, x);
227            //if (LOG) logerror("I8275 '%s' y %u x %u IRQ 1\n", tag(), y, x);
223228            m_status |= ST_IR;
224229            m_write_irq(ASSERT_LINE);
225230         }
226231      }
227232      else if (m_scanline == m_vrtc_scanline)
228233      {
229         //logerror("I8275 '%s' y %u x %u VRTC 1\n", tag(), y, x);
234         //if (LOG) logerror("I8275 '%s' y %u x %u VRTC 1\n", tag(), y, x);
230235         m_write_vrtc(1);
231236
232237         // reset field attributes
r29185r29186
366371
367372      if (m_status & ST_IR)
368373      {
369         //logerror("I8275 '%s' IRQ 0\n", tag());
374         //if (LOG) logerror("I8275 '%s' IRQ 0\n", tag());
370375         m_write_irq(CLEAR_LINE);
371376      }
372377
r29185r29186
395400{
396401   if (offset & 0x01)
397402   {
398      logerror("I8275 '%s' Command %02x\n", tag(), data);
403      if (LOG) logerror("I8275 '%s' Command %02x\n", tag(), data);
399404
400405      switch (data >> 5)
401406      {
402407      case CMD_RESET:
403         logerror("I8275 '%s' Reset\n", tag());
408         if (LOG) logerror("I8275 '%s' Reset\n", tag());
404409
405410         m_status &= ~ST_IE;
406         logerror("I8275 '%s' IRQ 0\n", tag());
411         if (LOG) logerror("I8275 '%s' IRQ 0\n", tag());
407412         m_write_irq(CLEAR_LINE);
408413
409414         m_param_idx = REG_SCN1;
r29185r29186
413418      case CMD_START_DISPLAY:
414419         {
415420            m_param[REG_DMA] = data;
416            logerror("I8275 '%s' Start Display %u %u\n", tag(), DMA_BURST_COUNT, DMA_BURST_SPACE);
421            if (LOG) logerror("I8275 '%s' Start Display %u %u\n", tag(), DMA_BURST_COUNT, DMA_BURST_SPACE);
417422            m_status |= (ST_IE | ST_VE);
418423         }
419424         break;
420425
421426      case CMD_STOP_DISPLAY:
422         logerror("I8275 '%s' Stop Display\n", tag());
427         if (LOG) logerror("I8275 '%s' Stop Display\n", tag());
423428         m_status &= ~ST_VE;
424429         break;
425430
426431      case CMD_READ_LIGHT_PEN:
427         logerror("I8275 '%s' Read Light Pen\n", tag());
432         if (LOG) logerror("I8275 '%s' Read Light Pen\n", tag());
428433         m_param_idx = REG_LPEN_COL;
429434         m_param_end = REG_LPEN_ROW;
430435         break;
431436
432437      case CMD_LOAD_CURSOR:
433         logerror("I8275 '%s' Load Cursor\n", tag());
438         if (LOG) logerror("I8275 '%s' Load Cursor\n", tag());
434439         m_param_idx = REG_CUR_COL;
435440         m_param_end = REG_CUR_ROW;
436441         break;
437442
438443      case CMD_ENABLE_INTERRUPT:
439         logerror("I8275 '%s' Enable Interrupt\n", tag());
444         if (LOG) logerror("I8275 '%s' Enable Interrupt\n", tag());
440445         m_status |= ST_IE;
441446         break;
442447
443448      case CMD_DISABLE_INTERRUPT:
444         logerror("I8275 '%s' Disable Interrupt\n", tag());
449         if (LOG) logerror("I8275 '%s' Disable Interrupt\n", tag());
445450         m_status &= ~ST_IE;
446451         break;
447452
448453      case CMD_PRESET_COUNTERS:
449         logerror("I8275 '%s' Preset Counters\n", tag());
454         if (LOG) logerror("I8275 '%s' Preset Counters\n", tag());
450455         m_scanline = 0;
451456         break;
452457      }
453458   }
454459   else
455460   {
456      logerror("I8275 '%s' Parameter %02x\n", tag(), data);
461      if (LOG) logerror("I8275 '%s' Parameter %02x\n", tag(), data);
457462
458463      m_param[m_param_idx] = data;
459464
r29185r29186
473478
474479WRITE8_MEMBER( i8275x_device::dack_w )
475480{
476   //logerror("DACK write %02x %u\n", data, m_buffer_idx);
481   //if (LOG) logerror("DACK write %02x %u\n", data, m_buffer_idx);
477482
478483   if (m_fifo_next)
479484   {
r29185r29186
553558   int max_visible_x = (CHARACTERS_PER_ROW * m_hpixels_per_column) - 1;
554559   int max_visible_y = (CHARACTER_ROWS_PER_FRAME * SCANLINES_PER_ROW) - 1;
555560
556   logerror("width %u height %u max_x %u max_y %u refresh %f\n", horiz_pix_total, vert_pix_total, max_visible_x, max_visible_y, 1 / ATTOSECONDS_TO_DOUBLE(refresh));
561   if (LOG) logerror("width %u height %u max_x %u max_y %u refresh %f\n", horiz_pix_total, vert_pix_total, max_visible_x, max_visible_y, 1 / ATTOSECONDS_TO_DOUBLE(refresh));
557562
558563   rectangle visarea;
559564   visarea.set(0, max_visible_x, 0, max_visible_y);

Previous 199869 Revisions Next


© 1997-2024 The MAME Team