src/mess/devices/flopdrv.c
| r6671 | r6672 | |
| 43 | 43 | int drtn; /* direction */ |
| 44 | 44 | int stp; /* step */ |
| 45 | 45 | int wtg; /* write gate */ |
| 46 | int mon; /* motor on */ |
| 46 | 47 | |
| 47 | 48 | /* state of output lines */ |
| 48 | 49 | int idx; /* index pulse */ |
| r6671 | r6672 | |
| 371 | 372 | } |
| 372 | 373 | } |
| 373 | 374 | |
| 374 | | void floppy_drive_set_motor_state(const device_config *img, int state) |
| 375 | | { |
| 376 | | int new_motor_state = 0; |
| 377 | | int previous_state = 0; |
| 378 | | |
| 379 | | /* previous state */ |
| 380 | | if (floppy_drive_get_flag_state(img, FLOPPY_DRIVE_MOTOR_ON)) |
| 381 | | previous_state = 1; |
| 382 | | |
| 383 | | /* calc new state */ |
| 384 | | |
| 385 | | /* drive present? */ |
| 386 | | if (image_slotexists(img)) |
| 387 | | { |
| 388 | | /* disk inserted? */ |
| 389 | | if (image_exists(img)) |
| 390 | | { |
| 391 | | /* drive present and disc inserted */ |
| 392 | | |
| 393 | | /* state of motor is same as the programmed state */ |
| 394 | | if (state) |
| 395 | | { |
| 396 | | new_motor_state = 1; |
| 397 | | } |
| 398 | | } |
| 399 | | } |
| 400 | | |
| 401 | | if ((new_motor_state^previous_state)!=0) |
| 402 | | { |
| 403 | | /* if timer already setup remove it */ |
| 404 | | if (image_slotexists(img)) |
| 405 | | { |
| 406 | | floppy_drive *pDrive = get_safe_token( img ); |
| 407 | | |
| 408 | | pDrive->idx = 0; |
| 409 | | if (new_motor_state) |
| 410 | | { |
| 411 | | /* off->on */ |
| 412 | | /* check it's in range */ |
| 413 | | |
| 414 | | /* setup timer to trigger at rpm */ |
| 415 | | floppy_drive_index_func(img); |
| 416 | | } |
| 417 | | else |
| 418 | | { |
| 419 | | /* on->off */ |
| 420 | | timer_adjust_oneshot(pDrive->index_timer, attotime_zero, 0); |
| 421 | | } |
| 422 | | } |
| 423 | | } |
| 424 | | |
| 425 | | floppy_drive_set_flag_state(img, FLOPPY_DRIVE_MOTOR_ON, new_motor_state); |
| 426 | | |
| 427 | | } |
| 428 | | |
| 429 | 375 | /* for pc, drive is always ready, for amstrad,pcw,spectrum it is only ready under |
| 430 | 376 | a fixed set of circumstances */ |
| 431 | 377 | /* use this to set ready state of drive */ |
| 432 | 378 | void floppy_drive_set_ready_state(const device_config *img, int state, int flag) |
| 433 | 379 | { |
| 380 | floppy_drive *drive = get_safe_token(img); |
| 381 | |
| 434 | 382 | if (flag) |
| 435 | 383 | { |
| 436 | 384 | /* set ready only if drive is present, disk is in the drive, |
| r6671 | r6672 | |
| 442 | 390 | /* disk inserted? */ |
| 443 | 391 | if (image_exists(img)) |
| 444 | 392 | { |
| 445 | | if (floppy_drive_get_flag_state(img, FLOPPY_DRIVE_MOTOR_ON)) |
| 393 | if (drive->mon == CLEAR_LINE) |
| 446 | 394 | { |
| 447 | 395 | /* set state */ |
| 448 | 396 | floppy_drive_set_flag_state(img, FLOPPY_DRIVE_READY, state); |
| r6671 | r6672 | |
| 471 | 419 | drive_flags = drv->flags; |
| 472 | 420 | |
| 473 | 421 | /* these flags are independant of a real drive/disk image */ |
| 474 | | flags |= drive_flags & (FLOPPY_DRIVE_READY | FLOPPY_DRIVE_MOTOR_ON | FLOPPY_DRIVE_INDEX); |
| 422 | flags |= drive_flags & (FLOPPY_DRIVE_READY | FLOPPY_DRIVE_INDEX); |
| 475 | 423 | |
| 476 | 424 | flags &= flag; |
| 477 | 425 | |
| r6671 | r6672 | |
| 682 | 630 | /* not at track 0 */ |
| 683 | 631 | floppy->tk00 = ASSERT_LINE; |
| 684 | 632 | |
| 633 | /* motor off */ |
| 634 | floppy->mon = ASSERT_LINE; |
| 635 | |
| 685 | 636 | /* resolve callbacks */ |
| 686 | 637 | devcb_resolve_write_line(&floppy->out_idx_func, &floppy->config->out_idx_func, device); |
| 687 | 638 | devcb_resolve_read_line(&floppy->in_mon_func, &floppy->config->in_mon_func, device); |
| r6671 | r6672 | |
| 888 | 839 | floppy_ds3_w(device, BIT(data, 3)); |
| 889 | 840 | } |
| 890 | 841 | |
| 842 | /* motor on, active low */ |
| 843 | WRITE_LINE_DEVICE_HANDLER( floppy_mon_w ) |
| 844 | { |
| 845 | floppy_drive *drive = get_safe_token(device); |
| 846 | |
| 847 | /* force off if there is no attached image */ |
| 848 | if (!image_exists(device)) |
| 849 | state = ASSERT_LINE; |
| 850 | |
| 851 | if (image_slotexists(device)) |
| 852 | { |
| 853 | /* off -> on */ |
| 854 | if (drive->mon && state == CLEAR_LINE) |
| 855 | { |
| 856 | drive->idx = 0; |
| 857 | floppy_drive_index_func(device); |
| 858 | } |
| 859 | |
| 860 | /* on -> off */ |
| 861 | else if (drive->mon == CLEAR_LINE && state) |
| 862 | timer_adjust_oneshot(drive->index_timer, attotime_zero, 0); |
| 863 | } |
| 864 | |
| 865 | drive->mon = state; |
| 866 | } |
| 867 | |
| 891 | 868 | /* direction */ |
| 892 | 869 | WRITE_LINE_DEVICE_HANDLER( floppy_drtn_w ) |
| 893 | 870 | { |
| r6671 | r6672 | |
| 913 | 890 | if (drive->drtn) |
| 914 | 891 | { |
| 915 | 892 | /* move head outward */ |
| 916 | | drive->current_track--; |
| 893 | if (drive->current_track > 0) |
| 894 | drive->current_track--; |
| 917 | 895 | |
| 918 | 896 | /* are we at track 0 now? */ |
| 919 | | if (drive->current_track <= 0) |
| 920 | | { |
| 921 | | drive->current_track = 0; |
| 922 | | drive->tk00 = CLEAR_LINE; |
| 923 | | } |
| 924 | | else |
| 925 | | drive->tk00 = ASSERT_LINE; |
| 897 | drive->tk00 = (drive->current_track == 0) ? CLEAR_LINE : ASSERT_LINE; |
| 926 | 898 | } |
| 927 | 899 | else |
| 928 | 900 | { |
| 929 | 901 | /* move head inward */ |
| 930 | | drive->current_track++; |
| 902 | if (drive->current_track < drive->max_track) |
| 903 | drive->current_track++; |
| 931 | 904 | |
| 932 | | /* are we over the maximum? */ |
| 933 | | if (drive->current_track >= drive->max_track) |
| 934 | | drive->current_track = drive->max_track - 1; |
| 935 | | |
| 936 | 905 | /* we can't be at track 0 here, so reset the line */ |
| 937 | 906 | drive->tk00 = ASSERT_LINE; |
| 938 | 907 | } |
src/mess/devices/sonydriv.c
| r6671 | r6672 | |
| 84 | 84 | unsigned int disk_switched : 1; /* disk-in-place status bit */ |
| 85 | 85 | unsigned int head : 1; /* active head (-> floppy side) */ |
| 86 | 86 | unsigned int step : 1; |
| 87 | int motor_on; |
| 87 | 88 | |
| 88 | 89 | unsigned int loadedtrack_valid : 1; /* is data in track buffer valid ? */ |
| 89 | 90 | unsigned int loadedtrack_dirty : 1; /* has data in track buffer been modified? */ |
| r6671 | r6672 | |
| 297 | 298 | result = 0; |
| 298 | 299 | break; |
| 299 | 300 | case 0x08: /* Motor on 0=on 1=off */ |
| 300 | | if (cur_image) |
| 301 | | result = floppy_drive_get_flag_state(cur_image, FLOPPY_DRIVE_MOTOR_ON) ? 1 : 0; |
| 302 | | else |
| 303 | | result = 0; |
| 301 | result = f->motor_on; |
| 304 | 302 | break; |
| 305 | 303 | case 0x09: /* Number of sides: 0=single sided, 1=double sided */ |
| 306 | 304 | if (cur_image) |
| r6671 | r6672 | |
| 394 | 392 | } |
| 395 | 393 | break; |
| 396 | 394 | case 0x08: /* Turn motor on */ |
| 395 | f->motor_on = CLEAR_LINE; |
| 397 | 396 | if (cur_image) |
| 398 | | floppy_drive_set_flag_state(cur_image, FLOPPY_DRIVE_MOTOR_ON, 1); |
| 397 | floppy_mon_w(cur_image, f->motor_on); |
| 399 | 398 | break; |
| 400 | 399 | case 0x09: /* Turn motor off */ |
| 400 | f->motor_on = ASSERT_LINE; |
| 401 | 401 | if (cur_image) |
| 402 | | floppy_drive_set_flag_state(cur_image, FLOPPY_DRIVE_MOTOR_ON, 0); |
| 402 | floppy_mon_w(cur_image, f->motor_on); |
| 403 | 403 | break; |
| 404 | 404 | case 0x0d: /* Eject disk */ |
| 405 | 405 | if (cur_image) |
src/mess/devices/flopdrv.h
| r6671 | r6672 | |
| 66 | 66 | #define FLOPPY_DRIVE_READY 0x0010 |
| 67 | 67 | /* set if index has just occured */ |
| 68 | 68 | #define FLOPPY_DRIVE_INDEX 0x0020 |
| 69 | | /* motor state */ |
| 70 | | #define FLOPPY_DRIVE_MOTOR_ON 0x0040 |
| 71 | 69 | |
| 72 | 70 | /* a callback which will be executed if the ready state of the drive changes e.g. not ready->ready, ready->not ready */ |
| 73 | 71 | void floppy_drive_set_ready_state_change_callback(const device_config *img, void (*callback)(const device_config *controller,const device_config *img, int state)); |
| r6671 | r6672 | |
| 87 | 85 | disk is in drive, and motor is on. Otherwise set ready state to the state passed */ |
| 88 | 86 | void floppy_drive_set_ready_state(const device_config *img, int state, int flag); |
| 89 | 87 | |
| 90 | | void floppy_drive_set_motor_state(const device_config *img, int state); |
| 91 | | |
| 92 | 88 | /* seek up or down */ |
| 93 | 89 | void floppy_drive_seek(const device_config *img, signed int signed_tracks); |
| 94 | 90 | |
| r6671 | r6672 | |
| 138 | 134 | WRITE_LINE_DEVICE_HANDLER( floppy_ds3_w ); |
| 139 | 135 | WRITE8_DEVICE_HANDLER( floppy_ds_w ); |
| 140 | 136 | |
| 137 | WRITE_LINE_DEVICE_HANDLER( floppy_mon_w ); |
| 141 | 138 | WRITE_LINE_DEVICE_HANDLER( floppy_drtn_w ); |
| 142 | 139 | WRITE_LINE_DEVICE_HANDLER( floppy_stp_w ); |
| 143 | 140 | WRITE_LINE_DEVICE_HANDLER( floppy_wtd_w ); |
src/mess/devices/thomflop.c
| r6671 | r6672 | |
| 76 | 76 | #define THOM_SIZE_DATA_HI (256+80) |
| 77 | 77 | #define THOM_SIZE_SYNCHRO 12 |
| 78 | 78 | |
| 79 | static int motor_on; |
| 79 | 80 | |
| 81 | |
| 80 | 82 | /* build an identifier, with header & space */ |
| 81 | 83 | static int thom_floppy_make_addr( chrn_id id, UINT8* dst, int sector_size ) |
| 82 | 84 | { |
| r6671 | r6672 | |
| 839 | 841 | if (img) { |
| 840 | 842 | floppy_drive_set_index_pulse_callback( img, to7_qdd_index_pulse_cb ); |
| 841 | 843 | floppy_drive_set_ready_state( img, FLOPPY_DRIVE_READY, 0 ); |
| 842 | | floppy_drive_set_motor_state( img, 1 ); |
| 844 | |
| 845 | motor_on = CLEAR_LINE; |
| 846 | floppy_mon_w(img, motor_on); |
| 847 | |
| 843 | 848 | /* pulse each time the whole-disk spiraling track ends */ |
| 844 | 849 | /* at 90us per byte read, the disk can be read in 6s */ |
| 845 | 850 | floppy_drive_set_rpm( img, 60. / 6. ); |
| r6671 | r6672 | |
| 1287 | 1292 | if ( flags & FLOPPY_DRIVE_READY ) |
| 1288 | 1293 | data |= 0x02; |
| 1289 | 1294 | } |
| 1290 | | if ( ! (flags & FLOPPY_DRIVE_MOTOR_ON ) ) |
| 1295 | if (!motor_on) |
| 1291 | 1296 | data |= 0x10; |
| 1292 | 1297 | if (!floppy_wpt_r(img)) |
| 1293 | 1298 | data |= 0x04; |
| r6671 | r6672 | |
| 1466 | 1471 | set motor to 1 every few seconds. |
| 1467 | 1472 | instead of counting, we assume the motor is always running... |
| 1468 | 1473 | */ |
| 1469 | | floppy_drive_set_motor_state( img, 1 /* motor */ ); |
| 1474 | motor_on = CLEAR_LINE /* motor */; |
| 1475 | floppy_mon_w(img, motor_on); |
| 1470 | 1476 | } |
| 1471 | 1477 | break; |
| 1472 | 1478 | |
src/mess/machine/conkort.c
| r6671 | r6672 | |
| 277 | 277 | // if (BIT(data, 2)) wd17xx_set_drive(conkort->wd1791, 2); |
| 278 | 278 | |
| 279 | 279 | /* motor enable */ |
| 280 | | floppy_drive_set_motor_state(get_floppy_image(space->machine, 0), BIT(data, 3)); |
| 281 | | floppy_drive_set_motor_state(get_floppy_image(space->machine, 1), BIT(data, 3)); |
| 280 | floppy_mon_w(get_floppy_image(space->machine, 0), !BIT(data, 3)); |
| 281 | floppy_mon_w(get_floppy_image(space->machine, 1), !BIT(data, 3)); |
| 282 | 282 | floppy_drive_set_ready_state(get_floppy_image(space->machine, 0), 1, 1); |
| 283 | 283 | floppy_drive_set_ready_state(get_floppy_image(space->machine, 1), 1, 1); |
| 284 | 284 | |
| r6671 | r6672 | |
| 914 | 914 | |
| 915 | 915 | static DEVICE_RESET( luxor_55_21046 ) |
| 916 | 916 | { |
| 917 | | floppy_drive_set_motor_state(get_floppy_image(device->machine, 0), 1); |
| 918 | | floppy_drive_set_motor_state(get_floppy_image(device->machine, 1), 1); |
| 917 | floppy_mon_w(get_floppy_image(device->machine, 0), CLEAR_LINE); |
| 918 | floppy_mon_w(get_floppy_image(device->machine, 1), CLEAR_LINE); |
| 919 | 919 | floppy_drive_set_ready_state(get_floppy_image(device->machine, 0), 1, 1); |
| 920 | 920 | floppy_drive_set_ready_state(get_floppy_image(device->machine, 1), 1, 1); |
| 921 | 921 | } |
src/mess/machine/amstrad.c
| r6671 | r6672 | |
| 2554 | 2554 | /* FDC Motor Control - Bit 0 defines the state of the FDD motor: |
| 2555 | 2555 | * "1" the FDD motor will be active. |
| 2556 | 2556 | * "0" the FDD motor will be in-active.*/ |
| 2557 | | floppy_drive_set_motor_state(floppy_get_device(space->machine, 0), (data & 0x01)); |
| 2558 | | floppy_drive_set_motor_state(floppy_get_device(space->machine, 1), (data & 0x01)); |
| 2557 | floppy_mon_w(floppy_get_device(space->machine, 0), !BIT(data, 0)); |
| 2558 | floppy_mon_w(floppy_get_device(space->machine, 1), !BIT(data, 0)); |
| 2559 | 2559 | floppy_drive_set_ready_state(floppy_get_device(space->machine, 0), 1,1); |
| 2560 | 2560 | floppy_drive_set_ready_state(floppy_get_device(space->machine, 1), 1,1); |
| 2561 | 2561 | break; |
src/mess/machine/pc8801.c
| r6671 | r6672 | |
| 732 | 732 | |
| 733 | 733 | cpu_set_input_line_vector(cputag_get_cpu(machine, "sub"), 0, 0); |
| 734 | 734 | |
| 735 | | floppy_drive_set_motor_state(floppy_get_device(machine, 0), 1); |
| 736 | | floppy_drive_set_motor_state(floppy_get_device(machine, 1), 1); |
| 735 | floppy_mon_w(floppy_get_device(machine, 0), CLEAR_LINE); |
| 736 | floppy_mon_w(floppy_get_device(machine, 1), CLEAR_LINE); |
| 737 | 737 | floppy_drive_set_ready_state(floppy_get_device(machine, 0), 1, 1); |
| 738 | 738 | floppy_drive_set_ready_state(floppy_get_device(machine, 1), 1, 1); |
| 739 | 739 | } |
src/mess/machine/pc_fdc.c
| r6671 | r6672 | |
| 265 | 265 | |
| 266 | 266 | /* set floppy drive motor state */ |
| 267 | 267 | if (floppy_count > 0) |
| 268 | | floppy_drive_set_motor_state(floppy_get_device(machine, 0), (data>>4) & 0x0f); |
| 268 | floppy_mon_w(floppy_get_device(machine, 0), !BIT(data, 4)); |
| 269 | 269 | if (floppy_count > 1) |
| 270 | | floppy_drive_set_motor_state(floppy_get_device(machine, 1), (data>>5) & 0x01); |
| 270 | floppy_mon_w(floppy_get_device(machine, 1), !BIT(data, 5)); |
| 271 | 271 | if (floppy_count > 2) |
| 272 | | floppy_drive_set_motor_state(floppy_get_device(machine, 2), (data>>6) & 0x01); |
| 272 | floppy_mon_w(floppy_get_device(machine, 2), !BIT(data, 6)); |
| 273 | 273 | if (floppy_count > 3) |
| 274 | | floppy_drive_set_motor_state(floppy_get_device(machine, 3), (data>>7) & 0x01); |
| 274 | floppy_mon_w(floppy_get_device(machine, 3), !BIT(data, 7)); |
| 275 | 275 | |
| 276 | 276 | if ((data>>4) & (1<<selected_drive)) |
| 277 | 277 | { |
| r6671 | r6672 | |
| 365 | 365 | |
| 366 | 366 | /* set floppy drive motor state */ |
| 367 | 367 | if (floppy_count > 0) |
| 368 | | floppy_drive_set_motor_state(floppy_get_device(machine, 0), data & 0x01); |
| 368 | floppy_mon_w(floppy_get_device(machine, 0), BIT(data, 0) ? CLEAR_LINE : ASSERT_LINE); |
| 369 | 369 | |
| 370 | 370 | if ( data & 0x01 ) |
| 371 | 371 | { |
src/mess/machine/tf20.c
| r6671 | r6672 | |
| 78 | 78 | memory_install_readwrite_bank(prg, 0x0000, 0x7fff, 0, 0,"bank21"); |
| 79 | 79 | memory_set_bankptr(space->machine, "bank21", messram_get_ptr(tf20->ram)); |
| 80 | 80 | |
| 81 | /* clear tc */ |
| 82 | upd765_tc_w(tf20->upd765a, CLEAR_LINE); |
| 83 | |
| 81 | 84 | return 0xff; |
| 82 | 85 | } |
| 83 | 86 | |
| 84 | 87 | static READ8_HANDLER( tf20_dip_r ) |
| 85 | 88 | { |
| 89 | tf20_state *tf20 = get_safe_token(space->cpu->owner); |
| 86 | 90 | logerror("%s: tf20_dip_r\n", cpuexec_describe_context(space->machine)); |
| 87 | 91 | |
| 92 | /* clear tc */ |
| 93 | upd765_tc_w(tf20->upd765a, CLEAR_LINE); |
| 94 | |
| 88 | 95 | return 0xff; |
| 89 | 96 | } |
| 90 | 97 | |
| r6671 | r6672 | |
| 104 | 111 | logerror("%s: tf20_fdc_control_w %02x\n", cpuexec_describe_context(space->machine), data); |
| 105 | 112 | |
| 106 | 113 | /* bit 0, motor on signal */ |
| 107 | | floppy_drive_set_motor_state(tf20->floppy_0, BIT(data, 0)); |
| 114 | floppy_mon_w(tf20->floppy_0, !BIT(data, 0)); |
| 115 | floppy_mon_w(tf20->floppy_1, !BIT(data, 0)); |
| 108 | 116 | floppy_drive_set_ready_state(tf20->floppy_0, BIT(data, 0), 1); |
| 109 | | floppy_drive_set_motor_state(tf20->floppy_1, BIT(data, 0)); |
| 110 | 117 | floppy_drive_set_ready_state(tf20->floppy_1, BIT(data, 0), 1); |
| 111 | 118 | |
| 112 | | /* clear tc on write */ |
| 113 | | upd765_tc_w(tf20->upd765a, CLEAR_LINE); |
| 119 | /* set tc on write */ |
| 120 | upd765_tc_w(tf20->upd765a, ASSERT_LINE); |
| 114 | 121 | } |
| 115 | 122 | |
| 116 | 123 | static IRQ_CALLBACK( tf20_irq_ack ) |
src/mess/drivers/act.c
| r6671 | r6672 | |
| 140 | 140 | |
| 141 | 141 | // printf("%02x\n",offset); |
| 142 | 142 | |
| 143 | | floppy_drive_set_motor_state(floppy_get_device(space->machine, xi_sys_ctrl.fdrv_num), 1); |
| 143 | floppy_mon_w(floppy_get_device(space->machine, xi_sys_ctrl.fdrv_num), CLEAR_LINE); |
| 144 | 144 | floppy_drive_set_ready_state(floppy_get_device(space->machine, xi_sys_ctrl.fdrv_num), 1,0); |
| 145 | 145 | |
| 146 | 146 | switch(offset) |
| r6671 | r6672 | |
| 167 | 167 | |
| 168 | 168 | // printf("%02x %02x\n",offset,data); |
| 169 | 169 | |
| 170 | | floppy_drive_set_motor_state(floppy_get_device(space->machine, xi_sys_ctrl.fdrv_num), 1); |
| 170 | floppy_mon_w(floppy_get_device(space->machine, xi_sys_ctrl.fdrv_num), CLEAR_LINE); |
| 171 | 171 | floppy_drive_set_ready_state(floppy_get_device(space->machine, xi_sys_ctrl.fdrv_num), 1,0); |
| 172 | 172 | |
| 173 | 173 | switch(offset) |
src/mess/drivers/xor100.c
| r6671 | r6672 | |
| 216 | 216 | if (BIT(data, 0)) wd17xx_set_drive(state->wd1795, 0); |
| 217 | 217 | if (BIT(data, 1)) wd17xx_set_drive(state->wd1795, 1); |
| 218 | 218 | |
| 219 | | floppy_drive_set_motor_state(floppy_get_device(space->machine, 0), 1); |
| 220 | | floppy_drive_set_motor_state(floppy_get_device(space->machine, 1), 1); |
| 219 | floppy_mon_w(floppy_get_device(space->machine, 0), CLEAR_LINE); |
| 220 | floppy_mon_w(floppy_get_device(space->machine, 1), CLEAR_LINE); |
| 221 | 221 | floppy_drive_set_ready_state(floppy_get_device(space->machine, 0), 1, 1); |
| 222 | 222 | floppy_drive_set_ready_state(floppy_get_device(space->machine, 1), 1, 1); |
| 223 | 223 | } |
src/mess/drivers/mikromik.c
| r6671 | r6672 | |
| 115 | 115 | |
| 116 | 116 | case 7: /* MOTOR ON */ |
| 117 | 117 | //logerror("MOTOR %u\n", d); |
| 118 | | floppy_drive_set_motor_state(floppy_get_device(space->machine, 0), d); |
| 118 | floppy_mon_w(floppy_get_device(space->machine, 0), !d); |
| 119 | floppy_mon_w(floppy_get_device(space->machine, 1), !d); |
| 119 | 120 | floppy_drive_set_ready_state(floppy_get_device(space->machine, 0), d, 1); |
| 120 | | floppy_drive_set_motor_state(floppy_get_device(space->machine, 1), d); |
| 121 | 121 | floppy_drive_set_ready_state(floppy_get_device(space->machine, 1), d, 1); |
| 122 | 122 | |
| 123 | 123 | if (input_port_read(space->machine, "T5")) upd765_ready_w(state->upd765, d); |
src/mess/drivers/pcw.c
| r6671 | r6672 | |
| 534 | 534 | /* disc motor on */ |
| 535 | 535 | case 9: |
| 536 | 536 | { |
| 537 | | floppy_drive_set_motor_state(floppy_get_device(space->machine, 0), 1); |
| 538 | | floppy_drive_set_motor_state(floppy_get_device(space->machine, 1), 1); |
| 537 | floppy_mon_w(floppy_get_device(space->machine, 0), CLEAR_LINE); |
| 538 | floppy_mon_w(floppy_get_device(space->machine, 1), CLEAR_LINE); |
| 539 | 539 | floppy_drive_set_ready_state(floppy_get_device(space->machine, 0), 1,1); |
| 540 | 540 | floppy_drive_set_ready_state(floppy_get_device(space->machine, 1), 1,1); |
| 541 | 541 | } |
| r6671 | r6672 | |
| 544 | 544 | /* disc motor off */ |
| 545 | 545 | case 10: |
| 546 | 546 | { |
| 547 | | floppy_drive_set_motor_state(floppy_get_device(space->machine, 0), 0); |
| 548 | | floppy_drive_set_motor_state(floppy_get_device(space->machine, 1), 0); |
| 547 | floppy_mon_w(floppy_get_device(space->machine, 0), ASSERT_LINE); |
| 548 | floppy_mon_w(floppy_get_device(space->machine, 1), ASSERT_LINE); |
| 549 | 549 | floppy_drive_set_ready_state(floppy_get_device(space->machine, 0), 0,1); |
| 550 | 550 | floppy_drive_set_ready_state(floppy_get_device(space->machine, 1), 0,1); |
| 551 | 551 | } |
src/mess/drivers/v1050.c
| r6671 | r6672 | |
| 811 | 811 | wd17xx_set_side(state->mb8877, BIT(data, 4)); |
| 812 | 812 | |
| 813 | 813 | /* floppy motor */ |
| 814 | | floppy_drive_set_motor_state(get_floppy_image(device->machine, 0), f_motor_on); |
| 815 | | floppy_drive_set_motor_state(get_floppy_image(device->machine, 1), f_motor_on); |
| 814 | floppy_mon_w(get_floppy_image(device->machine, 0), BIT(data, 6)); |
| 815 | floppy_mon_w(get_floppy_image(device->machine, 1), BIT(data, 6)); |
| 816 | 816 | floppy_drive_set_ready_state(get_floppy_image(device->machine, 0), f_motor_on, 1); |
| 817 | 817 | floppy_drive_set_ready_state(get_floppy_image(device->machine, 1), f_motor_on, 1); |
| 818 | 818 | |
src/mess/drivers/tiki100.c
| r6671 | r6672 | |
| 214 | 214 | wd17xx_set_density(state->fd1797, BIT(data, 4) ? DEN_FM_LO : DEN_FM_HI); |
| 215 | 215 | |
| 216 | 216 | /* floppy motor */ |
| 217 | | floppy_drive_set_motor_state(get_floppy_image(space->machine, 0), BIT(data, 6)); |
| 218 | | floppy_drive_set_motor_state(get_floppy_image(space->machine, 1), BIT(data, 6)); |
| 217 | floppy_mon_w(get_floppy_image(space->machine, 0), !BIT(data, 6)); |
| 218 | floppy_mon_w(get_floppy_image(space->machine, 1), !BIT(data, 6)); |
| 219 | 219 | floppy_drive_set_ready_state(get_floppy_image(space->machine, 0), BIT(data, 6), 1); |
| 220 | 220 | floppy_drive_set_ready_state(get_floppy_image(space->machine, 1), BIT(data, 6), 1); |
| 221 | 221 | |
src/mess/drivers/sord.c
| r6671 | r6672 | |
| 119 | 119 | cpu_yield(space->cpu); |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | | static WRITE8_HANDLER(fd5_drive_control_w) |
| 122 | static WRITE8_HANDLER( fd5_drive_control_w ) |
| 123 | 123 | { |
| 124 | 124 | int state; |
| 125 | 125 | |
| r6671 | r6672 | |
| 130 | 130 | |
| 131 | 131 | LOG(("fd5 drive state w: %02x\n",state)); |
| 132 | 132 | |
| 133 | | floppy_drive_set_motor_state(floppy_get_device(space->machine, 0), state); |
| 134 | | floppy_drive_set_motor_state(floppy_get_device(space->machine, 0), state); |
| 133 | floppy_mon_w(floppy_get_device(space->machine, 0), !state); |
| 134 | floppy_mon_w(floppy_get_device(space->machine, 1), !state); |
| 135 | floppy_drive_set_ready_state(floppy_get_device(space->machine, 0), 1,1); |
| 135 | 136 | floppy_drive_set_ready_state(floppy_get_device(space->machine, 1), 1,1); |
| 136 | | floppy_drive_set_ready_state(floppy_get_device(space->machine, 1), 1,1); |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | | static WRITE8_HANDLER(fd5_tc_w) |
| 139 | static WRITE8_HANDLER( fd5_tc_w ) |
| 140 | 140 | { |
| 141 | 141 | const device_config *fdc = devtag_get_device(space->machine, "upd765"); |
| 142 | 142 | upd765_tc_w(fdc, 1); |
src/mess/drivers/bw12.c
| r6671 | r6672 | |
| 89 | 89 | { |
| 90 | 90 | bw12_state *state = machine->driver_data; |
| 91 | 91 | |
| 92 | | floppy_drive_set_motor_state(get_floppy_image(machine, 0), 0); |
| 93 | | floppy_drive_set_motor_state(get_floppy_image(machine, 1), 0); |
| 92 | floppy_mon_w(get_floppy_image(machine, 0), ASSERT_LINE); |
| 93 | floppy_mon_w(get_floppy_image(machine, 1), ASSERT_LINE); |
| 94 | |
| 94 | 95 | floppy_drive_set_ready_state(get_floppy_image(machine, 0), 0, 0); |
| 95 | 96 | floppy_drive_set_ready_state(get_floppy_image(machine, 1), 0, 0); |
| 96 | 97 | |
| r6671 | r6672 | |
| 150 | 151 | |
| 151 | 152 | if (data) |
| 152 | 153 | { |
| 153 | | floppy_drive_set_motor_state(get_floppy_image(machine, 0), 1); |
| 154 | floppy_mon_w(get_floppy_image(machine, 0), CLEAR_LINE); |
| 154 | 155 | floppy_drive_set_ready_state(get_floppy_image(machine, 0), 1, 0); |
| 155 | 156 | } |
| 156 | 157 | |
| r6671 | r6672 | |
| 162 | 163 | |
| 163 | 164 | if (data) |
| 164 | 165 | { |
| 165 | | floppy_drive_set_motor_state(get_floppy_image(machine, 1), 1); |
| 166 | floppy_mon_w(get_floppy_image(machine, 1), CLEAR_LINE); |
| 166 | 167 | floppy_drive_set_ready_state(get_floppy_image(machine, 1), 1, 0); |
| 167 | 168 | } |
| 168 | 169 | |
src/mess/drivers/prof80.c
| r6671 | r6672 | |
| 197 | 197 | { |
| 198 | 198 | prof80_state *state = machine->driver_data; |
| 199 | 199 | |
| 200 | | floppy_drive_set_motor_state(floppy_get_device(machine, 0), 0); |
| 201 | | floppy_drive_set_motor_state(floppy_get_device(machine, 1), 0); |
| 200 | floppy_mon_w(floppy_get_device(machine, 0), ASSERT_LINE); |
| 201 | floppy_mon_w(floppy_get_device(machine, 1), ASSERT_LINE); |
| 202 | 202 | floppy_drive_set_ready_state(floppy_get_device(machine, 0), 0, 1); |
| 203 | 203 | floppy_drive_set_ready_state(floppy_get_device(machine, 1), 0, 1); |
| 204 | 204 | |
| r6671 | r6672 | |
| 249 | 249 | else |
| 250 | 250 | { |
| 251 | 251 | /* turn on floppy motor */ |
| 252 | | floppy_drive_set_motor_state(floppy_get_device(machine, 0), 1); |
| 253 | | floppy_drive_set_motor_state(floppy_get_device(machine, 1), 1); |
| 252 | floppy_mon_w(floppy_get_device(machine, 0), CLEAR_LINE); |
| 253 | floppy_mon_w(floppy_get_device(machine, 1), CLEAR_LINE); |
| 254 | 254 | floppy_drive_set_ready_state(floppy_get_device(machine, 0), 1, 1); |
| 255 | 255 | floppy_drive_set_ready_state(floppy_get_device(machine, 1), 1, 1); |
| 256 | 256 | |
src/mess/drivers/specpls3.c
| r6671 | r6672 | |
| 318 | 318 | /* D3 - Disk motor on/off */ |
| 319 | 319 | /* D4 - parallel port strobe */ |
| 320 | 320 | |
| 321 | | floppy_drive_set_motor_state(floppy_get_device(space->machine, 0), data & (1<<3)); |
| 322 | | floppy_drive_set_motor_state(floppy_get_device(space->machine, 1), data & (1<<3)); |
| 321 | floppy_mon_w(floppy_get_device(space->machine, 0), !BIT(data, 3)); |
| 322 | floppy_mon_w(floppy_get_device(space->machine, 1), !BIT(data, 3)); |
| 323 | 323 | floppy_drive_set_ready_state(floppy_get_device(space->machine, 0), 1, 1); |
| 324 | 324 | floppy_drive_set_ready_state(floppy_get_device(space->machine, 1), 1, 1); |
| 325 | 325 | |
src/mess/drivers/x68k.c
| r6671 | r6672 | |
| 982 | 982 | if(data & 0x20) // ejects disk |
| 983 | 983 | { |
| 984 | 984 | image_unload(floppy_get_device(space->machine, drive)); |
| 985 | | floppy_drive_set_motor_state(floppy_get_device(space->machine, drive), 0); // I'll presume ejecting the disk stops the drive motor :) |
| 985 | floppy_mon_w(floppy_get_device(space->machine, drive), ASSERT_LINE); |
| 986 | 986 | } |
| 987 | 987 | } |
| 988 | 988 | } |
| r6671 | r6672 | |
| 993 | 993 | case 0x03: |
| 994 | 994 | x68k_sys.fdc.media_density[data & 0x03] = data & 0x10; |
| 995 | 995 | x68k_sys.fdc.motor[data & 0x03] = data & 0x80; |
| 996 | | floppy_drive_set_motor_state(floppy_get_device(space->machine, data & 0x03), (data & 0x80)); |
| 996 | floppy_mon_w(floppy_get_device(space->machine, data & 0x03), !BIT(data, 7)); |
| 997 | 997 | if(data & 0x80) |
| 998 | 998 | { |
| 999 | 999 | for(drive=0;drive<4;drive++) // enable motor for this drive |
| 1000 | 1000 | { |
| 1001 | 1001 | if(drive == (data & 0x03)) |
| 1002 | 1002 | { |
| 1003 | | floppy_drive_set_motor_state(floppy_get_device(space->machine, drive), 1); |
| 1003 | floppy_mon_w(floppy_get_device(space->machine, drive), CLEAR_LINE); |
| 1004 | 1004 | output_set_indexed_value("access_drv",drive,0); |
| 1005 | 1005 | } |
| 1006 | 1006 | else |
| r6671 | r6672 | |
| 1011 | 1011 | { |
| 1012 | 1012 | for(drive=0;drive<4;drive++) |
| 1013 | 1013 | { |
| 1014 | | floppy_drive_set_motor_state(floppy_get_device(space->machine, drive), 0); |
| 1014 | floppy_mon_w(floppy_get_device(space->machine, drive), ASSERT_LINE); |
| 1015 | 1015 | output_set_indexed_value("access_drv",drive,1); |
| 1016 | 1016 | } |
| 1017 | 1017 | } |
src/mess/drivers/bw2.c
| r6671 | r6672 | |
| 475 | 475 | driver_state->mtron = state; |
| 476 | 476 | driver_state->mfdbk = !state; |
| 477 | 477 | |
| 478 | | floppy_drive_set_motor_state(get_floppy_image(device->machine, 0), !driver_state->mtron); |
| 479 | | floppy_drive_set_motor_state(get_floppy_image(device->machine, 1), !driver_state->mtron); |
| 478 | floppy_mon_w(get_floppy_image(device->machine, 0), driver_state->mtron); |
| 479 | floppy_mon_w(get_floppy_image(device->machine, 1), driver_state->mtron); |
| 480 | 480 | |
| 481 | 481 | floppy_drive_set_ready_state(get_floppy_image(device->machine, 0), 1, 1); |
| 482 | 482 | floppy_drive_set_ready_state(get_floppy_image(device->machine, 1), 1, 1); |
src/mess/drivers/elwro800.c
| r6671 | r6672 | |
| 85 | 85 | { |
| 86 | 86 | const device_config *fdc = devtag_get_device(space->machine, "upd765"); |
| 87 | 87 | |
| 88 | | floppy_drive_set_motor_state(floppy_get_device(space->machine, 0), (data & 0x01)); |
| 89 | | floppy_drive_set_motor_state(floppy_get_device(space->machine, 1), (data & 0x02)); |
| 88 | floppy_mon_w(floppy_get_device(space->machine, 0), !BIT(data, 0)); |
| 89 | floppy_mon_w(floppy_get_device(space->machine, 1), !BIT(data, 1)); |
| 90 | 90 | floppy_drive_set_ready_state(floppy_get_device(space->machine, 0), 1,1); |
| 91 | 91 | floppy_drive_set_ready_state(floppy_get_device(space->machine, 1), 1,1); |
| 92 | 92 | |
src/mess/drivers/xerox820.c
| r6671 | r6672 | |
| 366 | 366 | if (dvsel1) wd17xx_set_drive(state->wd1771, 0); |
| 367 | 367 | if (dvsel2) wd17xx_set_drive(state->wd1771, 1); |
| 368 | 368 | |
| 369 | | floppy_drive_set_motor_state(floppy_get_device(device->machine, 0), dvsel1); |
| 370 | | floppy_drive_set_motor_state(floppy_get_device(device->machine, 1), dvsel2); |
| 369 | floppy_mon_w(floppy_get_device(device->machine, 0), !dvsel1); |
| 370 | floppy_mon_w(floppy_get_device(device->machine, 1), !dvsel2); |
| 371 | |
| 371 | 372 | floppy_drive_set_ready_state(floppy_get_device(device->machine, 0), dvsel1, 1); |
| 372 | 373 | floppy_drive_set_ready_state(floppy_get_device(device->machine, 1), dvsel2, 1); |
| 373 | 374 | |