summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2011-06-18 08:25:20 +0000
committer Miodrag Milanovic <mmicko@gmail.com>2011-06-18 08:25:20 +0000
commita4a72c79d5c90d861e96be3aac7067db4df1d57c (patch)
tree886f2a95bd58e5a699b2b873b5fb0a27a90afd0b /src
parent291862b7189f707c572aa6c0425423bc8462fdb5 (diff)
Preps for floppy conversion to c++ device (no whatsnew)
Diffstat (limited to 'src')
-rw-r--r--src/emu/imagedev/flopdrv.c33
-rw-r--r--src/emu/imagedev/flopdrv.h37
2 files changed, 21 insertions, 49 deletions
diff --git a/src/emu/imagedev/flopdrv.c b/src/emu/imagedev/flopdrv.c
index 36e772216d0..19282aab650 100644
--- a/src/emu/imagedev/flopdrv.c
+++ b/src/emu/imagedev/flopdrv.c
@@ -57,7 +57,7 @@ struct _floppy_drive
int drive_id;
int active;
- const floppy_config *config;
+ const floppy_interface *config;
/* flags */
int flags;
@@ -127,13 +127,6 @@ INLINE floppy_drive *get_safe_token(device_t *device)
return (floppy_drive *) downcast<legacy_device_base *>(device)->token();
}
-INLINE const inline_floppy_config *get_config_dev(const device_t *device)
-{
- assert(device != NULL);
- assert( device->type() == FLOPPY || device->type() == FLOPPY_APPLE || device->type() == FLOPPY_SONY);
- return (const inline_floppy_config *)downcast<const legacy_device_base *>(device)->inline_config();
-}
-
floppy_image *flopimg_get_image(device_t *image)
{
return get_safe_token(image)->floppy;
@@ -224,7 +217,7 @@ static void floppy_drive_init(device_t *img)
pDrive->index_timer = img->machine().scheduler().timer_alloc(FUNC(floppy_drive_index_callback), (void *) img);
pDrive->idx = 0;
- floppy_drive_set_geometry(img, ((floppy_config*)img->static_config())->floppy_type);
+ floppy_drive_set_geometry(img, ((floppy_interface*)img->static_config())->floppy_type);
/* initialise id index - not so important */
pDrive->id_index = 0;
@@ -572,7 +565,7 @@ void floppy_drive_set_controller(device_t *img, device_t *controller)
DEVICE_START( floppy )
{
floppy_drive *floppy = get_safe_token( device );
- floppy->config = (const floppy_config*)device->static_config();
+ floppy->config = (const floppy_interface*)device->static_config();
floppy_drive_init(device);
floppy->drive_id = floppy_get_drive(device);
@@ -614,7 +607,7 @@ static int internal_floppy_device_load(device_image_interface *image, int create
flopimg = get_safe_token( &image->device() );
/* figure out the floppy options */
- floppy_options = ((floppy_config*)image->device().static_config())->formats;
+ floppy_options = ((floppy_interface*)image->device().static_config())->formats;
if (image->has_been_created())
{
@@ -973,7 +966,7 @@ DEVICE_GET_INFO(floppy)
{
/* --- the following bits of info are returned as 64-bit signed integers --- */
case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(floppy_drive); break;
- case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = sizeof(inline_floppy_config); break;
+ case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break;
case DEVINFO_INT_IMAGE_TYPE: info->i = IO_FLOPPY; break;
case DEVINFO_INT_IMAGE_READABLE: info->i = 1; break;
case DEVINFO_INT_IMAGE_WRITEABLE: info->i = 1; break;
@@ -982,7 +975,7 @@ DEVICE_GET_INFO(floppy)
int cnt = 0;
if ( device && device->static_config() )
{
- const struct FloppyFormat *floppy_options = ((floppy_config*)device->static_config())->formats;
+ const struct FloppyFormat *floppy_options = ((floppy_interface*)device->static_config())->formats;
int i;
for ( i = 0; floppy_options[i].construct; i++ ) {
if(floppy_options[i].param_guidelines) cnt++;
@@ -1001,8 +994,8 @@ DEVICE_GET_INFO(floppy)
if (device->type() == FLOPPY_APPLE) {
info->f = NULL;
} else {
- if ( device && downcast<const legacy_image_device_base *>(device)->inline_config() && get_config_dev(device)->device_displayinfo) {
- info->f = (genf *) get_config_dev(device)->device_displayinfo;
+ if ( device && downcast<const legacy_image_device_base *>(device)->static_config() && ((floppy_interface*)(device))->device_displayinfo) {
+ info->f = (genf *) ((floppy_interface*)(device))->device_displayinfo;
} else {
info->f = NULL;
}
@@ -1012,7 +1005,7 @@ DEVICE_GET_INFO(floppy)
case DEVINFO_PTR_IMAGE_CREATE_OPTGUIDE: info->p = (void *)floppy_option_guide; break;
case DEVINFO_INT_IMAGE_CREATE_OPTCOUNT:
{
- const struct FloppyFormat *floppy_options = ((floppy_config*)device->static_config())->formats;
+ const struct FloppyFormat *floppy_options = ((floppy_interface*)device->static_config())->formats;
int count;
for (count = 0; floppy_options[count].construct; count++)
;
@@ -1027,7 +1020,7 @@ DEVICE_GET_INFO(floppy)
case DEVINFO_STR_IMAGE_FILE_EXTENSIONS:
if ( device && device->static_config() )
{
- const struct FloppyFormat *floppy_options = ((floppy_config*)device->static_config())->formats;
+ const struct FloppyFormat *floppy_options = ((floppy_interface*)device->static_config())->formats;
int i;
/* set up a temporary string */
info->s[0] = '\0';
@@ -1036,16 +1029,16 @@ DEVICE_GET_INFO(floppy)
}
break;
case DEVINFO_STR_IMAGE_INTERFACE:
- if ( device && device->static_config() && ((floppy_config *)device->static_config())->interface)
+ if ( device && device->static_config() && ((floppy_interface *)device->static_config())->interface)
{
- strcpy(info->s, ((floppy_config *)device->static_config())->interface );
+ strcpy(info->s, ((floppy_interface *)device->static_config())->interface );
}
break;
default:
{
if ( device && device->static_config() )
{
- const struct FloppyFormat *floppy_options = ((floppy_config*)device->static_config())->formats;
+ const struct FloppyFormat *floppy_options = ((floppy_interface*)device->static_config())->formats;
if ((state >= DEVINFO_PTR_IMAGE_CREATE_OPTSPEC) && (state < DEVINFO_PTR_IMAGE_CREATE_OPTSPEC + DEVINFO_IMAGE_CREATE_OPTMAX)) {
info->p = (void *) floppy_options[state - DEVINFO_PTR_IMAGE_CREATE_OPTSPEC].param_guidelines;
} else if ((state >= DEVINFO_STR_IMAGE_CREATE_OPTNAME) && (state < DEVINFO_STR_IMAGE_CREATE_OPTNAME + DEVINFO_IMAGE_CREATE_OPTMAX)) {
diff --git a/src/emu/imagedev/flopdrv.h b/src/emu/imagedev/flopdrv.h
index a4c940fd230..6b965fa2900 100644
--- a/src/emu/imagedev/flopdrv.h
+++ b/src/emu/imagedev/flopdrv.h
@@ -47,7 +47,9 @@
/***************************************************************************
TYPE DEFINITIONS
***************************************************************************/
-typedef struct floppy_type_t floppy_type;
+
+// ======================> floppy_type_t
+
struct floppy_type_t
{
UINT8 media_size;
@@ -56,14 +58,9 @@ struct floppy_type_t
UINT8 max_density;
};
-typedef struct inline_floppy_config_t inline_floppy_config;
-struct inline_floppy_config_t
-{
- device_image_display_info_func device_displayinfo;
-};
+// ======================> floppy_interface
-typedef struct floppy_config_t floppy_config;
-struct floppy_config_t
+struct floppy_interface
{
devcb_write_line out_idx_func; /* index */
devcb_read_line in_mon_func; /* motor on */
@@ -75,6 +72,7 @@ struct floppy_config_t
floppy_type_t floppy_type;
const struct FloppyFormat *formats;
const char *interface;
+ device_image_display_info_func device_displayinfo;
};
/* sector has a deleted data address mark */
@@ -84,7 +82,7 @@ struct floppy_config_t
/* CRC error in data field */
#define ID_FLAG_CRC_ERROR_IN_DATA_FIELD 0x0004
-typedef struct chrn_id
+struct chrn_id
{
unsigned char C;
unsigned char H;
@@ -92,7 +90,7 @@ typedef struct chrn_id
unsigned char N;
int data_id; // id for read/write data command
unsigned long flags;
-} chrn_id;
+};
/* set if drive is ready */
#define FLOPPY_DRIVE_READY 0x0010
@@ -249,23 +247,4 @@ extern DEVICE_IMAGE_UNLOAD( floppy );
MCFG_DEVICE_REMOVE(FLOPPY_0) \
MCFG_DEVICE_REMOVE(FLOPPY_1)
-#define MCFG_FLOPPY_DRIVE_DISPLAY_INFO(_displayinfo) \
- MCFG_DEVICE_CONFIG_DATAPTR(inline_floppy_config, device_displayinfo, DEVICE_IMAGE_DISPLAY_INFO_NAME(_displayinfo))
-
-#define MCFG_FLOPPY_2_DRIVES_DISPLAY_INFO(_displayinfo) \
- MCFG_DEVICE_MODIFY(FLOPPY_0) \
- MCFG_DEVICE_CONFIG_DATAPTR(inline_floppy_config, device_displayinfo, DEVICE_IMAGE_DISPLAY_INFO_NAME(_displayinfo)) \
- MCFG_DEVICE_MODIFY(FLOPPY_1) \
- MCFG_DEVICE_CONFIG_DATAPTR(inline_floppy_config, device_displayinfo, DEVICE_IMAGE_DISPLAY_INFO_NAME(_displayinfo))
-
-#define MCFG_FLOPPY_4_DRIVES_DISPLAY_INFO(_displayinfo) \
- MCFG_DEVICE_MODIFY(FLOPPY_0) \
- MCFG_DEVICE_CONFIG_DATAPTR(inline_floppy_config, device_displayinfo, DEVICE_IMAGE_DISPLAY_INFO_NAME(_displayinfo)) \
- MCFG_DEVICE_MODIFY(FLOPPY_1) \
- MCFG_DEVICE_CONFIG_DATAPTR(inline_floppy_config, device_displayinfo, DEVICE_IMAGE_DISPLAY_INFO_NAME(_displayinfo)) \
- MCFG_DEVICE_MODIFY(FLOPPY_2) \
- MCFG_DEVICE_CONFIG_DATAPTR(inline_floppy_config, device_displayinfo, DEVICE_IMAGE_DISPLAY_INFO_NAME(_displayinfo)) \
- MCFG_DEVICE_MODIFY(FLOPPY_3) \
- MCFG_DEVICE_CONFIG_DATAPTR(inline_floppy_config, device_displayinfo, DEVICE_IMAGE_DISPLAY_INFO_NAME(_displayinfo))
-
#endif /* __FLOPDRV_H__ */