src/mess/drivers/mz2500.c
| r9030 | r9031 | |
| 199 | 199 | if(pen) |
| 200 | 200 | { |
| 201 | 201 | if((y*8+yi-s_y) >= 0 && (y*8+yi-s_y) < 200*y_step) |
| 202 | | mz2500_draw_pixel(machine,bitmap,x*8+xi,y*8+yi-s_y,pen+(pal_select ? 0x000 : 0x208),0,0); |
| 202 | mz2500_draw_pixel(machine,bitmap,x*8+xi,y*8+yi-s_y,pen+(pal_select ? 0x00 : 0x18),0,0); |
| 203 | 203 | } |
| 204 | 204 | } |
| 205 | 205 | } |
| r9030 | r9031 | |
| 281 | 281 | if(wid_40) // 640 x 200 with 40 x 25, double x size |
| 282 | 282 | { |
| 283 | 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 : 0x208),1,0); |
| 284 | mz2500_draw_pixel(machine,bitmap,x*8+xi,y*8+yi-s_y,pen+(pal_select ? 0x000 : 0x18),1,0); |
| 285 | 285 | } |
| 286 | 286 | else |
| 287 | 287 | { |
| 288 | 288 | if((y*8+yi-s_y) >= 0 && (y*8+yi-s_y) < 200*y_step) |
| 289 | | mz2500_draw_pixel(machine,bitmap,x*8+xi,y*8+yi-s_y,pen+(pal_select ? 0x000 : 0x208),0,0); |
| 289 | mz2500_draw_pixel(machine,bitmap,x*8+xi,y*8+yi-s_y,pen+(pal_select ? 0x000 : 0x18),0,0); |
| 290 | 290 | } |
| 291 | 291 | } |
| 292 | 292 | } |
| r9030 | r9031 | |
| 299 | 299 | } |
| 300 | 300 | } |
| 301 | 301 | |
| 302 | | static void draw_tv_screen(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect) |
| 303 | | { |
| 304 | | UINT16 base_addr; |
| 305 | | |
| 306 | | base_addr = text_reg[1] | ((text_reg[2] & 0x7) << 8); |
| 307 | | |
| 308 | | // popmessage("%02x",text_reg[9]); |
| 309 | | |
| 310 | | if(text_col_size) |
| 311 | | draw_80x25(machine,bitmap,cliprect,base_addr); |
| 312 | | else |
| 313 | | { |
| 314 | | int tv_mode; |
| 315 | | |
| 316 | | tv_mode = text_reg[0] >> 2; |
| 317 | | |
| 318 | | switch(tv_mode & 3) |
| 319 | | { |
| 320 | | // case 0: mixed 6bpp mode |
| 321 | | case 1: |
| 322 | | draw_40x25(machine,bitmap,cliprect,0,base_addr); |
| 323 | | break; |
| 324 | | case 2: |
| 325 | | draw_40x25(machine,bitmap,cliprect,1,base_addr); |
| 326 | | break; |
| 327 | | case 3: |
| 328 | | draw_40x25(machine,bitmap,cliprect,0,base_addr); |
| 329 | | draw_40x25(machine,bitmap,cliprect,1,base_addr); |
| 330 | | break; |
| 331 | | //default: popmessage("%02x %02x %02x",tv_mode & 3,text_reg[1],text_reg[2]); break; |
| 332 | | } |
| 333 | | } |
| 334 | | } |
| 335 | | |
| 336 | 302 | static void draw_cg4_screen(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int pri) |
| 337 | 303 | { |
| 338 | 304 | static UINT32 count; |
| r9030 | r9031 | |
| 421 | 387 | if(cg_interlace == 2) |
| 422 | 388 | { |
| 423 | 389 | if(pri == ((clut16[pen] & 0x10) >> 4)) |
| 424 | | mz2500_draw_pixel(machine,bitmap,res_x,res_y,(clut16[pen] & 0x0f)+0x200,0,1); |
| 390 | mz2500_draw_pixel(machine,bitmap,res_x,res_y,(clut16[pen] & 0x0f)+0x10,0,1); |
| 425 | 391 | |
| 426 | 392 | } |
| 427 | 393 | else |
| 428 | 394 | { |
| 429 | 395 | if(pri == ((clut16[pen] & 0x10) >> 4)) |
| 430 | | mz2500_draw_pixel(machine,bitmap,res_x,res_y,(clut16[pen] & 0x0f)+0x200,0,0); |
| 396 | mz2500_draw_pixel(machine,bitmap,res_x,res_y,(clut16[pen] & 0x0f)+0x10,0,0); |
| 431 | 397 | } |
| 432 | 398 | } |
| 433 | 399 | count++; |
| r9030 | r9031 | |
| 492 | 458 | } |
| 493 | 459 | } |
| 494 | 460 | |
| 461 | static void draw_tv_screen(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect) |
| 462 | { |
| 463 | UINT16 base_addr; |
| 464 | |
| 465 | base_addr = text_reg[1] | ((text_reg[2] & 0x7) << 8); |
| 466 | |
| 467 | // popmessage("%02x",text_reg[9]); |
| 468 | |
| 469 | if(text_col_size) |
| 470 | draw_80x25(machine,bitmap,cliprect,base_addr); |
| 471 | else |
| 472 | { |
| 473 | int tv_mode; |
| 474 | |
| 475 | tv_mode = text_reg[0] >> 2; |
| 476 | |
| 477 | switch(tv_mode & 3) |
| 478 | { |
| 479 | // case 0: mixed 6bpp mode |
| 480 | case 1: |
| 481 | draw_40x25(machine,bitmap,cliprect,0,base_addr); |
| 482 | break; |
| 483 | case 2: |
| 484 | draw_40x25(machine,bitmap,cliprect,1,base_addr); |
| 485 | break; |
| 486 | case 3: |
| 487 | draw_40x25(machine,bitmap,cliprect,0,base_addr); |
| 488 | draw_40x25(machine,bitmap,cliprect,1,base_addr); |
| 489 | break; |
| 490 | //default: popmessage("%02x %02x %02x",tv_mode & 3,text_reg[1],text_reg[2]); break; |
| 491 | } |
| 492 | } |
| 493 | } |
| 494 | |
| 495 | 495 | static void draw_cg_screen(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int pri) |
| 496 | 496 | { |
| 497 | 497 | switch(cg_reg[0x0e]) |
| r9030 | r9031 | |
| 525 | 525 | { |
| 526 | 526 | bitmap_fill(bitmap, cliprect, screen->machine->pens[0]); //TODO: correct? |
| 527 | 527 | |
| 528 | | //popmessage("%02x",cg_mask); |
| 529 | | |
| 530 | 528 | draw_cg_screen(screen->machine,bitmap,cliprect,0); |
| 531 | 529 | draw_tv_screen(screen->machine,bitmap,cliprect); |
| 532 | 530 | draw_cg_screen(screen->machine,bitmap,cliprect,1); |
| r9030 | r9031 | |
| 907 | 905 | |
| 908 | 906 | palette_set_color_rgb(space->machine, i+0x100,pal3bit(r),pal3bit(g),pal3bit(b)); |
| 909 | 907 | } |
| 910 | | |
| 911 | 908 | } |
| 912 | 909 | if(text_reg_index >= 0x80 && text_reg_index <= 0x8f) //Bitmap 16 clut registers |
| 913 | 910 | { |
| r9030 | r9031 | |
| 1047 | 1044 | //printf("%02x\n",data); |
| 1048 | 1045 | } |
| 1049 | 1046 | |
| 1050 | | /* sets first 16 color entries of the 4096 palette bank */ |
| 1047 | /* sets 16 color entries out of 4096 possible combinations */ |
| 1051 | 1048 | static WRITE8_HANDLER( palette4096_io_w ) |
| 1052 | 1049 | { |
| 1053 | 1050 | static UINT8 r[16],g[16],b[16]; |
| r9030 | r9031 | |
| 1065 | 1062 | b[pal_entry] = data & 0x0f; |
| 1066 | 1063 | } |
| 1067 | 1064 | |
| 1068 | | palette_set_color_rgb(space->machine, pal_entry+0x200,pal4bit(r[pal_entry]),pal4bit(g[pal_entry]),pal4bit(b[pal_entry])); |
| 1065 | palette_set_color_rgb(space->machine, pal_entry+0x10,pal4bit(r[pal_entry]),pal4bit(g[pal_entry]),pal4bit(b[pal_entry])); |
| 1069 | 1066 | } |
| 1070 | 1067 | |
| 1071 | 1068 | static READ8_DEVICE_HANDLER( mz2500_wd17xx_r ) |
| r9030 | r9031 | |
| 1804 | 1801 | { |
| 1805 | 1802 | int i; |
| 1806 | 1803 | |
| 1807 | | /*set up 16 colors (TODO) */ |
| 1804 | for(i=0;i<0x200;i++) |
| 1805 | palette_set_color_rgb(machine, i,pal1bit(0),pal1bit(0),pal1bit(0)); |
| 1806 | |
| 1807 | /* set up 8 colors (PCG) */ |
| 1808 | 1808 | for(i=0;i<8;i++) |
| 1809 | 1809 | palette_set_color_rgb(machine, i,pal1bit((i & 2)>>1),pal1bit((i & 4)>>2),pal1bit((i & 1)>>0)); |
| 1810 | 1810 | |
| 1811 | | /* set up 256 colors (TODO) */ |
| 1811 | /* set up 16 colors (PCG / CG) */ |
| 1812 | 1812 | |
| 1813 | | /* set up 4096 colors */ |
| 1814 | | // ... |
| 1813 | /* set up 256 colors (CG) */ |
| 1814 | { |
| 1815 | int r,g,b; |
| 1816 | |
| 1817 | for(i = 0;i < 0x100;i++) |
| 1818 | { |
| 1819 | int bit0,bit1,bit2; |
| 1820 | |
| 1821 | bit0 = pal_256_param(i,0) ? 1 : 0; |
| 1822 | bit1 = i & 0x01 ? 2 : 0; |
| 1823 | bit2 = i & 0x10 ? 4 : 0; |
| 1824 | b = bit0|bit1|bit2; |
| 1825 | bit0 = pal_256_param(i,0) ? 1 : 0; |
| 1826 | bit1 = i & 0x02 ? 2 : 0; |
| 1827 | bit2 = i & 0x20 ? 4 : 0; |
| 1828 | r = bit0|bit1|bit2; |
| 1829 | bit0 = pal_256_param(i,0) ? 1 : 0; |
| 1830 | bit1 = i & 0x04 ? 2 : 0; |
| 1831 | bit2 = i & 0x40 ? 4 : 0; |
| 1832 | g = bit0|bit1|bit2; |
| 1833 | |
| 1834 | palette_set_color_rgb(machine, i+0x100,pal3bit(r),pal3bit(g),pal3bit(b)); |
| 1835 | } |
| 1836 | } |
| 1815 | 1837 | } |
| 1816 | 1838 | |
| 1817 | 1839 | /* PIT8253 Interface */ |
| r9030 | r9031 | |
| 1877 | 1899 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 1878 | 1900 | //MDRV_SCREEN_RAW_PARAMS(XTAL_17_73447MHz/2, 568, 0, 320, 312, 0, 200) |
| 1879 | 1901 | MDRV_SCREEN_RAW_PARAMS(XTAL_17_73447MHz, 640+108, 0, 320, 480, 0, 200) //TODO: fix this |
| 1880 | | MDRV_PALETTE_LENGTH(0x200+4096) // TODO: it needs more than this |
| 1902 | MDRV_PALETTE_LENGTH(0x200) |
| 1881 | 1903 | MDRV_PALETTE_INIT(mz2500) |
| 1882 | 1904 | |
| 1883 | 1905 | MDRV_GFXDECODE(mz2500) |