src/mess/drivers/mz2500.c
| r9034 | r9035 | |
| 9 | 9 | - Find real CRTC registers |
| 10 | 10 | - Some games doesn't set proper registers if you have interlace enabled, is there any real reason? |
| 11 | 11 | - Implement external ROM hook-up; |
| 12 | - Add remaining missing peripherals, SIO, HDD and w1300a network; |
| 12 | 13 | - FDC loading without the IPLPRO doesn't work at all, why? |
| 13 | 14 | - reverse / blanking tvram attributes; |
| 14 | | - there's a soft reset PCG init bug now (try for example Eiyuu Densetsu Saga then Excite Bike); |
| 15 | - there's a soft reset PCG init bug now (try for example Eiyuu Densetsu Saga then Excite Bike), MAME / MESS core bug? |
| 15 | 16 | - clean-ups! ^^' |
| 16 | 17 | |
| 17 | 18 | per-game/program specific TODO: |
| r9034 | r9035 | |
| 85 | 86 | static UINT8 text_col_size, text_font_reg; |
| 86 | 87 | static UINT8 pal_select; |
| 87 | 88 | static UINT16 cg_vs,cg_ve,cg_hs,cg_he; //CG window parameters |
| 89 | static UINT16 tv_vs,tv_ve,tv_hs,tv_he; //TV window parameters |
| 88 | 90 | static UINT8 cg_latch[4]; |
| 89 | 91 | static UINT8 cg_reg_index; |
| 90 | 92 | static UINT8 cg_reg[0x20]; |
| r9034 | r9035 | |
| 183 | 185 | { |
| 184 | 186 | UINT8 pen_bit[3],pen; |
| 185 | 187 | |
| 188 | int res_x,res_y; |
| 189 | |
| 190 | res_x = x*8+xi; |
| 191 | res_y = y*8+yi-s_y; |
| 192 | |
| 193 | /* check TV window boundaries */ |
| 194 | //if(res_x < tv_hs || res_x >= tv_he || res_y < tv_vs || res_y >= tv_ve) |
| 195 | // continue; |
| 196 | |
| 186 | 197 | if(gfx_sel & 0x8) |
| 187 | 198 | { |
| 188 | 199 | pen_bit[0] = ((gfx_data[tile*8+yi+0x1800]>>(7-xi)) & 1) ? 4 : 0; //G |
| r9034 | r9035 | |
| 200 | 211 | |
| 201 | 212 | if(pen) |
| 202 | 213 | { |
| 203 | | if((y*8+yi-s_y) >= 0 && (y*8+yi-s_y) < 200*y_step) |
| 204 | | mz2500_draw_pixel(machine,bitmap,x*8+xi,y*8+yi-s_y,pen+(pal_select ? 0x00 : 0x18),0,0); |
| 214 | if((res_y) >= 0 && (res_y) < 200*y_step) |
| 215 | mz2500_draw_pixel(machine,bitmap,res_x,res_y,pen+(pal_select ? 0x00 : 0x18),0,0); |
| 205 | 216 | } |
| 206 | 217 | } |
| 207 | 218 | } |
| r9034 | r9035 | |
| 264 | 275 | for(xi=0;xi<8;xi++) |
| 265 | 276 | { |
| 266 | 277 | UINT8 pen_bit[3],pen; |
| 278 | int res_x,res_y; |
| 267 | 279 | |
| 280 | res_x = x*8+xi; |
| 281 | res_y = y*8+yi-s_y; |
| 282 | |
| 283 | /* check TV window boundaries */ |
| 284 | //if(res_x < tv_hs || res_x >= tv_he || res_y < tv_vs || res_y >= tv_ve) |
| 285 | // continue; |
| 286 | |
| 268 | 287 | if(gfx_sel & 0x8) |
| 269 | 288 | { |
| 270 | 289 | pen_bit[0] = ((gfx_data[tile*8+yi+0x1800]>>(7-xi)) & 1) ? 4 : 0; //G |
| r9034 | r9035 | |
| 280 | 299 | |
| 281 | 300 | if(pen) |
| 282 | 301 | { |
| 283 | | if((y*8+yi-s_y) >= 0 && (y*8+yi-s_y) < 200*y_step) |
| 284 | | mz2500_draw_pixel(machine,bitmap,x*8+xi,y*8+yi-s_y,pen+(pal_select ? 0x000 : 0x18),scr_x_size == 640,0); |
| 302 | if((res_y) >= 0 && (res_y) < 200*y_step) |
| 303 | mz2500_draw_pixel(machine,bitmap,res_x,res_y,pen+(pal_select ? 0x000 : 0x18),scr_x_size == 640,0); |
| 285 | 304 | } |
| 286 | 305 | } |
| 287 | 306 | } |
| r9034 | r9035 | |
| 353 | 372 | s_x = (cg_reg[0x0f] & 0xf); |
| 354 | 373 | cg_interlace = text_font_reg ? 1 : 2; |
| 355 | 374 | |
| 356 | | popmessage("%d %d %d %d",cg_hs,cg_he,cg_vs,cg_ve); |
| 375 | // popmessage("%d %d %d %d",cg_hs,cg_he,cg_vs,cg_ve); |
| 357 | 376 | |
| 358 | 377 | for(y=0;y<200;y++) |
| 359 | 378 | { |
| r9034 | r9035 | |
| 441 | 460 | base_addr = text_reg[1] | ((text_reg[2] & 0x7) << 8); |
| 442 | 461 | |
| 443 | 462 | // popmessage("%02x",text_reg[9]); |
| 463 | // popmessage("%d %d %d %d",tv_hs,(tv_he),tv_vs,(tv_ve)); |
| 444 | 464 | |
| 445 | 465 | if(text_col_size) |
| 446 | 466 | draw_80x25(machine,bitmap,cliprect,base_addr); |
| r9034 | r9035 | |
| 528 | 548 | visarea.max_x = scr_x_size - 1; |
| 529 | 549 | visarea.max_y = scr_y_size - 1; |
| 530 | 550 | |
| 551 | //popmessage("%d %d %d %d %02x",vs,ve,hs,he,cg_reg[0x0e]); |
| 552 | |
| 553 | machine->primary_screen->configure(720, 480, visarea, machine->primary_screen->frame_period().attoseconds); |
| 554 | |
| 555 | /* calculate CG window parameters here */ |
| 531 | 556 | cg_vs = (cg_reg[0x08]) | ((cg_reg[0x09]<<8) & 1); |
| 532 | 557 | cg_ve = (cg_reg[0x0a]) | ((cg_reg[0x0b]<<8) & 1); |
| 533 | 558 | cg_hs = ((cg_reg[0x0c] & 0x7f)*8); |
| r9034 | r9035 | |
| 539 | 564 | cg_he /= 2; |
| 540 | 565 | } |
| 541 | 566 | |
| 542 | | //popmessage("%d %d %d %d %02x",vs,ve,hs,he,cg_reg[0x0e]); |
| 567 | /* calculate TV window parameters here */ |
| 568 | { |
| 569 | static int x_offs,y_offs; |
| 543 | 570 | |
| 544 | | machine->primary_screen->configure(720, 480, visarea, machine->primary_screen->frame_period().attoseconds); |
| 571 | switch((text_font_reg|text_col_size<<1) & 3) |
| 572 | { |
| 573 | case 0: x_offs = 64; break; |
| 574 | case 1: x_offs = 80; break; |
| 575 | case 2: x_offs = 72; break; |
| 576 | case 3: x_offs = 72; break; |
| 577 | } |
| 578 | //printf("%d %d %d\n",x_offs,(text_reg[7] & 0x7f) * 8,(text_reg[8] & 0x7f)* 8); |
| 579 | |
| 580 | y_offs = text_font_reg ? 76 : 34; |
| 581 | |
| 582 | tv_hs = ((text_reg[7] & 0x7f)*8) - x_offs; |
| 583 | tv_he = ((text_reg[8] & 0x7f)*8) - x_offs; |
| 584 | tv_vs = (text_reg[3]*2) - y_offs; |
| 585 | tv_ve = (text_reg[5]*2) - y_offs; |
| 586 | |
| 587 | if(scr_x_size == 320) |
| 588 | { |
| 589 | tv_hs /= 2; |
| 590 | tv_he /= 2; |
| 591 | } |
| 592 | |
| 593 | if(scr_y_size == 200) |
| 594 | { |
| 595 | tv_vs /= 2; |
| 596 | tv_ve /= 2; |
| 597 | } |
| 598 | } |
| 545 | 599 | } |
| 546 | 600 | |
| 547 | 601 | static UINT8 mz2500_cg_latch_compare(void) |
| r9034 | r9035 | |
| 888 | 942 | #endif |
| 889 | 943 | //popmessage("%d %02x %d %02x %d %d",text_reg[3],text_reg[4],text_reg[5],text_reg[6],text_reg[7]*8,text_reg[8]*8); |
| 890 | 944 | |
| 945 | mz2500_reconfigure_screen(space->machine); |
| 946 | |
| 891 | 947 | if(text_reg_index == 0x0a) // set 256 color palette |
| 892 | 948 | { |
| 893 | 949 | int i,r,g,b; |