src/mess/devices/thomflop.c
| r2194 | r2195 | |
| 7 | 7 | **********************************************************************/ |
| 8 | 8 | |
| 9 | 9 | #include "driver.h" |
| 10 | #include "deprecat.h" |
| 10 | 11 | #include "includes/thomson.h" |
| 11 | 12 | #include "machine/wd17xx.h" |
| 12 | 13 | #include "devices/flopdrv.h" |
| r2194 | r2195 | |
| 338 | 339 | LOG(( "to7_5p14_reset: CD 90-640 controller\n" )); |
| 339 | 340 | thom_floppy_set_density( DEN_MFM_LO ); |
| 340 | 341 | wd17xx_reset(); |
| 341 | | for ( i = 0; i < device_count( IO_FLOPPY ); i++ ) |
| 342 | for ( i = 0; i < device_count( Machine, IO_FLOPPY ); i++ ) |
| 342 | 343 | { |
| 343 | 344 | const device_config * img = image_from_devtype_and_index( IO_FLOPPY, i ); |
| 344 | 345 | floppy_drive_set_ready_state( img, FLOPPY_DRIVE_READY, 0 ); |
| r2194 | r2195 | |
| 439 | 440 | LOG(( "to7_5p14sd_reset: CD 90-015 controller\n" )); |
| 440 | 441 | thom_floppy_set_density( DEN_FM_LO ); |
| 441 | 442 | mc6843_reset(); |
| 442 | | for ( i = 0; i < device_count( IO_FLOPPY ); i++ ) |
| 443 | for ( i = 0; i < device_count( Machine, IO_FLOPPY ); i++ ) |
| 443 | 444 | { |
| 444 | 445 | const device_config * img = image_from_devtype_and_index( IO_FLOPPY, i ); |
| 445 | 446 | floppy_drive_set_ready_state( img, FLOPPY_DRIVE_READY, 0 ); |
| r2194 | r2195 | |
| 845 | 846 | |
| 846 | 847 | thom_floppy_set_density( DEN_MFM_LO ); |
| 847 | 848 | |
| 848 | | for ( i = 0; i < device_count( IO_FLOPPY ); i++ ) |
| 849 | for ( i = 0; i < device_count( Machine, IO_FLOPPY ); i++ ) |
| 849 | 850 | { |
| 850 | 851 | const device_config * img = image_from_devtype_and_index( IO_FLOPPY, i ); |
| 851 | 852 | floppy_drive_set_index_pulse_callback( img, to7_qdd_index_pulse_cb ); |
| r2194 | r2195 | |
| 1526 | 1527 | int i; |
| 1527 | 1528 | LOG(( "thmfc_floppy_reset: THMFC1 controller\n" )); |
| 1528 | 1529 | |
| 1529 | | for ( i = 0; i < device_count( IO_FLOPPY ); i++ ) |
| 1530 | for ( i = 0; i < device_count( Machine, IO_FLOPPY ); i++ ) |
| 1530 | 1531 | { |
| 1531 | 1532 | const device_config * img = image_from_devtype_and_index( IO_FLOPPY, i ); |
| 1532 | 1533 | floppy_drive_set_index_pulse_callback( img, thmfc_floppy_index_pulse_cb ); |
src/mess/tapectrl.c
| r2194 | r2195 | |
| 12 | 12 | #include "uimenu.h" |
| 13 | 13 | #include "mslegacy.h" |
| 14 | 14 | #include "devices/cassette.h" |
| 15 | #include "deprecat.h" |
| 15 | 16 | |
| 16 | 17 | void tapecontrol_gettime(char *timepos, size_t timepos_size, const device_config *img, int *curpos, int *endpos) |
| 17 | 18 | { |
| r2194 | r2195 | |
| 150 | 151 | { |
| 151 | 152 | case 0: |
| 152 | 153 | id--; |
| 153 | | if (id < 0) id = device_count(IO_CASSETTE)-1; |
| 154 | if (id < 0) id = device_count(Machine, IO_CASSETTE)-1; |
| 154 | 155 | break; |
| 155 | 156 | } |
| 156 | 157 | } |
| r2194 | r2195 | |
| 161 | 162 | { |
| 162 | 163 | case 0: |
| 163 | 164 | id++; |
| 164 | | if (id > device_count(IO_CASSETTE)-1) id = 0; |
| 165 | if (id > device_count(Machine, IO_CASSETTE)-1) id = 0; |
| 165 | 166 | break; |
| 166 | 167 | } |
| 167 | 168 | } |
| r2194 | r2195 | |
| 176 | 177 | switch (sel) |
| 177 | 178 | { |
| 178 | 179 | case 0: |
| 179 | | id = (id + 1) % device_count(IO_CASSETTE); |
| 180 | id = (id + 1) % device_count(Machine, IO_CASSETTE); |
| 180 | 181 | break; |
| 181 | 182 | case 2: |
| 182 | 183 | /* Pause/stop */ |
src/mess/device.c
| r2194 | r2195 | |
| 9 | 9 | #include <stddef.h> |
| 10 | 10 | |
| 11 | 11 | #include "device.h" |
| 12 | | #include "deprecat.h" |
| 13 | 12 | #include "mslegacy.h" |
| 14 | 13 | #include "driver.h" |
| 15 | 14 | #include "pool.h" |
| r2194 | r2195 | |
| 557 | 556 | |
| 558 | 557 | |
| 559 | 558 | /* this function is deprecated */ |
| 560 | | int device_count(iodevice_t type) |
| 559 | int device_count(running_machine *machine, iodevice_t type) |
| 561 | 560 | { |
| 562 | 561 | int count = 0; |
| 563 | 562 | const device_config *device; |
| 564 | 563 | |
| 565 | | for (device = device_list_first(Machine->config->devicelist, MESS_DEVICE); device != NULL; device = device_list_next(device, MESS_DEVICE)) |
| 564 | for (device = device_list_first(machine->config->devicelist, MESS_DEVICE); device != NULL; device = device_list_next(device, MESS_DEVICE)) |
| 566 | 565 | { |
| 567 | 566 | const struct IODevice *iodev = mess_device_from_core_device(device); |
| 568 | 567 | if (iodev->type == type) |
src/mess/machine/nec765.c
| r2194 | r2195 | |
| 21 | 21 | ***************************************************************************/ |
| 22 | 22 | |
| 23 | 23 | #include "driver.h" |
| 24 | #include "deprecat.h" |
| 24 | 25 | #include "machine/nec765.h" |
| 25 | 26 | |
| 26 | 27 | |
| r2194 | r2195 | |
| 149 | 150 | |
| 150 | 151 | if (!nec765_iface.get_image) |
| 151 | 152 | { |
| 152 | | if (fdc.drive < device_count(IO_FLOPPY)) |
| 153 | if (fdc.drive < device_count(Machine, IO_FLOPPY)) |
| 153 | 154 | image = image_from_devtype_and_index(IO_FLOPPY, fdc.drive); |
| 154 | 155 | } |
| 155 | 156 | else |
| r2194 | r2195 | |
| 696 | 697 | |
| 697 | 698 | nec765_reset(0); |
| 698 | 699 | |
| 699 | | for (i = 0; i < device_count(IO_FLOPPY); i++) |
| 700 | for (i = 0; i < device_count(Machine, IO_FLOPPY); i++) |
| 700 | 701 | floppy_drive_set_ready_state_change_callback(image_from_devtype_and_index(IO_FLOPPY, i), nec765_set_ready_change_callback); |
| 701 | 702 | } |
| 702 | 703 | |
| r2194 | r2195 | |
| 2139 | 2140 | are checked or only the drive selected with the drive select bits?? */ |
| 2140 | 2141 | |
| 2141 | 2142 | a_drive_is_ready = 0; |
| 2142 | | for (i = 0; i < device_count(IO_FLOPPY); i++) |
| 2143 | for (i = 0; i < device_count(Machine, IO_FLOPPY); i++) |
| 2143 | 2144 | { |
| 2144 | 2145 | if (image_exists(image_from_devtype_and_index(IO_FLOPPY, i))) |
| 2145 | 2146 | { |
src/mess/machine/pc_fdc.c
| r2194 | r2195 | |
| 96 | 96 | |
| 97 | 97 | pc_fdc_reset(); |
| 98 | 98 | |
| 99 | | for (i = 0; i < device_count(IO_FLOPPY); i++) |
| 99 | for (i = 0; i < device_count(Machine, IO_FLOPPY); i++) |
| 100 | 100 | { |
| 101 | 101 | img = image_from_devtype_and_index(IO_FLOPPY, i); |
| 102 | 102 | floppy_drive_set_geometry(img, FLOPPY_DRIVE_DS_80); |
| r2194 | r2195 | |
| 111 | 111 | |
| 112 | 112 | if (!fdc->fdc_interface.get_image) |
| 113 | 113 | { |
| 114 | | if (floppy_index < device_count(IO_FLOPPY)) |
| 114 | if (floppy_index < device_count(Machine, IO_FLOPPY)) |
| 115 | 115 | image = image_from_devtype_and_index(IO_FLOPPY, floppy_index); |
| 116 | 116 | } |
| 117 | 117 | else |
| r2194 | r2195 | |
| 234 | 234 | int selected_drive; |
| 235 | 235 | int floppy_count; |
| 236 | 236 | |
| 237 | | floppy_count = device_count(IO_FLOPPY); |
| 237 | floppy_count = device_count(Machine, IO_FLOPPY); |
| 238 | 238 | |
| 239 | 239 | if (floppy_count > (fdc->digital_output_register & 0x03)) |
| 240 | 240 | floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, fdc->digital_output_register & 0x03), 1, 0); |
src/mess/machine/mc6843.c
| r2194 | r2195 | |
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | #include "driver.h" |
| 34 | #include "deprecat.h" |
| 34 | 35 | #include "mc6843.h" |
| 35 | 36 | #include "devices/flopdrv.h" |
| 36 | 37 | |
| r2194 | r2195 | |
| 758 | 759 | LOG (( "mc6843 reset\n" )); |
| 759 | 760 | |
| 760 | 761 | /* setup/reset floppy drive */ |
| 761 | | for ( i = 0; i < device_count( IO_FLOPPY ); i++ ) |
| 762 | for ( i = 0; i < device_count( Machine, IO_FLOPPY ); i++ ) |
| 762 | 763 | { |
| 763 | 764 | const device_config * img = image_from_devtype_and_index( IO_FLOPPY, i ); |
| 764 | 765 | floppy_drive_set_index_pulse_callback( img, mc6843_index_pulse_callback ); |
src/mess/machine/wd17xx.c
| r2194 | r2195 | |
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | #include "driver.h" |
| 39 | #include "deprecat.h" |
| 39 | 40 | #include "machine/wd17xx.h" |
| 40 | 41 | #include "devices/flopdrv.h" |
| 41 | 42 | |
| r2194 | r2195 | |
| 323 | 324 | { |
| 324 | 325 | UINT8 step_counter; |
| 325 | 326 | |
| 326 | | if (current_drive >= device_count(IO_FLOPPY)) |
| 327 | if (current_drive >= device_count(Machine, IO_FLOPPY)) |
| 327 | 328 | return; |
| 328 | 329 | |
| 329 | 330 | step_counter = 255; |
| r2194 | r2195 | |
| 374 | 375 | void wd17xx_reset(void) |
| 375 | 376 | { |
| 376 | 377 | int i; |
| 377 | | for (i = 0; i < device_count(IO_FLOPPY); i++) |
| 378 | for (i = 0; i < device_count(Machine, IO_FLOPPY); i++) |
| 378 | 379 | { |
| 379 | 380 | const device_config *img = image_from_devtype_and_index(IO_FLOPPY, i); |
| 380 | 381 | floppy_drive_set_index_pulse_callback(img, wd17xx_index_pulse_callback); |
src/mess/machine/corvushd.c
| r2194 | r2195 | |
| 64 | 64 | // |
| 65 | 65 | |
| 66 | 66 | #include "driver.h" |
| 67 | #include "deprecat.h" |
| 67 | 68 | #include "devices/harddriv.h" |
| 68 | 69 | #include "includes/corvushd.h" |
| 69 | 70 | #include <ctype.h> |
| r2194 | r2195 | |
| 554 | 555 | |
| 555 | 556 | LOG(("corvus_write_sector: Write Drive: %d, physical sector: 0x%5.5x\n", drv, sector)); |
| 556 | 557 | |
| 557 | | if(drv >= device_count(IO_HARDDISK)) { |
| 558 | if(drv >= device_count(Machine, IO_HARDDISK)) { |
| 558 | 559 | logerror("corvus_write_sector: Attempt to write to non-existant drive: %d\n", drv); |
| 559 | 560 | return STAT_FATAL_ERR | STAT_DRIVE_NOT_ONLINE; |
| 560 | 561 | } |
| r2194 | r2195 | |
| 670 | 671 | |
| 671 | 672 | LOG(("corvus_read_sector: Read Drive: %d, physical sector: 0x%5.5x\n", drv, sector)); |
| 672 | 673 | |
| 673 | | if(drv >= device_count(IO_HARDDISK)) { |
| 674 | if(drv >= device_count(Machine, IO_HARDDISK)) { |
| 674 | 675 | logerror("corvus_read_sector: Attempt to read from non-existant drive: %d\n", drv); |
| 675 | 676 | return STAT_FATAL_ERR | STAT_DRIVE_NOT_ONLINE; |
| 676 | 677 | } |
| r2194 | r2195 | |
| 966 | 967 | // |
| 967 | 968 | drv -= 1; // Internally, drives start at 0 |
| 968 | 969 | |
| 969 | | if(drv >= device_count(IO_HARDDISK)) { |
| 970 | if(drv >= device_count(Machine, IO_HARDDISK)) { |
| 970 | 971 | logerror("corvus_get_drive_parameters: Attempt to retrieve parameters from non-existant drive: %d\n", drv); |
| 971 | 972 | c->xmit_bytes = 1; |
| 972 | 973 | return STAT_FATAL_ERR | STAT_DRIVE_NOT_ONLINE; |
src/mess/cheatms.c
| r2194 | r2195 | |
| 11 | 11 | #include "mess.h" |
| 12 | 12 | #include "image.h" |
| 13 | 13 | #include "cheatms.h" |
| 14 | #include "deprecat.h" |
| 14 | 15 | |
| 15 | 16 | |
| 16 | 17 | /*************************************************************************** |
| r2194 | r2195 | |
| 29 | 30 | |
| 30 | 31 | static void BuildCRCTable(void) |
| 31 | 32 | { |
| 32 | | int deviceType, deviceID, listIdx; |
| 33 | int listIdx; |
| 34 | const device_config *img; |
| 33 | 35 | |
| 34 | 36 | free(deviceCRCList); |
| 35 | 37 | |
| r2194 | r2195 | |
| 37 | 39 | deviceCRCList = calloc(1, sizeof(UINT32)); |
| 38 | 40 | deviceCRCListLength = 1; |
| 39 | 41 | |
| 40 | | for(deviceType = 0; deviceType < IO_COUNT; deviceType++) |
| 42 | for (img = image_device_first(Machine->config); img != NULL; img = image_device_next(img)) |
| 41 | 43 | { |
| 42 | | for(deviceID = 0; deviceID < device_count(deviceType); deviceID++) |
| 44 | if (image_exists(img)) |
| 43 | 45 | { |
| 44 | | const device_config *img = image_from_devtype_and_index(deviceType, deviceID); |
| 45 | | if (image_exists(img)) |
| 46 | | { |
| 47 | | UINT32 crc = image_crc(img); |
| 48 | | int isUnique = 1; |
| 46 | UINT32 crc = image_crc(img); |
| 47 | int isUnique = 1; |
| 49 | 48 | |
| 50 | | for(listIdx = 0; listIdx < deviceCRCListLength; listIdx++) |
| 49 | for(listIdx = 0; listIdx < deviceCRCListLength; listIdx++) |
| 50 | { |
| 51 | if(deviceCRCList[listIdx] == crc) |
| 51 | 52 | { |
| 52 | | if(deviceCRCList[listIdx] == crc) |
| 53 | | { |
| 54 | | isUnique = 0; |
| 53 | isUnique = 0; |
| 55 | 54 | |
| 56 | | break; |
| 57 | | } |
| 55 | break; |
| 58 | 56 | } |
| 57 | } |
| 59 | 58 | |
| 60 | | if(isUnique) |
| 61 | | { |
| 62 | | if(!thisGameCRC) |
| 63 | | thisGameCRC = crc; |
| 59 | if(isUnique) |
| 60 | { |
| 61 | if(!thisGameCRC) |
| 62 | thisGameCRC = crc; |
| 64 | 63 | |
| 65 | | deviceCRCList = realloc(deviceCRCList, (deviceCRCListLength + 1) * sizeof(UINT32)); |
| 64 | deviceCRCList = realloc(deviceCRCList, (deviceCRCListLength + 1) * sizeof(UINT32)); |
| 66 | 65 | |
| 67 | | deviceCRCList[deviceCRCListLength] = crc; |
| 68 | | deviceCRCListLength++; |
| 69 | | } |
| 66 | deviceCRCList[deviceCRCListLength] = crc; |
| 67 | deviceCRCListLength++; |
| 70 | 68 | } |
| 71 | 69 | } |
| 72 | 70 | } |