src/mess/video/crtc_ega.c
| r3758 | r3759 | |
| 705 | 705 | |
| 706 | 706 | /* create the timers */ |
| 707 | 707 | if (crtc_ega->intf->on_de_changed != NULL) |
| 708 | | crtc_ega->de_changed_timer = timer_alloc(machine, de_changed_timer_cb, (void *)device); |
| 708 | crtc_ega->de_changed_timer = timer_alloc(device->machine, de_changed_timer_cb, (void *)device); |
| 709 | 709 | |
| 710 | 710 | if (crtc_ega->intf->on_hsync_changed != NULL) |
| 711 | 711 | { |
| 712 | | crtc_ega->hsync_on_timer = timer_alloc(machine, hsync_on_timer_cb, (void *)device); |
| 713 | | crtc_ega->hsync_off_timer = timer_alloc(machine, hsync_off_timer_cb, (void *)device); |
| 712 | crtc_ega->hsync_on_timer = timer_alloc(device->machine, hsync_on_timer_cb, (void *)device); |
| 713 | crtc_ega->hsync_off_timer = timer_alloc(device->machine, hsync_off_timer_cb, (void *)device); |
| 714 | 714 | } |
| 715 | 715 | |
| 716 | 716 | if (crtc_ega->intf->on_vsync_changed != NULL) |
| 717 | 717 | { |
| 718 | | crtc_ega->vsync_on_timer = timer_alloc(machine, vsync_on_timer_cb, (void *)device); |
| 719 | | crtc_ega->vsync_off_timer = timer_alloc(machine, vsync_off_timer_cb, (void *)device); |
| 718 | crtc_ega->vsync_on_timer = timer_alloc(device->machine, vsync_on_timer_cb, (void *)device); |
| 719 | crtc_ega->vsync_off_timer = timer_alloc(device->machine, vsync_off_timer_cb, (void *)device); |
| 720 | 720 | } |
| 721 | 721 | } |
| 722 | 722 | |
| 723 | | crtc_ega->light_pen_latch_timer = timer_alloc(machine, light_pen_latch_timer_cb, (void *)device); |
| 723 | crtc_ega->light_pen_latch_timer = timer_alloc(device->machine, light_pen_latch_timer_cb, (void *)device); |
| 724 | 724 | |
| 725 | 725 | /* register for state saving */ |
| 726 | 726 | |
| 727 | 727 | state_save_register_postload(device->machine, crtc_ega_state_save_postload, crtc_ega); |
| 728 | 728 | |
| 729 | | state_save_register_item(device->tag, NULL, 0, crtc_ega->clock); |
| 730 | | state_save_register_item(device->tag, NULL, 0, crtc_ega->hpixels_per_column); |
| 731 | | state_save_register_item(device->tag, NULL, 0, crtc_ega->register_address_latch); |
| 732 | | state_save_register_item(device->tag, NULL, 0, crtc_ega->horiz_char_total); |
| 733 | | state_save_register_item(device->tag, NULL, 0, crtc_ega->horiz_disp); |
| 734 | | state_save_register_item(device->tag, NULL, 0, crtc_ega->horiz_blank_start); |
| 735 | | state_save_register_item(device->tag, NULL, 0, crtc_ega->mode_control); |
| 736 | | state_save_register_item(device->tag, NULL, 0, crtc_ega->cursor_start_ras); |
| 737 | | state_save_register_item(device->tag, NULL, 0, crtc_ega->cursor_end_ras); |
| 738 | | state_save_register_item(device->tag, NULL, 0, crtc_ega->disp_start_addr); |
| 739 | | state_save_register_item(device->tag, NULL, 0, crtc_ega->cursor_addr); |
| 740 | | state_save_register_item(device->tag, NULL, 0, crtc_ega->light_pen_addr); |
| 741 | | state_save_register_item(device->tag, NULL, 0, crtc_ega->light_pen_latched); |
| 742 | | state_save_register_item(device->tag, NULL, 0, crtc_ega->cursor_state); |
| 743 | | state_save_register_item(device->tag, NULL, 0, crtc_ega->cursor_blink_count); |
| 744 | | state_save_register_item(device->tag, NULL, 0, crtc_ega->horiz_blank_end); |
| 745 | | state_save_register_item(device->tag, NULL, 0, crtc_ega->ena_vert_access); |
| 746 | | state_save_register_item(device->tag, NULL, 0, crtc_ega->de_skew); |
| 747 | | state_save_register_item(device->tag, NULL, 0, crtc_ega->horiz_retr_start); |
| 748 | | state_save_register_item(device->tag, NULL, 0, crtc_ega->horiz_retr_end); |
| 749 | | state_save_register_item(device->tag, NULL, 0, crtc_ega->horiz_retr_skew); |
| 750 | | state_save_register_item(device->tag, NULL, 0, crtc_ega->vert_total); |
| 751 | | state_save_register_item(device->tag, NULL, 0, crtc_ega->preset_row_scan); |
| 752 | | state_save_register_item(device->tag, NULL, 0, crtc_ega->byte_panning); |
| 753 | | state_save_register_item(device->tag, NULL, 0, crtc_ega->max_ras_addr); |
| 754 | | state_save_register_item(device->tag, NULL, 0, crtc_ega->scan_doubling); |
| 755 | | state_save_register_item(device->tag, NULL, 0, crtc_ega->cursor_disable); |
| 756 | | state_save_register_item(device->tag, NULL, 0, crtc_ega->cursor_skew); |
| 757 | | state_save_register_item(device->tag, NULL, 0, crtc_ega->vert_retr_start); |
| 758 | | state_save_register_item(device->tag, NULL, 0, crtc_ega->vert_retr_end); |
| 759 | | state_save_register_item(device->tag, NULL, 0, crtc_ega->protect); |
| 760 | | state_save_register_item(device->tag, NULL, 0, crtc_ega->bandwidth); |
| 761 | | state_save_register_item(device->tag, NULL, 0, crtc_ega->vert_disp_end); |
| 762 | | state_save_register_item(device->tag, NULL, 0, crtc_ega->offset); |
| 763 | | state_save_register_item(device->tag, NULL, 0, crtc_ega->underline_loc); |
| 764 | | state_save_register_item(device->tag, NULL, 0, crtc_ega->vert_blank_start); |
| 765 | | state_save_register_item(device->tag, NULL, 0, crtc_ega->vert_blank_end); |
| 766 | | state_save_register_item(device->tag, NULL, 0, crtc_ega->line_compare); |
| 729 | state_save_register_item(device->machine, device->tag, NULL, 0, crtc_ega->clock); |
| 730 | state_save_register_item(device->machine, device->tag, NULL, 0, crtc_ega->hpixels_per_column); |
| 731 | state_save_register_item(device->machine, device->tag, NULL, 0, crtc_ega->register_address_latch); |
| 732 | state_save_register_item(device->machine, device->tag, NULL, 0, crtc_ega->horiz_char_total); |
| 733 | state_save_register_item(device->machine, device->tag, NULL, 0, crtc_ega->horiz_disp); |
| 734 | state_save_register_item(device->machine, device->tag, NULL, 0, crtc_ega->horiz_blank_start); |
| 735 | state_save_register_item(device->machine, device->tag, NULL, 0, crtc_ega->mode_control); |
| 736 | state_save_register_item(device->machine, device->tag, NULL, 0, crtc_ega->cursor_start_ras); |
| 737 | state_save_register_item(device->machine, device->tag, NULL, 0, crtc_ega->cursor_end_ras); |
| 738 | state_save_register_item(device->machine, device->tag, NULL, 0, crtc_ega->disp_start_addr); |
| 739 | state_save_register_item(device->machine, device->tag, NULL, 0, crtc_ega->cursor_addr); |
| 740 | state_save_register_item(device->machine, device->tag, NULL, 0, crtc_ega->light_pen_addr); |
| 741 | state_save_register_item(device->machine, device->tag, NULL, 0, crtc_ega->light_pen_latched); |
| 742 | state_save_register_item(device->machine, device->tag, NULL, 0, crtc_ega->cursor_state); |
| 743 | state_save_register_item(device->machine, device->tag, NULL, 0, crtc_ega->cursor_blink_count); |
| 744 | state_save_register_item(device->machine, device->tag, NULL, 0, crtc_ega->horiz_blank_end); |
| 745 | state_save_register_item(device->machine, device->tag, NULL, 0, crtc_ega->ena_vert_access); |
| 746 | state_save_register_item(device->machine, device->tag, NULL, 0, crtc_ega->de_skew); |
| 747 | state_save_register_item(device->machine, device->tag, NULL, 0, crtc_ega->horiz_retr_start); |
| 748 | state_save_register_item(device->machine, device->tag, NULL, 0, crtc_ega->horiz_retr_end); |
| 749 | state_save_register_item(device->machine, device->tag, NULL, 0, crtc_ega->horiz_retr_skew); |
| 750 | state_save_register_item(device->machine, device->tag, NULL, 0, crtc_ega->vert_total); |
| 751 | state_save_register_item(device->machine, device->tag, NULL, 0, crtc_ega->preset_row_scan); |
| 752 | state_save_register_item(device->machine, device->tag, NULL, 0, crtc_ega->byte_panning); |
| 753 | state_save_register_item(device->machine, device->tag, NULL, 0, crtc_ega->max_ras_addr); |
| 754 | state_save_register_item(device->machine, device->tag, NULL, 0, crtc_ega->scan_doubling); |
| 755 | state_save_register_item(device->machine, device->tag, NULL, 0, crtc_ega->cursor_disable); |
| 756 | state_save_register_item(device->machine, device->tag, NULL, 0, crtc_ega->cursor_skew); |
| 757 | state_save_register_item(device->machine, device->tag, NULL, 0, crtc_ega->vert_retr_start); |
| 758 | state_save_register_item(device->machine, device->tag, NULL, 0, crtc_ega->vert_retr_end); |
| 759 | state_save_register_item(device->machine, device->tag, NULL, 0, crtc_ega->protect); |
| 760 | state_save_register_item(device->machine, device->tag, NULL, 0, crtc_ega->bandwidth); |
| 761 | state_save_register_item(device->machine, device->tag, NULL, 0, crtc_ega->vert_disp_end); |
| 762 | state_save_register_item(device->machine, device->tag, NULL, 0, crtc_ega->offset); |
| 763 | state_save_register_item(device->machine, device->tag, NULL, 0, crtc_ega->underline_loc); |
| 764 | state_save_register_item(device->machine, device->tag, NULL, 0, crtc_ega->vert_blank_start); |
| 765 | state_save_register_item(device->machine, device->tag, NULL, 0, crtc_ega->vert_blank_end); |
| 766 | state_save_register_item(device->machine, device->tag, NULL, 0, crtc_ega->line_compare); |
| 767 | 767 | } |
| 768 | 768 | |
| 769 | 769 | |
src/mess/video/pc_cga.c
| r3758 | r3759 | |
| 546 | 546 | { |
| 547 | 547 | UINT16 *p = BITMAP_ADDR16(bitmap, y, 0); |
| 548 | 548 | int i; |
| 549 | running_machine *machine = device->machine; |
| 549 | 550 | |
| 550 | 551 | if ( y == 0 ) CGA_LOG(1,"cga_text_inten_update_row",("\n")); |
| 551 | 552 | for ( i = 0; i < x_count; i++ ) |
| r3758 | r3759 | |
| 583 | 584 | { |
| 584 | 585 | UINT16 *p = BITMAP_ADDR16(bitmap, y, 0); |
| 585 | 586 | int i; |
| 587 | running_machine *machine = device->machine; |
| 586 | 588 | |
| 587 | 589 | if ( y == 0 ) CGA_LOG(1,"cga_text_inten_update_row",("\n")); |
| 588 | 590 | for ( i = 0; i < x_count; i++ ) |
| r3758 | r3759 | |
| 619 | 621 | { |
| 620 | 622 | UINT16 *p = BITMAP_ADDR16(bitmap, y, 0); |
| 621 | 623 | int i; |
| 624 | running_machine *machine = device->machine; |
| 622 | 625 | |
| 623 | 626 | if ( y == 0 ) CGA_LOG(1,"cga_text_inten_alt_update_row",("\n")); |
| 624 | 627 | for ( i = 0; i < x_count; i++ ) |
| r3758 | r3759 | |
| 655 | 658 | { |
| 656 | 659 | UINT16 *p = BITMAP_ADDR16(bitmap, y, 0); |
| 657 | 660 | int i; |
| 661 | running_machine *machine = device->machine; |
| 658 | 662 | |
| 659 | 663 | if ( y == 0 ) CGA_LOG(1,"cga_text_blink_update_row",("\n")); |
| 660 | 664 | for ( i = 0; i < x_count; i++ ) |
| r3758 | r3759 | |
| 702 | 706 | { |
| 703 | 707 | UINT16 *p = BITMAP_ADDR16(bitmap, y, 0); |
| 704 | 708 | int i; |
| 709 | running_machine *machine = device->machine; |
| 705 | 710 | |
| 706 | 711 | if ( y == 0 ) CGA_LOG(1,"cga_text_blink_alt_update_row",("\n")); |
| 707 | 712 | for ( i = 0; i < x_count; i++ ) |
| r3758 | r3759 | |
| 747 | 752 | { |
| 748 | 753 | UINT16 *p = BITMAP_ADDR16(bitmap, y, 0); |
| 749 | 754 | int i; |
| 755 | running_machine *machine = device->machine; |
| 750 | 756 | |
| 751 | 757 | if ( y == 0 ) CGA_LOG(1,"cga_gfx_4bppl_update_row",("\n")); |
| 752 | 758 | for ( i = 0; i < x_count; i++ ) |
| r3758 | r3759 | |
| 805 | 811 | int samp_index = 0; |
| 806 | 812 | UINT16 *p = BITMAP_ADDR16(bitmap, y, 0); |
| 807 | 813 | int i; |
| 814 | running_machine *machine = device->machine; |
| 808 | 815 | |
| 809 | 816 | if ( y == 0 ) CGA_LOG(1,"cga_gfx_4bpph_update_row",("\n")); |
| 810 | 817 | if ( NTSC_FILTER ) |
| r3758 | r3759 | |
| 907 | 914 | { |
| 908 | 915 | UINT16 *p = BITMAP_ADDR16(bitmap, y, 0); |
| 909 | 916 | int i; |
| 917 | running_machine *machine = device->machine; |
| 910 | 918 | |
| 911 | 919 | if ( y == 0 ) CGA_LOG(1,"cga_gfx_2bpp_update_row",("\n")); |
| 912 | 920 | for ( i = 0; i < x_count; i++ ) |
| r3758 | r3759 | |
| 941 | 949 | UINT16 *p = BITMAP_ADDR16(bitmap, y, 0); |
| 942 | 950 | UINT8 fg = cga.color_select & 0x0F; |
| 943 | 951 | int i; |
| 952 | running_machine *machine = device->machine; |
| 944 | 953 | |
| 945 | 954 | if ( y == 0 ) CGA_LOG(1,"cga_gfx_1bpp_update_row",("\n")); |
| 946 | 955 | for ( i = 0; i < x_count; i++ ) |
| r3758 | r3759 | |
| 1156 | 1165 | /* |
| 1157 | 1166 | * ?W reserved for color select register on color adapter |
| 1158 | 1167 | */ |
| 1159 | | static void pc_cga_color_select_w(int data) |
| 1168 | static void pc_cga_color_select_w(running_machine *machine, int data) |
| 1160 | 1169 | { |
| 1161 | 1170 | CGA_LOG(1,"CGA_color_select_w",("$%02x\n", data)); |
| 1162 | 1171 | cga.color_select = data; |
| r3758 | r3759 | |
| 1169 | 1178 | /* |
| 1170 | 1179 | * Select Plantronics modes |
| 1171 | 1180 | */ |
| 1172 | | static void pc_cga_plantronics_w(int data) |
| 1181 | static void pc_cga_plantronics_w(running_machine *machine, int data) |
| 1173 | 1182 | { |
| 1174 | 1183 | CGA_LOG(1,"CGA_plantronics_w",("$%02x\n", data)); |
| 1175 | 1184 | |
| r3758 | r3759 | |
| 1227 | 1236 | pc_cga_mode_control_w(space->machine, data); |
| 1228 | 1237 | break; |
| 1229 | 1238 | case 9: |
| 1230 | | pc_cga_color_select_w(data); |
| 1239 | pc_cga_color_select_w(space->machine, data); |
| 1231 | 1240 | break; |
| 1232 | 1241 | case 0x0d: |
| 1233 | | pc_cga_plantronics_w(data); |
| 1242 | pc_cga_plantronics_w(space->machine, data); |
| 1234 | 1243 | break; |
| 1235 | 1244 | } |
| 1236 | 1245 | } |
| r3758 | r3759 | |
| 1457 | 1466 | UINT16 *p = BITMAP_ADDR16(bitmap, y, 0); |
| 1458 | 1467 | UINT16 offset_base = ra << 13; |
| 1459 | 1468 | int i; |
| 1469 | running_machine *machine = device->machine; |
| 1460 | 1470 | |
| 1461 | 1471 | if ( y == 0 ) CGA_LOG(1,"pc1512_gfx_4bpp_update_row",("\n")); |
| 1462 | 1472 | for ( i = 0; i < x_count; i++ ) |
src/mess/machine/pc.c
| r3758 | r3759 | |
| 229 | 229 | { |
| 230 | 230 | if ( cpu_get_reg( device->machine->cpu[0], REG_PC ) == 0xF0454 ) |
| 231 | 231 | { |
| 232 | | timer_adjust_oneshot( pc_int_delay_timer, cpu_clocks_to_attotime(machine->cpu[0], 1), interrupt ); |
| 232 | timer_adjust_oneshot( pc_int_delay_timer, cpu_clocks_to_attotime(device->machine->cpu[0], 1), interrupt ); |
| 233 | 233 | } |
| 234 | 234 | else |
| 235 | 235 | { |
| r3758 | r3759 | |
| 574 | 574 | } |
| 575 | 575 | |
| 576 | 576 | |
| 577 | | static void pcjr_keyb_init(void) |
| 577 | static void pcjr_keyb_init(running_machine *machine) |
| 578 | 578 | { |
| 579 | 579 | pcjr_keyb.transferring = 0; |
| 580 | 580 | pcjr_keyb.latch = 0; |
| r3758 | r3759 | |
| 660 | 660 | static READ8_DEVICE_HANDLER (ibm5150_ppi_porta_r) |
| 661 | 661 | { |
| 662 | 662 | int data = 0xFF; |
| 663 | running_machine *machine = device->machine; |
| 663 | 664 | |
| 664 | 665 | /* KB port A */ |
| 665 | 666 | if (pc_ppi.keyboard_clear) |
| r3758 | r3759 | |
| 702 | 703 | static READ8_DEVICE_HANDLER (ibm5150_ppi_portb_r ) |
| 703 | 704 | { |
| 704 | 705 | int data; |
| 706 | running_machine *machine = device->machine; |
| 705 | 707 | |
| 706 | 708 | data = 0xff; |
| 707 | 709 | PIO_LOG(1,"PIO_B_r",("$%02x\n", data)); |
| r3758 | r3759 | |
| 713 | 715 | { |
| 714 | 716 | int timer2_output = pit8253_get_output( pc_devices.pit8253, 2 ); |
| 715 | 717 | int data=0xff; |
| 718 | running_machine *machine = device->machine; |
| 716 | 719 | |
| 717 | 720 | data&=~0x80; // no parity error |
| 718 | 721 | data&=~0x40; // no error on expansion board |
| r3758 | r3759 | |
| 780 | 783 | |
| 781 | 784 | static WRITE8_DEVICE_HANDLER ( ibm5150_ppi_porta_w ) |
| 782 | 785 | { |
| 786 | running_machine *machine = device->machine; |
| 787 | |
| 783 | 788 | /* KB controller port A */ |
| 784 | 789 | PIO_LOG(1,"PIO_A_w",("$%02x\n", data)); |
| 785 | 790 | } |
| r3758 | r3759 | |
| 790 | 795 | /* KB controller port B */ |
| 791 | 796 | pc_ppi.portb = data; |
| 792 | 797 | pc_ppi.portc_switch_high = data & 0x08; |
| 793 | | pc_ppi.keyboard_clear = data & 0x80; |
| 798 | pc_ppi.keyboard_clear = data & 0x80; |
| 794 | 799 | pc_ppi.keyb_clock = data & 0x40; |
| 795 | 800 | pit8253_gate_w( pc_devices.pit8253, 2, data & 1); |
| 796 | 801 | pc_speaker_set_spkrdata( data & 0x02 ); |
| r3758 | r3759 | |
| 813 | 818 | |
| 814 | 819 | static WRITE8_DEVICE_HANDLER ( ibm5150_ppi_portc_w ) |
| 815 | 820 | { |
| 821 | running_machine *machine = device->machine; |
| 822 | |
| 816 | 823 | /* KB controller port C */ |
| 817 | 824 | PIO_LOG(1,"PIO_C_w",("$%02x\n", data)); |
| 818 | 825 | } |
| r3758 | r3759 | |
| 880 | 887 | static READ8_DEVICE_HANDLER (ibm5160_ppi_porta_r) |
| 881 | 888 | { |
| 882 | 889 | int data = 0xFF; |
| 890 | running_machine *machine = device->machine; |
| 883 | 891 | |
| 884 | 892 | /* KB port A */ |
| 885 | 893 | if (pc_ppi.keyboard_clear) |
| r3758 | r3759 | |
| 911 | 919 | { |
| 912 | 920 | int timer2_output = pit8253_get_output( pc_devices.pit8253, 2 ); |
| 913 | 921 | int data=0xff; |
| 922 | running_machine *machine = device->machine; |
| 914 | 923 | |
| 915 | 924 | data&=~0x80; // no parity error |
| 916 | 925 | data&=~0x40; // no error on expansion board |
| r3758 | r3759 | |
| 983 | 992 | static READ8_DEVICE_HANDLER (pcjr_ppi_porta_r ) |
| 984 | 993 | { |
| 985 | 994 | int data; |
| 995 | running_machine *machine = device->machine; |
| 986 | 996 | |
| 987 | 997 | data = 0xff; |
| 988 | 998 | PIO_LOG(1,"PIO_A_r",("$%02x\n", data)); |
| r3758 | r3759 | |
| 1120 | 1130 | DRIVER_INIT( ibm5150 ) |
| 1121 | 1131 | { |
| 1122 | 1132 | mess_init_pc_common(machine, PCCOMMON_KEYBOARD_PC, pc_set_keyb_int, pc_set_irq_line); |
| 1123 | | pc_rtc_init(); |
| 1133 | pc_rtc_init(machine); |
| 1124 | 1134 | |
| 1125 | 1135 | /* Attach keyboard to the keyboard controller */ |
| 1126 | 1136 | ibm5150_set_keyboard_interface( machine, kb_keytronic_set_clock_signal, kb_keytronic_set_data_signal ); |
| r3758 | r3759 | |
| 1131 | 1141 | DRIVER_INIT( pccga ) |
| 1132 | 1142 | { |
| 1133 | 1143 | mess_init_pc_common(machine, PCCOMMON_KEYBOARD_PC, pc_set_keyb_int, pc_set_irq_line); |
| 1134 | | pc_rtc_init(); |
| 1144 | pc_rtc_init(machine); |
| 1135 | 1145 | } |
| 1136 | 1146 | |
| 1137 | 1147 | |
| r3758 | r3759 | |
| 1169 | 1179 | |
| 1170 | 1180 | mess_init_pc_common(machine, PCCOMMON_KEYBOARD_PC, pc_set_keyb_int, pc_set_irq_line); |
| 1171 | 1181 | |
| 1172 | | europc_rtc_init(); |
| 1182 | europc_rtc_init(machine); |
| 1173 | 1183 | // europc_rtc_set_time(machine); |
| 1174 | 1184 | } |
| 1175 | 1185 | |
| r3758 | r3759 | |
| 1333 | 1343 | MACHINE_RESET( pcjr ) |
| 1334 | 1344 | { |
| 1335 | 1345 | MACHINE_RESET_CALL( pc ); |
| 1336 | | pcjr_keyb_init(); |
| 1346 | pcjr_keyb_init(machine); |
| 1337 | 1347 | pc_int_delay_timer = timer_alloc(machine, pcjr_delayed_pic8259_irq, NULL ); |
| 1338 | 1348 | } |
| 1339 | 1349 | |