Previous 15994 Revisions Next

r9750 Wednesday 8th December, 2010 at 00:43:23 UTC by Cowering
move AC handling to happen immediately instead of after the busy flag timer
[src/mess/video]hd44780.c hd44780.h

src/mess/video/hd44780.c
r9749r9750
114114   m_busy_timer = device_timer_alloc(*this, BUSY_TIMER);
115115   m_blink_timer = device_timer_alloc(*this, BLINKING_TIMER);
116116
117   timer_adjust_periodic(m_blink_timer, ATTOTIME_IN_MSEC(500), 0, ATTOTIME_IN_MSEC(500));
117   timer_adjust_periodic(m_blink_timer, ATTOTIME_IN_MSEC(409), 0, ATTOTIME_IN_MSEC(409));
118118
119119   state_save_register_device_item( this, 0, ac);
120120   state_save_register_device_item( this, 0, ac_mode);
r9749r9750
173173   switch(id)
174174   {
175175      case BUSY_TIMER:
176         if (data_bus_flag)
177         {
178            int new_ac = ac + direction;
179
180            ac = (new_ac < 0) ? 0 : ((new_ac > 0x7f) ? 0x7f : new_ac);
181
182            if (ac_mode == 0)
183            {
184               cursor_pos = ac;
185
186               // display is shifted only after a write
187               if (shift_on && data_bus_flag == 1)
188                  disp_shift += direction;
189            }
190
191            data_bus_flag = 0;
192         }
193
194176         busy_flag = 0;
195177         break;
196178
r9749r9750
205187   busy_flag = 1;
206188
207189   timer_adjust_oneshot( m_busy_timer, ATTOTIME_IN_USEC( usec ), 0 );
190
208191}
209192
210193//**************************************************************************
r9749r9750
364347   return busy_flag<<7 || ac&0x7f;
365348}
366349
367void hd44780_device::data_write(offs_t offset, UINT8 data)
350void hd44780_device::update_ac(void) // data_bus_flag was left as global so old savestates will work
368351{
369   static int lastac = 0;
370   if (lastac != ac_mode) {
371      lastac = ac_mode;
372   }
352int new_ac = ac + direction;
353ac = (new_ac < 0) ? 0 : ((new_ac > 0x7f) ? 0x7f : new_ac);
354if (ac_mode == 0) {
355   cursor_pos = ac;
356   // display is shifted only after a write
357   if (shift_on && data_bus_flag == 1)   disp_shift += direction;
358}
359   data_bus_flag = 0;
360}
373361
374   if (ac_mode == 0)
375      ddram[ac] = data;
376   else {
377      cgram[ac] = data;
378   }
379   data_bus_flag = 1;
380362
363void hd44780_device::data_write(offs_t offset, UINT8 data)
364{
365   if (ac_mode == 0) ddram[ac] = data;
366   else cgram[ac] = data;
367   data_bus_flag = 1;
368   update_ac();
381369   set_busy_flag(41);
382370}
383371
r9749r9750
392380   }
393381
394382   data_bus_flag = 2;
383   update_ac();
395384
396385   set_busy_flag(41);
397386
src/mess/video/hd44780.h
r9749r9750
7979private:
8080   // internal helper
8181   void set_busy_flag(UINT16 usec);
82
82   void update_ac(void);
8383   // internal state
8484   const hd44780_device_config &m_config;
8585   static const device_timer_id BUSY_TIMER = 0;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team