Previous 199869 Revisions Next

r20755 Wednesday 6th February, 2013 at 04:09:46 UTC by R. Belmont
(MESS) Apple II: General modernization, some tagmap cleanup, and prep work to emulate IIe aux slot cards. [R. Belmont]
[src/mess/drivers]apple2.c apple2gs.c
[src/mess/includes]apple2.h
[src/mess/machine]apple2.c apple2gs.c

trunk/src/mess/includes/apple2.h
r20754r20755
7575enum machine_type_t
7676{
7777   APPLE_II,           // Apple II/II+
78   APPLE_IIEPLUS,      // Apple IIe/IIc/IIgs/IIc+
78   APPLE_IIE,         // Apple IIe with aux slots
79   APPLE_IIEPLUS,      // Apple IIc/IIgs/IIc+ with permanent aux memory
7980   TK2000,             // Microdigital TK2000
8081   LASER128,           // Laser 128/128EX/128EX2
8182   SPACE84             // "Space 84" with flipped text mode
r20754r20755
257258   read8_delegate rd_inh_e000;
258259   write8_delegate wd_inh_e000;
259260   DECLARE_MACHINE_START(apple2);
261   DECLARE_MACHINE_START(apple2e);
260262   DECLARE_VIDEO_START(apple2);
261263   DECLARE_PALETTE_INIT(apple2);
262264   DECLARE_MACHINE_START(apple2orig);
r20754r20755
272274   DECLARE_WRITE8_MEMBER(a2bus_inh_w);
273275   void apple2_update_memory_postload();
274276   virtual void machine_reset();
277   void apple2_setup_memory(const apple2_memmap_config *config);
278   void apple2_update_memory();
275279};
276280
277281
r20754r20755
306310
307311int apple2_pressed_specialkey(running_machine &machine, UINT8 key);
308312
309void apple2_setup_memory(running_machine &machine, const apple2_memmap_config *config);
310void apple2_update_memory(running_machine &machine);
311
312313/*----------- defined in video/apple2.c -----------*/
313314
314315void apple2_video_start(running_machine &machine, const UINT8 *vram, size_t vram_size, UINT32 ignored_softswitches, int hires_modulo);
trunk/src/mess/drivers/apple2.c
r20754r20755
237237WRITE8_MEMBER(apple2_state::a2bus_inh_w)
238238{
239239   m_inh_slot = data;
240   apple2_update_memory(machine());
240   apple2_update_memory();
241241}
242242
243243/***************************************************************************
r20754r20755
707707MACHINE_CONFIG_END
708708
709709static MACHINE_CONFIG_DERIVED( apple2e, apple2_common )
710   MCFG_MACHINE_START_OVERRIDE(apple2_state,apple2e)
710711   MCFG_VIDEO_START_OVERRIDE(apple2_state,apple2e)
711712   /* internal ram */
712713   MCFG_RAM_ADD(RAM_TAG)
r20754r20755
748749MACHINE_CONFIG_END
749750
750751static MACHINE_CONFIG_DERIVED( mprof3, apple2e )
752   MCFG_MACHINE_START_OVERRIDE(apple2_state,apple2)
751753
752754   /* internal ram */
753755   MCFG_RAM_MODIFY(RAM_TAG)
r20754r20755
763765MACHINE_CONFIG_END
764766
765767static MACHINE_CONFIG_DERIVED( apple2c, apple2ee )
768   MCFG_MACHINE_START_OVERRIDE(apple2_state,apple2)
769
766770   MCFG_A2BUS_SLOT_REMOVE("sl1")   // IIc has no slots, of course :)
767771   MCFG_A2BUS_SLOT_REMOVE("sl2")
768772   MCFG_A2BUS_SLOT_REMOVE("sl3")
trunk/src/mess/drivers/apple2gs.c
r20754r20755
272272WRITE8_MEMBER(apple2gs_state::a2bus_inh_w)
273273{
274274    m_inh_slot = data;
275    apple2_update_memory(machine());
275    apple2_update_memory();
276276}
277277
278278static const struct a2bus_interface a2bus_intf =
trunk/src/mess/machine/apple2gs.c
r20754r20755
261261         logerror("apple2gs_add_irq(): adding %s\n", apple2gs_irq_name(irq_mask));
262262
263263      state->m_pending_irqs |= irq_mask;
264      machine.device("maincpu")->execute().set_input_line(G65816_LINE_IRQ, state->m_pending_irqs ? ASSERT_LINE : CLEAR_LINE);
264      state->m_maincpu->set_input_line(G65816_LINE_IRQ, state->m_pending_irqs ? ASSERT_LINE : CLEAR_LINE);
265265   }
266266}
267267
r20754r20755
276276         logerror("apple2gs_remove_irq(): removing %s\n", apple2gs_irq_name(irq_mask));
277277
278278      state->m_pending_irqs &= ~irq_mask;
279      machine.device("maincpu")->execute().set_input_line(G65816_LINE_IRQ, state->m_pending_irqs ? ASSERT_LINE : CLEAR_LINE);
279      state->m_maincpu->set_input_line(G65816_LINE_IRQ, state->m_pending_irqs ? ASSERT_LINE : CLEAR_LINE);
280280   }
281281}
282282
r20754r20755
513513         state->m_adb_command_length = 0;
514514         state->m_adb_command_pos = 0;
515515
516//         printf("ADB command %02x\n", data);
516517         switch(data)
517518         {
518519            case 0x00:  /* ??? */
r20754r20755
534535               break;
535536
536537            case 0x07:  /* synchronize */
537               if (state->memregion("maincpu")->bytes() == 0x40000)    /* HACK */
538                  state->m_adb_command_length = 8;
538               if (state->m_is_rom3)
539                  state->m_adb_command_length = 8;   // ROM 3 has 8 bytes: mode byte, 3 config bytes, kbd/mouse params, disk eject options
539540               else
540                  state->m_adb_command_length = 4;
541                  state->m_adb_command_length = 4;   // ROM 0/1 has 4 bytes sync
541542               break;
542543
543544            case 0x08:  /* write memory */
r20754r20755
603604
604605      case ADBSTATE_INCOMMAND:
605606         assert(state->m_adb_command_pos < ARRAY_LENGTH(state->m_adb_command_bytes));
607//         printf("ADB param %02x\n", data);
606608         state->m_adb_command_bytes[state->m_adb_command_pos++] = data;
607609         break;
608610
r20754r20755
10571059      case 0x74: case 0x75: case 0x76: case 0x77:
10581060      case 0x78: case 0x79: case 0x7a: case 0x7b:
10591061      case 0x7c: case 0x7d: case 0x7e: case 0x7f:
1060         offset |= (space.machine().root_device().memregion("maincpu")->bytes() - 1) & ~0x3FFF;
1061         result = space.machine().root_device().memregion("maincpu")->base()[offset];
1062         offset |= (memregion("maincpu")->bytes() - 1) & ~0x3FFF;
1063         result = memregion("maincpu")->base()[offset];
10621064         break;
10631065
10641066      case 0x21:  /* C021 - MONOCOLOR */
r20754r20755
11601162
11611163      case 0x2D:  /* C02D - SLTROMSEL */
11621164         m_sltromsel = data;
1163         apple2_update_memory(space.machine());
1165         apple2_update_memory();
11641166         break;
11651167
11661168      case 0x31:  /* C031 - DISKREG */
r20754r20755
11861188         if (m_shadow != data)
11871189         {
11881190            m_shadow = data;
1189            apple2_update_memory(space.machine());
1191            apple2_update_memory();
11901192         }
11911193         break;
11921194
11931195      case 0x36:  /* C036 - CYAREG */
11941196         m_cyareg = data & ~0x20;
1195         space.machine().device("maincpu")->set_unscaled_clock((data & 0x80) ? APPLE2GS_14M/5 : APPLE2GS_7M/7);
1197         m_maincpu->set_unscaled_clock((data & 0x80) ? APPLE2GS_14M/5 : APPLE2GS_7M/7);
11961198         break;
11971199
11981200      case 0x38:  /* C038 - SCCBREG */
r20754r20755
15871589   }
15881590   else if ((address & 0x000F00) == 0x000000)  // accessing C0xx?
15891591   {
1590      result = state->apple2gs_c0xx_r(machine.device("maincpu")->memory().space(AS_PROGRAM), address, 0);
1592      result = state->apple2gs_c0xx_r(state->m_maincpu->space(AS_PROGRAM), address, 0);
15911593   }
15921594   else
15931595   {
r20754r20755
16031605         {
16041606            // accessing a slot mapped to internal, let's put back the internal ROM
16051607            state->m_a2_cnxx_slot = -1;
1606            apple2_update_memory(space.machine());
1608            state->apple2_update_memory();
16071609            result = *apple2gs_getslotmem(machine, address);
16081610         }
16091611         else
r20754r20755
16141616               if (slotdevice->take_c800())
16151617               {
16161618                  state->m_a2_cnxx_slot = slot;
1617                  apple2_update_memory(space.machine());
1619                  state->apple2_update_memory();
16181620               }
16191621               result = slotdevice->read_cnxx(space, address&0xff);
16201622            }
r20754r20755
16341636            if ((address & 0xfff) == 0xfff)
16351637            {
16361638               state->m_a2_cnxx_slot = -1;
1637               apple2_update_memory(space.machine());
1639               state->apple2_update_memory();
16381640            }
16391641         }
16401642
r20754r20755
16691671      if ((address & 0xfff) == 0xfff)
16701672      {
16711673         state->m_a2_cnxx_slot = -1;
1672         apple2_update_memory(space.machine());
1674         state->apple2_update_memory();
16731675      }
16741676   }
16751677
r20754r20755
16791681   }
16801682   else if ((address & 0x000F00) == 0x000000)
16811683   {
1682      state->apple2gs_c0xx_w(machine.device("maincpu")->memory().space(AS_PROGRAM), address, data, 0);
1684      state->apple2gs_c0xx_w(state->m_maincpu->space(AS_PROGRAM), address, data, 0);
16831685   }
16841686   else
16851687   {
r20754r20755
16961698         {
16971699            // accessing a slot mapped to internal, let's put back the internal ROM
16981700            state->m_a2_cnxx_slot = -1;
1699            apple2_update_memory(space.machine());
1701            state->apple2_update_memory();
17001702            *apple2gs_getslotmem(machine, address) = data;
17011703         }
17021704         else
r20754r20755
17071709               if (slotdevice->take_c800())
17081710               {
17091711                  state->m_a2_cnxx_slot = slot;
1710                  apple2_update_memory(space.machine());
1712                  state->apple2_update_memory();
17111713               }
17121714               slotdevice->write_cnxx(space, address&0xff, data);
17131715            }
r20754r20755
17221724         if ((address & 0xfff) == 0xfff)
17231725         {
17241726            state->m_a2_cnxx_slot = -1;
1725            apple2_update_memory(space.machine());
1727            state->apple2_update_memory();
17261728         }
17271729
17281730         if ( state->m_a2_cnxx_slot >= 0 && state->m_a2_cnxx_slot <= 7 )
r20754r20755
18291831static void apple2gs_setup_memory(running_machine &machine)
18301832{
18311833   apple2gs_state *state = machine.driver_data<apple2gs_state>();
1832   address_space& space = machine.device("maincpu")->memory().space(AS_PROGRAM);
1834   address_space& space = state->m_maincpu->space(AS_PROGRAM);
18331835   offs_t begin, end;
18341836   apple2_memmap_config cfg;
18351837
r20754r20755
18731875   state->membank("bank2")->set_base(state->m_slowmem);
18741876
18751877   /* install alternate ROM bank */
1876   begin = 0x1000000 - machine.root_device().memregion("maincpu")->bytes();
1878   begin = 0x1000000 - state->memregion("maincpu")->bytes();
18771879   end = 0xffffff;
18781880   space.install_read_bank(begin, end, "bank3");
1879   state->membank("bank3")->set_base(machine.root_device().memregion("maincpu")->base());
1881   state->membank("bank3")->set_base(state->memregion("maincpu")->base());
18801882
18811883   /* install new xxC000-xxCFFF handlers */
18821884   space.install_legacy_read_handler(0x00c000, 0x00cfff, FUNC(apple2gs_00Cxxx_r));
r20754r20755
19011903   cfg.memmap = apple2gs_memmap_entries;
19021904   cfg.auxmem = state->m_slowmem;
19031905   cfg.auxmem_length = 0x20000;
1904   apple2_setup_memory(machine, &cfg);
1906   state->apple2_setup_memory(&cfg);
19051907}
19061908
19071909
r20754r20755
19191921{
19201922   apple2gs_refresh_delegates();
19211923
1924   // call "base class" machine reset to set up m_rambase and the language card
1925   machine_reset();
1926
19221927   m_cur_slot6_image = NULL;
19231928   m_newvideo = 0x00;
19241929   m_vgcint = 0x00;
r20754r20755
19701975   apple2_init_common(machine());
19711976
19721977   /* set up Apple IIgs vectoring */
1973   g65816_set_read_vector_callback(machine().device("maincpu"), read8_delegate(FUNC(apple2gs_state::apple2gs_read_vector),this));
1978   g65816_set_read_vector_callback(m_maincpu, read8_delegate(FUNC(apple2gs_state::apple2gs_read_vector),this));
19741979
19751980   /* setup globals */
19761981   m_is_rom3 = true;
r20754r20755
21872192           m_glu_sysstat |= 0x80;
21882193        }
21892194        m_glu_816_read_dstat = true;
2190        printf("816 gets %02x in sysstat (data avail %02x)\n", m_glu_sysstat, m_glu_sysstat & 0x20);
2195//        printf("816 gets %02x in sysstat (data avail %02x)\n", m_glu_sysstat, m_glu_sysstat & 0x20);
21912196        return m_glu_sysstat;
21922197
21932198      case GLU_DATA:
trunk/src/mess/machine/apple2.c
r20754r20755
4646
4747
4848
49void apple2_setup_memory(running_machine &machine, const apple2_memmap_config *config)
49void apple2_state::apple2_setup_memory(const apple2_memmap_config *config)
5050{
51   apple2_state *state = machine.driver_data<apple2_state>();
52   state->m_mem_config = *config;
53   state->m_current_meminfo = NULL;
54   apple2_update_memory(machine);
51   m_mem_config = *config;
52   m_current_meminfo = NULL;
53   apple2_update_memory();
5554}
5655
5756
5857
59void apple2_update_memory(running_machine &machine)
58void apple2_state::apple2_update_memory()
6059{
61   apple2_state *state = machine.driver_data<apple2_state>();
62   address_space& space = machine.device("maincpu")->memory().space(AS_PROGRAM);
60   address_space& space = m_maincpu->space(AS_PROGRAM);
6361   int i, bank;
6462   char rbank[10], wbank[10];
6563   int full_update = 0;
r20754r20755
7371   int wh_nop = 0;
7472
7573   /* need to build list of current info? */
76   if (!state->m_current_meminfo)
74   if (!m_current_meminfo)
7775   {
78      for (i = 0; state->m_mem_config.memmap[i].end; i++)
76      for (i = 0; m_mem_config.memmap[i].end; i++)
7977         ;
80      state->m_current_meminfo = auto_alloc_array(machine, apple2_meminfo, i);
78      m_current_meminfo = auto_alloc_array(machine(), apple2_meminfo, i);
8179      full_update = 1;
8280   }
8381
8482   /* get critical info */
85   rom = machine.root_device().memregion("maincpu")->base();
86   rom_length = machine.root_device().memregion("maincpu")->bytes() & ~0xFFF;
83   rom = memregion("maincpu")->base();
84   rom_length = memregion("maincpu")->bytes() & ~0xFFF;
8785
8886   /* loop through the entire memory map */
89   bank = state->m_mem_config.first_bank;
90   for (i = 0; state->m_mem_config.memmap[i].get_meminfo; i++)
87   bank = m_mem_config.first_bank;
88   for (i = 0; m_mem_config.memmap[i].get_meminfo; i++)
9189   {
9290      /* retrieve information on this entry */
9391      memset(&meminfo, 0, sizeof(meminfo));
94      state->m_mem_config.memmap[i].get_meminfo(machine, state->m_mem_config.memmap[i].begin, state->m_mem_config.memmap[i].end, &meminfo);
92      m_mem_config.memmap[i].get_meminfo(machine(), m_mem_config.memmap[i].begin, m_mem_config.memmap[i].end, &meminfo);
9593
96      bank_disposition = state->m_mem_config.memmap[i].bank_disposition;
94      bank_disposition = m_mem_config.memmap[i].bank_disposition;
9795
9896      /* do we need to memory reading? */
9997      if (full_update
100         || (meminfo.read_mem != state->m_current_meminfo[i].read_mem)
101         || (meminfo.read_handler != state->m_current_meminfo[i].read_handler))
98         || (meminfo.read_mem != m_current_meminfo[i].read_mem)
99         || (meminfo.read_handler != m_current_meminfo[i].read_handler))
102100      {
103101         rbase = NULL;
104102         sprintf(rbank,"bank%d",bank);
105         begin = state->m_mem_config.memmap[i].begin;
106         end_r = state->m_mem_config.memmap[i].end;
103         begin = m_mem_config.memmap[i].begin;
104         end_r = m_mem_config.memmap[i].end;
107105         rh = NULL;
108106
109107         LOG(("apple2_update_memory():  Updating RD {%06X..%06X} [#%02d] --> %08X\n",
r20754r20755
118116         else if (meminfo.read_mem == APPLE2_MEM_FLOATING)
119117         {
120118            /* floating RAM */
121            rh = &state->read_delegates_master[0];
119            rh = &read_delegates_master[0];
122120         }
123121         else if ((meminfo.read_mem & 0xC0000000) == APPLE2_MEM_AUX)
124122         {
125123            /* auxillary memory */
126            assert(state->m_mem_config.auxmem);
124            assert(m_mem_config.auxmem);
127125            offset = meminfo.read_mem & APPLE2_MEM_MASK;
128            rbase = &state->m_mem_config.auxmem[offset];
126            rbase = &m_mem_config.auxmem[offset];
129127         }
130128         else if ((meminfo.read_mem & 0xC0000000) == APPLE2_MEM_SLOT)
131129         {
132130            // slots 1-2
133131            if ((meminfo.write_mem & APPLE2_MEM_MASK) == 0)
134132            {
135               rh = &state->read_delegates_master[1];
133               rh = &read_delegates_master[1];
136134            }
137135            else if ((meminfo.write_mem & APPLE2_MEM_MASK) == 0x200)
138136            {   // slot 3
139               rh = &state->read_delegates_master[2];
137               rh = &read_delegates_master[2];
140138            }
141139            else if ((meminfo.write_mem & APPLE2_MEM_MASK) == 0x300)
142140            {   // slots 4-7
143               rh = &state->read_delegates_master[3];
141               rh = &read_delegates_master[3];
144142            }
145143            else
146144            {
r20754r20755
156154         else
157155         {
158156            /* RAM */
159            if (end_r >= state->m_ram->size())
160               end_r = state->m_ram->size() - 1;
157            if (end_r >= m_ram->size())
158               end_r = m_ram->size() - 1;
161159            offset = meminfo.read_mem & APPLE2_MEM_MASK;
162160            if (end_r >= begin)
163               rbase = &state->m_ram->pointer()[offset];
161               rbase = &m_ram->pointer()[offset];
164162         }
165163
166164         /* install the actual handlers */
r20754r20755
173171         }
174172
175173         /* did we 'go past the end?' */
176         if (end_r < state->m_mem_config.memmap[i].end)
177            space.nop_read(end_r + 1, state->m_mem_config.memmap[i].end);
174         if (end_r < m_mem_config.memmap[i].end)
175            space.nop_read(end_r + 1, m_mem_config.memmap[i].end);
178176
179177         /* set the memory bank */
180178         if (rbase)
181179         {
182            state->membank(rbank)->set_base(rbase);
180            membank(rbank)->set_base(rbase);
183181         }
184182
185183         /* record the current settings */
186         state->m_current_meminfo[i].read_mem = meminfo.read_mem;
187         state->m_current_meminfo[i].read_handler = meminfo.read_handler;
184         m_current_meminfo[i].read_mem = meminfo.read_mem;
185         m_current_meminfo[i].read_handler = meminfo.read_handler;
188186      }
189187
190188      /* do we need to memory writing? */
191189      if (full_update
192         || (meminfo.write_mem != state->m_current_meminfo[i].write_mem)
193         || (meminfo.write_handler != state->m_current_meminfo[i].write_handler))
190         || (meminfo.write_mem != m_current_meminfo[i].write_mem)
191         || (meminfo.write_handler != m_current_meminfo[i].write_handler))
194192      {
195193         wbase = NULL;
196194         if (bank_disposition == A2MEM_MONO)
197195            sprintf(wbank,"bank%d",bank);
198196         else if (bank_disposition == A2MEM_DUAL)
199197            sprintf(wbank,"bank%d",bank+1);
200         begin = state->m_mem_config.memmap[i].begin;
201         end_w = state->m_mem_config.memmap[i].end;
198         begin = m_mem_config.memmap[i].begin;
199         end_w = m_mem_config.memmap[i].end;
202200         wh = NULL;
203201
204202         LOG(("apple2_update_memory():  Updating WR {%06X..%06X} [#%02d] --> %08X\n",
r20754r20755
213211         else if ((meminfo.write_mem & 0xC0000000) == APPLE2_MEM_AUX)
214212         {
215213            /* auxillary memory */
216            assert(state->m_mem_config.auxmem);
214            assert(m_mem_config.auxmem);
217215            offset = meminfo.write_mem & APPLE2_MEM_MASK;
218            wbase = &state->m_mem_config.auxmem[offset];
216            wbase = &m_mem_config.auxmem[offset];
219217         }
220218         else if ((meminfo.write_mem & 0xC0000000) == APPLE2_MEM_SLOT)
221219         {
r20754r20755
224222            // slots 1-2
225223            if ((meminfo.write_mem & APPLE2_MEM_MASK) == 0)
226224            {
227               wh = &state->write_delegates_master[0];
225               wh = &write_delegates_master[0];
228226            }
229227            else if ((meminfo.write_mem & APPLE2_MEM_MASK) == 0x200)
230228            {   // slot 3
231               wh = &state->write_delegates_master[1];
229               wh = &write_delegates_master[1];
232230            }
233231            else if ((meminfo.write_mem & APPLE2_MEM_MASK) == 0x300)
234232            {   // slots 4-7
235               wh = &state->write_delegates_master[2];
233               wh = &write_delegates_master[2];
236234            }
237235         }
238236         else if ((meminfo.write_mem & 0xC0000000) == APPLE2_MEM_ROM)
r20754r20755
243241         else
244242         {
245243            /* RAM */
246            if (end_w >= state->m_ram->size())
247               end_w = state->m_ram->size() - 1;
244            if (end_w >= m_ram->size())
245               end_w = m_ram->size() - 1;
248246            offset = meminfo.write_mem & APPLE2_MEM_MASK;
249247            if (end_w >= begin)
250               wbase = &state->m_ram->pointer()[offset];
248               wbase = &m_ram->pointer()[offset];
251249         }
252250
253251
r20754r20755
265263         }
266264
267265         /* did we 'go past the end?' */
268         if (end_w < state->m_mem_config.memmap[i].end)
269            space.nop_write(end_w + 1, state->m_mem_config.memmap[i].end);
266         if (end_w < m_mem_config.memmap[i].end)
267            space.nop_write(end_w + 1, m_mem_config.memmap[i].end);
270268
271269         /* set the memory bank */
272270         if (wbase)
273271         {
274            state->membank(wbank)->set_base(wbase);
272            membank(wbank)->set_base(wbase);
275273         }
276274
277275         /* record the current settings */
278         state->m_current_meminfo[i].write_mem = meminfo.write_mem;
279         state->m_current_meminfo[i].write_handler = meminfo.write_handler;
276         m_current_meminfo[i].write_mem = meminfo.write_mem;
277         m_current_meminfo[i].write_handler = meminfo.write_handler;
280278      }
281279      bank += bank_disposition;
282280   }
r20754r20755
286284
287285void apple2_state::apple2_update_memory_postload()
288286{
289   apple2_update_memory(machine());
287   apple2_update_memory();
290288}
291289
292290
r20754r20755
394392   UINT32 rom_length, slot_length;
395393
396394   // find slot_ram if any
397   rom = space.machine().root_device().memregion("maincpu")->base();
398   rom_length = space.machine().root_device().memregion("maincpu")->bytes() & ~0xFFF;
395   rom = state->memregion("maincpu")->base();
396   rom_length = state->memregion("maincpu")->bytes() & ~0xFFF;
399397   slot_length = state->memregion("maincpu")->bytes() - rom_length;
400398   slot_ram = (slot_length > 0) ? &rom[rom_length] : NULL;
401399
r20754r20755
405403      {
406404//          printf("slotram_r: taking cnxx_slot to -1\n");
407405         state->m_a2_cnxx_slot = -1;
408         apple2_update_memory(space.machine());
406         state->apple2_update_memory();
409407      }
410408
411409      return slot_ram[offset];
r20754r20755
429427      {
430428//          printf("c1xx_r: taking cnxx_slot to %d\n", slotnum);
431429         m_a2_cnxx_slot = slotnum;
432         apple2_update_memory(space.machine());
430         apple2_update_memory();
433431      }
434432
435433      return slotdevice->read_cnxx(space, offset&0xff);
r20754r20755
451449   UINT32 rom_length, slot_length;
452450
453451   // find slot_ram if any
454   rom = space.machine().root_device().memregion("maincpu")->base();
455   rom_length = space.machine().root_device().memregion("maincpu")->bytes() & ~0xFFF;
452   rom = memregion("maincpu")->base();
453   rom_length = memregion("maincpu")->bytes() & ~0xFFF;
456454   slot_length = memregion("maincpu")->bytes() - rom_length;
457455   slot_ram = (slot_length > 0) ? &rom[rom_length] : NULL;
458456
r20754r20755
486484      {
487485//          printf("c3xx_r: taking cnxx_slot to %d\n", slotnum);
488486         m_a2_cnxx_slot = slotnum;
489         apple2_update_memory(space.machine());
487         apple2_update_memory();
490488      }
491489      return slotdevice->read_cnxx(space, offset&0xff);
492490   }
r20754r20755
507505   UINT32 rom_length, slot_length;
508506
509507   // find slot_ram if any
510   rom = space.machine().root_device().memregion("maincpu")->base();
511   rom_length = space.machine().root_device().memregion("maincpu")->bytes() & ~0xFFF;
508   rom = memregion("maincpu")->base();
509   rom_length = memregion("maincpu")->bytes() & ~0xFFF;
512510   slot_length = memregion("maincpu")->bytes() - rom_length;
513511   slot_ram = (slot_length > 0) ? &rom[rom_length] : NULL;
514512
r20754r20755
521519      {
522520//          printf("c3xx_w: taking cnxx_slot to %d\n", slotnum);
523521         m_a2_cnxx_slot = slotnum;
524         apple2_update_memory(space.machine());
522         apple2_update_memory();
525523      }
526524      slotdevice->write_cnxx(space, offset&0xff, data);
527525   }
r20754r20755
546544      if (slotdevice->take_c800() && (m_a2_cnxx_slot != slotnum))
547545      {
548546         m_a2_cnxx_slot = slotnum;
549         apple2_update_memory(space.machine());
547         apple2_update_memory();
550548      }
551549      return slotdevice->read_cnxx(space, offset&0xff);
552550   }
r20754r20755
567565   UINT32 rom_length, slot_length;
568566
569567   // find slot_ram if any
570   rom = space.machine().root_device().memregion("maincpu")->base();
571   rom_length = space.machine().root_device().memregion("maincpu")->bytes() & ~0xFFF;
568   rom = memregion("maincpu")->base();
569   rom_length = memregion("maincpu")->bytes() & ~0xFFF;
572570   slot_length = memregion("maincpu")->bytes() - rom_length;
573571   slot_ram = (slot_length > 0) ? &rom[rom_length] : NULL;
574572
r20754r20755
581579      {
582580//          printf("c4xx_w: taking cnxx_slot to %d\n", slotnum);
583581         m_a2_cnxx_slot = slotnum;
584         apple2_update_memory(space.machine());
582         apple2_update_memory();
585583      }
586584      slotdevice->write_cnxx(space, offset&0xff, data);
587585   }
r20754r20755
599597   {
600598//      printf("cfff_r: taking cnxx_slot to -1\n");
601599      m_a2_cnxx_slot = -1;
602      apple2_update_memory(space.machine());
600      apple2_update_memory();
603601   }
604602
605603   return apple2_getfloatingbusvalue(space.machine());
r20754r20755
611609   {
612610//      printf("cfff_w: taking cnxx_slot to -1\n");
613611      m_a2_cnxx_slot = -1;
614      apple2_update_memory(space.machine());
612      apple2_update_memory();
615613   }
616614}
617615
r20754r20755
1001999{
10021000   apple2_state *state = machine.driver_data<apple2_state>();
10031001   LOG(("apple2_setvar(): val=0x%06x mask=0x%06x pc=0x%04x\n", val, mask,
1004               (unsigned int) machine.device("maincpu")->safe_pc()));
1002               (unsigned int) state->m_maincpu->pc()));
10051003
10061004   assert((val & mask) == val);
10071005
r20754r20755
10161014   // disable flags that don't apply (INTCXROM/SLOTC3ROM on II/II+ for instance)
10171015   state->m_flags &= ~state->m_flags_mask;
10181016
1019   apple2_update_memory(machine);
1017   state->apple2_update_memory();
10201018}
10211019
10221020
r20754r20755
10641062
10651063   // video scanner data
10661064   //
1067   i = (machine.device<cpu_device>("maincpu"))->total_cycles() % kClocksPerVSync; // cycles into this VSync
1065   i = state->m_maincpu->total_cycles() % kClocksPerVSync; // cycles into this VSync
10681066
10691067   // machine state switches
10701068   //
r20754r20755
15661564
15671565      if (offset == 0)
15681566      {
1569         m_joystick_x1_time = space.machine().time().as_double() + x_calibration * m_joy1x->read();
1570         m_joystick_y1_time = space.machine().time().as_double() + y_calibration * m_joy1y->read();
1571         m_joystick_x2_time = space.machine().time().as_double() + x_calibration * m_joy2x->read();
1572         m_joystick_y2_time = space.machine().time().as_double() + y_calibration * m_joy2y->read();
1567         m_joystick_x1_time = machine().time().as_double() + x_calibration * m_joy1x->read();
1568         m_joystick_y1_time = machine().time().as_double() + y_calibration * m_joy1y->read();
1569         m_joystick_x2_time = machine().time().as_double() + x_calibration * m_joy2x->read();
1570         m_joystick_y2_time = machine().time().as_double() + y_calibration * m_joy2y->read();
15731571      }
15741572   }
15751573   return 0;
r20754r20755
15831581
15841582WRITE8_MEMBER ( apple2_state::apple2_c07x_w )
15851583{
1584   // this a machine with an aux slot?
1585   if (m_machinetype == APPLE_IIE)
1586   {
1587      device_a2eauxslot_card_interface *auxslotdevice = NULL;
1588
1589      auxslotdevice = m_a2eauxslot->get_a2eauxslot_card();
1590
1591      if (auxslotdevice)
1592      {
1593         auxslotdevice->write_c07x(space, offset&0xf, data);
1594      }
1595   }
1596
1597   // AE RamWorks manual indicates that even if the auxslot card sees the c07x write,
1598   // so does the motherboard and it will trigger the paddles.  So always call this.
15861599   apple2_c07x_r(space, offset, 0);
15871600}
15881601
r20754r20755
18041817   mem_cfg.first_bank = 1;
18051818   mem_cfg.memmap = apple2_memmap_entries;
18061819   mem_cfg.auxmem = (UINT8*)apple2cp_ce00_ram;
1807   apple2_setup_memory(machine(), &mem_cfg);
1820   apple2_setup_memory(&mem_cfg);
18081821}
18091822
1823MACHINE_START_MEMBER(apple2_state,apple2e)
1824{
1825   apple2_memmap_config mem_cfg;
1826   void *apple2cp_ce00_ram = NULL;
1827
1828   m_flags_mask = 0;
1829
1830   /* there appears to be some hidden RAM that is swapped in on the Apple
1831    * IIc plus; I have not found any official documentation but the BIOS
1832    * clearly uses this area as writeable memory */
1833   if (!strcmp(machine().system().name, "apple2cp"))
1834      apple2cp_ce00_ram = auto_alloc_array(machine(), UINT8, 0x200);
1835
1836   m_machinetype = APPLE_IIE;
1837
1838   apple2_init_common(machine());
1839
1840   /* setup memory */
1841   memset(&mem_cfg, 0, sizeof(mem_cfg));
1842   mem_cfg.first_bank = 1;
1843   mem_cfg.memmap = apple2_memmap_entries;
1844   mem_cfg.auxmem = (UINT8*)apple2cp_ce00_ram;
1845   apple2_setup_memory(&mem_cfg);
1846}
1847
18101848MACHINE_START_MEMBER(apple2_state,laser128)
18111849{
18121850   apple2_memmap_config mem_cfg;
r20754r20755
18211859   mem_cfg.first_bank = 1;
18221860   mem_cfg.memmap = apple2_memmap_entries;
18231861   mem_cfg.auxmem = (UINT8*)NULL;
1824   apple2_setup_memory(machine(), &mem_cfg);
1862   apple2_setup_memory(&mem_cfg);
18251863}
18261864
18271865MACHINE_START_MEMBER(apple2_state,apple2orig)
r20754r20755
18411879   mem_cfg.first_bank = 1;
18421880   mem_cfg.memmap = apple2_memmap_entries;
18431881   mem_cfg.auxmem = (UINT8*)apple2cp_ce00_ram;
1844   apple2_setup_memory(machine(), &mem_cfg);
1882   apple2_setup_memory(&mem_cfg);
18451883}
18461884
18471885MACHINE_START_MEMBER(apple2_state,space84)
r20754r20755
18611899   mem_cfg.first_bank = 1;
18621900   mem_cfg.memmap = apple2_memmap_entries;
18631901   mem_cfg.auxmem = (UINT8*)apple2cp_ce00_ram;
1864   apple2_setup_memory(machine(), &mem_cfg);
1902   apple2_setup_memory(&mem_cfg);
18651903}
18661904
18671905MACHINE_START_MEMBER(apple2_state,tk2000)
r20754r20755
18801918   mem_cfg.first_bank = 1;
18811919   mem_cfg.memmap = tk2000_memmap_entries;
18821920   mem_cfg.auxmem = (UINT8*)NULL;
1883   apple2_setup_memory(machine(), &mem_cfg);
1921   apple2_setup_memory(&mem_cfg);
18841922}
18851923
18861924int apple2_state::apple2_pressed_specialkey(UINT8 key)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team