Previous 15994 Revisions Next

r4557 Saturday 25th April, 2009 at 17:11:23 UTC by Fabio Priuli
Replaced a few cpu numbers with corresponding tags
[src/mess/drivers]a2600.c abc80.c abc80x.c adam.c amiga.c apexc.c
[src/mess/machine]3do.c a7800.c aim65.c
[src/mess/video]a7800.c ac1.c

src/mess/video/ac1.c
r4556r4557
2929VIDEO_UPDATE( ac1 )
3030{
3131   int x,y;
32   const address_space *space = cpu_get_address_space(screen->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
32   const address_space *space = cputag_get_address_space(screen->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
3333   
3434   for(y = 0; y < 16; y++ )
3535   {
r4556r4557
4646VIDEO_UPDATE( ac1_32 )
4747{
4848   int x,y;
49   const address_space *space = cpu_get_address_space(screen->machine->cpu[0], ADDRESS_SPACE_PROGRAM);
49   const address_space *space = cputag_get_address_space(screen->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
5050   
5151   for(y = 0; y < 32; y++ )
5252   {
src/mess/video/a7800.c
r4556r4557
106106
107107static void maria_draw_scanline(running_machine *machine)
108108{
109   const address_space* space = cpu_get_address_space(machine->cpu[0],ADDRESS_SPACE_PROGRAM);
109   const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
110110   unsigned int graph_adr,data_addr;
111111   int width,hpos,pal,mode,ind;
112112   unsigned int dl;
r4556r4557
340340{
341341   int frame_scanline;
342342   UINT8 *ROM = memory_region(device->machine, "maincpu");
343   const address_space* space = cpu_get_address_space(device->machine->cpu[0],ADDRESS_SPACE_PROGRAM);
343   const address_space* space = cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
344344   
345345   maria_scanline++;
346346
r4556r4557
498498         maria_palette[0][3] = data;
499499         break;
500500      case 0x04:
501         cpu_spinuntil_trigger(space->machine->cpu[0],TRIGGER_HSYNC);
501         cpu_spinuntil_trigger(cputag_get_cpu(space->machine, "maincpu"), TRIGGER_HSYNC);
502502         maria_wsync=1;
503503         break;
504504
src/mess/machine/3do.c
r4556r4557
1919
2020
2121READ32_HANDLER( nvarea_r ) {
22   logerror( "%08X: NVRAM read offset = %08X\n", cpu_get_pc(space->machine->cpu[0]), offset );
22   logerror( "%08X: NVRAM read offset = %08X\n", cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")), offset );
2323   return 0;
2424}
2525
2626WRITE32_HANDLER( nvarea_w ) {
27   logerror( "%08X: NVRAM write offset = %08X, data = %08X, mask = %08X\n", cpu_get_pc(space->machine->cpu[0]), offset, data, mem_mask );
27   logerror( "%08X: NVRAM write offset = %08X, data = %08X, mask = %08X\n", cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")), offset, data, mem_mask );
2828}
2929
3030
r4556r4557
7171   several groups of 16 write actions or 16 read actions
7272*/
7373READ32_HANDLER( unk_318_r ) {
74   logerror( "%08X: UNK_318 read offset = %08X\n", cpu_get_pc(space->machine->cpu[0]), offset );
74   logerror( "%08X: UNK_318 read offset = %08X\n", cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")), offset );
7575#if 0
7676   switch( offset ) {
7777   case 0:      /* Boot ROM checks here and expects to read 1, 0, 1, 0 in the lowest bit */
r4556r4557
8484
8585WRITE32_HANDLER( unk_318_w )
8686{
87   logerror( "%08X: UNK_318 write offset = %08X, data = %08X, mask = %08X\n", cpu_get_pc(space->machine->cpu[0]), offset, data, mem_mask );
87   logerror( "%08X: UNK_318 write offset = %08X, data = %08X, mask = %08X\n", cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")), offset, data, mem_mask );
8888
8989   switch( offset )
9090   {
r4556r4557
100100
101101
102102READ32_HANDLER( vram_sport_r ) {
103   logerror( "%08X: VRAM SPORT read offset = %08X\n", cpu_get_pc(space->machine->cpu[0]), offset );
103   logerror( "%08X: VRAM SPORT read offset = %08X\n", cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")), offset );
104104   switch( offset ) {
105105   case 0x1840:   /* 03206100 - ?? */
106106      break;
r4556r4557
111111}
112112
113113WRITE32_HANDLER( vram_sport_w ) {
114   logerror( "%08X: VRAM SPORT write offset = %08X, data = %08X, mask = %08X\n", cpu_get_pc(space->machine->cpu[0]), offset, data, mem_mask );
114   logerror( "%08X: VRAM SPORT write offset = %08X, data = %08X, mask = %08X\n", cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")), offset, data, mem_mask );
115115   switch( offset ) {
116116   case 0x0800:   /* 03202000 - ?? during boot 00190019 gets written */
117117      break;
r4556r4557
123123
124124
125125READ32_HANDLER( madam_r ) {
126   logerror( "%08X: MADAM read offset = %08X\n", cpu_get_pc(space->machine->cpu[0]), offset );
126   logerror( "%08X: MADAM read offset = %08X\n", cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")), offset );
127127   switch( offset ) {
128128   case 0:      /* 03300000 - Revision */
129129      return madam.revision;
r4556r4557
135135
136136
137137WRITE32_HANDLER( madam_w ) {
138   logerror( "%08X: MADAM write offset = %08X, data = %08X, mask = %08X\n", cpu_get_pc(space->machine->cpu[0]), offset, data, mem_mask );
138   logerror( "%08X: MADAM write offset = %08X, data = %08X, mask = %08X\n", cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")), offset, data, mem_mask );
139139   switch( offset ) {
140140   case 0x01:   /* 03300004 - Memory configuration 29 = 2MB DRAM, 1MB VRAM */
141141      madam.memory_configuration = data;
r4556r4557
157157
158158READ32_HANDLER( clio_r )
159159{
160   logerror( "%08X: CLIO read offset = %08X\n", cpu_get_pc(space->machine->cpu[0]), offset );
160   logerror( "%08X: CLIO read offset = %08X\n", cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")), offset );
161161
162162   switch( offset )
163163   {
r4556r4557
176176
177177WRITE32_HANDLER( clio_w )
178178{
179   logerror( "%08X: CLIO write offset = %08X, data = %08X, mask = %08X\n", cpu_get_pc(space->machine->cpu[0]), offset, data, mem_mask );
179   logerror( "%08X: CLIO write offset = %08X, data = %08X, mask = %08X\n", cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")), offset, data, mem_mask );
180180
181181   switch( offset )
182182   {
src/mess/machine/aim65.c
r4556r4557
156156
157157void aim65_riot_irq(const device_config *device, int state)
158158{
159   cpu_set_input_line(device->machine->cpu[0], M6502_IRQ_LINE, state ? HOLD_LINE : CLEAR_LINE);
159   cputag_set_input_line(device->machine, "maincpu", M6502_IRQ_LINE, state ? HOLD_LINE : CLEAR_LINE);
160160}
161161
162162
r4556r4557
168168MACHINE_START( aim65 )
169169{
170170   const device_config *via_0 = devtag_get_device(machine, "via6522_0");
171   const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM);
171   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
172172
173173   /* Init RAM */
174174   memory_install_readwrite8_handler(space, 0, mess_ram_size - 1, 0, 0, SMH_BANK1, SMH_BANK1);
src/mess/machine/a7800.c
r4556r4557
7676
7777static void a7800_driver_init(running_machine *machine, int ispal, int lines)
7878{
79   const address_space* space = cpu_get_address_space(machine->cpu[0],ADDRESS_SPACE_PROGRAM);
79   const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
8080   ROM = memory_region(machine, "maincpu");
8181   a7800_ispal = ispal;
8282   a7800_lines = lines;
r4556r4557
111111MACHINE_RESET( a7800 )
112112{
113113   UINT8 *memory;
114   const address_space* space = cpu_get_address_space(machine->cpu[0],ADDRESS_SPACE_PROGRAM);
114   const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
115115
116116   a7800_ctrl_lock = 0;
117117   a7800_ctrl_reg = 0;
src/mess/drivers/adam.c
r4556r4557
435435    /* only if it goes up */
436436   if (state && !last_state)
437437    {
438        cpu_set_input_line(machine->cpu[0], INPUT_LINE_NMI, PULSE_LINE);
438        cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE);
439439    }
440440   last_state = state;
441441}
r4556r4557
460460      adam_joy_stat[1] = 1;
461461
462462   if (adam_joy_stat[0] || adam_joy_stat[1])
463      cpu_set_input_line(machine->cpu[0], 0, HOLD_LINE);
463      cputag_set_input_line(machine, "maincpu", 0, HOLD_LINE);
464464}
465465
466466void adam_set_memory_banks(running_machine *machine)
src/mess/drivers/abc80.c
r4556r4557
364364
365365static INTERRUPT_GEN( abc80_nmi_interrupt )
366366{
367   cpu_set_input_line(device->machine->cpu[0], INPUT_LINE_NMI, PULSE_LINE);
367   cputag_set_input_line(device->machine, Z80_TAG, INPUT_LINE_NMI, PULSE_LINE);
368368}
369369
370370/* Z80 PIO */
r4556r4557
381381
382382static void abc80_pio_interrupt(const device_config *device, int state)
383383{
384   cpu_set_input_line(device->machine->cpu[0], INPUT_LINE_IRQ0, state);
384   cputag_set_input_line(device->machine, Z80_TAG, INPUT_LINE_IRQ0, state);
385385}
386386
387387static READ8_DEVICE_HANDLER( abc80_pio_port_a_r )
r4556r4557
494494   switch (mess_ram_size)
495495   {
496496   case 16*1024:
497      memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0xbfff, 0, 0, SMH_UNMAP, SMH_UNMAP);
497      memory_install_readwrite8_handler(cputag_get_address_space(machine, Z80_TAG, ADDRESS_SPACE_PROGRAM), 0x8000, 0xbfff, 0, 0, SMH_UNMAP, SMH_UNMAP);
498498      break;
499499
500500   case 32*1024:
501      memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0xbfff, 0, 0, SMH_BANK1, SMH_BANK1);
501      memory_install_readwrite8_handler(cputag_get_address_space(machine, Z80_TAG, ADDRESS_SPACE_PROGRAM), 0x8000, 0xbfff, 0, 0, SMH_BANK1, SMH_BANK1);
502502      break;
503503   }
504504
src/mess/drivers/apexc.c
r4556r4557
278278   PORT_BIT(panel_mem, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Read mem")                PORT_CODE(KEYCODE_6_PAD)
279279   PORT_BIT(panel_write, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Write instead of read") PORT_CODE(KEYCODE_LSHIFT)
280280
281   PORT_START("data1")   /* 1 : data edit #1 */
282   PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #1")              PORT_CODE(KEYCODE_1)
283   PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #2")              PORT_CODE(KEYCODE_2)
284   PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #3")              PORT_CODE(KEYCODE_3)
285   PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #4")              PORT_CODE(KEYCODE_4)
286   PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #5")              PORT_CODE(KEYCODE_5)
287   PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #6")              PORT_CODE(KEYCODE_6)
288   PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #7")              PORT_CODE(KEYCODE_7)
289   PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #8")              PORT_CODE(KEYCODE_8)
290   PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #9")              PORT_CODE(KEYCODE_9)
291   PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #10")             PORT_CODE(KEYCODE_0)
292   PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #11")             PORT_CODE(KEYCODE_Q)
293   PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #12")             PORT_CODE(KEYCODE_W)
294   PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #13")             PORT_CODE(KEYCODE_E)
295   PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #14")             PORT_CODE(KEYCODE_R)
296   PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #15")             PORT_CODE(KEYCODE_T)
297   PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #16")             PORT_CODE(KEYCODE_Y)
281   PORT_START("data")   /* data edit */
282   PORT_BIT(0x80000000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #1")              PORT_CODE(KEYCODE_1)
283   PORT_BIT(0x40000000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #2")              PORT_CODE(KEYCODE_2)
284   PORT_BIT(0x20000000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #3")              PORT_CODE(KEYCODE_3)
285   PORT_BIT(0x10000000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #4")              PORT_CODE(KEYCODE_4)
286   PORT_BIT(0x08000000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #5")              PORT_CODE(KEYCODE_5)
287   PORT_BIT(0x04000000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #6")              PORT_CODE(KEYCODE_6)
288   PORT_BIT(0x02000000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #7")              PORT_CODE(KEYCODE_7)
289   PORT_BIT(0x01000000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #8")              PORT_CODE(KEYCODE_8)
290   PORT_BIT(0x00800000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #9")              PORT_CODE(KEYCODE_9)
291   PORT_BIT(0x00400000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #10")             PORT_CODE(KEYCODE_0)
292   PORT_BIT(0x00200000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #11")             PORT_CODE(KEYCODE_Q)
293   PORT_BIT(0x00100000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #12")             PORT_CODE(KEYCODE_W)
294   PORT_BIT(0x00080000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #13")             PORT_CODE(KEYCODE_E)
295   PORT_BIT(0x00040000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #14")             PORT_CODE(KEYCODE_R)
296   PORT_BIT(0x00020000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #15")             PORT_CODE(KEYCODE_T)
297   PORT_BIT(0x00010000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #16")             PORT_CODE(KEYCODE_Y)
298298
299   PORT_START("data2")   /* 2 : data edit #2 */
300   PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #17")             PORT_CODE(KEYCODE_U)
301   PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #18")             PORT_CODE(KEYCODE_I)
302   PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #19")             PORT_CODE(KEYCODE_O)
303   PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #20")             PORT_CODE(KEYCODE_P)
304   PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #21")             PORT_CODE(KEYCODE_A)
305   PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #22")             PORT_CODE(KEYCODE_S)
306   PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #23")             PORT_CODE(KEYCODE_D)
307   PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #24")             PORT_CODE(KEYCODE_F)
308   PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #25")             PORT_CODE(KEYCODE_G)
309   PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #26")             PORT_CODE(KEYCODE_H)
310   PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #27")             PORT_CODE(KEYCODE_J)
311   PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #28")             PORT_CODE(KEYCODE_K)
312   PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #29")             PORT_CODE(KEYCODE_L)
313   PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #30")             PORT_CODE(KEYCODE_Z)
314   PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #31")             PORT_CODE(KEYCODE_X)
315   PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #32")             PORT_CODE(KEYCODE_C)
316
299   PORT_BIT(0x00008000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #17")             PORT_CODE(KEYCODE_U)
300   PORT_BIT(0x00004000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #18")             PORT_CODE(KEYCODE_I)
301   PORT_BIT(0x00002000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #19")             PORT_CODE(KEYCODE_O)
302   PORT_BIT(0x00001000, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #20")             PORT_CODE(KEYCODE_P)
303   PORT_BIT(0x00000800, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #21")             PORT_CODE(KEYCODE_A)
304   PORT_BIT(0x00000400, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #22")             PORT_CODE(KEYCODE_S)
305   PORT_BIT(0x00000200, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #23")             PORT_CODE(KEYCODE_D)
306   PORT_BIT(0x00000100, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #24")             PORT_CODE(KEYCODE_F)
307   PORT_BIT(0x00000080, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #25")             PORT_CODE(KEYCODE_G)
308   PORT_BIT(0x00000040, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #26")             PORT_CODE(KEYCODE_H)
309   PORT_BIT(0x00000020, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #27")             PORT_CODE(KEYCODE_J)
310   PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #28")             PORT_CODE(KEYCODE_K)
311   PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #29")             PORT_CODE(KEYCODE_L)
312   PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #30")             PORT_CODE(KEYCODE_Z)
313   PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #31")             PORT_CODE(KEYCODE_X)
314   PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toggle bit #32")             PORT_CODE(KEYCODE_C)
317315INPUT_PORTS_END
318316
319317
r4556r4557
326324*/
327325static INTERRUPT_GEN( apexc_interrupt )
328326{
329   const address_space* space = cpu_get_address_space(device->machine->cpu[0],ADDRESS_SPACE_PROGRAM);
327   const address_space* space = cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
330328   UINT32 edit_keys;
331329   int control_keys;
332330
r4556r4557
337335
338336
339337   /* read new state of edit keys */
340   edit_keys = (input_port_read(device->machine, "data1") << 16) | input_port_read(device->machine, "data2");
338   edit_keys = input_port_read(device->machine, "data");
341339
342340   /* toggle data reg according to transitions */
343341   panel_data_reg ^= edit_keys & (~ old_edit_keys);
r4556r4557
542540
543541   apexc_draw_led(bitmap, 0, 0, 1);
544542
545   apexc_draw_led(bitmap, 0, 8, cpu_get_reg(screen->machine->cpu[0], APEXC_STATE));
543   apexc_draw_led(bitmap, 0, 8, cpu_get_reg(cputag_get_cpu(screen->machine, "maincpu"), APEXC_STATE));
546544
547545   for (i=0; i<32; i++)
548546   {
src/mess/drivers/a2600.c
r4556r4557
533533   }
534534   /* Check the reset vector does not point into the super chip RAM area */
535535   i = ( cart[0x0FFD] << 8 ) | cart[0x0FFC];
536   if ( ( i & 0x0FFF ) < 0x0100 ) {
536   if ( ( i & 0x0FFF ) < 0x0100 )
537   {
537538      return 0;
538539   }
539540   return 1;
r4556r4557
578579
579580   image_fread(image, cart, cart_size);
580581
581   if (!(cart_size == 0x4000 && detect_modef6(image->machine))) {
582      while (cart_size > 0x00800) {
582   if (!(cart_size == 0x4000 && detect_modef6(image->machine)))
583   {
584      while (cart_size > 0x00800)
585      {
583586         if (!memcmp(cart, &cart[cart_size/2],cart_size/2)) cart_size /= 2;
584587         else break;
585588      }
r4556r4557
587590
588591   extrainfo = image_extrainfo( image );
589592
590   if ( extrainfo && extrainfo[0] ) {
591      for ( eibd = extrainfo_banking_defs; eibd->extrainfo[0]; eibd++ ) {
592         if ( ! mame_stricmp( eibd->extrainfo, extrainfo ) ) {
593   if ( extrainfo && extrainfo[0] )
594   {
595      for ( eibd = extrainfo_banking_defs; eibd->extrainfo[0]; eibd++ )
596      {
597         if ( ! mame_stricmp( eibd->extrainfo, extrainfo ) )
598         {
593599            banking_mode = eibd->bank_mode;
594600         }
595601      }
r4556r4557
669675static void modeFV_switch(running_machine *machine, UINT16 offset, UINT8 data)
670676{
671677   //printf("ModeFV %04x\n",offset);
672   if (!FVlocked && ( cpu_get_pc(machine->cpu[0]) & 0x1F00 ) == 0x1F00 ) {
678   if (!FVlocked && ( cpu_get_pc(cputag_get_cpu(machine, "maincpu")) & 0x1F00 ) == 0x1F00 )
679   {
673680      FVlocked = 1;
674681      current_bank = current_bank ^ 0x01;
675682      bank_base[1] = CART + 0x1000 * current_bank;
r4556r4557
678685}
679686static void modeJVP_switch(running_machine *machine, UINT16 offset, UINT8 data)
680687{
681   switch( offset ) {
688   switch( offset )
689   {
682690   case 0x00:
683691   case 0x20:
684692      current_bank ^= 1;
685693      break;
686694   default:
687      printf("%04X: write to unknown mapper address %02X\n", cpu_get_pc(machine->cpu[0]), 0xfa0 + offset );
695      printf("%04X: write to unknown mapper address %02X\n", cpu_get_pc(cputag_get_cpu(machine, "maincpu")), 0xfa0 + offset );
688696      break;
689697   }
690698   bank_base[1] = CART + 0x1000 * current_bank;
r4556r4557
718726static WRITE8_HANDLER(modeDC_switch_w) { modeDC_switch(space->machine, offset, data); }
719727static WRITE8_HANDLER(mode3E_switch_w) { mode3E_switch(space->machine, offset, data); }
720728static WRITE8_HANDLER(mode3E_RAM_switch_w) { mode3E_RAM_switch(space->machine, offset, data); }
721static WRITE8_HANDLER(mode3E_RAM_w) {
722   if ( mode3E_ram_enabled ) {
729static WRITE8_HANDLER(mode3E_RAM_w)
730{
731   if ( mode3E_ram_enabled )
732   {
723733      ram_base[offset] = data;
724734   }
725735}
r4556r4557
729739
730740static DIRECT_UPDATE_HANDLER( modeF6_opbase )
731741{
732   if ( ( address & 0x1FFF ) >= 0x1FF6 && ( address & 0x1FFF ) <= 0x1FF9 ) {
742   if ( ( address & 0x1FFF ) >= 0x1FF6 && ( address & 0x1FFF ) <= 0x1FF9 )
743   {
733744      modeF6_switch_w( space, ( address & 0x1FFF ) - 0x1FF6, 0 );
734745   }
735746   return address;
r4556r4557
737748
738749static DIRECT_UPDATE_HANDLER( modeSS_opbase )
739750{
740   if ( address & 0x1000 ) {
751   if ( address & 0x1000 )
752   {
741753      direct->bytemask = 0x7ff;
742754      direct->bytestart = ( address & 0xf800 );
743755      direct->byteend = ( address & 0xf800 ) | 0x7ff;
744      if ( address & 0x800 ) {
756      if ( address & 0x800 )
757      {
745758         direct->decrypted = bank_base[2];
746759         direct->raw = bank_base[2];
747      } else {
760      }
761      else
762      {
748763         direct->decrypted = bank_base[1];
749764         direct->raw = bank_base[1];
750765      }
r4556r4557
757772{
758773   UINT8 data = ( offset & 0x800 ) ? bank_base[2][offset & 0x7FF] : bank_base[1][offset];
759774
760   //logerror("%04X: read from modeSS area offset = %04X\n", cpu_get_pc(machine->cpu[0]), offset);
775   //logerror("%04X: read from modeSS area offset = %04X\n", cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")), offset);
761776   /* Check for control register "write" */
762   if ( offset == 0xFF8 ) {
763      //logerror("%04X: write to modeSS control register data = %02X\n", cpu_get_pc(machine->cpu[0]), modeSS_byte);
777   if ( offset == 0xFF8 )
778   {
779      //logerror("%04X: write to modeSS control register data = %02X\n", cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")), modeSS_byte);
764780      modeSS_write_enabled = modeSS_byte & 0x02;
765781      modeSS_write_delay = modeSS_byte >> 5;
766      switch ( modeSS_byte & 0x1C ) {
782      switch ( modeSS_byte & 0x1C )
783      {
767784      case 0x00:
768785         bank_base[1] = extra_RAM + 2 * 0x800;
769786         bank_base[2] = ( modeSS_byte & 0x01 ) ? memory_region(space->machine, "maincpu") + 0x1800 : memory_region(space->machine, "user1");
r4556r4557
809826      memory_set_bankptr(space->machine, 2, bank_base[2] );
810827
811828      /* Check if we should stop the tape */
812      if ( cpu_get_pc(space->machine->cpu[0]) == 0x00FD ) {
829      if ( cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")) == 0x00FD )
830      {
813831         const device_config *img = devtag_get_device(space->machine, "cassette");
814         if ( img ) {
832         if ( img )
833         {
815834            cassette_change_state(img, CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR);
816835         }
817836      }
818   } else if ( offset == 0xFF9 ) {
837   }
838   else if ( offset == 0xFF9 )
839   {
819840      /* Cassette port read */
820841      double tap_val = cassette_input( devtag_get_device(space->machine, "cassette") );
821      //logerror("%04X: Cassette port read, tap_val = %f\n", cpu_get_pc(machine->cpu[0]), tap_val);
822      if ( tap_val < 0 ) {
842      //logerror("%04X: Cassette port read, tap_val = %f\n", cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")), tap_val);
843      if ( tap_val < 0 )
844      {
823845         data = 0x00;
824      } else {
846      }
847      else
848      {
825849         data = 0x01;
826850      }
827   } else {
851   }
852   else
853   {
828854      /* Possible RAM write */
829      if ( modeSS_write_enabled ) {
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);
832         if ( diff - modeSS_diff_adjust == 5 ) {
833            //logerror("%04X: RAM write offset = %04X, data = %02X\n", cpu_get_pc(machine->cpu[0]), offset, modeSS_byte );
834            if ( offset & 0x800 ) {
835               if ( modeSS_high_ram_enabled ) {
855      if ( modeSS_write_enabled )
856      {
857         int diff = cputag_get_total_cycles(space->machine, "maincpu") - modeSS_byte_started;
858         //logerror("%04X: offset = %04X, %d\n", cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")), offset, diff);
859         if ( diff - modeSS_diff_adjust == 5 )
860         {
861            //logerror("%04X: RAM write offset = %04X, data = %02X\n", cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")), offset, modeSS_byte );
862            if ( offset & 0x800 )
863            {
864               if ( modeSS_high_ram_enabled )
865               {
836866                  bank_base[2][offset & 0x7FF] = modeSS_byte;
837867                  data = modeSS_byte;
838868               }
839            } else {
869            }
870            else
871            {
840872               bank_base[1][offset] = modeSS_byte;
841873               data = modeSS_byte;
842874            }
843         } else if ( offset < 0x0100 ) {
875         }
876         else if ( offset < 0x0100 )
877         {
844878            modeSS_byte = offset;
845            modeSS_byte_started = cpu_get_total_cycles(space->machine->cpu[0]);
879            modeSS_byte_started = cputag_get_total_cycles(space->machine, "maincpu");
846880         }
847881         /* Check for dummy read from same address */
848         if ( diff == 2 ) {
882         if ( diff == 2 )
883         {
849884            modeSS_diff_adjust = 1;
850         } else {
885         }
886         else
887         {
851888            modeSS_diff_adjust = 0;
852889         }
853      } else if ( offset < 0x0100 ) {
890      }
891      else if ( offset < 0x0100 )
892      {
854893         modeSS_byte = offset;
855         modeSS_byte_started = cpu_get_total_cycles(space->machine->cpu[0]);
894         modeSS_byte_started = cputag_get_total_cycles(space->machine, "maincpu");
856895      }
857896   }
858897   /* Because the mame core caches opcode data and doesn't perform reads like normal */
859898   /* we have to put in this little hack here to get Suicide Mission to work. */
860   if ( offset != 0xFF8 && ( cpu_get_pc(space->machine->cpu[0]) & 0x1FFF ) == 0x1FF8 ) {
899   if ( offset != 0xFF8 && ( cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")) & 0x1FFF ) == 0x1FF8 )
900   {
861901      modeSS_r( space, 0xFF8 );
862902   }
863903   return data;
864904}
865905
866INLINE void modeDPC_check_flag(UINT8 data_fetcher) {
906INLINE void modeDPC_check_flag(UINT8 data_fetcher)
907{
867908   /* Set flag when low counter equals top */
868   if ( dpc.df[data_fetcher].low == dpc.df[data_fetcher].top ) {
909   if ( dpc.df[data_fetcher].low == dpc.df[data_fetcher].top )
910   {
869911      dpc.df[data_fetcher].flag = 1;
870912   }
871913   /* Reset flag when low counter equals bottom */
872   if ( dpc.df[data_fetcher].low == dpc.df[data_fetcher].bottom ) {
914   if ( dpc.df[data_fetcher].low == dpc.df[data_fetcher].bottom )
915   {
873916      dpc.df[data_fetcher].flag = 0;
874917   }
875918}
876919
877INLINE void modeDPC_decrement_counter(UINT8 data_fetcher) {
920INLINE void modeDPC_decrement_counter(UINT8 data_fetcher)
921{
878922   dpc.df[data_fetcher].low -= 1;
879   if ( dpc.df[data_fetcher].low == 0xFF ) {
923   if ( dpc.df[data_fetcher].low == 0xFF )
924   {
880925      dpc.df[data_fetcher].high -= 1;
881      if ( data_fetcher > 4 && dpc.df[data_fetcher].music_mode ) {
926      if ( data_fetcher > 4 && dpc.df[data_fetcher].music_mode )
927      {
882928         dpc.df[data_fetcher].low = dpc.df[data_fetcher].top;
883929      }
884930   }
r4556r4557
889935static TIMER_CALLBACK(modeDPC_timer_callback)
890936{
891937   int data_fetcher;
892   for( data_fetcher = 5; data_fetcher < 8; data_fetcher++ ) {
893      if ( dpc.df[data_fetcher].osc_clk ) {
938   for( data_fetcher = 5; data_fetcher < 8; data_fetcher++ )
939   {
940      if ( dpc.df[data_fetcher].osc_clk )
941      {
894942         modeDPC_decrement_counter( data_fetcher );
895943      }
896944   }
r4556r4557
912960   UINT8   data_fetcher = offset & 0x07;
913961   UINT8   data = 0xFF;
914962
915   logerror("%04X: Read from DPC offset $%02X\n", cpu_get_pc(space->machine->cpu[0]), offset);
916   if ( offset < 0x08 ) {
917      switch( offset & 0x06 ) {
963   logerror("%04X: Read from DPC offset $%02X\n", cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")), offset);
964   if ( offset < 0x08 )
965   {
966      switch( offset & 0x06 )
967      {
918968      case 0x00:      /* Random number generator */
919969      case 0x02:
920970         return dpc.shift_reg;
r4556r4557
924974         dpc.latch_64 = dpc.latch_62 + dpc.df[4].top;
925975         dpc.dlc = ( dpc.latch_62 + dpc.df[4].top > 0xFF ) ? 1 : 0;
926976         data = 0;
927         if ( dpc.df[5].music_mode && dpc.df[5].flag ) {
977         if ( dpc.df[5].music_mode && dpc.df[5].flag )
978         {
928979            data |= 0x01;
929980         }
930         if ( dpc.df[6].music_mode && dpc.df[6].flag ) {
981         if ( dpc.df[6].music_mode && dpc.df[6].flag )
982         {
931983            data |= 0x02;
932984         }
933         if ( dpc.df[7].music_mode && dpc.df[7].flag ) {
985         if ( dpc.df[7].music_mode && dpc.df[7].flag )
986         {
934987            data |= 0x04;
935988         }
936989         return ( dpc.dlc ? dpc.movamt & 0xF0 : 0 ) | dpc_amplitude[data];
937990      }
938   } else {
991   }
992   else
993   {
939994      UINT8   display_data = memory_region(space->machine, "user1")[0x2000 + ( ~ ( ( dpc.df[data_fetcher].low | ( dpc.df[data_fetcher].high << 8 ) ) ) & 0x7FF ) ];
940995
941      switch( offset & 0x38 ) {
996      switch( offset & 0x38 )
997      {
942998      case 0x08:         /* display data */
943999         data = display_data;
9441000         break;
r4556r4557
9621018         break;
9631019      }
9641020
965      if ( data_fetcher < 5 || ! dpc.df[data_fetcher].osc_clk ) {
1021      if ( data_fetcher < 5 || ! dpc.df[data_fetcher].osc_clk )
1022      {
9661023         modeDPC_decrement_counter( data_fetcher );
9671024      }
9681025   }
r4556r4557
9731030{
9741031   UINT8   data_fetcher = offset & 0x07;
9751032
976   switch( offset & 0x38 ) {
1033   switch( offset & 0x38 )
1034   {
9771035   case 0x00:         /* Top count */
9781036      dpc.df[data_fetcher].top = data;
9791037      dpc.df[data_fetcher].flag = 0;
r4556r4557
9851043      break;
9861044   case 0x10:         /* Counter low */
9871045      dpc.df[data_fetcher].low = data;
988      if ( data_fetcher == 4 ) {
1046      if ( data_fetcher == 4 )
1047      {
9891048         dpc.latch_64 = data;
9901049      }
991      if ( data_fetcher > 4 && dpc.df[data_fetcher].music_mode ) {
1050      if ( data_fetcher > 4 && dpc.df[data_fetcher].music_mode )
1051      {
9921052         dpc.df[data_fetcher].low = dpc.df[data_fetcher].top;
9931053      }
9941054      modeDPC_check_flag( data_fetcher );
r4556r4557
9971057      dpc.df[data_fetcher].high = data;
9981058      dpc.df[data_fetcher].music_mode = data & 0x10;
9991059      dpc.df[data_fetcher].osc_clk = data & 0x20;
1000      if ( data_fetcher > 4 && dpc.df[data_fetcher].music_mode && dpc.df[data_fetcher].low == 0xFF ) {
1060      if ( data_fetcher > 4 && dpc.df[data_fetcher].music_mode && dpc.df[data_fetcher].low == 0xFF )
1061      {
10011062         dpc.df[data_fetcher].low = dpc.df[data_fetcher].top;
10021063         modeDPC_check_flag( data_fetcher );
10031064      }
r4556r4557
10061067      dpc.movamt = data;
10071068      break;
10081069   case 0x28:         /* Not used */
1009      logerror("%04X: Write to unused DPC register $%02X, data $%02X\n", cpu_get_pc(space->machine->cpu[0]), offset, data);
1070      logerror("%04X: Write to unused DPC register $%02X, data $%02X\n", cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")), offset, data);
10101071      break;
10111072   case 0x30:         /* Random number generator reset */
10121073      dpc.shift_reg = 0;
10131074      break;
10141075   case 0x38:         /* Not used */
1015      logerror("%04X: Write to unused DPC register $%02X, data $%02X\n", cpu_get_pc(space->machine->cpu[0]), offset, data);
1076      logerror("%04X: Write to unused DPC register $%02X, data $%02X\n", cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")), offset, data);
10161077      break;
10171078   }
10181079}
r4556r4557
10541115
10551116static void modeFE_switch(running_machine *machine,UINT16 offset, UINT8 data)
10561117{
1057   const address_space* space = cpu_get_address_space(machine->cpu[0],ADDRESS_SPACE_PROGRAM);
1118   const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
10581119   /* Retrieve last byte read by the cpu (for this mapping scheme this
10591120       should be the last byte that was on the data bus
10601121    */
r4556r4557
10921153   running_machine *machine = device->machine;
10931154
10941155   /* Left controller port */
1095   if ( input_port_read(machine, "CONTROLLERS") / CATEGORY_SELECT == 0x03 ) {
1156   if ( input_port_read(machine, "CONTROLLERS") / CATEGORY_SELECT == 0x03 )
1157   {
10961158      keypad_left_column = data / 16;
10971159   }
10981160
10991161   /* Right controller port */
1100   switch( input_port_read(machine, "CONTROLLERS") % CATEGORY_SELECT ) {
1162   switch( input_port_read(machine, "CONTROLLERS") % CATEGORY_SELECT )
1163   {
11011164   case 0x03:   /* Keypad */
11021165      keypad_right_column = data & 0x0F;
11031166      break;
r4556r4557
11141177   UINT8 val = 0;
11151178
11161179   /* Left controller port PINs 1-4 ( 4321 ) */
1117   switch( input_port_read(machine, "CONTROLLERS") / CATEGORY_SELECT ) {
1180   switch( input_port_read(machine, "CONTROLLERS") / CATEGORY_SELECT )
1181   {
11181182   case 0x00:  /* Joystick */
11191183   case 0x05:   /* Joystick w/Boostergrip */
11201184      val |= input_port_read(machine, "SWA_JOY") & 0xF0;
r4556r4557
11351199   }
11361200
11371201   /* Right controller port PINs 1-4 ( 4321 ) */
1138   switch( input_port_read(machine, "CONTROLLERS") % CATEGORY_SELECT ) {
1202   switch( input_port_read(machine, "CONTROLLERS") % CATEGORY_SELECT )
1203   {
11391204   case 0x00:   /* Joystick */
11401205   case 0x05:   /* Joystick w/Boostergrip */
11411206      val |= input_port_read(machine, "SWA_JOY") & 0x0F;
r4556r4557
11961261         SMH_BANK4,
11971262      };
11981263
1199      memory_install_read8_handler(cpu_get_address_space(machine->cpu[0],ADDRESS_SPACE_PROGRAM),
1264      memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM),
12001265         0x1000 + (i + 0) * 0x1000 / count - 0,
12011266         0x1000 + (i + 1) * 0x1000 / count - 1, 0, 0, handler[i]);
12021267
r4556r4557
12051270   }
12061271}
12071272
1208static READ16_HANDLER(a2600_read_input_port) {
1273static READ16_HANDLER(a2600_read_input_port)
1274{
12091275   int i;
12101276
1211   switch( offset ) {
1277   switch( offset )
1278   {
12121279   case 0:   /* Left controller port PIN 5 */
1213      switch ( input_port_read(space->machine, "CONTROLLERS") / CATEGORY_SELECT ) {
1280      switch ( input_port_read(space->machine, "CONTROLLERS") / CATEGORY_SELECT )
1281      {
12141282      case 0x00:   /* Joystick */
12151283         return TIA_INPUT_PORT_ALWAYS_OFF;
12161284      case 0x01:   /* Paddle */
12171285         return input_port_read(space->machine, "PADDLE1");
12181286      case 0x03:   /* Keypad */
1219         for ( i = 0; i < 4; i++ ) {
1220            if ( ! ( ( keypad_left_column >> i ) & 0x01 ) ) {
1221               if ( ( input_port_read(space->machine, "KEYPAD_L") >> 3*i ) & 0x01 ) {
1287         for ( i = 0; i < 4; i++ )
1288         {
1289            if ( ! ( ( keypad_left_column >> i ) & 0x01 ) )
1290            {
1291               if ( ( input_port_read(space->machine, "KEYPAD_L") >> 3*i ) & 0x01 )
1292               {
12221293                  return TIA_INPUT_PORT_ALWAYS_ON;
1223               } else {
1294               }
1295               else
1296               {
12241297                  return TIA_INPUT_PORT_ALWAYS_OFF;
12251298               }
12261299            }
r4556r4557
12331306      }
12341307      break;
12351308   case 1:   /* Right controller port PIN 5 */
1236      switch ( input_port_read(space->machine, "CONTROLLERS") / CATEGORY_SELECT ) {
1309      switch ( input_port_read(space->machine, "CONTROLLERS") / CATEGORY_SELECT )
1310      {
12371311      case 0x00:   /* Joystick */
12381312         return TIA_INPUT_PORT_ALWAYS_OFF;
12391313      case 0x01:   /* Paddle */
12401314         return input_port_read(space->machine, "PADDLE3");
12411315      case 0x03:   /* Keypad */
1242         for ( i = 0; i < 4; i++ ) {
1243            if ( ! ( ( keypad_left_column >> i ) & 0x01 ) ) {
1244               if ( ( input_port_read(space->machine, "KEYPAD_L") >> 3*i ) & 0x02 ) {
1316         for ( i = 0; i < 4; i++ )
1317         {
1318            if ( ! ( ( keypad_left_column >> i ) & 0x01 ) )
1319            {
1320               if ( ( input_port_read(space->machine, "KEYPAD_L") >> 3*i ) & 0x02 )
1321               {
12451322                  return TIA_INPUT_PORT_ALWAYS_ON;
1246               } else {
1323               }
1324               else
1325               {
12471326                  return TIA_INPUT_PORT_ALWAYS_OFF;
12481327               }
12491328            }
r4556r4557
12561335      }
12571336      break;
12581337   case 2:   /* Left controller port PIN 9 */
1259      switch ( input_port_read(space->machine, "CONTROLLERS") % CATEGORY_SELECT ) {
1338      switch ( input_port_read(space->machine, "CONTROLLERS") % CATEGORY_SELECT )
1339      {
12601340      case 0x00:   /* Joystick */
12611341         return TIA_INPUT_PORT_ALWAYS_OFF;
12621342      case 0x01:   /* Paddle */
12631343         return input_port_read(space->machine, "PADDLE2");
12641344      case 0x03:   /* Keypad */
1265         for ( i = 0; i < 4; i++ ) {
1266            if ( ! ( ( keypad_right_column >> i ) & 0x01 ) ) {
1267               if ( ( input_port_read(space->machine, "KEYPAD_R") >> 3*i ) & 0x01 ) {
1345         for ( i = 0; i < 4; i++ )
1346         {
1347            if ( ! ( ( keypad_right_column >> i ) & 0x01 ) )
1348            {
1349               if ( ( input_port_read(space->machine, "KEYPAD_R") >> 3*i ) & 0x01 )
1350               {
12681351                  return TIA_INPUT_PORT_ALWAYS_ON;
1269               } else {
1352               }
1353               else
1354               {
12701355                  return TIA_INPUT_PORT_ALWAYS_OFF;
12711356               }
12721357            }
r4556r4557
12791364      }
12801365      break;
12811366   case 3:   /* Right controller port PIN 9 */
1282      switch ( input_port_read(space->machine, "CONTROLLERS") % CATEGORY_SELECT ) {
1367      switch ( input_port_read(space->machine, "CONTROLLERS") % CATEGORY_SELECT )
1368      {
12831369      case 0x00:   /* Joystick */
12841370         return TIA_INPUT_PORT_ALWAYS_OFF;
12851371      case 0x01:   /* Paddle */
12861372         return input_port_read(space->machine, "PADDLE4");
12871373      case 0x03:   /* Keypad */
1288         for ( i = 0; i < 4; i++ ) {
1289            if ( ! ( ( keypad_right_column >> i ) & 0x01 ) ) {
1290               if ( ( input_port_read(space->machine, "KEYPAD_R") >> 3*i ) & 0x02 ) {
1374         for ( i = 0; i < 4; i++ )
1375         {
1376            if ( ! ( ( keypad_right_column >> i ) & 0x01 ) )
1377            {
1378               if ( ( input_port_read(space->machine, "KEYPAD_R") >> 3*i ) & 0x02 )
1379               {
12911380                  return TIA_INPUT_PORT_ALWAYS_ON;
1292               } else {
1381               }
1382               else
1383               {
12931384                  return TIA_INPUT_PORT_ALWAYS_OFF;
12941385               }
12951386            }
r4556r4557
13021393      }
13031394      break;
13041395   case 4:   /* Left controller port PIN 6 */
1305      switch ( input_port_read(space->machine, "CONTROLLERS") / CATEGORY_SELECT ) {
1396      switch ( input_port_read(space->machine, "CONTROLLERS") / CATEGORY_SELECT )
1397      {
13061398      case 0x00:   /* Joystick */
13071399      case 0x05:   /* Joystick w/Boostergrip */
13081400         return input_port_read(space->machine, "BUTTONS_L");
r4556r4557
13111403      case 0x02:   /* Driving */
13121404         return input_port_read(space->machine, "BUTTONS_L") << 3;
13131405      case 0x03:   /* Keypad */
1314         for ( i = 0; i < 4; i++ ) {
1315            if ( ! ( ( keypad_left_column >> i ) & 0x01 ) ) {
1316               if ( ( input_port_read(space->machine, "KEYPAD_L") >> 3*i ) & 0x04 ) {
1406         for ( i = 0; i < 4; i++ )
1407         {
1408            if ( ! ( ( keypad_left_column >> i ) & 0x01 ) )
1409            {
1410               if ( ( input_port_read(space->machine, "KEYPAD_L") >> 3*i ) & 0x04 )
1411               {
13171412                  return 0xff;
1318               } else {
1413               }
1414               else
1415               {
13191416                  return 0x00;
13201417               }
13211418            }
r4556r4557
13281425      }
13291426      break;
13301427   case 5:   /* Right controller port PIN 6 */
1331      switch ( input_port_read(space->machine, "CONTROLLERS") % CATEGORY_SELECT ) {
1428      switch ( input_port_read(space->machine, "CONTROLLERS") % CATEGORY_SELECT )
1429      {
13321430      case 0x00:   /* Joystick */
13331431      case 0x05:   /* Joystick w/Boostergrip */
13341432         return input_port_read(space->machine, "BUTTONS_R");
r4556r4557
13371435      case 0x02:   /* Driving */
13381436         return input_port_read(space->machine, "BUTTONS_R") << 3;
13391437      case 0x03:   /* Keypad */
1340         for ( i = 0; i < 4; i++ ) {
1341            if ( ! ( ( keypad_right_column >> i ) & 0x01 ) ) {
1342               if ( ( input_port_read(space->machine, "KEYPAD_R") >> 3*i ) & 0x04 ) {
1438         for ( i = 0; i < 4; i++ )
1439         {
1440            if ( ! ( ( keypad_right_column >> i ) & 0x01 ) )
1441            {
1442               if ( ( input_port_read(space->machine, "KEYPAD_R") >> 3*i ) & 0x04 )
1443               {
13431444                  return 0xff;
1344               } else {
1445               }
1446               else
1447               {
13451448                  return 0x00;
13461449               }
13471450            }
r4556r4557
13651468   Q-Bert's Qubes (NTSC,F6) at 0x1594
13661469   Berzerk at 0xF093.
13671470*/
1368static READ8_HANDLER(a2600_get_databus_contents) {
1471static READ8_HANDLER(a2600_get_databus_contents)
1472{
13691473   UINT16   last_address, prev_address;
13701474   UINT8   last_byte, prev_byte;
13711475
1372   last_address = cpu_get_pc(space->machine->cpu[0]) - 1;
1373   if ( ! ( last_address & 0x1080 ) ) {
1476   last_address = cpu_get_pc(cputag_get_cpu(space->machine, "maincpu")) - 1;
1477   if ( ! ( last_address & 0x1080 ) )
1478   {
13741479      return offset;
13751480   }
13761481   last_byte = memory_read_byte(space,  last_address );
1377   if ( last_byte < 0x80 || last_byte == 0xFF ) {
1482   if ( last_byte < 0x80 || last_byte == 0xFF )
1483   {
13781484      return last_byte;
13791485   }
13801486   prev_address = last_address - 1;
1381   if ( ! ( prev_address & 0x1080 ) ) {
1487   if ( ! ( prev_address & 0x1080 ) )
1488   {
13821489      return last_byte;
13831490   }
13841491   prev_byte = memory_read_byte(space,  prev_address );
1385   if ( prev_byte == 0xB1 ) {   /* LDA (XX),Y */
1492   if ( prev_byte == 0xB1 )
1493   {   /* LDA (XX),Y */
13861494      return memory_read_byte(space,  last_byte + 1 );
13871495   }
13881496   return last_byte;
r4556r4557
13951503   { 26, 26 + 160 + 16, 48, 48 + 240 + 31 }   /* 342 */
13961504};
13971505
1398static WRITE16_HANDLER( a2600_tia_vsync_callback ) {
1506static WRITE16_HANDLER( a2600_tia_vsync_callback )
1507{
13991508   int i;
14001509
1401   for ( i = 0; i < sizeof( supported_screen_heights ) / sizeof( supported_screen_heights[0] ); i++ ) {
1402      if ( data >= supported_screen_heights[i] - 3 && data <= supported_screen_heights[i] + 3 ) {
1403         if ( supported_screen_heights[i] != current_screen_height ) {
1510   for ( i = 0; i < sizeof( supported_screen_heights ) / sizeof( supported_screen_heights[0] ); i++ )
1511   {
1512      if ( data >= supported_screen_heights[i] - 3 && data <= supported_screen_heights[i] + 3 )
1513      {
1514         if ( supported_screen_heights[i] != current_screen_height )
1515         {
14041516            current_screen_height = supported_screen_heights[i];
14051517//              video_screen_configure( machine->primary_screen, 228, current_screen_height, &visarea[i], HZ_TO_ATTOSECONDS( MASTER_CLOCK_NTSC ) * 228 * current_screen_height );
14061518         }
r4556r4557
14081520   }
14091521}
14101522
1411static WRITE16_HANDLER( a2600_tia_vsync_callback_pal ) {
1523static WRITE16_HANDLER( a2600_tia_vsync_callback_pal )
1524{
14121525   int i;
14131526
1414   for ( i = 0; i < sizeof( supported_screen_heights ) / sizeof( supported_screen_heights[0] ); i++ ) {
1415      if ( data >= supported_screen_heights[i] - 3 && data <= supported_screen_heights[i] + 3 ) {
1416         if ( supported_screen_heights[i] != current_screen_height ) {
1527   for ( i = 0; i < sizeof( supported_screen_heights ) / sizeof( supported_screen_heights[0] ); i++ )
1528   {
1529      if ( data >= supported_screen_heights[i] - 3 && data <= supported_screen_heights[i] + 3 )
1530      {
1531         if ( supported_screen_heights[i] != current_screen_height )
1532         {
14171533            current_screen_height = supported_screen_heights[i];
14181534//              video_screen_configure( machine->primary_screen, 228, current_screen_height, &visarea[i], HZ_TO_ATTOSECONDS( MASTER_CLOCK_PAL ) * 228 * current_screen_height );
14191535         }
r4556r4557
14551571   current_reset_bank_counter = 0xFF;
14561572}
14571573
1458static void set_category_value( running_machine *machine, const char* cat, const char *cat_selection ) {
1574static void set_category_value( running_machine *machine, const char* cat, const char *cat_selection )
1575{
14591576   /* NPW 22-May-2008 - FIXME */
14601577#if 0
14611578   input_port_entry   *cat_in = NULL;
14621579   input_port_entry   *in;
14631580
1464   for( in = machine->input_ports; in->type != IPT_END; in++ ) {
1465      if ( in->type == IPT_CATEGORY_NAME && ! mame_stricmp( cat, input_port_name(in) ) ) {
1581   for( in = machine->input_ports; in->type != IPT_END; in++ )
1582   {
1583      if ( in->type == IPT_CATEGORY_NAME && ! mame_stricmp( cat, input_port_name(in) ) )
1584      {
14661585         cat_in = in;
14671586      }
1468      if ( cat_in && in->type == IPT_CATEGORY_SETTING && ! mame_stricmp( cat_selection, input_port_name(in) ) ) {
1587      if ( cat_in && in->type == IPT_CATEGORY_SETTING && ! mame_stricmp( cat_selection, input_port_name(in) ) )
1588      {
14691589         cat_in->default_value = in->default_value;
14701590         return;
14711591      }
r4556r4557
14731593#endif
14741594}
14751595
1476static void set_controller( running_machine *machine, const char *controller, unsigned int selection ) {
1596static void set_controller( running_machine *machine, const char *controller, unsigned int selection )
1597{
14771598   /* Defaulting to only joystick when joysstick and paddle are set for now... */
14781599   if ( selection == JOYS + PADD )
14791600      selection = JOYS;
14801601
1481   switch( selection ) {
1602   switch( selection )
1603   {
14821604   case JOYS:   set_category_value( machine, controller, "Joystick" ); break;
14831605   case PADD:   set_category_value( machine, controller, STR_PADDLES ); break;
14841606   case KEYP:   set_category_value( machine, controller, STR_KEYPAD ); break;
r4556r4557
14961618
14971619static MACHINE_RESET( a2600 )
14981620{
1499   const address_space* space = cpu_get_address_space(machine->cpu[0],ADDRESS_SPACE_PROGRAM);
1621   const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
15001622   int chip = 0xFF;
15011623   unsigned long controltemp;
15021624   static const unsigned char snowwhite[] = { 0x10, 0xd0, 0xff, 0xff }; // Snow White Proto
r4556r4557
15231645   if (banking_mode == 0xff) if (detect_32K_mode3F(machine)) banking_mode = mode3F;
15241646   if (banking_mode == 0xff) if (detect_modeE7(machine)) banking_mode = modeE7;
15251647
1526   if (banking_mode == 0xff) {
1648   if (banking_mode == 0xff)
1649   {
15271650      switch (cart_size)
15281651      {
15291652      case 0x800:
r4556r4557
15851708      break;
15861709
15871710   case modeF8:
1588      if (!memcmp(&CART[0x1ffc],snowwhite,sizeof(snowwhite))) {
1711      if (!memcmp(&CART[0x1ffc],snowwhite,sizeof(snowwhite)))
1712      {
15891713         install_banks(machine, 1, 0x0000);
1590      } else {
1714      }
1715      else
1716      {
15911717         install_banks(machine, 1, 0x1000);
15921718      }
15931719      break;
r4556r4557
17641890      memory_set_direct_update_handler(space, modeDPC_opbase_handler );
17651891      {
17661892         int   data_fetcher;
1767         for( data_fetcher = 0; data_fetcher < 8; data_fetcher++ ) {
1893         for( data_fetcher = 0; data_fetcher < 8; data_fetcher++ )
1894         {
17681895            dpc.df[data_fetcher].osc_clk = 0;
17691896            dpc.df[data_fetcher].flag = 0;
17701897            dpc.df[data_fetcher].music_mode = 0;
r4556r4557
18121939   }
18131940
18141941   /* Banks may have changed, reset the cpu so it uses the correct reset vector */
1815   device_reset( machine->cpu[0] );
1942   device_reset( cputag_get_cpu(machine, "maincpu") );
18161943}
18171944
18181945
src/mess/drivers/amiga.c
r4556r4557
465465      }
466466
467467      /* overlay disabled, map RAM on 0x000000 */
468      memory_install_write16_handler(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, amiga_chip_ram_size - 1, 0, mirror_mask, SMH_BANK1);
468      memory_install_write16_handler(cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x000000, amiga_chip_ram_size - 1, 0, mirror_mask, SMH_BANK1);
469469
470470      amiga_cart_check_overlay(device->machine);
471471   }
472472   else
473473      /* overlay enabled, map Amiga system ROM on 0x000000 */
474      memory_install_write16_handler(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, amiga_chip_ram_size - 1, 0, 0, SMH_UNMAP);
474      memory_install_write16_handler(cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x000000, amiga_chip_ram_size - 1, 0, 0, SMH_UNMAP);
475475
476476   set_led_status( 0, ( data & 2 ) ? 0 : 1 ); /* bit 2 = Power Led on Amiga */
477477   output_set_value("power_led", ( data & 2 ) ? 0 : 1);
r4556r4557
524524   if (input_port_read(machine, "hardware") & 0x08)
525525   {
526526      /* Install RTC */
527      memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xdc0000, 0xdc003f, 0, 0, amiga_clock_r, amiga_clock_w);
527      memory_install_readwrite16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xdc0000, 0xdc003f, 0, 0, amiga_clock_r, amiga_clock_w);
528528   }
529529   else
530530   {
531531      /* No RTC support */
532      memory_install_readwrite16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xdc0000, 0xdc003f, 0, 0, SMH_UNMAP, SMH_UNMAP);
532      memory_install_readwrite16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xdc0000, 0xdc003f, 0, 0, SMH_UNMAP, SMH_UNMAP);
533533   }
534534}
535535
src/mess/drivers/abc80x.c
r4556r4557
790790
791791static void ctc_interrupt(const device_config *device, int state)
792792{
793   cpu_set_input_line(device->machine->cpu[0], INPUT_LINE_IRQ0, state);
793   cputag_set_input_line(device->machine, Z80_TAG, INPUT_LINE_IRQ0, state);
794794}
795795
796796static WRITE8_DEVICE_HANDLER( ctc_z0_w )
r4556r4557
857857
858858static void sio_interrupt(const device_config *device, int state)
859859{
860   cpu_set_input_line(device->machine->cpu[0], INPUT_LINE_IRQ0, state);
860   cputag_set_input_line(device->machine, Z80_TAG, INPUT_LINE_IRQ0, state);
861861}
862862
863863static WRITE8_DEVICE_HANDLER( sio_dtr_w )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team