src/mess/machine/amstrad.c
| r5849 | r5850 | |
| 3261 | 3261 | else |
| 3262 | 3262 | cpu_set_input_line_vector(cputag_get_cpu(machine, "maincpu"), 0, 0x00); |
| 3263 | 3263 | |
| 3264 | | if(amstrad_system_type != SYSTEM_GX4000) |
| 3265 | | { |
| 3266 | | floppy_drive_set_geometry(floppy_get_device(machine, 0), FLOPPY_DRIVE_SS_40); |
| 3267 | | floppy_drive_set_geometry(floppy_get_device(machine, 1), FLOPPY_DRIVE_SS_40); |
| 3268 | | } |
| 3269 | | |
| 3270 | 3264 | /* The opcode timing in the Amstrad is different to the opcode |
| 3271 | 3265 | timing in the core for the Z80 CPU. |
| 3272 | 3266 | |
| r5849 | r5850 | |
| 3438 | 3432 | Amstrad_ROM_Table[7] = &rom[0x018000]; // AMSDOS |
| 3439 | 3433 | amstrad_common_init(machine); |
| 3440 | 3434 | amstrad_reset_machine(machine); |
| 3441 | | |
| 3442 | | floppy_drive_set_geometry(floppy_get_device(machine, 0), FLOPPY_DRIVE_DS_80); |
| 3443 | | floppy_drive_set_geometry(floppy_get_device(machine, 1), FLOPPY_DRIVE_DS_80); |
| 3444 | 3435 | } |
| 3445 | 3436 | |
| 3446 | 3437 | |
src/mess/machine/wd17xx.c
| r5849 | r5850 | |
| 866 | 866 | timer_reset(w->timer, attotime_never); |
| 867 | 867 | } |
| 868 | 868 | |
| 869 | int wd17xx_get_datarate_in_us(DENSITY density) |
| 870 | { |
| 871 | int usecs; |
| 872 | /* 64 for single density */ |
| 873 | switch (density) |
| 874 | { |
| 875 | case DEN_FM_LO: |
| 876 | { |
| 877 | usecs = 128; |
| 878 | } |
| 879 | break; |
| 869 | 880 | |
| 881 | case DEN_FM_HI: |
| 882 | { |
| 883 | usecs = 64; |
| 884 | } |
| 885 | break; |
| 870 | 886 | |
| 887 | default: |
| 888 | case DEN_MFM_LO: |
| 889 | { |
| 890 | usecs = 32; |
| 891 | } |
| 892 | break; |
| 893 | |
| 894 | case DEN_MFM_HI: |
| 895 | { |
| 896 | usecs = 16; |
| 897 | } |
| 898 | break; |
| 899 | } |
| 900 | |
| 901 | return usecs; |
| 902 | } |
| 903 | |
| 871 | 904 | /* called on error, or when command is actually completed */ |
| 872 | 905 | /* KT - I have used a timer for systems that use interrupt driven transfers. |
| 873 | 906 | A interrupt occurs after the last byte has been read. If it occurs at the time |
| r5849 | r5850 | |
| 890 | 923 | /* Robbbert - adjusted delay value (see notes above) to fix the osborne1 */ |
| 891 | 924 | w->status &= ~STA_2_BUSY; |
| 892 | 925 | |
| 893 | | usecs = floppy_drive_get_datarate_in_us(w->density); |
| 926 | usecs = wd17xx_get_datarate_in_us(w->density); |
| 894 | 927 | usecs *= delay; |
| 895 | 928 | #endif |
| 896 | 929 | |
| r5849 | r5850 | |
| 1083 | 1116 | int usecs; |
| 1084 | 1117 | wd17xx_t *w = get_safe_token(device); |
| 1085 | 1118 | |
| 1086 | | usecs = floppy_drive_get_datarate_in_us(w->density); |
| 1119 | usecs = wd17xx_get_datarate_in_us(w->density); |
| 1087 | 1120 | |
| 1088 | 1121 | /* set new timer */ |
| 1089 | 1122 | timer_adjust_oneshot(w->timer, ATTOTIME_IN_USEC(usecs), MISCCALLBACK_DATA); |
src/mess/machine/exidy.c
| r5849 | r5850 | |
| 390 | 390 | } |
| 391 | 391 | } |
| 392 | 392 | |
| 393 | | MACHINE_START( exidyd ) |
| 393 | MACHINE_START( exidy ) |
| 394 | 394 | { |
| 395 | 395 | // serial_timer = timer_alloc(machine, exidy_serial_timer_callback, NULL); |
| 396 | 396 | cassette_timer = timer_alloc(machine, exidy_cassette_tc, NULL); |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | | MACHINE_START( exidy ) |
| 399 | MACHINE_RESET( exidy ) |
| 400 | 400 | { |
| 401 | | MACHINE_START_CALL( exidyd ); |
| 402 | | } |
| 403 | | |
| 404 | | MACHINE_RESET( exidyd ) |
| 405 | | { |
| 406 | 401 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 407 | 402 | |
| 408 | 403 | /* Initialize cassette interface */ |
| r5849 | r5850 | |
| 418 | 413 | timer_set(machine, ATTOTIME_IN_USEC(10), NULL, 0, exidy_reset); |
| 419 | 414 | memory_set_bank(machine, 1, 1); |
| 420 | 415 | } |
| 421 | | |
| 422 | | MACHINE_RESET( exidy ) |
| 423 | | { |
| 424 | | floppy_drive_set_geometry(floppy_get_device(machine, 0), FLOPPY_DRIVE_DS_80); |
| 425 | | MACHINE_RESET_CALL( exidyd ); |
| 426 | | } |
src/mess/machine/pc_fdc.c
| r5849 | r5850 | |
| 112 | 112 | |
| 113 | 113 | void pc_fdc_init(running_machine *machine, const struct pc_fdc_interface *iface) |
| 114 | 114 | { |
| 115 | | int i; |
| 116 | | const device_config *img; |
| 117 | | |
| 118 | 115 | /* initialize fdc structure */ |
| 119 | 116 | fdc = auto_alloc_clear(machine, struct pc_fdc); |
| 120 | 117 | |
| r5849 | r5850 | |
| 122 | 119 | if (iface) |
| 123 | 120 | memcpy(&fdc->fdc_interface, iface, sizeof(fdc->fdc_interface)); |
| 124 | 121 | |
| 125 | | /* setup nec765 interface */ |
| 126 | | //nec765_init(machine, &pc_fdc_nec765_interface, iface->nec765_type, iface->nec765_rdy_pin); |
| 127 | | |
| 128 | 122 | fdc->watchdog = timer_alloc(machine, watchdog_timeout, NULL ); |
| 129 | 123 | |
| 130 | 124 | pc_fdc_reset(machine); |
| 131 | | |
| 132 | | for (i = 0; i < 4; i++) |
| 133 | | { |
| 134 | | img = floppy_get_device(machine, i); |
| 135 | | if (img) { |
| 136 | | floppy_drive_set_geometry(img, FLOPPY_DRIVE_DS_80); |
| 137 | | } |
| 138 | | } |
| 139 | 125 | } |
| 140 | 126 | |
| 141 | 127 | |
src/mess/devices/flopdrv.c
| r5849 | r5850 | |
| 214 | 214 | image_fsize_thunk |
| 215 | 215 | }; |
| 216 | 216 | |
| 217 | void floppy_drive_set_geometry_absolute(const device_config *img, int tracks, int sides) |
| 218 | { |
| 219 | floppy_drive *pDrive = get_safe_token( img ); |
| 220 | pDrive->max_track = tracks; |
| 221 | pDrive->num_sides = sides; |
| 222 | } |
| 217 | 223 | |
| 224 | void floppy_drive_set_geometry(const device_config *img, floppy_type type) |
| 225 | { |
| 226 | int max_track, num_sides; |
| 227 | |
| 228 | switch (type) { |
| 229 | case FLOPPY_DRIVE_SS_40: /* single sided, 40 track drive e.g. Amstrad CPC internal 3" drive */ |
| 230 | max_track = 42; |
| 231 | num_sides = 1; |
| 232 | break; |
| 233 | |
| 234 | case FLOPPY_DRIVE_DS_80: |
| 235 | max_track = 83; |
| 236 | num_sides = 2; |
| 237 | break; |
| 238 | |
| 239 | default: |
| 240 | assert(0); |
| 241 | return; |
| 242 | } |
| 243 | floppy_drive_set_geometry_absolute(img, max_track, num_sides); |
| 244 | } |
| 245 | |
| 218 | 246 | static TIMER_CALLBACK(floppy_drive_index_callback); |
| 219 | 247 | |
| 220 | 248 | /* this is called on device init */ |
| r5849 | r5850 | |
| 229 | 257 | pDrive->index_timer = timer_alloc(img->machine, floppy_drive_index_callback, (void *) img); |
| 230 | 258 | pDrive->index = 0; |
| 231 | 259 | |
| 232 | | /* all drives are double-sided 80 track - can be overriden in driver! */ |
| 233 | | floppy_drive_set_geometry(img, FLOPPY_DRIVE_DS_80); |
| 260 | floppy_drive_set_geometry(img, ((floppy_config*)img->static_config)->floppy_type); |
| 234 | 261 | |
| 235 | 262 | /* initialise id index - not so important */ |
| 236 | 263 | pDrive->id_index = 0; |
| r5849 | r5850 | |
| 460 | 487 | } |
| 461 | 488 | |
| 462 | 489 | |
| 463 | | void floppy_drive_set_geometry(const device_config *img, floppy_type type) |
| 464 | | { |
| 465 | | int max_track, num_sides; |
| 466 | | |
| 467 | | switch (type) { |
| 468 | | case FLOPPY_DRIVE_SS_40: /* single sided, 40 track drive e.g. Amstrad CPC internal 3" drive */ |
| 469 | | max_track = 42; |
| 470 | | num_sides = 1; |
| 471 | | break; |
| 472 | | |
| 473 | | case FLOPPY_DRIVE_DS_80: |
| 474 | | max_track = 83; |
| 475 | | num_sides = 2; |
| 476 | | break; |
| 477 | | |
| 478 | | default: |
| 479 | | assert(0); |
| 480 | | return; |
| 481 | | } |
| 482 | | floppy_drive_set_geometry_absolute(img, max_track, num_sides); |
| 483 | | } |
| 484 | | |
| 485 | 490 | void floppy_drive_seek(const device_config *img, signed int signed_tracks) |
| 486 | 491 | { |
| 487 | 492 | floppy_drive *pDrive; |
| r5849 | r5850 | |
| 623 | 628 | } |
| 624 | 629 | } |
| 625 | 630 | |
| 626 | | int floppy_drive_get_datarate_in_us(DENSITY density) |
| 627 | | { |
| 628 | | int usecs; |
| 629 | | /* 64 for single density */ |
| 630 | | switch (density) |
| 631 | | { |
| 632 | | case DEN_FM_LO: |
| 633 | | { |
| 634 | | usecs = 128; |
| 635 | | } |
| 636 | | break; |
| 637 | | |
| 638 | | case DEN_FM_HI: |
| 639 | | { |
| 640 | | usecs = 64; |
| 641 | | } |
| 642 | | break; |
| 643 | | |
| 644 | | default: |
| 645 | | case DEN_MFM_LO: |
| 646 | | { |
| 647 | | usecs = 32; |
| 648 | | } |
| 649 | | break; |
| 650 | | |
| 651 | | case DEN_MFM_HI: |
| 652 | | { |
| 653 | | usecs = 16; |
| 654 | | } |
| 655 | | break; |
| 656 | | } |
| 657 | | |
| 658 | | return usecs; |
| 659 | | } |
| 660 | | |
| 661 | 631 | void floppy_install_load_proc(const device_config *image, void (*proc)(const device_config *image)) |
| 662 | 632 | { |
| 663 | 633 | floppy_drive *flopimg = get_safe_token( image ); |
| r5849 | r5850 | |
| 690 | 660 | pDrive->ready_state_change_callback = callback; |
| 691 | 661 | } |
| 692 | 662 | |
| 693 | | void floppy_drive_set_geometry_absolute(const device_config *img, int tracks, int sides) |
| 694 | | { |
| 695 | | floppy_drive *pDrive = get_safe_token( img ); |
| 696 | | pDrive->max_track = tracks; |
| 697 | | pDrive->num_sides = sides; |
| 698 | | } |
| 699 | | |
| 700 | 663 | int floppy_drive_get_current_track(const device_config *img) |
| 701 | 664 | { |
| 702 | 665 | floppy_drive *drv = get_safe_token( img ); |
src/mess/devices/flopdrv.h
| r5849 | r5850 | |
| 36 | 36 | keep_geometry keep_drive_geometry; |
| 37 | 37 | }; |
| 38 | 38 | |
| 39 | | typedef enum |
| 40 | | { |
| 41 | | DEN_FM_LO = 0, |
| 42 | | DEN_FM_HI, |
| 43 | | DEN_MFM_LO, |
| 44 | | DEN_MFM_HI |
| 45 | | } DENSITY; |
| 46 | | |
| 47 | 39 | /* sector has a deleted data address mark */ |
| 48 | 40 | #define ID_FLAG_DELETED_DATA 0x0001 |
| 49 | 41 | /* CRC error in id field */ |
| r5849 | r5850 | |
| 86 | 78 | /* get current physical track drive is on */ |
| 87 | 79 | int floppy_drive_get_current_track(const device_config *img); |
| 88 | 80 | |
| 89 | | void floppy_drive_set_geometry(const device_config *img, floppy_type type); |
| 90 | | void floppy_drive_set_geometry_absolute(const device_config *img, int tracks, int sides); |
| 91 | | |
| 92 | 81 | /* get next id from track, 1 if got a id, 0 if no id was got */ |
| 93 | 82 | int floppy_drive_get_next_id(const device_config *img, int side, chrn_id *); |
| 94 | 83 | /* set ready state of drive. If flag == 1, set ready state only if drive present, |
| r5849 | r5850 | |
| 105 | 94 | void floppy_drive_format_sector(const device_config *img, int side, int sector_index, int c, int h, int r, int n, int filler); |
| 106 | 95 | void floppy_drive_read_sector_data(const device_config *img, int side, int index1, void *pBuffer, int length); |
| 107 | 96 | void floppy_drive_write_sector_data(const device_config *img, int side, int index1, const void *pBuffer, int length, int ddam); |
| 108 | | int floppy_drive_get_datarate_in_us(DENSITY density); |
| 109 | 97 | |
| 110 | 98 | /* set motor speed to get correct index pulses |
| 111 | 99 | standard RPM are 300 RPM (common) and 360 RPM |
src/mess/drivers/sord.c
| r5849 | r5850 | |
| 175 | 175 | |
| 176 | 176 | static MACHINE_RESET( sord_m5_fd5 ) |
| 177 | 177 | { |
| 178 | | floppy_drive_set_geometry(floppy_get_device(machine,0), FLOPPY_DRIVE_SS_40); |
| 179 | | floppy_drive_set_geometry(floppy_get_device(machine,1), FLOPPY_DRIVE_SS_40); |
| 180 | 178 | MACHINE_RESET_CALL(sord_m5); |
| 181 | 179 | ppi8255_set_port_c(devtag_get_device(machine, "ppi8255"), 0x50); |
| 182 | 180 | } |
| r5849 | r5850 | |
| 571 | 569 | |
| 572 | 570 | static const floppy_config sordm5_floppy_config = |
| 573 | 571 | { |
| 574 | | FLOPPY_DRIVE_DS_80, |
| 572 | FLOPPY_DRIVE_SS_40, |
| 575 | 573 | FLOPPY_OPTIONS_NAME(sordm5), |
| 576 | 574 | DO_NOT_KEEP_GEOMETRY |
| 577 | 575 | }; |
src/mess/drivers/specpls3.c
| r5849 | r5850 | |
| 351 | 351 | { |
| 352 | 352 | memset(mess_ram,0,128*1024); |
| 353 | 353 | |
| 354 | | floppy_drive_set_geometry(floppy_get_device(machine, 0), FLOPPY_DRIVE_SS_40); |
| 355 | | floppy_drive_set_geometry(floppy_get_device(machine, 1), FLOPPY_DRIVE_SS_40); |
| 356 | | |
| 357 | 354 | /* Initial configuration */ |
| 358 | 355 | spectrum_128_port_7ffd_data = 0; |
| 359 | 356 | spectrum_plus3_port_1ffd_data = 0; |
| r5849 | r5850 | |
| 364 | 361 | |
| 365 | 362 | static const floppy_config specpls3_floppy_config = |
| 366 | 363 | { |
| 367 | | FLOPPY_DRIVE_DS_80, |
| 364 | FLOPPY_DRIVE_SS_40, |
| 368 | 365 | FLOPPY_OPTIONS_NAME(default), |
| 369 | 366 | DO_NOT_KEEP_GEOMETRY |
| 370 | 367 | }; |