Previous 15994 Revisions Next

r3520 Friday 7th November, 2008 at 17:59:50 UTC by Curt Coder
[MC6845] Readded SY6545-1 stuff.
[src/emu/video]mc6845.c

src/emu/video/mc6845.c
r3519r3520
4444};
4545
4646
47/* mode control bits */
48
49#define MODE_INTERLACED            0x01 /* not supported */
50#define MODE_VIDEO               0x02 /* not supported */
51#define MODE_ROW_COLUMN_ADDRESSING   0x04 /* not supported */
52#define MODE_TRANSPARENT_ADDRESSING   0x08 /* not supported */
53#define MODE_DISPLAY_ENABLE_SKEW   0x10
54#define MODE_CURSOR_SKEW         0x20
55#define MODE_RA4_IS_UPDATE_STROBE   0x40 /* not supported */
56#define MODE_INTERLEAVED_UPDATES   0x80 /* not supported */
57
58
4759/* tags for state saving */
4860static const char * const device_tags[NUM_TYPES] = {     "mc6845", "mc6845-1", "c6545-1", "r6545-1", "h46505", "hd6845", "sy6545-1" };
4961
r3519r3520
5264static const int supports_vert_sync_width[NUM_TYPES]   = { FALSE,       TRUE,      TRUE,      TRUE,    FALSE,     TRUE,       TRUE };
5365static const int supports_status_reg_d5[NUM_TYPES]     = { FALSE,      FALSE,      TRUE,      TRUE,    FALSE,    FALSE,       TRUE };
5466static const int supports_status_reg_d6[NUM_TYPES]     = { FALSE,      FALSE,      TRUE,      TRUE,    FALSE,    FALSE,       TRUE };
67static const int supports_status_reg_d7[NUM_TYPES]     = { FALSE,      FALSE,     FALSE,     FALSE,    FALSE,    FALSE,       TRUE };
5568
5669
5770typedef struct _mc6845_t mc6845_t;
r3519r3520
7790   UINT16   disp_start_addr;   /* 0x0c/0x0d */
7891   UINT16   cursor_addr;      /* 0x0e/0x0f */
7992   UINT16   light_pen_addr;      /* 0x10/0x11 */
93   UINT16   update_addr;      /* 0x12/0x13 */
8094
8195   /* other internal state */
8296   UINT64   clock;
r3519r3520
104118   UINT16   vsync_off_pos;
105119   UINT16  current_disp_addr;   /* the display address currently drawn */
106120   UINT8   light_pen_latched;
121   int      update_ready;
107122   int      has_valid_parameters;
108123};
109124
r3519r3520
159174   if (supports_status_reg_d6[mc6845->device_type] && mc6845->light_pen_latched)
160175      ret = ret | 0x40;
161176
177   /* update ready */
178   if (supports_status_reg_d7[mc6845->device_type] && mc6845->update_ready)
179      ret = ret | 0x80;
180
162181   return ret;
163182}
164183
r3519r3520
176195      case 0x0f:  ret = (mc6845->cursor_addr    >> 0) & 0xff; break;
177196      case 0x10:  ret = (mc6845->light_pen_addr >> 8) & 0xff; mc6845->light_pen_latched = FALSE; break;
178197      case 0x11:  ret = (mc6845->light_pen_addr >> 0) & 0xff; mc6845->light_pen_latched = FALSE; break;
198      case 0x1f:  mc6845->update_ready = 0; mc6845->update_addr = (mc6845->update_addr + 1) & 0x3fff; break;
179199
180200      /* all other registers are write only and return 0 */
181201      default: break;
r3519r3520
211231      case 0x0f:  mc6845->cursor_addr      = ((data & 0xff) << 0) | (mc6845->cursor_addr & 0xff00); break;
212232      case 0x10: /* read-only */ break;
213233      case 0x11: /* read-only */ break;
234      case 0x12:  mc6845->update_addr      = ((data & 0x3f) << 8) | (mc6845->update_addr & 0x00ff); break;
235      case 0x13:  mc6845->update_addr      = ((data & 0xff) << 0) | (mc6845->update_addr & 0xff00); break;
236      case 0x1f:  mc6845->update_ready = 0; mc6845->update_addr = (mc6845->update_addr + 1) & 0x3fff; break;
214237      default: break;
215238   }
216239
217   /* display message if the Mode Control register is not zero */
218   if ((mc6845->register_address_latch == 0x08) && (mc6845->mode_control != 0))
240   /* display message if the Mode Control register has unsupported bits active */
241   if ((mc6845->register_address_latch == 0x08) && (mc6845->mode_control & ~(MODE_DISPLAY_ENABLE_SKEW | MODE_CURSOR_SKEW)))
219242      popmessage("Mode Control %02X is not supported!!!", mc6845->mode_control);
220243
221244   recompute_parameters(mc6845, FALSE);
r3519r3520
354377            next_y = 0;
355378      }
356379
380      /* delay display enable for 1 character time if skew is enabled */
381      if (mc6845->mode_control & MODE_DISPLAY_ENABLE_SKEW)
382         next_x += mc6845->hpixels_per_column;
383
357384      if (next_y != -1)
358385         duration = video_screen_get_time_until_pos(mc6845->screen, next_y, next_x);
359386      else
r3519r3520
651678         /* compute the cursor X position, or -1 if not visible */
652679         INT8 cursor_x = cursor_visible ? (mc6845->cursor_addr - mc6845->current_disp_addr) : -1;
653680
681         /* delay cursor for 1 character time if skew is enabled */
682         if (mc6845->mode_control & MODE_CURSOR_SKEW)
683            cursor_x += mc6845->hpixels_per_column;
684
654685         /* call the external system to draw it */
655686         mc6845->intf->update_row(device, bitmap, cliprect, mc6845->current_disp_addr, ra, y, mc6845->horiz_disp, cursor_x, param);
656687
r3519r3520
742773   state_save_register_item(unique_tag, 0, mc6845->light_pen_latched);
743774   state_save_register_item(unique_tag, 0, mc6845->cursor_state);
744775   state_save_register_item(unique_tag, 0, mc6845->cursor_blink_count);
776   state_save_register_item(unique_tag, 0, mc6845->update_addr);
777   state_save_register_item(unique_tag, 0, mc6845->update_ready);
745778
746779   return DEVICE_START_OK;
747780}

Previous 15994 Revisions Next


© 1998-2018 The MESS Team