Previous 15994 Revisions Next

r10341 Wednesday 9th February, 2011 at 03:22:08 UTC by R. Belmont
apple2gs: Fixed startup (save states will need looking at later)
[src/mess/machine]apple2gs.c

src/mess/machine/apple2gs.c
r10340r10341
118118#include "sound/es5503.h"
119119#include "machine/ram.h"
120120#include "debugger.h"
121#include "machine/ap2_slot.h"
121122
122123#define LOG_C0XX         0
123124#define LOG_ADB            0
r10340r10341
15071508   UINT8 result;
15081509   int slot;
15091510
1510   if ((state->shadow & 0x40) && ((address & 0xF00000) == 0x000000))
1511   if ((state->shadow & 0x40) && ((address & 0xF00000) == 0x000000))   // shadow all banks and C0xx?
15111512   {
15121513      result = ram_get_ptr(machine->device(RAM_TAG))[address];
15131514   }
1514   else if ((address & 0x000F00) == 0x000000)
1515   else if ((address & 0x000F00) == 0x000000)   // accessing C0xx?
15151516   {
1517      state->a2_cnxx_slot = -1;
15161518      result = apple2gs_c0xx_r(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), address);
15171519   }
15181520   else
15191521   {
1522      device_t *slotdevice;
1523
15201524      slot = (address & 0x000F00) / 0x100;
1525      if (slot <= 7)   // slots 1-7, it's the slot
1526      {
1527         slotdevice = apple2_slot(machine, slot);
15211528
1522      if ((slot > 7) || ((state->sltromsel & (1 << slot)) == 0))
1523         result = *apple2gs_getslotmem(machine, address);
1524      else
1525         result = apple2_getfloatingbusvalue(machine);
1529         // is this slot internal or "Your Card"?
1530         if ((state->sltromsel & (1 << slot)) == 0)
1531         {
1532            // accessing a slot mapped to internal, let's put back the internal ROM
1533            state->a2_cnxx_slot = -1;
1534             result = *apple2gs_getslotmem(machine, address);
1535         }
1536         else
1537         {
1538            // accessing a slot mapped to "Your Card", C800 should belong to that card
1539            if (state->a2_cnxx_slot == -1)
1540            {
1541               state->a2_cnxx_slot = slot;
1542            }
1543
1544            if (slotdevice != NULL)
1545            {
1546               result = apple2_slot_ROM_r(slotdevice, address&0xff);
1547            }
1548            else
1549            {
1550               result = apple2_getfloatingbusvalue(machine);
1551            }
1552         }
1553      }
1554      else   // C800-CFFF, not cards
1555      {
1556         slotdevice = NULL;
1557
1558         // if CFFF accessed, reset C800 area to internal ROM
1559         if ((address & 0xfff) == 0xfff)
1560         {
1561            state->a2_cnxx_slot = -1;
1562         }
1563
1564         slotdevice = apple2_slot(machine, state->a2_cnxx_slot);
1565
1566         if (slotdevice)
1567         {
1568            result = apple2_c800_slot_r(slotdevice, address&0x7ff);
1569         }
1570         else
1571         {
1572            result = *apple2gs_getslotmem(machine, address);
1573         }
1574      }
15261575   }
15271576   return result;
15281577}
r10340r10341
15341583   apple2gs_state *state = machine->driver_data<apple2gs_state>();
15351584   int slot;
15361585
1586   // if CFFF accessed, reset C800 area to internal ROM
1587   if ((address & 0xfff) == 0xfff)
1588   {
1589      state->a2_cnxx_slot = -1;
1590   }
1591
15371592   if ((state->shadow & 0x40) && ((address & 0xF00000) == 0x000000))
15381593   {
15391594      ram_get_ptr(machine->device(RAM_TAG))[address] = data;
r10340r10341
16371692
16381693   /* allocate memory for E00000-E1FFFF */
16391694   state->slowmem = auto_alloc_array_clear(machine, UINT8, 128*1024);
1695   state_save_register_item_pointer(machine, "APPLE2GS_SLOWMEM", NULL, 0, state->slowmem, 128*1024);
16401696
1641   state_save_register_item_array(machine, "APPLE2GS_SLOWMEM", NULL, 0, state->slowmem);
1642
16431697   /* install expanded memory */
16441698   memory_install_readwrite_bank(space, 0x010000, ram_get_size(machine->device(RAM_TAG)) - 1, 0, 0, "bank1");
16451699   memory_set_bankptr(machine,"bank1", ram_get_ptr(machine->device(RAM_TAG)) + 0x010000);
r10340r10341
17581812
17591813   /* save state stuff.  note that the driver takes care of docram. */
17601814   UINT8* ram = ram_get_ptr(machine->device(RAM_TAG));
1761   state_save_register_global_array(machine, ram);
1815   state_save_register_item_pointer(machine, "APPLE2GS_RAM", NULL, 0, ram, ram_get_size(machine->device(RAM_TAG)));
17621816
17631817   state_save_register_item(machine, "NEWVIDEO", NULL, 0, state->newvideo);
17641818
r10340r10341
17811835   state_save_register_item(machine, "CLKREG1", NULL,0, state->clock_reg1);
17821836   state_save_register_item(machine, "CLKCURTIME", NULL,0, state->clock_curtime);
17831837   state_save_register_item(machine, "CLKCURTIMEINT", NULL,0, state->clock_curtime_interval);
1784   state_save_register_item(machine, "CLKMODE", NULL,0, state->clock_mode);
1838//   state_save_register_item(machine, "CLKMODE", NULL,0, state->clock_mode);
17851839   state->save_item(NAME(state->clock_bram));
17861840
17871841   state->save_item(NAME(state->adb_memory));
17881842   state->save_item(NAME(state->adb_command_bytes));
17891843   state->save_item(NAME(state->adb_response_bytes));
1790   state_save_register_item(machine, "ADB", NULL,0, state->adb_state);
1844//   state_save_register_item(machine, "ADB", NULL,0, state->adb_state);
17911845   state_save_register_item(machine, "ADB", NULL,0, state->adb_command);
17921846   state_save_register_item(machine, "ADB", NULL,0, state->adb_mode);
17931847   state_save_register_item(machine, "ADB", NULL,0, state->adb_kmstatus);

Previous 15994 Revisions Next


© 1998-2018 The MESS Team