Previous 15994 Revisions Next

r4561 Saturday 25th April, 2009 at 23:41:10 UTC by Fabio Priuli
More number-to-tag CPU conversions
[src/mess/drivers]apf.c aquarius.c avigo.c
[src/mess/machine]amstrad.c apple1.c apple2.c apple2gs.c apple3.c at.c atom.c ay3600.c
[src/mess/video]apple3.c atarist.c

src/mess/video/apple3.c
r4560r4561
4141
4242void apple3_write_charmem(running_machine *machine)
4343{
44   const address_space* space = cpu_get_address_space(machine->cpu[0],ADDRESS_SPACE_PROGRAM);
44   const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
4545   static const UINT32 screen_hole_map[] =
4646   {
4747      0x478, 0x4f8, 0x578, 0x5f8, 0x678, 0x6f8, 0x778, 0x7f8
src/mess/video/atarist.c
r4560r4561
119119{
120120   atarist_state *state = machine->driver_data;
121121
122   const address_space *program = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
122   const address_space *program = cputag_get_address_space(machine, M68000_TAG, ADDRESS_SPACE_PROGRAM);
123123   UINT16 data = memory_read_word_16be(program, state->shifter_ofs);
124124
125125   state->shifter_ir[state->shifter_bitplane] = data;
r4560r4561
162162
163163   if ((y == state->shifter_vblank_start) && (x == 0))
164164   {
165      cpu_set_input_line(machine->cpu[0], M68K_IRQ_4, HOLD_LINE);
165      cputag_set_input_line(machine, M68000_TAG, M68K_IRQ_4, HOLD_LINE);
166166      state->shifter_ofs = state->shifter_base;
167167   }
168168
169169   if (x == state->shifter_hblank_start)
170170   {
171      cpu_set_input_line(machine->cpu[0], M68K_IRQ_2, HOLD_LINE);
171      cputag_set_input_line(machine, M68000_TAG, M68K_IRQ_2, HOLD_LINE);
172172      state->shifter_ofs += (state->shifter_lineofs * 2); // STe
173173   }
174174}
r4560r4561
421421{
422422   atarist_state *state = machine->driver_data;
423423
424   const address_space *program = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
424   const address_space *program = cputag_get_address_space(machine, M68000_TAG, ADDRESS_SPACE_PROGRAM);
425425   UINT16 data = memory_read_word_16be(program, state->blitter_src);
426426
427427   if (state->blitter_src_inc_x < 0)
r4560r4561
464464static void atarist_blitter_op(running_machine *machine, UINT16 s, UINT32 dstaddr, UINT16 mask)
465465{
466466   atarist_state *state = machine->driver_data;
467   const address_space *program = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
467   const address_space *program = cputag_get_address_space(machine, M68000_TAG, ADDRESS_SPACE_PROGRAM);
468468
469469   UINT16 d = memory_read_word_16be(program, dstaddr);
470470   UINT16 result = 0;
src/mess/machine/apple3.c
r4560r4561
338338{
339339   UINT16 bank;
340340   UINT8 page;
341   const address_space* space = cpu_get_address_space(machine->cpu[0],ADDRESS_SPACE_PROGRAM);
341   const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
342342
343343   if (LOG_MEMORY)
344344   {
345345      logerror("apple3_update_memory(): via_0_b=0x%02x via_1_a=0x0x%02x\n", via_0_b, via_1_a);
346346   }
347347
348   cpu_set_clock(machine->cpu[0], (via_0_a & 0x80) ? 1000000 : 2000000);
348   cputag_set_clock(machine, "maincpu", (via_0_a & 0x80) ? 1000000 : 2000000);
349349
350350   /* bank 2 (0100-01FF) */
351351   if (!(via_0_a & 0x04))
r4560r4561
493493{
494494   if (!via_1_irq && state)
495495   {
496      cpu_set_input_line(device->machine->cpu[0], M6502_IRQ_LINE, ASSERT_LINE);
497      cpu_set_input_line(device->machine->cpu[0], M6502_IRQ_LINE, CLEAR_LINE);
496      cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, ASSERT_LINE);
497      cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, CLEAR_LINE);
498498   }
499499   via_1_irq = state;
500500}
r4560r4561
729729   via_1_irq = 0;
730730   apple3_update_memory(machine);
731731
732   memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[0],ADDRESS_SPACE_PROGRAM), apple3_opbase);
732   memory_set_direct_update_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), apple3_opbase);
733733
734734   /* the Apple /// does some weird tricks whereby it monitors the SYNC pin
735735    * on the CPU to check for indexed instructions and directs them to
736736    * different memory locations */
737   device_set_info_fct(machine->cpu[0], CPUINFO_FCT_M6502_READINDEXED_CALLBACK, (genf *) apple3_indexed_read);
738   device_set_info_fct(machine->cpu[0], CPUINFO_FCT_M6502_WRITEINDEXED_CALLBACK, (genf *) apple3_indexed_write);
737   device_set_info_fct(cputag_get_cpu(machine, "maincpu"), CPUINFO_FCT_M6502_READINDEXED_CALLBACK, (genf *) apple3_indexed_read);
738   device_set_info_fct(cputag_get_cpu(machine, "maincpu"), CPUINFO_FCT_M6502_WRITEINDEXED_CALLBACK, (genf *) apple3_indexed_write);
739739}
src/mess/machine/ay3600.c
r4560r4561
436436
437437   /* reset key check */
438438   if (apple2_pressed_specialkey(machine, SPECIALKEY_RESET) &&
439      (a2_no_ctrl_reset(machine) || switchkey & A2_KEY_CONTROL)) {
440         if (!reset_flag) {
439      (a2_no_ctrl_reset(machine) || switchkey & A2_KEY_CONTROL))
440      {
441         if (!reset_flag)
442         {
441443            reset_flag = 1;
442444            /* using PULSE_LINE does not allow us to press and hold key */
443            cpu_set_input_line(machine->cpu[0], INPUT_LINE_RESET, ASSERT_LINE);
445            cputag_set_input_line(machine, "maincpu", INPUT_LINE_RESET, ASSERT_LINE);
444446         }
445447         return;
446448   }
447449   if (reset_flag)
448450   {
449451      reset_flag = 0;
450      cpu_set_input_line(machine->cpu[0], INPUT_LINE_RESET, CLEAR_LINE);
452      cputag_set_input_line(machine, "maincpu", INPUT_LINE_RESET, CLEAR_LINE);
451453      mame_schedule_soft_reset(machine);
452454   }
453455
src/mess/machine/at.c
r4560r4561
5454 *************************************************************/
5555
5656static PIC8259_SET_INT_LINE( at_pic8259_master_set_int_line ) {
57   cpu_set_input_line(device->machine->cpu[0], 0, interrupt ? ASSERT_LINE : CLEAR_LINE);
57   cputag_set_input_line(device->machine, "maincpu", 0, interrupt ? ASSERT_LINE : CLEAR_LINE);
5858}
5959
6060
r4560r4561
146146static void at_set_gate_a20(running_machine *machine, int a20)
147147{
148148   /* set the CPU's A20 line */
149   cpu_set_input_line(machine->cpu[0], INPUT_LINE_A20, a20);
149   cputag_set_input_line(machine, "maincpu", INPUT_LINE_A20, a20);
150150}
151151
152152
r4560r4561
162162
163163static void init_at_common(running_machine *machine, const struct kbdc8042_interface *at8042)
164164{
165   const address_space* space = cpu_get_address_space(machine->cpu[0],ADDRESS_SPACE_PROGRAM);
165   const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
166166   mess_init_pc_common(machine, PCCOMMON_KEYBOARD_AT, at_set_keyb_int, at_set_irq_line);
167167   mc146818_init(machine, MC146818_STANDARD);
168168   soundblaster_config(&soundblaster);
r4560r4561
224224
225225   if (LOG_PORT80 && (offset == 0))
226226   {
227      logerror(" at_page8_w(): Port 80h <== 0x%02x (PC=0x%08x)\n", data, (unsigned) cpu_get_reg(space->machine->cpu[0],REG_GENPC));
227      logerror(" at_page8_w(): Port 80h <== 0x%02x (PC=0x%08x)\n", data,
228                     (unsigned) cpu_get_reg(cputag_get_cpu(space->machine, "maincpu"), REG_GENPC));
228229   }
229230
230231   switch(offset % 8) {
r4560r4561
250251   offs_t page_offset = (((offs_t) dma_offset[0][channel]) << 16)
251252      & 0xFF0000;
252253
253   result = memory_read_byte(cpu_get_address_space(device->machine->cpu[0],ADDRESS_SPACE_PROGRAM), page_offset + offset);
254   result = memory_read_byte(cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM), page_offset + offset);
254255   return result;
255256}
256257
r4560r4561
260261   offs_t page_offset = (((offs_t) dma_offset[0][channel]) << 16)
261262      & 0xFF0000;
262263
263   memory_write_byte(cpu_get_address_space(device->machine->cpu[0],ADDRESS_SPACE_PROGRAM), page_offset + offset, data);
264   memory_write_byte(cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM), page_offset + offset, data);
264265}
265266
266267
r4560r4561
471472
472473static READ8_HANDLER( at_kbdc8042_p1_r )
473474{
474   logerror("%04x: reading P1\n", cpu_get_pc(space->machine->cpu[0]) );
475   logerror("%04x: reading P1\n", cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")) );
475476   return 0xFF;
476477}
477478
r4560r4561
484485
485486static WRITE8_HANDLER( at_kbdc8042_p2_w )
486487{
487   logerror("%04x: writing $%02x to P2\n", cpu_get_pc(space->machine->cpu[0]), data );
488   logerror("%04x: writing $%02x to P2\n", cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")), data );
488489
489490   at_set_gate_a20( space->machine, ( data & 0x02 ) ? 1 : 0 );
490491   
491   cpu_set_input_line(space->machine->cpu[0], INPUT_LINE_RESET, ( data & 0x01 ) ? CLEAR_LINE : ASSERT_LINE );
492   cputag_set_input_line(space->machine, "maincpu", INPUT_LINE_RESET, ( data & 0x01 ) ? CLEAR_LINE : ASSERT_LINE );
492493
493494   at_kbdc8042.clock_signal = ( data & 0x40 ) ? 1 : 0;
494495   at_kbdc8042.data_signal = ( data & 0x80 ) ? 1 : 0;
r4560r4561
552553   switch ( offset )
553554   {
554555   case 0:      /* A2 is wired to 8042 A0 */
555      data = upi41_master_r( space->machine->cpu[1], 0 );
556      data = upi41_master_r( cputag_get_cpu(space->machine, "kbdc8042"), 0 );
556557      break;
557558
558559   case 1:
r4560r4561
581582      break;
582583
583584   case 4:      /* A2 is wired to 8042 A0 */
584      data = upi41_master_r( space->machine->cpu[1], 1 );
585      data = upi41_master_r( cputag_get_cpu(space->machine, "kbdc8042"), 1 );
585586      break;
586587   }
587588
r4560r4561
598599
599600   switch (offset) {
600601   case 0:      /* A2 is wired to 8042 A0 */
601      upi41_master_w( space->machine->cpu[1], 0, data );
602      upi41_master_w( cputag_get_cpu(space->machine, "kbdc8042"), 0, data );
602603      break;
603604
604605   case 1:
r4560r4561
608609      break;
609610
610611   case 4:      /* A2 is wired to 8042 A0 */
611      upi41_master_w( space->machine->cpu[1], 1, data );
612      upi41_master_w( cputag_get_cpu(space->machine, "kbdc8042"), 1, data );
612613      break;
613614    }
614615}
r4560r4561
686687static void at_map_vga_memory(running_machine *machine, offs_t begin, offs_t end, read8_space_func rh, write8_space_func wh)
687688{
688689   int buswidth;
689   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
690   buswidth = cpu_get_databus_width(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
690   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
691   buswidth = cpu_get_databus_width(cputag_get_cpu(machine, "maincpu"), ADDRESS_SPACE_PROGRAM);
691692   switch(buswidth)
692693   {
693694      case 8:
r4560r4561
761762
762763MACHINE_START( at )
763764{
764   cpu_set_irq_callback(machine->cpu[0], at_irq_callback);
765   cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), at_irq_callback);
765766   pc_fdc_init( machine, &fdc_interface );
766767}
767768
src/mess/machine/amstrad.c
r4560r4561
582582      {
583583         amstrad_plus_irq_cause = channel * 2;
584584         amstrad_plus_asic_ram[0x2c0f] |= (0x40 >> channel);
585         cpu_set_input_line(machine->cpu[0],0,ASSERT_LINE);
585         cputag_set_input_line(machine, "maincpu", 0, ASSERT_LINE);
586586         logerror("DMA %i: INT\n",channel);
587587      }
588588      if (command & 0x20)  // Stop processing on this channel
r4560r4561
12061206         {
12071207            if (amstrad_CRTC_HS_Counter >= 32)
12081208            {
1209               cpu_set_input_line(device->machine->cpu[0],0, ASSERT_LINE);
1209               cputag_set_input_line(device->machine, "maincpu", 0, ASSERT_LINE);
12101210            }
12111211            amstrad_CRTC_HS_Counter = 0;
12121212         }
r4560r4561
12151215      if ( amstrad_CRTC_HS_Counter >= 52 )
12161216      {
12171217         amstrad_CRTC_HS_Counter = 0;
1218         cpu_set_input_line(device->machine->cpu[0],0, ASSERT_LINE);
1218         cputag_set_input_line(device->machine, "maincpu", 0, ASSERT_LINE);
12191219      }
12201220   }
12211221   amstrad_CRTC_HS = hsync ? 1 : 0;
r4560r4561
12381238            {
12391239               if( asic.pri == 0 || asic.enabled == 0)
12401240               {
1241                  cpu_set_input_line(device->machine->cpu[0],0, ASSERT_LINE);
1241                  cputag_set_input_line(device->machine, "maincpu", 0, ASSERT_LINE);
12421242               }
12431243            }
12441244            amstrad_CRTC_HS_Counter = 0;
r4560r4561
12501250         amstrad_CRTC_HS_Counter = 0;
12511251         if ( asic.pri == 0 || asic.enabled == 0 )
12521252         {
1253            cpu_set_input_line(device->machine->cpu[0],0, ASSERT_LINE);
1253            cputag_set_input_line(device->machine, "maincpu", 0, ASSERT_LINE);
12541254         }
12551255      }
12561256
r4560r4561
12621262            if ( asic.pri == video_screen_get_vpos( device->machine->primary_screen ) )
12631263            {
12641264               logerror("PRI: triggered, scanline %d\n",asic.pri);
1265               cpu_set_input_line(device->machine->cpu[0],0,ASSERT_LINE);
1265               cputag_set_input_line(device->machine, "maincpu", 0, ASSERT_LINE);
12661266               amstrad_plus_irq_cause = 0x06;  // raster interrupt vector
12671267               amstrad_CRTC_HS_Counter &= ~0x20;  // ASIC PRI resets the MSB of the raster counter
12681268            }
r4560r4561
13661366{
13671367      int pc;
13681368
1369      pc = cpu_get_pc(space->machine->cpu[0]);
1369      pc = cpu_get_pc(cputag_get_cpu(space->machine, "maincpu"));
13701370
13711371      /* there are two places where CALL &0065 can be found
13721372        in the multiface rom. At this address there is a RET.
r4560r4561
14841484      multiface_rethink_memory(machine);
14851485
14861486      /* pulse the nmi line */
1487      cpu_set_input_line(machine->cpu[0], INPUT_LINE_NMI, PULSE_LINE);
1487      cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE);
14881488
14891489      /* initialise 0065 override to monitor calls to 0065 */
1490      memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM),amstrad_multiface_directoverride);
1490      memory_set_direct_update_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), amstrad_multiface_directoverride);
14911491   }
14921492
14931493}
r4560r4561
16511651   }
16521652   else  // CPC+/GX4000
16531653   {
1654      const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
1654      const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
16551655
16561656      if ( asic.enabled && ( asic.rmr2 & 0x18 ) == 0x18 )
16571657      {
r4560r4561
17821782         Aleste_RamBanks[i] = BankAddr;
17831783         AmstradCPC_RamBanks[i] = BankAddr;
17841784      }
1785   } else {/* Need to add the ram expansion configuration here ! */
1785   }
1786   else
1787   {/* Need to add the ram expansion configuration here ! */
17861788   }
17871789   amstrad_rethinkMemory(machine);
17881790}
r4560r4561
18901892      if ( asic.enabled )
18911893      {
18921894         vector = (data & 0xf8) + (amstrad_plus_irq_cause);
1893         cpu_set_input_line_vector(space->machine->cpu[0], 0, vector);
1895         cpu_set_input_line_vector(cputag_get_cpu(space->machine, "maincpu"), 0, vector);
18941896         logerror("ASIC: IM 2 vector write %02x, data = &%02x\n",vector,data);
18951897      }
18961898      asic.dma_clear = data & 0x01;
r4560r4561
19341936      if(data & 0x40)
19351937      {
19361938         logerror("ASIC: DMA 0 IRQ acknowledge\n");
1937         cpu_set_input_line(space->machine->cpu[0],0,CLEAR_LINE);
1939         cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE);
19381940         amstrad_plus_irq_cause = 0x06;
19391941         amstrad_plus_asic_ram[0x2c0f] &= ~0x40;
19401942      }
19411943      if(data & 0x20)
19421944      {
19431945         logerror("ASIC: DMA 1 IRQ acknowledge\n");
1944         cpu_set_input_line(space->machine->cpu[0],0,CLEAR_LINE);
1946         cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE);
19451947         amstrad_plus_irq_cause = 0x06;
19461948         amstrad_plus_asic_ram[0x2c0f] &= ~0x20;
19471949      }
19481950      if(data & 0x10)
19491951      {
19501952         logerror("ASIC: DMA 2 IRQ acknowledge\n");
1951         cpu_set_input_line(space->machine->cpu[0],0,CLEAR_LINE);
1953         cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE);
19521954         amstrad_plus_irq_cause = 0x06;
19531955         amstrad_plus_asic_ram[0x2c0f] &= ~0x10;
19541956      }
r4560r4561
20442046static void amstrad_GateArray_write(running_machine *machine, UINT8 dataToGateArray)
20452047{
20462048/* Get Bit 7 and 6 of the dataToGateArray = Gate Array function selected */
2047   switch ((dataToGateArray & 0xc0)>>6) {
2049   switch ((dataToGateArray & 0xc0)>>6)
2050   {
20482051/* Pen selection
20492052   -------------
20502053Bit Value Function        Bit Value Function
r4560r4561
21302133      if ( gate_array.mrer & 0x10 )
21312134      {
21322135         amstrad_CRTC_HS_Counter = 0;
2133         cpu_set_input_line(machine->cpu[0], 0, CLEAR_LINE);
2136         cputag_set_input_line(machine, "maincpu", 0, CLEAR_LINE);
21342137      }
21352138
21362139      /* b3b2 != 0 then change the state of upper or lower rom area and rethink memory */
r4560r4561
23112314   /* if b14 = 0 : CRTC Read selected */
23122315   if ((offset & (1<<14)) == 0)
23132316   {
2314      switch(r1r0) {
2317      switch(r1r0)
2318      {
23152319      case 0x02:
23162320         data = mc6845_status_r( mc6845, 0 );
23172321//         /* CRTC Type 1 : Read Status Register
r4560r4561
25842588/* load CPCEMU style snapshots */
25852589static void amstrad_handle_snapshot(running_machine *machine, unsigned char *pSnapshot)
25862590{
2587   const address_space* space = cpu_get_address_space(machine->cpu[0],ADDRESS_SPACE_PROGRAM);
2591   const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
25882592   const device_config *mc6845 = devtag_get_device(space->machine, "mc6845" );
25892593   const device_config *ay8910 = devtag_get_device(machine, "ay");
25902594   int RegData;
r4560r4561
25922596
25932597   /* init Z80 */
25942598   RegData = (pSnapshot[0x011] & 0x0ff) | ((pSnapshot[0x012] & 0x0ff)<<8);
2595   cpu_set_reg(machine->cpu[0],Z80_AF, RegData);
2599   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_AF, RegData);
25962600
25972601   RegData = (pSnapshot[0x013] & 0x0ff) | ((pSnapshot[0x014] & 0x0ff)<<8);
2598   cpu_set_reg(machine->cpu[0],Z80_BC, RegData);
2602   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_BC, RegData);
25992603
26002604   RegData = (pSnapshot[0x015] & 0x0ff) | ((pSnapshot[0x016] & 0x0ff)<<8);
2601   cpu_set_reg(machine->cpu[0],Z80_DE, RegData);
2605   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_DE, RegData);
26022606
26032607   RegData = (pSnapshot[0x017] & 0x0ff) | ((pSnapshot[0x018] & 0x0ff)<<8);
2604   cpu_set_reg(machine->cpu[0],Z80_HL, RegData);
2608   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_HL, RegData);
26052609
26062610   RegData = (pSnapshot[0x019] & 0x0ff) ;
2607   cpu_set_reg(machine->cpu[0],Z80_R, RegData);
2611   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_R, RegData);
26082612
26092613   RegData = (pSnapshot[0x01a] & 0x0ff);
2610   cpu_set_reg(machine->cpu[0],Z80_I, RegData);
2614   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_I, RegData);
26112615
26122616   if ((pSnapshot[0x01b] & 1)==1)
26132617   {
2614      cpu_set_reg(machine->cpu[0],Z80_IFF1, 1);
2618      cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IFF1, 1);
26152619   }
26162620   else
26172621   {
2618      cpu_set_reg(machine->cpu[0],Z80_IFF1, 0);
2622      cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IFF1, 0);
26192623   }
26202624
26212625   if ((pSnapshot[0x01c] & 1)==1)
26222626   {
2623      cpu_set_reg(machine->cpu[0],Z80_IFF2, 1);
2627      cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IFF2, 1);
26242628   }
26252629   else
26262630   {
2627      cpu_set_reg(machine->cpu[0],Z80_IFF2, 0);
2631      cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IFF2, 0);
26282632   }
26292633
26302634   RegData = (pSnapshot[0x01d] & 0x0ff) | ((pSnapshot[0x01e] & 0x0ff)<<8);
2631   cpu_set_reg(machine->cpu[0],Z80_IX, RegData);
2635   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IX, RegData);
26322636
26332637   RegData = (pSnapshot[0x01f] & 0x0ff) | ((pSnapshot[0x020] & 0x0ff)<<8);
2634   cpu_set_reg(machine->cpu[0],Z80_IY, RegData);
2638   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IY, RegData);
26352639
26362640   RegData = (pSnapshot[0x021] & 0x0ff) | ((pSnapshot[0x022] & 0x0ff)<<8);
2637   cpu_set_reg(machine->cpu[0],Z80_SP, RegData);
2638   cpu_set_reg(machine->cpu[0],REG_GENSP,RegData);
2641   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_SP, RegData);
2642   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), REG_GENSP, RegData);
26392643
26402644   RegData = (pSnapshot[0x023] & 0x0ff) | ((pSnapshot[0x024] & 0x0ff)<<8);
26412645
2642   cpu_set_reg(machine->cpu[0],Z80_PC, RegData);
2643//   cpu_set_reg(machine->cpu[0],REG_SP,RegData);
2646   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_PC, RegData);
2647//   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), REG_SP, RegData);
26442648
26452649   RegData = (pSnapshot[0x025] & 0x0ff);
2646   cpu_set_reg(machine->cpu[0],Z80_IM, RegData);
2650   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IM, RegData);
26472651
26482652   RegData = (pSnapshot[0x026] & 0x0ff) | ((pSnapshot[0x027] & 0x0ff)<<8);
2649   cpu_set_reg(machine->cpu[0],Z80_AF2, RegData);
2653   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_AF2, RegData);
26502654
26512655   RegData = (pSnapshot[0x028] & 0x0ff) | ((pSnapshot[0x029] & 0x0ff)<<8);
2652   cpu_set_reg(machine->cpu[0],Z80_BC2, RegData);
2656   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_BC2, RegData);
26532657
26542658   RegData = (pSnapshot[0x02a] & 0x0ff) | ((pSnapshot[0x02b] & 0x0ff)<<8);
2655   cpu_set_reg(machine->cpu[0],Z80_DE2, RegData);
2659   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_DE2, RegData);
26562660
26572661   RegData = (pSnapshot[0x02c] & 0x0ff) | ((pSnapshot[0x02d] & 0x0ff)<<8);
2658   cpu_set_reg(machine->cpu[0],Z80_HL2, RegData);
2662   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_HL2, RegData);
26592663
26602664   /* init GA */
26612665   for (i=0; i<17; i++)
r4560r4561
28042808   }
28052809
28062810   /* multiface hardware enabled? */
2807   if (multiface_hardware_enabled(machine)) {
2811   if (multiface_hardware_enabled(machine))
2812   {
28082813      multiface_rethink_memory(machine);
28092814   }
28102815}
r4560r4561
28542859static unsigned char amstrad_Psg_FunctionSelected;
28552860static void update_psg(running_machine *machine)
28562861{
2857   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
2862   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
28582863   const device_config *ay8910 = devtag_get_device(machine, "ay");
28592864   
28602865   if(aleste_mode & 0x20)  // RTC selected
r4560r4561
29462951/* Set b7 with cassette tape input */
29472952   if(amstrad_system_type != SYSTEM_GX4000)
29482953   {
2949      if (cassette_input(devtag_get_device(device->machine, "cassette" )) > 0.03) {
2954      if (cassette_input(devtag_get_device(device->machine, "cassette" )) > 0.03)
2955      {
29502956         data |= (1<<7);
29512957      }
29522958   }
r4560r4561
30113017   /* b5 Cassette Write data */
30123018   if(amstrad_system_type != SYSTEM_GX4000)
30133019   {
3014      if ((changed_data & 0x20) != 0) {
3020      if ((changed_data & 0x20) != 0)
3021      {
30153022         cassette_output(devtag_get_device(device->machine, "cassette" ),
30163023            ((data & 0x20) ? -1.0 : +1.0));
30173024      }
r4560r4561
30743081      amstrad_plus_asic_ram[0x2c0f] &= ~0x80;  // not a raster interrupt, so this bit is reset
30753082      return (amstrad_plus_asic_ram[0x2805] & 0xf8) | amstrad_plus_irq_cause;
30763083   }
3077   cpu_set_input_line(device->machine->cpu[0],0, CLEAR_LINE);
3084   cputag_set_input_line(device->machine,"maincpu", 0, CLEAR_LINE);
30783085   amstrad_CRTC_HS_Counter &= 0x1F;
30793086   if ( asic.enabled )
30803087   {
r4560r4561
32133220
32143221static void amstrad_common_init(running_machine *machine)
32153222{
3216   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
3223   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
32173224
32183225   aleste_mode = 0;
32193226
r4560r4561
32453252   memory_install_write8_handler(space, 0xc000, 0xdfff, 0, 0, SMH_BANK15);
32463253   memory_install_write8_handler(space, 0xe000, 0xffff, 0, 0, SMH_BANK16);
32473254
3248   device_reset(space->machine->cpu[0]);
3255   device_reset(cputag_get_cpu(space->machine, "maincpu"));
32493256   if ( amstrad_system_type == SYSTEM_CPC || amstrad_system_type == SYSTEM_ALESTE )
3250      cpu_set_input_line_vector(machine->cpu[0], 0,0xff);
3257      cpu_set_input_line_vector(cputag_get_cpu(machine, "maincpu"), 0, 0xff);
32513258   else
3252      cpu_set_input_line_vector(machine->cpu[0], 0,0x00);
3259      cpu_set_input_line_vector(cputag_get_cpu(machine, "maincpu"), 0, 0x00);
32533260
32543261   if(amstrad_system_type != SYSTEM_GX4000)
32553262   {
r4560r4561
32673274
32683275   /* Using the cool code Juergen has provided, I will override
32693276    the timing tables with the values for the amstrad */
3270   z80_set_cycle_tables(machine->cpu[0],
3277   z80_set_cycle_tables(cputag_get_cpu(machine, "maincpu"),
32713278      (void*)amstrad_cycle_table_op,
32723279      (void*)amstrad_cycle_table_cb,
32733280      (void*)amstrad_cycle_table_ed,
r4560r4561
32763283      (void*)amstrad_cycle_table_ex);
32773284
32783285   /* Juergen is a cool dude! */
3279   cpu_set_irq_callback(machine->cpu[0], amstrad_cpu_acknowledge_int);
3286   cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), amstrad_cpu_acknowledge_int);
32803287}
32813288
32823289
src/mess/machine/apple2gs.c
r4560r4561
317317         logerror("apple2gs_add_irq(): adding %s\n", apple2gs_irq_name(irq_mask));
318318
319319      apple2gs_pending_irqs |= irq_mask;
320      cpu_set_input_line(machine->cpu[0], G65816_LINE_IRQ, apple2gs_pending_irqs ? ASSERT_LINE : CLEAR_LINE);
320      cputag_set_input_line(machine, "maincpu", G65816_LINE_IRQ, apple2gs_pending_irqs ? ASSERT_LINE : CLEAR_LINE);
321321   }
322322}
323323
r4560r4561
331331         logerror("apple2gs_remove_irq(): removing %s\n", apple2gs_irq_name(irq_mask));
332332
333333      apple2gs_pending_irqs &= ~irq_mask;
334      cpu_set_input_line(machine->cpu[0], G65816_LINE_IRQ, apple2gs_pending_irqs ? ASSERT_LINE : CLEAR_LINE);
334      cputag_set_input_line(machine, "maincpu", G65816_LINE_IRQ, apple2gs_pending_irqs ? ASSERT_LINE : CLEAR_LINE);
335335   }
336336}
337337
r4560r4561
828828
829829      /* call Apple II interrupt handler */
830830      if ((video_screen_get_vpos(machine->primary_screen) % 8) == 7)
831         apple2_interrupt(machine->cpu[0]);
831         apple2_interrupt(cputag_get_cpu(machine, "maincpu"));
832832   }
833833
834834   timer_adjust_oneshot(apple2gs_scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, (scanline+1)%262, 0), 0);
r4560r4561
11761176
11771177      case 0x36:   /* C036 - CYAREG */
11781178         apple2gs_cyareg = data & ~0x20;
1179         cpu_set_clock(space->machine->cpu[0], (data & 0x80) ? APPLE2GS_14M/5 : APPLE2GS_7M/7);
1179         cputag_set_clock(space->machine, "maincpu", (data & 0x80) ? APPLE2GS_14M/5 : APPLE2GS_7M/7);
11801180         break;
11811181
11821182      case 0x38:   /* C038 - SCCBREG */
r4560r4561
15381538   }
15391539   else if ((address & 0x000F00) == 0x000000)
15401540   {
1541      result = apple2gs_c0xx_r(cpu_get_address_space(machine->cpu[0],ADDRESS_SPACE_PROGRAM), address);
1541      result = apple2gs_c0xx_r(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), address);
15421542   }
15431543   else
15441544   {
r4560r4561
15641564   }
15651565   else if ((address & 0x000F00) == 0x000000)
15661566   {
1567      apple2gs_c0xx_w(cpu_get_address_space(machine->cpu[0],ADDRESS_SPACE_PROGRAM), address, data);
1567      apple2gs_c0xx_w(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), address, data);
15681568   }
15691569   else
15701570   {
r4560r4561
16531653
16541654static void apple2gs_setup_memory(running_machine *machine)
16551655{
1656   const address_space* space = cpu_get_address_space(machine->cpu[0],ADDRESS_SPACE_PROGRAM);
1656   const address_space* space = cputag_get_address_space(machine, "maincpu",ADDRESS_SPACE_PROGRAM);
16571657   offs_t begin, end;
16581658   apple2_memmap_config cfg;
16591659
r4560r4561
17391739   apple2_init_common(machine);
17401740
17411741   /* set up Apple IIgs vectoring */
1742   device_set_info_fct(machine->cpu[0], CPUINFO_FCT_G65816_READVECTOR_CALLBACK, (genf *) apple2gs_read_vector);
1742   device_set_info_fct(cputag_get_cpu(machine, "maincpu"), CPUINFO_FCT_G65816_READVECTOR_CALLBACK, (genf *) apple2gs_read_vector);
17431743
17441744   /* setup globals */
17451745   apple2gs_cur_slot6_image = NULL;
src/mess/machine/atom.c
r4560r4561
106106      {
107107         /* I'll pulse it because if I used hold-line I'm not sure
108108         it would clear - to be checked */
109         cpu_set_input_line(device->machine->cpu[0], INPUT_LINE_NMI, PULSE_LINE);
109         cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE);
110110      }
111111   }
112112
r4560r4561
254254   /* copy data into memory */
255255   for (i=size-1; i>=0; i--)
256256   {
257      memory_write_byte( cpu_get_address_space( image->machine->cpu[0], ADDRESS_SPACE_PROGRAM ), addr, data[0]);
257      memory_write_byte( cputag_get_address_space( image->machine, "maincpu", ADDRESS_SPACE_PROGRAM ), addr, data[0]);
258258      addr++;
259259      data++;
260260   }
261261
262262
263263   /* set new pc address */
264   cpu_set_reg( image->machine->cpu[0], REG_GENPC, exec);
264   cpu_set_reg( cputag_get_cpu(image->machine, "maincpu"), REG_GENPC, exec);
265265
266266   /* free the data */
267267   free(quickload_data);
src/mess/machine/apple1.c
r4560r4561
144144
145145DRIVER_INIT( apple1 )
146146{
147   const address_space* space = cpu_get_address_space(machine->cpu[0],ADDRESS_SPACE_PROGRAM);
147   const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
148148   /* Set up the handlers for MESS's dynamically-sized RAM. */
149149   memory_install_read8_handler(space,
150150                         0x0000, mess_ram_size - 1, 0, 0, SMH_BANK1);
r4560r4561
259259   for (addr = start_addr, snapptr = snapbuf + SNAP_HEADER_LEN;
260260       addr <= end_addr;
261261       addr++, snapptr++)
262      memory_write_byte(cpu_get_address_space(image->machine->cpu[0],ADDRESS_SPACE_PROGRAM), addr, *snapptr);
262      memory_write_byte(cputag_get_address_space(image->machine, "maincpu", ADDRESS_SPACE_PROGRAM), addr, *snapptr);
263263
264264   return INIT_PASS;
265265}
r4560r4561
302302      if (!reset_flag) {
303303         reset_flag = 1;
304304         /* using PULSE_LINE does not allow us to press and hold key */
305         cpu_set_input_line(machine->cpu[0], INPUT_LINE_RESET, ASSERT_LINE);
305         cputag_set_input_line(machine, "maincpu", INPUT_LINE_RESET, ASSERT_LINE);
306306         device_reset( pia );
307307      }
308308   }
309309   else if (reset_flag) {
310310      /* RESET released--allow the processor to continue. */
311311      reset_flag = 0;
312      cpu_set_input_line(machine->cpu[0], INPUT_LINE_RESET, CLEAR_LINE);
312      cputag_set_input_line(machine, "maincpu", INPUT_LINE_RESET, CLEAR_LINE);
313313   }
314314
315315   /* The CLEAR SCREEN switch clears the video hardware. */
src/mess/machine/apple2.c
r4560r4561
100100
101101void apple2_update_memory(running_machine *machine)
102102{
103   const address_space* space = cpu_get_address_space(machine->cpu[0],ADDRESS_SPACE_PROGRAM);
103   const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
104104   int i, bank, rbank, wbank;
105105   int full_update = 0;
106106   apple2_meminfo meminfo;
r4560r4561
569569
570570void apple2_setvar(running_machine *machine, UINT32 val, UINT32 mask)
571571{
572   LOG(("apple2_setvar(): val=0x%06x mask=0x%06x pc=0x%04x\n", val, mask, (unsigned int) cpu_get_reg(machine->cpu[0], REG_GENPC)));
572   LOG(("apple2_setvar(): val=0x%06x mask=0x%06x pc=0x%04x\n", val, mask,
573               (unsigned int) cpu_get_reg(cputag_get_cpu(machine, "maincpu"), REG_GENPC)));
573574
574575   assert((val & mask) == val);
575576
r4560r4561
628629
629630   // video scanner data
630631   //
631   i = cpu_get_total_cycles(machine->cpu[0]) % kClocksPerVSync; // cycles into this VSync
632   i = cputag_get_total_cycles(machine, "maincpu") % kClocksPerVSync; // cycles into this VSync
632633
633634   // machine state switches
634635   //
r4560r4561
784785         irq_freq = 1;
785786
786787      if (irq_freq)
787         cpu_set_input_line(device->machine->cpu[0], M6502_IRQ_LINE, PULSE_LINE);
788         cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, PULSE_LINE);
788789   }
789790
790791   video_screen_update_partial(device->machine->primary_screen, scanline);
src/mess/drivers/aquarius.c
r4560r4561
219219
220220static INPUT_CHANGED( aquarius_reset )
221221{
222   cpu_set_input_line(field->port->machine->cpu[0], INPUT_LINE_RESET, (input_port_read(field->port->machine, "RESET") ? CLEAR_LINE : ASSERT_LINE));
222   cputag_set_input_line(field->port->machine, "maincpu", INPUT_LINE_RESET, (input_port_read(field->port->machine, "RESET") ? CLEAR_LINE : ASSERT_LINE));
223223}
224224
225225static INPUT_PORTS_START(aquarius)
r4560r4561
358358   switch (mess_ram_size)
359359   {
360360   case 4 * 1024:
361      memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4000, 0xbfff, 0, 0, SMH_UNMAP, SMH_UNMAP);
361      memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x4000, 0xbfff, 0, 0, SMH_UNMAP, SMH_UNMAP);
362362      break;
363363
364364   case 8 * 1024: // 4K expansion
365      memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4000, 0x4fff, 0, 0, SMH_BANK1, SMH_BANK1);
366      memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x5000, 0xbfff, 0, 0, SMH_UNMAP, SMH_UNMAP);
365      memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x4000, 0x4fff, 0, 0, SMH_BANK1, SMH_BANK1);
366      memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x5000, 0xbfff, 0, 0, SMH_UNMAP, SMH_UNMAP);
367367      break;
368368
369369   case 20 * 1024: // 16K expansion
370      memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4000, 0x8fff, 0, 0, SMH_BANK1, SMH_BANK1);
371      memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x9000, 0xbfff, 0, 0, SMH_UNMAP, SMH_UNMAP);
370      memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x4000, 0x8fff, 0, 0, SMH_BANK1, SMH_BANK1);
371      memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x9000, 0xbfff, 0, 0, SMH_UNMAP, SMH_UNMAP);
372372      break;
373373
374374   case 36 * 1024: // 32K expansion (prototype)
375      memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4000, 0xbfff, 0, 0, SMH_BANK1, SMH_BANK1);
375      memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x4000, 0xbfff, 0, 0, SMH_BANK1, SMH_BANK1);
376376      break;
377377   }
378378
r4560r4561
398398   switch (size)
399399   {
400400   case 8 * 1024:
401      memory_install_readwrite8_handler(cpu_get_address_space(image->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc000, 0xdfff, 0, 0x2000, SMH_BANK2, SMH_UNMAP);
401      memory_install_readwrite8_handler(cputag_get_address_space(image->machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xc000, 0xdfff, 0, 0x2000, SMH_BANK2, SMH_UNMAP);
402402      break;
403403
404404   case 16 * 1024:
405      memory_install_readwrite8_handler(cpu_get_address_space(image->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc000, 0xffff, 0, 0, SMH_BANK2, SMH_UNMAP);
405      memory_install_readwrite8_handler(cputag_get_address_space(image->machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xc000, 0xffff, 0, 0, SMH_BANK2, SMH_UNMAP);
406406      break;
407407   }
408408
src/mess/drivers/apf.c
r4560r4561
146146
147147void apf_update_ints(running_machine *machine)
148148{
149   cpu_set_input_line(machine->cpu[0], 0, apf_ints ? HOLD_LINE : CLEAR_LINE);
149   cputag_set_input_line(machine, "maincpu", 0, apf_ints ? HOLD_LINE : CLEAR_LINE);
150150}
151151
152152static WRITE_LINE_DEVICE_HANDLER( apf_m1000_irq_a_func )
src/mess/drivers/avigo.c
r4560r4561
9696
9797static void avigo_setbank(running_machine *machine, int bank, void *address, read8_space_func rh, write8_space_func wh)
9898{
99   const address_space* space = cpu_get_address_space(machine->cpu[0],ADDRESS_SPACE_PROGRAM);
99   const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
100100   if (address)
101101   {
102102      memory_set_bankptr(machine, 1+bank, address);
r4560r4561
156156static void avigo_refresh_ints(running_machine *machine)
157157{
158158   if (avigo_irq!=0)
159      cpu_set_input_line(machine->cpu[0], 0, HOLD_LINE);
159      cputag_set_input_line(machine, "maincpu", 0, HOLD_LINE);
160160   else
161      cpu_set_input_line(machine->cpu[0], 0, CLEAR_LINE);
161      cputag_set_input_line(machine, "maincpu", 0, CLEAR_LINE);
162162}
163163
164164
r4560r4561
213213      if ((current_input_port_data[3] & 0x02)!=0)
214214      {
215215         /* ????? causes a NMI */
216         cpu_set_input_line(machine->cpu[0], INPUT_LINE_NMI, PULSE_LINE);
216         cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE);
217217      }
218218   }
219219
r4560r4561
435435   /* clear */
436436   memset(mess_ram, 0, 128*1024);
437437
438   memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[0],ADDRESS_SPACE_PROGRAM), avigo_opbase_handler);
438   memory_set_direct_update_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), avigo_opbase_handler);
439439
440440   addr = (unsigned char *)intelflash_getmemptr(0);
441441   avigo_setbank(machine, 0, addr, avigo_flash_0x0000_read_handler, avigo_flash_0x0000_write_handler);

Previous 15994 Revisions Next


© 1998-2018 The MESS Team