src/mess/drivers/pc98.c
| r6009 | r6010 | |
| 226 | 226 | gfx_bitmap_ram = auto_alloc_array(machine, UINT32, 0x18000*2); |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | /* |
| 230 | attrib ram is: |
| 231 | bit 0: secret / hidden (?) |
| 232 | bit 1: blink |
| 233 | bit 2: reverse video |
| 234 | bit 3: underline |
| 235 | bit 4: vertical line / simple gfx (toggled by flip-flop bit) (?) |
| 236 | bit 5-7: BRG colors |
| 237 | */ |
| 238 | |
| 229 | 239 | static VIDEO_UPDATE( pc9801 ) |
| 230 | 240 | { |
| 231 | | const gfx_element *gfx = screen->machine->gfx[0]; |
| 232 | | int count = 0x00000; |
| 241 | // const gfx_element *gfx = screen->machine->gfx[0]; |
| 233 | 242 | int y,x; |
| 243 | int yi,xi; |
| 244 | UINT8 *gfx_data = memory_region(screen->machine, "gfx1"); |
| 234 | 245 | |
| 235 | | |
| 236 | | for (y=0;y<64;y++) |
| 246 | for (y=0;y<24;y++) |
| 237 | 247 | { |
| 238 | | for (x=0;x<64;x+=2) |
| 248 | for (x=0;x<40;x++) |
| 239 | 249 | { |
| 240 | | int tile; |
| 250 | for(yi=0;yi<8;yi++) |
| 251 | { |
| 252 | for(xi=0;xi<8;xi++) |
| 253 | { |
| 254 | int tile,attr,pen[3],pen_mask,color; |
| 241 | 255 | |
| 242 | | tile = (pc9801_vram[count] & 0x00ff0000)>>16; |
| 243 | | drawgfx_opaque(bitmap,cliprect,gfx,tile,0,0,0,(x+1)*8,y*8); |
| 256 | tile = (pc9801_vram[(x+y*40)] & 0x00ff0000) >> 16; |
| 257 | attr = (pc9801_vram[((x+y*40)+0x2000/4)] & 0x00ff0000) >> 16; |
| 244 | 258 | |
| 245 | | tile = pc9801_vram[count] & 0x000000ff; |
| 246 | | drawgfx_opaque(bitmap,cliprect,gfx,tile,0,0,0,(x+0)*8,y*8); |
| 259 | pen_mask = (attr & 0xe0)>>5; |
| 247 | 260 | |
| 248 | | count++; |
| 261 | pen[0] = gfx_data[(tile*8)+yi]>>(7-xi) & (pen_mask & 1)>>0; |
| 262 | pen[1] = gfx_data[(tile*8)+yi]>>(7-xi) & (pen_mask & 2)>>1; |
| 263 | pen[2] = gfx_data[(tile*8)+yi]>>(7-xi) & (pen_mask & 4)>>2; |
| 264 | |
| 265 | color = pen[2]<<2|pen[1]<<1|pen[0]<<0; |
| 266 | |
| 267 | if(((x*2+1)*8+xi)<video_screen_get_visible_area(screen->machine->primary_screen)->max_x && (y*8+yi)<video_screen_get_visible_area(screen->machine->primary_screen)->max_y) |
| 268 | *BITMAP_ADDR16(bitmap, y*8+yi, (x*2+1)*8+xi) = screen->machine->pens[color]; |
| 269 | |
| 270 | tile = (pc9801_vram[(x+y*40)] & 0x000000ff) >> 0; |
| 271 | attr = (pc9801_vram[((x+y*40)+0x2000/4)] & 0x000000ff) >> 0; |
| 272 | |
| 273 | pen_mask = (attr & 0xe0)>>5; |
| 274 | |
| 275 | pen[0] = gfx_data[(tile*8)+yi]>>(7-xi) & (pen_mask & 1)>>0; |
| 276 | pen[1] = gfx_data[(tile*8)+yi]>>(7-xi) & (pen_mask & 2)>>1; |
| 277 | pen[2] = gfx_data[(tile*8)+yi]>>(7-xi) & (pen_mask & 4)>>2; |
| 278 | |
| 279 | color = pen[2]<<2|pen[1]<<1|pen[0]<<0; |
| 280 | |
| 281 | if(((x*2+0)*8+xi)<video_screen_get_visible_area(screen->machine->primary_screen)->max_x && (y*8+yi)<video_screen_get_visible_area(screen->machine->primary_screen)->max_y) |
| 282 | *BITMAP_ADDR16(bitmap, y*8+yi, (x*2+0)*8+xi) = screen->machine->pens[color]; |
| 283 | } |
| 284 | } |
| 249 | 285 | } |
| 250 | 286 | } |
| 251 | 287 | |
| r6009 | r6010 | |
| 579 | 615 | } |
| 580 | 616 | }; |
| 581 | 617 | |
| 618 | static PALETTE_INIT( pc9801 ) |
| 619 | { |
| 620 | int i; |
| 621 | |
| 622 | for(i=0;i<8;i++) |
| 623 | palette_set_color_rgb(machine, i+0x000, pal1bit(i >> 1), pal1bit(i >> 2), pal1bit(i >> 0)); |
| 624 | } |
| 625 | |
| 582 | 626 | /* I suspect the dump for pc9801 comes from a i386 later model... the original machine would use a i8086 @ 5Mhz CPU (see notes at top) */ |
| 583 | 627 | /* More investigations are required, but in the meanwhile I set a I386 as main CPU */ |
| 584 | 628 | static MACHINE_DRIVER_START( pc9801 ) |
| r6009 | r6010 | |
| 600 | 644 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 601 | 645 | MDRV_SCREEN_SIZE(640, 480) |
| 602 | 646 | MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) |
| 603 | | MDRV_PALETTE_LENGTH(2) |
| 604 | | MDRV_PALETTE_INIT(black_and_white) |
| 647 | MDRV_PALETTE_LENGTH(8) |
| 648 | MDRV_PALETTE_INIT(pc9801) |
| 605 | 649 | MDRV_GFXDECODE(pc9801) |
| 606 | 650 | |
| 607 | 651 | MDRV_VIDEO_START(pc9801) |