Previous 15994 Revisions Next

r3645 Thursday 27th November, 2008 at 14:24:50 UTC by Miodrag Milanović
[ATARI][AT] Fixed some files
[src/mess/drivers]a2600.c at.c atari.c jaguar.c
[src/mess/machine]a7800.c at.c atarifdc.c i82439tx.c
[src/mess/video]a7800.c

src/mess/video/a7800.c
r3644r3645
104104
105105***************************************************************************/
106106
107static void maria_draw_scanline(void)
107static void maria_draw_scanline(running_machine *machine)
108108{
109   const address_space* space = cpu_get_address_space(machine->cpu[0],ADDRESS_SPACE_PROGRAM);
109110   unsigned int graph_adr,data_addr;
110111   int width,hpos,pal,mode,ind;
111112   unsigned int dl;
r3644r3645
338339INTERRUPT_GEN( a7800_interrupt )
339340{
340341   int frame_scanline;
341   UINT8 *ROM = memory_region(machine, "main");
342
342   UINT8 *ROM = memory_region(device->machine, "main");
343   const address_space* space = cpu_get_address_space(device->machine->cpu[0],ADDRESS_SPACE_PROGRAM);
344   
343345   maria_scanline++;
344346
345347   /* why + 1? */
r3644r3645
352354
353355   if( maria_wsync )
354356   {
355      cpu_trigger( machine, TRIGGER_HSYNC );
357      cpuexec_trigger( device->machine, TRIGGER_HSYNC );
356358      maria_wsync = 0;
357359   }
358360
r3644r3645
410412   if( ( frame_scanline > 15 ) && maria_dodma )
411413   {
412414      if (maria_scanline < ( a7800_lines - 4 ) )
413         maria_draw_scanline();
415         maria_draw_scanline(device->machine);
414416
415417      if( maria_offset == 0 )
416418      {
r3644r3645
434436   if( maria_dli )
435437   {
436438      maria_dli = 0;
437      cpu_set_input_line(machine->cpu[0], INPUT_LINE_NMI, PULSE_LINE);
439      cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE);
438440   }
439441
440442}
r3644r3645
457459
458460 READ8_HANDLER( a7800_MARIA_r )
459461{
460   UINT8 *ROM = memory_region(machine, "main");
462   UINT8 *ROM = memory_region(space->machine, "main");
461463   switch (offset)
462464   {
463465      case 0x08:
r3644r3645
471473
472474WRITE8_HANDLER( a7800_MARIA_w )
473475{
474   UINT8 *ROM = memory_region(machine, "main");
476   UINT8 *ROM = memory_region(space->machine, "main");
475477   switch (offset)
476478   {
477479      case 0x00:
r3644r3645
496498         maria_palette[0][3] = data;
497499         break;
498500      case 0x04:
499         cpu_spinuntil_trigger(TRIGGER_HSYNC);
501         cpu_spinuntil_trigger(space->machine->cpu[0],TRIGGER_HSYNC);
500502         maria_wsync=1;
501503         break;
502504
src/mess/machine/at.c
r3644r3645
5555 *************************************************************/
5656
5757static PIC8259_SET_INT_LINE( at_pic8259_master_set_int_line ) {
58   cpunum_set_input_line(device->machine, 0, 0, interrupt ? HOLD_LINE : CLEAR_LINE);
58   cpu_set_input_line(device->machine->cpu[0], 0, interrupt ? HOLD_LINE : CLEAR_LINE);
5959}
6060
6161
r3644r3645
161161
162162static void init_at_common(running_machine *machine, const struct kbdc8042_interface *at8042)
163163{
164   const address_space* space = cpu_get_address_space(machine->cpu[0],ADDRESS_SPACE_PROGRAM);
164165   mess_init_pc_common(machine, PCCOMMON_KEYBOARD_AT, at_set_keyb_int, at_set_irq_line);
165166   mc146818_init(machine, MC146818_STANDARD);
166167   soundblaster_config(&soundblaster);
r3644r3645
169170   if (mess_ram_size > 0x0a0000)
170171   {
171172      offs_t ram_limit = 0x100000 + mess_ram_size - 0x0a0000;
172      memory_install_read_handler(machine, 0,  ADDRESS_SPACE_PROGRAM, 0x100000,  ram_limit - 1, 0, 0, 1);
173      memory_install_write_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x100000,  ram_limit - 1, 0, 0, 1);
173      memory_install_read_handler(space, 0x100000,  ram_limit - 1, 0, 0, 1);
174      memory_install_write_handler(space, 0x100000,  ram_limit - 1, 0, 0, 1);
174175      memory_set_bankptr(machine, 1, mess_ram + 0xa0000);
175176   }
176177}
r3644r3645
222223
223224   if (LOG_PORT80 && (offset == 0))
224225   {
225      logerror(" at_page8_w(): Port 80h <== 0x%02x (PC=0x%08x)\n", data, (unsigned) activecpu_get_reg(REG_PC));
226      logerror(" at_page8_w(): Port 80h <== 0x%02x (PC=0x%08x)\n", data, (unsigned) cpu_get_reg(space->machine->cpu[0],REG_PC));
226227   }
227228
228229   switch(offset % 8) {
r3644r3645
248249   offs_t page_offset = (((offs_t) dma_offset[0][channel]) << 16)
249250      & 0xFF0000;
250251
251   cpuintrf_push_context(0);
252   result = memory_read_byte(space, page_offset + offset);
253   cpuintrf_pop_context();
252   cpu_push_context(device->machine->cpu[0]);
253   result = memory_read_byte(cpu_get_address_space(device->machine->cpu[0],ADDRESS_SPACE_PROGRAM), page_offset + offset);
254   cpu_pop_context();
254255
255256   return result;
256257}
r3644r3645
261262   offs_t page_offset = (((offs_t) dma_offset[0][channel]) << 16)
262263      & 0xFF0000;
263264
264   cpuintrf_push_context(0);
265   memory_write_byte(space, page_offset + offset, data);
266   cpuintrf_pop_context();
265   cpu_push_context(device->machine->cpu[0]);
266   memory_write_byte(cpu_get_address_space(device->machine->cpu[0],ADDRESS_SPACE_PROGRAM), page_offset + offset, data);
267   cpu_pop_context();
267268}
268269
269270
r3644r3645
462463   UINT8               offset1;
463464   UINT8               clock_signal;
464465   UINT8               data_signal;
465   write8_machine_func      clock_callback;
466   write8_machine_func      data_callback;
466   write8_space_func      clock_callback;
467   write8_space_func      data_callback;
467468} at_kbdc8042;
468469
469470
470471static READ8_HANDLER( at_kbdc8042_p1_r )
471472{
472   logerror("%04x: reading P1\n", activecpu_get_pc() );
473   logerror("%04x: reading P1\n", cpu_get_pc(space->machine->cpu[0]) );
473474   return 0xFF;
474475}
475476
r3644r3645
482483
483484static WRITE8_HANDLER( at_kbdc8042_p2_w )
484485{
485   logerror("%04x: writing $%02x to P2\n", activecpu_get_pc(), data );
486   logerror("%04x: writing $%02x to P2\n", cpu_get_pc(space->machine->cpu[0]), data );
486487
487488   at_set_gate_a20( ( data & 0x02 ) ? 1 : 0 );
488489   
489   cpu_set_input_line(machine->cpu[0], INPUT_LINE_RESET, ( data & 0x01 ) ? CLEAR_LINE : ASSERT_LINE );
490   cpu_set_input_line(space->machine->cpu[0], INPUT_LINE_RESET, ( data & 0x01 ) ? CLEAR_LINE : ASSERT_LINE );
490491
491492   at_kbdc8042.clock_signal = ( data & 0x40 ) ? 1 : 0;
492493   at_kbdc8042.data_signal = ( data & 0x80 ) ? 1 : 0;
493494
494   at_kbdc8042.data_callback( machine, 0, at_kbdc8042.data_signal );
495   at_kbdc8042.clock_callback( machine, 0, at_kbdc8042.clock_signal );
495   at_kbdc8042.data_callback( space, 0, at_kbdc8042.data_signal );
496   at_kbdc8042.clock_callback( space, 0, at_kbdc8042.clock_signal );
496497}
497498
498499
r3644r3645
520521}
521522
522523
523static void at_kbdc8042_set_keyboard_interface( running_machine *machine, write8_machine_func clock_cb, write8_machine_func data_cb )
524static void at_kbdc8042_set_keyboard_interface( running_machine *machine, write8_space_func clock_cb, write8_space_func data_cb )
524525{
525526   at_kbdc8042.offset1 = 0xFF;
526527   at_kbdc8042.clock_callback = clock_cb;
r3644r3645
542543ADDRESS_MAP_END
543544
544545
545static const i8x41_config i8042_config = { TYPE_I8X42 };
546
547
548546MACHINE_DRIVER_START( at_kbdc8042 )
549   MDRV_CPU_ADD("kbdc8042", I8X41, 4772720 )   /* Frequency is a wild guess */
547   MDRV_CPU_ADD("kbdc8042", I8042, 4772720 )   /* Frequency is a wild guess */
550548   MDRV_CPU_PROGRAM_MAP( kbdc8042_mem, 0 )
551549   MDRV_CPU_IO_MAP( kbdc8042_io, 0 )
552   MDRV_CPU_CONFIG( i8042_config )
553550MACHINE_DRIVER_END
554551
555552
r3644r3645
561558   switch ( offset )
562559   {
563560   case 0:
564      data = cpunum_get_reg( 1, I8X41_DATA );
561      data = cpu_get_reg( space->machine->cpu[1], I8X41_DATA );
565562      break;
566563
567564   case 1:
r3644r3645
583580      break;
584581
585582   case 2:
586      if (at_get_out2(machine))
583      if (at_get_out2(space->machine))
587584         data |= 0x20;
588585      else
589586         data &= ~0x20;
590587      break;
591588
592589   case 4:
593      data = cpunum_get_reg( 1, I8X41_STAT );
590      data = cpu_get_reg( space->machine->cpu[1], I8X41_STAT );
594591      break;
595592   }
596593
r3644r3645
607604
608605   switch (offset) {
609606   case 0:
610      cpunum_set_reg( 1, I8X41_DATA, data );
607      cpu_set_reg( space->machine->cpu[1], I8X41_DATA, data );
611608      break;
612609
613610   case 1:
r3644r3645
617614      break;
618615
619616   case 4:
620      cpunum_set_reg( 1, I8X41_CMND, data );
617      cpu_set_reg( space->machine->cpu[1], I8X41_CMND, data );
621618      break;
622619    }
623620}
r3644r3645
692689
693690
694691
695static void at_map_vga_memory(offs_t begin, offs_t end, read8_machine_func rh, write8_machine_func wh)
692static void at_map_vga_memory(offs_t begin, offs_t end, read8_space_func rh, write8_space_func wh)
696693{
697694   int buswidth;
698   buswidth = cputype_databus_width(Machine->config->cpu[0].type, ADDRESS_SPACE_PROGRAM);
695   const address_space *space = cpu_get_address_space(Machine->cpu[0], ADDRESS_SPACE_PROGRAM);
696   buswidth = cpu_get_databus_width(Machine->cpu[0], ADDRESS_SPACE_PROGRAM);
699697   switch(buswidth)
700698   {
701699      case 8:
702         memory_install_read8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0xA0000, 0xBFFFF, 0, 0, SMH_NOP);
703         memory_install_write8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, 0xA0000, 0xBFFFF, 0, 0, SMH_NOP);
700         memory_install_read8_handler(space, 0xA0000, 0xBFFFF, 0, 0, SMH_NOP);
701         memory_install_write8_handler(space, 0xA0000, 0xBFFFF, 0, 0, SMH_NOP);
704702
705         memory_install_read8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, begin, end, 0, 0, rh);
706         memory_install_write8_handler(Machine, 0, ADDRESS_SPACE_PROGRAM, begin, end, 0, 0, wh);
703         memory_install_read8_handler(space, begin, end, 0, 0, rh);
704         memory_install_write8_handler(space, begin, end, 0, 0, wh);
707705         break;
708706   }
709707}
r3644r3645
767765
768766MACHINE_START( at )
769767{
770   cpunum_set_irq_callback(0, at_irq_callback);
768   cpu_set_irq_callback(machine->cpu[0], at_irq_callback);
771769   pc_fdc_init( machine, &fdc_interface );
772770}
773771
src/mess/machine/a7800.c
r3644r3645
5353/* TODO: Convert the definitions into a syntax accepting input_port_read */
5454
5555static UINT8 riot_input_port_0_r(const device_config *device, UINT8 olddata)
56{
57   return input_port_0_r(device->machine, 0);
56{   
57   return input_port_0_r(cpu_get_address_space(device->machine->cpu[0],ADDRESS_SPACE_PROGRAM), 0);
5858}
5959
6060static UINT8 riot_input_port_3_r(const device_config *device, UINT8 olddata)
6161{
62   return input_port_3_r(device->machine, 0);
62   return input_port_3_r(cpu_get_address_space(device->machine->cpu[0],ADDRESS_SPACE_PROGRAM), 0);
6363}
6464
6565const riot6532_interface r6532_interface_ntsc =
r3644r3645
8484
8585static void a7800_driver_init(running_machine *machine, int ispal, int lines)
8686{
87   const address_space* space = cpu_get_address_space(machine->cpu[0],ADDRESS_SPACE_PROGRAM);
8788   ROM = memory_region(machine, "main");
8889   a7800_ispal = ispal;
8990   a7800_lines = lines;
r3644r3645
9495   memory_set_bankptr(machine, 7, &ROM[0x2000]);      /* MAINRAM */
9596
9697   /* Brutal hack put in as a consequence of new memory system; fix this */
97   memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0480, 0x04FF, 0, 0, SMH_BANK10);
98   memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0480, 0x04FF, 0, 0, SMH_BANK10);
98   memory_install_read8_handler(space, 0x0480, 0x04FF, 0, 0, SMH_BANK10);
99   memory_install_write8_handler(space, 0x0480, 0x04FF, 0, 0, SMH_BANK10);
99100   memory_set_bankptr(machine, 10, ROM + 0x0480);
100   memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1800, 0x27FF, 0, 0, SMH_BANK11);
101   memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1800, 0x27FF, 0, 0, SMH_BANK11);
101   memory_install_read8_handler(space, 0x1800, 0x27FF, 0, 0, SMH_BANK11);
102   memory_install_write8_handler(space, 0x1800, 0x27FF, 0, 0, SMH_BANK11);
102103   memory_set_bankptr(machine, 11, ROM + 0x1800);
103104}
104105
r3644r3645
121122MACHINE_RESET( a7800 )
122123{
123124   UINT8 *memory;
125   const address_space* space = cpu_get_address_space(machine->cpu[0],ADDRESS_SPACE_PROGRAM);
124126
125127   a7800_ctrl_lock = 0;
126128   a7800_ctrl_reg = 0;
r3644r3645
128130
129131   /* set banks to default states */
130132   memory = memory_region(machine, "main");
131   memory_set_bankptr( 1, memory + 0x4000 );
132   memory_set_bankptr( 2, memory + 0x8000 );
133   memory_set_bankptr( 3, memory + 0xA000 );
134   memory_set_bankptr( 4, memory + 0xC000 );
133   memory_set_bankptr(machine,  1, memory + 0x4000 );
134   memory_set_bankptr(machine,  2, memory + 0x8000 );
135   memory_set_bankptr(machine,  3, memory + 0xA000 );
136   memory_set_bankptr(machine,  4, memory + 0xC000 );
135137
136138   /* pokey cartridge */
137139   if (a7800_cart_type & 0x01)
138140   {
139      memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x7FFF, 0, 0, pokey1_r);
140      memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x7FFF, 0, 0, pokey1_w);
141      memory_install_read8_handler(space, 0x4000, 0x7FFF, 0, 0, pokey1_r);
142      memory_install_write8_handler(space, 0x4000, 0x7FFF, 0, 0, pokey1_w);
141143   }
142144}
143145
r3644r3645
345347   switch(offset)
346348   {
347349      case 0x08:
348           return((input_port_read(machine, "buttons") & 0x02) << 6);
350           return((input_port_read(space->machine, "buttons") & 0x02) << 6);
349351      case 0x09:
350           return((input_port_read(machine, "buttons") & 0x08) << 4);
352           return((input_port_read(space->machine, "buttons") & 0x08) << 4);
351353      case 0x0A:
352           return((input_port_read(machine, "buttons") & 0x01) << 7);
354           return((input_port_read(space->machine, "buttons") & 0x01) << 7);
353355      case 0x0B:
354           return((input_port_read(machine, "buttons") & 0x04) << 5);
356           return((input_port_read(space->machine, "buttons") & 0x04) << 5);
355357      case 0x0c:
356         if((input_port_read(machine, "buttons") & 0x08) ||(input_port_read(machine, "buttons") & 0x02))
358         if((input_port_read(space->machine, "buttons") & 0x08) ||(input_port_read(space->machine, "buttons") & 0x02))
357359            return 0x00;
358360         else
359361            return 0x80;
360362      case 0x0d:
361         if((input_port_read(machine, "buttons") & 0x01) ||(input_port_read(machine, "buttons") & 0x04))
363         if((input_port_read(space->machine, "buttons") & 0x01) ||(input_port_read(space->machine, "buttons") & 0x04))
362364            return 0x00;
363365         else
364366            return 0x80;
r3644r3645
389391      }
390392      break;
391393   }
392   tia_sound_w(machine, offset,data);
394   tia_sound_w(space, offset,data);
393395   ROM[offset] = data;
394396}
395397
r3644r3645
405407
406408WRITE8_HANDLER( a7800_cart_w )
407409{
408   UINT8 *memory = memory_region(machine, "main");
410   UINT8 *memory = memory_region(space->machine, "main");
409411
410412   if(offset < 0x4000)
411413   {
r3644r3645
415417      }
416418      else if(a7800_cart_type & 0x01)
417419      {
418         pokey1_w(machine, offset,data);
420         pokey1_w(space, offset,data);
419421      }
420422      else
421423      {
r3644r3645
434436      {
435437         data &= 0x07;
436438      }
437      memory_set_bankptr(machine, 2,memory + 0x10000 + (data << 14));
438      memory_set_bankptr(machine, 3,memory + 0x12000 + (data << 14));
439      memory_set_bankptr(space->machine, 2,memory + 0x10000 + (data << 14));
440      memory_set_bankptr(space->machine, 3,memory + 0x12000 + (data << 14));
439441   /*   logerror("BANK SEL: %d\n",data); */
440442   }
441443   else if(( a7800_cart_type == MBANK_TYPE_ABSOLUTE ) &&( offset == 0x4000 ) )
r3644r3645
444446      /*logerror( "F18 BANK SEL: %d\n", data );*/
445447      if( data & 1 )
446448      {
447         memory_set_bankptr(machine, 1,memory + 0x10000 );
449         memory_set_bankptr(space->machine, 1,memory + 0x10000 );
448450      }
449451      else if( data & 2 )
450452      {
451         memory_set_bankptr(machine, 1,memory + 0x14000 );
453         memory_set_bankptr(space->machine, 1,memory + 0x14000 );
452454      }
453455   }
454456   else if(( a7800_cart_type == MBANK_TYPE_ACTIVISION ) &&( offset >= 0xBF80 ) )
r3644r3645
458460
459461      /*logerror( "Activision BANK SEL: %d\n", data );*/
460462
461      memory_set_bankptr( 3, memory + 0x10000 + ( data << 14 ) );
462      memory_set_bankptr( 4, memory + 0x12000 + ( data << 14 ) );
463      memory_set_bankptr(space->machine,  3, memory + 0x10000 + ( data << 14 ) );
464      memory_set_bankptr(space->machine,  4, memory + 0x12000 + ( data << 14 ) );
463465   }
464466}
465467
src/mess/machine/i82439tx.c
r3644r3645
102102
103103
104104
105static void intel82439tx_configure_memory(running_machine *machine, UINT8 val, offs_t begin, offs_t end, int read_bank, write32_machine_func wh)
105static void intel82439tx_configure_memory(running_machine *machine, UINT8 val, offs_t begin, offs_t end, int read_bank, write32_space_func wh)
106106{
107   memory_install_read_handler(machine, 0, ADDRESS_SPACE_PROGRAM, begin, end, 0, 0, read_bank);
107   const address_space* space = cpu_get_address_space(machine->cpu[0],ADDRESS_SPACE_PROGRAM);
108   memory_install_read_handler(space, begin, end, 0, 0, read_bank);
108109   if (val & 0x01)
109      memory_set_bankptr(read_bank, i82439tx->bios_ram + (begin - 0xC0000) / 4);
110      memory_set_bankptr(machine, read_bank, i82439tx->bios_ram + (begin - 0xC0000) / 4);
110111   else
111      memory_set_bankptr(read_bank, memory_region(machine, "user1") + (begin - 0xC0000));
112      memory_set_bankptr(machine, read_bank, memory_region(machine, "user1") + (begin - 0xC0000));
112113
113114   if (val & 0x02)
114      memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, begin, end, 0, 0, wh);
115      memory_install_write32_handler(space, begin, end, 0, 0, wh);
115116   else
116      memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, begin, end, 0, 0, SMH_NOP);
117      memory_install_write32_handler(space, begin, end, 0, 0, SMH_NOP);
117118}
118119
119120
r3644r3645
199200   }
200201
201202   /* hack to compensate for weird issue (maybe the Pentium core needs to support caching? */
202   if ((cpunum_get_reg(0, REG_PC) == 0xFCB01) && !strcmp(machine->gamedrv->name, "at586"))
203   if ((cpu_get_reg(machine->cpu[0], REG_PC) == 0xFCB01) && !strcmp(machine->gamedrv->name, "at586"))
203204   {
204205      memory_region(machine, "user1")[0x3CB01] = 0xF3;
205206      memory_region(machine, "user1")[0x3CB02] = 0xA4;
src/mess/machine/atarifdc.c
r3644r3645
710710         atari_fdc.serout_chksum ^= data;
711711         /* if the attention line is high, this should be data */
712712         if (pia_get_irq_b(0))
713            a800_serial_write(machine);
713            a800_serial_write(space->machine);
714714      }
715715      else
716716      {
r3644r3645
730730   else
731731   {
732732      atari_fdc.serin_delay = 0;
733      a800_serial_command(machine);
733      a800_serial_command(space->machine);
734734   }
735735}
src/mess/drivers/jaguar.c
r3644r3645
9999
100100static MACHINE_RESET( jaguar )
101101{
102   cpunum_set_irq_callback(0, jaguar_irq_callback);
102   cpu_set_irq_callback(machine->cpu[0], jaguar_irq_callback);
103103
104104   *((UINT32 *) jaguar_gpu_ram) = 0x3d0dead;
105105
r3644r3645
123123//  memory_set_bankptr(machine, 17, jaguar_gpu_ram);
124124
125125   /* clear any spinuntil stuff */
126   jaguar_gpu_resume();
127   jaguar_dsp_resume();
126   jaguar_gpu_resume(machine);
127   jaguar_dsp_resume(machine);
128128
129129   /* halt the CPUs */
130   jaguargpu_ctrl_w(1, G_CTRL, 0, 0);
131   jaguardsp_ctrl_w(2, D_CTRL, 0, 0);
130   jaguargpu_ctrl_w(machine->cpu[1], G_CTRL, 0, 0);
131   jaguardsp_ctrl_w(machine->cpu[2], D_CTRL, 0, 0);
132132
133133   /* init the sound system */
134134   cojag_sound_reset();
r3644r3645
146146
147147static READ32_HANDLER( gpuctrl_r )
148148{
149   return jaguargpu_ctrl_r(1, offset);
149   return jaguargpu_ctrl_r(space->machine->cpu[1], offset);
150150}
151151
152152
153153static WRITE32_HANDLER( gpuctrl_w )
154154{
155   jaguargpu_ctrl_w(1, offset, data, mem_mask);
155   jaguargpu_ctrl_w(space->machine->cpu[1], offset, data, mem_mask);
156156}
157157
158158
r3644r3645
165165
166166static READ32_HANDLER( dspctrl_r )
167167{
168   return jaguardsp_ctrl_r(2, offset);
168   return jaguardsp_ctrl_r(space->machine->cpu[1], offset);
169169}
170170
171171
172172static WRITE32_HANDLER( dspctrl_w )
173173{
174   jaguardsp_ctrl_w(2, offset, data, mem_mask);
174   jaguardsp_ctrl_w(space->machine->cpu[2], offset, data, mem_mask);
175175}
176176
177177
r3644r3645
217217   {
218218      if ((joystick_data & (0x10000 << i)) == 0)
219219      {
220         joystick_result &= input_port_read(machine, keynames[0][i]);
221         joybuts_result &= input_port_read(machine, keynames[1][i]);
220         joystick_result &= input_port_read(space->machine, keynames[0][i]);
221         joybuts_result &= input_port_read(space->machine, keynames[1][i]);
222222      }
223223   }
224224
r3644r3645
439439 *************************************/
440440
441441
442static const jaguar_cpu_core gpu_config =
442static const jaguar_cpu_config gpu_config =
443443{
444444   jaguar_gpu_cpu_int
445445};
446446
447447
448static const jaguar_cpu_core dsp_config =
448static const jaguar_cpu_config dsp_config =
449449{
450450   jaguar_dsp_cpu_int
451451};
r3644r3645
524524   offs_t quickload_begin = 0x4000;
525525   quickload_size = MIN(quickload_size, 0x200000 - quickload_begin);
526526   image_fread(image, &memory_region(image->machine, "main")[quickload_begin], quickload_size);
527   cpu_set_reg(machine->cpu[0], REG_PC, quickload_begin);
527   cpu_set_reg(image->machine->cpu[0], REG_PC, quickload_begin);
528528   return INIT_PASS;
529529}
530530
src/mess/drivers/atari.c
r3644r3645
654654
655655
656656
657static READ8_HANDLER( analog_0_r ) { return (UINT8) input_port_read(machine, "analog_0"); }
658static READ8_HANDLER( analog_1_r ) { return (UINT8) input_port_read(machine, "analog_1"); }
659static READ8_HANDLER( analog_2_r ) { return (UINT8) input_port_read(machine, "analog_2"); }
660static READ8_HANDLER( analog_3_r ) { return (UINT8) input_port_read(machine, "analog_3"); }
661static READ8_HANDLER( analog_4_r ) { return (UINT8) input_port_read(machine, "analog_4"); }
662static READ8_HANDLER( analog_5_r ) { return (UINT8) input_port_read(machine, "analog_5"); }
663static READ8_HANDLER( analog_6_r ) { return (UINT8) input_port_read(machine, "analog_6"); }
664static READ8_HANDLER( analog_7_r ) { return (UINT8) input_port_read(machine, "analog_7"); }
657static READ8_HANDLER( analog_0_r ) { return (UINT8) input_port_read(space->machine, "analog_0"); }
658static READ8_HANDLER( analog_1_r ) { return (UINT8) input_port_read(space->machine, "analog_1"); }
659static READ8_HANDLER( analog_2_r ) { return (UINT8) input_port_read(space->machine, "analog_2"); }
660static READ8_HANDLER( analog_3_r ) { return (UINT8) input_port_read(space->machine, "analog_3"); }
661static READ8_HANDLER( analog_4_r ) { return (UINT8) input_port_read(space->machine, "analog_4"); }
662static READ8_HANDLER( analog_5_r ) { return (UINT8) input_port_read(space->machine, "analog_5"); }
663static READ8_HANDLER( analog_6_r ) { return (UINT8) input_port_read(space->machine, "analog_6"); }
664static READ8_HANDLER( analog_7_r ) { return (UINT8) input_port_read(space->machine, "analog_7"); }
665665
666666
667667
src/mess/drivers/a2600.c
r3644r3645
607607static void modeF8_switch(running_machine *machine, UINT16 offset, UINT8 data)
608608{
609609   bank_base[1] = CART + 0x1000 * offset;
610   memory_set_bankptr(machine, 1, bank_base[1]);
610   memory_set_bankptr(machine,1, bank_base[1]);
611611}
612612static void modeFA_switch(running_machine *machine, UINT16 offset, UINT8 data)
613613{
614614   bank_base[1] = CART + 0x1000 * offset;
615   memory_set_bankptr(machine, 1, bank_base[1]);
615   memory_set_bankptr(machine,1, bank_base[1]);
616616}
617617static void modeF6_switch(running_machine *machine, UINT16 offset, UINT8 data)
618618{
619619   bank_base[1] = CART + 0x1000 * offset;
620   memory_set_bankptr(machine, 1, bank_base[1]);
620   memory_set_bankptr(machine,1, bank_base[1]);
621621}
622622static void modeF4_switch(running_machine *machine, UINT16 offset, UINT8 data)
623623{
624624   bank_base[1] = CART + 0x1000 * offset;
625   memory_set_bankptr(machine, 1, bank_base[1]);
625   memory_set_bankptr(machine,1, bank_base[1]);
626626}
627627static void mode3F_switch(running_machine *machine, UINT16 offset, UINT8 data)
628628{
629629   bank_base[1] = CART + 0x800 * (data & (number_banks - 1));
630   memory_set_bankptr(machine, 1, bank_base[1]);
630   memory_set_bankptr(machine,1, bank_base[1]);
631631}
632632static void modeUA_switch(running_machine *machine, UINT16 offset, UINT8 data)
633633{
634634   bank_base[1] = CART + (offset >> 6) * 0x1000;
635   memory_set_bankptr(machine, 1, bank_base[1]);
635   memory_set_bankptr(machine,1, bank_base[1]);
636636}
637637static void modeE0_switch(running_machine *machine, UINT16 offset, UINT8 data)
638638{
639639   int bank = 1 + (offset >> 3);
640640   bank_base[bank] = CART + 0x400 * (offset & 7);
641   memory_set_bankptr(bank, bank_base[bank]);
641   memory_set_bankptr(machine,bank, bank_base[bank]);
642642}
643643static void modeE7_switch(running_machine *machine, UINT16 offset, UINT8 data)
644644{
645645   bank_base[1] = CART + 0x800 * offset;
646   memory_set_bankptr(machine, 1, bank_base[1]);
646   memory_set_bankptr(machine,1, bank_base[1]);
647647}
648648static void modeE7_RAM_switch(running_machine *machine, UINT16 offset, UINT8 data)
649649{
650   memory_set_bankptr(machine, 9, extra_RAM + (4 + offset) * 256 );
650   memory_set_bankptr(machine,9, extra_RAM + (4 + offset) * 256 );
651651}
652652static void modeDC_switch(running_machine *machine, UINT16 offset, UINT8 data)
653653{
654654   bank_base[1] = CART + 0x1000 * next_bank();
655   memory_set_bankptr(machine, 1, bank_base[1]);
655   memory_set_bankptr(machine,1, bank_base[1]);
656656}
657657static void mode3E_switch(running_machine *machine, UINT16 offset, UINT8 data)
658658{
659659   bank_base[1] = CART + 0x800 * (data & (number_banks - 1));
660   memory_set_bankptr(machine, 1, bank_base[1]);
660   memory_set_bankptr(machine,1, bank_base[1]);
661661   mode3E_ram_enabled = 0;
662662}
663663static void mode3E_RAM_switch(running_machine *machine, UINT16 offset, UINT8 data)
664664{
665665   ram_base = extra_RAM + 0x200 * ( data & 0x3F );
666   memory_set_bankptr(machine, 1, ram_base );
666   memory_set_bankptr(machine,1, ram_base );
667667   mode3E_ram_enabled = 1;
668668}
669669static void modeFV_switch(running_machine *machine, UINT16 offset, UINT8 data)
670670{
671671   //printf("ModeFV %04x\n",offset);
672   if (!FVlocked && ( activecpu_get_pc() & 0x1F00 ) == 0x1F00 ) {
672   if (!FVlocked && ( cpu_get_pc(machine->cpu[0]) & 0x1F00 ) == 0x1F00 ) {
673673      FVlocked = 1;
674674      current_bank = current_bank ^ 0x01;
675675      bank_base[1] = CART + 0x1000 * current_bank;
676      memory_set_bankptr(machine, 1, bank_base[1]);
676      memory_set_bankptr(machine,1, bank_base[1]);
677677   }
678678}
679679static void modeJVP_switch(running_machine *machine, UINT16 offset, UINT8 data)
r3644r3645
684684      current_bank ^= 1;
685685      break;
686686   default:
687      printf("%04X: write to unknown mapper address %02X\n", activecpu_get_pc(), 0xfa0 + offset );
687      printf("%04X: write to unknown mapper address %02X\n", cpu_get_pc(machine->cpu[0]), 0xfa0 + offset );
688688      break;
689689   }
690690   bank_base[1] = CART + 0x1000 * current_bank;
691   memory_set_bankptr( 1, bank_base[1] );
691   memory_set_bankptr(machine, 1, bank_base[1] );
692692}
693693
694694
695695/* These read handlers will return the byte from the new bank */
696static  READ8_HANDLER(modeF8_switch_r) { modeF8_switch(machine, offset, 0); return bank_base[1][0xff8 + offset]; }
697static  READ8_HANDLER(modeFA_switch_r) { modeFA_switch(machine, offset, 0); return bank_base[1][0xff8 + offset]; }
698static  READ8_HANDLER(modeF6_switch_r) { modeF6_switch(machine, offset, 0); return bank_base[1][0xff6 + offset]; }
699static  READ8_HANDLER(modeF4_switch_r) { modeF4_switch(machine, offset, 0); return bank_base[1][0xff4 + offset]; }
700static  READ8_HANDLER(modeE0_switch_r) { modeE0_switch(machine, offset, 0); return bank_base[4][0x3e0 + offset]; }
701static  READ8_HANDLER(modeE7_switch_r) { modeE7_switch(machine, offset, 0); return bank_base[1][0xfe0 + offset]; }
702static  READ8_HANDLER(modeE7_RAM_switch_r) { modeE7_RAM_switch(machine, offset, 0); return 0; }
703static  READ8_HANDLER(modeUA_switch_r) { modeUA_switch(machine, offset, 0); return 0; }
704static  READ8_HANDLER(modeDC_switch_r) { modeDC_switch(machine, offset, 0); return bank_base[1][0xff0 + offset]; }
705static  READ8_HANDLER(modeFV_switch_r) { modeFV_switch(machine, offset, 0); return bank_base[1][0xfd0 + offset]; }
706static  READ8_HANDLER(modeJVP_switch_r) { modeJVP_switch(machine, offset, 0); return riot_ram[ 0x20 + offset ]; }
696static  READ8_HANDLER(modeF8_switch_r) { modeF8_switch(space->machine, offset, 0); return bank_base[1][0xff8 + offset]; }
697static  READ8_HANDLER(modeFA_switch_r) { modeFA_switch(space->machine, offset, 0); return bank_base[1][0xff8 + offset]; }
698static  READ8_HANDLER(modeF6_switch_r) { modeF6_switch(space->machine, offset, 0); return bank_base[1][0xff6 + offset]; }
699static  READ8_HANDLER(modeF4_switch_r) { modeF4_switch(space->machine, offset, 0); return bank_base[1][0xff4 + offset]; }
700static  READ8_HANDLER(modeE0_switch_r) { modeE0_switch(space->machine, offset, 0); return bank_base[4][0x3e0 + offset]; }
701static  READ8_HANDLER(modeE7_switch_r) { modeE7_switch(space->machine, offset, 0); return bank_base[1][0xfe0 + offset]; }
702static  READ8_HANDLER(modeE7_RAM_switch_r) { modeE7_RAM_switch(space->machine, offset, 0); return 0; }
703static  READ8_HANDLER(modeUA_switch_r) { modeUA_switch(space->machine, offset, 0); return 0; }
704static  READ8_HANDLER(modeDC_switch_r) { modeDC_switch(space->machine, offset, 0); return bank_base[1][0xff0 + offset]; }
705static  READ8_HANDLER(modeFV_switch_r) { modeFV_switch(space->machine, offset, 0); return bank_base[1][0xfd0 + offset]; }
706static  READ8_HANDLER(modeJVP_switch_r) { modeJVP_switch(space->machine, offset, 0); return riot_ram[ 0x20 + offset ]; }
707707
708708
709static WRITE8_HANDLER(modeF8_switch_w) { modeF8_switch(machine, offset, data); }
710static WRITE8_HANDLER(modeFA_switch_w) { modeFA_switch(machine, offset, data); }
711static WRITE8_HANDLER(modeF6_switch_w) { modeF6_switch(machine, offset, data); }
712static WRITE8_HANDLER(modeF4_switch_w) { modeF4_switch(machine, offset, data); }
713static WRITE8_HANDLER(modeE0_switch_w) { modeE0_switch(machine, offset, data); }
714static WRITE8_HANDLER(modeE7_switch_w) { modeE7_switch(machine, offset, data); }
715static WRITE8_HANDLER(modeE7_RAM_switch_w) { modeE7_RAM_switch(machine, offset, data); }
716static WRITE8_HANDLER(mode3F_switch_w) { mode3F_switch(machine, offset, data); }
717static WRITE8_HANDLER(modeUA_switch_w) { modeUA_switch(machine, offset, data); }
718static WRITE8_HANDLER(modeDC_switch_w) { modeDC_switch(machine, offset, data); }
719static WRITE8_HANDLER(mode3E_switch_w) { mode3E_switch(machine, offset, data); }
720static WRITE8_HANDLER(mode3E_RAM_switch_w) { mode3E_RAM_switch(machine, offset, data); }
709static WRITE8_HANDLER(modeF8_switch_w) { modeF8_switch(space->machine, offset, data); }
710static WRITE8_HANDLER(modeFA_switch_w) { modeFA_switch(space->machine, offset, data); }
711static WRITE8_HANDLER(modeF6_switch_w) { modeF6_switch(space->machine, offset, data); }
712static WRITE8_HANDLER(modeF4_switch_w) { modeF4_switch(space->machine, offset, data); }
713static WRITE8_HANDLER(modeE0_switch_w) { modeE0_switch(space->machine, offset, data); }
714static WRITE8_HANDLER(modeE7_switch_w) { modeE7_switch(space->machine, offset, data); }
715static WRITE8_HANDLER(modeE7_RAM_switch_w) { modeE7_RAM_switch(space->machine, offset, data); }
716static WRITE8_HANDLER(mode3F_switch_w) { mode3F_switch(space->machine, offset, data); }
717static WRITE8_HANDLER(modeUA_switch_w) { modeUA_switch(space->machine, offset, data); }
718static WRITE8_HANDLER(modeDC_switch_w) { modeDC_switch(space->machine, offset, data); }
719static WRITE8_HANDLER(mode3E_switch_w) { mode3E_switch(space->machine, offset, data); }
720static WRITE8_HANDLER(mode3E_RAM_switch_w) { mode3E_RAM_switch(space->machine, offset, data); }
721721static WRITE8_HANDLER(mode3E_RAM_w) {
722722   if ( mode3E_ram_enabled ) {
723723      ram_base[offset] = data;
724724   }
725725}
726static WRITE8_HANDLER(modeFV_switch_w) { modeFV_switch(machine, offset, data); }
727static WRITE8_HANDLER(modeJVP_switch_w) { modeJVP_switch(machine, offset, data); riot_ram[ 0x20 + offset ] = data; }
726static WRITE8_HANDLER(modeFV_switch_w) { modeFV_switch(space->machine, offset, data); }
727static WRITE8_HANDLER(modeJVP_switch_w) { modeJVP_switch(space->machine, offset, data); riot_ram[ 0x20 + offset ] = data; }
728728
729729
730730static DIRECT_UPDATE_HANDLER( modeF6_opbase )
731731{
732732   if ( ( address & 0x1FFF ) >= 0x1FF6 && ( address & 0x1FFF ) <= 0x1FF9 ) {
733      modeF6_switch_w( machine, ( address & 0x1FFF ) - 0x1FF6, 0 );
733      modeF6_switch_w( space, ( address & 0x1FFF ) - 0x1FF6, 0 );
734734   }
735735   return address;
736736}
r3644r3645
738738static DIRECT_UPDATE_HANDLER( modeSS_opbase )
739739{
740740   if ( address & 0x1000 ) {
741      opbase->mask = 0x7ff;
742      opbase->mem_min = ( address & 0xf800 );
743      opbase->mem_max = ( address & 0xf800 ) | 0x7ff;
741      direct->mask = 0x7ff;
742      direct->min = ( address & 0xf800 );
743      direct->max = ( address & 0xf800 ) | 0x7ff;
744744      if ( address & 0x800 ) {
745745         direct->decrypted = bank_base[2];
746746         direct->raw = bank_base[2];
r3644r3645
757757{
758758   UINT8 data = ( offset & 0x800 ) ? bank_base[2][offset & 0x7FF] : bank_base[1][offset];
759759
760   //logerror("%04X: read from modeSS area offset = %04X\n", activecpu_get_pc(), offset);
760   //logerror("%04X: read from modeSS area offset = %04X\n", cpu_get_pc(machine->cpu[0]), offset);
761761   /* Check for control register "write" */
762762   if ( offset == 0xFF8 ) {
763      //logerror("%04X: write to modeSS control register data = %02X\n", activecpu_get_pc(), modeSS_byte);
763      //logerror("%04X: write to modeSS control register data = %02X\n", cpu_get_pc(machine->cpu[0]), modeSS_byte);
764764      modeSS_write_enabled = modeSS_byte & 0x02;
765765      modeSS_write_delay = modeSS_byte >> 5;
766766      switch ( modeSS_byte & 0x1C ) {
767767      case 0x00:
768768         bank_base[1] = extra_RAM + 2 * 0x800;
769         bank_base[2] = ( modeSS_byte & 0x01 ) ? memory_region(machine, "main") + 0x1800 : CART;
769         bank_base[2] = ( modeSS_byte & 0x01 ) ? memory_region(space->machine, "main") + 0x1800 : memory_region(space->machine, "user1");
770770         modeSS_high_ram_enabled = 0;
771771         break;
772772      case 0x04:
773773         bank_base[1] = extra_RAM;
774         bank_base[2] = ( modeSS_byte & 0x01 ) ? memory_region(machine, "main") + 0x1800 : CART;
774         bank_base[2] = ( modeSS_byte & 0x01 ) ? memory_region(space->machine, "main") + 0x1800 : memory_region(space->machine, "user1");
775775         modeSS_high_ram_enabled = 0;
776776         break;
777777      case 0x08:
r3644r3645
786786         break;
787787      case 0x10:
788788         bank_base[1] = extra_RAM + 2 * 0x800;
789         bank_base[2] = ( modeSS_byte & 0x01 ) ? memory_region(machine, "main") + 0x1800 : CART;
789         bank_base[2] = ( modeSS_byte & 0x01 ) ? memory_region(space->machine, "main") + 0x1800 : memory_region(space->machine, "user1");
790790         modeSS_high_ram_enabled = 0;
791791         break;
792792      case 0x14:
793793         bank_base[1] = extra_RAM + 0x800;
794         bank_base[2] = ( modeSS_byte & 0x01 ) ? memory_region(machine, "main") + 0x1800 : CART;
794         bank_base[2] = ( modeSS_byte & 0x01 ) ? memory_region(space->machine, "main") + 0x1800 : memory_region(space->machine, "user1");
795795         modeSS_high_ram_enabled = 0;
796796         break;
797797      case 0x18:
r3644r3645
805805         modeSS_high_ram_enabled = 1;
806806         break;
807807      }
808      memory_set_bankptr( 1, bank_base[1] );
809      memory_set_bankptr( 2, bank_base[2] );
808      memory_set_bankptr(space->machine, 1, bank_base[1] );
809      memory_set_bankptr(space->machine, 2, bank_base[2] );
810810
811811      /* Check if we should stop the tape */
812      if ( cpu_getactivecpu() >= 0 && activecpu_get_pc() == 0x00FD ) {
813         const device_config *img = device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" );
812      if ( cpu_get_pc(space->machine->cpu[0]) == 0x00FD ) {
813         const device_config *img = device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" );
814814         if ( img ) {
815815            cassette_change_state(img, CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
816816         }
817817      }
818818   } else if ( offset == 0xFF9 ) {
819819      /* Cassette port read */
820      double tap_val = cassette_input( device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" ) );
821      //logerror("%04X: Cassette port read, tap_val = %f\n", activecpu_get_pc(), tap_val);
820      double tap_val = cassette_input( device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" ) );
821      //logerror("%04X: Cassette port read, tap_val = %f\n", cpu_get_pc(machine->cpu[0]), tap_val);
822822      if ( tap_val < 0 ) {
823823         data = 0x00;
824824      } else {
r3644r3645
827827   } else {
828828      /* Possible RAM write */
829829      if ( modeSS_write_enabled ) {
830         int diff = activecpu_gettotalcycles() - modeSS_byte_started;
831         //logerror("%04X: offset = %04X, %d\n", activecpu_get_pc(), offset, diff);
830         int diff = cpu_get_total_cycles(space->machine->cpu[0]) - modeSS_byte_started;
831         //logerror("%04X: offset = %04X, %d\n", cpu_get_pc(machine->cpu[0]), offset, diff);
832832         if ( diff - modeSS_diff_adjust == 5 ) {
833            //logerror("%04X: RAM write offset = %04X, data = %02X\n", activecpu_get_pc(), offset, modeSS_byte );
833            //logerror("%04X: RAM write offset = %04X, data = %02X\n", cpu_get_pc(machine->cpu[0]), offset, modeSS_byte );
834834            if ( offset & 0x800 ) {
835835               if ( modeSS_high_ram_enabled ) {
836836                  bank_base[2][offset & 0x7FF] = modeSS_byte;
r3644r3645
842842            }
843843         } else if ( offset < 0x0100 ) {
844844            modeSS_byte = offset;
845            modeSS_byte_started = activecpu_gettotalcycles();
845            modeSS_byte_started = cpu_get_total_cycles(space->machine->cpu[0]);
846846         }
847847         /* Check for dummy read from same address */
848848         if ( diff == 2 ) {
r3644r3645
852852         }
853853      } else if ( offset < 0x0100 ) {
854854         modeSS_byte = offset;
855         modeSS_byte_started = activecpu_gettotalcycles();
855         modeSS_byte_started = cpu_get_total_cycles(space->machine->cpu[0]);
856856      }
857857   }
858858   /* Because the mame core caches opcode data and doesn't perform reads like normal */
859859   /* we have to put in this little hack here to get Suicide Mission to work. */
860   if ( offset != 0xFF8 && ( activecpu_get_pc() & 0x1FFF ) == 0x1FF8 ) {
861      modeSS_r( machine, 0xFF8 );
860   if ( offset != 0xFF8 && ( cpu_get_pc(space->machine->cpu[0]) & 0x1FFF ) == 0x1FF8 ) {
861      modeSS_r( space, 0xFF8 );
862862   }
863863   return data;
864864}
r3644r3645
912912   UINT8   data_fetcher = offset & 0x07;
913913   UINT8   data = 0xFF;
914914
915   logerror("%04X: Read from DPC offset $%02X\n", activecpu_get_pc(), offset);
915   logerror("%04X: Read from DPC offset $%02X\n", cpu_get_pc(space->machine->cpu[0]), offset);
916916   if ( offset < 0x08 ) {
917917      switch( offset & 0x06 ) {
918918      case 0x00:      /* Random number generator */
r3644r3645
936936         return ( dpc.dlc ? dpc.movamt & 0xF0 : 0 ) | dpc_amplitude[data];
937937      }
938938   } else {
939      UINT8   display_data = CART[0x2000 + ( ~ ( ( dpc.df[data_fetcher].low | ( dpc.df[data_fetcher].high << 8 ) ) ) & 0x7FF ) ];
939      UINT8   display_data = memory_region(space->machine, "user1")[0x2000 + ( ~ ( ( dpc.df[data_fetcher].low | ( dpc.df[data_fetcher].high << 8 ) ) ) & 0x7FF ) ];
940940
941941      switch( offset & 0x38 ) {
942942      case 0x08:         /* display data */
r3644r3645
10061006      dpc.movamt = data;
10071007      break;
10081008   case 0x28:         /* Not used */
1009      logerror("%04X: Write to unused DPC register $%02X, data $%02X\n", activecpu_get_pc(), offset, data);
1009      logerror("%04X: Write to unused DPC register $%02X, data $%02X\n", cpu_get_pc(space->machine->cpu[0]), offset, data);
10101010      break;
10111011   case 0x30:         /* Random number generator reset */
10121012      dpc.shift_reg = 0;
10131013      break;
10141014   case 0x38:         /* Not used */
1015      logerror("%04X: Write to unused DPC register $%02X, data $%02X\n", activecpu_get_pc(), offset, data);
1015      logerror("%04X: Write to unused DPC register $%02X, data $%02X\n", cpu_get_pc(space->machine->cpu[0]), offset, data);
10161016      break;
10171017   }
10181018}
r3644r3645
10291029
10301030 */
10311031
1032static opbase_handler_func FE_old_opbase_handler;
1032static direct_update_func FE_old_opbase_handler;
10331033static int FETimer;
10341034
10351035static DIRECT_UPDATE_HANDLER(modeFE_opbase_handler)
r3644r3645
10391039      /* Still cheating a bit here by looking bit 13 of the address..., but the high byte of the
10401040           cpu should be the last byte that was on the data bus and so should determine the bank
10411041           we should switch in. */
1042      bank_base[1] = CART + 0x1000 * ( ( address & 0x2000 ) ? 0 : 1 );
1043      memory_set_bankptr( 1, bank_base[1] );
1042      bank_base[1] = memory_region(space->machine, "user1") + 0x1000 * ( ( address & 0x2000 ) ? 0 : 1 );
1043      memory_set_bankptr(space->machine, 1, bank_base[1] );
10441044      /* and restore old opbase handler */
1045      memory_set_direct_update_handler(0, FE_old_opbase_handler);
1045      memory_set_direct_update_handler(space, FE_old_opbase_handler);
10461046   }
10471047   else
10481048   {
r3644r3645
10521052   return address;
10531053}
10541054
1055static void modeFE_switch(UINT16 offset, UINT8 data)
1055static void modeFE_switch(running_machine *machine,UINT16 offset, UINT8 data)
10561056{
1057   const address_space* space = cpu_get_address_space(machine->cpu[0],ADDRESS_SPACE_PROGRAM);
10571058   /* Retrieve last byte read by the cpu (for this mapping scheme this
10581059       should be the last byte that was on the data bus
10591060    */
10601061   FETimer = 1;
1061   FE_old_opbase_handler = memory_set_direct_update_handler(0, modeFE_opbase_handler);
1062   FE_old_opbase_handler = memory_set_direct_update_handler(space, modeFE_opbase_handler);
10621063}
10631064
10641065static READ8_HANDLER(modeFE_switch_r)
10651066{
1066   modeFE_switch(offset, 0 );
1067   modeFE_switch(space->machine,offset, 0 );
10671068   return memory_read_byte(space,  0xFE );
10681069}
10691070
10701071static WRITE8_HANDLER(modeFE_switch_w)
10711072{
10721073   memory_write_byte(space,  0xFE, data );
1073   modeFE_switch(offset, 0 );
1074   modeFE_switch(space->machine,offset, 0 );
10741075}
10751076
10761077static  READ8_HANDLER(current_bank_r)
r3644r3645
11671168
11681169static UINT8 riot_input_port_8_r(const device_config *device, UINT8 olddata)
11691170{
1170   return input_port_8_r(device->machine, 0);
1171   return input_port_8_r(cpu_get_address_space(device->machine->cpu[0],ADDRESS_SPACE_PROGRAM), 0);
11711172}
11721173
11731174static const riot6532_interface r6532_interface =
r3644r3645
11871188
11881189   for (i = 0; i < count; i++)
11891190   {
1190      static const read8_machine_func handler[] =
1191      static const read8_space_func handler[] =
11911192      {
11921193         SMH_BANK1,
11931194         SMH_BANK2,
r3644r3645
11951196         SMH_BANK4,
11961197      };
11971198
1198      memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM,
1199      memory_install_read8_handler(cpu_get_address_space(machine->cpu[0],ADDRESS_SPACE_PROGRAM),
11991200         0x1000 + (i + 0) * 0x1000 / count - 0,
12001201         0x1000 + (i + 1) * 0x1000 / count - 1, 0, 0, handler[i]);
12011202
12021203      bank_base[i + 1] = cart + init;
1203      memory_set_bankptr(i + 1, bank_base[i + 1]);
1204      memory_set_bankptr(machine,i + 1, bank_base[i + 1]);
12041205   }
12051206}
12061207
r3644r3645
12091210
12101211   switch( offset ) {
12111212   case 0:   /* Left controller port PIN 5 */
1212      switch ( input_port_read(machine, "CONTROLLERS") / CATEGORY_SELECT ) {
1213      switch ( input_port_read(space->machine, "CONTROLLERS") / CATEGORY_SELECT ) {
12131214      case 0x00:   /* Joystick */
12141215         return TIA_INPUT_PORT_ALWAYS_OFF;
12151216      case 0x01:   /* Paddle */
1216         return input_port_read(machine, "PADDLE1");
1217         return input_port_read(space->machine, "PADDLE1");
12171218      case 0x03:   /* Keypad */
12181219         for ( i = 0; i < 4; i++ ) {
12191220            if ( ! ( ( keypad_left_column >> i ) & 0x01 ) ) {
1220               if ( ( input_port_read(machine, "KEYPAD_L") >> 3*i ) & 0x01 ) {
1221               if ( ( input_port_read(space->machine, "KEYPAD_L") >> 3*i ) & 0x01 ) {
12211222                  return TIA_INPUT_PORT_ALWAYS_ON;
12221223               } else {
12231224                  return TIA_INPUT_PORT_ALWAYS_OFF;
r3644r3645
12261227         }
12271228         return TIA_INPUT_PORT_ALWAYS_ON;
12281229      case 0x05:   /* Boostergrip joystick */
1229         return ( input_port_read(machine, "BUTTONS_L") & 0x40 ) ? TIA_INPUT_PORT_ALWAYS_OFF : TIA_INPUT_PORT_ALWAYS_ON;
1230         return ( input_port_read(space->machine, "BUTTONS_L") & 0x40 ) ? TIA_INPUT_PORT_ALWAYS_OFF : TIA_INPUT_PORT_ALWAYS_ON;
12301231      default:
12311232         return TIA_INPUT_PORT_ALWAYS_OFF;
12321233      }
12331234      break;
12341235   case 1:   /* Right controller port PIN 5 */
1235      switch ( input_port_read(machine, "CONTROLLERS") / CATEGORY_SELECT ) {
1236      switch ( input_port_read(space->machine, "CONTROLLERS") / CATEGORY_SELECT ) {
12361237      case 0x00:   /* Joystick */
12371238         return TIA_INPUT_PORT_ALWAYS_OFF;
12381239      case 0x01:   /* Paddle */
1239         return input_port_read(machine, "PADDLE3");
1240         return input_port_read(space->machine, "PADDLE3");
12401241      case 0x03:   /* Keypad */
12411242         for ( i = 0; i < 4; i++ ) {
12421243            if ( ! ( ( keypad_left_column >> i ) & 0x01 ) ) {
1243               if ( ( input_port_read(machine, "KEYPAD_L") >> 3*i ) & 0x02 ) {
1244               if ( ( input_port_read(space->machine, "KEYPAD_L") >> 3*i ) & 0x02 ) {
12441245                  return TIA_INPUT_PORT_ALWAYS_ON;
12451246               } else {
12461247                  return TIA_INPUT_PORT_ALWAYS_OFF;
r3644r3645
12491250         }
12501251         return TIA_INPUT_PORT_ALWAYS_ON;
12511252      case 0x05:   /* Joystick w/Boostergrip */
1252         return ( input_port_read(machine, "BUTTONS_L") & 0x20 ) ? TIA_INPUT_PORT_ALWAYS_OFF : TIA_INPUT_PORT_ALWAYS_ON;
1253         return ( input_port_read(space->machine, "BUTTONS_L") & 0x20 ) ? TIA_INPUT_PORT_ALWAYS_OFF : TIA_INPUT_PORT_ALWAYS_ON;
12531254      default:
12541255         return TIA_INPUT_PORT_ALWAYS_OFF;
12551256      }
12561257      break;
12571258   case 2:   /* Left controller port PIN 9 */
1258      switch ( input_port_read(machine, "CONTROLLERS") % CATEGORY_SELECT ) {
1259      switch ( input_port_read(space->machine, "CONTROLLERS") % CATEGORY_SELECT ) {
12591260      case 0x00:   /* Joystick */
12601261         return TIA_INPUT_PORT_ALWAYS_OFF;
12611262      case 0x01:   /* Paddle */
1262         return input_port_read(machine, "PADDLE2");
1263         return input_port_read(space->machine, "PADDLE2");
12631264      case 0x03:   /* Keypad */
12641265         for ( i = 0; i < 4; i++ ) {
12651266            if ( ! ( ( keypad_right_column >> i ) & 0x01 ) ) {
1266               if ( ( input_port_read(machine, "KEYPAD_R") >> 3*i ) & 0x01 ) {
1267               if ( ( input_port_read(space->machine, "KEYPAD_R") >> 3*i ) & 0x01 ) {
12671268                  return TIA_INPUT_PORT_ALWAYS_ON;
12681269               } else {
12691270                  return TIA_INPUT_PORT_ALWAYS_OFF;
r3644r3645
12721273         }
12731274         return TIA_INPUT_PORT_ALWAYS_ON;
12741275      case 0x05:   /* Joystick w/Boostergrip */
1275         return ( input_port_read(machine, "BUTTONS_R") & 0x40 ) ? TIA_INPUT_PORT_ALWAYS_OFF : TIA_INPUT_PORT_ALWAYS_ON;
1276         return ( input_port_read(space->machine, "BUTTONS_R") & 0x40 ) ? TIA_INPUT_PORT_ALWAYS_OFF : TIA_INPUT_PORT_ALWAYS_ON;
12761277      default:
12771278         return TIA_INPUT_PORT_ALWAYS_OFF;
12781279      }
12791280      break;
12801281   case 3:   /* Right controller port PIN 9 */
1281      switch ( input_port_read(machine, "CONTROLLERS") % CATEGORY_SELECT ) {
1282      switch ( input_port_read(space->machine, "CONTROLLERS") % CATEGORY_SELECT ) {
12821283      case 0x00:   /* Joystick */
12831284         return TIA_INPUT_PORT_ALWAYS_OFF;
12841285      case 0x01:   /* Paddle */
1285         return input_port_read(machine, "PADDLE4");
1286         return input_port_read(space->machine, "PADDLE4");
12861287      case 0x03:   /* Keypad */
12871288         for ( i = 0; i < 4; i++ ) {
12881289            if ( ! ( ( keypad_right_column >> i ) & 0x01 ) ) {
1289               if ( ( input_port_read(machine, "KEYPAD_R") >> 3*i ) & 0x02 ) {
1290               if ( ( input_port_read(space->machine, "KEYPAD_R") >> 3*i ) & 0x02 ) {
12901291                  return TIA_INPUT_PORT_ALWAYS_ON;
12911292               } else {
12921293                  return TIA_INPUT_PORT_ALWAYS_OFF;
r3644r3645
12951296         }
12961297         return TIA_INPUT_PORT_ALWAYS_ON;
12971298      case 0x05:   /* Joystick w/Boostergrip */
1298         return ( input_port_read(machine, "BUTTONS_R") & 0x20 ) ? TIA_INPUT_PORT_ALWAYS_OFF : TIA_INPUT_PORT_ALWAYS_ON;
1299         return ( input_port_read(space->machine, "BUTTONS_R") & 0x20 ) ? TIA_INPUT_PORT_ALWAYS_OFF : TIA_INPUT_PORT_ALWAYS_ON;
12991300      default:
13001301         return TIA_INPUT_PORT_ALWAYS_OFF;
13011302      }
13021303      break;
13031304   case 4:   /* Left controller port PIN 6 */
1304      switch ( input_port_read(machine, "CONTROLLERS") / CATEGORY_SELECT ) {
1305      switch ( input_port_read(space->machine, "CONTROLLERS") / CATEGORY_SELECT ) {
13051306      case 0x00:   /* Joystick */
13061307      case 0x05:   /* Joystick w/Boostergrip */
1307         return input_port_read(machine, "BUTTONS_L");
1308         return input_port_read(space->machine, "BUTTONS_L");
13081309      case 0x01:   /* Paddle */
13091310         return 0xff;
13101311      case 0x02:   /* Driving */
1311         return input_port_read(machine, "BUTTONS_L") << 3;
1312         return input_port_read(space->machine, "BUTTONS_L") << 3;
13121313      case 0x03:   /* Keypad */
13131314         for ( i = 0; i < 4; i++ ) {
13141315            if ( ! ( ( keypad_left_column >> i ) & 0x01 ) ) {
1315               if ( ( input_port_read(machine, "KEYPAD_L") >> 3*i ) & 0x04 ) {
1316               if ( ( input_port_read(space->machine, "KEYPAD_L") >> 3*i ) & 0x04 ) {
13161317                  return 0xff;
13171318               } else {
13181319                  return 0x00;
r3644r3645
13211322         }
13221323         return 0xff;
13231324      case 0x06:   /* Trakball CX-22 */
1324         return input_port_read(machine, "BUTTONS_L") << 4;
1325         return input_port_read(space->machine, "BUTTONS_L") << 4;
13251326      default:
13261327         return 0xff;
13271328      }
13281329      break;
13291330   case 5:   /* Right controller port PIN 6 */
1330      switch ( input_port_read(machine, "CONTROLLERS") % CATEGORY_SELECT ) {
1331      switch ( input_port_read(space->machine, "CONTROLLERS") % CATEGORY_SELECT ) {
13311332      case 0x00:   /* Joystick */
13321333      case 0x05:   /* Joystick w/Boostergrip */
1333         return input_port_read(machine, "BUTTONS_R");
1334         return input_port_read(space->machine, "BUTTONS_R");
13341335      case 0x01:   /* Paddle */
13351336         return 0xff;
13361337      case 0x02:   /* Driving */
1337         return input_port_read(machine, "BUTTONS_R") << 3;
1338         return input_port_read(space->machine, "BUTTONS_R") << 3;
13381339      case 0x03:   /* Keypad */
13391340         for ( i = 0; i < 4; i++ ) {
13401341            if ( ! ( ( keypad_right_column >> i ) & 0x01 ) ) {
1341               if ( ( input_port_read(machine, "KEYPAD_R") >> 3*i ) & 0x04 ) {
1342               if ( ( input_port_read(space->machine, "KEYPAD_R") >> 3*i ) & 0x04 ) {
13421343                  return 0xff;
13431344               } else {
13441345                  return 0x00;
r3644r3645
13471348         }
13481349         return 0xff;
13491350      case 0x06:   /* Trakball CX-22 */
1350         return input_port_read(machine, "BUTTONS_R") << 4;
1351         return input_port_read(space->machine, "BUTTONS_R") << 4;
13511352      default:
13521353         return 0xff;
13531354      }
r3644r3645
13681369   UINT16   last_address, prev_address;
13691370   UINT8   last_byte, prev_byte;
13701371
1371   last_address = activecpu_get_pc() - 1;
1372   last_address = cpu_get_pc(space->machine->cpu[0]) - 1;
13721373   if ( ! ( last_address & 0x1080 ) ) {
13731374      return offset;
13741375   }
r3644r3645
14951496
14961497static MACHINE_RESET( a2600 )
14971498{
1498
1499   const address_space* space = cpu_get_address_space(machine->cpu[0],ADDRESS_SPACE_PROGRAM);
14991500   int chip = 0xFF;
15001501   unsigned long controltemp;
15011502   static const unsigned char snowwhite[] = { 0x10, 0xd0, 0xff, 0xff }; // Snow White Proto
r3644r3645
16691670
16701671   if (banking_mode == modeDC)
16711672   {
1672      memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fec, 0x1fec, 0, 0, current_bank_r);
1673      memory_install_read8_handler(space, 0x1fec, 0x1fec, 0, 0, current_bank_r);
16731674   }
16741675
16751676   /* set up bank switch registers */
r3644r3645
16771678   switch (banking_mode)
16781679   {
16791680   case modeF8:
1680      memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1ff8, 0x1ff9, 0, 0, modeF8_switch_w);
1681      memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1ff8, 0x1ff9, 0, 0, modeF8_switch_r);
1681      memory_install_write8_handler(space, 0x1ff8, 0x1ff9, 0, 0, modeF8_switch_w);
1682      memory_install_read8_handler(space, 0x1ff8, 0x1ff9, 0, 0, modeF8_switch_r);
16821683      break;
16831684
16841685   case modeFA:
1685      memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1ff8, 0x1ffa, 0, 0, modeFA_switch_w);
1686      memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1ff8, 0x1ffa, 0, 0, modeFA_switch_r);
1686      memory_install_write8_handler(space, 0x1ff8, 0x1ffa, 0, 0, modeFA_switch_w);
1687      memory_install_read8_handler(space, 0x1ff8, 0x1ffa, 0, 0, modeFA_switch_r);
16871688      break;
16881689
16891690   case modeF6:
1690      memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1ff6, 0x1ff9, 0, 0, modeF6_switch_w);
1691      memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1ff6, 0x1ff9, 0, 0, modeF6_switch_r);
1691      memory_install_write8_handler(space, 0x1ff6, 0x1ff9, 0, 0, modeF6_switch_w);
1692      memory_install_read8_handler(space, 0x1ff6, 0x1ff9, 0, 0, modeF6_switch_r);
16921693      memory_set_direct_update_handler( 0, modeF6_opbase );
16931694      break;
16941695
16951696   case modeF4:
1696      memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1ff4, 0x1ffb, 0, 0, modeF4_switch_w);
1697      memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1ff4, 0x1ffb, 0, 0, modeF4_switch_r);
1697      memory_install_write8_handler(space, 0x1ff4, 0x1ffb, 0, 0, modeF4_switch_w);
1698      memory_install_read8_handler(space, 0x1ff4, 0x1ffb, 0, 0, modeF4_switch_r);
16981699      break;
16991700
17001701   case modeE0:
1701      memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fe0, 0x1ff8, 0, 0, modeE0_switch_w);
1702      memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fe0, 0x1ff8, 0, 0, modeE0_switch_r);
1702      memory_install_write8_handler(space, 0x1fe0, 0x1ff8, 0, 0, modeE0_switch_w);
1703      memory_install_read8_handler(space, 0x1fe0, 0x1ff8, 0, 0, modeE0_switch_r);
17031704      break;
17041705
17051706   case mode3F:
1706      memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x00, 0x3f, 0, 0, mode3F_switch_w);
1707      memory_install_write8_handler(space, 0x00, 0x3f, 0, 0, mode3F_switch_w);
17071708      break;
17081709
17091710   case modeUA:
1710      memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x200, 0x27f, 0, 0, modeUA_switch_w);
1711      memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x200, 0x27f, 0, 0, modeUA_switch_r);
1711      memory_install_write8_handler(space, 0x200, 0x27f, 0, 0, modeUA_switch_w);
1712      memory_install_read8_handler(space, 0x200, 0x27f, 0, 0, modeUA_switch_r);
17121713      break;
17131714
17141715   case modeE7:
1715      memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fe0, 0x1fe7, 0, 0, modeE7_switch_w);
1716      memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fe0, 0x1fe7, 0, 0, modeE7_switch_r);
1717      memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fe8, 0x1feb, 0, 0, modeE7_RAM_switch_w);
1718      memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fe8, 0x1feb, 0, 0, modeE7_RAM_switch_r);
1719      memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1800, 0x18ff, 0, 0, SMH_BANK9);
1720      memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1900, 0x19ff, 0, 0, SMH_BANK9);
1721      memory_set_bankptr( 9, extra_RAM + 4 * 256 );
1716      memory_install_write8_handler(space, 0x1fe0, 0x1fe7, 0, 0, modeE7_switch_w);
1717      memory_install_read8_handler(space, 0x1fe0, 0x1fe7, 0, 0, modeE7_switch_r);
1718      memory_install_write8_handler(space, 0x1fe8, 0x1feb, 0, 0, modeE7_RAM_switch_w);
1719      memory_install_read8_handler(space, 0x1fe8, 0x1feb, 0, 0, modeE7_RAM_switch_r);
1720      memory_install_write8_handler(space, 0x1800, 0x18ff, 0, 0, SMH_BANK9);
1721      memory_install_read8_handler(space, 0x1900, 0x19ff, 0, 0, SMH_BANK9);
1722      memory_set_bankptr(machine, 9, extra_RAM + 4 * 256 );
17221723      break;
17231724
17241725   case modeDC:
1725      memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1ff0, 0x1ff0, 0, 0, modeDC_switch_w);
1726      memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1ff0, 0x1ff0, 0, 0, modeDC_switch_r);
1726      memory_install_write8_handler(space, 0x1ff0, 0x1ff0, 0, 0, modeDC_switch_w);
1727      memory_install_read8_handler(space, 0x1ff0, 0x1ff0, 0, 0, modeDC_switch_r);
17271728      break;
17281729
17291730   case modeFE:
1730      memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x01fe, 0x01fe, 0, 0, modeFE_switch_w);
1731      memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x01fe, 0x01fe, 0, 0, modeFE_switch_r);
1731      memory_install_write8_handler(space, 0x01fe, 0x01fe, 0, 0, modeFE_switch_w);
1732      memory_install_read8_handler(space, 0x01fe, 0x01fe, 0, 0, modeFE_switch_r);
17321733      break;
17331734
17341735   case mode3E:
1735      memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x3e, 0x3e, 0, 0, mode3E_RAM_switch_w);
1736      memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x3f, 0x3f, 0, 0, mode3E_switch_w);
1737      memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1400, 0x15ff, 0, 0, mode3E_RAM_w);
1736      memory_install_write8_handler(space, 0x3e, 0x3e, 0, 0, mode3E_RAM_switch_w);
1737      memory_install_write8_handler(space, 0x3f, 0x3f, 0, 0, mode3E_switch_w);
1738      memory_install_write8_handler(space, 0x1400, 0x15ff, 0, 0, mode3E_RAM_w);
17381739      break;
17391740
17401741   case modeSS:
1741      memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1000, 0x1fff, 0, 0, modeSS_r);
1742      memory_install_read8_handler(space, 0x1000, 0x1fff, 0, 0, modeSS_r);
17421743      bank_base[1] = extra_RAM + 2 * 0x800;
17431744      bank_base[2] = CART;
1744      memory_set_bankptr( 1, bank_base[1] );
1745      memory_set_bankptr( 2, bank_base[2] );
1745      memory_set_bankptr(machine, 1, bank_base[1] );
1746      memory_set_bankptr(machine, 2, bank_base[2] );
17461747      modeSS_write_enabled = 0;
17471748      modeSS_byte_started = 0;
17481749      memory_set_direct_update_handler( 0, modeSS_opbase );
r3644r3645
17511752      break;
17521753
17531754   case modeFV:
1754      memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fd0, 0x1fd0, 0, 0, modeFV_switch_w);
1755      memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1fd0, 0x1fd0, 0, 0, modeFV_switch_r);
1755      memory_install_write8_handler(space, 0x1fd0, 0x1fd0, 0, 0, modeFV_switch_w);
1756      memory_install_read8_handler(space, 0x1fd0, 0x1fd0, 0, 0, modeFV_switch_r);
17561757      break;
17571758
17581759   case modeDPC:
1759      memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1000, 0x103f, 0, 0, modeDPC_r);
1760      memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1040, 0x107f, 0, 0, modeDPC_w);
1761      memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1ff8, 0x1ff9, 0, 0, modeF8_switch_w);
1762      memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1ff8, 0x1ff9, 0, 0, modeF8_switch_r);
1760      memory_install_read8_handler(space, 0x1000, 0x103f, 0, 0, modeDPC_r);
1761      memory_install_write8_handler(space, 0x1040, 0x107f, 0, 0, modeDPC_w);
1762      memory_install_write8_handler(space, 0x1ff8, 0x1ff9, 0, 0, modeF8_switch_w);
1763      memory_install_read8_handler(space, 0x1ff8, 0x1ff9, 0, 0, modeF8_switch_r);
17631764      memory_set_direct_update_handler( 0, modeDPC_opbase_handler );
17641765      {
17651766         int   data_fetcher;
r3644r3645
17741775      break;
17751776
17761777   case mode32in1:
1777      memory_set_bankptr( 1, CART + current_reset_bank_counter * 0x800 );
1778      memory_set_bankptr( 2, CART + current_reset_bank_counter * 0x800 );
1778      memory_set_bankptr(machine, 1, CART + current_reset_bank_counter * 0x800 );
1779      memory_set_bankptr(machine, 2, CART + current_reset_bank_counter * 0x800 );
17791780      break;
17801781
17811782   case modeJVP:
1782      memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0FA0, 0x0FC0, 0, 0, modeJVP_switch_r);
1783      memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0FA0, 0x0FC0, 0, 0, modeJVP_switch_w);
1783      memory_install_read8_handler(space, 0x0FA0, 0x0FC0, 0, 0, modeJVP_switch_r);
1784      memory_install_write8_handler(space, 0x0FA0, 0x0FC0, 0, 0, modeJVP_switch_w);
17841785      break;
17851786   }
17861787
r3644r3645
17881789
17891790   if (banking_mode == modeFA)
17901791   {
1791      memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1000, 0x10ff, 0, 0, SMH_BANK9);
1792      memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1100, 0x11ff, 0, 0, SMH_BANK9);
1792      memory_install_write8_handler(space, 0x1000, 0x10ff, 0, 0, SMH_BANK9);
1793      memory_install_read8_handler(space, 0x1100, 0x11ff, 0, 0, SMH_BANK9);
17931794
1794      memory_set_bankptr(machine, 9, extra_RAM);
1795      memory_set_bankptr(machine,9, extra_RAM);
17951796   }
17961797
17971798   if (banking_mode == modeCV)
17981799   {
1799      memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1400, 0x17ff, 0, 0, SMH_BANK9);
1800      memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1000, 0x13ff, 0, 0, SMH_BANK9);
1800      memory_install_write8_handler(space, 0x1400, 0x17ff, 0, 0, SMH_BANK9);
1801      memory_install_read8_handler(space, 0x1000, 0x13ff, 0, 0, SMH_BANK9);
18011802
1802      memory_set_bankptr(machine, 9, extra_RAM);
1803      memory_set_bankptr(machine,9, extra_RAM);
18031804   }
18041805
18051806   if (chip)
18061807   {
1807      memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1000, 0x107f, 0, 0, SMH_BANK9);
1808      memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x1080, 0x10ff, 0, 0, SMH_BANK9);
1808      memory_install_write8_handler(space, 0x1000, 0x107f, 0, 0, SMH_BANK9);
1809      memory_install_read8_handler(space, 0x1080, 0x10ff, 0, 0, SMH_BANK9);
18091810
1810      memory_set_bankptr(machine, 9, extra_RAM);
1811      memory_set_bankptr(machine,9, extra_RAM);
18111812   }
18121813}
18131814
src/mess/drivers/at.c
r3644r3645
118118   if ( offset )
119119      return 0xFF;
120120   else
121      return ym3812_status_port_0_r( machine, 0 );
121      return ym3812_status_port_0_r( space, 0 );
122122}
123123
124124static WRITE8_HANDLER(at_adlib_w)
125125{
126126   if ( offset )
127      ym3812_write_port_0_w( machine, 0, data );
127      ym3812_write_port_0_w( space, 0, data );
128128   else
129      ym3812_control_port_0_w( machine, 0, data );
129      ym3812_control_port_0_w( space, 0, data );
130130}
131131#endif
132132

Previous 15994 Revisions Next


© 1998-2018 The MESS Team