Previous 15994 Revisions Next

r1845 Wednesday 5th March, 2008 at 13:26:08 UTC by Nathan Woods
[APPLE2] Now passing around running_machine structure
[src/mess/includes]apple2.h
[src/mess/machine]apple2.c

src/mess/includes/apple2.h
r1844r1845
4646{
4747   const char *name;
4848   const char *description;
49   void *(*init)(int slot);
50   void (*reset)(void *token);
51   UINT8 (*read)(void *token, offs_t offset);
52   void (*write)(void *token, offs_t offset, UINT8 data);
49   void *(*init)(running_machine *machine, int slot);
50   void (*reset)(running_machine *machine, void *token);
51   UINT8 (*read)(running_machine *machine, void *token, offs_t offset);
52   void (*write)(running_machine *machine, void *token, offs_t offset, UINT8 data);
5353};
5454
5555typedef struct _apple2_config apple2_config;
src/mess/machine/apple2.c
r1844r1845
312312   };
313313   UINT8 result = 0x00;
314314   int slot;
315   running_machine *machine = Machine;
315316
316317   offset &= 0xFF;
317318
r1844r1845
324325   {
325326      slot = (offset - 0x80) / 0x10;
326327      if (a2_config->slots[slot] && a2_config->slots[slot]->read)
327         result = a2_config->slots[slot]->read(a2_slot_tokens[slot], offset % 0x10);
328         result = a2_config->slots[slot]->read(machine, a2_slot_tokens[slot], offset % 0x10);
328329   }
329330   return result;
330331}
r1844r1845
345346      apple2_c07x_w
346347   };
347348   int slot;
349   running_machine *machine = Machine;
348350
349351   offset &= 0xFF;
350352
r1844r1845
357359   {
358360      slot = (offset - 0x80) / 0x10;
359361      if (a2_config->slots[slot] && a2_config->slots[slot]->write)
360         a2_config->slots[slot]->write(a2_slot_tokens[slot], offset % 0x10, data);
362         a2_config->slots[slot]->write(machine, a2_slot_tokens[slot], offset % 0x10, data);
361363   }
362364}
363365
r1844r1845
743745      if (a2_config->slots[i])
744746      {
745747         if (a2_config->slots[i]->reset)
746            a2_config->slots[i]->reset(a2_slot_tokens[i]);
748            a2_config->slots[i]->reset(machine, a2_slot_tokens[i]);
747749      }
748750   }
749751
r1844r1845
11351137 * Language Card
11361138 * ----------------------------------------------------------------------- */
11371139
1138static UINT8 apple2_langcard_read(void *token, offs_t offset)
1140static UINT8 apple2_langcard_read(running_machine *machine, void *token, offs_t offset)
11391141{
11401142   return apple2_c08x_r(offset);
11411143
r1844r1845
11431145
11441146
11451147
1146static void apple2_langcard_write(void *token, offs_t offset, UINT8 data)
1148static void apple2_langcard_write(running_machine *machine, void *token, offs_t offset, UINT8 data)
11471149{
11481150   apple2_c08x_w(offset, data);
11491151}
r1844r1845
11661168 * Mockingboard
11671169 * ----------------------------------------------------------------------- */
11681170
1169static void apple2_mockingboard_reset(void *token)
1171static void apple2_mockingboard_reset(running_machine *machine, void *token)
11701172{
11711173   /* TODO: fix this */
11721174   /* What follows is pure filth. It abuses the core like an angry pimp on a bad hair day. */
r1844r1845
11811183
11821184
11831185
1184static UINT8 apple2_mockingboard_read(void *token, offs_t offset)
1186static UINT8 apple2_mockingboard_read(running_machine *machine, void *token, offs_t offset)
11851187{
11861188   static int flip1 = 0, flip2 = 0;
11871189
r1844r1845
12051207
12061208
12071209
1208static void apple2_mockingboard_write(void *token, offs_t offset, UINT8 data)
1210static void apple2_mockingboard_write(running_machine *machine, void *token, offs_t offset, UINT8 data)
12091211{
12101212   static int latch0, latch1;
12111213
r1844r1845
14231425
14241426
14251427
1426static void *apple2_fdc_init(int slot, applefdc_t fdc_type)
1428static void *apple2_fdc_init(running_machine *machine, int slot, applefdc_t fdc_type)
14271429{
14281430   const struct IODevice *dev;
14291431   struct applefdc_interface intf;
r1844r1845
14551457
14561458
14571459
1458static void *apple2_fdc_apple2_init(int slot)
1460static void *apple2_fdc_apple2_init(running_machine *machine, int slot)
14591461{
1460   return apple2_fdc_init(slot, APPLEFDC_APPLE2);
1462   return apple2_fdc_init(machine, slot, APPLEFDC_APPLE2);
14611463}
14621464
14631465
14641466
1465static void *apple2_fdc_iwm_init(int slot)
1467static void *apple2_fdc_iwm_init(running_machine *machine, int slot)
14661468{
1467   return apple2_fdc_init(slot, APPLEFDC_IWM);
1469   return apple2_fdc_init(machine, slot, APPLEFDC_IWM);
14681470}
14691471
14701472
14711473
1472static UINT8 apple2_fdc_read(void *token, offs_t offset)
1474static UINT8 apple2_fdc_read(running_machine *machine, void *token, offs_t offset)
14731475{
14741476   return applefdc_r(offset);
14751477}
14761478
14771479
14781480
1479static void apple2_fdc_write(void *token, offs_t offset, UINT8 data)
1481static void apple2_fdc_write(running_machine *machine, void *token, offs_t offset, UINT8 data)
14801482{
14811483   applefdc_w(offset, data);
14821484}
r1844r1845
15401542      if (a2_config->slots[i])
15411543      {
15421544         if (a2_config->slots[i]->init)
1543            token = a2_config->slots[i]->init(i);
1545            token = a2_config->slots[i]->init(machine, i);
15441546         else
15451547            token = (void *) ~0;
15461548

Previous 15994 Revisions Next


© 1998-2018 The MESS Team