Previous 15994 Revisions Next

r4594 Thursday 30th April, 2009 at 21:15:00 UTC by Fabio Priuli
One more round of numbers-to-tag conversions
[src/mess/devices]thomflop.c
[src/mess/drivers]glasgow.c tec1.c timex.c tm990189.c tmc1800.c tmc2000e.c tutor.c vc4000.c vip.c vtech2.c x68k.c z88.c
[src/mess/machine]990_hd.c 990_tap.c 99_dsk.c amigacd.c amigacrt.c amigafdc.c ataricrt.c c128.c c16.c c64.c c65.c cbm.c cbmb.c coco.c geneve.c llc.c mbee.c pet.c sgi.c tandy1t.c thomson.c ti85.c ti990.c ti99_4x.c trs80.c tx0.c vc20.c vector06.c vectrex.c vtech1.c vtech2.c wswan.c z1013.c z80ne.c zx.c
[src/mess/video]newport.c ti85.c tx0.c vc4000.c vectrex.c vtech1.c x68k.c zx.c

src/mess/video/zx.c
r4593r4594
110110
111111   r.min_y = r.max_y = ula_scanline_count;
112112   bitmap_fill(bitmap, &r, 1);
113//   logerror("ULA %3d[%d] NMI, R:$%02X, $%04x\n", video_screen_get_vpos(machine->primary_screen), ula_scancode_count, (unsigned) cpu_get_reg(machine->cpu[0], Z80_R), (unsigned) cpu_get_reg(machine->cpu[0], Z80_PC));
114   cpu_set_input_line(machine->cpu[0], INPUT_LINE_NMI, PULSE_LINE);
113//   logerror("ULA %3d[%d] NMI, R:$%02X, $%04x\n", video_screen_get_vpos(machine->primary_screen), ula_scancode_count, (unsigned) cpu_get_reg(cputag_get_cpu(machine, "maincpu"), Z80_R), (unsigned) cpu_get_reg(cputag_get_cpu(machine, "maincpu"), Z80_PC));
114   cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE);
115115   if (++ula_scanline_count == height)
116116      ula_scanline_count = 0;
117117}
r4593r4594
126126    */
127127   if (ula_irq_active)
128128   {
129//      logerror("ULA %3d[%d] IRQ, R:$%02X, $%04x\n", video_screen_get_vpos(machine->primary_screen), ula_scancode_count, (unsigned) cpu_get_reg(machine->cpu[0], Z80_R), (unsigned) cpu_get_reg(machine->cpu[0], Z80_PC));
129//      logerror("ULA %3d[%d] IRQ, R:$%02X, $%04x\n", video_screen_get_vpos(machine->primary_screen), ula_scancode_count, (unsigned) cpu_get_reg(cputag_get_cpu(machine, "maincpu"), Z80_R), (unsigned) cpu_get_reg(cputag_get_cpu(machine, "maincpu"), Z80_PC));
130130
131131      ula_irq_active = 0;
132      cpu_set_input_line(machine->cpu[0], 0, HOLD_LINE);
132      cputag_set_input_line(machine, "maincpu", 0, HOLD_LINE);
133133   }
134134}
135135
r4593r4594
144144   {
145145      bitmap_t *bitmap = tmpbitmap;
146146      UINT16 y, *scanline;
147      UINT16 ireg = cpu_get_reg(machine->cpu[0], Z80_I) << 8;
147      UINT16 ireg = cpu_get_reg(cputag_get_cpu(machine, "maincpu"), Z80_I) << 8;
148148      UINT8 data, *chrgen, creg;
149149
150150      if (param)
151         creg = cpu_get_reg(machine->cpu[0], Z80_B);
151         creg = cpu_get_reg(cputag_get_cpu(machine, "maincpu"), Z80_B);
152152      else
153         creg = cpu_get_reg(machine->cpu[0], Z80_C);
153         creg = cpu_get_reg(cputag_get_cpu(machine, "maincpu"), Z80_C);
154154
155155      chrgen = memory_region(machine, region);
156156
r4593r4594
172172      for (y = charline_ptr; y < ARRAY_LENGTH(charline); y++)
173173         charline[y] = 0;
174174
175      timer_set(machine, cpu_clocks_to_attotime(machine->cpu[0], ((32 - charline_ptr) << 2)), NULL, 0, zx_ula_irq);
175      timer_set(machine, cputag_clocks_to_attotime(machine, "maincpu", ((32 - charline_ptr) << 2)), NULL, 0, zx_ula_irq);
176176      ula_irq_active++;
177177
178178      scanline = BITMAP_ADDR16(bitmap, ula_scanline_count, 0);
src/mess/video/newport.c
r4593r4594
3838      va_start( v, s_fmt );
3939      vsprintf( buf, s_fmt, v );
4040      va_end( v );
41      logerror( "%08x: %s", cpu_get_pc(machine->cpu[0]), buf );
41      logerror( "%08x: %s", cpu_get_pc(cputag_get_cpu(machine, "maincpu")), buf );
4242   }
4343}
4444
src/mess/video/vectrex.c
r4593r4594
105105
106106   if (vectrex_lightpen_port & 2)
107107   {
108      cpu_set_input_line(machine->cpu[0], M6809_FIRQ_LINE, PULSE_LINE);
108      cputag_set_input_line(machine, "maincpu", M6809_FIRQ_LINE, PULSE_LINE);
109109   }
110110}
111111
r4593r4594
149149   case 9:
150150      via_timer2 = (via_timer2 & 0x00ff) | (data << 8);
151151
152      period = attotime_mul(ATTOTIME_IN_HZ(cpu_get_clock(space->machine->cpu[0])), via_timer2);
152      period = attotime_mul(ATTOTIME_IN_HZ(cputag_get_clock(space->machine, "maincpu")), via_timer2);
153153
154154      if (vectrex_reset_refresh)
155155         timer_adjust_periodic(refresh, period, 0, period);
r4593r4594
266266
267267   if (!ramp)
268268   {
269      length = cpu_get_clock(machine->cpu[0]) * INT_PER_CLOCK
269      length = cputag_get_clock(machine, "maincpu") * INT_PER_CLOCK
270270         * attotime_to_double(attotime_sub(timer_get_time(machine), vector_start_time));
271271
272272      x_int += length * (analog[A_X] + analog[A_ZR]);
r4593r4594
376376                  +(double)(pen_y - y_int) * (pen_y - y_int);
377377               d2 = b2 - ab * ab / a2;
378378               if (d2 < 2e10 && analog[A_Z] * blank > 0)
379                  timer_adjust_oneshot(lp_t, double_to_attotime(ab / a2 / (cpu_get_clock(device->machine->cpu[0]) * INT_PER_CLOCK)), 0);
379                  timer_adjust_oneshot(lp_t, double_to_attotime(ab / a2 / (cputag_get_clock(device->machine, "maincpu") * INT_PER_CLOCK)), 0);
380380            }
381381         }
382382      }
src/mess/video/x68k.c
r4593r4594
490490      }
491491      break;
492492   }
493//   logerror("CRTC: [%08x] Wrote %04x to CRTC register %i\n",cpu_get_pc(space->machine->cpu[0]),data,offset);
493//   logerror("CRTC: [%08x] Wrote %04x to CRTC register %i\n",cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")),data,offset);
494494}
495495
496496READ16_HANDLER( x68k_crtc_r )
r4593r4594
503503   }*/
504504   if(offset < 24)
505505   {
506//      logerror("CRTC: [%08x] Read %04x from CRTC register %i\n",cpu_get_pc(space->machine->cpu[0]),x68k_sys.crtc.reg[offset],offset);
506//      logerror("CRTC: [%08x] Read %04x from CRTC register %i\n",cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")),x68k_sys.crtc.reg[offset],offset);
507507      switch(offset)
508508      {
509509      case 9:
r4593r4594
11921192      x68k_sys.mfp.isra = 0;
11931193      x68k_sys.mfp.isrb = 0;
11941194//      mfp_trigger_irq(MFP_IRQ_GPIP6);
1195//      cpu_set_input_line_and_vector(machine->cpu[0],6,ASSERT_LINE,0x43);
1195//      cputag_set_input_line_and_vector(machine, "maincpu",6,ASSERT_LINE,0x43);
11961196   }
11971197   if(input_code_pressed(KEYCODE_9))
11981198   {
src/mess/video/tx0.c
r4593r4594
292292   int i;
293293
294294   /* column 1: registers, test accumulator, test buffer, toggle switch storage */
295   tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset+2*8, y_panel_pc_offset+8, cpu_get_reg(machine->cpu[0], TX0_PC), 16);
296   tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset+2*8, y_panel_mar_offset+8, cpu_get_reg(machine->cpu[0], TX0_MAR), 16);
297   tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset, y_panel_mbr_offset+8, cpu_get_reg(machine->cpu[0], TX0_MBR), 18);
298   tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset, y_panel_ac_offset+8, cpu_get_reg(machine->cpu[0], TX0_AC), 18);
299   tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset, y_panel_lr_offset+8, cpu_get_reg(machine->cpu[0], TX0_LR), 18);
300   tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset+4*8, y_panel_xr_offset+8, cpu_get_reg(machine->cpu[0], TX0_XR), 14);
301   tx0_draw_multipleswitch(machine, bitmap, x_panel_col1b_offset, y_panel_tbr_offset+8, cpu_get_reg(machine->cpu[0], TX0_TBR), 18);
302   tx0_draw_multipleswitch(machine, bitmap, x_panel_col1b_offset, y_panel_tac_offset+8, cpu_get_reg(machine->cpu[0], TX0_TAC), 18);
303   cm_sel = cpu_get_reg(machine->cpu[0], TX0_CM_SEL);
304   lr_sel = cpu_get_reg(machine->cpu[0], TX0_LR_SEL);
295   tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset+2*8, y_panel_pc_offset+8, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_PC), 16);
296   tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset+2*8, y_panel_mar_offset+8, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_MAR), 16);
297   tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset, y_panel_mbr_offset+8, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_MBR), 18);
298   tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset, y_panel_ac_offset+8, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_AC), 18);
299   tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset, y_panel_lr_offset+8, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_LR), 18);
300   tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset+4*8, y_panel_xr_offset+8, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_XR), 14);
301   tx0_draw_multipleswitch(machine, bitmap, x_panel_col1b_offset, y_panel_tbr_offset+8, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_TBR), 18);
302   tx0_draw_multipleswitch(machine, bitmap, x_panel_col1b_offset, y_panel_tac_offset+8, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_TAC), 18);
303   cm_sel = cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_CM_SEL);
304   lr_sel = cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_LR_SEL);
305305   for (i=0; i<16; i++)
306306   {
307307      tx0_draw_switch(machine, bitmap, x_panel_col1a_offset+16, y_panel_tss_offset+8+i*8, (cm_sel >> i) & 1);
308      tx0_draw_multipleswitch(machine, bitmap, x_panel_col1a_offset+24, y_panel_tss_offset+8+i*8, cpu_get_reg(machine->cpu[0], TX0_TSS00+i), 18);
308      tx0_draw_multipleswitch(machine, bitmap, x_panel_col1a_offset+24, y_panel_tss_offset+8+i*8, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_TSS00+i), 18);
309309      tx0_draw_switch(machine, bitmap, x_panel_col1a_offset+168, y_panel_tss_offset+8+i*8, (lr_sel >> i) & 1);
310310   }
311311
312312   /* column 2: stop c0, stop c1, cm sel, 1-bit indicators, instr, flags */
313   tx0_draw_switch(machine, bitmap, x_panel_col2_offset, y_panel_stop_c0_offset, cpu_get_reg(machine->cpu[0], TX0_STOP_CYC0));
314   tx0_draw_switch(machine, bitmap, x_panel_col2_offset, y_panel_stop_c1_offset, cpu_get_reg(machine->cpu[0], TX0_STOP_CYC1));
315   tx0_draw_switch(machine, bitmap, x_panel_col2_offset, y_panel_gbl_cm_sel_offset, cpu_get_reg(machine->cpu[0], TX0_GBL_CM_SEL));
316   tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_run_offset, cpu_get_reg(machine->cpu[0], TX0_RUN));
317   tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_cycle1_offset, cpu_get_reg(machine->cpu[0], TX0_CYCLE) & 1);
318   tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_cycle2_offset, cpu_get_reg(machine->cpu[0], TX0_CYCLE) & 2);
319   tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_rim_offset, cpu_get_reg(machine->cpu[0], TX0_RIM));
320   tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ioh_offset, cpu_get_reg(machine->cpu[0], TX0_IOH));
321   tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ios_offset, cpu_get_reg(machine->cpu[0], TX0_IOS));
322   tx0_draw_multipleled(machine, bitmap, x_panel_col2_offset, y_panel_ir_offset+8, cpu_get_reg(machine->cpu[0], TX0_IR), 5);
323   tx0_draw_multipleled(machine, bitmap, x_panel_col2_offset, y_panel_pf_offset+8, cpu_get_reg(machine->cpu[0], TX0_PF), 6);
313   tx0_draw_switch(machine, bitmap, x_panel_col2_offset, y_panel_stop_c0_offset, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_STOP_CYC0));
314   tx0_draw_switch(machine, bitmap, x_panel_col2_offset, y_panel_stop_c1_offset, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_STOP_CYC1));
315   tx0_draw_switch(machine, bitmap, x_panel_col2_offset, y_panel_gbl_cm_sel_offset, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_GBL_CM_SEL));
316   tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_run_offset, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_RUN));
317   tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_cycle1_offset, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_CYCLE) & 1);
318   tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_cycle2_offset, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_CYCLE) & 2);
319   tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_rim_offset, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_RIM));
320   tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ioh_offset, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_IOH));
321   tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ios_offset, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_IOS));
322   tx0_draw_multipleled(machine, bitmap, x_panel_col2_offset, y_panel_ir_offset+8, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_IR), 5);
323   tx0_draw_multipleled(machine, bitmap, x_panel_col2_offset, y_panel_pf_offset+8, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_PF), 6);
324324}
325325
326326
src/mess/video/vtech1.c
r4593r4594
8989static void vtech1_field_sync_callback(running_machine *machine, int data)
9090{
9191   if (data)
92      cpu_set_input_line(machine->cpu[0], 0, CLEAR_LINE);
92      cputag_set_input_line(machine, "maincpu", 0, CLEAR_LINE);
9393   else
94      cpu_set_input_line(machine->cpu[0], 0, HOLD_LINE);
94      cputag_set_input_line(machine, "maincpu", 0, HOLD_LINE);
9595}
9696
9797
src/mess/video/ti85.c
r4593r4594
155155
156156VIDEO_UPDATE( ti85 )
157157{
158   const address_space *space = cpu_get_address_space(screen->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
158   const address_space *space = cputag_get_address_space(screen->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
159159   int x,y,b;
160160   int brightnes;
161161   int lcdmem;
src/mess/video/vc4000.c
r4593r4594
176176   case 0xcc:      /* left joystick */
177177      if (input_port_read(space->machine, "CONFIG")&1)
178178      {      /* paddle */
179         if (!cpu_get_reg(space->machine->cpu[0], S2650_FO))
179         if (!cpu_get_reg(cputag_get_cpu(space->machine, "maincpu"), S2650_FO))
180180         {
181181            data = input_port_read(space->machine, "JOYS") & 0x03;
182182            switch (data)
r4593r4594
215215      }
216216      else
217217      {      /* buttons */
218         if (!cpu_get_reg(space->machine->cpu[0], S2650_FO))
218         if (!cpu_get_reg(cputag_get_cpu(space->machine, "maincpu"), S2650_FO))
219219         {
220220            data = input_port_read(space->machine, "JOYS") & 0x03;
221221            switch (data)
r4593r4594
253253   case 0xcd:      /* right joystick */
254254      if (input_port_read(space->machine, "CONFIG")&1)
255255      {
256         if (!cpu_get_reg(space->machine->cpu[0], S2650_FO))
256         if (!cpu_get_reg(cputag_get_cpu(space->machine, "maincpu"), S2650_FO))
257257         {
258258            data = input_port_read(space->machine, "JOYS") & 0x30;
259259            switch (data)
r4593r4594
292292      }
293293      else
294294      {
295         if (!cpu_get_reg(space->machine->cpu[0], S2650_FO))
295         if (!cpu_get_reg(cputag_get_cpu(space->machine, "maincpu"), S2650_FO))
296296         {
297297            data = input_port_read(space->machine, "JOYS") & 0x30;
298298            switch (data)
r4593r4594
635635
636636   if (irq_pause>10)
637637   {
638      cpu_set_input_line(device->machine->cpu[0], 0, CLEAR_LINE);
638      cputag_set_input_line(device->machine, "maincpu", 0, CLEAR_LINE);
639639      irq_pause = 0;
640640   }
641641
r4593r4594
681681      (vc4000_video.sprites[1].finished_now) |
682682      (vc4000_video.sprites[0].finished_now)) && (!irq_pause))
683683      {
684         cpu_set_input_line_and_vector(device->machine->cpu[0], 0, ASSERT_LINE, 3);
684         cputag_set_input_line_and_vector(device->machine, "maincpu", 0, ASSERT_LINE, 3);
685685         irq_pause=1;
686686      }
687687}
src/mess/machine/ataricrt.c
r4593r4594
3939
4040   /* install RAM */
4141   ram_top = MIN(mess_ram_size, ram_size) - 1;
42   memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM),
42   memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM),
4343      0x0000, ram_top, 0, 0, SMH_BANK2);
44   memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM),
44   memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM),
4545      0x0000, ram_top, 0, 0, SMH_BANK2);
4646   memory_set_bankptr(machine, 2, mess_ram);
4747}
r4593r4594
7474         break;
7575   }
7676
77   memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0xbfff, 0, 0,
77   memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x8000, 0xbfff, 0, 0,
7878      read_addr ? SMH_BANK1 : SMH_NOP);
79   memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0xbfff, 0, 0,
79   memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x8000, 0xbfff, 0, 0,
8080      write_addr ? SMH_BANK1 : SMH_NOP);
8181   if (read_addr)
8282      memory_set_bankptr(machine, 1, read_addr);
r4593r4594
116116
117117   /* install RAM */
118118   ram_top = MIN(mess_ram_size, ram_size) - 1;
119   memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM),
119   memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM),
120120      0x0000, ram_top, 0, 0, SMH_BANK2);
121   memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM),
121   memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM),
122122      0x0000, ram_top, 0, 0, SMH_BANK2);
123123   memory_set_bankptr(machine, 2, mess_ram);
124124
src/mess/machine/c65.c
r4593r4594
9797   PAIR pair, src, dst, len;
9898   UINT8 cmd, fill;
9999   int i;
100   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
100   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
101101
102102   switch (offset&3) {
103103   case 2:
r4593r4594
336336
337337static void c65_fdc_w(running_machine *machine, int offset, int data)
338338{
339   DBG_LOG (1, "fdc write", ("%.5x %.2x %.2x\n", cpu_get_pc(machine->cpu[0]), offset, data));
339   DBG_LOG (1, "fdc write", ("%.5x %.2x %.2x\n", cpu_get_pc(cputag_get_cpu(machine, "maincpu")), offset, data));
340340   switch (offset&0xf) {
341341   case 0:
342342      c65_fdc.reg[0]=data;
r4593r4594
417417      data=c65_fdc.reg[offset&0xf];
418418      break;
419419   }
420   DBG_LOG (1, "fdc read", ("%.5x %.2x %.2x\n", cpu_get_pc(machine->cpu[0]), offset, data));
420   DBG_LOG (1, "fdc read", ("%.5x %.2x %.2x\n", cpu_get_pc(cputag_get_cpu(machine, "maincpu")), offset, data));
421421   return data;
422422}
423423
r4593r4594
621621         rh = c65_read_io_dc00;
622622         wh = c65_write_io_dc00;
623623      }
624      memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0dc00, 0x0dfff, 0, 0, rh);
625      memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0dc00, 0x0dfff, 0, 0, wh);
624      memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0dc00, 0x0dfff, 0, 0, rh);
625      memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0dc00, 0x0dfff, 0, 0, wh);
626626   }
627627
628628   c65_io_dc00_on=!(value&1);
r4593r4594
664664   read8_space_func rh4, rh8;
665665   write8_space_func wh5, wh9;
666666
667   data = (UINT8) device_get_info_int(machine->cpu[0], CPUINFO_INT_M6510_PORT);
667   data = (UINT8) devtag_get_info_int(machine, "maincpu", CPUINFO_INT_M6510_PORT);
668668   if (data == old)
669669      return;
670670
r4593r4594
718718         memory_set_bankptr (machine, 8, c64_colorram+0x400);
719719         memory_set_bankptr (machine, 9, c64_colorram+0x400);
720720      }
721      memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0dc00, 0x0dfff, 0, 0, rh8);
722      memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0dc00, 0x0dfff, 0, 0, wh9);
721      memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0dc00, 0x0dfff, 0, 0, rh8);
722      memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0dc00, 0x0dfff, 0, 0, wh9);
723723   }
724724   else
725725   {
r4593r4594
742742         memory_set_bankptr (machine, 8, c64_memory + 0xdc00);
743743      }
744744   }
745   memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0d000, 0x0d7ff, 0, 0, rh4);
746   memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0d000, 0x0d7ff, 0, 0, wh5);
745   memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0d000, 0x0d7ff, 0, 0, rh4);
746   memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0d000, 0x0d7ff, 0, 0, wh5);
747747
748748   if (!c64_game && c64_exrom)
749749   {
src/mess/machine/cbmb.c
r4593r4594
215215   if (level != old_level)
216216   {
217217      DBG_LOG (3, "mos6509", ("irq %s\n", level ? "start" : "end"));
218      cpu_set_input_line(device->machine->cpu[0], M6502_IRQ_LINE, level);
218      cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, level);
219219      old_level = level;
220220   }
221221}
src/mess/machine/mbee.c
r4593r4594
4747   switch( state )
4848   {
4949   case WD17XX_IRQ_CLR:
50//      cpu_set_input_line(machine->cpu[0],0,CLEAR_LINE);
50//      cputag_set_input_line(machine, "maincpu", 0, CLEAR_LINE);
5151      fdc_status &= ~0x40;
5252        break;
5353   case WD17XX_IRQ_SET:
54//      cpu_set_input_line(machine->cpu[0],0,HOLD_LINE);
54//      cputag_set_input_line(machine, "maincpu", 0, HOLD_LINE);
5555      fdc_status |= 0x40;
5656        break;
5757   case WD17XX_DRQ_CLR:
src/mess/machine/coco.c
r4593r4594
600600{
601601   coco_state *state = machine->driver_data;
602602
603   cpu_set_reg(machine->cpu[0], M6809_PC, trailer->reg_pc);
604   cpu_set_reg(machine->cpu[0], M6809_X, trailer->reg_x);
605   cpu_set_reg(machine->cpu[0], M6809_Y, trailer->reg_y);
606   cpu_set_reg(machine->cpu[0], M6809_U, trailer->reg_u);
607   cpu_set_reg(machine->cpu[0], M6809_S, trailer->reg_s);
608   cpu_set_reg(machine->cpu[0], M6809_DP, trailer->reg_dp);
609   cpu_set_reg(machine->cpu[0], M6809_B, trailer->reg_b);
610   cpu_set_reg(machine->cpu[0], M6809_A, trailer->reg_a);
611   cpu_set_reg(machine->cpu[0], M6809_CC, trailer->reg_cc);
603   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), M6809_PC, trailer->reg_pc);
604   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), M6809_X, trailer->reg_x);
605   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), M6809_Y, trailer->reg_y);
606   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), M6809_U, trailer->reg_u);
607   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), M6809_S, trailer->reg_s);
608   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), M6809_DP, trailer->reg_dp);
609   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), M6809_B, trailer->reg_b);
610   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), M6809_A, trailer->reg_a);
611   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), M6809_CC, trailer->reg_cc);
612612
613613   /* I seem to only be able to get a small amount of the PIA state from the
614614    * snapshot trailers. Thus I am going to configure the PIA myself. The
r4593r4594
773773      if (preamble != 0)
774774      {
775775         /* start address - just set the address and return */
776         cpu_set_reg(image->machine->cpu[0], REG_GENPC, block_address);
776         cpu_set_reg(cputag_get_cpu(image->machine, "maincpu"), REG_GENPC, block_address);
777777         done = TRUE;
778778      }
779779      else
780780      {
781         const address_space *space = cpu_get_address_space( image->machine->cpu[0], ADDRESS_SPACE_PROGRAM );
781         const address_space *space = cputag_get_address_space( image->machine, "maincpu", ADDRESS_SPACE_PROGRAM );
782782
783783         /* data block - need to cap the maximum length of the block */
784784         block_length = MIN(block_length, length - position);
r4593r4594
912912   UINT8 pia0_irq_b = pia6821_get_irq_b(state->pia_0);
913913
914914   if (pia0_irq_a || pia0_irq_b)
915      cpu_set_input_line(machine->cpu[0], M6809_IRQ_LINE, ASSERT_LINE);
915      cputag_set_input_line(machine, "maincpu", M6809_IRQ_LINE, ASSERT_LINE);
916916   else
917      cpu_set_input_line(machine->cpu[0], M6809_IRQ_LINE, CLEAR_LINE);
917      cputag_set_input_line(machine, "maincpu", M6809_IRQ_LINE, CLEAR_LINE);
918918}
919919
920920static void d_recalc_firq(running_machine *machine)
r4593r4594
926926   UINT8 pia2_firq_b = (state->pia_2 != NULL) ? pia6821_get_irq_b(state->pia_2) : 0x00;
927927
928928   if (pia1_firq_a || pia1_firq_b || pia2_firq_a || pia2_firq_b)
929      cpu_set_input_line(machine->cpu[0], M6809_FIRQ_LINE, ASSERT_LINE);
929      cputag_set_input_line(machine, "maincpu", M6809_FIRQ_LINE, ASSERT_LINE);
930930   else
931      cpu_set_input_line(machine->cpu[0], M6809_FIRQ_LINE, CLEAR_LINE);
931      cputag_set_input_line(machine, "maincpu", M6809_FIRQ_LINE, CLEAR_LINE);
932932}
933933
934934static void coco3_recalc_irq(running_machine *machine)
935935{
936936   if ((coco3_gimereg[0] & 0x20) && gime_irq)
937      cpu_set_input_line(machine->cpu[0], M6809_IRQ_LINE, ASSERT_LINE);
937      cputag_set_input_line(machine, "maincpu", M6809_IRQ_LINE, ASSERT_LINE);
938938   else
939939      d_recalc_irq(machine);
940940}
r4593r4594
942942static void coco3_recalc_firq(running_machine *machine)
943943{
944944   if ((coco3_gimereg[0] & 0x10) && gime_firq)
945      cpu_set_input_line(machine->cpu[0], M6809_FIRQ_LINE, ASSERT_LINE);
945      cputag_set_input_line(machine, "maincpu", M6809_FIRQ_LINE, ASSERT_LINE);
946946   else
947947      d_recalc_firq(machine);
948948}
r4593r4594
10791079{
10801080   cpunum_set_input_line(machine, 0, INPUT_LINE_HALT, halt_line);
10811081   if (halt_line == CLEAR_LINE)
1082      timer_set(machine, cpu_clocks_to_attotime(machine->cpu[0], 1), NULL, 0, recalc_interrupts);
1082      timer_set(machine, cputag_clocks_to_attotime(machine, "maincpu", 1), NULL, 0, recalc_interrupts);
10831083}
10841084#endif
10851085
r4593r4594
18061806   switch(state)
18071807   {
18081808      case WD17XX_IRQ_CLR:
1809         cpu_set_input_line(device->machine->cpu[0], INPUT_LINE_NMI, CLEAR_LINE);
1809         cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_NMI, CLEAR_LINE);
18101810         break;
18111811      case WD17XX_IRQ_SET:
18121812         if(dgnalpha_just_reset)
r4593r4594
18161816         else
18171817         {
18181818            if (pia6821_get_output_ca2_z(cstate->pia_2))
1819               cpu_set_input_line(device->machine->cpu[0], INPUT_LINE_NMI, ASSERT_LINE);
1819               cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_NMI, ASSERT_LINE);
18201820         }
18211821         break;
18221822      case WD17XX_DRQ_CLR:
r4593r4594
20402040    * TODO:  Make the overclock more accurate.  In dual speed, ROM was a fast
20412041    * access but RAM was not.  I don't know how to simulate this.
20422042    */
2043    cpu_set_clockscale(device->machine->cpu[0], val ? 2 : 1);
2043    cpu_set_clockscale(cputag_get_cpu(device->machine, "maincpu"), val ? 2 : 1);
20442044}
20452045
20462046READ8_HANDLER(dragon_alpha_mapped_irq_r)
r4593r4594
21002100   };
21012101
21022102   /* We need to init these vars from the sam, as this may be called from outside the sam callbacks */
2103   const address_space *space = cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_PROGRAM );
2103   const address_space *space = cputag_get_address_space( machine, "maincpu", ADDRESS_SPACE_PROGRAM );
21042104   coco_state *state = machine->driver_data;
21052105   UINT8 memsize   = get_sam_memorysize(state->sam);
21062106   UINT8 maptype   = get_sam_maptype(state->sam);
r4593r4594
24432443      { 0xfe00, 0xfeff }
24442444   };
24452445
2446   const address_space *space = cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_PROGRAM );
2446   const address_space *space = cputag_get_address_space( machine, "maincpu", ADDRESS_SPACE_PROGRAM );
24472447   int i, offset, writebank;
24482448   UINT8 *readbank;
24492449   UINT8 *cart_rom = memory_region(machine, "cart");
r4593r4594
28042804
28052805void coco_halt_w(const device_config *device, int data)
28062806{
2807   cpu_set_input_line(device->machine->cpu[0], INPUT_LINE_HALT, data ? ASSERT_LINE : CLEAR_LINE);
2807   cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_HALT, data ? ASSERT_LINE : CLEAR_LINE);
28082808}
28092809
28102810
r4593r4594
28152815
28162816void coco_nmi_w(const device_config *device, int data)
28172817{
2818   cpu_set_input_line(device->machine->cpu[0], INPUT_LINE_NMI, data ? ASSERT_LINE : CLEAR_LINE);
2818   cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_NMI, data ? ASSERT_LINE : CLEAR_LINE);
28192819}
28202820
28212821
r4593r4594
28932893   /* setup printer output callback */
28942894   printer_out = init->printer_out_;
28952895
2896   debug_cpu_set_dasm_override(machine->cpu[0], coco_dasm_override);
2896   debug_cpu_set_dasm_override(cputag_get_cpu(machine, "maincpu"), coco_dasm_override);
28972897
28982898   state_save_register_global(machine, mux_sel1);
28992899   state_save_register_global(machine, mux_sel2);
src/mess/machine/990_hd.c
r4593r4594
530530   if (! (hdc.w[1] & w1_transfer_inhibit))
531531      for (i=0; i<real_word_count; i++)
532532      {
533         memory_write_word_16be(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM),dma_address, buffer[i]);
533         memory_write_word_16be(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM),dma_address, buffer[i]);
534534         dma_address = (dma_address + 2) & 0x1ffffe;
535535      }
536536
r4593r4594
685685      if (! (hdc.w[1] & w1_transfer_inhibit))
686686         for (i=0; i<bytes_read; i+=2)
687687         {
688            memory_write_word_16be(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM),dma_address, (((int) buffer[i]) << 8) | buffer[i+1]);
688            memory_write_word_16be(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM),dma_address, (((int) buffer[i]) << 8) | buffer[i+1]);
689689            dma_address = (dma_address + 2) & 0x1ffffe;
690690         }
691691
r4593r4594
781781      /* DMA */
782782      for (i=0; (i<byte_count) && (i<hdc.d[dsk_sel].bytes_per_sector); i+=2)
783783      {
784         word = memory_read_word_16be(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM),dma_address);
784         word = memory_read_word_16be(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM),dma_address);
785785         buffer[i] = word >> 8;
786786         buffer[i+1] = word & 0xff;
787787
r4593r4594
888888   if (! (hdc.w[1] & w1_transfer_inhibit))
889889      for (i=0; i<real_word_count; i++)
890890      {
891         memory_write_word_16be(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM),dma_address, buffer[i]);
891         memory_write_word_16be(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM),dma_address, buffer[i]);
892892         dma_address = (dma_address + 2) & 0x1ffffe;
893893      }
894894
src/mess/machine/99_dsk.c
r4593r4594
7474static void fdc_handle_hold(running_machine *machine)
7575{
7676   if (DSKhold && (!DRQ_IRQ_status) && DVENA)
77      cpu_set_input_line(machine->cpu[0], INPUT_LINE_HALT, ASSERT_LINE);
77      cputag_set_input_line(machine, "maincpu", INPUT_LINE_HALT, ASSERT_LINE);
7878   else
79      cpu_set_input_line(machine->cpu[0], INPUT_LINE_HALT, CLEAR_LINE);
79      cputag_set_input_line(machine, "maincpu", INPUT_LINE_HALT, CLEAR_LINE);
8080}
8181
8282/*
src/mess/machine/ti990.c
r4593r4594
3131   {
3232      for (level = 0; ! (intlines & (1 << level)); level++)
3333         ;
34      cpu_set_input_line_and_vector(machine->cpu[0], 0, ASSERT_LINE, level);   /* interrupt it, baby */
34      cputag_set_input_line_and_vector(machine, "maincpu", 0, ASSERT_LINE, level);   /* interrupt it, baby */
3535   }
3636   else
37      cpu_set_input_line(machine->cpu[0], 0, CLEAR_LINE);
37      cputag_set_input_line(machine, "maincpu", 0, CLEAR_LINE);
3838}
3939
4040void ti990_set_int2(const device_config *device, int state)
r4593r4594
7878
7979static TIMER_CALLBACK(clear_load)
8080{
81   cpu_set_input_line(machine->cpu[0], INPUT_LINE_NMI, CLEAR_LINE);
81   cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, CLEAR_LINE);
8282}
8383
8484void ti990_hold_load(running_machine *machine)
8585{
86   cpu_set_input_line(machine->cpu[0], INPUT_LINE_NMI, ASSERT_LINE);
86   cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, ASSERT_LINE);
8787   timer_set(machine, ATTOTIME_IN_MSEC(100), NULL, 0, clear_load);
8888}
8989
src/mess/machine/thomson.c
r4593r4594
9595         if ( bitpos >= to7_k7_bitsize )
9696            bitpos = to7_k7_bitsize -1;
9797         VLOG (( "$%04x %f to7_get_cassette: state=$%X pos=%f samppos=%i bit=%i\n",
98            cpu_get_previouspc( machine->cpu[0] ), attotime_to_double(timer_get_time(machine)), state, pos, bitpos,
98            cpu_get_previouspc(cputag_get_cpu(machine, "maincpu")), attotime_to_double(timer_get_time(machine)), state, pos, bitpos,
9999            to7_k7_bits[ bitpos ] ));
100100         return to7_k7_bits[ bitpos ];
101101      }
r4593r4594
116116         }
117117         k = ( chg >= 13 ) ? 1 : 0;
118118         VLOG (( "$%04x %f to7_get_cassette: state=$%X pos=%f samppos=%i bit=%i (%i)\n",
119            cpu_get_previouspc( machine->cpu[0] ), attotime_to_double(timer_get_time(machine)), state, pos, bitpos,
119            cpu_get_previouspc(cputag_get_cpu(machine, "maincpu")), attotime_to_double(timer_get_time(machine)), state, pos, bitpos,
120120            k, chg ));
121121         return k;
122122      }
r4593r4594
144144   double pos = cassette_get_position(img);
145145
146146   LOG (( "$%04x %f to7_set_cassette_motor: cassette motor %s bitpos=%i\n",
147          cpu_get_previouspc( device->machine->cpu[0] ), attotime_to_double(timer_get_time(img->machine)), data ? "off" : "on",
147          cpu_get_previouspc(cputag_get_cpu(device->machine, "maincpu")), attotime_to_double(timer_get_time(img->machine)), data ? "off" : "on",
148148          (int) (pos / TO7_BIT_LENGTH) ));
149149
150150   if ( (state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED && !data && pos > 0.3 )
r4593r4594
194194      hbit = hbit >= 0;
195195
196196      VLOG (( "$%04x %f mo5_get_cassette: state=$%X pos=%f hbitpos=%i hbit=%i\n",
197         cpu_get_previouspc( machine->cpu[0] ), attotime_to_double(timer_get_time(machine)), state, pos,
197         cpu_get_previouspc(cputag_get_cpu(machine, "maincpu")), attotime_to_double(timer_get_time(machine)), state, pos,
198198         (int) (pos / MO5_HBIT_LENGTH), hbit ));
199199      return hbit;
200200   }
r4593r4594
219219   double pos = cassette_get_position(img);
220220
221221   LOG (( "$%04x %f mo5_set_cassette_motor: cassette motor %s hbitpos=%i\n",
222          cpu_get_previouspc( device->machine->cpu[0] ), attotime_to_double(timer_get_time(device->machine)), data ? "off" : "on",
222          cpu_get_previouspc(cputag_get_cpu(device->machine, "maincpu")), attotime_to_double(timer_get_time(device->machine)), data ? "off" : "on",
223223          (int) (pos / MO5_HBIT_LENGTH) ));
224224
225225   if ( (state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED &&  !data && pos > 0.3 )
r4593r4594
263263   if ( old && !thom_irq )
264264      LOG_IRQ(( "%f thom_set_irq: irq line down %i\n", attotime_to_double(timer_get_time(machine)), line ));
265265
266   cpu_set_input_line(machine->cpu[0], M6809_IRQ_LINE, thom_irq ? ASSERT_LINE : CLEAR_LINE );
266   cputag_set_input_line(machine, "maincpu", M6809_IRQ_LINE, thom_irq ? ASSERT_LINE : CLEAR_LINE);
267267}
268268
269269
r4593r4594
282282   if ( old && !thom_firq )
283283      LOG_IRQ(( "%f thom_set_firq: firq line down %i\n", attotime_to_double(timer_get_time(machine)), line ));
284284
285   cpu_set_input_line( machine->cpu[0], M6809_FIRQ_LINE, thom_firq ? ASSERT_LINE : CLEAR_LINE );
285   cputag_set_input_line(machine, "maincpu", M6809_FIRQ_LINE, thom_firq ? ASSERT_LINE : CLEAR_LINE);
286286}
287287
288288
r4593r4594
291291{
292292   thom_irq = 0;
293293   thom_firq = 0;
294   cpu_set_input_line( machine->cpu[0], M6809_IRQ_LINE, CLEAR_LINE );
295   cpu_set_input_line( machine->cpu[0], M6809_FIRQ_LINE, CLEAR_LINE );
294   cputag_set_input_line( machine, "maincpu", M6809_IRQ_LINE, CLEAR_LINE );
295   cputag_set_input_line( machine, "maincpu", M6809_FIRQ_LINE, CLEAR_LINE );
296296}
297297
298298
r4593r4594
505505
506506static void to7_update_cart_bank(running_machine *machine)
507507{
508   const address_space* space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
508   const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
509509   static int old_bank = -1;
510510   int bank = 0;
511511   if ( thom_cart_nb_banks )
r4593r4594
770770   int tx  = data & 1;
771771   int dtr = ( data & 2 ) ? 1 : 0;
772772
773   LOG_IO(( "$%04x %f to7_io_porta_out: tx=%i, dtr=%i\n",  cpu_get_previouspc( device->machine->cpu[0] ), attotime_to_double(timer_get_time(device->machine)), tx, dtr ));
773   LOG_IO(( "$%04x %f to7_io_porta_out: tx=%i, dtr=%i\n",  cpu_get_previouspc(cputag_get_cpu(device->machine, "maincpu")), attotime_to_double(timer_get_time(device->machine)), tx, dtr ));
774774   if ( dtr )
775775      to7_io_line.State |=  SERIAL_STATE_DTR;
776776   else
r4593r4594
794794   else
795795      cts = !centronics_busy_r(printer);
796796
797   LOG_IO(( "$%04x %f to7_io_porta_in: mode=%i cts=%i, dsr=%i, rd=%i\n", cpu_get_previouspc( device->machine->cpu[0] ), attotime_to_double(timer_get_time(device->machine)), to7_io_mode(device->machine), cts, dsr, rd ));
797   LOG_IO(( "$%04x %f to7_io_porta_in: mode=%i cts=%i, dsr=%i, rd=%i\n", cpu_get_previouspc(cputag_get_cpu(device->machine, "maincpu")), attotime_to_double(timer_get_time(device->machine)), to7_io_mode(device->machine), cts, dsr, rd ));
798798
799799   return (dsr ? 0x20 : 0) | (cts ? 0x40 : 0) | (rd ? 0x80: 0);
800800}
r4593r4594
805805{
806806   const device_config *printer = devtag_get_device(device->machine, "centronics");
807807
808   LOG_IO(( "$%04x %f to7_io_portb_out: CENTRONICS set data=$%02X\n", cpu_get_previouspc( device->machine->cpu[0] ), attotime_to_double(timer_get_time(device->machine)), data ));
808   LOG_IO(( "$%04x %f to7_io_portb_out: CENTRONICS set data=$%02X\n", cpu_get_previouspc(cputag_get_cpu(device->machine, "maincpu")), attotime_to_double(timer_get_time(device->machine)), data ));
809809
810810   /* set 8-bit data */
811811   centronics_data_w(printer, 0, data);
r4593r4594
817817{
818818   const device_config *printer = devtag_get_device(device->machine, "centronics");
819819
820   LOG_IO(( "$%04x %f to7_io_cb2_out: CENTRONICS set strobe=%i\n", cpu_get_previouspc( device->machine->cpu[0] ), attotime_to_double(timer_get_time(device->machine)), data ));
820   LOG_IO(( "$%04x %f to7_io_cb2_out: CENTRONICS set strobe=%i\n", cpu_get_previouspc(cputag_get_cpu(device->machine, "maincpu")), attotime_to_double(timer_get_time(device->machine)), data ));
821821
822822   /* send STROBE to printer */
823823   centronics_strobe_w(printer, data);
r4593r4594
13281328      /* bit 6:     parity error (ignored) */
13291329      /* bit 7:     interrupt */
13301330      LOG_MIDI(( "$%04x %f to7_midi_r: status $%02X (rdrf=%i, tdre=%i, ovrn=%i, irq=%i)\n",
1331           cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), to7_midi_status,
1331           cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)), to7_midi_status,
13321332           (to7_midi_status & ACIA_6850_RDRF) ? 1 : 0,
13331333           (to7_midi_status & ACIA_6850_TDRE) ? 1 : 0,
13341334           (to7_midi_status & ACIA_6850_OVRN) ? 1 : 0,
r4593r4594
13461346         to7_midi_status &= ~ACIA_6850_OVRN;
13471347      to7_midi_overrun = 0;
13481348      LOG_MIDI(( "$%04x %f to7_midi_r: read data $%02X\n",
1349           cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), data ));
1349           cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)), data ));
13501350      to7_midi_update_irq( space->machine );
13511351      return data;
13521352   }
r4593r4594
13541354
13551355   default:
13561356      logerror( "$%04x to7_midi_r: invalid offset %i\n",
1357           cpu_get_previouspc( space->machine->cpu[0] ),  offset );
1357           cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")),  offset );
13581358      return 0;
13591359   }
13601360}
r4593r4594
13731373      if ( (data & 3) == 3 )
13741374      {
13751375         /* reset */
1376         LOG_MIDI(( "$%04x %f to7_midi_w: reset (data=$%02X)\n", cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), data ));
1376         LOG_MIDI(( "$%04x %f to7_midi_w: reset (data=$%02X)\n", cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)), data ));
13771377         to7_midi_overrun = 0;
13781378         to7_midi_status = 2;
13791379         to7_midi_intr = 0;
r4593r4594
13901390            static const int stop[8] = { 2,2,1,1,2,1,1,1 };
13911391            static const char parity[8] = { 'e','o','e','o','-','-','e','o' };
13921392            LOG_MIDI(( "$%04x %f to7_midi_w: set control to $%02X (bits=%i, stop=%i, parity=%c, intr in=%i out=%i)\n",
1393                 cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)),
1393                 cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)),
13941394                 data,
13951395                 bits[ (data >> 2) & 7 ],
13961396                 stop[ (data >> 2) & 7 ],
r4593r4594
14041404
14051405
14061406   case 1: /* output data */
1407      LOG_MIDI(( "$%04x %f to7_midi_w: write data $%02X\n", cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), data ));
1407      LOG_MIDI(( "$%04x %f to7_midi_w: write data $%02X\n", cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)), data ));
14081408      if ( data == 0x55 )
14091409         /* cable-detect: shortcut */
14101410         chardev_fake_in( to7_midi_chardev, 0x55 );
r4593r4594
14181418
14191419
14201420   default:
1421      logerror( "$%04x to7_midi_w: invalid offset %i (data=$%02X) \n", cpu_get_previouspc( space->machine->cpu[0] ), offset, data );
1421      logerror( "$%04x to7_midi_w: invalid offset %i (data=$%02X) \n", cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset, data );
14221422   }
14231423}
14241424
r4593r4594
15291529
15301530MACHINE_START ( to7 )
15311531{
1532   const address_space* space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
1532   const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
15331533   UINT8* mem = memory_region(machine, "maincpu");
15341534
15351535   LOG (( "to7: machine start called\n" ));
r4593r4594
15881588static WRITE8_DEVICE_HANDLER ( to770_sys_cb2_out )
15891589{
15901590   /* video overlay: black pixels are transparent and show TV image underneath */
1591   LOG(( "$%04x to770_sys_cb2_out: video overlay %i\n", cpu_get_previouspc( device->machine->cpu[0] ), data ));
1591   LOG(( "$%04x to770_sys_cb2_out: video overlay %i\n", cpu_get_previouspc(cputag_get_cpu(device->machine, "maincpu")), data ));
15921592}
15931593
15941594
r4593r4594
16081608static void to770_update_ram_bank(running_machine *machine)
16091609{
16101610   const device_config *sys_pia = devtag_get_device( machine, THOM_PIA_SYS );
1611   const address_space* space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
1611   const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
16121612   UINT8 portb = pia6821_get_port_b_z_mask( sys_pia );
16131613   static int old_bank = -1;
16141614   int bank;
r4593r4594
17301730   case 2: return (lt3 << 7) | (inil << 6);
17311731   case 3: return (init << 7);
17321732   default:
1733      logerror( "$%04x to770_gatearray_r: invalid offset %i\n", cpu_get_previouspc( space->machine->cpu[0] ), offset );
1733      logerror( "$%04x to770_gatearray_r: invalid offset %i\n", cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset );
17341734      return 0;
17351735   }
17361736}
r4593r4594
19581958   case 2: return (lt3 << 7) | (inil << 6);
19591959   case 3: return (init << 7);
19601960   default:
1961      logerror( "$%04x mo5_gatearray_r: invalid offset %i\n",  cpu_get_previouspc( space->machine->cpu[0] ), offset );
1961      logerror( "$%04x mo5_gatearray_r: invalid offset %i\n",  cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset );
19621962      return 0;
19631963   }
19641964}
r4593r4594
20292029
20302030static void mo5_update_cart_bank(running_machine *machine)
20312031{
2032   const address_space* space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
2032   const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
20332033   static int old_bank = -1;
20342034   int rom_is_ram = mo5_reg_cart & 4;
20352035   int bank = 0;
r4593r4594
22022202
22032203WRITE8_HANDLER ( to9_ieee_w )
22042204{
2205   logerror( "$%04x %f to9_ieee_w: unhandled write $%02X to register %i\n", cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), data, offset );
2205   logerror( "$%04x %f to9_ieee_w: unhandled write $%02X to register %i\n", cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)), data, offset );
22062206}
22072207
22082208
22092209
22102210READ8_HANDLER  ( to9_ieee_r )
22112211{
2212   logerror( "$%04x %f to9_ieee_r: unhandled read from register %i\n", cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), offset );
2212   logerror( "$%04x %f to9_ieee_r: unhandled read from register %i\n", cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)), offset );
22132213   return 0;
22142214}
22152215
r4593r4594
22402240   case 2: return (lt3 << 7) | (inil << 6);
22412241   case 3: return (v.init << 7) | (init << 6); /* != TO7/70 */
22422242   default:
2243      logerror( "$%04x to9_gatearray_r: invalid offset %i\n", cpu_get_previouspc( space->machine->cpu[0] ), offset );
2243      logerror( "$%04x to9_gatearray_r: invalid offset %i\n", cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset );
22442244      return 0;
22452245   }
22462246}
r4593r4594
23352335
23362336WRITE8_HANDLER ( to9_vreg_w )
23372337{
2338   LOG_VIDEO(( "$%04x %f to9_vreg_w: off=%i ($%04X) data=$%02X\n", cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), offset, 0xe7da + offset, data ));
2338   LOG_VIDEO(( "$%04x %f to9_vreg_w: off=%i ($%04X) data=$%02X\n", cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)), offset, 0xe7da + offset, data ));
23392339
23402340   switch ( offset )
23412341   {
r4593r4594
23902390
23912391static void to9_update_cart_bank(running_machine *machine)
23922392{
2393   const address_space* space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
2393   const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
23942394   static int old_bank = -1;
23952395   int bank = 0;
23962396   int slot = ( mc6846_get_output_port(devtag_get_device(machine, "mc6846")) >> 4 ) & 3; /* bits 4-5: ROM bank */
r4593r4594
24752475static void to9_update_ram_bank (running_machine *machine)
24762476{
24772477   const device_config *sys_pia = devtag_get_device( machine, THOM_PIA_SYS );
2478   const address_space* space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
2478   const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
24792479   static int old_bank = -1;
24802480   UINT8 port = mc6846_get_output_port(devtag_get_device(machine, "mc6846"));
24812481   UINT8 portb = pia6821_get_port_b_z_mask( sys_pia );
r4593r4594
26332633      /* bit 7:     interrupt */
26342634
26352635      LOG_KBD(( "$%04x %f to9_kbd_r: status $%02X (rdrf=%i, tdre=%i, ovrn=%i, pe=%i, irq=%i)\n",
2636           cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), to9_kbd_status,
2636           cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)), to9_kbd_status,
26372637           (to9_kbd_status & ACIA_6850_RDRF) ? 1 : 0,
26382638           (to9_kbd_status & ACIA_6850_TDRE) ? 1 : 0,
26392639           (to9_kbd_status & ACIA_6850_OVRN) ? 1 : 0,
r4593r4594
26482648      else
26492649         to9_kbd_status &= ~(ACIA_6850_OVRN | ACIA_6850_RDRF);
26502650      to9_kbd_overrun = 0;
2651      LOG_KBD(( "$%04x %f to9_kbd_r: read data $%02X\n", cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), to9_kbd_in ));
2651      LOG_KBD(( "$%04x %f to9_kbd_r: read data $%02X\n", cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)), to9_kbd_in ));
26522652      to9_kbd_update_irq(space->machine);
26532653      return to9_kbd_in;
26542654
26552655   default:
2656      logerror( "$%04x to9_kbd_r: invalid offset %i\n", cpu_get_previouspc( space->machine->cpu[0] ),  offset );
2656      logerror( "$%04x to9_kbd_r: invalid offset %i\n", cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")),  offset );
26572657      return 0;
26582658   }
26592659}
r4593r4594
26752675         to9_kbd_overrun = 0;
26762676         to9_kbd_status = ACIA_6850_TDRE;
26772677         to9_kbd_intr = 0;
2678         LOG_KBD(( "$%04x %f to9_kbd_w: reset (data=$%02X)\n", cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), data ));
2678         LOG_KBD(( "$%04x %f to9_kbd_w: reset (data=$%02X)\n", cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)), data ));
26792679      }
26802680      else
26812681      {
r4593r4594
26892689         to9_kbd_intr = data >> 5;
26902690
26912691         LOG_KBD(( "$%04x %f to9_kbd_w: set control to $%02X (parity=%i, intr in=%i out=%i)\n",
2692              cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)),
2692              cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)),
26932693              data, to9_kbd_parity, to9_kbd_intr >> 2,
26942694              (to9_kbd_intr & 3) ? 1 : 0 ));
26952695      }
r4593r4594
27202720      case 0xFE: to9_kbd_periph = 0; break;
27212721
27222722      default:
2723         logerror( "$%04x %f to9_kbd_w: unknown kbd command %02X\n", cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), data );
2723         logerror( "$%04x %f to9_kbd_w: unknown kbd command %02X\n", cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)), data );
27242724      }
27252725
27262726      thom_set_caps_led( space->machine, !to9_kbd_caps );
27272727
27282728      LOG(( "$%04x %f to9_kbd_w: kbd command %02X (caps=%i, pad=%i, periph=%i)\n",
2729            cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), data,
2729            cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)), data,
27302730            to9_kbd_caps, to9_kbd_pad, to9_kbd_periph ));
27312731
27322732      break;
27332733
27342734   default:
2735      logerror( "$%04x to9_kbd_w: invalid offset %i (data=$%02X) \n", cpu_get_previouspc( space->machine->cpu[0] ), offset, data );
2735      logerror( "$%04x to9_kbd_w: invalid offset %i (data=$%02X) \n", cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset, data );
27362736   }
27372737}
27382738
r4593r4594
35253525static void to8_update_ram_bank (running_machine *machine)
35263526{
35273527   const device_config *sys_pia = devtag_get_device( machine, THOM_PIA_SYS );
3528   const address_space* space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
3528   const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
35293529   UINT8 bank = 0;
35303530
35313531   if ( to8_reg_sys1 & 0x10 )
r4593r4594
35893589
35903590static void to8_update_cart_bank (running_machine *machine)
35913591{
3592   const address_space* space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
3592   const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
35933593   static int old_bank = -1;
35943594   int bank = 0;
35953595
r4593r4594
37813781      break;
37823782
37833783   default:
3784      logerror( "$%04x to8_gatearray_r: invalid offset %i\n", cpu_get_previouspc( space->machine->cpu[0] ), offset );
3784      logerror( "$%04x to8_gatearray_r: invalid offset %i\n", cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset );
37853785      res = 0;
37863786   }
37873787
37883788   LOG_VIDEO(( "$%04x %f to8_gatearray_r: off=%i ($%04X) res=$%02X lightpen=%i\n",
3789        cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)),
3789        cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)),
37903790        offset, 0xe7e4 + offset, res, to7_lightpen ));
37913791
37923792   return res;
r4593r4594
37973797WRITE8_HANDLER ( to8_gatearray_w )
37983798{
37993799   LOG_VIDEO(( "$%04x %f to8_gatearray_w: off=%i ($%04X) data=$%02X\n",
3800        cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)),
3800        cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)),
38013801        offset, 0xe7e4 + offset, data ));
38023802
38033803   switch ( offset )
r4593r4594
38293829
38303830   default:
38313831      logerror( "$%04x to8_gatearray_w: invalid offset %i (data=$%02X)\n",
3832           cpu_get_previouspc( space->machine->cpu[0] ), offset, data );
3832           cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset, data );
38333833   }
38343834}
38353835
r4593r4594
38783878WRITE8_HANDLER ( to8_vreg_w )
38793879{
38803880   LOG_VIDEO(( "$%04x %f to8_vreg_w: off=%i ($%04X) data=$%02X\n",
3881        cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)),
3881        cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)),
38823882        offset, 0xe7da + offset, data ));
38833883
38843884   switch ( offset )
r4593r4594
39343934{
39353935   int ktest = to8_kbd_ktest (device->machine);
39363936
3937   LOG_KBD(( "$%04x %f: to8_sys_porta_in ktest=%i\n", cpu_get_previouspc( device->machine->cpu[0] ), attotime_to_double(timer_get_time(device->machine)), ktest ));
3937   LOG_KBD(( "$%04x %f: to8_sys_porta_in ktest=%i\n", cpu_get_previouspc(cputag_get_cpu(device->machine, "maincpu")), attotime_to_double(timer_get_time(device->machine)), ktest ));
39383938
39393939   return ktest;
39403940}
r4593r4594
43464346static void mo6_update_cart_bank (running_machine *machine)
43474347{
43484348   const device_config *sys_pia = devtag_get_device( machine, THOM_PIA_SYS );
4349   const address_space* space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
4349   const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
43504350   int b = (pia6821_get_output_a( sys_pia ) >> 5) & 1;
43514351   static int old_bank = -1;
43524352   int bank = 0;
r4593r4594
44874487{
44884488   const device_config *printer = devtag_get_device(device->machine, "centronics");
44894489
4490   LOG (( "$%04x %f mo6_game_porta_out: CENTRONICS set data=$%02X\n", cpu_get_previouspc( device->machine->cpu[0] ), attotime_to_double(timer_get_time(device->machine)), data ));
4490   LOG (( "$%04x %f mo6_game_porta_out: CENTRONICS set data=$%02X\n", cpu_get_previouspc(cputag_get_cpu(device->machine, "maincpu")), attotime_to_double(timer_get_time(device->machine)), data ));
44914491
44924492   /* centronics data */
44934493   centronics_data_w(printer, 0, data);
r4593r4594
44994499{
45004500   const device_config *printer = devtag_get_device(device->machine, "centronics");
45014501
4502   LOG (( "$%04x %f mo6_game_cb2_out: CENTRONICS set strobe=%i\n", cpu_get_previouspc( device->machine->cpu[0] ), attotime_to_double(timer_get_time(device->machine)), data ));
4502   LOG (( "$%04x %f mo6_game_cb2_out: CENTRONICS set strobe=%i\n", cpu_get_previouspc(cputag_get_cpu(device->machine, "maincpu")), attotime_to_double(timer_get_time(device->machine)), data ));
45034503
45044504   /* centronics strobe */
45054505   centronics_strobe_w(printer, data);
r4593r4594
47004700      break;
47014701
47024702   default:
4703      logerror( "$%04x mo6_gatearray_r: invalid offset %i\n", cpu_get_previouspc( space->machine->cpu[0] ), offset );
4703      logerror( "$%04x mo6_gatearray_r: invalid offset %i\n", cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset );
47044704      res = 0;
47054705   }
47064706
47074707   LOG_VIDEO(( "$%04x %f mo6_gatearray_r: off=%i ($%04X) res=$%02X lightpen=%i\n",
4708        cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)),
4708        cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)),
47094709        offset, 0xa7e4 + offset, res, to7_lightpen ));
47104710
47114711   return res;
r4593r4594
47164716WRITE8_HANDLER ( mo6_gatearray_w )
47174717{
47184718   LOG_VIDEO(( "$%04x %f mo6_gatearray_w: off=%i ($%04X) data=$%02X\n",
4719        cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)),
4719        cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)),
47204720        offset, 0xa7e4 + offset, data ));
47214721
47224722   switch ( offset )
r4593r4594
47464746      break;
47474747
47484748   default:
4749      logerror( "$%04x mo6_gatearray_w: invalid offset %i (data=$%02X)\n", cpu_get_previouspc( space->machine->cpu[0] ), offset, data );
4749      logerror( "$%04x mo6_gatearray_w: invalid offset %i (data=$%02X)\n", cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset, data );
47504750   }
47514751}
47524752
r4593r4594
47834783WRITE8_HANDLER ( mo6_vreg_w )
47844784{
47854785   LOG_VIDEO(( "$%04x %f mo6_vreg_w: off=%i ($%04X) data=$%02X\n",
4786        cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)),
4786        cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)),
47874787        offset, 0xa7da + offset, data ));
47884788
47894789   switch ( offset )
r4593r4594
49354935   if ( to7_controller_type )
49364936      return to7_floppy_r ( space, offset );
49374937
4938   logerror( "$%04x %f mo5nr_net_r: read from reg %i\n", cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), offset );
4938   logerror( "$%04x %f mo5nr_net_r: read from reg %i\n", cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)), offset );
49394939
49404940   return 0;
49414941}
r4593r4594
49484948      to7_floppy_w ( space, offset, data );
49494949   else
49504950      logerror( "$%04x %f mo5nr_net_w: write $%02X to reg %i\n",
4951           cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), data, offset );
4951           cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)), data, offset );
49524952}
49534953
49544954
src/mess/machine/tx0.c
r4593r4594
323323         if (data & 0100)
324324         {
325325            /* read current AC */
326            ac = cpu_get_reg(machine->cpu[0], TX0_AC);
326            ac = cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_AC);
327327            /* cycle right */
328328            ac = (ac >> 1) | ((ac & 1) << 17);
329329            /* shuffle and insert data into AC */
330330            ac = (ac /*& 0333333*/) | ((data & 001) << 17) | ((data & 002) << 13) | ((data & 004) << 9) | ((data & 010) << 5) | ((data & 020) << 1) | ((data & 040) >> 3);
331331            /* write modified AC */
332            cpu_set_reg(machine->cpu[0], TX0_AC, ac);
332            cpu_set_reg(cputag_get_cpu(machine, "maincpu"), TX0_AC, ac);
333333
334334            tape_reader.rc = (tape_reader.rc+1) & 3;
335335
336336            if (tape_reader.rc == 0)
337337            {   /* IO complete */
338338               tape_reader.rcl = 0;
339               cpu_set_reg(machine->cpu[0], TX0_IO_COMPLETE, 0);
339               cpu_set_reg(cputag_get_cpu(machine, "maincpu"), TX0_IO_COMPLETE, 0);
340340            }
341341         }
342342      }
r4593r4594
354354*/
355355static TIMER_CALLBACK(puncher_callback)
356356{
357   cpu_set_reg(machine->cpu[0], TX0_IO_COMPLETE, 0);
357   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), TX0_IO_COMPLETE, 0);
358358}
359359
360360/*
r4593r4594
442442*/
443443static TIMER_CALLBACK(prt_callback)
444444{
445   cpu_set_reg(machine->cpu[0], TX0_IO_COMPLETE, 0);
445   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), TX0_IO_COMPLETE, 0);
446446}
447447
448448/*
r4593r4594
468468*/
469469static TIMER_CALLBACK(dis_callback)
470470{
471   cpu_set_reg(machine->cpu[0], TX0_IO_COMPLETE, 0);
471   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), TX0_IO_COMPLETE, 0);
472472}
473473
474474/*
r4593r4594
582582      if ((magtape.state == MTS_SELECTED) || ((magtape.state == MTS_SELECTING) && (magtape.command == 2)))
583583      {   /* unit has become unavailable */
584584         magtape.state = MTS_UNSELECTING;
585         cpu_set_reg(image->machine->cpu[0], TX0_PF, cpu_get_reg(image->machine->cpu[0], TX0_PF) | PF_RWC);
585         cpu_set_reg(cputag_get_cpu(image->machine, "maincpu"), TX0_PF, cpu_get_reg(cputag_get_cpu(image->machine, "maincpu"), TX0_PF) | PF_RWC);
586586         schedule_unselect();
587587      }
588588   }
r4593r4594
11241124         previous LR */
11251125         lr = (1 << 17) | ((charcode & 040) << 10) | ((charcode & 020) << 8) | ((charcode & 010) << 6) | ((charcode & 004) << 4) | ((charcode & 002) << 2) | ((charcode & 001) << 1);
11261126         /* write modified LR */
1127         cpu_set_reg(machine->cpu[0], TX0_LR, lr);
1127         cpu_set_reg(cputag_get_cpu(machine, "maincpu"), TX0_LR, lr);
11281128         tx0_typewriter_drawchar(machine, charcode);   /* we want to echo input */
11291129         break;
11301130      }
r4593r4594
11601160
11611161      if (control_transitions & tx0_stop_cyc0)
11621162      {
1163         cpu_set_reg(device->machine->cpu[0], TX0_STOP_CYC0, !cpu_get_reg(device->machine->cpu[0], TX0_STOP_CYC0));
1163         cpu_set_reg(cputag_get_cpu(device->machine, "maincpu"), TX0_STOP_CYC0, !cpu_get_reg(cputag_get_cpu(device->machine, "maincpu"), TX0_STOP_CYC0));
11641164      }
11651165      if (control_transitions & tx0_stop_cyc1)
11661166      {
1167         cpu_set_reg(device->machine->cpu[0], TX0_STOP_CYC1, !cpu_get_reg(device->machine->cpu[0], TX0_STOP_CYC1));
1167         cpu_set_reg(cputag_get_cpu(device->machine, "maincpu"), TX0_STOP_CYC1, !cpu_get_reg(cputag_get_cpu(device->machine, "maincpu"), TX0_STOP_CYC1));
11681168      }
11691169      if (control_transitions & tx0_gbl_cm_sel)
11701170      {
1171         cpu_set_reg(device->machine->cpu[0], TX0_GBL_CM_SEL, !cpu_get_reg(device->machine->cpu[0], TX0_GBL_CM_SEL));
1171         cpu_set_reg(cputag_get_cpu(device->machine, "maincpu"), TX0_GBL_CM_SEL, !cpu_get_reg(cputag_get_cpu(device->machine, "maincpu"), TX0_GBL_CM_SEL));
11721172      }
11731173      if (control_transitions & tx0_stop)
11741174      {
1175         cpu_set_reg(device->machine->cpu[0], TX0_RUN, 0);
1176         cpu_set_reg(device->machine->cpu[0], TX0_RIM, 0);
1175         cpu_set_reg(cputag_get_cpu(device->machine, "maincpu"), TX0_RUN, 0);
1176         cpu_set_reg(cputag_get_cpu(device->machine, "maincpu"), TX0_RIM, 0);
11771177      }
11781178      if (control_transitions & tx0_restart)
11791179      {
1180         cpu_set_reg(device->machine->cpu[0], TX0_RUN, 1);
1181         cpu_set_reg(device->machine->cpu[0], TX0_RIM, 0);
1180         cpu_set_reg(cputag_get_cpu(device->machine, "maincpu"), TX0_RUN, 1);
1181         cpu_set_reg(cputag_get_cpu(device->machine, "maincpu"), TX0_RIM, 0);
11821182      }
11831183      if (control_transitions & tx0_read_in)
11841184      {   /* set cpu to read instructions from perforated tape */
1185         cpu_set_reg(device->machine->cpu[0], TX0_RESET, 0);
1186         cpu_set_reg(device->machine->cpu[0], TX0_RUN, 0);
1187         cpu_set_reg(device->machine->cpu[0], TX0_RIM, 1);
1185         cpu_set_reg(cputag_get_cpu(device->machine, "maincpu"), TX0_RESET, 0);
1186         cpu_set_reg(cputag_get_cpu(device->machine, "maincpu"), TX0_RUN, 0);
1187         cpu_set_reg(cputag_get_cpu(device->machine, "maincpu"), TX0_RIM, 1);
11881188      }
11891189      if (control_transitions & tx0_toggle_dn)
11901190      {
r4593r4594
12021202      {
12031203         if (tsr_index >= 2)
12041204         {
1205            UINT32 cm_sel = (UINT32) cpu_get_reg(device->machine->cpu[0], TX0_CM_SEL);
1206            cpu_set_reg(device->machine->cpu[0], TX0_CM_SEL, cm_sel ^ (1 << (tsr_index - 2)));
1205            UINT32 cm_sel = (UINT32) cpu_get_reg(cputag_get_cpu(device->machine, "maincpu"), TX0_CM_SEL);
1206            cpu_set_reg(cputag_get_cpu(device->machine, "maincpu"), TX0_CM_SEL, cm_sel ^ (1 << (tsr_index - 2)));
12071207         }
12081208      }
12091209      if (control_transitions & tx0_lr_sel)
12101210      {
12111211         if (tsr_index >= 2)
12121212         {
1213            UINT32 lr_sel = (UINT32) cpu_get_reg(device->machine->cpu[0], TX0_LR_SEL);
1214            cpu_set_reg(device->machine->cpu[0], TX0_LR_SEL, (lr_sel ^ (1 << (tsr_index - 2))));
1213            UINT32 lr_sel = (UINT32) cpu_get_reg(cputag_get_cpu(device->machine, "maincpu"), TX0_LR_SEL);
1214            cpu_set_reg(cputag_get_cpu(device->machine, "maincpu"), TX0_LR_SEL, (lr_sel ^ (1 << (tsr_index - 2))));
12151215         }
12161216      }
12171217
r4593r4594
12271227
12281228      /* update toggle switch register */
12291229      if (tsr_transitions)
1230         cpu_set_reg(device->machine->cpu[0], TX0_TBR+tsr_index, cpu_get_reg(device->machine->cpu[0], TX0_TBR+tsr_index) ^ tsr_transitions);
1230         cpu_set_reg(cputag_get_cpu(device->machine, "maincpu"), TX0_TBR+tsr_index, cpu_get_reg(cputag_get_cpu(device->machine, "maincpu"), TX0_TBR+tsr_index) ^ tsr_transitions);
12311231
12321232      /* remember new state of toggle switch register keys */
12331233      old_tsr_keys = tsr_keys;
src/mess/machine/c128.c
r4593r4594
9797   const device_config *cia_1 = devtag_get_device(space->machine, "cia_1");
9898   const device_config *sid = devtag_get_device(space->machine, "sid6581");
9999
100   UINT8 c64_port6510 = (UINT8) device_get_info_int(space->machine->cpu[0], CPUINFO_INT_M6510_PORT);
100   UINT8 c64_port6510 = (UINT8) devtag_get_info_int(space->machine, "maincpu", CPUINFO_INT_M6510_PORT);
101101
102102   if (!c128_write_io)
103103   {
r4593r4594
192192   if (!c64mode)
193193      return;
194194
195   data = (UINT8) device_get_info_int(machine->cpu[0], CPUINFO_INT_M6510_PORT) & 0x07;
195   data = (UINT8) devtag_get_info_int(machine, "maincpu", CPUINFO_INT_M6510_PORT) & 0x07;
196196   if ((data == old)&&(exrom==c64_exrom)&&(game==c64_game)&&!reset)
197197      return;
198198
r4593r4594
564564//         memory_set_context(machine, 0);
565565         c128_bankswitch_z80(machine);
566566//         memory_set_context(machine, 1);
567         cpu_set_input_line(machine->cpu[0], INPUT_LINE_HALT, CLEAR_LINE);
568         cpu_set_input_line(machine->cpu[1], INPUT_LINE_HALT, ASSERT_LINE);
567         cputag_set_input_line(machine, "maincpu", INPUT_LINE_HALT, CLEAR_LINE);
568         cputag_set_input_line(machine, "m8502", INPUT_LINE_HALT, ASSERT_LINE);
569569      }
570570      else
571571      {
r4593r4594
573573//         memory_set_context(machine, 1);
574574         c128_bankswitch_128(machine, reset);
575575//         memory_set_context(machine, 0);
576         cpu_set_input_line(machine->cpu[0], INPUT_LINE_HALT, ASSERT_LINE);
577         cpu_set_input_line(machine->cpu[1], INPUT_LINE_HALT, CLEAR_LINE);
576         cputag_set_input_line(machine, "maincpu", INPUT_LINE_HALT, ASSERT_LINE);
577         cputag_set_input_line(machine, "m8502", INPUT_LINE_HALT, CLEAR_LINE);
578578
579579         /* NPW 19-Nov-2005 - In the C128, CPU #0 starts out and hands over
580580          * control to CPU #1.  CPU #1 seems to execute garbage from 0x0000
r4593r4594
588588          * driver used to work with this behavior, so I am doing this hack
589589          * where I set CPU #1's PC to 0x1100 on reset.
590590          */
591         if (cpu_get_reg(machine->cpu[1], REG_GENPC) == 0x0000)
592            cpu_set_reg(machine->cpu[1], REG_GENPC, 0x1100);
591         if (cpu_get_reg(cputag_get_cpu(machine, "m8502"), REG_GENPC) == 0x0000)
592            cpu_set_reg(cputag_get_cpu(machine, "m8502"), REG_GENPC, 0x1100);
593593      }
594594      mmu_cpu = MMU_CPU8502;
595595      return;
r4593r4594
782782 */
783783static int c128_dma_read(running_machine *machine, int offset)
784784{
785   UINT8 c64_port6510 = (UINT8) device_get_info_int(machine->cpu[0], CPUINFO_INT_M6510_PORT);
785   UINT8 c64_port6510 = (UINT8) devtag_get_info_int(machine, "maincpu", CPUINFO_INT_M6510_PORT);
786786
787787   /* main memory configuration to include */
788788   if (c64mode)
r4593r4594
805805
806806static int c128_dma_read_color(running_machine *machine, int offset)
807807{
808   UINT8 c64_port6510 = (UINT8) device_get_info_int(machine->cpu[0], CPUINFO_INT_M6510_PORT);
808   UINT8 c64_port6510 = (UINT8) devtag_get_info_int(machine, "maincpu", CPUINFO_INT_M6510_PORT);
809809
810810   if (c64mode)
811811      return c64_colorram[offset & 0x3ff] & 0xf;
r4593r4594
892892   int i;
893893
894894   /* configure the M6510 port */
895   device_set_info_fct(machine->cpu[1], CPUINFO_FCT_M6510_PORTREAD, (genf *) c128_m6510_port_read);
896   device_set_info_fct(machine->cpu[1], CPUINFO_FCT_M6510_PORTWRITE, (genf *) c128_m6510_port_write);
895   devtag_set_info_fct(machine, "m8502", CPUINFO_FCT_M6510_PORTREAD, (genf *) c128_m6510_port_read);
896   devtag_set_info_fct(machine, "m8502", CPUINFO_FCT_M6510_PORTWRITE, (genf *) c128_m6510_port_write);
897897
898898   c64_memory = ram;
899899
r4593r4594
959959   c128_vicaddr = c64_vicaddr = c64_memory;
960960   c64mode = 0;
961961   c128_mmu8722_reset (machine);
962   cpu_set_input_line(machine->cpu[0], INPUT_LINE_HALT, CLEAR_LINE);
963   cpu_set_input_line(machine->cpu[1], INPUT_LINE_HALT, ASSERT_LINE);
962   cputag_set_input_line(machine, "maincpu", INPUT_LINE_HALT, CLEAR_LINE);
963   cputag_set_input_line(machine, "m8502", INPUT_LINE_HALT, ASSERT_LINE);
964964}
965965
966966VIDEO_START( c128 )
src/mess/machine/pet.c
r4593r4594
178178   {
179179      DBG_LOG (3, "mos6502", ("irq %s\n", level ? "start" : "end"));
180180      if (driver_state->superpet)
181         cpu_set_input_line(machine->cpu[1], M6809_IRQ_LINE, level);
182      cpu_set_input_line(machine->cpu[0], M6502_IRQ_LINE, level);
181         cputag_set_input_line(machine, "m6809", M6809_IRQ_LINE, level);
182      cputag_set_input_line(machine, "maincpu", M6502_IRQ_LINE, level);
183183      old_level = level;
184184   }
185185}
r4593r4594
595595   state->superpet = 0;
596596   state->cbm8096 = 0;
597597
598   memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, mess_ram_size - 1, 0, 0, SMH_BANK10);
599   memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, mess_ram_size - 1, 0, 0, SMH_BANK10);
598   memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0000, mess_ram_size - 1, 0, 0, SMH_BANK10);
599   memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0000, mess_ram_size - 1, 0, 0, SMH_BANK10);
600600   memory_set_bankptr (machine, 10, pet_memory);
601601
602602   if (mess_ram_size < 0x8000)
603603   {
604      memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), mess_ram_size, 0x7FFF, 0, 0, SMH_NOP);
605      memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), mess_ram_size, 0x7FFF, 0, 0, SMH_NOP);
604      memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), mess_ram_size, 0x7FFF, 0, 0, SMH_NOP);
605      memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), mess_ram_size, 0x7FFF, 0, 0, SMH_NOP);
606606   }
607607
608608   /* 2114 poweron ? 64 x 0xff, 64x 0, and so on */
r4593r4594
675675      spet.rom = 0;
676676      if (input_port_read(machine, "CFG") & 0x04)
677677      {
678         cpu_set_input_line(machine->cpu[0], INPUT_LINE_HALT, 1);
679         cpu_set_input_line(machine->cpu[0], INPUT_LINE_HALT, 0);
678         cputag_set_input_line(machine, "maincpu", INPUT_LINE_HALT, 1);
679         cputag_set_input_line(machine, "maincpu", INPUT_LINE_HALT, 0);
680680         pet_font = 2;
681681      }
682682      else
683683      {
684         cpu_set_input_line(machine->cpu[0], INPUT_LINE_HALT, 0);
685         cpu_set_input_line(machine->cpu[0], INPUT_LINE_HALT, 1);
684         cputag_set_input_line(machine, "maincpu", INPUT_LINE_HALT, 0);
685         cputag_set_input_line(machine, "maincpu", INPUT_LINE_HALT, 1);
686686         pet_font = 0;
687687      }
688688   }
r4593r4594
691691   {
692692      if (input_port_read(machine, "CFG") & 0x08)
693693      {
694         memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xfff0, 0xfff0, 0, 0, cbm8096_w);
694         memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xfff0, 0xfff0, 0, 0, cbm8096_w);
695695      }
696696      else
697697      {
698         memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xfff0, 0xfff0, 0, 0, SMH_NOP);
698         memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xfff0, 0xfff0, 0, 0, SMH_NOP);
699699      }
700700      cbm8096_w(cputag_get_address_space(machine,"maincpu",ADDRESS_SPACE_PROGRAM), 0, 0);
701701   }
src/mess/machine/c16.c
r4593r4594
125125UINT8 c16_m7501_port_read(const device_config *device, UINT8 direction)
126126{
127127   UINT8 data = 0xff;
128   UINT8 c16_port7501 = (UINT8) device_get_info_int(device->machine->cpu[0], CPUINFO_INT_M6510_PORT);
128   UINT8 c16_port7501 = (UINT8) devtag_get_info_int(device->machine, "maincpu", CPUINFO_INT_M6510_PORT);
129129
130130   if ((c16_port7501 & 0x01) || !cbm_serial_data_read(device->machine))
131131      data &= ~0x80;
r4593r4594
422422   if (level != old_level)
423423   {
424424      DBG_LOG (3, "mos7501", ("irq %s\n", level ? "start" : "end"));
425      cpu_set_input_line(machine->cpu[0], M6510_IRQ_LINE, level);
425      cputag_set_input_line(machine, "maincpu", M6510_IRQ_LINE, level);
426426      old_level = level;
427427   }
428428}
r4593r4594
432432   UINT8 *rom;
433433
434434   /* configure the M7501 port */
435   device_set_info_fct(machine->cpu[0], CPUINFO_FCT_M6510_PORTREAD, (genf *) c16_m7501_port_read);
436   device_set_info_fct(machine->cpu[0], CPUINFO_FCT_M6510_PORTWRITE, (genf *) c16_m7501_port_write);
435   devtag_set_info_fct(machine, "maincpu", CPUINFO_FCT_M6510_PORTREAD, (genf *) c16_m7501_port_read);
436   devtag_set_info_fct(machine, "maincpu", CPUINFO_FCT_M6510_PORTWRITE, (genf *) c16_m7501_port_write);
437437
438438   c16_select_roms (cputag_get_address_space(machine,"maincpu",ADDRESS_SPACE_PROGRAM), 0, 0);
439439   c16_switch_to_rom (cputag_get_address_space(machine,"maincpu",ADDRESS_SPACE_PROGRAM), 0, 0);
r4593r4594
489489
490490MACHINE_RESET( c16 )
491491{
492   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
492   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
493493   const device_config *sid = devtag_get_device(space->machine, "sid6581");
494494   
495495   c364_speech_init(machine);
src/mess/machine/vector06.c
r4593r4594
161161   UINT8 val = input_port_read(machine, "RESET");
162162   if ((val & 1)==1) {
163163      memory_set_bankptr(machine, 1, memory_region(machine, "maincpu") + 0x10000);
164      device_reset(machine->cpu[0]);
164      device_reset(cputag_get_cpu(machine, "maincpu"));
165165   }
166166   if ((val & 2)==2) {
167167      memory_set_bankptr(machine, 1, mess_ram + 0x0000);
168      device_reset(machine->cpu[0]);
168      device_reset(cputag_get_cpu(machine, "maincpu"));
169169   }
170170}
171171
r4593r4594
211211
212212MACHINE_RESET( vector06 )
213213{
214   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
214   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
215215   
216   cpu_set_irq_callback(machine->cpu[0], vector06_irq_callback);
216   cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), vector06_irq_callback);
217217   memory_install_read8_handler (space, 0x0000, 0x7fff, 0, 0, SMH_BANK1);
218218   memory_install_write8_handler(space, 0x0000, 0x7fff, 0, 0, SMH_BANK2);
219219   memory_install_read8_handler (space, 0x8000, 0xffff, 0, 0, SMH_BANK3);
src/mess/machine/amigafdc.c
r4593r4594
265265   if ( fdc_status[drive].mfm[cur_pos-2] == ( ( sync >> 8 ) & 0xff ) &&
266266       fdc_status[drive].mfm[cur_pos-1] == ( sync & 0xff ) )
267267   {
268      const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
268      const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
269269
270270      amiga_custom_w(space, REG_INTREQ, 0x8000 | INTENA_DSKSYN, 0xffff);
271271   }
r4593r4594
307307   {
308308      if ( fdc_status[drive].len > 0 )
309309      {
310         const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
310         const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
311311
312312         logerror("Write to disk unsupported yet\n" );
313313
r4593r4594
344344
345345      if ( fdc_status[drive].len <= 0 )
346346      {
347         const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
347         const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
348348
349349         amiga_custom_w(space, REG_INTREQ, 0x8000 | INTENA_DSKBLK, 0xffff);
350350      }
r4593r4594
376376   }
377377
378378   if ( drive == -1 ) {
379      const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
379      const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
380380
381381      logerror("Disk DMA started with no drive selected!\n" );
382382      amiga_custom_w(space, REG_INTREQ, 0x8000 | INTENA_DSKBLK, 0xffff);
src/mess/machine/amigacrt.c
r4593r4594
8383static TIMER_CALLBACK( amiga_ar1_delayed_nmi )
8484{
8585   (void)param;
86   cpu_set_input_line(machine->cpu[0], 7, PULSE_LINE);
86   cputag_set_input_line(machine, "maincpu", 7, PULSE_LINE);
8787}
8888
8989static void amiga_ar1_nmi( running_machine *machine )
9090{
9191   /* get the cart's built-in ram */
92   UINT16 *ar_ram = (UINT16 *)memory_get_write_ptr(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x9fc000);
92   UINT16 *ar_ram = (UINT16 *)memory_get_write_ptr(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x9fc000);
9393
9494   if ( ar_ram != NULL )
9595   {
r4593r4594
101101
102102      /* trigger NMI irq */
103103      amiga_ar1_spurious = 0;
104      timer_set(machine,  cpu_clocks_to_attotime(machine->cpu[0], 28), NULL, 0, amiga_ar1_delayed_nmi );
104      timer_set(machine,  cputag_clocks_to_attotime(machine, "maincpu", 28), NULL, 0, amiga_ar1_delayed_nmi );
105105   }
106106}
107107
r4593r4594
118118      {
119119         /* trigger an NMI or spurious irq */
120120         amiga_ar1_spurious = (offset == 0x60/2) ? 0 : 1;
121         timer_set(space->machine,  cpu_clocks_to_attotime(space->machine->cpu[0], 28), NULL, 0, amiga_ar1_delayed_nmi );
121         timer_set(space->machine,  cputag_clocks_to_attotime(space->machine, "maincpu", 28), NULL, 0, amiga_ar1_delayed_nmi );
122122      }
123123   }
124124
r4593r4594
127127
128128static void amiga_ar1_check_overlay( running_machine *machine )
129129{
130   memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x00007f, 0, 0, amiga_ar1_chipmem_w);
130   memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x000000, 0x00007f, 0, 0, amiga_ar1_chipmem_w);
131131}
132132
133133static void amiga_ar1_init( running_machine *machine )
r4593r4594
146146   memset(ar_ram, 0, 0x4000);
147147
148148   /* Install ROM */
149   memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf00000, 0xf7ffff, 0, 0, SMH_BANK2);
150   memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf00000, 0xf7ffff, 0, 0, SMH_ROM);
149   memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xf00000, 0xf7ffff, 0, 0, SMH_BANK2);
150   memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xf00000, 0xf7ffff, 0, 0, SMH_ROM);
151151
152152   /* Install RAM */
153   memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x9fc000, 0x9fffff, 0, 0, SMH_BANK3);
154   memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x9fc000, 0x9fffff, 0, 0, SMH_BANK3);
153   memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x9fc000, 0x9fffff, 0, 0, SMH_BANK3);
154   memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x9fc000, 0x9fffff, 0, 0, SMH_BANK3);
155155
156156   /* Configure Banks */
157157   memory_set_bankptr(machine, 2, memory_region(machine, "user2"));
r4593r4594
160160   amiga_ar1_spurious = 0;
161161
162162   /* Install IRQ ACK callback */
163   cpu_set_irq_callback(machine->cpu[0],amiga_ar1_irqack);
163   cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), amiga_ar1_irqack);
164164}
165165
166166/***************************************************************************
r4593r4594
256256
257257static void amiga_ar23_freeze( running_machine *machine )
258258{
259   int pc = cpu_get_pc(machine->cpu[0]);
259   int pc = cpu_get_pc(cputag_get_cpu(machine, "maincpu"));
260260
261261   /* only freeze if we're not inside the cart's ROM */
262262   if ( ((pc >> 16) & 0xfe ) != 0x40 )
263263   {
264264      /* get the cart's built-in ram */
265      UINT16 *ar_ram = (UINT16 *)memory_get_write_ptr(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x440000);
265      UINT16 *ar_ram = (UINT16 *)memory_get_write_ptr(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x440000);
266266
267267      if ( ar_ram != NULL )
268268      {
r4593r4594
276276      memory_set_bank(machine, 1, 2);
277277
278278      /* writes go to chipram */
279      memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, amiga_chip_ram_size - 1, 0, 0, amiga_ar23_chipmem_w);
279      memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x000000, amiga_chip_ram_size - 1, 0, 0, amiga_ar23_chipmem_w);
280280
281281      /* trigger NMI irq */
282      cpu_set_input_line(machine->cpu[0], 7, PULSE_LINE);
282      cputag_set_input_line(machine, "maincpu", 7, PULSE_LINE);
283283   }
284284}
285285
r4593r4594
334334static void amiga_ar23_check_overlay( running_machine *machine )
335335{
336336   amiga_ar23_mode = 3;
337   memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x00000f, 0, 0, amiga_ar23_chipmem_w);
337   memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x000000, 0x00000f, 0, 0, amiga_ar23_chipmem_w);
338338}
339339
340340static void amiga_ar23_init( running_machine *machine, int ar3 )
r4593r4594
361361   }
362362
363363   /* Install ROM */
364   memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x400000, 0x400000+size, 0, mirror, SMH_BANK2);
365   memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x400000, 0x400000+size, 0, mirror, SMH_ROM);
364   memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x400000, 0x400000+size, 0, mirror, SMH_BANK2);
365   memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x400000, 0x400000+size, 0, mirror, SMH_ROM);
366366
367367   /* Install RAM */
368   memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x440000, 0x44ffff, 0, 0, SMH_BANK3);
369   memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x440000, 0x44ffff, 0, 0, SMH_BANK3);
368   memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x440000, 0x44ffff, 0, 0, SMH_BANK3);
369   memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x440000, 0x44ffff, 0, 0, SMH_BANK3);
370370
371371   /* Install Custom chip monitor */
372//   memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xdff000, 0xdff1ff, 0, 0, amiga_ar23_custom_r);
373//   memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xdff000, 0xdff1ff, 0, 0, amiga_ar23_custom_w);
372//   memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xdff000, 0xdff1ff, 0, 0, amiga_ar23_custom_r);
373//   memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xdff000, 0xdff1ff, 0, 0, amiga_ar23_custom_w);
374374
375375   /* Install status/mode handlers */
376   memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x400000, 0x400007, 0, mirror, amiga_ar23_mode_r);
377   memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x400000, 0x400003, 0, mirror, amiga_ar23_mode_w);
376   memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x400000, 0x400007, 0, mirror, amiga_ar23_mode_r);
377   memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x400000, 0x400003, 0, mirror, amiga_ar23_mode_w);
378378
379379   /* Configure Banks */
380380   memory_set_bankptr(machine, 2, memory_region(machine, "user2"));
src/mess/machine/vtech1.c
r4593r4594
9393      case 22 * 1024:
9494      case 32 * 1024:
9595         /* install 16KB memory expansion */
96         memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), base, base + 0x3fff, 0, 0, SMH_BANK2);
97         memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), base, base + 0x3fff, 0, 0, SMH_BANK2);
96         memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), base, base + 0x3fff, 0, 0, SMH_BANK2);
97         memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), base, base + 0x3fff, 0, 0, SMH_BANK2);
9898         memory_configure_bank(machine, 2, 0, 1, mess_ram + base - 0x7800, 0);
9999         memory_set_bank(machine, 2, 0);
100100
101         memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), base + 0x4000, 0xffff, 0, 0, SMH_NOP);
102         memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), base + 0x4000, 0xffff, 0, 0, SMH_NOP);
101         memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), base + 0x4000, 0xffff, 0, 0, SMH_NOP);
102         memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), base + 0x4000, 0xffff, 0, 0, SMH_NOP);
103103         break;
104104
105105      case 66 * 1024:
r4593r4594
107107         /* 64KB/4MB memory expansion */
108108
109109         /* install fixed first bank */
110         memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0xbfff, 0, 0, SMH_BANK2);
111         memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0xbfff, 0, 0, SMH_BANK2);
110         memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x8000, 0xbfff, 0, 0, SMH_BANK2);
111         memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x8000, 0xbfff, 0, 0, SMH_BANK2);
112112         memory_configure_bank(machine, 2, 0, 1, mess_ram + 0x800, 0);
113113         memory_set_bank(machine, 2, 0);
114114
115115         /* install the others, dynamically banked in */
116         memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc000, 0xffff, 0, 0, SMH_BANK3);
117         memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc000, 0xffff, 0, 0, SMH_BANK3);
116         memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xc000, 0xffff, 0, 0, SMH_BANK3);
117         memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xc000, 0xffff, 0, 0, SMH_BANK3);
118118         memory_configure_bank(machine, 3, 0, (mess_ram_size - 0x4800) / 0x4000, mess_ram + 0x4800, 0x4000);
119119         memory_set_bank(machine, 3, 0);
120120         break;
121121
122122      default:
123123         /* no memory expansion */
124         memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), base, 0xffff, 0, 0, SMH_NOP);
125         memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), base, 0xffff, 0, 0, SMH_NOP);
124         memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), base, 0xffff, 0, 0, SMH_NOP);
125         memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), base, 0xffff, 0, 0, SMH_NOP);
126126         break;
127127   }
128128}
src/mess/machine/llc.c
r4593r4594
4747
4848static void llc1_ctc_interrupt(const device_config *device, int state)
4949{
50   cpu_set_input_line(device->machine->cpu[0], 0, state);
50   cputag_set_input_line(device->machine, "maincpu", 0, state);
5151}
5252
5353const z80ctc_interface llc1_ctc_intf =
r4593r4594
113113
114114MACHINE_RESET( llc2 )
115115{
116   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
116   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
117117   
118118   memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP);
119119   memory_set_bankptr(machine, 1, memory_region(machine, "maincpu"));
r4593r4594
131131
132132WRITE8_HANDLER( llc2_rom_disable_w )
133133{   
134   const address_space *mem_space = cpu_get_address_space(space->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
134   const address_space *mem_space = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
135135   
136136   memory_install_write8_handler(mem_space, 0x0000, 0xbfff, 0, 0, SMH_BANK1);
137137   memory_set_bankptr(space->machine, 1, mess_ram);
r4593r4594
150150WRITE8_HANDLER( llc2_basic_enable_w )
151151{
152152
153   const address_space *mem_space = cpu_get_address_space(space->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
153   const address_space *mem_space = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
154154   if (data & 0x02) {
155155      memory_install_write8_handler(mem_space, 0x4000, 0x5fff, 0, 0, SMH_UNMAP);
156156      memory_set_bankptr(space->machine, 2, memory_region(space->machine, "maincpu") + 0x10000);         
src/mess/machine/z1013.c
r4593r4594
2020
2121MACHINE_RESET( z1013 )
2222{
23   cpu_set_reg(machine->cpu[0], Z80_PC, 0xF000);
23   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_PC, 0xF000);
2424   z1013_keyboard_part = 0;
2525   z1013_keyboard_line = 0;
2626}
r4593r4594
6969   if (data[12]!='C') return INIT_FAIL;
7070   if (data[13]!=0xD3 || data[14]!=0xD3 || data[14]!=0xD3) return INIT_FAIL;
7171     
72   memcpy (memory_get_read_ptr(cpu_get_address_space(image->machine->cpu[0], ADDRESS_SPACE_PROGRAM),  startaddr ),
72   memcpy (memory_get_read_ptr(cputag_get_address_space(image->machine, "maincpu", ADDRESS_SPACE_PROGRAM),  startaddr ),
7373       data+0x20, endaddr - startaddr + 1);
7474
75   cpu_set_reg(image->machine->cpu[0], Z80_PC, runaddr);
75   cpu_set_reg(cputag_get_cpu(image->machine, "maincpu"), Z80_PC, runaddr);
7676
7777   return INIT_PASS;
7878}
src/mess/machine/trs80.c
r4593r4594
8686      {
8787         cassette_data = 0;
8888         trs80_int |= CASS_FALL;
89         cpu_set_input_line(machine->cpu[0], 0, HOLD_LINE);
89         cputag_set_input_line(machine, "maincpu", 0, HOLD_LINE);
9090      }
9191   }
9292   else
r4593r4594
9696      {
9797         cassette_data = 1;
9898         trs80_int |= CASS_RISE;
99         cpu_set_input_line(machine->cpu[0], 0, HOLD_LINE);
99         cputag_set_input_line(machine, "maincpu", 0, HOLD_LINE);
100100      }
101101   }
102102
r4593r4594
106106
107107QUICKLOAD_LOAD( trs80_cmd )
108108{
109   const address_space *space = cpu_get_address_space(image->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
109   const address_space *space = cputag_get_address_space(image->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
110110   UINT16 entry = 0, block_ofs = 0, block_len = 0;
111111   unsigned offs = 0;
112112   UINT8 *cmd_buff;
r4593r4594
164164         quickload_size--;
165165      }
166166   }
167   cpu_set_reg(image->machine->cpu[0], Z80_PC, entry);
167   cpu_set_reg(cputag_get_cpu(image->machine, "maincpu"), Z80_PC, entry);
168168
169169   free(cmd_buff);
170170   return INIT_PASS;
r4593r4594
262262   d1 Cass 1500 baud Falling
263263   d0 Cass 1500 baud Rising */
264264
265   cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE);
265   cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE);
266266   return ~(trs80_mask & trs80_int);
267267}
268268
r4593r4594
278278   d6 status of Motor Timeout (0=true)
279279   d5 status of Reset signal (0=true - this will reboot the computer) */
280280
281   cpu_set_input_line(space->machine->cpu[0], INPUT_LINE_NMI, CLEAR_LINE);
281   cputag_set_input_line(space->machine, "maincpu", INPUT_LINE_NMI, CLEAR_LINE);
282282
283283   return ~(trs80_nmi_mask & trs80_nmi_data);
284284}
r4593r4594
516516   d2 Mode Select (0=64 chars, 1=32chars)
517517   d1 Cassette Motor (1=On) */
518518
519   cpu_set_clock(space->machine->cpu[0], data & 0x40 ? MODEL4_MASTER_CLOCK/5 : MODEL4_MASTER_CLOCK/10);
519   cputag_set_clock(space->machine, "maincpu", data & 0x40 ? MODEL4_MASTER_CLOCK/5 : MODEL4_MASTER_CLOCK/10);
520520
521521   trs80_mode = (trs80_mode & 0xfe) | ((data & 4) ? 1 : 0);
522522
r4593r4594
675675      if (trs80_nmi_mask & 0x80)   // Model 4 does a NMI
676676      {
677677         trs80_nmi_data = 0x80;
678         cpu_set_input_line(machine->cpu[0], INPUT_LINE_NMI, PULSE_LINE);
678         cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE);
679679      }
680680   }
681681   else      // Model 1 does a IRQ
682682   {
683683      trs80_int |= IRQ_M1_FDC;
684      cpu_set_input_line(machine->cpu[0], 0, HOLD_LINE);
684      cputag_set_input_line(machine, "maincpu", 0, HOLD_LINE);
685685   }
686686}
687687
r4593r4594
770770   which is dealt with by the DOS. We take the opportunity to reset the cpu INT line. */
771771
772772   int result = trs80_int;
773   cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE);
773   cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE);
774774   trs80_int = 0;
775775   return result;
776776}
src/mess/machine/tandy1t.c
r4593r4594
193193      break;
194194   case 2:
195195      tandy_ppi.portc = data;
196      if (data&8) cpu_set_clockscale(space->machine->cpu[0], 1);
197      else cpu_set_clockscale(space->machine->cpu[0], 4.77/8);
196      if (data & 8)
197         cpu_set_clockscale(cputag_get_cpu(space->machine, "maincpu"), 1);
198      else
199         cpu_set_clockscale(cputag_get_cpu(space->machine, "maincpu"), 4.77/8);
198200      break;
199201   }
200202}
src/mess/machine/ti85.c
r4593r4594
114114   {
115115      if (ti85_ON_interrupt_mask && !ti85_ON_pressed)
116116      {
117         cpu_set_input_line(machine->cpu[0], 0, HOLD_LINE);
117         cputag_set_input_line(machine, "maincpu", 0, HOLD_LINE);
118118         ti85_ON_interrupt_status = 1;
119119         if (!ti85_timer_interrupt_mask) ti85_timer_interrupt_mask = 1;
120120      }
r4593r4594
125125      ti85_ON_pressed = 0;
126126   if (ti85_timer_interrupt_mask)
127127   {
128      cpu_set_input_line(machine->cpu[0], 0, HOLD_LINE);
128      cputag_set_input_line(machine, "maincpu", 0, HOLD_LINE);
129129      ti85_timer_interrupt_status = 1;
130130   }
131131}
r4593r4594
137137
138138static void update_ti86_memory (running_machine *machine)
139139{
140   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
140   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
141141   write8_space_func wh;
142142
143143   if (ti85_memory_page_0x4000 & 0x40)
r4593r4594
173173
174174MACHINE_START( ti81 )
175175{
176   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
176   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
177177   UINT8 *mem = memory_region(machine, "maincpu");
178178
179179   ti85_timer_interrupt_mask = 0;
r4593r4594
207207
208208MACHINE_START( ti85 )
209209{
210   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
210   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
211211   UINT8 *mem = memory_region(machine, "maincpu");
212212
213213   ti85_timer_interrupt_mask = 0;
r4593r4594
243243
244244MACHINE_START( ti86 )
245245{
246   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
246   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
247247   UINT8 *mem = memory_region(machine, "maincpu");
248248
249249   ti85_timer_interrupt_mask = 0;
r4593r4594
452452      if (file)
453453      {
454454         mame_fread(file, mem+0x8000, sizeof(unsigned char)*0x8000);
455         cpu_set_reg(machine->cpu[0], Z80_PC,0x0239);
455         cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_PC,0x0239);
456456      }
457457      else
458458         memset(mem+0x8000, 0, sizeof(unsigned char)*0x8000);
r4593r4594
470470      if (file)
471471      {
472472         mame_fread(file, mem+0x8000, sizeof(unsigned char)*0x8000);
473         cpu_set_reg(machine->cpu[0], Z80_PC,0x0b5f);
473         cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_PC,0x0b5f);
474474      }
475475      else
476476         memset(mem+0x8000, 0, sizeof(unsigned char)*0x8000);
r4593r4594
488488         if (file)
489489         {
490490            mame_fread(file, ti86_ram, sizeof(unsigned char)*128*1024);
491            cpu_set_reg(machine->cpu[0], Z80_PC,0x0c59);
491            cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_PC,0x0c59);
492492         }
493493         else
494494            memset(ti86_ram, 0, sizeof(unsigned char)*128*1024);
r4593r4594
507507   /* Set registers */
508508   lo = reg[0x00] & 0x0ff;
509509   hi = reg[0x01] & 0x0ff;
510   cpu_set_reg(machine->cpu[0], Z80_AF, (hi << 8) | lo);
510   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_AF, (hi << 8) | lo);
511511   lo = reg[0x04] & 0x0ff;
512512   hi = reg[0x05] & 0x0ff;
513   cpu_set_reg(machine->cpu[0], Z80_BC, (hi << 8) | lo);
513   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_BC, (hi << 8) | lo);
514514   lo = reg[0x08] & 0x0ff;
515515   hi = reg[0x09] & 0x0ff;
516   cpu_set_reg(machine->cpu[0], Z80_DE, (hi << 8) | lo);
516   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_DE, (hi << 8) | lo);
517517   lo = reg[0x0c] & 0x0ff;
518518   hi = reg[0x0d] & 0x0ff;
519   cpu_set_reg(machine->cpu[0], Z80_HL, (hi << 8) | lo);
519   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_HL, (hi << 8) | lo);
520520   lo = reg[0x10] & 0x0ff;
521521   hi = reg[0x11] & 0x0ff;
522   cpu_set_reg(machine->cpu[0], Z80_IX, (hi << 8) | lo);
522   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IX, (hi << 8) | lo);
523523   lo = reg[0x14] & 0x0ff;
524524   hi = reg[0x15] & 0x0ff;
525   cpu_set_reg(machine->cpu[0], Z80_IY, (hi << 8) | lo);
525   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IY, (hi << 8) | lo);
526526   lo = reg[0x18] & 0x0ff;
527527   hi = reg[0x19] & 0x0ff;
528   cpu_set_reg(machine->cpu[0], Z80_PC, (hi << 8) | lo);
528   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_PC, (hi << 8) | lo);
529529   lo = reg[0x1c] & 0x0ff;
530530   hi = reg[0x1d] & 0x0ff;
531   cpu_set_reg(machine->cpu[0], Z80_SP, (hi << 8) | lo);
531   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_SP, (hi << 8) | lo);
532532   lo = reg[0x20] & 0x0ff;
533533   hi = reg[0x21] & 0x0ff;
534   cpu_set_reg(machine->cpu[0], Z80_AF2, (hi << 8) | lo);
534   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_AF2, (hi << 8) | lo);
535535   lo = reg[0x24] & 0x0ff;
536536   hi = reg[0x25] & 0x0ff;
537   cpu_set_reg(machine->cpu[0], Z80_BC2, (hi << 8) | lo);
537   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_BC2, (hi << 8) | lo);
538538   lo = reg[0x28] & 0x0ff;
539539   hi = reg[0x29] & 0x0ff;
540   cpu_set_reg(machine->cpu[0], Z80_DE2, (hi << 8) | lo);
540   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_DE2, (hi << 8) | lo);
541541   lo = reg[0x2c] & 0x0ff;
542542   hi = reg[0x2d] & 0x0ff;
543   cpu_set_reg(machine->cpu[0], Z80_HL2, (hi << 8) | lo);
544   cpu_set_reg(machine->cpu[0], Z80_IFF1, reg[0x30]&0x0ff);
545   cpu_set_reg(machine->cpu[0], Z80_IFF2, reg[0x34]&0x0ff);
546   cpu_set_reg(machine->cpu[0], Z80_HALT, reg[0x38]&0x0ff);
547   cpu_set_reg(machine->cpu[0], Z80_IM, reg[0x3c]&0x0ff);
548   cpu_set_reg(machine->cpu[0], Z80_I, reg[0x40]&0x0ff);
543   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_HL2, (hi << 8) | lo);
544   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IFF1, reg[0x30]&0x0ff);
545   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IFF2, reg[0x34]&0x0ff);
546   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_HALT, reg[0x38]&0x0ff);
547   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IM, reg[0x3c]&0x0ff);
548   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_I, reg[0x40]&0x0ff);
549549
550   cpu_set_reg(machine->cpu[0], Z80_R, (reg[0x44]&0x7f) | (reg[0x48]&0x80));
550   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_R, (reg[0x44]&0x7f) | (reg[0x48]&0x80));
551551
552   cpu_set_input_line(machine->cpu[0], 0, 0);
553   cpu_set_input_line(machine->cpu[0], INPUT_LINE_NMI, 0);
554   cpu_set_input_line(machine->cpu[0], INPUT_LINE_HALT, 0);
552   cputag_set_input_line(machine, "maincpu", 0, 0);
553   cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, 0);
554   cputag_set_input_line(machine, "maincpu", INPUT_LINE_HALT, 0);
555555}
556556
557557static void ti85_setup_snapshot (running_machine *machine, UINT8 * data)
558558{
559   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
559   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
560560   int i;
561561   unsigned char lo,hi;
562562   unsigned char * hdw = data + 0x8000 + 0x94;
src/mess/machine/vtech2.c
r4593r4594
191191            write_handler = SMH_NOP;
192192         }
193193      }
194      memory_install_read8_handler(cpu_get_address_space(space->machine->cpu[0], ADDRESS_SPACE_PROGRAM), offset * 0x4000, offset * 0x4000 + 0x3fff, 0, 0, read_handler);
195      memory_install_write8_handler(cpu_get_address_space(space->machine->cpu[0], ADDRESS_SPACE_PROGRAM), offset * 0x4000, offset * 0x4000 + 0x3fff, 0, 0, write_handler);
194      memory_install_read8_handler(cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM), offset * 0x4000, offset * 0x4000 + 0x3fff, 0, 0, read_handler);
195      memory_install_write8_handler(cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM), offset * 0x4000, offset * 0x4000 + 0x3fff, 0, 0, write_handler);
196196    }
197197}
198198
src/mess/machine/wswan.c
r4593r4594
128128   0xea, 0xc0, 0xff, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
129129};
130130
131static void wswan_handle_irqs( running_machine *machine ) {
131static void wswan_handle_irqs( running_machine *machine )
132{
132133   if ( ws_portram[0xb2] & ws_portram[0xb6] & WSWAN_IFLAG_HBLTMR ) {
133      cpu_set_input_line_and_vector( machine->cpu[0], 0, HOLD_LINE, ws_portram[0xb0] + WSWAN_INT_HBLTMR );
134      cputag_set_input_line_and_vector( machine, "maincpu", 0, HOLD_LINE, ws_portram[0xb0] + WSWAN_INT_HBLTMR );
134135   } else if ( ws_portram[0xb2] & ws_portram[0xb6] & WSWAN_IFLAG_VBL ) {
135      cpu_set_input_line_and_vector( machine->cpu[0], 0, HOLD_LINE, ws_portram[0xb0] + WSWAN_INT_VBL );
136      cputag_set_input_line_and_vector( machine, "maincpu", 0, HOLD_LINE, ws_portram[0xb0] + WSWAN_INT_VBL );
136137   } else if ( ws_portram[0xb2] & ws_portram[0xb6] & WSWAN_IFLAG_VBLTMR ) {
137      cpu_set_input_line_and_vector( machine->cpu[0], 0, HOLD_LINE, ws_portram[0xb0] + WSWAN_INT_VBLTMR );
138      cputag_set_input_line_and_vector( machine, "maincpu", 0, HOLD_LINE, ws_portram[0xb0] + WSWAN_INT_VBLTMR );
138139   } else if ( ws_portram[0xb2] & ws_portram[0xb6] & WSWAN_IFLAG_LCMP ) {
139      cpu_set_input_line_and_vector( machine->cpu[0], 0, HOLD_LINE, ws_portram[0xb0] + WSWAN_INT_LCMP );
140      cputag_set_input_line_and_vector( machine, "maincpu", 0, HOLD_LINE, ws_portram[0xb0] + WSWAN_INT_LCMP );
140141   } else if ( ws_portram[0xb2] & ws_portram[0xb6] & WSWAN_IFLAG_SRX ) {
141      cpu_set_input_line_and_vector( machine->cpu[0], 0, HOLD_LINE, ws_portram[0xb0] + WSWAN_INT_SRX );
142      cputag_set_input_line_and_vector( machine, "maincpu", 0, HOLD_LINE, ws_portram[0xb0] + WSWAN_INT_SRX );
142143   } else if ( ws_portram[0xb2] & ws_portram[0xb6] & WSWAN_IFLAG_RTC ) {
143      cpu_set_input_line_and_vector( machine->cpu[0], 0, HOLD_LINE, ws_portram[0xb0] + WSWAN_INT_RTC );
144      cputag_set_input_line_and_vector( machine, "maincpu", 0, HOLD_LINE, ws_portram[0xb0] + WSWAN_INT_RTC );
144145   } else if ( ws_portram[0xb2] & ws_portram[0xb6] & WSWAN_IFLAG_KEY ) {
145      cpu_set_input_line_and_vector( machine->cpu[0], 0, HOLD_LINE, ws_portram[0xb0] + WSWAN_INT_KEY );
146      cputag_set_input_line_and_vector( machine, "maincpu", 0, HOLD_LINE, ws_portram[0xb0] + WSWAN_INT_KEY );
146147   } else if ( ws_portram[0xb2] & ws_portram[0xb6] & WSWAN_IFLAG_STX ) {
147      cpu_set_input_line_and_vector( machine->cpu[0], 0, HOLD_LINE, ws_portram[0xb0] + WSWAN_INT_STX );
148      cputag_set_input_line_and_vector( machine, "maincpu", 0, HOLD_LINE, ws_portram[0xb0] + WSWAN_INT_STX );
148149   } else {
149      cpu_set_input_line(machine->cpu[0], 0, CLEAR_LINE );
150      cputag_set_input_line(machine, "maincpu", 0, CLEAR_LINE );
150151   }
151152}
152153
153static void wswan_set_irq_line( running_machine *machine, int irq) {
154   if ( ws_portram[0xb2] & irq ) {
154static void wswan_set_irq_line( running_machine *machine, int irq)
155{
156   if ( ws_portram[0xb2] & irq )
157   {
155158      ws_portram[0xb6] |= irq;
156159      wswan_handle_irqs( machine );
157160   }
158161}
159162
160static void wswan_clear_irq_line( running_machine *machine, int irq) {
163static void wswan_clear_irq_line( running_machine *machine, int irq)
164{
161165   ws_portram[0xb6] &= ~irq;
162166   wswan_handle_irqs( machine );
163167}
r4593r4594
166170{
167171   /* A second passed */
168172   rtc.second = rtc.second + 1;
169   if ( ( rtc.second & 0x0F ) > 9 ) {
173   if ( ( rtc.second & 0x0F ) > 9 )
174   {
170175      rtc.second = ( rtc.second & 0xF0 ) + 0x10;
171176   }
172177
173178   /* Check for minute passed */
174   if ( rtc.second >= 0x60 ) {
179   if ( rtc.second >= 0x60 )
180   {
175181      rtc.second = 0;
176182      rtc.minute = rtc.minute + 1;
177      if ( ( rtc.minute & 0x0F ) > 9 ) {
183      if ( ( rtc.minute & 0x0F ) > 9 )
184      {
178185         rtc.minute = ( rtc.minute & 0xF0 ) + 0x10;
179186      }
180187   }
181188
182189   /* Check for hour passed */
183   if ( rtc.minute >= 0x60 ) {
190   if ( rtc.minute >= 0x60 )
191   {
184192      rtc.minute = 0;
185193      rtc.hour = rtc.hour + 1;
186      if ( ( rtc.hour & 0x0F ) > 9 ) {
194      if ( ( rtc.hour & 0x0F ) > 9 )
195      {
187196         rtc.hour = ( rtc.hour & 0xF0 ) + 0x10;
188197      }
189      if ( rtc.hour == 0x12 ) {
198      if ( rtc.hour == 0x12 )
199      {
190200         rtc.hour |= 0x80;
191201      }
192202   }
193203
194204   /* Check for day passed */
195   if ( rtc.hour >= 0x24 ) {
205   if ( rtc.hour >= 0x24 )
206   {
196207      rtc.hour = 0;
197208      rtc.day = rtc.day + 1;
198209   }
199210}
200211
201static void wswan_machine_stop( running_machine *machine ) {
202   if ( eeprom.size ) {
212static void wswan_machine_stop( running_machine *machine )
213{
214   if ( eeprom.size )
215   {
203216      image_battery_save( devtag_get_device(machine, "cart"), eeprom.data, eeprom.size );
204217   }
205218}
206219
207static void wswan_setup_bios( void ) {
208   if ( ws_bios_bank == NULL ) {
220static void wswan_setup_bios( void )
221{
222   if ( ws_bios_bank == NULL )
223   {
209224      ws_bios_bank = auto_malloc( 0x10000 );
210225      memcpy( ws_bios_bank + 0xffc0, ws_fake_bios_code, 0x40 );
211226   }
212227}
213228
214MACHINE_START( wswan ) {
229MACHINE_START( wswan )
230{
215231   ws_bios_bank = NULL;
216232   system_type = WSWAN;
217233   add_exit_callback( machine, wswan_machine_stop );
218234}
219235
220MACHINE_START( wscolor ) {
236MACHINE_START( wscolor )
237{
221238   ws_bios_bank = NULL;
222239   system_type = WSC;
223240   add_exit_callback( machine, wswan_machine_stop );
r4593r4594
225242
226243MACHINE_RESET( wswan )
227244{
228   const address_space *space = cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_PROGRAM );
245   const address_space *space = cputag_get_address_space( machine, "maincpu", ADDRESS_SPACE_PROGRAM );
229246
230247   wswan_setup_bios();
231248
r4593r4594
268285//   memory_set_bankptr( machine, 15, ROMMap[(ROMBanks - 1) & (ROMBanks - 1)] );
269286
270287   /* Set up RTC timer */
271   if ( rtc.present ) {
288   if ( rtc.present )
289   {
272290      timer_pulse(machine,  ATTOTIME_IN_SEC(1), NULL, 0, wswan_rtc_callback );
273291   }
274292
275293}
276294
277NVRAM_HANDLER( wswan ) {
278   if ( read_or_write ) {
295NVRAM_HANDLER( wswan )
296{
297   if ( read_or_write )
298   {
279299      /* Save the EEPROM data */
280300      mame_fwrite( file, internal_eeprom, INTERNAL_EEPROM_SIZE );
281   } else {
301   }
302   else
303   {
282304      /* Load the EEPROM data */
283      if ( file ) {
305      if ( file )
306      {
284307         mame_fread( file, internal_eeprom, INTERNAL_EEPROM_SIZE );
285      } else {
308      }
309      else
310      {
286311         /* Initialize the EEPROM data */
287312         memset( internal_eeprom, 0xFF, sizeof( internal_eeprom ) );
288313      }
r4593r4594
291316
292317READ8_HANDLER( wswan_sram_r )
293318{
294   if ( eeprom.data == NULL ) {
319   if ( eeprom.data == NULL )
320   {
295321      return 0xFF;
296322   }
297323   return eeprom.page[ offset & ( eeprom.size - 1 ) ];
r4593r4594
299325
300326WRITE8_HANDLER( wswan_sram_w )
301327{
302   if ( eeprom.data == NULL ) {
328   if ( eeprom.data == NULL )
329   {
303330      return;
304331   }
305332   eeprom.page[ offset & ( eeprom.size - 1 ) ] = data;
r4593r4594
339366               /* Bit 1 - Determine mono/color */
340367               /* Bit 2 - Determine color/crystal */
341368         value = value & ~ 0x02;
342         if ( system_type == WSC ) {
369         if ( system_type == WSC )
370         {
343371            value |= 2;
344372         }
345373         break;
r4593r4594
356384         value = wswan_vdp.timer_vblank_count >> 8;
357385         break;
358386      case 0xCB:      /* RTC data */
359         if ( ws_portram[0xca] == 0x95 && ( rtc.index < 7 ) ) {
360            switch( rtc.index ) {
387         if ( ws_portram[0xca] == 0x95 && ( rtc.index < 7 ) )
388         {
389            switch( rtc.index )
390            {
361391            case 0: value = rtc.year; break;
362392            case 1: value = rtc.month; break;
363393            case 2: value = rtc.day; break;
r4593r4594
523553               Bit 0-3 - Gray tone setting for main palette index 0
524554               Bit 4-7 - Gray tone setting for main palette index 1
525555            */
526         if ( system_type == WSC ) {
556         if ( system_type == WSC )
557         {
527558            int i = 15 - ( data & 0x0F );
528559            int j = 15 - ( ( data & 0xF0 ) >> 4 );
529560            wswan_vdp.main_palette[0] = ( i << 8 ) | ( i << 4 ) | i;
530561            wswan_vdp.main_palette[1] = ( j << 8 ) | ( j << 4 ) | j;
531         } else {
562         }
563         else
564         {
532565            wswan_vdp.main_palette[0] = data & 0x0F;
533566            wswan_vdp.main_palette[1] = ( data & 0xF0 ) >> 4;
534567         }
r4593r4594
537570               Bit 0-3 - Gray tone setting for main palette index 2
538571               Bit 4-7 - Gray tone setting for main palette index 3
539572            */
540         if ( system_type == WSC ) {
573         if ( system_type == WSC )
574         {
541575            int i = 15 - ( data & 0x0F );
542576            int j = 15 - ( ( data & 0xF0 ) >> 4 );
543577            wswan_vdp.main_palette[2] = ( i << 8 ) | ( i << 4 ) | i;
544578            wswan_vdp.main_palette[3] = ( j << 8 ) | ( j << 4 ) | j;
545         } else {
579         }
580         else
581         {
546582            wswan_vdp.main_palette[2] = data & 0x0F;
547583            wswan_vdp.main_palette[3] = ( data & 0xF0 ) >> 4;
548584         }
r4593r4594
551587               Bit 0-3 - Gray tone setting for main palette index 4
552588               Bit 4-7 - Gray tone setting for main paeltte index 5
553589            */
554         if ( system_type == WSC ) {
590         if ( system_type == WSC )
591         {
555592            int i = 15 - ( data & 0x0F );
556593            int j = 15 - ( ( data & 0xF0 ) >> 4 );
557594            wswan_vdp.main_palette[4] = ( i << 8 ) | ( i << 4 ) | i;
558595            wswan_vdp.main_palette[5] = ( j << 8 ) | ( j << 4 ) | j;
559         } else {
596         }
597         else
598         {
560599            wswan_vdp.main_palette[4] = data & 0x0F;
561600            wswan_vdp.main_palette[5] = ( data & 0xF0 ) >> 4;
562601         }
r4593r4594
565604               Bit 0-3 - Gray tone setting for main palette index 6
566605               Bit 4-7 - Gray tone setting for main palette index 7
567606            */
568         if ( system_type == WSC ) {
607         if ( system_type == WSC )
608         {
569609            int i = 15 - ( data & 0x0F );
570610            int j = 15 - ( ( data & 0xF0 ) >> 4 );
571611            wswan_vdp.main_palette[6] = ( i << 8 ) | ( i << 4 ) | i;
572612            wswan_vdp.main_palette[7] = ( j << 8 ) | ( j << 4 ) | j;
573         } else {
613         }
614         else
615         {
574616            wswan_vdp.main_palette[6] = data & 0x0F;
575617            wswan_vdp.main_palette[7] = ( data & 0xF0 ) >> 4;
576618         }
r4593r4594
678720            src = ws_portram[0x40] + (ws_portram[0x41] << 8) + (ws_portram[0x42] << 16);
679721            dst = ws_portram[0x44] + (ws_portram[0x45] << 8) + (ws_portram[0x43] << 16);
680722            length = ws_portram[0x46] + (ws_portram[0x47] << 8);
681            for( ; length > 0; length-- ) {
723            for( ; length > 0; length-- )
724            {
682725               memory_write_byte(space,  dst, memory_read_byte(space,  src ) );
683726               src++;
684727               dst++;
r4593r4594
748791          * 001   - packed, 4 color, use 2000, monochrome
749792          * 000  - not packed, 4 color, use 2000, monochrome - Regular WS monochrome
750793          */
751         if ( system_type == WSC ) {
794         if ( system_type == WSC )
795         {
752796            wswan_vdp.color_mode = data & 0x80;
753797            wswan_vdp.colors_16 = data & 0x40;
754798            wswan_vdp.tile_packed = data & 0x20;
r4593r4594
844888               Bit 1   - Hardware type: 0 = WS, 1 = WSC
845889               Bit 2-7 - Unknown
846890            */
847         if ( ( data & 0x01 ) && !wswan_bios_disabled ) {
891         if ( ( data & 0x01 ) && !wswan_bios_disabled )
892         {
848893            wswan_bios_disabled = 1;
849894            memory_set_bankptr( space->machine, 15, ROMMap[ ( ( ( ws_portram[0xc0] & 0x0F ) << 4 ) | 15 ) & ( ROMBanks - 1 ) ] );
850895         }
r4593r4594
933978            */
934979//         data |= 0x02;
935980         ws_portram[0xb1] = 0xFF;
936         if ( data & 0x80 ) {
981         if ( data & 0x80 )
982         {
937983//            ws_portram[0xb1] = 0x00;
938984            data |= 0x04;
939985         }
940         if (data & 0x20 ) {
986         if (data & 0x20 )
987         {
941988//            data |= 0x01;
942989         }
943990         break;
r4593r4594
10011048               Bit 6   - Protect
10021049               Bit 7   - Initialize
10031050            */
1004         if ( data & 0x20 ) {
1051         if ( data & 0x20 )
1052         {
10051053            UINT16 addr = ( ( ( ws_portram[0xbd] << 8 ) | ws_portram[0xbc] ) << 1 ) & 0x1FF;
10061054            internal_eeprom[ addr ] = ws_portram[0xba];
10071055            internal_eeprom[ addr + 1 ] = ws_portram[0xbb];
10081056            data |= 0x02;
1009         } else if ( data & 0x10 ) {
1057         }
1058         else if ( data & 0x10 )
1059         {
10101060            UINT16 addr = ( ( ( ws_portram[0xbd] << 8 ) | ws_portram[0xbc] ) << 1 ) & 0x1FF;
10111061            ws_portram[0xba] = internal_eeprom[ addr ];
10121062            ws_portram[0xbb] = internal_eeprom[ addr + 1];
10131063            data |= 0x01;
1014         } else {
1064         }
1065         else
1066         {
10151067            logerror( "Unsupported internal EEPROM command: %X\n", data );
10161068         }
10171069         break;
r4593r4594
10301082         memory_set_bankptr( space->machine, 12, ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 12 ) & ( ROMBanks - 1 ) ] );
10311083         memory_set_bankptr( space->machine, 13, ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 13 ) & ( ROMBanks - 1 ) ] );
10321084         memory_set_bankptr( space->machine, 14, ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 14 ) & ( ROMBanks - 1 ) ] );
1033         if ( wswan_bios_disabled ) {
1085         if ( wswan_bios_disabled )
1086         {
10341087            memory_set_bankptr( space->machine, 15, ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 15 ) & ( ROMBanks - 1 ) ] );
10351088         }
10361089         break;
10371090      case 0xc1:   /* SRAM bank select
10381091               Bit 0-7 - SRAM bank to select
10391092            */
1040         if ( eeprom.mode == SRAM_64K || eeprom.mode == SRAM_256K || eeprom.mode == SRAM_512K || eeprom.mode == SRAM_1M || eeprom.mode == SRAM_2M ) {
1093         if ( eeprom.mode == SRAM_64K || eeprom.mode == SRAM_256K || eeprom.mode == SRAM_512K || eeprom.mode == SRAM_1M || eeprom.mode == SRAM_2M )
1094         {
10411095            eeprom.page = &eeprom.data[ ( data * 64 * 1024 ) & ( eeprom.size - 1 ) ];
10421096         }
10431097         break;
r4593r4594
10661120               16KBit EEPROM:
10671121               Bit 0-7 - EEPROM address bit 1-8
10681122            */
1069         switch( eeprom.mode ) {
1123         switch( eeprom.mode )
1124         {
10701125         case EEPROM_1K:
10711126            eeprom.address = data & 0x3F;
10721127            eeprom.command = data >> 4;
1073            if ( ( eeprom.command & 0x0C ) != 0x00 ) {
1128            if ( ( eeprom.command & 0x0C ) != 0x00 )
1129            {
10741130               eeprom.command = eeprom.command & 0x0C;
10751131            }
10761132            break;
r4593r4594
11001156               Bit 4   - Start
11011157               Bit 5-7 - Unknown
11021158            */
1103         switch( eeprom.mode ) {
1159         switch( eeprom.mode )
1160         {
11041161         case EEPROM_1K:
11051162            eeprom.start = data & 0x01;
11061163            break;
11071164         case EEPROM_16K:
11081165            eeprom.address = ( ( data & 0x03 ) << 8 ) | ( eeprom.address & 0xFF );
11091166            eeprom.command = data & 0x0F;
1110            if ( ( eeprom.command & 0x0C ) != 0x00 ) {
1167            if ( ( eeprom.command & 0x0C ) != 0x00 )
1168            {
11111169               eeprom.command = eeprom.command & 0x0C;
11121170            }
11131171            eeprom.start = ( data >> 4 ) & 0x01;
r4593r4594
11261184               Bit 6   - Protect
11271185               Bit 7   - Initialize
11281186            */
1129         if ( eeprom.mode == EEPROM_1K || eeprom.mode == EEPROM_16K ) {
1130            if ( data & 0x80 ) {   /* Initialize */
1187         if ( eeprom.mode == EEPROM_1K || eeprom.mode == EEPROM_16K )
1188         {
1189            if ( data & 0x80 )
1190            {   /* Initialize */
11311191               logerror( "Unsupported EEPROM command 'Initialize'\n" );
11321192            }
1133            if ( data & 0x40 ) {   /* Protect */
1134               switch( eeprom.command ) {
1193            if ( data & 0x40 )
1194            {   /* Protect */
1195               switch( eeprom.command )
1196               {
11351197               case 0x00:
11361198                  eeprom.write_enabled = 0;
11371199                  data |= 0x02;
r4593r4594
11441206                  logerror( "Unsupported 'Protect' command %X\n", eeprom.command );
11451207               }
11461208            }
1147            if ( data & 0x20 ) {   /* Write */
1148               if ( eeprom.write_enabled ) {
1149                  switch( eeprom.command ) {
1209            if ( data & 0x20 )
1210            {   /* Write */
1211               if ( eeprom.write_enabled )
1212               {
1213                  switch( eeprom.command )
1214                  {
11501215                  case 0x04:
11511216                     eeprom.data[ ( eeprom.address << 1 ) + 1 ] = ws_portram[0xc4];
11521217                     eeprom.data[ eeprom.address << 1 ] = ws_portram[0xc5];
r4593r4594
11571222                  }
11581223               }
11591224            }
1160            if ( data & 0x10 ) {   /* Read */
1225            if ( data & 0x10 )
1226            {   /* Read */
11611227               ws_portram[0xc4] = eeprom.data[ ( eeprom.address << 1 ) + 1 ];
11621228               ws_portram[0xc5] = eeprom.data[ eeprom.address << 1 ];
11631229               data |= 0x01;
11641230            }
1165         } else {
1231         }
1232         else
1233         {
11661234            logerror( "EEPROM command for unknown EEPROM type\n" );
11671235         }
11681236         break;
r4593r4594
11761244               Bit 5-6 - Unknown
11771245               Bit 7   - Command done (read only)
11781246            */
1179         switch( data ) {
1247         switch( data )
1248         {
11801249         case 0x10:   /* Reset */
11811250            rtc.index = 8;
11821251            rtc.year = 0;
r4593r4594
12141283         }
12151284         break;
12161285      case 0xcb:   /* RTC Data */
1217         if ( ws_portram[0xca] == 0x94 && rtc.index < 7 ) {
1218            switch( rtc.index ) {
1286         if ( ws_portram[0xca] == 0x94 && rtc.index < 7 )
1287         {
1288            switch( rtc.index )
1289            {
12191290            case 0:   rtc.year = data; break;
12201291            case 1: rtc.month = data; break;
12211292            case 2: rtc.day = data; break;
r4593r4594
12361307   ws_portram[offset] = data;
12371308}
12381309
1239static const char* wswan_determine_sram( UINT8 data ) {
1310static const char* wswan_determine_sram( UINT8 data )
1311{
12401312   eeprom.write_enabled = 0;
12411313   eeprom.mode = SRAM_UNKNOWN;
1242   switch( data ) {
1314   switch( data )
1315   {
12431316   case 0x00: eeprom.mode = SRAM_NONE; break;
12441317   case 0x01: eeprom.mode = SRAM_64K; break;
12451318   case 0x02: eeprom.mode = SRAM_256K; break;
r4593r4594
12601333   "4Mbit", "8Mbit", "16Mbit", "32Mbit", "64Mbit", "128Mbit", "Unknown"
12611334};
12621335
1263static const char* wswan_determine_romsize( UINT8 data ) {
1264   switch( data ) {
1336static const char* wswan_determine_romsize( UINT8 data )
1337{
1338   switch( data )
1339   {
12651340   case 0x02:   return wswan_romsize_str[ ROM_4M ];
12661341   case 0x03:   return wswan_romsize_str[ ROM_8M ];
12671342   case 0x04:   return wswan_romsize_str[ ROM_16M ];
r4593r4594
12981373   UINT32 ii;
12991374   const char *sram_str;
13001375
1301   ws_ram = memory_get_read_ptr( cpu_get_address_space( image->machine->cpu[0], ADDRESS_SPACE_PROGRAM ), 0 );
1376   ws_ram = memory_get_read_ptr( cputag_get_address_space( image->machine, "maincpu", ADDRESS_SPACE_PROGRAM ), 0 );
13021377   memset( ws_ram, 0, 0xFFFF );
13031378   ROMBanks = image_length( image ) / 65536;
13041379
r4593r4594
13351410      mame_printf_debug( "\tSRAM size: %s\n", sram_str );
13361411      mame_printf_debug( "\tFeatures: %X\n", ROMMap[ROMBanks-1][0xfffc] );
13371412      mame_printf_debug( "\tRTC: %s\n", ( ROMMap[ROMBanks-1][0xfffd] ? "yes" : "no" ) );
1338      for( ii = 0; ii < ROMBanks; ii++ ) {
1413      for( ii = 0; ii < ROMBanks; ii++ )
1414      {
13391415         int count;
1340         for( count = 0; count < 0x10000; count++ ) {
1416         for( count = 0; count < 0x10000; count++ )
1417         {
13411418            sum += ROMMap[ii][count];
13421419         }
13431420      }
r4593r4594
13481425   }
13491426#endif
13501427
1351   if ( eeprom.size != 0 ) {
1428   if ( eeprom.size != 0 )
1429   {
13521430      eeprom.data = auto_malloc( eeprom.size );
13531431      image_battery_load( image, eeprom.data, eeprom.size );
13541432      eeprom.page = eeprom.data;
r4593r4594
13641442
13651443static TIMER_CALLBACK(wswan_scanline_interrupt)
13661444{
1367   if( wswan_vdp.current_line < 144 ) {
1445   if( wswan_vdp.current_line < 144 )
1446   {
13681447      wswan_refresh_scanline();
13691448   }
13701449
13711450   /* Decrement 12kHz (HBlank) counter */
1372   if ( wswan_vdp.timer_hblank_enable && wswan_vdp.timer_hblank_reload != 0 ) {
1451   if ( wswan_vdp.timer_hblank_enable && wswan_vdp.timer_hblank_reload != 0 )
1452   {
13731453      wswan_vdp.timer_hblank_count--;
13741454      logerror( "timer_hblank_count: %X\n", wswan_vdp.timer_hblank_count );
1375      if ( wswan_vdp.timer_hblank_count == 0 ) {
1376         if ( wswan_vdp.timer_hblank_mode ) {
1455      if ( wswan_vdp.timer_hblank_count == 0 )
1456      {
1457         if ( wswan_vdp.timer_hblank_mode )
1458         {
13771459            wswan_vdp.timer_hblank_count = wswan_vdp.timer_hblank_reload;
1378         } else {
1460         }
1461         else
1462         {
13791463            wswan_vdp.timer_hblank_reload = 0;
13801464         }
13811465         logerror( "trigerring hbltmr interrupt\n" );
r4593r4594
13841468   }
13851469
13861470   /* Handle Sound DMA */
1387   if ( ( sound_dma.enable & 0x88 ) == 0x80 ) {
1388      const address_space *space = cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_PROGRAM );
1471   if ( ( sound_dma.enable & 0x88 ) == 0x80 )
1472   {
1473      const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM );
13891474      /* TODO: Output sound DMA byte */
13901475      wswan_port_w( space, 0x89, memory_read_byte(space,  sound_dma.source ) );
13911476      sound_dma.size--;
13921477      sound_dma.source = ( sound_dma.source + 1 ) & 0x0FFFFF;
1393      if ( sound_dma.size == 0 ) {
1478      if ( sound_dma.size == 0 )
1479      {
13941480         sound_dma.enable &= 0x7F;
13951481      }
13961482   }
13971483
13981484//   wswan_vdp.current_line = (wswan_vdp.current_line + 1) % 159;
13991485
1400   if( wswan_vdp.current_line == 144 ) {
1486   if( wswan_vdp.current_line == 144 )
1487   {
14011488      wswan_set_irq_line( machine, WSWAN_IFLAG_VBL );
14021489      /* Decrement 75Hz (VBlank) counter */
1403      if ( wswan_vdp.timer_vblank_enable && wswan_vdp.timer_vblank_reload != 0 ) {
1490      if ( wswan_vdp.timer_vblank_enable && wswan_vdp.timer_vblank_reload != 0 )
1491      {
14041492         wswan_vdp.timer_vblank_count--;
14051493         logerror( "timer_vblank_count: %X\n", wswan_vdp.timer_vblank_count );
1406         if ( wswan_vdp.timer_vblank_count == 0 ) {
1407            if ( wswan_vdp.timer_vblank_mode ) {
1494         if ( wswan_vdp.timer_vblank_count == 0 )
1495         {
1496            if ( wswan_vdp.timer_vblank_mode )
1497            {
14081498               wswan_vdp.timer_vblank_count = wswan_vdp.timer_vblank_reload;
1409            } else {
1499            }
1500            else
1501            {
14101502               wswan_vdp.timer_vblank_reload = 0;
14111503            }
14121504            logerror( "triggering vbltmr interrupt\n" );
r4593r4594
14171509
14181510//   wswan_vdp.current_line = (wswan_vdp.current_line + 1) % 159;
14191511
1420   if ( wswan_vdp.current_line == wswan_vdp.line_compare ) {
1512   if ( wswan_vdp.current_line == wswan_vdp.line_compare )
1513   {
14211514      wswan_set_irq_line( machine, WSWAN_IFLAG_LCMP );
14221515   }
14231516
14241517   wswan_vdp.current_line = (wswan_vdp.current_line + 1) % 159;
14251518
1426   if ( wswan_vdp.current_line == 0 ) {
1427      if ( wswan_vdp.display_vertical != wswan_vdp.new_display_vertical ) {
1519   if ( wswan_vdp.current_line == 0 )
1520   {
1521      if ( wswan_vdp.display_vertical != wswan_vdp.new_display_vertical )
1522      {
14281523         wswan_vdp.display_vertical = wswan_vdp.new_display_vertical;
1429         if ( wswan_vdp.display_vertical ) {
1524         if ( wswan_vdp.display_vertical )
1525         {
14301526            video_screen_set_visarea( machine->primary_screen, 5*8, 5*8 + WSWAN_Y_PIXELS - 1, 0, WSWAN_X_PIXELS - 1 );
1431         } else {
1527         }
1528         else
1529         {
14321530            video_screen_set_visarea( machine->primary_screen, 0, WSWAN_X_PIXELS - 1, 5*8, 5*8 + WSWAN_Y_PIXELS - 1 );
14331531         }
14341532      }
src/mess/machine/cbm.c
r4593r4594
2121   UINT32 bytesread;
2222   UINT16 address = 0;
2323   int i;
24   const address_space *space = cpu_get_address_space(image->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
24   const address_space *space = cputag_get_address_space(image->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
2525
2626   if (!file_type)
2727      goto error;
r4593r4594
8484
8585static void cbm_quick_sethiaddress(running_machine *machine, UINT16 hiaddress)
8686{
87   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
87   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
8888
8989   memory_write_byte(space, 0x31, hiaddress & 0xff);
9090   memory_write_byte(space, 0x2f, hiaddress & 0xff);
r4593r4594
111111
112112static void cbm_pet_quick_sethiaddress(running_machine *machine, UINT16 hiaddress)
113113{
114   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
114   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
115115
116116   memory_write_byte(space, 0x2e, hiaddress & 0xff);
117117   memory_write_byte(space, 0x2c, hiaddress & 0xff);
r4593r4594
128128
129129static void cbm_pet1_quick_sethiaddress(running_machine *machine, UINT16 hiaddress)
130130{
131   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
131   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
132132
133133   memory_write_byte(space, 0x80, hiaddress & 0xff);
134134   memory_write_byte(space, 0x7e, hiaddress & 0xff);
r4593r4594
145145
146146static void cbmb_quick_sethiaddress(running_machine *machine, UINT16 hiaddress)
147147{
148   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
148   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
149149
150150   memory_write_byte(space, 0xf0046, hiaddress & 0xff);
151151   memory_write_byte(space, 0xf0047, hiaddress >> 8);
r4593r4594
163163
164164static void cbm_c65_quick_sethiaddress(running_machine *machine, UINT16 hiaddress)
165165{
166   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
166   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
167167
168168   memory_write_byte(space, 0x82, hiaddress & 0xff);
169169   memory_write_byte(space, 0x83, hiaddress >> 8);
src/mess/machine/zx.c
r4593r4594
4949
5050DRIVER_INIT ( zx )
5151{
52   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
52   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
5353
5454   memory_install_readwrite8_handler(space, 0x4000, 0x4000 + mess_ram_size - 1, 0, 0, SMH_BANK1, zx_ram_w);
5555   memory_set_bankptr(machine, 1, memory_region(machine, "maincpu") + 0x4000);
r4593r4594
7878
7979MACHINE_RESET ( zx80 )
8080{
81   memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), zx_setdirect);
81   memory_set_direct_update_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), zx_setdirect);
8282   zx_tape_bit = 0x80;
8383}
8484
8585MACHINE_RESET ( pow3000 )
8686{
87   memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), pow3000_setdirect);
87   memory_set_direct_update_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), pow3000_setdirect);
8888   zx_tape_bit = 0x80;
8989}
9090
9191MACHINE_RESET ( pc8300 )
9292{
93   memory_set_direct_update_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), pc8300_setdirect);
93   memory_set_direct_update_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), pc8300_setdirect);
9494   zx_tape_bit = 0x80;
9595}
9696
r4593r4594
410410   else
411411   if (offs == 0xfe)
412412   {
413      timer_adjust_periodic(ula_nmi, attotime_zero, 0, cpu_clocks_to_attotime(space->machine->cpu[0], 207));
413      timer_adjust_periodic(ula_nmi, attotime_zero, 0, cputag_clocks_to_attotime(space->machine, "maincpu", 207));
414414
415415      LOG_ZX81_IOW("ULA NMIs on");
416416
src/mess/machine/z80ne.c
r4593r4594
182182   if (!nmi_delay_counter)
183183   {
184184      memory_set_direct_update_handler( space, NULL );
185      cpu_set_input_line(space->machine->cpu[0], INPUT_LINE_NMI, PULSE_LINE);
185      cputag_set_input_line(space->machine, "z80ne", INPUT_LINE_NMI, PULSE_LINE);
186186   }
187187   return address;
188188}
r4593r4594
287287   {
288288      running_machine *machine = field->port->machine;
289289      //MACHINE_RESET_CALL(z80ne);
290      //device_reset(machine->cpu[0]);
290      //device_reset(cputag_get_cpu(machine, "z80ne"));
291291      mame_schedule_soft_reset(machine);
292292   }
293293}
r4593r4594
299299
300300   if ( ! BIT(nmi, 0))
301301   {
302      cpu_set_input_line(field->port->machine->cpu[0], INPUT_LINE_NMI, PULSE_LINE);
302      cputag_set_input_line(field->port->machine, "z80ne", INPUT_LINE_NMI, PULSE_LINE);
303303   }
304304}
305305
r4593r4594
385385    else
386386       /* after writing to port 0xF8 and the first ~M1 cycles strike a NMI for single step execution */
387387       nmi_delay_counter = 1;
388       memory_set_direct_update_handler(cpu_get_address_space(space->machine->cpu[0], ADDRESS_SPACE_PROGRAM),nmi_delay_count);
388       memory_set_direct_update_handler(cputag_get_address_space(space->machine, "z80ne", ADDRESS_SPACE_PROGRAM),nmi_delay_count);
389389}
390390
391391
src/mess/machine/amigacd.c
r4593r4594
8282      return;
8383
8484   /* otherwise, generate the IRQ */
85   amiga_custom_w(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), REG_INTREQ, 0x8000 | INTENA_PORTS, 0xffff);
85   amiga_custom_w(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), REG_INTREQ, 0x8000 | INTENA_PORTS, 0xffff);
8686}
8787
8888static TIMER_CALLBACK(dmac_dma_proc)
r4593r4594
388388
389389static void   dmac_install(running_machine *machine, offs_t base)
390390{
391   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
391   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
392392   memory_install_read16_handler(space, base, base + 0xFFFF, 0, 0, amiga_dmac_r);
393393   memory_install_write16_handler(space, base, base + 0xFFFF, 0, 0, amiga_dmac_w);
394394}
395395
396396static void   dmac_uninstall(running_machine *machine, offs_t base)
397397{
398   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
398   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
399399   memory_install_read16_handler(space, base, base + 0xFFFF, 0, 0, SMH_UNMAP);
400400   memory_install_write16_handler(space, base, base + 0xFFFF, 0, 0, SMH_UNMAP);
401401}
r4593r4594
456456
457457   if ( (CUSTOM_REG(REG_INTREQ) & INTENA_PORTS) == 0 )
458458   {
459      amiga_custom_w(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), REG_INTREQ, 0x8000 | INTENA_PORTS, 0xffff);
459      amiga_custom_w(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), REG_INTREQ, 0x8000 | INTENA_PORTS, 0xffff);
460460   }
461461   else
462462   {
r4593r4594
472472   {
473473      if ( (CUSTOM_REG(REG_INTREQ) & INTENA_PORTS) == 0 )
474474      {
475         amiga_custom_w(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM), REG_INTREQ, 0x8000 | INTENA_PORTS, 0xffff);
475         amiga_custom_w(cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM), REG_INTREQ, 0x8000 | INTENA_PORTS, 0xffff);
476476      }
477477      else
478478      {
src/mess/machine/990_tap.c
r4593r4594
358358      /* DMA */
359359      for (i=0; i<bytes_read; i+=2)
360360      {
361         memory_write_word_16be(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM),dma_address, (((int) buffer[i]) << 8) | buffer[i+1]);
361         memory_write_word_16be(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM),dma_address, (((int) buffer[i]) << 8) | buffer[i+1]);
362362         dma_address = (dma_address + 2) & 0x1ffffe;
363363      }
364364
src/mess/machine/vectrex.c
r4593r4594
220220
221221void v_via_irq(const device_config *device, int level)
222222{
223   cpu_set_input_line(device->machine->cpu[0], M6809_IRQ_LINE, level);
223   cputag_set_input_line(device->machine, "maincpu", M6809_IRQ_LINE, level);
224224}
225225
226226
src/mess/machine/geneve.c
r4593r4594
133133};
134134
135135/* tms9995_ICount: used to implement memory waitstates (hack) */
136/* NPW 23-Feb-2004 - externs no longer needed because we now use cpu_adjust_icount(space->machine->cpu[0],) */
136/* NPW 23-Feb-2004 - externs no longer needed because we now use cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),) */
137137
138138
139139
r4593r4594
291291static void inta_callback(running_machine *machine, int state)
292292{
293293   tms9901_set_single_int(devtag_get_device(machine, "tms9901"), 1, state);
294   cpu_set_input_line(machine->cpu[0], 1, state ? ASSERT_LINE : CLEAR_LINE);
294   cputag_set_input_line(machine, "maincpu", 1, state ? ASSERT_LINE : CLEAR_LINE);
295295}
296296
297297/*
r4593r4594
317317*/
318318static  READ8_HANDLER ( geneve_speech_r )
319319{
320   cpu_adjust_icount(space->machine->cpu[0],-8);      /* this is just a minimum, it can be more */
320   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-8);      /* this is just a minimum, it can be more */
321321
322322   return tms5220_status_r(devtag_get_device(space->machine, "tms5220"), offset);
323323}
r4593r4594
343343*/
344344static WRITE8_HANDLER ( geneve_speech_w )
345345{
346   cpu_adjust_icount(space->machine->cpu[0],-32*4);      /* this is just an approx. minimum, it can be much more */
346   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-32*4);      /* this is just an approx. minimum, it can be much more */
347347
348348#if 1
349349   /* the stupid design of the tms5220 core means that ready is cleared when
r4593r4594
353353   if (! tms5220_ready_r(devtag_get_device(space->machine, "tms5220")))
354354   {
355355      attotime time_to_ready = double_to_attotime(tms5220_time_to_ready(devtag_get_device(space->machine, "tms5220")));
356      int cycles_to_ready = ceil(cpu_attotime_to_clocks(space->machine->cpu[0], time_to_ready));
356      int cycles_to_ready = ceil(cputag_attotime_to_clocks(space->machine, "maincpu", time_to_ready));
357357
358358      logerror("time to ready: %f -> %d\n", attotime_to_double(time_to_ready), (int) cycles_to_ready);
359359
360      cpu_adjust_icount(space->machine->cpu[0],-cycles_to_ready);
360      cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-cycles_to_ready);
361361      timer_set(space->machine, attotime_zero, NULL, 0, /*speech_kludge_callback*/NULL);
362362   }
363363#endif
r4593r4594
12901290static TMS9901_INT_CALLBACK( tms9901_interrupt_callback )
12911291{
12921292   /* INTREQ is connected to INT1 (IC0-3 are not connected) */
1293   cpu_set_input_line(device->machine->cpu[0], 0, intreq ? ASSERT_LINE : CLEAR_LINE);
1293   cputag_set_input_line(device->machine, "maincpu", 0, intreq ? ASSERT_LINE : CLEAR_LINE);
12941294}
12951295
12961296/*
src/mess/machine/vc20.c
r4593r4594
7575*/
7676static void vc20_via0_irq (const device_config *device, int level)
7777{
78   cpu_set_input_line(device->machine->cpu[0], INPUT_LINE_NMI, level);
78   cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_NMI, level);
7979}
8080
8181static READ8_DEVICE_HANDLER( vc20_via0_read_ca1 )
r4593r4594
149149 */
150150static void vc20_via1_irq (const device_config *device, int level)
151151{
152   cpu_set_input_line(device->machine->cpu[0], M6502_IRQ_LINE, level);
152   cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, level);
153153}
154154
155155static READ8_DEVICE_HANDLER( vc20_via1_read_porta )
src/mess/machine/c64.c
r4593r4594
119119         if (1) // this was never valid, there is no active CPU during a timer firing!  cpu_getactivecpu() == 0)
120120         {
121121            /* z80 */
122            cpu_set_input_line(machine->cpu[0], INPUT_LINE_NMI, (input_port_read(machine, "SPECIAL") & 0x80) || cia1irq);
122            cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, (input_port_read(machine, "SPECIAL") & 0x80) || cia1irq);
123123         }
124124         else
125125         {
126            cpu_set_input_line(machine->cpu[1], INPUT_LINE_NMI, (input_port_read(machine, "SPECIAL") & 0x80) || cia1irq);
126            cputag_set_input_line(machine, "m8502", INPUT_LINE_NMI, (input_port_read(machine, "SPECIAL") & 0x80) || cia1irq);
127127         }
128128      }
129129
130130      else
131131      {
132         cpu_set_input_line(machine->cpu[0], INPUT_LINE_NMI, (input_port_read(machine, "SPECIAL") & 0x80) || cia1irq);
132         cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, (input_port_read(machine, "SPECIAL") & 0x80) || cia1irq);
133133      }
134134
135135      nmilevel = (input_port_read(machine, "SPECIAL") & 0x80) || cia1irq;
r4593r4594
331331      {
332332         if (0) // && (cpu_getactivecpu() == 0))
333333         {
334            cpu_set_input_line(machine->cpu[0], 0, level);
334            cputag_set_input_line(machine, "maincpu", 0, level);
335335         }
336336         else
337337         {
338            cpu_set_input_line(machine->cpu[1], M6510_IRQ_LINE, level);
338            cputag_set_input_line(machine, "m8502", M6510_IRQ_LINE, level);
339339         }
340340      }
341341      else
342342      {
343         cpu_set_input_line(machine->cpu[0], M6510_IRQ_LINE, level);
343         cputag_set_input_line(machine, "maincpu", M6510_IRQ_LINE, level);
344344      }
345345      old_level = level;
346346   }
r4593r4594
679679   static int old = -1, exrom, game;
680680   int loram, hiram, charen;
681681   int ultimax_mode = 0;
682   int data = (UINT8) device_get_info_int(machine->cpu[0], CPUINFO_INT_M6510_PORT) & 0x07;
682   int data = (UINT8) devtag_get_info_int(machine, "maincpu", CPUINFO_INT_M6510_PORT) & 0x07;
683683
684684   /* If nothing has changed or reset = 0, don't do anything */
685685   if ((data == old) && (exrom == c64_exrom) && (game == c64_game) && !reset)
r4593r4594
704704         memory_set_bankptr (machine, 2, c64_memory + 0x8000);
705705         memory_set_bankptr (machine, 3, c64_memory + 0xa000);
706706         memory_set_bankptr (machine, 4, romh);
707         memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xe000, 0xffff, 0, 0, SMH_NOP);
707         memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xe000, 0xffff, 0, 0, SMH_NOP);
708708   }
709709   else
710710   {
r4593r4594
10251025static void c64_common_driver_init (running_machine *machine)
10261026{
10271027   /* configure the M6510 port */
1028   device_set_info_fct(machine->cpu[0], CPUINFO_FCT_M6510_PORTREAD, (genf *) c64_m6510_port_read);
1029   device_set_info_fct(machine->cpu[0], CPUINFO_FCT_M6510_PORTWRITE, (genf *) c64_m6510_port_write);
1028   devtag_set_info_fct(machine, "maincpu", CPUINFO_FCT_M6510_PORTREAD, (genf *) c64_m6510_port_read);
1029   devtag_set_info_fct(machine, "maincpu", CPUINFO_FCT_M6510_PORTWRITE, (genf *) c64_m6510_port_write);
10301030
10311031   if (!ultimax)
10321032   {
src/mess/machine/ti99_4x.c
r4593r4594
290290
291291/* tms9900_ICount: used to implement memory waitstates (hack) */
292292/* tms9995_ICount: used to implement memory waitstates (hack) */
293/* NPW 23-Feb-2004 - externs no longer needed because we now use cpu_adjust_icount(space->machine->cpu[0],) */
293/* NPW 23-Feb-2004 - externs no longer needed because we now use cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),) */
294294
295295
296296
r4593r4594
424424   /* There is a circuitry in TI99/4(a) that resets the console when a
425425   cartridge is inserted or removed.  We emulate this instead of resetting the
426426   emulator (which is the default in MESS). */
427   /*cpu_set_input_line(machine->cpu[0], INPUT_LINE_RESET, PULSE_LINE);
427   /*cputag_set_input_line(machine, "maincpu", INPUT_LINE_RESET, PULSE_LINE);
428428   tms9901_reset(0);
429429   if (! has_evpc)
430430      TMS9928A_reset();
r4593r4594
551551   /* There is a circuitry in TI99/4(a) that resets the console when a
552552   cartridge is inserted or removed.  We emulate this instead of resetting the
553553   emulator (which is the default in MESS). */
554   /*cpu_set_input_line(machine->cpu[0], INPUT_LINE_RESET, PULSE_LINE);
554   /*cputag_set_input_line(machine, "maincpu", INPUT_LINE_RESET, PULSE_LINE);
555555   tms9901_reset(0);
556556   if (! has_evpc)
557557      TMS9928A_reset();
r4593r4594
702702*/
703703MACHINE_RESET( ti99 )
704704{
705   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
705   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
706706   /*console_GROMs.data_ptr = memory_region(machine, region_grom);*/
707707   console_GROMs.addr = 0;
708708
r4593r4594
952952*/
953953READ16_HANDLER ( ti99_nop_8_r )
954954{
955   cpu_adjust_icount(space->machine->cpu[0],-4);
955   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
956956
957957   return (0);
958958}
959959
960960WRITE16_HANDLER ( ti99_nop_8_w )
961961{
962   cpu_adjust_icount(space->machine->cpu[0],-4);
962   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
963963}
964964
965965/*
r4593r4594
977977*/
978978READ16_HANDLER ( ti99_cart_r )
979979{
980   cpu_adjust_icount(space->machine->cpu[0],-4);
980   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
981981
982982   if (hsgpl_crdena)
983983      /* hsgpl is enabled */
r4593r4594
991991
992992WRITE16_HANDLER ( ti99_cart_w )
993993{
994   cpu_adjust_icount(space->machine->cpu[0],-4);
994   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
995995
996996   if (hsgpl_crdena)
997997      /* hsgpl is enabled */
r4593r4594
10211021   if (ti99_4p_internal_rom6_enable)
10221022      return ti99_4p_internal_ROM6[offset];
10231023
1024   cpu_adjust_icount(space->machine->cpu[0],-4);
1024   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
10251025
10261026   if (hsgpl_crdena)
10271027      /* hsgpl is enabled */
r4593r4594
10381038      return;
10391039   }
10401040
1041   cpu_adjust_icount(space->machine->cpu[0],-4);
1041   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
10421042
10431043   if (hsgpl_crdena)
10441044      /* hsgpl is enabled */
r4593r4594
10801080*/
10811081WRITE16_HANDLER ( ti99_wsnd_w )
10821082{
1083   cpu_adjust_icount(space->machine->cpu[0],-4);
1083   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
10841084
10851085   sn76496_w(devtag_get_device(space->machine, "sn76496"), offset, (data >> 8) & 0xff);
10861086}
r4593r4594
10901090*/
10911091READ16_HANDLER ( ti99_rvdp_r )
10921092{
1093   cpu_adjust_icount(space->machine->cpu[0],-4);
1093   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
10941094
10951095   if (offset & 1)
10961096   {   /* read VDP status */
r4593r4594
11071107*/
11081108WRITE16_HANDLER ( ti99_wvdp_w )
11091109{
1110   cpu_adjust_icount(space->machine->cpu[0],-4);
1110   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
11111111
11121112   if (offset & 1)
11131113   {   /* write VDP address */
r4593r4594
11241124*/
11251125READ16_HANDLER ( ti99_rv38_r )
11261126{
1127   cpu_adjust_icount(space->machine->cpu[0],-4);
1127   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
11281128
11291129   if (offset & 1)
11301130   {   /* read VDP status */
r4593r4594
11411141*/
11421142WRITE16_HANDLER ( ti99_wv38_w )
11431143{
1144   cpu_adjust_icount(space->machine->cpu[0],-4);
1144   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
11451145
11461146   switch (offset & 3)
11471147   {
r4593r4594
11691169*/
11701170static READ16_HANDLER ( ti99_rspeech_r )
11711171{
1172   cpu_adjust_icount(space->machine->cpu[0],-(18+3));      /* this is just a minimum, it can be more */
1172   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-(18+3));      /* this is just a minimum, it can be more */
11731173
11741174   return ((int) tms5220_status_r(devtag_get_device(space->machine, "tms5220"), offset)) << 8;
11751175}
r4593r4594
11951195*/
11961196static WRITE16_HANDLER ( ti99_wspeech_w )
11971197{
1198   cpu_adjust_icount(space->machine->cpu[0],-(54+3));      /* this is just an approx. minimum, it can be much more */
1198   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-(54+3));      /* this is just an approx. minimum, it can be much more */
11991199
12001200#if 1
12011201   /* the stupid design of the tms5220 core means that ready is cleared when
r4593r4594
12051205   if (! tms5220_ready_r(devtag_get_device(space->machine, "tms5220")))
12061206   {
12071207      attotime time_to_ready = double_to_attotime(tms5220_time_to_ready(devtag_get_device(space->machine, "tms5220")));
1208      int cycles_to_ready = cpu_attotime_to_clocks(space->machine->cpu[0], time_to_ready);
1208      int cycles_to_ready = cputag_attotime_to_clocks(space->machine, "maincpu", time_to_ready);
12091209
12101210      logerror("time to ready: %f -> %d\n", attotime_to_double(time_to_ready), (int) cycles_to_ready);
12111211
1212      cpu_adjust_icount(space->machine->cpu[0],-cycles_to_ready);
1212      cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-cycles_to_ready);
12131213      timer_set(space->machine, attotime_zero, NULL, 0, /*speech_kludge_callback*/NULL);
12141214   }
12151215#endif
r4593r4594
12251225   int reply;
12261226
12271227
1228   cpu_adjust_icount(space->machine->cpu[0],-4 /*20+3*/);      /* from 4 to 23? */
1228   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4 /*20+3*/);      /* from 4 to 23? */
12291229
12301230   if (offset & 1)
12311231   {   /* read GPL address */
r4593r4594
12661266*/
12671267WRITE16_HANDLER ( ti99_wgpl_w )
12681268{
1269   cpu_adjust_icount(space->machine->cpu[0],-4/*20+3*/);      /* from 4 to 23? */
1269   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4/*20+3*/);      /* from 4 to 23? */
12701270
12711271   if (offset & 1)
12721272   {   /* write GPL address */
r4593r4594
13121312*/
13131313READ16_HANDLER ( ti99_4p_rgpl_r )
13141314{
1315   cpu_adjust_icount(space->machine->cpu[0],-4);      /* HSGPL is located on 8-bit bus? */
1315   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);      /* HSGPL is located on 8-bit bus? */
13161316
13171317   return /*hsgpl_crdena ?*/ ti99_hsgpl_gpl_r(space, offset, mem_mask) /*: 0*/;
13181318}
r4593r4594
13221322*/
13231323WRITE16_HANDLER ( ti99_4p_wgpl_w )
13241324{
1325   cpu_adjust_icount(space->machine->cpu[0],-4);      /* HSGPL is located on 8-bit bus? */
1325   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);      /* HSGPL is located on 8-bit bus? */
13261326
13271327   /*if (hsgpl_crdena)*/
13281328      ti99_hsgpl_gpl_w(space, offset, data, mem_mask);
r4593r4594
13931393            /* speech read */
13941394            if (! (offset & 1))
13951395            {
1396               cpu_adjust_icount(space->machine->cpu[0],-16*4);      /* this is just a minimum, it can be more */
1396               cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-16*4);      /* this is just a minimum, it can be more */
13971397               reply = tms5220_status_r(devtag_get_device(space->machine, "tms5220"), 0);
13981398            }
13991399            break;
r4593r4594
15571557            /* speech write */
15581558            if (! (offset & 1))
15591559            {
1560               cpu_adjust_icount(space->machine->cpu[0],-48*4);      /* this is just an approx. minimum, it can be much more */
1560               cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-48*4);      /* this is just an approx. minimum, it can be much more */
15611561
15621562               /* the stupid design of the tms5220 core means that ready is cleared when
15631563               there are 15 bytes in FIFO.  It should be 16.  Of course, if it were the
r4593r4594
15661566               if (! tms5220_ready_r(devtag_get_device(space->machine, "tms5220")))
15671567               {
15681568                  attotime time_to_ready = double_to_attotime(tms5220_time_to_ready(devtag_get_device(space->machine, "tms5220")));
1569                  double d = ceil(cpu_attotime_to_clocks(space->machine->cpu[0], time_to_ready));
1569                  double d = ceil(cputag_attotime_to_clocks(space->machine, "maincpu", time_to_ready));
15701570                  int cycles_to_ready = ((int) (d + 3)) & ~3;
15711571
15721572                  logerror("time to ready: %f -> %d\n", attotime_to_double(time_to_ready)
15731573                     , (int) cycles_to_ready);
15741574
1575                  cpu_adjust_icount(space->machine->cpu[0],-cycles_to_ready);
1575                  cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-cycles_to_ready);
15761576                  timer_set(space->machine, attotime_zero, NULL, 0, /*speech_kludge_callback*/NULL);
15771577               }
15781578
r4593r4594
21632163   {
21642164      /* On TI99, TMS9900 IC0-3 lines are not connected to TMS9901,
21652165       * but hard-wired to force level 1 interrupts */
2166      cpu_set_input_line_and_vector(device->machine->cpu[0], 0, ASSERT_LINE, 1);   /* interrupt it, baby */
2166      cputag_set_input_line_and_vector(device->machine, "maincpu", 0, ASSERT_LINE, 1);   /* interrupt it, baby */
21672167   }
21682168   else
21692169   {
2170      cpu_set_input_line(device->machine->cpu[0], 0, CLEAR_LINE);
2170      cputag_set_input_line(device->machine, "maincpu", 0, CLEAR_LINE);
21712171   }
21722172}
21732173
r4593r4594
26072607
26082608static void ti99_TIxram_init(running_machine *machine)
26092609{
2610   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
2610   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
26112611   
26122612   memory_install_read16_handler(space, 0x2000, 0x3fff, 0, 0, ti99_TIxramlow_r);
26132613   memory_install_write16_handler(space, 0x2000, 0x3fff, 0, 0, ti99_TIxramlow_w);
r4593r4594
26182618/* low 8 kb: 0x2000-0x3fff */
26192619static READ16_HANDLER ( ti99_TIxramlow_r )
26202620{
2621   cpu_adjust_icount(space->machine->cpu[0],-4);
2621   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
26222622
26232623   return xRAM_ptr[offset];
26242624}
26252625
26262626static WRITE16_HANDLER ( ti99_TIxramlow_w )
26272627{
2628   cpu_adjust_icount(space->machine->cpu[0],-4);
2628   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
26292629
26302630   COMBINE_DATA(xRAM_ptr + offset);
26312631}
r4593r4594
26332633/* high 24 kb: 0xa000-0xffff */
26342634static READ16_HANDLER ( ti99_TIxramhigh_r )
26352635{
2636   cpu_adjust_icount(space->machine->cpu[0],-4);
2636   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
26372637
26382638   return xRAM_ptr[offset+0x1000];
26392639}
26402640
26412641static WRITE16_HANDLER ( ti99_TIxramhigh_w )
26422642{
2643   cpu_adjust_icount(space->machine->cpu[0],-4);
2643   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
26442644
26452645   COMBINE_DATA(xRAM_ptr + offset+0x1000);
26462646}
r4593r4594
26832683{
26842684   int i;
26852685
2686   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
2686   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
26872687   
26882688   memory_install_read16_handler(space, 0x2000, 0x3fff, 0, 0, ti99_sAMSxramlow_r);
26892689   memory_install_write16_handler(space, 0x2000, 0x3fff, 0, 0, ti99_sAMSxramlow_w);
r4593r4594
27222722/* low 8 kb: 0x2000-0x3fff */
27232723static READ16_HANDLER ( ti99_sAMSxramlow_r )
27242724{
2725   cpu_adjust_icount(space->machine->cpu[0],-4);
2725   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
27262726
27272727   if (sAMS_mapper_on)
27282728      return xRAM_ptr[(offset&0x7ff)+sAMSlookup[(0x1000+offset)>>11]];
r4593r4594
27322732
27332733static WRITE16_HANDLER ( ti99_sAMSxramlow_w )
27342734{
2735   cpu_adjust_icount(space->machine->cpu[0],-4);
2735   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
27362736
27372737   if (sAMS_mapper_on)
27382738      COMBINE_DATA(xRAM_ptr + (offset&0x7ff)+sAMSlookup[(0x1000+offset)>>11]);
r4593r4594
27432743/* high 24 kb: 0xa000-0xffff */
27442744static READ16_HANDLER ( ti99_sAMSxramhigh_r )
27452745{
2746   cpu_adjust_icount(space->machine->cpu[0],-4);
2746   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
27472747
27482748   if (sAMS_mapper_on)
27492749      return xRAM_ptr[(offset&0x7ff)+sAMSlookup[(0x5000+offset)>>11]];
r4593r4594
27532753
27542754static WRITE16_HANDLER ( ti99_sAMSxramhigh_w )
27552755{
2756   cpu_adjust_icount(space->machine->cpu[0],-4);
2756   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
27572757
27582758   if (sAMS_mapper_on)
27592759      COMBINE_DATA(xRAM_ptr + (offset&0x7ff)+sAMSlookup[(0x5000+offset)>>11]);
r4593r4594
29462946/* set up myarc handlers, and set initial state */
29472947static void ti99_myarcxram_init(running_machine *machine)
29482948{
2949   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
2949   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
29502950   
29512951   memory_install_read16_handler(space, 0x2000, 0x3fff, 0, 0, ti99_myarcxramlow_r);
29522952   memory_install_write16_handler(space, 0x2000, 0x3fff, 0, 0, ti99_myarcxramlow_w);
r4593r4594
30163016/* low 8 kb: 0x2000-0x3fff */
30173017static READ16_HANDLER ( ti99_myarcxramlow_r )
30183018{
3019   cpu_adjust_icount(space->machine->cpu[0],-4);
3019   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
30203020
30213021   return xRAM_ptr[myarc_cur_page_offset + offset];
30223022}
30233023
30243024static WRITE16_HANDLER ( ti99_myarcxramlow_w )
30253025{
3026   cpu_adjust_icount(space->machine->cpu[0],-4);
3026   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
30273027
30283028   COMBINE_DATA(xRAM_ptr + myarc_cur_page_offset + offset);
30293029}
r4593r4594
30313031/* high 24 kb: 0xa000-0xffff */
30323032static READ16_HANDLER ( ti99_myarcxramhigh_r )
30333033{
3034   cpu_adjust_icount(space->machine->cpu[0],-4);
3034   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
30353035
30363036   return xRAM_ptr[myarc_cur_page_offset + offset+0x1000];
30373037}
30383038
30393039static WRITE16_HANDLER ( ti99_myarcxramhigh_w )
30403040{
3041   cpu_adjust_icount(space->machine->cpu[0],-4);
3041   cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4);
30423042
30433043   COMBINE_DATA(xRAM_ptr + myarc_cur_page_offset + offset+0x1000);
30443044}
src/mess/machine/sgi.c
r4593r4594
2020      va_start( v, s_fmt );
2121      vsprintf( buf, s_fmt, v );
2222      va_end( v );
23      logerror( "%08x: %s", (unsigned) cpu_get_pc(machine->cpu[0]), buf );
23      logerror( "%08x: %s", (unsigned) cpu_get_pc(cputag_get_cpu(machine, "maincpu")), buf );
2424   }
2525}
2626
src/mess/devices/thomflop.c
r4593r4594
277277   else if ( offset == 8 )
278278      return to7_5p14_select;
279279   else
280      logerror ( "%f $%04x to7_5p14_r: invalid read offset %i\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), offset );
280      logerror ( "%f $%04x to7_5p14_r: invalid read offset %i\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset );
281281   return 0;
282282}
283283
r4593r4594
302302      case 4: drive = 2; side = 0; break;
303303      case 5: drive = 3; side = 1; break;
304304      default:
305         logerror( "%f $%04x to7_5p14_w: invalid drive select pattern $%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data );
305         logerror( "%f $%04x to7_5p14_w: invalid drive select pattern $%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), data );
306306      }
307307
308308      dens = (data & 0x80) ? DEN_FM_LO : DEN_MFM_LO;
r4593r4594
317317         wd17xx_set_drive( fdc, drive );
318318         wd17xx_set_side( fdc, side );
319319         LOG(( "%f $%04x to7_5p14_w: $%02X set drive=%i side=%i density=%s\n",
320               attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ),
320               attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")),
321321               data, drive, side, (dens == DEN_FM_LO) ? "FM" : "MFM" ));
322322      }
323323   }
324324   else
325325      logerror ( "%f $%04x to7_5p14_w: invalid write offset %i (data=$%02X)\n",
326            attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), offset, data );
326            attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset, data );
327327}
328328
329329
r4593r4594
375375   else if ( offset >= 8 && offset <= 9 )
376376      return to7_5p14sd_select;
377377   else
378      logerror ( "%f $%04x to7_5p14sd_r: invalid read offset %i\n",  attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), offset );
378      logerror ( "%f $%04x to7_5p14sd_r: invalid read offset %i\n",  attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset );
379379   return 0;
380380}
381381
r4593r4594
419419         mc6843_set_drive( devtag_get_device(space->machine, "mc6843"), drive );
420420         mc6843_set_side( devtag_get_device(space->machine, "mc6843"), side );
421421         LOG(( "%f $%04x to7_5p14sd_w: $%02X set drive=%i side=%i\n",
422               attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data, drive, side ));
422               attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), data, drive, side ));
423423      }
424424   }
425425   else
426426      logerror ( "%f $%04x to7_5p14sd_w: invalid write offset %i (data=$%02X)\n",
427            attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), offset, data );
427            attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset, data );
428428}
429429
430430static void to7_5p14_index_pulse_callback( const device_config *controller,const device_config *image, int state )
r4593r4594
604604      data = to7qdd->data[ to7qdd->data_idx ];
605605
606606   VLOG(( "%f $%04x to7_qdd_read_byte: RDATA off=%i/%i data=$%02X\n",
607          attotime_to_double(timer_get_time(machine)), cpu_get_previouspc( machine->cpu[0] ),
607          attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(cputag_get_cpu(machine, "maincpu")),
608608          to7qdd->data_idx, to7qdd->data_size, data ));
609609
610610   to7qdd->data_idx++;
r4593r4594
645645      to7qdd->data_idx++;
646646
647647      VLOG (( "%f $%04x to7_qdd_write_byte: got $%02X offs=%i-%i\n",
648         attotime_to_double(timer_get_time(machine)), cpu_get_previouspc( machine->cpu[0] ), data,
648         attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(cputag_get_cpu(machine, "maincpu")), data,
649649         to7qdd->start_idx, to7qdd->data_idx ));
650650
651651      /* end of tentative id field */
r4593r4594
659659         UINT8 filler = 0xff;
660660
661661         LOG(( "%f $%04x to7_qdd_write_byte: got id field for sector=%i\n",
662               attotime_to_double(timer_get_time(machine)), cpu_get_previouspc( machine->cpu[0] ), sector ));
662               attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(cputag_get_cpu(machine, "maincpu")), sector ));
663663
664664         floppy_drive_format_sector( to7_qdd_image(machine),
665665                      0, sector, 0, 0, sector, 128, filler );
r4593r4594
688688            int sector = (int) to7qdd->data[ i + 1 ] * 256 + (int) to7qdd->data[ i + 2 ];
689689
690690            LOG(( "%f $%04x to7_qdd_write_byte: goto data field for sector=%i\n",
691                  attotime_to_double(timer_get_time(machine)), cpu_get_previouspc( machine->cpu[0] ), sector ));
691                  attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(cputag_get_cpu(machine, "maincpu")), sector ));
692692
693693            floppy_drive_write_sector_data( to7_qdd_image(machine), 0, sector, to7qdd->data + to7qdd->start_idx + 1, 128, 0 );
694694         }
r4593r4594
710710   case 0: /* MC6852 status */
711711      to7_qdd_stat_update(space->machine);
712712      VLOG(( "%f $%04x to7_qdd_r: STAT=$%02X irq=%i pe=%i ovr=%i und=%i tr=%i rd=%i ncts=%i\n",
713             attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), to7qdd->status,
713             attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), to7qdd->status,
714714             to7qdd->status & QDD_S_IRQ  ? 1 : 0,
715715             to7qdd->status & QDD_S_PE   ? 1 : 0,
716716             to7qdd->status & QDD_S_OVR  ? 1 : 0,
r4593r4594
733733         data |= 0x40; /* disk present */
734734      if ( to7qdd->index_pulse )
735735         data |= 0x80; /* disk start */
736      VLOG(( "%f $%04x to7_qdd_r: STATUS8 $%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data ));
736      VLOG(( "%f $%04x to7_qdd_r: STATUS8 $%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), data ));
737737      return data;
738738   }
739739
740740   default:
741      logerror ( "%f $%04x to7_qdd_r: invalid read offset %i\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), offset );
741      logerror ( "%f $%04x to7_qdd_r: invalid read offset %i\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset );
742742      return 0;
743743   }
744744}
r4593r4594
760760      to7qdd->ctrl1 = ( data & ~(QDD_C1_RRESET | QDD_C1_TRESET) ) |( data &  (QDD_C1_RRESET | QDD_C1_TRESET) & to7qdd->ctrl1 );
761761      to7_qdd_stat_update(space->machine);
762762      VLOG(( "%f $%04x to7_qdd_w: CTRL1=$%02X reset=%c%c %s%sirq=%c%c\n",
763             attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data,
763             attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), data,
764764             data & QDD_C1_RRESET ? 'r' : '-', data & QDD_C1_TRESET ? 't' : '-',
765765             data & QDD_C1_STRIPSYNC ? "strip-sync " : "",
766766             data & QDD_C1_CLRSYNC ? "clear-sync " : "",
r4593r4594
784784         parity = par[ (data >> 3) & 7 ];
785785         to7_qdd_stat_update(space->machine);
786786         VLOG(( "%f $%04x to7_qdd_w: CTRL2=$%02X bits=%i par=%s blen=%i under=%s%s\n",
787                attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data,
787                attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), data,
788788                bits, parname[ parity ], data & QDD_C2_BLEN ? 1 : 2,
789789                data & QDD_C2_TSYNC ? "sync" : "ff",
790790                data & QDD_C2_EIE ? "irq-err" : "" ));
r4593r4594
802802            to7qdd->status &= ~QDD_S_NCTS;
803803         to7_qdd_stat_update(space->machine);
804804         VLOG(( "%f $%04x to7_qdd_w: CTRL3=$%02X %s%ssync-len=%i sync-mode=%s\n",
805                attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data,
805                attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), data,
806806                data & QDD_C3_CLRTUF ? "clr-tuf " : "",
807807                data & QDD_C3_CLRCTS ? "clr-cts " : "",
808808                data & QDD_C3_SYNCLEN ? 1 : 2,
r4593r4594
814814         break;
815815
816816      case 3: /* MC6852 data out => does not seem to be used */
817         VLOG(( "%f $%04x to7_qdd_w: ignored WDATA=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data ));
817         VLOG(( "%f $%04x to7_qdd_w: ignored WDATA=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), data ));
818818         break;
819819
820820      }
r4593r4594
822822
823823   case 8: /* set drive */
824824      to7qdd->drive = data;
825      VLOG(( "%f $%04x to7_qdd_w: DRIVE=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data ));
825      VLOG(( "%f $%04x to7_qdd_w: DRIVE=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), data ));
826826      break;
827827
828828   case 12: /* motor pulse ? */
829829      thom_floppy_active( space->machine, 0 );
830      VLOG(( "%f $%04x to7_qdd_w: MOTOR=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data ));
830      VLOG(( "%f $%04x to7_qdd_w: MOTOR=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), data ));
831831      break;
832832
833833   default:
834      logerror ( "%f $%04x to7_qdd_w: invalid write offset %i (data=$%02X)\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), offset, data );
834      logerror ( "%f $%04x to7_qdd_w: invalid write offset %i (data=$%02X)\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset, data );
835835   }
836836}
837837
r4593r4594
10581058   UINT8 data = thmfc1->data[ thmfc1->data_idx ];
10591059
10601060   VLOG(( "%f $%04x thmfc_floppy_read_byte: off=%i/%i/%i data=$%02X\n",
1061          attotime_to_double(timer_get_time(machine)), cpu_get_previouspc( machine->cpu[0] ),
1061          attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(cputag_get_cpu(machine, "maincpu")),
10621062          thmfc1->data_idx, thmfc1->data_finish - 1, thmfc1->data_size - 1,
10631063          data ));
10641064
r4593r4594
11011101      data = thmfc1->data[ thmfc1->data_raw_idx ];
11021102
11031103   VLOG(( "%f $%04x thmfc_floppy_raw_read_byte: off=%i/%i data=$%02X\n",
1104          attotime_to_double(timer_get_time(machine)), cpu_get_previouspc( machine->cpu[0] ),
1104          attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(cputag_get_cpu(machine, "maincpu")),
11051105          thmfc1->data_raw_idx, thmfc1->data_raw_size, data ));
11061106
11071107   thmfc1->data_raw_idx++;
r4593r4594
11391139      }
11401140
11411141      VLOG (( "%f $%04x thmfc_floppy_qdd_write_byte: $%02X offs=%i-%i\n",
1142         attotime_to_double(timer_get_time(machine)), cpu_get_previouspc( machine->cpu[0] ), data,
1142         attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(cputag_get_cpu(machine, "maincpu")), data,
11431143         thmfc1->data_idx,thmfc1->data_raw_idx ));
11441144
11451145      if ( thmfc1->data_raw_idx == thmfc1->data_idx + 3 &&
r4593r4594
11511151         int sector = (int) thmfc1->data[ thmfc1->data_idx ] * 256 + (int) thmfc1->data[ thmfc1->data_idx + 1 ];
11521152         UINT8 filler = 0xff;
11531153
1154         LOG(( "%f $%04x thmfc_floppy_qdd_write_byte: id field, sector=%i\n", attotime_to_double(timer_get_time(machine)), cpu_get_previouspc( machine->cpu[0] ), sector ));
1154         LOG(( "%f $%04x thmfc_floppy_qdd_write_byte: id field, sector=%i\n", attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(cputag_get_cpu(machine, "maincpu")), sector ));
11551155
11561156         floppy_drive_format_sector( thmfc_floppy_image(machine), 0, sector, 0, 0, sector, 128, filler );
11571157         thmfc1->data_idx = 0;
r4593r4594
11801180               (int) thmfc1->data[ i + 2 ];
11811181
11821182            LOG(( "%f $%04x thmfc_floppy_qdd_write_byte: data field, sector=%i\n",
1183                  attotime_to_double(timer_get_time(machine)), cpu_get_previouspc( machine->cpu[0] ), sector ));
1183                  attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(cputag_get_cpu(machine, "maincpu")), sector ));
11841184
11851185            floppy_drive_write_sector_data( img, 0, sector, thmfc1->data + thmfc1->data_idx, 128, 0 );
11861186         }
r4593r4594
11941194   else
11951195   {
11961196      thmfc1->data_raw_idx++;
1197      VLOG (( "%f $%04x thmfc_floppy_qdd_write_byte: ignored $%02X\n", attotime_to_double(timer_get_time(machine)), cpu_get_previouspc( machine->cpu[0] ), data ));
1197      VLOG (( "%f $%04x thmfc_floppy_qdd_write_byte: ignored $%02X\n", attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(cputag_get_cpu(machine, "maincpu")), data ));
11981198   }
11991199
12001200}
r4593r4594
12051205static void thmfc_floppy_write_byte ( running_machine *machine, UINT8 data )
12061206{
12071207   VLOG (( "%f $%04x thmfc_floppy_write_byte: off=%i/%i data=$%02X\n",
1208      attotime_to_double(timer_get_time(machine)), cpu_get_previouspc( machine->cpu[0] ),
1208      attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(cputag_get_cpu(machine, "maincpu")),
12091209      thmfc1->data_idx, thmfc1->data_size - 1, data ));
12101210
12111211   thmfc1->data_raw_size = 0;
r4593r4594
12191219/* intelligent formatting */
12201220static void thmfc_floppy_format_byte ( running_machine *machine, UINT8 data )
12211221{
1222   VLOG (( "%f $%04x thmfc_floppy_format_byte: $%02X\n", attotime_to_double(timer_get_time(machine)), cpu_get_previouspc( machine->cpu[0] ), data ));
1222   VLOG (( "%f $%04x thmfc_floppy_format_byte: $%02X\n", attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(cputag_get_cpu(machine, "maincpu")), data ));
12231223
12241224   thmfc1->data_raw_size = 0;
12251225
r4593r4594
12591259
12601260   case 0: /* STAT0 */
12611261      thmfc1->stat0 ^= THMFC1_STAT0_SYNCHRO | THMFC1_STAT0_BYTE_READY_POL;
1262      VLOG(( "%f $%04x thmfc_floppy_r: STAT0=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), thmfc1->stat0 ));
1262      VLOG(( "%f $%04x thmfc_floppy_r: STAT0=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), thmfc1->stat0 ));
12631263      return thmfc1->stat0;
12641264
12651265   case 1: /* STAT1 */
r4593r4594
12901290         data |= 0x10;
12911291      if ( flags & FLOPPY_DRIVE_DISK_WRITE_PROTECTED )
12921292         data |= 0x04;
1293      VLOG(( "%f $%04x thmfc_floppy_r: STAT1=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data ));
1293      VLOG(( "%f $%04x thmfc_floppy_r: STAT1=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), data ));
12941294      return data;
12951295   }
12961296
r4593r4594
13081308   {
13091309      /* undocumented => emulate TO7 QDD controller ? */
13101310      UINT8 data = thmfc1->ipl << 7;
1311      VLOG(( "%f $%04x thmfc_floppy_r: STAT8=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data ));
1311      VLOG(( "%f $%04x thmfc_floppy_r: STAT8=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), data ));
13121312      return data;
13131313   }
13141314
13151315   default:
1316      logerror ( "%f $%04x thmfc_floppy_r: invalid read offset %i\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), offset );
1316      logerror ( "%f $%04x thmfc_floppy_r: invalid read offset %i\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset );
13171317      return 0;
13181318   }
13191319}
r4593r4594
13331333      thom_floppy_set_density( dens );
13341334      thmfc1->formatting = (data >> 2) & 1;
13351335      LOG (( "%f $%04x thmfc_floppy_w: CMD0=$%02X dens=%s wsync=%i dsync=%i fmt=%i op=%i\n",
1336             attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data,
1336             attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), data,
13371337             (dens == DEN_FM_LO) ? "MF" : "MFM",
13381338             wsync, (data >> 3) & 1,
13391339             thmfc1->formatting, data & 3 ));
r4593r4594
14181418      if ( thmfc1->sector_size > 256 )
14191419      {
14201420         logerror( "$%04x thmfc_floppy_w: sector size %i > 256 not handled\n",
1421              cpu_get_previouspc( space->machine->cpu[0] ), thmfc1->sector_size );
1421              cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), thmfc1->sector_size );
14221422         thmfc1->sector_size = 256;
14231423      }
14241424
14251425      LOG (( "%f $%04x thmfc_floppy_w: CMD1=$%02X sect-size=%i comp=%i head=%i\n",
1426             attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data,
1426             attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), data,
14271427             thmfc1->sector_size, (data >> 1) & 7, thmfc1->side ));
14281428      break;
14291429
r4593r4594
14511451      thom_floppy_active( space->machine, 0 );
14521452
14531453      LOG (( "%f $%04x thmfc_floppy_w: CMD2=$%02X drv=%i step=%i motor=%i\n",
1454             attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data,
1454             attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), data,
14551455             thmfc1->drive, seek, motor ));
14561456
14571457      if ( seek )
r4593r4594
14811481      {
14821482         /* TODO: implement other forms of raw track writing */
14831483         LOG (( "%f $%04x thmfc_floppy_w: ignored raw WDATA $%02X\n",
1484                attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data ));
1484                attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), data ));
14851485      }
14861486      break;
14871487
r4593r4594
14891489   case 4: /* WCLK (unemulated) */
14901490      /* clock configuration: FF for data, 0A for synchro */
14911491      LOG (( "%f $%04x thmfc_floppy_w: WCLK=$%02X (%s)\n",
1492             attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data,
1492             attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), data,
14931493             (data == 0xff) ? "data" : (data == 0x0A) ? "synchro" : "?" ));
14941494      break;
14951495
14961496   case 5: /* WSECT */
14971497      thmfc1->sector = data;
14981498      LOG (( "%f $%04x thmfc_floppy_w: WSECT=%i\n",
1499             attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data ));
1499             attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), data ));
15001500      break;
15011501
15021502   case 6: /* WTRCK */
15031503      thmfc1->track = data;
15041504      LOG (( "%f $%04x thmfc_floppy_w: WTRCK=%i (real=%i)\n",
1505             attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data,
1505             attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), data,
15061506             floppy_drive_get_current_track( thmfc_floppy_image(space->machine) ) ));
15071507      break;
15081508
15091509   case 7: /* WCELL */
15101510      /* precompensation (unemulated) */
15111511      LOG (( "%f $%04x thmfc_floppy_w: WCELL=$%02X\n",
1512             attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data ));
1512             attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), data ));
15131513      break;
15141514
15151515   default:
15161516      logerror ( "%f $%04x thmfc_floppy_w: invalid write offset %i (data=$%02X)\n",
1517            attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), offset, data );
1517            attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset, data );
15181518   }
15191519}
15201520
r4593r4594
17151715   {
17161716      /* network ID of the computer */
17171717      UINT8 id = input_port_read(space->machine, "fconfig") >> 3;
1718      VLOG(( "%f $%04x to7_network_r: read id $%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), id ));
1718      VLOG(( "%f $%04x to7_network_r: read id $%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), id ));
17191719      return id;
17201720   }
17211721
1722   logerror( "%f $%04x to7_network_r: invalid read offset %i\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), offset );
1722   logerror( "%f $%04x to7_network_r: invalid read offset %i\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset );
17231723   return 0;
17241724}
17251725
r4593r4594
17321732   else
17331733   {
17341734      logerror( "%f $%04x to7_network_w: invalid write offset %i (data=$%02X)\n",
1735           attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), offset, data );
1735           attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset, data );
17361736   }
17371737}
17381738
src/mess/drivers/vip.c
r4593r4594
274274{
275275   /* enable RAM */
276276
277   const address_space *program = cpu_get_address_space(space->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
277   const address_space *program = cputag_get_address_space(space->machine, CDP1802_TAG, ADDRESS_SPACE_PROGRAM);
278278
279279   memory_set_bank(space->machine, 1, VIP_BANK_RAM);
280280
r4593r4594
568568
569569   /* ROM banking */
570570
571   memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0x81ff, 0, 0x7e00, SMH_BANK2, SMH_UNMAP);
571   memory_install_readwrite8_handler(cputag_get_address_space(machine, CDP1802_TAG, ADDRESS_SPACE_PROGRAM), 0x8000, 0x81ff, 0, 0x7e00, SMH_BANK2, SMH_UNMAP);
572572   memory_configure_bank(machine, 2, 0, 1, memory_region(machine, CDP1802_TAG) + 0x8000, 0);
573573   memory_set_bank(machine, 2, 0);
574574
r4593r4594
607607{
608608   vip_state *state = machine->driver_data;
609609   
610   const address_space *program = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
611   const address_space *io = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO);
610   const address_space *program = cputag_get_address_space(machine, CDP1802_TAG, ADDRESS_SPACE_PROGRAM);
611   const address_space *io = cputag_get_address_space(machine, CDP1802_TAG, ADDRESS_SPACE_IO);
612612
613613   /* reset auxiliary chips */
614614
src/mess/drivers/tec1.c
r4593r4594
110110
111111static READ8_HANDLER( tec1_kbd_r )
112112{
113   cpu_set_input_line(space->machine->cpu[0], INPUT_LINE_NMI, CLEAR_LINE);
113   cputag_set_input_line(space->machine, "maincpu", INPUT_LINE_NMI, CLEAR_LINE);
114114   return tec1_kbd;
115115}
116116   
r4593r4594
155155   if (input_port_read(machine, keynames[row]))
156156   {
157157      tec1_kbd = tec1_convert_col_to_bin(input_port_read(machine, keynames[row]), row);
158      cpu_set_input_line(machine->cpu[0], INPUT_LINE_NMI, HOLD_LINE);
158      cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, HOLD_LINE);
159159   }
160160}
161161
src/mess/drivers/z88.c
r4593r4594
4646         )
4747      {
4848         logerror("set int\n");
49         cpu_set_input_line(machine->cpu[0], 0, HOLD_LINE);
49         cputag_set_input_line(machine, "maincpu", 0, HOLD_LINE);
5050         return;
5151      }
5252   }
5353
5454   logerror("clear int\n");
55   cpu_set_input_line(machine->cpu[0], 0, CLEAR_LINE);
55   cputag_set_input_line(machine, "maincpu", 0, CLEAR_LINE);
5656}
5757
5858static void z88_update_rtc_interrupt(void)
r4593r4594
191191   write_handler = (write_addr != NULL) ? (write8_space_func) (STATIC_BANK1 + (FPTR)(bank_base - 1 + 1)) : SMH_UNMAP;
192192
193193   /* install the handlers */
194   memory_install_read8_handler(cpu_get_address_space(machine->cpu[0],  ADDRESS_SPACE_PROGRAM ), start, start + size - 1, 0, 0, read_handler);
195   memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM ), start, start + size - 1, 0, 0, write_handler);
194   memory_install_read8_handler(cputag_get_address_space(machine, "maincpu",  ADDRESS_SPACE_PROGRAM ), start, start + size - 1, 0, 0, read_handler);
195   memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM ), start, start + size - 1, 0, 0, write_handler);
196196
197197   /* and set the banks */
198198   if (read_addr != NULL)
r4593r4594
542542         {
543543            z88_blink.z88_state = Z88_SNOOZE;
544544            /* spin cycles until rtc timer */
545            cpu_spinuntil_trigger( space->machine->cpu[0], Z88_SNOOZE_TRIGGER);
545            cpu_spinuntil_trigger( cputag_get_cpu(space->machine, "maincpu"), Z88_SNOOZE_TRIGGER);
546546
547547            logerror("z88 entering snooze!\n");
548548         }
r4593r4594
771771
772772/*     YEAR     NAME    PARENT  COMPAT  MACHINE     INPUT       INIT    CONFIG  COMPANY                 FULLNAME */
773773COMP( 1988,   z88,   0,      0,      z88,      z88,      0,      z88,   "Cambridge Computers",   "Z88",GAME_NOT_WORKING)
774
src/mess/drivers/glasgow.c
r4593r4594
404404
405405static TIMER_CALLBACK( update_nmi )
406406{
407   //cpu_set_input_line_and_vector(machine->cpu[0],  M68K_IRQ_7,irq_edge&0xff ? CLEAR_LINE:ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR);
408      cpu_set_input_line_and_vector(machine->cpu[0],  M68K_IRQ_7,ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR);
409      cpu_set_input_line_and_vector(machine->cpu[0],  M68K_IRQ_7,CLEAR_LINE, M68K_INT_ACK_AUTOVECTOR);
407   //cputag_set_input_line_and_vector(machine, "main",  M68K_IRQ_7,irq_edge&0xff ? CLEAR_LINE:ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR);
408      cputag_set_input_line_and_vector(machine, "main",  M68K_IRQ_7,ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR);
409      cputag_set_input_line_and_vector(machine, "main",  M68K_IRQ_7,CLEAR_LINE, M68K_INT_ACK_AUTOVECTOR);
410410      irq_edge=~irq_edge;
411411}
412412
413413static TIMER_CALLBACK( update_nmi32 )
414414{
415   // cpu_set_input_line_and_vector(machine->cpu[0],  M68K_IRQ_7, irq_edge&0xff ? CLEAR_LINE:ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR);
416      cpu_set_input_line_and_vector(machine->cpu[0],  M68K_IRQ_7, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR);
417      cpu_set_input_line_and_vector(machine->cpu[0],  M68K_IRQ_7, CLEAR_LINE, M68K_INT_ACK_AUTOVECTOR);
415   // cputag_set_input_line_and_vector(machine, "main",  M68K_IRQ_7, irq_edge&0xff ? CLEAR_LINE:ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR);
416      cputag_set_input_line_and_vector(machine, "main",  M68K_IRQ_7, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR);
417      cputag_set_input_line_and_vector(machine, "main",  M68K_IRQ_7, CLEAR_LINE, M68K_INT_ACK_AUTOVECTOR);
418418    irq_edge=~irq_edge;
419419}
420420
src/mess/drivers/tm990189.c
r4593r4594
238238static void field_interrupts(running_machine *machine)
239239{
240240   if (load_state)
241      cpu_set_input_line_and_vector(machine->cpu[0], 0, ASSERT_LINE, 2);
241      cputag_set_input_line_and_vector(machine, "maincpu", 0, ASSERT_LINE, 2);
242242   else
243      cpu_set_input_line_and_vector(machine->cpu[0], 0, ASSERT_LINE, ic_state);
243      cputag_set_input_line_and_vector(machine, "maincpu", 0, ASSERT_LINE, ic_state);
244244}
245245
246246/*
src/mess/drivers/x68k.c
r4593r4594
213213//              if(x68k_sys.mfp.iera & (1 << x))
214214                {
215215                    current_vector[6] = (x68k_sys.mfp.vr & 0xf0) | (x+8);
216                    cpu_set_input_line_and_vector(machine->cpu[0],x68k_sys.mfp.irqline,ASSERT_LINE,(x68k_sys.mfp.vr & 0xf0) | (x + 8));
216                    cputag_set_input_line_and_vector(machine, "maincpu",x68k_sys.mfp.irqline,ASSERT_LINE,(x68k_sys.mfp.vr & 0xf0) | (x + 8));
217217//                  logerror("MFP: Sent IRQ vector 0x%02x (IRQ line %i)\n",(x68k_sys.mfp.vr & 0xf0) | (x+8),x68k_sys.mfp.irqline);
218218                    return;  // one at a time only
219219                }
r4593r4594
232232//              if(x68k_sys.mfp.ierb & (1 << x))
233233                {
234234                    current_vector[6] = (x68k_sys.mfp.vr & 0xf0) | x;
235                    cpu_set_input_line_and_vector(machine->cpu[0],x68k_sys.mfp.irqline,ASSERT_LINE,(x68k_sys.mfp.vr & 0xf0) | x);
235                    cputag_set_input_line_and_vector(machine, "maincpu",x68k_sys.mfp.irqline,ASSERT_LINE,(x68k_sys.mfp.vr & 0xf0) | x);
236236//                  logerror("MFP: Sent IRQ vector 0x%02x (IRQ line %i)\n",(x68k_sys.mfp.vr & 0xf0) | x,x68k_sys.mfp.irqline);
237237                    return;  // one at a time only
238238                }
r4593r4594
453453         if(input_port_read(machine,"options") & 0x01)
454454         {
455455            current_vector[6] = 0x4c;
456            cpu_set_input_line_and_vector(machine->cpu[0],6,ASSERT_LINE,0x4c);
456            cputag_set_input_line_and_vector(machine, "maincpu",6,ASSERT_LINE,0x4c);
457457            logerror("MFP: Receive buffer full IRQ sent\n");
458458         }
459459      }
r4593r4594
464464      x68k_sys.keyboard.headpos = 0;
465465//      mfp_trigger_irq(MFP_IRQ_RX_ERROR);
466466      current_vector[6] = 0x4b;
467//      cpu_set_input_line_and_vector(machine->cpu[0],6,ASSERT_LINE,0x4b);
467//      cputag_set_input_line_and_vector(machine, "maincpu",6,ASSERT_LINE,0x4b);
468468   }
469469}
470470
r4593r4594
648648            x68k_sys.mouse.irqactive = 1;
649649            current_vector[5] = 0x54;
650650            current_irq_line = 5;
651            cpu_set_input_line_and_vector(machine->cpu[0],5,ASSERT_LINE,0x54);
651            cputag_set_input_line_and_vector(machine, "maincpu",5,ASSERT_LINE,0x54);
652652         }
653653      }
654654   }
r4593r4594
884884   if((prev1 & 0x10) == 0x00 && (data & 0x10) == 0x10)
885885   {
886886      x68k_sys.mdctrl.seq1++;
887      timer_adjust_oneshot(x68k_sys.mdctrl.io_timeout1,cpu_clocks_to_attotime(device->machine->cpu[0],8192),0);
887      timer_adjust_oneshot(x68k_sys.mdctrl.io_timeout1,cputag_clocks_to_attotime(device->machine, "maincpu", 8192),0);
888888   }
889889   prev1 = data;
890890
r4593r4594
893893   if((prev2 & 0x20) == 0x00 && (data & 0x20) == 0x20)
894894   {
895895      x68k_sys.mdctrl.seq2++;
896      timer_adjust_oneshot(x68k_sys.mdctrl.io_timeout2,cpu_clocks_to_attotime(device->machine->cpu[0],8192),0);
896      timer_adjust_oneshot(x68k_sys.mdctrl.io_timeout2,cputag_clocks_to_attotime(device->machine, "maincpu", 8192),0);
897897   }
898898   prev2 = data;
899899
r4593r4594
10261026      x68k_sys.ioc.irqstatus |= 0x80;
10271027      current_irq_line = 1;
10281028      logerror("FDC: IRQ triggered\n");
1029      cpu_set_input_line_and_vector(device->machine->cpu[0],1,ASSERT_LINE,current_vector[1]);
1029      cputag_set_input_line_and_vector(device->machine, "maincpu", 1, ASSERT_LINE, current_vector[1]);
10301030   }
10311031}
10321032
r4593r4594
15711571   if(mess_ram[0x09] != 0x02)  // normal vector for bus errors points to 02FF0540
15721572   {
15731573      int addr = (mess_ram[0x09] << 24) | (mess_ram[0x08] << 16) |(mess_ram[0x0b] << 8) | mess_ram[0x0a];
1574      int sp = cpu_get_reg(machine->cpu[0],REG_GENSP);
1575      int pc = cpu_get_reg(machine->cpu[0],REG_GENPC);
1576      int sr = cpu_get_reg(machine->cpu[0],M68K_SR);
1577      //int pda = cpu_get_reg(machine->cpu[0],M68K_PREF_DATA);
1578      cpu_set_reg(machine->cpu[0],REG_GENSP,sp-14);
1574      int sp = cpu_get_reg(cputag_get_cpu(machine, "maincpu"), REG_GENSP);
1575      int pc = cpu_get_reg(cputag_get_cpu(machine, "maincpu"), REG_GENPC);
1576      int sr = cpu_get_reg(cputag_get_cpu(machine, "maincpu"), M68K_SR);
1577      //int pda = cpu_get_reg(cputag_get_cpu(machine, "maincpu"), M68K_PREF_DATA);
1578      cpu_set_reg(cputag_get_cpu(machine, "maincpu"), REG_GENSP, sp - 14);
15791579      mess_ram[sp-11] = (val & 0xff000000) >> 24;
15801580      mess_ram[sp-12] = (val & 0x00ff0000) >> 16;
15811581      mess_ram[sp-9] = (val & 0x0000ff00) >> 8;
r4593r4594
15861586      mess_ram[sp-2] = (pc & 0x000000ff);  // place PC onto the stack
15871587      mess_ram[sp-5] = (sr & 0xff00) >> 8;
15881588      mess_ram[sp-6] = (sr & 0x00ff);  // place SR onto the stack
1589      cpu_set_reg(machine->cpu[0],REG_GENPC,addr);  // real exceptions seem to take too long to be acknowledged
1590      popmessage("Expansion access [%08x]: PC jump to %08x",val,addr);
1589      cpu_set_reg(cputag_get_cpu(machine, "maincpu"), REG_GENPC, addr);  // real exceptions seem to take too long to be acknowledged
1590      popmessage("Expansion access [%08x]: PC jump to %08x", val, addr);
15911591   }
15921592}
15931593
r4593r4594
15971597       then access causes a bus error */
15981598   current_vector[2] = 0x02;  // bus error
15991599   current_irq_line = 2;
1600//   cpu_set_input_line_and_vector(space->machine->cpu[0],2,ASSERT_LINE,current_vector[2]);
1600//   cputag_set_input_line_and_vector(space->machine, "maincpu",2,ASSERT_LINE,current_vector[2]);
16011601   if(input_port_read(space->machine, "options") & 0x02)
16021602   {
16031603      offset *= 2;
16041604      if(ACCESSING_BITS_0_7)
16051605         offset++;
1606      timer_set(space->machine, cpu_clocks_to_attotime(space->machine->cpu[0], 4), NULL, 0xbffffc+offset,x68k_fake_bus_error);
1606      timer_set(space->machine, cputag_clocks_to_attotime(space->machine, "maincpu", 4), NULL, 0xbffffc+offset,x68k_fake_bus_error);
16071607   }
16081608   return 0xff;
16091609}
r4593r4594
16141614       then access causes a bus error */
16151615   current_vector[2] = 0x02;  // bus error
16161616   current_irq_line = 2;
1617//   cpu_set_input_line_and_vector(space->machine->cpu[0],2,ASSERT_LINE,current_vector[2]);
1617//   cputag_set_input_line_and_vector(space->machine, "maincpu",2,ASSERT_LINE,current_vector[2]);
16181618   if(input_port_read(space->machine, "options") & 0x02)
16191619   {
16201620      offset *= 2;
16211621      if(ACCESSING_BITS_0_7)
16221622         offset++;
1623      timer_set(space->machine, cpu_clocks_to_attotime(space->machine->cpu[0], 4), NULL, 0xbffffc+offset,x68k_fake_bus_error);
1623      timer_set(space->machine, cputag_clocks_to_attotime(space->machine, "maincpu", 4), NULL, 0xbffffc+offset,x68k_fake_bus_error);
16241624   }
16251625}
16261626
r4593r4594
16341634      offset *= 2;
16351635      if(ACCESSING_BITS_0_7)
16361636         offset++;
1637      timer_set(space->machine, cpu_clocks_to_attotime(space->machine->cpu[0], 16), NULL, 0xeafa00+offset,x68k_fake_bus_error);
1638//      cpu_set_input_line_and_vector(machine->cpu[0],2,ASSERT_LINE,current_vector[2]);
1637      timer_set(space->machine, cputag_clocks_to_attotime(space->machine, "maincpu", 16), NULL, 0xeafa00+offset,x68k_fake_bus_error);
1638//      cputag_set_input_line_and_vector(machine, "maincpu",2,ASSERT_LINE,current_vector[2]);
16391639   }
16401640   return 0xffff;
16411641}
r4593r4594
16501650      offset *= 2;
16511651      if(ACCESSING_BITS_0_7)
16521652         offset++;
1653      timer_set(space->machine, cpu_clocks_to_attotime(space->machine->cpu[0], 16), NULL, 0xeafa00+offset,x68k_fake_bus_error);
1654//      cpu_set_input_line_and_vector(machine->cpu[0],2,ASSERT_LINE,current_vector[2]);
1653      timer_set(space->machine, cputag_clocks_to_attotime(space->machine, "maincpu", 16), NULL, 0xeafa00+offset,x68k_fake_bus_error);
1654//      cputag_set_input_line_and_vector(machine, "maincpu",2,ASSERT_LINE,current_vector[2]);
16551655   }
16561656}
16571657
r4593r4594
16611661   current_vector[3] = hd63450_get_vector(device, channel);
16621662   current_irq_line = 3;
16631663   logerror("DMA#%i: DMA End (vector 0x%02x)\n",channel,current_vector[3]);
1664   cpu_set_input_line_and_vector(machine->cpu[0],3,ASSERT_LINE,current_vector[3]);
1664   cputag_set_input_line_and_vector(machine, "maincpu",3,ASSERT_LINE,current_vector[3]);
16651665}
16661666
16671667static void x68k_dma_end(running_machine *machine, int channel,int irq)
r4593r4594
16791679   {
16801680      current_vector[3] = hd63450_get_error_vector(device,channel);
16811681      current_irq_line = 3;
1682      cpu_set_input_line_and_vector(machine->cpu[0],3,ASSERT_LINE,current_vector[3]);
1682      cputag_set_input_line_and_vector(machine, "maincpu",3,ASSERT_LINE,current_vector[3]);
16831683   }
16841684}
16851685
r4593r4594
17151715      return;
17161716//   if((x68k_sys.ioc.irqstatus & 0xc0) != 0)  // if the FDC is busy, then we don't want to miss that IRQ
17171717//      return;
1718   cpu_set_input_line(device->machine->cpu[0], 6, state);
1718   cputag_set_input_line(device->machine, "maincpu", 6, state);
17191719   current_vector[6] = 0;
17201720   prev = state;
17211721}
r4593r4594
17461746      if(current_vector[6] != 0x4b && current_vector[6] != 0x4c)
17471747         current_vector[6] = mc68901_get_vector(x68k_mfp);
17481748      else
1749         cpu_set_input_line_and_vector(device->machine->cpu[0],irqline,CLEAR_LINE,current_vector[irqline]);
1749         cputag_set_input_line_and_vector(device->machine, "maincpu",irqline,CLEAR_LINE,current_vector[irqline]);
17501750      logerror("SYS: IRQ acknowledged (vector=0x%02x, line = %i)\n",current_vector[6],irqline);
17511751      return current_vector[6];
17521752   }
17531753   
1754   cpu_set_input_line_and_vector(device->machine->cpu[0],irqline,CLEAR_LINE,current_vector[irqline]);
1754   cputag_set_input_line_and_vector(device->machine, "maincpu",irqline,CLEAR_LINE,current_vector[irqline]);
17551755   if(irqline == 1)  // IOSC
17561756   {
17571757      x68k_sys.ioc.irqstatus &= ~0xf0;
r4593r4594
22172217         current_vector[1] = 0x61;
22182218         x68k_sys.ioc.irqstatus |= 0x40;
22192219         current_irq_line = 1;
2220         cpu_set_input_line_and_vector(image->machine->cpu[0],1,ASSERT_LINE,current_vector[1]);  // Disk insert/eject interrupt
2220         cputag_set_input_line_and_vector(image->machine, "maincpu",1,ASSERT_LINE,current_vector[1]);  // Disk insert/eject interrupt
22212221         logerror("IOC: Disk image inserted\n");
22222222      }
22232223      x68k_sys.fdc.disk_inserted[image_index_in_device(image)] = 1;
r4593r4594
22342234      current_vector[1] = 0x61;
22352235      x68k_sys.ioc.irqstatus |= 0x40;
22362236      current_irq_line = 1;
2237      cpu_set_input_line_and_vector(image->machine->cpu[0],1,ASSERT_LINE,current_vector[1]);  // Disk insert/eject interrupt
2237      cputag_set_input_line_and_vector(image->machine, "maincpu",1,ASSERT_LINE,current_vector[1]);  // Disk insert/eject interrupt
22382238   }
22392239   x68k_sys.fdc.disk_inserted[image_index_in_device(image)] = 0;
22402240}
r4593r4594
23372337   }
23382338   
23392339   // reset CPU
2340   device_reset(machine->cpu[0]);
2340   device_reset(cputag_get_cpu(machine, "maincpu"));
23412341}
23422342
23432343static MACHINE_START( x68000 )
23442344{
2345   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
2345   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
23462346   /*  Install RAM handlers  */
23472347   x68k_spriteram = (UINT16*)memory_region(machine, "user1");
23482348   memory_install_read16_handler(space,0x000000,mess_ram_size-1,mess_ram_size-1,0,(read16_space_func)1);
r4593r4594
23972397
23982398   mfp_init();
23992399
2400   cpu_set_irq_callback(machine->cpu[0], x68k_int_ack);
2400   cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), x68k_int_ack);
24012401
24022402   // init keyboard
24032403   x68k_sys.keyboard.delay = 500;  // 3*100+200
src/mess/drivers/timex.c
r4593r4594
218218 *******************************************************************/
219219void ts2068_update_memory(running_machine *machine)
220220{
221   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
221   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
222222   unsigned char *ChosenROM, *ExROM, *DOCK;
223223   read8_space_func rh;
224224   write8_space_func wh;
src/mess/drivers/tmc2000e.c
r4593r4594
272272
273273   device_reset(state->cdp1864);
274274
275   cpu_set_input_line(machine->cpu[0], INPUT_LINE_RESET, PULSE_LINE);
275   cputag_set_input_line(machine, CDP1802_TAG, INPUT_LINE_RESET, PULSE_LINE);
276276
277277   // reset program counter to 0xc000
278278}
src/mess/drivers/tmc1800.c
r4593r4594
205205   switch (mess_ram_size)
206206   {
207207   case 4 * 1024:
208      memory_install_readwrite8_handler(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0x0fff, 0, 0x7000, SMH_BANK1, SMH_BANK1);
208      memory_install_readwrite8_handler(cputag_get_address_space(device->machine, CDP1802_TAG, ADDRESS_SPACE_PROGRAM), 0x0000, 0x0fff, 0, 0x7000, SMH_BANK1, SMH_BANK1);
209209      break;
210210
211211   case 16 * 1024:
212      memory_install_readwrite8_handler(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0x3fff, 0, 0x4000, SMH_BANK1, SMH_BANK1);
212      memory_install_readwrite8_handler(cputag_get_address_space(device->machine, CDP1802_TAG, ADDRESS_SPACE_PROGRAM), 0x0000, 0x3fff, 0, 0x4000, SMH_BANK1, SMH_BANK1);
213213      break;
214214
215215   case 32 * 1024:
216      memory_install_readwrite8_handler(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0x7fff, 0, 0, SMH_BANK1, SMH_BANK1);
216      memory_install_readwrite8_handler(cputag_get_address_space(device->machine, CDP1802_TAG, ADDRESS_SPACE_PROGRAM), 0x0000, 0x7fff, 0, 0, SMH_BANK1, SMH_BANK1);
217217      break;
218218   }
219219
r4593r4594
224224   switch (bank)
225225   {
226226   case TMC2000_BANK_MONITOR:
227      memory_install_readwrite8_handler(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0x81ff, 0, 0x7e00, SMH_BANK2, SMH_UNMAP);
227      memory_install_readwrite8_handler(cputag_get_address_space(device->machine, CDP1802_TAG, ADDRESS_SPACE_PROGRAM), 0x8000, 0x81ff, 0, 0x7e00, SMH_BANK2, SMH_UNMAP);
228228      break;
229229
230230   case TMC2000_BANK_COLORRAM: // write-only
231      memory_install_readwrite8_handler(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0x81ff, 0, 0x7e00, SMH_UNMAP, SMH_BANK2);
231      memory_install_readwrite8_handler(cputag_get_address_space(device->machine, CDP1802_TAG, ADDRESS_SPACE_PROGRAM), 0x8000, 0x81ff, 0, 0x7e00, SMH_UNMAP, SMH_BANK2);
232232      break;
233233   }
234234
r4593r4594
243243
244244   memory_set_bank(device->machine, 1, OSCNANO_BANK_RAM);
245245
246   memory_install_readwrite8_handler(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0x0fff, 0, 0x7000, SMH_BANK1, SMH_BANK1);
246   memory_install_readwrite8_handler(cputag_get_address_space(device->machine, CDP1802_TAG, ADDRESS_SPACE_PROGRAM), 0x0000, 0x0fff, 0, 0x7000, SMH_BANK1, SMH_BANK1);
247247
248248   /* write to CDP1864 tone latch */
249249
r4593r4594
802802
803803   memory_set_bank(machine, 1, TMC2000_BANK_ROM);
804804
805   memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0x01ff, 0, 0x7e00, SMH_BANK1, SMH_UNMAP);
805   memory_install_readwrite8_handler(cputag_get_address_space(machine, CDP1802_TAG, ADDRESS_SPACE_PROGRAM), 0x0000, 0x01ff, 0, 0x7e00, SMH_BANK1, SMH_UNMAP);
806806
807807   /* enable monitor */
808808
809809   memory_set_bank(machine, 2, TMC2000_BANK_MONITOR);
810810
811   memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0x81ff, 0, 0x7e00, SMH_BANK2, SMH_UNMAP);
811   memory_install_readwrite8_handler(cputag_get_address_space(machine, CDP1802_TAG, ADDRESS_SPACE_PROGRAM), 0x8000, 0x81ff, 0, 0x7e00, SMH_BANK2, SMH_UNMAP);
812812}
813813
814814// OSCOM Nano
r4593r4594
853853
854854   memory_set_bank(machine, 1, OSCNANO_BANK_ROM);
855855
856   memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x0000, 0x01ff, 0, 0x7e00, SMH_BANK1, SMH_BANK1);
856   memory_install_readwrite8_handler(cputag_get_address_space(machine, CDP1802_TAG, ADDRESS_SPACE_PROGRAM), 0x0000, 0x01ff, 0, 0x7e00, SMH_BANK1, SMH_BANK1);
857857}
858858
859859/* Machine Drivers */
src/mess/drivers/tutor.c
r4593r4594
357357static TIMER_CALLBACK(tape_interrupt_handler)
358358{
359359   //assert(tape_interrupt_enable);
360   cpu_set_input_line(machine->cpu[0], 1, (cassette_input(devtag_get_device(machine, "cassette")) > 0.0) ? ASSERT_LINE : CLEAR_LINE);
360   cputag_set_input_line(machine, "maincpu", 1, (cassette_input(devtag_get_device(machine, "cassette")) > 0.0) ? ASSERT_LINE : CLEAR_LINE);
361361}
362362
363363/* CRU handler */
r4593r4594
393393            else
394394            {
395395               timer_adjust_oneshot(tape_interrupt_timer, attotime_never, 0);
396               cpu_set_input_line(space->machine->cpu[0], 1, CLEAR_LINE);
396               cputag_set_input_line(space->machine, "maincpu", 1, CLEAR_LINE);
397397            }
398398         }
399399         break;
src/mess/drivers/vc4000.c
r4593r4594
193193
194194   if (size > 0x1000)   /* 6k rom + 1k ram - Chess2 only */
195195   {
196      memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1000, 0x15ff, 0, 0, SMH_BANK1);   /* extra rom */
196      memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x1000, 0x15ff, 0, 0, SMH_BANK1);   /* extra rom */
197197      memory_set_bankptr(machine, 1, memory_region(machine, "maincpu") + 0x1000);
198198
199      memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1800, 0x1bff, 0, 0, SMH_BANK3, SMH_BANK4);   /* ram */
199      memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x1800, 0x1bff, 0, 0, SMH_BANK3, SMH_BANK4);   /* ram */
200200      memory_set_bankptr(machine, 3, memory_region(machine, "maincpu") + 0x1800);
201201      memory_set_bankptr(machine, 4, memory_region(machine, "maincpu") + 0x1800);
202202   }
203203   else
204204   if (size > 0x0800)   /* some 4k roms have 1k of mirrored ram */
205205   {
206      memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x1000, 0x15ff, 0, 0x800, SMH_BANK1, SMH_BANK2); /* ram */
206      memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x1000, 0x15ff, 0, 0x800, SMH_BANK1, SMH_BANK2); /* ram */
207207      memory_set_bankptr(machine, 1, memory_region(machine, "maincpu") + 0x1000);
208208      memory_set_bankptr(machine, 2, memory_region(machine, "maincpu") + 0x1000);
209209   }
r4593r4594
259259
260260QUICKLOAD_LOAD(vc4000)
261261{
262   const address_space *space = cpu_get_address_space(image->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
262   const address_space *space = cputag_get_address_space(image->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
263263   int i;
264264   int quick_addr = 0x08c0;
265265   int quick_length;
src/mess/drivers/vtech2.c
r4593r4594
398398
399399static INTERRUPT_GEN( vtech2_interrupt )
400400{
401   cpu_set_input_line(device->machine->cpu[0], 0, HOLD_LINE);
401   cputag_set_input_line(device->machine, "maincpu", 0, HOLD_LINE);
402402}
403403
404404static const cassette_config laser_cassette_config =

Previous 15994 Revisions Next


© 1998-2018 The MESS Team