Previous 15994 Revisions Next

r6067 Wednesday 14th October, 2009 at 06:25:25 UTC by Harmony
CD-i Changes:
- Updated backdrop and cursor colors, makes black level more consistent
- Tweaked CDIC emulation, Hotel Mario video changes background frames correctly
[src/mess/drivers]cdi.c

src/mess/drivers/cdi.c
r6066r6067
948948         }
949949
950950         cdic_regs.time += 0x100;
951         if((cdic_regs.time & 0x00000f00) == 0xa00)
951         if((cdic_regs.time & 0x00000f00) == 0x00000a00)
952952         {
953953            cdic_regs.time &= 0xfffff0ff;
954954            cdic_regs.time += 0x00001000;
955955         }
956         if((cdic_regs.time & 0x0000ff00) == 0x7500)
956         if((cdic_regs.time & 0x0000ff00) == 0x00007500)
957957         {
958958            cdic_regs.time &= 0xffff00ff;
959959            cdic_regs.time += 0x00010000;
960            if((cdic_regs.time & 0xf0000) == 0xa0000)
960            if((cdic_regs.time & 0x000f0000) == 0x000a0000)
961961            {
962962               cdic_regs.time &= 0xfff0ffff;
963               cdic_regs.time += 0x100000;
964               if((cdic_regs.time & 0xf00000) == 0xf00000)
963               cdic_regs.time += 0x00100000;
964               if((cdic_regs.time & 0x00f00000) == 0x00a00000)
965965               {
966966                  cdic_regs.time &= 0xff0fffff;
967967                  cdic_regs.time += 0x01000000;
968                  if((cdic_regs.time & 0x0f000000) == 0x0a000000)
969                  {
970                     cdic_regs.time &= 0xf0ffffff;
971                     cdic_regs.time += 0x10000000;
972                  }
968973               }
969974            }
970975         }
r6066r6067
983988               cdic_regs.data_buffer |= 0x4000;
984989               cdic_regs.data_buffer &= 0x7fff;
985990
986               verboselog(machine, 0, "EOF, access should stop here\n" );
987991               //printf( "Setting CDIC interrupt line\n" );
988992               verboselog(machine, 0, "Setting CDIC interrupt line\n" );
989993               cpu_set_input_line_vector(cputag_get_cpu(machine, "maincpu"), M68K_IRQ_4, 128);
r6066r6067
992996         }
993997         else if((buffer[22] & 0x0e) == 0x00)
994998         {
995            // Empty message sector, ignore it
999            // Ignore the audio sector for now.
1000            if(!(buffer[22] & 0x10))
1001            {
1002               verboselog(machine, 0, "Message sector, ignored\n" );
1003            }
1004            else
1005            {
1006               cdic_regs.x_buffer |= 0x8000;
1007
1008               cdic_regs.data_buffer |= 0x4000;
1009               cdic_regs.data_buffer &= 0x7fff;
1010
1011               //printf( "Setting CDIC interrupt line\n" );
1012               verboselog(machine, 0, "Setting CDIC interrupt line\n" );
1013               cpu_set_input_line_vector(cputag_get_cpu(machine, "maincpu"), M68K_IRQ_4, 128);
1014               cputag_set_input_line(machine, "maincpu", M68K_IRQ_4, ASSERT_LINE);
1015            }
9961016         }
9971017         else //if((buffer[22] & 0x04) == 0x04)
9981018         {
r6066r6067
10011021            cdic_regs.data_buffer |= 0x4000;
10021022            cdic_regs.data_buffer &= 0x7fff;
10031023
1004            verboselog(machine, 0, "EOF, access should stop here\n" );
10051024            //printf( "Setting CDIC interrupt line\n" );
10061025            verboselog(machine, 0, "Setting CDIC interrupt line\n" );
10071026            cpu_set_input_line_vector(cputag_get_cpu(machine, "maincpu"), M68K_IRQ_4, 128);
r6066r6067
11271146         for(index = start / 2; index < (start / 2 + count); index++)
11281147         {
11291148            memory[index] = cdram[src_index++];
1130            if(cdic_regs.time == 0x00332400 || cdic_regs.time == 0x00332500)
1131            {
1132               //printf( "%04x ", cdram[src_index - 1] );
1133            }
11341149         }
1135         //printf( "\n" );
11361150         scc68070_regs.dma.channel[0].memory_address_counter += scc68070_regs.dma.channel[0].transfer_counter * 2;
11371151         break;
11381152      }
r6066r6067
11631177               case 0x2a: // Read Mode 2
11641178                  timer_adjust_oneshot(cdic_regs.interrupt_timer, ATTOTIME_IN_HZ(75), 0); // 75Hz = 1x CD-ROM speed
11651179                  break;
1180               default:
1181                  fatalerror( "Unknown CDIC command: %02x\n", cdic_regs.command );
1182                  break;
11661183            }
11671184         }
11681185         break;
r6066r6067
12351252   UINT16 old_mouse_x = slave_regs.real_mouse_x;
12361253   UINT16 old_mouse_y = slave_regs.real_mouse_y;
12371254
1255   if(slave_regs.real_mouse_x == 0xffff)
1256   {
1257      old_mouse_x = x & 0x3ff;
1258      old_mouse_y = y & 0x3ff;
1259   }
1260
12381261   slave_regs.real_mouse_x = x & 0x3ff;
12391262   slave_regs.real_mouse_y = y & 0x3ff;
12401263
1241   if(slave_regs.real_mouse_x == 0xffff)
1264   slave_regs.fake_mouse_x += (slave_regs.real_mouse_x - old_mouse_x);
1265   slave_regs.fake_mouse_y += (slave_regs.real_mouse_y - old_mouse_y);
1266
1267   while(slave_regs.fake_mouse_x > 0x3ff)
12421268   {
1243      slave_regs.fake_mouse_x = slave_regs.real_mouse_x;
1244      slave_regs.fake_mouse_y = slave_regs.real_mouse_y;
1269      slave_regs.fake_mouse_x += 0x400;
12451270   }
1246   else
1271
1272   while(slave_regs.fake_mouse_y > 0x3ff)
12471273   {
1248      old_mouse_x = 0xffff;
1249      old_mouse_y = 0xffff;
1250      slave_regs.fake_mouse_x = x & 0x3ff;
1251      slave_regs.fake_mouse_y = y & 0x3ff;
1274      slave_regs.fake_mouse_y += 0x400;
12521275   }
12531276
1254   slave_regs.fake_mouse_x += (slave_regs.real_mouse_x - old_mouse_x);
1255   slave_regs.fake_mouse_y += (slave_regs.real_mouse_y - old_mouse_y);
1256
12571277   x = slave_regs.fake_mouse_x;
12581278   y = slave_regs.fake_mouse_y;
12591279
r6066r6067
13061326{
13071327   UINT16 x, y;
13081328
1309   printf( "old fake mouse x: %04x\n", slave_regs.fake_mouse_x );
1310   printf( "old fake mouse y: %04x\n", slave_regs.fake_mouse_y );
1329   printf( "Set mouse position: %02x %02x %02x\n", slave_regs.in_buf[0], slave_regs.in_buf[1], slave_regs.in_buf[2] );
13111330
1312   slave_regs.fake_mouse_y = (slave_regs.fake_mouse_y & 0xff80) | (slave_regs.in_buf[1] & 0x7f);
1313   slave_regs.fake_mouse_x = (slave_regs.fake_mouse_x & 0xff80) | (slave_regs.in_buf[2] & 0x7f);
1331   slave_regs.fake_mouse_y = ((slave_regs.in_buf[1] & 0x0f) << 6) | (slave_regs.in_buf[0] & 0x3f);
1332   slave_regs.fake_mouse_x = ((slave_regs.in_buf[1] & 0x70) << 3) | slave_regs.in_buf[2];
13141333
13151334   x = slave_regs.fake_mouse_x;
13161335   y = slave_regs.fake_mouse_y;
13171336
1318   printf( "new fake mouse x: %04x\n", slave_regs.fake_mouse_x );
1319   printf( "new fake mouse y: %04x\n", slave_regs.fake_mouse_y );
1320
13211337   if(slave_regs.polling_active)
13221338   {
13231339      slave_prepare_readback(machine, ATTOTIME_IN_HZ(10000), 0, 4, (x & 0x380) >> 7, x & 0x7f, (y & 0x380) >> 7, y & 0x7f, 0xf7);
r6066r6067
23672383                     mcd212.region_flag[flag] = 1;
23682384                     break;
23692385               }
2370               break;
23712386            }
23722387         }
23732388      }
r6066r6067
24302445                  mcd212.region_flag[flag] = 1;
24312446                  break;
24322447            }
2433            break;
24342448         }
24352449      }
24362450   }
r6066r6067
25662580               {
25672581                  for(; x < 768; x++)
25682582                  {
2569                     pixels[x++] = 0;
2570                     pixels[x] = 0;
2583                     pixels[x++] = 0x00101010;
2584                     pixels[x] = 0x00101010;
25712585                  }
25722586               }
25732587            }
r6066r6067
26372651
26382652static const UINT32 mcd212_4bpp_color[16] =
26392653{
2640   0x00000000, 0x0000007f, 0x00007f00, 0x00007f7f, 0x007f0000, 0x007f007f, 0x007f7f00, 0x007f7f7f,
2641   0x00000000, 0x000000ff, 0x0000ff00, 0x0000ffff, 0x00ff0000, 0x00ff00ff, 0x00ffff00, 0x00ffffff
2654   0x00101010, 0x0010107a, 0x00107a10, 0x00107a7a, 0x007a1010, 0x007a107a, 0x007a7a10, 0x007a7a7a,
2655   0x00101010, 0x001010e6, 0x0010e610, 0x0010e6e6, 0x00e61010, 0x00e610e6, 0x00e6e610, 0x00e6e6e6
26422656};
26432657
26442658INLINE void mcd212_draw_cursor(running_machine *machine, UINT32 *scanline, int y)
26452659{
26462660   if(mcd212.channel[0].cursor_control & MCD212_CURCNT_EN)
26472661   {
2648      UINT16 curx = mcd212.channel[0].cursor_position & 0x3ff;
2649      UINT16 cury = (mcd212.channel[0].cursor_position >> 12) & 0x3ff;
2662      UINT16 curx =  mcd212.channel[0].cursor_position        & 0x3ff;
2663      UINT16 cury = ((mcd212.channel[0].cursor_position >> 12) & 0x3ff) + 22;
26502664      UINT32 x = 0;
2651      cury += 22;
26522665      if(y >= cury && y < (cury + 16))
26532666      {
26542667         UINT32 color = mcd212_4bpp_color[mcd212.channel[0].cursor_control & MCD212_CURCNT_COLOR];
r6066r6067
29612974
29622975static INPUT_PORTS_START( cdi )
29632976   PORT_START("MOUSEX")
2964   PORT_BIT(0x3ff, 0x000, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_CHANGED(mouse_update, 0)
2977   PORT_BIT(0x3ff, 0x000, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_MINMAX(0x000, 0x3ff) PORT_KEYDELTA(0) PORT_CHANGED(mouse_update, 0)
29652978
29662979   PORT_START("MOUSEY")
2967   PORT_BIT(0x1ff, 0x000, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_CHANGED(mouse_update, 0)
2980   PORT_BIT(0x3ff, 0x000, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_MINMAX(0x000, 0x3ff) PORT_KEYDELTA(0) PORT_CHANGED(mouse_update, 0)
29682981
29692982   PORT_START("MOUSEBTN")
29702983   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_CODE(MOUSECODE_BUTTON1) PORT_NAME("Mouse Button 1") PORT_CHANGED(mouse_update, 0)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team