src/mess/drivers/pc8801.c
| r10082 | r10083 | |
| 27 | 27 | - Alphos: test case for text VRAM attributes; |
| 28 | 28 | - Alphos: text VRAM garbage during gameplay; |
| 29 | 29 | - Alphos: background is supposed to be blue? |
| 30 | - Balance of Power: attempt to use the SIO port for mouse polling, worked around for now; |
| 30 | 31 | - Bokosuka Wars: doesn't boot, floppy issue; |
| 31 | 32 | - Grobda: palette is ugly; |
| 32 | 33 | - Xevious: game is too fast |
| r10082 | r10083 | |
| 220 | 221 | return 0; |
| 221 | 222 | } |
| 222 | 223 | |
| 223 | | static void draw_bitmap_3bpp_h200(running_machine *machine, bitmap_t *bitmap) |
| 224 | static void draw_bitmap_3bpp(running_machine *machine, bitmap_t *bitmap) |
| 224 | 225 | { |
| 225 | 226 | int x,y,xi; |
| 226 | 227 | UINT32 count; |
| r10082 | r10083 | |
| 250 | 251 | } |
| 251 | 252 | } |
| 252 | 253 | |
| 253 | | static void draw_bitmap_1bpp_h400(running_machine *machine, bitmap_t *bitmap) |
| 254 | static void draw_bitmap_1bpp(running_machine *machine, bitmap_t *bitmap) |
| 254 | 255 | { |
| 255 | | popmessage("%02x VIDEO MODE",gfx_ctrl); |
| 256 | int x,y,xi; |
| 257 | UINT32 count; |
| 258 | UINT8 *gvram = machine->region("maincpu")->base() + GRAM_BASE; |
| 256 | 259 | |
| 257 | | // ... |
| 260 | count = 0; |
| 261 | |
| 262 | for(y=0;y<200;y++) |
| 263 | { |
| 264 | for(x=0;x<640;x+=8) |
| 265 | { |
| 266 | for(xi=0;xi<8;xi++) |
| 267 | { |
| 268 | int pen; |
| 269 | |
| 270 | /* TODO: dunno if layer_mask is correct here */ |
| 271 | if(!(layer_mask & 2)) { pen = ((gvram[count+0x0000] >> (7-xi)) & 1) << 0; } |
| 272 | |
| 273 | *BITMAP_ADDR16(bitmap, y, x+xi) = machine->pens[pen ? 7 : 0]; |
| 274 | } |
| 275 | |
| 276 | count++; |
| 277 | } |
| 278 | } |
| 279 | |
| 280 | count = 0; |
| 281 | |
| 282 | if(!(gfx_ctrl & 1)) // 400 lines |
| 283 | { |
| 284 | for(y=200;y<400;y++) |
| 285 | { |
| 286 | for(x=0;x<640;x+=8) |
| 287 | { |
| 288 | for(xi=0;xi<8;xi++) |
| 289 | { |
| 290 | int pen; |
| 291 | |
| 292 | /* TODO: dunno if layer_mask is correct here */ |
| 293 | if(!(layer_mask & 4)) { pen = ((gvram[count+0x4000] >> (7-xi)) & 1) << 0; } |
| 294 | |
| 295 | *BITMAP_ADDR16(bitmap, y, x+xi) = machine->pens[pen ? 7 : 0]; |
| 296 | } |
| 297 | |
| 298 | count++; |
| 299 | } |
| 300 | } |
| 301 | } |
| 258 | 302 | } |
| 259 | 303 | |
| 260 | 304 | static VIDEO_UPDATE( pc8801 ) |
| r10082 | r10083 | |
| 268 | 312 | if(gfx_ctrl & 8) |
| 269 | 313 | { |
| 270 | 314 | if(gfx_ctrl & 0x10) |
| 271 | | draw_bitmap_3bpp_h200(screen->machine,bitmap); |
| 315 | draw_bitmap_3bpp(screen->machine,bitmap); |
| 272 | 316 | else |
| 273 | | draw_bitmap_1bpp_h400(screen->machine,bitmap); |
| 317 | draw_bitmap_1bpp(screen->machine,bitmap); |
| 274 | 318 | } |
| 275 | 319 | |
| 276 | 320 | if(!(layer_mask & 1) && dmac_mode & 4 && crtc.status & 0x10 && crtc.irq_mask == 3) |
| r10082 | r10083 | |
| 663 | 707 | bankw[1] = pc8801_bankswitch_1_w(space->machine); |
| 664 | 708 | } |
| 665 | 709 | |
| 710 | static void pc8801_dynamic_res_change(running_machine *machine) |
| 711 | { |
| 712 | rectangle visarea; |
| 713 | |
| 714 | visarea.min_x = 0; |
| 715 | visarea.min_y = 0; |
| 716 | visarea.max_x = 640 - 1; |
| 717 | visarea.max_y = ((gfx_ctrl & 1) ? 200 : 400) - 1; |
| 718 | |
| 719 | /* low screen res if graphic screen is disabled */ |
| 720 | if((gfx_ctrl & 0x8) == 0) |
| 721 | visarea.max_y = 200 - 1; |
| 722 | |
| 723 | machine->primary_screen->configure(640, 480, visarea, machine->primary_screen->frame_period().attoseconds); |
| 724 | } |
| 725 | |
| 666 | 726 | static WRITE8_HANDLER( pc8801_gfx_ctrl_w ) |
| 667 | 727 | { |
| 668 | 728 | /* |
| r10082 | r10083 | |
| 679 | 739 | bankr[1] = pc8801_bankswitch_1_r(space->machine); |
| 680 | 740 | bankw[0] = pc8801_bankswitch_0_w(space->machine); |
| 681 | 741 | bankw[1] = pc8801_bankswitch_1_w(space->machine); |
| 742 | |
| 743 | pc8801_dynamic_res_change(space->machine); |
| 682 | 744 | } |
| 683 | 745 | |
| 684 | 746 | static READ8_HANDLER( pc8801_vram_select_r ) |
| r10082 | r10083 | |
| 919 | 981 | printf("Write to PCG-8100 %02x %02x\n",offset,data); |
| 920 | 982 | } |
| 921 | 983 | |
| 984 | /* Balance of Power temp work-around */ |
| 985 | static READ8_HANDLER( sio_status_r ) |
| 986 | { |
| 987 | return 0; |
| 988 | } |
| 989 | |
| 922 | 990 | static ADDRESS_MAP_START( pc8801_io, ADDRESS_SPACE_IO, 8 ) |
| 923 | 991 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 924 | 992 | ADDRESS_MAP_UNMAP_HIGH |
| r10082 | r10083 | |
| 940 | 1008 | AM_RANGE(0x0f, 0x0f) AM_READ_PORT("KEY15") |
| 941 | 1009 | AM_RANGE(0x00, 0x02) AM_WRITE(pc8801_pcg8100_w) |
| 942 | 1010 | // AM_RANGE(0x10, 0x10) AM_WRITE(pc88_rtc_w) |
| 943 | | // AM_RANGE(0x20, 0x21) AM_NOP /* RS-232C and cassette */ |
| 1011 | AM_RANGE(0x21, 0x21) AM_READ(sio_status_r) /* RS-232C and cassette */ |
| 944 | 1012 | AM_RANGE(0x30, 0x30) AM_READ_PORT("DSW1") //AM_WRITE(pc88sr_outport_30) |
| 945 | 1013 | AM_RANGE(0x31, 0x31) AM_READ_PORT("DSW2") AM_WRITE(pc8801_gfx_ctrl_w) |
| 946 | 1014 | AM_RANGE(0x32, 0x32) AM_READWRITE(pc8801_misc_ctrl_r, pc8801_misc_ctrl_w) |
| r10082 | r10083 | |
| 1467 | 1535 | bankw[3] = pc8801_bankswitch_3_w(machine); |
| 1468 | 1536 | bankw[4] = pc8801_bankswitch_4_w(machine); |
| 1469 | 1537 | |
| 1538 | pc8801_dynamic_res_change(machine); |
| 1539 | |
| 1470 | 1540 | fdc_irq_opcode = 0; //TODO: copied from PC-88VA, could be wrong here ... should be 0x7f ld a,a in the latter case |
| 1471 | 1541 | |
| 1472 | 1542 | cpu_set_input_line_vector(machine->device("fdccpu"), 0, 0); |
| r10082 | r10083 | |
| 1565 | 1635 | MCFG_SCREEN_REFRESH_RATE(60) |
| 1566 | 1636 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 1567 | 1637 | MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 1568 | | MCFG_SCREEN_SIZE(640, 220) |
| 1638 | MCFG_SCREEN_SIZE(640, 480) |
| 1569 | 1639 | MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1) |
| 1570 | 1640 | MCFG_GFXDECODE( pc8801 ) |
| 1571 | 1641 | MCFG_PALETTE_LENGTH(0x10) |