src/mess/drivers/mz2500.c
| r9043 | r9044 | |
| 367 | 367 | base_mask = (x_size == 640) ? 0x3f : 0x1f; |
| 368 | 368 | |
| 369 | 369 | count = (cg_reg[0x10]) | ((cg_reg[0x11] & base_mask) << 8); |
| 370 | | count|= (plane & 2) ? 0x10000 : 0x00000; |
| 371 | 370 | wa_reg = (cg_reg[0x12]) | ((cg_reg[0x13] & base_mask) << 8); |
| 372 | | wa_reg|= (plane & 2) ? 0x10000 : 0x00000; |
| 373 | 371 | /* TODO: layer 2 scrolling */ |
| 374 | 372 | s_x = (cg_reg[0x0f] & 0xf); |
| 375 | 373 | cg_interlace = text_font_reg ? 1 : 2; |
| r9043 | r9044 | |
| 390 | 388 | if(res_x < cg_hs || res_x >= cg_he || res_y < cg_vs || res_y >= cg_ve) |
| 391 | 389 | continue; |
| 392 | 390 | |
| 393 | | pen_bit[0] = (vram[count+0x40000+((plane & 1) * 0x2000)]>>(xi)) & 1 ? (pen_mask & 0x01) : 0; //B |
| 394 | | pen_bit[1] = (vram[count+0x44000+((plane & 1) * 0x2000)]>>(xi)) & 1 ? (pen_mask & 0x02) : 0; //R |
| 395 | | pen_bit[2] = (vram[count+0x48000+((plane & 1) * 0x2000)]>>(xi)) & 1 ? (pen_mask & 0x04) : 0; //G |
| 396 | | pen_bit[3] = (vram[count+0x4c000+((plane & 1) * 0x2000)]>>(xi)) & 1 ? (pen_mask & 0x08) : 0; //I |
| 391 | pen_bit[0] = (vram[count+0x40000+((plane & 1) * 0x2000)+(((plane & 2)>>1) * 0x10000)]>>(xi)) & 1 ? (pen_mask & 0x01) : 0; //B |
| 392 | pen_bit[1] = (vram[count+0x44000+((plane & 1) * 0x2000)+(((plane & 2)>>1) * 0x10000)]>>(xi)) & 1 ? (pen_mask & 0x02) : 0; //R |
| 393 | pen_bit[2] = (vram[count+0x48000+((plane & 1) * 0x2000)+(((plane & 2)>>1) * 0x10000)]>>(xi)) & 1 ? (pen_mask & 0x04) : 0; //G |
| 394 | pen_bit[3] = (vram[count+0x4c000+((plane & 1) * 0x2000)+(((plane & 2)>>1) * 0x10000)]>>(xi)) & 1 ? (pen_mask & 0x08) : 0; //I |
| 397 | 395 | |
| 398 | 396 | pen = 0; |
| 399 | 397 | for(pen_i=0;pen_i<4;pen_i++) |
| r9043 | r9044 | |
| 410 | 408 | } |
| 411 | 409 | } |
| 412 | 410 | |
| 413 | | static void draw_cg256_screen(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int pri) |
| 411 | static void draw_cg256_screen(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int plane,int pri) |
| 414 | 412 | { |
| 415 | 413 | static UINT32 count; |
| 416 | 414 | UINT8 *vram = memory_region(machine, "maincpu"); |
| 417 | 415 | UINT8 pen,pen_bit[8]; |
| 418 | 416 | int x,y,xi,pen_i; |
| 417 | UINT32 wa_reg; |
| 418 | UINT8 s_x; |
| 419 | UINT8 base_mask; |
| 419 | 420 | int res_x,res_y; |
| 420 | 421 | UINT8 cg_interlace; |
| 421 | 422 | |
| 422 | | count = 0x40000; |
| 423 | base_mask = 0x3f; //no x_size == 640 |
| 424 | |
| 425 | count = (cg_reg[0x10]) | ((cg_reg[0x11] & base_mask) << 8); |
| 426 | wa_reg = (cg_reg[0x12]) | ((cg_reg[0x13] & base_mask) << 8); |
| 427 | /* TODO: layer 2 scrolling */ |
| 428 | s_x = (cg_reg[0x0f] & 0xf); |
| 423 | 429 | cg_interlace = text_font_reg ? 1 : 2; |
| 424 | 430 | |
| 425 | 431 | for(y=0;y<200;y++) |
| r9043 | r9044 | |
| 428 | 434 | { |
| 429 | 435 | for(xi=0;xi<8;xi++) |
| 430 | 436 | { |
| 431 | | res_x = x+xi; |
| 437 | res_x = x+xi+s_x; |
| 432 | 438 | res_y = y; |
| 433 | 439 | |
| 434 | 440 | /* check window boundaries */ |
| 435 | 441 | if(res_x < cg_hs || res_x >= cg_he || res_y < cg_vs || res_y >= cg_ve) |
| 436 | 442 | continue; |
| 437 | 443 | |
| 438 | | pen_bit[0] = (vram[count + 0x2000]>>(xi)) & 1 ? (cg_reg[0x18] & 0x10) : 0; // B1 |
| 439 | | pen_bit[1] = (vram[count + 0x0000]>>(xi)) & 1 ? (cg_reg[0x18] & 0x01) : 0; // B0 |
| 440 | | pen_bit[2] = (vram[count + 0x6000]>>(xi)) & 1 ? (cg_reg[0x18] & 0x20) : 0; // R1 |
| 441 | | pen_bit[3] = (vram[count + 0x4000]>>(xi)) & 1 ? (cg_reg[0x18] & 0x02) : 0; // R0 |
| 442 | | pen_bit[4] = (vram[count + 0xa000]>>(xi)) & 1 ? (cg_reg[0x18] & 0x40) : 0; // G1 |
| 443 | | pen_bit[5] = (vram[count + 0x8000]>>(xi)) & 1 ? (cg_reg[0x18] & 0x04) : 0; // G0 |
| 444 | | pen_bit[6] = (vram[count + 0xe000]>>(xi)) & 1 ? (cg_reg[0x18] & 0x80) : 0; // I1 |
| 445 | | pen_bit[7] = (vram[count + 0xc000]>>(xi)) & 1 ? (cg_reg[0x18] & 0x08) : 0; // I0 |
| 444 | pen_bit[0] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0x2000]>>(xi)) & 1 ? (cg_reg[0x18] & 0x10) : 0; // B1 |
| 445 | pen_bit[1] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0x0000]>>(xi)) & 1 ? (cg_reg[0x18] & 0x01) : 0; // B0 |
| 446 | pen_bit[2] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0x6000]>>(xi)) & 1 ? (cg_reg[0x18] & 0x20) : 0; // R1 |
| 447 | pen_bit[3] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0x4000]>>(xi)) & 1 ? (cg_reg[0x18] & 0x02) : 0; // R0 |
| 448 | pen_bit[4] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0xa000]>>(xi)) & 1 ? (cg_reg[0x18] & 0x40) : 0; // G1 |
| 449 | pen_bit[5] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0x8000]>>(xi)) & 1 ? (cg_reg[0x18] & 0x04) : 0; // G0 |
| 450 | pen_bit[6] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0xe000]>>(xi)) & 1 ? (cg_reg[0x18] & 0x80) : 0; // I1 |
| 451 | pen_bit[7] = (vram[count + 0x40000 + (((plane & 2)>>1) * 0x10000) + 0xc000]>>(xi)) & 1 ? (cg_reg[0x18] & 0x08) : 0; // I0 |
| 446 | 452 | |
| 447 | 453 | pen = 0; |
| 448 | 454 | for(pen_i=0;pen_i<8;pen_i++) |
| r9043 | r9044 | |
| 452 | 458 | mz2500_draw_pixel(machine,bitmap,res_x,res_y,(clut256[pen] & 0xff)+0x100,scr_x_size == 640,cg_interlace == 2); |
| 453 | 459 | } |
| 454 | 460 | count++; |
| 461 | count&=((base_mask<<8) | 0xff); |
| 462 | if(count > wa_reg) |
| 463 | count = 0; |
| 455 | 464 | } |
| 456 | 465 | } |
| 457 | 466 | } |
| r9043 | r9044 | |
| 514 | 523 | draw_cg16_screen(machine,bitmap,cliprect,0,640,pri); |
| 515 | 524 | break; |
| 516 | 525 | case 0x1d: |
| 517 | | draw_cg256_screen(machine,bitmap,cliprect,pri); |
| 526 | draw_cg256_screen(machine,bitmap,cliprect,0,pri); |
| 518 | 527 | break; |
| 519 | 528 | case 0x97: |
| 520 | 529 | draw_cg16_screen(machine,bitmap,cliprect,2,640,pri); |