src/mess/drivers/mz2500.c
| r8960 | r8961 | |
| 2 | 2 | |
| 3 | 3 | Sharp MZ-2500 (c) 1985 Sharp Corporation |
| 4 | 4 | |
| 5 | | preliminary driver by Angelo Salese |
| 5 | driver by Angelo Salese |
| 6 | 6 | |
| 7 | 7 | 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; |
| 11 | 17 | |
| 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 | |
| 12 | 41 | memory map: |
| 13 | 42 | 0x00000-0x3ffff Work RAM |
| 14 | 43 | 0x40000-0x5ffff CG RAM |
| r8960 | r8961 | |
| 47 | 76 | static UINT16 clut256[0x100]; |
| 48 | 77 | static UINT8 cg_mask; |
| 49 | 78 | static UINT8 wid_40; |
| 79 | static UINT16 cg_vs,cg_ve,cg_hs,cg_he; //CG window parameters |
| 50 | 80 | |
| 51 | 81 | #define WRAM_RESET 0 |
| 52 | 82 | #define IPL_RESET 1 |
| r8960 | r8961 | |
| 294 | 324 | UINT32 wa_reg; |
| 295 | 325 | UINT8 s_x; |
| 296 | 326 | UINT8 base_mask; |
| 327 | int res_x,res_y; |
| 297 | 328 | |
| 298 | 329 | base_mask = (x_size == 640) ? 0x3f : 0x1f; |
| 299 | 330 | |
| r8960 | r8961 | |
| 302 | 333 | /* TODO: layer 2 scrolling */ |
| 303 | 334 | s_x = (cg_reg[0x0f] & 0xf); |
| 304 | 335 | |
| 336 | //popmessage("%d %d %d %d",cg_hs,cg_he,cg_vs,cg_ve); |
| 337 | |
| 305 | 338 | for(y=0;y<200;y++) |
| 306 | 339 | { |
| 307 | 340 | for(x=0;x<x_size;x+=8) |
| 308 | 341 | { |
| 309 | 342 | for(xi=0;xi<8;xi++) |
| 310 | 343 | { |
| 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 | |
| 311 | 351 | pen_bit[0] = (vram[count+0x40000+(plane * 0x2000)]>>(xi)) & 1 ? 1 : 0; //B |
| 312 | 352 | pen_bit[1] = (vram[count+0x44000+(plane * 0x2000)]>>(xi)) & 1 ? 2 : 0; //R |
| 313 | 353 | pen_bit[2] = (vram[count+0x48000+(plane * 0x2000)]>>(xi)) & 1 ? 4 : 0; //G |
| r8960 | r8961 | |
| 318 | 358 | pen |= pen_bit[pen_i]; |
| 319 | 359 | |
| 320 | 360 | 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]; |
| 322 | 362 | } |
| 323 | 363 | count++; |
| 324 | 364 | count&=((base_mask<<8) | 0xff); |
| r8960 | r8961 | |
| 334 | 374 | UINT8 *vram = memory_region(machine, "maincpu"); |
| 335 | 375 | UINT8 pen,pen_bit[8]; |
| 336 | 376 | int x,y,xi,pen_i; |
| 377 | int res_x,res_y; |
| 337 | 378 | |
| 338 | 379 | count = 0x40000; |
| 339 | 380 | |
| r8960 | r8961 | |
| 343 | 384 | { |
| 344 | 385 | for(xi=0;xi<8;xi++) |
| 345 | 386 | { |
| 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 | |
| 346 | 394 | pen_bit[0] = (vram[count + 0x2000]>>(xi)) & 1 ? (cg_reg[0x18] & 0x10) : 0; // B1 |
| 347 | 395 | pen_bit[1] = (vram[count + 0x0000]>>(xi)) & 1 ? (cg_reg[0x18] & 0x01) : 0; // B0 |
| 348 | 396 | pen_bit[2] = (vram[count + 0x6000]>>(xi)) & 1 ? (cg_reg[0x18] & 0x20) : 0; // R1 |
| r8960 | r8961 | |
| 357 | 405 | pen |= pen_bit[pen_i]; |
| 358 | 406 | |
| 359 | 407 | 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]; |
| 361 | 409 | } |
| 362 | 410 | count++; |
| 363 | 411 | } |
| r8960 | r8961 | |
| 388 | 436 | |
| 389 | 437 | static VIDEO_UPDATE( mz2500 ) |
| 390 | 438 | { |
| 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? |
| 392 | 440 | |
| 393 | | popmessage("%02x",cg_mask); |
| 441 | //popmessage("%02x",cg_mask); |
| 394 | 442 | |
| 395 | 443 | if(pal_select) |
| 396 | 444 | { |
| r8960 | r8961 | |
| 401 | 449 | } |
| 402 | 450 | else //4096 mode colors |
| 403 | 451 | { |
| 404 | | // ... |
| 452 | draw_tv_screen(screen->machine,bitmap,cliprect); |
| 405 | 453 | } |
| 406 | 454 | |
| 407 | 455 | return 0; |
| r8960 | r8961 | |
| 933 | 981 | cg_reg_index = (cg_reg_index & 0xfc) | ((cg_reg_index + 1) & 0x03); |
| 934 | 982 | |
| 935 | 983 | { |
| 936 | | static UINT16 vs,ve,hs,he; |
| 937 | 984 | rectangle visarea; |
| 938 | 985 | static int x_size,y_size; |
| 939 | 986 | |
| r8960 | r8961 | |
| 948 | 995 | |
| 949 | 996 | wid_40 = (x_size == 640); |
| 950 | 997 | |
| 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; |
| 955 | 1002 | |
| 956 | 1003 | //popmessage("%d %d %d %d %02x",vs,ve,hs,he,cg_reg[0x0e]); |
| 957 | 1004 | |
| r8960 | r8961 | |
| 1588 | 1635 | ROM_REGION( 0x40000, "dictionary", 0 ) |
| 1589 | 1636 | ROM_LOAD( "dict.rom", 0x00000, 0x40000, CRC(aa957c2b) SHA1(19a5ba85055f048a84ed4e8d471aaff70fcf0374) ) |
| 1590 | 1637 | |
| 1591 | | ROM_REGION( 0x2000, "pcg", ROMREGION_ERASE00 ) |
| 1638 | ROM_REGION( 0x2000, "pcg", ROMREGION_ERASEFF ) |
| 1592 | 1639 | |
| 1593 | 1640 | ROM_REGION( 0x8000, "rom", ROMREGION_ERASEFF ) |
| 1594 | 1641 | ROM_LOAD( "file.rom", 0x00000, 0x8000, CRC(a7bf39ce) SHA1(3f4a237fc4f34bac6fe2bbda4ce4d16d42400081) ) //optional? |