src/emu/video/mc6845.c
| r2066 | r2067 | |
| 32 | 32 | /* device types */ |
| 33 | 33 | enum |
| 34 | 34 | { |
| 35 | | TYPE_MC6845, |
| 35 | TYPE_MC6845 = 0, |
| 36 | 36 | TYPE_MC6845_1, |
| 37 | 37 | TYPE_C6545_1, |
| 38 | 38 | TYPE_R6545_1, |
| r2066 | r2067 | |
| 79 | 79 | UINT16 light_pen_addr; /* 0x10/0x11 */ |
| 80 | 80 | |
| 81 | 81 | /* other internal state */ |
| 82 | UINT64 clock; |
| 82 | 83 | UINT8 register_address_latch; |
| 83 | 84 | UINT8 cursor_state; /* 0 = off, 1 = on */ |
| 84 | 85 | UINT8 cursor_blink_count; |
| r2066 | r2067 | |
| 119 | 120 | assert(device != NULL); |
| 120 | 121 | assert(device->token != NULL); |
| 121 | 122 | assert((device->type == DEVICE_GET_INFO_NAME(mc6845)) || |
| 123 | (device->type == DEVICE_GET_INFO_NAME(mc6845_1)) || |
| 122 | 124 | (device->type == DEVICE_GET_INFO_NAME(c6545_1)) || |
| 123 | | (device->type == DEVICE_GET_INFO_NAME(r6545_1))); |
| 125 | (device->type == DEVICE_GET_INFO_NAME(r6545_1)) || |
| 126 | (device->type == DEVICE_GET_INFO_NAME(h46505)) || |
| 127 | (device->type == DEVICE_GET_INFO_NAME(hd6845)) || |
| 128 | (device->type == DEVICE_GET_INFO_NAME(sy6545_1))); |
| 124 | 129 | |
| 125 | 130 | return (mc6845_t *)device->token; |
| 126 | 131 | } |
| r2066 | r2067 | |
| 268 | 273 | { |
| 269 | 274 | rectangle visarea; |
| 270 | 275 | |
| 271 | | attoseconds_t refresh = HZ_TO_ATTOSECONDS(mc6845->intf->clock) * (mc6845->horiz_char_total + 1) * vert_pix_total; |
| 276 | attoseconds_t refresh = HZ_TO_ATTOSECONDS(mc6845->clock) * (mc6845->horiz_char_total + 1) * vert_pix_total; |
| 272 | 277 | |
| 273 | 278 | visarea.min_x = 0; |
| 274 | 279 | visarea.min_y = 0; |
| r2066 | r2067 | |
| 544 | 549 | } |
| 545 | 550 | |
| 546 | 551 | |
| 552 | void mc6845_set_clock(const device_config *device, int clock) |
| 553 | { |
| 554 | mc6845_t *mc6845 = get_safe_token(device); |
| 555 | |
| 556 | /* validate arguments */ |
| 557 | assert(clock > 0); |
| 558 | |
| 559 | if (clock != mc6845->clock) |
| 560 | { |
| 561 | mc6845->clock = clock; |
| 562 | recompute_parameters(mc6845, FALSE); |
| 563 | } |
| 564 | } |
| 565 | |
| 566 | |
| 547 | 567 | static void update_cursor_state(mc6845_t *mc6845) |
| 548 | 568 | { |
| 549 | 569 | /* save and increment cursor counter */ |
| r2066 | r2067 | |
| 657 | 677 | assert(mc6845->intf->clock > 0); |
| 658 | 678 | assert(mc6845->intf->hpixels_per_column > 0); |
| 659 | 679 | |
| 680 | /* copy the initial clock */ |
| 681 | mc6845->clock = mc6845->intf->clock; |
| 682 | |
| 660 | 683 | /* get the screen device */ |
| 661 | 684 | mc6845->screen = device_list_find_by_tag(device->machine->config->devicelist, VIDEO_SCREEN, mc6845->intf->screen_tag); |
| 662 | 685 | assert(mc6845->screen != NULL); |
| r2066 | r2067 | |
| 685 | 708 | |
| 686 | 709 | state_save_register_func_postload_ptr(mc6845_state_save_postload, mc6845); |
| 687 | 710 | |
| 711 | state_save_register_item(unique_tag, 0, mc6845->clock); |
| 688 | 712 | state_save_register_item(unique_tag, 0, mc6845->register_address_latch); |
| 689 | 713 | state_save_register_item(unique_tag, 0, mc6845->horiz_char_total); |
| 690 | 714 | state_save_register_item(unique_tag, 0, mc6845->horiz_disp); |
src/emu/video/mc6845.h
| r2066 | r2067 | |
| 107 | 107 | /* simulates the LO->HI clocking of the light pen pin (pin 3) */ |
| 108 | 108 | void mc6845_assert_light_pen_input(const device_config *device); |
| 109 | 109 | |
| 110 | /* set the clock (pin 21) of the chip */ |
| 111 | void mc6845_set_clock(const device_config *device, int clock); |
| 112 | |
| 110 | 113 | /* updates the screen -- this will call begin_update(), |
| 111 | 114 | followed by update_row() reapeatedly and after all row |
| 112 | 115 | updating is complete, end_update() */ |