src/mess/machine/pc_fdc.c
| r2503 | r2504 | |
| 45 | 45 | /* stored int state */ |
| 46 | 46 | int int_state; |
| 47 | 47 | |
| 48 | /* PCJR watchdog timer */ |
| 49 | emu_timer *watchdog; |
| 50 | |
| 48 | 51 | struct pc_fdc_interface fdc_interface; |
| 49 | 52 | }; |
| 50 | 53 | |
| 51 | 54 | static struct pc_fdc *fdc; |
| 52 | 55 | |
| 56 | /* Prototypes */ |
| 57 | |
| 58 | static TIMER_CALLBACK( watchdog_timeout ); |
| 53 | 59 | static void pc_fdc_hw_interrupt(int state); |
| 54 | 60 | static void pc_fdc_hw_dma_drq(int,int); |
| 55 | 61 | static const device_config *pc_fdc_get_image(int floppy_index); |
| r2503 | r2504 | |
| 94 | 100 | /* setup nec765 interface */ |
| 95 | 101 | nec765_init(&pc_fdc_nec765_interface, iface->nec765_type, iface->nec765_rdy_pin); |
| 96 | 102 | |
| 103 | fdc->watchdog = timer_alloc( watchdog_timeout, NULL ); |
| 104 | |
| 97 | 105 | pc_fdc_reset(); |
| 98 | 106 | |
| 99 | 107 | for (i = 0; i < device_count(Machine, IO_FLOPPY); i++) |
| r2503 | r2504 | |
| 319 | 327 | | | | | | `------- Reserved |
| 320 | 328 | | | | | `--------- Reserved |
| 321 | 329 | | | | `----------- Reserved |
| 322 | | | | `------------- Watchdog Timer Enable ( 0 = watchdog enabled, 1 = watchdog disabled ) |
| 330 | | | `------------- Watchdog Timer Enable ( 0 = watchdog disabled, 1 = watchdog enabled ) |
| 323 | 331 | | `--------------- Watchdog Timer Trigger ( on a 1->0 transition to strobe the trigger ) |
| 324 | 332 | `----------------- FDC Reset ( 0 = hold reset, 1 = release reset ) |
| 325 | 333 | */ |
| 326 | 334 | |
| 335 | static TIMER_CALLBACK( watchdog_timeout ) |
| 336 | { |
| 337 | /* Trigger a watchdog timeout signal */ |
| 338 | if ( fdc->fdc_interface.pc_fdc_interrupt ) |
| 339 | { |
| 340 | fdc->fdc_interface.pc_fdc_interrupt( 1 ); |
| 341 | fdc->fdc_interface.pc_fdc_interrupt( 0 ); |
| 342 | } |
| 343 | } |
| 344 | |
| 327 | 345 | static void pcjr_fdc_dor_w(running_machine *machine, UINT8 data) |
| 328 | 346 | { |
| 329 | 347 | int floppy_count; |
| r2503 | r2504 | |
| 340 | 358 | floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, 0), 1, 0); |
| 341 | 359 | } |
| 342 | 360 | |
| 361 | /* Is the watchdog timer disabled */ |
| 362 | if ( ! ( data & 0x20 ) ) |
| 363 | { |
| 364 | timer_adjust_oneshot( fdc->watchdog, attotime_never, 0 ); |
| 365 | } else { |
| 366 | /* Check for 1->0 watchdog trigger */ |
| 367 | if ( ( fdc->digital_output_register & 0x40 ) && ! ( data & 0x40 ) ) |
| 368 | { |
| 369 | /* Start watchdog timer here */ |
| 370 | timer_adjust_oneshot( fdc->watchdog, ATTOTIME_IN_SEC(3), 0 ); |
| 371 | } |
| 372 | } |
| 373 | |
| 343 | 374 | /* reset? */ |
| 344 | 375 | if ( ! (data & 0x80) ) |
| 345 | 376 | { |
src/mess/machine/pc.c
| r2503 | r2504 | |
| 438 | 438 | |
| 439 | 439 | static TIMER_CALLBACK( pcjr_keyb_signal_callback ) |
| 440 | 440 | { |
| 441 | | pcjr_keyb.raw_keyb_data = pcjr_keyb.raw_keyb_data >> 1; |
| 442 | | pcjr_keyb.signal_count--; |
| 441 | pcjr_keyb.raw_keyb_data = pcjr_keyb.raw_keyb_data >> 1; |
| 442 | pcjr_keyb.signal_count--; |
| 443 | 443 | |
| 444 | | if ( pcjr_keyb.signal_count <= 0 ) |
| 445 | | { |
| 446 | | timer_adjust_periodic( pcjr_keyb.keyb_signal_timer, attotime_never, 0, attotime_never ); |
| 447 | | pcjr_keyb.transferring = 0; |
| 448 | | } |
| 444 | if ( pcjr_keyb.signal_count <= 0 ) |
| 445 | { |
| 446 | timer_adjust_periodic( pcjr_keyb.keyb_signal_timer, attotime_never, 0, attotime_never ); |
| 447 | pcjr_keyb.transferring = 0; |
| 448 | } |
| 449 | 449 | } |
| 450 | 450 | |
| 451 | 451 | |
| r2503 | r2504 | |
| 691 | 691 | int data=0xff; |
| 692 | 692 | |
| 693 | 693 | data&=~0x80; |
| 694 | data &= ~0x04; /* floppy drive installed */ |
| 694 | 695 | data = ( data & ~0x01 ) | ( pcjr_keyb.latch ? 0x01: 0x00 ); |
| 695 | 696 | if ( ! ( pc_ppi.portb & 0x08 ) ) |
| 696 | 697 | { |