src/mess/video/pc_aga.c
| r3662 | r3663 | |
| 16 | 16 | #include "video/cgapal.h" |
| 17 | 17 | |
| 18 | 18 | |
| 19 | | #define CGA_MONITOR (input_port_read(machine, "VIDEO") & 0x1C) |
| 19 | #define CGA_MONITOR (input_port_read(space->machine, "VIDEO") & 0x1C) |
| 20 | 20 | #define CGA_MONITOR_RGB 0x00 /* Colour RGB */ |
| 21 | 21 | #define CGA_MONITOR_MONO 0x04 /* Greyscale RGB */ |
| 22 | 22 | #define CGA_MONITOR_COMPOSITE 0x08 /* Colour composite */ |
| r3662 | r3663 | |
| 480 | 480 | UINT8 data = 0xFF; |
| 481 | 481 | |
| 482 | 482 | if ( aga.mode == AGA_MONO ) { |
| 483 | | device_config *devconf = (device_config *) device_list_find_by_tag(machine->config->devicelist, MC6845, MDA_MC6845_NAME); |
| 483 | device_config *devconf = (device_config *) device_list_find_by_tag(space->machine->config->devicelist, MC6845, MDA_MC6845_NAME); |
| 484 | 484 | switch( offset ) |
| 485 | 485 | { |
| 486 | 486 | case 0: case 2: case 4: case 6: |
| r3662 | r3663 | |
| 490 | 490 | data = mc6845_register_r( devconf, offset ); |
| 491 | 491 | break; |
| 492 | 492 | case 10: |
| 493 | | data = (input_port_read(machine, "IN0") & 0x80 ) | 0x08 | aga.mda_status; |
| 493 | data = (input_port_read(space->machine, "IN0") & 0x80 ) | 0x08 | aga.mda_status; |
| 494 | 494 | aga.mda_status ^= 0x01; |
| 495 | 495 | break; |
| 496 | 496 | /* 12, 13, 14 are the LPT1 ports */ |
| r3662 | r3663 | |
| 502 | 502 | static WRITE8_HANDLER ( pc_aga_mda_w ) |
| 503 | 503 | { |
| 504 | 504 | if ( aga.mode == AGA_MONO ) { |
| 505 | | device_config *devconf = (device_config *) device_list_find_by_tag(machine->config->devicelist, MC6845, AGA_MC6845_NAME); |
| 505 | device_config *devconf = (device_config *) device_list_find_by_tag(space->machine->config->devicelist, MC6845, AGA_MC6845_NAME); |
| 506 | 506 | switch( offset ) |
| 507 | 507 | { |
| 508 | 508 | case 0: case 2: case 4: case 6: |
| r3662 | r3663 | |
| 535 | 535 | UINT8 data = 0xFF; |
| 536 | 536 | |
| 537 | 537 | if ( aga.mode == AGA_COLOR ) { |
| 538 | | device_config *devconf = (device_config *) device_list_find_by_tag(machine->config->devicelist, MC6845, AGA_MC6845_NAME); |
| 538 | device_config *devconf = (device_config *) device_list_find_by_tag(space->machine->config->devicelist, MC6845, AGA_MC6845_NAME); |
| 539 | 539 | switch( offset ) { |
| 540 | 540 | case 0: case 2: case 4: case 6: |
| 541 | 541 | /* return last written mc6845 address value here? */ |
| r3662 | r3663 | |
| 581 | 581 | static WRITE8_HANDLER ( pc_aga_cga_w ) |
| 582 | 582 | { |
| 583 | 583 | if ( aga.mode == AGA_COLOR ) { |
| 584 | | device_config *devconf = (device_config *) device_list_find_by_tag(machine->config->devicelist, MC6845, AGA_MC6845_NAME); |
| 584 | device_config *devconf = (device_config *) device_list_find_by_tag(space->machine->config->devicelist, MC6845, AGA_MC6845_NAME); |
| 585 | 585 | |
| 586 | 586 | switch(offset) { |
| 587 | 587 | case 0: case 2: case 4: case 6: |
| r3662 | r3663 | |
| 651 | 651 | } |
| 652 | 652 | |
| 653 | 653 | |
| 654 | | static READ16_HANDLER ( pc16le_aga_mda_r ) { return read16le_with_read8_handler(pc_aga_mda_r, machine, offset, mem_mask); } |
| 655 | | static WRITE16_HANDLER ( pc16le_aga_mda_w ) { write16le_with_write8_handler(pc_aga_mda_w, machine, offset, data, mem_mask); } |
| 656 | | static READ16_HANDLER ( pc16le_aga_cga_r ) { return read16le_with_read8_handler(pc_aga_cga_r, machine, offset, mem_mask); } |
| 657 | | static WRITE16_HANDLER ( pc16le_aga_cga_w ) { write16le_with_write8_handler(pc_aga_cga_w, machine, offset, data, mem_mask); } |
| 654 | static READ16_HANDLER ( pc16le_aga_mda_r ) { return read16le_with_read8_handler(pc_aga_mda_r, space, offset, mem_mask); } |
| 655 | static WRITE16_HANDLER ( pc16le_aga_mda_w ) { write16le_with_write8_handler(pc_aga_mda_w, space, offset, data, mem_mask); } |
| 656 | static READ16_HANDLER ( pc16le_aga_cga_r ) { return read16le_with_read8_handler(pc_aga_cga_r, space, offset, mem_mask); } |
| 657 | static WRITE16_HANDLER ( pc16le_aga_cga_w ) { write16le_with_write8_handler(pc_aga_cga_w, space, offset, data, mem_mask); } |
| 658 | 658 | |
| 659 | 659 | |
| 660 | 660 | |
| r3662 | r3663 | |
| 681 | 681 | |
| 682 | 682 | VIDEO_START( pc_aga ) |
| 683 | 683 | { |
| 684 | | int buswidth = cputype_databus_width(machine->config->cpu[0].type, ADDRESS_SPACE_PROGRAM); |
| 684 | const address_space *space = cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_IO ); |
| 685 | int buswidth = cpu_get_databus_width(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 685 | 686 | |
| 686 | 687 | switch(buswidth) |
| 687 | 688 | { |
| 688 | 689 | case 8: |
| 689 | | memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x3b0, 0x3bf, 0, 0, pc_aga_mda_r ); |
| 690 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x3b0, 0x3bf, 0, 0, pc_aga_mda_w ); |
| 691 | | memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x3d0, 0x3df, 0, 0, pc_aga_cga_r ); |
| 692 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x3d0, 0x3df, 0, 0, pc_aga_cga_w ); |
| 690 | memory_install_read8_handler(space, 0x3b0, 0x3bf, 0, 0, pc_aga_mda_r ); |
| 691 | memory_install_write8_handler(space, 0x3b0, 0x3bf, 0, 0, pc_aga_mda_w ); |
| 692 | memory_install_read8_handler(space, 0x3d0, 0x3df, 0, 0, pc_aga_cga_r ); |
| 693 | memory_install_write8_handler(space, 0x3d0, 0x3df, 0, 0, pc_aga_cga_w ); |
| 693 | 694 | break; |
| 694 | 695 | |
| 695 | 696 | case 16: |
| 696 | | memory_install_read16_handler(machine, 0, ADDRESS_SPACE_IO, 0x3b0, 0x3bf, 0, 0, pc16le_aga_mda_r ); |
| 697 | | memory_install_write16_handler(machine, 0, ADDRESS_SPACE_IO, 0x3b0, 0x3bf, 0, 0, pc16le_aga_mda_w ); |
| 698 | | memory_install_read16_handler(machine, 0, ADDRESS_SPACE_IO, 0x3d0, 0x3df, 0, 0, pc16le_aga_cga_r ); |
| 699 | | memory_install_write16_handler(machine, 0, ADDRESS_SPACE_IO, 0x3d0, 0x3df, 0, 0, pc16le_aga_cga_w ); |
| 697 | memory_install_read16_handler(space, 0x3b0, 0x3bf, 0, 0, pc16le_aga_mda_r ); |
| 698 | memory_install_write16_handler(space, 0x3b0, 0x3bf, 0, 0, pc16le_aga_mda_w ); |
| 699 | memory_install_read16_handler(space, 0x3d0, 0x3df, 0, 0, pc16le_aga_cga_r ); |
| 700 | memory_install_write16_handler(space, 0x3d0, 0x3df, 0, 0, pc16le_aga_cga_w ); |
| 700 | 701 | break; |
| 701 | 702 | |
| 702 | 703 | default: |
| r3662 | r3663 | |
| 714 | 715 | |
| 715 | 716 | VIDEO_START( pc200 ) |
| 716 | 717 | { |
| 718 | const address_space *space = cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_IO ); |
| 717 | 719 | int buswidth; |
| 718 | 720 | |
| 719 | 721 | VIDEO_START_CALL(pc_aga); |
| 720 | 722 | |
| 721 | | buswidth = cputype_databus_width(machine->config->cpu[0].type, ADDRESS_SPACE_PROGRAM); |
| 723 | buswidth = cpu_get_databus_width(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 722 | 724 | switch(buswidth) |
| 723 | 725 | { |
| 724 | 726 | case 8: |
| 725 | | memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x3d0, 0x3df, 0, 0, pc200_cga_r ); |
| 726 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_IO, 0x3d0, 0x3df, 0, 0, pc200_cga_w ); |
| 727 | memory_install_read8_handler(space, 0x3d0, 0x3df, 0, 0, pc200_cga_r ); |
| 728 | memory_install_write8_handler(space, 0x3d0, 0x3df, 0, 0, pc200_cga_w ); |
| 727 | 729 | break; |
| 728 | 730 | |
| 729 | 731 | case 16: |
| 730 | | memory_install_read16_handler(machine, 0, ADDRESS_SPACE_IO, 0x3d0, 0x3df, 0, 0, pc200_cga16le_r ); |
| 731 | | memory_install_write16_handler(machine, 0, ADDRESS_SPACE_IO, 0x3d0, 0x3df, 0, 0, pc200_cga16le_w ); |
| 732 | memory_install_read16_handler(space, 0x3d0, 0x3df, 0, 0, pc200_cga16le_r ); |
| 733 | memory_install_write16_handler(space, 0x3d0, 0x3df, 0, 0, pc200_cga16le_w ); |
| 732 | 734 | break; |
| 733 | 735 | |
| 734 | 736 | default: |
| r3662 | r3663 | |
| 751 | 753 | switch (aga.mode) { |
| 752 | 754 | case AGA_COLOR: |
| 753 | 755 | if (offset>=0x8000) |
| 754 | | pc_video_videoram_w(machine, offset-0x8000, data); |
| 756 | pc_video_videoram_w(space, offset-0x8000, data); |
| 755 | 757 | break; |
| 756 | 758 | case AGA_MONO: |
| 757 | | pc_video_videoram_w(machine, offset,data); |
| 759 | pc_video_videoram_w(space, offset,data); |
| 758 | 760 | break; |
| 759 | 761 | case AGA_OFF: break; |
| 760 | 762 | } |
| r3662 | r3663 | |
| 792 | 794 | { |
| 793 | 795 | default: |
| 794 | 796 | if (offset>=0x8000) |
| 795 | | pc_video_videoram_w(machine, offset-0x8000, data); |
| 797 | pc_video_videoram_w(space, offset-0x8000, data); |
| 796 | 798 | break; |
| 797 | 799 | case AGA_MONO: |
| 798 | | pc_video_videoram_w(machine, offset,data); |
| 800 | pc_video_videoram_w(space, offset,data); |
| 799 | 801 | break; |
| 800 | 802 | } |
| 801 | 803 | } |
| 802 | 804 | |
| 803 | | READ16_HANDLER( pc200_videoram16le_r ) { return read16le_with_read8_handler(pc200_videoram_r, machine, offset, mem_mask); } |
| 804 | | WRITE16_HANDLER( pc200_videoram16le_w ) { write16le_with_write8_handler(pc200_videoram_w, machine, offset, data, mem_mask); } |
| 805 | READ16_HANDLER( pc200_videoram16le_r ) { return read16le_with_read8_handler(pc200_videoram_r, space, offset, mem_mask); } |
| 806 | WRITE16_HANDLER( pc200_videoram16le_w ) { write16le_with_write8_handler(pc200_videoram_w, space, offset, data, mem_mask); } |
| 805 | 807 | |
| 806 | 808 | |
| 807 | 809 | static struct { |
| r3662 | r3663 | |
| 815 | 817 | switch(offset) { |
| 816 | 818 | case 4: |
| 817 | 819 | pc200.portd |= 0x20; |
| 818 | | // pc_cga8_w(machine, offset,data); |
| 820 | // pc_cga8_w(space, offset,data); |
| 819 | 821 | break; |
| 820 | 822 | case 8: |
| 821 | 823 | pc200.port8 = data; |
| 822 | 824 | pc200.portd |= 0x80; |
| 823 | | // pc_cga8_w(machine, offset,data); |
| 825 | // pc_cga8_w(space, offset,data); |
| 824 | 826 | break; |
| 825 | 827 | case 0xe: |
| 826 | 828 | pc200.portd = 0x1f; |
| r3662 | r3663 | |
| 835 | 837 | if ((pc200.porte & 7) != (data & 7)) |
| 836 | 838 | { |
| 837 | 839 | if (data & 4) |
| 838 | | pc_aga_set_mode(machine, AGA_OFF); |
| 840 | pc_aga_set_mode(space->machine, AGA_OFF); |
| 839 | 841 | else if (data & 2) |
| 840 | | pc_aga_set_mode(machine, AGA_MONO); |
| 842 | pc_aga_set_mode(space->machine, AGA_MONO); |
| 841 | 843 | else |
| 842 | | pc_aga_set_mode(machine, AGA_COLOR); |
| 844 | pc_aga_set_mode(space->machine, AGA_COLOR); |
| 843 | 845 | } |
| 844 | 846 | pc200.porte = data; |
| 845 | 847 | break; |
| 846 | 848 | |
| 847 | 849 | default: |
| 848 | | // pc_cga8_w(machine, offset,data); |
| 850 | // pc_cga8_w(space, offset,data); |
| 849 | 851 | break; |
| 850 | 852 | } |
| 851 | 853 | } |
| r3662 | r3663 | |
| 868 | 870 | case 0xe: |
| 869 | 871 | // 0x20 low cga |
| 870 | 872 | // 0x10 low special |
| 871 | | result = input_port_read(machine, "DSW0") & 0x38; |
| 873 | result = input_port_read(space->machine, "DSW0") & 0x38; |
| 872 | 874 | break; |
| 873 | 875 | |
| 874 | 876 | default: |
| 875 | | // result = pc_cga8_r(machine, offset); |
| 877 | // result = pc_cga8_r(space, offset); |
| 876 | 878 | break; |
| 877 | 879 | } |
| 878 | 880 | return result; |
| 879 | 881 | } |
| 880 | 882 | |
| 881 | | READ16_HANDLER( pc200_cga16le_r ) { return read16le_with_read8_handler(pc200_cga_r, machine, offset, mem_mask); } |
| 882 | | WRITE16_HANDLER( pc200_cga16le_w ) { write16le_with_write8_handler(pc200_cga_w, machine, offset, data, mem_mask); } |
| 883 | READ16_HANDLER( pc200_cga16le_r ) { return read16le_with_read8_handler(pc200_cga_r, space, offset, mem_mask); } |
| 884 | WRITE16_HANDLER( pc200_cga16le_w ) { write16le_with_write8_handler(pc200_cga_w, space, offset, data, mem_mask); } |
src/mess/machine/amstr_pc.c
| r3662 | r3663 | |
| 154 | 154 | pc1640.port61=data; |
| 155 | 155 | if (data==0x30) pc1640.port62=(pc1640.port65&0x10)>>4; |
| 156 | 156 | else if (data==0x34) pc1640.port62=pc1640.port65&0xf; |
| 157 | | pit8253_gate_w( (device_config*)device_list_find_by_tag( machine->config->devicelist, PIT8253, "pit8253" ), 2, data & 1); |
| 157 | pit8253_gate_w( (device_config*)device_list_find_by_tag( space->machine->config->devicelist, PIT8253, "pit8253" ), 2, data & 1); |
| 158 | 158 | pc_speaker_set_spkrdata( data & 0x02 ); |
| 159 | 159 | pc_keyb_set_clock(data&0x40); |
| 160 | 160 | break; |
| r3662 | r3663 | |
| 192 | 192 | |
| 193 | 193 | case 2: |
| 194 | 194 | data = pc1640.port62; |
| 195 | | if (pit8253_get_output(device_list_find_by_tag( machine->config->devicelist, PIT8253, "pit8253" ), 2)) |
| 195 | if (pit8253_get_output(device_list_find_by_tag( space->machine->config->devicelist, PIT8253, "pit8253" ), 2)) |
| 196 | 196 | data |= 0x20; |
| 197 | 197 | break; |
| 198 | 198 | } |
| r3662 | r3663 | |
| 201 | 201 | |
| 202 | 202 | READ8_HANDLER( pc200_port378_r ) |
| 203 | 203 | { |
| 204 | | int data=pc_parallelport1_r(machine, offset); |
| 204 | int data=pc_parallelport1_r(space, offset); |
| 205 | 205 | if (offset == 1) |
| 206 | | data = (data & ~7) | (input_port_read(machine, "DSW0") & 7); |
| 206 | data = (data & ~7) | (input_port_read(space->machine, "DSW0") & 7); |
| 207 | 207 | if (offset == 2) |
| 208 | | data = (data & ~0xe0) | (input_port_read(machine, "DSW0") & 0xc0); |
| 208 | data = (data & ~0xe0) | (input_port_read(space->machine, "DSW0") & 0xc0); |
| 209 | 209 | return data; |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | |
| 213 | 213 | READ8_HANDLER( pc1640_port378_r ) |
| 214 | 214 | { |
| 215 | | int data=pc_parallelport1_r(machine, offset); |
| 215 | int data=pc_parallelport1_r(space, offset); |
| 216 | 216 | if (offset == 1) |
| 217 | | data=(data & ~7) | (input_port_read(machine, "DSW0") & 7); |
| 217 | data=(data & ~7) | (input_port_read(space->machine, "DSW0") & 7); |
| 218 | 218 | if (offset == 2) |
| 219 | 219 | { |
| 220 | 220 | switch (pc1640.dipstate) |
| 221 | 221 | { |
| 222 | 222 | case 0: |
| 223 | | data = (data&~0xe0) | (input_port_read(machine, "DSW0") & 0xe0); |
| 223 | data = (data&~0xe0) | (input_port_read(space->machine, "DSW0") & 0xe0); |
| 224 | 224 | break; |
| 225 | 225 | case 1: |
| 226 | | data = (data&~0xe0) | ((input_port_read(machine, "DSW0") & 0xe000)>>8); |
| 226 | data = (data&~0xe0) | ((input_port_read(space->machine, "DSW0") & 0xe000)>>8); |
| 227 | 227 | break; |
| 228 | 228 | case 2: |
| 229 | | data = (data&~0xe0) | ((input_port_read(machine, "DSW0") & 0xe00)>>4); |
| 229 | data = (data&~0xe0) | ((input_port_read(space->machine, "DSW0") & 0xe00)>>4); |
| 230 | 230 | break; |
| 231 | 231 | |
| 232 | 232 | } |
| r3662 | r3663 | |
| 237 | 237 | READ8_HANDLER( pc1640_port3d0_r ) |
| 238 | 238 | { |
| 239 | 239 | if (offset==0xa) pc1640.dipstate=0; |
| 240 | | return vga_port_03d0_r(machine, offset); |
| 240 | return vga_port_03d0_r(space, offset); |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | READ8_HANDLER( pc1640_port4278_r ) |
| r3662 | r3663 | |
| 256 | 256 | |
| 257 | 257 | static READ8_HANDLER( pc1640_mouse_x_r ) |
| 258 | 258 | { |
| 259 | | return pc1640.mouse.x - input_port_read(machine, "pc_mouse_x"); |
| 259 | return pc1640.mouse.x - input_port_read(space->machine, "pc_mouse_x"); |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | static READ8_HANDLER( pc1640_mouse_y_r ) |
| 263 | 263 | { |
| 264 | | return pc1640.mouse.y - input_port_read(machine, "pc_mouse_y"); |
| 264 | return pc1640.mouse.y - input_port_read(space->machine, "pc_mouse_y"); |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | static WRITE8_HANDLER( pc1640_mouse_x_w ) |
| 268 | 268 | { |
| 269 | | pc1640.mouse.x = data + input_port_read(machine, "pc_mouse_x"); |
| 269 | pc1640.mouse.x = data + input_port_read(space->machine, "pc_mouse_x"); |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | static WRITE8_HANDLER( pc1640_mouse_y_w ) |
| 273 | 273 | { |
| 274 | | pc1640.mouse.y = data + input_port_read(machine, "pc_mouse_y"); |
| 274 | pc1640.mouse.y = data + input_port_read(space->machine, "pc_mouse_y"); |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | | READ16_HANDLER( pc1640_16le_mouse_x_r ) { return read16le_with_read8_handler(pc1640_mouse_x_r, machine, offset, mem_mask); } |
| 278 | | READ16_HANDLER( pc1640_16le_mouse_y_r ) { return read16le_with_read8_handler(pc1640_mouse_y_r, machine, offset, mem_mask); } |
| 279 | | WRITE16_HANDLER( pc1640_16le_mouse_x_w ) { write16le_with_write8_handler(pc1640_mouse_x_w, machine, offset, data, mem_mask); } |
| 280 | | WRITE16_HANDLER( pc1640_16le_mouse_y_w ) { write16le_with_write8_handler(pc1640_mouse_y_w, machine, offset, data, mem_mask); } |
| 277 | READ16_HANDLER( pc1640_16le_mouse_x_r ) { return read16le_with_read8_handler(pc1640_mouse_x_r, space, offset, mem_mask); } |
| 278 | READ16_HANDLER( pc1640_16le_mouse_y_r ) { return read16le_with_read8_handler(pc1640_mouse_y_r, space, offset, mem_mask); } |
| 279 | WRITE16_HANDLER( pc1640_16le_mouse_x_w ) { write16le_with_write8_handler(pc1640_mouse_x_w, space, offset, data, mem_mask); } |
| 280 | WRITE16_HANDLER( pc1640_16le_mouse_y_w ) { write16le_with_write8_handler(pc1640_mouse_y_w, space, offset, data, mem_mask); } |
| 281 | 281 | |
| 282 | 282 | INPUT_PORTS_START( amstrad_keyboard ) |
| 283 | 283 | |
| r3662 | r3663 | |
| 408 | 408 | INPUT_PORTS_END |
| 409 | 409 | |
| 410 | 410 | |
| 411 | | READ16_HANDLER( pc1640_16le_port60_r ) { return read16le_with_read8_handler(pc1640_port60_r, machine, offset, mem_mask); } |
| 412 | | WRITE16_HANDLER( pc1640_16le_port60_w ) { write16le_with_write8_handler(pc1640_port60_w, machine, offset, data, mem_mask); } |
| 411 | READ16_HANDLER( pc1640_16le_port60_r ) { return read16le_with_read8_handler(pc1640_port60_r, space, offset, mem_mask); } |
| 412 | WRITE16_HANDLER( pc1640_16le_port60_w ) { write16le_with_write8_handler(pc1640_port60_w, space, offset, data, mem_mask); } |
| 413 | 413 | |
| 414 | | READ16_HANDLER( pc200_16le_port378_r ) { return read16le_with_read8_handler(pc200_port378_r, machine, offset, mem_mask); } |
| 415 | | READ16_HANDLER( pc1640_16le_port378_r ) { return read16le_with_read8_handler(pc1640_port378_r, machine, offset, mem_mask); } |
| 416 | | READ16_HANDLER( pc1640_16le_port3d0_r ) { return read16le_with_read8_handler(pc1640_port3d0_r, machine, offset, mem_mask); } |
| 417 | | READ16_HANDLER( pc1640_16le_port4278_r ) { return read16le_with_read8_handler(pc1640_port4278_r, machine, offset, mem_mask); } |
| 418 | | READ16_HANDLER( pc1640_16le_port278_r ) { return read16le_with_read8_handler(pc1640_port278_r, machine, offset, mem_mask); } |
| 414 | READ16_HANDLER( pc200_16le_port378_r ) { return read16le_with_read8_handler(pc200_port378_r, space, offset, mem_mask); } |
| 415 | READ16_HANDLER( pc1640_16le_port378_r ) { return read16le_with_read8_handler(pc1640_port378_r, space, offset, mem_mask); } |
| 416 | READ16_HANDLER( pc1640_16le_port3d0_r ) { return read16le_with_read8_handler(pc1640_port3d0_r, space, offset, mem_mask); } |
| 417 | READ16_HANDLER( pc1640_16le_port4278_r ) { return read16le_with_read8_handler(pc1640_port4278_r, space, offset, mem_mask); } |
| 418 | READ16_HANDLER( pc1640_16le_port278_r ) { return read16le_with_read8_handler(pc1640_port278_r, space, offset, mem_mask); } |
src/mess/machine/pc.c
| r3662 | r3663 | |
| 101 | 101 | offs_t page_offset = (((offs_t) dma_offset[0][channel]) << 16) |
| 102 | 102 | & 0x0F0000; |
| 103 | 103 | |
| 104 | | cpuintrf_push_context(0); |
| 105 | | result = memory_read_byte(space, page_offset + offset); |
| 106 | | cpuintrf_pop_context(); |
| 104 | cpu_push_context( device->machine->cpu[0] ); |
| 105 | result = memory_read_byte( cpu_get_address_space( device->machine->cpu[0], ADDRESS_SPACE_PROGRAM ), page_offset + offset); |
| 106 | cpu_pop_context(); |
| 107 | 107 | |
| 108 | 108 | return result; |
| 109 | 109 | } |
| r3662 | r3663 | |
| 114 | 114 | offs_t page_offset = (((offs_t) dma_offset[0][channel]) << 16) |
| 115 | 115 | & 0x0F0000; |
| 116 | 116 | |
| 117 | | cpuintrf_push_context(0); |
| 118 | | memory_write_byte(space, page_offset + offset, data); |
| 119 | | cpuintrf_pop_context(); |
| 117 | cpu_push_context( device->machine->cpu[0] ); |
| 118 | memory_write_byte( cpu_get_address_space( device->machine->cpu[0], ADDRESS_SPACE_PROGRAM ), page_offset + offset, data); |
| 119 | cpu_pop_context(); |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | |
| r3662 | r3663 | |
| 214 | 214 | |
| 215 | 215 | static TIMER_CALLBACK( pcjr_delayed_pic8259_irq ) |
| 216 | 216 | { |
| 217 | | cpunum_set_input_line(pc_devices.pic8259_master->machine, 0, 0, param ? HOLD_LINE : CLEAR_LINE); |
| 217 | cpu_set_input_line(machine->cpu[0], 0, param ? ASSERT_LINE : CLEAR_LINE); |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | |
| 221 | 221 | static PIC8259_SET_INT_LINE( pcjr_pic8259_master_set_int_line ) |
| 222 | 222 | { |
| 223 | | if ( cpunum_get_reg( 0, REG_PC ) == 0xF0454 ) |
| 223 | if ( cpu_get_reg( device->machine->cpu[0], REG_PC ) == 0xF0454 ) |
| 224 | 224 | { |
| 225 | 225 | timer_adjust_oneshot( pc_int_delay_timer, ATTOTIME_IN_CYCLES(1,0), interrupt ); |
| 226 | 226 | } |
| r3662 | r3663 | |
| 560 | 560 | pcjr_keyb.latch = 1; |
| 561 | 561 | if ( nmi_enabled & 0x80 ) |
| 562 | 562 | { |
| 563 | | cpunum_set_input_line( Machine, 0, INPUT_LINE_NMI, PULSE_LINE ); |
| 563 | cpu_set_input_line( Machine->cpu[0], INPUT_LINE_NMI, PULSE_LINE ); |
| 564 | 564 | } |
| 565 | 565 | } |
| 566 | 566 | } |
| r3662 | r3663 | |
| 645 | 645 | UINT8 data_signal; |
| 646 | 646 | UINT8 shift_register; |
| 647 | 647 | UINT8 shift_enable; |
| 648 | | write8_machine_func clock_callback; |
| 649 | | write8_machine_func data_callback; |
| 648 | write8_space_func clock_callback; |
| 649 | write8_space_func data_callback; |
| 650 | 650 | } pc_ppi={ 0 }; |
| 651 | 651 | |
| 652 | 652 | |
| r3662 | r3663 | |
| 792 | 792 | |
| 793 | 793 | pc_ppi.clock_signal = ( pc_ppi.keyb_clock ) ? 1 : 0; |
| 794 | 794 | |
| 795 | | pc_ppi.clock_callback( device->machine, 0, pc_ppi.clock_signal ); |
| 795 | pc_ppi.clock_callback( cpu_get_address_space( device->machine->cpu[0], ADDRESS_SPACE_PROGRAM ), 0, pc_ppi.clock_signal ); |
| 796 | 796 | |
| 797 | 797 | /* If PB7 is set clear the shift register and reset the IRQ line */ |
| 798 | 798 | if ( pc_ppi.keyboard_clear ) |
| r3662 | r3663 | |
| 831 | 831 | pic8259_set_irq_line(pc_devices.pic8259_master, 1, 1); |
| 832 | 832 | pc_ppi.shift_enable = 0; |
| 833 | 833 | pc_ppi.clock_signal = 0; |
| 834 | | pc_ppi.clock_callback( machine, 0, 0 ); |
| 834 | pc_ppi.clock_callback( space, 0, 0 ); |
| 835 | 835 | } |
| 836 | 836 | } |
| 837 | 837 | } |
| 838 | 838 | } |
| 839 | 839 | } |
| 840 | 840 | |
| 841 | | pc_ppi.clock_callback( machine, 0, pc_ppi.clock_signal ); |
| 841 | pc_ppi.clock_callback( space, 0, pc_ppi.clock_signal ); |
| 842 | 842 | } |
| 843 | 843 | |
| 844 | 844 | |
| r3662 | r3663 | |
| 846 | 846 | { |
| 847 | 847 | pc_ppi.data_signal = data; |
| 848 | 848 | |
| 849 | | pc_ppi.data_callback( machine, 0, pc_ppi.data_signal ); |
| 849 | pc_ppi.data_callback( space, 0, pc_ppi.data_signal ); |
| 850 | 850 | } |
| 851 | 851 | |
| 852 | 852 | |
| 853 | | static void ibm5150_set_keyboard_interface( running_machine *machine, write8_machine_func clock_cb, write8_machine_func data_cb ) |
| 853 | static void ibm5150_set_keyboard_interface( running_machine *machine, write8_space_func clock_cb, write8_space_func data_cb ) |
| 854 | 854 | { |
| 855 | 855 | pc_ppi.clock_callback = clock_cb; |
| 856 | 856 | pc_ppi.data_callback = data_cb; |
| r3662 | r3663 | |
| 1090 | 1090 | |
| 1091 | 1091 | /* MESS managed RAM */ |
| 1092 | 1092 | if ( mess_ram ) |
| 1093 | | memory_set_bankptr( 10, mess_ram ); |
| 1093 | memory_set_bankptr( machine, 10, mess_ram ); |
| 1094 | 1094 | |
| 1095 | 1095 | /* FDC/HDC hardware */ |
| 1096 | 1096 | pc_hdc_setup(set_hdc_int_func); |
| r3662 | r3663 | |
| 1174 | 1174 | |
| 1175 | 1175 | DRIVER_INIT( pc200 ) |
| 1176 | 1176 | { |
| 1177 | const address_space *space = cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_PROGRAM ); |
| 1178 | const address_space *io_space = cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_IO ); |
| 1177 | 1179 | UINT8 *gfx = &memory_region(machine, "gfx1")[0x8000]; |
| 1178 | 1180 | int i; |
| 1179 | 1181 | |
| r3662 | r3663 | |
| 1181 | 1183 | for (i = 0; i < 256; i++) |
| 1182 | 1184 | gfx[i] = i; |
| 1183 | 1185 | |
| 1184 | | memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xb0000, 0xbffff, 0, 0, pc200_videoram16le_r ); |
| 1185 | | memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xb0000, 0xbffff, 0, 0, pc200_videoram16le_w ); |
| 1186 | memory_install_read16_handler( space, 0xb0000, 0xbffff, 0, 0, pc200_videoram16le_r ); |
| 1187 | memory_install_write16_handler( space, 0xb0000, 0xbffff, 0, 0, pc200_videoram16le_w ); |
| 1186 | 1188 | videoram_size=0x10000; |
| 1187 | 1189 | videoram=memory_region(machine, "main")+0xb0000; |
| 1188 | | memory_install_read16_handler(machine, 0, ADDRESS_SPACE_IO, 0x278, 0x27b, 0, 0, pc200_16le_port378_r ); |
| 1190 | memory_install_read16_handler( io_space, 0x278, 0x27b, 0, 0, pc200_16le_port378_r ); |
| 1189 | 1191 | |
| 1190 | 1192 | mess_init_pc_common(machine, PCCOMMON_KEYBOARD_PC, pc_set_keyb_int, pc_set_irq_line); |
| 1191 | 1193 | } |
| 1192 | 1194 | |
| 1193 | 1195 | DRIVER_INIT( pc1512 ) |
| 1194 | 1196 | { |
| 1197 | const address_space *space = cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_PROGRAM ); |
| 1198 | const address_space *io_space = cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_IO ); |
| 1195 | 1199 | UINT8 *gfx = &memory_region(machine, "gfx1")[0x8000]; |
| 1196 | 1200 | int i; |
| 1197 | 1201 | |
| r3662 | r3663 | |
| 1199 | 1203 | for (i = 0; i < 256; i++) |
| 1200 | 1204 | gfx[i] = i; |
| 1201 | 1205 | |
| 1202 | | memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xb8000, 0xbbfff, 0, 0x0C000, SMH_BANK1 ); |
| 1203 | | memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xb8000, 0xbbfff, 0, 0x0C000, pc1512_videoram16le_w ); |
| 1206 | memory_install_read16_handler( space, 0xb8000, 0xbbfff, 0, 0x0C000, SMH_BANK1 ); |
| 1207 | memory_install_write16_handler( space, 0xb8000, 0xbbfff, 0, 0x0C000, pc1512_videoram16le_w ); |
| 1204 | 1208 | |
| 1205 | | memory_install_read16_handler(machine, 0, ADDRESS_SPACE_IO, 0x3d0, 0x3df, 0, 0, pc1512_16le_r ); |
| 1206 | | memory_install_write16_handler(machine, 0, ADDRESS_SPACE_IO, 0x3d0, 0x3df, 0, 0, pc1512_16le_w ); |
| 1209 | memory_install_read16_handler( io_space, 0x3d0, 0x3df, 0, 0, pc1512_16le_r ); |
| 1210 | memory_install_write16_handler( io_space, 0x3d0, 0x3df, 0, 0, pc1512_16le_w ); |
| 1207 | 1211 | |
| 1208 | | memory_install_read16_handler(machine, 0, ADDRESS_SPACE_IO, 0x278, 0x27b, 0, 0, pc16le_parallelport2_r ); |
| 1212 | memory_install_read16_handler( io_space, 0x278, 0x27b, 0, 0, pc16le_parallelport2_r ); |
| 1209 | 1213 | |
| 1210 | 1214 | |
| 1211 | 1215 | mess_init_pc_common(machine, PCCOMMON_KEYBOARD_PC, pc_set_keyb_int, pc_set_irq_line); |
| r3662 | r3663 | |
| 1220 | 1224 | |
| 1221 | 1225 | |
| 1222 | 1226 | |
| 1223 | | static void pc_map_vga_memory(offs_t begin, offs_t end, read8_machine_func rh, write8_machine_func wh) |
| 1227 | static void pc_map_vga_memory(offs_t begin, offs_t end, read8_space_func rh, write8_space_func wh) |
| 1224 | 1228 | { |
| 1229 | const address_space *space = cpu_get_address_space( Machine->cpu[0], ADDRESS_SPACE_PROGRAM ); |
| 1225 | 1230 | int buswidth; |
| 1226 | | buswidth = cputype_databus_width(Machine->config->cpu[0].type, ADDRESS_SPACE_PROGRAM); |
| 1231 | buswidth = cpu_get_databus_width(Machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 1227 | 1232 | switch(buswidth) |
| 1228 | 1233 | { |
| 1229 | 1234 | case 8: |
| 1230 | | memory_install_read8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0xA0000, 0xBFFFF, 0, 0, SMH_NOP); |
| 1231 | | memory_install_write8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0xA0000, 0xBFFFF, 0, 0, SMH_NOP); |
| 1235 | memory_install_read8_handler(space, 0xA0000, 0xBFFFF, 0, 0, SMH_NOP); |
| 1236 | memory_install_write8_handler(space, 0xA0000, 0xBFFFF, 0, 0, SMH_NOP); |
| 1232 | 1237 | |
| 1233 | | memory_install_read8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, begin, end, 0, 0, rh); |
| 1234 | | memory_install_write8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, begin, end, 0, 0, wh); |
| 1238 | memory_install_read8_handler(space, begin, end, 0, 0, rh); |
| 1239 | memory_install_write8_handler(space, begin, end, 0, 0, wh); |
| 1235 | 1240 | break; |
| 1236 | 1241 | |
| 1237 | 1242 | default: |
| r3662 | r3663 | |
| 1257 | 1262 | |
| 1258 | 1263 | DRIVER_INIT( pc1640 ) |
| 1259 | 1264 | { |
| 1265 | const address_space *space = cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_PROGRAM ); |
| 1266 | const address_space *io_space = cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_IO ); |
| 1267 | |
| 1260 | 1268 | pc_vga_init(machine, &vga_interface, NULL); |
| 1261 | | memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa0000, 0xaffff, 0, 0, SMH_BANK1 ); |
| 1262 | | memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xb0000, 0xb7fff, 0, 0, SMH_BANK2 ); |
| 1263 | | memory_install_read16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xb8000, 0xbffff, 0, 0, SMH_BANK3 ); |
| 1269 | memory_install_read16_handler(space, 0xa0000, 0xaffff, 0, 0, SMH_BANK1 ); |
| 1270 | memory_install_read16_handler(space, 0xb0000, 0xb7fff, 0, 0, SMH_BANK2 ); |
| 1271 | memory_install_read16_handler(space, 0xb8000, 0xbffff, 0, 0, SMH_BANK3 ); |
| 1264 | 1272 | |
| 1265 | | memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xa0000, 0xaffff, 0, 0, SMH_BANK1 ); |
| 1266 | | memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xb0000, 0xb7fff, 0, 0, SMH_BANK2 ); |
| 1267 | | memory_install_write16_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xb8000, 0xbffff, 0, 0, SMH_BANK3 ); |
| 1273 | memory_install_write16_handler(space, 0xa0000, 0xaffff, 0, 0, SMH_BANK1 ); |
| 1274 | memory_install_write16_handler(space, 0xb0000, 0xb7fff, 0, 0, SMH_BANK2 ); |
| 1275 | memory_install_write16_handler(space, 0xb8000, 0xbffff, 0, 0, SMH_BANK3 ); |
| 1268 | 1276 | |
| 1269 | | memory_install_read16_handler(machine, 0, ADDRESS_SPACE_IO, 0x3b0, 0x3bf, 0, 0, vga_port16le_03b0_r ); |
| 1270 | | memory_install_read16_handler(machine, 0, ADDRESS_SPACE_IO, 0x3c0, 0x3cf, 0, 0, paradise_ega16le_03c0_r ); |
| 1271 | | memory_install_read16_handler(machine, 0, ADDRESS_SPACE_IO, 0x3d0, 0x3df, 0, 0, pc1640_16le_port3d0_r ); |
| 1277 | memory_install_read16_handler(io_space, 0x3b0, 0x3bf, 0, 0, vga_port16le_03b0_r ); |
| 1278 | memory_install_read16_handler(io_space, 0x3c0, 0x3cf, 0, 0, paradise_ega16le_03c0_r ); |
| 1279 | memory_install_read16_handler(io_space, 0x3d0, 0x3df, 0, 0, pc1640_16le_port3d0_r ); |
| 1272 | 1280 | |
| 1273 | | memory_install_write16_handler(machine, 0, ADDRESS_SPACE_IO, 0x3b0, 0x3bf, 0, 0, vga_port16le_03b0_w ); |
| 1274 | | memory_install_write16_handler(machine, 0, ADDRESS_SPACE_IO, 0x3c0, 0x3cf, 0, 0, vga_port16le_03c0_w ); |
| 1275 | | memory_install_write16_handler(machine, 0, ADDRESS_SPACE_IO, 0x3d0, 0x3df, 0, 0, vga_port16le_03d0_w ); |
| 1281 | memory_install_write16_handler(io_space, 0x3b0, 0x3bf, 0, 0, vga_port16le_03b0_w ); |
| 1282 | memory_install_write16_handler(io_space, 0x3c0, 0x3cf, 0, 0, vga_port16le_03c0_w ); |
| 1283 | memory_install_write16_handler(io_space, 0x3d0, 0x3df, 0, 0, vga_port16le_03d0_w ); |
| 1276 | 1284 | |
| 1277 | | memory_install_read16_handler(machine, 0, ADDRESS_SPACE_IO, 0x278, 0x27b, 0, 0, pc1640_16le_port278_r ); |
| 1278 | | memory_install_read16_handler(machine, 0, ADDRESS_SPACE_IO, 0x4278, 0x427b, 0, 0, pc1640_16le_port4278_r ); |
| 1285 | memory_install_read16_handler(io_space, 0x278, 0x27b, 0, 0, pc1640_16le_port278_r ); |
| 1286 | memory_install_read16_handler(io_space, 0x4278, 0x427b, 0, 0, pc1640_16le_port4278_r ); |
| 1279 | 1287 | |
| 1280 | 1288 | mess_init_pc_common(machine, PCCOMMON_KEYBOARD_PC, pc_set_keyb_int, pc_set_irq_line); |
| 1281 | 1289 | |
| r3662 | r3663 | |
| 1303 | 1311 | |
| 1304 | 1312 | MACHINE_RESET( pc ) |
| 1305 | 1313 | { |
| 1306 | | cpunum_set_irq_callback(0, pc_irq_callback); |
| 1314 | cpu_set_irq_callback(machine->cpu[0], pc_irq_callback); |
| 1307 | 1315 | |
| 1308 | 1316 | pc_devices.pic8259_master = device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259_master" ); |
| 1309 | 1317 | pc_devices.pic8259_slave = device_list_find_by_tag( machine->config->devicelist, PIC8259, "pic8259_slave" ); |