Previous 15994 Revisions Next

r8961 Monday 30th August, 2010 at 18:15:24 UTC by Angelo Salese
[MZ-2500]: Implemented CG window effects, makes The Tower of Druaga to be playable
[src/mess/drivers]mz2500.c

src/mess/drivers/mz2500.c
r8960r8961
22
33    Sharp MZ-2500 (c) 1985 Sharp Corporation
44
5    preliminary driver by Angelo Salese
5    driver by Angelo Salese
66
77   TODO:
8   - floppy device;
9   - graphics are really a bare minimum, this system is very complex;
10   - keyboard inputs (needs something that actually works);
8   - 4096 color mode;
9   - Kanji text is cutted in half when font_size is 1, different data used?
10     (check Back to the Future);
11   - check how crtc really changes the screen resolution;
12   - Add cg latch read;
13   - Implement unlatched ROMs (Phone and Dictionary);
14   - Implement external ROM hook-up;
15   - FDC loading without the IPLPRO doesn't work at all, why?
16   - reverse / blanking tvram attributes;
1117
18    per-game/program specific TODO:
19   - (Koei Simulation War Game): title screen background is grey when it should be black;
20   - (Mahjong): white on configurations,same as above?
21   - (Renju): hangs on the "presents" screen;
22   - (Xtal Soft - The Prince of Darkness): dies on IPLPRO loading, presumably a wd17xx core bug;
23   - (Sound Gal): dies with bad code, another wd17xx core bug;
24   - Basic: vertical scrolling returns wrap-around that shouldn't wrap;
25   - (K2): doesn't seem to work, there was a "Disk I/O error" msg before;
26   - LayDock: hangs by reading the FDC status and expecting it to become 0x81;
27   - Mappy: TVRAM layer is double x sized than it should be;
28   - Marchen Veil I: dies with garbage on screen;
29   - Moon Child: needs mixed 3+3bpp tvram supported;
30   - Multiplan: hangs after you set the RTC;
31   - Murder Club: has lots of CG artifacts;
32   - Penguin Kun Wars: has a bug with window effects ("Push space or trigger" msg on the bottom"), needs investigation;
33   - Personal CP/M: black screen, writes bit 7 to i/o port 0xde
34   - Relics: doesn't boot, bad dump?
35   - Super MZ Demo 1: Hangs at the logo "roar".
36   - Telephone Soft: shows garbage with the CG layer;
37   - The Black Onyx: hangs at the title screen, background should also animate;
38   - Xevious: has issues with the window effects, it should actually be applied on TV layer and not CG.
39   - Ys 3: crashes if you try to load it with different DSW settings
40
1241    memory map:
1342    0x00000-0x3ffff Work RAM
1443    0x40000-0x5ffff CG RAM
r8960r8961
4776static UINT16 clut256[0x100];
4877static UINT8 cg_mask;
4978static UINT8 wid_40;
79static UINT16 cg_vs,cg_ve,cg_hs,cg_he; //CG window parameters
5080
5181#define WRAM_RESET 0
5282#define IPL_RESET 1
r8960r8961
294324   UINT32 wa_reg;
295325   UINT8 s_x;
296326   UINT8 base_mask;
327   int res_x,res_y;
297328
298329   base_mask = (x_size == 640) ? 0x3f : 0x1f;
299330
r8960r8961
302333   /* TODO: layer 2 scrolling */
303334   s_x = (cg_reg[0x0f] & 0xf);
304335
336   //popmessage("%d %d %d %d",cg_hs,cg_he,cg_vs,cg_ve);
337
305338   for(y=0;y<200;y++)
306339   {
307340      for(x=0;x<x_size;x+=8)
308341      {
309342         for(xi=0;xi<8;xi++)
310343         {
344            res_x = x+xi+s_x;
345            res_y = y;
346
347            /* check window boundaries */
348            if(res_x < cg_hs || res_x >= cg_he || res_y < cg_vs || res_y >= cg_ve)
349               continue;
350
311351            pen_bit[0] = (vram[count+0x40000+(plane * 0x2000)]>>(xi)) & 1 ? 1 : 0; //B
312352            pen_bit[1] = (vram[count+0x44000+(plane * 0x2000)]>>(xi)) & 1 ? 2 : 0; //R
313353            pen_bit[2] = (vram[count+0x48000+(plane * 0x2000)]>>(xi)) & 1 ? 4 : 0; //G
r8960r8961
318358               pen |= pen_bit[pen_i];
319359
320360            if(pri == ((clut16[pen] & 0x10) >> 4))
321               *BITMAP_ADDR16(bitmap, y, x+xi+s_x) = machine->pens[(clut16[pen] & 0x0f)+0x200];
361               *BITMAP_ADDR16(bitmap, res_y, res_x) = machine->pens[(clut16[pen] & 0x0f)+0x200];
322362         }
323363         count++;
324364         count&=((base_mask<<8) | 0xff);
r8960r8961
334374   UINT8 *vram = memory_region(machine, "maincpu");
335375   UINT8 pen,pen_bit[8];
336376   int x,y,xi,pen_i;
377   int res_x,res_y;
337378
338379   count = 0x40000;
339380
r8960r8961
343384      {
344385         for(xi=0;xi<8;xi++)
345386         {
387            res_x = x+xi;
388            res_y = y;
389
390            /* check window boundaries */
391            if(res_x < cg_hs || res_x >= cg_he || res_y < cg_vs || res_y >= cg_ve)
392               continue;
393
346394            pen_bit[0] = (vram[count + 0x2000]>>(xi)) & 1 ? (cg_reg[0x18] & 0x10) : 0; // B1
347395            pen_bit[1] = (vram[count + 0x0000]>>(xi)) & 1 ? (cg_reg[0x18] & 0x01) : 0; // B0
348396            pen_bit[2] = (vram[count + 0x6000]>>(xi)) & 1 ? (cg_reg[0x18] & 0x20) : 0; // R1
r8960r8961
357405               pen |= pen_bit[pen_i];
358406
359407            if(pri == ((clut256[pen] & 0x100) >> 8))
360               *BITMAP_ADDR16(bitmap, y, x+xi) = machine->pens[(clut256[pen] & 0xff)+0x100];
408               *BITMAP_ADDR16(bitmap, res_y, res_x) = machine->pens[(clut256[pen] & 0xff)+0x100];
361409         }
362410         count++;
363411      }
r8960r8961
388436
389437static VIDEO_UPDATE( mz2500 )
390438{
391   bitmap_fill(bitmap, cliprect, screen->machine->pens[(clut16[0] & 0xf)+0x200]); //TODO: correct?
439   bitmap_fill(bitmap, cliprect, screen->machine->pens[0]); //TODO: correct?
392440
393   popmessage("%02x",cg_mask);
441   //popmessage("%02x",cg_mask);
394442
395443   if(pal_select)
396444   {
r8960r8961
401449   }
402450   else //4096 mode colors
403451   {
404      // ...
452      draw_tv_screen(screen->machine,bitmap,cliprect);
405453   }
406454
407455    return 0;
r8960r8961
933981      cg_reg_index = (cg_reg_index & 0xfc) | ((cg_reg_index + 1) & 0x03);
934982
935983   {
936      static UINT16 vs,ve,hs,he;
937984      rectangle visarea;
938985      static int x_size,y_size;
939986
r8960r8961
948995
949996      wid_40 = (x_size == 640);
950997
951      vs = (cg_reg[0x08]) | ((cg_reg[0x09]<<8) & 1);
952      ve = (cg_reg[0x0a]) | ((cg_reg[0x0b]<<8) & 1);
953      hs = (cg_reg[0x0c] & 0x7f)*8;
954      he = (cg_reg[0x0d] & 0x7f)*8;
998      cg_vs = (cg_reg[0x08]) | ((cg_reg[0x09]<<8) & 1);
999      cg_ve = (cg_reg[0x0a]) | ((cg_reg[0x0b]<<8) & 1);
1000      cg_hs = (cg_reg[0x0c] & 0x7f)*8;
1001      cg_he = (cg_reg[0x0d] & 0x7f)*8;
9551002
9561003      //popmessage("%d %d %d %d %02x",vs,ve,hs,he,cg_reg[0x0e]);
9571004
r8960r8961
15881635   ROM_REGION( 0x40000, "dictionary", 0 )
15891636   ROM_LOAD( "dict.rom", 0x00000, 0x40000, CRC(aa957c2b) SHA1(19a5ba85055f048a84ed4e8d471aaff70fcf0374) )
15901637
1591   ROM_REGION( 0x2000, "pcg", ROMREGION_ERASE00 )
1638   ROM_REGION( 0x2000, "pcg", ROMREGION_ERASEFF )
15921639
15931640   ROM_REGION( 0x8000, "rom", ROMREGION_ERASEFF )
15941641   ROM_LOAD( "file.rom", 0x00000, 0x8000, CRC(a7bf39ce) SHA1(3f4a237fc4f34bac6fe2bbda4ce4d16d42400081) ) //optional?

Previous 15994 Revisions Next


© 1998-2018 The MESS Team