src/mess/video/mbee.c
| r4401 | r4402 | |
| 72 | 72 | |
| 73 | 73 | WRITE8_HANDLER ( mbee_pcg_w ) |
| 74 | 74 | { |
| 75 | | if( mbee_pcgram[0x0800+offset] != data ) |
| 76 | | { |
| 77 | | int chr = 0x80 + offset / 16; |
| 78 | | mbee_pcgram[0x0800+offset] = data; |
| 79 | | /* decode character graphics again */ |
| 80 | | gfx_element_mark_dirty(space->machine->gfx[0], chr); |
| 81 | | } |
| 75 | mbee_pcgram[0x0800 | offset] = data; |
| 82 | 76 | } |
| 83 | 77 | |
| 84 | 78 | WRITE8_HANDLER ( mbee_pcg_color_w ) |
| 85 | 79 | { |
| 86 | 80 | if( (m6545_video_bank & 0x01) || (mbee_pcg_color_latch & 0x40) == 0 ) |
| 87 | | { |
| 88 | | if( mbee_pcgram[0x0800+offset] != data ) |
| 89 | | { |
| 90 | | int chr = 0x80 + offset / 16; |
| 91 | | mbee_pcgram[0x0800+offset] = data; |
| 92 | | /* decode character graphics again */ |
| 93 | | gfx_element_mark_dirty(space->machine->gfx[0], chr); |
| 94 | | } |
| 95 | | } |
| 81 | mbee_pcgram[0x0800 | offset] = data; |
| 96 | 82 | else |
| 97 | 83 | colorram[offset] = data; |
| 98 | 84 | } |
| r4401 | r4402 | |
| 461 | 447 | |
| 462 | 448 | VIDEO_UPDATE( mbee ) |
| 463 | 449 | { |
| 464 | | UINT16 i, bytes = crt.horizontal_displayed*crt.vertical_displayed; |
| 450 | UINT8 y,z,chr,gfx; |
| 451 | UINT16 mem,sy=0,sx=0,x,i; |
| 465 | 452 | UINT8 speed = crt.cursor_top&0x20, flash = crt.cursor_top&0x40; // cursor modes |
| 466 | 453 | UINT16 cursor = (crt.cursor_address_hi<<8) | crt.cursor_address_lo; // get cursor position |
| 467 | 454 | UINT16 screen_home = (crt.screen_address_hi<<8) | crt.screen_address_lo; // screen home offset (usually zero) |
| r4401 | r4402 | |
| 470 | 457 | |
| 471 | 458 | framecnt++; |
| 472 | 459 | |
| 473 | | /* Get the graphics of the character under the cursor, xor with the visible cursor scan lines, |
| 474 | | and store as character number 256. */ |
| 475 | | for ( i = 0; i < ARRAY_LENGTH(mc6845_cursor); i++) |
| 476 | | mbee_pcgram[0x1000+i] = mbee_pcgram[(videoram[cursor]<<4) + i] ^ mc6845_cursor[i]; |
| 460 | for (y = 0; y < crt.vertical_displayed; y++) // for each row of chars |
| 461 | { |
| 462 | for (z = 0; z < crt.scan_lines+1; z++) // for each scanline |
| 463 | { |
| 464 | UINT16 *p = BITMAP_ADDR16(bitmap, sy++, 0); |
| 477 | 465 | |
| 478 | | gfx_element_mark_dirty(screen->machine->gfx[0],256); // and into machine graphics |
| 466 | for (x = sx; x < sx + crt.horizontal_displayed; x++) // for each character |
| 467 | { |
| 468 | UINT8 inv=0; |
| 469 | mem = (x + screen_home) & 0x7ff; |
| 470 | chr = videoram[mem]; |
| 479 | 471 | |
| 480 | | for( i = 0; i < bytes; i++ ) |
| 481 | | { |
| 482 | | int mem = (i + screen_home) & 0x7ff; |
| 483 | | int sy = (i / crt.horizontal_displayed) * (crt.scan_lines + 1); |
| 484 | | int sx = (i % crt.horizontal_displayed) << 3; |
| 485 | | int chr = videoram[mem]; |
| 472 | /* process cursor */ |
| 473 | if ((((!flash) && (!speed)) || // (5,6)=(0,0) = cursor on always |
| 474 | ((flash) && (speed) && (framecnt & 0x10)) || // (5,6)=(1,1) = cycle per 32 frames |
| 475 | ((flash) && (!speed) && (framecnt & 8))) && // (5,6)=(0,1) = cycle per 16 frames |
| 476 | (mem == cursor)) // displaying at cursor position? |
| 477 | inv ^= mc6845_cursor[z]; // cursor scan row |
| 486 | 478 | |
| 487 | | /* if cursor is on and we are at cursor position, show it */ |
| 488 | | /* NOTE: flash rates obtained from real hardware */ |
| 479 | /* get pattern of pixels for that character scanline */ |
| 480 | gfx = mbee_pcgram[(chr<<4) | z] ^ inv; |
| 489 | 481 | |
| 490 | | if ((((!flash) && (!speed)) || // (5,6)=(0,0) = cursor on always |
| 491 | | ((flash) && (speed) && (framecnt & 0x10)) || // (5,6)=(1,1) = cycle per 32 frames |
| 492 | | ((flash) && (!speed) && (framecnt & 8))) && // (5,6)=(0,1) = cycle per 16 frames |
| 493 | | (mem == cursor)) // displaying at cursor position? |
| 494 | | chr = 256; // 256 = cursor character |
| 495 | | |
| 496 | | drawgfx( bitmap, screen->machine->gfx[0],chr,0,0,0,sx,sy, |
| 497 | | NULL,TRANSPARENCY_NONE,0); // put character on the screen |
| 482 | /* Display a scanline of a character (8 pixels) */ |
| 483 | *p = ( gfx & 0x80 ) ? 1 : 0; p++; |
| 484 | *p = ( gfx & 0x40 ) ? 1 : 0; p++; |
| 485 | *p = ( gfx & 0x20 ) ? 1 : 0; p++; |
| 486 | *p = ( gfx & 0x10 ) ? 1 : 0; p++; |
| 487 | *p = ( gfx & 0x08 ) ? 1 : 0; p++; |
| 488 | *p = ( gfx & 0x04 ) ? 1 : 0; p++; |
| 489 | *p = ( gfx & 0x02 ) ? 1 : 0; p++; |
| 490 | *p = ( gfx & 0x01 ) ? 1 : 0; p++; |
| 491 | } |
| 492 | } |
| 493 | sx+=crt.horizontal_displayed; |
| 498 | 494 | } |
| 499 | | |
| 500 | 495 | return 0; |
| 501 | 496 | } |
| 502 | 497 | |
| 503 | 498 | VIDEO_UPDATE( mbeeic ) |
| 504 | 499 | { |
| 505 | | UINT16 i, bytes = crt.horizontal_displayed*crt.vertical_displayed; |
| 500 | UINT8 y,z,chr,gfx,fg,bg; |
| 501 | UINT16 mem,sy=0,sx=0,x,i,col; |
| 506 | 502 | UINT8 speed = crt.cursor_top&0x20, flash = crt.cursor_top&0x40; // cursor modes |
| 507 | 503 | UINT16 cursor = (crt.cursor_address_hi<<8) | crt.cursor_address_lo; // get cursor position |
| 508 | 504 | UINT16 screen_home = (crt.screen_address_hi<<8) | crt.screen_address_lo; // screen home offset (usually zero) |
| r4401 | r4402 | |
| 512 | 508 | |
| 513 | 509 | framecnt++; |
| 514 | 510 | |
| 515 | | /* Get the graphics of the character under the cursor, xor with the visible cursor scan lines, |
| 516 | | and store as character number 256. */ |
| 517 | | for ( i = 0; i < ARRAY_LENGTH(mc6845_cursor); i++) |
| 518 | | mbee_pcgram[0x1000+i] = mbee_pcgram[(videoram[cursor]<<4) + i] ^ mc6845_cursor[i]; |
| 519 | | |
| 520 | | gfx_element_mark_dirty(screen->machine->gfx[0],256); // and into machine graphics |
| 521 | | |
| 522 | | for( i = 0; i < bytes; i++ ) |
| 511 | for (y = 0; y < crt.vertical_displayed; y++) // for each row of chars |
| 523 | 512 | { |
| 524 | | int mem = (i + screen_home) & 0x7ff; |
| 525 | | int sy = (i / crt.horizontal_displayed) * (crt.scan_lines + 1); |
| 526 | | int sx = (i % crt.horizontal_displayed) << 3; |
| 527 | | int chr = videoram[mem]; |
| 528 | | int col = colorram[mem] | colourm; // read a byte of colour |
| 513 | for (z = 0; z < crt.scan_lines+1; z++) // for each scanline |
| 514 | { |
| 515 | UINT16 *p = BITMAP_ADDR16(bitmap, sy++, 0); |
| 529 | 516 | |
| 530 | | /* if cursor is on and we are at cursor position, show it */ |
| 531 | | /* NOTE: flash rates obtained from real hardware */ |
| 517 | for (x = sx; x < sx + crt.horizontal_displayed; x++) // for each character |
| 518 | { |
| 519 | UINT8 inv=0; |
| 520 | mem = (x + screen_home) & 0x7ff; |
| 521 | chr = videoram[mem]; |
| 522 | col = colorram[mem] | colourm; // read a byte of colour |
| 532 | 523 | |
| 533 | | if ((((!flash) && (!speed)) || // (5,6)=(0,0) = cursor on always |
| 534 | | ((flash) && (speed) && (framecnt & 0x10)) || // (5,6)=(1,1) = cycle per 32 frames |
| 535 | | ((flash) && (!speed) && (framecnt & 8))) && // (5,6)=(0,1) = cycle per 16 frames |
| 536 | | (mem == cursor)) // displaying at cursor position? |
| 537 | | chr = 256; // 256 = cursor character |
| 524 | /* process cursor */ |
| 525 | if ((((!flash) && (!speed)) || // (5,6)=(0,0) = cursor on always |
| 526 | ((flash) && (speed) && (framecnt & 0x10)) || // (5,6)=(1,1) = cycle per 32 frames |
| 527 | ((flash) && (!speed) && (framecnt & 8))) && // (5,6)=(0,1) = cycle per 16 frames |
| 528 | (mem == cursor)) // displaying at cursor position? |
| 529 | inv ^= mc6845_cursor[z]; // cursor scan row |
| 538 | 530 | |
| 539 | | drawgfx( bitmap, screen->machine->gfx[0],chr,col,0,0,sx,sy, |
| 540 | | cliprect,TRANSPARENCY_NONE,0); // put character on the screen |
| 531 | /* get pattern of pixels for that character scanline */ |
| 532 | gfx = mbee_pcgram[(chr<<4) | z] ^ inv; |
| 533 | fg = (col & 0x001f) | 64; // map to foreground palette |
| 534 | bg = (col & 0x07e0) >> 5; // and background palette |
| 541 | 535 | |
| 536 | /* Display a scanline of a character (8 pixels) */ |
| 537 | *p = ( gfx & 0x80 ) ? fg : bg; p++; |
| 538 | *p = ( gfx & 0x40 ) ? fg : bg; p++; |
| 539 | *p = ( gfx & 0x20 ) ? fg : bg; p++; |
| 540 | *p = ( gfx & 0x10 ) ? fg : bg; p++; |
| 541 | *p = ( gfx & 0x08 ) ? fg : bg; p++; |
| 542 | *p = ( gfx & 0x04 ) ? fg : bg; p++; |
| 543 | *p = ( gfx & 0x02 ) ? fg : bg; p++; |
| 544 | *p = ( gfx & 0x01 ) ? fg : bg; p++; |
| 545 | } |
| 546 | } |
| 547 | sx+=crt.horizontal_displayed; |
| 542 | 548 | } |
| 543 | | |
| 544 | 549 | return 0; |
| 545 | 550 | } |
src/mess/drivers/mbee.c
| r4401 | r4402 | |
| 242 | 242 | // PORT_CONFSETTING( 0x00, DEF_STR(Off)) |
| 243 | 243 | INPUT_PORTS_END |
| 244 | 244 | |
| 245 | /* GFX not used by video update - for documentation only */ |
| 245 | 246 | static const gfx_layout mbee_charlayout = |
| 246 | 247 | { |
| 247 | 248 | 8,16, /* 8 x 16 characters */ |
| r4401 | r4402 | |
| 261 | 262 | GFXDECODE_END |
| 262 | 263 | |
| 263 | 264 | static GFXDECODE_START( mbeeic ) |
| 264 | | GFXDECODE_ENTRY( "maincpu", 0x11000, mbee_charlayout, 0, 4096 ) |
| 265 | GFXDECODE_ENTRY( "maincpu", 0x11000, mbee_charlayout, 0, 48 ) |
| 265 | 266 | GFXDECODE_END |
| 266 | 267 | |
| 267 | 268 | static PALETTE_INIT( mbeeic ) |
| r4401 | r4402 | |
| 270 | 271 | UINT8 r, b, g, k; |
| 271 | 272 | UINT8 level[] = { 0, 0x80, 0xff, 0xff }; /* off, half, full intensity */ |
| 272 | 273 | |
| 273 | | /* space for colortable (64 background and 32 foreground) */ |
| 274 | | machine->colortable = colortable_alloc(machine, 96); |
| 275 | | |
| 276 | | /* set up background colortable */ |
| 274 | /* set up background palette (00-63) */ |
| 277 | 275 | for (i = 0; i < 64; i++) |
| 278 | 276 | { |
| 279 | 277 | r = level[((i>>0)&1)|((i>>2)&2)]; |
| 280 | 278 | g = level[((i>>1)&1)|((i>>3)&2)]; |
| 281 | 279 | b = level[((i>>2)&1)|((i>>4)&2)]; |
| 282 | | colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b)); |
| 280 | palette_set_color(machine, i, MAKE_RGB(r, g, b)); |
| 283 | 281 | } |
| 284 | 282 | |
| 285 | | /* set up foreground colortable by reading the prom */ |
| 283 | /* set up foreground palette (64-95) by reading the prom */ |
| 286 | 284 | for (i = 0; i < 32; i++) |
| 287 | 285 | { |
| 288 | 286 | k = color_prom[i]; |
| 289 | 287 | r = level[((k>>2)&1)|((k>>4)&2)]; |
| 290 | 288 | g = level[((k>>1)&1)|((k>>3)&2)]; |
| 291 | 289 | b = level[((k>>0)&1)|((k>>2)&2)]; |
| 292 | | colortable_palette_set_color(machine->colortable, i|64, MAKE_RGB(r, g, b)); |
| 290 | palette_set_color(machine, i|64, MAKE_RGB(r, g, b)); |
| 293 | 291 | } |
| 294 | | |
| 295 | | /* set up background palette */ |
| 296 | | for (i = 0; i < 64; i++) |
| 297 | | for (r = 0; r < 32; r++) |
| 298 | | colortable_entry_set_value(machine->colortable, ((i<<5)|r)<<1, i); |
| 299 | | |
| 300 | | /* set up foreground palette */ |
| 301 | | for (i = 0; i < 64; i++) |
| 302 | | for (r = 0; r < 32; r++) |
| 303 | | colortable_entry_set_value(machine->colortable, (((i<<5)|r)<<1)|1, r|64); |
| 304 | 292 | } |
| 305 | 293 | |
| 306 | | |
| 307 | 294 | static int mbee_vsync; |
| 308 | 295 | |
| 309 | 296 | static void mbee_pio_interrupt(const device_config *device, int state) |
| r4401 | r4402 | |
| 402 | 389 | MDRV_SCREEN_REFRESH_RATE(50) |
| 403 | 390 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(250)) /* not accurate */ |
| 404 | 391 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 405 | | MDRV_SCREEN_SIZE(64*8, 16*16) |
| 406 | | MDRV_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0, 16*16-1) |
| 392 | MDRV_SCREEN_SIZE(64*8, 19*16) /* need at least 17 lines for NET */ |
| 393 | MDRV_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0, 19*16-1) |
| 407 | 394 | MDRV_PALETTE_LENGTH(2) |
| 408 | 395 | MDRV_PALETTE_INIT(black_and_white) |
| 409 | 396 | |
| r4401 | r4402 | |
| 447 | 434 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 448 | 435 | MDRV_SCREEN_SIZE(70*8, 310) |
| 449 | 436 | MDRV_SCREEN_VISIBLE_AREA(0*8, 70*8-1, 0, 19*16-1) |
| 450 | | MDRV_PALETTE_LENGTH(0x1000) |
| 437 | MDRV_PALETTE_LENGTH(96) |
| 451 | 438 | MDRV_PALETTE_INIT(mbeeic) |
| 452 | 439 | |
| 453 | 440 | MDRV_VIDEO_START(mbeeic) |