src/mess/drivers/mz2500.c
| r9041 | r9042 | |
| 92 | 92 | static UINT16 clut256[0x100]; |
| 93 | 93 | static UINT8 cg_mask; |
| 94 | 94 | static int scr_x_size,scr_y_size; |
| 95 | static UINT8 cg_clear_flag; |
| 95 | 96 | |
| 96 | 97 | static VIDEO_START( mz2500 ) |
| 97 | 98 | { |
| r9041 | r9042 | |
| 366 | 367 | base_mask = (x_size == 640) ? 0x3f : 0x1f; |
| 367 | 368 | |
| 368 | 369 | count = (cg_reg[0x10]) | ((cg_reg[0x11] & base_mask) << 8); |
| 370 | count|= (plane & 2) ? 0x10000 : 0x00000; |
| 369 | 371 | wa_reg = (cg_reg[0x12]) | ((cg_reg[0x13] & base_mask) << 8); |
| 372 | wa_reg|= (plane & 2) ? 0x10000 : 0x00000; |
| 370 | 373 | /* TODO: layer 2 scrolling */ |
| 371 | 374 | s_x = (cg_reg[0x0f] & 0xf); |
| 372 | 375 | cg_interlace = text_font_reg ? 1 : 2; |
| r9041 | r9042 | |
| 387 | 390 | if(res_x < cg_hs || res_x >= cg_he || res_y < cg_vs || res_y >= cg_ve) |
| 388 | 391 | continue; |
| 389 | 392 | |
| 390 | | pen_bit[0] = (vram[count+0x40000+(plane * 0x2000)]>>(xi)) & 1 ? (pen_mask & 0x01) : 0; //B |
| 391 | | pen_bit[1] = (vram[count+0x44000+(plane * 0x2000)]>>(xi)) & 1 ? (pen_mask & 0x02) : 0; //R |
| 392 | | pen_bit[2] = (vram[count+0x48000+(plane * 0x2000)]>>(xi)) & 1 ? (pen_mask & 0x04) : 0; //G |
| 393 | | pen_bit[3] = (vram[count+0x4c000+(plane * 0x2000)]>>(xi)) & 1 ? (pen_mask & 0x08) : 0; //I |
| 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 |
| 394 | 397 | |
| 395 | 398 | pen = 0; |
| 396 | 399 | for(pen_i=0;pen_i<4;pen_i++) |
| r9041 | r9042 | |
| 513 | 516 | case 0x1d: |
| 514 | 517 | draw_cg256_screen(machine,bitmap,cliprect,pri); |
| 515 | 518 | break; |
| 519 | case 0x97: |
| 520 | draw_cg16_screen(machine,bitmap,cliprect,2,640,pri); |
| 521 | break; |
| 516 | 522 | default: |
| 517 | 523 | popmessage("Unsupported CG mode %02x, contact MESS dev",cg_reg[0x0e]); |
| 518 | 524 | break; |
| r9041 | r9042 | |
| 1159 | 1165 | { |
| 1160 | 1166 | static UINT8 vblank_bit; |
| 1161 | 1167 | |
| 1162 | | // ---- ---x clear flag |
| 1163 | | vblank_bit = space->machine->primary_screen->vblank() ? 0 : 0x80; |
| 1168 | vblank_bit = space->machine->primary_screen->vblank() ? 0 : 0x80 | cg_clear_flag; |
| 1164 | 1169 | |
| 1165 | 1170 | return vblank_bit; |
| 1166 | 1171 | } |
| r9041 | r9042 | |
| 1227 | 1232 | { |
| 1228 | 1233 | UINT32 i; |
| 1229 | 1234 | UINT8 *vram = memory_region(space->machine, "maincpu"); |
| 1235 | UINT32 layer_bank; |
| 1230 | 1236 | |
| 1237 | layer_bank = (cg_reg[0x0e] & 0x80) ? 0x10000 : 0x00000; |
| 1238 | |
| 1231 | 1239 | /* TODO: this isn't yet 100% accurate */ |
| 1232 | 1240 | if(cg_reg[0x05] & 1) |
| 1233 | 1241 | { |
| 1234 | 1242 | for(i=0;i<0x4000;i++) |
| 1235 | | vram[i+0x40000] = 0x00; //clear B |
| 1243 | vram[i+0x40000+layer_bank] = 0x00; //clear B |
| 1236 | 1244 | } |
| 1237 | 1245 | if(cg_reg[0x05] & 2) |
| 1238 | 1246 | { |
| 1239 | 1247 | for(i=0;i<0x4000;i++) |
| 1240 | | vram[i+0x44000] = 0x00; //clear R |
| 1248 | vram[i+0x44000+layer_bank] = 0x00; //clear R |
| 1241 | 1249 | } |
| 1242 | 1250 | if(cg_reg[0x05] & 4) |
| 1243 | 1251 | { |
| 1244 | 1252 | for(i=0;i<0x4000;i++) |
| 1245 | | vram[i+0x48000] = 0x00; //clear G |
| 1253 | vram[i+0x48000+layer_bank] = 0x00; //clear G |
| 1246 | 1254 | } |
| 1247 | 1255 | if(cg_reg[0x05] & 8) |
| 1248 | 1256 | { |
| 1249 | 1257 | for(i=0;i<0x4000;i++) |
| 1250 | | vram[i+0x4c000] = 0x00; //clear I |
| 1258 | vram[i+0x4c000+layer_bank] = 0x00; //clear I |
| 1251 | 1259 | } |
| 1260 | cg_clear_flag = 1; |
| 1252 | 1261 | } |
| 1253 | 1262 | |
| 1254 | 1263 | { |
| r9041 | r9042 | |
| 1622 | 1631 | irq_mask[i] = 0; |
| 1623 | 1632 | |
| 1624 | 1633 | kanji_bank = 0; |
| 1634 | |
| 1635 | cg_clear_flag = 0; |
| 1625 | 1636 | } |
| 1626 | 1637 | |
| 1627 | 1638 | static const gfx_layout mz2500_cg_layout = |
| r9041 | r9042 | |
| 1692 | 1703 | { |
| 1693 | 1704 | if(irq_mask[0]) |
| 1694 | 1705 | cpu_set_input_line_and_vector(device, 0, HOLD_LINE, irq_vector[0]); |
| 1706 | |
| 1707 | cg_clear_flag = 0; |
| 1695 | 1708 | } |
| 1696 | 1709 | |
| 1697 | 1710 | static READ8_DEVICE_HANDLER( mz2500_porta_r ) |