Previous 15994 Revisions Next

r9032 Saturday 4th September, 2010 at 13:12:38 UTC by Angelo Salese
[MZ-2500]: Many video related fixes, promoted system to working
[src/mess/drivers]mz2500.c

src/mess/drivers/mz2500.c
r9031r9032
55    driver by Angelo Salese
66
77    TODO:
8    - Kanji text is cutted in half when font_size is 1 / interlace is disabled, different data used? (check Back to the Future);
8    - Kanji text is cutted in half when font_size is 1 / interlace is disabled, different ROM used? (check Back to the Future);
99    - Find real CRTC registers
1010    - Some games doesn't set proper registers if you have interlace enabled, is there any real reason?
1111    - Implement external ROM hook-up;
1212    - FDC loading without the IPLPRO doesn't work at all, why?
1313    - reverse / blanking tvram attributes;
14    - there's a soft reset PCG init bug now (try for example Eiyuu Densetsu Saga then Excite Bike);
1415    - clean-ups! ^^'
1516
1617    per-game/program specific TODO:
1718    - Basic: vertical scrolling returns wrap-around that shouldn't wrap;
18    - Basic: loading has an alignment bug with the bitmap
19    - Dust Box vol. n: they all dies after pressing a key on the 256 color CG layer shows up;
20    - Dust Box vol. n: three items returns "purple" text, presumably HW failures;
21    - Dust Box vol. 4: window effect transition is bugged;
1922    - LayDock: hangs by reading the FDC status and expecting it to become 0x81;
20    - Mappy: TVRAM layer is double x sized than it should be;
21    - Marchen Veil I: dies with garbage on screen;
2223    - Moon Child: needs mixed 3+3bpp tvram supported;
2324    - Moon Child: appears to be a network / system link game, obviously doesn't work with current MAME / MESS framework;
24    - Mugen no Shinzou: returns an HW error if you attempt to start a play;
25    - Mugen no Shinzou: returns an HW error if you attempt to start a play, it seems to be a fdc writing issue;
2526    - Mugen no Shinzou II - The Prince of Darkness: dies on IPLPRO loading, presumably a wd17xx core bug;
2627    - Multiplan: random hangs/crashes after you set the RTC, sometimes it loads properly;
2728    - Murder Club: has lots of CG artifacts;
2829    - Penguin Kun Wars: has a bug with window effects ("Push space or trigger" msg on the bottom"), needs investigation;
2930    - Relics: doesn't boot, sets fdc register 0xdc bit 2 to 1
30    - Sound Gal Music Editor: dies with bad code, another wd17xx core bug;
31    - Sound Gal Music Editor: wants a "master disk", that apparently isn't available;
32    - Super MZ Demo: priority doesn't work properly on the "face" item;
3133    - Telephone Soft: shows garbage with the CG layer;
3234    - The Tower of Druaga: has a small priority/layer clearance bug at the digital / analog screen select;
3335    - Xevious: has issues with the window effects, it should actually be applied on TV layer and not CG.
34    - Ys 3: has garbage on top / bottom (note: you have to load both disks at start-up otherwise it refuses to run)
36    - Ys 3: has garbage on top / bottom (note: you have to load both disks at start-up otherwise it refuses to run), same issue as the Basic one;
3537    - Yukar K2 (normal version): moans about something, DFJustin: "please put the system disk back to normal", disk write-protected?
3638
3739    memory map:
r9031r9032
8284static UINT8 text_reg[0x100], text_reg_index;
8385static UINT8 text_col_size, text_font_reg;
8486static UINT8 pal_select;
85static UINT8 wid_40;
8687static UINT16 cg_vs,cg_ve,cg_hs,cg_he; //CG window parameters
8788static UINT8 cg_latch[4];
8889static UINT8 cg_reg_index;
r9031r9032
9091static UINT8 clut16[0x10];
9192static UINT16 clut256[0x100];
9293static UINT8 cg_mask;
94static int scr_x_size,scr_y_size;
9395
9496static VIDEO_START( mz2500 )
9597{
r9031r9032
151153         int tile_bank = vram[0x70000+count+0x1000] & 0x3f;
152154         int gfx_sel = (attr & 0x38) | (vram[0x70000+count+0x1000] & 0xc0);
153155         int color = attr & 7;
156         int inv_col = (attr & 0x40) >> 6;
154157
155158         if(gfx_sel & 8) // Xevious, PCG 8 colors have priority above kanji roms
156159            gfx_data = memory_region(machine,"pcg");
r9031r9032
187190                  pen_bit[2] = ((gfx_data[tile*8+yi+0x0800]>>(7-xi)) & 1) ? 1 : 0; //B
188191
189192                  pen = (pen_bit[0]|pen_bit[1]|pen_bit[2]);
193
194                  if(inv_col) { pen ^= 7; }
190195               }
191196               else
192197               {
193                  pen = ((gfx_data[tile*8+yi+((gfx_sel & 0x30)<<7)]>>(7-xi)) & 1) ? color : 0;
198                  pen = (((gfx_data[tile*8+yi+((gfx_sel & 0x30)<<7)]>>(7-xi)) & 1) ^ inv_col) ? color : 0;
194199               }
195200
196               if(attr & 0x40)
197                  pen ^= 0x7;
198
199201               if(pen)
200202               {
201203                  if((y*8+yi-s_y) >= 0 && (y*8+yi-s_y) < 200*y_step)
r9031r9032
233235         int gfx_sel = (attr & 0x38) | (vram[0x70000+count+0x1000] & 0xc0);
234236         //int gfx_num;
235237         int color = attr & 7;
238         int inv_col = (attr & 0x40) >> 6;
236239
237240         if(gfx_sel & 8) // Xevious, PCG 8 colors have priority above kanji roms
238241            gfx_data = memory_region(machine,"pcg");
r9031r9032
269272                  pen_bit[2] = ((gfx_data[tile*8+yi+0x0800]>>(7-xi)) & 1) ? 1 : 0; //B
270273
271274                  pen = (pen_bit[0]|pen_bit[1]|pen_bit[2]);
275
276                  if(inv_col) { pen ^= 7; }
272277               }
273278               else
274                  pen = ((gfx_data[tile*8+yi+((gfx_sel & 0x30)<<7)]>>(7-xi)) & 1) ? color : 0;
279                  pen = (((gfx_data[tile*8+yi+((gfx_sel & 0x30)<<7)]>>(7-xi)) & 1) ^ inv_col) ? color : 0;
275280
276               if(attr & 0x40)
277                  pen ^= 0x7;
278
279281               if(pen)
280282               {
281                  if(wid_40) // 640 x 200 with 40 x 25, double x size
282                  {
283                     if((y*8+yi-s_y) >= 0 && (y*8+yi-s_y) < 200*y_step)
284                        mz2500_draw_pixel(machine,bitmap,x*8+xi,y*8+yi-s_y,pen+(pal_select ? 0x000 : 0x18),1,0);
285                  }
286                  else
287                  {
288                     if((y*8+yi-s_y) >= 0 && (y*8+yi-s_y) < 200*y_step)
289                        mz2500_draw_pixel(machine,bitmap,x*8+xi,y*8+yi-s_y,pen+(pal_select ? 0x000 : 0x18),0,0);
290                  }
283                  if((y*8+yi-s_y) >= 0 && (y*8+yi-s_y) < 200*y_step)
284                     mz2500_draw_pixel(machine,bitmap,x*8+xi,y*8+yi-s_y,pen+(pal_select ? 0x000 : 0x18),scr_x_size == 640,0);
291285               }
292286            }
293287         }
r9031r9032
384378            for(pen_i=0;pen_i<4;pen_i++)
385379               pen |= pen_bit[pen_i];
386380
387            if(cg_interlace == 2)
388            {
389               if(pri == ((clut16[pen] & 0x10) >> 4))
390                  mz2500_draw_pixel(machine,bitmap,res_x,res_y,(clut16[pen] & 0x0f)+0x10,0,1);
391
392            }
393            else
394            {
395               if(pri == ((clut16[pen] & 0x10) >> 4))
396                  mz2500_draw_pixel(machine,bitmap,res_x,res_y,(clut16[pen] & 0x0f)+0x10,0,0);
397            }
381            if(pri == ((clut16[pen] & 0x10) >> 4))
382               mz2500_draw_pixel(machine,bitmap,res_x,res_y,(clut16[pen] & 0x0f)+0x10,(x_size == 320 && scr_x_size == 640),cg_interlace == 2);
398383         }
399384         count++;
400385         count&=((base_mask<<8) | 0xff);
r9031r9032
442427            for(pen_i=0;pen_i<8;pen_i++)
443428               pen |= pen_bit[pen_i];
444429
445            if(cg_interlace == 2)
446            {
447               if(pri == ((clut256[pen] & 0x100) >> 8))
448                  mz2500_draw_pixel(machine,bitmap,res_x,res_y,(clut256[pen] & 0xff)+0x100,0,1);
449            }
450            else
451            {
452               if(pri == ((clut256[pen] & 0x100) >> 8))
453                  mz2500_draw_pixel(machine,bitmap,res_x,res_y,(clut256[pen] & 0xff)+0x100,0,0);
454            }
430            if(pri == ((clut256[pen] & 0x100) >> 8))
431               mz2500_draw_pixel(machine,bitmap,res_x,res_y,(clut256[pen] & 0xff)+0x100,scr_x_size == 640,cg_interlace == 2);
455432         }
456433         count++;
457434      }
r9031r9032
533510    return 0;
534511}
535512
513static void mz2500_reconfigure_screen(running_machine *machine)
514{
515   rectangle visarea;
516
517   if((cg_reg[0x0e] & 0x1f) == 0x17 || (cg_reg[0x0e] & 0x1f) == 0x03 || text_col_size)
518      scr_x_size = 640;
519   else
520      scr_x_size = 320;
521
522   if((cg_reg[0x0e] & 0x1f) == 0x03)
523      scr_y_size = 400;
524   else
525      scr_y_size = 200 * ((text_font_reg) ? 1 : 2);
526
527   visarea.min_x = 0;
528   visarea.min_y = 0;
529   visarea.max_x = scr_x_size - 1;
530   visarea.max_y = scr_y_size - 1;
531
532   //popmessage("%d %d %d %d %02x",vs,ve,hs,he,cg_reg[0x0e]);
533
534   machine->primary_screen->configure(720, 480, visarea, machine->primary_screen->frame_period().attoseconds);
535}
536
536537static UINT8 mz2500_cg_latch_compare(void)
537538{
538539   UINT8 compare_val = cg_reg[0x07] & 0xf;
r9031r9032
931932      case 3:
932933         /* Font size reg */
933934         text_font_reg = data & 1;
935         mz2500_reconfigure_screen(space->machine);
934936         break;
935937   }
936938}
r9031r9032
11821184      }
11831185   }
11841186
1185   {
1186      rectangle visarea;
1187      static int x_size,y_size;
1187   cg_vs = (cg_reg[0x08]) | ((cg_reg[0x09]<<8) & 1);
1188   cg_ve = (cg_reg[0x0a]) | ((cg_reg[0x0b]<<8) & 1);
1189   cg_hs = (cg_reg[0x0c] & 0x7f)*8;
1190   cg_he = (cg_reg[0x0d] & 0x7f)*8;
11881191
1189      /* TODO: not convinced about this arrangement ... */
1190      x_size = ((cg_reg[0x0e] & 0x1f) == 0x17 || (cg_reg[0x0e] & 0x1f) == 0x03) ? 640 : 320;
1191      y_size = ((cg_reg[0x0e] & 0x1f) == 0x03) ? 400 : 200*((text_font_reg) ? 1 : 2); //enables interlace?
1192
1193      visarea.min_x = 0;
1194      visarea.min_y = 0;
1195      visarea.max_x = x_size - 1;
1196      visarea.max_y = y_size - 1;
1197
1198      wid_40 = (x_size == 640);
1199
1200      cg_vs = (cg_reg[0x08]) | ((cg_reg[0x09]<<8) & 1);
1201      cg_ve = (cg_reg[0x0a]) | ((cg_reg[0x0b]<<8) & 1);
1202      cg_hs = (cg_reg[0x0c] & 0x7f)*8;
1203      cg_he = (cg_reg[0x0d] & 0x7f)*8;
1204
1205      //popmessage("%d %d %d %d %02x",vs,ve,hs,he,cg_reg[0x0e]);
1206
1207      space->machine->primary_screen->configure(720, 480, visarea, space->machine->primary_screen->frame_period().attoseconds); //TODO
1192   {
1193      mz2500_reconfigure_screen(space->machine);
12081194   }
12091195
12101196   if(cg_reg_index & 0x80) //enable auto-inc
r9031r9032
14131399   PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("BREAK") //PORT_CODE(KEYCODE_ESC)
14141400
14151401   PORT_START("KEY4")
1416   PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH)
1402   PORT_BIT(0x01,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("/") //PORT_CODE(KEYCODE_SLASH)
14171403   PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A) PORT_CHAR('A')
14181404   PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B) PORT_CHAR('B')
14191405   PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C) PORT_CHAR('C')
r9031r9032
14671453   PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9')
14681454   PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(":")
14691455   PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME(";")
1470   PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("-")
1456   PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS)
14711457   PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("@")
14721458   PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("[")
14731459   PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_UNUSED)
r9031r9032
14771463   PORT_BIT(0x02,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("COPY")
14781464   PORT_BIT(0x04,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("CLR")
14791465   PORT_BIT(0x08,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("INST")
1480   PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("BS")
1466   PORT_BIT(0x10,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("BACKSPACE") PORT_CODE(KEYCODE_BACKSPACE)
14811467   PORT_BIT(0x20,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("ESC")
14821468   PORT_BIT(0x40,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("* (PAD)") PORT_CODE(KEYCODE_ASTERISK)
14831469   PORT_BIT(0x80,IP_ACTIVE_LOW,IPT_KEYBOARD) PORT_NAME("/ (PAD)") PORT_CODE(KEYCODE_SLASH_PAD)
r9031r9032
17131699
17141700static WRITE8_DEVICE_HANDLER( mz2500_pio1_porta_w )
17151701{
1702   static UINT8 prev_col_val;
17161703//  printf("%02x\n",data);
1717   text_col_size = (data & 0x20) ? 1 : 0;
1704
1705   if(prev_col_val != ((data & 0x20) >> 5))
1706   {
1707      text_col_size = ((data & 0x20) >> 5);
1708      prev_col_val = text_col_size;
1709      mz2500_reconfigure_screen(device->machine);
1710   }
17181711   key_mux = data & 0x1f;
17191712}
17201713
r9031r9032
18971890   /* video hardware */
18981891   MDRV_SCREEN_ADD("screen", RASTER)
18991892   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
1900   //MDRV_SCREEN_RAW_PARAMS(XTAL_17_73447MHz/2, 568, 0, 320, 312, 0, 200)
1901   MDRV_SCREEN_RAW_PARAMS(XTAL_17_73447MHz, 640+108, 0, 320, 480, 0, 200) //TODO: fix this
1893   MDRV_SCREEN_RAW_PARAMS(XTAL_21_4772MHz, 640+108, 0, 320, 480, 0, 200) //unknown clock / divider
19021894   MDRV_PALETTE_LENGTH(0x200)
19031895   MDRV_PALETTE_INIT(mz2500)
19041896
r9031r9032
19091901
19101902   MDRV_SPEAKER_STANDARD_MONO("mono")
19111903
1912   MDRV_SOUND_ADD("ym", YM2203, 6000000/4) //unknown clock / divider
1904   MDRV_SOUND_ADD("ym", YM2203, 2000000) //unknown clock / divider
19131905   MDRV_SOUND_CONFIG(ym2203_interface_1)
1914   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.60)
1906   MDRV_SOUND_ROUTE(0, "mono", 0.25)
1907   MDRV_SOUND_ROUTE(1, "mono", 0.25)
1908   MDRV_SOUND_ROUTE(2, "mono", 0.50)
1909   MDRV_SOUND_ROUTE(3, "mono", 0.50)
19151910
19161911   MDRV_PIT8253_ADD("pit", mz2500_pit8253_intf)
19171912MACHINE_CONFIG_END
r9031r9032
19511946
19521947/* Driver */
19531948
1954COMP( 1985, mz2500,   0,        0,      mz2500,   mz2500,        0,      "Sharp",     "MZ-2500", GAME_NOT_WORKING | GAME_NO_SOUND)
1949COMP( 1985, mz2500,   0,        0,      mz2500,   mz2500,        0,      "Sharp",     "MZ-2500", 0 )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team