src/mess/machine/c128.c
| r4734 | r4735 | |
| 20 | 20 | #include "video/vic6567.h" |
| 21 | 21 | #include "video/vdc8563.h" |
| 22 | 22 | |
| 23 | #include "cbmipt.h" /* we need cbm_common_interrupt & c64_keyline for input reading */ |
| 24 | |
| 23 | 25 | #include "includes/c128.h" |
| 24 | 26 | #include "includes/c64.h" |
| 25 | 27 | |
| r4734 | r4735 | |
| 70 | 72 | |
| 71 | 73 | static UINT8 c64_port_data; |
| 72 | 74 | |
| 75 | static UINT8 c128_keyline[3] = {0xff, 0xff, 0xff}; |
| 76 | |
| 73 | 77 | static void c128_set_m8502_read_handler(running_machine *machine, UINT16 start, UINT16 end, read8_space_func rh) |
| 74 | 78 | { |
| 75 | 79 | const device_config *cpu; |
| r4734 | r4735 | |
| 959 | 963 | cputag_set_input_line(machine, "m8502", INPUT_LINE_HALT, ASSERT_LINE); |
| 960 | 964 | } |
| 961 | 965 | |
| 966 | |
| 967 | static void c128_nmi(running_machine *machine) |
| 968 | { |
| 969 | static int nmilevel = 0; |
| 970 | const device_config *cia_1 = devtag_get_device(machine, "cia_1"); |
| 971 | int cia1irq = cia_get_irq(cia_1); |
| 972 | |
| 973 | if (nmilevel != (input_port_read(machine, "SPECIAL") & 0x80) || cia1irq) /* KEY_RESTORE */ |
| 974 | { |
| 975 | if (1) // this was never valid, there is no active CPU during a timer firing! cpu_getactivecpu() == 0) |
| 976 | { |
| 977 | /* z80 */ |
| 978 | cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, (input_port_read(machine, "SPECIAL") & 0x80) || cia1irq); |
| 979 | } |
| 980 | else |
| 981 | { |
| 982 | cputag_set_input_line(machine, "m8502", INPUT_LINE_NMI, (input_port_read(machine, "SPECIAL") & 0x80) || cia1irq); |
| 983 | } |
| 984 | |
| 985 | nmilevel = (input_port_read(machine, "SPECIAL") & 0x80) || cia1irq; |
| 986 | } |
| 987 | } |
| 988 | |
| 989 | INTERRUPT_GEN( c128_frame_interrupt ) |
| 990 | { |
| 991 | static int monitor = -1; |
| 992 | static const char *const c128ports[] = { "KP0", "KP1", "KP2" }; |
| 993 | int i, value; |
| 994 | |
| 995 | c128_nmi(device->machine); |
| 996 | |
| 997 | if ((input_port_read(device->machine, "SPECIAL") & 0x08) != monitor) |
| 998 | { |
| 999 | if (input_port_read(device->machine, "SPECIAL") & 0x08) |
| 1000 | { |
| 1001 | vic2_set_rastering(0); |
| 1002 | vdc8563_set_rastering(1); |
| 1003 | video_screen_set_visarea(device->machine->primary_screen, 0, 655, 0, 215); |
| 1004 | } |
| 1005 | else |
| 1006 | { |
| 1007 | vic2_set_rastering(1); |
| 1008 | vdc8563_set_rastering(0); |
| 1009 | if (c64_pal) |
| 1010 | video_screen_set_visarea(device->machine->primary_screen, VIC6569_STARTVISIBLECOLUMNS, VIC6569_STARTVISIBLECOLUMNS + VIC6569_VISIBLECOLUMNS - 1, VIC6569_STARTVISIBLELINES, VIC6569_STARTVISIBLELINES + VIC6569_VISIBLELINES - 1); |
| 1011 | else |
| 1012 | video_screen_set_visarea(device->machine->primary_screen, VIC6567_STARTVISIBLECOLUMNS, VIC6567_STARTVISIBLECOLUMNS + VIC6567_VISIBLECOLUMNS - 1, VIC6567_STARTVISIBLELINES, VIC6567_STARTVISIBLELINES + VIC6567_VISIBLELINES - 1); |
| 1013 | } |
| 1014 | monitor = input_port_read(device->machine, "SPECIAL") & 0x08; |
| 1015 | } |
| 1016 | |
| 1017 | |
| 1018 | /* common keys input ports */ |
| 1019 | cbm_common_interrupt(device); |
| 1020 | |
| 1021 | /* Fix Me! Currently, neither left Shift nor Shift Lock work in c128, but reading the correspondent input produces a bug! |
| 1022 | Hence, we overwrite the actual reading as it never happens */ |
| 1023 | if ((input_port_read(device->machine, "SPECIAL") & 0x40)) // |
| 1024 | c64_keyline[1] |= 0x80; |
| 1025 | |
| 1026 | /* c128 specific: keypad input ports */ |
| 1027 | for (i = 0; i < 3; i++) |
| 1028 | { |
| 1029 | value = 0xff; |
| 1030 | value &= ~input_port_read(device->machine, c128ports[i]); |
| 1031 | c128_keyline[i] = value; |
| 1032 | } |
| 1033 | } |
| 1034 | |
| 1035 | |
| 962 | 1036 | VIDEO_START( c128 ) |
| 963 | 1037 | { |
| 964 | 1038 | VIDEO_START_CALL(vdc8563); |
src/mess/machine/cbmipt.c
| r4734 | r4735 | |
| 19 | 19 | #include "driver.h" |
| 20 | 20 | #include "machine/cbmipt.h" |
| 21 | 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | /*********************************************** |
| 26 | |
| 27 | Input Reading - Common Components |
| 28 | |
| 29 | ***********************************************/ |
| 30 | |
| 31 | /* These are needed by c64, c65 and c128, each machine has also additional specific |
| 32 | components in its INTERRUPT_GEN */ |
| 33 | |
| 34 | /* keyboard lines */ |
| 35 | UINT8 c64_keyline[10] = |
| 36 | { |
| 37 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff |
| 38 | }; |
| 39 | |
| 40 | |
| 41 | static TIMER_CALLBACK( lightpen_tick ) |
| 42 | { |
| 43 | if ((input_port_read(machine, "CTRLSEL") & 0x07) == 0x04) |
| 44 | { |
| 45 | /* enable lightpen crosshair */ |
| 46 | crosshair_set_screen(machine, 0, CROSSHAIR_SCREEN_ALL); |
| 47 | } |
| 48 | else |
| 49 | { |
| 50 | /* disable lightpen crosshair */ |
| 51 | crosshair_set_screen(machine, 0, CROSSHAIR_SCREEN_NONE); |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | void cbm_common_interrupt( const device_config *device ) |
| 56 | { |
| 57 | int value, i; |
| 58 | int controller1 = input_port_read(device->machine, "CTRLSEL") & 0x07; |
| 59 | int controller2 = input_port_read(device->machine, "CTRLSEL") & 0x70; |
| 60 | static const char *const c64ports[] = { "ROW0", "ROW1", "ROW2", "ROW3", "ROW4", "ROW5", "ROW6", "ROW7" }; |
| 61 | |
| 62 | /* Lines 0-7 : common keyboard */ |
| 63 | for (i = 0; i < 8; i++) |
| 64 | { |
| 65 | value = 0xff; |
| 66 | value &= ~input_port_read(device->machine, c64ports[i]); |
| 67 | |
| 68 | /* Shift Lock is mapped on Left Shift */ |
| 69 | if ((i == 1) && (input_port_read(device->machine, "SPECIAL") & 0x40)) |
| 70 | value &= ~0x80; |
| 71 | |
| 72 | c64_keyline[i] = value; |
| 73 | } |
| 74 | |
| 75 | |
| 76 | value = 0xff; |
| 77 | switch(controller1) |
| 78 | { |
| 79 | case 0x00: |
| 80 | value &= ~input_port_read(device->machine, "JOY1_1B"); /* Joy1 Directions + Button 1 */ |
| 81 | break; |
| 82 | |
| 83 | case 0x01: |
| 84 | if (input_port_read(device->machine, "OTHER") & 0x40) /* Paddle2 Button */ |
| 85 | value &= ~0x08; |
| 86 | if (input_port_read(device->machine, "OTHER") & 0x80) /* Paddle1 Button */ |
| 87 | value &= ~0x04; |
| 88 | break; |
| 89 | |
| 90 | case 0x02: |
| 91 | if (input_port_read(device->machine, "OTHER") & 0x02) /* Mouse Button Left */ |
| 92 | value &= ~0x10; |
| 93 | if (input_port_read(device->machine, "OTHER") & 0x01) /* Mouse Button Right */ |
| 94 | value &= ~0x01; |
| 95 | break; |
| 96 | |
| 97 | case 0x03: |
| 98 | value &= ~(input_port_read(device->machine, "JOY1_2B") & 0x1f); /* Joy1 Directions + Button 1 */ |
| 99 | break; |
| 100 | |
| 101 | case 0x04: |
| 102 | /* was there any input on the lightpen? where is it mapped? */ |
| 103 | // if (input_port_read(device->machine, "OTHER") & 0x04) /* Lightpen Signal */ |
| 104 | // value &= ?? ; |
| 105 | break; |
| 106 | |
| 107 | case 0x07: |
| 108 | break; |
| 109 | |
| 110 | default: |
| 111 | logerror("Invalid Controller 1 Setting %d\n", controller1); |
| 112 | break; |
| 113 | } |
| 114 | |
| 115 | c64_keyline[8] = value; |
| 116 | |
| 117 | |
| 118 | value = 0xff; |
| 119 | switch(controller2) |
| 120 | { |
| 121 | case 0x00: |
| 122 | value &= ~input_port_read(device->machine, "JOY2_1B"); /* Joy2 Directions + Button 1 */ |
| 123 | break; |
| 124 | |
| 125 | case 0x10: |
| 126 | if (input_port_read(device->machine, "OTHER") & 0x10) /* Paddle4 Button */ |
| 127 | value &= ~0x08; |
| 128 | if (input_port_read(device->machine, "OTHER") & 0x20) /* Paddle3 Button */ |
| 129 | value &= ~0x04; |
| 130 | break; |
| 131 | |
| 132 | case 0x20: |
| 133 | if (input_port_read(device->machine, "OTHER") & 0x02) /* Mouse Button Left */ |
| 134 | value &= ~0x10; |
| 135 | if (input_port_read(device->machine, "OTHER") & 0x01) /* Mouse Button Right */ |
| 136 | value &= ~0x01; |
| 137 | break; |
| 138 | |
| 139 | case 0x30: |
| 140 | value &= ~(input_port_read(device->machine, "JOY2_2B") & 0x1f); /* Joy2 Directions + Button 1 */ |
| 141 | break; |
| 142 | |
| 143 | case 0x40: |
| 144 | /* was there any input on the lightpen? where is it mapped? */ |
| 145 | // if (input_port_read(device->machine, "OTHER") & 0x04) /* Lightpen Signal */ |
| 146 | // value &= ?? ; |
| 147 | break; |
| 148 | |
| 149 | case 0x70: |
| 150 | break; |
| 151 | |
| 152 | default: |
| 153 | logerror("Invalid Controller 2 Setting %d\n", controller2); |
| 154 | break; |
| 155 | } |
| 156 | |
| 157 | c64_keyline[9] = value; |
| 158 | |
| 159 | // vic2_frame_interrupt does nothing so this is not necessary |
| 160 | // vic2_frame_interrupt (device); |
| 161 | |
| 162 | /* check if lightpen has been chosen as input: if so, enable crosshair */ |
| 163 | timer_set(device->machine, attotime_zero, NULL, 0, lightpen_tick); |
| 164 | |
| 165 | set_led_status (1, input_port_read(device->machine, "SPECIAL") & 0x40 ? 1 : 0); /* Shift Lock */ |
| 166 | set_led_status (0, input_port_read(device->machine, "CTRLSEL") & 0x80 ? 1 : 0); /* Joystick Swap */ |
| 167 | } |
| 168 | |
| 169 | |
| 170 | |
| 171 | |
| 172 | /*********************************************** |
| 173 | |
| 174 | Input Ports |
| 175 | |
| 176 | ***********************************************/ |
| 177 | |
| 22 | 178 | /***************************** Commodore 64 **************************************** |
| 23 | 179 | * |
| 24 | 180 | * - common_cbm_keyboard: C64 keyboard; used by C16, C65 and C128 as well |
| r4734 | r4735 | |
| 388 | 544 | ESC TAB ALT LOCK HELP FEED DISPLAY SCROLL UP DOWN LEFT RIGHT F1 F3 F5 F7 |
| 389 | 545 | |
| 390 | 546 | CLR INST |
| 391 | | <- 1! 2" 3# 4$ 5% 6& 7' 8( 9) 0 + - £ HOME DEL 7 8 9 + |
| 547 | <- 1! 2" 3# 4$ 5% 6& 7' 8( 9) 0 + - £ HOME DEL 7 8 9 + |
| 392 | 548 | |
| 393 | 549 | |
| 394 | 550 | CONTROL Q W E R T Y U I O P @ * UP RESTORE 4 5 6 - |
src/mess/machine/c64.c
| r4734 | r4735 | |
| 26 | 26 | #include "includes/cbmserb.h" |
| 27 | 27 | #include "includes/cbmdrive.h" |
| 28 | 28 | #include "includes/vc1541.h" |
| 29 | #include "cbmipt.h" /* we need cbm_common_interrupt & c64_keyline for input reading */ |
| 29 | 30 | |
| 30 | 31 | #include "includes/c64.h" |
| 31 | 32 | #include "includes/c128.h" /* we need c128_bankswitch_64 in MACHINE_START */ |
| r4734 | r4735 | |
| 44 | 45 | } \ |
| 45 | 46 | } while (0) |
| 46 | 47 | |
| 47 | | unsigned char c65_keyline = { 0xff }; |
| 48 | | UINT8 c65_6511_port=0xff; |
| 48 | /* still needed for CIA interfaces, will be factored out soon... */ |
| 49 | UINT8 c65_6511_port = 0xff; |
| 50 | static UINT8 c65_keyline = { 0xff }; |
| 51 | static UINT8 c128_keyline[3] = {0xff, 0xff, 0xff}; |
| 49 | 52 | |
| 50 | | UINT8 c128_keyline[3] = {0xff, 0xff, 0xff}; |
| 51 | | |
| 52 | | |
| 53 | | /* keyboard lines */ |
| 54 | | UINT8 c64_keyline[10] = |
| 55 | | { |
| 56 | | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff |
| 57 | | }; |
| 58 | | |
| 59 | 53 | /* expansion port lines input */ |
| 60 | 54 | int c64_pal = 0; |
| 61 | 55 | UINT8 c64_game = 1, c64_exrom = 1; |
| r4734 | r4735 | |
| 108 | 102 | |
| 109 | 103 | if (nmilevel != (input_port_read(machine, "SPECIAL") & 0x80) || cia1irq) /* KEY_RESTORE */ |
| 110 | 104 | { |
| 111 | | if (is_c128(machine)) |
| 112 | | { |
| 113 | | if (1) // this was never valid, there is no active CPU during a timer firing! cpu_getactivecpu() == 0) |
| 114 | | { |
| 115 | | /* z80 */ |
| 116 | | cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, (input_port_read(machine, "SPECIAL") & 0x80) || cia1irq); |
| 117 | | } |
| 118 | | else |
| 119 | | { |
| 120 | | cputag_set_input_line(machine, "m8502", INPUT_LINE_NMI, (input_port_read(machine, "SPECIAL") & 0x80) || cia1irq); |
| 121 | | } |
| 122 | | } |
| 105 | cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, (input_port_read(machine, "SPECIAL") & 0x80) || cia1irq); |
| 123 | 106 | |
| 124 | | else |
| 125 | | { |
| 126 | | cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, (input_port_read(machine, "SPECIAL") & 0x80) || cia1irq); |
| 127 | | } |
| 128 | | |
| 129 | 107 | nmilevel = (input_port_read(machine, "SPECIAL") & 0x80) || cia1irq; |
| 130 | 108 | } |
| 131 | 109 | } |
| r4734 | r4735 | |
| 848 | 826 | { |
| 849 | 827 | if (input_port_read(device->machine, "SPECIAL") & 0x20) /* Check Caps Lock */ |
| 850 | 828 | data &= ~0x40; |
| 851 | | |
| 852 | 829 | else |
| 853 | 830 | data |= 0x40; |
| 854 | 831 | } |
| r4734 | r4735 | |
| 1077 | 1054 | { |
| 1078 | 1055 | if (is_sx64 /* || is_c128d(machine) */) |
| 1079 | 1056 | { |
| 1080 | | cbm_serial_config(machine, &cbm_fake_drive_interface); |
| 1057 | cbm_serial_config(machine, &cbm_emu_drive_interface); |
| 1081 | 1058 | drive_reset (); |
| 1082 | 1059 | } |
| 1083 | 1060 | |
| r4734 | r4735 | |
| 1109 | 1086 | } |
| 1110 | 1087 | |
| 1111 | 1088 | |
| 1112 | | static TIMER_CALLBACK( lightpen_tick ) |
| 1113 | | { |
| 1114 | | if ((input_port_read(machine, "CTRLSEL") & 0x07) == 0x04) |
| 1115 | | { |
| 1116 | | /* enable lightpen crosshair */ |
| 1117 | | crosshair_set_screen(machine, 0, CROSSHAIR_SCREEN_ALL); |
| 1118 | | } |
| 1119 | | else |
| 1120 | | { |
| 1121 | | /* disable lightpen crosshair */ |
| 1122 | | crosshair_set_screen(machine, 0, CROSSHAIR_SCREEN_NONE); |
| 1123 | | } |
| 1124 | | } |
| 1125 | | |
| 1126 | 1089 | INTERRUPT_GEN( c64_frame_interrupt ) |
| 1127 | 1090 | { |
| 1128 | | static int monitor = -1; |
| 1129 | | int value, i; |
| 1130 | | int controller1 = input_port_read(device->machine, "CTRLSEL") & 0x07; |
| 1131 | | int controller2 = input_port_read(device->machine, "CTRLSEL") & 0x70; |
| 1132 | | static const char *const c64ports[] = { "ROW0", "ROW1", "ROW2", "ROW3", "ROW4", "ROW5", "ROW6", "ROW7" }; |
| 1133 | | static const char *const c128ports[] = { "KP0", "KP1", "KP2" }; |
| 1134 | | |
| 1135 | 1091 | c64_nmi(device->machine); |
| 1136 | | |
| 1137 | | if (is_c128(device->machine)) |
| 1138 | | { |
| 1139 | | if ((input_port_read(device->machine, "SPECIAL") & 0x08) != monitor) |
| 1140 | | { |
| 1141 | | if (input_port_read(device->machine, "SPECIAL") & 0x08) |
| 1142 | | { |
| 1143 | | vic2_set_rastering(0); |
| 1144 | | vdc8563_set_rastering(1); |
| 1145 | | video_screen_set_visarea(device->machine->primary_screen, 0, 655, 0, 215); |
| 1146 | | } |
| 1147 | | else |
| 1148 | | { |
| 1149 | | vic2_set_rastering(1); |
| 1150 | | vdc8563_set_rastering(0); |
| 1151 | | if (c64_pal) |
| 1152 | | video_screen_set_visarea(device->machine->primary_screen, VIC6569_STARTVISIBLECOLUMNS, VIC6569_STARTVISIBLECOLUMNS + VIC6569_VISIBLECOLUMNS - 1, VIC6569_STARTVISIBLELINES, VIC6569_STARTVISIBLELINES + VIC6569_VISIBLELINES - 1); |
| 1153 | | else |
| 1154 | | video_screen_set_visarea(device->machine->primary_screen, VIC6567_STARTVISIBLECOLUMNS, VIC6567_STARTVISIBLECOLUMNS + VIC6567_VISIBLECOLUMNS - 1, VIC6567_STARTVISIBLELINES, VIC6567_STARTVISIBLELINES + VIC6567_VISIBLELINES - 1); |
| 1155 | | } |
| 1156 | | monitor = input_port_read(device->machine, "SPECIAL") & 0x08; |
| 1157 | | } |
| 1158 | | } |
| 1159 | | |
| 1160 | | /* Lines 0-7 : common keyboard */ |
| 1161 | | for (i = 0; i < 8; i++) |
| 1162 | | { |
| 1163 | | value = 0xff; |
| 1164 | | value &= ~input_port_read(device->machine, c64ports[i]); |
| 1165 | | |
| 1166 | | /* Shift Lock is mapped on Left Shift */ |
| 1167 | | if ((i == 1) && (input_port_read(device->machine, "SPECIAL") & 0x40) && !is_c128(device->machine)) // Fix Me! Currently, neither left Shift nor Shift Lock works in c128, but reading this in c128 produces a bug! |
| 1168 | | value &= ~0x80; |
| 1169 | | |
| 1170 | | c64_keyline[i] = value; |
| 1171 | | } |
| 1172 | | |
| 1173 | | |
| 1174 | | value = 0xff; |
| 1175 | | switch(controller1) |
| 1176 | | { |
| 1177 | | case 0x00: |
| 1178 | | value &= ~input_port_read(device->machine, "JOY1_1B"); /* Joy1 Directions + Button 1 */ |
| 1179 | | break; |
| 1180 | | |
| 1181 | | case 0x01: |
| 1182 | | if (input_port_read(device->machine, "OTHER") & 0x40) /* Paddle2 Button */ |
| 1183 | | value &= ~0x08; |
| 1184 | | if (input_port_read(device->machine, "OTHER") & 0x80) /* Paddle1 Button */ |
| 1185 | | value &= ~0x04; |
| 1186 | | break; |
| 1187 | | |
| 1188 | | case 0x02: |
| 1189 | | if (input_port_read(device->machine, "OTHER") & 0x02) /* Mouse Button Left */ |
| 1190 | | value &= ~0x10; |
| 1191 | | if (input_port_read(device->machine, "OTHER") & 0x01) /* Mouse Button Right */ |
| 1192 | | value &= ~0x01; |
| 1193 | | break; |
| 1194 | | |
| 1195 | | case 0x03: |
| 1196 | | value &= ~(input_port_read(device->machine, "JOY1_2B") & 0x1f); /* Joy1 Directions + Button 1 */ |
| 1197 | | break; |
| 1198 | | |
| 1199 | | case 0x04: |
| 1200 | | /* was there any input on the lightpen? where is it mapped? */ |
| 1201 | | // if (input_port_read(device->machine, "OTHER") & 0x04) /* Lightpen Signal */ |
| 1202 | | // value &= ?? ; |
| 1203 | | break; |
| 1204 | | |
| 1205 | | case 0x07: |
| 1206 | | break; |
| 1207 | | |
| 1208 | | default: |
| 1209 | | logerror("Invalid Controller 1 Setting %d\n", controller1); |
| 1210 | | break; |
| 1211 | | } |
| 1212 | | |
| 1213 | | c64_keyline[8] = value; |
| 1214 | | |
| 1215 | | |
| 1216 | | value = 0xff; |
| 1217 | | switch(controller2) |
| 1218 | | { |
| 1219 | | case 0x00: |
| 1220 | | value &= ~input_port_read(device->machine, "JOY2_1B"); /* Joy2 Directions + Button 1 */ |
| 1221 | | break; |
| 1222 | | |
| 1223 | | case 0x10: |
| 1224 | | if (input_port_read(device->machine, "OTHER") & 0x10) /* Paddle4 Button */ |
| 1225 | | value &= ~0x08; |
| 1226 | | if (input_port_read(device->machine, "OTHER") & 0x20) /* Paddle3 Button */ |
| 1227 | | value &= ~0x04; |
| 1228 | | break; |
| 1229 | | |
| 1230 | | case 0x20: |
| 1231 | | if (input_port_read(device->machine, "OTHER") & 0x02) /* Mouse Button Left */ |
| 1232 | | value &= ~0x10; |
| 1233 | | if (input_port_read(device->machine, "OTHER") & 0x01) /* Mouse Button Right */ |
| 1234 | | value &= ~0x01; |
| 1235 | | break; |
| 1236 | | |
| 1237 | | case 0x30: |
| 1238 | | value &= ~(input_port_read(device->machine, "JOY2_2B") & 0x1f); /* Joy2 Directions + Button 1 */ |
| 1239 | | break; |
| 1240 | | |
| 1241 | | case 0x40: |
| 1242 | | /* was there any input on the lightpen? where is it mapped? */ |
| 1243 | | // if (input_port_read(device->machine, "OTHER") & 0x04) /* Lightpen Signal */ |
| 1244 | | // value &= ?? ; |
| 1245 | | break; |
| 1246 | | |
| 1247 | | case 0x70: |
| 1248 | | break; |
| 1249 | | |
| 1250 | | default: |
| 1251 | | logerror("Invalid Controller 2 Setting %d\n", controller2); |
| 1252 | | break; |
| 1253 | | } |
| 1254 | | |
| 1255 | | c64_keyline[9] = value; |
| 1256 | | |
| 1257 | | /* C128 only : keypad input ports */ |
| 1258 | | if (is_c128(device->machine)) |
| 1259 | | { |
| 1260 | | for (i = 0; i < 3; i++) |
| 1261 | | { |
| 1262 | | value = 0xff; |
| 1263 | | value &= ~input_port_read(device->machine, c128ports[i]); |
| 1264 | | c128_keyline[i] = value; |
| 1265 | | } |
| 1266 | | } |
| 1267 | | |
| 1268 | | /* C65 only : function keys input ports */ |
| 1269 | | if (is_c65(device->machine)) |
| 1270 | | { |
| 1271 | | value = 0xff; |
| 1272 | | |
| 1273 | | value &= ~input_port_read(device->machine, "FUNCT"); |
| 1274 | | c65_keyline = value; |
| 1275 | | } |
| 1276 | | |
| 1277 | | // vic2_frame_interrupt does nothing so this is not necessary |
| 1278 | | // vic2_frame_interrupt (device); |
| 1279 | | |
| 1280 | | /* check if lightpen has been chosen as input: if so, enable crosshair */ |
| 1281 | | timer_set(device->machine, attotime_zero, NULL, 0, lightpen_tick); |
| 1282 | | |
| 1283 | | set_led_status (1, input_port_read(device->machine, "SPECIAL") & 0x40 ? 1 : 0); /* Shift Lock */ |
| 1284 | | set_led_status (0, input_port_read(device->machine, "CTRLSEL") & 0x80 ? 1 : 0); /* Joystick Swap */ |
| 1092 | cbm_common_interrupt(device); |
| 1285 | 1093 | } |
| 1286 | 1094 | |
| 1287 | 1095 | |