trunk/src/mame/drivers/popobear.c
| r21825 | r21826 | |
| 8 | 8 | - auto-animation speed is erratic (way too fast); |
| 9 | 9 | - tilemap effects (scrolling, colscroll, linescroll); |
| 10 | 10 | (high score table?) |
| 11 | | - BMC logo isn't copied correctly after an attract loop, RAM not cleared on a reset either? |
| 12 | 11 | - BGM seems quite off, YM2413 core bug? |
| 13 | 12 | - I/Os; |
| 14 | 13 | - IRQ generation; |
| r21825 | r21826 | |
| 116 | 115 | virtual void video_start(); |
| 117 | 116 | UINT32 screen_update_popobear(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 118 | 117 | TIMER_DEVICE_CALLBACK_MEMBER(popobear_irq); |
| 119 | | void draw_layer(bitmap_ind16 &bitmap,const rectangle &cliprect, UINT8 layer_n); |
| 120 | 118 | void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); |
| 121 | 119 | |
| 122 | 120 | int m_gfx_index; |
| r21825 | r21826 | |
| 230 | 228 | } |
| 231 | 229 | |
| 232 | 230 | |
| 233 | | void popobear_state::draw_layer(bitmap_ind16 &bitmap,const rectangle &cliprect, UINT8 layer_n) |
| 234 | | { |
| 235 | | UINT16* vreg = (UINT16 *)m_vregs; |
| 236 | | const UINT8 vreg_base[] = { 0x10/2, 0x14/2 }; |
| 237 | | int xscroll,yscroll; |
| 238 | 231 | |
| 239 | | if(layer_n & 2) |
| 240 | | { |
| 241 | | xscroll = vreg[vreg_base[(layer_n & 1) ^ 1]+2/2] & 0x1ff; |
| 242 | | yscroll = vreg[vreg_base[(layer_n & 1) ^ 1]+0/2] & 0x1ff; |
| 243 | | } |
| 244 | | else |
| 245 | | { |
| 246 | | xscroll = 0; |
| 247 | | yscroll = 0; |
| 248 | | } |
| 249 | | popmessage("%04x %04x",vreg[vreg_base[0]+0/2],vreg[vreg_base[1]+0/2]); |
| 250 | 232 | |
| 251 | | |
| 252 | | m_bg_tilemap[layer_n]->set_scrolly(0, yscroll); |
| 253 | | m_bg_tilemap[layer_n]->set_scrollx(0, xscroll); |
| 254 | | |
| 255 | | |
| 256 | | |
| 257 | | m_bg_tilemap[layer_n]->draw(bitmap, cliprect, 0, 0); |
| 258 | | |
| 259 | | } |
| 260 | | |
| 261 | | |
| 262 | 233 | void popobear_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect) |
| 263 | 234 | { |
| 264 | 235 | // ERROR: This cast is NOT endian-safe without the use of BYTE/WORD/DWORD_XOR_* macros! |
| r21825 | r21826 | |
| 321 | 292 | bitmap.fill(0, cliprect); |
| 322 | 293 | |
| 323 | 294 | //popmessage("%04x",m_vregs[0/2]); |
| 295 | UINT16* vreg = m_vregs; |
| 324 | 296 | |
| 325 | | draw_layer(bitmap,cliprect,3); |
| 326 | | draw_layer(bitmap,cliprect,2); |
| 327 | | draw_layer(bitmap,cliprect,1); |
| 328 | | draw_layer(bitmap,cliprect,0); |
| 297 | popmessage("%04x %04x %04x %04x %04x %04x %04x - %04x - %04x %04x",vreg[0x00],vreg[0x01],vreg[0x02],vreg[0x03],vreg[0x04],vreg[0x05],vreg[0x06], vreg[0x0b],vreg[0x0e],vreg[0x0f]); |
| 298 | |
| 299 | |
| 300 | |
| 301 | // 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? |
| 303 | int enable0 = (m_vregs[0x0c] & 0xff00)>>8; |
| 304 | int enable1 = (m_vregs[0x0c] & 0x00ff)>>0; |
| 305 | int enable2 = (m_vregs[0x0d] & 0xff00)>>8; |
| 306 | int enable3 = (m_vregs[0x0d] & 0x00ff)>>0; |
| 307 | |
| 308 | if ((enable0 != 0x00) && (enable0 != 0x0d) && (enable0 != 0x1f)) printf("unknown enable0 value %02x\n", enable0); |
| 309 | if ((enable1 != 0x00) && (enable1 != 0x0d) && (enable1 != 0x1f)) printf("unknown enable1 value %02x\n", enable1); |
| 310 | if ((enable2 != 0x00) && (enable2 != 0x0d) && (enable2 != 0x1f)) printf("unknown enable2 value %02x\n", enable2); |
| 311 | if ((enable3 != 0x00) && (enable3 != 0x0d) && (enable3 != 0x1f)) printf("unknown enable3 value %02x\n", enable3); |
| 312 | |
| 313 | m_bg_tilemap[2]->set_scrollx(0, vreg[0x07]); |
| 314 | m_bg_tilemap[2]->set_scrolly(0, vreg[0x08]); |
| 315 | |
| 316 | m_bg_tilemap[3]->set_scrollx(0, vreg[0x09]); |
| 317 | m_bg_tilemap[3]->set_scrolly(0, vreg[0x0a]); |
| 318 | |
| 319 | |
| 320 | if (enable3) m_bg_tilemap[3]->draw(bitmap, cliprect, 0, 0); |
| 321 | 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); |
| 329 | 324 | draw_sprites(bitmap,cliprect); |
| 330 | 325 | |
| 331 | 326 | return 0; |