Previous 15994 Revisions Next

r6638 Tuesday 15th December, 2009 at 10:32:46 UTC by Dirk Best
Remove floppy_status() function
[src/mess/devices]flopdrv.c flopdrv.h
[src/mess/machine]smc92x4.c

src/mess/devices/flopdrv.c
r6637r6638
339339/*************************************************************************/
340340/* IO_FLOPPY device functions */
341341
342/* return and set current status
343  use for setting:-
344  1) write protect/enable
345  2) drive present/missing
346*/
347
348int   floppy_status(const device_config *img, int new_status)
349{
350   /* return current status only? */
351   if (new_status!=-1)
352   {
353      /* we don't set the flags directly.
354        The flags are "cooked" when we do a floppy_drive_get_flag_state depending on
355        if drive is connected etc. So if we wrote the flags back it would
356        corrupt this information. Therefore we update the flags depending on new_status */
357
358      floppy_drive_set_flag_state(img, FLOPPY_DRIVE_DISK_WRITE_PROTECTED, (new_status & FLOPPY_DRIVE_DISK_WRITE_PROTECTED));
359   }
360
361   /* return current status */
362   return floppy_drive_get_flag_state(img,0x0ff);
363}
364
365342/* set flag state */
366343void floppy_drive_set_flag_state(const device_config *img, int flag, int state)
367344{
src/mess/devices/flopdrv.h
r6637r6638
5252/* CRC error in data field */
5353#define ID_FLAG_CRC_ERROR_IN_DATA_FIELD 0x0004
5454
55int   floppy_status(const device_config *img, int new_status);
56
5755typedef struct chrn_id
5856{
5957   unsigned char C;
src/mess/machine/smc92x4.c
r6637r6638
255255static UINT8 floppy_get_disk_status(running_machine *machine,int which, int disk_unit)
256256{
257257   const device_config *disk_img = floppy_get_device(machine, disk_unit);
258   int status = floppy_status(disk_img, -1);
259   int reply;
258   int reply = 0;
260259
261   reply = 0;
262   if (status & FLOPPY_DRIVE_INDEX)
260   if (floppy_drive_get_flag_state(disk_img, FLOPPY_DRIVE_INDEX) == FLOPPY_DRIVE_INDEX)
263261      reply |= DS_INDEX;
264   reply |= DS_SKCOM;
265   if (status & FLOPPY_DRIVE_HEAD_AT_TRACK_0)
262   if (floppy_drive_get_flag_state(disk_img, FLOPPY_DRIVE_HEAD_AT_TRACK_0) == FLOPPY_DRIVE_HEAD_AT_TRACK_0)
266263      reply |= DS_TRK00;
267   if (status & FLOPPY_DRIVE_DISK_WRITE_PROTECTED)
264   if (floppy_drive_get_flag_state(disk_img, FLOPPY_DRIVE_DISK_WRITE_PROTECTED) == FLOPPY_DRIVE_DISK_WRITE_PROTECTED)
268265      reply |= DS_WRPROT;
269   if /*(status & FLOPPY_DRIVE_READY)*/(image_exists(disk_img))
266   if (image_exists(disk_img))
270267      reply |= DS_READY;
271268
269   reply |= DS_SKCOM;
270
272271   return reply;
273272}
274273

Previous 15994 Revisions Next


© 1998-2018 The MESS Team