Previous 15994 Revisions Next

r3066 Wednesday 20th August, 2008 at 18:08:09 UTC by Wilbert Pol
Harddisks are now implemented as a mame device.
[src/emu/machine]scsicd.c scsihd.c
[src/mess]mess.mak
[src/mess/devices]harddriv.c harddriv.h idedrive.c idedrive.h
[src/mess/drivers]at.c bebox.c concept.c geneve.c ip20.c ip22.c mac.c pc.c ti990_10.c ti99_4p.c ti99_4x.c ti99_8.c
[src/mess/includes]corvushd.h
[src/mess/machine]990_hd.c 990_hd.h 99_ide.c 99_ide.h bebox.c concept.c corvushd.c mac.c pc_hdc.c pc_hdc.h smc92x4.c smc92x4.h ti99_4x.c ti99_4x.h

src/emu/machine/scsihd.c
r3065r3066
1010
1111#ifdef MESS
1212#include "devices/harddriv.h"
13#include "deprecat.h"
1314#endif
1415#include "scsihd.h"
1516
r3065r3066
236237   state_save_register_item( tag, 0, our_this->blocks );
237238
238239#ifdef MESS
239   our_this->disk = mess_hd_get_hard_disk_file_by_number( diskregion );
240   /* TODO: get rid of this ifdef MESS section */
241   our_this->disk = mess_hd_get_hard_disk_file( device_list_find_by_tag( Machine->config->devicelist, HARDDISK, diskregion ) );
240242#else
241243   our_this->disk = hard_disk_open(get_disk_handle( diskregion ));
242244
src/emu/machine/scsicd.c
r3065r3066
696696
697697#ifdef MESS
698698   /* TODO: get rid of this ifdef MESS section */
699   our_this->cdrom = mess_cd_get_cdrom_file( device_list_find_by_tag( Machine->config->devicelist, CDROM, "cdrom" ) );
699   our_this->cdrom = mess_cd_get_cdrom_file( device_list_find_by_tag( Machine->config->devicelist, CDROM, diskregion ) );
700700#else
701701   our_this->cdrom = cdrom_open(get_disk_handle( diskregion ));
702702
src/mess/includes/corvushd.h
r3065r3066
173173//
174174// Prototypes
175175//
176UINT8 corvus_hdc_init( void );
176UINT8 corvus_hdc_init( running_machine *machine );
177177READ8_HANDLER ( corvus_hdc_status_r );
178178READ8_HANDLER ( corvus_hdc_data_r );
179179WRITE8_HANDLER ( corvus_hdc_data_w );
src/mess/machine/990_hd.c
r3065r3066
159159static hdc_t hdc;
160160
161161
162/*
163   Initialize hard disk unit
164*/
165DEVICE_START( ti990_hd )
162static int get_id_from_device( const device_config *device )
166163{
167   hd_unit_t *d;
168   int id = image_index_in_device(device);
164   int id = -1;
169165
170   assert ((id >= 0) && (id < MAX_DISK_UNIT));
166   if ( ! strcmp( "harddisk1", device->tag ) )
167   {
168      id = 0;
169   }
170   else if ( ! strcmp( "harddisk2", device->tag ) )
171   {
172      id = 1;
173   }
174   else if ( ! strcmp( "harddisk3", device->tag ) )
175   {
176      id = 2;
177   }
178   else if ( ! strcmp( "harddisk4", device->tag ) )
179   {
180      id = 3;
181   }
182   assert( id >= 0 );
171183
172   d = &hdc.d[id];
173   memset(d, 0, sizeof(*d));
184   return id;
185}
174186
175   d->img = device;
176   d->format = format_mame;   /* don't care */
177   d->hd_handle = NULL;
178   d->wp = 1;
179   d->unsafe = 1;
180187
181   /* clear attention line */
182   /*hdc.w[0] &= ~ (0x80 >> id);*/
183
184   DEVICE_START_CALL(mess_hd);
185}
186
187188/*DEVICE_STOP( ti990_hd )
188189{
189190   d->img = NULL;
r3065r3066
194195*/
195196DEVICE_IMAGE_LOAD( ti990_hd )
196197{
197   int id = image_index_in_device(image);
198   int id = get_id_from_device( image );
198199   hd_unit_t *d;
199   char tag[8];
200   const hard_disk_info *standard_header;
201   disk_image_header custom_header;
202   int bytes_read;
200   hard_disk_file   *hd_file;
203201
202   d = &hdc.d[id];
203   d->img = image;
204204
205   if ((id < 0) || (id >= MAX_DISK_UNIT))
206      return INIT_FAIL;
205   hd_file = mess_hd_get_hard_disk_file( image );
207206
208   d = &hdc.d[id];
209
210   bytes_read = image_fread(image, tag, sizeof(tag));
211   if (bytes_read != sizeof(tag))
212      return INIT_FAIL;;
213   if (! strncmp(tag, "MComprHD", 8))
207   if ( hd_file )
214208   {
215      /* standard hard disk format */
209      const hard_disk_info *standard_header;
216210
217      /* open image */
218      if (device_load_mess_hd(image))
219         return INIT_FAIL;
211      d->format = format_mame;
212      d->hd_handle = hd_file;
220213
221      /* set file descriptor */
222      d->format = format_mame;
223      d->hd_handle = mess_hd_get_hard_disk_file(image);
224      /* tell whether the image is writable */
225      d->wp = !image_is_writable(image);
214      /* use standard hard disk image header. */
215      standard_header = hard_disk_get_info(d->hd_handle);
216
217      d->cylinders = standard_header->cylinders;
218      d->heads = standard_header->heads;
219      d->sectors_per_track = standard_header->sectors;
220      d->bytes_per_sector = standard_header->sectorbytes;
226221   }
227222   else
228223   {
229224      /* older, custom format */
225      disk_image_header custom_header;
226      int bytes_read;
230227
231228      /* set file descriptor */
232229      d->format = format_old;
233230      d->hd_handle = NULL;
234      /* tell whether the image is writable */
235      d->wp = ! image_is_writable(image);
236   }
237231
238   d->unsafe = 1;
239   /* set attention line */
240   hdc.w[0] |= (0x80 >> id);
241
242   /* read geometry */
243   switch (d->format)
244   {
245   case format_mame:
246      /* use standard hard disk image header. */
247      standard_header = hard_disk_get_info(d->hd_handle);
248
249      d->cylinders = standard_header->cylinders;
250      d->heads = standard_header->heads;
251      d->sectors_per_track = standard_header->sectors;
252      d->bytes_per_sector = standard_header->sectorbytes;
253      break;
254
255   case format_old:
256232      /* use custom image header. */
257233      /* to convert old header-less images to this format, insert a 16-byte
258234      header as follow: 00 00 03 8f  00 00 00 05  00 00 00 21  00 00 01 00 */
r3065r3066
260236      bytes_read = image_fread(d->img, &custom_header, sizeof(custom_header));
261237      if (bytes_read != sizeof(custom_header))
262238      {
263         device_unload_ti990_hd(image);
239         d->format = format_mame;    /* don't care */
240         d->wp = 1;
241         d->unsafe = 1;
264242         return INIT_FAIL;
265243      }
266244
r3065r3066
268246      d->heads = get_UINT32BE(custom_header.heads);
269247      d->sectors_per_track = get_UINT32BE(custom_header.sectors_per_track);
270248      d->bytes_per_sector = get_UINT32BE(custom_header.bytes_per_sector);
271      break;
272249   }
273250
274251   if (d->bytes_per_sector > MAX_SECTOR_SIZE)
275252   {
276      device_unload_ti990_hd(image);
253      d->format = format_mame;
254      d->hd_handle = NULL;
255      d->wp = 1;
256      d->unsafe = 1;
277257      return INIT_FAIL;
278258   }
279259
260   /* tell whether the image is writable */
261   d->wp = ! image_is_writable( image );
262
263   d->unsafe = 1;
264   /* set attention line */
265   hdc.w[0] |= (0x80 >> id);
266
280267   return INIT_PASS;
281268}
282269
r3065r3066
285272*/
286273DEVICE_IMAGE_UNLOAD( ti990_hd )
287274{
288   int id = image_index_in_device(image);
275   int id = get_id_from_device( image );
289276   hd_unit_t *d;
290277
291   if ((id < 0) || (id >= MAX_DISK_UNIT))
292      return;
293
294278   d = &hdc.d[id];
295279
296   switch (d->format)
297   {
298   case format_mame:
299      device_unload_mess_hd(image);
300      break;
301
302   case format_old:
303      /* no additional clean up is needed */
304      break;
305   }
306
307280   d->format = format_mame;   /* don't care */
308281   d->hd_handle = NULL;
309282   d->wp = 1;
r3065r3066
337310/*
338311   Init the hdc core
339312*/
340void ti990_hdc_init(void (*interrupt_callback)(int state))
313MACHINE_START(ti990_hdc)
341314{
342315   int i;
343316
317   /* initialize harddisk information */
318   /* attention lines will be set by DEVICE_IMAGE_LOD */
319   for (i=0; i<MAX_DISK_UNIT; i++)
320   {
321      hdc.d[i].format = format_mame;
322      hdc.d[i].hd_handle = NULL;
323      hdc.d[i].wp = 1;
324      hdc.d[i].unsafe = 1;
325   }
326}
344327
328
329void ti990_hdc_init(running_machine *machine, void (*interrupt_callback)(int state))
330{
345331   memset(hdc.w, 0, sizeof(hdc.w));
346332   hdc.w[7] = w7_idle;
347   /* set attention lines */
348   for (i=0; i<MAX_DISK_UNIT; i++)
349      if (is_unit_loaded(i))
350         hdc.w[0] |= (0x80 >> i);
351333
334   /* get references to harddisk devices */
335   hdc.d[0].img = device_list_find_by_tag( machine->config->devicelist, HARDDISK, "harddisk1" );
336   hdc.d[1].img = device_list_find_by_tag( machine->config->devicelist, HARDDISK, "harddisk2" );
337   hdc.d[2].img = device_list_find_by_tag( machine->config->devicelist, HARDDISK, "harddisk3" );
338   hdc.d[3].img = device_list_find_by_tag( machine->config->devicelist, HARDDISK, "harddisk4" );
339
352340   hdc.interrupt_callback = interrupt_callback;
353341
354342   update_interrupt();
355343}
356344
345
357346/*
358347   Parse the disk select lines, and return the corresponding tape unit.
359348   (-1 if none)
r3065r3066
10351024      }
10361025   }
10371026}
1027
1028
1029static const struct harddisk_callback_config ti990_harddisk_config =
1030{
1031   DEVICE_IMAGE_LOAD_NAME( ti990_hd ),
1032   DEVICE_IMAGE_UNLOAD_NAME( ti990_hd )
1033};
1034
1035MACHINE_DRIVER_START( ti990_hdc )
1036   MDRV_DEVICE_ADD( "harddisk1", HARDDISK )
1037   MDRV_DEVICE_CONFIG( ti990_harddisk_config )
1038   MDRV_DEVICE_ADD( "harddisk2", HARDDISK )
1039   MDRV_DEVICE_CONFIG( ti990_harddisk_config )
1040   MDRV_DEVICE_ADD( "harddisk3", HARDDISK )
1041   MDRV_DEVICE_CONFIG( ti990_harddisk_config )
1042   MDRV_DEVICE_ADD( "harddisk4", HARDDISK )
1043   MDRV_DEVICE_CONFIG( ti990_harddisk_config )
1044MACHINE_DRIVER_END
1045
src/mess/machine/990_hd.h
r3065r3066
11/*
22   990_hd.h: include file for 990_hd.c
33*/
4#ifndef __990_HD_H_
5#define __990_HD_H_
46
5DEVICE_START( ti990_hd );
6DEVICE_IMAGE_LOAD( ti990_hd );
7DEVICE_IMAGE_UNLOAD( ti990_hd );
7#include "devices/harddriv.h"
88
9void ti990_hdc_init(void (*interrupt_callback)(int state));
9MACHINE_START( ti990_hdc );
1010
11extern READ16_HANDLER(ti990_hdc_r);
12extern WRITE16_HANDLER(ti990_hdc_w);
11void ti990_hdc_init(running_machine *machine, void (*interrupt_callback)(int state));
1312
13READ16_HANDLER(ti990_hdc_r);
14WRITE16_HANDLER(ti990_hdc_w);
15
16MACHINE_DRIVER_EXTERN( ti990_hdc );
17
18#endif
src/mess/machine/pc_hdc.c
r3065r3066
3434#include "machine/8237dma.h"
3535#include "devices/harddriv.h"
3636#include "memconv.h"
37#include "deprecat.h"
3738
3839
3940#define LOG_HDC_STATUS      0
r3065r3066
210211
211212static hard_disk_file *pc_hdc_file(int id)
212213{
213   const device_config *img;
214   const device_config *img = NULL;
214215
215   img = image_from_devtype_and_index(IO_HARDDISK, id);
216   switch( id )
217   {
218   case 0:
219      img = device_list_find_by_tag( Machine->config->devicelist, HARDDISK, "harddisk1" );
220      break;
221   case 1:
222      img = device_list_find_by_tag( Machine->config->devicelist, HARDDISK, "harddisk2" );
223      break;
224   case 2:
225      img = device_list_find_by_tag( Machine->config->devicelist, HARDDISK, "harddisk3" );
226      break;
227   case 3:
228      img = device_list_find_by_tag( Machine->config->devicelist, HARDDISK, "harddisk4" );
229      break;
230   }
231
232   if ( img == NULL )
233      return NULL;
234 
216235   if (!image_exists(img))
217236      return NULL;
218237
r3065r3066
821840READ32_HANDLER ( pc32le_HDC2_r ) { return read32le_with_read8_handler(pc_HDC2_r, machine, offset, mem_mask); }
822841WRITE32_HANDLER ( pc32le_HDC1_w ) { write32le_with_write8_handler(pc_HDC1_w, machine, offset, data, mem_mask); }
823842WRITE32_HANDLER ( pc32le_HDC2_w ) { write32le_with_write8_handler(pc_HDC2_w, machine, offset, data, mem_mask); }
843
844
845MACHINE_DRIVER_START( pc_hdc )
846   /* harddisk */
847   MDRV_DEVICE_ADD("harddisk1", HARDDISK)
848   MDRV_DEVICE_ADD("harddisk2", HARDDISK)
849   MDRV_DEVICE_ADD("harddisk3", HARDDISK)
850   MDRV_DEVICE_ADD("harddisk4", HARDDISK)
851MACHINE_DRIVER_END
852
853
src/mess/machine/pc_hdc.h
r3065r3066
2525
2626void pc_hdc_set_dma8237_device( const device_config *dma8237 );
2727
28MACHINE_DRIVER_EXTERN( pc_hdc );
29
2830#endif /* PC_HDC_H */
src/mess/machine/corvushd.c
r3065r3066
369369//
370370// Prototypes
371371//
372static hard_disk_file *corvus_hdc_file(int id);
372static hard_disk_file *corvus_hdc_file(running_machine *machine, int id);
373373static TIMER_CALLBACK(corvus_hdc_callback);
374374
375375//
r3065r3066
554554
555555   LOG(("corvus_write_sector: Write Drive: %d, physical sector: 0x%5.5x\n", drv, sector));
556556
557   if(drv >= device_count(machine, IO_HARDDISK)) {
558      logerror("corvus_write_sector: Attempt to write to non-existant drive: %d\n", drv);
559      return STAT_FATAL_ERR | STAT_DRIVE_NOT_ONLINE;
560   }
561
562   disk = corvus_hdc_file(drv);
557   disk = corvus_hdc_file(machine, drv);
563558   if(!disk) {
564559      logerror("corvus_write_sector: Failure returned by corvus_hdc_file(%d)\n", drv);
565560      return STAT_FATAL_ERR | STAT_DRIVE_NOT_ONLINE;
r3065r3066
670665
671666   LOG(("corvus_read_sector: Read Drive: %d, physical sector: 0x%5.5x\n", drv, sector));
672667
673   if(drv >= device_count(machine, IO_HARDDISK)) {
674      logerror("corvus_read_sector: Attempt to read from non-existant drive: %d\n", drv);
675      return STAT_FATAL_ERR | STAT_DRIVE_NOT_ONLINE;
676   }
677
678   disk = corvus_hdc_file(drv);
668   disk = corvus_hdc_file(machine, drv);
679669   if(!disk) {
680670      logerror("corvus_read_sector: Failure returned by corvus_hdc_file(%d)\n", drv);
681671      return STAT_FATAL_ERR | STAT_DRIVE_NOT_ONLINE;
r3065r3066
966956   //
967957   drv -= 1;                           // Internally, drives start at 0
968958
969   if(drv >= device_count(machine, IO_HARDDISK)) {
959   if ( ! corvus_hdc_file( machine, drv ) )
960   {
970961      logerror("corvus_get_drive_parameters: Attempt to retrieve parameters from non-existant drive: %d\n", drv);
971962      c->xmit_bytes = 1;
972963      return STAT_FATAL_ERR | STAT_DRIVE_NOT_ONLINE;
r3065r3066
11811172// Returns:
11821173//      hard_disk_file object
11831174//
1184static hard_disk_file *corvus_hdc_file(int id) {
1185
1175static hard_disk_file *corvus_hdc_file(running_machine *machine, int id) {
1176   const char *tags[] = {
1177      "harddisk1"
1178   };
11861179   const device_config *img;
11871180
1188   img = image_from_devtype_and_index(IO_HARDDISK, id);
1181   /* Only one harddisk supported right now */
1182   assert ( id == 0 );
1183
1184   img = device_list_find_by_tag( machine->config->devicelist, HARDDISK, tags[id] );
1185
1186   if ( !img )
1187      return NULL;
1188
11891189   if (!image_exists(img))
11901190      return NULL;
11911191
r3065r3066
14331433// Returns:
14341434//      NULL if there's no file to attach to
14351435//
1436UINT8 corvus_hdc_init() {
1436UINT8 corvus_hdc_init(running_machine *machine) {
14371437
14381438   corvus_hdc_t         *c = &corvus_hdc;   // Pick up global controller structure
14391439   hard_disk_file   *disk;            // Structures for interface to CHD routines
14401440   hard_disk_info   *info;
14411441
1442   if((disk = corvus_hdc_file(0)))            // Attach to the CHD file
1442   if((disk = corvus_hdc_file(machine, 0)))            // Attach to the CHD file
14431443      info = hard_disk_get_info(disk);      // Pick up the Head/Cylinder/Sector info
14441444   else
14451445      return 0;
src/mess/machine/mac.c
r3065r3066
13821382{
13831383   1,                                      /* 2 SCSI devices */
13841384   {
1385    { SCSI_ID_5, "hard0", SCSI_DEVICE_HARDDISK },  /* SCSI ID 5, using CHD 1, and it's a harddisk */
1386    { SCSI_ID_6, "hard1", SCSI_DEVICE_HARDDISK }   /* SCSI ID 6, using CHD 0, and it's a harddisk */
1385    { SCSI_ID_5, "harddisk1", SCSI_DEVICE_HARDDISK },  /* SCSI ID 5, using CHD 1, and it's a harddisk */
1386    { SCSI_ID_6, "harddisk2", SCSI_DEVICE_HARDDISK }   /* SCSI ID 6, using CHD 0, and it's a harddisk */
13871387   }
13881388};
13891389
src/mess/machine/concept.c
r3065r3066
8282} expansion_slots[4];
8383
8484static void concept_fdc_init(running_machine *machine, int slot);
85static void concept_hdc_init(int slot);
85static void concept_hdc_init(running_machine *machine, int slot);
8686
8787MACHINE_START(concept)
8888{
r3065r3066
105105   /* initialize expansion slots */
106106   memset(expansion_slots, 0, sizeof(expansion_slots));
107107
108   concept_hdc_init(1);   /* Flat cable Hard Disk Controller in Slot 2 */
108   concept_hdc_init(machine, 1);   /* Flat cable Hard Disk Controller in Slot 2 */
109109   concept_fdc_init(machine, 2);   /* Floppy Disk Controller in Slot 3 */
110110}
111111
r3065r3066
686686 *   Concept Hard Disk Controller (hdc)
687687 */
688688
689static void concept_hdc_init(int slot);
690
691689static  READ8_HANDLER(concept_hdc_reg_r);
692690static WRITE8_HANDLER(concept_hdc_reg_w);
693691static  READ8_HANDLER(concept_hdc_rom_r);
r3065r3066
696694 *   Hook up the Register and ROM R/W routines into the Slot I/O Space
697695 */
698696
699static void concept_hdc_init(int slot)
697static void concept_hdc_init(running_machine *machine, int slot)
700698{
701   if(corvus_hdc_init())
699   if(corvus_hdc_init(machine))
702700      install_expansion_slot(slot, concept_hdc_reg_r, concept_hdc_reg_w, concept_hdc_rom_r, NULL);
703701}
704702
src/mess/machine/99_ide.c
r3065r3066
1919
2020#include "driver.h"
2121#include "machine/idectrl.h"
22#include "devices/idedrive.h"
2322#include "machine/rtc65271.h"
2423#include "ti99_4x.h"
2524#include "99_peb.h"
r3065r3066
364363   }
365364}
366365
367
368
369void ti99_ide_harddisk_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
370{
371   switch(state)
372   {
373      /* --- the following bits of info are returned as 64-bit signed integers --- */
374      case MESS_DEVINFO_INT_COUNT:                  info->i = 1; break;
375
376      /* --- the following bits of info are returned as pointers to data or functions --- */
377      case DEVINFO_PTR_IDEDRIVE_INTERFACE: info->p = (void *) ~0; /* FIXME */ break;
378
379      /* --- the following bits of info are returned as NULL-terminated strings --- */
380      case MESS_DEVINFO_STR_DEV_TAG:               strcpy(info->s = device_temp_str(), "99_ide"); break;
381
382      default: ide_harddisk_device_getinfo(devclass, state, info); break;
383   }
384}
src/mess/machine/99_ide.h
r3065r3066
11int ti99_ide_load_memcard(running_machine *machine);
22int ti99_ide_save_memcard(void);
33
4void ti99_ide_harddisk_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info);
5
64void ti99_ide_init(running_machine *machine);
75void ti99_ide_reset(running_machine *machine, int in_tms9995_mode);
86
src/mess/machine/bebox.c
r3065r3066
10281028{
10291029   2, /* 2 SCSI devices */
10301030   {
1031      { SCSI_ID_0, "scsi0", SCSI_DEVICE_HARDDISK },   /* SCSI ID 0, using HD 0, HD */
1032      { SCSI_ID_3, "scsi3", SCSI_DEVICE_CDROM }   /* SCSI ID 3, using CHD 0, CD-ROM */
1031      { SCSI_ID_0, "harddisk1", SCSI_DEVICE_HARDDISK },   /* SCSI ID 0, using HD 0, HD */
1032      { SCSI_ID_3, "cdrom", SCSI_DEVICE_CDROM }   /* SCSI ID 3, using CHD 0, CD-ROM */
10331033   }
10341034};
10351035
src/mess/machine/ti99_4x.c
r3065r3066
689689   slot_type[id] = SLOT_EMPTY;
690690}
691691
692DEVICE_IMAGE_LOAD( ti99_hd )
693{
694   int id = image_index_in_device(image);
695   return smc92x4_hd_load(image, id);
696}
697
698DEVICE_IMAGE_UNLOAD( ti99_hd )
699{
700   int id = image_index_in_device(image);
701   smc92x4_hd_unload(image, id);
702}
703
704692static const TMS9928a_interface tms9918_interface =
705693{
706694   TMS99x8,
src/mess/machine/smc92x4.c
r3065r3066
285285   unsigned int cylinders, heads, sectors_per_track, bytes_per_sector;
286286} hd[10];
287287
288int smc92x4_hd_load(const device_config *image, int disk_unit)
288static int get_id_from_device( const device_config *device )
289289{
290   int id = -1;
291
292   if ( ! strcmp( "harddisk1", device->tag ) )
293   {
294      id = 0;
295   }
296   else if ( ! strcmp( "harddisk2", device->tag ) )
297   {
298      id = 1;
299   }
300   else if ( ! strcmp( "harddisk3", device->tag ) )
301   {
302      id = 2;
303   }
304   assert( id >= 0 );
305
306   return id;
307}
308
309
310DEVICE_IMAGE_LOAD(smc92x4_hd)
311{
290312   const hard_disk_info *info;
291313
292   if (device_load_mess_hd(image) == INIT_PASS)
314   if ( mess_hd_get_hard_disk_file(image) )
293315   {
316      int disk_unit = get_id_from_device( image );
317
294318      hd[disk_unit].hd_handle = mess_hd_get_hard_disk_file(image);
295319      hd[disk_unit].wp = !image_is_writable(image);
296320      hd[disk_unit].current_cylinder = 0;
r3065r3066
304328            || (hd[disk_unit].sectors_per_track > 256)
305329            || (hd[disk_unit].bytes_per_sector > 2048))
306330      {
307         smc92x4_hd_unload(image, disk_unit);
331         hd[disk_unit].hd_handle = NULL;
308332         return INIT_FAIL;
309333      }
310334      if (hd[disk_unit].bytes_per_sector != 256)
311335      {
312         smc92x4_hd_unload(image, disk_unit);
336         hd[disk_unit].hd_handle = NULL;
313337         return INIT_FAIL;
314338      }
315339      return INIT_PASS;
r3065r3066
318342   return INIT_FAIL;
319343}
320344
321void smc92x4_hd_unload(const device_config *image, int disk_unit)
345DEVICE_IMAGE_UNLOAD(smc92x4_hd)
322346{
323   device_unload_mess_hd(image);
347   int disk_unit = get_id_from_device( image );
348
324349   hd[disk_unit].hd_handle = NULL;
325350}
326351
r3065r3066
12251250   smc92x4_w(0, offset, data);
12261251}
12271252
1253static const struct harddisk_callback_config smc92x4_harddisk_config =
1254{
1255   DEVICE_IMAGE_LOAD_NAME( smc92x4_hd ),
1256   DEVICE_IMAGE_UNLOAD_NAME( smc92x4_hd )
1257};
1258
1259
1260MACHINE_DRIVER_START( smc92x4_hd )
1261   MDRV_DEVICE_ADD( "harddisk1", HARDDISK )
1262   MDRV_DEVICE_CONFIG( smc92x4_harddisk_config )
1263   MDRV_DEVICE_ADD( "harddisk2", HARDDISK )
1264   MDRV_DEVICE_CONFIG( smc92x4_harddisk_config )
1265   MDRV_DEVICE_ADD( "harddisk3", HARDDISK )
1266   MDRV_DEVICE_CONFIG( smc92x4_harddisk_config )
1267MACHINE_DRIVER_END
src/mess/machine/ti99_4x.h
r3065r3066
147147DEVICE_IMAGE_LOAD( ti99_cart );
148148DEVICE_IMAGE_UNLOAD( ti99_cart );
149149
150DEVICE_IMAGE_LOAD( ti99_hd );
151DEVICE_IMAGE_UNLOAD( ti99_hd );
152
153150VIDEO_START( ti99_4ev );
154151INTERRUPT_GEN( ti99_vblank_interrupt );
155152INTERRUPT_GEN( ti99_4ev_hblank_interrupt );
src/mess/machine/smc92x4.h
r3065r3066
4141   void (*int_callback)(int which, int state);
4242} smc92x4_intf;
4343
44int smc92x4_hd_load(const device_config *image, int disk_unit);
45void smc92x4_hd_unload(const device_config *image, int disk_unit);
4644
4745void smc92x4_init(int which, const smc92x4_intf *intf);
4846void smc92x4_reset(int which);
r3065r3066
5048void smc92x4_w(int which, int offset, int data);
5149 READ8_HANDLER(smc92x4_0_r);
5250WRITE8_HANDLER(smc92x4_0_w);
51
52MACHINE_DRIVER_EXTERN( smc92x4_hd );
53
src/mess/mess.mak
r3065r3066
466466   $(MESS_DEVICES)/basicdsk.o   \
467467   $(MESS_DEVICES)/flopdrv.o   \
468468   $(MESS_DEVICES)/harddriv.o   \
469   $(MESS_DEVICES)/idedrive.o   \
470469   $(MESS_DEVICES)/dsk.o      \
471470   $(MESS_DEVICES)/z80bin.o   \
472471   $(MESS_DEVICES)/chd_cd.o   \
src/mess/devices/idedrive.c
r3065r3066
1/*********************************************************************
2
3   idedrive.c
4
5   Code to interface the MESS image code with MAME's IDE core
6
7   Raphael Nabet 2003
8
9 *********************************************************************/
10
11#include "driver.h"
12#include "idedrive.h"
13#include "harddriv.h"
14#include "machine/idectrl.h"
15
16/* FIXME - this is so completely broken until we device-ize IDE drives */
17struct ide_interface;
18
19static void ide_get_params(const device_config *image, int *which_bus, int *which_address,
20   struct ide_interface **intf,
21   device_start_func *parent_init,
22   device_image_load_func *parent_load,
23   device_image_unload_func *parent_unload)
24{
25   const mess_device_class *devclass = mess_devclass_from_core_device(image);
26   mess_device_class parent_devclass;
27
28   *which_bus = image_index_in_device(image);
29   *which_address = (int) mess_device_get_info_int(devclass, DEVINFO_INT_IDEDRIVE_ADDRESS);
30   *intf = (struct ide_interface *) mess_device_get_info_ptr(devclass, DEVINFO_PTR_IDEDRIVE_INTERFACE);
31
32   parent_devclass = *devclass;
33   parent_devclass.get_info = harddisk_device_getinfo;
34
35   if (parent_init)
36      *parent_init = (device_start_func) mess_device_get_info_fct(&parent_devclass, MESS_DEVINFO_PTR_START);
37   if (parent_load)
38      *parent_load = (device_image_load_func) mess_device_get_info_fct(&parent_devclass, MESS_DEVINFO_PTR_LOAD);
39   if (parent_unload)
40      *parent_unload = (device_image_unload_func) mess_device_get_info_fct(&parent_devclass, MESS_DEVINFO_PTR_UNLOAD);
41
42   assert(*which_address == 0);
43   assert(*intf);
44}
45
46
47
48/*-------------------------------------------------
49   DEVICE_START(ide_hd) - Init an IDE hard disk device
50-------------------------------------------------*/
51
52static DEVICE_START(ide_hd)
53{
54   int which_bus, which_address;
55   struct ide_interface *intf;
56   device_start_func parent_init;
57
58   /* get the basics */
59   ide_get_params(device, &which_bus, &which_address, &intf, &parent_init, NULL, NULL);
60
61   /* call the parent init function */
62   parent_init(device);
63
64   /* configure IDE */
65   /* FIXME IDE */
66   /* ide_controller_init_custom(which_bus, intf, NULL); */
67}
68
69
70
71/*-------------------------------------------------
72   DEVICE_IMAGE_LOAD(ide_hd) - Load an IDE hard disk image
73-------------------------------------------------*/
74
75static DEVICE_IMAGE_LOAD(ide_hd)
76{
77   int result, which_bus, which_address;
78   struct ide_interface *intf;
79   device_image_load_func parent_load;
80
81   /* get the basics */
82   ide_get_params(image, &which_bus, &which_address, &intf, NULL, &parent_load, NULL);
83
84   /* call the parent load function */
85   result = parent_load(image);
86   if (result != INIT_PASS)
87      return result;
88
89   /* configure IDE */
90   /* FIXME IDE */
91   /* ide_controller_init_custom(which_bus, intf, mess_hd_get_chd_file(image)); */
92   /* ide_controller_reset(which_bus); */
93   return INIT_PASS;
94}
95
96
97
98/*-------------------------------------------------
99   DEVICE_IMAGE_UNLOAD(ide_hd) - Unload an IDE hard disk image
100-------------------------------------------------*/
101
102static DEVICE_IMAGE_UNLOAD(ide_hd)
103{
104   int which_bus, which_address;
105   struct ide_interface *intf;
106   device_image_unload_func parent_unload;
107
108   /* get the basics */
109   ide_get_params(image, &which_bus, &which_address, &intf, NULL, NULL, &parent_unload);
110
111   /* call the parent unload function */
112   parent_unload(image);
113
114   /* configure IDE */
115   /* FIXME IDE */
116   /* ide_controller_init_custom(which_bus, intf, NULL); */
117   /* ide_controller_reset(which_bus); */
118}
119
120
121
122/*-------------------------------------------------
123   ide_hd_validity_check - check this device's validity
124-------------------------------------------------*/
125
126static int ide_hd_validity_check(const mess_device_class *devclass)
127{
128   int error = 0;
129   int which_address;
130   INT64 count;
131   struct ide_interface *intf;
132
133   which_address = (int) mess_device_get_info_int(devclass, DEVINFO_INT_IDEDRIVE_ADDRESS);
134   intf = (struct ide_interface *) mess_device_get_info_ptr(devclass, DEVINFO_PTR_IDEDRIVE_INTERFACE);
135   count = mess_device_get_info_int(devclass, MESS_DEVINFO_INT_COUNT);
136
137   if (which_address != 0)
138   {
139      mame_printf_error("%s: IDE device has non-zero address\n", devclass->gamedrv->name);
140      error = 1;
141   }
142
143   if (!intf)
144   {
145      mame_printf_error("%s: IDE device does not specify an interface\n", devclass->gamedrv->name);
146      error = 1;
147   }
148
149   return error;
150}
151
152
153
154/*-------------------------------------------------
155   ide_harddisk_device_getinfo - Get info proc
156-------------------------------------------------*/
157
158void ide_harddisk_device_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
159{
160   switch(state)
161   {
162      /* --- the following bits of info are returned as pointers to data or functions --- */
163      case MESS_DEVINFO_PTR_START:            info->start = DEVICE_START_NAME(ide_hd); break;
164      case MESS_DEVINFO_PTR_LOAD:               info->load = DEVICE_IMAGE_LOAD_NAME(ide_hd); break;
165      case MESS_DEVINFO_PTR_UNLOAD:            info->unload = DEVICE_IMAGE_UNLOAD_NAME(ide_hd); break;
166      case MESS_DEVINFO_PTR_VALIDITY_CHECK:      info->validity_check = ide_hd_validity_check; break;
167
168      /* --- the following bits of info are returned as NULL-terminated strings --- */
169      case MESS_DEVINFO_STR_NAME:               strcpy(info->s = device_temp_str(), "ideharddrive"); break;
170      case MESS_DEVINFO_STR_SHORT_NAME:         strcpy(info->s = device_temp_str(), "idehd"); break;
171      case MESS_DEVINFO_STR_DESCRIPTION:         strcpy(info->s = device_temp_str(), "IDE Hard Disk"); break;
172
173      default: harddisk_device_getinfo(devclass, state, info); break;
174   }
175}
src/mess/devices/idedrive.h
r3065r3066
1/*********************************************************************
2
3   idedrive.h
4
5   Code to interface the MESS image code with MAME's IDE core
6
7*********************************************************************/
8
9#ifndef IDEDRIVE_H
10#define IDEDRIVE_H
11
12#include "device.h"
13#include "image.h"
14
15
16enum
17{
18   DEVINFO_INT_IDEDRIVE_ADDRESS = MESS_DEVINFO_INT_DEV_SPECIFIC,
19
20   DEVINFO_PTR_IDEDRIVE_INTERFACE = MESS_DEVINFO_PTR_DEV_SPECIFIC
21};
22
23void ide_harddisk_device_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info);
24
25
26#endif /* IDEDRIVE_H */
src/mess/devices/harddriv.c
r3065r3066
2121#include "harddriv.h"
2222
2323
24#define MAX_HARDDISKS   8
25#define USE_CHD_OPEN   0
26
2724static const char *const error_strings[] =
2825{
2926   "no error",
r3065r3066
5047   "unsupported CHD version"
5148};
5249
53static hard_disk_file *drive_handles[MAX_HARDDISKS];
54
5550static const char *chd_get_error_string(int chderr)
5651{
5752   if ((chderr < 0 ) || (chderr >= (sizeof(error_strings) / sizeof(error_strings[0]))))
r3065r3066
7368   "C1-[512]-1024;H1/2/[4]/8;S1-[16]-64;L128/256/[512]/1024;K512/1024/2048/[4096]";
7469
7570
76#define MESSHDTAG "mess_hd"
77
78struct mess_hd
71typedef struct _dev_harddisk_t   dev_harddisk_t;
72struct _dev_harddisk_t
7973{
80   chd_file *chd;
81   hard_disk_file *hard_disk_handle;
74   const struct harddisk_callback_config   *config;
75   chd_file      *chd;
76   hard_disk_file   *hard_disk_handle;
8277};
8378
84static struct mess_hd *get_drive(const device_config *img)
85{
86   return image_lookuptag(img, MESSHDTAG);
87}
8879
89
90
91/*************************************
92 *
93 *   device_init_mess_hd()
94 *
95 *   Device init
96 *
97 *************************************/
98
99DEVICE_START( mess_hd )
80INLINE dev_harddisk_t *get_safe_token(const device_config *device)
10081{
101   struct mess_hd *hd;
102   hd = image_alloctag(device, MESSHDTAG, sizeof(struct mess_hd));
103   hd->hard_disk_handle = NULL;
82   assert( device != NULL );
83   assert( device->token != NULL );
84   assert( ( device->type == DEVICE_GET_INFO_NAME(mess_hd) ) ||
85           ( device->type == DEVICE_GET_INFO_NAME(mess_ide) ) );
86   return (dev_harddisk_t *) device->token;
10487}
10588
10689
107
10890/*************************************
10991 *
110 *   DEVICE_IMAGE_LOAD_NAME(mess_hd)
111 *  DEVICE_IMAGE_CREATE_NAME(mess_hd)
92 *   DEVICE_IMAGE_LOAD(mess_hd)
93 *  DEVICE_IMAGE_CREATE(mess_hd)
11294 *
11395 *   Device load and create
11496 *
r3065r3066
11698
11799static int internal_load_mess_hd(const device_config *image, const char *metadata)
118100{
119   chd_error err = 0;
120   struct mess_hd *hd;
121   int is_writeable;
122   int id = image_index_in_device(image);
101   dev_harddisk_t   *harddisk = get_safe_token( image );
102   chd_error      err = 0;
103   int            is_writeable;
123104
124   hd = get_drive(image);
125
126105   /* open the CHD file */
127106   do
128107   {
129108      is_writeable = image_is_writable(image);
130      hd->chd = NULL;
131      err = chd_open_file(image_core_file(image), is_writeable ? CHD_OPEN_READWRITE : CHD_OPEN_READ, NULL, &hd->chd);
109      harddisk->chd = NULL;
110      err = chd_open_file(image_core_file(image), is_writeable ? CHD_OPEN_READWRITE : CHD_OPEN_READ, NULL, &harddisk->chd);
132111
133112      /* special case; if we get CHDERR_FILE_NOT_WRITEABLE, make the
134113       * image read only and repeat */
135114      if (err == CHDERR_FILE_NOT_WRITEABLE)
136115         image_make_readonly(image);
137116   }
138   while(!hd->chd && is_writeable && (err == CHDERR_FILE_NOT_WRITEABLE));
139   if (!hd->chd)
117   while(!harddisk->chd && is_writeable && (err == CHDERR_FILE_NOT_WRITEABLE));
118   if (!harddisk->chd)
140119      goto done;
141120
142121   /* if we created the image and hence, have metadata to set, set the metadata */
143122   if (metadata)
144123   {
145      err = chd_set_metadata(hd->chd, HARD_DISK_METADATA_TAG, 0, metadata, strlen(metadata) + 1);
124      err = chd_set_metadata(harddisk->chd, HARD_DISK_METADATA_TAG, 0, metadata, strlen(metadata) + 1);
146125      if (err != CHDERR_NONE)
147126         goto done;
148127   }
149128
150129   /* open the hard disk file */
151   hd->hard_disk_handle = hard_disk_open(hd->chd);
152   if (!hd->hard_disk_handle)
130   harddisk->hard_disk_handle = hard_disk_open(harddisk->chd);
131   if (!harddisk->hard_disk_handle)
153132      goto done;
154133
155   drive_handles[id] = hd->hard_disk_handle;
156
157134done:
158135   if (err)
159136   {
160137      /* if we had an error, close out the CHD */
161      if (hd->chd != NULL)
138      if (harddisk->chd != NULL)
162139      {
163         chd_close(hd->chd);
164         hd->chd = NULL;
140         chd_close(harddisk->chd);
141         harddisk->chd = NULL;
165142      }
166143
167144      image_seterror(image, IMAGE_ERROR_UNSPECIFIED, chd_get_error_string(err));
r3065r3066
173150
174151DEVICE_IMAGE_LOAD( mess_hd )
175152{
176   return internal_load_mess_hd(image, NULL);
153   dev_harddisk_t   *harddisk = get_safe_token( image );
154   int our_result;
155
156   our_result = internal_load_mess_hd(image, NULL);
157
158   /* Check if there is an image_load callback defined */
159   if ( harddisk->config && harddisk->config->device_image_load )
160   {
161      /* Let the override do some additional work/checks */
162      our_result = harddisk->config->device_image_load( image );
163   }
164   return our_result;
177165}
178166
179167
r3065r3066
208196
209197/*************************************
210198 *
211 *   DEVICE_IMAGE_UNLOAD_NAME(mess_hd)
199 *   DEVICE_IMAGE_UNLOAD(mess_hd)
212200 *
213201 *   Device unload
214202 *
r3065r3066
216204
217205DEVICE_IMAGE_UNLOAD( mess_hd )
218206{
219   struct mess_hd *hd = get_drive(image);
207   dev_harddisk_t   *harddisk = get_safe_token( image );
220208
221   if (hd->hard_disk_handle != NULL)
209   /* Check if there is an image_unload callback defined */
210   if ( harddisk->config && harddisk->config->device_image_unload )
222211   {
223      hard_disk_close(hd->hard_disk_handle);
224      hd->hard_disk_handle = NULL;
212      harddisk->config->device_image_unload( image );
225213   }
226214
227   if (hd->chd != NULL)
215   if (harddisk->hard_disk_handle != NULL)
228216   {
229      chd_close(hd->chd);
230      hd->chd = NULL;
217      hard_disk_close(harddisk->hard_disk_handle);
218      harddisk->hard_disk_handle = NULL;
231219   }
232220
233   drive_handles[image_index_in_device(image)] = NULL;
221   if (harddisk->chd != NULL)
222   {
223      chd_close(harddisk->chd);
224      harddisk->chd = NULL;
225   }
234226}
235227
236228
237
238229/*************************************
239230 *
240 *   Get the MESS/MAME hard disk handle (from the src/harddisk.c core)
231 *  Get the MESS/MAME hard disk handle (from the src/harddisk.c core)
241232 *  after an image has been opened with the mess_hd core
242233 *
243234 *************************************/
244235
245hard_disk_file *mess_hd_get_hard_disk_file(const device_config *image)
236hard_disk_file *mess_hd_get_hard_disk_file(const device_config *device)
246237{
247   struct mess_hd *hd = get_drive(image);
248   return hd->hard_disk_handle;
238   dev_harddisk_t   *harddisk = get_safe_token( device );
239
240   return harddisk->hard_disk_handle;
249241}
250242
251243
252
253244/*************************************
254245 *
255246 *   Get the MESS/MAME CHD file (from the src/chd.c core)
r3065r3066
257248 *
258249 *************************************/
259250
260chd_file *mess_hd_get_chd_file(const device_config *image)
251chd_file *mess_hd_get_chd_file(const device_config *device)
261252{
262253   chd_file *result = NULL;
263254   hard_disk_file *hd_file;
264255
265   if (image)
256   if (device)
266257   {
267      hd_file = mess_hd_get_hard_disk_file(image);
258      hd_file = mess_hd_get_hard_disk_file(device);
268259      if (hd_file)
269260         result = hard_disk_get_chd(hd_file);
270261   }
r3065r3066
272263}
273264
274265
266/*-------------------------------------------------
267    DEVICE_START(mess_hd)
268-------------------------------------------------*/
275269
276/*************************************
277 *
278 *   Device specification function
279 *
280 *************************************/
270static DEVICE_START(mess_hd)
271{
272   dev_harddisk_t   *harddisk = get_safe_token( device );
281273
282void harddisk_device_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
274   harddisk->config = device->static_config;
275   harddisk->chd = NULL;
276   harddisk->hard_disk_handle = NULL;
277}
278
279
280/*-------------------------------------------------
281    DEVICE_GET_INFO(mess_hd)
282-------------------------------------------------*/
283
284DEVICE_GET_INFO(mess_hd)
283285{
284   switch(state)
286   switch( state )
285287   {
286288      /* --- the following bits of info are returned as 64-bit signed integers --- */
287      case MESS_DEVINFO_INT_TYPE:                  info->i = IO_HARDDISK; break;
288      case MESS_DEVINFO_INT_READABLE:               info->i = 1; break;
289      case MESS_DEVINFO_INT_WRITEABLE:            info->i = 1; break;
290      case MESS_DEVINFO_INT_CREATABLE:            info->i = 0; break;
291      case MESS_DEVINFO_INT_CREATE_OPTCOUNT:         info->i = 1; break;
289      case DEVINFO_INT_TOKEN_BYTES:            info->i = sizeof(dev_harddisk_t); break;
290      case DEVINFO_INT_INLINE_CONFIG_BYTES:      info->i = 0; break;
291      case DEVINFO_INT_CLASS:                  info->i = DEVICE_CLASS_PERIPHERAL; break;
292      case DEVINFO_INT_IMAGE_TYPE:            info->i = IO_HARDDISK; break;
293      case DEVINFO_INT_IMAGE_READABLE:         info->i = 1; break;
294      case DEVINFO_INT_IMAGE_WRITEABLE:         info->i = 1; break;
295      case DEVINFO_INT_IMAGE_CREATABLE:         info->i = 0; break;
296      case DEVINFO_INT_IMAGE_CREATE_OPTCOUNT:      info->i = 1; break;
292297
293298      /* --- the following bits of info are returned as pointers to data or functions --- */
294      case MESS_DEVINFO_PTR_START:                  info->start = DEVICE_START_NAME(mess_hd); break;
295      case MESS_DEVINFO_PTR_LOAD:                  info->load = DEVICE_IMAGE_LOAD_NAME(mess_hd); break;
296      case MESS_DEVINFO_PTR_UNLOAD:               info->unload = DEVICE_IMAGE_UNLOAD_NAME(mess_hd); break;
297      case MESS_DEVINFO_PTR_CREATE:               info->create = DEVICE_IMAGE_CREATE_NAME(mess_hd); break;
298      case MESS_DEVINFO_PTR_CREATE_OPTGUIDE:         info->p = (void *) mess_hd_option_guide; break;
299      case MESS_DEVINFO_PTR_CREATE_OPTSPEC+0:         info->p = (void *) mess_hd_option_spec;
299      case DEVINFO_FCT_START:                  info->start = DEVICE_START_NAME(mess_hd); break;
300      case DEVINFO_FCT_IMAGE_LOAD:            info->f = (genf *) DEVICE_IMAGE_LOAD_NAME(mess_hd); break;
301      case DEVINFO_FCT_IMAGE_UNLOAD:            info->f = (genf *) DEVICE_IMAGE_UNLOAD_NAME(mess_hd); break;
302      case DEVINFO_FCT_IMAGE_CREATE:            info->f = (genf *) DEVICE_IMAGE_CREATE_NAME(mess_hd); break;
303      case DEVINFO_PTR_IMAGE_CREATE_OPTGUIDE:      info->p = (void *) mess_hd_option_guide; break;
304      case DEVINFO_PTR_IMAGE_CREATE_OPTSPEC+0:   info->p = (void *) mess_hd_option_spec; break;
300305
301306      /* --- the following bits of info are returned as NULL-terminated strings --- */
302      case MESS_DEVINFO_STR_DEV_FILE:               strcpy(info->s = device_temp_str(), __FILE__); break;
303      case MESS_DEVINFO_STR_FILE_EXTENSIONS:         strcpy(info->s = device_temp_str(), "chd,hd"); break;
304      case MESS_DEVINFO_STR_CREATE_OPTNAME+0:         strcpy(info->s = device_temp_str(), "chd"); break;
305      case MESS_DEVINFO_STR_CREATE_OPTDESC+0:         strcpy(info->s = device_temp_str(), "MAME/MESS CHD Hard drive"); break;
306      case MESS_DEVINFO_STR_CREATE_OPTEXTS+0:         strcpy(info->s = device_temp_str(), "chd,hd"); break;
307      case DEVINFO_STR_NAME:                  info->s = "Harddisk"; break;
308      case DEVINFO_STR_FAMILY:               info->s = "Harddisk"; break;
309      case DEVINFO_STR_SOURCE_FILE:            info->s = __FILE__; break;
310      case DEVINFO_STR_IMAGE_FILE_EXTENSIONS:      info->s = "chd,hd"; break;
311      case DEVINFO_STR_IMAGE_CREATE_OPTNAME+0:   info->s = "chd"; break;
312      case DEVINFO_STR_IMAGE_CREATE_OPTDESC+0:   info->s = "MAME/MESS CHD Hard drive"; break;
313      case DEVINFO_STR_IMAGE_CREATE_OPTEXTS+0:   info->s = "chd,hd"; break;
307314   }
308315}
309316
310hard_disk_file *mess_hd_get_hard_disk_file_by_number(const char *diskregion)
317
318static DEVICE_START(mess_ide)
311319{
312   const device_config *device;
313   device = device_list_find_by_tag(Machine->config->devicelist, DEVICE_TYPE_WILDCARD, diskregion);
314   return mess_hd_get_hard_disk_file(device);
320   /* old code from idedrive.c */
321#ifdef UNUSED_FUNCTION
322   int which_bus, which_address;
323   struct ide_interface *intf;
324   device_start_func parent_init;
325
326   /* get the basics */
327   ide_get_params(device, &which_bus, &which_address, &intf, &parent_init, NULL, NULL);
328
329   /* call the parent init function */
330   parent_init(device);
331
332   /* configure IDE */
333   /* FIXME IDE */
334   /* ide_controller_init_custom(which_bus, intf, NULL); */
335#endif
336
337   DEVICE_START_CALL(mess_hd);
315338}
316339
340
341static DEVICE_IMAGE_LOAD(mess_ide)
342{
343   /* old code from idedrive.c */
344#ifdef UNUSED_FUNCTION
345   int result, which_bus, which_address;
346   struct ide_interface *intf;
347   device_image_load_func parent_load;
348
349   /* get the basics */
350   ide_get_params(image, &which_bus, &which_address, &intf, NULL, &parent_load, NULL);
351
352   /* call the parent load function */
353   result = parent_load(image);
354   if (result != INIT_PASS)
355      return result;
356
357   /* configure IDE */
358   /* FIXME IDE */
359   /* ide_controller_init_custom(which_bus, intf, mess_hd_get_chd_file(image)); */
360   /* ide_controller_reset(which_bus); */
361   return INIT_PASS;
362#endif
363   return device_load_mess_hd( image );
364}
365
366
367static DEVICE_IMAGE_UNLOAD(mess_ide)
368{
369   /* old code from idedrive.c */
370#ifdef UNUSED_FUNCTION
371   int which_bus, which_address;
372   struct ide_interface *intf;
373   device_image_unload_func parent_unload;
374
375   /* get the basics */
376   ide_get_params(image, &which_bus, &which_address, &intf, NULL, NULL, &parent_unload);
377
378   /* call the parent unload function */
379   parent_unload(image);
380
381   /* configure IDE */
382   /* FIXME IDE */
383   /* ide_controller_init_custom(which_bus, intf, NULL); */
384   /* ide_controller_reset(which_bus); */
385#endif
386   device_unload_mess_hd( image );
387}
388
389
390#ifdef UNSUED_FUNCTION
391/*-------------------------------------------------
392    ide_hd_validity_check - check this device's validity
393-------------------------------------------------*/
394
395static int ide_hd_validity_check(const mess_device_class *devclass)
396{
397   int error = 0;
398   int which_address;
399   INT64 count;
400   struct ide_interface *intf;
401
402   which_address = (int) mess_device_get_info_int(devclass, DEVINFO_INT_IDEDRIVE_ADDRESS);
403   intf = (struct ide_interface *) mess_device_get_info_ptr(devclass, DEVINFO_PTR_IDEDRIVE_INTERFACE);
404   count = mess_device_get_info_int(devclass, MESS_DEVINFO_INT_COUNT);
405
406   if (which_address != 0)
407   {
408      mame_printf_error("%s: IDE device has non-zero address\n", devclass->gamedrv->name);
409      error = 1;
410   }
411
412   if (!intf)
413   {
414      mame_printf_error("%s: IDE device does not specify an interface\n", devclass->gamedrv->name);
415      error = 1;
416   }
417
418   return error;
419}
420#endif
421
422
423DEVICE_GET_INFO(mess_ide)
424{
425   switch( state )
426   {
427      /* --- the following bits of info are returned as pointers to data or functions --- */
428      case DEVINFO_FCT_START:                  info->start = DEVICE_START_NAME(mess_ide); break;
429      case DEVINFO_FCT_IMAGE_LOAD:            info->f = (genf *) DEVICE_IMAGE_LOAD_NAME(mess_ide); break;
430      case DEVINFO_FCT_IMAGE_UNLOAD:            info->f = (genf *) DEVICE_IMAGE_UNLOAD_NAME(mess_ide); break;
431//      case DEVINFO_FCT_IMAGE_VERIFY:            info->f = (genf *) ide_hd_validity_check; break;
432
433      /* --- the following bits of info are returned as NULL-terminated strings --- */
434      case DEVINFO_STR_NAME:                  info->s = "IDE harddisk"; break;
435      case DEVINFO_STR_IMAGE_INSTANCE_NAME:      info->s = "ideharddrive"; break;
436      case DEVINFO_STR_IMAGE_BRIEF_INSTANCE_NAME:   info->s = "idehd"; break;
437
438      default:                           DEVICE_GET_INFO_CALL( mess_hd ); break;
439   }
440}
441
src/mess/devices/harddriv.h
r3065r3066
1313#include "image.h"
1414#include "harddisk.h"
1515
16#define HARDDISK      DEVICE_GET_INFO_NAME(mess_hd)
17#define IDE_HARDDISK   DEVICE_GET_INFO_NAME(mess_ide)
1618
17DEVICE_START( mess_hd );
18DEVICE_IMAGE_LOAD( mess_hd );
19DEVICE_IMAGE_UNLOAD( mess_hd );
19DEVICE_GET_INFO( mess_hd );
20DEVICE_GET_INFO( mess_ide );
2021
21hard_disk_file *mess_hd_get_hard_disk_file(const device_config *image);
22hard_disk_file *mess_hd_get_hard_disk_file_by_number(const char *diskregion);
23chd_file *mess_hd_get_chd_file(const device_config *image);
22hard_disk_file *mess_hd_get_hard_disk_file(const device_config *device);
23chd_file *mess_hd_get_chd_file(const device_config *device);
2424
25void harddisk_device_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info);
25struct harddisk_callback_config
26{
27   device_image_load_func      device_image_load;
28   device_image_unload_func   device_image_unload;
29};
2630
2731
2832#endif /* MESS_HD_H */
src/mess/drivers/mac.c
r3065r3066
140140   MDRV_CPU_PROGRAM_MAP(macplus_map, 0)
141141
142142   MDRV_MACHINE_START(macscsi)
143
144   MDRV_DEVICE_ADD( "harddisk1", HARDDISK )
145   MDRV_DEVICE_ADD( "harddisk2", HARDDISK )
143146MACHINE_DRIVER_END
144147
145148
r3065r3066
340343   }
341344}
342345
343static void mac_harddisk_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
344{
345   /* harddisk */
346   switch(state)
347   {
348      /* --- the following bits of info are returned as 64-bit signed integers --- */
349      case MESS_DEVINFO_INT_COUNT:                     info->i = 2; break;
350
351      default: harddisk_device_getinfo(devclass, state, info); break;
352   }
353}
354
355346static SYSTEM_CONFIG_START(mac128k)
356347   CONFIG_DEVICE(mac128512_floppy_getinfo)
357348   CONFIG_RAM_DEFAULT(0x020000)
r3065r3066
364355
365356static SYSTEM_CONFIG_START(macplus)
366357   CONFIG_DEVICE(mac_floppy_getinfo)
367   CONFIG_DEVICE(mac_harddisk_getinfo)
368358   CONFIG_RAM         (0x080000)
369359   CONFIG_RAM_DEFAULT   (0x100000)
370360   CONFIG_RAM         (0x200000)
r3065r3066
374364
375365static SYSTEM_CONFIG_START(macse)
376366   CONFIG_DEVICE(mac_floppy_getinfo)
377   CONFIG_DEVICE(mac_harddisk_getinfo)
378367   CONFIG_RAM_DEFAULT   (0x100000)
379368   CONFIG_RAM         (0x200000)
380369   CONFIG_RAM         (0x280000)
src/mess/drivers/ti99_8.c
r3065r3066
427427
428428   /* devices */
429429   MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt )   /* FIXME */
430
431   MDRV_DEVICE_ADD( "harddisk1", HARDDISK )
432   MDRV_DEVICE_ADD( "harddisk2", HARDDISK )
433   MDRV_DEVICE_ADD( "harddisk3", HARDDISK )
434
435   MDRV_DEVICE_ADD( "ide_harddisk", IDE_HARDDISK )
430436MACHINE_DRIVER_END
431437
432438
r3065r3066
460466
461467   /* devices */
462468   MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt )   /* FIXME */
469
470   MDRV_DEVICE_ADD( "harddisk1", HARDDISK )
471   MDRV_DEVICE_ADD( "harddisk2", HARDDISK )
472   MDRV_DEVICE_ADD( "harddisk3", HARDDISK )
473
474   MDRV_DEVICE_ADD( "ide_harddisk", IDE_HARDDISK )
463475MACHINE_DRIVER_END
464476
465477/*
r3065r3066
543555   }
544556}
545557
546static void ti99_8_harddisk_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
547{
548   /* harddisk */
549   switch(state)
550   {
551      /* --- the following bits of info are returned as 64-bit signed integers --- */
552      case MESS_DEVINFO_INT_TYPE:                     info->i = IO_HARDDISK; break;
553      case MESS_DEVINFO_INT_READABLE:                  info->i = 1; break;
554      case MESS_DEVINFO_INT_WRITEABLE:                  info->i = 1; break;
555      case MESS_DEVINFO_INT_CREATABLE:                  info->i = 0; break;
556      case MESS_DEVINFO_INT_COUNT:                     info->i = 3; break;
557
558      /* --- the following bits of info are returned as pointers to data or functions --- */
559      case MESS_DEVINFO_PTR_START:                     info->start = DEVICE_START_NAME(mess_hd); break;
560      case MESS_DEVINFO_PTR_LOAD:                     info->load = DEVICE_IMAGE_LOAD_NAME(ti99_hd); break;
561      case MESS_DEVINFO_PTR_UNLOAD:                  info->unload = DEVICE_IMAGE_UNLOAD_NAME(ti99_hd); break;
562
563      /* --- the following bits of info are returned as NULL-terminated strings --- */
564      case MESS_DEVINFO_STR_FILE_EXTENSIONS:            strcpy(info->s = device_temp_str(), "hd"); break;
565      case MESS_DEVINFO_STR_DEV_TAG:                  strcpy(info->s = device_temp_str(), "ti99_8_hd"); break;
566   }
567}
568
569558static void ti99_8_parallel_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
570559{
571560   /* parallel */
r3065r3066
640629   CONFIG_DEVICE(ti99_8_cartslot_getinfo)
641630#if 1
642631   CONFIG_DEVICE(ti99_8_floppy_getinfo)
643   CONFIG_DEVICE(ti99_8_harddisk_getinfo)
644   CONFIG_DEVICE(ti99_ide_harddisk_getinfo)
645632   CONFIG_DEVICE(ti99_8_parallel_getinfo)
646633   CONFIG_DEVICE(ti99_8_serial_getinfo)
647634   /*CONFIG_DEVICE(ti99_8_quickload_getinfo)*/
src/mess/drivers/concept.c
r3065r3066
7777   MDRV_VIDEO_UPDATE(concept)
7878
7979   /* no sound? */
80
81   MDRV_DEVICE_ADD( "harddisk1", HARDDISK )
8082MACHINE_DRIVER_END
8183
8284
r3065r3066
314316   }
315317}
316318
317static void concept_harddisk_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
318{
319   /* Hard Drive */
320   switch(state)
321   {
322      /* --- the following bits of info are returned as 64-bit signed integers --- */
323      case MESS_DEVINFO_INT_COUNT:                     info->i = 1; break;
324319
325      default:                              harddisk_device_getinfo(devclass, state, info); break;
326   }
327}
328
329320static SYSTEM_CONFIG_START(concept)
330321   /* The concept should eventually support floppies, hard disks, etc. */
331322   CONFIG_DEVICE(concept_floppy_getinfo)
332   CONFIG_DEVICE(concept_harddisk_getinfo)
333323SYSTEM_CONFIG_END
334324
335325
src/mess/drivers/geneve.c
r3065r3066
481481
482482   /* devices */
483483   MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt )   /* FIXME */
484
485   MDRV_DEVICE_ADD( "harddisk1", HARDDISK )
486   MDRV_DEVICE_ADD( "harddisk2", HARDDISK )
487   MDRV_DEVICE_ADD( "harddisk3", HARDDISK )
488
489   MDRV_DEVICE_ADD( "ide_harddisk", IDE_HARDDISK )
484490MACHINE_DRIVER_END
485491
486492
r3065r3066
548554   }
549555}
550556
551static void geneve_harddisk_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
552{
553   /* harddisk */
554   switch(state)
555   {
556      /* --- the following bits of info are returned as 64-bit signed integers --- */
557      case MESS_DEVINFO_INT_TYPE:                     info->i = IO_HARDDISK; break;
558      case MESS_DEVINFO_INT_READABLE:                  info->i = 1; break;
559      case MESS_DEVINFO_INT_WRITEABLE:                  info->i = 1; break;
560      case MESS_DEVINFO_INT_CREATABLE:                  info->i = 0; break;
561      case MESS_DEVINFO_INT_COUNT:                     info->i = 3; break;
562
563      /* --- the following bits of info are returned as pointers to data or functions --- */
564      case MESS_DEVINFO_PTR_START:                     info->start = DEVICE_START_NAME(mess_hd); break;
565      case MESS_DEVINFO_PTR_LOAD:                     info->load = DEVICE_IMAGE_LOAD_NAME(ti99_hd); break;
566      case MESS_DEVINFO_PTR_UNLOAD:                  info->unload = DEVICE_IMAGE_UNLOAD_NAME(ti99_hd); break;
567
568      /* --- the following bits of info are returned as NULL-terminated strings --- */
569      case MESS_DEVINFO_STR_FILE_EXTENSIONS:            strcpy(info->s = device_temp_str(), "hd"); break;
570      case MESS_DEVINFO_STR_DEV_TAG:                  strcpy(info->s = device_temp_str(), "geneve_hd"); break;
571   }
572}
573
574557static void geneve_parallel_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
575558{
576559   /* parallel */
r3065r3066
637620
638621static SYSTEM_CONFIG_START(geneve)
639622   CONFIG_DEVICE(geneve_floppy_getinfo)
640   CONFIG_DEVICE(geneve_harddisk_getinfo)
641   CONFIG_DEVICE(ti99_ide_harddisk_getinfo)
642623   CONFIG_DEVICE(geneve_parallel_getinfo)
643624   CONFIG_DEVICE(geneve_serial_getinfo)
644625   CONFIG_DEVICE(geneve_memcard_getinfo)
src/mess/drivers/ip22.c
r3065r3066
14191419static const SCSIConfigTable dev_table =
14201420{
14211421        1,                                      /* 1 SCSI device */
1422        { { SCSI_ID_4, 0, SCSI_DEVICE_CDROM } }  /* SCSI ID 4, using CD 0, and it's a CD-ROM */
1423//     { SCSI_ID_2, 0, SCSI_DEVICE_CDROM } } /* SCSI ID 2, using HD 0, and it's a CD-ROM */
1422        { { SCSI_ID_4, "cdrom", SCSI_DEVICE_CDROM } }  /* SCSI ID 4, using CD 0, and it's a CD-ROM */
1423//     { SCSI_ID_2, "cdrom", SCSI_DEVICE_CDROM } } /* SCSI ID 2, using HD 0, and it's a CD-ROM */
14241424};
14251425
14261426static const struct WD33C93interface scsi_intf =
src/mess/drivers/at.c
r3065r3066
478478   MDRV_DEVICE_ADD("printer1", PRINTER)
479479   MDRV_DEVICE_ADD("printer2", PRINTER)
480480   MDRV_DEVICE_ADD("printer3", PRINTER)
481
482   /* harddisk */
483   MDRV_IMPORT_FROM( pc_hdc )
481484MACHINE_DRIVER_END
482485
483486
r3065r3066
540543   MDRV_DEVICE_ADD("printer1", PRINTER)
541544   MDRV_DEVICE_ADD("printer2", PRINTER)
542545   MDRV_DEVICE_ADD("printer3", PRINTER)
546
547   /* harddisk */
548   MDRV_IMPORT_FROM( pc_hdc )
543549MACHINE_DRIVER_END
544550
545551
r3065r3066
609615   MDRV_DEVICE_ADD("printer1", PRINTER)
610616   MDRV_DEVICE_ADD("printer2", PRINTER)
611617   MDRV_DEVICE_ADD("printer3", PRINTER)
618
619   /* harddisk */
620   MDRV_IMPORT_FROM( pc_hdc )
612621MACHINE_DRIVER_END
613622
614623
r3065r3066
680689   MDRV_DEVICE_ADD("printer1", PRINTER)
681690   MDRV_DEVICE_ADD("printer2", PRINTER)
682691   MDRV_DEVICE_ADD("printer3", PRINTER)
692
693   /* harddisk */
694   MDRV_IMPORT_FROM( pc_hdc )
683695MACHINE_DRIVER_END
684696
685697
r3065r3066
748760   MDRV_DEVICE_ADD("printer1", PRINTER)
749761   MDRV_DEVICE_ADD("printer2", PRINTER)
750762   MDRV_DEVICE_ADD("printer3", PRINTER)
763
764   /* harddisk */
765   MDRV_IMPORT_FROM( pc_hdc )
751766MACHINE_DRIVER_END
752767
753768
r3065r3066
10291044   }
10301045}
10311046
1032static void ibmat_harddisk_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
1033{
1034   /* harddisk */
1035   switch(state)
1036   {
1037      /* --- the following bits of info are returned as 64-bit signed integers --- */
1038      case MESS_DEVINFO_INT_COUNT:                     info->i = 4; break;
10391047
1040      default:                              harddisk_device_getinfo(devclass, state, info); break;
1041   }
1042}
1043
10441048static SYSTEM_CONFIG_START(ibmat)
10451049   CONFIG_RAM_DEFAULT( (640+1024) * 1024 )
10461050   CONFIG_DEVICE(ibmat_floppy_getinfo)
1047   CONFIG_DEVICE(ibmat_harddisk_getinfo)
10481051SYSTEM_CONFIG_END
10491052
10501053/***************************************************************************
src/mess/drivers/ti990_10.c
r3065r3066
7575#include "machine/990_tap.h"
7676#include "video/911_vdt.h"
7777
78static MACHINE_START( ti990_10 )
79{
80   MACHINE_START_CALL( ti990_hdc );
81}
82
83
7884static MACHINE_RESET( ti990_10 )
7985{
8086   ti990_hold_load(machine);
r3065r3066
8288   ti990_reset_int();
8389
8490   ti990_tpc_init(ti990_set_int9);
85   ti990_hdc_init(ti990_set_int13);
91   ti990_hdc_init(machine, ti990_set_int13);
8692}
8793
8894static INTERRUPT_GEN( ti990_10_line_interrupt )
r3065r3066
201207   MDRV_CPU_IO_MAP(ti990_10_readcru, ti990_10_writecru)
202208   MDRV_CPU_PERIODIC_INT(ti990_10_line_interrupt, 120/*or 100 in Europe*/)
203209
210   MDRV_MACHINE_START( ti990_10 )
204211   MDRV_MACHINE_RESET( ti990_10 )
205212
206213   /* video hardware - we emulate a single 911 vdt display */
r3065r3066
223230   MDRV_SPEAKER_STANDARD_MONO("mono")
224231   MDRV_SOUND_ADD("beep", BEEP, 0)
225232   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
233
234   MDRV_IMPORT_FROM( ti990_hdc )
226235MACHINE_DRIVER_END
227236
228237
r3065r3066
285294   VDT911_KEY_PORTS
286295INPUT_PORTS_END
287296
288static void ti990_10_harddisk_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
289{
290   /* harddisk */
291   switch(state)
292   {
293      /* --- the following bits of info are returned as 64-bit signed integers --- */
294      case MESS_DEVINFO_INT_TYPE:                     info->i = IO_HARDDISK; break;
295      case MESS_DEVINFO_INT_READABLE:                  info->i = 1; break;
296      case MESS_DEVINFO_INT_WRITEABLE:                  info->i = 1; break;
297      case MESS_DEVINFO_INT_CREATABLE:                  info->i = 0; break;
298      case MESS_DEVINFO_INT_COUNT:                     info->i = 4; break;
299297
300      /* --- the following bits of info are returned as pointers to data or functions --- */
301      case MESS_DEVINFO_PTR_START:                     info->start = DEVICE_START_NAME(ti990_hd); break;
302      case MESS_DEVINFO_PTR_LOAD:                     info->load = DEVICE_IMAGE_LOAD_NAME(ti990_hd); break;
303      case MESS_DEVINFO_PTR_UNLOAD:                  info->unload = DEVICE_IMAGE_UNLOAD_NAME(ti990_hd); break;
304
305      /* --- the following bits of info are returned as NULL-terminated strings --- */
306      case MESS_DEVINFO_STR_FILE_EXTENSIONS:            strcpy(info->s = device_temp_str(), "hd"); break;
307   }
308}
309
310298static void ti990_10_cassette_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
311299{
312300   /* cassette */
r3065r3066
330318}
331319
332320static SYSTEM_CONFIG_START(ti990_10)
333   CONFIG_DEVICE(ti990_10_harddisk_getinfo)
334321   CONFIG_DEVICE(ti990_10_cassette_getinfo)
335322SYSTEM_CONFIG_END
336323
src/mess/drivers/bebox.c
r3065r3066
135135   MDRV_NVRAM_HANDLER( bebox )
136136
137137   MDRV_DEVICE_ADD( "cdrom", CDROM )
138
139   MDRV_DEVICE_ADD( "harddisk1", HARDDISK )
138140MACHINE_DRIVER_END
139141
140142static MACHINE_DRIVER_START( bebox2 )
r3065r3066
176178   }
177179}
178180
179static void bebox_harddisk_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
180{
181   /* harddisk */
182   switch(state)
183   {
184      /* --- the following bits of info are returned as 64-bit signed integers --- */
185      case MESS_DEVINFO_INT_COUNT:                     info->i = 1; break;
186181
187      default:                              harddisk_device_getinfo(devclass, state, info); break;
188   }
189}
190
191182static SYSTEM_CONFIG_START(bebox)
192183   CONFIG_RAM(8 * 1024 * 1024)
193184   CONFIG_RAM(16 * 1024 * 1024)
194185   CONFIG_RAM_DEFAULT(32 * 1024 * 1024)
195186   CONFIG_DEVICE(bebox_floppy_getinfo)
196   CONFIG_DEVICE(bebox_harddisk_getinfo)
197187SYSTEM_CONFIG_END
198188
199189
src/mess/drivers/ti99_4p.c
r3065r3066
4343#include "sound/5220intf.h"
4444#include "devices/harddriv.h"
4545#include "machine/idectrl.h"
46#include "machine/smc92x4.h"
4647
4748static ADDRESS_MAP_START(memmap, ADDRESS_SPACE_PROGRAM, 16)
4849
r3065r3066
280281
281282   /* devices */
282283   MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt )   /* FIXME */
284
285   MDRV_IMPORT_FROM( smc92x4_hd )
286
287   MDRV_DEVICE_ADD( "ide_harddisk", IDE_HARDDISK )
283288MACHINE_DRIVER_END
284289
285290
r3065r3066
337342   }
338343}
339344
340static void ti99_4p_harddisk_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
341{
342   /* harddisk */
343   switch(state)
344   {
345      /* --- the following bits of info are returned as 64-bit signed integers --- */
346      case MESS_DEVINFO_INT_TYPE:                     info->i = IO_HARDDISK; break;
347      case MESS_DEVINFO_INT_READABLE:                  info->i = 1; break;
348      case MESS_DEVINFO_INT_WRITEABLE:                  info->i = 1; break;
349      case MESS_DEVINFO_INT_CREATABLE:                  info->i = 0; break;
350      case MESS_DEVINFO_INT_COUNT:                     info->i = 3; break;
351
352      /* --- the following bits of info are returned as pointers to data or functions --- */
353      case MESS_DEVINFO_PTR_START:                     info->start = DEVICE_START_NAME(mess_hd); break;
354      case MESS_DEVINFO_PTR_LOAD:                     info->load = DEVICE_IMAGE_LOAD_NAME(ti99_hd); break;
355      case MESS_DEVINFO_PTR_UNLOAD:                  info->unload = DEVICE_IMAGE_UNLOAD_NAME(ti99_hd); break;
356
357      /* --- the following bits of info are returned as NULL-terminated strings --- */
358      case MESS_DEVINFO_STR_FILE_EXTENSIONS:            strcpy(info->s = device_temp_str(), "hd"); break;
359   }
360}
361
362345static void ti99_4p_parallel_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
363346{
364347   /* parallel */
r3065r3066
447430static SYSTEM_CONFIG_START(ti99_4p)
448431   CONFIG_DEVICE(ti99_4p_floppy_getinfo)
449432   CONFIG_DEVICE(ti99_4p_floppy_getinfo)
450   CONFIG_DEVICE(ti99_4p_harddisk_getinfo)
451   CONFIG_DEVICE(ti99_ide_harddisk_getinfo)
452433   CONFIG_DEVICE(ti99_4p_parallel_getinfo)
453434   CONFIG_DEVICE(ti99_4p_serial_getinfo)
454435   /*CONFIG_DEVICE(ti99_4p_quickload_getinfo)*/
src/mess/drivers/pc.c
r3065r3066
13381338   MDRV_DEVICE_CONFIG( ibm5150_pic8259_slave_config )
13391339
13401340   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
1341   MDRV_DEVICE_CONFIG( ibm5150_ppi8255_interface )
1341   MDRV_DEVICE_CONFIG( ibm5160_ppi8255_interface )
13421342
13431343   MDRV_DEVICE_ADD( "ins8250_0", INS8250 )         /* TODO: Verify model */
13441344   MDRV_DEVICE_CONFIG( ibm5150_com_interface[0] )
r3065r3066
13751375   MDRV_DEVICE_ADD("printer", PRINTER)
13761376   MDRV_DEVICE_ADD("printer2", PRINTER)
13771377   MDRV_DEVICE_ADD("printer3", PRINTER)
1378
1379   /* harddisk */
1380   MDRV_IMPORT_FROM( pc_hdc )
13781381MACHINE_DRIVER_END
13791382
13801383
r3065r3066
14011404   MDRV_DEVICE_CONFIG( ibm5150_pic8259_slave_config )
14021405
14031406   MDRV_DEVICE_ADD( "ppi8255", PPI8255 )
1404   MDRV_DEVICE_CONFIG( ibm5150_ppi8255_interface )
1407   MDRV_DEVICE_CONFIG( ibm5160_ppi8255_interface )
14051408
14061409   MDRV_DEVICE_ADD( "ins8250_0", INS8250 )         /* TODO: Verify model */
14071410   MDRV_DEVICE_CONFIG( ibm5150_com_interface[0] )
r3065r3066
14381441   MDRV_DEVICE_ADD("printer", PRINTER)
14391442   MDRV_DEVICE_ADD("printer2", PRINTER)
14401443   MDRV_DEVICE_ADD("printer3", PRINTER)
1444
1445   /* harddisk */
1446   MDRV_IMPORT_FROM( pc_hdc )
14411447MACHINE_DRIVER_END
14421448
14431449static MACHINE_DRIVER_START( ibm5150 )
r3065r3066
15041510   MDRV_DEVICE_ADD("printer", PRINTER)
15051511   MDRV_DEVICE_ADD("printer2", PRINTER)
15061512   MDRV_DEVICE_ADD("printer3", PRINTER)
1513
1514   /* harddisk */
1515   MDRV_IMPORT_FROM( pc_hdc )
15071516MACHINE_DRIVER_END
15081517
15091518static MACHINE_DRIVER_START( pccga )
r3065r3066
15671576   MDRV_DEVICE_ADD("printer", PRINTER)
15681577   MDRV_DEVICE_ADD("printer2", PRINTER)
15691578   MDRV_DEVICE_ADD("printer3", PRINTER)
1579
1580   /* harddisk */
1581   MDRV_IMPORT_FROM( pc_hdc )
15701582MACHINE_DRIVER_END
15711583
15721584
r3065r3066
16231635   MDRV_DEVICE_ADD("printer", PRINTER)
16241636   MDRV_DEVICE_ADD("printer2", PRINTER)
16251637   MDRV_DEVICE_ADD("printer3", PRINTER)
1638
1639   /* harddisk */
1640   MDRV_IMPORT_FROM( pc_hdc )
16261641MACHINE_DRIVER_END
16271642
16281643
r3065r3066
16851700   MDRV_DEVICE_ADD("printer", PRINTER)
16861701   MDRV_DEVICE_ADD("printer2", PRINTER)
16871702   MDRV_DEVICE_ADD("printer3", PRINTER)
1703
1704   /* harddisk */
1705   MDRV_IMPORT_FROM( pc_hdc )
16881706MACHINE_DRIVER_END
16891707
16901708
r3065r3066
17341752   MDRV_DEVICE_ADD("printer", PRINTER)
17351753   MDRV_DEVICE_ADD("printer2", PRINTER)
17361754   MDRV_DEVICE_ADD("printer3", PRINTER)
1755
1756   /* harddisk */
1757   MDRV_IMPORT_FROM( pc_hdc )
17371758MACHINE_DRIVER_END
17381759
17391760
r3065r3066
17851806   MDRV_DEVICE_ADD("printer", PRINTER)
17861807   MDRV_DEVICE_ADD("printer2", PRINTER)
17871808   MDRV_DEVICE_ADD("printer3", PRINTER)
1809
1810   /* harddisk */
1811   MDRV_IMPORT_FROM( pc_hdc )
17881812MACHINE_DRIVER_END
17891813
17901814
r3065r3066
18391863   MDRV_DEVICE_ADD("printer", PRINTER)
18401864   MDRV_DEVICE_ADD("printer2", PRINTER)
18411865   MDRV_DEVICE_ADD("printer3", PRINTER)
1866
1867   /* harddisk */
1868   MDRV_IMPORT_FROM( pc_hdc )
18421869MACHINE_DRIVER_END
18431870
18441871
r3065r3066
18971924   MDRV_SOUND_ADD("saa1099.2", SAA1099, 4772720)
18981925   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
18991926#endif
1927
1928   /* harddisk */
1929   MDRV_IMPORT_FROM( pc_hdc )
19001930MACHINE_DRIVER_END
19011931
19021932
r3065r3066
19441974   MDRV_DEVICE_ADD("printer", PRINTER)
19451975   MDRV_DEVICE_ADD("printer2", PRINTER)
19461976   MDRV_DEVICE_ADD("printer3", PRINTER)
1977
1978   /* harddisk */
1979   MDRV_IMPORT_FROM( pc_hdc )
19471980MACHINE_DRIVER_END
19481981
19491982
r3065r3066
24312464   }
24322465}
24332466
2434static void ibmpc_harddisk_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
2435{
2436   /* harddisk */
2437   switch(state)
2438   {
2439      /* --- the following bits of info are returned as 64-bit signed integers --- */
2440      case MESS_DEVINFO_INT_COUNT:                     info->i = 4; break;
24412467
2442      default:                              harddisk_device_getinfo(devclass, state, info); break;
2443   }
2444}
2445
24462468static void pcjr_cartslot_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
24472469{
24482470   switch( state )
r3065r3066
24652487   CONFIG_RAM_DEFAULT( 640 * 1024 )
24662488   CONFIG_DEVICE(ibmpc_cassette_getinfo)
24672489   CONFIG_DEVICE(ibmpc_floppy_getinfo)
2468   CONFIG_DEVICE(ibmpc_harddisk_getinfo)
24692490SYSTEM_CONFIG_END
24702491
24712492
24722493static SYSTEM_CONFIG_START(ibm5160)
24732494   CONFIG_RAM_DEFAULT( 640 * 1024 )
24742495   CONFIG_DEVICE(ibmpc_floppy_getinfo)
2475   CONFIG_DEVICE(ibmpc_harddisk_getinfo)
24762496SYSTEM_CONFIG_END
24772497
24782498
src/mess/drivers/ti99_4x.c
r3065r3066
3535#include "machine/smartmed.h"
3636#include "sound/5220intf.h"
3737#include "machine/idectrl.h"
38#include "machine/smc92x4.h"
3839
3940/*
4041    memory map
r3065r3066
530531
531532   /* devices */
532533   MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt )   /* FIXME */
534
535   MDRV_IMPORT_FROM( smc92x4_hd )
536
537   MDRV_DEVICE_ADD( "ide_harddisk", IDE_HARDDISK )
533538MACHINE_DRIVER_END
534539
535540static MACHINE_DRIVER_START(ti99_4_50hz)
r3065r3066
561566
562567   /* devices */
563568   MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt )   /* FIXME */
569
570   MDRV_IMPORT_FROM( smc92x4_hd )
571
572   MDRV_DEVICE_ADD( "ide_harddisk", IDE_HARDDISK )
564573MACHINE_DRIVER_END
565574
566575static MACHINE_DRIVER_START(ti99_4a_60hz)
r3065r3066
592601
593602   /* devices */
594603   MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt )   /* FIXME */
604
605   MDRV_IMPORT_FROM( smc92x4_hd )
606
607   MDRV_DEVICE_ADD( "ide_harddisk", IDE_HARDDISK )
595608MACHINE_DRIVER_END
596609
597610
r3065r3066
624637
625638   /* devices */
626639   MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt )   /* FIXME */
640
641   MDRV_IMPORT_FROM( smc92x4_hd )
642
643   MDRV_DEVICE_ADD( "ide_harddisk", IDE_HARDDISK )
627644MACHINE_DRIVER_END
628645
629646
r3065r3066
664681
665682   /* devices */
666683   MDRV_IDE_CONTROLLER_ADD( "ide", ti99_ide_interrupt )   /* FIXME */
684
685   MDRV_IMPORT_FROM( smc92x4_hd )
686
687   MDRV_DEVICE_ADD( "ide_harddisk", IDE_HARDDISK )
667688MACHINE_DRIVER_END
668689
669690
r3065r3066
820841   }
821842}
822843
823static void ti99_4_harddisk_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
824{
825   /* harddisk */
826   switch(state)
827   {
828      /* --- the following bits of info are returned as 64-bit signed integers --- */
829      case MESS_DEVINFO_INT_TYPE:                     info->i = IO_HARDDISK; break;
830      case MESS_DEVINFO_INT_READABLE:                  info->i = 1; break;
831      case MESS_DEVINFO_INT_WRITEABLE:                  info->i = 1; break;
832      case MESS_DEVINFO_INT_CREATABLE:                  info->i = 0; break;
833      case MESS_DEVINFO_INT_COUNT:                     info->i = 3; break;
834
835      /* --- the following bits of info are returned as pointers to data or functions --- */
836      case MESS_DEVINFO_PTR_START:                     info->start = DEVICE_START_NAME(mess_hd); break;
837      case MESS_DEVINFO_PTR_LOAD:                     info->load = DEVICE_IMAGE_LOAD_NAME(ti99_hd); break;
838      case MESS_DEVINFO_PTR_UNLOAD:                  info->unload = DEVICE_IMAGE_UNLOAD_NAME(ti99_hd); break;
839
840      /* --- the following bits of info are returned as NULL-terminated strings --- */
841      case MESS_DEVINFO_STR_FILE_EXTENSIONS:            strcpy(info->s = device_temp_str(), "hd"); break;
842      case MESS_DEVINFO_STR_DEV_TAG:                  strcpy(info->s = device_temp_str(), "ti99_4x_hd"); break;
843   }
844}
845
846844static void ti99_4_parallel_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
847845{
848846   /* parallel */
r3065r3066
932930   CONFIG_DEVICE(ti99_4_cassette_getinfo)
933931   CONFIG_DEVICE(ti99_4_cartslot_getinfo)
934932   CONFIG_DEVICE(ti99_4_floppy_getinfo)
935   CONFIG_DEVICE(ti99_4_harddisk_getinfo)
936   CONFIG_DEVICE(ti99_ide_harddisk_getinfo)
937933   CONFIG_DEVICE(ti99_4_parallel_getinfo)
938934   CONFIG_DEVICE(ti99_4_serial_getinfo)
939935   /*CONFIG_DEVICE(ti99_4_quickload_getinfo)*/
src/mess/drivers/ip20.c
r3065r3066
576576static const SCSIConfigTable dev_table =
577577{
578578        1,                                      /* 1 SCSI device */
579        { { SCSI_ID_6, 0, SCSI_DEVICE_CDROM } } /* SCSI ID 6, using CHD 0, and it's a CD-ROM */
579        { { SCSI_ID_6, "cdrom", SCSI_DEVICE_CDROM } } /* SCSI ID 6, using CHD 0, and it's a CD-ROM */
580580};
581581
582582static const struct WD33C93interface scsi_intf =

Previous 15994 Revisions Next


© 1998-2018 The MESS Team