trunk/src/mame/drivers/gunpey.c
| r21692 | r21693 | |
| 227 | 227 | UINT16 m_vreg_addr; |
| 228 | 228 | |
| 229 | 229 | UINT8* m_blit_rom; |
| 230 | UINT8* m_blit_rom2; |
| 231 | |
| 230 | 232 | UINT8* m_vram; |
| 231 | 233 | |
| 232 | 234 | // work variables for the decompression |
| r21692 | r21693 | |
| 243 | 245 | int m_dstxbase; |
| 244 | 246 | int m_dstxcount; |
| 245 | 247 | int m_dstycount; |
| 248 | bool m_out_of_data; |
| 246 | 249 | |
| 247 | 250 | int m_latched_bits_left; |
| 248 | 251 | UINT8 m_latched_byte; |
| r21692 | r21693 | |
| 641 | 644 | { |
| 642 | 645 | // check if we need to move on to the next row of the source bitmap |
| 643 | 646 | // to get the data requested |
| 647 | |
| 644 | 648 | if (m_scrxcount==m_sourcewide) |
| 645 | 649 | { |
| 646 | 650 | m_scrxcount = 0; |
| r21692 | r21693 | |
| 649 | 653 | } |
| 650 | 654 | |
| 651 | 655 | m_latched_byte = m_blit_rom[(((m_srcy)&0x7ff)*0x800)+((m_srcx)&0x7ff)]; |
| 656 | if (!m_out_of_data) m_blit_rom2[(((m_srcy)&0x7ff)*0x800)+((m_srcx)&0x7ff)] = 0x77; // debug |
| 657 | |
| 652 | 658 | m_latched_bits_left = 8; |
| 653 | 659 | |
| 654 | 660 | // increase counters |
| r21692 | r21693 | |
| 1054 | 1060 | m_latched_bits_left = 0; |
| 1055 | 1061 | m_zero_bit_count = 0; |
| 1056 | 1062 | |
| 1057 | | bool out_of_data = false; |
| 1063 | m_out_of_data = false; |
| 1058 | 1064 | |
| 1059 | 1065 | for (;;) |
| 1060 | 1066 | { |
| r21692 | r21693 | |
| 1084 | 1090 | // hack, really I imagine there is exactly enough compressed data to fill the dest bitmap area when decompressed, but to stop us |
| 1085 | 1091 | // overrunning into reading other data we terminate on a 0000, which doesn't seem likely to be compressed data. |
| 1086 | 1092 | if (m_zero_bit_count>=16) |
| 1087 | | out_of_data = true; |
| 1093 | m_out_of_data = true; |
| 1088 | 1094 | |
| 1089 | 1095 | |
| 1090 | 1096 | |
| 1091 | 1097 | UINT8 usedata = 0xff; |
| 1092 | | if (!out_of_data) |
| 1098 | if (!m_out_of_data) |
| 1093 | 1099 | { |
| 1094 | 1100 | #ifdef SHOW_COMPRESSED_DATA_DEBUG |
| 1095 | 1101 | //if (count<512) |
| r21692 | r21693 | |
| 1158 | 1164 | for (;;) |
| 1159 | 1165 | { |
| 1160 | 1166 | UINT8 usedata = m_blit_rom[(((m_srcy)&0x7ff)*0x800)+((m_srcx)&0x7ff)]; |
| 1161 | | |
| 1167 | m_blit_rom2[(((m_srcy)&0x7ff)*0x800)+((m_srcx)&0x7ff)] = 0x44; // debug |
| 1162 | 1168 | m_srcx++; m_scrxcount++; |
| 1163 | 1169 | if (m_scrxcount==m_xsize) |
| 1164 | 1170 | { |
| r21692 | r21693 | |
| 1377 | 1383 | |
| 1378 | 1384 | static GFXDECODE_START( gunpey ) |
| 1379 | 1385 | GFXDECODE_ENTRY( "blit_data", 0, gunpey, 0x0000, 0x1 ) |
| 1386 | GFXDECODE_ENTRY( "blit_data2", 0, gunpey, 0x0000, 0x1 ) |
| 1380 | 1387 | GFXDECODE_ENTRY( "vram", 0, gunpey, 0x0000, 0x1 ) |
| 1381 | 1388 | GFXDECODE_END |
| 1382 | 1389 | |
| r21692 | r21693 | |
| 1421 | 1428 | |
| 1422 | 1429 | ROM_REGION( 0x400000, "blit_data", 0 ) |
| 1423 | 1430 | ROM_LOAD( "gp_rom3.025", 0x00000, 0x400000, CRC(f2d1f9f0) SHA1(0d20301fd33892074508b9d127456eae80cc3a1c) ) |
| 1431 | ROM_REGION( 0x400000, "blit_data2", 0 ) // debug test |
| 1432 | ROM_COPY( "blit_data", 0x00000, 0x00000, 0x400000 ) |
| 1424 | 1433 | |
| 1434 | |
| 1425 | 1435 | ROM_REGION( 0x400000, "vram", ROMREGION_ERASEFF ) |
| 1426 | 1436 | |
| 1427 | 1437 | ROM_REGION( 0x400000, "ymz", 0 ) |
| r21692 | r21693 | |
| 1437 | 1447 | { |
| 1438 | 1448 | |
| 1439 | 1449 | m_blit_rom = memregion("blit_data")->base(); |
| 1450 | m_blit_rom2 = memregion("blit_data2")->base(); |
| 1451 | |
| 1440 | 1452 | m_vram = memregion("vram")->base(); |
| 1441 | 1453 | // ... |
| 1442 | 1454 | } |