Previous 15994 Revisions Next

r2195 Tuesday 1st April, 2008 at 11:15:21 UTC by Nathan Woods
Removed 'Machine' usage from src/mess/device.c; had to add it in a bunch of
other places though. Somebody will probably clean these up.
[src/mess]cheatms.c device.c device.h image.c tapectrl.c
[src/mess/devices]coco_fdc.c thomflop.c
[src/mess/machine]corvushd.c mc6843.c nec765.c pc_fdc.c wd17xx.c

src/mess/devices/coco_fdc.c
r2194r2195
420420      case 0x43:
421421      case 0x44:
422422      case 0x45:
423         if (device_count(IO_VHD) > 0)
423         if (device_count(Machine, IO_VHD) > 0)
424424            result = coco_vhd_io_r(machine, addr);
425425         break;
426426   }
r2194r2195
457457      case 0x43:
458458      case 0x44:
459459      case 0x45:
460         if (device_count(IO_VHD) > 0)
460         if (device_count(Machine, IO_VHD) > 0)
461461            coco_vhd_io_w(machine, addr, data);
462462         break;
463463   }
src/mess/devices/thomflop.c
r2194r2195
77**********************************************************************/
88
99#include "driver.h"
10#include "deprecat.h"
1011#include "includes/thomson.h"
1112#include "machine/wd17xx.h"
1213#include "devices/flopdrv.h"
r2194r2195
338339   LOG(( "to7_5p14_reset: CD 90-640 controller\n" ));
339340   thom_floppy_set_density( DEN_MFM_LO );
340341   wd17xx_reset();
341   for ( i = 0; i < device_count( IO_FLOPPY ); i++ )
342   for ( i = 0; i < device_count( Machine, IO_FLOPPY ); i++ )
342343   {
343344      const device_config * img = image_from_devtype_and_index( IO_FLOPPY, i );
344345      floppy_drive_set_ready_state( img, FLOPPY_DRIVE_READY, 0 );
r2194r2195
439440   LOG(( "to7_5p14sd_reset: CD 90-015 controller\n" ));
440441   thom_floppy_set_density( DEN_FM_LO );
441442   mc6843_reset();
442   for ( i = 0; i < device_count( IO_FLOPPY ); i++ )
443   for ( i = 0; i < device_count( Machine, IO_FLOPPY ); i++ )
443444   {
444445      const device_config * img = image_from_devtype_and_index( IO_FLOPPY, i );
445446      floppy_drive_set_ready_state( img, FLOPPY_DRIVE_READY, 0 );
r2194r2195
845846
846847   thom_floppy_set_density( DEN_MFM_LO );
847848
848   for ( i = 0; i < device_count( IO_FLOPPY ); i++ )
849   for ( i = 0; i < device_count( Machine, IO_FLOPPY ); i++ )
849850   {
850851      const device_config * img = image_from_devtype_and_index( IO_FLOPPY, i );
851852      floppy_drive_set_index_pulse_callback( img, to7_qdd_index_pulse_cb );
r2194r2195
15261527   int i;
15271528   LOG(( "thmfc_floppy_reset: THMFC1 controller\n" ));
15281529
1529   for ( i = 0; i < device_count( IO_FLOPPY ); i++ )
1530   for ( i = 0; i < device_count( Machine, IO_FLOPPY ); i++ )
15301531   {
15311532      const device_config * img = image_from_devtype_and_index( IO_FLOPPY, i );
15321533      floppy_drive_set_index_pulse_callback( img, thmfc_floppy_index_pulse_cb );
src/mess/tapectrl.c
r2194r2195
1212#include "uimenu.h"
1313#include "mslegacy.h"
1414#include "devices/cassette.h"
15#include "deprecat.h"
1516
1617void tapecontrol_gettime(char *timepos, size_t timepos_size, const device_config *img, int *curpos, int *endpos)
1718{
r2194r2195
150151      {
151152      case 0:
152153         id--;
153         if (id < 0) id = device_count(IO_CASSETTE)-1;
154         if (id < 0) id = device_count(Machine, IO_CASSETTE)-1;
154155         break;
155156      }
156157   }
r2194r2195
161162      {
162163      case 0:
163164         id++;
164         if (id > device_count(IO_CASSETTE)-1) id = 0;
165         if (id > device_count(Machine, IO_CASSETTE)-1) id = 0;
165166         break;
166167      }
167168   }
r2194r2195
176177         switch (sel)
177178         {
178179         case 0:
179            id = (id + 1) % device_count(IO_CASSETTE);
180            id = (id + 1) % device_count(Machine, IO_CASSETTE);
180181            break;
181182         case 2:
182183            /* Pause/stop */
src/mess/image.c
r2194r2195
17981798   int device_index;
17991799
18001800   assert((Machine->images_data->multiple_dev_mask & (1 << type)) == 0);
1801   assert(id < device_count(type));
1801   assert(id < device_count(Machine, type));
18021802
18031803   indx = 0;
18041804   device_index = 0;
src/mess/device.c
r2194r2195
99#include <stddef.h>
1010
1111#include "device.h"
12#include "deprecat.h"
1312#include "mslegacy.h"
1413#include "driver.h"
1514#include "pool.h"
r2194r2195
557556
558557
559558/* this function is deprecated */
560int device_count(iodevice_t type)
559int device_count(running_machine *machine, iodevice_t type)
561560{
562561   int count = 0;
563562   const device_config *device;
564563
565   for (device = device_list_first(Machine->config->devicelist, MESS_DEVICE); device != NULL; device = device_list_next(device, MESS_DEVICE))
564   for (device = device_list_first(machine->config->devicelist, MESS_DEVICE); device != NULL; device = device_list_next(device, MESS_DEVICE))
566565   {
567566      const struct IODevice *iodev = mess_device_from_core_device(device);
568567      if (iodev->type == type)
src/mess/device.h
r2194r2195
294294
295295/* deprecated: device lookup; both of these function assume only one of each type of device */
296296const struct IODevice *device_find_from_machine(const running_machine *machine, iodevice_t type);
297int device_count(iodevice_t type);
297int device_count(running_machine *machine, iodevice_t type);
298298
299299/* diagnostics */
300300int device_valididtychecks(void);
src/mess/machine/nec765.c
r2194r2195
2121***************************************************************************/
2222
2323#include "driver.h"
24#include "deprecat.h"
2425#include "machine/nec765.h"
2526
2627
r2194r2195
149150
150151   if (!nec765_iface.get_image)
151152   {
152      if (fdc.drive < device_count(IO_FLOPPY))
153      if (fdc.drive < device_count(Machine, IO_FLOPPY))
153154         image = image_from_devtype_and_index(IO_FLOPPY, fdc.drive);
154155   }
155156   else
r2194r2195
696697
697698   nec765_reset(0);
698699
699   for (i = 0; i < device_count(IO_FLOPPY); i++)
700   for (i = 0; i < device_count(Machine, IO_FLOPPY); i++)
700701      floppy_drive_set_ready_state_change_callback(image_from_devtype_and_index(IO_FLOPPY, i), nec765_set_ready_change_callback);
701702}
702703
r2194r2195
21392140      are checked or only the drive selected with the drive select bits?? */
21402141
21412142      a_drive_is_ready = 0;
2142      for (i = 0; i < device_count(IO_FLOPPY); i++)
2143      for (i = 0; i < device_count(Machine, IO_FLOPPY); i++)
21432144      {
21442145         if (image_exists(image_from_devtype_and_index(IO_FLOPPY, i)))
21452146         {
src/mess/machine/pc_fdc.c
r2194r2195
9696
9797   pc_fdc_reset();
9898
99   for (i = 0; i < device_count(IO_FLOPPY); i++)
99   for (i = 0; i < device_count(Machine, IO_FLOPPY); i++)
100100   {
101101      img = image_from_devtype_and_index(IO_FLOPPY, i);
102102      floppy_drive_set_geometry(img, FLOPPY_DRIVE_DS_80);
r2194r2195
111111
112112   if (!fdc->fdc_interface.get_image)
113113   {
114      if (floppy_index < device_count(IO_FLOPPY))
114      if (floppy_index < device_count(Machine, IO_FLOPPY))
115115         image = image_from_devtype_and_index(IO_FLOPPY, floppy_index);
116116   }
117117   else
r2194r2195
234234   int selected_drive;
235235   int floppy_count;
236236
237   floppy_count = device_count(IO_FLOPPY);
237   floppy_count = device_count(Machine, IO_FLOPPY);
238238
239239   if (floppy_count > (fdc->digital_output_register & 0x03))
240240      floppy_drive_set_ready_state(image_from_devtype_and_index(IO_FLOPPY, fdc->digital_output_register & 0x03), 1, 0);
src/mess/machine/mc6843.c
r2194r2195
3131
3232
3333#include "driver.h"
34#include "deprecat.h"
3435#include "mc6843.h"
3536#include "devices/flopdrv.h"
3637
r2194r2195
758759   LOG (( "mc6843 reset\n" ));
759760
760761   /* setup/reset floppy drive */
761   for ( i = 0; i < device_count( IO_FLOPPY ); i++ )
762   for ( i = 0; i < device_count( Machine, IO_FLOPPY ); i++ )
762763   {
763764      const device_config * img = image_from_devtype_and_index( IO_FLOPPY, i );
764765      floppy_drive_set_index_pulse_callback( img, mc6843_index_pulse_callback );
src/mess/machine/wd17xx.c
r2194r2195
3636
3737
3838#include "driver.h"
39#include "deprecat.h"
3940#include "machine/wd17xx.h"
4041#include "devices/flopdrv.h"
4142
r2194r2195
323324{
324325   UINT8 step_counter;
325326
326   if (current_drive >= device_count(IO_FLOPPY))
327   if (current_drive >= device_count(Machine, IO_FLOPPY))
327328      return;
328329
329330   step_counter = 255;
r2194r2195
374375void wd17xx_reset(void)
375376{
376377   int i;
377   for (i = 0; i < device_count(IO_FLOPPY); i++)
378   for (i = 0; i < device_count(Machine, IO_FLOPPY); i++)
378379   {
379380      const device_config *img = image_from_devtype_and_index(IO_FLOPPY, i);
380381      floppy_drive_set_index_pulse_callback(img, wd17xx_index_pulse_callback);
src/mess/machine/corvushd.c
r2194r2195
6464//
6565
6666#include "driver.h"
67#include "deprecat.h"
6768#include "devices/harddriv.h"
6869#include "includes/corvushd.h"
6970#include <ctype.h>
r2194r2195
554555
555556   LOG(("corvus_write_sector: Write Drive: %d, physical sector: 0x%5.5x\n", drv, sector));
556557
557   if(drv >= device_count(IO_HARDDISK)) {
558   if(drv >= device_count(Machine, IO_HARDDISK)) {
558559      logerror("corvus_write_sector: Attempt to write to non-existant drive: %d\n", drv);
559560      return STAT_FATAL_ERR | STAT_DRIVE_NOT_ONLINE;
560561   }
r2194r2195
670671
671672   LOG(("corvus_read_sector: Read Drive: %d, physical sector: 0x%5.5x\n", drv, sector));
672673
673   if(drv >= device_count(IO_HARDDISK)) {
674   if(drv >= device_count(Machine, IO_HARDDISK)) {
674675      logerror("corvus_read_sector: Attempt to read from non-existant drive: %d\n", drv);
675676      return STAT_FATAL_ERR | STAT_DRIVE_NOT_ONLINE;
676677   }
r2194r2195
966967   //
967968   drv -= 1;                           // Internally, drives start at 0
968969
969   if(drv >= device_count(IO_HARDDISK)) {
970   if(drv >= device_count(Machine, IO_HARDDISK)) {
970971      logerror("corvus_get_drive_parameters: Attempt to retrieve parameters from non-existant drive: %d\n", drv);
971972      c->xmit_bytes = 1;
972973      return STAT_FATAL_ERR | STAT_DRIVE_NOT_ONLINE;
src/mess/cheatms.c
r2194r2195
1111#include "mess.h"
1212#include "image.h"
1313#include "cheatms.h"
14#include "deprecat.h"
1415
1516
1617/***************************************************************************
r2194r2195
2930
3031static void BuildCRCTable(void)
3132{
32   int   deviceType, deviceID, listIdx;
33   int   listIdx;
34   const device_config *img;
3335
3436   free(deviceCRCList);
3537
r2194r2195
3739   deviceCRCList = calloc(1, sizeof(UINT32));
3840   deviceCRCListLength = 1;
3941
40   for(deviceType = 0; deviceType < IO_COUNT; deviceType++)
42   for (img = image_device_first(Machine->config); img != NULL; img = image_device_next(img))
4143   {
42      for(deviceID = 0; deviceID < device_count(deviceType); deviceID++)
44      if (image_exists(img))
4345      {
44         const device_config *img = image_from_devtype_and_index(deviceType, deviceID);
45         if (image_exists(img))
46         {
47            UINT32   crc = image_crc(img);
48            int      isUnique = 1;
46         UINT32   crc = image_crc(img);
47         int      isUnique = 1;
4948
50            for(listIdx = 0; listIdx < deviceCRCListLength; listIdx++)
49         for(listIdx = 0; listIdx < deviceCRCListLength; listIdx++)
50         {
51            if(deviceCRCList[listIdx] == crc)
5152            {
52               if(deviceCRCList[listIdx] == crc)
53               {
54                  isUnique = 0;
53               isUnique = 0;
5554
56                  break;
57               }
55               break;
5856            }
57         }
5958
60            if(isUnique)
61            {
62               if(!thisGameCRC)
63                  thisGameCRC = crc;
59         if(isUnique)
60         {
61            if(!thisGameCRC)
62               thisGameCRC = crc;
6463
65               deviceCRCList = realloc(deviceCRCList, (deviceCRCListLength + 1) * sizeof(UINT32));
64            deviceCRCList = realloc(deviceCRCList, (deviceCRCListLength + 1) * sizeof(UINT32));
6665
67               deviceCRCList[deviceCRCListLength] = crc;
68               deviceCRCListLength++;
69            }
66            deviceCRCList[deviceCRCListLength] = crc;
67            deviceCRCListLength++;
7068         }
7169      }
7270   }

Previous 15994 Revisions Next


© 1998-2018 The MESS Team