trunk/src/mame/drivers/gunpey.c
| r21527 | r21528 | |
| 234 | 234 | { |
| 235 | 235 | int x,y; |
| 236 | 236 | int bpp_sel; |
| 237 | | int height; |
| 238 | | int width; |
| 239 | 237 | int color; |
| 240 | 238 | UINT8 *vram = memregion("vram")->base(); |
| 241 | 239 | |
| r21527 | r21528 | |
| 268 | 266 | { |
| 269 | 267 | x = (m_wram[count+3] >> 8) | ((m_wram[count+4] & 0x03) << 8); |
| 270 | 268 | y = (m_wram[count+4] >> 8) | ((m_wram[count+4] & 0x30) << 4); |
| 271 | | height = (m_wram[count+5] >> 8); |
| 272 | | width = (m_wram[count+5] & 0xff); |
| 269 | UINT8 zoomheight = (m_wram[count+5] >> 8); |
| 270 | UINT8 zoomwidth = (m_wram[count+5] & 0xff); |
| 273 | 271 | bpp_sel = (m_wram[count+0] & 0x18); |
| 274 | 272 | color = (m_wram[count+0] >> 8); |
| 275 | 273 | |
| 276 | 274 | x-=0x160; |
| 277 | 275 | y-=0x188; |
| 278 | 276 | |
| 279 | | UINT8 zoomwidth = (m_wram[count+6] & 0xff); |
| 280 | | UINT8 zoomheight = (m_wram[count+7] >> 8); |
| 277 | UINT8 sourcewidth = (m_wram[count+6] & 0xff); |
| 278 | UINT8 sourceheight = (m_wram[count+7] >> 8); |
| 281 | 279 | |
| 282 | 280 | //UINT32 col = 0xffffff; |
| 283 | 281 | // UINT32 val = (m_wram[count+1] << 16) | ((m_wram[count+2])); |
| r21527 | r21528 | |
| 290 | 288 | // xsource<<=1; |
| 291 | 289 | // ysource <<=2; |
| 292 | 290 | |
| 293 | | UINT8 testhack = vram[((((ysource+0)&0x7ff)*0x800) + ((xsource+0)&0x7ff))]; |
| 294 | | UINT8 testhack2 = vram[((((ysource+0)&0x7ff)*0x800) + ((xsource+1)&0x7ff))]; |
| 291 | // UINT8 testhack = vram[((((ysource+0)&0x7ff)*0x800) + ((xsource+0)&0x7ff))]; |
| 292 | // UINT8 testhack2 = vram[((((ysource+0)&0x7ff)*0x800) + ((xsource+1)&0x7ff))]; |
| 295 | 293 | |
| 296 | | if (m_wram[count+1] & 0x0010) |
| 297 | | color = machine.rand()&0xf; |
| 294 | //if (m_wram[count+1] & 0x0010) |
| 295 | // color = machine.rand()&0xf; |
| 298 | 296 | |
| 299 | 297 | |
| 300 | 298 | |
| r21527 | r21528 | |
| 311 | 309 | unused = m_wram[count+6]&~0x00ff; if (unused) printf("unused bits set in word 6 - %04x\n", unused); |
| 312 | 310 | unused = m_wram[count+7]&~0xff00; if (unused) printf("unused bits set in word 7 - %04x\n", unused); |
| 313 | 311 | |
| 314 | | if ((zoomwidth != width) || (zoomheight!= height)) |
| 312 | if ((zoomwidth != sourcewidth) || (zoomheight!= zoomheight)) |
| 315 | 313 | { |
| 316 | | printf("zoomed widths %02x %02x heights %02x %02x\n", width, zoomwidth, height, zoomheight); |
| 314 | //printf("zoomed widths %02x %02x heights %02x %02x\n", sourcewidth, zoomwidth, sourceheight, zoomheight); |
| 317 | 315 | } |
| 318 | 316 | |
| 319 | 317 | |
| 320 | 318 | |
| 321 | | if ((testhack2 & 0x0f) == 0x08) |
| 322 | | return m_wram[count+0] & 0x80; |
| 319 | // if ((testhack2 & 0x0f) == 0x08) |
| 320 | // return m_wram[count+0] & 0x80; |
| 323 | 321 | |
| 324 | | if (debug) printf("testhack1 %02x %02x\n", testhack, testhack2); |
| 322 | //if (debug) printf("testhack1 %02x %02x\n", testhack, testhack2); |
| 325 | 323 | |
| 326 | 324 | if(bpp_sel == 0x00) // 4bpp |
| 327 | 325 | { |
| 328 | | for(int yi=0;yi<height;yi++) |
| 326 | for(int yi=0;yi<sourceheight;yi++) |
| 329 | 327 | { |
| 330 | | for(int xi=0;xi<width/2;xi++) |
| 328 | for(int xi=0;xi<sourcewidth/2;xi++) |
| 331 | 329 | { |
| 332 | 330 | UINT8 data = vram[((((ysource+yi)&0x7ff)*0x800) + ((xsource+xi)&0x7ff))]; |
| 333 | 331 | UINT8 pix; |
| 334 | 332 | UINT32 col_offs; |
| 335 | 333 | UINT16 color_data; |
| 336 | 334 | |
| 337 | | |
| 338 | | |
| 339 | 335 | pix = (data & 0x0f); |
| 340 | 336 | col_offs = ((pix + color*0x10) & 0xff) << 1; |
| 341 | 337 | col_offs+= ((pix + color*0x10) >> 8)*0x800; |
| 342 | 338 | color_data = (vram[col_offs])|(vram[col_offs+1]<<8); |
| 343 | 339 | |
| 344 | 340 | if(!(color_data & 0x8000)) |
| 345 | | if(cliprect.contains(x+(xi*2), y+yi)) |
| 346 | | bitmap.pix16(y+yi, x+(xi*2)) = color_data & 0x7fff; |
| 341 | if(cliprect.contains(x+(xi*2), y+yi)) |
| 342 | bitmap.pix16(y+yi, x+(xi*2)) = color_data & 0x7fff; |
| 347 | 343 | |
| 348 | 344 | pix = (data & 0xf0)>>4; |
| 349 | 345 | col_offs = ((pix + color*0x10) & 0xff) << 1; |
| r21527 | r21528 | |
| 358 | 354 | } |
| 359 | 355 | else if(bpp_sel == 0x08) // 6bpp |
| 360 | 356 | { |
| 357 | printf("6bpp\n"); |
| 361 | 358 | #if 0 |
| 362 | | for(int yi=0;yi<height;yi++) |
| 359 | for(int yi=0;yi<sourceheight;yi++) |
| 363 | 360 | { |
| 364 | | for(int xi=0;xi<width;xi++) |
| 361 | for(int xi=0;xi<sourcewidth;xi++) |
| 365 | 362 | { |
| 366 | 363 | UINT8 data = vram[((((ysource+yi)&0x7ff)*0x800) + ((xsource+xi)&0x7ff))]; |
| 367 | 364 | UINT8 pix; |
| r21527 | r21528 | |
| 377 | 374 | } |
| 378 | 375 | else if(bpp_sel == 0x10) // 8bpp |
| 379 | 376 | { |
| 380 | | for(int yi=0;yi<height;yi++) |
| 377 | for(int yi=0;yi<sourceheight;yi++) |
| 381 | 378 | { |
| 382 | | for(int xi=0;xi<width;xi++) |
| 379 | for(int xi=0;xi<sourcewidth;xi++) |
| 383 | 380 | { |
| 384 | 381 | UINT8 data = vram[((((ysource+yi)&0x7ff)*0x800) + ((xsource+xi)&0x7ff))]; |
| 385 | 382 | UINT8 pix; |
| r21527 | r21528 | |
| 399 | 396 | } |
| 400 | 397 | else if(bpp_sel == 0x18) // RGB32k |
| 401 | 398 | { |
| 399 | printf("32k\n"); |
| 402 | 400 | // ... |
| 403 | 401 | } |
| 404 | 402 | } |