Previous 15994 Revisions Next

r4593 Thursday 30th April, 2009 at 18:07:57 UTC by Fabio Priuli
A few more number-to-tag conversions in CPU calls
[src/mess/audio]svision.c
[src/mess/drivers]saturn.c scorpion.c sord.c specpls3.c spectrum.c ssystem3.c super80.c svision.c
[src/mess/machine]samcoupe.c sms.c snescart.c special.c spectrum.c svi318.c sym1.c
[src/mess/video]smsvdp.c ssystem3.c

src/mess/audio/svision.c
r4592r4593
3131         svision_dma.size = (data ? data : 0x100) * 32;
3232         break;
3333      case 3:
34         svision_dma.step = cpu_get_clock(space->machine->cpu[0]) / (256.0 * space->machine->sample_rate * (1 + (data & 3)));
34         svision_dma.step = cputag_get_clock(space->machine, "maincpu") / (256.0 * space->machine->sample_rate * (1 + (data & 3)));
3535         svision_dma.right = data & 4;
3636         svision_dma.left = data & 8;
3737         svision_dma.ca14to16 = ((data & 0x70) >> 4) << 14;
r4592r4593
5454   {
5555      case 0:
5656         svision_noise.volume=data&0xf;
57         svision_noise.step= cpu_get_clock(space->machine->cpu[0]) / (256.0*space->machine->sample_rate*(1+(data>>4)));
57         svision_noise.step= cputag_get_clock(space->machine, "maincpu") / (256.0*space->machine->sample_rate*(1+(data>>4)));
5858         break;
5959      case 1:
6060         svision_noise.count = data + 1;
r4592r4593
8686         if (size)
8787         {
8888            //   channel->size=(int)(machine->sample_rate*(size<<5)/4e6);
89            channel->size= (int) (machine->sample_rate * (size << 5) / cpu_get_clock(machine->cpu[0]));
89            channel->size= (int) (machine->sample_rate * (size << 5) / cputag_get_clock(machine, "maincpu"));
9090         }
9191         else
9292         {
r4592r4593
194194         }
195195         else
196196         {
197            sample = memory_read_byte(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM), addr);
197            sample = memory_read_byte(cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM), addr);
198198         }
199199         if (((unsigned)svision_dma.pos) & 1)
200200            s = (sample & 0xf);
src/mess/video/smsvdp.c
r4592r4593
273273   /* Check if we're on the last line of a frame */
274274   if ( vpos == vpos_limit - 1 )
275275   {
276      sms_check_pause_button( cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM) );
276      sms_check_pause_button( cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM) );
277277      return;
278278   }
279279
src/mess/video/ssystem3.c
r4592r4593
2222    ssystem3_lcd.data[ssystem3_lcd.count/8]&=~(1<<(ssystem3_lcd.count&7));
2323    if (data) ssystem3_lcd.data[ssystem3_lcd.count/8]|=1<<(ssystem3_lcd.count&7);
2424    if (ssystem3_lcd.count+1==40) {
25      logerror("%.4x lcd %02x%02x%02x%02x%02x\n",(int)cpu_get_pc(machine->cpu[0]),
25      logerror("%.4x lcd %02x%02x%02x%02x%02x\n",(int)cpu_get_pc(cputag_get_cpu(machine, "maincpu")),
2626          ssystem3_lcd.data[0], ssystem3_lcd.data[1], ssystem3_lcd.data[2], ssystem3_lcd.data[3], ssystem3_lcd.data[4]);
2727    }
2828    ssystem3_lcd.count=(ssystem3_lcd.count+1)%40;
src/mess/machine/spectrum.c
r4592r4593
5757{
5858   /* Hack for correct handling 0xffff interrupt vector */
5959   if (address == 0x0001)
60      if (cpu_get_reg(space->machine->cpu[0], REG_GENPCBASE)==0xffff)
60      if (cpu_get_reg(cputag_get_cpu(space->machine, "maincpu"), REG_GENPCBASE)==0xffff)
6161      {
62         cpu_set_reg(space->machine->cpu[0], Z80_PC, 0xfff4);
62         cpu_set_reg(cputag_get_cpu(space->machine, "maincpu"), Z80_PC, 0xfff4);
6363         return 0xfff4;
6464      }
6565   return address;
r4592r4593
6767
6868MACHINE_RESET( spectrum )
6969{
70   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
70   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
7171   memory_set_direct_update_handler(space, spectrum_direct);
7272}
7373
r4592r4593
104104      spectrum_setup_z80(image->machine, snapshot_data, snapshot_size);
105105   }
106106   free(snapshot_data);
107   //logerror("Snapshot loaded - new PC = %04x\n", (unsigned) cpu_get_reg(machine->cpu[0], Z80_PC) & 0x0ffff);
107   //logerror("Snapshot loaded - new PC = %04x\n", (unsigned) cpu_get_reg(cputag_get_cpu(image->machine, "maincpu"), Z80_PC) & 0x0ffff);
108108   return INIT_PASS;
109109
110110error:
r4592r4593
193193   UINT8 lo, hi, data;
194194   UINT16 offset, size;
195195   UINT16 status;
196   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
196   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
197197
198198   lo = pSnapshot[2] & 0x0ff;
199199   hi = pSnapshot[3] & 0x0ff;
r4592r4593
206206
207207   lo = pSnapshot[6] & 0x0ff;
208208   hi = pSnapshot[7] & 0x0ff;
209   cpu_set_reg(machine->cpu[0], Z80_BC, (hi << 8) | lo);
209   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_BC, (hi << 8) | lo);
210210   lo = pSnapshot[8] & 0x0ff;
211211   hi = pSnapshot[9] & 0x0ff;
212   cpu_set_reg(machine->cpu[0], Z80_DE, (hi << 8) | lo);
212   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_DE, (hi << 8) | lo);
213213   lo = pSnapshot[10] & 0x0ff;
214214   hi = pSnapshot[11] & 0x0ff;
215   cpu_set_reg(machine->cpu[0], Z80_HL, (hi << 8) | lo);
215   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_HL, (hi << 8) | lo);
216216   lo = pSnapshot[12] & 0x0ff;
217217   hi = pSnapshot[13] & 0x0ff;
218   cpu_set_reg(machine->cpu[0], Z80_AF, (hi << 8) | lo);
218   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_AF, (hi << 8) | lo);
219219
220220   lo = pSnapshot[14] & 0x0ff;
221221   hi = pSnapshot[15] & 0x0ff;
222   cpu_set_reg(machine->cpu[0], Z80_IX, (hi << 8) | lo);
222   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IX, (hi << 8) | lo);
223223   lo = pSnapshot[16] & 0x0ff;
224224   hi = pSnapshot[17] & 0x0ff;
225   cpu_set_reg(machine->cpu[0], Z80_IY, (hi << 8) | lo);
225   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IY, (hi << 8) | lo);
226226
227227   lo = pSnapshot[18] & 0x0ff;
228228   hi = pSnapshot[19] & 0x0ff;
229   cpu_set_reg(machine->cpu[0], Z80_BC2, (hi << 8) | lo);
229   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_BC2, (hi << 8) | lo);
230230   lo = pSnapshot[20] & 0x0ff;
231231   hi = pSnapshot[21] & 0x0ff;
232   cpu_set_reg(machine->cpu[0], Z80_DE2, (hi << 8) | lo);
232   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_DE2, (hi << 8) | lo);
233233   lo = pSnapshot[22] & 0x0ff;
234234   hi = pSnapshot[23] & 0x0ff;
235   cpu_set_reg(machine->cpu[0], Z80_HL2, (hi << 8) | lo);
235   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_HL2, (hi << 8) | lo);
236236   lo = pSnapshot[24] & 0x0ff;
237237   hi = pSnapshot[25] & 0x0ff;
238   cpu_set_reg(machine->cpu[0], Z80_AF2, (hi << 8) | lo);
238   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_AF2, (hi << 8) | lo);
239239
240   cpu_set_reg(machine->cpu[0], Z80_R, (pSnapshot[26] & 0x0ff));
241   cpu_set_reg(machine->cpu[0], Z80_I, (pSnapshot[27] & 0x0ff));
240   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_R, (pSnapshot[26] & 0x0ff));
241   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_I, (pSnapshot[27] & 0x0ff));
242242
243243   lo = pSnapshot[28] & 0x0ff;
244244   hi = pSnapshot[29] & 0x0ff;
245   cpu_set_reg(machine->cpu[0], Z80_SP, (hi << 8) | lo);
245   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_SP, (hi << 8) | lo);
246246   lo = pSnapshot[30] & 0x0ff;
247247   hi = pSnapshot[31] & 0x0ff;
248   cpu_set_reg(machine->cpu[0], Z80_PC, (hi << 8) | lo);
248   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_PC, (hi << 8) | lo);
249249
250250   lo = pSnapshot[32] & 0x0ff;
251251   hi = pSnapshot[33] & 0x0ff;
r4592r4593
266266   status = (hi << 8) | lo;
267267
268268   data = (status & 0x01);
269   cpu_set_reg(machine->cpu[0], Z80_IFF1, data);
270   data = (status & 0x04)>>2;
271   cpu_set_reg(machine->cpu[0], Z80_IFF2, data);
269   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IFF1, data);
270   data = (status & 0x04) >> 2;
271   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IFF2, data);
272272
273   data = (status & 0x08)>>3;
273   data = (status & 0x08) >> 3;
274274   if (data)
275      cpu_set_reg(machine->cpu[0], Z80_IM, 0);
275      cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IM, 0);
276276   else
277277   {
278      data = (status & 0x02)>>1;
278      data = (status & 0x02) >> 1;
279279      if (data)
280         cpu_set_reg(machine->cpu[0], Z80_IM, 2);
280         cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IM, 2);
281281      else
282         cpu_set_reg(machine->cpu[0], Z80_IM, 1);
282         cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IM, 1);
283283   }
284284
285   data = (status & 0x10)>>4;
286   cpu_set_input_line(machine->cpu[0], 0, data);
287   cpu_set_input_line(machine->cpu[0], INPUT_LINE_NMI, data);
288   cpu_set_input_line(machine->cpu[0], INPUT_LINE_HALT, 0);
285   data = (status & 0x10) >> 4;
286   cputag_set_input_line(machine, "maincpu", 0, data);
287   cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, data);
288   cputag_set_input_line(machine, "maincpu", INPUT_LINE_HALT, 0);
289289
290290   spectrum_page_basicrom(machine);
291291
r4592r4593
331331   long bank_offset;
332332   unsigned char lo, hi, data;
333333   unsigned short addr;
334   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
334   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
335335
336336   if ((SnapshotSize != 49179) && (spectrum_128_port_7ffd_data == -1))
337337   {
r4592r4593
339339      return;
340340   }
341341
342   cpu_set_reg(machine->cpu[0], Z80_I, (pSnapshot[0] & 0x0ff));
342   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_I, (pSnapshot[0] & 0x0ff));
343343   lo = pSnapshot[1] & 0x0ff;
344344   hi = pSnapshot[2] & 0x0ff;
345   cpu_set_reg(machine->cpu[0], Z80_HL2, (hi << 8) | lo);
345   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_HL2, (hi << 8) | lo);
346346   lo = pSnapshot[3] & 0x0ff;
347347   hi = pSnapshot[4] & 0x0ff;
348   cpu_set_reg(machine->cpu[0], Z80_DE2, (hi << 8) | lo);
348   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_DE2, (hi << 8) | lo);
349349   lo = pSnapshot[5] & 0x0ff;
350350   hi = pSnapshot[6] & 0x0ff;
351   cpu_set_reg(machine->cpu[0], Z80_BC2, (hi << 8) | lo);
351   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_BC2, (hi << 8) | lo);
352352   lo = pSnapshot[7] & 0x0ff;
353353   hi = pSnapshot[8] & 0x0ff;
354   cpu_set_reg(machine->cpu[0], Z80_AF2, (hi << 8) | lo);
354   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_AF2, (hi << 8) | lo);
355355   lo = pSnapshot[9] & 0x0ff;
356356   hi = pSnapshot[10] & 0x0ff;
357   cpu_set_reg(machine->cpu[0], Z80_HL, (hi << 8) | lo);
357   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_HL, (hi << 8) | lo);
358358   lo = pSnapshot[11] & 0x0ff;
359359   hi = pSnapshot[12] & 0x0ff;
360   cpu_set_reg(machine->cpu[0], Z80_DE, (hi << 8) | lo);
360   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_DE, (hi << 8) | lo);
361361   lo = pSnapshot[13] & 0x0ff;
362362   hi = pSnapshot[14] & 0x0ff;
363   cpu_set_reg(machine->cpu[0], Z80_BC, (hi << 8) | lo);
363   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_BC, (hi << 8) | lo);
364364   lo = pSnapshot[15] & 0x0ff;
365365   hi = pSnapshot[16] & 0x0ff;
366   cpu_set_reg(machine->cpu[0], Z80_IY, (hi << 8) | lo);
366   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IY, (hi << 8) | lo);
367367   lo = pSnapshot[17] & 0x0ff;
368368   hi = pSnapshot[18] & 0x0ff;
369   cpu_set_reg(machine->cpu[0], Z80_IX, (hi << 8) | lo);
369   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IX, (hi << 8) | lo);
370370   data = (pSnapshot[19] & 0x04) >> 2;
371   cpu_set_reg(machine->cpu[0], Z80_IFF2, data);
372   cpu_set_reg(machine->cpu[0], Z80_IFF1, data);
371   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IFF2, data);
372   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IFF1, data);
373373   data = (pSnapshot[20] & 0x0ff);
374   cpu_set_reg(machine->cpu[0], Z80_R, data);
374   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_R, data);
375375   lo = pSnapshot[21] & 0x0ff;
376376   hi = pSnapshot[22] & 0x0ff;
377   cpu_set_reg(machine->cpu[0], Z80_AF, (hi << 8) | lo);
377   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_AF, (hi << 8) | lo);
378378   lo = pSnapshot[23] & 0x0ff;
379379   hi = pSnapshot[24] & 0x0ff;
380   cpu_set_reg(machine->cpu[0], Z80_SP, (hi << 8) | lo);
380   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_SP, (hi << 8) | lo);
381381   data = (pSnapshot[25] & 0x0ff);
382   cpu_set_reg(machine->cpu[0], Z80_IM, data);
382   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IM, data);
383383
384384   /* Set border colour */
385385   spectrum_PreviousFE = (spectrum_PreviousFE & 0xf8) | (pSnapshot[26] & 0x07);
r4592r4593
387387   set_last_border_color(pSnapshot[26] & 0x07);
388388   force_border_redraw();
389389
390   cpu_set_input_line(machine->cpu[0], 0, data);
391   cpu_set_input_line(machine->cpu[0], INPUT_LINE_NMI, data);
392   cpu_set_input_line(machine->cpu[0], INPUT_LINE_HALT, 0);
390   cputag_set_input_line(machine, "maincpu", 0, data);
391   cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, data);
392   cputag_set_input_line(machine, "maincpu", INPUT_LINE_HALT, 0);
393393
394394   if (SnapshotSize == 49179)
395395      /* 48K Snapshot */
r4592r4593
410410   if (SnapshotSize == 49179)
411411   {
412412      /* get pc from stack */
413      addr = cpu_get_reg(machine->cpu[0], Z80_SP) & 0xFFFF;
413      addr = cpu_get_reg(cputag_get_cpu(machine, "maincpu"), Z80_SP) & 0xFFFF;
414414
415      cpu_set_reg(machine->cpu[0], Z80_PC,
415      cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_PC,
416416         ((UINT16) memory_read_byte(space,addr + 0) ) >> 8 |
417417         ((UINT16) memory_read_byte(space,addr + 1) ) >> 0);
418418
419419      addr += 2;
420      cpu_set_reg(machine->cpu[0], Z80_SP, (addr & 0x0ffff));
420      cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_SP, (addr & 0x0ffff));
421421
422422
423423   }
r4592r4593
453453      /* program counter */
454454      lo = pSnapshot[49179] & 0x0ff;
455455      hi = pSnapshot[49180] & 0x0ff;
456      cpu_set_reg(machine->cpu[0], Z80_PC, (hi << 8) | lo);
456      cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_PC, (hi << 8) | lo);
457457   }
458458}
459459
r4592r4593
462462{
463463   unsigned char ch;
464464   int i;
465   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
465   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
466466   
467467   do
468468   {
r4592r4593
588588   int i;
589589   unsigned char lo, hi, data;
590590   SPECTRUM_Z80_SNAPSHOT_TYPE z80_type;
591   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
591   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
592592
593593   z80_type = spectrum_identify_z80(pSnapshot, SnapshotSize);
594594
r4592r4593
629629   /* AF */
630630   hi = pSnapshot[0] & 0x0ff;
631631   lo = pSnapshot[1] & 0x0ff;
632   cpu_set_reg(machine->cpu[0], Z80_AF, (hi << 8) | lo);
632   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_AF, (hi << 8) | lo);
633633   /* BC */
634634   lo = pSnapshot[2] & 0x0ff;
635635   hi = pSnapshot[3] & 0x0ff;
636   cpu_set_reg(machine->cpu[0], Z80_BC, (hi << 8) | lo);
636   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_BC, (hi << 8) | lo);
637637   /* HL */
638638   lo = pSnapshot[4] & 0x0ff;
639639   hi = pSnapshot[5] & 0x0ff;
640   cpu_set_reg(machine->cpu[0], Z80_HL, (hi << 8) | lo);
640   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_HL, (hi << 8) | lo);
641641
642642   /* SP */
643643   lo = pSnapshot[8] & 0x0ff;
644644   hi = pSnapshot[9] & 0x0ff;
645   cpu_set_reg(machine->cpu[0], Z80_SP, (hi << 8) | lo);
645   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_SP, (hi << 8) | lo);
646646
647647   /* I */
648   cpu_set_reg(machine->cpu[0], Z80_I, (pSnapshot[10] & 0x0ff));
648   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_I, (pSnapshot[10] & 0x0ff));
649649
650650   /* R */
651651   data = (pSnapshot[11] & 0x07f) | ((pSnapshot[12] & 0x01) << 7);
652   cpu_set_reg(machine->cpu[0], Z80_R, data);
652   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_R, data);
653653
654654   /* Set border colour */
655655   spectrum_PreviousFE = (spectrum_PreviousFE & 0xf8) | ((pSnapshot[12] & 0x0e) >> 1);
r4592r4593
659659
660660   lo = pSnapshot[13] & 0x0ff;
661661   hi = pSnapshot[14] & 0x0ff;
662   cpu_set_reg(machine->cpu[0], Z80_DE, (hi << 8) | lo);
662   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_DE, (hi << 8) | lo);
663663
664664   lo = pSnapshot[15] & 0x0ff;
665665   hi = pSnapshot[16] & 0x0ff;
666   cpu_set_reg(machine->cpu[0], Z80_BC2, (hi << 8) | lo);
666   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_BC2, (hi << 8) | lo);
667667
668668   lo = pSnapshot[17] & 0x0ff;
669669   hi = pSnapshot[18] & 0x0ff;
670   cpu_set_reg(machine->cpu[0], Z80_DE2, (hi << 8) | lo);
670   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_DE2, (hi << 8) | lo);
671671
672672   lo = pSnapshot[19] & 0x0ff;
673673   hi = pSnapshot[20] & 0x0ff;
674   cpu_set_reg(machine->cpu[0], Z80_HL2, (hi << 8) | lo);
674   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_HL2, (hi << 8) | lo);
675675
676676   hi = pSnapshot[21] & 0x0ff;
677677   lo = pSnapshot[22] & 0x0ff;
678   cpu_set_reg(machine->cpu[0], Z80_AF2, (hi << 8) | lo);
678   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_AF2, (hi << 8) | lo);
679679
680680   lo = pSnapshot[23] & 0x0ff;
681681   hi = pSnapshot[24] & 0x0ff;
682   cpu_set_reg(machine->cpu[0], Z80_IY, (hi << 8) | lo);
682   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IY, (hi << 8) | lo);
683683
684684   lo = pSnapshot[25] & 0x0ff;
685685   hi = pSnapshot[26] & 0x0ff;
686   cpu_set_reg(machine->cpu[0], Z80_IX, (hi << 8) | lo);
686   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IX, (hi << 8) | lo);
687687
688688   /* Interrupt Flip/Flop */
689689   if (pSnapshot[27] == 0)
690690   {
691      cpu_set_reg(machine->cpu[0], Z80_IFF1, 0);
692      /* cpu_set_reg(machine->cpu[0], Z80_IRQ_STATE, 0); */
691      cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IFF1, 0);
692      /* cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IRQ_STATE, 0); */
693693   }
694694   else
695695   {
696      cpu_set_reg(machine->cpu[0], Z80_IFF1, 1);
697      /* cpu_set_reg(machine->cpu[0], Z80_IRQ_STATE, 1); */
696      cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IFF1, 1);
697      /* cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IRQ_STATE, 1); */
698698   }
699699
700   cpu_set_input_line(machine->cpu[0], 0, data);
701   cpu_set_input_line(machine->cpu[0], INPUT_LINE_NMI, data);
702   cpu_set_input_line(machine->cpu[0], INPUT_LINE_HALT, 0);
700   cputag_set_input_line(machine, "maincpu", 0, data);
701   cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, data);
702   cputag_set_input_line(machine, "maincpu", INPUT_LINE_HALT, 0);
703703
704704   /* IFF2 */
705705   if (pSnapshot[28] != 0)
r4592r4593
710710   {
711711      data = 0;
712712   }
713   cpu_set_reg(machine->cpu[0], Z80_IFF2, data);
713   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IFF2, data);
714714
715715   /* Interrupt Mode */
716   cpu_set_reg(machine->cpu[0], Z80_IM, (pSnapshot[29] & 0x03));
716   cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IM, (pSnapshot[29] & 0x03));
717717
718718   if (z80_type == SPECTRUM_Z80_SNAPSHOT_48K_OLD)
719719   {
720720      lo = pSnapshot[6] & 0x0ff;
721721      hi = pSnapshot[7] & 0x0ff;
722      cpu_set_reg(machine->cpu[0], Z80_PC, (hi << 8) | lo);
722      cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_PC, (hi << 8) | lo);
723723
724724      spectrum_page_basicrom(machine);
725725
r4592r4593
744744
745745      lo = pSnapshot[32] & 0x0ff;
746746      hi = pSnapshot[33] & 0x0ff;
747      cpu_set_reg(machine->cpu[0], Z80_PC, (hi << 8) | lo);
747      cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_PC, (hi << 8) | lo);
748748
749749      if ((z80_type == SPECTRUM_Z80_SNAPSHOT_128K) || ((z80_type == SPECTRUM_Z80_SNAPSHOT_TS2068) && !strcmp(machine->gamedrv->name,"ts2068")))
750750      {
r4592r4593
857857
858858QUICKLOAD_LOAD(spectrum)
859859{
860   const address_space *space = cpu_get_address_space(image->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
860   const address_space *space = cputag_get_address_space(image->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
861861   int i;
862862   int quick_addr = 0x4000;
863863   int quick_length;
src/mess/machine/sms.c
r4592r4593
368368   }
369369   if ( ! (input_port_read(space->machine, IS_GAMEGEAR ? "START" : "PAUSE") & 0x80) ) {
370370      if ( ! smsPaused ) {
371         cpu_set_input_line(space->machine->cpu[0], INPUT_LINE_NMI, PULSE_LINE );
371         cputag_set_input_line(space->machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE );
372372      }
373373      smsPaused = 1;
374374   }
r4592r4593
11691169
11701170MACHINE_RESET(sms)
11711171{
1172   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
1172   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
11731173
11741174   smsVersion = 0x00;
11751175   if ( HAS_FM )
r4592r4593
12731273   logerror( "0x%04X: sms_store_control write 0x%02X\n", cpu_get_pc(space->cpu), data );
12741274   if ( data & 0x02 )
12751275   {
1276      cpu_resume( space->machine->cpu[0], SUSPEND_REASON_HALT );
1276      cputag_resume( space->machine, "maincpu", SUSPEND_REASON_HALT );
12771277   }
12781278   else
12791279   {
12801280      /* Pull reset line of CPU #0 low */
1281      cpu_suspend( space->machine->cpu[0], SUSPEND_REASON_HALT, 1 );
1282      device_reset(space->machine->cpu[0]);
1281      cputag_suspend( space->machine, "maincpu", SUSPEND_REASON_HALT, 1 );
1282      device_reset(cputag_get_cpu(space->machine, "maincpu"));
12831283   }
12841284   sms_store_control = data;
12851285}
r4592r4593
12871287
12881288void sms_int_callback( running_machine *machine, int state )
12891289{
1290   cpu_set_input_line(machine->cpu[0], 0, state );
1290   cputag_set_input_line(machine, "maincpu", 0, state );
12911291}
12921292
12931293
12941294void sms_store_int_callback( running_machine *machine, int state )
12951295{
1296   cpu_set_input_line(machine->cpu[0], sms_store_control & 0x01 ? 1 : 0, state );
1296   cputag_set_input_line(machine, "maincpu", sms_store_control & 0x01 ? 1 : 0, state );
12971297}
12981298
12991299
r4592r4593
13371337{
13381338   sms_flags = FLAG_REGION_JAPAN | FLAG_GAMEGEAR | FLAG_BIOS_0400;
13391339}
1340
src/mess/machine/samcoupe.c
r4592r4593
164164
165165MACHINE_RESET( samcoupe )
166166{
167   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
168   const address_space *spaceio = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO);
167   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
168   const address_space *spaceio = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_IO);
169169   coupe_asic *asic = machine->driver_data;
170170
171171   asic->lmpr = 0x0f;      /* ROM0 paged in, ROM1 paged out RAM Banks */
src/mess/machine/svi318.c
r4592r4593
6161
6262static INS8250_INTERRUPT( svi318_ins8250_interrupt )
6363{
64   if (svi.bankLow != SVI_CART) {
65      cpu_set_input_line(device->machine->cpu[0], 0, (state ? HOLD_LINE : CLEAR_LINE));
64   if (svi.bankLow != SVI_CART)
65   {
66      cputag_set_input_line(device->machine, "maincpu", 0, (state ? HOLD_LINE : CLEAR_LINE));
6667   }
6768}
6869
r4592r4593
435436      int j;
436437      UINT8   data = svi.svi806_gfx[ svi.svi806_ram[ ( ma + i ) & 0x7FF ] * 16 + ra ];
437438
438      if ( i == cursor_x ) {
439      if ( i == cursor_x )
440      {
439441         data = 0xFF;
440442      }
441443
r4592r4593
506508
507509void svi318_vdp_interrupt(running_machine *machine, int i)
508510{
509   cpu_set_input_line(machine->cpu[0], 0, (i ? HOLD_LINE : CLEAR_LINE));
511   cputag_set_input_line(machine, "maincpu", 0, (i ? HOLD_LINE : CLEAR_LINE));
510512}
511513
512514
r4592r4593
623625DRIVER_INIT( svi318 )
624626{
625627   /* z80 stuff */
626   z80_set_cycle_tables( machine->cpu[0], cc_op, cc_cb, cc_ed, cc_xy, cc_xycb, cc_ex );
628   z80_set_cycle_tables( cputag_get_cpu(machine, "maincpu"), cc_op, cc_cb, cc_ed, cc_xy, cc_xycb, cc_ex );
627629
628630   memset(&svi, 0, sizeof (svi) );
629631
630   if ( ! strcmp( machine->gamedrv->name, "svi318" ) || ! strcmp( machine->gamedrv->name, "svi318n" ) ) {
632   if ( ! strcmp( machine->gamedrv->name, "svi318" ) || ! strcmp( machine->gamedrv->name, "svi318n" ) )
633   {
631634      svi.svi318 = 1;
632635   }
633636
634   cpu_set_input_line_vector(machine->cpu[0], 0, 0xff);
637   cpu_set_input_line_vector(cputag_get_cpu(machine, "maincpu"), 0, 0xff);
635638
636639   /* memory */
637640   svi.empty_bank = auto_malloc (0x8000);
r4592r4593
712715
713716WRITE8_HANDLER( svi318_writemem4 )
714717{
715   if ( svi.svi806_ram_enabled ) {
716      if ( offset < 0x800 ) {
718   if ( svi.svi806_ram_enabled )
719   {
720      if ( offset < 0x800 )
721      {
717722         svi.svi806_ram[ offset ] = data;
718723      }
719   } else {
724   }
725   else
726   {
720727      if ( svi.bankHigh2_read_only )
721728         return;
722729
r4592r4593
734741   svi.bankLow_ptr = svi.empty_bank;
735742   svi.bankLow_read_only = 1;
736743
737   switch( svi.bankLow ) {
744   switch( svi.bankLow )
745   {
738746   case SVI_INTERNAL:
739747      svi.bankLow_ptr = memory_region(machine, "maincpu");
740748      break;
741749   case SVI_CART:
742      if ( pcart ) {
750      if ( pcart )
751      {
743752         svi.bankLow_ptr = pcart;
744753      }
745754      break;
746755   case SVI_EXPRAM2:
747      if ( mess_ram_size >= 64 * 1024 ) {
756      if ( mess_ram_size >= 64 * 1024 )
757      {
748758         svi.bankLow_ptr = mess_ram + mess_ram_size - 64 * 1024;
749759         svi.bankLow_read_only = 0;
750760      }
751761      break;
752762   case SVI_EXPRAM3:
753      if ( mess_ram_size > 128 * 1024 ) {
763      if ( mess_ram_size > 128 * 1024 )
764      {
754765         svi.bankLow_ptr = mess_ram + mess_ram_size - 128 * 1024;
755766         svi.bankLow_read_only = 0;
756767      }
r4592r4593
760771   svi.bankHigh1_ptr = svi.bankHigh2_ptr = svi.empty_bank;
761772   svi.bankHigh1_read_only = svi.bankHigh2_read_only = 1;
762773
763   switch( svi.bankHigh1 ) {
774   switch( svi.bankHigh1 )
775   {
764776   case SVI_INTERNAL:
765      if ( mess_ram_size == 16 * 1024 ) {
777      if ( mess_ram_size == 16 * 1024 )
778      {
766779         svi.bankHigh2_ptr = mess_ram;
767780         svi.bankHigh2_read_only = 0;
768      } else {
781      }
782      else
783      {
769784         svi.bankHigh1_ptr = mess_ram;
770785         svi.bankHigh1_read_only = 0;
771786         svi.bankHigh2_ptr = mess_ram + 0x4000;
r4592r4593
773788      }
774789      break;
775790   case SVI_EXPRAM2:
776      if ( mess_ram_size > 64 * 1024 ) {
791      if ( mess_ram_size > 64 * 1024 )
792      {
777793         svi.bankHigh1_ptr = mess_ram + mess_ram_size - 64 * 1024 + 32 * 1024;
778794         svi.bankHigh1_read_only = 0;
779795         svi.bankHigh2_ptr = mess_ram + mess_ram_size - 64 * 1024 + 48 * 1024;
r4592r4593
781797      }
782798      break;
783799   case SVI_EXPRAM3:
784      if ( mess_ram_size > 128 * 1024 ) {
800      if ( mess_ram_size > 128 * 1024 )
801      {
785802         svi.bankHigh1_ptr = mess_ram + mess_ram_size - 128 * 1024 + 32 * 1024;
786803         svi.bankHigh1_read_only = 0;
787804         svi.bankHigh2_ptr = mess_ram + mess_ram_size - 128 * 1024 + 48 * 1024;
r4592r4593
791808   }
792809
793810   /* Check for special CART based banking */
794   if ( svi.bankLow == SVI_CART && ( v & 0xc0 ) != 0xc0 ) {
811   if ( svi.bankLow == SVI_CART && ( v & 0xc0 ) != 0xc0 )
812   {
795813      svi.bankHigh1_ptr = svi.empty_bank;
796814      svi.bankHigh1_read_only = 1;
797815      svi.bankHigh2_ptr = svi.empty_bank;
798816      svi.bankHigh2_read_only = 1;
799      if ( pcart && ! ( v & 0x80 ) ) {
817      if ( pcart && ! ( v & 0x80 ) )
818      {
800819         svi.bankHigh2_ptr = pcart + 0x4000;
801820      }
802      if ( pcart && ! ( v & 0x40 ) ) {
821      if ( pcart && ! ( v & 0x40 ) )
822      {
803823         svi.bankHigh1_ptr = pcart;
804824      }
805825   }
r4592r4593
809829   memory_set_bankptr(machine, 3, svi.bankHigh2_ptr );
810830
811831   /* SVI-806 80 column card specific banking */
812   if ( svi.svi806_present ) {
813      if ( svi.svi806_ram_enabled ) {
832   if ( svi.svi806_present )
833   {
834      if ( svi.svi806_ram_enabled )
835      {
814836         memory_set_bankptr(machine, 4, svi.svi806_ram );
815      } else {
837      }
838      else
839      {
816840         memory_set_bankptr(machine, 4, svi.bankHigh2_ptr + 0x3000 );
817841      }
818842   }
r4592r4593
837861   const device_config *fdc = devtag_get_device(space->machine, "wd179x");
838862   const device_config *printer = devtag_get_device(space->machine, "centronics");
839863
840   if (svi.bankLow == SVI_CART) {
864   if (svi.bankLow == SVI_CART)
865   {
841866      return 0xff;
842867   }
843868
r4592r4593
899924   const device_config *fdc = devtag_get_device(space->machine, "wd179x");
900925   const device_config *printer = devtag_get_device(space->machine, "centronics");
901926
902   if (svi.bankLow == SVI_CART) {
927   if (svi.bankLow == SVI_CART)
928   {
903929      return;
904930   }
905931
src/mess/machine/sym1.c
r4592r4593
115115
116116static void sym1_riot_a_w(const device_config *device, UINT8 newdata, UINT8 data)
117117{
118   logerror("%x: riot_a_w 0x%02x\n", cpu_get_pc( device->machine->cpu[0] ), data);
118   logerror("%x: riot_a_w 0x%02x\n", cpu_get_pc( cputag_get_cpu(device->machine, "maincpu") ), data);
119119
120120   /* save for later use */
121121   riot_port_a = data;
r4592r4593
124124
125125static void sym1_riot_b_w(const device_config *device, UINT8 newdata, UINT8 data)
126126{
127   logerror("%x: riot_b_w 0x%02x\n", cpu_get_pc( device->machine->cpu[0] ), data);
127   logerror("%x: riot_b_w 0x%02x\n", cpu_get_pc( cputag_get_cpu(device->machine, "maincpu") ), data);
128128
129129   /* save for later use */
130130   riot_port_b = data;
r4592r4593
165165
166166static void sym1_irq(const device_config *device, int level)
167167{
168   cpu_set_input_line(device->machine->cpu[0], M6502_IRQ_LINE, level);
168   cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, level);
169169}
170170
171171
r4592r4593
188188 */
189189static WRITE8_DEVICE_HANDLER( sym1_via2_a_w )
190190{
191   const address_space *cpu0space = cpu_get_address_space( device->machine->cpu[0], ADDRESS_SPACE_PROGRAM );
191   const address_space *cpu0space = cputag_get_address_space( device->machine, "maincpu", ADDRESS_SPACE_PROGRAM );
192192
193193   logerror("SYM1 VIA2 W 0x%02x\n", data);
194194
r4592r4593
271271   /* wipe expansion memory banks that are not installed */
272272   if (mess_ram_size < 4*1024)
273273   {
274      memory_install_readwrite8_handler(cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_PROGRAM ),
274      memory_install_readwrite8_handler(cputag_get_address_space( machine, "maincpu", ADDRESS_SPACE_PROGRAM ),
275275         mess_ram_size, 0x0fff, 0, 0, SMH_NOP, SMH_NOP);
276276   }
277277
r4592r4593
284284{
285285   /* make 0xf800 to 0xffff point to the last half of the monitor ROM
286286      so that the CPU can find its reset vectors */
287   memory_install_readwrite8_handler(cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_PROGRAM ),
287   memory_install_readwrite8_handler(cputag_get_address_space( machine, "maincpu", ADDRESS_SPACE_PROGRAM ),
288288         0xf800, 0xffff, 0, 0, SMH_BANK1, SMH_NOP);
289289   memory_set_bankptr(machine, 1, sym1_monitor + 0x800);
290290   device_reset(cputag_get_cpu(machine, "maincpu"));
src/mess/machine/special.c
r4592r4593
7171   if (input_port_read(device->machine, "LINE12")!=0xff) dat ^= 0x02;
7272     
7373   level = cassette_input(devtag_get_device(device->machine, "cassette"));                                               
74   if (level >=  0) {
74   if (level >=  0)
75   {
7576         dat ^= 0x01;
7677    }     
7778   return dat & 0xff;
r4592r4593
162163
163164static void specimx_set_bank(running_machine *machine, int i,int data)
164165{
165   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);
166167   memory_install_write8_handler(space, 0xc000, 0xffbf, 0, 0, SMH_BANK3);
167168   memory_install_write8_handler(space, 0xffc0, 0xffdf, 0, 0, SMH_BANK4);
168169   memory_set_bankptr(machine, 4, mess_ram + 0xffc0);
169   switch(i) {
170   switch(i)
171   {
170172      case 0 :           
171173            memory_install_write8_handler(space, 0x0000, 0x8fff, 0, 0, SMH_BANK1);
172174            memory_install_write8_handler(space, 0x9000, 0xbfff, 0, 0, video_memory_w);
r4592r4593
189191         
190192            memory_set_bankptr(machine, 1, memory_region(machine, "maincpu") + 0x10000);
191193            memory_set_bankptr(machine, 2, memory_region(machine, "maincpu") + 0x19000);
192           if (data & 0x80) {
194            if (data & 0x80)
195            {
193196               memory_set_bankptr(machine, 3, mess_ram + 0x1c000);               
194            } else {
197            }
198            else
199            {
195200               memory_set_bankptr(machine, 3, mess_ram + 0xc000);               
196201            }
197202            break;
r4592r4593
252257   wd17xx_set_density (fdc,DEN_FM_HI);
253258}
254259
255static TIMER_CALLBACK( setup_pit8253_gates ) {
260static TIMER_CALLBACK( setup_pit8253_gates )
261{
256262   device_config *pit8253 = (device_config*)devtag_get_device(machine, "pit8253");
257263
258264   pit8253_gate_w(pit8253, 0, 0);
r4592r4593
276282{   
277283   const device_config *fdc = devtag_get_device(space->machine, "wd1793");
278284
279   switch(offset) {             
285   switch(offset)
286   {             
280287      case 2 :                 
281288             wd17xx_set_side(fdc,data & 1);                     
282289            break;         
r4592r4593
329336static UINT8 RR_register;
330337static UINT8 RC_register;
331338
332static void erik_set_bank(running_machine *machine) {     
339static void erik_set_bank(running_machine *machine)
340{     
333341   UINT8 bank1 = (RR_register & 3);
334342   UINT8 bank2 = ((RR_register >> 2) & 3);
335343   UINT8 bank3 = ((RR_register >> 4) & 3);
336344   UINT8 bank4 = ((RR_register >> 6) & 3);
337345   UINT8 *mem = memory_region(machine, "maincpu");
338   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);   
346   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);   
339347   
340348   memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_BANK1);
341349   memory_install_write8_handler(space, 0x4000, 0x8fff, 0, 0, SMH_BANK2);
r4592r4593
344352   memory_install_write8_handler(space, 0xf000, 0xf7ff, 0, 0, SMH_BANK5);
345353   memory_install_write8_handler(space, 0xf800, 0xffff, 0, 0, SMH_BANK6);
346354   
347   switch(bank1) {
355   switch(bank1)
356   {
348357      case    1:                   
349358      case    2:
350359      case    3:         
r4592r4593
355364                  memory_set_bankptr(machine, 1, mem + 0x10000);   
356365                  break;
357366   }
358   switch(bank2) {
367   switch(bank2)
368   {
359369      case    1:                   
360370      case    2:
361371      case    3:         
r4592r4593
366376                  memory_set_bankptr(machine, 2, mem + 0x14000);   
367377                  break;
368378   }
369   switch(bank3) {
379   switch(bank3)
380   {
370381      case    1:                                     
371382      case    2:
372383      case    3:         
r4592r4593
377388                  memory_set_bankptr(machine, 3, mem + 0x19000);   
378389                  break;
379390   }
380   switch(bank4) {
391   switch(bank4)
392   {
381393      case    1:                   
382394      case    2:
383395      case    3:         
r4592r4593
435447   erik_background = ((RC_register  >> 6 ) & 1) + ((RC_register  >> 7 ) & 1) * 4;
436448}
437449
438READ8_HANDLER ( erik_disk_reg_r ) {
450READ8_HANDLER ( erik_disk_reg_r )
451{
439452   return 0xff;   
440453}
441454
442WRITE8_HANDLER( erik_disk_reg_w ) {
455WRITE8_HANDLER( erik_disk_reg_w )
456{
443457   const device_config *fdc = devtag_get_device(space->machine, "wd1793");
444458   
445459   wd17xx_set_side (fdc,data & 1);   
446460   wd17xx_set_drive(fdc,(data >> 1) & 1);
447   if((data >>2) & 1) {
461   if((data >>2) & 1)
462   {
448463      wd17xx_set_density (fdc,DEN_FM_LO);
449   } else {
464   }
465   else
466   {
450467      wd17xx_set_density (fdc,DEN_FM_HI);
451468  }   
452469}
src/mess/machine/snescart.c
r4592r4593
337337{
338338   int i, supported_type = 0;
339339   running_machine *machine = image->machine;
340   const address_space *space = cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_PROGRAM );
340   const address_space *space = cputag_get_address_space( machine, "maincpu", ADDRESS_SPACE_PROGRAM );
341341   int total_blocks, read_blocks;
342342   UINT32 offset;
343343   UINT8 header[512];
src/mess/drivers/sord.c
r4592r4593
155155{
156156   if (state)
157157   {
158      cpu_set_input_line(device->machine->cpu[1], 0, HOLD_LINE);
158      cputag_set_input_line(device->machine, "floppy", 0, HOLD_LINE);
159159   }
160160   else
161161   {
162      cpu_set_input_line(device->machine->cpu[1], 0,CLEAR_LINE);
162      cputag_set_input_line(device->machine, "floppy", 0,CLEAR_LINE);
163163   }
164164}
165165
r4592r4593
190190
191191static READ8_DEVICE_HANDLER(sord_ppi_porta_r)
192192{
193   cpu_yield(device->machine->cpu[0]);
193   cpu_yield(cputag_get_cpu(device->machine, "maincpu"));
194194
195195   return fd5_databus;
196196}
197197
198198static READ8_DEVICE_HANDLER(sord_ppi_portb_r)
199199{
200   cpu_yield(device->machine->cpu[0]);
200   cpu_yield(cputag_get_cpu(device->machine, "maincpu"));
201201
202   LOG(("m5 read from pi5 port b %04x\n",cpu_get_pc(device->machine->cpu[0])));
202   LOG(("m5 read from pi5 port b %04x\n", cpu_get_pc(cputag_get_cpu(device->machine, "maincpu"))));
203203
204204   return 0x0ff;
205205}
206206
207207static READ8_DEVICE_HANDLER(sord_ppi_portc_r)
208208{
209   cpu_yield(device->machine->cpu[0]);
209   cpu_yield(cputag_get_cpu(device->machine, "maincpu"));
210210
211   LOG(("m5 read from pi5 port c %04x\n",cpu_get_pc(device->machine->cpu[0])));
211   LOG(("m5 read from pi5 port c %04x\n", cpu_get_pc(cputag_get_cpu(device->machine, "maincpu"))));
212212
213213/* from fd5 */
214214/* 00 = 0000 = write */
r4592r4593
237237
238238static WRITE8_DEVICE_HANDLER(sord_ppi_porta_w)
239239{
240   cpu_yield(device->machine->cpu[0]);
240   cpu_yield(cputag_get_cpu(device->machine, "maincpu"));
241241
242242   fd5_databus = data;
243243}
244244
245245static WRITE8_DEVICE_HANDLER(sord_ppi_portb_w)
246246{
247   cpu_yield(device->machine->cpu[0]);
247   cpu_yield(cputag_get_cpu(device->machine, "maincpu"));
248248
249249   /* f0, 40 */
250250   /* 1111 */
251251   /* 0100 */
252252
253   if (data==0x0f0)
253   if (data == 0x0f0)
254254   {
255      cpu_set_input_line(device->machine->cpu[1], INPUT_LINE_RESET, ASSERT_LINE);
256      cpu_set_input_line(device->machine->cpu[1], INPUT_LINE_RESET, CLEAR_LINE);
255      cputag_set_input_line(device->machine, "floppy", INPUT_LINE_RESET, ASSERT_LINE);
256      cputag_set_input_line(device->machine, "floppy", INPUT_LINE_RESET, CLEAR_LINE);
257257   }
258   LOG(("m5 write to pi5 port b: %02x %04x\n",data,cpu_get_pc(device->machine->cpu[0])));
258   LOG(("m5 write to pi5 port b: %02x %04x\n", data, cpu_get_pc(cputag_get_cpu(device->machine, "maincpu"))));
259259}
260260
261261/* A,  B,  C,  D,  E,   F,  G,  H,  I,  J, K,  L,  M,   N, O, P, Q, R,   */
r4592r4593
270270   intra = (data & 0x08) ? 1 : 0;
271271   ibfa = (data & 0x20) ? 1 : 0;
272272
273   cpu_yield(device->machine->cpu[0]);
274   LOG(("m5 write to pi5 port c: %02x %04x\n",data,cpu_get_pc(device->machine->cpu[0])));
273   cpu_yield(cputag_get_cpu(device->machine, "maincpu"));
274   LOG(("m5 write to pi5 port c: %02x %04x\n", data, cpu_get_pc(cputag_get_cpu(device->machine, "maincpu"))));
275275}
276276
277277static const ppi8255_interface sord_ppi8255_interface =
r4592r4593
290290static void sord_m5_ctc_interrupt(const device_config *device, int state)
291291{
292292   //logerror("interrupting ctc %02x\r\n ",state);
293   cpu_set_input_line(device->machine->cpu[0], 0, state);
293   cputag_set_input_line(device->machine, "maincpu", 0, state);
294294}
295295
296296static const z80ctc_interface   sord_m5_ctc_intf =
r4592r4593
572572static INTERRUPT_GEN( sord_interrupt )
573573{
574574   if (TMS9928A_interrupt(device->machine))
575      cpu_set_input_line(device->machine->cpu[0], 0, HOLD_LINE);
575      cputag_set_input_line(device->machine, "maincpu", 0, HOLD_LINE);
576576}
577577
578578static const cassette_config sordm5_cassette_config =
src/mess/drivers/scorpion.c
r4592r4593
193193
194194static void scorpion_update_memory(running_machine *machine)
195195{
196   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
196   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
197197   spectrum_screen_location = mess_ram + ((spectrum_128_port_7ffd_data & 8) ? (7<<14) : (5<<14));
198198
199199   memory_set_bankptr(machine, 4, mess_ram + (((spectrum_128_port_7ffd_data & 0x07) | ((scorpion_256_port_1ffd_data & 0x10)>>1)) * 0x4000));
r4592r4593
209209      if ((scorpion_256_port_1ffd_data & 0x02)==0x02)
210210      {
211211         ROMSelection = 2;         
212      } else {
212      }
213      else
214      {
213215         ROMSelection = ((spectrum_128_port_7ffd_data>>4) & 0x01) ? 1 : 0;
214216      }         
215217      memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP);
r4592r4593
221223
222224static DIRECT_UPDATE_HANDLER( scorpion_direct )
223225{   
224   UINT16 pc = cpu_get_reg(space->machine->cpu[0], REG_GENPCBASE);
225   if (betadisk_is_active()) {
226      if (pc >= 0x4000) {
226   UINT16 pc = cpu_get_reg(cputag_get_cpu(space->machine, "maincpu"), REG_GENPCBASE);
227   if (betadisk_is_active())
228   {
229      if (pc >= 0x4000)
230      {
227231         ROMSelection = ((spectrum_128_port_7ffd_data>>4) & 0x01) ? 1 : 0;
228232         betadisk_disable();
229233         memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP);
r4592r4593
235239      betadisk_enable();
236240     
237241   }
238   if((address>=0x0000) && (address<=0x3fff)) {
242   if((address>=0x0000) && (address<=0x3fff))
243   {
239244      memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP);
240245      direct->raw = direct->decrypted =  memory_region(space->machine, "maincpu") + 0x010000 + (ROMSelection<<14);
241246      memory_set_bankptr(space->machine, 1, direct->raw);
r4592r4593
246251
247252static TIMER_CALLBACK(nmi_check_callback)
248253{
249   if ((input_port_read(machine, "NMI") & 1)==1) {
254   if ((input_port_read(machine, "NMI") & 1)==1)
255   {
250256      scorpion_256_port_1ffd_data |= 0x02;
251257      scorpion_update_memory(machine);
252      cpu_set_input_line(machine->cpu[0], INPUT_LINE_NMI, PULSE_LINE);
258      cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE);
253259   }
254260}
255261
r4592r4593
293299
294300static MACHINE_RESET( scorpion )
295301{   
296   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);   
302   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);   
297303   
298304   memory_install_read8_handler (space, 0x0000, 0x3fff, 0, 0, SMH_BANK1);
299305   
src/mess/drivers/specpls3.c
r4592r4593
210210
211211void spectrum_plus3_update_memory(running_machine *machine)
212212{
213   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
213   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
214214   
215215   if (spectrum_128_port_7ffd_data & 8)
216216   {
217217         logerror("+3 SCREEN 1: BLOCK 7\n");
218         spectrum_screen_location = mess_ram + (7<<14);
218         spectrum_screen_location = mess_ram + (7 << 14);
219219   }
220220   else
221221   {
222222         logerror("+3 SCREEN 0: BLOCK 5\n");
223         spectrum_screen_location = mess_ram + (5<<14);
223         spectrum_screen_location = mess_ram + (5 << 14);
224224   }
225225
226   if ((spectrum_plus3_port_1ffd_data & 0x01)==0)
226   if ((spectrum_plus3_port_1ffd_data & 0x01) == 0)
227227   {
228228         int ram_page;
229229         unsigned char *ram_data;
r4592r4593
238238
239239         memory_set_bankptr(machine, 4, ram_data);
240240
241         logerror("RAM at 0xc000: %02x\n",ram_page);
241         logerror("RAM at 0xc000: %02x\n", ram_page);
242242
243243         /* Reset memory between 0x4000 - 0xbfff in case extended paging was being used */
244244         /* Bank 5 in 0x4000 - 0x7fff */
245         memory_set_bankptr(machine, 2, mess_ram + (5<<14));
245         memory_set_bankptr(machine, 2, mess_ram + (5 << 14));
246246
247247         /* Bank 2 in 0x8000 - 0xbfff */
248         memory_set_bankptr(machine, 3, mess_ram + (2<<14));
248         memory_set_bankptr(machine, 3, mess_ram + (2 << 14));
249249
250250
251         ROMSelection = ((spectrum_128_port_7ffd_data>>4) & 0x01) |
252            ((spectrum_plus3_port_1ffd_data>>1) & 0x02);
251         ROMSelection = ((spectrum_128_port_7ffd_data >> 4) & 0x01) |
252            ((spectrum_plus3_port_1ffd_data >> 1) & 0x02);
253253
254254         /* rom 0 is editor, rom 1 is syntax, rom 2 is DOS, rom 3 is 48 BASIC */
255255
256         ChosenROM = memory_region(machine, "maincpu") + 0x010000 + (ROMSelection<<14);
256         ChosenROM = memory_region(machine, "maincpu") + 0x010000 + (ROMSelection << 14);
257257
258258         memory_set_bankptr(machine, 1, ChosenROM);
259259         memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP);
r4592r4593
268268         int MemorySelection;
269269         unsigned char *ram_data;
270270
271         MemorySelection = (spectrum_plus3_port_1ffd_data>>1) & 0x03;
271         MemorySelection = (spectrum_plus3_port_1ffd_data >> 1) & 0x03;
272272
273         memory_selection = &spectrum_plus3_memory_selections[(MemorySelection<<2)];
273         memory_selection = &spectrum_plus3_memory_selections[(MemorySelection << 2)];
274274
275         ram_data = mess_ram + (memory_selection[0]<<14);
275         ram_data = mess_ram + (memory_selection[0] << 14);
276276         memory_set_bankptr(machine, 1, ram_data);
277277         /* allow writes to 0x0000-0x03fff */
278278         memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_BANK1);
279279
280         ram_data = mess_ram + (memory_selection[1]<<14);
280         ram_data = mess_ram + (memory_selection[1] << 14);
281281         memory_set_bankptr(machine, 2, ram_data);
282282
283         ram_data = mess_ram + (memory_selection[2]<<14);
283         ram_data = mess_ram + (memory_selection[2] << 14);
284284         memory_set_bankptr(machine, 3, ram_data);
285285
286         ram_data = mess_ram + (memory_selection[3]<<14);
286         ram_data = mess_ram + (memory_selection[3] << 14);
287287         memory_set_bankptr(machine, 4, ram_data);
288288
289         logerror("extended memory paging: %02x\n",MemorySelection);
289         logerror("extended memory paging: %02x\n", MemorySelection);
290290      }
291291}
292292
src/mess/drivers/spectrum.c
r4592r4593
180180   if ((Changed & 0x07)!=0)
181181   {
182182      /* yes - send event */
183      EventList_AddItemOffset(space->machine, 0x0fe, data & 0x07, cpu_attotime_to_clocks(space->machine->cpu[0],attotime_mul(video_screen_get_scan_period(space->machine->primary_screen), video_screen_get_vpos(space->machine->primary_screen))));
183      EventList_AddItemOffset(space->machine, 0x0fe, data & 0x07, cputag_attotime_to_clocks(space->machine, "maincpu", attotime_mul(video_screen_get_scan_period(space->machine->primary_screen), video_screen_get_vpos(space->machine->primary_screen))));
184184   }
185185
186186   if ((Changed & (1<<4))!=0)
src/mess/drivers/super80.c
r4592r4593
625625   if (!go_fast)
626626   {
627627      if (!int_sw)
628         cpu_set_input_line(machine->cpu[0], INPUT_LINE_HALT, ASSERT_LINE);   // if going, stop it
628         cputag_set_input_line(machine, "maincpu", INPUT_LINE_HALT, ASSERT_LINE);   // if going, stop it
629629
630630      int_sw++;
631631      if (int_sw > 1)
632632      {
633         cpu_set_input_line(machine->cpu[0], INPUT_LINE_HALT, CLEAR_LINE);      // if stopped, start it
633         cputag_set_input_line(machine, "maincpu", INPUT_LINE_HALT, CLEAR_LINE);      // if stopped, start it
634634         int_sw = 0;
635635      }
636636   }
r4592r4593
638638   {
639639      if (int_sw < 8)                        // @2MHz, reset just once
640640      {
641         cpu_set_input_line(machine->cpu[0], INPUT_LINE_HALT, CLEAR_LINE);
641         cputag_set_input_line(machine, "maincpu", INPUT_LINE_HALT, CLEAR_LINE);
642642         int_sw = 8;                     // ...not every time
643643      }
644644   }
r4592r4593
916916COMP( 1981, super80m, super80, 0, super80m, super80m, super80d, 0, "Dick Smith Electronics","Super-80 (8R0)" , 0)
917917COMP( 1981, super80r, super80, 0, super80r, super80r, super80v, 0, "Dick Smith Electronics","Super-80 (with VDUEB)" , 0)
918918COMP( 1981, super80v, super80, 0, super80v, super80v, super80v, 0, "Dick Smith Electronics","Super-80 (with enhanced VDUEB)" , 0)
919
src/mess/drivers/saturn.c
r4592r4593
261261
262262/*A-Bus IRQ checks,where they could be located these?*/
263263#define ABUSIRQ(_irq_,_vector_) \
264   { cpu_set_input_line_and_vector(device->machine->cpu[0], _irq_, HOLD_LINE , _vector_); }
264   { cputag_set_input_line_and_vector(device->machine, "maincpu", _irq_, HOLD_LINE , _vector_); }
265265#if 0
266266if(stv_scu[42] & 1)//IRQ ACK
267267{
r4592r4593
586586         intback_stage = 2;
587587      }
588588      smpc_intbackhelper(machine);
589      cpu_set_input_line_and_vector(machine->cpu[0], 8, HOLD_LINE , 0x47);
589      cputag_set_input_line_and_vector(machine, "maincpu", 8, HOLD_LINE , 0x47);
590590   }
591591
592592   if ((offset == 1) && (data & 0x40))
r4592r4593
629629         if(!(stv_scu[40] & 0x0100)) /*Pad irq*/
630630         {
631631            if(LOG_SMPC) logerror ("Interrupt: PAD irq, Vector 0x48 Level 0x08\n");
632            cpu_set_input_line_and_vector(machine->cpu[0], 8, HOLD_LINE , 0x48);
632            cputag_set_input_line_and_vector(machine, "maincpu", 8, HOLD_LINE , 0x48);
633633         }
634634   }
635635
r4592r4593
646646            if(LOG_SMPC) logerror ("SMPC: Slave ON\n");
647647            smpc_ram[0x5f]=0x02;
648648            stv_enable_slave_sh2 = 1;
649            cpu_set_input_line(machine->cpu[1], INPUT_LINE_RESET, CLEAR_LINE);
649            cputag_set_input_line(machine, "slave", INPUT_LINE_RESET, CLEAR_LINE);
650650            break;
651651         case 0x03:
652652            if(LOG_SMPC) logerror ("SMPC: Slave OFF\n");
653653            smpc_ram[0x5f]=0x03;
654654            stv_enable_slave_sh2 = 0;
655655            cpuexec_trigger(machine, 1000);
656            cpu_set_input_line(machine->cpu[1], INPUT_LINE_RESET, ASSERT_LINE);
656            cputag_set_input_line(machine, "slave", INPUT_LINE_RESET, ASSERT_LINE);
657657            break;
658658         case 0x06:
659659            if(LOG_SMPC) logerror ("SMPC: Sound ON\n");
660660            /* wrong? */
661661            smpc_ram[0x5f]=0x06;
662            cpu_set_input_line(machine->cpu[2], INPUT_LINE_RESET, CLEAR_LINE);
662            cputag_set_input_line(machine, "audiocpu", INPUT_LINE_RESET, CLEAR_LINE);
663663            en_68k = 1;
664664            break;
665665         case 0x07:
666666            if(LOG_SMPC) logerror ("SMPC: Sound OFF\n");
667            cpu_set_input_line(machine->cpu[2], INPUT_LINE_RESET, ASSERT_LINE);
667            cputag_set_input_line(machine, "audiocpu", INPUT_LINE_RESET, ASSERT_LINE);
668668            en_68k = 0;
669669            smpc_ram[0x5f]=0x07;
670670            break;
r4592r4593
674674         case 0x0d:
675675            if(LOG_SMPC) logerror ("SMPC: System Reset\n");
676676            smpc_ram[0x5f]=0x0d;
677            cpu_set_input_line(machine->cpu[0], INPUT_LINE_RESET, PULSE_LINE);
677            cputag_set_input_line(machine, "maincpu", INPUT_LINE_RESET, PULSE_LINE);
678678            system_reset();
679679            break;
680680         case 0x0e:
681681            if(LOG_SMPC) logerror ("SMPC: Change Clock to 352\n");
682682            smpc_ram[0x5f]=0x0e;
683            cpu_set_clock(machine->cpu[0], MASTER_CLOCK_352/2);
684            cpu_set_clock(machine->cpu[1], MASTER_CLOCK_352/2);
685            cpu_set_clock(machine->cpu[2], MASTER_CLOCK_352/5);
686            cpu_set_input_line(machine->cpu[0], INPUT_LINE_NMI, PULSE_LINE); // ff said this causes nmi, should we set a timer then nmi?
683            cputag_set_clock(machine, "maincpu", MASTER_CLOCK_352/2);
684            cputag_set_clock(machine, "slave", MASTER_CLOCK_352/2);
685            cputag_set_clock(machine, "audiocpu", MASTER_CLOCK_352/5);
686            cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE); // ff said this causes nmi, should we set a timer then nmi?
687687            break;
688688         case 0x0f:
689689            if(LOG_SMPC) logerror ("SMPC: Change Clock to 320\n");
690690            smpc_ram[0x5f]=0x0f;
691            cpu_set_clock(machine->cpu[0], MASTER_CLOCK_320/2);
692            cpu_set_clock(machine->cpu[1], MASTER_CLOCK_320/2);
693            cpu_set_clock(machine->cpu[2], MASTER_CLOCK_320/5);
694            cpu_set_input_line(machine->cpu[0], INPUT_LINE_NMI, PULSE_LINE); // ff said this causes nmi, should we set a timer then nmi?
691            cputag_set_clock(machine, "maincpu", MASTER_CLOCK_320/2);
692            cputag_set_clock(machine, "slave", MASTER_CLOCK_320/2);
693            cputag_set_clock(machine, "audiocpu", MASTER_CLOCK_320/5);
694            cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE); // ff said this causes nmi, should we set a timer then nmi?
695695            break;
696696         /*"Interrupt Back"*/
697697         case 0x10:
r4592r4593
743743            {
744744//                  if(LOG_SMPC) logerror ("Interrupt: System Manager (SMPC) at scanline %04x, Vector 0x47 Level 0x08\n",scanline);
745745               smpc_intbackhelper(machine);
746               cpu_set_input_line_and_vector(machine->cpu[0], 8, HOLD_LINE , 0x47);
746               cputag_set_input_line_and_vector(machine, "maincpu", 8, HOLD_LINE , 0x47);
747747            }
748748         break;
749749         /* RTC write*/
r4592r4593
772772            if(LOG_SMPC) logerror ("SMPC: NMI request\n");
773773            smpc_ram[0x5f]=0x18;
774774            /*NMI is unconditionally requested?*/
775            cpu_set_input_line(machine->cpu[0], INPUT_LINE_NMI, PULSE_LINE);
775            cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE);
776776            break;
777777         case 0x19:
778778            if(LOG_SMPC) logerror ("SMPC: NMI Enable\n");
r4592r4593
10621062         /*Sound IRQ*/
10631063         if(/*(!(stv_scu[40] & 0x40)) &&*/ scsp_to_main_irq == 1)
10641064         {
1065            //cpu_set_input_line_and_vector(space->machine->cpu[0], 9, HOLD_LINE , 0x46);
1065            //cputag_set_input_line_and_vector(space->machine, "maincpu", 9, HOLD_LINE , 0x46);
10661066            logerror("SCSP: Main CPU interrupt\n");
10671067            #if 0
10681068            if((scu_dst_0 & 0x7ffffff) != 0x05a00000)
10691069            {
10701070               if(!(stv_scu[40] & 0x1000))
10711071               {
1072                  cpu_set_input_line_and_vector(space->machine->cpu[0], 3, HOLD_LINE, 0x4c);
1072                  cputag_set_input_line_and_vector(space->machine, "maincpu", 3, HOLD_LINE, 0x4c);
10731073                  logerror("SCU: Illegal DMA interrupt\n");
10741074               }
10751075            }
r4592r4593
11231123         /*Sound IRQ*/
11241124         if(/*(!(stv_scu[40] & 0x40)) &&*/ scsp_to_main_irq == 1)
11251125         {
1126            //cpu_set_input_line_and_vector(space->machine->cpu[0], 9, HOLD_LINE , 0x46);
1126            //cputag_set_input_line_and_vector(space->machine, "maincpu", 9, HOLD_LINE , 0x46);
11271127            logerror("SCSP: Main CPU interrupt\n");
11281128         }
11291129      }
r4592r4593
11731173         /*Sound IRQ*/
11741174         if(/*(!(stv_scu[40] & 0x40)) &&*/ scsp_to_main_irq == 1)
11751175         {
1176            //cpu_set_input_line_and_vector(space->machine->cpu[0], 9, HOLD_LINE , 0x46);
1176            //cputag_set_input_line_and_vector(space->machine, "maincpu", 9, HOLD_LINE , 0x46);
11771177            logerror("SCSP: Main CPU interrupt\n");
11781178         }
11791179      }
r4592r4593
12901290/*Lv 0 DMA end irq*/
12911291static TIMER_CALLBACK( dma_lv0_ended )
12921292{
1293   cpu_set_input_line_and_vector(machine->cpu[0], 5, (stv_irq.dma_end[0]) ? HOLD_LINE : CLEAR_LINE, 0x4b);
1293   cputag_set_input_line_and_vector(machine, "maincpu", 5, (stv_irq.dma_end[0]) ? HOLD_LINE : CLEAR_LINE, 0x4b);
12941294
12951295   D0MV_0;
12961296}
r4592r4593
12981298/*Lv 1 DMA end irq*/
12991299static TIMER_CALLBACK( dma_lv1_ended )
13001300{
1301   cpu_set_input_line_and_vector(machine->cpu[0], 6, (stv_irq.dma_end[1]) ? HOLD_LINE : CLEAR_LINE, 0x4a);
1301   cputag_set_input_line_and_vector(machine, "maincpu", 6, (stv_irq.dma_end[1]) ? HOLD_LINE : CLEAR_LINE, 0x4a);
13021302
13031303   D1MV_0;
13041304}
r4592r4593
13061306/*Lv 2 DMA end irq*/
13071307static TIMER_CALLBACK( dma_lv2_ended )
13081308{
1309   cpu_set_input_line_and_vector(machine->cpu[0], 6, (stv_irq.dma_end[2]) ? HOLD_LINE : CLEAR_LINE, 0x49);
1309   cputag_set_input_line_and_vector(machine, "maincpu", 6, (stv_irq.dma_end[2]) ? HOLD_LINE : CLEAR_LINE, 0x49);
13101310
13111311   D2MV_0;
13121312}
r4592r4593
18671867   logerror("cpu %s (PC=%08X) MINIT write = %08x\n", space->cpu->tag, cpu_get_pc(space->cpu),data);
18681868   cpuexec_boost_interleave(space->machine, minit_boost_timeslice, ATTOTIME_IN_USEC(minit_boost));
18691869   cpuexec_trigger(space->machine, 1000);
1870   sh2_set_frt_input(space->machine->cpu[1], PULSE_LINE);
1870   sh2_set_frt_input(cputag_get_cpu(space->machine, "slave"), PULSE_LINE);
18711871}
18721872
18731873static WRITE32_HANDLER( sinit_w )
18741874{
18751875   logerror("cpu %s (PC=%08X) SINIT write = %08x\n", space->cpu->tag, cpu_get_pc(space->cpu),data);
18761876   cpuexec_boost_interleave(space->machine, sinit_boost_timeslice, ATTOTIME_IN_USEC(sinit_boost));
1877   sh2_set_frt_input(space->machine->cpu[0], PULSE_LINE);
1877   sh2_set_frt_input(cputag_get_cpu(space->machine, "maincpu"), PULSE_LINE);
18781878}
18791879
18801880static UINT32 backup[64*1024/4];
r4592r4593
20672067timer_0 = 0; \
20682068{ \
20692069   /*if(LOG_IRQ) logerror ("Interrupt: VBlank-OUT Vector 0x41 Level 0x0e\n");*/ \
2070   cpu_set_input_line_and_vector(machine->cpu[0], 0xe, (stv_irq.vblank_out) ? HOLD_LINE : CLEAR_LINE , 0x41); \
2070   cputag_set_input_line_and_vector(machine, "maincpu", 0xe, (stv_irq.vblank_out) ? HOLD_LINE : CLEAR_LINE , 0x41); \
20712071} \
20722072
20732073#define VBLANK_IN_IRQ \
20742074{ \
20752075   /*if(LOG_IRQ) logerror ("Interrupt: VBlank IN Vector 0x40 Level 0x0f\n");*/ \
2076   cpu_set_input_line_and_vector(device->machine->cpu[0], 0xf, (stv_irq.vblank_in) ? HOLD_LINE : CLEAR_LINE , 0x40); \
2076   cputag_set_input_line_and_vector(device->machine, "maincpu", 0xf, (stv_irq.vblank_in) ? HOLD_LINE : CLEAR_LINE , 0x40); \
20772077} \
20782078
20792079#define HBLANK_IN_IRQ \
20802080timer_1 = stv_scu[37] & 0x1ff; \
20812081{ \
20822082   /*if(LOG_IRQ) logerror ("Interrupt: HBlank-In at scanline %04x, Vector 0x42 Level 0x0d\n",scanline);*/ \
2083   cpu_set_input_line_and_vector(machine->cpu[0], 0xd, (stv_irq.hblank_in) ? HOLD_LINE : CLEAR_LINE, 0x42); \
2083   cputag_set_input_line_and_vector(machine, "maincpu", 0xd, (stv_irq.hblank_in) ? HOLD_LINE : CLEAR_LINE, 0x42); \
20842084} \
20852085
20862086#define TIMER_0_IRQ \
20872087if(timer_0 == (stv_scu[36] & 0x3ff)) \
20882088{ \
20892089   /*if(LOG_IRQ) logerror ("Interrupt: Timer 0 at scanline %04x, Vector 0x43 Level 0x0c\n",scanline);*/ \
2090   cpu_set_input_line_and_vector(machine->cpu[0], 0xc, (stv_irq.timer_0) ? HOLD_LINE : CLEAR_LINE, 0x43 ); \
2090   cputag_set_input_line_and_vector(machine, "maincpu", 0xc, (stv_irq.timer_0) ? HOLD_LINE : CLEAR_LINE, 0x43 ); \
20912091} \
20922092
20932093#define TIMER_1_IRQ   \
r4592r4593
20962096   if(!(stv_scu[38] & 0x80)) \
20972097   { \
20982098      /*if(LOG_IRQ) logerror ("Interrupt: Timer 1 at point %04x, Vector 0x44 Level 0x0b\n",point);*/ \
2099      cpu_set_input_line_and_vector(machine->cpu[0], 0xb, (stv_irq.timer_1) ? HOLD_LINE : CLEAR_LINE, 0x44 ); \
2099      cputag_set_input_line_and_vector(machine, "maincpu", 0xb, (stv_irq.timer_1) ? HOLD_LINE : CLEAR_LINE, 0x44 ); \
21002100   } \
21012101   else \
21022102   { \
21032103      if((timer_0) == (stv_scu[36] & 0x3ff)) \
21042104      { \
21052105         /*if(LOG_IRQ) logerror ("Interrupt: Timer 1 at point %04x, Vector 0x44 Level 0x0b\n",point);*/ \
2106         cpu_set_input_line_and_vector(machine->cpu[0], 0xb, (stv_irq.timer_1) ? HOLD_LINE : CLEAR_LINE, 0x44 ); \
2106         cputag_set_input_line_and_vector(machine, "maincpu", 0xb, (stv_irq.timer_1) ? HOLD_LINE : CLEAR_LINE, 0x44 ); \
21072107      } \
21082108   } \
21092109} \
21102110
21112111#define VDP1_IRQ \
21122112{ \
2113   cpu_set_input_line_and_vector(machine->cpu[0], 2, (stv_irq.vdp1_end) ? HOLD_LINE : CLEAR_LINE, 0x4d); \
2113   cputag_set_input_line_and_vector(machine, "maincpu", 2, (stv_irq.vdp1_end) ? HOLD_LINE : CLEAR_LINE, 0x4d); \
21142114} \
21152115
21162116static TIMER_CALLBACK( hblank_in_irq )
r4592r4593
21902190   saturn_region = rgn;
21912191
21922192   // set compatible options
2193   sh2drc_set_options(machine->cpu[0], SH2DRC_STRICT_VERIFY|SH2DRC_STRICT_PCREL);
2194   sh2drc_set_options(machine->cpu[1], SH2DRC_STRICT_VERIFY|SH2DRC_STRICT_PCREL);
2193   sh2drc_set_options(cputag_get_cpu(machine, "maincpu"), SH2DRC_STRICT_VERIFY|SH2DRC_STRICT_PCREL);
2194   sh2drc_set_options(cputag_get_cpu(machine, "slave"), SH2DRC_STRICT_VERIFY|SH2DRC_STRICT_PCREL);
21952195
21962196   /* get the current date/time from the core */
21972197   mame_get_current_datetime(machine, &systime);
r4592r4593
22712271static MACHINE_RESET( saturn )
22722272{
22732273   // don't let the slave cpu and the 68k go anywhere
2274   cpu_set_input_line(machine->cpu[1], INPUT_LINE_RESET, ASSERT_LINE);
2274   cputag_set_input_line(machine, "slave", INPUT_LINE_RESET, ASSERT_LINE);
22752275   stv_enable_slave_sh2 = 0;
2276   cpu_set_input_line(machine->cpu[2], INPUT_LINE_RESET, ASSERT_LINE);
2276   cputag_set_input_line(machine, "audiocpu", INPUT_LINE_RESET, ASSERT_LINE);
22772277
22782278   smpcSR = 0x40;   // this bit is always on according to docs
22792279
r4592r4593
22882288   memset(stv_workram_l, 0, 0x100000);
22892289   memset(stv_workram_h, 0, 0x100000);
22902290
2291   cpu_set_clock(machine->cpu[0], MASTER_CLOCK_320/2);
2292   cpu_set_clock(machine->cpu[1], MASTER_CLOCK_320/2);
2293   cpu_set_clock(machine->cpu[2], MASTER_CLOCK_320/5);
2291   cputag_set_clock(machine, "maincpu", MASTER_CLOCK_320/2);
2292   cputag_set_clock(machine, "slave", MASTER_CLOCK_320/2);
2293   cputag_set_clock(machine, "audiocpu", MASTER_CLOCK_320/5);
22942294
22952295   stvcd_reset( machine );
22962296
r4592r4593
23872387   if (irq > 0)
23882388   {
23892389      scsp_last_line = irq;
2390      cpu_set_input_line(device->machine->cpu[2], irq, ASSERT_LINE);
2390      cputag_set_input_line(device->machine, "audiocpu", irq, ASSERT_LINE);
23912391   }
23922392   else if (irq < 0)
23932393   {
2394      cpu_set_input_line(device->machine->cpu[2], -irq, CLEAR_LINE);
2394      cputag_set_input_line(device->machine, "audiocpu", -irq, CLEAR_LINE);
23952395   }
23962396   else
23972397   {
2398      cpu_set_input_line(device->machine->cpu[2], scsp_last_line, CLEAR_LINE);
2398      cputag_set_input_line(device->machine, "audiocpu", scsp_last_line, CLEAR_LINE);
23992399   }
24002400}
24012401
r4592r4593
25162516CONS( 1994, saturneu,   saturn, 0,      saturn, saturn, saturneu,   0, "Sega",     "Saturn (PAL)",     GAME_NOT_WORKING )
25172517CONS( 1995, vsaturn,    saturn, 0,      saturn, saturn, saturnjp,   0, "JVC",      "V-Saturn",         GAME_NOT_WORKING )
25182518CONS( 1995, hisaturn,   saturn, 0,      saturn, saturn, saturnjp,   0, "Hitachi",  "HiSaturn",         GAME_NOT_WORKING )
2519
2520
src/mess/drivers/ssystem3.c
r4592r4593
110110      if (d) playfield.data|=1<<(playfield.bit^7);
111111      playfield.bit++;
112112      if (playfield.bit==8) {
113   logerror("%.4x playfield wrote %d %02x\n",(int)cpu_get_pc(machine->cpu[0]), playfield.count, playfield.data);
113   logerror("%.4x playfield wrote %d %02x\n", (int)cpu_get_pc(cputag_get_cpu(machine, "maincpu")), playfield.count, playfield.data);
114114   playfield.u.data[playfield.count]=playfield.data;
115115   playfield.bit=0;
116116   playfield.count=(playfield.count+1)%ARRAY_LENGTH(playfield.u.data);
src/mess/drivers/svision.c
r4592r4593
7777   int irq = svision.timer_shot && (BANK & 2);
7878   irq = irq || (svision_dma.finished && (BANK & 4));
7979
80   cpu_set_input_line(machine->cpu[0], M6502_IRQ_LINE, irq ? ASSERT_LINE : CLEAR_LINE);
80   cputag_set_input_line(machine, "maincpu", M6502_IRQ_LINE, irq ? ASSERT_LINE : CLEAR_LINE);
8181}
8282
8383static TIMER_CALLBACK(svision_timer)
r4592r4593
155155         else
156156            delay = 256;
157157         timer_enable(svision.timer1, TRUE);
158         timer_reset(svision.timer1, cpu_clocks_to_attotime(space->machine->cpu[0], value * delay));
158         timer_reset(svision.timer1, cputag_clocks_to_attotime(space->machine, "maincpu", value * delay));
159159         break;
160160      case 0x10: case 0x11: case 0x12: case 0x13:
161161         svision_soundport_w(space->machine, svision_channel + 0, offset & 3, data);
r4592r4593
453453   svision.timer1 = timer_alloc(machine, svision_timer, NULL);
454454   svision_pet.on = TRUE;
455455   svision_pet.timer = timer_alloc(machine, svision_pet_timer, NULL);
456   timer_pulse(machine, attotime_mul(ATTOTIME_IN_SEC(8), 256/cpu_get_clock(machine->cpu[0])), NULL, 0, svision_pet_timer);
456   timer_pulse(machine, attotime_mul(ATTOTIME_IN_SEC(8), 256/cputag_get_clock(machine, "maincpu")), NULL, 0, svision_pet_timer);
457457}
458458
459459static MACHINE_RESET( svision )
r4592r4593
530530
531531static MACHINE_DRIVER_START( tvlinkp )
532532   MDRV_IMPORT_FROM( svisionp )
533    MDRV_CPU_MODIFY("maincpu")
533   MDRV_CPU_MODIFY("maincpu")
534534   MDRV_CPU_PROGRAM_MAP(tvlink_mem, 0)
535535
536536   MDRV_MACHINE_RESET( tvlink )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team