Previous 15994 Revisions Next

r2167 Sunday 30th March, 2008 at 17:13:03 UTC by Nathan Woods
Changed all instances of "mess_image" to "const device_config"
[src/emu/sound]wave.c
[src/mess]artworkx.c artworkx.h cheatms.c configms.c device.h filemngr.c image.c image.h mess.c mess.h messopts.c osdmess.h tapectrl.c uimess.c
[src/mess/devices]appldriv.c basicdsk.c basicdsk.h bitbngr.c bitbngr.h cartslot.c cassette.c cassette.h chd_cd.c chd_cd.h coco_vhd.c dsk.c flopdrv.c flopdrv.h harddriv.c harddriv.h idedrive.c mflopimg.c mflopimg.h mfmdisk.c printer.c printer.h snapquik.c snapquik.h sonydriv.c thomflop.c z80bin.c z80bin.h
[src/mess/drivers]a2600.c apexc.c coco.c lynx.c sg1000.c sord.c super80.c tm990189.c tutor.c x68k.c
[src/mess/formats]thom_cas.c thom_dsk.c thom_dsk.h
[src/mess/includes]d88.h serial.h thomson.h
[src/mess/machine]6551.c 6551.h 990_dk.c 990_hd.c 990_tap.c 994x_ser.c 99_dsk.c adam.c amigafdc.c apple1.c apple2gs.c atom.c bebox.c c16.c cbm.c cgenie.c coco.c corvushd.c cpm_bios.c d88.c electron.c i8271.c intv.c kc.c mbee.c mc10.c mc6843.c microtan.c msm8251.c msm8251.h msx.c mtx.c nc.c nec765.c nec765.h nes.c oric.c pc_fdc.c pc_fdc.h pc_hdc.c pce.c pdp1.c serial.c smc92x4.c smc92x4.h svi318.c thomson.c ti99_4x.c tx0.c vc20.c vc20tape.c vtech1.c vtech2.c wd17xx.c
[src/mess/osd/windows]menu.c tapedlg.c
[src/mess/tools/messtest]testmess.c tststubs.c

src/emu/sound/wave.c
r2166r2167
2626static void wave_sound_update(void *param,stream_sample_t **inputs, stream_sample_t **_buffer,int length)
2727{
2828#ifdef MESS
29   mess_image *image;
29   const device_config *image;
3030   cassette_image *cassette;
3131   cassette_state state;
3232   double time_index;
src/mess/devices/snapquik.h
r2166r2167
2222   MESS_DEVINFO_FLOAT_QUICKLOAD_DELAY = MESS_DEVINFO_FLOAT_DEV_SPECIFIC
2323};
2424
25typedef int (*snapquick_loadproc)(running_machine *machine, mess_image *image, const char *file_type, int file_size);
25typedef int (*snapquick_loadproc)(running_machine *machine, const device_config *image, const char *file_type, int file_size);
2626
27#define SNAPSHOT_LOAD(name)      int snapshot_load_##name(running_machine *machine, mess_image *image, const char *file_type, int snapshot_size)
28#define QUICKLOAD_LOAD(name)   int quickload_load_##name(running_machine *machine, mess_image *image, const char *file_type, int quickload_size)
27#define SNAPSHOT_LOAD(name)      int snapshot_load_##name(running_machine *machine, const device_config *image, const char *file_type, int snapshot_size)
28#define QUICKLOAD_LOAD(name)   int quickload_load_##name(running_machine *machine, const device_config *image, const char *file_type, int quickload_size)
2929
3030void snapshot_device_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info);
3131void quickload_device_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info);
src/mess/devices/harddriv.c
r2166r2167
7979   hard_disk_file *hard_disk_handle;
8080};
8181
82static struct mess_hd *get_drive(mess_image *img)
82static struct mess_hd *get_drive(const device_config *img)
8383{
8484   return image_lookuptag(img, MESSHDTAG);
8585}
r2166r2167
118118 *
119119 *************************************/
120120
121static int internal_load_mess_hd(mess_image *image, const char *metadata)
121static int internal_load_mess_hd(const device_config *image, const char *metadata)
122122{
123123   chd_error err = 0;
124124   struct mess_hd *hd;
r2166r2167
234234 *
235235 *************************************/
236236
237hard_disk_file *mess_hd_get_hard_disk_file(mess_image *image)
237hard_disk_file *mess_hd_get_hard_disk_file(const device_config *image)
238238{
239239   struct mess_hd *hd = get_drive(image);
240240   return hd->hard_disk_handle;
r2166r2167
249249 *
250250 *************************************/
251251
252chd_file *mess_hd_get_chd_file(mess_image *image)
252chd_file *mess_hd_get_chd_file(const device_config *image)
253253{
254254   chd_file *result = NULL;
255255   hard_disk_file *hd_file;
src/mess/devices/harddriv.h
r2166r2167
1818DEVICE_LOAD( mess_hd );
1919DEVICE_UNLOAD( mess_hd );
2020
21hard_disk_file *mess_hd_get_hard_disk_file(mess_image *image);
21hard_disk_file *mess_hd_get_hard_disk_file(const device_config *image);
2222hard_disk_file *mess_hd_get_hard_disk_file_by_number(int drivenum);
23chd_file *mess_hd_get_chd_file(mess_image *image);
23chd_file *mess_hd_get_chd_file(const device_config *image);
2424
2525void harddisk_device_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info);
2626
src/mess/devices/z80bin.c
r2166r2167
1717#include "snapquik.h"
1818
1919
20int z80bin_load_file( running_machine *machine, mess_image *image, const char *file_type, UINT16 *exec_addr, UINT16 *start_addr, UINT16 *end_addr )
20int z80bin_load_file( running_machine *machine, const device_config *image, const char *file_type, UINT16 *exec_addr, UINT16 *start_addr, UINT16 *end_addr )
2121{
2222   int ch;
2323   UINT16 args[3];
src/mess/devices/cassette.c
r2166r2167
3434};
3535
3636
37static struct mess_cassetteimg *get_cassimg(mess_image *image)
37static struct mess_cassetteimg *get_cassimg(const device_config *image)
3838{
3939   return image_lookuptag(image, CASSETTE_TAG);
4040}
r2166r2167
5353   cassette IO
5454*********************************************************************/
5555
56static int cassette_is_motor_on(mess_image *cassette)
56static int cassette_is_motor_on(const device_config *cassette)
5757{
5858   cassette_state state;
5959   state = cassette_get_state(cassette);
r2166r2167
6666
6767
6868
69static void cassette_update(mess_image *cassette)
69static void cassette_update(const device_config *cassette)
7070{
7171   struct mess_cassetteimg *tag;
7272   double cur_time;
r2166r2167
9595
9696
9797
98cassette_state cassette_get_state(mess_image *cassette)
98cassette_state cassette_get_state(const device_config *cassette)
9999{
100100   return get_cassimg(cassette)->state;
101101}
102102
103103
104104
105void cassette_change_state(mess_image *cassette, cassette_state state, cassette_state mask)
105void cassette_change_state(const device_config *cassette, cassette_state state, cassette_state mask)
106106{
107107   struct mess_cassetteimg *tag;
108108   cassette_state new_state;
r2166r2167
121121
122122
123123
124void cassette_set_state(mess_image *cassette, cassette_state state)
124void cassette_set_state(const device_config *cassette, cassette_state state)
125125{
126126   cassette_change_state(cassette, state, ~0);
127127}
128128
129129
130130
131double cassette_input(mess_image *cassette)
131double cassette_input(const device_config *cassette)
132132{
133133   INT32 sample;
134134   double double_value;
r2166r2167
146146
147147
148148
149void cassette_output(mess_image *cassette, double value)
149void cassette_output(const device_config *cassette, double value)
150150{
151151   struct mess_cassetteimg *tag;
152152   tag = get_cassimg(cassette);
r2166r2167
163163
164164
165165
166cassette_image *cassette_get_image(mess_image *cassette)
166cassette_image *cassette_get_image(const device_config *cassette)
167167{
168168   struct mess_cassetteimg *tag;
169169   tag = get_cassimg(cassette);
r2166r2167
172172
173173
174174
175double cassette_get_position(mess_image *cassette)
175double cassette_get_position(const device_config *cassette)
176176{
177177   double position;
178178   struct mess_cassetteimg *tag;
r2166r2167
187187
188188
189189
190double cassette_get_length(mess_image *cassette)
190double cassette_get_length(const device_config *cassette)
191191{
192192   struct mess_cassetteimg *tag;
193193   struct CassetteInfo info;
r2166r2167
199199
200200
201201
202void cassette_seek(mess_image *cassette, double time, int origin)
202void cassette_seek(const device_config *cassette, double time, int origin)
203203{
204204   struct mess_cassetteimg *tag;
205205
r2166r2167
328328/*
329329   display a small tape icon, with the current position in the tape image
330330*/
331static void device_display_cassette(mess_image *image)
331static void device_display_cassette(const device_config *image)
332332{
333333   char buf[65];
334334   float x, y;
src/mess/devices/flopdrv.c
r2166r2167
2323#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
2424#define FLOPDRVTAG   "flopdrv"
2525
26static struct floppy_drive *get_drive(mess_image *img)
26static struct floppy_drive *get_drive(const device_config *img)
2727{
2828   return image_lookuptag(img, FLOPDRVTAG);
2929}
r2166r2167
3131static TIMER_CALLBACK(floppy_drive_index_callback);
3232
3333/* this is called on device init */
34int floppy_drive_init(mess_image *img, const floppy_interface *iface)
34int floppy_drive_init(const device_config *img, const floppy_interface *iface)
3535{
3636   struct floppy_drive *pDrive;
3737
r2166r2167
6666
6767
6868/* index pulses at rpm/60 Hz, and stays high 1/20th of time */
69static void floppy_drive_index_func(mess_image *img)
69static void floppy_drive_index_func(const device_config *img)
7070{
7171   struct floppy_drive *pDrive = get_drive(img);
7272
r2166r2167
9191
9292static TIMER_CALLBACK(floppy_drive_index_callback)
9393{
94   mess_image *image = (mess_image *) ptr;
94   const device_config *image = (const device_config *) ptr;
9595   floppy_drive_index_func(image);
9696}
9797
9898
9999
100100/* set the callback for the index pulse */
101void floppy_drive_set_index_pulse_callback(mess_image *img, void (*callback)(mess_image *image, int state))
101void floppy_drive_set_index_pulse_callback(const device_config *img, void (*callback)(const device_config *image, int state))
102102{
103103   struct floppy_drive *pDrive = get_drive(img);
104104   pDrive->index_pulse_callback = callback;
105105}
106106
107107
108void floppy_drive_set_ready_state_change_callback(mess_image *img, void (*callback)(mess_image *img, int state))
108void floppy_drive_set_ready_state_change_callback(const device_config *img, void (*callback)(const device_config *img, int state))
109109{
110110   struct floppy_drive *pDrive = get_drive(img);
111111   pDrive->ready_state_change_callback = callback;
r2166r2167
120120  2) drive present/missing
121121*/
122122
123int   floppy_status(mess_image *img, int new_status)
123int   floppy_status(const device_config *img, int new_status)
124124{
125125   /* return current status only? */
126126   if (new_status!=-1)
r2166r2167
138138}
139139
140140/* set interface for image interface */
141void floppy_drive_set_disk_image_interface(mess_image *img, const floppy_interface *iface)
141void floppy_drive_set_disk_image_interface(const device_config *img, const floppy_interface *iface)
142142{
143143   struct floppy_drive *pDrive = get_drive(img);
144144   if (iface)
r2166r2167
148148}
149149
150150/* set flag state */
151void floppy_drive_set_flag_state(mess_image *img, int flag, int state)
151void floppy_drive_set_flag_state(const device_config *img, int flag, int state)
152152{
153153   struct floppy_drive *drv = get_drive(img);
154154   int prev_state;
r2166r2167
177177   }
178178}
179179
180void floppy_drive_set_motor_state(mess_image *img, int state)
180void floppy_drive_set_motor_state(const device_config *img, int state)
181181{
182182   int new_motor_state = 0;
183183   int previous_state = 0;
r2166r2167
235235/* for pc, drive is always ready, for amstrad,pcw,spectrum it is only ready under
236236a fixed set of circumstances */
237237/* use this to set ready state of drive */
238void floppy_drive_set_ready_state(mess_image *img, int state, int flag)
238void floppy_drive_set_ready_state(const device_config *img, int state, int flag)
239239{
240240   if (flag)
241241   {
r2166r2167
270270
271271
272272/* get flag state */
273int   floppy_drive_get_flag_state(mess_image *img, int flag)
273int   floppy_drive_get_flag_state(const device_config *img, int flag)
274274{
275275   struct floppy_drive *drv = get_drive(img);
276276   int drive_flags;
r2166r2167
310310}
311311
312312
313void floppy_drive_set_geometry(mess_image *img, floppy_type type)
313void floppy_drive_set_geometry(const device_config *img, floppy_type type)
314314{
315315   int max_track, num_sides;
316316
r2166r2167
332332   floppy_drive_set_geometry_absolute(img, max_track, num_sides);
333333}
334334
335void floppy_drive_set_geometry_absolute(mess_image *img, int tracks, int sides)
335void floppy_drive_set_geometry_absolute(const device_config *img, int tracks, int sides)
336336{
337337   struct floppy_drive *pDrive = get_drive(img);
338338   pDrive->max_track = tracks;
339339   pDrive->num_sides = sides;
340340}
341341
342void floppy_drive_seek(mess_image *img, signed int signed_tracks)
342void floppy_drive_seek(const device_config *img, signed int signed_tracks)
343343{
344344   struct floppy_drive *pDrive;
345345
r2166r2167
377377
378378
379379/* this is not accurate. But it will do for now */
380int   floppy_drive_get_next_id(mess_image *img, int side, chrn_id *id)
380int   floppy_drive_get_next_id(const device_config *img, int side, chrn_id *id)
381381{
382382   struct floppy_drive *pDrive;
383383   int spt;
r2166r2167
415415   return (spt == 0) ? 0 : 1;
416416}
417417
418int   floppy_drive_get_current_track(mess_image *img)
418int   floppy_drive_get_current_track(const device_config *img)
419419{
420420   struct floppy_drive *drv = get_drive(img);
421421   return drv->current_track;
422422}
423423
424void floppy_drive_read_track_data_info_buffer(mess_image *img, int side, void *ptr, int *length )
424void floppy_drive_read_track_data_info_buffer(const device_config *img, int side, void *ptr, int *length )
425425{
426426   if (image_exists(img))
427427   {
r2166r2167
431431   }
432432}
433433
434void floppy_drive_write_track_data_info_buffer(mess_image *img, int side, const void *ptr, int *length )
434void floppy_drive_write_track_data_info_buffer(const device_config *img, int side, const void *ptr, int *length )
435435{
436436   if (image_exists(img))
437437   {
r2166r2167
441441   }
442442}
443443
444void floppy_drive_format_sector(mess_image *img, int side, int sector_index,int c,int h, int r, int n, int filler)
444void floppy_drive_format_sector(const device_config *img, int side, int sector_index,int c,int h, int r, int n, int filler)
445445{
446446   if (image_exists(img))
447447   {
r2166r2167
451451   }
452452}
453453
454void floppy_drive_read_sector_data(mess_image *img, int side, int index1, void *pBuffer, int length)
454void floppy_drive_read_sector_data(const device_config *img, int side, int index1, void *pBuffer, int length)
455455{
456456   if (image_exists(img))
457457   {
r2166r2167
461461   }
462462}
463463
464void floppy_drive_write_sector_data(mess_image *img, int side, int index1, const void *pBuffer,int length, int ddam)
464void floppy_drive_write_sector_data(const device_config *img, int side, int index1, const void *pBuffer,int length, int ddam)
465465{
466466   if (image_exists(img))
467467   {
r2166r2167
508508
509509
510510
511void floppy_drive_set_rpm(mess_image *img, float rpm)
511void floppy_drive_set_rpm(const device_config *img, float rpm)
512512{
513513   struct floppy_drive *drv = get_drive(img);
514514   drv->rpm = rpm;
src/mess/devices/sonydriv.c
r2166r2167
7878*/
7979typedef struct
8080{
81   mess_image *img;
81   const device_config *img;
8282   mame_file *fd;
8383
8484   unsigned int ext_speed_control : 1;   /* is motor rotation controlled by external device ? */
r2166r2167
105105}
106106
107107#ifdef UNUSED_FUNCTION
108static floppy *get_sony_floppy(mess_image *img)
108static floppy *get_sony_floppy(const device_config *img)
109109{
110110   int id = image_index_in_device(img);
111111   return &sony_floppy[id];
r2166r2167
116116static void load_track_data(int floppy_select)
117117{
118118   int track_size;
119   mess_image *cur_image;
119   const device_config *cur_image;
120120   UINT8 *new_data;
121121   floppy *f;
122122
r2166r2167
140140
141141static void save_track_data(int floppy_select)
142142{
143   mess_image *cur_image;
143   const device_config *cur_image;
144144   floppy *f;
145145   int len;
146146
r2166r2167
160160UINT8 sony_read_data(void)
161161{
162162   UINT8 result = 0;
163   mess_image *cur_image;
163   const device_config *cur_image;
164164   floppy *f;
165165
166166   if (sony_enable2() || (! sony_floppy_enable))
r2166r2167
182182
183183void sony_write_data(UINT8 data)
184184{
185   mess_image *cur_image;
185   const device_config *cur_image;
186186   floppy *f;
187187
188188   f = &sony_floppy[sony_floppy_select];
r2166r2167
198198
199199
200200
201static int sony_rpm(floppy *f, mess_image *cur_image)
201static int sony_rpm(floppy *f, const device_config *cur_image)
202202{
203203   int result = 0;
204204
r2166r2167
256256   int result = 1;
257257   int action;
258258   floppy *f;
259   mess_image *cur_image;
259   const device_config *cur_image;
260260
261261   action = ((sony_lines & (SONY_CA1 | SONY_CA0)) << 2) | (sony_sel_line << 1) | ((sony_lines & SONY_CA2) >> 2);
262262
r2166r2167
367367{
368368   int action;
369369   floppy *f;
370   mess_image *cur_image;
370   const device_config *cur_image;
371371
372372   action = ((sony_lines & (SONY_CA1 | SONY_CA0)) << 2) | ((sony_lines & SONY_CA2) >> 2) | (sony_sel_line << 1);
373373
src/mess/devices/z80bin.h
r2166r2167
1616
1717void z80bin_quickload_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info);
1818
19int z80bin_load_file( running_machine *machine, mess_image *image, const char *file_type, UINT16 *exec_addr, UINT16 *start_addr, UINT16 *end_addr );
19int z80bin_load_file( running_machine *machine, const device_config *image, const char *file_type, UINT16 *exec_addr, UINT16 *start_addr, UINT16 *end_addr );
2020
2121
2222#endif /* Z80BIN_H */
src/mess/devices/cassette.h
r2166r2167
4343} cassette_state;
4444
4545/* cassette prototypes */
46cassette_state cassette_get_state(mess_image *cassette);
47void cassette_set_state(mess_image *cassette, cassette_state state);
48void cassette_change_state(mess_image *cassette, cassette_state state, cassette_state mask);
46cassette_state cassette_get_state(const device_config *cassette);
47void cassette_set_state(const device_config *cassette, cassette_state state);
48void cassette_change_state(const device_config *cassette, cassette_state state, cassette_state mask);
4949
50double cassette_input(mess_image *cassette);
51void cassette_output(mess_image *cassette, double value);
50double cassette_input(const device_config *cassette);
51void cassette_output(const device_config *cassette, double value);
5252
53cassette_image *cassette_get_image(mess_image *cassette);
54double cassette_get_position(mess_image *cassette);
55double cassette_get_length(mess_image *cassette);
56void cassette_seek(mess_image *cassette, double time, int origin);
53cassette_image *cassette_get_image(const device_config *cassette);
54double cassette_get_position(const device_config *cassette);
55double cassette_get_length(const device_config *cassette);
56void cassette_seek(const device_config *cassette, double time, int origin);
5757
5858/* device specification */
5959void cassette_device_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info);
src/mess/devices/flopdrv.h
r2166r2167
2323/* CRC error in data field */
2424#define ID_FLAG_CRC_ERROR_IN_DATA_FIELD 0x0004
2525
26int   floppy_status(mess_image *img, int new_status);
26int   floppy_status(const device_config *img, int new_status);
2727
2828typedef struct chrn_id
2929{
r2166r2167
5050typedef struct floppy_interface
5151{
5252   /* seek to physical track */
53   void (*seek_callback)(mess_image *img, int physical_track);
53   void (*seek_callback)(const device_config *img, int physical_track);
5454
5555   /* the following are not strictly floppy drive operations, but are used by the
5656   nec765 to get data from the track - really the whole track should be constructed
r2166r2167
5959   with the data */
6060
6161   /* get number of sectors per track on side specified */
62   int (*get_sectors_per_track)(mess_image *image, int physical_side);
62   int (*get_sectors_per_track)(const device_config *image, int physical_side);
6363
6464   /* get id from current track and specified side */
65   void (*get_id_callback)(mess_image *image, chrn_id *, int id_index, int physical_side);
65   void (*get_id_callback)(const device_config *image, chrn_id *, int id_index, int physical_side);
6666
6767   /* read sector data into buffer, length = number of bytes to read */
68   void (*read_sector_data_into_buffer)(mess_image *image, int side,int data_id,char *, int length);
68   void (*read_sector_data_into_buffer)(const device_config *image, int side,int data_id,char *, int length);
6969
7070   /* write sector data from buffer, length = number of bytes to read  */
71   void (*write_sector_data_from_buffer)(mess_image *image, int side,int data_id, const char *, int length, int ddam);
71   void (*write_sector_data_from_buffer)(const device_config *image, int side,int data_id, const char *, int length, int ddam);
7272
7373   /* Read track in buffer, length = number of bytes to read */
74   void (*read_track_data_info_buffer)(mess_image *image, int side, void *ptr, int *length );
74   void (*read_track_data_info_buffer)(const device_config *image, int side, void *ptr, int *length );
7575
7676   /* Write track in buffer, length = number of bytes to read */
77   void (*write_track_data_info_buffer)(mess_image *image, int side, const void *ptr, int *length );
77   void (*write_track_data_info_buffer)(const device_config *image, int side, const void *ptr, int *length );
7878
7979   /* format */
80   void (*format_sector)(mess_image *img, int side, int sector_index,int c, int h, int r, int n, int filler);
80   void (*format_sector)(const device_config *img, int side, int sector_index,int c, int h, int r, int n, int filler);
8181} floppy_interface;
8282
8383struct floppy_drive
r2166r2167
9595   /* index pulse timer */
9696   void   *index_timer;
9797   /* index pulse callback */
98   void   (*index_pulse_callback)(mess_image *image, int state);
98   void   (*index_pulse_callback)(const device_config *image, int state);
9999   /* rotation per minute => gives index pulse frequency */
100100   float rpm;
101101   /* current index pulse value */
102102   int index;
103103
104   void   (*ready_state_change_callback)(mess_image *img, int state);
104   void   (*ready_state_change_callback)(const device_config *img, int state);
105105
106106   unsigned char id_buffer[4];
107107
r2166r2167
112112};
113113
114114/* a callback which will be executed if the ready state of the drive changes e.g. not ready->ready, ready->not ready */
115void floppy_drive_set_ready_state_change_callback(mess_image *img, void (*callback)(mess_image *img, int state));
115void floppy_drive_set_ready_state_change_callback(const device_config *img, void (*callback)(const device_config *img, int state));
116116
117117/* floppy drive types */
118118typedef enum
r2166r2167
121121   FLOPPY_DRIVE_DS_80
122122} floppy_type;
123123
124void floppy_drive_set_index_pulse_callback(mess_image *img, void (*callback)(mess_image *image, int state));
124void floppy_drive_set_index_pulse_callback(const device_config *img, void (*callback)(const device_config *image, int state));
125125
126126/* set flag state */
127int floppy_drive_get_flag_state(mess_image *img, int flag);
127int floppy_drive_get_flag_state(const device_config *img, int flag);
128128/* get flag state */
129void floppy_drive_set_flag_state(mess_image *img, int flag, int state);
129void floppy_drive_set_flag_state(const device_config *img, int flag, int state);
130130/* get current physical track drive is on */
131int floppy_drive_get_current_track(mess_image *img);
131int floppy_drive_get_current_track(const device_config *img);
132132
133void floppy_drive_set_geometry(mess_image *img, floppy_type type);
134void floppy_drive_set_geometry_absolute(mess_image *img, int tracks, int sides);
133void floppy_drive_set_geometry(const device_config *img, floppy_type type);
134void floppy_drive_set_geometry_absolute(const device_config *img, int tracks, int sides);
135135
136136/* called in device init/exit functions */
137int floppy_drive_init(mess_image *img, const floppy_interface *iface);
137int floppy_drive_init(const device_config *img, const floppy_interface *iface);
138138
139139/* get next id from track, 1 if got a id, 0 if no id was got */
140int floppy_drive_get_next_id(mess_image *img, int side, chrn_id *);
140int floppy_drive_get_next_id(const device_config *img, int side, chrn_id *);
141141/* set ready state of drive. If flag == 1, set ready state only if drive present,
142142disk is in drive, and motor is on. Otherwise set ready state to the state passed */
143void floppy_drive_set_ready_state(mess_image *img, int state, int flag);
143void floppy_drive_set_ready_state(const device_config *img, int state, int flag);
144144
145void floppy_drive_set_motor_state(mess_image *img, int state);
145void floppy_drive_set_motor_state(const device_config *img, int state);
146146
147147/* deprecated; set interface for disk image functions */
148void floppy_drive_set_disk_image_interface(mess_image *img, const floppy_interface *iface);
148void floppy_drive_set_disk_image_interface(const device_config *img, const floppy_interface *iface);
149149
150150/* seek up or down */
151void floppy_drive_seek(mess_image *img, signed int signed_tracks);
151void floppy_drive_seek(const device_config *img, signed int signed_tracks);
152152
153void floppy_drive_read_track_data_info_buffer(mess_image *img, int side, void *ptr, int *length );
154void floppy_drive_write_track_data_info_buffer(mess_image *img, int side, const void *ptr, int *length );
155void floppy_drive_format_sector(mess_image *img, int side, int sector_index, int c, int h, int r, int n, int filler);
156void floppy_drive_read_sector_data(mess_image *img, int side, int index1, void *pBuffer, int length);
157void floppy_drive_write_sector_data(mess_image *img, int side, int index1, const void *pBuffer, int length, int ddam);
153void floppy_drive_read_track_data_info_buffer(const device_config *img, int side, void *ptr, int *length );
154void floppy_drive_write_track_data_info_buffer(const device_config *img, int side, const void *ptr, int *length );
155void floppy_drive_format_sector(const device_config *img, int side, int sector_index, int c, int h, int r, int n, int filler);
156void floppy_drive_read_sector_data(const device_config *img, int side, int index1, void *pBuffer, int length);
157void floppy_drive_write_sector_data(const device_config *img, int side, int index1, const void *pBuffer, int length, int ddam);
158158int   floppy_drive_get_datarate_in_us(DENSITY density);
159159
160160/* set motor speed to get correct index pulses
r2166r2167
162162   Note: this actually only works for soft sectored disks: one index pulse per
163163   track.
164164*/
165void floppy_drive_set_rpm(mess_image *image, float rpm);
165void floppy_drive_set_rpm(const device_config *image, float rpm);
166166
167167
168168#endif /* FLOPDRV_H */
src/mess/devices/mfmdisk.c
r2166r2167
1313#include "flopdrv.h"
1414
1515
16static void mfm_disk_seek_callback(mess_image *image, int);
17static int mfm_disk_get_sectors_per_track(mess_image *image, int);
18static void mfm_disk_get_id_callback(mess_image *image, chrn_id *, int, int);
19static void mfm_disk_read_sector_data_into_buffer(mess_image *image, int side, int index1, char *ptr, int length);
20static void mfm_disk_write_sector_data_from_buffer(mess_image *image, int side, int index1, const char *ptr, int length,int ddam);
16static void mfm_disk_seek_callback(const device_config *image, int);
17static int mfm_disk_get_sectors_per_track(const device_config *image, int);
18static void mfm_disk_get_id_callback(const device_config *image, chrn_id *, int, int);
19static void mfm_disk_read_sector_data_into_buffer(const device_config *image, int side, int index1, char *ptr, int length);
20static void mfm_disk_write_sector_data_from_buffer(const device_config *image, int side, int index1, const char *ptr, int length,int ddam);
2121
2222const floppy_interface mfm_disk_floppy_interface =
2323{
r2166r2167
102102  deleted data mark and data in the sector field!
103103*/
104104
105static struct mfm_disk_info *get_disk(mess_image *image)
105static struct mfm_disk_info *get_disk(const device_config *image)
106106{
107107   int disk = image_index_in_device(image);
108108   return &mfm_disks[disk];
r2166r2167
110110
111111/* TODO: Error checking if a id is found at very end of track, or a sector which
112112goes over end of track */
113static void mfm_info_cache_sector_info(mess_image *image,unsigned char *pTrackPtr, unsigned long Length)
113static void mfm_info_cache_sector_info(const device_config *image,unsigned char *pTrackPtr, unsigned long Length)
114114{
115115   /* initialise these with single density values if single density */
116116   unsigned char IdMark = 0x0fe;
r2166r2167
190190
191191}
192192
193static unsigned long mfm_disk_get_track_size(mess_image *image)
193static unsigned long mfm_disk_get_track_size(const device_config *image)
194194{
195195   struct mfm_disk_info *pDisk = get_disk(image);
196196   switch (pDisk->Density)
r2166r2167
206206}
207207
208208
209static unsigned char *mfm_disk_get_track_ptr(mess_image *image, int track, int side)
209static unsigned char *mfm_disk_get_track_ptr(const device_config *image, int track, int side)
210210{
211211   struct mfm_disk_info *pDisk = get_disk(image);
212212
r2166r2167
327327}
328328
329329/* cache info about track */
330static void mfm_disk_cache_data(mess_image *image, int track, int side)
330static void mfm_disk_cache_data(const device_config *image, int track, int side)
331331{
332332   struct mfm_disk_info *mfm_disk = get_disk(image);
333333
r2166r2167
345345
346346
347347
348static void mfm_disk_get_id_callback(mess_image *image, chrn_id *id, int id_index, int side)
348static void mfm_disk_get_id_callback(const device_config *image, chrn_id *id, int id_index, int side)
349349{
350350   struct mfm_disk_info *mfm_disk = get_disk(image);
351351
r2166r2167
369369   }
370370}
371371
372static int mfm_disk_get_sectors_per_track(mess_image *image, int side)
372static int mfm_disk_get_sectors_per_track(const device_config *image, int side)
373373{
374374   struct mfm_disk_info *mfm_disk = get_disk(image);
375375
r2166r2167
385385   return mfm_disk->NumSectors;
386386}
387387
388static void mfm_disk_seek_callback(mess_image *image, int physical_track)
388static void mfm_disk_seek_callback(const device_config *image, int physical_track)
389389{
390390   struct mfm_disk_info *mfm_disk = get_disk(image);
391391   mfm_disk->CurrentTrack = physical_track;
r2166r2167
393393
394394/* reading and writing are not clever, they need to be so that the data is correctly written back
395395to the image */
396static void mfm_disk_write_sector_data_from_buffer(mess_image *image, int side, int index1, const char *ptr, int length, int ddam)
396static void mfm_disk_write_sector_data_from_buffer(const device_config *image, int side, int index1, const char *ptr, int length, int ddam)
397397{
398398   struct mfm_disk_info *mfm_disk = get_disk(image);
399399   unsigned char *pSectorPtr;
r2166r2167
405405   memcpy(pSectorPtr, ptr, length);
406406}
407407
408static void mfm_disk_read_sector_data_into_buffer(mess_image *image, int side, int index1, char *ptr, int length)
408static void mfm_disk_read_sector_data_into_buffer(const device_config *image, int side, int index1, char *ptr, int length)
409409{
410410   struct mfm_disk_info *mfm_disk = get_disk(image);
411411   unsigned char *pSectorPtr;
src/mess/devices/idedrive.c
r2166r2167
1414#include "machine/idectrl.h"
1515
1616
17static void ide_get_params(mess_image *image, int *which_bus, int *which_address,
17static void ide_get_params(const device_config *image, int *which_bus, int *which_address,
1818   struct ide_interface **intf,
1919   device_init_handler *parent_init,
2020   device_load_handler *parent_load,
r2166r2167
4747   ide_hd_init - Init an IDE hard disk device
4848-------------------------------------------------*/
4949
50static int ide_hd_init(mess_image *image)
50static int ide_hd_init(const device_config *image)
5151{
5252   int result, which_bus, which_address;
5353   struct ide_interface *intf;
r2166r2167
7272   ide_hd_load - Load an IDE hard disk image
7373-------------------------------------------------*/
7474
75static int ide_hd_load(mess_image *image)
75static int ide_hd_load(const device_config *image)
7676{
7777   int result, which_bus, which_address;
7878   struct ide_interface *intf;
r2166r2167
9898   ide_hd_unload - Unload an IDE hard disk image
9999-------------------------------------------------*/
100100
101static void ide_hd_unload(mess_image *image)
101static void ide_hd_unload(const device_config *image)
102102{
103103   int which_bus, which_address;
104104   struct ide_interface *intf;
src/mess/devices/cartslot.c
r2166r2167
3030
3131
3232
33static int load_cartridge(const rom_entry *romrgn, const rom_entry *roment, mess_image *image)
33static int load_cartridge(const rom_entry *romrgn, const rom_entry *roment, const device_config *image)
3434{
3535   UINT32 region, flags;
3636   offs_t offset, length, read_length, pos = 0, len;
r2166r2167
111111
112112
113113
114static int process_cartridge(mess_image *image, mess_image *file)
114static int process_cartridge(const device_config *image, const device_config *file)
115115{
116116   const rom_entry *romrgn, *roment;
117117   int position = 0, result;
src/mess/devices/chd_cd.c
r2166r2167
6565   cdrom_file *cdrom_handle;
6666};
6767
68static struct mess_cd *get_drive(mess_image *img)
68static struct mess_cd *get_drive(const device_config *img)
6969{
7070   return image_lookuptag(img, MESSCDTAG);
7171}
r2166r2167
119119 *
120120 *************************************/
121121
122static int internal_load_mess_cd(mess_image *image, const char *metadata)
122static int internal_load_mess_cd(const device_config *image, const char *metadata)
123123{
124124   chd_error err = 0;
125125   struct mess_cd *cd;
r2166r2167
183183 *
184184 *************************************/
185185
186cdrom_file *mess_cd_get_cdrom_file(mess_image *image)
186cdrom_file *mess_cd_get_cdrom_file(const device_config *image)
187187{
188188   struct mess_cd *cd = get_drive(image);
189189   return cd->cdrom_handle;
r2166r2167
198198 *
199199 *************************************/
200200
201chd_file *mess_cd_get_chd_file(mess_image *image)
201chd_file *mess_cd_get_chd_file(const device_config *image)
202202{
203203   return NULL;   // not supported by the src/cdrom.c core at this time
204204}
src/mess/devices/chd_cd.h
r2166r2167
1414#include "cdrom.h"
1515
1616
17cdrom_file *mess_cd_get_cdrom_file(mess_image *image);
18chd_file *mess_cd_get_chd_file(mess_image *image);
17cdrom_file *mess_cd_get_cdrom_file(const device_config *image);
18chd_file *mess_cd_get_chd_file(const device_config *image);
1919
2020void cdrom_device_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info);
2121
src/mess/devices/mflopimg.c
r2166r2167
3131{
3232   floppy_image *floppy;
3333   int track;
34   void (*unload_proc)(mess_image *image);
35   int (*tracktranslate_proc)(mess_image *image, floppy_image *floppy, int physical_track);
34   void (*unload_proc)(const device_config *image);
35   int (*tracktranslate_proc)(const device_config *image, floppy_image *floppy, int physical_track);
3636};
3737
3838
r2166r2167
6464    IMPLEMENTATION
6565***************************************************************************/
6666
67static mess_flopimg *get_flopimg(mess_image *image)
67static mess_flopimg *get_flopimg(const device_config *image)
6868{
6969   return (mess_flopimg *) image_lookuptag(image, FLOPPY_TAG);
7070}
7171
7272
7373
74floppy_image *flopimg_get_image(mess_image *image)
74floppy_image *flopimg_get_image(const device_config *image)
7575{
7676   return get_flopimg(image)->floppy;
7777}
7878
7979
8080
81static void flopimg_seek_callback(mess_image *image, int physical_track)
81static void flopimg_seek_callback(const device_config *image, int physical_track)
8282{
8383   mess_flopimg *flopimg;
8484
r2166r2167
9595
9696
9797
98static int flopimg_get_sectors_per_track(mess_image *image, int side)
98static int flopimg_get_sectors_per_track(const device_config *image, int side)
9999{
100100   mess_flopimg *flopimg;
101101   floperr_t err;
r2166r2167
113113
114114
115115
116static void flopimg_get_id_callback(mess_image *image, chrn_id *id, int id_index, int side)
116static void flopimg_get_id_callback(const device_config *image, chrn_id *id, int id_index, int side)
117117{
118118   mess_flopimg *flopimg;
119119   int cylinder, sector, N;
r2166r2167
148148
149149
150150
151static void flopimg_read_sector_data_into_buffer(mess_image *image, int side, int index1, char *ptr, int length)
151static void flopimg_read_sector_data_into_buffer(const device_config *image, int side, int index1, char *ptr, int length)
152152{
153153   mess_flopimg *flopimg;
154154
r2166r2167
164164
165165
166166
167static void flopimg_write_sector_data_from_buffer(mess_image *image, int side, int index1, const char *ptr, int length,int ddam)
167static void flopimg_write_sector_data_from_buffer(const device_config *image, int side, int index1, const char *ptr, int length,int ddam)
168168{
169169   mess_flopimg *flopimg;
170170
r2166r2167
180180
181181
182182
183static void flopimg_read_track_data_info_buffer(mess_image *image, int side, void *ptr, int *length)
183static void flopimg_read_track_data_info_buffer(const device_config *image, int side, void *ptr, int *length)
184184{
185185   mess_flopimg *flopimg;
186186
r2166r2167
193193
194194
195195
196static void flopimg_write_track_data_info_buffer(mess_image *image, int side, const void *ptr, int *length)
196static void flopimg_write_track_data_info_buffer(const device_config *image, int side, const void *ptr, int *length)
197197{
198198   mess_flopimg *flopimg;
199199
r2166r2167
222222
223223static int image_fseek_thunk(void *file, INT64 offset, int whence)
224224{
225   return image_fseek((mess_image *) file, offset, whence);
225   return image_fseek((const device_config *) file, offset, whence);
226226}
227227
228228static size_t image_fread_thunk(void *file, void *buffer, size_t length)
229229{
230   return image_fread((mess_image *) file, buffer, length);
230   return image_fread((const device_config *) file, buffer, length);
231231}
232232
233233static size_t image_fwrite_thunk(void *file, const void *buffer, size_t length)
234234{
235   return image_fwrite((mess_image *) file, buffer, length);
235   return image_fwrite((const device_config *) file, buffer, length);
236236}
237237
238238static UINT64 image_fsize_thunk(void *file)
239239{
240   return image_length((mess_image *) file);
240   return image_length((const device_config *) file);
241241}
242242
243243/* ----------------------------------------------------------------------- */
r2166r2167
266266
267267
268268
269static int internal_floppy_device_load(mess_image *image, int create_format, option_resolution *create_args)
269static int internal_floppy_device_load(const device_config *image, int create_format, option_resolution *create_args)
270270{
271271   floperr_t err;
272272   mess_flopimg *flopimg;
r2166r2167
367367 *
368368 *************************************/
369369
370void floppy_install_unload_proc(mess_image *image, void (*proc)(mess_image *image))
370void floppy_install_unload_proc(const device_config *image, void (*proc)(const device_config *image))
371371{
372372   mess_flopimg *flopimg;
373373   flopimg = image_lookuptag(image, FLOPPY_TAG);
r2166r2167
376376
377377
378378
379void floppy_install_tracktranslate_proc(mess_image *image, int (*proc)(mess_image *image, floppy_image *floppy, int physical_track))
379void floppy_install_tracktranslate_proc(const device_config *image, int (*proc)(const device_config *image, floppy_image *floppy, int physical_track))
380380{
381381   mess_flopimg *flopimg;
382382   flopimg = image_lookuptag(image, FLOPPY_TAG);
src/mess/devices/mflopimg.h
r2166r2167
2121   MESS_DEVINFO_INT_KEEP_DRIVE_GEOMETRY = MESS_DEVINFO_INT_DEV_SPECIFIC
2222};
2323
24floppy_image *flopimg_get_image(mess_image *image);
24floppy_image *flopimg_get_image(const device_config *image);
2525
2626void floppy_device_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info);
2727
2828/* hack for apple II; replace this when we think of something better */
29void floppy_install_unload_proc(mess_image *image, void (*proc)(mess_image *image));
29void floppy_install_unload_proc(const device_config *image, void (*proc)(const device_config *image));
3030
3131/* hack for TI99; replace this when we think of something better */
32void floppy_install_tracktranslate_proc(mess_image *image, int (*proc)(mess_image *image, floppy_image *floppy, int physical_track));
32void floppy_install_tracktranslate_proc(const device_config *image, int (*proc)(const device_config *image, floppy_image *floppy, int physical_track));
3333
3434#endif /* MFLOPIMG_H */
src/mess/devices/dsk.c
r2166r2167
3434
3535static void dsk_disk_image_init(dsk_drive *);
3636
37static void dsk_seek_callback(mess_image *img, int physical_track);
38static void dsk_get_id_callback(mess_image *img, struct chrn_id *id, int id_index, int side);
39static int dsk_get_sectors_per_track(mess_image *img, int side);
37static void dsk_seek_callback(const device_config *img, int physical_track);
38static void dsk_get_id_callback(const device_config *img, struct chrn_id *id, int id_index, int side);
39static int dsk_get_sectors_per_track(const device_config *img, int side);
4040
41static void dsk_write_sector_data_from_buffer(mess_image *img, int sector_index, int side, const char *ptr, int length, int ddam);
42static void dsk_read_sector_data_into_buffer(mess_image *img, int sector_index, int side, char *ptr, int length);
41static void dsk_write_sector_data_from_buffer(const device_config *img, int sector_index, int side, const char *ptr, int length, int ddam);
42static void dsk_read_sector_data_into_buffer(const device_config *img, int sector_index, int side, char *ptr, int length);
4343
4444static const floppy_interface dsk_floppy_interface =
4545{
r2166r2167
5454
5555static dsk_drive drives[dsk_NUM_DRIVES]; /* the drives */
5656
57static dsk_drive *get_drive(mess_image *img)
57static dsk_drive *get_drive(const device_config *img)
5858{
5959   return &drives[image_index_in_device(img)];
6060}
r2166r2167
9898   return INIT_PASS;
9999}
100100
101static int dsk_save(mess_image *img, unsigned char **ptr)
101static int dsk_save(const device_config *img, unsigned char **ptr)
102102{
103103   int datasize;
104104   unsigned char *data;
r2166r2167
333333}
334334
335335
336static void dsk_seek_callback(mess_image *img, int physical_track)
336static void dsk_seek_callback(const device_config *img, int physical_track)
337337{
338338   get_drive(img)->current_track = physical_track;
339339}
340340
341static int get_track_offset(mess_image *img, int side)
341static int get_track_offset(const device_config *img, int side)
342342{
343343   dsk_drive *thedrive = get_drive(img);
344344   side = side & 0x01;
345345   return thedrive->track_offsets[(thedrive->current_track<<1) + side];
346346}
347347
348static unsigned char *get_floppy_data(mess_image *img)
348static unsigned char *get_floppy_data(const device_config *img)
349349{
350350   return get_drive(img)->data;
351351}
352352
353static void dsk_get_id_callback(mess_image *img, chrn_id *id, int id_index, int side)
353static void dsk_get_id_callback(const device_config *img, chrn_id *id, int id_index, int side)
354354{
355355   int id_offset;
356356   int track_offset;
r2166r2167
397397}
398398
399399
400static void dsk_set_ddam(mess_image *img, int id_index, int side, int ddam)
400static void dsk_set_ddam(const device_config *img, int id_index, int side, int ddam)
401401{
402402   int id_offset;
403403   int track_offset;
r2166r2167
432432}
433433
434434
435static char * dsk_get_sector_ptr_callback(mess_image *img, int sector_index, int side)
435static char * dsk_get_sector_ptr_callback(const device_config *img, int sector_index, int side)
436436{
437437   int track_offset;
438438   int sector_offset;
r2166r2167
480480   return (char *)(data + track_offset + sector_offset);
481481}
482482
483static void dsk_write_sector_data_from_buffer(mess_image *img, int side, int index1, const char *ptr, int length, int ddam)
483static void dsk_write_sector_data_from_buffer(const device_config *img, int side, int index1, const char *ptr, int length, int ddam)
484484{
485485   char * pSectorData;
486486
r2166r2167
495495   dsk_set_ddam(img, index1, side,ddam);
496496}
497497
498static void dsk_read_sector_data_into_buffer(mess_image *img, int side, int index1, char *ptr, int length)
498static void dsk_read_sector_data_into_buffer(const device_config *img, int side, int index1, char *ptr, int length)
499499{
500500   char *pSectorData;
501501
r2166r2167
505505      memcpy(ptr, pSectorData, length);
506506}
507507
508static int dsk_get_sectors_per_track(mess_image *img, int side)
508static int dsk_get_sectors_per_track(const device_config *img, int side)
509509{
510510   int track_offset;
511511   unsigned char *track_header;
src/mess/devices/appldriv.c
r2166r2167
4040
4141/* ----------------------------------------------------------------------- */
4242
43static void apple525_load_current_track(mess_image *image)
43static void apple525_load_current_track(const device_config *image)
4444{
4545   int len;
4646   struct apple525_disk *disk;
r2166r2167
5555
5656
5757
58static void apple525_save_current_track(mess_image *image, int unload)
58static void apple525_save_current_track(const device_config *image, int unload)
5959{
6060   int len;
6161   struct apple525_disk *disk;
r2166r2167
7474
7575
7676
77static void apple525_seek_disk(mess_image *img, struct apple525_disk *disk, signed int step)
77static void apple525_seek_disk(const device_config *img, struct apple525_disk *disk, signed int step)
7878{
7979   int track;
8080   int pseudo_track;
r2166r2167
104104
105105
106106
107static void apple525_disk_set_lines(mess_image *image, UINT8 new_state)
107static void apple525_disk_set_lines(const device_config *image, UINT8 new_state)
108108{
109109   struct apple525_disk *cur_disk;
110110   UINT8 old_state;
r2166r2167
148148void apple525_set_lines(UINT8 lines)
149149{
150150   int i, count;
151   mess_image *image;
151   const device_config *image;
152152
153153   count = device_count_tag_from_machine(Machine, APPLE525TAG);
154154
r2166r2167
166166
167167
168168/* reads/writes a byte; write_value is -1 for read only */
169static UINT8 apple525_process_byte(mess_image *img, int write_value)
169static UINT8 apple525_process_byte(const device_config *img, int write_value)
170170{
171171   UINT8 read_value;
172172   struct apple525_disk *disk;
r2166r2167
218218
219219
220220
221static mess_image *apple525_selected_image(void)
221static const device_config *apple525_selected_image(void)
222222{
223223   int i, count;
224224
r2166r2167
236236
237237UINT8 apple525_read_data(void)
238238{
239   mess_image *image;
239   const device_config *image;
240240   image = apple525_selected_image();
241241   return image ? apple525_process_byte(image, -1) : 0xFF;
242242}
r2166r2167
245245
246246void apple525_write_data(UINT8 data)
247247{
248   mess_image *image;
248   const device_config *image;
249249   image = apple525_selected_image();
250250   if (image)
251251      apple525_process_byte(image, data);
r2166r2167
256256int apple525_read_status(void)
257257{
258258   int i, count, result = 0;
259   mess_image *image;
259   const device_config *image;
260260
261261   count = device_count_tag_from_machine(Machine, APPLE525TAG);
262262
src/mess/devices/printer.c
r2166r2167
77#include "printer.h"
88
99
10int printer_status(mess_image *img, int newstatus)
10int printer_status(const device_config *img, int newstatus)
1111{
1212   /* if there is a file attached to it, it's online */
1313   return image_exists(img) != 0;
r2166r2167
1515
1616
1717
18void printer_output(mess_image *img, int data)
18void printer_output(const device_config *img, int data)
1919{
2020   if (image_exists(img))
2121   {
src/mess/devices/basicdsk.c
r2166r2167
2424typedef struct
2525{
2626   const char *image_name;       /* file name for disc image */
27   mess_image   *image_file;         /* file handle for disc image */
27   const device_config   *image_file;         /* file handle for disc image */
2828   int    mode;               /* open mode == 0 read only, != 0 read/write */
2929   unsigned long image_size;      /* size of image file */
3030
r2166r2167
5959
6060static basicdsk basicdsk_drives[basicdsk_MAX_DRIVES];
6161
62static void basicdsk_seek_callback(mess_image *img, int);
63static int basicdsk_get_sectors_per_track(mess_image *img, int);
64static void basicdsk_get_id_callback(mess_image *img,  chrn_id *, int, int);
65static void basicdsk_read_sector_data_into_buffer(mess_image *img, int side, int index1, char *ptr, int length);
66static void basicdsk_write_sector_data_from_buffer(mess_image *img, int side, int index1, const char *ptr, int length,int ddam);
62static void basicdsk_seek_callback(const device_config *img, int);
63static int basicdsk_get_sectors_per_track(const device_config *img, int);
64static void basicdsk_get_id_callback(const device_config *img,  chrn_id *, int, int);
65static void basicdsk_read_sector_data_into_buffer(const device_config *img, int side, int index1, char *ptr, int length);
66static void basicdsk_write_sector_data_from_buffer(const device_config *img, int side, int index1, const char *ptr, int length,int ddam);
6767
6868const floppy_interface basicdsk_floppy_interface =
6969{
r2166r2167
7676   NULL
7777};
7878
79static basicdsk *get_basicdsk(mess_image *img)
79static basicdsk *get_basicdsk(const device_config *img)
8080{
8181   int drive = image_index_in_device(img);
8282   assert(drive >= 0);
r2166r2167
118118
119119/* set data mark/deleted data mark for the sector specified. If ddam!=0, the sector will
120120have a deleted data mark, if ddam==0, the sector will have a data mark */
121void basicdsk_set_ddam(mess_image *img, UINT8 physical_track, UINT8 physical_side, UINT8 sector_id,UINT8 ddam)
121void basicdsk_set_ddam(const device_config *img, UINT8 physical_track, UINT8 physical_side, UINT8 sector_id,UINT8 ddam)
122122{
123123   unsigned long ddam_bit_offset, ddam_bit_index, ddam_byte_offset;
124124   basicdsk *pDisk = get_basicdsk(img);
r2166r2167
153153}
154154
155155/* get dam state for specified sector */
156static int basicdsk_get_ddam(mess_image *img, UINT8 physical_track, UINT8 physical_side, UINT8 sector_id)
156static int basicdsk_get_ddam(const device_config *img, UINT8 physical_track, UINT8 physical_side, UINT8 sector_id)
157157{
158158   unsigned long ddam_bit_offset, ddam_bit_index, ddam_byte_offset;
159159   basicdsk *pDisk = get_basicdsk(img);
r2166r2167
179179}
180180
181181
182void basicdsk_set_calcoffset(mess_image *img, unsigned long (*calcoffset)(UINT8 t, UINT8 h, UINT8 s,
182void basicdsk_set_calcoffset(const device_config *img, unsigned long (*calcoffset)(UINT8 t, UINT8 h, UINT8 s,
183183   UINT8 tracks, UINT8 heads, UINT8 sec_per_track, UINT16 sector_length, UINT8 first_sector_id, UINT16 offset_track_zero))
184184{
185185   basicdsk *pDisk = get_basicdsk(img);
r2166r2167
188188
189189/* dir_sector is a relative offset from the start of the disc,
190190dir_length is a relative offset from the start of the disc */
191void basicdsk_set_geometry(mess_image *img, UINT8 tracks, UINT8 heads, UINT8 sec_per_track, UINT16 sector_length, UINT8 first_sector_id, UINT16 offset_track_zero, int track_skipping)
191void basicdsk_set_geometry(const device_config *img, UINT8 tracks, UINT8 heads, UINT8 sec_per_track, UINT16 sector_length, UINT8 first_sector_id, UINT16 offset_track_zero, int track_skipping)
192192{
193193   unsigned long N;
194194   unsigned long ShiftCount;
r2166r2167
510510#endif
511511
512512
513static void basicdsk_get_id_callback(mess_image *img, chrn_id *id, int id_index, int side)
513static void basicdsk_get_id_callback(const device_config *img, chrn_id *id, int id_index, int side)
514514{
515515   basicdsk *w = get_basicdsk(img);
516516
r2166r2167
530530
531531}
532532
533static int basicdsk_get_sectors_per_track(mess_image *img, int side)
533static int basicdsk_get_sectors_per_track(const device_config *img, int side)
534534{
535535   basicdsk *w = get_basicdsk(img);
536536
r2166r2167
544544   return w->sec_per_track;
545545}
546546
547static void basicdsk_seek_callback(mess_image *img, int physical_track)
547static void basicdsk_seek_callback(const device_config *img, int physical_track)
548548{
549549   basicdsk *w = get_basicdsk(img);
550550   assert(w->track_divider);
551551   w->track = physical_track / w->track_divider;
552552}
553553
554static void basicdsk_write_sector_data_from_buffer(mess_image *img, int side, int index1, const char *ptr, int length, int ddam)
554static void basicdsk_write_sector_data_from_buffer(const device_config *img, int side, int index1, const char *ptr, int length, int ddam)
555555{
556556   basicdsk *w = get_basicdsk(img);
557557
r2166r2167
563563   basicdsk_set_ddam(img, w->track, side, index1, ddam);
564564}
565565
566static void basicdsk_read_sector_data_into_buffer(mess_image *img, int side, int index1, char *ptr, int length)
566static void basicdsk_read_sector_data_into_buffer(const device_config *img, int side, int index1, char *ptr, int length)
567567{
568568   basicdsk *w = get_basicdsk(img);
569569
src/mess/devices/coco_vhd.c
r2166r2167
5858static UINT8 vhd_status;
5959
6060
61static mess_image *vhd_image(void)
61static const device_config *vhd_image(void)
6262{
63   mess_image *image;
63   const device_config *image;
6464   image = image_from_devtype_and_index(IO_VHD, 0);
6565   return image_exists(image) ? image : NULL;
6666}
r2166r2167
8787
8888static void coco_vhd_readwrite(UINT8 data)
8989{
90   mess_image *vhdfile;
90   const device_config *vhdfile;
9191   int result;
9292   int phyOffset;
9393   UINT32 nBA = buffer_address;
src/mess/devices/bitbngr.c
r2166r2167
2929
3030static struct bitbanger_info *bitbangers[MAX_PRINTER];
3131
32static int bitbanger_init(mess_image *img)
32static int bitbanger_init(const device_config *img)
3333{
3434   int id = image_index_in_device(img);
3535   struct bitbanger_info *bi;
r2166r2167
124124
125125
126126
127void bitbanger_output(mess_image *img, int value)
127void bitbanger_output(const device_config *img, int value)
128128{
129129   int id = image_index_in_device(img);
130130   struct bitbanger_info *bi = bitbangers[id];
src/mess/devices/basicdsk.h
r2166r2167
4444  80-track drive, FALSE otherwise
4545*/
4646
47void basicdsk_set_geometry(mess_image *img, UINT8 tracks, UINT8 sides, UINT8 sec_per_track, UINT16 sector_length/*, UINT16 dir_sector, UINT16 dir_length*/, UINT8 first_sector_id, UINT16 offset_track_zero, int track_skipping);
47void basicdsk_set_geometry(const device_config *img, UINT8 tracks, UINT8 sides, UINT8 sec_per_track, UINT16 sector_length/*, UINT16 dir_sector, UINT16 dir_length*/, UINT8 first_sector_id, UINT16 offset_track_zero, int track_skipping);
4848
49void basicdsk_set_calcoffset(mess_image *img, unsigned long (*calcoffset)(UINT8 t, UINT8 h, UINT8 s,
49void basicdsk_set_calcoffset(const device_config *img, unsigned long (*calcoffset)(UINT8 t, UINT8 h, UINT8 s,
5050   UINT8 tracks, UINT8 heads, UINT8 sec_per_track, UINT16 sector_length, UINT8 first_sector_id, UINT16 offset_track_zero));
5151
5252/* set data mark/deleted data mark for the sector specified. If ddam!=0, the sector will
5353have a deleted data mark, if ddam==0, the sector will have a data mark */
54void basicdsk_set_ddam(mess_image *img, UINT8 physical_track, UINT8 physical_side, UINT8 sector_id,UINT8 ddam);
54void basicdsk_set_ddam(const device_config *img, UINT8 physical_track, UINT8 physical_side, UINT8 sector_id,UINT8 ddam);
5555
5656void legacybasicdsk_device_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info);
5757
src/mess/devices/printer.h
r2166r2167
1919#define MAX_PRINTER   (4)
2020
2121
22int printer_status(mess_image *img, int newstatus);
23void printer_output(mess_image *img, int data);
22int printer_status(const device_config *img, int newstatus);
23void printer_output(const device_config *img, int data);
2424
2525void printer_device_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info);
2626
src/mess/devices/thomflop.c
r2166r2167
119119
120120
121121/* build a sector, with header & space */
122static int thom_floppy_make_sector( mess_image* img, chrn_id id, UINT8* dst, int sector_size )
122static int thom_floppy_make_sector( const device_config* img, chrn_id id, UINT8* dst, int sector_size )
123123{
124124   if ( sector_size == 128 )
125125   {
r2166r2167
150150
151151
152152/* build a whole track */
153static int thom_floppy_make_track( mess_image* img, UINT8* dst, int sector_size, int side )
153static int thom_floppy_make_track( const device_config* img, UINT8* dst, int sector_size, int side )
154154{
155155   UINT8 space = ( sector_size == 128 ) ? 0xff : 0;
156156   UINT8* org = dst;
r2166r2167
226226
227227
228228/* build a sector, with header */
229static int thom_qdd_make_sector( mess_image* img, int sector, UINT8* dst )
229static int thom_qdd_make_sector( const device_config* img, int sector, UINT8* dst )
230230{
231231   int i;
232232   dst[ 0 ] = 0x5a;
r2166r2167
240240
241241
242242/* build a whole disk */
243static int thom_qdd_make_disk ( mess_image* img, UINT8* dst )
243static int thom_qdd_make_disk ( const device_config* img, UINT8* dst )
244244{
245245   UINT8* org = dst;
246246   int i;
r2166r2167
340340   wd17xx_reset();
341341   for ( i = 0; i < device_count( IO_FLOPPY ); i++ )
342342   {
343      mess_image * img = image_from_devtype_and_index( IO_FLOPPY, i );
343      const device_config * img = image_from_devtype_and_index( IO_FLOPPY, i );
344344      floppy_drive_set_ready_state( img, FLOPPY_DRIVE_READY, 0 );
345345      floppy_drive_set_rpm( img, 300. );
346346      floppy_drive_seek( img, - floppy_drive_get_current_track( img ) );
r2166r2167
441441   mc6843_reset();
442442   for ( i = 0; i < device_count( IO_FLOPPY ); i++ )
443443   {
444      mess_image * img = image_from_devtype_and_index( IO_FLOPPY, i );
444      const device_config * img = image_from_devtype_and_index( IO_FLOPPY, i );
445445      floppy_drive_set_ready_state( img, FLOPPY_DRIVE_READY, 0 );
446446      floppy_drive_set_rpm( img, 300. );
447447      floppy_drive_seek( img, - floppy_drive_get_current_track( img ) );
r2166r2167
529529
530530
531531
532static void to7_qdd_index_pulse_cb ( mess_image* img, int state )
532static void to7_qdd_index_pulse_cb ( const device_config* img, int state )
533533{
534534   to7qdd->index_pulse = state;
535535
r2166r2167
546546
547547
548548
549static mess_image * to7_qdd_image ( void )
549static const device_config * to7_qdd_image ( void )
550550{
551551   return image_from_devtype_and_index( IO_FLOPPY, 0 );
552552}
r2166r2167
729729   case 8: /* floppy status */
730730   {
731731      UINT8 data = 0;
732      mess_image* img = to7_qdd_image();
732      const device_config* img = to7_qdd_image();
733733      if ( ! image_exists( img ) )
734734         data |= 0x40; /* disk present */
735735      if ( to7qdd->index_pulse )
r2166r2167
847847
848848   for ( i = 0; i < device_count( IO_FLOPPY ); i++ )
849849   {
850      mess_image * img = image_from_devtype_and_index( IO_FLOPPY, i );
850      const device_config * img = image_from_devtype_and_index( IO_FLOPPY, i );
851851      floppy_drive_set_index_pulse_callback( img, to7_qdd_index_pulse_cb );
852852      floppy_drive_set_ready_state( img, FLOPPY_DRIVE_READY, 0 );
853853      floppy_drive_set_motor_state( img, 1 );
r2166r2167
944944
945945
946946
947static mess_image * thmfc_floppy_image ( void )
947static const device_config * thmfc_floppy_image ( void )
948948{
949949   return image_from_devtype_and_index( IO_FLOPPY, thmfc1->drive );
950950}
r2166r2167
958958
959959
960960
961static void thmfc_floppy_index_pulse_cb ( mess_image *img, int state )
961static void thmfc_floppy_index_pulse_cb ( const device_config *img, int state )
962962{
963963   if ( img != thmfc_floppy_image() )
964964      return;
r2166r2167
990990
991991static int thmfc_floppy_find_sector ( chrn_id* dst )
992992{
993   mess_image* img = thmfc_floppy_image();
993   const device_config* img = thmfc_floppy_image();
994994   chrn_id id;
995995   int r = 0;
996996
r2166r2167
10341034   if ( thmfc1->op == THMFC1_OP_WRITE_SECT )
10351035   {
10361036      /* TODO: detect ddam (?) */
1037      mess_image * img = thmfc_floppy_image();
1037      const device_config * img = thmfc_floppy_image();
10381038      floppy_drive_write_sector_data( img, thmfc1->side, thmfc1->sector, thmfc1->data + 3, thmfc1->data_size - 3, 0 );
10391039   }
10401040   thmfc1->op = THMFC1_OP_RESET;
r2166r2167
11761176         if ( i >= 0 )
11771177         {
11781178            /* got an id & a data field => write */
1179            mess_image * img = thmfc_floppy_image();
1179            const device_config * img = thmfc_floppy_image();
11801180            int sector = (int) thmfc1->data[ i + 1 ] * 256 +
11811181               (int) thmfc1->data[ i + 2 ];
11821182
r2166r2167
12361236         if ( !memcmp ( thmfc1->data, header, sizeof( header ) ) )
12371237         {
12381238            /* got id field => format */
1239            mess_image * img = thmfc_floppy_image();
1239            const device_config * img = thmfc_floppy_image();
12401240            UINT8 track  = thmfc1->data[4];
12411241            UINT8 side   = thmfc1->data[5];
12421242            UINT8 sector = thmfc1->data[6];
r2166r2167
12661266   case 1: /* STAT1 */
12671267   {
12681268      UINT8 data = 0;
1269      mess_image * img = thmfc_floppy_image();
1269      const device_config * img = thmfc_floppy_image();
12701270      int flags = floppy_drive_get_flag_state( img, -1 );
12711271      if ( thmfc_floppy_is_qdd() )
12721272      {
r2166r2167
14311431
14321432   case 2: /* CMD2 */
14331433   {
1434      mess_image * img;
1434      const device_config * img;
14351435      int seek = 0, motor;
14361436      thmfc1->drive = data & 2;
14371437
r2166r2167
15281528
15291529   for ( i = 0; i < device_count( IO_FLOPPY ); i++ )
15301530   {
1531      mess_image * img = image_from_devtype_and_index( IO_FLOPPY, i );
1531      const device_config * img = image_from_devtype_and_index( IO_FLOPPY, i );
15321532      floppy_drive_set_index_pulse_callback( img, thmfc_floppy_index_pulse_cb );
15331533      floppy_drive_set_ready_state( img, FLOPPY_DRIVE_READY, 0 );
15341534      floppy_drive_seek( img, - floppy_drive_get_current_track( img ) );
src/mess/devices/snapquik.c
r2166r2167
1515struct snapquick_info
1616{
1717   const struct IODevice *dev;
18   mess_image *img;
18   const device_config *img;
1919   int file_size;
2020   struct snapquick_info *next;
2121};
src/mess/devices/bitbngr.h
r2166r2167
1616struct bitbanger_config
1717{
1818   /* filter function; returns non-zero if input accepted */
19   int (*filter)(mess_image *img, const int *pulses, int total_pulses, int total_duration);
19   int (*filter)(const device_config *img, const int *pulses, int total_pulses, int total_duration);
2020   double pulse_threshhold;         /* the maximum duration pulse that we will consider */
2121   double pulse_tolerance;            /* deviation tolerance for pulses */
2222   int minimum_pulses;               /* the minimum amount of pulses before we start analyzing */
r2166r2167
3333};
3434
3535void bitbanger_device_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info);
36void bitbanger_output(mess_image *img, int value);
36void bitbanger_output(const device_config *img, int value);
3737
3838
3939#endif /* BITBNGR_H */
src/mess/configms.c
r2166r2167
2424{
2525   xml_data_node *node;
2626   const struct IODevice *dev;
27   mess_image *image;
27   const device_config *image;
2828   const char *dev_instance;
2929   const char *working_directory;
3030
r2166r2167
6565{
6666   xml_data_node *node;
6767   const struct IODevice *dev;
68   mess_image *image;
68   const device_config *image;
6969   const char *dev_instance;
7070
7171   /* only care about game-specific data */
src/mess/uimess.c
r2166r2167
8282   {
8383      if (dev->display != NULL)
8484      {
85         mess_image *img = image_from_device(dev);
85         const device_config *img = image_from_device(dev);
8686         dev->display(img);
8787      }
8888   }
r2166r2167
111111
112112   for (dev = mess_device_first_from_machine(machine); dev != NULL; dev = mess_device_next(dev))
113113   {
114         mess_image *img = image_from_device(dev);
114         const device_config *img = image_from_device(dev);
115115      const char *name = image_filename(img);
116116      if( name )
117117      {
src/mess/mess.c
r2166r2167
111111   const struct IODevice *dev;
112112   int result = INIT_FAIL;
113113   const char *image_name;
114   mess_image *image;
114   const device_config *image;
115115
116116   /* initialize natural keyboard support */
117117   inputx_init(machine);
src/mess/mess.h
r2166r2167
5757
5858#if HAS_WAVE
5959int tapecontrol(int selected);
60void tapecontrol_gettime(char *timepos, size_t timepos_size, mess_image *img, int *curpos, int *endpos);
60void tapecontrol_gettime(char *timepos, size_t timepos_size, const device_config *img, int *curpos, int *endpos);
6161#endif
6262
6363/* IODevice Initialisation return values.  Use these to determine if */
src/mess/tapectrl.c
r2166r2167
1313#include "mslegacy.h"
1414#include "devices/cassette.h"
1515
16void tapecontrol_gettime(char *timepos, size_t timepos_size, mess_image *img, int *curpos, int *endpos)
16void tapecontrol_gettime(char *timepos, size_t timepos_size, const device_config *img, int *curpos, int *endpos)
1717{
1818   double t0, t1;
1919
r2166r2167
3737   char timepos[32];
3838   ui_menu_item menu_item[40];
3939   char name[64];
40   mess_image *img;
40   const device_config *img;
4141
4242   int sel;
4343   int total;
src/mess/tools/messtest/testmess.c
r2166r2167
660660
661661static void command_image_loadcreate(running_machine *machine)
662662{
663   mess_image *image;
663   const device_config *image;
664664   int device_type;
665665   int device_slot;
666666   const char *device_tag;
r2166r2167
695695
696696   /* is an image format specified? */
697697   format = current_command->u.image_args.format;
698   if (format)
698   if (format != NULL)
699699   {
700700      if (current_command->command_type != MESSTEST_COMMAND_IMAGE_CREATE)
701701      {
r2166r2167
844844   size_t verify_data_size;
845845   size_t offset, offset_start, offset_end;
846846   const char *filename;
847   mess_image *image;
847   const device_config *image;
848848   FILE *f;
849849   UINT8 c;
850850   char filename_buf[512];
src/mess/tools/messtest/tststubs.c
r2166r2167
119119{
120120}
121121
122void osd_image_load_status_changed(mess_image *img, int is_final_unload)
122void osd_image_load_status_changed(const device_config *img, int is_final_unload)
123123{
124124}
125125#endif
src/mess/image.c
r2166r2167
701701    image_load - load an image into MESS
702702-------------------------------------------------*/
703703
704int image_load(mess_image *image, const char *path)
704int image_load(const device_config *image, const char *path)
705705{
706706   return image_load_internal(image, path, FALSE, 0, NULL);
707707}
r2166r2167
712712    image_create - create a MESS image
713713-------------------------------------------------*/
714714
715int image_create(mess_image *image, const char *path, int create_format, option_resolution *create_args)
715int image_create(const device_config *image, const char *path, int create_format, option_resolution *create_args)
716716{
717717   return image_load_internal(image, path, TRUE, create_format, create_args);
718718}
r2166r2167
778778    image_unload - main call to unload an image
779779-------------------------------------------------*/
780780
781void image_unload(mess_image *image)
781void image_unload(const device_config *image)
782782{
783783   image_slot_data *slot = find_image_slot(image);
784784   image_unload_internal(slot, FALSE);
r2166r2167
844844   error
845845-------------------------------------------------*/
846846
847const char *image_error(mess_image *image)
847const char *image_error(const device_config *image)
848848{
849849   static const char *const messages[] =
850850   {
r2166r2167
868868    image_seterror - specifies an error on an image
869869-------------------------------------------------*/
870870
871void image_seterror(mess_image *image, image_error_t err, const char *message)
871void image_seterror(const device_config *image, image_error_t err, const char *message)
872872{
873873   image_slot_data *slot = find_image_slot(image);
874874
r2166r2167
896896  raised if this happens
897897****************************************************************************/
898898
899void *image_alloctag(mess_image *image, const char *tag, size_t size)
899void *image_alloctag(const device_config *image, const char *tag, size_t size)
900900{
901901   image_slot_data *slot = find_image_slot(image);
902902   return tagpool_alloc(&slot->tagpool, tag, size);
r2166r2167
904904
905905
906906
907void *image_lookuptag(mess_image *image, const char *tag)
907void *image_lookuptag(const device_config *image, const char *tag)
908908{
909909   image_slot_data *slot = find_image_slot(image);
910910   return tagpool_lookup(&slot->tagpool, tag);
r2166r2167
949949
950950
951951
952static void run_hash(mess_image *image,
952static void run_hash(const device_config *image,
953953   void (*partialhash)(char *, const unsigned char *, unsigned long, unsigned int),
954954   char *dest, unsigned int hash_functions)
955955{
r2166r2167
10261026    image_device
10271027-------------------------------------------------*/
10281028
1029const struct IODevice *image_device(mess_image *image)
1029const struct IODevice *image_device(const device_config *image)
10301030{
10311031   return mess_device_from_core_device(image);
10321032}
r2166r2167
10371037    image_exists
10381038-------------------------------------------------*/
10391039
1040int image_exists(mess_image *image)
1040int image_exists(const device_config *image)
10411041{
10421042   return image_filename(image) != NULL;
10431043}
r2166r2167
10481048    image_slotexists
10491049-------------------------------------------------*/
10501050
1051int image_slotexists(mess_image *image)
1051int image_slotexists(const device_config *image)
10521052{
10531053   return TRUE;
10541054}
r2166r2167
10591059    image_filename
10601060-------------------------------------------------*/
10611061
1062const char *image_filename(mess_image *image)
1062const char *image_filename(const device_config *image)
10631063{
10641064   image_slot_data *slot = find_image_slot(image);
10651065   return slot->name;
r2166r2167
10711071    image_basename
10721072-------------------------------------------------*/
10731073
1074const char *image_basename(mess_image *image)
1074const char *image_basename(const device_config *image)
10751075{
10761076   return osd_basename((char *) image_filename(image));
10771077}
r2166r2167
10821082    image_basename_noext
10831083-------------------------------------------------*/
10841084
1085const char *image_basename_noext(mess_image *image)
1085const char *image_basename_noext(const device_config *image)
10861086{
10871087   const char *s;
10881088   char *ext;
r2166r2167
11081108    image_filetype
11091109-------------------------------------------------*/
11101110
1111const char *image_filetype(mess_image *image)
1111const char *image_filetype(const device_config *image)
11121112{
11131113   const char *s;
11141114   s = image_filename(image);
r2166r2167
11231123    image_filedir
11241124-------------------------------------------------*/
11251125
1126const char *image_filedir(mess_image *image)
1126const char *image_filedir(const device_config *image)
11271127{
11281128   image_slot_data *slot = find_image_slot(image);
11291129   return slot->dir;
r2166r2167
11351135    image_core_file
11361136-------------------------------------------------*/
11371137
1138core_file *image_core_file(mess_image *image)
1138core_file *image_core_file(const device_config *image)
11391139{
11401140   image_slot_data *slot = find_image_slot(image);
11411141   return slot->file;
r2166r2167
11471147    image_typename_id
11481148-------------------------------------------------*/
11491149
1150const char *image_typename_id(mess_image *image)
1150const char *image_typename_id(const device_config *image)
11511151{
11521152   const struct IODevice *dev;
11531153   int id;
r2166r2167
11751175    image_length
11761176-------------------------------------------------*/
11771177
1178UINT64 image_length(mess_image *image)
1178UINT64 image_length(const device_config *image)
11791179{
11801180   image_slot_data *slot = find_image_slot(image);
11811181   check_for_file(slot);
r2166r2167
11881188    image_hash
11891189-------------------------------------------------*/
11901190
1191const char *image_hash(mess_image *image)
1191const char *image_hash(const device_config *image)
11921192{
11931193   image_slot_data *slot = find_image_slot(image);
11941194   image_checkhash(slot);
r2166r2167
12011201    image_crc
12021202-------------------------------------------------*/
12031203
1204UINT32 image_crc(mess_image *image)
1204UINT32 image_crc(const device_config *image)
12051205{
12061206   const char *hash_string;
12071207   UINT32 crc = 0;
r2166r2167
12191219    image_is_writable
12201220-------------------------------------------------*/
12211221
1222int image_is_writable(mess_image *image)
1222int image_is_writable(const device_config *image)
12231223{
12241224   image_slot_data *slot = find_image_slot(image);
12251225   return slot->writeable;
r2166r2167
12311231    image_has_been_created
12321232-------------------------------------------------*/
12331233
1234int image_has_been_created(mess_image *image)
1234int image_has_been_created(const device_config *image)
12351235{
12361236   image_slot_data *slot = find_image_slot(image);
12371237   return slot->created;
r2166r2167
12431243    image_make_readonly
12441244-------------------------------------------------*/
12451245
1246void image_make_readonly(mess_image *image)
1246void image_make_readonly(const device_config *image)
12471247{
12481248   image_slot_data *slot = find_image_slot(image);
12491249   slot->writeable = 0;
r2166r2167
12551255    image_fread
12561256-------------------------------------------------*/
12571257
1258UINT32 image_fread(mess_image *image, void *buffer, UINT32 length)
1258UINT32 image_fread(const device_config *image, void *buffer, UINT32 length)
12591259{
12601260   image_slot_data *slot = find_image_slot(image);
12611261   check_for_file(slot);
r2166r2167
12681268    image_fwrite
12691269-------------------------------------------------*/
12701270
1271UINT32 image_fwrite(mess_image *image, const void *buffer, UINT32 length)
1271UINT32 image_fwrite(const device_config *image, const void *buffer, UINT32 length)
12721272{
12731273   image_slot_data *slot = find_image_slot(image);
12741274   check_for_file(slot);
r2166r2167
12811281    image_fseek
12821282-------------------------------------------------*/
12831283
1284int image_fseek(mess_image *image, INT64 offset, int whence)
1284int image_fseek(const device_config *image, INT64 offset, int whence)
12851285{
12861286   image_slot_data *slot = find_image_slot(image);
12871287   check_for_file(slot);
r2166r2167
12941294    image_ftell
12951295-------------------------------------------------*/
12961296
1297UINT64 image_ftell(mess_image *image)
1297UINT64 image_ftell(const device_config *image)
12981298{
12991299   image_slot_data *slot = find_image_slot(image);
13001300   check_for_file(slot);
r2166r2167
13071307    image_fgetc
13081308-------------------------------------------------*/
13091309
1310int image_fgetc(mess_image *image)
1310int image_fgetc(const device_config *image)
13111311{
13121312   char ch;
13131313   if (image_fread(image, &ch, 1) != 1)
r2166r2167
13211321    image_feof
13221322-------------------------------------------------*/
13231323
1324int image_feof(mess_image *image)
1324int image_feof(const device_config *image)
13251325{
13261326   image_slot_data *slot = find_image_slot(image);
13271327   check_for_file(slot);
r2166r2167
13341334    image_ptr
13351335-------------------------------------------------*/
13361336
1337void *image_ptr(mess_image *image)
1337void *image_ptr(const device_config *image)
13381338{
13391339   image_slot_data *slot = find_image_slot(image);
13401340   check_for_file(slot);
r2166r2167
14361436   valid even if not mounted
14371437-------------------------------------------------*/
14381438
1439const char *image_working_directory(mess_image *image)
1439const char *image_working_directory(const device_config *image)
14401440{
14411441   image_slot_data *slot = find_image_slot(image);
14421442
r2166r2167
14541454   directory to use for this image
14551455-------------------------------------------------*/
14561456
1457void image_set_working_directory(mess_image *image, const char *working_directory)
1457void image_set_working_directory(const device_config *image, const char *working_directory)
14581458{
14591459   image_slot_data *slot = find_image_slot(image);
14601460
r2166r2167
14741474  able to eliminate the need for a unload function.
14751475****************************************************************************/
14761476
1477void *image_malloc(mess_image *image, size_t size)
1477void *image_malloc(const device_config *image, size_t size)
14781478{
14791479   return image_realloc(image, NULL, size);
14801480}
14811481
14821482
14831483
1484void *image_realloc(mess_image *image, void *ptr, size_t size)
1484void *image_realloc(const device_config *image, void *ptr, size_t size)
14851485{
14861486   image_slot_data *slot = find_image_slot(image);
14871487
r2166r2167
14931493
14941494
14951495
1496char *image_strdup(mess_image *image, const char *src)
1496char *image_strdup(const device_config *image, const char *src)
14971497{
14981498   image_slot_data *slot = find_image_slot(image);
14991499
r2166r2167
15051505
15061506
15071507
1508void image_freeptr(mess_image *image, void *ptr)
1508void image_freeptr(const device_config *image, void *ptr)
15091509{
15101510   /* should really do something better here */
15111511   image_realloc(image, ptr, 0);
r2166r2167
15201520  pertaining to that image in the CRC database
15211521****************************************************************************/
15221522
1523const char *image_longname(mess_image *image)
1523const char *image_longname(const device_config *image)
15241524{
15251525   image_slot_data *slot = find_image_slot(image);
15261526   image_checkhash(slot);
r2166r2167
15291529
15301530
15311531
1532const char *image_manufacturer(mess_image *image)
1532const char *image_manufacturer(const device_config *image)
15331533{
15341534   image_slot_data *slot = find_image_slot(image);
15351535   image_checkhash(slot);
r2166r2167
15381538
15391539
15401540
1541const char *image_year(mess_image *image)
1541const char *image_year(const device_config *image)
15421542{
15431543   image_slot_data *slot = find_image_slot(image);
15441544   image_checkhash(slot);
r2166r2167
15471547
15481548
15491549
1550const char *image_playable(mess_image *image)
1550const char *image_playable(const device_config *image)
15511551{
15521552   image_slot_data *slot = find_image_slot(image);
15531553   image_checkhash(slot);
r2166r2167
15561556
15571557
15581558
1559const char *image_extrainfo(mess_image *image)
1559const char *image_extrainfo(const device_config *image)
15601560{
15611561   image_slot_data *slot = find_image_slot(image);
15621562   image_checkhash(slot);
r2166r2167
15771577   NVRAM file for an image
15781578-------------------------------------------------*/
15791579
1580static file_error open_battery_file(mess_image *image, UINT32 openflags, mame_file **file)
1580static file_error open_battery_file(const device_config *image, UINT32 openflags, mame_file **file)
15811581{
15821582   file_error filerr;
15831583   char *basename_noext;
r2166r2167
16001600   backed RAM for an image
16011601-------------------------------------------------*/
16021602
1603void image_battery_load(mess_image *image, void *buffer, int length)
1603void image_battery_load(const device_config *image, void *buffer, int length)
16041604{
16051605   file_error filerr;
16061606   mame_file *file;
r2166r2167
16271627   backed RAM for an image
16281628-------------------------------------------------*/
16291629
1630void image_battery_save(mess_image *image, const void *buffer, int length)
1630void image_battery_save(const device_config *image, const void *buffer, int length)
16311631{
16321632   file_error filerr;
16331633   mame_file *file;
r2166r2167
16511651  These provide various ways of indexing images
16521652****************************************************************************/
16531653
1654int image_absolute_index(mess_image *image)
1654int image_absolute_index(const device_config *image)
16551655{
16561656   image_slot_data *slot = find_image_slot(image);
16571657   return slot - image->machine->images_data->slots;
r2166r2167
16591659
16601660
16611661
1662mess_image *image_from_absolute_index(int absolute_index)
1662const device_config *image_from_absolute_index(int absolute_index)
16631663{
16641664   return Machine->images_data->slots[absolute_index].dev;
16651665}
r2166r2167
16741674  type/id.
16751675****************************************************************************/
16761676
1677mess_image *image_from_device(const struct IODevice *device)
1677const device_config *image_from_device(const struct IODevice *device)
16781678{
16791679   return device->devconfig;
16801680}
16811681
16821682
16831683
1684mess_image *image_from_devtag_and_index(const char *devtag, int id)
1684const device_config *image_from_devtag_and_index(const char *devtag, int id)
16851685{
16861686   int indx;
1687   mess_image *image = NULL;
1687   const device_config *image = NULL;
16881688   const struct IODevice *dev;
16891689   int device_index;
16901690
r2166r2167
17061706
17071707
17081708
1709mess_image *image_from_devtype_and_index(iodevice_t type, int id)
1709const device_config *image_from_devtype_and_index(iodevice_t type, int id)
17101710{
17111711   int indx;
1712   mess_image *image = NULL;
1712   const device_config *image = NULL;
17131713   const struct IODevice *dev;
17141714   int device_index;
17151715
r2166r2167
17341734
17351735
17361736
1737iodevice_t image_devtype(mess_image *image)
1737iodevice_t image_devtype(const device_config *image)
17381738{
17391739   const struct IODevice *iodev = mess_device_from_core_device(image);
17401740   assert(iodev != NULL);
r2166r2167
17431743
17441744
17451745
1746int image_index_in_device(mess_image *image)
1746int image_index_in_device(const device_config *image)
17471747{
17481748   const struct IODevice *iodev = mess_device_from_core_device(image);
17491749   assert(iodev != NULL);
src/mess/includes/d88.h
r2166r2167
3030
3131typedef struct
3232{
33   mess_image   *image_file;         /* file handle for disc image */
33   const device_config   *image_file;         /* file handle for disc image */
3434   int    mode;            /* open mode == 0 read only, != 0 read/write */
3535   unsigned long image_size;      /* size of image file */
3636
src/mess/includes/serial.h
r2166r2167
296296/* connect this device to the emulated serial chip */
297297/* id is the serial device to connect to */
298298/* connection is the serial connection to connect to the serial device */
299void serial_device_connect(mess_image *image, struct serial_connection *connection);
299void serial_device_connect(const device_config *image, struct serial_connection *connection);
300300
301301/* init this device */
302int serial_device_init(mess_image *image);
303int serial_device_load(mess_image *image);
304void serial_device_unload(mess_image *image);
302int serial_device_init(const device_config *image);
303int serial_device_load(const device_config *image);
304void serial_device_unload(const device_config *image);
305305
306void serial_device_setup(mess_image *image, int baud_rate, int num_data_bits, int stop_bit_count, int parity_code);
306void serial_device_setup(const device_config *image, int baud_rate, int num_data_bits, int stop_bit_count, int parity_code);
307307
308308/* get name of protocol identified by specified id */
309309const char *serial_device_get_protocol_name(int protocol_id);
310310
311311/* set the protocol to be used by the serial device */
312void serial_device_set_protocol(mess_image *image, int protocol_id);
312void serial_device_set_protocol(const device_config *image, int protocol_id);
313313/* set the transmit state of the serial device */
314void serial_device_set_transmit_state(mess_image *image, int state);
314void serial_device_set_transmit_state(const device_config *image, int state);
315315
316316/***********************************************************************************************/
317317/* XModem protocol */
src/mess/includes/thomson.h
r2166r2167
4646
4747
4848/* serial */
49extern int  thom_serial_init   ( mess_image* image );
50extern int  thom_serial_load   ( mess_image* image );
51extern void thom_serial_unload ( mess_image* image );
49extern int  thom_serial_init   ( const device_config* image );
50extern int  thom_serial_load   ( const device_config* image );
51extern void thom_serial_unload ( const device_config* image );
5252
5353
5454/***************************** TO7 / T9000 *************************/
5555
5656/* cartridge bank-switching */
57extern int to7_cartridge_load ( mess_image* image );
57extern int to7_cartridge_load ( const device_config* image );
5858extern WRITE8_HANDLER ( to7_cartridge_w );
5959extern READ8_HANDLER  ( to7_cartridge_r );
6060
r2166r2167
8787extern WRITE8_HANDLER ( mo5_gatearray_w );
8888
8989/* cartridge / extended RAM bank-switching */
90extern int mo5_cartridge_load ( mess_image* image );
90extern int mo5_cartridge_load ( const device_config* image );
9191extern WRITE8_HANDLER ( mo5_ext_w );
9292extern WRITE8_HANDLER ( mo5_cartridge_w );
9393extern READ8_HANDLER  ( mo5_cartridge_r );
src/mess/image.h
r2166r2167
3434
3535
3636/****************************************************************************
37  A mess_image pointer represents one device entry; this could be an instance
37  A const device_config pointer represents one device entry; this could be an instance
3838  of a floppy drive or a printer.  The defining property is that either at
3939  startup or at runtime, it can become associated with a file on the hosting
4040  machine (for the examples above, a disk image or printer output file
41  repsectively).  In fact, mess_image might be better renamed mess_device.
41  repsectively).  In fact, const device_config might be better renamed mess_device.
4242
4343  MESS drivers declare what device types each system had and how many.  For
44  each of these, a mess_image is allocated.  Devices can have init functions
44  each of these, a const device_config is allocated.  Devices can have init functions
4545  that allow the devices to set up any relevant internal data structures.
4646  It is recommended that devices use the tag allocation system described
4747  below.
r2166r2167
6565****************************************************************************/
6666
6767/* can be called by front ends */
68int image_load(mess_image *img, const char *name);
69int image_create(mess_image *img, const char *name, int create_format, option_resolution *create_args);
70void image_unload(mess_image *img);
68int image_load(const device_config *img, const char *name);
69int image_create(const device_config *img, const char *name, int create_format, option_resolution *create_args);
70void image_unload(const device_config *img);
7171
7272/* used to retrieve error information during image loading */
73const char *image_error(mess_image *img);
73const char *image_error(const device_config *img);
7474
7575/* used for driver init and machine init */
7676void image_unload_all(int ispreload);
7777
7878/* used to set the error that occured during image loading */
79void image_seterror(mess_image *img, image_error_t err, const char *message);
79void image_seterror(const device_config *img, image_error_t err, const char *message);
8080
8181
8282
r2166r2167
9494  raised if this happens
9595****************************************************************************/
9696
97void *image_alloctag(mess_image *img, const char *tag, size_t size);
98void *image_lookuptag(mess_image *img, const char *tag);
97void *image_alloctag(const device_config *img, const char *tag, size_t size);
98void *image_lookuptag(const device_config *img, const char *tag);
9999
100100
101101
r2166r2167
105105  These provide information about the device; and about the mounted image
106106****************************************************************************/
107107
108const struct IODevice *image_device(mess_image *image);
109int image_exists(mess_image *image);
110int image_slotexists(mess_image *image);
108const struct IODevice *image_device(const device_config *image);
109int image_exists(const device_config *image);
110int image_slotexists(const device_config *image);
111111
112core_file *image_core_file(mess_image *image);
113const char *image_typename_id(mess_image *image);
114const char *image_filename(mess_image *image);
115const char *image_basename(mess_image *image);
116const char *image_basename_noext(mess_image *image);
117const char *image_filetype(mess_image *image);
118const char *image_filedir(mess_image *image);
119const char *image_working_directory(mess_image *image);
120void image_set_working_directory(mess_image *image, const char *working_directory);
121UINT64 image_length(mess_image *image);
122const char *image_hash(mess_image *image);
123UINT32 image_crc(mess_image *image);
112core_file *image_core_file(const device_config *image);
113const char *image_typename_id(const device_config *image);
114const char *image_filename(const device_config *image);
115const char *image_basename(const device_config *image);
116const char *image_basename_noext(const device_config *image);
117const char *image_filetype(const device_config *image);
118const char *image_filedir(const device_config *image);
119const char *image_working_directory(const device_config *image);
120void image_set_working_directory(const device_config *image, const char *working_directory);
121UINT64 image_length(const device_config *image);
122const char *image_hash(const device_config *image);
123UINT32 image_crc(const device_config *image);
124124
125int image_is_writable(mess_image *image);
126int image_has_been_created(mess_image *image);
127void image_make_readonly(mess_image *image);
125int image_is_writable(const device_config *image);
126int image_has_been_created(const device_config *image);
127void image_make_readonly(const device_config *image);
128128
129UINT32 image_fread(mess_image *image, void *buffer, UINT32 length);
130UINT32 image_fwrite(mess_image *image, const void *buffer, UINT32 length);
131int image_fseek(mess_image *image, INT64 offset, int whence);
132UINT64 image_ftell(mess_image *image);
133int image_fgetc(mess_image *image);
134int image_feof(mess_image *image);
129UINT32 image_fread(const device_config *image, void *buffer, UINT32 length);
130UINT32 image_fwrite(const device_config *image, const void *buffer, UINT32 length);
131int image_fseek(const device_config *image, INT64 offset, int whence);
132UINT64 image_ftell(const device_config *image);
133int image_fgetc(const device_config *image);
134int image_feof(const device_config *image);
135135
136void *image_ptr(mess_image *image);
136void *image_ptr(const device_config *image);
137137
138138
139139
r2166r2167
145145  able to eliminate the need for a unload function.
146146****************************************************************************/
147147
148void *image_malloc(mess_image *img, size_t size) ATTR_MALLOC;
149char *image_strdup(mess_image *img, const char *src) ATTR_MALLOC;
150void *image_realloc(mess_image *img, void *ptr, size_t size);
151void image_freeptr(mess_image *img, void *ptr);
148void *image_malloc(const device_config *img, size_t size) ATTR_MALLOC;
149char *image_strdup(const device_config *img, const char *src) ATTR_MALLOC;
150void *image_realloc(const device_config *img, void *ptr, size_t size);
151void image_freeptr(const device_config *img, void *ptr);
152152
153153
154154
r2166r2167
159159  pertaining to that image in the CRC database
160160****************************************************************************/
161161
162const char *image_longname(mess_image *img);
163const char *image_manufacturer(mess_image *img);
164const char *image_year(mess_image *img);
165const char *image_playable(mess_image *img);
166const char *image_extrainfo(mess_image *img);
162const char *image_longname(const device_config *img);
163const char *image_manufacturer(const device_config *img);
164const char *image_year(const device_config *img);
165const char *image_playable(const device_config *img);
166const char *image_extrainfo(const device_config *img);
167167
168168
169169
r2166r2167
174174  image; typically for cartridges.
175175****************************************************************************/
176176
177void image_battery_load(mess_image *img, void *buffer, int length);
178void image_battery_save(mess_image *img, const void *buffer, int length);
177void image_battery_load(const device_config *img, void *buffer, int length);
178void image_battery_save(const device_config *img, const void *buffer, int length);
179179
180180
181181
r2166r2167
185185  These provide various ways of indexing images
186186****************************************************************************/
187187
188int image_absolute_index(mess_image *image);
189mess_image *image_from_absolute_index(int absolute_index);
188int image_absolute_index(const device_config *image);
189const device_config *image_from_absolute_index(int absolute_index);
190190
191191
192192
r2166r2167
198198  type/id.
199199****************************************************************************/
200200
201int image_index_in_device(mess_image *img);
202mess_image *image_from_device(const struct IODevice *dev);
203mess_image *image_from_devtag_and_index(const char *devtag, int id);
201int image_index_in_device(const device_config *img);
202const device_config *image_from_device(const struct IODevice *dev);
203const device_config *image_from_devtag_and_index(const char *devtag, int id);
204204
205205/* deprecated; as there can be multiple devices of a certain type */
206iodevice_t image_devtype(mess_image *img);
207mess_image *image_from_devtype_and_index(iodevice_t type, int id);
206iodevice_t image_devtype(const device_config *img);
207const device_config *image_from_devtype_and_index(iodevice_t type, int id);
208208
209209
210210
r2166r2167
213213  Macros for declaring device callbacks
214214****************************************************************************/
215215
216#define   DEVICE_INIT(name)   int device_init_##name(mess_image *image)
217#define DEVICE_EXIT(name)   void device_exit_##name(mess_image *image)
218#define DEVICE_LOAD(name)   int device_load_##name(mess_image *image)
219#define DEVICE_CREATE(name)   int device_create_##name(mess_image *image, int create_format, option_resolution *create_args)
220#define DEVICE_UNLOAD(name)   void device_unload_##name(mess_image *image)
216#define   DEVICE_INIT(name)   int device_init_##name(const device_config *image)
217#define DEVICE_EXIT(name)   void device_exit_##name(const device_config *image)
218#define DEVICE_LOAD(name)   int device_load_##name(const device_config *image)
219#define DEVICE_CREATE(name)   int device_create_##name(const device_config *image, int create_format, option_resolution *create_args)
220#define DEVICE_UNLOAD(name)   void device_unload_##name(const device_config *image)
221221
222222#endif /* IMAGE_H */
src/mess/filemngr.c
r2166r2167
640640   char names[40][64];
641641   int sel, total, arrowize;
642642   const struct IODevice *dev;
643   mess_image *image;
643   const device_config *image;
644644
645645   sel = selected - 1;
646646   total = 0;
src/mess/device.h
r2166r2167
9191
9292struct IODevice;
9393
94typedef int (*device_init_handler)(mess_image *image);
95typedef void (*device_exit_handler)(mess_image *image);
96typedef int (*device_load_handler)(mess_image *image);
97typedef int (*device_create_handler)(mess_image *image, int format_type, option_resolution *format_options);
98typedef void (*device_unload_handler)(mess_image *image);
94typedef int (*device_init_handler)(const device_config *image);
95typedef void (*device_exit_handler)(const device_config *image);
96typedef int (*device_load_handler)(const device_config *image);
97typedef int (*device_create_handler)(const device_config *image, int format_type, option_resolution *format_options);
98typedef void (*device_unload_handler)(const device_config *image);
9999typedef int (*device_verify_handler)(const UINT8 *buf, size_t size);
100100typedef void (*device_partialhash_handler)(char *, const unsigned char *, unsigned long, unsigned int);
101101typedef void (*device_getdispositions_handler)(const struct IODevice *dev, int id,
102102   unsigned int *readable, unsigned int *writeable, unsigned int *creatable);
103typedef void (*device_display_handler)(mess_image *image);
103typedef void (*device_display_handler)(const device_config *image);
104104typedef const char *(*device_getname_handler)(const struct IODevice *dev, int id, char *buf, size_t bufsize);
105105
106106struct _mess_device_class;
r2166r2167
268268   device_partialhash_handler partialhash;
269269
270270   /* cosmetic/UI callbacks */
271   void (*display)(mess_image *img);
271   void (*display)(const device_config *img);
272272   const char *(*name)(const struct IODevice *dev, int id, char *buf, size_t bufsize);
273273
274274   /* image creation options */
src/mess/osd/windows/menu.c
r2166r2167
818818//   change_device
819819//============================================================
820820
821static void change_device(HWND wnd, mess_image *img, int is_save)
821static void change_device(HWND wnd, const device_config *img, int is_save)
822822{
823823   dialog_box *dialog = NULL;
824824   char filter[2048];
r2166r2167
12181218   UINT flags;
12191219   UINT flags_for_exists;
12201220   UINT flags_for_writing;
1221   mess_image *img;
1221   const device_config *img;
12221222   int has_config, has_dipswitch, has_keyboard, has_analog, has_misc;
12231223   const input_port_entry *in;
12241224   UINT16 in_cat_value = 0;
r2166r2167
14721472//   device_command
14731473//============================================================
14741474
1475static void device_command(HWND wnd, mess_image *img, int devoption)
1475static void device_command(HWND wnd, const device_config *img, int devoption)
14761476{
14771477   switch(devoption)
14781478   {
r2166r2167
15961596//   decode_deviceoption
15971597//============================================================
15981598
1599static mess_image *decode_deviceoption(int command, int *devoption)
1599static const device_config *decode_deviceoption(int command, int *devoption)
16001600{
16011601   int absolute_index;
16021602
r2166r2167
16461646{
16471647   int handled = 1;
16481648   int dev_command, i;
1649   mess_image *img;
1649   const device_config *img;
16501650   int port_count;
16511651   UINT16 setting, category;
16521652   input_port_entry *in;
src/mess/osd/windows/tapedlg.c
r2166r2167
5757   int id;
5858   int curpos, endpos;
5959   char tapestatus[32];
60   mess_image *img;
60   const device_config *img;
6161
6262   dlg = get_tapedialog(dialog);
6363   id = dlg - tape_dialogs;
src/mess/messopts.c
r2166r2167
205205static void extract_device_options_for_device(core_options *opts, const game_driver *gamedrv,
206206   const mess_device_class *devclass, int device_index, int global_index)
207207{
208   mess_image *image;
208   const device_config *image;
209209   iodevice_t dev_type;
210210   const char *dev_tag;
211211   const char *dev_name;
src/mess/artworkx.c
r2166r2167
2727
2828/**************************************************************************/
2929
30void artwork_use_device_art(mess_image *img, const char *defaultartfile)
30void artwork_use_device_art(const device_config *img, const char *defaultartfile)
3131{
3232   const char *strs[3];
3333   int len, pos, i;
src/mess/osdmess.h
r2166r2167
1515#include "devintrf.h"
1616
1717struct _mame_file;
18typedef const device_config mess_image;
1918
2019
2120
src/mess/machine/cbm.c
r2166r2167
66#include "devices/cartslot.h"
77
88
9static int general_cbm_loadsnap(mess_image *image, const char *file_type, int snapshot_size,
9static int general_cbm_loadsnap(const device_config *image, const char *file_type, int snapshot_size,
1010   offs_t offset, void (*cbm_sethiaddress)(UINT16 hiaddress))
1111{
1212   char buffer[7];
src/mess/machine/pdp1.c
r2166r2167
7979/* tape reader registers */
8080typedef struct tape_reader_t
8181{
82   mess_image *fd;   /* file descriptor of tape image */
82   const device_config *fd;   /* file descriptor of tape image */
8383
8484   int motor_on;   /* 1-bit reader motor on */
8585
r2166r2167
9898/* tape puncher registers */
9999typedef struct tape_puncher_t
100100{
101   mess_image *fd;   /* file descriptor of tape image */
101   const device_config *fd;   /* file descriptor of tape image */
102102
103103   emu_timer *timer;   /* timer to generate completion pulses */
104104} tape_puncher_t;
r2166r2167
109109/* typewriter registers */
110110typedef struct typewriter_t
111111{
112   mess_image *fd;   /* file descriptor of output image */
112   const device_config *fd;   /* file descriptor of output image */
113113
114114   int tb;         /* typewriter buffer */
115115
r2166r2167
129129/* MIT parallel drum (mostly similar to type 23) */
130130typedef struct parallel_drum_t
131131{
132   mess_image *fd;   /* file descriptor of drum image */
132   const device_config *fd;   /* file descriptor of drum image */
133133
134134   int il;         /* initial location (12-bit) */
135135   int wc;         /* word counter (12-bit) */
src/mess/machine/nec765.c
r2166r2167
141141
142142
143143
144static mess_image *current_image(void)
144static const device_config *current_image(void)
145145{
146   mess_image *image = NULL;
146   const device_config *image = NULL;
147147
148148   if (!nec765_iface.get_image)
149149   {
r2166r2167
257257      This indicates it is always ready!!!!!
258258   */
259259
260   mess_image *img = current_image();
260   const device_config *img = current_image();
261261
262262   if (!img)
263263      return;
r2166r2167
434434
435435static void nec765_seek_setup(int is_recalibrate)
436436{
437   mess_image *img;
437   const device_config *img;
438438   int signed_tracks;
439439
440440   fdc.nec765_flags |= NEC765_SEEK_ACTIVE;
r2166r2167
654654/* done when ready state of drive changes */
655655/* this ignores if command is active, in which case command should terminate immediatly
656656with error */
657static void nec765_set_ready_change_callback(mess_image *img, int state)
657static void nec765_set_ready_change_callback(const device_config *img, int state)
658658{
659659   int drive = image_index_in_device(img);
660660
r2166r2167
800800
801801static void nec765_get_next_id(chrn_id *id)
802802{
803   mess_image *img = current_image();
803   const device_config *img = current_image();
804804
805805   /* get next id from disc */
806806   floppy_drive_get_next_id(img, fdc.side,id);
r2166r2167
817817
818818static int nec765_get_matching_sector(void)
819819{
820   mess_image *img = current_image();
820   const device_config *img = current_image();
821821   chrn_id id;
822822
823823   /* number of times we have seen index hole */
r2166r2167
928928
929929static void nec765_read_data(void)
930930{
931   mess_image *img = current_image();
931   const device_config *img = current_image();
932932
933933   if (!(floppy_drive_get_flag_state(img, FLOPPY_DRIVE_READY)))
934934   {
r2166r2167
10101010
10111011static void nec765_format_track(void)
10121012{
1013   mess_image *img = current_image();
1013   const device_config *img = current_image();
10141014
10151015   /* write protected? */
10161016   if (floppy_drive_get_flag_state(img, FLOPPY_DRIVE_DISK_WRITE_PROTECTED))
r2166r2167
17711771      "Lock"                  /* [14] */
17721772   };
17731773
1774   mess_image *img = current_image();
1774   const device_config *img = current_image();
17751775   const char *cmd = NULL;
17761776   chrn_id id;
17771777
src/mess/machine/nec765.h
r2166r2167
3333   void   (*dma_drq)(int state,int read_write);
3434
3535   /* image lookup */
36   mess_image *(*get_image)(int floppy_index);
36   const device_config *(*get_image)(int floppy_index);
3737} nec765_interface;
3838
3939/* init nec765 interface */
src/mess/machine/apple2gs.c
r2166r2167
147147static UINT8 apple2gs_mouse_y;
148148static INT8 apple2gs_mouse_dx;
149149static INT8 apple2gs_mouse_dy;
150static mess_image *apple2gs_cur_slot6_image;
150static const device_config *apple2gs_cur_slot6_image;
151151static emu_timer *apple2gs_scanline_timer;
152152static emu_timer *apple2gs_clock_timer;
153153static emu_timer *apple2gs_qsecond_timer;
src/mess/machine/nc.c
r2166r2167
2323extern int nc_membank_card_ram_mask;
2424
2525/* save card data back */
26static void   nc_card_save(mess_image *image)
26static void   nc_card_save(const device_config *image)
2727{
2828   /* if there is no data to write, quit */
2929   if (!nc_card_ram || !nc_card_size)
r2166r2167
5858
5959
6060/* load card image */
61static int nc_card_load(mess_image *image, unsigned char **ptr)
61static int nc_card_load(const device_config *image, unsigned char **ptr)
6262{
6363   int datasize;
6464   unsigned char *data;
src/mess/machine/adam.c
r2166r2167
524524   int i, buffer, byteCount, sectorNmbr, sectorCount, currentSector;
525525   UINT8 kbcode;
526526   static const UINT8 interleave[8] = {0,5,2,7,4,1,6,3};
527   mess_image *image;
527   const device_config *image;
528528
529529   if (offset == adam_pcb)
530530   {
src/mess/machine/d88.c
r2166r2167
1010
1111static d88image     d88image_drives[d88image_MAX_DRIVES];
1212
13static void d88image_seek_callback(mess_image *img,int);
14static int d88image_get_sectors_per_track(mess_image *img,int);
15static void d88image_get_id_callback(mess_image *img, chrn_id *, int, int);
16static void d88image_read_sector_data_into_buffer(mess_image *img, int side, int index1, char *ptr, int length);
17static void d88image_write_sector_data_from_buffer(mess_image *img, int side, int index1, const char *ptr, int length,int ddam);
13static void d88image_seek_callback(const device_config *img,int);
14static int d88image_get_sectors_per_track(const device_config *img,int);
15static void d88image_get_id_callback(const device_config *img, chrn_id *, int, int);
16static void d88image_read_sector_data_into_buffer(const device_config *img, int side, int index1, char *ptr, int length);
17static void d88image_write_sector_data_from_buffer(const device_config *img, int side, int index1, const char *ptr, int length,int ddam);
1818
1919static const floppy_interface d88image_floppy_interface=
2020{
r2166r2167
2727   NULL
2828};
2929
30static d88image *get_d88image(mess_image *img)
30static d88image *get_d88image(const device_config *img)
3131{
3232   return &d88image_drives[image_index_in_device(img)];
3333}
r2166r2167
164164   return 1;
165165}
166166
167static void d88image_get_id_callback(mess_image *img, chrn_id *id, int id_index, int side)
167static void d88image_get_id_callback(const device_config *img, chrn_id *id, int id_index, int side)
168168{
169169   d88image *w = get_d88image(img);
170170   d88sect *s = &(w->sects[w->track*2+side][id_index]);
r2166r2167
178178   id->flags = s->flags;
179179}
180180
181static int d88image_get_sectors_per_track(mess_image *img, int side)
181static int d88image_get_sectors_per_track(const device_config *img, int side)
182182{
183183   d88image *w = get_d88image(img);
184184
r2166r2167
192192   return w->num_sects[w->track*2+side];
193193}
194194
195static void d88image_seek_callback(mess_image *img, int physical_track)
195static void d88image_seek_callback(const device_config *img, int physical_track)
196196{
197197   d88image *w = get_d88image(img);
198198   w->track = physical_track;
199199}
200200
201static void d88image_write_sector_data_from_buffer(mess_image *img, int side, int index1, const char *ptr, int length, int ddam)
201static void d88image_write_sector_data_from_buffer(const device_config *img, int side, int index1, const char *ptr, int length, int ddam)
202202{
203203   d88image *w = get_d88image(img);
204204   d88sect *s = &(w->sects[w->track*2+side][index1]);
r2166r2167
211211   s->flags = ddam ? ID_FLAG_DELETED_DATA : 0;
212212}
213213
214static void d88image_read_sector_data_into_buffer(mess_image *img, int side, int index1, char *ptr, int length)
214static void d88image_read_sector_data_into_buffer(const device_config *img, int side, int index1, char *ptr, int length)
215215{
216216   d88image *w = get_d88image(img);
217217
src/mess/machine/mbee.c
r2166r2167
7575   wd17xx_init(machine, WD_TYPE_179X,mbee_fdc_callback, NULL);
7676}
7777
78static mess_image *cassette_device_image(void)
78static const device_config *cassette_device_image(void)
7979{
8080   return image_from_devtype_and_index(IO_CASSETTE, 0);
8181}
src/mess/machine/i8271.c
r2166r2167
4646#define FDC_LOG(x) do { if (VERBOSE) logerror("I8271: %s\n",x); } while (0)
4747#define FDC_LOG_COMMAND(x) do { if (VERBOSE) logerror("I8271: COMMAND %s\n",x); } while (0)
4848
49static mess_image *current_image(void)
49static const device_config *current_image(void)
5050{
5151   return image_from_devtype_and_index(IO_FLOPPY, i8271.drive);
5252}
r2166r2167
7070
7171static void i8271_seek_to_track(int track)
7272{
73   mess_image *img = current_image();
73   const device_config *img = current_image();
7474
7575   if (track==0)
7676   {
r2166r2167
550550
551551static int i8271_find_sector(void)
552552{
553   mess_image *img = current_image();
553   const device_config *img = current_image();
554554//   int track_count_attempt;
555555
556556//   track_count_attempt
r2166r2167
605605
606606static void i8271_command_execute(void)
607607{
608   mess_image *img = current_image();
608   const device_config *img = current_image();
609609
610610   /* clear it = good completion status */
611611   /* this will be changed if anything bad happens! */
src/mess/machine/coco.c
r2166r2167
394394  changing to make it worthy of Microsoft.
395395***************************************************************************/
396396
397static int load_pak_into_region(mess_image *image, int *pakbase, int *paklen, UINT8 *mem, int segaddr, int seglen)
397static int load_pak_into_region(const device_config *image, int *pakbase, int *paklen, UINT8 *mem, int segaddr, int seglen)
398398{
399399   if (*paklen)
400400   {
r2166r2167
482482   sam_set_state(trailer->sam, 0x7fff);
483483}
484484
485static int generic_pak_load(mess_image *image, int rambase_index, int rombase_index, int pakbase_index)
485static int generic_pak_load(const device_config *image, int rambase_index, int rombase_index, int pakbase_index)
486486{
487487   UINT8 *ROM;
488488   UINT8 *rambase;
r2166r2167
640640  be used in place of PAK files, when possible
641641***************************************************************************/
642642
643static int generic_rom_load(mess_image *image, UINT8 *dest, UINT16 destlength)
643static int generic_rom_load(const device_config *image, UINT8 *dest, UINT16 destlength)
644644{
645645   UINT8 *rombase;
646646   int   romsize;
r2166r2167
11101110#define SOUNDMUX_STATUS_SEL2   2
11111111#define SOUNDMUX_STATUS_SEL1   1
11121112
1113static mess_image *cartslot_image(void)
1113static const device_config *cartslot_image(void)
11141114{
11151115   return image_from_devtype_and_index(IO_CARTSLOT, 0);
11161116}
11171117
1118static mess_image *cassette_device_image(void)
1118static const device_config *cassette_device_image(void)
11191119{
11201120   return image_from_devtype_and_index(IO_CASSETTE, 0);
11211121}
11221122
1123static mess_image *bitbanger_image(void)
1123static const device_config *bitbanger_image(void)
11241124{
11251125   return image_from_devtype_and_index(IO_BITBANGER, 0);
11261126}
11271127
1128static mess_image *printer_image(void)
1128static const device_config *printer_image(void)
11291129{
11301130   return image_from_devtype_and_index(IO_PRINTER, 0);
11311131}
r2166r2167
27102710
27112711static void generic_mapmemory(coco_cartridge *cartridge, UINT32 offset, UINT32 mask, UINT8 *cartmem, UINT32 cartmem_size)
27122712{
2713   mess_image *image = cartslot_image();
2713   const device_config *image = cartslot_image();
27142714   const UINT8 *cart_ptr;
27152715   UINT32 cart_size, i;
27162716
r2166r2167
28012801static void generic_init_machine(running_machine *machine, const machine_init_interface *init)
28022802{
28032803   coco_cartridge_config cart_config;
2804   mess_image *cart_image;
2804   const device_config *cart_image;
28052805   const char *extrainfo;
28062806   const char *cart_hardware;
28072807   int i;
src/mess/machine/990_tap.c
r2166r2167
3939
4040typedef struct tape_unit_t
4141{
42   mess_image *img;      /* image descriptor */
42   const device_config *img;      /* image descriptor */
4343   unsigned int bot : 1;   /* TRUE if we are at the beginning of tape */
4444   unsigned int eot : 1;   /* TRUE if we are at the end of tape */
4545   unsigned int wp : 1;   /* TRUE if tape is write-protected */
src/mess/machine/nes.c
r2166r2167
6464    FUNCTIONS
6565***************************************************************************/
6666
67static mess_image *cartslot_image(void)
67static const device_config *cartslot_image(void)
6868{
6969   return image_from_devtype_and_index(IO_CARTSLOT, 0);
7070}
src/mess/machine/990_hd.c
r2166r2167
7575/* disk drive unit descriptor */
7676typedef struct hd_unit_t
7777{
78   mess_image *img;                  /* image descriptor */
78   const device_config *img;                  /* image descriptor */
7979   enum { format_mame, format_old } format;
8080   hard_disk_file *hd_handle;      /* mame hard disk descriptor - only if format == format_mame */
8181   unsigned int wp : 1;               /* TRUE if disk is write-protected */
src/mess/machine/99_dsk.c
r2166r2167
134134/*
135135   support for 48TPI disks in 96TPI drives
136136*/
137static int ti99_tracktranslate(mess_image *image, floppy_image *floppy, int physical_track)
137static int ti99_tracktranslate(const device_config *image, floppy_image *floppy, int physical_track)
138138{
139139   struct ti99_geometry *geometry;
140140   geometry = floppy_tag(floppy, TI99DSK_TAG);
r2166r2167
355355static void ti99_install_tracktranslate_procs(void)
356356{
357357   int id;
358   mess_image *image;
358   const device_config *image;
359359
360360   for (id=0; id<MAX_FLOPPIES; id++)
361361   {
src/mess/machine/msx.c
r2166r2167
437437      AY8910_control_port_0_w (machine, offset, data);
438438}
439439
440static mess_image *cassette_device_image(void)
440static const device_config *cassette_device_image(void)
441441{
442442   return image_from_devtype_and_index(IO_CASSETTE, 0);
443443}
444444
445static mess_image *printer_image(void)
445static const device_config *printer_image(void)
446446{
447447   return image_from_devtype_and_index(IO_PRINTER, 0);
448448}
src/mess/machine/serial.c
r2166r2167
110110/**********************************************************/
111111
112112/***** SERIAL DEVICE ******/
113void serial_device_setup(mess_image *image, int baud_rate, int num_data_bits, int stop_bit_count, int parity_code)
113void serial_device_setup(const device_config *image, int baud_rate, int num_data_bits, int stop_bit_count, int parity_code)
114114{
115115   int id = image_index_in_device(image);
116116
r2166r2167
165165   return protocol_names[protocol_id];
166166}
167167
168void serial_device_set_protocol(mess_image *image, int protocol_id)
168void serial_device_set_protocol(const device_config *image, int protocol_id)
169169{
170170   int id = image_index_in_device(image);
171171
r2166r2167
192192   }
193193}
194194
195void serial_device_set_transmit_state(mess_image *image, int state)
195void serial_device_set_transmit_state(const device_config *image, int state)
196196{
197197   int previous_state;
198198   int id = image_index_in_device(image);
r2166r2167
564564}
565565
566566/* connect the specified connection to this serial device */
567void serial_device_connect(mess_image *image, struct serial_connection *connection)
567void serial_device_connect(const device_config *image, struct serial_connection *connection)
568568{
569569   int id = image_index_in_device(image);
570570
r2166r2167
577577
578578
579579/* load image */
580static int serial_device_load_internal(mess_image *image, unsigned char **ptr, int *pDataSize)
580static int serial_device_load_internal(const device_config *image, unsigned char **ptr, int *pDataSize)
581581{
582582   int datasize;
583583   unsigned char *data;
r2166r2167
635635   data_stream_reset(stream);
636636}
637637
638int serial_device_init(mess_image *image)
638int serial_device_init(const device_config *image)
639639{
640640   int id = image_index_in_device(image);
641641   memset(&serial_devices[id], 0, sizeof(serial_devices[id]));
642642   return INIT_PASS;
643643}
644644
645int serial_device_load(mess_image *image)
645int serial_device_load(const device_config *image)
646646{
647647   int id = image_index_in_device(image);
648648   int data_length;
r2166r2167
663663}
664664
665665
666void serial_device_unload(mess_image *image)
666void serial_device_unload(const device_config *image)
667667{
668668   int id = image_index_in_device(image);
669669
src/mess/machine/thomson.c
r2166r2167
177177
178178
179179
180int thom_serial_init ( mess_image *image )
180int thom_serial_init ( const device_config *image )
181181{
182182   int idx = image_index_in_device(image);
183183
r2166r2167
214214
215215
216216
217void thom_serial_unload ( mess_image *image )
217void thom_serial_unload ( const device_config *image )
218218{
219219   serial_device_unload( image );
220220}
221221
222222
223223
224int thom_serial_load ( mess_image* image )
224int thom_serial_load ( const device_config* image )
225225{
226226   int idx = image_index_in_device( image );
227227
r2166r2167
260260static UINT8 thom_cart_bank;     /* current bank */
261261
262262
263int to7_cartridge_load ( mess_image* image )
263int to7_cartridge_load ( const device_config* image )
264264{
265265   int i,j;
266266   UINT8* pos = memory_region( REGION_CPU1 ) + 0x10000;
r2166r2167
17001700
17011701
17021702
1703int mo5_cartridge_load ( mess_image* image )
1703int mo5_cartridge_load ( const device_config* image )
17041704{
17051705   UINT8* pos = memory_region(REGION_CPU1) + 0x10000;
17061706   UINT64 size = image_length ( image );
src/mess/machine/cgenie.c
r2166r2167
118118static OPBASE_HANDLER (opbaseoverride)
119119{
120120   UINT8 *RAM = memory_region(REGION_CPU1);
121   mess_image *img;
121   const device_config *img;
122122   UINT8 *buff, *s, data;
123123   UINT16 size, entry = 0, block_len, block_ofs = 0;
124124
src/mess/machine/tx0.c
r2166r2167
2121/* tape reader registers */
2222typedef struct tape_reader_t
2323{
24   mess_image *fd;   /* file descriptor of tape image */
24   const device_config *fd;   /* file descriptor of tape image */
2525
2626   int motor_on;   /* 1-bit reader motor on */
2727
r2166r2167
3737/* tape puncher registers */
3838typedef struct tape_puncher_t
3939{
40   mess_image *fd;   /* file descriptor of tape image */
40   const device_config *fd;   /* file descriptor of tape image */
4141
4242   emu_timer *timer;   /* timer to generate completion pulses */
4343} tape_puncher_t;
r2166r2167
4848/* typewriter registers */
4949typedef struct typewriter_t
5050{
51   mess_image *fd;   /* file descriptor of output image */
51   const device_config *fd;   /* file descriptor of output image */
5252
5353   emu_timer *prt_timer;/* timer to generate completion pulses */
5454} typewriter_t;
r2166r2167
6363/* magnetic tape unit registers */
6464typedef struct magtape_t
6565{
66   mess_image *img;      /* image descriptor */
66   const device_config *img;      /* image descriptor */
6767
6868   enum
6969   {
src/mess/machine/c16.c
r2166r2167
5454static UINT8 *c16_memory_28000;
5555static UINT8 *c16_memory_2c000;
5656
57static int c16_rom_load(mess_image *img);
57static int c16_rom_load(const device_config *img);
5858
5959/**
6060  ddr bit 1 port line is output
r2166r2167
555555
556556   for (i = 0; i < 2; i++)
557557   {
558      mess_image *image = image_from_devtype_and_index(IO_CARTSLOT, i);
558      const device_config *image = image_from_devtype_and_index(IO_CARTSLOT, i);
559559      if (image_exists(image))
560560         c16_rom_load(image);
561561   }
562562}
563563
564static int c16_rom_id(mess_image *image)
564static int c16_rom_id(const device_config *image)
565565{
566566    /* magic lowrom at offset 7: $43 $42 $4d */
567567   /* if at offset 6 stands 1 it will immediatly jumped to offset 0 (0x8000) */
r2166r2167
600600   return (!c16_rom_id(image)) ? INIT_FAIL : INIT_PASS;
601601}
602602
603static int c16_rom_load(mess_image *image)
603static int c16_rom_load(const device_config *image)
604604{
605605   UINT8 *mem = memory_region (REGION_CPU1);
606606   int size, read_;
src/mess/machine/oric.c
r2166r2167
269269 */
270270
271271
272static mess_image *cassette_device_image(void)
272static const device_config *cassette_device_image(void)
273273{
274274   return image_from_devtype_and_index(IO_CASSETTE, 0);
275275}
src/mess/machine/990_dk.c
r2166r2167
3737
3838   struct
3939   {
40      mess_image *img;
40      const device_config *img;
4141      int phys_cylinder;
4242      int log_cylinder[2];
4343      int seclen;
r2166r2167
9191      (*fd800.interrupt_callback)((fd800.stat_reg & status_interrupt) && ! fd800.interrupt_f_f);
9292}
9393
94static void fd800_unload_proc(mess_image *image)
94static void fd800_unload_proc(const device_config *image)
9595{
9696   int unit = image_index_in_device(image);
9797
src/mess/machine/mc10.c
r2166r2167
135135     *   BIT 4 CASSETTE TAPE INPUT
136136     */
137137
138   mess_image *img = image_from_devtype_and_index(IO_CASSETTE, 0);
138   const device_config *img = image_from_devtype_and_index(IO_CASSETTE, 0);
139139   int val = 0xed;
140140
141141   if ((readinputport(6) | mc10_keyboard_strobe) == 0xff)
r2166r2167
150150
151151WRITE8_HANDLER ( mc10_port2_w )
152152{
153   mess_image *img = image_from_devtype_and_index(IO_CASSETTE, 0);
153   const device_config *img = image_from_devtype_and_index(IO_CASSETTE, 0);
154154
155155   /*   BIT 0 PRINTER OUTFUT & CASS OUTPUT
156156     */
src/mess/machine/6551.c
r2166r2167
483483}
484484
485485
486void acia_6551_connect_to_serial_device(mess_image *image)
486void acia_6551_connect_to_serial_device(const device_config *image)
487487{
488488   serial_device_connect(image, &acia.connection);
489489}
src/mess/machine/atom.c
r2166r2167
5252   }
5353}
5454
55static mess_image *cassette_device_image(void)
55static const device_config *cassette_device_image(void)
5656{
5757   return image_from_devtype_and_index(IO_CASSETTE, 0);
5858}
5959
60static mess_image *printer_image(void)
60static const device_config *printer_image(void)
6161{
6262   return image_from_devtype_and_index(IO_PRINTER, 0);
6363}
src/mess/machine/6551.h
r2166r2167
1818void acia_6551_init(void);
1919void acia_6551_set_irq_callback(void (*callback)(int));
2020
21void acia_6551_connect_to_serial_device(mess_image *image);
21void acia_6551_connect_to_serial_device(const device_config *image);
2222
2323
2424#endif /* _6551_H_ */
src/mess/machine/vc20.c
r2166r2167
577577   via_0_ca1_w(machine, 0, vc20_via0_read_ca1(machine, 0) );
578578}
579579
580static int vc20_rom_id(mess_image *image)
580static int vc20_rom_id(const device_config *image)
581581{
582582   static const unsigned char magic[] =
583583   {0x41, 0x30, 0x20, 0xc3, 0xc2, 0xcd};   /* A0 CBM at 0xa004 (module offset 4) */
src/mess/machine/electron.c
r2166r2167
1515ULA ula;
1616static emu_timer *electron_tape_timer;
1717
18static mess_image *cassette_device_image( void ) {
18static const device_config *cassette_device_image( void ) {
1919   return image_from_devtype_and_index( IO_CASSETTE, 0 );
2020}
2121
src/mess/machine/pc_fdc.c
r2166r2167
5252
5353static void pc_fdc_hw_interrupt(int state);
5454static void pc_fdc_hw_dma_drq(int,int);
55static mess_image *pc_fdc_get_image(int floppy_index);
55static const device_config *pc_fdc_get_image(int floppy_index);
5656
5757static const nec765_interface pc_fdc_nec765_interface =
5858{
r2166r2167
8181void pc_fdc_init(const struct pc_fdc_interface *iface)
8282{
8383   int i;
84   mess_image *img;
84   const device_config *img;
8585
8686   /* initialize fdc structure */
8787   fdc = auto_malloc(sizeof(*fdc));
r2166r2167
105105
106106
107107
108static mess_image *pc_fdc_get_image(int floppy_index)
108static const device_config *pc_fdc_get_image(int floppy_index)
109109{
110   mess_image *image = NULL;
110   const device_config *image = NULL;
111111
112112   if (!fdc->fdc_interface.get_image)
113113   {
src/mess/machine/pc_hdc.c
r2166r2167
188188
189189static hard_disk_file *pc_hdc_file(int id)
190190{
191   mess_image *img;
191   const device_config *img;
192192
193193   img = image_from_devtype_and_index(IO_HARDDISK, id);
194194   if (!image_exists(img))
src/mess/machine/apple1.c
r2166r2167
486486**   could be placed on a single tape.
487487*****************************************************************************/
488488
489static mess_image *cassette_device_image(void)
489static const device_config *cassette_device_image(void)
490490{
491491   return image_from_devtype_and_index(IO_CASSETTE, 0);
492492}
src/mess/machine/pc_fdc.h
r2166r2167
2929   NEC765_VERSION nec765_type;
3030   void (*pc_fdc_interrupt)(int);
3131   void (*pc_fdc_dma_drq)(int,int);
32   mess_image *(*get_image)(int floppy_index);
32   const device_config *(*get_image)(int floppy_index);
3333};
3434
3535
src/mess/machine/mc6843.c
r2166r2167
110110
111111
112112
113static mess_image* mc6843_floppy_image ( void )
113static const device_config* mc6843_floppy_image ( void )
114114{
115115   return image_from_devtype_and_index( IO_FLOPPY, mc6843->drive );
116116}
r2166r2167
161161
162162
163163
164static void mc6843_index_pulse_callback(mess_image *img, int state)
164static void mc6843_index_pulse_callback(const device_config *img, int state)
165165{
166166   mc6843->index_pulse = state;
167167}
r2166r2167
190190/* Seek Track Zero bottom half */
191191static void mc6843_finish_STZ( void )
192192{
193   mess_image* img = mc6843_floppy_image();
193   const device_config* img = mc6843_floppy_image();
194194   int i;
195195
196196   /* seek to track zero */
r2166r2167
219219/* Seek bottom half */
220220static void mc6843_finish_SEK( void )
221221{
222   mess_image* img = mc6843_floppy_image();
222   const device_config* img = mc6843_floppy_image();
223223
224224   /* seek to track */
225225   floppy_drive_seek( img, mc6843->GCR - mc6843->CTAR );
r2166r2167
237237/* preamble to all sector read / write commands, returns 1 if found */
238238static int mc6843_address_search( chrn_id* id )
239239{
240   mess_image* img = mc6843_floppy_image();
240   const device_config* img = mc6843_floppy_image();
241241   int r = 0;
242242
243243   while ( 1 )
r2166r2167
333333static void mc6843_cont_SR( void )
334334{
335335   chrn_id id;
336   mess_image* img = mc6843_floppy_image();
336   const device_config* img = mc6843_floppy_image();
337337
338338   /* sector seek */
339339   if ( ! mc6843_address_search_read( &id ) )
r2166r2167
490490   case 3: /* Status Register A (STRA) */
491491   {
492492      /* update */
493      mess_image* img = mc6843_floppy_image();
493      const device_config* img = mc6843_floppy_image();
494494      int flag = floppy_drive_get_flag_state( img, FLOPPY_DRIVE_READY | FLOPPY_DRIVE_HEAD_AT_TRACK_0 | FLOPPY_DRIVE_DISK_WRITE_PROTECTED );
495495      mc6843->STRA &= 0xa3;
496496      if ( flag & FLOPPY_DRIVE_READY )
r2166r2167
561561         if ( mc6843->data_idx >= mc6843->data_size )
562562         {
563563            /* end of sector write */
564            mess_image* img = mc6843_floppy_image();
564            const device_config* img = mc6843_floppy_image();
565565
566566            LOG(( "%f $%04x mc6843_w: write sector %i\n", attotime_to_double(timer_get_time()), activecpu_get_previouspc(), mc6843->data_id ));
567567
r2166r2167
623623            if ( (mc6843->data[2] == 0) && (mc6843->data[4] == 0) )
624624            {
625625               /* valid address id field */
626               mess_image* img = mc6843_floppy_image();
626               const device_config* img = mc6843_floppy_image();
627627               UINT8 track  = mc6843->data[1];
628628               UINT8 sector = mc6843->data[3];
629629               UINT8 filler = 0xe5; /* standard Thomson filler */
r2166r2167
760760   /* setup/reset floppy drive */
761761   for ( i = 0; i < device_count( IO_FLOPPY ); i++ )
762762   {
763      mess_image * img = image_from_devtype_and_index( IO_FLOPPY, i );
763      const device_config * img = image_from_devtype_and_index( IO_FLOPPY, i );
764764      floppy_drive_set_index_pulse_callback( img, mc6843_index_pulse_callback );
765765      floppy_drive_set_motor_state( img, 1 );
766766      floppy_drive_set_ready_state( img, FLOPPY_DRIVE_READY, 0 );
src/mess/machine/amigafdc.c
r2166r2167
3939   int dir;
4040   int wprot;
4141   int disk_changed;
42   mess_image *f;
42   const device_config *f;
4343   UINT32 extinfo[MAX_TRACKS];
4444   UINT32 extoffs[MAX_TRACKS];
4545   int is_ext_image;
src/mess/machine/bebox.c
r2166r2167
380380}
381381
382382
383static mess_image *bebox_fdc_get_image(int floppy_index)
383static const device_config *bebox_fdc_get_image(int floppy_index)
384384{
385385   /* the BeBox boot ROM seems to query for floppy #1 when it should be
386386    * querying for floppy #0 */
src/mess/machine/mtx.c
r2166r2167
128128 *
129129 *************************************/
130130
131static mess_image *mtx_printer_image(void)
131static const device_config *mtx_printer_image(void)
132132{
133133   return image_from_devtype_and_index(IO_PRINTER, 0);
134134}
src/mess/machine/microtan.c
r2166r2167
143143    cpunum_set_input_line(machine, 0, 0, via_0_irq_line | via_1_irq_line | kbd_irq_line);
144144}
145145
146static mess_image *cassette_device_image(void)
146static const device_config *cassette_device_image(void)
147147{
148148   return image_from_devtype_and_index(IO_CASSETTE, 0);
149149}
src/mess/machine/intv.c
r2166r2167
316316   intv_ram16[offset] = data&0xffff;
317317}
318318
319static int intv_load_rom_file(mess_image *image, int required)
319static int intv_load_rom_file(const device_config *image, int required)
320320{
321321    int i;
322322
src/mess/machine/vtech1.c
r2166r2167
165165 Cassette Handling
166166******************************************************************************/
167167
168static mess_image *cassette_device_image(void)
168static const device_config *cassette_device_image(void)
169169{
170170   return image_from_devtype_and_index(IO_CASSETTE, 0);
171171}
r2166r2167
227227 Floppy Handling
228228******************************************************************************/
229229
230static mess_image *vtech1_file(void)
230static const device_config *vtech1_file(void)
231231{
232232   if (vtech1_drive < 0)
233233      return NULL;
src/mess/machine/cpm_bios.c
r2166r2167
3838static int mode[NDSK] = {0,};      /* 0 read only, !0 read/write */
3939static int bdos_trk[NDSK] = {0,};   /* BDOS track number */
4040static int bdos_sec[NDSK] = {0,};   /* BDOS sector number */
41static mess_image *fp[NDSK] = {NULL, };   /* image file pointer */
41static const device_config *fp[NDSK] = {NULL, };   /* image file pointer */
4242static int ff[NDSK] = {0, };            /* image filenames specified flags */
4343static mame_file *lp = NULL;          /* list file handle (ie. PIP LST:=X:FILE.EXT) */
44//static mess_image *pp = NULL;         /* punch file handle (ie. PIP PUN:=X:FILE.EXT) */
45//static mess_image *rp = NULL;         /* reader file handle (ie. PIP X:FILE.EXE=RDR:) */
44//static const device_config *pp = NULL;         /* punch file handle (ie. PIP PUN:=X:FILE.EXT) */
45//static const device_config *rp = NULL;         /* reader file handle (ie. PIP X:FILE.EXE=RDR:) */
4646static int dma = 0;             /* DMA transfer address */
4747
4848static UINT8 zeropage0[8] =
src/mess/machine/wd17xx.c
r2166r2167
258258
259259/**************************************************************************/
260260
261static mess_image *wd17xx_current_image(void)
261static const device_config *wd17xx_current_image(void)
262262{
263263   return image_from_devtype_and_index(IO_FLOPPY, current_drive);
264264}
r2166r2167
369369static TIMER_CALLBACK(wd17xx_misc_timer_callback);
370370static TIMER_CALLBACK(wd17xx_read_sector_callback);
371371static TIMER_CALLBACK(wd17xx_write_sector_callback);
372static void wd17xx_index_pulse_callback(mess_image *img, int state);
372static void wd17xx_index_pulse_callback(const device_config *img, int state);
373373
374374void wd17xx_reset(void)
375375{
376376   int i;
377377   for (i = 0; i < device_count(IO_FLOPPY); i++)
378378   {
379      mess_image *img = image_from_devtype_and_index(IO_FLOPPY, i);
379      const device_config *img = image_from_devtype_and_index(IO_FLOPPY, i);
380380      floppy_drive_set_index_pulse_callback(img, wd17xx_index_pulse_callback);
381381      floppy_drive_set_rpm( img, 300.);
382382   }
r2166r2167
650650
651651
652652
653static void wd17xx_index_pulse_callback(mess_image *img, int state)
653static void wd17xx_index_pulse_callback(const device_config *img, int state)
654654{
655655   wd17xx_info *w = &wd;
656656   if ( img != wd17xx_current_image() )
src/mess/machine/svi318.c
r2166r2167
380380
381381static WRITE8_HANDLER( svi318_fdc_density_side_w )
382382{
383   mess_image *image;
383   const device_config *image;
384384
385385   wd17xx_set_density(data & 0x01 ? DEN_FM_LO:DEN_MFM_LO);
386386
src/mess/machine/pce.c
r2166r2167
9999static TIMER_CALLBACK( pce_cd_adpcm_dma_timer_callback );
100100
101101
102static mess_image *cdrom_device_image( void ) {
102static const device_config *cdrom_device_image( void ) {
103103   return image_from_devtype_and_index( IO_CDROM, 0 );
104104}
105105
r2166r2167
517517/* 0xDE - GET DIR INFO (NEC) */
518518static void pce_cd_nec_get_dir_info( void ) {
519519   UINT32 frame, msf, track = 0;
520   mess_image *img = cdrom_device_image();
520   const device_config *img = cdrom_device_image();
521521   const cdrom_toc   *toc;
522522   logerror("nec get dir info\n");
523523
src/mess/machine/smc92x4.c
r2166r2167
131131*/
132132static int floppy_read_id(int which, int disk_unit, int head)
133133{
134   mess_image *disk_img = image_from_devtype_and_index(IO_FLOPPY, disk_unit);
134   const device_config *disk_img = image_from_devtype_and_index(IO_FLOPPY, disk_unit);
135135   UINT8 revolution_count;
136136   chrn_id id;
137137
r2166r2167
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   mess_image *disk_img = image_from_devtype_and_index(IO_FLOPPY, disk_unit);
166   const device_config *disk_img = image_from_devtype_and_index(IO_FLOPPY, disk_unit);
167167   UINT8 revolution_count;
168168   chrn_id id;
169169
r2166r2167
207207   int sector_data_id, sector_len;
208208   UINT8 buf[MAX_SECTOR_LEN];
209209   int i;
210   mess_image *disk_img = image_from_devtype_and_index(IO_FLOPPY, disk_unit);
210   const device_config *disk_img = image_from_devtype_and_index(IO_FLOPPY, disk_unit);
211211
212212   if (! floppy_find_sector(which, disk_unit, cylinder, head, check_secnum, sector, & sector_data_id, & sector_len))
213213   {
r2166r2167
229229   int sector_data_id, sector_len;
230230   UINT8 buf[MAX_SECTOR_LEN];
231231   int i;
232   mess_image *disk_img = image_from_devtype_and_index(IO_FLOPPY, disk_unit);
232   const device_config *disk_img = image_from_devtype_and_index(IO_FLOPPY, disk_unit);
233233
234234   if (! floppy_find_sector(which, disk_unit, cylinder, head, check_secnum, sector, & sector_data_id, & sector_len))
235235   {
r2166r2167
248248
249249static void floppy_step(int which, int disk_unit, int direction)
250250{
251   mess_image *disk_img = image_from_devtype_and_index(IO_FLOPPY, disk_unit);
251   const device_config *disk_img = image_from_devtype_and_index(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   mess_image *disk_img = image_from_devtype_and_index(IO_FLOPPY, disk_unit);
257   const device_config *disk_img = image_from_devtype_and_index(IO_FLOPPY, disk_unit);
258258   int status = floppy_status(disk_img, -1);
259259   int reply;
260260
r2166r2167
285285   unsigned int cylinders, heads, sectors_per_track, bytes_per_sector;
286286} hd[10];
287287
288int smc92x4_hd_load(mess_image *image, int disk_unit)
288int smc92x4_hd_load(const device_config *image, int disk_unit)
289289{
290290   const hard_disk_info *info;
291291
r2166r2167
318318   return INIT_FAIL;
319319}
320320
321void smc92x4_hd_unload(mess_image *image, int disk_unit)
321void smc92x4_hd_unload(const device_config *image, int disk_unit)
322322{
323323   device_unload_mess_hd(image);
324324   hd[disk_unit].hd_handle = NULL;
src/mess/machine/ti99_4x.c
r2166r2167
24262426*/
24272427static void ti99_CS_motor(int offset, int data)
24282428{
2429   mess_image *img = image_from_devtype_and_index(IO_CASSETTE, offset-6);
2429   const device_config *img = image_from_devtype_and_index(IO_CASSETTE, offset-6);
24302430   cassette_change_state(img, data ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
24312431}
24322432
src/mess/machine/msm8251.c
r2166r2167
586586
587587/* initialise transfer using serial device - set the callback which will
588588be called when serial device has updated it's state */
589void msm8251_connect_to_serial_device(mess_image *image)
589void msm8251_connect_to_serial_device(const device_config *image)
590590{
591591   serial_device_connect(image, &uart.connection);
592592}
src/mess/machine/smc92x4.h
r2166r2167
4141   void (*int_callback)(int which, int state);
4242} smc92x4_intf;
4343
44int smc92x4_hd_load(mess_image *image, int disk_unit);
45void smc92x4_hd_unload(mess_image *image, int disk_unit);
44int smc92x4_hd_load(const device_config *image, int disk_unit);
45void smc92x4_hd_unload(const device_config *image, int disk_unit);
4646
4747void smc92x4_init(int which, const smc92x4_intf *intf);
4848void smc92x4_reset(int which);
src/mess/machine/msm8251.h
r2166r2167
9595void msm8251_receive_clock(void);
9696
9797
98void msm8251_connect_to_serial_device(mess_image *image);
98void msm8251_connect_to_serial_device(const device_config *image);
9999
100100void msm8251_connect(struct serial_connection *other_connection);
101101
src/mess/machine/vc20tape.c
r2166r2167
4444   emu_timer *timer;
4545   int pos;
4646   struct GameSample *sample;
47   mess_image *img;
47   const device_config *img;
4848} wav;
4949
5050/* these are the values for prg files */
r2166r2167
7272   char name[16];                  /*name for cbm */
7373   UINT8 chksum;
7474   attotime lasttime;
75   mess_image *img;
75   const device_config *img;
7676} prg;
7777
7878/* from sound/samples.c no changes (static declared) */
7979/* readsamples not useable (loads files only from sample or game directory) */
8080/* and doesn't search the rompath */
81static struct GameSample *vc20_read_wav_sample (mess_image *image)
81static struct GameSample *vc20_read_wav_sample (const device_config *image)
8282{
8383   /* NPW 28-Feb-2005 - this code sucks */
8484   return NULL;
r2166r2167
280280#endif
281281}
282282
283static void vc20_wav_open(mess_image *image)
283static void vc20_wav_open(const device_config *image)
284284{
285285   if ((wav.sample = vc20_read_wav_sample (image)) == NULL)
286286   {
r2166r2167
406406   }
407407}
408408
409static void vc20_prg_open(mess_image *image)
409static void vc20_prg_open(const device_config *image)
410410{
411411   const char *name;
412412   int i;
src/mess/machine/994x_ser.c
r2166r2167
5151static int pio_out_buffer;
5252static int pio_in_buffer;
5353
54static mess_image *pio_fp;
54static const device_config *pio_fp;
5555static int pio_readable;
5656static int pio_writable;
5757static int pio_write = 1/*0*/;   // 1 if image is to be written to
5858
59static mess_image *rs232_fp;
59static const device_config *rs232_fp;
6060
6161static const ti99_peb_card_handlers_t rs232_handlers =
6262{
src/mess/machine/vtech2.c
r2166r2167
196196    }
197197}
198198
199static mess_image *vtech2_cassette_image(void)
199static const device_config *vtech2_cassette_image(void)
200200{
201201   return image_from_devtype_and_index(IO_CASSETTE, 0);
202202}
r2166r2167
372372   return INIT_PASS;
373373}
374374
375static mess_image *laser_file(void)
375static const device_config *laser_file(void)
376376{
377377   return image_from_devtype_and_index(IO_FLOPPY, laser_drive);
378378}
src/mess/machine/kc.c
r2166r2167
5050
5151
5252/* load image */
53static int kc_load(mess_image *image, unsigned char **ptr)
53static int kc_load(const device_config *image, unsigned char **ptr)
5454{
5555   int datasize;
5656   unsigned char *data;
src/mess/machine/corvushd.c
r2166r2167
11831183//
11841184static hard_disk_file *corvus_hdc_file(int id) {
11851185
1186   mess_image *img;
1186   const device_config *img;
11871187
11881188   img = image_from_devtype_and_index(IO_HARDDISK, id);
11891189   if (!image_exists(img))
src/mess/cheatms.c
r2166r2167
4141   {
4242      for(deviceID = 0; deviceID < device_count(deviceType); deviceID++)
4343      {
44         mess_image *img = image_from_devtype_and_index(deviceType, deviceID);
44         const device_config *img = image_from_devtype_and_index(deviceType, deviceID);
4545         if (image_exists(img))
4646         {
4747            UINT32   crc = image_crc(img);
src/mess/artworkx.h
r2166r2167
5252
5353***************************************************************************/
5454
55void artwork_use_device_art(mess_image *img, const char *defaultartfile);
55void artwork_use_device_art(const device_config *img, const char *defaultartfile);
5656
5757int artwork_get_inputscreen_customizations(png_info *png, artwork_cust_type cust_type,
5858   const char *section,
src/mess/formats/thom_dsk.c
r2166r2167
4444   UINT8  cur_track;
4545
4646   /* for write-back */
47   mess_image* image;
47   const device_config* image;
4848   UINT8       has_changed;
4949
5050} thom_floppy_drive;
r2166r2167
200200
201201
202202
203static thom_floppy_drive* thom_floppy_drive_of_image ( mess_image *image )
203static thom_floppy_drive* thom_floppy_drive_of_image ( const device_config *image )
204204{
205205   return thom_floppy_drives + image_index_in_device( image );
206206}
207207
208208
209209
210static void thom_floppy_seek ( mess_image *image, int physical_track )
210static void thom_floppy_seek ( const device_config *image, int physical_track )
211211{
212212   thom_floppy_drive* d = thom_floppy_drive_of_image( image );
213213   thom_floppy_active( 0 );
r2166r2167
221221
222222
223223
224static int thom_floppy_get_sectors_per_track( mess_image *image, int side )
224static int thom_floppy_get_sectors_per_track( const device_config *image, int side )
225225{
226226   thom_floppy_drive* d = thom_floppy_drive_of_image( image );
227227   VLOG(( "thom_floppy_get_sectors_per_track: track=%i/%i dens=%s/%s\n", d->cur_track, d->tracks,
r2166r2167
232232
233233
234234
235static void thom_floppy_get_id ( mess_image* image, chrn_id* id,
235static void thom_floppy_get_id ( const device_config* image, chrn_id* id,
236236             int id_index, int physical_side )
237237{
238238   thom_floppy_drive* d = thom_floppy_drive_of_image( image );
r2166r2167
278278
279279
280280
281static void thom_floppy_read_sector_data_into_buffer ( mess_image* image, int side, int index1, char *ptr, int length )
281static void thom_floppy_read_sector_data_into_buffer ( const device_config* image, int side, int index1, char *ptr, int length )
282282{
283283   thom_floppy_drive* d = thom_floppy_drive_of_image( image );
284284   UINT8* src = thom_floppy_sector_ptr( d, index1, d->cur_track, 0 );
r2166r2167
295295
296296
297297
298static void thom_floppy_write_sector_data_from_buffer ( mess_image *image, int side, int data_id,  const char *ptr, int length, int ddam )
298static void thom_floppy_write_sector_data_from_buffer ( const device_config *image, int side, int data_id,  const char *ptr, int length, int ddam )
299299{
300300   thom_floppy_drive* d = thom_floppy_drive_of_image( image );
301301   UINT8* dst = thom_floppy_sector_ptr( d, data_id, d->cur_track, 0 );
r2166r2167
315315
316316
317317
318static void thom_floppy_format_sector ( mess_image *image, int side, int sector_index, int c, int h, int r, int n, int filler )
318static void thom_floppy_format_sector ( const device_config *image, int side, int sector_index, int c, int h, int r, int n, int filler )
319319{
320320   thom_floppy_drive* d = thom_floppy_drive_of_image( image );
321321   int sector_size = 128 << n;
r2166r2167
371371/*********************** .fd format ************************/
372372
373373
374static int thom_floppy_fd_load ( mess_image* image )
374static int thom_floppy_fd_load ( const device_config* image )
375375{
376376   thom_floppy_drive* d = thom_floppy_drives + image_index_in_device( image );
377377   int size = image_length( image );
r2166r2167
462462
463463
464464
465static void thom_floppy_fd_save ( mess_image* image )
465static void thom_floppy_fd_save ( const device_config* image )
466466{
467467   thom_floppy_drive* d = thom_floppy_drives + image_index_in_device( image );
468468   unsigned size = d->sides * d->tracks * d->sectors * d->sector_size;
r2166r2167
489489*/
490490
491491
492static int thom_floppy_qd_load ( mess_image* image )
492static int thom_floppy_qd_load ( const device_config* image )
493493{
494494   thom_floppy_drive* d = thom_floppy_drives + image_index_in_device( image );
495495   int size = image_length( image );
r2166r2167
542542
543543
544544
545static void thom_floppy_qd_save ( mess_image* image )
545static void thom_floppy_qd_save ( const device_config* image )
546546{
547547   thom_floppy_drive* d = thom_floppy_drives + image_index_in_device( image );
548548   unsigned size = d->sides * d->tracks * d->sectors * d->sector_size;
r2166r2167
593593
594594
595595/* TODO: protection */
596static int thom_floppy_sap_load ( mess_image* image )
596static int thom_floppy_sap_load ( const device_config* image )
597597{
598598   int drive = image_index_in_device( image );
599599   thom_floppy_drive* d = thom_floppy_drives + drive;
r2166r2167
712712
713713
714714
715static void thom_floppy_sap_save ( mess_image* image )
715static void thom_floppy_sap_save ( const device_config* image )
716716{
717717   thom_floppy_drive* d = thom_floppy_drives + image_index_in_device( image );
718718   unsigned size = d->sides * d->tracks * d->sectors * d->sector_size;
r2166r2167
782782
783783
784784
785int thom_floppy_init ( mess_image *image )
785int thom_floppy_init ( const device_config *image )
786786{
787787   thom_qdd_compute_map();
788788   thom_floppy_reset( thom_floppy_drive_of_image( image  ) );
r2166r2167
791791
792792
793793
794int thom_floppy_load ( mess_image* image )
794int thom_floppy_load ( const device_config* image )
795795{
796796   const char* typ = image_filetype( image );
797797   thom_floppy_drive* d = thom_floppy_drive_of_image( image );
r2166r2167
817817
818818
819819
820void thom_floppy_unload ( mess_image *image )
820void thom_floppy_unload ( const device_config *image )
821821{
822822   thom_floppy_drive* d = thom_floppy_drive_of_image( image );
823823   const char* typ = image_filetype( image );
r2166r2167
835835
836836
837837
838int  thom_floppy_create ( mess_image *image, int create_format, option_resolution *args )
838int  thom_floppy_create ( const device_config *image, int create_format, option_resolution *args )
839839{
840840   thom_floppy_drive* d = thom_floppy_drive_of_image( image );
841841   const char* typ = image_filetype( image );
src/mess/formats/thom_dsk.h
r2166r2167
2525  THOM_FLOPPY_QDD,     /* 2"8 */
2626} thom_floppy_type;
2727
28extern int  thom_floppy_init   ( mess_image *image );
29extern int  thom_floppy_load   ( mess_image* image );
30extern void thom_floppy_unload ( mess_image *image);
31extern int  thom_floppy_create ( mess_image *image,
28extern int  thom_floppy_init   ( const device_config *image );
29extern int  thom_floppy_load   ( const device_config* image );
30extern void thom_floppy_unload ( const device_config *image);
31extern int  thom_floppy_create ( const device_config *image,
3232             int create_format, option_resolution *args );
3333
3434extern void    thom_floppy_set_density( DENSITY density );
src/mess/formats/thom_cas.c
r2166r2167
4242/*************************** I / O **************************/
4343
4444
45INLINE mess_image* thom_cassette_img( void )
45INLINE const device_config* thom_cassette_img( void )
4646{ return image_from_devtype_and_index(IO_CASSETTE, 0); }
4747
4848
r2166r2167
8989*/
9090int to7_get_cassette ( void )
9191{
92   mess_image* img = thom_cassette_img();
92   const device_config* img = thom_cassette_img();
9393
9494   if ( image_exists( img ) )
9595   {
r2166r2167
143143/* 1-bit cassette output */
144144void to7_set_cassette ( int data )
145145{
146   mess_image* img = thom_cassette_img();
146   const device_config* img = thom_cassette_img();
147147   cassette_output( img, data ? 1. : -1. );
148148}
149149
r2166r2167
151151
152152WRITE8_HANDLER ( to7_set_cassette_motor )
153153{
154   mess_image* img = thom_cassette_img();
154   const device_config* img = thom_cassette_img();
155155   cassette_state state = cassette_get_state( img );
156156   double pos = cassette_get_position(img);
157157
r2166r2167
190190
191191int mo5_get_cassette ( void )
192192{
193   mess_image* img = thom_cassette_img();
193   const device_config* img = thom_cassette_img();
194194
195195   if ( image_exists( img ) )
196196   {
r2166r2167
218218
219219void mo5_set_cassette ( int data )
220220{
221   mess_image* img = thom_cassette_img();
221   const device_config* img = thom_cassette_img();
222222   cassette_output( img, data ? 1. : -1. );
223223}
224224
r2166r2167
226226
227227WRITE8_HANDLER ( mo5_set_cassette_motor )
228228{
229   mess_image* img = thom_cassette_img();
229   const device_config* img = thom_cassette_img();
230230   cassette_state state = cassette_get_state( img );
231231   double pos = cassette_get_position(img);
232232
src/mess/drivers/sord.c
r2166r2167
191191}
192192
193193
194static mess_image *cassette_device_image(void)
194static const device_config *cassette_device_image(void)
195195{
196196   return image_from_devtype_and_index(IO_CASSETTE, 0);
197197}
src/mess/drivers/coco.c
r2166r2167
881881  Bitbanger port
882882***************************************************************************/
883883
884static int coco_bitbanger_filter(mess_image *img, const int *pulses, int total_pulses, int total_duration)
884static int coco_bitbanger_filter(const device_config *img, const int *pulses, int total_pulses, int total_duration)
885885{
886886   int i;
887887   int result = 0;
src/mess/drivers/tm990189.c
r2166r2167
184184   xmit_callback         /* called when a character is transmitted */
185185};
186186
187static mess_image *rs232_fp;
187static const device_config *rs232_fp;
188188static UINT8 rs232_rts;
189189static emu_timer *rs232_input_timer;
190190
r2166r2167
552552   case 5: /* CKON: set DECKCONTROL */
553553      LED_state |= 0x20;
554554      {
555         mess_image *img = image_from_devtype_and_index(IO_CASSETTE, 0);
555         const device_config *img = image_from_devtype_and_index(IO_CASSETTE, 0);
556556         cassette_change_state(img, CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR);
557557      }
558558      break;
r2166r2167
560560   case 6: /* CKOF: clear DECKCONTROL */
561561      LED_state &= ~0x20;
562562      {
563         mess_image *img = image_from_devtype_and_index(IO_CASSETTE, 0);
563         const device_config *img = image_from_devtype_and_index(IO_CASSETTE, 0);
564564         cassette_change_state(img, CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
565565      }
566566      break;
src/mess/drivers/lynx.c
r2166r2167
306306   return IMAGE_VERIFY_PASS;
307307}
308308
309static void lynx_crc_keyword(mess_image *image)
309static void lynx_crc_keyword(const device_config *image)
310310{
311311    const char *info;
312312
src/mess/drivers/apexc.c
r2166r2167
3333
3434typedef struct cylinder
3535{
36   mess_image *fd;
36   const device_config *fd;
3737   int writable;
3838} cylinder;
3939
r2166r2167
142142
143143typedef struct tape
144144{
145   mess_image *fd;
145   const device_config *fd;
146146} tape;
147147
148148static tape apexc_tapes[2];
src/mess/drivers/x68k.c
r2166r2167
17521752
17531753INPUT_PORTS_END
17541754
1755static void dimdsk_set_geometry(mess_image* image)
1755static void dimdsk_set_geometry(const device_config* image)
17561756{
17571757   // DIM disk image header, most of this is guesswork
17581758   int tracks = 77;
src/mess/drivers/super80.c
r2166r2167
399399
400400/**************************** CASSETTE ROUTINES *****************************************************************/
401401
402static mess_image *cassette_device_image(void)
402static const device_config *cassette_device_image(void)
403403{
404404   return image_from_devtype_and_index(IO_CASSETTE, 0);
405405}
src/mess/drivers/sg1000.c
r2166r2167
505505   sf7000_fdc_int = state;
506506}
507507
508static void sf7000_fdc_index_callback(mess_image *img, int state)
508static void sf7000_fdc_index_callback(const device_config *img, int state)
509509{
510510   sf7000_fdc_index = state;
511511}
src/mess/drivers/a2600.c
r2166r2167
791791
792792      /* Check if we should stop the tape */
793793      if ( cpu_getactivecpu() >= 0 && activecpu_get_pc() == 0x00FD ) {
794         mess_image *img = image_from_devtype_and_index(IO_CASSETTE, 0);
794         const device_config *img = image_from_devtype_and_index(IO_CASSETTE, 0);
795795         if ( img ) {
796796            cassette_change_state(img, CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
797797         }
src/mess/drivers/tutor.c
r2166r2167
138138   TMS9928A_interrupt();
139139}
140140
141static mess_image *printer_fp(void)
141static const device_config *printer_fp(void)
142142{
143143   return image_from_devtype_and_index(IO_PARALLEL, 0);
144144}

Previous 15994 Revisions Next


© 1998-2018 The MESS Team