src/mess/machine/applefdc.c
| r3910 | r3911 | |
| 260 | 260 | * Bits 4-0 Same as IWM mode bits 4-0 |
| 261 | 261 | */ |
| 262 | 262 | |
| 263 | | status = iwm_enable2(device) ? 1 : (intf->read_status ? intf->read_status() : 0); |
| 263 | status = iwm_enable2(device) ? 1 : (intf->read_status ? intf->read_status(device) : 0); |
| 264 | 264 | |
| 265 | 265 | result = (status ? 0x80 : 0x00); |
| 266 | 266 | |
| r3910 | r3911 | |
| 318 | 318 | logerror("applefdc_read_reg(): latch mode off not implemented\n"); |
| 319 | 319 | } |
| 320 | 320 | |
| 321 | | result = (intf->read_data ? intf->read_data() : 0x00); |
| 321 | result = (intf->read_data ? intf->read_data(device) : 0x00); |
| 322 | 322 | } |
| 323 | 323 | break; |
| 324 | 324 | |
| r3910 | r3911 | |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | if (intf->write_data != NULL) |
| 375 | | intf->write_data(data); |
| 375 | intf->write_data(device,data); |
| 376 | 376 | } |
| 377 | 377 | break; |
| 378 | 378 | } |
| r3910 | r3911 | |
| 410 | 410 | |
| 411 | 411 | /* invoke callback, if present */ |
| 412 | 412 | if (intf->set_enable_lines != NULL) |
| 413 | | intf->set_enable_lines(enable_lines); |
| 413 | intf->set_enable_lines(device,enable_lines); |
| 414 | 414 | |
| 415 | 415 | if (LOG_APPLEFDC_EXTRA) |
| 416 | 416 | logerror("iwm_turnmotor_onoff(): Turning motor %s\n", status ? "on" : "off"); |
| r3910 | r3911 | |
| 451 | 451 | fdc->lines &= ~(1 << (offset >> 1)); |
| 452 | 452 | |
| 453 | 453 | if ((offset < 0x08) && (intf->set_lines != NULL)) |
| 454 | | intf->set_lines(fdc->lines & 0x0f); |
| 454 | intf->set_lines(device,fdc->lines & 0x0f); |
| 455 | 455 | |
| 456 | 456 | switch(offset) |
| 457 | 457 | { |
| r3910 | r3911 | |
| 469 | 469 | case 0x0A: |
| 470 | 470 | /* turn off IWM_DRIVE */ |
| 471 | 471 | if ((fdc->lines & IWM_MOTOR) && (intf->set_enable_lines != NULL)) |
| 472 | | intf->set_enable_lines(1); |
| 472 | intf->set_enable_lines(device,1); |
| 473 | 473 | break; |
| 474 | 474 | |
| 475 | 475 | case 0x0B: |
| 476 | 476 | /* turn on IWM_DRIVE */ |
| 477 | 477 | if ((fdc->lines & IWM_MOTOR) && (intf->set_enable_lines != NULL)) |
| 478 | | intf->set_enable_lines(2); |
| 478 | intf->set_enable_lines(device,2); |
| 479 | 479 | break; |
| 480 | 480 | } |
| 481 | 481 | } |
| r3910 | r3911 | |
| 509 | 509 | if (fdc->lines & IWM_Q7) |
| 510 | 510 | { |
| 511 | 511 | if (intf->write_data != NULL) |
| 512 | | intf->write_data(fdc->write_byte); |
| 512 | intf->write_data(device,fdc->write_byte); |
| 513 | 513 | result = 0; |
| 514 | 514 | } |
| 515 | 515 | else |
| r3910 | r3911 | |
| 568 | 568 | if (fdc->lines & IWM_Q7) |
| 569 | 569 | { |
| 570 | 570 | if (intf->write_data != NULL) |
| 571 | | intf->write_data(fdc->write_byte); |
| 571 | intf->write_data(device,fdc->write_byte); |
| 572 | 572 | } |
| 573 | 573 | break; |
| 574 | 574 | |
src/mess/machine/applefdc.h
| r3910 | r3911 | |
| 40 | 40 | typedef struct _applefdc_interface applefdc_interface; |
| 41 | 41 | struct _applefdc_interface |
| 42 | 42 | { |
| 43 | | void (*set_lines)(UINT8 lines); |
| 44 | | void (*set_enable_lines)(int enable_mask); |
| 43 | void (*set_lines)(const device_config *device, UINT8 lines); |
| 44 | void (*set_enable_lines)(const device_config *device, int enable_mask); |
| 45 | 45 | |
| 46 | | UINT8 (*read_data)(void); |
| 47 | | void (*write_data)(UINT8 data); |
| 48 | | int (*read_status)(void); |
| 46 | UINT8 (*read_data)(const device_config *device); |
| 47 | void (*write_data)(const device_config *device, UINT8 data); |
| 48 | int (*read_status)(const device_config *device); |
| 49 | 49 | }; |
| 50 | 50 | |
| 51 | 51 | |
| r3910 | r3911 | |
| 70 | 70 | /* accessor */ |
| 71 | 71 | UINT8 applefdc_get_lines(const device_config *device); |
| 72 | 72 | |
| 73 | /*************************************************************************** |
| 74 | DEVICE CONFIGURATION MACROS |
| 75 | ***************************************************************************/ |
| 73 | 76 | |
| 77 | #define MDRV_APPLEFDC_ADD(_tag, _intrf) \ |
| 78 | MDRV_DEVICE_ADD(_tag, APPLEFDC) \ |
| 79 | MDRV_DEVICE_CONFIG(_intrf) |
| 80 | |
| 81 | #define MDRV_APPLEFDC_MODIFY(_tag, _intrf) \ |
| 82 | MDRV_DEVICE_MODIFY(_tag, APPLEFDC) \ |
| 83 | MDRV_DEVICE_CONFIG(_intrf) |
| 84 | |
| 85 | #define MDRV_APPLEFDC_REMOVE(_tag) \ |
| 86 | MDRV_DEVICE_REMOVE(_tag, APPLEFDC) |
| 87 | |
| 88 | #define MDRV_IWM_ADD(_tag, _intrf) \ |
| 89 | MDRV_DEVICE_ADD(_tag, IWM) \ |
| 90 | MDRV_DEVICE_CONFIG(_intrf) |
| 91 | |
| 92 | #define MDRV_IWM_MODIFY(_tag, _intrf) \ |
| 93 | MDRV_DEVICE_MODIFY(_tag, IWM) \ |
| 94 | MDRV_DEVICE_CONFIG(_intrf) |
| 95 | |
| 96 | #define MDRV_IWM_REMOVE(_tag) \ |
| 97 | MDRV_DEVICE_REMOVE(_tag, IWM) |
| 98 | |
| 99 | #define MDRV_SWIM_ADD(_tag, _intrf) \ |
| 100 | MDRV_DEVICE_ADD(_tag, SWIM) \ |
| 101 | MDRV_DEVICE_CONFIG(_intrf) |
| 102 | |
| 103 | #define MDRV_SWIM_MODIFY(_tag, _intrf) \ |
| 104 | MDRV_DEVICE_MODIFY(_tag, SWIM) \ |
| 105 | MDRV_DEVICE_CONFIG(_intrf) |
| 106 | |
| 107 | #define MDRV_SWIM_REMOVE(_tag) \ |
| 108 | MDRV_DEVICE_REMOVE(_tag, SWIM) |
| 109 | |
| 110 | |
| 74 | 111 | #endif /* __APPLEFDC_H__ */ |
src/mess/machine/apple2.c
| r3910 | r3911 | |
| 1112 | 1112 | return device_count_tag_from_machine(machine, "apple525driv") > 0; |
| 1113 | 1113 | } |
| 1114 | 1114 | |
| 1115 | | static void apple2_fdc_set_lines(UINT8 lines) |
| 1115 | static void apple2_fdc_set_lines(const device_config *device, UINT8 lines) |
| 1116 | 1116 | { |
| 1117 | 1117 | if (apple2_fdc_diskreg & 0x40) |
| 1118 | 1118 | { |
| 1119 | | if (apple2_fdc_has_35(Machine)) |
| 1119 | if (apple2_fdc_has_35(device->machine)) |
| 1120 | 1120 | { |
| 1121 | 1121 | /* slot 5: 3.5" disks */ |
| 1122 | | sony_set_lines(lines); |
| 1122 | sony_set_lines(device,lines); |
| 1123 | 1123 | } |
| 1124 | 1124 | } |
| 1125 | 1125 | else |
| 1126 | 1126 | { |
| 1127 | | if (apple2_fdc_has_525(Machine)) |
| 1127 | if (apple2_fdc_has_525(device->machine)) |
| 1128 | 1128 | { |
| 1129 | 1129 | /* slot 6: 5.25" disks */ |
| 1130 | | apple525_set_lines(lines); |
| 1130 | apple525_set_lines(device,lines); |
| 1131 | 1131 | } |
| 1132 | 1132 | } |
| 1133 | 1133 | } |
| 1134 | 1134 | |
| 1135 | 1135 | |
| 1136 | 1136 | |
| 1137 | | static void apple2_fdc_set_enable_lines(int enable_mask) |
| 1137 | static void apple2_fdc_set_enable_lines(const device_config *device,int enable_mask) |
| 1138 | 1138 | { |
| 1139 | 1139 | int slot5_enable_mask = 0; |
| 1140 | 1140 | int slot6_enable_mask = 0; |
| r3910 | r3911 | |
| 1144 | 1144 | else |
| 1145 | 1145 | slot6_enable_mask = enable_mask; |
| 1146 | 1146 | |
| 1147 | | if (apple2_fdc_has_35(Machine)) |
| 1147 | if (apple2_fdc_has_35(device->machine)) |
| 1148 | 1148 | { |
| 1149 | 1149 | /* set the 3.5" enable lines */ |
| 1150 | | sony_set_enable_lines(slot5_enable_mask); |
| 1150 | sony_set_enable_lines(device,slot5_enable_mask); |
| 1151 | 1151 | } |
| 1152 | 1152 | |
| 1153 | | if (apple2_fdc_has_525(Machine)) |
| 1153 | if (apple2_fdc_has_525(device->machine)) |
| 1154 | 1154 | { |
| 1155 | 1155 | /* set the 5.25" enable lines */ |
| 1156 | | apple525_set_enable_lines(slot6_enable_mask); |
| 1156 | apple525_set_enable_lines(device,slot6_enable_mask); |
| 1157 | 1157 | } |
| 1158 | 1158 | } |
| 1159 | 1159 | |
| 1160 | 1160 | |
| 1161 | 1161 | |
| 1162 | | static UINT8 apple2_fdc_read_data(void) |
| 1162 | static UINT8 apple2_fdc_read_data(const device_config *device) |
| 1163 | 1163 | { |
| 1164 | 1164 | UINT8 result = 0x00; |
| 1165 | 1165 | |
| 1166 | 1166 | if (apple2_fdc_diskreg & 0x40) |
| 1167 | 1167 | { |
| 1168 | | if (apple2_fdc_has_35(Machine)) |
| 1168 | if (apple2_fdc_has_35(device->machine)) |
| 1169 | 1169 | { |
| 1170 | 1170 | /* slot 5: 3.5" disks */ |
| 1171 | | result = sony_read_data(); |
| 1171 | result = sony_read_data(device); |
| 1172 | 1172 | } |
| 1173 | 1173 | } |
| 1174 | 1174 | else |
| 1175 | 1175 | { |
| 1176 | | if (apple2_fdc_has_525(Machine)) |
| 1176 | if (apple2_fdc_has_525(device->machine)) |
| 1177 | 1177 | { |
| 1178 | 1178 | /* slot 6: 5.25" disks */ |
| 1179 | | result = apple525_read_data(); |
| 1179 | result = apple525_read_data(device); |
| 1180 | 1180 | } |
| 1181 | 1181 | } |
| 1182 | 1182 | return result; |
| r3910 | r3911 | |
| 1184 | 1184 | |
| 1185 | 1185 | |
| 1186 | 1186 | |
| 1187 | | static void apple2_fdc_write_data(UINT8 data) |
| 1187 | static void apple2_fdc_write_data(const device_config *device, UINT8 data) |
| 1188 | 1188 | { |
| 1189 | 1189 | if (apple2_fdc_diskreg & 0x40) |
| 1190 | 1190 | { |
| 1191 | | if (apple2_fdc_has_35(Machine)) |
| 1191 | if (apple2_fdc_has_35(device->machine)) |
| 1192 | 1192 | { |
| 1193 | 1193 | /* slot 5: 3.5" disks */ |
| 1194 | | sony_write_data(data); |
| 1194 | sony_write_data(device,data); |
| 1195 | 1195 | } |
| 1196 | 1196 | } |
| 1197 | 1197 | else |
| 1198 | 1198 | { |
| 1199 | | if (apple2_fdc_has_525(Machine)) |
| 1199 | if (apple2_fdc_has_525(device->machine)) |
| 1200 | 1200 | { |
| 1201 | 1201 | /* slot 6: 5.25" disks */ |
| 1202 | | apple525_write_data(data); |
| 1202 | apple525_write_data(device,data); |
| 1203 | 1203 | } |
| 1204 | 1204 | } |
| 1205 | 1205 | } |
| 1206 | 1206 | |
| 1207 | 1207 | |
| 1208 | 1208 | |
| 1209 | | static int apple2_fdc_read_status(void) |
| 1209 | static int apple2_fdc_read_status(const device_config *device) |
| 1210 | 1210 | { |
| 1211 | 1211 | int result = 0; |
| 1212 | 1212 | |
| 1213 | 1213 | if (apple2_fdc_diskreg & 0x40) |
| 1214 | 1214 | { |
| 1215 | | if (apple2_fdc_has_35(Machine)) |
| 1215 | if (apple2_fdc_has_35(device->machine)) |
| 1216 | 1216 | { |
| 1217 | 1217 | /* slot 5: 3.5" disks */ |
| 1218 | | result = sony_read_status(); |
| 1218 | result = sony_read_status(device); |
| 1219 | 1219 | } |
| 1220 | 1220 | } |
| 1221 | 1221 | else |
| 1222 | 1222 | { |
| 1223 | | if (apple2_fdc_has_525(Machine)) |
| 1223 | if (apple2_fdc_has_525(device->machine)) |
| 1224 | 1224 | { |
| 1225 | 1225 | /* slot 6: 5.25" disks */ |
| 1226 | | result = apple525_read_status(); |
| 1226 | result = apple525_read_status(device); |
| 1227 | 1227 | } |
| 1228 | 1228 | } |
| 1229 | 1229 | return result; |
| r3910 | r3911 | |
| 1235 | 1235 | { |
| 1236 | 1236 | apple2_fdc_diskreg = data & 0xC0; |
| 1237 | 1237 | if (apple2_fdc_has_35(machine)) |
| 1238 | | sony_set_sel_line(apple2_fdc_diskreg & 0x80); |
| 1238 | sony_set_sel_line( (device_config*)device_list_find_by_tag( machine->config->devicelist,APPLEFDC,"fdc"),apple2_fdc_diskreg & 0x80); |
| 1239 | 1239 | } |
| 1240 | 1240 | |
| 1241 | 1241 | |
src/mess/devices/sonydriv.c
| r3910 | r3911 | |
| 37 | 37 | *********************************************************************/ |
| 38 | 38 | |
| 39 | 39 | #include "driver.h" |
| 40 | | #include "deprecat.h" |
| 40 | #include "machine/applefdc.h" |
| 41 | 41 | #include "sonydriv.h" |
| 42 | 42 | #include "formats/ap_dsk35.h" |
| 43 | 43 | #include "flopdrv.h" |
| r3910 | r3911 | |
| 114 | 114 | #endif |
| 115 | 115 | |
| 116 | 116 | |
| 117 | | static void load_track_data(int floppy_select) |
| 117 | static void load_track_data(const device_config *device,int floppy_select) |
| 118 | 118 | { |
| 119 | 119 | int track_size; |
| 120 | 120 | const device_config *cur_image; |
| r3910 | r3911 | |
| 122 | 122 | floppy *f; |
| 123 | 123 | |
| 124 | 124 | f = &sony_floppy[floppy_select]; |
| 125 | | cur_image = image_from_devtag_and_index(Machine, "sonydriv", floppy_select); |
| 125 | cur_image = image_from_devtag_and_index(device->machine, "sonydriv", floppy_select); |
| 126 | 126 | |
| 127 | 127 | track_size = floppy_get_track_size(flopimg_get_image(cur_image), f->head, floppy_drive_get_current_track(cur_image)); |
| 128 | 128 | new_data = image_realloc(cur_image, f->loadedtrack_data, track_size); |
| r3910 | r3911 | |
| 139 | 139 | |
| 140 | 140 | |
| 141 | 141 | |
| 142 | | static void save_track_data(int floppy_select) |
| 142 | static void save_track_data(const device_config *device, int floppy_select) |
| 143 | 143 | { |
| 144 | 144 | const device_config *cur_image; |
| 145 | 145 | floppy *f; |
| 146 | 146 | int len; |
| 147 | 147 | |
| 148 | 148 | f = &sony_floppy[floppy_select]; |
| 149 | | cur_image = image_from_devtag_and_index(Machine, "sonydriv", floppy_select); |
| 149 | cur_image = image_from_devtag_and_index(device->machine, "sonydriv", floppy_select); |
| 150 | 150 | |
| 151 | 151 | if (f->loadedtrack_dirty) |
| 152 | 152 | { |
| r3910 | r3911 | |
| 158 | 158 | |
| 159 | 159 | |
| 160 | 160 | |
| 161 | | UINT8 sony_read_data(void) |
| 161 | UINT8 sony_read_data(const device_config *device) |
| 162 | 162 | { |
| 163 | 163 | UINT8 result = 0; |
| 164 | 164 | const device_config *cur_image; |
| r3910 | r3911 | |
| 168 | 168 | return 0xFF; /* right ??? */ |
| 169 | 169 | |
| 170 | 170 | f = &sony_floppy[sony_floppy_select]; |
| 171 | | cur_image = image_from_devtag_and_index(Machine, "sonydriv", sony_floppy_select); |
| 171 | cur_image = image_from_devtag_and_index(device->machine, "sonydriv", sony_floppy_select); |
| 172 | 172 | if (!image_exists(cur_image)) |
| 173 | 173 | return 0xFF; |
| 174 | 174 | |
| 175 | 175 | if (!f->loadedtrack_valid) |
| 176 | | load_track_data(sony_floppy_select); |
| 176 | load_track_data(device, sony_floppy_select); |
| 177 | 177 | |
| 178 | 178 | result = sony_fetchtrack(f->loadedtrack_data, f->loadedtrack_size, &f->loadedtrack_pos); |
| 179 | 179 | return result; |
| r3910 | r3911 | |
| 181 | 181 | |
| 182 | 182 | |
| 183 | 183 | |
| 184 | | void sony_write_data(UINT8 data) |
| 184 | void sony_write_data(const device_config *device,UINT8 data) |
| 185 | 185 | { |
| 186 | 186 | const device_config *cur_image; |
| 187 | 187 | floppy *f; |
| 188 | 188 | |
| 189 | 189 | f = &sony_floppy[sony_floppy_select]; |
| 190 | | cur_image = image_from_devtag_and_index(Machine, "sonydriv", sony_floppy_select); |
| 190 | cur_image = image_from_devtag_and_index(device->machine, "sonydriv", sony_floppy_select); |
| 191 | 191 | if (!image_exists(cur_image)) |
| 192 | 192 | return; |
| 193 | 193 | |
| 194 | 194 | if (!f->loadedtrack_valid) |
| 195 | | load_track_data(sony_floppy_select); |
| 195 | load_track_data(device,sony_floppy_select); |
| 196 | 196 | sony_filltrack(f->loadedtrack_data, f->loadedtrack_size, &f->loadedtrack_pos, data); |
| 197 | 197 | f->loadedtrack_dirty = 1; |
| 198 | 198 | } |
| r3910 | r3911 | |
| 252 | 252 | return result; |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | | int sony_read_status(void) |
| 255 | int sony_read_status(const device_config *device) |
| 256 | 256 | { |
| 257 | 257 | int result = 1; |
| 258 | 258 | int action; |
| r3910 | r3911 | |
| 264 | 264 | if (LOG_SONY_EXTRA) |
| 265 | 265 | { |
| 266 | 266 | logerror("sony_status(): action=%d pc=0x%08x%s\n", |
| 267 | | action, (int) cpu_get_pc(Machine->cpu[0]), sony_floppy_enable ? "" : " (no drive enabled)"); |
| 267 | action, (int) cpu_get_pc(device->machine->cpu[0]), sony_floppy_enable ? "" : " (no drive enabled)"); |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | if ((! sony_enable2()) && sony_floppy_enable) |
| 271 | 271 | { |
| 272 | 272 | f = &sony_floppy[sony_floppy_select]; |
| 273 | | cur_image = image_from_devtag_and_index(Machine, "sonydriv", sony_floppy_select); |
| 273 | cur_image = image_from_devtag_and_index(device->machine, "sonydriv", sony_floppy_select); |
| 274 | 274 | if (!image_exists(cur_image)) |
| 275 | 275 | cur_image = NULL; |
| 276 | 276 | |
| r3910 | r3911 | |
| 281 | 281 | case 0x01: /* Lower head activate */ |
| 282 | 282 | if (f->head != 0) |
| 283 | 283 | { |
| 284 | | save_track_data(sony_floppy_select); |
| 284 | save_track_data(device,sony_floppy_select); |
| 285 | 285 | f->head = 0; |
| 286 | 286 | f->loadedtrack_valid = 0; |
| 287 | 287 | } |
| r3910 | r3911 | |
| 293 | 293 | case 0x03: /* Upper head activate */ |
| 294 | 294 | if (f->head != 1) |
| 295 | 295 | { |
| 296 | | save_track_data(sony_floppy_select); |
| 296 | save_track_data(device,sony_floppy_select); |
| 297 | 297 | f->head = 1; |
| 298 | 298 | f->loadedtrack_valid = 0; |
| 299 | 299 | } |
| r3910 | r3911 | |
| 319 | 319 | result = floppy_get_heads_per_disk(flopimg_get_image(cur_image)) - 1; |
| 320 | 320 | break; |
| 321 | 321 | case 0x0a: /* At track 0: 0=track zero 1=not track zero */ |
| 322 | | logerror("sony_status(): reading Track 0 pc=0x%08x\n", (int) cpu_get_pc(Machine->cpu[0])); |
| 322 | logerror("sony_status(): reading Track 0 pc=0x%08x\n", (int) cpu_get_pc(device->machine->cpu[0])); |
| 323 | 323 | if (cur_image) |
| 324 | 324 | result = floppy_drive_get_flag_state(cur_image, FLOPPY_DRIVE_HEAD_AT_TRACK_0) ? 0 : 1; |
| 325 | 325 | else |
| r3910 | r3911 | |
| 347 | 347 | break; |
| 348 | 348 | case 0x0e: /* Tachometer */ |
| 349 | 349 | /* (time in seconds) / (60 sec/minute) * (rounds/minute) * (60 pulses) * (2 pulse phases) */ |
| 350 | | result = ((int) (attotime_to_double(timer_get_time(Machine)) / 60.0 * sony_rpm(f, cur_image) * 60.0 * 2.0)) & 1; |
| 350 | result = ((int) (attotime_to_double(timer_get_time(device->machine)) / 60.0 * sony_rpm(f, cur_image) * 60.0 * 2.0)) & 1; |
| 351 | 351 | break; |
| 352 | 352 | case 0x0f: /* Drive installed: 0=drive connected, 1=drive not connected */ |
| 353 | 353 | result = 0; |
| r3910 | r3911 | |
| 364 | 364 | |
| 365 | 365 | |
| 366 | 366 | |
| 367 | | static void sony_doaction(void) |
| 367 | static void sony_doaction(const device_config *device) |
| 368 | 368 | { |
| 369 | 369 | int action; |
| 370 | 370 | floppy *f; |
| r3910 | r3911 | |
| 375 | 375 | if (LOG_SONY) |
| 376 | 376 | { |
| 377 | 377 | logerror("sony_doaction(): action=%d pc=0x%08x%s\n", |
| 378 | | action, (int) cpu_get_pc(Machine->cpu[0]), (sony_floppy_enable) ? "" : " (MOTOR OFF)"); |
| 378 | action, (int) cpu_get_pc(device->machine->cpu[0]), (sony_floppy_enable) ? "" : " (MOTOR OFF)"); |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | if (sony_floppy_enable) |
| 382 | 382 | { |
| 383 | 383 | f = &sony_floppy[sony_floppy_select]; |
| 384 | | cur_image = image_from_devtag_and_index(Machine, "sonydriv", sony_floppy_select); |
| 384 | cur_image = image_from_devtag_and_index(device->machine, "sonydriv", sony_floppy_select); |
| 385 | 385 | if (!image_exists(cur_image)) |
| 386 | 386 | cur_image = NULL; |
| 387 | 387 | |
| r3910 | r3911 | |
| 399 | 399 | case 0x04: /* Step disk */ |
| 400 | 400 | if (cur_image) |
| 401 | 401 | { |
| 402 | | save_track_data(sony_floppy_select); |
| 402 | save_track_data(device,sony_floppy_select); |
| 403 | 403 | if (f->step) |
| 404 | 404 | floppy_drive_seek(cur_image, -1); |
| 405 | 405 | else |
| r3910 | r3911 | |
| 429 | 429 | |
| 430 | 430 | |
| 431 | 431 | |
| 432 | | void sony_set_lines(UINT8 lines) |
| 432 | void sony_set_lines(const device_config *device,UINT8 lines) |
| 433 | 433 | { |
| 434 | 434 | int old_sony_lines = sony_lines; |
| 435 | 435 | |
| r3910 | r3911 | |
| 439 | 439 | if ((sony_lines & ~old_sony_lines) & SONY_LSTRB) |
| 440 | 440 | { |
| 441 | 441 | /* if so, write drive reg */ |
| 442 | | sony_doaction(); |
| 442 | sony_doaction(device); |
| 443 | 443 | } |
| 444 | 444 | |
| 445 | 445 | if (LOG_SONY_EXTRA) |
| r3910 | r3911 | |
| 448 | 448 | |
| 449 | 449 | |
| 450 | 450 | |
| 451 | | void sony_set_enable_lines(int enable_mask) |
| 451 | void sony_set_enable_lines(const device_config *device,int enable_mask) |
| 452 | 452 | { |
| 453 | 453 | switch (enable_mask) |
| 454 | 454 | { |
| r3910 | r3911 | |
| 472 | 472 | |
| 473 | 473 | |
| 474 | 474 | |
| 475 | | void sony_set_sel_line(int sel) |
| 475 | void sony_set_sel_line(const device_config *device,int sel) |
| 476 | 476 | { |
| 477 | 477 | sony_sel_line = sel ? 1 : 0; |
| 478 | 478 | |
| r3910 | r3911 | |
| 495 | 495 | device_image_unload_func parent_unload; |
| 496 | 496 | |
| 497 | 497 | id = image_index_in_device(image); |
| 498 | | save_track_data(id); |
| 498 | save_track_data((device_config*)device_list_find_by_tag( image->machine->config->devicelist,APPLEFDC,"fdc"),id); |
| 499 | 499 | memset(&sony_floppy[id], 0, sizeof(sony_floppy[id])); |
| 500 | 500 | |
| 501 | 501 | parent_unload = (device_image_unload_func) mess_device_get_info_fct(&parent_devclass, MESS_DEVINFO_PTR_UNLOAD); |
src/mess/devices/appldriv.c
| r3910 | r3911 | |
| 9 | 9 | #include "appldriv.h" |
| 10 | 10 | #include "flopdrv.h" |
| 11 | 11 | #include "mflopimg.h" |
| 12 | | #include "deprecat.h" |
| 13 | 12 | #include "formats/ap2_dsk.h" |
| 14 | 13 | |
| 15 | 14 | |
| r3910 | r3911 | |
| 31 | 30 | |
| 32 | 31 | |
| 33 | 32 | |
| 34 | | void apple525_set_enable_lines(int enable_mask) |
| 33 | void apple525_set_enable_lines(const device_config *device,int enable_mask) |
| 35 | 34 | { |
| 36 | 35 | apple525_enable_mask = enable_mask; |
| 37 | 36 | } |
| r3910 | r3911 | |
| 104 | 103 | |
| 105 | 104 | |
| 106 | 105 | |
| 107 | | static void apple525_disk_set_lines(const device_config *image, UINT8 new_state) |
| 106 | static void apple525_disk_set_lines(const device_config *device,const device_config *image, UINT8 new_state) |
| 108 | 107 | { |
| 109 | 108 | struct apple525_disk *cur_disk; |
| 110 | 109 | UINT8 old_state; |
| r3910 | r3911 | |
| 145 | 144 | |
| 146 | 145 | |
| 147 | 146 | |
| 148 | | void apple525_set_lines(UINT8 lines) |
| 147 | void apple525_set_lines(const device_config *device,UINT8 lines) |
| 149 | 148 | { |
| 150 | 149 | int i, count; |
| 151 | 150 | const device_config *image; |
| 152 | 151 | |
| 153 | | count = device_count_tag_from_machine(Machine, APPLE525TAG); |
| 152 | count = device_count_tag_from_machine(device->machine, APPLE525TAG); |
| 154 | 153 | |
| 155 | 154 | for (i = 0; i < count; i++) |
| 156 | 155 | { |
| 157 | 156 | if (apple525_enable_mask & (1 << i)) |
| 158 | 157 | { |
| 159 | | image = image_from_devtag_and_index(Machine, APPLE525TAG, i); |
| 158 | image = image_from_devtag_and_index(device->machine, APPLE525TAG, i); |
| 160 | 159 | if (image) |
| 161 | | apple525_disk_set_lines(image, lines); |
| 160 | apple525_disk_set_lines(device,image, lines); |
| 162 | 161 | } |
| 163 | 162 | } |
| 164 | 163 | } |
| r3910 | r3911 | |
| 234 | 233 | |
| 235 | 234 | |
| 236 | 235 | |
| 237 | | UINT8 apple525_read_data(void) |
| 236 | UINT8 apple525_read_data(const device_config *device) |
| 238 | 237 | { |
| 239 | 238 | const device_config *image; |
| 240 | | image = apple525_selected_image(Machine); |
| 239 | image = apple525_selected_image(device->machine); |
| 241 | 240 | return image ? apple525_process_byte(image, -1) : 0xFF; |
| 242 | 241 | } |
| 243 | 242 | |
| 244 | 243 | |
| 245 | 244 | |
| 246 | | void apple525_write_data(UINT8 data) |
| 245 | void apple525_write_data(const device_config *device,UINT8 data) |
| 247 | 246 | { |
| 248 | 247 | const device_config *image; |
| 249 | | image = apple525_selected_image(Machine); |
| 248 | image = apple525_selected_image(device->machine); |
| 250 | 249 | if (image) |
| 251 | 250 | apple525_process_byte(image, data); |
| 252 | 251 | } |
| 253 | 252 | |
| 254 | 253 | |
| 255 | 254 | |
| 256 | | int apple525_read_status(void) |
| 255 | int apple525_read_status(const device_config *device) |
| 257 | 256 | { |
| 258 | 257 | int i, count, result = 0; |
| 259 | 258 | const device_config *image; |
| 260 | 259 | |
| 261 | | count = device_count_tag_from_machine(Machine, APPLE525TAG); |
| 260 | count = device_count_tag_from_machine(device->machine, APPLE525TAG); |
| 262 | 261 | |
| 263 | 262 | for (i = 0; i < count; i++) |
| 264 | 263 | { |
| 265 | 264 | if (apple525_enable_mask & (1 << i)) |
| 266 | 265 | { |
| 267 | | image = image_from_devtag_and_index(Machine, APPLE525TAG, i); |
| 266 | image = image_from_devtag_and_index(device->machine, APPLE525TAG, i); |
| 268 | 267 | if (image && !image_is_writable(image)) |
| 269 | 268 | result = 1; |
| 270 | 269 | } |
src/mess/drivers/lisa.c
| r3910 | r3911 | |
| 48 | 48 | DEVICE CONFIG |
| 49 | 49 | ***************************************************************************/ |
| 50 | 50 | |
| 51 | | static void lisa2_set_iwm_enable_lines(int enable_mask) |
| 51 | static void lisa2_set_iwm_enable_lines(const device_config *device,int enable_mask) |
| 52 | 52 | { |
| 53 | 53 | /* E1 & E2 is connected to the Sony SEL line (?) */ |
| 54 | 54 | /*logerror("new sel line state %d\n", (enable_mask) ? 0 : 1);*/ |
| 55 | | sony_set_sel_line((enable_mask) ? 0 : 1); |
| 55 | sony_set_sel_line(device,(enable_mask) ? 0 : 1); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | | static void lisa210_set_iwm_enable_lines(int enable_mask) |
| 58 | static void lisa210_set_iwm_enable_lines(const device_config *device,int enable_mask) |
| 59 | 59 | { |
| 60 | 60 | /* E2 is connected to the Sony enable line (?) */ |
| 61 | | sony_set_enable_lines(enable_mask >> 1); |
| 61 | sony_set_enable_lines(device,enable_mask >> 1); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | static const applefdc_interface lisa2_fdc_interface = |
| r3910 | r3911 | |
| 122 | 122 | MDRV_NVRAM_HANDLER(lisa) |
| 123 | 123 | |
| 124 | 124 | /* devices */ |
| 125 | | MDRV_DEVICE_ADD("fdc", IWM) |
| 126 | | MDRV_DEVICE_CONFIG(lisa2_fdc_interface) |
| 125 | MDRV_IWM_ADD("fdc", lisa2_fdc_interface) |
| 127 | 126 | |
| 128 | 127 | /* via */ |
| 129 | 128 | MDRV_VIA6522_ADD("via6522_0", 500000, lisa_via6522_0_intf) |
| r3910 | r3911 | |
| 137 | 136 | MDRV_CPU_PROGRAM_MAP(lisa210_fdc_map, 0) |
| 138 | 137 | |
| 139 | 138 | /* Lisa 2/10 and MacXL had a slightly different FDC interface */ |
| 140 | | MDRV_DEVICE_MODIFY("fdc", IWM) |
| 141 | | MDRV_DEVICE_CONFIG(lisa210_fdc_interface) |
| 139 | MDRV_IWM_MODIFY("fdc", lisa210_fdc_interface) |
| 142 | 140 | |
| 143 | 141 | /* via */ |
| 144 | 142 | MDRV_VIA6522_REMOVE("via6522_0") |