Previous 15994 Revisions Next

r14746 Sunday 11th March, 2012 at 17:17:06 UTC by Miodrag Milanović
Sync with MAME r15681 (nw)
[src/emu/cpu/powerpc]ppcdrc.c
[src/mame/drivers]namcos22.c popobear.c
[src/mame/includes]namcos22.h

src/mame/includes/namcos22.h
r14745r14746
2828   NAMCOS22_DIRT_DASH
2929};
3030
31typedef void (*namcos22_output_callback)(int offset, UINT16 data);
32
3331class namcos22_state : public driver_device
3432{
3533public:
r14745r14746
108106   UINT8 *m_dirtypal;
109107   bitmap_ind16 *m_mix_bitmap;
110108   tilemap_t *m_bgtilemap;
111   namcos22_output_callback m_sw1_output;
112   namcos22_output_callback m_sw2_output;
113109};
114110
115111
src/mame/drivers/popobear.c
r14745r14746
101101{
102102   popobear_state *state = machine.driver_data<popobear_state>();
103103   UINT8* vram = (UINT8 *)state->m_vram;
104   UINT16* vreg = (UINT16 *)state->m_vregs;
104105   int count;
105//   const UINT8 vreg_base[] = { 0x6/2, 0xa/2, 0x10/2, 0x14/2 };
106   const UINT8 vreg_base[] = { 0x10/2, 0x14/2 };
107   int xscroll,yscroll;
106108
107109//   count = (state->m_vregs[vreg_base[layer_n]]<<5);
108110//   count &= 0xfc000;
109111   count = (0xf0000+layer_n*0x4000);
112   if(layer_n & 2)
113   {
114      xscroll = vreg[vreg_base[(layer_n & 1) ^ 1]+2/2] & 0x1ff;
115      yscroll = vreg[vreg_base[(layer_n & 1) ^ 1]+0/2] & 0x1ff;
116   }
117   else
118   {
119      xscroll = 0;
120      yscroll = 0;
121   }
110122
111   for(int y=0;y<32;y++)
123   popmessage("%04x %04x",vreg[vreg_base[0]+0/2],vreg[vreg_base[1]+0/2]);
124
125   for(int y=0;y<64;y++)
112126   {
113127      for(int x=0;x<128;x++)
114128      {
r14745r14746
125139            for(int xi=0;xi<8;xi+=2)
126140            {
127141               UINT8 color;
142               int xoffs,yoffs;
128143
144               xoffs = x*8+xi - xscroll;
145               yoffs = y*8+yi - yscroll;
146
129147               color = (vram[((xi+yi*1024)+xtile+ytile) & 0xfffff] & 0xff);
130148
131               if(cliprect.contains(x*8+xi+1, y*8+yi) && color)
132                  bitmap.pix16(y*8+yi, x*8+xi+1) = machine.pens[color];
149               if(cliprect.contains(xoffs+1, yoffs) && color)
150                  bitmap.pix16(yoffs, xoffs+1) = machine.pens[color];
133151
152               if(cliprect.contains(xoffs+1, yoffs+512) && color)
153                  bitmap.pix16(yoffs+512, xoffs+1) = machine.pens[color];
154
155               //if(cliprect.contains(xoffs+1, yoffs+256) && color)
156               //   bitmap.pix16(yoffs+512, xoffs+1) = machine.pens[color];
157
134158               color = (vram[((xi+1+yi*1024)+xtile+ytile) & 0xfffff] & 0xff);
135159
136               if(cliprect.contains(x*8+xi, y*8+yi) && color)
137                  bitmap.pix16(y*8+yi, x*8+xi) = machine.pens[color];
160               if(cliprect.contains(xoffs, yoffs) && color)
161                  bitmap.pix16(yoffs, xoffs) = machine.pens[color];
162
163               if(cliprect.contains(xoffs, yoffs+512) && color)
164                  bitmap.pix16(yoffs+512, xoffs) = machine.pens[color];
138165            }
139166         }
140167
src/mame/drivers/namcos22.c
r14745r14746
24592459static WRITE32_HANDLER( namcos22_mcuram_w )
24602460{
24612461   namcos22_state *state = space->machine().driver_data<namcos22_state>();
2462     
2463   if ( ACCESSING_BITS_0_15 )
2464   {
2465      if (state->m_sw1_output)
2466      {
2467         state->m_sw1_output(offset, data);
2468      }
2469   }
2470   else
2471   {
2472      if (state->m_sw2_output)
2473      {         
2474         state->m_sw2_output(offset, data>>16);
2475      }
2476   }
2477   
24782462   COMBINE_DATA(&state->m_shareram[offset]);
2479   
24802463}
24812464
2482
24832465static READ32_HANDLER( namcos22_gun_r )
24842466{
24852467   int xpos = input_port_read_safe(space->machine(), "LIGHTX", 0) * 640 / 0xff;
r14745r14746
27062688   return 0;
27072689}
27082690
2691static WRITE8_HANDLER( propcycle_mcu_port5_w )
2692{
2693   // prop cycle outputs:
2694   // bit 1 = fan
2695   // bit 2 = button light
2696
2697   output_set_value("fan0", data & 1);
2698   set_led_status(space->machine(), 0, data & 2);
2699}
2700
27092701static READ8_HANDLER( propcycle_mcu_adc_r )
27102702{
27112703   // H+L = horizontal, 1 H+L = vertical
r14745r14746
55165508      machine.device("mcu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x82, 0x83, FUNC(mcu141_speedup_r), FUNC(mcu_speedup_w));
55175509}
55185510
5519/*****************************************************************************************************/
5520// Some of the data is stored visually, with the leftmost bit corresponding to the least significant bit.
5521// As a result the values must be un-reversed before being used.
5522// Taken from http://www-graphics.stanford.edu/~seander/bithacks.html#ReverseByteWith64BitsDiv
5523static unsigned char reverse(UINT16 b)
5524{
5525   return ((unsigned char)b * 0x0202020202ULL & 0x010884422010ULL) % 1023;
5526}
5527
5528static void acedrvr_sw1_output( int offset , UINT16 data )
5529{
5530   if (offset == 16)
5531   {     
5532      //These LEDs are arranged in a figure 8.
5533      output_set_value("Uknown_led", BIT(data,0) ^ 0x01);         
5534      output_set_value("Middle_led", BIT(data,1) ^ 0x01);
5535      output_set_value("Top_left_led", BIT(data,2) ^ 0x01);
5536      output_set_value("Bottom_left_led", BIT(data,3) ^ 0x01);
5537      output_set_value("Bottom_led", BIT(data,4) ^ 0x01);
5538      output_set_value("Bottom_right_led", BIT(data,5) ^ 0x01);
5539      output_set_value("Top_led", BIT(data,6) ^ 0x01);
5540      output_set_value("Top_right_led", BIT(data,7) ^ 0x01);           
5541   }
5542}
5543
5544static void acedrvr_sw2_output( int offset , UINT16 data )
5545{
5546   switch ( offset )
5547   {     
5548      case 8:         
5549         output_set_value("Signal_Green_lamp", BIT(data,0));
5550         output_set_value("Base_vibration", BIT(data,2));
5551         output_set_value("Wheel_force", BIT(data,3));
5552         output_set_value("Top_lamp", BIT(data,4));
5553         output_set_value("Signal_Red_lamp", BIT(data,5));         
5554         break;     
5555      case 16:         
5556         output_set_value("Wheel_force_direction", BIT(data,1));
5557         output_set_value("Wheel_force_magnitude",((reverse(data) & 0x3F) ^ 0x3F));         
5558         break;         
5559      default:
5560         break;
5561   }
5562}
5563
5564static void airco22_sw1_output( int offset , UINT16 data )
5565{
5566   if ( offset == 8011)
5567      output_set_value("Start_lamp", BIT(data,1));
5568
5569}
5570
5571static void cybrcomm_sw2_output( int offset , UINT16 data )
5572{
5573   if ( offset == 8)
5574      output_set_value("View_switch_lamp", BIT(data,4));
5575
5576}
5577
5578static void propcycl_sw1_output( int offset , UINT16 data )
5579{
5580   if ( offset == 8011)
5581   {
5582      output_set_value("Fan_motor", BIT(data,1));
5583      output_set_value("Button_lamp", BIT(data,2));
5584   }
5585}
5586
5587static void raveracw_sw2_output( int offset , UINT16 data )
5588{
5589   if ( offset == 16)
5590   {                         
5591      output_set_value("Wheel_force_direction", BIT(data,1));
5592      output_set_value("Wheel_force_magnitude",((reverse(data) & 0x3F) ^ 0x3F));   
5593   }
5594}
5595
5596static void dirtdash_sw1_output( int offset , UINT16 data )
5597{
5598   if ( offset >= 7680 && offset <= 7695)
5599   {
5600         /*
5601         The wheel force direction and magnitude interact with the wheel
5602         position in a way that isn't fully understood.  This causes
5603         what appear to be spurious changes in direction and magnitude.
5604         */
5605         output_set_value("Wheel_force_direction", BIT(data,1));
5606         output_set_value("Wheel_force_magnitude",((reverse(data) & 0x3F) ^ 0x3F));   
5607   }
5608   else if ( offset == 8011)
5609   {         
5610         output_set_value("Wheel_force", BIT(data,1));
5611         output_set_value("Valve_front_left", BIT(data,4));
5612         output_set_value("Valve_front_right", BIT(data,5));
5613         output_set_value("Valve_rear_left", BIT(data,6));
5614         output_set_value("Valve_rear_right", BIT(data,7));           
5615   }
5616}
5617
5618static void alpiner_sw1_output( int offset , UINT16 data )
5619{
5620   if ( offset == 8011)
5621   {
5622      //Direction 0 is locking and 1 is freeing.
5623      output_set_value("Motor_direction", BIT(data,1));
5624      output_set_value("Motor_power", BIT(data,2));
5625      output_set_value("Decision_lamp", BIT(data,4));
5626      output_set_value("Left_selection_lamp", BIT(data,5));
5627      output_set_value("Right_selection_lamp", BIT(data,6));
5628   }
5629}
5630
5631static void alpiner2_sw1_output( int offset , UINT16 data )
5632{
5633   if ( offset == 8011)
5634   {
5635      //Direction 0 is locking and 1 is freeing.
5636      output_set_value("Motor_direction", BIT(data,1));
5637      output_set_value("Motor_power", BIT(data,2));
5638      output_set_value("View_switch_lamp", BIT(data,4));
5639      output_set_value("Left_selection_lamp", BIT(data,5));
5640      output_set_value("Right_selection_lamp", BIT(data,6));
5641   }
5642}
5643
5644static void aquajet_sw1_output( int offset , UINT16 data )
5645{
5646   if ( offset == 8011)
5647   {
5648      output_set_value("Start_lamp", BIT(data,1));
5649      output_set_value("Fan_motor", BIT(data,2));
5650      output_set_value("Air_spring", BIT(data,7));
5651   }
5652}
5653
5654static void cybrcyc_sw1_output( int offset , UINT16 data )
5655{
5656   if ( offset == 8011)
5657   {
5658      output_set_value("bit0", BIT(data,0));
5659      output_set_value("1_lamp", BIT(data,1));
5660      output_set_value("2_lamp", BIT(data,2));
5661      output_set_value("3_lamp", BIT(data,3));
5662      output_set_value("4_lamp", BIT(data,4));
5663      output_set_value("Red_lamp", BIT(data,5));
5664      output_set_value("Yellow_lamp", BIT(data,6));
5665      output_set_value("Blue_lamp", BIT(data,7));
5666      output_set_value("Green_lamp", BIT(data,8));
5667      output_set_value("View_switch_lamp", BIT(data,9));
5668   }
5669}
5670
5671static void timecris_sw1_output( int offset , UINT16 data )
5672{
5673   if ( offset == 8011)
5674      output_set_value("Gun_recoil", BIT(data,1));
5675}
5676
5677static void tokyowar_sw1_output( int offset , UINT16 data )
5678{
5679   if ( offset == 8011)
5680   {
5681      output_set_value("View_switch_lamp", BIT(data,1));
5682      output_set_value("Credit_available_lamp", BIT(data,2));
5683   }
5684}
5685
5686/*****************************************************************************************************/
5687
56885511static void namcos22_init( running_machine &machine, int game_type )
56895512{
56905513   namcos22_state *state = machine.driver_data<namcos22_state>();
r14745r14746
56965519   state->m_p4 = 0;
56975520   state->m_old_coin_state = 0;
56985521   state->m_credits1 = state->m_credits2 = 0;
5699   state->m_sw1_output = NULL;
5700   state->m_sw2_output = NULL;
57015522
57025523   state->m_mpPointRAM = auto_alloc_array(machine, UINT32, 0x20000);
57035524}
r14745r14746
57235544   install_130_speedup(machine);
57245545
57255546   state->m_keycus_id = 0x0187;
5726   state->m_sw1_output = alpiner_sw1_output;
57275547}
57285548
57295549static DRIVER_INIT( alpiner2 )
r14745r14746
57345554   install_130_speedup(machine);
57355555
57365556   state->m_keycus_id = 0x0187;
5737   state->m_sw1_output = alpiner2_sw1_output;
57385557}
57395558
57405559static DRIVER_INIT( alpinesa )
r14745r14746
57475566   install_141_speedup(machine);
57485567
57495568   state->m_keycus_id = 0x01a9;
5750   state->m_sw1_output = alpiner2_sw1_output;
57515569}
57525570
57535571static DRIVER_INIT( airco22 )
57545572{
5755   namcos22_state *state = machine.driver_data<namcos22_state>();
57565573   namcos22_init(machine, NAMCOS22_AIR_COMBAT22);
57575574
57585575   // S22-BIOS ver1.20 namco all rights reserved 94/12/21
57595576   machine.device("mcu")->memory().space(AS_IO)->install_legacy_read_handler(M37710_ADC0_L, M37710_ADC7_H, FUNC(airco22_mcu_adc_r));
5760   
5761   state->m_sw1_output = airco22_sw1_output;
57625577}
57635578
57645579static DRIVER_INIT( propcycl )
57655580{
5766   namcos22_state *state = machine.driver_data<namcos22_state>();
5767   UINT32 *pROM = (UINT32 *)machine.region("maincpu")->base();
5581   UINT32 *pROM = (UINT32 *)machine.region("maincpu")->base();
57685582
57695583   /* patch out strange routine (uninitialized-eprom related?) */
57705584   pROM[0x1992C/4] = 0x4E754E75;
r14745r14746
57835597
57845598   namcos22_init(machine, NAMCOS22_PROP_CYCLE);
57855599
5786   machine.device("mcu")->memory().space(AS_IO)->install_legacy_read_handler(M37710_ADC0_L, M37710_ADC7_H, FUNC(propcycle_mcu_adc_r));   
5600   machine.device("mcu")->memory().space(AS_IO)->install_legacy_read_handler(M37710_ADC0_L, M37710_ADC7_H, FUNC(propcycle_mcu_adc_r));
5601   machine.device("mcu")->memory().space(AS_IO)->install_legacy_write_handler(M37710_PORT5, M37710_PORT5, FUNC(propcycle_mcu_port5_w));
57875602   install_141_speedup(machine);
5788   state->m_sw1_output = propcycl_sw1_output;
57895603}
57905604
57915605static DRIVER_INIT( ridgeraj )
r14745r14746
58165630   install_c74_speedup(machine);
58175631
58185632   state->m_keycus_id = 0x0173;
5819   state->m_sw1_output = acedrvr_sw1_output;
5820   state->m_sw2_output = acedrvr_sw2_output;
58215633}
58225634
58235635static DRIVER_INIT( victlap )
r14745r14746
58285640   install_c74_speedup(machine);
58295641
58305642   state->m_keycus_id = 0x0188;
5831   state->m_sw2_output = acedrvr_sw2_output;
5832   state->m_sw1_output = acedrvr_sw1_output;
58335643}
58345644
58355645static DRIVER_INIT( raveracw )
58365646{
5837   namcos22_state *state = machine.driver_data<namcos22_state>();
58385647   namcos22_init(machine, NAMCOS22_RAVE_RACER);
58395648
58405649   install_c74_speedup(machine);
5841   state->m_sw2_output = raveracw_sw2_output;
58425650}
58435651
58445652static DRIVER_INIT( cybrcomm )
r14745r14746
58495657   install_c74_speedup(machine);
58505658
58515659   state->m_keycus_id = 0x0185;
5852   state->m_sw2_output = cybrcomm_sw2_output;
58535660}
58545661
58555662static DRIVER_INIT( cybrcyc )
r14745r14746
58615668   install_130_speedup(machine);
58625669
58635670   state->m_keycus_id = 0x0387;
5864   state->m_sw1_output = cybrcyc_sw1_output;
58655671}
58665672
58675673static DRIVER_INIT( timecris )
58685674{
5869   namcos22_state *state = machine.driver_data<namcos22_state>();
58705675   namcos22_init(machine, NAMCOS22_TIME_CRISIS);
58715676
58725677   install_130_speedup(machine);
5873   state->m_sw1_output = timecris_sw1_output;
58745678}
58755679
58765680static DRIVER_INIT( tokyowar )
r14745r14746
58825686   install_141_speedup(machine);
58835687
58845688   state->m_keycus_id = 0x01a8;
5885   state->m_sw1_output = tokyowar_sw1_output;
58865689}
58875690
58885691static DRIVER_INIT( aquajet )
58895692{
5890   namcos22_state *state = machine.driver_data<namcos22_state>();
58915693   namcos22_init(machine, NAMCOS22_AQUA_JET);
58925694
58935695   machine.device("mcu")->memory().space(AS_IO)->install_legacy_read_handler(M37710_ADC0_L, M37710_ADC7_H, FUNC(aquajet_mcu_adc_r));
58945696   install_141_speedup(machine);
5895   state->m_sw1_output = aquajet_sw1_output;
5896   
58975697}
58985698
58995699static DRIVER_INIT( dirtdash )
r14745r14746
59055705   install_141_speedup(machine);
59065706
59075707   state->m_keycus_id = 0x01a2;
5908   state->m_sw1_output = dirtdash_sw1_output;
59095708}
59105709
59115710/************************************************************************************/
src/emu/cpu/powerpc/ppcdrc.c
r14745r14746
30723072         return TRUE;
30733073
30743074      case 0x1eb:   /* DIVWx */
3075      case 0x3eb:   /* DIVWOx */
3075        case 0x3eb:   /* DIVWOx */
3076            UML_CMP(block, R32(G_RB(op)), 0x0);                 // cmp rb, #0
3077            UML_JMPc(block, COND_NE, compiler->labelnum);       // bne 0:
3078            UML_CMP(block, R32(G_RA(op)), 0x80000000);          // cmp rb, #80000000
3079            UML_JMPc(block, COND_AE, compiler->labelnum);       // bae 0:
3080
3081            UML_MOV(block, R32(G_RD(op)), 0x0);                 // move rd, #0
3082            if (op & M_OE)
3083            {
3084                UML_OR(block, XERSO32, XERSO32, 0x1);           // SO = 1
3085            }
3086            UML_JMP(block, compiler->labelnum+3);               // jmp 3:
3087
3088            UML_LABEL(block, compiler->labelnum++);             // 0:
3089
3090            UML_CMP(block, R32(G_RB(op)), 0x0);                 // cmp rb, #0
3091            UML_JMPc(block, COND_Z, compiler->labelnum);        // beq 1:
3092
3093            UML_CMP(block, R32(G_RB(op)), 0xffffffff);          // cmp rb, #ffffffff
3094            UML_JMPc(block, COND_NE, compiler->labelnum+1);     // bne 2:
3095            UML_CMP(block, R32(G_RA(op)), 0x80000000);          // cmp ra, #80000000
3096            UML_JMPc(block, COND_NE, compiler->labelnum+1);     // bne 2:
3097
3098            UML_LABEL(block, compiler->labelnum++);             // 1:
3099            // do second branch
3100            UML_MOV(block, R32(G_RD(op)), 0xffffffff);          // move rd, #ffffffff
3101            if (op & M_OE)
3102            {
3103                UML_OR(block, XERSO32, XERSO32, 0x1);           // SO = 1
3104            }
3105            UML_JMP(block, compiler->labelnum+1);               // jmp 3:
3106
3107            UML_LABEL(block, compiler->labelnum++);             // 2:
30763108         UML_DIVS(block, R32(G_RD(op)), R32(G_RD(op)), R32(G_RA(op)), R32(G_RB(op)));   // divs    rd,rd,ra,rb
3077         generate_compute_flags(ppc, block, desc, op & M_RC, ((op & M_OE) ? XER_OV : 0), FALSE);// <update flags>
3078         return TRUE;
3109            generate_compute_flags(ppc, block, desc, op & M_RC, ((op & M_OE) ? XER_OV : 0), FALSE);// <update flags>
30793110
3111            UML_LABEL(block, compiler->labelnum++);             // 3:
3112            return TRUE;
3113
30803114      case 0x01c:   /* ANDx */
30813115         UML_AND(block, R32(G_RA(op)), R32(G_RS(op)), R32(G_RB(op)));               // and     ra,rs,rb
30823116         generate_compute_flags(ppc, block, desc, op & M_RC, 0, FALSE);               // <update flags>

Previous 15994 Revisions Next


© 1998-2018 The MESS Team