Previous 15994 Revisions Next

r14750 Monday 12th March, 2012 at 07:19:57 UTC by Miodrag Milanović
Fix apollo crash (no whatsnew)
[src/mess/machine]omti8621.c

src/mess/machine/omti8621.c
r14749r14750
11231123   }
11241124}
11251125
1126/*-------------------------------------------------
1127    device start callback
1128-------------------------------------------------*/
11291126
1130static 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
1163static 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
1176DEVICE_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
1198DEFINE_LEGACY_DEVICE(OMTI8621, omti8621);
1199
12001127//##########################################################################
12011128class omti_disk_image_device :   public device_t,
12021129                        public device_image_interface
r14749r14750
13611288   MCFG_DEVICE_ADD(OMTI_DISK1_TAG, OMTI_DISK, 0)
13621289MACHINE_CONFIG_END
13631290
1291/*-------------------------------------------------
1292    device start callback
1293-------------------------------------------------*/
1294
1295static 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
1328static 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
1341DEVICE_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
1363DEFINE_LEGACY_DEVICE(OMTI8621, omti8621);

Previous 15994 Revisions Next


© 1998-2018 The MESS Team