trunk/src/mame/drivers/gunpey.c
| r21514 | r21515 | |
| 1 | | |
| 2 | | //#define USE_FAKE_ROM |
| 3 | | |
| 4 | 1 | /******************************************************************************************** |
| 5 | 2 | |
| 6 | 3 | Gunpey (c) 2000 Banpresto |
| r21514 | r21515 | |
| 220 | 217 | TIMER_DEVICE_CALLBACK_MEMBER(gunpey_scanline); |
| 221 | 218 | TIMER_CALLBACK_MEMBER(blitter_end); |
| 222 | 219 | void gunpey_irq_check(UINT8 irq_type); |
| 220 | void flush_pal_data(int x, int y); |
| 223 | 221 | UINT16 m_vram_bank; |
| 224 | 222 | |
| 225 | 223 | //UINT16 main_vram[0x800][0x800]; |
| r21514 | r21515 | |
| 239 | 237 | int bpp_sel; |
| 240 | 238 | int height; |
| 241 | 239 | int width; |
| 240 | int color; |
| 242 | 241 | UINT16 vram_bank = m_vram_bank & 0x7fff; |
| 243 | 242 | UINT8 *vram = memregion("vram")->base(); |
| 244 | 243 | |
| r21514 | r21515 | |
| 256 | 255 | height = (m_wram[count+5] >> 8); |
| 257 | 256 | width = (m_wram[count+5] & 0xff); |
| 258 | 257 | bpp_sel = (m_wram[count+0] & 0x18); |
| 258 | color = (m_wram[count+0] >> 8); |
| 259 | 259 | |
| 260 | 260 | x-=0x160; |
| 261 | 261 | y-=0x188; |
| r21514 | r21515 | |
| 263 | 263 | //UINT32 col = 0xffffff; |
| 264 | 264 | |
| 265 | 265 | // UINT32 val = (m_wram[count+1] << 16) | ((m_wram[count+2])); |
| 266 | | |
| 267 | | #ifdef USE_FAKE_ROM |
| 268 | | int letter = -1; |
| 269 | 266 | |
| 270 | | /* |
| 271 | | -- TEST MODE -- |
| 272 | | I/O TEST |
| 273 | | MONITOR TEST |
| 274 | | CG-ROM VIEWER |
| 275 | | CHARACTER CHECK |
| 276 | | SOUND TEST |
| 277 | | */ |
| 278 | | // these are going to be co-ordinates in the bitmap, probably not the ROM, but the one the 'blitter' (gfx unpack device?) creates |
| 279 | | if (val == 0x2080203b) { letter = ' '; } |
| 280 | | if (val == 0x0080203b) { letter = '-'; } |
| 281 | | if (val == 0x4080203b) { letter = '/'; } |
| 282 | | if (val == 0x6080203b) { letter = '0'; } |
| 283 | | if (val == 0x8080403a) { letter = '1'; } |
| 284 | | if (val == 0xa080403a) { letter = '2'; } |
| 285 | | if (val == 0xc080403a) { letter = '3'; } |
| 286 | | if (val == 0xe080403a) { letter = '4'; } |
| 287 | | if (val == 0x0080403b) { letter = '5'; } |
| 288 | | if (val == 0x2080403b) { letter = '6'; } |
| 289 | | if (val == 0x4080403b) { letter = '7'; } |
| 290 | | if (val == 0x6080403b) { letter = '8'; } |
| 291 | | if (val == 0x8080603a) { letter = '9'; } |
| 292 | | |
| 293 | | if (val == 0x8080803a) { letter = 'A'; } |
| 294 | | if (val == 0xa080803a) { letter = 'B'; } |
| 295 | | if (val == 0xc080803a) { letter = 'C'; } |
| 296 | | if (val == 0xe080803a) { letter = 'D'; } |
| 297 | | if (val == 0x0080803b) { letter = 'E'; } |
| 298 | | if (val == 0x2080803b) { letter = 'F'; } |
| 299 | | if (val == 0x4080803b) { letter = 'G'; } |
| 300 | | if (val == 0x6080803b) { letter = 'H'; } |
| 301 | | if (val == 0x8080a03a) { letter = 'I'; } |
| 302 | | if (val == 0xa080a03a) { letter = 'J'; } |
| 303 | | if (val == 0xc080a03a) { letter = 'K'; } |
| 304 | | if (val == 0xe080a03a) { letter = 'L'; } |
| 305 | | if (val == 0x0080a03b) { letter = 'M'; } |
| 306 | | if (val == 0x2080a03b) { letter = 'N'; } |
| 307 | | if (val == 0x4080a03b) { letter = 'O'; } |
| 308 | | if (val == 0x6080a03b) { letter = 'P'; } |
| 309 | | if (val == 0x8080c03a) { letter = 'Q'; } |
| 310 | | if (val == 0xa080c03a) { letter = 'R'; } |
| 311 | | if (val == 0xc080c03a) { letter = 'S'; } |
| 312 | | if (val == 0xe080c03a) { letter = 'T'; } |
| 313 | | if (val == 0x0080c03b) { letter = 'U'; } |
| 314 | | if (val == 0x2080c03b) { letter = 'V'; } |
| 315 | | if (val == 0x4080c03b) { letter = 'W'; } |
| 316 | | if (val == 0x6080c03b) { letter = 'X'; } |
| 317 | | if (val == 0x8080e03a) { letter = 'Y'; } |
| 318 | | if (val == 0xa080e03a) { letter = 'Z'; } |
| 319 | | |
| 320 | | #endif |
| 321 | 267 | int xsource = ((m_wram[count+2] & 0x00ff) << 4) | ((m_wram[count+1] & 0xf000) >> 12); |
| 322 | 268 | int ysource = ((m_wram[count+2] & 0xf000) >> 12)| ((m_wram[count+3] & 0x00ff) << 4); |
| 323 | 269 | |
| r21514 | r21515 | |
| 334 | 280 | |
| 335 | 281 | |
| 336 | 282 | |
| 337 | | |
| 338 | | #ifdef USE_FAKE_ROM |
| 339 | | if (letter != -1) |
| 340 | | drawgfx_opaque(bitmap,cliprect,machine().gfx[1],letter,1,0,0,x,y); |
| 341 | | else |
| 342 | | #endif |
| 343 | 283 | if(bpp_sel == 0x00) |
| 344 | 284 | { |
| 345 | 285 | for(int yi=0;yi<height;yi++) |
| r21514 | r21515 | |
| 353 | 293 | pix = (data & 0x0f); |
| 354 | 294 | |
| 355 | 295 | if(cliprect.contains(x+(xi*2), y+yi)) |
| 356 | | bitmap.pix16(y+yi, x+(xi*2)) = pix; |
| 296 | bitmap.pix16(y+yi, x+(xi*2)) = pix + color*0x10; |
| 357 | 297 | |
| 358 | 298 | pix = (data & 0xf0)>>4; |
| 359 | 299 | |
| 360 | 300 | if(cliprect.contains(x+1+(xi*2), y+yi)) |
| 361 | | bitmap.pix16(y+yi, x+1+(xi*2)) = pix; |
| 301 | bitmap.pix16(y+yi, x+1+(xi*2)) = pix + color*0x10; |
| 362 | 302 | } |
| 363 | 303 | } |
| 364 | 304 | } |
| r21514 | r21515 | |
| 366 | 306 | } |
| 367 | 307 | } |
| 368 | 308 | |
| 369 | | #if 0 |
| 370 | | for(y=0;y<512;y++) |
| 371 | | { |
| 372 | | for(x=0;x<512;x++) |
| 373 | | { |
| 374 | | UINT32 color; |
| 375 | | int r,g,b; |
| 376 | | color = (blit_buffer[count] & 0xffff); |
| 377 | 309 | |
| 378 | | b = (color & 0x001f) << 3; |
| 379 | | g = (color & 0x03e0) >> 2; |
| 380 | | r = (color & 0x7c00) >> 7; |
| 381 | | |
| 382 | | if(cliprect.contains(x, y)) |
| 383 | | bitmap.pix32(y, x) = b | (g<<8) | (r<<16); |
| 384 | | |
| 385 | | count++; |
| 386 | | } |
| 387 | | } |
| 388 | | #endif |
| 389 | | |
| 390 | 310 | return 0; |
| 391 | 311 | } |
| 392 | 312 | |
| r21514 | r21515 | |
| 442 | 362 | gunpey_irq_check(4); |
| 443 | 363 | } |
| 444 | 364 | |
| 365 | void gunpey_state::flush_pal_data(int x, int y) |
| 366 | { |
| 367 | if(y < 512 && x < 512) |
| 368 | { |
| 369 | UINT8 *vram = memregion("vram")->base(); |
| 370 | int val = (vram[y*0x800+x]) | (vram[y*0x800+x+1]<<8); |
| 371 | int r,g,b; |
| 372 | |
| 373 | b = (val & 0x001f) >> 0; |
| 374 | g = (val & 0x03e0) >> 5; |
| 375 | r = (val & 0x7c00) >> 10; |
| 376 | |
| 377 | palette_set_color(machine(), y*256+x/2, MAKE_RGB(pal5bit(r), pal5bit(g), pal5bit(b))); |
| 378 | } |
| 379 | } |
| 380 | |
| 445 | 381 | WRITE8_MEMBER(gunpey_state::gunpey_blitter_w) |
| 446 | 382 | { |
| 447 | 383 | // UINT16 *blit_buffer = m_blit_buffer; |
| r21514 | r21515 | |
| 493 | 429 | for (int x=0;x<xsize;x++) |
| 494 | 430 | { |
| 495 | 431 | vram[(((dsty+y)&0x7ff)*0x800)+((dstx+x)&0x7ff)] = blit_rom[(((srcy+y)&0x7ff)*0x800)+((srcx+x)&0x7ff)]; |
| 432 | flush_pal_data((dstx+x) & 0x7fe,(dsty+y) & 0x7ff); |
| 496 | 433 | } |
| 497 | 434 | } |
| 498 | 435 | |
| r21514 | r21515 | |
| 649 | 586 | /* test hack */ |
| 650 | 587 | void gunpey_state::palette_init() |
| 651 | 588 | { |
| 589 | #if 0 |
| 652 | 590 | int i,r,g,b,val; |
| 653 | 591 | UINT8 *blit_rom = memregion("blit_data")->base(); |
| 654 | 592 | |
| r21514 | r21515 | |
| 665 | 603 | |
| 666 | 604 | palette_set_color(machine(), i/2, MAKE_RGB(r, g, b)); |
| 667 | 605 | } |
| 668 | | |
| 606 | #endif |
| 669 | 607 | } |
| 670 | 608 | |
| 671 | 609 | |
| r21514 | r21515 | |
| 708 | 646 | |
| 709 | 647 | static GFXDECODE_START( gunpey ) |
| 710 | 648 | GFXDECODE_ENTRY( "blit_data", 0, gunpey, 0x0000, 0x1 ) |
| 711 | | GFXDECODE_ENTRY( "fakerom", 0x18000, fake_layout, 0x0, 2 ) |
| 712 | 649 | //GFXDECODE_ENTRY( "vram", 0, gunpey1024, 0x0000, 0x1 ) |
| 713 | 650 | GFXDECODE_ENTRY( "vram", 0, gunpey, 0x0000, 0x1 ) |
| 714 | 651 | |
| r21514 | r21515 | |
| 730 | 667 | MCFG_SCREEN_RAW_PARAMS(57242400/8, 442, 0, 320, 264, 0, 224) /* just to get ~60 Hz */ |
| 731 | 668 | MCFG_SCREEN_UPDATE_DRIVER(gunpey_state, screen_update_gunpey) |
| 732 | 669 | |
| 733 | | MCFG_PALETTE_LENGTH(0x800) |
| 670 | MCFG_PALETTE_LENGTH(0x10000) |
| 734 | 671 | MCFG_GFXDECODE(gunpey) |
| 735 | 672 | |
| 736 | 673 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker","rspeaker") |
| r21514 | r21515 | |
| 762 | 699 | |
| 763 | 700 | ROM_REGION( 0x400000, "oki", 0 ) |
| 764 | 701 | ROM_LOAD( "gp_rom5.622", 0x000000, 0x400000, CRC(f79903e0) SHA1(4fd50b4138e64a48ec1504eb8cd172a229e0e965)) // 1xxxxxxxxxxxxxxxxxxxxx = 0xFF |
| 765 | | |
| 766 | | ROM_REGION( 0x20000, "fakerom", ROMREGION_ERASEFF ) |
| 767 | | #ifdef USE_FAKE_ROM |
| 768 | | ROM_LOAD( "video", 0x00000, 0x20000, CRC(8857ec5a) SHA1(5bed14933af060cb4a1ce6a961c4ca1467a1cbc2) ) |
| 769 | | #endif |
| 770 | 702 | ROM_END |
| 771 | 703 | |
| 772 | 704 | |