trunk/src/mame/drivers/gunpey.c
| r21522 | r21523 | |
| 217 | 217 | TIMER_DEVICE_CALLBACK_MEMBER(gunpey_scanline); |
| 218 | 218 | TIMER_CALLBACK_MEMBER(blitter_end); |
| 219 | 219 | void gunpey_irq_check(UINT8 irq_type); |
| 220 | | UINT8 draw_gfx(bitmap_ind16 &bitmap,const rectangle &cliprect,int count); |
| 220 | UINT8 draw_gfx(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int count); |
| 221 | 221 | UINT16 m_vram_bank; |
| 222 | 222 | |
| 223 | 223 | |
| r21522 | r21523 | |
| 230 | 230 | m_blit_buffer = auto_alloc_array(machine(), UINT16, 512*512); |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | | UINT8 gunpey_state::draw_gfx(bitmap_ind16 &bitmap,const rectangle &cliprect,int count) |
| 233 | UINT8 gunpey_state::draw_gfx(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int count) |
| 234 | 234 | { |
| 235 | 235 | int x,y; |
| 236 | 236 | int bpp_sel; |
| r21522 | r21523 | |
| 239 | 239 | int color; |
| 240 | 240 | UINT8 *vram = memregion("vram")->base(); |
| 241 | 241 | |
| 242 | // +0 +1 +2 +3 +4 +5 +6 +7 |
| 243 | // cccc cccc e--b b--- | xxxx ---- u--- ---- | yyyy ---- --XX XXXX | nnnn nnnn ---Y YYYY | mmmm mmmm -MMM -NNN | hhhh hhhh wwww wwww | ---- ---- ---- ---- | ---- ---- ---- ---- | |
| 244 | |
| 245 | // c = color palette |
| 246 | // e = END marker |
| 247 | // b = bpp select |
| 248 | // x = LSB x source |
| 249 | // X = MSB x source |
| 250 | // y = LSB y source |
| 251 | // Y = MSB y source |
| 252 | // n = LSB X DRAW position |
| 253 | // N = MSB X DRAW position |
| 254 | // m = LSB Y DRAW position |
| 255 | // M = MSB Y DRAW position |
| 256 | // h = height |
| 257 | // w = width |
| 258 | // u = unknown, set on text, maybe 'solid' ? |
| 259 | |
| 260 | |
| 242 | 261 | if(!(m_wram[count+0] & 1)) |
| 243 | 262 | { |
| 244 | 263 | x = (m_wram[count+3] >> 8) | ((m_wram[count+4] & 0x03) << 8); |
| r21522 | r21523 | |
| 253 | 272 | |
| 254 | 273 | //UINT32 col = 0xffffff; |
| 255 | 274 | // UINT32 val = (m_wram[count+1] << 16) | ((m_wram[count+2])); |
| 256 | | int xsource = ((m_wram[count+2] & 0x00ff) << 4) | ((m_wram[count+1] & 0xf000) >> 12); |
| 257 | | int ysource = ((m_wram[count+2] & 0xf000) >> 12)| ((m_wram[count+3] & 0x00ff) << 4); |
| 275 | int xsource = ((m_wram[count+2] & 0x003f) << 4) | ((m_wram[count+1] & 0xf000) >> 12); |
| 276 | int ysource = ((m_wram[count+3] & 0x001f) << 4) | ((m_wram[count+2] & 0xf000) >> 12); |
| 258 | 277 | //printf("%08x %04x %04x\n", val, m_wram[count+1],m_wram[count+2] ); |
| 259 | 278 | // UINT16 xsource = (m_wram[count+2] & 0x00ff << 4) | (m_wram[count+1] & 0xf000 >> 12); |
| 260 | 279 | //xsource<<=1; |
| r21522 | r21523 | |
| 262 | 281 | xsource<<=1; |
| 263 | 282 | ysource <<=2; |
| 264 | 283 | |
| 284 | UINT8 testhack = vram[((((ysource+0)&0x7ff)*0x800) + ((xsource+0)&0x7ff))]; |
| 285 | UINT8 testhack2 = vram[((((ysource+0)&0x7ff)*0x800) + ((xsource+1)&0x7ff))]; |
| 286 | |
| 287 | //if (m_wram[count+1] & 0x0080) // set on text |
| 288 | // color = machine.rand()&0xf; |
| 289 | |
| 290 | |
| 291 | |
| 292 | printf("sprite %04x %04x %04x %04x %04x %04x %04x %04x\n", m_wram[count+0], m_wram[count+1], m_wram[count+2], m_wram[count+3], m_wram[count+4], m_wram[count+5], m_wram[count+6], m_wram[count+7]); |
| 293 | |
| 294 | if ((testhack2 & 0x0f) == 0x08) |
| 295 | return m_wram[count+0] & 0x80; |
| 296 | |
| 297 | printf("testhack1 %02x %02x\n", testhack, testhack2); |
| 298 | |
| 265 | 299 | if(bpp_sel == 0x00) // 4bpp |
| 266 | 300 | { |
| 267 | 301 | for(int yi=0;yi<height;yi++) |
| r21522 | r21523 | |
| 273 | 307 | UINT32 col_offs; |
| 274 | 308 | UINT16 color_data; |
| 275 | 309 | |
| 310 | |
| 311 | |
| 276 | 312 | pix = (data & 0x0f); |
| 277 | 313 | col_offs = ((pix + color*0x10) & 0xff) << 1; |
| 278 | 314 | col_offs+= ((pix + color*0x10) >> 8)*0x800; |
| r21522 | r21523 | |
| 355 | 391 | /* last 4 entries are special, skip them for now. */ |
| 356 | 392 | for(count = vram_bank/2;count<(vram_bank+0x1000)/2;count+=0x10/2) |
| 357 | 393 | { |
| 358 | | end_mark = draw_gfx(bitmap,cliprect,count); |
| 394 | end_mark = draw_gfx(screen.machine(), bitmap,cliprect,count); |
| 359 | 395 | |
| 360 | 396 | if(end_mark == 0x80) |
| 361 | 397 | break; |
| r21522 | r21523 | |
| 363 | 399 | |
| 364 | 400 | for(count = (vram_bank+0x1000)/2;count<(vram_bank+0x2000)/2;count+=0x10/2) |
| 365 | 401 | { |
| 366 | | end_mark = draw_gfx(bitmap,cliprect,count); |
| 402 | end_mark = draw_gfx(screen.machine(), bitmap,cliprect,count); |
| 367 | 403 | |
| 368 | 404 | if(end_mark == 0x80) |
| 369 | 405 | break; |
| r21522 | r21523 | |
| 449 | 485 | int ysize = blit_ram[0x0e]+1; |
| 450 | 486 | // int color,color_offs; |
| 451 | 487 | |
| 452 | | printf("%04x %04x %04x %04x\n",srcx,srcy,dstx,dsty); |
| 488 | // printf("%04x %04x %04x %04x\n",srcx,srcy,dstx,dsty); |
| 453 | 489 | |
| 454 | 490 | /* |
| 455 | 491 | printf("%02x %02x %02x %02x| (X SRC 4: %02x 5: %02x (val %04x)) (Y SRC 6: %02x 7: %02x (val %04x)) | (X DEST 8: %02x 9: %02x (val %04x)) (Y DEST a: %02x b: %02x (val %04x)) | %02x %02x %02x %02x\n" |