src/mess/machine/mboard.c
| r10521 | r10522 | |
| 32 | 32 | static UINT16 Line18_LED; |
| 33 | 33 | static UINT16 Line18_REED; |
| 34 | 34 | |
| 35 | static int led_updates; |
| 36 | |
| 35 | 37 | static MOUSE_HOLD mouse_hold; |
| 36 | 38 | |
| 37 | | static int read_board_flag = TRUE; |
| 38 | | |
| 39 | 39 | static int get_first_bit(UINT8 data) |
| 40 | 40 | { |
| 41 | 41 | int i; |
| r10521 | r10522 | |
| 91 | 91 | |
| 92 | 92 | */ |
| 93 | 93 | |
| 94 | led_updates=0; |
| 95 | |
| 94 | 96 | /* looking for cleared bit in mask Line18_REED => current line */ |
| 95 | 97 | |
| 96 | 98 | if (data && Line18_REED) |
| r10521 | r10522 | |
| 102 | 104 | for ( i_AH = 0; i_AH < 8; i_AH = i_AH + 1) |
| 103 | 105 | if (IsPiece(64-(i_18*8 + 8-i_AH))) |
| 104 | 106 | data &= ~(1 << i_AH); // clear bit |
| 105 | | |
| 106 | | read_board_flag = TRUE; |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | return data; |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | |
| 113 | | static void write_board( running_machine *machine, UINT8 data) |
| 113 | static void write_board(UINT8 data) |
| 114 | 114 | { |
| 115 | 115 | |
| 116 | 116 | Line18_REED=data; |
| 117 | Line18_LED = data; |
| 117 | 118 | |
| 118 | | if (read_board_flag && !strcmp(machine->m_game.name,"glasgow") ) //HACK |
| 119 | | Line18_LED = 0; |
| 120 | | else |
| 121 | | Line18_LED = data; |
| 122 | | |
| 123 | | read_board_flag = FALSE; |
| 124 | | |
| 125 | 119 | if (data == 0xff) |
| 126 | 120 | mboard_key_selector = 0; |
| 127 | 121 | } |
| 128 | 122 | |
| 129 | 123 | |
| 130 | 124 | |
| 131 | | static void write_LED(UINT8 data) |
| 125 | static void write_LED(running_machine *machine, UINT8 data) |
| 132 | 126 | { |
| 133 | 127 | int i; |
| 134 | 128 | UINT8 i_AH, i_18; |
| 135 | 129 | UINT8 LED; |
| 136 | 130 | |
| 137 | 131 | mboard_lcd_invert = 1; |
| 132 | |
| 138 | 133 | /* |
| 139 | 134 | |
| 140 | 135 | Example: turn led E2 on |
| r10521 | r10522 | |
| 147 | 142 | for (i=0; i < 64; i++) /* all LED's off */ |
| 148 | 143 | output_set_led_value(i, 0); |
| 149 | 144 | |
| 145 | led_updates++; |
| 146 | if ( (!strcmp(machine->m_game.name,"glasgow")) && led_updates <= 3) // HACK Change between board scan and trigger LED's |
| 147 | return; // cause problems in glasgow emulation |
| 148 | |
| 150 | 149 | if (Line18_LED) |
| 151 | 150 | { |
| 152 | 151 | for (i_AH = 0; i_AH < 8; i_AH++) /* turn LED on depending on bit masks */ |
| r10521 | r10522 | |
| 196 | 195 | |
| 197 | 196 | WRITE8_HANDLER( mboard_write_board_8 ) |
| 198 | 197 | { |
| 199 | | write_board(space->machine,data); |
| 198 | write_board(data); |
| 200 | 199 | logerror("Write Board Port Data = %02x\n ",data); |
| 201 | 200 | } |
| 202 | 201 | |
| 203 | 202 | WRITE16_HANDLER( mboard_write_board_16 ) |
| 204 | 203 | { |
| 205 | | if (data && 0xff) write_board(space->machine,data); |
| 204 | if (data && 0xff) write_board(data); |
| 206 | 205 | logerror("write board 16 %08x\n",data); |
| 207 | | write_board(space->machine,data>>8); |
| 206 | write_board(data>>8); |
| 208 | 207 | } |
| 209 | 208 | |
| 210 | 209 | WRITE32_HANDLER( mboard_write_board_32 ) |
| 211 | 210 | { |
| 212 | 211 | data |= data << 24; |
| 213 | 212 | logerror("write board 32 o: %08x d: %08x\n",offset,data); |
| 214 | | write_board(space->machine,data>>24); |
| 213 | write_board(data>>24); |
| 215 | 214 | } |
| 216 | 215 | |
| 217 | 216 | WRITE8_HANDLER( mboard_write_LED_8 ) |
| 218 | 217 | { |
| 219 | | write_LED(data); |
| 218 | write_LED(space->machine,data); |
| 220 | 219 | cpu_spinuntil_time(space->cpu, attotime::from_usec(7)); |
| 221 | 220 | } |
| 222 | 221 | |
| 223 | 222 | WRITE16_HANDLER( mboard_write_LED_16 ) |
| 224 | 223 | { |
| 225 | | write_LED(data >> 8); |
| 224 | write_LED(space->machine,data >> 8); |
| 226 | 225 | cpu_spinuntil_time(space->cpu, attotime::from_usec(9)); |
| 227 | 226 | } |
| 228 | 227 | |
| 229 | 228 | WRITE32_HANDLER( mboard_write_LED_32 ) |
| 230 | 229 | { |
| 231 | 230 | data = data | data << 24; |
| 232 | | write_LED(data >> 24); |
| 231 | write_LED(space->machine,data >> 24); |
| 233 | 232 | cpu_spinuntil_time(space->cpu, attotime::from_usec(20)); |
| 234 | 233 | } |
| 235 | 234 | |
| r10521 | r10522 | |
| 366 | 365 | if (!(pos2num_res < 8)) |
| 367 | 366 | logerror("Position out of bound!"); |
| 368 | 367 | |
| 369 | | else if ((mouse_hold.piece) && (!IsPiece(field))) |
| 368 | else if (mouse_hold.piece) // && (!IsPiece(field))) capture move |
| 370 | 369 | { |
| 371 | 370 | /* Moving a piece onto a blank */ |
| 372 | 371 | m_board[field] = mouse_hold.piece; |
| r10521 | r10522 | |
| 414 | 413 | mouse_hold.piece = 0; |
| 415 | 414 | mouse_hold.border_piece = FALSE; |
| 416 | 415 | } |
| 417 | | |
| 418 | 416 | return; |
| 419 | 417 | } |
| 420 | 418 | |
| 419 | |
| 421 | 420 | /* check additional buttons */ |
| 422 | 421 | if (data == 0xff) |
| 423 | 422 | { |
src/mess/drivers/polgar.c
| r10521 | r10522 | |
| 128 | 128 | { |
| 129 | 129 | for (i=0;i<8;i++) |
| 130 | 130 | output_set_led_value(10+i,!BIT(state->latch_data,7-i)); |
| 131 | | }else if (!data) |
| 131 | } |
| 132 | else if (!data && (!strcmp(space->machine->m_game.name,"milano"))) |
| 132 | 133 | for (i=0;i<8;i++) |
| 133 | 134 | { |
| 134 | 135 | output_set_led_value(i,!BIT(state->latch_data,i)); |
| r10521 | r10522 | |
| 242 | 243 | #endif |
| 243 | 244 | data=input_port_read(space->machine, keynames[0][offset]); |
| 244 | 245 | |
| 245 | | // logerror("read_keys = %s Data = %d\n ", keynames[0][offset], data); |
| 246 | | //logerror("read_keys: Data = %d offset = %d\n ",data, offset); |
| 247 | | |
| 248 | 246 | // logerror("Keyboard Port = %s Data = %d\n ", ((state->led_status & 0x80) == 0x00) ? keynames[0][offset] : keynames[1][offset], data); |
| 249 | 247 | return data | 0x7f; |
| 250 | 248 | } |
| r10521 | r10522 | |
| 322 | 320 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 323 | 321 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 324 | 322 | PORT_START("LINE3") |
| 325 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) |
| 326 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) |
| 327 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) |
| 328 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) |
| 329 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) |
| 330 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) |
| 331 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) |
| 332 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) |
| 323 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 324 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 325 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 326 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 327 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 328 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 329 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 330 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 333 | 331 | PORT_START("LINE4") |
| 334 | 332 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) |
| 335 | 333 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) |