src/mess/machine/c64.c
| r3931 | r3932 | |
| 27 | 27 | #include "machine/6526cia.h" |
| 28 | 28 | #include "video/vic6567.h" |
| 29 | 29 | #include "video/vdc8563.h" |
| 30 | | #include "deprecat.h" |
| 31 | 30 | |
| 32 | 31 | #include "includes/cbm.h" |
| 33 | 32 | #include "includes/cbmserb.h" |
| r3931 | r3932 | |
| 861 | 860 | } |
| 862 | 861 | |
| 863 | 862 | |
| 864 | | int c64_paddle_read (int which) |
| 863 | int c64_paddle_read (running_machine *machine, int which) |
| 865 | 864 | { |
| 866 | 865 | int pot1 = 0xff, pot2 = 0xff, pot3 = 0xff, pot4 = 0xff, temp; |
| 867 | | UINT8 cia0porta = cia_get_output_a(device_list_find_by_tag(Machine->config->devicelist, CIA6526R1, "cia_0")); |
| 868 | | int controller1 = input_port_read(Machine, "CTRLSEL") & 0x07; |
| 869 | | int controller2 = input_port_read(Machine, "CTRLSEL") & 0x70; |
| 866 | UINT8 cia0porta = cia_get_output_a(device_list_find_by_tag(machine->config->devicelist, CIA6526R1, "cia_0")); |
| 867 | int controller1 = input_port_read(machine, "CTRLSEL") & 0x07; |
| 868 | int controller2 = input_port_read(machine, "CTRLSEL") & 0x70; |
| 870 | 869 | |
| 871 | 870 | /* Notice that only a single input is defined for Mouse & Lightpen in both ports */ |
| 872 | 871 | switch (controller1) |
| 873 | 872 | { |
| 874 | 873 | case 0x01: |
| 875 | 874 | if (which) |
| 876 | | pot2 = input_port_read(Machine, "PADDLE2"); |
| 875 | pot2 = input_port_read(machine, "PADDLE2"); |
| 877 | 876 | else |
| 878 | | pot1 = input_port_read(Machine, "PADDLE1"); |
| 877 | pot1 = input_port_read(machine, "PADDLE1"); |
| 879 | 878 | break; |
| 880 | 879 | |
| 881 | 880 | case 0x02: |
| 882 | 881 | if (which) |
| 883 | | pot2 = input_port_read(Machine, "TRACKY"); |
| 882 | pot2 = input_port_read(machine, "TRACKY"); |
| 884 | 883 | else |
| 885 | | pot1 = input_port_read(Machine, "TRACKX"); |
| 884 | pot1 = input_port_read(machine, "TRACKX"); |
| 886 | 885 | break; |
| 887 | 886 | |
| 888 | 887 | case 0x03: |
| 889 | | if (which && (input_port_read(Machine, "JOY1_2B") & 0x20)) /* Joy1 Button 2 */ |
| 888 | if (which && (input_port_read(machine, "JOY1_2B") & 0x20)) /* Joy1 Button 2 */ |
| 890 | 889 | pot1 = 0x00; |
| 891 | 890 | break; |
| 892 | 891 | |
| 893 | 892 | case 0x04: |
| 894 | 893 | if (which) |
| 895 | | pot2 = input_port_read(Machine, "LIGHTY"); |
| 894 | pot2 = input_port_read(machine, "LIGHTY"); |
| 896 | 895 | else |
| 897 | | pot1 = input_port_read(Machine, "LIGHTX"); |
| 896 | pot1 = input_port_read(machine, "LIGHTX"); |
| 898 | 897 | break; |
| 899 | 898 | |
| 900 | 899 | case 0x00: |
| r3931 | r3932 | |
| 910 | 909 | { |
| 911 | 910 | case 0x10: |
| 912 | 911 | if (which) |
| 913 | | pot4 = input_port_read(Machine, "PADDLE4"); |
| 912 | pot4 = input_port_read(machine, "PADDLE4"); |
| 914 | 913 | else |
| 915 | | pot3 = input_port_read(Machine, "PADDLE3"); |
| 914 | pot3 = input_port_read(machine, "PADDLE3"); |
| 916 | 915 | break; |
| 917 | 916 | |
| 918 | 917 | case 0x20: |
| 919 | 918 | if (which) |
| 920 | | pot4 = input_port_read(Machine, "TRACKY"); |
| 919 | pot4 = input_port_read(machine, "TRACKY"); |
| 921 | 920 | else |
| 922 | | pot3 = input_port_read(Machine, "TRACKX"); |
| 921 | pot3 = input_port_read(machine, "TRACKX"); |
| 923 | 922 | break; |
| 924 | 923 | |
| 925 | 924 | case 0x30: |
| 926 | | if (which && (input_port_read(Machine, "JOY2_2B") & 0x20)) /* Joy2 Button 2 */ |
| 925 | if (which && (input_port_read(machine, "JOY2_2B") & 0x20)) /* Joy2 Button 2 */ |
| 927 | 926 | pot4 = 0x00; |
| 928 | 927 | break; |
| 929 | 928 | |
| 930 | 929 | case 0x40: |
| 931 | 930 | if (which) |
| 932 | | pot4 = input_port_read(Machine, "LIGHTY"); |
| 931 | pot4 = input_port_read(machine, "LIGHTY"); |
| 933 | 932 | else |
| 934 | | pot3 = input_port_read(Machine, "LIGHTX"); |
| 933 | pot3 = input_port_read(machine, "LIGHTX"); |
| 935 | 934 | break; |
| 936 | 935 | |
| 937 | 936 | case 0x00: |
| r3931 | r3932 | |
| 943 | 942 | break; |
| 944 | 943 | } |
| 945 | 944 | |
| 946 | | if (input_port_read(Machine, "CTRLSEL") & 0x80) /* Swap */ |
| 945 | if (input_port_read(machine, "CTRLSEL") & 0x80) /* Swap */ |
| 947 | 946 | { |
| 948 | 947 | temp = pot1; pot1 = pot2; pot2 = pot1; |
| 949 | 948 | temp = pot3; pot3 = pot4; pot4 = pot3; |