Previous 15994 Revisions Next

r3962 Tuesday 23rd December, 2008 at 12:39:37 UTC by Nathan Woods
Some fixes
[src/mess]device.c image.c
[src/mess/drivers]sord.c
[src/mess/machine]smc92x4.c

src/mess/image.c
r3961r3962
148148
149149
150150
151/*-------------------------------------------------
152    device_get_info_str_offline - return an integer
153   state value from an allocated device; can be
154   called offline
155-------------------------------------------------*/
156
157INLINE const char *device_get_info_string_offline(const device_config *device, UINT32 state)
158{
159   deviceinfo info;
160
161   assert(device != NULL);
162   assert(device->type != NULL);
163   assert(state >= DEVINFO_STR_FIRST && state <= DEVINFO_STR_LAST);
164
165   /* retrieve the value */
166   info.s = 0;
167   (*device->type)(device, state, &info);
168   return info.s;
169}
170
171
172
173151/***************************************************************************
174152    CORE IMPLEMENTATION
175153***************************************************************************/
r3961r3962
402380   if (name == NULL)
403381   {
404382      /* next try DEVINFO_STR_NAME */
405      name = device_get_info_string_offline(device, DEVINFO_STR_NAME);
383      name = device_get_info_string(device, DEVINFO_STR_NAME);
406384   }
407385
408386   /* make sure that the name is put into the buffer */
r3961r3962
428406   buffer_len--;
429407
430408   /* copy the string */
431   file_extensions = device_get_info_string_offline(device, DEVINFO_STR_IMAGE_FILE_EXTENSIONS);
409   file_extensions = device_get_info_string(device, DEVINFO_STR_IMAGE_FILE_EXTENSIONS);
432410   snprintf(buffer, buffer_len, "%s", (file_extensions != NULL) ? file_extensions : "");
433411
434412   /* convert the comma delimited list to a NUL delimited list */
r3961r3962
452430   int count, index;
453431
454432   /* retrieve info about the device instance */
455   result = device_get_info_string_offline(device, state);
433   result = device_get_info_string(device, state);
456434   if (result != NULL)
457435   {
458436      /* we got info directly */
src/mess/device.c
r3961r3962
255255
256256
257257/*-------------------------------------------------
258    safe_strcpy - hack
259-------------------------------------------------*/
260
261static void safe_strcpy(char *dst, const char *src)
262{
263   strcpy(dst, src ? src : "");
264}
265
266
267
268/*-------------------------------------------------
258269    DEVICE_GET_INFO(mess_device) - device get info
259270    callback
260271-------------------------------------------------*/
r3961r3962
299310      case DEVINFO_STR_VERSION:            strcpy(info->s, "1.0");                        break;
300311      case DEVINFO_STR_SOURCE_FILE:         strcpy(info->s, __FILE__);                        break;
301312      case DEVINFO_STR_CREDITS:            strcpy(info->s, "Copyright the MESS Team");         break;
302      case DEVINFO_STR_IMAGE_FILE_EXTENSIONS:   strcpy(info->s, mess_device_get_info_string(&mess_device->io_device.devclass, MESS_DEVINFO_STR_FILE_EXTENSIONS)); break;
303      case DEVINFO_STR_IMAGE_INSTANCE_NAME:   strcpy(info->s, mess_device_get_info_string(&mess_device->io_device.devclass, MESS_DEVINFO_STR_NAME + mess_device->io_device.index_in_device)); break;
304      case DEVINFO_STR_IMAGE_BRIEF_INSTANCE_NAME:   strcpy(info->s, mess_device_get_info_string(&mess_device->io_device.devclass, MESS_DEVINFO_STR_SHORT_NAME + mess_device->io_device.index_in_device)); break;
313      case DEVINFO_STR_IMAGE_FILE_EXTENSIONS:   safe_strcpy(info->s, mess_device_get_info_string(&mess_device->io_device.devclass, MESS_DEVINFO_STR_FILE_EXTENSIONS)); break;
314      case DEVINFO_STR_IMAGE_INSTANCE_NAME:   safe_strcpy(info->s, mess_device_get_info_string(&mess_device->io_device.devclass, MESS_DEVINFO_STR_NAME + mess_device->io_device.index_in_device)); break;
315      case DEVINFO_STR_IMAGE_BRIEF_INSTANCE_NAME:   safe_strcpy(info->s, mess_device_get_info_string(&mess_device->io_device.devclass, MESS_DEVINFO_STR_SHORT_NAME + mess_device->io_device.index_in_device)); break;
305316
306317      default:
307318         if ((state >= DEVINFO_PTR_IMAGE_CREATE_OPTSPEC) && (state < DEVINFO_PTR_IMAGE_CREATE_OPTSPEC + DEVINFO_CREATE_OPTMAX))
308319            info->p = mess_device_get_info_ptr(&mess_device->io_device.devclass, state - DEVINFO_PTR_IMAGE_CREATE_OPTSPEC + MESS_DEVINFO_PTR_CREATE_OPTSPEC);
309320         else if ((state >= DEVINFO_STR_IMAGE_CREATE_OPTNAME) && (state < DEVINFO_STR_IMAGE_CREATE_OPTNAME + DEVINFO_CREATE_OPTMAX))
310            info->s = mess_device_get_info_ptr(&mess_device->io_device.devclass, state - DEVINFO_STR_IMAGE_CREATE_OPTNAME + MESS_DEVINFO_STR_CREATE_OPTNAME);
321            safe_strcpy(info->s, mess_device_get_info_ptr(&mess_device->io_device.devclass, state - DEVINFO_STR_IMAGE_CREATE_OPTNAME + MESS_DEVINFO_STR_CREATE_OPTNAME));
311322         else if ((state >= DEVINFO_STR_IMAGE_CREATE_OPTDESC) && (state < DEVINFO_STR_IMAGE_CREATE_OPTDESC + DEVINFO_CREATE_OPTMAX))
312            info->s = mess_device_get_info_ptr(&mess_device->io_device.devclass, state - DEVINFO_STR_IMAGE_CREATE_OPTDESC + MESS_DEVINFO_STR_CREATE_OPTDESC);
323            safe_strcpy(info->s, mess_device_get_info_ptr(&mess_device->io_device.devclass, state - DEVINFO_STR_IMAGE_CREATE_OPTDESC + MESS_DEVINFO_STR_CREATE_OPTDESC));
313324         else if ((state >= DEVINFO_STR_IMAGE_CREATE_OPTEXTS) && (state < DEVINFO_STR_IMAGE_CREATE_OPTEXTS + DEVINFO_CREATE_OPTMAX))
314            info->s = mess_device_get_info_ptr(&mess_device->io_device.devclass, state - DEVINFO_STR_IMAGE_CREATE_OPTEXTS + MESS_DEVINFO_STR_CREATE_OPTEXTS);
325            safe_strcpy(info->s, mess_device_get_info_ptr(&mess_device->io_device.devclass, state - DEVINFO_STR_IMAGE_CREATE_OPTEXTS + MESS_DEVINFO_STR_CREATE_OPTEXTS));
315326         break;
316327   }
317328}
src/mess/machine/smc92x4.c
r3961r3962
131131*/
132132static int floppy_read_id(int which, int disk_unit, int head)
133133{
134   const device_config *disk_img = image_from_devtype_and_index(IO_FLOPPY, disk_unit);
134   const device_config *disk_img = image_from_devtype_and_index(machine, IO_FLOPPY, disk_unit);
135135   UINT8 revolution_count;
136136   chrn_id id;
137137
r3961r3962
163163*/
164164static int floppy_find_sector(int which, int disk_unit, int cylinder, int head, int check_secnum, int sector, int *sector_data_id, int *sector_len)
165165{
166   const device_config *disk_img = image_from_devtype_and_index(IO_FLOPPY, disk_unit);
166   const device_config *disk_img = image_from_devtype_and_index(machine, IO_FLOPPY, disk_unit);
167167   UINT8 revolution_count;
168168   chrn_id id;
169169
r3961r3962
207207   int sector_data_id, sector_len;
208208   UINT8 buf[MAX_SECTOR_LEN];
209209   int i;
210   const device_config *disk_img = image_from_devtype_and_index(IO_FLOPPY, disk_unit);
210   const device_config *disk_img = image_from_devtype_and_index(machine, IO_FLOPPY, disk_unit);
211211
212212   if (! floppy_find_sector(which, disk_unit, cylinder, head, check_secnum, sector, & sector_data_id, & sector_len))
213213   {
r3961r3962
229229   int sector_data_id, sector_len;
230230   UINT8 buf[MAX_SECTOR_LEN];
231231   int i;
232   const device_config *disk_img = image_from_devtype_and_index(IO_FLOPPY, disk_unit);
232   const device_config *disk_img = image_from_devtype_and_index(machine, IO_FLOPPY, disk_unit);
233233
234234   if (! floppy_find_sector(which, disk_unit, cylinder, head, check_secnum, sector, & sector_data_id, & sector_len))
235235   {
r3961r3962
248248
249249static void floppy_step(int which, int disk_unit, int direction)
250250{
251   const device_config *disk_img = image_from_devtype_and_index(IO_FLOPPY, disk_unit);
251   const device_config *disk_img = image_from_devtype_and_index(machine, IO_FLOPPY, disk_unit);
252252   floppy_drive_seek(disk_img, direction);
253253}
254254
255255static UINT8 floppy_get_disk_status(int which, int disk_unit)
256256{
257   const device_config *disk_img = image_from_devtype_and_index(IO_FLOPPY, disk_unit);
257   const device_config *disk_img = image_from_devtype_and_index(machine, IO_FLOPPY, disk_unit);
258258   int status = floppy_status(disk_img, -1);
259259   int reply;
260260
src/mess/drivers/sord.c
r3961r3962
123123
124124   LOG(("fd5 drive state w: %02x\n",state));
125125
126   floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, 0), state);
127   floppy_drive_set_motor_state(image_from_devtype_and_index(IO_FLOPPY, 0), state);
128   floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, 1), 1,1);
129   floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, 1), 1,1);
126   floppy_drive_set_motor_state(image_from_devtype_and_index(machine, IO_FLOPPY, 0), state);
127   floppy_drive_set_motor_state(image_from_devtype_and_index(machine, IO_FLOPPY, 0), state);
128   floppy_drive_set_ready_state(image_from_devtype_and_index(machine, IO_FLOPPY, 1), 1,1);
129   floppy_drive_set_ready_state(image_from_devtype_and_index(machine, IO_FLOPPY, 1), 1,1);
130130}
131131
132132static WRITE8_HANDLER(fd5_tc_w)
r3961r3962
174174
175175static MACHINE_RESET( sord_m5_fd5 )
176176{
177   floppy_drive_set_geometry(image_from_devtype_and_index(IO_FLOPPY, 0), FLOPPY_DRIVE_SS_40);
178   floppy_drive_set_geometry(image_from_devtype_and_index(IO_FLOPPY, 1), FLOPPY_DRIVE_SS_40);
177   floppy_drive_set_geometry(image_from_devtype_and_index(machine, IO_FLOPPY, 0), FLOPPY_DRIVE_SS_40);
178   floppy_drive_set_geometry(image_from_devtype_and_index(machine, IO_FLOPPY, 1), FLOPPY_DRIVE_SS_40);
179179   MACHINE_RESET_CALL(sord_m5);
180180   ppi8255_set_port_c((device_config*)device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255" ), 0x50);
181181}

Previous 15994 Revisions Next


© 1998-2018 The MESS Team