src/mess/drivers/glasgow.c
| r10408 | r10409 | |
| 260 | 260 | // irq_edge = ~irq_edge; |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | | static TIMER_DEVICE_CALLBACK( update_nmi32 ) |
| 263 | static TIMER_CALLBACK( update_nmi32 ) |
| 264 | 264 | { |
| 265 | 265 | // cputag_set_input_line_and_vector(timer.machine, "maincpu", M68K_IRQ_7, irq_edge & 0xff ? CLEAR_LINE : ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); |
| 266 | | cputag_set_input_line_and_vector(timer.machine, "maincpu", M68K_IRQ_7, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); |
| 267 | | cputag_set_input_line_and_vector(timer.machine, "maincpu", M68K_IRQ_7, CLEAR_LINE, M68K_INT_ACK_AUTOVECTOR); |
| 266 | cputag_set_input_line_and_vector(machine, "maincpu", M68K_IRQ_7, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); |
| 267 | cputag_set_input_line_and_vector(machine, "maincpu", M68K_IRQ_7, CLEAR_LINE, M68K_INT_ACK_AUTOVECTOR); |
| 268 | 268 | // irq_edge = ~irq_edge; |
| 269 | 269 | } |
| 270 | 270 | |
| r10408 | r10409 | |
| 290 | 290 | state->lcd_shift_counter = 3; |
| 291 | 291 | beep_set_frequency(speaker, 44); |
| 292 | 292 | |
| 293 | machine->scheduler().timer_pulse(attotime::from_hz(50),FUNC(update_nmi32),NULL); |
| 294 | |
| 293 | 295 | mboard_savestate_register(machine); |
| 294 | 296 | } |
| 295 | 297 | |
| r10408 | r10409 | |
| 523 | 525 | MCFG_MACHINE_START( dallas32 ) |
| 524 | 526 | |
| 525 | 527 | MCFG_DEVICE_REMOVE("nmi_timer") |
| 526 | | MCFG_TIMER_ADD_PERIODIC("nmi_timer", update_nmi32, attotime::from_hz(50)) |
| 528 | |
| 527 | 529 | MACHINE_CONFIG_END |
| 528 | 530 | |
| 529 | 531 | /*************************************************************************** |
src/mess/drivers/supercon.c
| r10408 | r10409 | |
| 32 | 32 | |
| 33 | 33 | UINT8 *ram; |
| 34 | 34 | emu_timer* timer_update_irq; |
| 35 | emu_timer* timer_mouse_click; |
| 35 | 36 | int emu_started; |
| 36 | 37 | int moving_piece; |
| 37 | 38 | UINT8 data_1E00; |
| r10408 | r10409 | |
| 44 | 45 | int led_update; |
| 45 | 46 | int remove_led_flag; |
| 46 | 47 | int selecting; |
| 48 | int save_key_data; |
| 49 | attotime wait_time; |
| 50 | int *current_field; |
| 47 | 51 | int confirm_board_click; |
| 48 | | int *current_field; |
| 49 | 52 | int m_board[64]; |
| 50 | 53 | int save_board[64]; |
| 51 | 54 | }; |
| r10408 | r10409 | |
| 88 | 91 | #define TAKE 1 |
| 89 | 92 | #define SET 2 |
| 90 | 93 | |
| 91 | | |
| 92 | | |
| 93 | | |
| 94 | | |
| 95 | | |
| 96 | | |
| 97 | | |
| 98 | | |
| 99 | 94 | /* artwork board */ |
| 100 | 95 | static const int start_board[64] = |
| 101 | 96 | { |
| r10408 | r10409 | |
| 193 | 188 | static void mouse_update(running_machine *machine) |
| 194 | 189 | { |
| 195 | 190 | supercon_state *state = machine->driver_data<supercon_state>(); |
| 196 | | UINT8 port_input, m_left; |
| 191 | UINT8 port_input; // m_left; |
| 197 | 192 | int i; |
| 198 | 193 | |
| 199 | | /* Set-remove piece after mouse release and confirmation of a board click = beep */ |
| 200 | | |
| 201 | | m_left=input_port_read(machine, "BUTTON_L"); |
| 202 | | if (!m_left && state->selecting) |
| 203 | | { |
| 204 | | if (state->confirm_board_click) |
| 205 | | { |
| 206 | | if (state->selecting==SET) |
| 207 | | { |
| 208 | | *state->current_field=state->moving_piece; |
| 209 | | state->moving_piece=EM; |
| 210 | | }else |
| 211 | | { |
| 212 | | state->moving_piece=*state->current_field; |
| 213 | | *state->current_field=EM; |
| 214 | | } |
| 215 | | set_pieces(state); |
| 216 | | output_set_value("MOVING",state->moving_piece); |
| 217 | | } |
| 218 | | |
| 219 | | state->selecting=NO_ACTION; |
| 220 | | state->confirm_board_click=FALSE; |
| 221 | | } |
| 222 | | |
| 223 | 194 | /* Boarder pieces and moving pice */ |
| 224 | 195 | |
| 225 | 196 | port_input=input_port_read(machine, "B_WHITE"); |
| r10408 | r10409 | |
| 263 | 234 | state->LED_AH=0; |
| 264 | 235 | state->LED_ST=0; |
| 265 | 236 | |
| 237 | state->wait_time = attotime::from_hz(4); |
| 238 | state->save_key_data = 0xff; |
| 239 | |
| 266 | 240 | state->moving_piece=0; |
| 267 | 241 | } |
| 268 | 242 | |
| r10408 | r10409 | |
| 391 | 365 | if (i_18==NOT_VALID) |
| 392 | 366 | return 0xff; |
| 393 | 367 | |
| 368 | /* if a button was pressed wait til timer -timer_mouse_click- is fired */ |
| 369 | |
| 370 | if (state->selecting) |
| 371 | return state->save_key_data; |
| 372 | else |
| 373 | { |
| 374 | set_pieces(state); |
| 375 | output_set_value("MOVING",state->moving_piece); |
| 376 | } |
| 377 | |
| 394 | 378 | key_data=input_port_read(space->machine, board_lines[i_18]); |
| 395 | 379 | |
| 396 | 380 | if (key_data != 0xff) |
| 397 | 381 | { |
| 398 | 382 | LOG(("%s key_data: %02x \n",board_lines[i_18],key_data)); |
| 399 | 383 | |
| 400 | | if (key_data) |
| 384 | /* Only if valid data and mouse button is pressed */ |
| 385 | |
| 386 | if (key_data && input_port_read(space->machine, "BUTTON_L")) |
| 401 | 387 | { |
| 402 | 388 | |
| 403 | 389 | /* Set or remove pieces */ |
| r10408 | r10409 | |
| 405 | 391 | i_AH=7-get_first_cleared_bit(key_data); |
| 406 | 392 | LOG(("Press -> AH: %d 18: %d Piece: %d\n",i_AH,i_18,state->m_board[i_18*8 + i_AH]);); |
| 407 | 393 | |
| 408 | | if (state->selecting==NO_ACTION) |
| 394 | state->current_field=&state->m_board[i_18*8 + i_AH]; |
| 395 | |
| 396 | if (state->moving_piece) |
| 409 | 397 | { |
| 410 | | state->current_field=&state->m_board[i_18*8 + i_AH]; |
| 398 | *state->current_field = state->moving_piece; |
| 399 | state->moving_piece = EM; |
| 400 | } |
| 401 | else |
| 402 | { |
| 403 | state->moving_piece = *state->current_field; |
| 404 | *state->current_field = EM; |
| 405 | } |
| 406 | state->selecting=TRUE; /* Flag is removed in timer -timer_mouse_click- */ |
| 407 | state->save_key_data=key_data; /* return same key_data til flag selecting is removed */ |
| 411 | 408 | |
| 412 | | if (state->moving_piece) |
| 413 | | state->selecting=SET; |
| 414 | | else |
| 415 | | state->selecting=TAKE; |
| 416 | | } |
| 409 | state->timer_mouse_click->adjust(state->wait_time, 0); |
| 410 | |
| 417 | 411 | return key_data; |
| 418 | 412 | } |
| 419 | 413 | } |
| r10408 | r10409 | |
| 504 | 498 | { |
| 505 | 499 | beep_set_state(speaker,1); |
| 506 | 500 | state->emu_started=TRUE; |
| 507 | | |
| 508 | | if (state->selecting) /* fast mouse clicks are recognized by the artwork but not by the emulation */ |
| 509 | | state->confirm_board_click=TRUE; /* therefore a beep must confirm each click on the board */ |
| 510 | 501 | } |
| 511 | 502 | else |
| 512 | 503 | beep_set_state(speaker,0); |
| 513 | 504 | |
| 514 | 505 | } |
| 515 | 506 | |
| 507 | static TIMER_CALLBACK( mouse_click ) |
| 508 | { |
| 509 | supercon_state *state = machine->driver_data<supercon_state>(); |
| 510 | |
| 511 | if (input_port_read_safe(machine, "BUTTON_L",0) ) /* wait for mouse release */ |
| 512 | state->timer_mouse_click->adjust(state->wait_time, 0); |
| 513 | else |
| 514 | state->selecting=FALSE; |
| 515 | } |
| 516 | |
| 516 | 517 | static TIMER_DEVICE_CALLBACK( update_artwork ) |
| 517 | 518 | { |
| 518 | 519 | mouse_update(timer.machine); |
| r10408 | r10409 | |
| 528 | 529 | |
| 529 | 530 | static STATE_PRESAVE( m_board_presave ) |
| 530 | 531 | { |
| 531 | | supercon_state *state = machine->driver_data<supercon_state>(); |
| 532 | | int i; |
| 533 | | for (i=0;i<64;i++) |
| 534 | | state->save_board[i]=state->m_board[i]; |
| 532 | supercon_state *state = machine->driver_data<supercon_state>(); |
| 533 | int i; |
| 534 | for (i=0;i<64;i++) |
| 535 | state->save_board[i]=state->m_board[i]; |
| 535 | 536 | } |
| 536 | 537 | |
| 537 | 538 | static STATE_POSTLOAD( m_board_postload ) |
| 538 | 539 | { |
| 539 | | supercon_state *state = machine->driver_data<supercon_state>(); |
| 540 | | int i; |
| 541 | | for (i=0;i<64;i++) |
| 542 | | state->m_board[i]=state->save_board[i]; |
| 540 | supercon_state *state = machine->driver_data<supercon_state>(); |
| 541 | int i; |
| 542 | for (i=0;i<64;i++) |
| 543 | state->m_board[i]=state->save_board[i]; |
| 543 | 544 | |
| 544 | | set_pieces(state); |
| 545 | set_pieces(state); |
| 545 | 546 | } |
| 546 | 547 | |
| 547 | 548 | static MACHINE_START( supercon ) |
| 548 | 549 | { |
| 549 | 550 | supercon_state *state = machine->driver_data<supercon_state>(); |
| 550 | | state->led_update=TRUE; |
| 551 | | state->remove_led_flag=TRUE; |
| 552 | 551 | |
| 553 | 552 | state->timer_update_irq = machine->scheduler().timer_alloc(FUNC(update_irq)); |
| 554 | 553 | state->timer_update_irq->adjust( attotime::zero, 0, attotime::from_hz(1000) ); |
| 555 | 554 | |
| 556 | | state->save_item(NAME(state->save_board)); |
| 557 | | machine->state().register_postload(m_board_postload,NULL); |
| 558 | | machine->state().register_presave(m_board_presave,NULL); |
| 555 | state->timer_mouse_click = machine->scheduler().timer_alloc(FUNC(mouse_click),NULL); |
| 556 | |
| 557 | |
| 558 | state->save_item(NAME(state->save_board)); |
| 559 | machine->state().register_postload(m_board_postload,NULL); |
| 560 | machine->state().register_presave(m_board_presave,NULL); |
| 561 | |
| 559 | 562 | } |
| 560 | 563 | |
| 561 | 564 | static MACHINE_RESET( supercon ) |
| r10408 | r10409 | |
| 764 | 767 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 765 | 768 | |
| 766 | 769 | MCFG_TIMER_ADD_PERIODIC("artwork_timer", update_artwork, attotime::from_hz(20)) |
| 770 | |
| 767 | 771 | MACHINE_CONFIG_END |
| 768 | 772 | |
| 769 | 773 | /* ROM definition */ |