Previous 15994 Revisions Next

r8965 Monday 30th August, 2010 at 23:11:18 UTC by Angelo Salese
[MZ-2500]: Implemented interlace support
[src/mess/drivers]mz2500.c

src/mess/drivers/mz2500.c
r8964r8965
1010     (check Back to the Future);
1111   - Implement unlatched ROMs (Phone and Dictionary);
1212   - Find real CRTC registers
13   - Some games doesn't set proper registers if you have interlace enabled, is there any real reason?
1314   - Implement external ROM hook-up;
1415   - FDC loading without the IPLPRO doesn't work at all, why?
1516   - reverse / blanking tvram attributes;
r8964r8965
120121   y_step = (text_font_reg) ? 1 : 2;
121122   s_y = text_reg[9] & 0xf;
122123
123   for (y=0;y<26;y+=y_step)
124   for (y=0;y<26*y_step;y+=y_step)
124125   {
125126      for (x=0;x<80;x++)
126127      {
r8964r8965
176177
177178               if(pen)
178179               {
179                  if((y*8+yi-s_y) >= 0 && (y*8+yi-s_y) < 200)
180                  if((y*8+yi-s_y) >= 0 && (y*8+yi-s_y) < 200*y_step)
180181                     *BITMAP_ADDR16(bitmap, (y*8+yi-s_y), x*8+xi) = machine->pens[pen+(pal_select ? 0x000 : 0x208)];
181182               }
182183            }
r8964r8965
202203   y_step = (text_font_reg) ? 1 : 2;
203204   s_y = text_reg[9] & 0xf;
204205
205   for (y=0;y<26;y+=y_step)
206   for (y=0;y<26*y_step;y+=y_step)
206207   {
207208      for (x=0;x<40;x++)
208209      {
r8964r8965
259260               {
260261                  if(wid_40) // 640 x 200 with 40 x 25, double x size
261262                  {
262                     if((y*8+yi-s_y) >= 0 && (y*8+yi-s_y) < 200)
263                     if((y*8+yi-s_y) >= 0 && (y*8+yi-s_y) < 200*y_step)
263264                     {
264265                        *BITMAP_ADDR16(bitmap, (y*8+yi-s_y), (x*8+xi)*2+0) = machine->pens[pen+(pal_select ? 0x000 : 0x208)];
265266                        *BITMAP_ADDR16(bitmap, (y*8+yi-s_y), (x*8+xi)*2+1) = machine->pens[pen+(pal_select ? 0x000 : 0x208)];
r8964r8965
267268                  }
268269                  else
269270                  {
270                     if((y*8+yi-s_y) >= 0 && (y*8+yi-s_y) < 200)
271                     if((y*8+yi-s_y) >= 0 && (y*8+yi-s_y) < 200*y_step)
271272                        *BITMAP_ADDR16(bitmap, (y*8+yi-s_y), x*8+xi) = machine->pens[pen+(pal_select ? 0x000 : 0x208)];
272273                  }
273274               }
r8964r8965
325326   UINT8 s_x;
326327   UINT8 base_mask;
327328   int res_x,res_y;
329   UINT8 cg_interlace;
328330
329331   base_mask = (x_size == 640) ? 0x3f : 0x1f;
330332
r8964r8965
332334   wa_reg = (cg_reg[0x12]) | ((cg_reg[0x13] & base_mask) << 8);
333335   /* TODO: layer 2 scrolling */
334336   s_x = (cg_reg[0x0f] & 0xf);
337   cg_interlace = text_font_reg ? 1 : 2;
335338
336339   //popmessage("%d %d %d %d",cg_hs,cg_he,cg_vs,cg_ve);
340   popmessage("%d %d",cg_vs,cg_ve);
337341
338342   for(y=0;y<200;y++)
339343   {
r8964r8965
357361            for(pen_i=0;pen_i<4;pen_i++)
358362               pen |= pen_bit[pen_i];
359363
360            if(pri == ((clut16[pen] & 0x10) >> 4))
361               *BITMAP_ADDR16(bitmap, res_y, res_x) = machine->pens[(clut16[pen] & 0x0f)+0x200];
364            if(cg_interlace == 2)
365            {
366               if(pri == ((clut16[pen] & 0x10) >> 4))
367               {
368                  *BITMAP_ADDR16(bitmap, res_y*2+0, res_x) = machine->pens[(clut16[pen] & 0x0f)+0x200];
369                  *BITMAP_ADDR16(bitmap, res_y*2+1, res_x) = machine->pens[(clut16[pen] & 0x0f)+0x200];
370               }
371            }
372            else
373            {
374               if(pri == ((clut16[pen] & 0x10) >> 4))
375                  *BITMAP_ADDR16(bitmap, res_y, res_x) = machine->pens[(clut16[pen] & 0x0f)+0x200];
376            }
362377         }
363378         count++;
364379         count&=((base_mask<<8) | 0xff);
r8964r8965
375390   UINT8 pen,pen_bit[8];
376391   int x,y,xi,pen_i;
377392   int res_x,res_y;
393   UINT8 cg_interlace;
378394
379395   count = 0x40000;
396   cg_interlace = text_font_reg ? 1 : 2;
380397
381398   for(y=0;y<200;y++)
382399   {
r8964r8965
404421            for(pen_i=0;pen_i<8;pen_i++)
405422               pen |= pen_bit[pen_i];
406423
407            if(pri == ((clut256[pen] & 0x100) >> 8))
408               *BITMAP_ADDR16(bitmap, res_y, res_x) = machine->pens[(clut256[pen] & 0xff)+0x100];
424            if(cg_interlace == 2)
425            {
426               if(pri == ((clut256[pen] & 0x100) >> 8))
427               {
428                  *BITMAP_ADDR16(bitmap, res_y*2+0, res_x) = machine->pens[(clut256[pen] & 0xff)+0x100];
429                  *BITMAP_ADDR16(bitmap, res_y*2+1, res_x) = machine->pens[(clut256[pen] & 0xff)+0x100];
430               }
431            }
432            else
433            {
434               if(pri == ((clut256[pen] & 0x100) >> 8))
435                  *BITMAP_ADDR16(bitmap, res_y, res_x) = machine->pens[(clut256[pen] & 0xff)+0x100];
436            }
409437         }
410438         count++;
411439      }
r8964r8965
10691097
10701098      /* TODO: not convinced about this arrangement ... */
10711099      x_size = ((cg_reg[0x0e] & 0x1f) == 0x17 || (cg_reg[0x0e] & 0x1f) == 0x03) ? 640 : 320;
1072      y_size = ((cg_reg[0x0e] & 0x1f) == 0x03) ? 400 : 200;
1100      y_size = ((cg_reg[0x0e] & 0x1f) == 0x03) ? 400 : 200*((text_font_reg) ? 1 : 2); //enables interlace?
10731101
10741102      visarea.min_x = 0;
10751103      visarea.min_y = 0;
r8964r8965
11601188   ADDRESS_MAP_GLOBAL_MASK(0xff)
11611189//  AM_RANGE(0x60, 0x63) AM_WRITE(w3100a_w)
11621190//  AM_RANGE(0x63, 0x63) AM_READ(w3100a_r)
1191   AM_RANGE(0x60, 0x63) AM_NOP
11631192//  AM_RANGE(0xa0, 0xa3) AM_READWRITE(sio_r,sio_w)
1193   AM_RANGE(0xa0, 0xa3) AM_NOP
11641194//  AM_RANGE(0xa4, 0xa5) AM_READWRITE(sasi_r, sasi_w)
1195   AM_RANGE(0xa4, 0xa5) AM_NOP
11651196   AM_RANGE(0xa8, 0xa8) AM_WRITE(mz2500_rom_w)
11661197   AM_RANGE(0xa9, 0xa9) AM_READ(mz2500_rom_r)
11671198//  AM_RANGE(0xac, 0xad) AM_WRITE(emm_w)
r8964r8965
11701201//  AM_RANGE(0xb0, 0xb3) AM_READWRITE(sio_r,sio_w)
11711202   AM_RANGE(0xb4, 0xb4) AM_READWRITE(mz2500_bank_addr_r,mz2500_bank_addr_w)
11721203   AM_RANGE(0xb5, 0xb5) AM_READWRITE(mz2500_bank_data_r,mz2500_bank_data_w)
1204   AM_RANGE(0xb7, 0xb7) AM_WRITENOP
11731205   AM_RANGE(0xb8, 0xb9) AM_READWRITE(mz2500_kanji_r,mz2500_kanji_w)
11741206   AM_RANGE(0xbc, 0xbc) AM_READ(mz2500_bplane_latch_r) AM_WRITE(mz2500_cg_addr_w)
11751207   AM_RANGE(0xbd, 0xbd) AM_READ(mz2500_rplane_latch_r) AM_WRITE(mz2500_cg_data_w)
r8964r8965
11801212   AM_RANGE(0xc8, 0xc9) AM_DEVREADWRITE("ym", ym2203_r, ym2203_w)
11811213//  AM_RANGE(0xca, 0xca) AM_READWRITE(voice_r,voice_w)
11821214//  AM_RANGE(0xcc, 0xcc) AM_READWRITE(calendar_r,calendar_w)
1215   AM_RANGE(0xcc, 0xcd) AM_NOP
11831216//  AM_RANGE(0xce, 0xce) AM_WRITE(mz2500_dictionary_bank_w)
1217   AM_RANGE(0xce, 0xce) AM_NOP
11841218   AM_RANGE(0xcf, 0xcf) AM_WRITE(mz2500_kanji_bank_w)
11851219   AM_RANGE(0xd8, 0xdb) AM_DEVREADWRITE("mb8877a", mz2500_wd17xx_r, mz2500_wd17xx_w)
11861220   AM_RANGE(0xdc, 0xdd) AM_WRITE(mz2500_fdc_w)
1221   AM_RANGE(0xde, 0xde) AM_WRITENOP
11871222   AM_RANGE(0xe0, 0xe3) AM_DEVREADWRITE("i8255_0", i8255a_r, i8255a_w)
11881223    AM_RANGE(0xe4, 0xe7) AM_DEVREADWRITE("pit", pit8253_r, pit8253_w)
1189//   AM_RANGE(0xe8, 0xe9) AM_DEVREADWRITE("z80pio_1", z80pio_c_r, z80pio_c_w)
1190//   AM_RANGE(0xea, 0xeb) AM_DEVREADWRITE("z80pio_1", z80pio_d_r, z80pio_d_w)
11911224   AM_RANGE(0xe8, 0xeb) AM_DEVREADWRITE("z80pio_1", z80pio_ba_cd_r, z80pio_ba_cd_w)
11921225   AM_RANGE(0xef, 0xef) AM_READWRITE(mz2500_joystick_r,mz2500_joystick_w)
11931226    AM_RANGE(0xf0, 0xf3) AM_WRITE(timer_w)
r8964r8965
13271360   PORT_START("UNUSED")
13281361   PORT_BIT(0xff,IP_ACTIVE_LOW,IPT_UNUSED )
13291362
1330   PORT_START("DSW0")
1331   PORT_DIPNAME( 0x01, 0x00, "DSW0" )
1332   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1333   PORT_DIPSETTING(    0x01, DEF_STR( On ) )
1334   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) )
1335   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1336   PORT_DIPSETTING(    0x02, DEF_STR( On ) )
1337   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) )
1338   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1339   PORT_DIPSETTING(    0x04, DEF_STR( On ) )
1340   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )
1341   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1342   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
1343   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
1344   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1345   PORT_DIPSETTING(    0x10, DEF_STR( On ) )
1346   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
1347   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1348   PORT_DIPSETTING(    0x20, DEF_STR( On ) )
1349   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
1350   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1351   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
1352   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) )
1353   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1354   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
1355
13561363   /* this enables HD-loader */
13571364   PORT_START("DSW1")
13581365   PORT_DIPNAME( 0x01, 0x01, "DSW1" )
r8964r8965
13671374   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
13681375   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
13691376   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
1370   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
1377   PORT_DIPNAME( 0x30, 0x30, "IPLPRO" )
13711378   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1372   PORT_DIPSETTING(    0x10, DEF_STR( On ) )
1373   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
1374   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1375   PORT_DIPSETTING(    0x20, DEF_STR( On ) )
1376   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
1377   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1378   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
1379   PORT_DIPSETTING(    0x30, DEF_STR( On ) )
1380   PORT_DIPNAME( 0x40, 0x40, "Monitor Interlace" ) //not all games support this
1381   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
1382   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
13791383   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
13801384   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
13811385   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
r8964r8965
16101614   DEVCB_NULL
16111615};
16121616
1617static UINT8 ym_porta;
1618
1619static READ8_DEVICE_HANDLER( opn_porta_r )
1620{
1621   return ym_porta;
1622}
1623
16131624static WRITE8_DEVICE_HANDLER( opn_porta_w )
16141625{
16151626   /*
r8964r8965
16181629   ---- --x- floppy reverse bit (controls wd17xx bits in command registers)
16191630   */
16201631
1621//   printf("%02x\n",data);
16221632   fdc_reverse = (data & 2) ? 0x00 : 0xff;
16231633   pal_select = (data & 4) ? 1 : 0;
1634
1635   ym_porta = data;
16241636}
16251637
1638static WRITE8_DEVICE_HANDLER( opn_portb_w )
1639{
1640   logerror("B %02x\n",data);
1641}
1642
16261643static const ym2203_interface ym2203_interface_1 =
16271644{
16281645   {
16291646      AY8910_LEGACY_OUTPUT,
16301647      AY8910_DEFAULT_LOADS,
1631      DEVCB_INPUT_PORT("DSW0"),   // read A
1648      DEVCB_HANDLER(opn_porta_r),   // read A
16321649      DEVCB_INPUT_PORT("DSW1"),   // read B
16331650      DEVCB_HANDLER(opn_porta_w),   // write A
1634      DEVCB_NULL               // write B
1651      DEVCB_HANDLER(opn_portb_w)   // write B
16351652   },
16361653   NULL
16371654};
r8964r8965
17101727
17111728   MDRV_SPEAKER_STANDARD_MONO("mono")
17121729
1713   MDRV_SOUND_ADD("ym", YM2203, 6000000/2) //unknown clock / divider
1730   MDRV_SOUND_ADD("ym", YM2203, 6000000/4) //unknown clock / divider
17141731   MDRV_SOUND_CONFIG(ym2203_interface_1)
17151732   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.60)
17161733

Previous 15994 Revisions Next


© 1998-2018 The MESS Team