trunk/src/mess/video/gbamode0.c
r23152 | r23153 | |
1 | | /*************************************************************************** |
| 1 | /*************************************************************************** |
2 | 2 | |
3 | 3 | gbamode0.c |
4 | 4 | |
r23152 | r23153 | |
8 | 8 | |
9 | 9 | ***************************************************************************/ |
10 | 10 | |
11 | | static void draw_mode0_scanline(running_machine &machine, gba_state *state, int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp) |
| 11 | |
| 12 | void gba_state::draw_mode0(int submode, int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp) |
12 | 13 | { |
| 14 | switch (submode) |
| 15 | { |
| 16 | case 0: |
| 17 | draw_mode0_scanline(y, line0, line1, line2, line3, lineOBJ, lineOBJWin, lineMix, bpp); |
| 18 | break; |
| 19 | case 1: |
| 20 | draw_mode0_scanline_nowindow(y, line0, line1, line2, line3, lineOBJ, lineOBJWin, lineMix, bpp); |
| 21 | break; |
| 22 | case 2: |
| 23 | draw_mode0_scanline_all(y, line0, line1, line2, line3, lineOBJ, lineOBJWin, lineMix, bpp); |
| 24 | break; |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | void gba_state::draw_mode0_scanline(int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp) |
| 29 | { |
13 | 30 | int x = 0; |
14 | | UINT32 backdrop = ((UINT16*)state->m_gba_pram.target())[0] | 0x30000000; |
| 31 | UINT32 backdrop = ((UINT16*)m_gba_pram.target())[0] | 0x30000000; |
15 | 32 | |
16 | | draw_bg_scanline(state, line0, y, DISPCNT_BG0_EN, state->m_BG0CNT, state->m_BG0HOFS, state->m_BG0VOFS); |
17 | | draw_bg_scanline(state, line1, y, DISPCNT_BG1_EN, state->m_BG1CNT, state->m_BG1HOFS, state->m_BG1VOFS); |
18 | | draw_bg_scanline(state, line2, y, DISPCNT_BG2_EN, state->m_BG2CNT, state->m_BG2HOFS, state->m_BG2VOFS); |
19 | | draw_bg_scanline(state, line3, y, DISPCNT_BG3_EN, state->m_BG3CNT, state->m_BG3HOFS, state->m_BG3VOFS); |
20 | | draw_gba_oam(state, machine, lineOBJ, y); |
| 33 | draw_bg_scanline(line0, y, DISPCNT_BG0_EN, m_BG0CNT, m_BG0HOFS, m_BG0VOFS); |
| 34 | draw_bg_scanline(line1, y, DISPCNT_BG1_EN, m_BG1CNT, m_BG1HOFS, m_BG1VOFS); |
| 35 | draw_bg_scanline(line2, y, DISPCNT_BG2_EN, m_BG2CNT, m_BG2HOFS, m_BG2VOFS); |
| 36 | draw_bg_scanline(line3, y, DISPCNT_BG3_EN, m_BG3CNT, m_BG3HOFS, m_BG3VOFS); |
| 37 | draw_gba_oam(lineOBJ, y); |
21 | 38 | |
22 | 39 | for(x = 0; x < 240; x++) |
23 | 40 | { |
r23152 | r23153 | |
83 | 100 | top2 = 0x08; |
84 | 101 | } |
85 | 102 | |
86 | | if(top2 & (state->m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
| 103 | if(top2 & (m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
87 | 104 | { |
88 | | color = alpha_blend_pixel(color, back, coeff[state->m_BLDALPHA & 0x1f], coeff[(state->m_BLDALPHA >> 8) & 0x1f]); |
| 105 | color = alpha_blend_pixel(color, back, coeff[m_BLDALPHA & 0x1f], coeff[(m_BLDALPHA >> 8) & 0x1f]); |
89 | 106 | } |
90 | 107 | else |
91 | 108 | { |
92 | | switch(state->m_BLDCNT & BLDCNT_SFX) |
| 109 | switch(m_BLDCNT & BLDCNT_SFX) |
93 | 110 | { |
94 | 111 | case BLDCNT_SFX_LIGHTEN: |
95 | | if(top & state->m_BLDCNT) |
| 112 | if(top & m_BLDCNT) |
96 | 113 | { |
97 | | color = increase_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 114 | color = increase_brightness(color, coeff[m_BLDY & 0x1f]); |
98 | 115 | } |
99 | 116 | break; |
100 | 117 | case BLDCNT_SFX_DARKEN: |
101 | | if(top & state->m_BLDCNT) |
| 118 | if(top & m_BLDCNT) |
102 | 119 | { |
103 | | color = decrease_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 120 | color = decrease_brightness(color, coeff[m_BLDY & 0x1f]); |
104 | 121 | } |
105 | 122 | break; |
106 | 123 | } |
r23152 | r23153 | |
111 | 128 | } |
112 | 129 | } |
113 | 130 | |
114 | | static void draw_mode0_scanline_nowindow(running_machine &machine, gba_state *state, int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp) |
| 131 | void gba_state::draw_mode0_scanline_nowindow(int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp) |
115 | 132 | { |
116 | 133 | int x = 0; |
117 | | UINT32 backdrop = ((UINT16*)state->m_gba_pram.target())[0] | 0x30000000; |
118 | | int effect = state->m_BLDCNT & BLDCNT_SFX; |
| 134 | UINT32 backdrop = ((UINT16*)m_gba_pram.target())[0] | 0x30000000; |
| 135 | int effect = m_BLDCNT & BLDCNT_SFX; |
119 | 136 | |
120 | | draw_bg_scanline(state, line0, y, DISPCNT_BG0_EN, state->m_BG0CNT, state->m_BG0HOFS, state->m_BG0VOFS); |
121 | | draw_bg_scanline(state, line1, y, DISPCNT_BG1_EN, state->m_BG1CNT, state->m_BG1HOFS, state->m_BG1VOFS); |
122 | | draw_bg_scanline(state, line2, y, DISPCNT_BG2_EN, state->m_BG2CNT, state->m_BG2HOFS, state->m_BG2VOFS); |
123 | | draw_bg_scanline(state, line3, y, DISPCNT_BG3_EN, state->m_BG3CNT, state->m_BG3HOFS, state->m_BG3VOFS); |
124 | | draw_gba_oam(state, machine, lineOBJ, y); |
| 137 | draw_bg_scanline(line0, y, DISPCNT_BG0_EN, m_BG0CNT, m_BG0HOFS, m_BG0VOFS); |
| 138 | draw_bg_scanline(line1, y, DISPCNT_BG1_EN, m_BG1CNT, m_BG1HOFS, m_BG1VOFS); |
| 139 | draw_bg_scanline(line2, y, DISPCNT_BG2_EN, m_BG2CNT, m_BG2HOFS, m_BG2VOFS); |
| 140 | draw_bg_scanline(line3, y, DISPCNT_BG3_EN, m_BG3CNT, m_BG3HOFS, m_BG3VOFS); |
| 141 | draw_gba_oam(lineOBJ, y); |
125 | 142 | |
126 | 143 | for(x = 0; x < 240; x++) |
127 | 144 | { |
r23152 | r23153 | |
165 | 182 | case BLDCNT_SFX_NONE: |
166 | 183 | break; |
167 | 184 | case BLDCNT_SFX_ALPHA: |
168 | | if(state->m_BLDCNT & top) |
| 185 | if(m_BLDCNT & top) |
169 | 186 | { |
170 | 187 | UINT32 back = backdrop; |
171 | 188 | UINT8 top2 = 0x20; |
r23152 | r23153 | |
215 | 232 | } |
216 | 233 | } |
217 | 234 | |
218 | | if(top2 & (state->m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
| 235 | if(top2 & (m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
219 | 236 | { |
220 | | color = alpha_blend_pixel(color, back, coeff[state->m_BLDALPHA & 0x1f], coeff[(state->m_BLDALPHA >> 8) & 0x1f]); |
| 237 | color = alpha_blend_pixel(color, back, coeff[m_BLDALPHA & 0x1f], coeff[(m_BLDALPHA >> 8) & 0x1f]); |
221 | 238 | } |
222 | 239 | } |
223 | 240 | break; |
224 | 241 | case BLDCNT_SFX_LIGHTEN: |
225 | | if(top & state->m_BLDCNT) |
| 242 | if(top & m_BLDCNT) |
226 | 243 | { |
227 | | color = increase_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 244 | color = increase_brightness(color, coeff[m_BLDY & 0x1f]); |
228 | 245 | } |
229 | 246 | break; |
230 | 247 | case BLDCNT_SFX_DARKEN: |
231 | | if(top & state->m_BLDCNT) |
| 248 | if(top & m_BLDCNT) |
232 | 249 | { |
233 | | color = decrease_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 250 | color = decrease_brightness(color, coeff[m_BLDY & 0x1f]); |
234 | 251 | } |
235 | 252 | break; |
236 | 253 | } |
r23152 | r23153 | |
264 | 281 | top2 = 0x08; |
265 | 282 | } |
266 | 283 | |
267 | | if(top2 & (state->m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
| 284 | if(top2 & (m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
268 | 285 | { |
269 | | color = alpha_blend_pixel(color, back, coeff[state->m_BLDALPHA & 0x1f], coeff[(state->m_BLDALPHA >> 8) & 0x1f]); |
| 286 | color = alpha_blend_pixel(color, back, coeff[m_BLDALPHA & 0x1f], coeff[(m_BLDALPHA >> 8) & 0x1f]); |
270 | 287 | } |
271 | 288 | else |
272 | 289 | { |
273 | | switch(state->m_BLDCNT & BLDCNT_SFX) |
| 290 | switch(m_BLDCNT & BLDCNT_SFX) |
274 | 291 | { |
275 | 292 | case BLDCNT_SFX_LIGHTEN: |
276 | | if(top & state->m_BLDCNT) |
| 293 | if(top & m_BLDCNT) |
277 | 294 | { |
278 | | color = increase_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 295 | color = increase_brightness(color, coeff[m_BLDY & 0x1f]); |
279 | 296 | } |
280 | 297 | break; |
281 | 298 | case BLDCNT_SFX_DARKEN: |
282 | | if(top & state->m_BLDCNT) |
| 299 | if(top & m_BLDCNT) |
283 | 300 | { |
284 | | color = decrease_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 301 | color = decrease_brightness(color, coeff[m_BLDY & 0x1f]); |
285 | 302 | } |
286 | 303 | break; |
287 | 304 | } |
r23152 | r23153 | |
291 | 308 | } |
292 | 309 | } |
293 | 310 | |
294 | | static void draw_mode0_scanline_all(running_machine &machine, gba_state *state, int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp) |
| 311 | void gba_state::draw_mode0_scanline_all(int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp) |
295 | 312 | { |
296 | 313 | int x = 0; |
297 | | UINT32 backdrop = ((UINT16*)state->m_gba_pram.target())[0] | 0x30000000; |
| 314 | UINT32 backdrop = ((UINT16*)m_gba_pram.target())[0] | 0x30000000; |
298 | 315 | int inWindow0 = 0; |
299 | 316 | int inWindow1 = 0; |
300 | | UINT8 inWin0Mask = state->m_WININ & 0x00ff; |
301 | | UINT8 inWin1Mask = state->m_WININ >> 8; |
302 | | UINT8 outMask = state->m_WINOUT & 0x00ff; |
| 317 | UINT8 inWin0Mask = m_WININ & 0x00ff; |
| 318 | UINT8 inWin1Mask = m_WININ >> 8; |
| 319 | UINT8 outMask = m_WINOUT & 0x00ff; |
303 | 320 | |
304 | | if(state->m_DISPCNT & DISPCNT_WIN0_EN) |
| 321 | if(m_DISPCNT & DISPCNT_WIN0_EN) |
305 | 322 | { |
306 | | UINT8 v0 = state->m_WIN0V >> 8; |
307 | | UINT8 v1 = state->m_WIN0V & 0x00ff; |
| 323 | UINT8 v0 = m_WIN0V >> 8; |
| 324 | UINT8 v1 = m_WIN0V & 0x00ff; |
308 | 325 | inWindow0 = ((v0 == v1) && (v0 >= 0xe8)) ? 1 : 0; |
309 | 326 | if(v1 >= v0) |
310 | 327 | { |
r23152 | r23153 | |
316 | 333 | } |
317 | 334 | } |
318 | 335 | |
319 | | if(state->m_DISPCNT & DISPCNT_WIN1_EN) |
| 336 | if(m_DISPCNT & DISPCNT_WIN1_EN) |
320 | 337 | { |
321 | | UINT8 v0 = state->m_WIN1V >> 8; |
322 | | UINT8 v1 = state->m_WIN1V & 0x00ff; |
| 338 | UINT8 v0 = m_WIN1V >> 8; |
| 339 | UINT8 v1 = m_WIN1V & 0x00ff; |
323 | 340 | inWindow1 = ((v0 == v1) && (v0 >= 0xe8)) ? 1 : 0; |
324 | 341 | if(v1 >= v0) |
325 | 342 | { |
r23152 | r23153 | |
331 | 348 | } |
332 | 349 | } |
333 | 350 | |
334 | | draw_bg_scanline(state, line0, y, DISPCNT_BG0_EN, state->m_BG0CNT, state->m_BG0HOFS, state->m_BG0VOFS); |
335 | | draw_bg_scanline(state, line1, y, DISPCNT_BG1_EN, state->m_BG1CNT, state->m_BG1HOFS, state->m_BG1VOFS); |
336 | | draw_bg_scanline(state, line2, y, DISPCNT_BG2_EN, state->m_BG2CNT, state->m_BG2HOFS, state->m_BG2VOFS); |
337 | | draw_bg_scanline(state, line3, y, DISPCNT_BG3_EN, state->m_BG3CNT, state->m_BG3HOFS, state->m_BG3VOFS); |
338 | | draw_gba_oam(state, machine, lineOBJ, y); |
339 | | draw_gba_oam_window(state, machine, lineOBJWin, y); |
| 351 | draw_bg_scanline(line0, y, DISPCNT_BG0_EN, m_BG0CNT, m_BG0HOFS, m_BG0VOFS); |
| 352 | draw_bg_scanline(line1, y, DISPCNT_BG1_EN, m_BG1CNT, m_BG1HOFS, m_BG1VOFS); |
| 353 | draw_bg_scanline(line2, y, DISPCNT_BG2_EN, m_BG2CNT, m_BG2HOFS, m_BG2VOFS); |
| 354 | draw_bg_scanline(line3, y, DISPCNT_BG3_EN, m_BG3CNT, m_BG3HOFS, m_BG3VOFS); |
| 355 | draw_gba_oam(lineOBJ, y); |
| 356 | draw_gba_oam_window(lineOBJWin, y); |
340 | 357 | |
341 | 358 | for(x = 0; x < 240; x++) |
342 | 359 | { |
r23152 | r23153 | |
346 | 363 | |
347 | 364 | if((lineOBJWin[x] & 0x80000000) == 0) |
348 | 365 | { |
349 | | mask = state->m_WINOUT >> 8; |
| 366 | mask = m_WINOUT >> 8; |
350 | 367 | } |
351 | 368 | |
352 | 369 | if(inWindow1) |
353 | 370 | { |
354 | | if(is_in_window(state, x, 1)) |
| 371 | if(is_in_window(x, 1)) |
355 | 372 | { |
356 | 373 | mask = inWin1Mask; |
357 | 374 | } |
r23152 | r23153 | |
359 | 376 | |
360 | 377 | if(inWindow0) |
361 | 378 | { |
362 | | if(is_in_window(state, x, 0)) |
| 379 | if(is_in_window(x, 0)) |
363 | 380 | { |
364 | 381 | mask = inWin0Mask; |
365 | 382 | } |
r23152 | r23153 | |
399 | 416 | { |
400 | 417 | if((color & 0x00010000) == 0) |
401 | 418 | { |
402 | | switch(state->m_BLDCNT & BLDCNT_SFX) |
| 419 | switch(m_BLDCNT & BLDCNT_SFX) |
403 | 420 | { |
404 | 421 | case BLDCNT_SFX_NONE: |
405 | 422 | break; |
406 | 423 | case BLDCNT_SFX_ALPHA: |
407 | 424 | { |
408 | | if(top & state->m_BLDCNT) |
| 425 | if(top & m_BLDCNT) |
409 | 426 | { |
410 | 427 | UINT32 back = backdrop; |
411 | 428 | UINT8 top2 = 0x20; |
r23152 | r23153 | |
454 | 471 | } |
455 | 472 | } |
456 | 473 | |
457 | | if(top2 & (state->m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
| 474 | if(top2 & (m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
458 | 475 | { |
459 | | color = alpha_blend_pixel(color, back, coeff[state->m_BLDALPHA & 0x1f], coeff[(state->m_BLDALPHA >> 8) & 0x1f]); |
| 476 | color = alpha_blend_pixel(color, back, coeff[m_BLDALPHA & 0x1f], coeff[(m_BLDALPHA >> 8) & 0x1f]); |
460 | 477 | } |
461 | 478 | } |
462 | 479 | break; |
463 | 480 | } |
464 | 481 | case BLDCNT_SFX_LIGHTEN: |
465 | | if(top & state->m_BLDCNT) |
| 482 | if(top & m_BLDCNT) |
466 | 483 | { |
467 | | color = increase_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 484 | color = increase_brightness(color, coeff[m_BLDY & 0x1f]); |
468 | 485 | } |
469 | 486 | break; |
470 | 487 | case BLDCNT_SFX_DARKEN: |
471 | | if(top & state->m_BLDCNT) |
| 488 | if(top & m_BLDCNT) |
472 | 489 | { |
473 | | color = decrease_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 490 | color = decrease_brightness(color, coeff[m_BLDY & 0x1f]); |
474 | 491 | } |
475 | 492 | break; |
476 | 493 | } |
r23152 | r23153 | |
504 | 521 | top2 = 0x08; |
505 | 522 | } |
506 | 523 | |
507 | | if(top2 & (state->m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
| 524 | if(top2 & (m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
508 | 525 | { |
509 | | color = alpha_blend_pixel(color, back, coeff[state->m_BLDALPHA & 0x1f], coeff[(state->m_BLDALPHA >> 8) & 0x1f]); |
| 526 | color = alpha_blend_pixel(color, back, coeff[m_BLDALPHA & 0x1f], coeff[(m_BLDALPHA >> 8) & 0x1f]); |
510 | 527 | } |
511 | 528 | else |
512 | 529 | { |
513 | | switch(state->m_BLDCNT & BLDCNT_SFX) |
| 530 | switch(m_BLDCNT & BLDCNT_SFX) |
514 | 531 | { |
515 | 532 | case BLDCNT_SFX_LIGHTEN: |
516 | | if(top & state->m_BLDCNT) |
| 533 | if(top & m_BLDCNT) |
517 | 534 | { |
518 | | color = increase_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 535 | color = increase_brightness(color, coeff[m_BLDY & 0x1f]); |
519 | 536 | } |
520 | 537 | break; |
521 | 538 | case BLDCNT_SFX_DARKEN: |
522 | | if(top & state->m_BLDCNT) |
| 539 | if(top & m_BLDCNT) |
523 | 540 | { |
524 | | color = decrease_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 541 | color = decrease_brightness(color, coeff[m_BLDY & 0x1f]); |
525 | 542 | } |
526 | 543 | break; |
527 | 544 | } |
r23152 | r23153 | |
557 | 574 | top2 = 0x08; |
558 | 575 | } |
559 | 576 | |
560 | | if(top2 & (state->m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
| 577 | if(top2 & (m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
561 | 578 | { |
562 | | color = alpha_blend_pixel(color, back, coeff[state->m_BLDALPHA & 0x1f], coeff[(state->m_BLDALPHA >> 8) & 0x1f]); |
| 579 | color = alpha_blend_pixel(color, back, coeff[m_BLDALPHA & 0x1f], coeff[(m_BLDALPHA >> 8) & 0x1f]); |
563 | 580 | } |
564 | 581 | else |
565 | 582 | { |
566 | | switch(state->m_BLDCNT & BLDCNT_SFX) |
| 583 | switch(m_BLDCNT & BLDCNT_SFX) |
567 | 584 | { |
568 | 585 | case BLDCNT_SFX_LIGHTEN: |
569 | | if(top & state->m_BLDCNT) |
| 586 | if(top & m_BLDCNT) |
570 | 587 | { |
571 | | color = increase_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 588 | color = increase_brightness(color, coeff[m_BLDY & 0x1f]); |
572 | 589 | } |
573 | 590 | break; |
574 | 591 | case BLDCNT_SFX_DARKEN: |
575 | | if(top & state->m_BLDCNT) |
| 592 | if(top & m_BLDCNT) |
576 | 593 | { |
577 | | color = decrease_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 594 | color = decrease_brightness(color, coeff[m_BLDY & 0x1f]); |
578 | 595 | } |
579 | 596 | break; |
580 | 597 | } |
trunk/src/mess/video/gbam345.c
r23152 | r23153 | |
1 | | /*************************************************************************** |
| 1 | /*************************************************************************** |
2 | 2 | |
3 | 3 | gbam345.c |
4 | 4 | |
r23152 | r23153 | |
8 | 8 | |
9 | 9 | ***************************************************************************/ |
10 | 10 | |
11 | | static void draw_roz_bitmap_mode_scanline(running_machine &machine, gba_state *state, int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp) |
| 11 | |
| 12 | void gba_state::draw_mode345(int submode, int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp) |
12 | 13 | { |
| 14 | switch (submode) |
| 15 | { |
| 16 | case 0: |
| 17 | draw_roz_bitmap_mode_scanline(y, line0, line1, line2, line3, lineOBJ, lineOBJWin, lineMix, bpp); |
| 18 | break; |
| 19 | case 1: |
| 20 | draw_roz_bitmap_mode_scanline_nowindow(y, line0, line1, line2, line3, lineOBJ, lineOBJWin, lineMix, bpp); |
| 21 | break; |
| 22 | case 2: |
| 23 | draw_roz_bitmap_mode_scanline_all(y, line0, line1, line2, line3, lineOBJ, lineOBJWin, lineMix, bpp); |
| 24 | break; |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | void gba_state::draw_roz_bitmap_mode_scanline(int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp) |
| 29 | { |
13 | 30 | int x = 0; |
14 | | UINT32 backdrop = ((UINT16*)state->m_gba_pram.target())[0] | 0x30000000; |
| 31 | UINT32 backdrop = ((UINT16*)m_gba_pram.target())[0] | 0x30000000; |
15 | 32 | |
16 | | draw_roz_bitmap_scanline(state, line2, y, DISPCNT_BG2_EN, state->m_BG2CNT, state->m_BG2X, state->m_BG2Y, state->m_BG2PA, state->m_BG2PB, state->m_BG2PC, state->m_BG2PD, &state->m_gfxBG2X, &state->m_gfxBG2Y, state->m_gfxBG2Changed, bpp); |
17 | | draw_gba_oam(state, machine, lineOBJ, y); |
| 33 | draw_roz_bitmap_scanline(line2, y, DISPCNT_BG2_EN, m_BG2CNT, m_BG2X, m_BG2Y, m_BG2PA, m_BG2PB, m_BG2PC, m_BG2PD, &m_gfxBG2X, &m_gfxBG2Y, m_gfxBG2Changed, bpp); |
| 34 | draw_gba_oam(lineOBJ, y); |
18 | 35 | |
19 | 36 | for(x = 0; x < 240; x++) |
20 | 37 | { |
r23152 | r23153 | |
44 | 61 | top2 = 0x04; |
45 | 62 | } |
46 | 63 | |
47 | | if(top2 & (state->m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
| 64 | if(top2 & (m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
48 | 65 | { |
49 | | color = alpha_blend_pixel(color, back, coeff[state->m_BLDALPHA & 0x1f], coeff[(state->m_BLDALPHA >> 8) & 0x1f]); |
| 66 | color = alpha_blend_pixel(color, back, coeff[m_BLDALPHA & 0x1f], coeff[(m_BLDALPHA >> 8) & 0x1f]); |
50 | 67 | } |
51 | 68 | else |
52 | 69 | { |
53 | | switch(state->m_BLDCNT & BLDCNT_SFX) |
| 70 | switch(m_BLDCNT & BLDCNT_SFX) |
54 | 71 | { |
55 | 72 | case BLDCNT_SFX_LIGHTEN: |
56 | | if(top & state->m_BLDCNT) |
| 73 | if(top & m_BLDCNT) |
57 | 74 | { |
58 | | color = increase_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 75 | color = increase_brightness(color, coeff[m_BLDY & 0x1f]); |
59 | 76 | } |
60 | 77 | break; |
61 | 78 | case BLDCNT_SFX_DARKEN: |
62 | | if(top & state->m_BLDCNT) |
| 79 | if(top & m_BLDCNT) |
63 | 80 | { |
64 | | color = decrease_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 81 | color = decrease_brightness(color, coeff[m_BLDY & 0x1f]); |
65 | 82 | } |
66 | 83 | break; |
67 | 84 | } |
r23152 | r23153 | |
70 | 87 | |
71 | 88 | lineMix[x] = color; |
72 | 89 | } |
73 | | state->m_gfxBG2Changed = 0; |
| 90 | m_gfxBG2Changed = 0; |
74 | 91 | } |
75 | 92 | |
76 | | static void draw_roz_bitmap_mode_scanline_nowindow(running_machine &machine, gba_state *state, int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp) |
| 93 | void gba_state::draw_roz_bitmap_mode_scanline_nowindow(int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp) |
77 | 94 | { |
78 | 95 | int x = 0; |
79 | | UINT32 backdrop = ((UINT16*)state->m_gba_pram.target())[0] | 0x30000000; |
80 | | int effect = state->m_BLDCNT & BLDCNT_SFX; |
| 96 | UINT32 backdrop = ((UINT16*)m_gba_pram.target())[0] | 0x30000000; |
| 97 | int effect = m_BLDCNT & BLDCNT_SFX; |
81 | 98 | |
82 | | draw_roz_bitmap_scanline(state, line2, y, DISPCNT_BG2_EN, state->m_BG2CNT, state->m_BG2X, state->m_BG2Y, state->m_BG2PA, state->m_BG2PB, state->m_BG2PC, state->m_BG2PD, &state->m_gfxBG2X, &state->m_gfxBG2Y, state->m_gfxBG2Changed, bpp); |
83 | | draw_gba_oam(state, machine, lineOBJ, y); |
| 99 | draw_roz_bitmap_scanline(line2, y, DISPCNT_BG2_EN, m_BG2CNT, m_BG2X, m_BG2Y, m_BG2PA, m_BG2PB, m_BG2PC, m_BG2PD, &m_gfxBG2X, &m_gfxBG2Y, m_gfxBG2Changed, bpp); |
| 100 | draw_gba_oam(lineOBJ, y); |
84 | 101 | |
85 | 102 | for(x = 0; x < 240; x++) |
86 | 103 | { |
r23152 | r23153 | |
106 | 123 | case BLDCNT_SFX_NONE: |
107 | 124 | break; |
108 | 125 | case BLDCNT_SFX_ALPHA: |
109 | | if(state->m_BLDCNT & top) |
| 126 | if(m_BLDCNT & top) |
110 | 127 | { |
111 | 128 | UINT32 back = backdrop; |
112 | 129 | UINT8 top2 = 0x20; |
r23152 | r23153 | |
129 | 146 | } |
130 | 147 | } |
131 | 148 | |
132 | | if(top2 & (state->m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
| 149 | if(top2 & (m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
133 | 150 | { |
134 | | color = alpha_blend_pixel(color, back, coeff[state->m_BLDALPHA & 0x1f], coeff[(state->m_BLDALPHA >> 8) & 0x1f]); |
| 151 | color = alpha_blend_pixel(color, back, coeff[m_BLDALPHA & 0x1f], coeff[(m_BLDALPHA >> 8) & 0x1f]); |
135 | 152 | } |
136 | 153 | } |
137 | 154 | break; |
138 | 155 | case BLDCNT_SFX_LIGHTEN: |
139 | | if(top & state->m_BLDCNT) |
| 156 | if(top & m_BLDCNT) |
140 | 157 | { |
141 | | color = increase_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 158 | color = increase_brightness(color, coeff[m_BLDY & 0x1f]); |
142 | 159 | } |
143 | 160 | break; |
144 | 161 | case BLDCNT_SFX_DARKEN: |
145 | | if(top & state->m_BLDCNT) |
| 162 | if(top & m_BLDCNT) |
146 | 163 | { |
147 | | color = decrease_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 164 | color = decrease_brightness(color, coeff[m_BLDY & 0x1f]); |
148 | 165 | } |
149 | 166 | break; |
150 | 167 | } |
r23152 | r23153 | |
160 | 177 | top2 = 0x04; |
161 | 178 | } |
162 | 179 | |
163 | | if(top2 & (state->m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
| 180 | if(top2 & (m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
164 | 181 | { |
165 | | color = alpha_blend_pixel(color, back, coeff[state->m_BLDALPHA & 0x1f], coeff[(state->m_BLDALPHA >> 8) & 0x1f]); |
| 182 | color = alpha_blend_pixel(color, back, coeff[m_BLDALPHA & 0x1f], coeff[(m_BLDALPHA >> 8) & 0x1f]); |
166 | 183 | } |
167 | 184 | else |
168 | 185 | { |
169 | | switch(state->m_BLDCNT & BLDCNT_SFX) |
| 186 | switch(m_BLDCNT & BLDCNT_SFX) |
170 | 187 | { |
171 | 188 | case BLDCNT_SFX_LIGHTEN: |
172 | | if(top & state->m_BLDCNT) |
| 189 | if(top & m_BLDCNT) |
173 | 190 | { |
174 | | color = increase_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 191 | color = increase_brightness(color, coeff[m_BLDY & 0x1f]); |
175 | 192 | } |
176 | 193 | break; |
177 | 194 | case BLDCNT_SFX_DARKEN: |
178 | | if(top & state->m_BLDCNT) |
| 195 | if(top & m_BLDCNT) |
179 | 196 | { |
180 | | color = decrease_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 197 | color = decrease_brightness(color, coeff[m_BLDY & 0x1f]); |
181 | 198 | } |
182 | 199 | break; |
183 | 200 | } |
r23152 | r23153 | |
185 | 202 | } |
186 | 203 | lineMix[x] = color; |
187 | 204 | } |
188 | | state->m_gfxBG2Changed = 0; |
| 205 | m_gfxBG2Changed = 0; |
189 | 206 | } |
190 | 207 | |
191 | | static void draw_roz_bitmap_mode_scanline_all(running_machine &machine, gba_state *state, int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp) |
| 208 | void gba_state::draw_roz_bitmap_mode_scanline_all(int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp) |
192 | 209 | { |
193 | 210 | int x = 0; |
194 | | UINT32 backdrop = ((UINT16*)state->m_gba_pram.target())[0] | 0x30000000; |
| 211 | UINT32 backdrop = ((UINT16*)m_gba_pram.target())[0] | 0x30000000; |
195 | 212 | int inWindow0 = 0; |
196 | 213 | int inWindow1 = 0; |
197 | | UINT8 inWin0Mask = state->m_WININ & 0x00ff; |
198 | | UINT8 inWin1Mask = state->m_WININ >> 8; |
199 | | UINT8 outMask = state->m_WINOUT & 0x00ff; |
| 214 | UINT8 inWin0Mask = m_WININ & 0x00ff; |
| 215 | UINT8 inWin1Mask = m_WININ >> 8; |
| 216 | UINT8 outMask = m_WINOUT & 0x00ff; |
200 | 217 | |
201 | | if(state->m_DISPCNT & DISPCNT_WIN0_EN) |
| 218 | if(m_DISPCNT & DISPCNT_WIN0_EN) |
202 | 219 | { |
203 | | UINT8 v0 = state->m_WIN0V >> 8; |
204 | | UINT8 v1 = state->m_WIN0V & 0x00ff; |
| 220 | UINT8 v0 = m_WIN0V >> 8; |
| 221 | UINT8 v1 = m_WIN0V & 0x00ff; |
205 | 222 | inWindow0 = ((v0 == v1) && (v0 >= 0xe8)) ? 1 : 0; |
206 | 223 | if(v1 >= v0) |
207 | 224 | { |
r23152 | r23153 | |
213 | 230 | } |
214 | 231 | } |
215 | 232 | |
216 | | if(state->m_DISPCNT & DISPCNT_WIN1_EN) |
| 233 | if(m_DISPCNT & DISPCNT_WIN1_EN) |
217 | 234 | { |
218 | | UINT8 v0 = state->m_WIN1V >> 8; |
219 | | UINT8 v1 = state->m_WIN1V & 0x00ff; |
| 235 | UINT8 v0 = m_WIN1V >> 8; |
| 236 | UINT8 v1 = m_WIN1V & 0x00ff; |
220 | 237 | inWindow1 = ((v0 == v1) && (v0 >= 0xe8)) ? 1 : 0; |
221 | 238 | if(v1 >= v0) |
222 | 239 | { |
r23152 | r23153 | |
228 | 245 | } |
229 | 246 | } |
230 | 247 | |
231 | | draw_roz_bitmap_scanline(state, line2, y, DISPCNT_BG2_EN, state->m_BG2CNT, state->m_BG2X, state->m_BG2Y, state->m_BG2PA, state->m_BG2PB, state->m_BG2PC, state->m_BG2PD, &state->m_gfxBG2X, &state->m_gfxBG2Y, state->m_gfxBG2Changed, bpp); |
232 | | draw_gba_oam(state, machine, lineOBJ, y); |
233 | | draw_gba_oam_window(state, machine, lineOBJWin, y); |
| 248 | draw_roz_bitmap_scanline(line2, y, DISPCNT_BG2_EN, m_BG2CNT, m_BG2X, m_BG2Y, m_BG2PA, m_BG2PB, m_BG2PC, m_BG2PD, &m_gfxBG2X, &m_gfxBG2Y, m_gfxBG2Changed, bpp); |
| 249 | draw_gba_oam(lineOBJ, y); |
| 250 | draw_gba_oam_window(lineOBJWin, y); |
234 | 251 | |
235 | 252 | for(x = 0; x < 240; x++) |
236 | 253 | { |
r23152 | r23153 | |
240 | 257 | |
241 | 258 | if((lineOBJWin[x] & 0x80000000) == 0) |
242 | 259 | { |
243 | | mask = state->m_WINOUT >> 8; |
| 260 | mask = m_WINOUT >> 8; |
244 | 261 | } |
245 | 262 | |
246 | 263 | if(inWindow1) |
247 | 264 | { |
248 | | if(is_in_window(state, x, 1)) |
| 265 | if(is_in_window(x, 1)) |
249 | 266 | { |
250 | 267 | mask = inWin1Mask; |
251 | 268 | } |
r23152 | r23153 | |
253 | 270 | |
254 | 271 | if(inWindow0) |
255 | 272 | { |
256 | | if(is_in_window(state, x, 0)) |
| 273 | if(is_in_window(x, 0)) |
257 | 274 | { |
258 | 275 | mask = inWin0Mask; |
259 | 276 | } |
r23152 | r23153 | |
275 | 292 | { |
276 | 293 | if((color & 0x00010000) == 0) |
277 | 294 | { |
278 | | switch(state->m_BLDCNT & BLDCNT_SFX) |
| 295 | switch(m_BLDCNT & BLDCNT_SFX) |
279 | 296 | { |
280 | 297 | case BLDCNT_SFX_NONE: |
281 | 298 | break; |
282 | 299 | case BLDCNT_SFX_ALPHA: |
283 | 300 | { |
284 | | if(top & state->m_BLDCNT) |
| 301 | if(top & m_BLDCNT) |
285 | 302 | { |
286 | 303 | UINT32 back = backdrop; |
287 | 304 | UINT8 top2 = 0x20; |
r23152 | r23153 | |
303 | 320 | } |
304 | 321 | } |
305 | 322 | |
306 | | if(top2 & (state->m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
| 323 | if(top2 & (m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
307 | 324 | { |
308 | | color = alpha_blend_pixel(color, back, coeff[state->m_BLDALPHA & 0x1f], coeff[(state->m_BLDALPHA >> 8) & 0x1f]); |
| 325 | color = alpha_blend_pixel(color, back, coeff[m_BLDALPHA & 0x1f], coeff[(m_BLDALPHA >> 8) & 0x1f]); |
309 | 326 | } |
310 | 327 | } |
311 | 328 | break; |
312 | 329 | } |
313 | 330 | case BLDCNT_SFX_LIGHTEN: |
314 | | if(top & state->m_BLDCNT) |
| 331 | if(top & m_BLDCNT) |
315 | 332 | { |
316 | | color = increase_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 333 | color = increase_brightness(color, coeff[m_BLDY & 0x1f]); |
317 | 334 | } |
318 | 335 | break; |
319 | 336 | case BLDCNT_SFX_DARKEN: |
320 | | if(top & state->m_BLDCNT) |
| 337 | if(top & m_BLDCNT) |
321 | 338 | { |
322 | | color = decrease_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 339 | color = decrease_brightness(color, coeff[m_BLDY & 0x1f]); |
323 | 340 | } |
324 | 341 | break; |
325 | 342 | } |
r23152 | r23153 | |
335 | 352 | top2 = 0x04; |
336 | 353 | } |
337 | 354 | |
338 | | if(top2 & (state->m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
| 355 | if(top2 & (m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
339 | 356 | { |
340 | | color = alpha_blend_pixel(color, back, coeff[state->m_BLDALPHA & 0x1f], coeff[(state->m_BLDALPHA >> 8) & 0x1f]); |
| 357 | color = alpha_blend_pixel(color, back, coeff[m_BLDALPHA & 0x1f], coeff[(m_BLDALPHA >> 8) & 0x1f]); |
341 | 358 | } |
342 | 359 | else |
343 | 360 | { |
344 | | switch(state->m_BLDCNT & BLDCNT_SFX) |
| 361 | switch(m_BLDCNT & BLDCNT_SFX) |
345 | 362 | { |
346 | 363 | case BLDCNT_SFX_LIGHTEN: |
347 | | if(top & state->m_BLDCNT) |
| 364 | if(top & m_BLDCNT) |
348 | 365 | { |
349 | | color = increase_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 366 | color = increase_brightness(color, coeff[m_BLDY & 0x1f]); |
350 | 367 | } |
351 | 368 | break; |
352 | 369 | case BLDCNT_SFX_DARKEN: |
353 | | if(top & state->m_BLDCNT) |
| 370 | if(top & m_BLDCNT) |
354 | 371 | { |
355 | | color = decrease_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 372 | color = decrease_brightness(color, coeff[m_BLDY & 0x1f]); |
356 | 373 | } |
357 | 374 | break; |
358 | 375 | } |
r23152 | r23153 | |
370 | 387 | top2 = 0x04; |
371 | 388 | } |
372 | 389 | |
373 | | if(top2 & (state->m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
| 390 | if(top2 & (m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
374 | 391 | { |
375 | | color = alpha_blend_pixel(color, back, coeff[state->m_BLDALPHA & 0x1f], coeff[(state->m_BLDALPHA >> 8) & 0x1f]); |
| 392 | color = alpha_blend_pixel(color, back, coeff[m_BLDALPHA & 0x1f], coeff[(m_BLDALPHA >> 8) & 0x1f]); |
376 | 393 | } |
377 | 394 | else |
378 | 395 | { |
379 | | switch(state->m_BLDCNT & BLDCNT_SFX) |
| 396 | switch(m_BLDCNT & BLDCNT_SFX) |
380 | 397 | { |
381 | 398 | case BLDCNT_SFX_LIGHTEN: |
382 | | if(top & state->m_BLDCNT) |
| 399 | if(top & m_BLDCNT) |
383 | 400 | { |
384 | | color = increase_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 401 | color = increase_brightness(color, coeff[m_BLDY & 0x1f]); |
385 | 402 | } |
386 | 403 | break; |
387 | 404 | case BLDCNT_SFX_DARKEN: |
388 | | if(top & state->m_BLDCNT) |
| 405 | if(top & m_BLDCNT) |
389 | 406 | { |
390 | | color = decrease_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 407 | color = decrease_brightness(color, coeff[m_BLDY & 0x1f]); |
391 | 408 | } |
392 | 409 | break; |
393 | 410 | } |
r23152 | r23153 | |
395 | 412 | } |
396 | 413 | lineMix[x] = color; |
397 | 414 | } |
398 | | state->m_gfxBG2Changed = 0; |
| 415 | m_gfxBG2Changed = 0; |
399 | 416 | } |
trunk/src/mess/video/gbamode1.c
r23152 | r23153 | |
1 | | /*************************************************************************** |
| 1 | /*************************************************************************** |
2 | 2 | |
3 | 3 | gbamode1.c |
4 | 4 | |
r23152 | r23153 | |
8 | 8 | |
9 | 9 | ***************************************************************************/ |
10 | 10 | |
11 | | static void draw_mode1_scanline(running_machine &machine, gba_state *state, int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp) |
| 11 | |
| 12 | void gba_state::draw_mode1(int submode, int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp) |
12 | 13 | { |
| 14 | switch (submode) |
| 15 | { |
| 16 | case 0: |
| 17 | draw_mode1_scanline(y, line0, line1, line2, line3, lineOBJ, lineOBJWin, lineMix, bpp); |
| 18 | break; |
| 19 | case 1: |
| 20 | draw_mode1_scanline_nowindow(y, line0, line1, line2, line3, lineOBJ, lineOBJWin, lineMix, bpp); |
| 21 | break; |
| 22 | case 2: |
| 23 | draw_mode1_scanline_all(y, line0, line1, line2, line3, lineOBJ, lineOBJWin, lineMix, bpp); |
| 24 | break; |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | void gba_state::draw_mode1_scanline(int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp) |
| 29 | { |
13 | 30 | int x = 0; |
14 | | UINT32 backdrop = ((UINT16*)state->m_gba_pram.target())[0] | 0x30000000; |
| 31 | UINT32 backdrop = ((UINT16*)m_gba_pram.target())[0] | 0x30000000; |
15 | 32 | |
16 | | draw_bg_scanline(state, line0, y, DISPCNT_BG0_EN, state->m_BG0CNT, state->m_BG0HOFS, state->m_BG0VOFS); |
17 | | draw_bg_scanline(state, line1, y, DISPCNT_BG1_EN, state->m_BG1CNT, state->m_BG1HOFS, state->m_BG1VOFS); |
18 | | draw_roz_scanline(state, line2, y, DISPCNT_BG2_EN, state->m_BG2CNT, state->m_BG2X, state->m_BG2Y, state->m_BG2PA, state->m_BG2PB, state->m_BG2PC, state->m_BG2PD, &state->m_gfxBG2X, &state->m_gfxBG2Y, state->m_gfxBG2Changed); |
19 | | draw_gba_oam(state, machine, lineOBJ, y); |
| 33 | draw_bg_scanline(line0, y, DISPCNT_BG0_EN, m_BG0CNT, m_BG0HOFS, m_BG0VOFS); |
| 34 | draw_bg_scanline(line1, y, DISPCNT_BG1_EN, m_BG1CNT, m_BG1HOFS, m_BG1VOFS); |
| 35 | draw_roz_scanline(line2, y, DISPCNT_BG2_EN, m_BG2CNT, m_BG2X, m_BG2Y, m_BG2PA, m_BG2PB, m_BG2PC, m_BG2PD, &m_gfxBG2X, &m_gfxBG2Y, m_gfxBG2Changed); |
| 36 | draw_gba_oam(lineOBJ, y); |
20 | 37 | |
21 | 38 | for(x = 0; x < 240; x++) |
22 | 39 | { |
r23152 | r23153 | |
70 | 87 | top2 = 0x04; |
71 | 88 | } |
72 | 89 | |
73 | | if(top2 & (state->m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
| 90 | if(top2 & (m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
74 | 91 | { |
75 | | color = alpha_blend_pixel(color, back, coeff[state->m_BLDALPHA & 0x1f], coeff[(state->m_BLDALPHA >> 8) & 0x1f]); |
| 92 | color = alpha_blend_pixel(color, back, coeff[m_BLDALPHA & 0x1f], coeff[(m_BLDALPHA >> 8) & 0x1f]); |
76 | 93 | } |
77 | 94 | else |
78 | 95 | { |
79 | | switch(state->m_BLDCNT & BLDCNT_SFX) |
| 96 | switch(m_BLDCNT & BLDCNT_SFX) |
80 | 97 | { |
81 | 98 | case BLDCNT_SFX_LIGHTEN: |
82 | | if(top & state->m_BLDCNT) |
| 99 | if(top & m_BLDCNT) |
83 | 100 | { |
84 | | color = increase_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 101 | color = increase_brightness(color, coeff[m_BLDY & 0x1f]); |
85 | 102 | } |
86 | 103 | break; |
87 | 104 | case BLDCNT_SFX_DARKEN: |
88 | | if(top & state->m_BLDCNT) |
| 105 | if(top & m_BLDCNT) |
89 | 106 | { |
90 | | color = decrease_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 107 | color = decrease_brightness(color, coeff[m_BLDY & 0x1f]); |
91 | 108 | } |
92 | 109 | break; |
93 | 110 | } |
r23152 | r23153 | |
96 | 113 | |
97 | 114 | lineMix[x] = color; |
98 | 115 | } |
99 | | state->m_gfxBG2Changed = 0; |
| 116 | m_gfxBG2Changed = 0; |
100 | 117 | } |
101 | 118 | |
102 | | static void draw_mode1_scanline_nowindow(running_machine &machine, gba_state *state, int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp) |
| 119 | void gba_state::draw_mode1_scanline_nowindow(int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp) |
103 | 120 | { |
104 | 121 | int x = 0; |
105 | | UINT32 backdrop = ((UINT16*)state->m_gba_pram.target())[0] | 0x30000000; |
106 | | int effect = state->m_BLDCNT & BLDCNT_SFX; |
| 122 | UINT32 backdrop = ((UINT16*)m_gba_pram.target())[0] | 0x30000000; |
| 123 | int effect = m_BLDCNT & BLDCNT_SFX; |
107 | 124 | |
108 | | draw_bg_scanline(state, line0, y, DISPCNT_BG0_EN, state->m_BG0CNT, state->m_BG0HOFS, state->m_BG0VOFS); |
109 | | draw_bg_scanline(state, line1, y, DISPCNT_BG1_EN, state->m_BG1CNT, state->m_BG1HOFS, state->m_BG1VOFS); |
110 | | draw_roz_scanline(state, line2, y, DISPCNT_BG2_EN, state->m_BG2CNT, state->m_BG2X, state->m_BG2Y, state->m_BG2PA, state->m_BG2PB, state->m_BG2PC, state->m_BG2PD, &state->m_gfxBG2X, &state->m_gfxBG2Y, state->m_gfxBG2Changed); |
111 | | draw_gba_oam(state, machine, lineOBJ, y); |
| 125 | draw_bg_scanline(line0, y, DISPCNT_BG0_EN, m_BG0CNT, m_BG0HOFS, m_BG0VOFS); |
| 126 | draw_bg_scanline(line1, y, DISPCNT_BG1_EN, m_BG1CNT, m_BG1HOFS, m_BG1VOFS); |
| 127 | draw_roz_scanline(line2, y, DISPCNT_BG2_EN, m_BG2CNT, m_BG2X, m_BG2Y, m_BG2PA, m_BG2PB, m_BG2PC, m_BG2PD, &m_gfxBG2X, &m_gfxBG2Y, m_gfxBG2Changed); |
| 128 | draw_gba_oam(lineOBJ, y); |
112 | 129 | |
113 | 130 | for(x = 0; x < 240; x++) |
114 | 131 | { |
r23152 | r23153 | |
146 | 163 | case BLDCNT_SFX_NONE: |
147 | 164 | break; |
148 | 165 | case BLDCNT_SFX_ALPHA: |
149 | | if(state->m_BLDCNT & top) |
| 166 | if(m_BLDCNT & top) |
150 | 167 | { |
151 | 168 | UINT32 back = backdrop; |
152 | 169 | UINT8 top2 = 0x20; |
r23152 | r23153 | |
187 | 204 | } |
188 | 205 | } |
189 | 206 | |
190 | | if(top2 & (state->m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
| 207 | if(top2 & (m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
191 | 208 | { |
192 | | color = alpha_blend_pixel(color, back, coeff[state->m_BLDALPHA & 0x1f], coeff[(state->m_BLDALPHA >> 8) & 0x1f]); |
| 209 | color = alpha_blend_pixel(color, back, coeff[m_BLDALPHA & 0x1f], coeff[(m_BLDALPHA >> 8) & 0x1f]); |
193 | 210 | } |
194 | 211 | } |
195 | 212 | break; |
196 | 213 | case BLDCNT_SFX_LIGHTEN: |
197 | | if(top & state->m_BLDCNT) |
| 214 | if(top & m_BLDCNT) |
198 | 215 | { |
199 | | color = increase_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 216 | color = increase_brightness(color, coeff[m_BLDY & 0x1f]); |
200 | 217 | } |
201 | 218 | break; |
202 | 219 | case BLDCNT_SFX_DARKEN: |
203 | | if(top & state->m_BLDCNT) |
| 220 | if(top & m_BLDCNT) |
204 | 221 | { |
205 | | color = decrease_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 222 | color = decrease_brightness(color, coeff[m_BLDY & 0x1f]); |
206 | 223 | } |
207 | 224 | break; |
208 | 225 | } |
r23152 | r23153 | |
230 | 247 | top2 = 0x04; |
231 | 248 | } |
232 | 249 | |
233 | | if(top2 & (state->m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
| 250 | if(top2 & (m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
234 | 251 | { |
235 | | color = alpha_blend_pixel(color, back, coeff[state->m_BLDALPHA & 0x1f], coeff[(state->m_BLDALPHA >> 8) & 0x1f]); |
| 252 | color = alpha_blend_pixel(color, back, coeff[m_BLDALPHA & 0x1f], coeff[(m_BLDALPHA >> 8) & 0x1f]); |
236 | 253 | } |
237 | 254 | else |
238 | 255 | { |
239 | | switch(state->m_BLDCNT & BLDCNT_SFX) |
| 256 | switch(m_BLDCNT & BLDCNT_SFX) |
240 | 257 | { |
241 | 258 | case BLDCNT_SFX_LIGHTEN: |
242 | | if(top & state->m_BLDCNT) |
| 259 | if(top & m_BLDCNT) |
243 | 260 | { |
244 | | color = increase_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 261 | color = increase_brightness(color, coeff[m_BLDY & 0x1f]); |
245 | 262 | } |
246 | 263 | break; |
247 | 264 | case BLDCNT_SFX_DARKEN: |
248 | | if(top & state->m_BLDCNT) |
| 265 | if(top & m_BLDCNT) |
249 | 266 | { |
250 | | color = decrease_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 267 | color = decrease_brightness(color, coeff[m_BLDY & 0x1f]); |
251 | 268 | } |
252 | 269 | break; |
253 | 270 | } |
r23152 | r23153 | |
255 | 272 | } |
256 | 273 | lineMix[x] = color; |
257 | 274 | } |
258 | | state->m_gfxBG2Changed = 0; |
| 275 | m_gfxBG2Changed = 0; |
259 | 276 | } |
260 | 277 | |
261 | | static void draw_mode1_scanline_all(running_machine &machine, gba_state *state, int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp) |
| 278 | void gba_state::draw_mode1_scanline_all(int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp) |
262 | 279 | { |
263 | 280 | int x = 0; |
264 | | UINT32 backdrop = ((UINT16*)state->m_gba_pram.target())[0] | 0x30000000; |
| 281 | UINT32 backdrop = ((UINT16*)m_gba_pram.target())[0] | 0x30000000; |
265 | 282 | int inWindow0 = 0; |
266 | 283 | int inWindow1 = 0; |
267 | | UINT8 inWin0Mask = state->m_WININ & 0x00ff; |
268 | | UINT8 inWin1Mask = state->m_WININ >> 8; |
269 | | UINT8 outMask = state->m_WINOUT & 0x00ff; |
| 284 | UINT8 inWin0Mask = m_WININ & 0x00ff; |
| 285 | UINT8 inWin1Mask = m_WININ >> 8; |
| 286 | UINT8 outMask = m_WINOUT & 0x00ff; |
270 | 287 | |
271 | | if(state->m_DISPCNT & DISPCNT_WIN0_EN) |
| 288 | if(m_DISPCNT & DISPCNT_WIN0_EN) |
272 | 289 | { |
273 | | UINT8 v0 = state->m_WIN0V >> 8; |
274 | | UINT8 v1 = state->m_WIN0V & 0x00ff; |
| 290 | UINT8 v0 = m_WIN0V >> 8; |
| 291 | UINT8 v1 = m_WIN0V & 0x00ff; |
275 | 292 | inWindow0 = ((v0 == v1) && (v0 >= 0xe8)) ? 1 : 0; |
276 | 293 | if(v1 >= v0) |
277 | 294 | { |
r23152 | r23153 | |
283 | 300 | } |
284 | 301 | } |
285 | 302 | |
286 | | if(state->m_DISPCNT & DISPCNT_WIN1_EN) |
| 303 | if(m_DISPCNT & DISPCNT_WIN1_EN) |
287 | 304 | { |
288 | | UINT8 v0 = state->m_WIN1V >> 8; |
289 | | UINT8 v1 = state->m_WIN1V & 0x00ff; |
| 305 | UINT8 v0 = m_WIN1V >> 8; |
| 306 | UINT8 v1 = m_WIN1V & 0x00ff; |
290 | 307 | inWindow1 = ((v0 == v1) && (v0 >= 0xe8)) ? 1 : 0; |
291 | 308 | if(v1 >= v0) |
292 | 309 | { |
r23152 | r23153 | |
298 | 315 | } |
299 | 316 | } |
300 | 317 | |
301 | | draw_bg_scanline(state, line0, y, DISPCNT_BG0_EN, state->m_BG0CNT, state->m_BG0HOFS, state->m_BG0VOFS); |
302 | | draw_bg_scanline(state, line1, y, DISPCNT_BG1_EN, state->m_BG1CNT, state->m_BG1HOFS, state->m_BG1VOFS); |
303 | | draw_roz_scanline(state, line2, y, DISPCNT_BG2_EN, state->m_BG2CNT, state->m_BG2X, state->m_BG2Y, state->m_BG2PA, state->m_BG2PB, state->m_BG2PC, state->m_BG2PD, &state->m_gfxBG2X, &state->m_gfxBG2Y, state->m_gfxBG2Changed); |
304 | | draw_gba_oam(state, machine, lineOBJ, y); |
305 | | draw_gba_oam_window(state, machine, lineOBJWin, y); |
| 318 | draw_bg_scanline(line0, y, DISPCNT_BG0_EN, m_BG0CNT, m_BG0HOFS, m_BG0VOFS); |
| 319 | draw_bg_scanline(line1, y, DISPCNT_BG1_EN, m_BG1CNT, m_BG1HOFS, m_BG1VOFS); |
| 320 | draw_roz_scanline(line2, y, DISPCNT_BG2_EN, m_BG2CNT, m_BG2X, m_BG2Y, m_BG2PA, m_BG2PB, m_BG2PC, m_BG2PD, &m_gfxBG2X, &m_gfxBG2Y, m_gfxBG2Changed); |
| 321 | draw_gba_oam(lineOBJ, y); |
| 322 | draw_gba_oam_window(lineOBJWin, y); |
306 | 323 | |
307 | 324 | for(x = 0; x < 240; x++) |
308 | 325 | { |
r23152 | r23153 | |
312 | 329 | |
313 | 330 | if((lineOBJWin[x] & 0x80000000) == 0) |
314 | 331 | { |
315 | | mask = state->m_WINOUT >> 8; |
| 332 | mask = m_WINOUT >> 8; |
316 | 333 | } |
317 | 334 | |
318 | 335 | if(inWindow1) |
319 | 336 | { |
320 | | if(is_in_window(state, x, 1)) |
| 337 | if(is_in_window(x, 1)) |
321 | 338 | { |
322 | 339 | mask = inWin1Mask; |
323 | 340 | } |
r23152 | r23153 | |
325 | 342 | |
326 | 343 | if(inWindow0) |
327 | 344 | { |
328 | | if(is_in_window(state, x, 0)) |
| 345 | if(is_in_window(x, 0)) |
329 | 346 | { |
330 | 347 | mask = inWin0Mask; |
331 | 348 | } |
r23152 | r23153 | |
359 | 376 | { |
360 | 377 | if((color & 0x00010000) == 0) |
361 | 378 | { |
362 | | switch(state->m_BLDCNT & BLDCNT_SFX) |
| 379 | switch(m_BLDCNT & BLDCNT_SFX) |
363 | 380 | { |
364 | 381 | case BLDCNT_SFX_NONE: |
365 | 382 | break; |
366 | 383 | case BLDCNT_SFX_ALPHA: |
367 | 384 | { |
368 | | if(top & state->m_BLDCNT) |
| 385 | if(top & m_BLDCNT) |
369 | 386 | { |
370 | 387 | UINT32 back = backdrop; |
371 | 388 | UINT8 top2 = 0x20; |
r23152 | r23153 | |
405 | 422 | } |
406 | 423 | } |
407 | 424 | |
408 | | if(top2 & (state->m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
| 425 | if(top2 & (m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
409 | 426 | { |
410 | | color = alpha_blend_pixel(color, back, coeff[state->m_BLDALPHA & 0x1f], coeff[(state->m_BLDALPHA >> 8) & 0x1f]); |
| 427 | color = alpha_blend_pixel(color, back, coeff[m_BLDALPHA & 0x1f], coeff[(m_BLDALPHA >> 8) & 0x1f]); |
411 | 428 | } |
412 | 429 | } |
413 | 430 | break; |
414 | 431 | } |
415 | 432 | case BLDCNT_SFX_LIGHTEN: |
416 | | if(top & state->m_BLDCNT) |
| 433 | if(top & m_BLDCNT) |
417 | 434 | { |
418 | | color = increase_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 435 | color = increase_brightness(color, coeff[m_BLDY & 0x1f]); |
419 | 436 | } |
420 | 437 | break; |
421 | 438 | case BLDCNT_SFX_DARKEN: |
422 | | if(top & state->m_BLDCNT) |
| 439 | if(top & m_BLDCNT) |
423 | 440 | { |
424 | | color = decrease_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 441 | color = decrease_brightness(color, coeff[m_BLDY & 0x1f]); |
425 | 442 | } |
426 | 443 | break; |
427 | 444 | } |
r23152 | r23153 | |
449 | 466 | top2 = 0x04; |
450 | 467 | } |
451 | 468 | |
452 | | if(top2 & (state->m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
| 469 | if(top2 & (m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
453 | 470 | { |
454 | | color = alpha_blend_pixel(color, back, coeff[state->m_BLDALPHA & 0x1f], coeff[(state->m_BLDALPHA >> 8) & 0x1f]); |
| 471 | color = alpha_blend_pixel(color, back, coeff[m_BLDALPHA & 0x1f], coeff[(m_BLDALPHA >> 8) & 0x1f]); |
455 | 472 | } |
456 | 473 | else |
457 | 474 | { |
458 | | switch(state->m_BLDCNT & BLDCNT_SFX) |
| 475 | switch(m_BLDCNT & BLDCNT_SFX) |
459 | 476 | { |
460 | 477 | case BLDCNT_SFX_LIGHTEN: |
461 | | if(top & state->m_BLDCNT) |
| 478 | if(top & m_BLDCNT) |
462 | 479 | { |
463 | | color = increase_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 480 | color = increase_brightness(color, coeff[m_BLDY & 0x1f]); |
464 | 481 | } |
465 | 482 | break; |
466 | 483 | case BLDCNT_SFX_DARKEN: |
467 | | if(top & state->m_BLDCNT) |
| 484 | if(top & m_BLDCNT) |
468 | 485 | { |
469 | | color = decrease_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 486 | color = decrease_brightness(color, coeff[m_BLDY & 0x1f]); |
470 | 487 | } |
471 | 488 | break; |
472 | 489 | } |
r23152 | r23153 | |
496 | 513 | top2 = 0x04; |
497 | 514 | } |
498 | 515 | |
499 | | if(top2 & (state->m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
| 516 | if(top2 & (m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
500 | 517 | { |
501 | | color = alpha_blend_pixel(color, back, coeff[state->m_BLDALPHA & 0x1f], coeff[(state->m_BLDALPHA >> 8) & 0x1f]); |
| 518 | color = alpha_blend_pixel(color, back, coeff[m_BLDALPHA & 0x1f], coeff[(m_BLDALPHA >> 8) & 0x1f]); |
502 | 519 | } |
503 | 520 | else |
504 | 521 | { |
505 | | switch(state->m_BLDCNT & BLDCNT_SFX) |
| 522 | switch(m_BLDCNT & BLDCNT_SFX) |
506 | 523 | { |
507 | 524 | case BLDCNT_SFX_LIGHTEN: |
508 | | if(top & state->m_BLDCNT) |
| 525 | if(top & m_BLDCNT) |
509 | 526 | { |
510 | | color = increase_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 527 | color = increase_brightness(color, coeff[m_BLDY & 0x1f]); |
511 | 528 | } |
512 | 529 | break; |
513 | 530 | case BLDCNT_SFX_DARKEN: |
514 | | if(top & state->m_BLDCNT) |
| 531 | if(top & m_BLDCNT) |
515 | 532 | { |
516 | | color = decrease_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 533 | color = decrease_brightness(color, coeff[m_BLDY & 0x1f]); |
517 | 534 | } |
518 | 535 | break; |
519 | 536 | } |
r23152 | r23153 | |
521 | 538 | } |
522 | 539 | lineMix[x] = color; |
523 | 540 | } |
524 | | state->m_gfxBG2Changed = 0; |
| 541 | m_gfxBG2Changed = 0; |
525 | 542 | } |
trunk/src/mess/video/gbamode2.c
r23152 | r23153 | |
1 | | /*************************************************************************** |
| 1 | /*************************************************************************** |
2 | 2 | |
3 | 3 | gbamode2.c |
4 | 4 | |
r23152 | r23153 | |
8 | 8 | |
9 | 9 | ***************************************************************************/ |
10 | 10 | |
11 | | static void draw_mode2_scanline(running_machine &machine, gba_state *state, int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp) |
| 11 | |
| 12 | void gba_state::draw_mode2(int submode, int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp) |
12 | 13 | { |
| 14 | switch (submode) |
| 15 | { |
| 16 | case 0: |
| 17 | draw_mode2_scanline(y, line0, line1, line2, line3, lineOBJ, lineOBJWin, lineMix, bpp); |
| 18 | break; |
| 19 | case 1: |
| 20 | draw_mode2_scanline_nowindow(y, line0, line1, line2, line3, lineOBJ, lineOBJWin, lineMix, bpp); |
| 21 | break; |
| 22 | case 2: |
| 23 | draw_mode2_scanline_all(y, line0, line1, line2, line3, lineOBJ, lineOBJWin, lineMix, bpp); |
| 24 | break; |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | void gba_state::draw_mode2_scanline(int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp) |
| 29 | { |
13 | 30 | int x = 0; |
14 | | UINT32 backdrop = ((UINT16*)state->m_gba_pram.target())[0] | 0x30000000; |
| 31 | UINT32 backdrop = ((UINT16*)m_gba_pram.target())[0] | 0x30000000; |
15 | 32 | |
16 | | draw_roz_scanline(state, line2, y, DISPCNT_BG2_EN, state->m_BG2CNT, state->m_BG2X, state->m_BG2Y, state->m_BG2PA, state->m_BG2PB, state->m_BG2PC, state->m_BG2PD, &state->m_gfxBG2X, &state->m_gfxBG2Y, state->m_gfxBG2Changed); |
17 | | draw_roz_scanline(state, line3, y, DISPCNT_BG3_EN, state->m_BG3CNT, state->m_BG3X, state->m_BG3Y, state->m_BG3PA, state->m_BG3PB, state->m_BG3PC, state->m_BG3PD, &state->m_gfxBG3X, &state->m_gfxBG3Y, state->m_gfxBG3Changed); |
18 | | draw_gba_oam(state, machine, lineOBJ, y); |
| 33 | draw_roz_scanline(line2, y, DISPCNT_BG2_EN, m_BG2CNT, m_BG2X, m_BG2Y, m_BG2PA, m_BG2PB, m_BG2PC, m_BG2PD, &m_gfxBG2X, &m_gfxBG2Y, m_gfxBG2Changed); |
| 34 | draw_roz_scanline(line3, y, DISPCNT_BG3_EN, m_BG3CNT, m_BG3X, m_BG3Y, m_BG3PA, m_BG3PB, m_BG3PC, m_BG3PD, &m_gfxBG3X, &m_gfxBG3Y, m_gfxBG3Changed); |
| 35 | draw_gba_oam(lineOBJ, y); |
19 | 36 | |
20 | 37 | for(x = 0; x < 240; x++) |
21 | 38 | { |
r23152 | r23153 | |
57 | 74 | top2 = 0x08; |
58 | 75 | } |
59 | 76 | |
60 | | if(top2 & (state->m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
| 77 | if(top2 & (m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
61 | 78 | { |
62 | | color = alpha_blend_pixel(color, back, coeff[state->m_BLDALPHA & 0x1f], coeff[(state->m_BLDALPHA >> 8) & 0x1f]); |
| 79 | color = alpha_blend_pixel(color, back, coeff[m_BLDALPHA & 0x1f], coeff[(m_BLDALPHA >> 8) & 0x1f]); |
63 | 80 | } |
64 | 81 | else |
65 | 82 | { |
66 | | switch(state->m_BLDCNT & BLDCNT_SFX) |
| 83 | switch(m_BLDCNT & BLDCNT_SFX) |
67 | 84 | { |
68 | 85 | case BLDCNT_SFX_LIGHTEN: |
69 | | if(top & state->m_BLDCNT) |
| 86 | if(top & m_BLDCNT) |
70 | 87 | { |
71 | | color = increase_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 88 | color = increase_brightness(color, coeff[m_BLDY & 0x1f]); |
72 | 89 | } |
73 | 90 | break; |
74 | 91 | case BLDCNT_SFX_DARKEN: |
75 | | if(top & state->m_BLDCNT) |
| 92 | if(top & m_BLDCNT) |
76 | 93 | { |
77 | | color = decrease_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 94 | color = decrease_brightness(color, coeff[m_BLDY & 0x1f]); |
78 | 95 | } |
79 | 96 | break; |
80 | 97 | } |
r23152 | r23153 | |
83 | 100 | |
84 | 101 | lineMix[x] = color; |
85 | 102 | } |
86 | | state->m_gfxBG2Changed = 0; |
87 | | state->m_gfxBG3Changed = 0; |
| 103 | m_gfxBG2Changed = 0; |
| 104 | m_gfxBG3Changed = 0; |
88 | 105 | } |
89 | 106 | |
90 | | static void draw_mode2_scanline_nowindow(running_machine &machine, gba_state *state, int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp) |
| 107 | void gba_state::draw_mode2_scanline_nowindow(int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp) |
91 | 108 | { |
92 | 109 | int x = 0; |
93 | | UINT32 backdrop = ((UINT16*)state->m_gba_pram.target())[0] | 0x30000000; |
94 | | int effect = state->m_BLDCNT & BLDCNT_SFX; |
| 110 | UINT32 backdrop = ((UINT16*)m_gba_pram.target())[0] | 0x30000000; |
| 111 | int effect = m_BLDCNT & BLDCNT_SFX; |
95 | 112 | |
96 | | draw_roz_scanline(state, line2, y, DISPCNT_BG2_EN, state->m_BG2CNT, state->m_BG2X, state->m_BG2Y, state->m_BG2PA, state->m_BG2PB, state->m_BG2PC, state->m_BG2PD, &state->m_gfxBG2X, &state->m_gfxBG2Y, state->m_gfxBG2Changed); |
97 | | draw_roz_scanline(state, line3, y, DISPCNT_BG3_EN, state->m_BG3CNT, state->m_BG3X, state->m_BG3Y, state->m_BG3PA, state->m_BG3PB, state->m_BG3PC, state->m_BG3PD, &state->m_gfxBG3X, &state->m_gfxBG3Y, state->m_gfxBG3Changed); |
98 | | draw_gba_oam(state, machine, lineOBJ, y); |
| 113 | draw_roz_scanline(line2, y, DISPCNT_BG2_EN, m_BG2CNT, m_BG2X, m_BG2Y, m_BG2PA, m_BG2PB, m_BG2PC, m_BG2PD, &m_gfxBG2X, &m_gfxBG2Y, m_gfxBG2Changed); |
| 114 | draw_roz_scanline(line3, y, DISPCNT_BG3_EN, m_BG3CNT, m_BG3X, m_BG3Y, m_BG3PA, m_BG3PB, m_BG3PC, m_BG3PD, &m_gfxBG3X, &m_gfxBG3Y, m_gfxBG3Changed); |
| 115 | draw_gba_oam(lineOBJ, y); |
99 | 116 | |
100 | 117 | for(x = 0; x < 240; x++) |
101 | 118 | { |
r23152 | r23153 | |
127 | 144 | case BLDCNT_SFX_NONE: |
128 | 145 | break; |
129 | 146 | case BLDCNT_SFX_ALPHA: |
130 | | if(state->m_BLDCNT & top) |
| 147 | if(m_BLDCNT & top) |
131 | 148 | { |
132 | 149 | UINT32 back = backdrop; |
133 | 150 | UINT8 top2 = 0x20; |
r23152 | r23153 | |
159 | 176 | } |
160 | 177 | } |
161 | 178 | |
162 | | if(top2 & (state->m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
| 179 | if(top2 & (m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
163 | 180 | { |
164 | | color = alpha_blend_pixel(color, back, coeff[state->m_BLDALPHA & 0x1f], coeff[(state->m_BLDALPHA >> 8) & 0x1f]); |
| 181 | color = alpha_blend_pixel(color, back, coeff[m_BLDALPHA & 0x1f], coeff[(m_BLDALPHA >> 8) & 0x1f]); |
165 | 182 | } |
166 | 183 | } |
167 | 184 | break; |
168 | 185 | case BLDCNT_SFX_LIGHTEN: |
169 | | if(top & state->m_BLDCNT) |
| 186 | if(top & m_BLDCNT) |
170 | 187 | { |
171 | | color = increase_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 188 | color = increase_brightness(color, coeff[m_BLDY & 0x1f]); |
172 | 189 | } |
173 | 190 | break; |
174 | 191 | case BLDCNT_SFX_DARKEN: |
175 | | if(top & state->m_BLDCNT) |
| 192 | if(top & m_BLDCNT) |
176 | 193 | { |
177 | | color = decrease_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 194 | color = decrease_brightness(color, coeff[m_BLDY & 0x1f]); |
178 | 195 | } |
179 | 196 | break; |
180 | 197 | } |
r23152 | r23153 | |
196 | 213 | top2 = 0x08; |
197 | 214 | } |
198 | 215 | |
199 | | if(top2 & (state->m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
| 216 | if(top2 & (m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
200 | 217 | { |
201 | | color = alpha_blend_pixel(color, back, coeff[state->m_BLDALPHA & 0x1f], coeff[(state->m_BLDALPHA >> 8) & 0x1f]); |
| 218 | color = alpha_blend_pixel(color, back, coeff[m_BLDALPHA & 0x1f], coeff[(m_BLDALPHA >> 8) & 0x1f]); |
202 | 219 | } |
203 | 220 | else |
204 | 221 | { |
205 | | switch(state->m_BLDCNT & BLDCNT_SFX) |
| 222 | switch(m_BLDCNT & BLDCNT_SFX) |
206 | 223 | { |
207 | 224 | case BLDCNT_SFX_LIGHTEN: |
208 | | if(top & state->m_BLDCNT) |
| 225 | if(top & m_BLDCNT) |
209 | 226 | { |
210 | | color = increase_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 227 | color = increase_brightness(color, coeff[m_BLDY & 0x1f]); |
211 | 228 | } |
212 | 229 | break; |
213 | 230 | case BLDCNT_SFX_DARKEN: |
214 | | if(top & state->m_BLDCNT) |
| 231 | if(top & m_BLDCNT) |
215 | 232 | { |
216 | | color = decrease_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 233 | color = decrease_brightness(color, coeff[m_BLDY & 0x1f]); |
217 | 234 | } |
218 | 235 | break; |
219 | 236 | } |
r23152 | r23153 | |
221 | 238 | } |
222 | 239 | lineMix[x] = color; |
223 | 240 | } |
224 | | state->m_gfxBG2Changed = 0; |
225 | | state->m_gfxBG3Changed = 0; |
| 241 | m_gfxBG2Changed = 0; |
| 242 | m_gfxBG3Changed = 0; |
226 | 243 | } |
227 | 244 | |
228 | | static void draw_mode2_scanline_all(running_machine &machine, gba_state *state, int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp) |
| 245 | void gba_state::draw_mode2_scanline_all(int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp) |
229 | 246 | { |
230 | 247 | int x = 0; |
231 | | UINT32 backdrop = ((UINT16*)state->m_gba_pram.target())[0] | 0x30000000; |
| 248 | UINT32 backdrop = ((UINT16*)m_gba_pram.target())[0] | 0x30000000; |
232 | 249 | int inWindow0 = 0; |
233 | 250 | int inWindow1 = 0; |
234 | | UINT8 inWin0Mask = state->m_WININ & 0x00ff; |
235 | | UINT8 inWin1Mask = state->m_WININ >> 8; |
236 | | UINT8 outMask = state->m_WINOUT & 0x00ff; |
| 251 | UINT8 inWin0Mask = m_WININ & 0x00ff; |
| 252 | UINT8 inWin1Mask = m_WININ >> 8; |
| 253 | UINT8 outMask = m_WINOUT & 0x00ff; |
237 | 254 | |
238 | | if(state->m_DISPCNT & DISPCNT_WIN0_EN) |
| 255 | if(m_DISPCNT & DISPCNT_WIN0_EN) |
239 | 256 | { |
240 | | UINT8 v0 = state->m_WIN0V >> 8; |
241 | | UINT8 v1 = state->m_WIN0V & 0x00ff; |
| 257 | UINT8 v0 = m_WIN0V >> 8; |
| 258 | UINT8 v1 = m_WIN0V & 0x00ff; |
242 | 259 | inWindow0 = ((v0 == v1) && (v0 >= 0xe8)) ? 1 : 0; |
243 | 260 | if(v1 >= v0) |
244 | 261 | { |
r23152 | r23153 | |
250 | 267 | } |
251 | 268 | } |
252 | 269 | |
253 | | if(state->m_DISPCNT & DISPCNT_WIN1_EN) |
| 270 | if(m_DISPCNT & DISPCNT_WIN1_EN) |
254 | 271 | { |
255 | | UINT8 v0 = state->m_WIN1V >> 8; |
256 | | UINT8 v1 = state->m_WIN1V & 0x00ff; |
| 272 | UINT8 v0 = m_WIN1V >> 8; |
| 273 | UINT8 v1 = m_WIN1V & 0x00ff; |
257 | 274 | inWindow1 = ((v0 == v1) && (v0 >= 0xe8)) ? 1 : 0; |
258 | 275 | if(v1 >= v0) |
259 | 276 | { |
r23152 | r23153 | |
265 | 282 | } |
266 | 283 | } |
267 | 284 | |
268 | | draw_roz_scanline(state, line2, y, DISPCNT_BG2_EN, state->m_BG2CNT, state->m_BG2X, state->m_BG2Y, state->m_BG2PA, state->m_BG2PB, state->m_BG2PC, state->m_BG2PD, &state->m_gfxBG2X, &state->m_gfxBG2Y, state->m_gfxBG2Changed); |
269 | | draw_roz_scanline(state, line3, y, DISPCNT_BG3_EN, state->m_BG3CNT, state->m_BG3X, state->m_BG3Y, state->m_BG3PA, state->m_BG3PB, state->m_BG3PC, state->m_BG3PD, &state->m_gfxBG3X, &state->m_gfxBG3Y, state->m_gfxBG3Changed); |
270 | | draw_gba_oam(state, machine, lineOBJ, y); |
271 | | draw_gba_oam_window(state, machine, lineOBJWin, y); |
| 285 | draw_roz_scanline(line2, y, DISPCNT_BG2_EN, m_BG2CNT, m_BG2X, m_BG2Y, m_BG2PA, m_BG2PB, m_BG2PC, m_BG2PD, &m_gfxBG2X, &m_gfxBG2Y, m_gfxBG2Changed); |
| 286 | draw_roz_scanline(line3, y, DISPCNT_BG3_EN, m_BG3CNT, m_BG3X, m_BG3Y, m_BG3PA, m_BG3PB, m_BG3PC, m_BG3PD, &m_gfxBG3X, &m_gfxBG3Y, m_gfxBG3Changed); |
| 287 | draw_gba_oam(lineOBJ, y); |
| 288 | draw_gba_oam_window(lineOBJWin, y); |
272 | 289 | |
273 | 290 | for(x = 0; x < 240; x++) |
274 | 291 | { |
r23152 | r23153 | |
278 | 295 | |
279 | 296 | if((lineOBJWin[x] & 0x80000000) == 0) |
280 | 297 | { |
281 | | mask = state->m_WINOUT >> 8; |
| 298 | mask = m_WINOUT >> 8; |
282 | 299 | } |
283 | 300 | |
284 | 301 | if(inWindow1) |
285 | 302 | { |
286 | | if(is_in_window(state, x, 1)) |
| 303 | if(is_in_window(x, 1)) |
287 | 304 | { |
288 | 305 | mask = inWin1Mask; |
289 | 306 | } |
r23152 | r23153 | |
291 | 308 | |
292 | 309 | if(inWindow0) |
293 | 310 | { |
294 | | if(is_in_window(state, x, 0)) |
| 311 | if(is_in_window(x, 0)) |
295 | 312 | { |
296 | 313 | mask = inWin0Mask; |
297 | 314 | } |
r23152 | r23153 | |
319 | 336 | { |
320 | 337 | if((color & 0x00010000) == 0) |
321 | 338 | { |
322 | | switch(state->m_BLDCNT & BLDCNT_SFX) |
| 339 | switch(m_BLDCNT & BLDCNT_SFX) |
323 | 340 | { |
324 | 341 | case BLDCNT_SFX_NONE: |
325 | 342 | break; |
326 | 343 | case BLDCNT_SFX_ALPHA: |
327 | 344 | { |
328 | | if(top & state->m_BLDCNT) |
| 345 | if(top & m_BLDCNT) |
329 | 346 | { |
330 | 347 | UINT32 back = backdrop; |
331 | 348 | UINT8 top2 = 0x20; |
r23152 | r23153 | |
356 | 373 | } |
357 | 374 | } |
358 | 375 | |
359 | | if(top2 & (state->m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
| 376 | if(top2 & (m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
360 | 377 | { |
361 | | color = alpha_blend_pixel(color, back, coeff[state->m_BLDALPHA & 0x1f], coeff[(state->m_BLDALPHA >> 8) & 0x1f]); |
| 378 | color = alpha_blend_pixel(color, back, coeff[m_BLDALPHA & 0x1f], coeff[(m_BLDALPHA >> 8) & 0x1f]); |
362 | 379 | } |
363 | 380 | } |
364 | 381 | break; |
365 | 382 | } |
366 | 383 | case BLDCNT_SFX_LIGHTEN: |
367 | | if(top & state->m_BLDCNT) |
| 384 | if(top & m_BLDCNT) |
368 | 385 | { |
369 | | color = increase_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 386 | color = increase_brightness(color, coeff[m_BLDY & 0x1f]); |
370 | 387 | } |
371 | 388 | break; |
372 | 389 | case BLDCNT_SFX_DARKEN: |
373 | | if(top & state->m_BLDCNT) |
| 390 | if(top & m_BLDCNT) |
374 | 391 | { |
375 | | color = decrease_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 392 | color = decrease_brightness(color, coeff[m_BLDY & 0x1f]); |
376 | 393 | } |
377 | 394 | break; |
378 | 395 | } |
r23152 | r23153 | |
394 | 411 | top2 = 0x08; |
395 | 412 | } |
396 | 413 | |
397 | | if(top2 & (state->m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
| 414 | if(top2 & (m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
398 | 415 | { |
399 | | color = alpha_blend_pixel(color, back, coeff[state->m_BLDALPHA & 0x1f], coeff[(state->m_BLDALPHA >> 8) & 0x1f]); |
| 416 | color = alpha_blend_pixel(color, back, coeff[m_BLDALPHA & 0x1f], coeff[(m_BLDALPHA >> 8) & 0x1f]); |
400 | 417 | } |
401 | 418 | else |
402 | 419 | { |
403 | | switch(state->m_BLDCNT & BLDCNT_SFX) |
| 420 | switch(m_BLDCNT & BLDCNT_SFX) |
404 | 421 | { |
405 | 422 | case BLDCNT_SFX_LIGHTEN: |
406 | | if(top & state->m_BLDCNT) |
| 423 | if(top & m_BLDCNT) |
407 | 424 | { |
408 | | color = increase_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 425 | color = increase_brightness(color, coeff[m_BLDY & 0x1f]); |
409 | 426 | } |
410 | 427 | break; |
411 | 428 | case BLDCNT_SFX_DARKEN: |
412 | | if(top & state->m_BLDCNT) |
| 429 | if(top & m_BLDCNT) |
413 | 430 | { |
414 | | color = decrease_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 431 | color = decrease_brightness(color, coeff[m_BLDY & 0x1f]); |
415 | 432 | } |
416 | 433 | break; |
417 | 434 | } |
r23152 | r23153 | |
435 | 452 | top2 = 0x08; |
436 | 453 | } |
437 | 454 | |
438 | | if(top2 & (state->m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
| 455 | if(top2 & (m_BLDCNT >> BLDCNT_TP2_SHIFT)) |
439 | 456 | { |
440 | | color = alpha_blend_pixel(color, back, coeff[state->m_BLDALPHA & 0x1f], coeff[(state->m_BLDALPHA >> 8) & 0x1f]); |
| 457 | color = alpha_blend_pixel(color, back, coeff[m_BLDALPHA & 0x1f], coeff[(m_BLDALPHA >> 8) & 0x1f]); |
441 | 458 | } |
442 | 459 | else |
443 | 460 | { |
444 | | switch(state->m_BLDCNT & BLDCNT_SFX) |
| 461 | switch(m_BLDCNT & BLDCNT_SFX) |
445 | 462 | { |
446 | 463 | case BLDCNT_SFX_LIGHTEN: |
447 | | if(top & state->m_BLDCNT) |
| 464 | if(top & m_BLDCNT) |
448 | 465 | { |
449 | | color = increase_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 466 | color = increase_brightness(color, coeff[m_BLDY & 0x1f]); |
450 | 467 | } |
451 | 468 | break; |
452 | 469 | case BLDCNT_SFX_DARKEN: |
453 | | if(top & state->m_BLDCNT) |
| 470 | if(top & m_BLDCNT) |
454 | 471 | { |
455 | | color = decrease_brightness(color, coeff[state->m_BLDY & 0x1f]); |
| 472 | color = decrease_brightness(color, coeff[m_BLDY & 0x1f]); |
456 | 473 | } |
457 | 474 | break; |
458 | 475 | } |
r23152 | r23153 | |
460 | 477 | } |
461 | 478 | lineMix[x] = color; |
462 | 479 | } |
463 | | state->m_gfxBG2Changed = 0; |
464 | | state->m_gfxBG3Changed = 0; |
| 480 | m_gfxBG2Changed = 0; |
| 481 | m_gfxBG3Changed = 0; |
465 | 482 | } |
trunk/src/mess/video/gba.c
r23152 | r23153 | |
31 | 31 | 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 |
32 | 32 | }; |
33 | 33 | |
34 | | /* Drawing functions */ |
35 | | static void draw_roz_bitmap_scanline(gba_state *state, UINT32 *scanline, int ypos, UINT32 enablemask, UINT32 ctrl, INT32 X, INT32 Y, INT32 PA, INT32 PB, INT32 PC, INT32 PD, INT32 *currentx, INT32 *currenty, int changed, int depth); |
36 | | static void draw_roz_scanline(gba_state *state, UINT32 *scanline, int ypos, UINT32 enablemask, UINT32 ctrl, INT32 X, INT32 Y, INT32 PA, INT32 PB, INT32 PC, INT32 PD, INT32 *currentx, INT32 *currenty, int changed); |
37 | | static void draw_bg_scanline(gba_state *state, UINT32 *scanline, int ypos, UINT32 enablemask, UINT32 ctrl, UINT32 hofs, UINT32 vofs); |
38 | | static void draw_gba_oam_window(gba_state *state, running_machine &machine, UINT32 *scanline, int y); |
39 | | static void draw_gba_oam(gba_state *state, running_machine &machine, UINT32 *scanline, int y); |
40 | | static void invalid_gba_draw_function(running_machine &machine, gba_state *state, int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int aux); |
41 | | |
42 | 34 | /* Utility functions */ |
43 | | INLINE int is_in_window(gba_state *state, int x, int window); |
44 | 35 | INLINE UINT32 alpha_blend_pixel(UINT32 color0, UINT32 color1, int ca, int cb); |
45 | 36 | INLINE UINT32 increase_brightness(UINT32 color, int coeff_); |
46 | 37 | INLINE UINT32 decrease_brightness(UINT32 color, int coeff_); |
r23152 | r23153 | |
50 | 41 | #include "gbamode2.c" |
51 | 42 | #include "gbam345.c" |
52 | 43 | |
53 | | static void (*const gba_draw_scanline_modes[8][3])(running_machine &machine, gba_state *state, int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int aux) = |
54 | | { |
55 | | /* All modes have three sub-modes: No effects, effects, and windowed effects. */ |
56 | | { /* Mode 0: 4 non-rotatable tilemaps and 1 OAM layer */ |
57 | | &draw_mode0_scanline, |
58 | | &draw_mode0_scanline_nowindow, |
59 | | &draw_mode0_scanline_all |
60 | | }, |
61 | | { /* Mode 1: 2 non-rotatable tilemaps, 1 rotozoomable tilemap, and 1 OAM layer */ |
62 | | &draw_mode1_scanline, |
63 | | &draw_mode1_scanline_nowindow, |
64 | | &draw_mode1_scanline_all |
65 | | }, |
66 | | { /* Mode 2: 2 rotozoomable tilemaps, and 1 OAM layer */ |
67 | | &draw_mode2_scanline, |
68 | | &draw_mode2_scanline_nowindow, |
69 | | &draw_mode2_scanline_all |
70 | | }, |
71 | | { /* Mode 3: 1 rotatable 8bpp bitmap and one OAM layer */ |
72 | | &draw_roz_bitmap_mode_scanline, |
73 | | &draw_roz_bitmap_mode_scanline_nowindow, |
74 | | &draw_roz_bitmap_mode_scanline_all |
75 | | }, |
76 | | { /* Mode 4: 1 rotatable 16bpp bitmap and one OAM layer */ |
77 | | &draw_roz_bitmap_mode_scanline, |
78 | | &draw_roz_bitmap_mode_scanline_nowindow, |
79 | | &draw_roz_bitmap_mode_scanline_all |
80 | | }, |
81 | | { /* Mode 5: 1 rotatable 4bpp bitmap and one OAM layer */ |
82 | | &draw_roz_bitmap_mode_scanline, |
83 | | &draw_roz_bitmap_mode_scanline_nowindow, |
84 | | &draw_roz_bitmap_mode_scanline_all |
85 | | }, |
86 | | { |
87 | | &invalid_gba_draw_function, |
88 | | &invalid_gba_draw_function, |
89 | | &invalid_gba_draw_function, |
90 | | }, |
91 | | { |
92 | | &invalid_gba_draw_function, |
93 | | &invalid_gba_draw_function, |
94 | | &invalid_gba_draw_function, |
95 | | }, |
96 | | }; |
97 | 44 | |
98 | | static void invalid_gba_draw_function(running_machine &machine, gba_state *state, int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int aux) |
| 45 | void gba_state::draw_roz_bitmap_scanline(UINT32 *scanline, int ypos, UINT32 enablemask, UINT32 ctrl, INT32 X, INT32 Y, INT32 PA, INT32 PB, INT32 PC, INT32 PD, INT32 *currentx, INT32 *currenty, int changed, int depth) |
99 | 46 | { |
100 | | fatalerror( "Invalid screen mode (6 or 7)!\n" ); |
101 | | } |
102 | | |
103 | | static void draw_roz_bitmap_scanline(gba_state *state, UINT32 *scanline, int ypos, UINT32 enablemask, UINT32 ctrl, INT32 X, INT32 Y, INT32 PA, INT32 PB, INT32 PC, INT32 PD, INT32 *currentx, INT32 *currenty, int changed, int depth) |
104 | | { |
105 | | UINT8 *src8 = (UINT8 *)state->m_gba_vram.target(); |
106 | | UINT16 *src16 = (UINT16 *)state->m_gba_vram.target(); |
107 | | UINT16 *palette = (UINT16 *)state->m_gba_pram.target(); |
| 47 | UINT8 *src8 = (UINT8 *)m_gba_vram.target(); |
| 48 | UINT16 *src16 = (UINT16 *)m_gba_vram.target(); |
| 49 | UINT16 *palette = (UINT16 *)m_gba_pram.target(); |
108 | 50 | INT32 sx = (depth == 4) ? 160 : 240; |
109 | 51 | INT32 sy = (depth == 4) ? 128 : 160; |
110 | 52 | UINT32 prio = ((ctrl & BGCNT_PRIORITY) << 25) + 0x1000000; |
111 | 53 | INT32 dx, dmx, dy, dmy, startx, starty; |
112 | 54 | INT32 rx, ry, pixx, pixy, x; |
113 | 55 | |
114 | | if ((depth == 8) && (state->m_DISPCNT & DISPCNT_FRAMESEL)) |
| 56 | if ((depth == 8) && (m_DISPCNT & DISPCNT_FRAMESEL)) |
115 | 57 | src8 += 0xa000; |
116 | 58 | |
117 | | if ((depth == 4) && (state->m_DISPCNT & DISPCNT_FRAMESEL)) |
| 59 | if ((depth == 4) && (m_DISPCNT & DISPCNT_FRAMESEL)) |
118 | 60 | src16 += 0xa000/2; |
119 | 61 | |
120 | 62 | // sign extend roz parameters |
r23152 | r23153 | |
151 | 93 | |
152 | 94 | if(ctrl & BGCNT_MOSAIC) |
153 | 95 | { |
154 | | INT32 mosaic_line = ((state->m_MOSAIC & 0x00f0) >> 4) + 1; |
| 96 | INT32 mosaic_line = ((m_MOSAIC & 0x00f0) >> 4) + 1; |
155 | 97 | INT32 tempy = (ypos / mosaic_line) * mosaic_line; |
156 | 98 | rx = startx + tempy*dmx; |
157 | 99 | ry = starty + tempy*dmy; |
r23152 | r23153 | |
188 | 130 | |
189 | 131 | if(ctrl & BGCNT_MOSAIC) |
190 | 132 | { |
191 | | INT32 mosaicx = (state->m_MOSAIC & 0x0f) + 1; |
| 133 | INT32 mosaicx = (m_MOSAIC & 0x0f) + 1; |
192 | 134 | if(mosaicx > 1) |
193 | 135 | { |
194 | 136 | INT32 m = 1; |
r23152 | r23153 | |
206 | 148 | } |
207 | 149 | } |
208 | 150 | |
209 | | static void draw_roz_scanline(gba_state *state, UINT32 *scanline, int ypos, UINT32 enablemask, UINT32 ctrl, INT32 X, INT32 Y, INT32 PA, INT32 PB, INT32 PC, INT32 PD, INT32 *currentx, INT32 *currenty, int changed) |
| 151 | void gba_state::draw_roz_scanline(UINT32 *scanline, int ypos, UINT32 enablemask, UINT32 ctrl, INT32 X, INT32 Y, INT32 PA, INT32 PB, INT32 PC, INT32 PD, INT32 *currentx, INT32 *currenty, int changed) |
210 | 152 | { |
211 | 153 | UINT32 base, mapbase, size; |
212 | 154 | static const INT32 sizes[4] = { 128, 256, 512, 1024 }; |
213 | 155 | INT32 cx, cy, x, pixx, pixy; |
214 | | UINT8 *mgba_vram = (UINT8 *)state->m_gba_vram.target(); |
| 156 | UINT8 *mgba_vram = (UINT8 *)m_gba_vram.target(); |
215 | 157 | UINT32 tile; |
216 | | UINT16 *pgba_pram = (UINT16 *)state->m_gba_pram.target(); |
| 158 | UINT16 *pgba_pram = (UINT16 *)m_gba_pram.target(); |
217 | 159 | UINT16 pixel; |
218 | 160 | UINT32 prio = ((ctrl & BGCNT_PRIORITY) << 25) + 0x1000000; |
219 | 161 | |
r23152 | r23153 | |
222 | 164 | scanline[x] = 0x80000000; |
223 | 165 | } |
224 | 166 | |
225 | | if (state->m_DISPCNT & enablemask) |
| 167 | if (m_DISPCNT & enablemask) |
226 | 168 | { |
227 | 169 | base = ((ctrl & BGCNT_CHARBASE) >> BGCNT_CHARBASE_SHIFT) * 0x4000; // VRAM base of tiles |
228 | 170 | mapbase = ((ctrl & BGCNT_SCREENBASE) >> BGCNT_SCREENBASE_SHIFT) * 0x800; // VRAM base of map |
r23152 | r23153 | |
264 | 206 | |
265 | 207 | if(ctrl & BGCNT_MOSAIC) |
266 | 208 | { |
267 | | int mosaicy = ((state->m_MOSAIC & 0xf0) >> 4) + 1; |
| 209 | int mosaicy = ((m_MOSAIC & 0xf0) >> 4) + 1; |
268 | 210 | int y = ypos % mosaicy; |
269 | 211 | cx -= y*PB; |
270 | 212 | cy -= y*PD; |
r23152 | r23153 | |
372 | 314 | |
373 | 315 | if(ctrl & BGCNT_MOSAIC) |
374 | 316 | { |
375 | | int mosaicx = (state->m_MOSAIC & 0x0f) + 1; |
| 317 | int mosaicx = (m_MOSAIC & 0x0f) + 1; |
376 | 318 | if(mosaicx > 1) |
377 | 319 | { |
378 | 320 | int m = 1; |
r23152 | r23153 | |
391 | 333 | } |
392 | 334 | } |
393 | 335 | |
394 | | static void draw_bg_scanline(gba_state *state, UINT32 *scanline, int ypos, UINT32 enablemask, UINT32 ctrl, UINT32 hofs, UINT32 vofs) |
| 336 | void gba_state::draw_bg_scanline(UINT32 *scanline, int ypos, UINT32 enablemask, UINT32 ctrl, UINT32 hofs, UINT32 vofs) |
395 | 337 | { |
396 | | UINT8 *vram = (UINT8*)state->m_gba_vram.target(); |
397 | | UINT16 *palette = (UINT16*)state->m_gba_pram.target(); |
| 338 | UINT8 *vram = (UINT8*)m_gba_vram.target(); |
| 339 | UINT16 *palette = (UINT16*)m_gba_pram.target(); |
398 | 340 | UINT8 *chardata = &vram[((ctrl & BGCNT_CHARBASE) >> BGCNT_CHARBASE_SHIFT) * 0x4000]; |
399 | 341 | UINT16 *screendata = (UINT16*)&vram[((ctrl & BGCNT_SCREENBASE) >> BGCNT_SCREENBASE_SHIFT) * 0x800]; |
400 | 342 | UINT32 priority = ((ctrl & BGCNT_PRIORITY) << 25) + 0x1000000; |
r23152 | r23153 | |
402 | 344 | INT32 height = 256; |
403 | 345 | INT32 maskx, masky, pixx, pixy; |
404 | 346 | UINT8 use_mosaic = (ctrl & BGCNT_MOSAIC) ? 1 : 0; |
405 | | INT32 mosaicx = (state->m_MOSAIC & 0x000f) + 1; |
406 | | INT32 mosaicy = ((state->m_MOSAIC & 0x00f0) >> 4) + 1; |
| 347 | INT32 mosaicx = (m_MOSAIC & 0x000f) + 1; |
| 348 | INT32 mosaicy = ((m_MOSAIC & 0x00f0) >> 4) + 1; |
407 | 349 | INT32 stride; |
408 | 350 | INT32 x; |
409 | 351 | |
410 | | if(!(state->m_DISPCNT & enablemask)) |
| 352 | if(!(m_DISPCNT & enablemask)) |
411 | 353 | { |
412 | 354 | for(x = 0; x < 240; x++) |
413 | 355 | { |
r23152 | r23153 | |
615 | 557 | } |
616 | 558 | } |
617 | 559 | |
618 | | static void draw_gba_oam_window(gba_state *state, running_machine &machine, UINT32 *scanline, int y) |
| 560 | void gba_state::draw_gba_oam_window(UINT32 *scanline, int y) |
619 | 561 | { |
620 | 562 | INT16 gba_oamindex; |
621 | 563 | UINT32 tilebytebase, tileindex, tiledrawindex; |
622 | 564 | UINT32 width, height; |
623 | | UINT16 *pgba_oam = (UINT16 *)state->m_gba_oam.target(); |
| 565 | UINT16 *pgba_oam = (UINT16 *)m_gba_oam.target(); |
624 | 566 | int x = 0; |
625 | | UINT8 *src = (UINT8*)state->m_gba_vram.target(); |
| 567 | UINT8 *src = (UINT8*)m_gba_vram.target(); |
626 | 568 | |
627 | 569 | for(x = 0; x < 240; x++) |
628 | 570 | { |
629 | 571 | scanline[x] = 0x80000000; |
630 | 572 | } |
631 | 573 | |
632 | | if( state->m_DISPCNT & DISPCNT_OBJWIN_EN ) |
| 574 | if( m_DISPCNT & DISPCNT_OBJWIN_EN ) |
633 | 575 | { |
634 | 576 | for( gba_oamindex = 127; gba_oamindex >= 0; gba_oamindex-- ) |
635 | 577 | { |
r23152 | r23153 | |
725 | 667 | default: |
726 | 668 | width = 0; |
727 | 669 | height = 0; |
728 | | verboselog(machine, 0, "OAM error: Trying to draw OBJ with OBJ_SHAPE = 3!\n" ); |
| 670 | verboselog(machine(), 0, "OAM error: Trying to draw OBJ with OBJ_SHAPE = 3!\n" ); |
729 | 671 | break; |
730 | 672 | } |
731 | 673 | |
r23152 | r23153 | |
773 | 715 | if((attr0 & OBJ_PALMODE) == OBJ_PALMODE_256) |
774 | 716 | { |
775 | 717 | int inc = 32; |
776 | | if((state->m_DISPCNT & DISPCNT_MODE) > 2 && tiledrawindex < 0x200) |
| 718 | if((m_DISPCNT & DISPCNT_MODE) > 2 && tiledrawindex < 0x200) |
777 | 719 | { |
778 | 720 | continue; |
779 | 721 | } |
780 | | if((state->m_DISPCNT & DISPCNT_VRAM_MAP) == DISPCNT_VRAM_MAP_1D) |
| 722 | if((m_DISPCNT & DISPCNT_VRAM_MAP) == DISPCNT_VRAM_MAP_1D) |
781 | 723 | { |
782 | 724 | inc = sx >> 2; |
783 | 725 | } |
r23152 | r23153 | |
812 | 754 | else |
813 | 755 | { |
814 | 756 | int inc = 32; |
815 | | if((state->m_DISPCNT & DISPCNT_MODE) > 2 && tiledrawindex < 0x200) |
| 757 | if((m_DISPCNT & DISPCNT_MODE) > 2 && tiledrawindex < 0x200) |
816 | 758 | { |
817 | 759 | continue; |
818 | 760 | } |
819 | | if((state->m_DISPCNT & DISPCNT_VRAM_MAP) == DISPCNT_VRAM_MAP_1D) |
| 761 | if((m_DISPCNT & DISPCNT_VRAM_MAP) == DISPCNT_VRAM_MAP_1D) |
820 | 762 | { |
821 | 763 | inc = sx >> 3; |
822 | 764 | } |
r23152 | r23153 | |
876 | 818 | { |
877 | 819 | cury_ = height - cury_ - 1; |
878 | 820 | } |
879 | | if((state->m_DISPCNT & DISPCNT_MODE) > 2 && tiledrawindex < 0x200) |
| 821 | if((m_DISPCNT & DISPCNT_MODE) > 2 && tiledrawindex < 0x200) |
880 | 822 | { |
881 | 823 | continue; |
882 | 824 | } |
883 | 825 | |
884 | | if((state->m_DISPCNT & DISPCNT_VRAM_MAP) == DISPCNT_VRAM_MAP_1D) |
| 826 | if((m_DISPCNT & DISPCNT_VRAM_MAP) == DISPCNT_VRAM_MAP_1D) |
885 | 827 | { |
886 | 828 | inc = width >> 2; |
887 | 829 | } |
r23152 | r23153 | |
955 | 897 | { |
956 | 898 | cury_ = height - cury_ - 1; |
957 | 899 | } |
958 | | if((state->m_DISPCNT & DISPCNT_MODE) > 2 && tiledrawindex < 0x200) |
| 900 | if((m_DISPCNT & DISPCNT_MODE) > 2 && tiledrawindex < 0x200) |
959 | 901 | { |
960 | 902 | continue; |
961 | 903 | } |
962 | 904 | |
963 | | if((state->m_DISPCNT & DISPCNT_VRAM_MAP) == DISPCNT_VRAM_MAP_1D) |
| 905 | if((m_DISPCNT & DISPCNT_VRAM_MAP) == DISPCNT_VRAM_MAP_1D) |
964 | 906 | { |
965 | 907 | inc = width >> 3; |
966 | 908 | } |
r23152 | r23153 | |
1061 | 1003 | } |
1062 | 1004 | } |
1063 | 1005 | |
1064 | | static void draw_gba_oam(gba_state *state, running_machine &machine, UINT32 *scanline, int y) |
| 1006 | void gba_state::draw_gba_oam(UINT32 *scanline, int y) |
1065 | 1007 | { |
1066 | 1008 | INT16 gba_oamindex; |
1067 | 1009 | INT32 mosaiccnt = 0; |
1068 | | INT32 mosaicy = ((state->m_MOSAIC & 0xf000) >> 12) + 1; |
1069 | | INT32 mosaicx = ((state->m_MOSAIC & 0x0f00) >> 8) + 1; |
| 1010 | INT32 mosaicy = ((m_MOSAIC & 0xf000) >> 12) + 1; |
| 1011 | INT32 mosaicx = ((m_MOSAIC & 0x0f00) >> 8) + 1; |
1070 | 1012 | UINT32 tileindex, tiledrawindex; //, tilebytebase |
1071 | 1013 | UINT8 width, height; |
1072 | | UINT16 *pgba_oam = (UINT16 *)state->m_gba_oam.target(); |
1073 | | UINT8 *src = (UINT8 *)state->m_gba_vram.target(); |
1074 | | UINT16 *palette = (UINT16*)state->m_gba_pram.target(); |
| 1014 | UINT16 *pgba_oam = (UINT16 *)m_gba_oam.target(); |
| 1015 | UINT8 *src = (UINT8 *)m_gba_vram.target(); |
| 1016 | UINT16 *palette = (UINT16*)m_gba_pram.target(); |
1075 | 1017 | int x = 0; |
1076 | 1018 | |
1077 | 1019 | for(x = 0; x < 240; x++) |
r23152 | r23153 | |
1079 | 1021 | scanline[x] = 0x80000000; |
1080 | 1022 | } |
1081 | 1023 | |
1082 | | if( state->m_DISPCNT & DISPCNT_OBJ_EN ) |
| 1024 | if( m_DISPCNT & DISPCNT_OBJ_EN ) |
1083 | 1025 | { |
1084 | 1026 | for( gba_oamindex = 0; gba_oamindex < 128; gba_oamindex++ ) |
1085 | 1027 | { |
r23152 | r23153 | |
1166 | 1108 | default: |
1167 | 1109 | width = 0; |
1168 | 1110 | height = 0; |
1169 | | verboselog(machine, 0, "OAM error: Trying to draw OBJ with OBJ_SHAPE = 3!\n" ); |
| 1111 | verboselog(machine(), 0, "OAM error: Trying to draw OBJ with OBJ_SHAPE = 3!\n" ); |
1170 | 1112 | break; |
1171 | 1113 | } |
1172 | 1114 | |
r23152 | r23153 | |
1229 | 1171 | { |
1230 | 1172 | INT32 inc = 32; |
1231 | 1173 | |
1232 | | if((state->m_DISPCNT & DISPCNT_MODE) > 2 && tiledrawindex < 0x200) |
| 1174 | if((m_DISPCNT & DISPCNT_MODE) > 2 && tiledrawindex < 0x200) |
1233 | 1175 | { |
1234 | 1176 | continue; |
1235 | 1177 | } |
1236 | 1178 | |
1237 | | if((state->m_DISPCNT & DISPCNT_VRAM_MAP) == DISPCNT_VRAM_MAP_1D) |
| 1179 | if((m_DISPCNT & DISPCNT_VRAM_MAP) == DISPCNT_VRAM_MAP_1D) |
1238 | 1180 | { |
1239 | 1181 | inc = width >> 2; |
1240 | 1182 | } |
r23152 | r23153 | |
1290 | 1232 | INT32 inc = 32; |
1291 | 1233 | INT32 palentry = (attr2 >> 8) & 0xf0; |
1292 | 1234 | |
1293 | | if((state->m_DISPCNT & DISPCNT_MODE) > 2 && tiledrawindex < 0x200) |
| 1235 | if((m_DISPCNT & DISPCNT_MODE) > 2 && tiledrawindex < 0x200) |
1294 | 1236 | { |
1295 | 1237 | continue; |
1296 | 1238 | } |
1297 | 1239 | |
1298 | | if((state->m_DISPCNT & DISPCNT_VRAM_MAP) == DISPCNT_VRAM_MAP_1D) |
| 1240 | if((m_DISPCNT & DISPCNT_VRAM_MAP) == DISPCNT_VRAM_MAP_1D) |
1299 | 1241 | { |
1300 | 1242 | inc = width >> 3; |
1301 | 1243 | } |
r23152 | r23153 | |
1394 | 1336 | cury = height - cury - 1; |
1395 | 1337 | } |
1396 | 1338 | |
1397 | | if((state->m_DISPCNT & DISPCNT_MODE) > 2 && tiledrawindex < 0x200) |
| 1339 | if((m_DISPCNT & DISPCNT_MODE) > 2 && tiledrawindex < 0x200) |
1398 | 1340 | { |
1399 | 1341 | continue; |
1400 | 1342 | } |
1401 | 1343 | |
1402 | | if((state->m_DISPCNT & DISPCNT_VRAM_MAP) == DISPCNT_VRAM_MAP_1D) |
| 1344 | if((m_DISPCNT & DISPCNT_VRAM_MAP) == DISPCNT_VRAM_MAP_1D) |
1403 | 1345 | { |
1404 | 1346 | inc = width >> 2; |
1405 | 1347 | } |
r23152 | r23153 | |
1502 | 1444 | cury = height - cury - 1; |
1503 | 1445 | } |
1504 | 1446 | |
1505 | | if((state->m_DISPCNT & DISPCNT_MODE) > 2 && tiledrawindex < 0x200) |
| 1447 | if((m_DISPCNT & DISPCNT_MODE) > 2 && tiledrawindex < 0x200) |
1506 | 1448 | { |
1507 | 1449 | continue; |
1508 | 1450 | } |
1509 | 1451 | |
1510 | | if((state->m_DISPCNT & DISPCNT_VRAM_MAP) == DISPCNT_VRAM_MAP_1D) |
| 1452 | if((m_DISPCNT & DISPCNT_VRAM_MAP) == DISPCNT_VRAM_MAP_1D) |
1511 | 1453 | { |
1512 | 1454 | inc = width >> 3; |
1513 | 1455 | } |
r23152 | r23153 | |
1654 | 1596 | } |
1655 | 1597 | } |
1656 | 1598 | |
1657 | | INLINE int is_in_window(gba_state *state, int x, int window) |
| 1599 | inline int gba_state::is_in_window(int x, int window) |
1658 | 1600 | { |
1659 | | int x0 = state->m_WIN0H >> 8; |
1660 | | int x1 = state->m_WIN0H & 0x00ff; |
| 1601 | int x0 = m_WIN0H >> 8; |
| 1602 | int x1 = m_WIN0H & 0x00ff; |
1661 | 1603 | |
1662 | 1604 | if(window == 1) |
1663 | 1605 | { |
1664 | | x0 = state->m_WIN1H >> 8; |
1665 | | x1 = state->m_WIN1H & 0x00ff; |
| 1606 | x0 = m_WIN1H >> 8; |
| 1607 | x1 = m_WIN1H & 0x00ff; |
1666 | 1608 | } |
1667 | 1609 | |
1668 | 1610 | if(x0 <= x1) |
r23152 | r23153 | |
1740 | 1682 | return (color & 0xffff0000) | (b << 10) | (g << 5) | r; |
1741 | 1683 | } |
1742 | 1684 | |
1743 | | void gba_draw_scanline(running_machine &machine, int y) |
| 1685 | void gba_state::draw_scanline(int y) |
1744 | 1686 | { |
1745 | | gba_state *state = machine.driver_data<gba_state>(); |
1746 | | bitmap_ind16 &bitmap = state->m_bitmap; |
| 1687 | bitmap_ind16 &bitmap = m_bitmap; |
1747 | 1688 | UINT16 *scanline = &bitmap.pix16(y); |
1748 | 1689 | int i, x; |
1749 | 1690 | UINT8 submode = 0; |
1750 | | int bpp = 0; |
1751 | 1691 | |
1752 | 1692 | // forced blank |
1753 | | if (state->m_DISPCNT & DISPCNT_BLANK) |
| 1693 | if (m_DISPCNT & DISPCNT_BLANK) |
1754 | 1694 | { |
1755 | 1695 | // forced blank is white |
1756 | 1696 | for (i = 0; i < 240; i++) |
r23152 | r23153 | |
1760 | 1700 | return; |
1761 | 1701 | } |
1762 | 1702 | |
1763 | | if(!state->m_fxOn && !state->m_windowOn && !(state->m_DISPCNT & DISPCNT_OBJWIN_EN)) |
| 1703 | if(!m_fxOn && !m_windowOn && !(m_DISPCNT & DISPCNT_OBJWIN_EN)) |
1764 | 1704 | { |
1765 | 1705 | submode = 0; |
1766 | 1706 | } |
1767 | | else if(state->m_fxOn && !state->m_windowOn && !(state->m_DISPCNT & DISPCNT_OBJWIN_EN)) |
| 1707 | else if(m_fxOn && !m_windowOn && !(m_DISPCNT & DISPCNT_OBJWIN_EN)) |
1768 | 1708 | { |
1769 | 1709 | submode = 1; |
1770 | 1710 | } |
r23152 | r23153 | |
1773 | 1713 | submode = 2; |
1774 | 1714 | } |
1775 | 1715 | |
1776 | | //printf( "mode = %d, %d\n", state->m_DISPCNT & 7, submode ); |
| 1716 | //printf( "mode = %d, %d\n", m_DISPCNT & 7, submode ); |
1777 | 1717 | |
1778 | | switch(state->m_DISPCNT & 7) |
| 1718 | switch(m_DISPCNT & 7) |
1779 | 1719 | { |
| 1720 | case 0: |
| 1721 | draw_mode0(submode, y, &m_xferscan[0][1024], &m_xferscan[1][1024], &m_xferscan[2][1024], &m_xferscan[3][1024], &m_xferscan[4][1024], &m_xferscan[5][1024], &m_xferscan[6][1024], 0); |
| 1722 | break; |
| 1723 | case 1: |
| 1724 | draw_mode1(submode, y, &m_xferscan[0][1024], &m_xferscan[1][1024], &m_xferscan[2][1024], &m_xferscan[3][1024], &m_xferscan[4][1024], &m_xferscan[5][1024], &m_xferscan[6][1024], 0); |
| 1725 | break; |
| 1726 | case 2: |
| 1727 | draw_mode2(submode, y, &m_xferscan[0][1024], &m_xferscan[1][1024], &m_xferscan[2][1024], &m_xferscan[3][1024], &m_xferscan[4][1024], &m_xferscan[5][1024], &m_xferscan[6][1024], 0); |
| 1728 | break; |
1780 | 1729 | case 3: |
1781 | | bpp = 16; |
| 1730 | draw_mode345(submode, y, &m_xferscan[0][1024], &m_xferscan[1][1024], &m_xferscan[2][1024], &m_xferscan[3][1024], &m_xferscan[4][1024], &m_xferscan[5][1024], &m_xferscan[6][1024], 16); |
1782 | 1731 | break; |
1783 | 1732 | case 4: |
1784 | | bpp = 8; |
| 1733 | draw_mode345(submode, y, &m_xferscan[0][1024], &m_xferscan[1][1024], &m_xferscan[2][1024], &m_xferscan[3][1024], &m_xferscan[4][1024], &m_xferscan[5][1024], &m_xferscan[6][1024], 8); |
1785 | 1734 | break; |
1786 | 1735 | case 5: |
1787 | | bpp = 4; |
| 1736 | draw_mode345(submode, y, &m_xferscan[0][1024], &m_xferscan[1][1024], &m_xferscan[2][1024], &m_xferscan[3][1024], &m_xferscan[4][1024], &m_xferscan[5][1024], &m_xferscan[6][1024], 4); |
1788 | 1737 | break; |
| 1738 | default: |
| 1739 | fatalerror( "Invalid screen mode (6 or 7)!\n" ); |
| 1740 | break; |
1789 | 1741 | } |
1790 | 1742 | |
1791 | | gba_draw_scanline_modes[state->m_DISPCNT & 7][submode](machine, state, y, &state->m_xferscan[0][1024], &state->m_xferscan[1][1024], &state->m_xferscan[2][1024], &state->m_xferscan[3][1024], &state->m_xferscan[4][1024], &state->m_xferscan[5][1024], &state->m_xferscan[6][1024], bpp); |
1792 | | |
1793 | 1743 | for(x = 0; x < 240; x++) |
1794 | 1744 | { |
1795 | | scanline[x] = state->m_xferscan[6][1024 + x] & 0x7fff; |
| 1745 | scanline[x] = m_xferscan[6][1024 + x] & 0x7fff; |
1796 | 1746 | } |
1797 | 1747 | |
1798 | 1748 | return; |
trunk/src/mess/includes/gba.h
r23152 | r23153 | |
3 | 3 | |
4 | 4 | #include "audio/gb.h" |
5 | 5 | #include "machine/intelfsh.h" |
| 6 | #include "machine/gba_slot.h" |
6 | 7 | #include "sound/dac.h" |
7 | | #include "machine/gba_slot.h" |
8 | 8 | |
9 | 9 | #define DISPSTAT_VBL 0x0001 |
10 | 10 | #define DISPSTAT_HBL 0x0002 |
r23152 | r23153 | |
252 | 252 | TIMER_CALLBACK_MEMBER(perform_hbl); |
253 | 253 | TIMER_CALLBACK_MEMBER(perform_scan); |
254 | 254 | |
| 255 | // video related |
| 256 | void draw_scanline(int y); |
| 257 | |
| 258 | void draw_roz_bitmap_scanline(UINT32 *scanline, int ypos, UINT32 enablemask, UINT32 ctrl, INT32 X, INT32 Y, INT32 PA, INT32 PB, INT32 PC, INT32 PD, INT32 *currentx, INT32 *currenty, int changed, int depth); |
| 259 | void draw_roz_scanline(UINT32 *scanline, int ypos, UINT32 enablemask, UINT32 ctrl, INT32 X, INT32 Y, INT32 PA, INT32 PB, INT32 PC, INT32 PD, INT32 *currentx, INT32 *currenty, int changed); |
| 260 | void draw_bg_scanline(UINT32 *scanline, int ypos, UINT32 enablemask, UINT32 ctrl, UINT32 hofs, UINT32 vofs); |
| 261 | void draw_gba_oam_window(UINT32 *scanline, int y); |
| 262 | void draw_gba_oam(UINT32 *scanline, int y); |
| 263 | |
| 264 | inline int is_in_window(int x, int window); |
| 265 | |
| 266 | void draw_mode0(int submode, int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp); |
| 267 | void draw_mode1(int submode, int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp); |
| 268 | void draw_mode2(int submode, int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp); |
| 269 | void draw_mode345(int submode, int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp); |
| 270 | |
| 271 | void draw_mode0_scanline(int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp); |
| 272 | void draw_mode0_scanline_nowindow(int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp); |
| 273 | void draw_mode0_scanline_all(int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp); |
| 274 | void draw_mode1_scanline(int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp); |
| 275 | void draw_mode1_scanline_nowindow(int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp); |
| 276 | void draw_mode1_scanline_all(int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp); |
| 277 | void draw_mode2_scanline(int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp); |
| 278 | void draw_mode2_scanline_nowindow(int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp); |
| 279 | void draw_mode2_scanline_all(int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp); |
| 280 | void draw_roz_bitmap_mode_scanline(int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp); |
| 281 | void draw_roz_bitmap_mode_scanline_nowindow(int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp); |
| 282 | void draw_roz_bitmap_mode_scanline_all(int y, UINT32* line0, UINT32* line1, UINT32* line2, UINT32* line3, UINT32* lineOBJ, UINT32* lineOBJWin, UINT32* lineMix, int bpp); |
| 283 | |
255 | 284 | protected: |
256 | 285 | required_memory_region m_region_maincpu; |
257 | 286 | required_ioport m_io_in0; |
258 | 287 | }; |
259 | 288 | |
260 | | /*----------- defined in video/gba.c -----------*/ |
261 | 289 | |
262 | | void gba_draw_scanline(running_machine &machine, int y); |
263 | | |
264 | 290 | #endif |