trunk/src/mame/drivers/popobear.c
| r21827 | r21828 | |
| 290 | 290 | UINT32 popobear_state::screen_update_popobear(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 291 | 291 | { |
| 292 | 292 | bitmap.fill(0, cliprect); |
| 293 | int line; |
| 294 | rectangle clip; |
| 295 | int scrollbase; |
| 296 | int scrollbase2; |
| 293 | 297 | |
| 298 | const rectangle &visarea = screen.visible_area(); |
| 299 | clip = visarea; |
| 300 | |
| 294 | 301 | //popmessage("%04x",m_vregs[0/2]); |
| 295 | 302 | UINT16* vreg = m_vregs; |
| 296 | 303 | |
| r21827 | r21828 | |
| 299 | 306 | |
| 300 | 307 | |
| 301 | 308 | // these are more than just enable, they get written with 0x0d and 0x1f (and 0x00 when a layer is off) |
| 302 | | // it might relate to the linescroll modes or sizes? |
| 309 | // seems to be related to the linescroll mode at least? maybe sizes? |
| 303 | 310 | int enable0 = (m_vregs[0x0c] & 0xff00)>>8; |
| 304 | 311 | int enable1 = (m_vregs[0x0c] & 0x00ff)>>0; |
| 305 | 312 | int enable2 = (m_vregs[0x0d] & 0xff00)>>8; |
| r21827 | r21828 | |
| 310 | 317 | if ((enable2 != 0x00) && (enable2 != 0x0d) && (enable2 != 0x1f)) printf("unknown enable2 value %02x\n", enable2); |
| 311 | 318 | if ((enable3 != 0x00) && (enable3 != 0x0d) && (enable3 != 0x1f)) printf("unknown enable3 value %02x\n", enable3); |
| 312 | 319 | |
| 320 | |
| 321 | // the lower 2 tilemaps use regular scrolling |
| 313 | 322 | m_bg_tilemap[2]->set_scrollx(0, vreg[0x07]); |
| 314 | 323 | m_bg_tilemap[2]->set_scrolly(0, vreg[0x08]); |
| 315 | 324 | |
| 316 | 325 | m_bg_tilemap[3]->set_scrollx(0, vreg[0x09]); |
| 317 | 326 | m_bg_tilemap[3]->set_scrolly(0, vreg[0x0a]); |
| 318 | 327 | |
| 319 | | |
| 320 | 328 | if (enable3) m_bg_tilemap[3]->draw(bitmap, cliprect, 0, 0); |
| 321 | 329 | if (enable2) m_bg_tilemap[2]->draw(bitmap, cliprect, 0, 0); |
| 322 | | if (enable1) m_bg_tilemap[1]->draw(bitmap, cliprect, 0, 0); |
| 323 | | if (enable0) m_bg_tilemap[0]->draw(bitmap, cliprect, 0, 0); |
| 330 | |
| 331 | // the upper 2 tilemaps have a lineselect / linescroll logic |
| 332 | |
| 333 | if (enable1 == 0x1f) |
| 334 | { |
| 335 | scrollbase = 0xdf600; |
| 336 | scrollbase2 = 0xdf800; |
| 337 | |
| 338 | for (line = 0; line < 240;line++) |
| 339 | { |
| 340 | UINT16 val = m_vram[scrollbase/2 + line]; |
| 341 | UINT16 upper = (m_vram[scrollbase2/2 + line]&0xff00)>>8; |
| 342 | |
| 343 | clip.min_y = clip.max_y = line; |
| 344 | |
| 345 | m_bg_tilemap[1]->set_scrollx(0,(val&0x00ff) | (upper << 8)); |
| 346 | m_bg_tilemap[1]->set_scrolly((0,(val&0xff00)>>8)-line); |
| 347 | |
| 348 | m_bg_tilemap[1]->draw(bitmap, clip, 0, 0); |
| 349 | } |
| 350 | } |
| 351 | else if (enable1 != 0x00) |
| 352 | { |
| 353 | m_bg_tilemap[1]->set_scrollx(0, 0); |
| 354 | m_bg_tilemap[1]->set_scrolly(0, 0); |
| 355 | m_bg_tilemap[1]->draw(bitmap, cliprect, 0, 0); |
| 356 | } |
| 357 | |
| 358 | if (enable0 == 0x1f) |
| 359 | { |
| 360 | scrollbase = 0xdf400; |
| 361 | scrollbase2 = 0xdf800; |
| 362 | |
| 363 | for (line = 0; line < 240;line++) |
| 364 | { |
| 365 | UINT16 val = m_vram[scrollbase/2 + line]; |
| 366 | UINT16 upper = (m_vram[scrollbase2/2 + line]&0x00ff)>>0; |
| 367 | |
| 368 | clip.min_y = clip.max_y = line; |
| 369 | |
| 370 | m_bg_tilemap[0]->set_scrollx(0,(val&0x00ff) | (upper << 8)); |
| 371 | m_bg_tilemap[0]->set_scrolly((0,(val&0xff00)>>8)-line); |
| 372 | |
| 373 | m_bg_tilemap[0]->draw(bitmap, clip, 0, 0); |
| 374 | } |
| 375 | } |
| 376 | else if (enable0 != 0x00) |
| 377 | { |
| 378 | m_bg_tilemap[0]->set_scrollx(0, 0); |
| 379 | m_bg_tilemap[0]->set_scrolly(0, 0); |
| 380 | m_bg_tilemap[0]->draw(bitmap, cliprect, 0, 0); |
| 381 | } |
| 382 | |
| 324 | 383 | draw_sprites(bitmap,cliprect); |
| 325 | 384 | |
| 326 | 385 | return 0; |