src/mess/machine/omti8621.c
| r14749 | r14750 | |
| 1123 | 1123 | } |
| 1124 | 1124 | } |
| 1125 | 1125 | |
| 1126 | | /*------------------------------------------------- |
| 1127 | | device start callback |
| 1128 | | -------------------------------------------------*/ |
| 1129 | 1126 | |
| 1130 | | static DEVICE_START( omti8621 ) { |
| 1131 | | omti8621_state *state = get_safe_token(device); |
| 1132 | | |
| 1133 | | const omti8621_config *config = |
| 1134 | | (const omti8621_config *) device->static_config(); |
| 1135 | | |
| 1136 | | /* validate basic stuff */ |
| 1137 | | assert(device != NULL); |
| 1138 | | assert(device->type() == OMTI8621); |
| 1139 | | |
| 1140 | | /* store a pointer back to the device */ |
| 1141 | | state->device = device; |
| 1142 | | |
| 1143 | | // note: we must have state->device before we can log |
| 1144 | | LOG2(("device_start_omti8621")); |
| 1145 | | |
| 1146 | | state->irq_handler = config->set_irq; |
| 1147 | | |
| 1148 | | state->sector_buffer = auto_alloc_array(device->machine(), UINT8, |
| 1149 | | OMTI_DISK_SECTOR_SIZE*OMTI_MAX_BLOCK_COUNT); |
| 1150 | | assert(state->sector_buffer != NULL); |
| 1151 | | |
| 1152 | | device_t *device0 = device->machine().device(OMTI_DISK0_TAG); |
| 1153 | | state->disk[0] = (disk_data *) downcast<legacy_device_base *>(device0)->token(); |
| 1154 | | |
| 1155 | | device_t *device1 = device->machine().device(OMTI_DISK1_TAG); |
| 1156 | | state->disk[1] = (disk_data *) downcast<legacy_device_base *>(device1)->token(); |
| 1157 | | } |
| 1158 | | |
| 1159 | | /*------------------------------------------------- |
| 1160 | | device reset callback |
| 1161 | | -------------------------------------------------*/ |
| 1162 | | |
| 1163 | | static DEVICE_RESET( omti8621 ) |
| 1164 | | { |
| 1165 | | omti8621_state *state = get_safe_token(device); |
| 1166 | | LOG2(("device_reset_omti8621")); |
| 1167 | | |
| 1168 | | omti_set_jumper(state, state->disk[0]->type); |
| 1169 | | omti_reset(state); |
| 1170 | | } |
| 1171 | | |
| 1172 | | /*------------------------------------------------- |
| 1173 | | device get info callback |
| 1174 | | -------------------------------------------------*/ |
| 1175 | | |
| 1176 | | DEVICE_GET_INFO( omti8621 ) |
| 1177 | | { |
| 1178 | | switch (state) |
| 1179 | | { |
| 1180 | | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 1181 | | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(omti8621_state); break; |
| 1182 | | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = sizeof(omti8621_config); break; |
| 1183 | | |
| 1184 | | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 1185 | | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(omti8621); break; |
| 1186 | | case DEVINFO_FCT_STOP: /* Nothing */ break; |
| 1187 | | case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME(omti8621); break; |
| 1188 | | |
| 1189 | | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 1190 | | case DEVINFO_STR_NAME: strcpy(info->s, "OMTI 8621"); break; |
| 1191 | | case DEVINFO_STR_FAMILY: strcpy(info->s, "Winchester Disk Controller");break; |
| 1192 | | case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break; |
| 1193 | | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 1194 | | case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break; |
| 1195 | | } |
| 1196 | | } |
| 1197 | | |
| 1198 | | DEFINE_LEGACY_DEVICE(OMTI8621, omti8621); |
| 1199 | | |
| 1200 | 1127 | //########################################################################## |
| 1201 | 1128 | class omti_disk_image_device : public device_t, |
| 1202 | 1129 | public device_image_interface |
| r14749 | r14750 | |
| 1361 | 1288 | MCFG_DEVICE_ADD(OMTI_DISK1_TAG, OMTI_DISK, 0) |
| 1362 | 1289 | MACHINE_CONFIG_END |
| 1363 | 1290 | |
| 1291 | /*------------------------------------------------- |
| 1292 | device start callback |
| 1293 | -------------------------------------------------*/ |
| 1294 | |
| 1295 | static DEVICE_START( omti8621 ) { |
| 1296 | omti8621_state *state = get_safe_token(device); |
| 1297 | |
| 1298 | const omti8621_config *config = |
| 1299 | (const omti8621_config *) device->static_config(); |
| 1300 | |
| 1301 | /* validate basic stuff */ |
| 1302 | assert(device != NULL); |
| 1303 | assert(device->type() == OMTI8621); |
| 1304 | |
| 1305 | /* store a pointer back to the device */ |
| 1306 | state->device = device; |
| 1307 | |
| 1308 | // note: we must have state->device before we can log |
| 1309 | LOG2(("device_start_omti8621")); |
| 1310 | |
| 1311 | state->irq_handler = config->set_irq; |
| 1312 | |
| 1313 | state->sector_buffer = auto_alloc_array(device->machine(), UINT8, |
| 1314 | OMTI_DISK_SECTOR_SIZE*OMTI_MAX_BLOCK_COUNT); |
| 1315 | assert(state->sector_buffer != NULL); |
| 1316 | |
| 1317 | device_t *device0 = device->machine().device(OMTI_DISK0_TAG); |
| 1318 | state->disk[0] = (disk_data *) downcast<omti_disk_image_device *>(device0)->token(); |
| 1319 | |
| 1320 | device_t *device1 = device->machine().device(OMTI_DISK1_TAG); |
| 1321 | state->disk[1] = (disk_data *) downcast<omti_disk_image_device *>(device1)->token(); |
| 1322 | } |
| 1323 | |
| 1324 | /*------------------------------------------------- |
| 1325 | device reset callback |
| 1326 | -------------------------------------------------*/ |
| 1327 | |
| 1328 | static DEVICE_RESET( omti8621 ) |
| 1329 | { |
| 1330 | omti8621_state *state = get_safe_token(device); |
| 1331 | LOG2(("device_reset_omti8621")); |
| 1332 | |
| 1333 | omti_set_jumper(state, state->disk[0]->type); |
| 1334 | omti_reset(state); |
| 1335 | } |
| 1336 | |
| 1337 | /*------------------------------------------------- |
| 1338 | device get info callback |
| 1339 | -------------------------------------------------*/ |
| 1340 | |
| 1341 | DEVICE_GET_INFO( omti8621 ) |
| 1342 | { |
| 1343 | switch (state) |
| 1344 | { |
| 1345 | /* --- the following bits of info are returned as 64-bit signed integers --- */ |
| 1346 | case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(omti8621_state); break; |
| 1347 | case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = sizeof(omti8621_config); break; |
| 1348 | |
| 1349 | /* --- the following bits of info are returned as pointers to data or functions --- */ |
| 1350 | case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(omti8621); break; |
| 1351 | case DEVINFO_FCT_STOP: /* Nothing */ break; |
| 1352 | case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME(omti8621); break; |
| 1353 | |
| 1354 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 1355 | case DEVINFO_STR_NAME: strcpy(info->s, "OMTI 8621"); break; |
| 1356 | case DEVINFO_STR_FAMILY: strcpy(info->s, "Winchester Disk Controller");break; |
| 1357 | case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break; |
| 1358 | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 1359 | case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break; |
| 1360 | } |
| 1361 | } |
| 1362 | |
| 1363 | DEFINE_LEGACY_DEVICE(OMTI8621, omti8621); |