src/mess/video/intv.c
| r2042 | r2043 | |
| 2 | 2 | #include "includes/intv.h" |
| 3 | 3 | #include "video/stic.h" |
| 4 | 4 | |
| 5 | /* Due to palette changes in the 0.123 to 0.124 cycle, it is likely that most colours will |
| 6 | be incorrect. You may need to change "color" to "(color<<1)+1" in various places. */ |
| 5 | 7 | |
| 6 | 8 | #define FOREGROUND_BIT 0x0010 |
| 7 | 9 | |
| 8 | 10 | INLINE void intv_plot_pixel(bitmap_t *bitmap, int x, int y, UINT32 color) |
| 9 | 11 | { |
| 10 | | *BITMAP_ADDR16(bitmap, y, x) = (UINT16)color; |
| 12 | *BITMAP_ADDR16(bitmap, y, x) = color; |
| 11 | 13 | } |
| 12 | 14 | |
| 13 | 15 | VIDEO_START( intv ) |
| r2042 | r2043 | |
| 207 | 209 | static void render_line(running_machine *machine, bitmap_t *bitmap, |
| 208 | 210 | UINT8 nextByte, UINT16 x, UINT16 y, UINT8 fgcolor, UINT8 bgcolor) |
| 209 | 211 | { |
| 210 | | UINT32 color = (nextByte & 0x80 ? machine->pens[fgcolor] |
| 211 | | : machine->pens[bgcolor]); |
| 212 | UINT32 color = (nextByte & 0x80 ? fgcolor : bgcolor); |
| 212 | 213 | intv_plot_pixel(bitmap, x, y, color); |
| 213 | 214 | intv_plot_pixel(bitmap, x+1, y, color); |
| 214 | 215 | intv_plot_pixel(bitmap, x, y+1, color); |
| 215 | 216 | intv_plot_pixel(bitmap, x+1, y+1, color); |
| 216 | 217 | |
| 217 | | color = (nextByte & 0x40 ? machine->pens[fgcolor] |
| 218 | | : machine->pens[bgcolor]); |
| 218 | color = (nextByte & 0x40 ? fgcolor : bgcolor); |
| 219 | 219 | intv_plot_pixel(bitmap, x+2, y, color); |
| 220 | 220 | intv_plot_pixel(bitmap, x+3, y, color); |
| 221 | 221 | intv_plot_pixel(bitmap, x+2, y+1, color); |
| 222 | 222 | intv_plot_pixel(bitmap, x+3, y+1, color); |
| 223 | 223 | |
| 224 | | color = (nextByte & 0x20 ? machine->pens[fgcolor] |
| 225 | | : machine->pens[bgcolor]); |
| 224 | color = (nextByte & 0x20 ? fgcolor : bgcolor); |
| 226 | 225 | intv_plot_pixel(bitmap, x+4, y, color); |
| 227 | 226 | intv_plot_pixel(bitmap, x+5, y, color); |
| 228 | 227 | intv_plot_pixel(bitmap, x+4, y+1, color); |
| 229 | 228 | intv_plot_pixel(bitmap, x+5, y+1, color); |
| 230 | 229 | |
| 231 | | color = (nextByte & 0x10 ? machine->pens[fgcolor] |
| 232 | | : machine->pens[bgcolor]); |
| 230 | color = (nextByte & 0x10 ? fgcolor : bgcolor); |
| 233 | 231 | intv_plot_pixel(bitmap, x+6, y, color); |
| 234 | 232 | intv_plot_pixel(bitmap, x+7, y, color); |
| 235 | 233 | intv_plot_pixel(bitmap, x+6, y+1, color); |
| 236 | 234 | intv_plot_pixel(bitmap, x+7, y+1, color); |
| 237 | 235 | |
| 238 | | color = (nextByte & 0x08 ? machine->pens[fgcolor] |
| 239 | | : machine->pens[bgcolor]); |
| 236 | color = (nextByte & 0x08 ? fgcolor : bgcolor); |
| 240 | 237 | intv_plot_pixel(bitmap, x+8, y, color); |
| 241 | 238 | intv_plot_pixel(bitmap, x+9, y, color); |
| 242 | 239 | intv_plot_pixel(bitmap, x+8, y+1, color); |
| 243 | 240 | intv_plot_pixel(bitmap, x+9, y+1, color); |
| 244 | 241 | |
| 245 | | color = (nextByte & 0x04 ? machine->pens[fgcolor] |
| 246 | | : machine->pens[bgcolor]); |
| 242 | color = (nextByte & 0x04 ? fgcolor : bgcolor); |
| 247 | 243 | intv_plot_pixel(bitmap, x+10, y, color); |
| 248 | 244 | intv_plot_pixel(bitmap, x+11, y, color); |
| 249 | 245 | intv_plot_pixel(bitmap, x+10, y+1, color); |
| 250 | 246 | intv_plot_pixel(bitmap, x+11, y+1, color); |
| 251 | 247 | |
| 252 | | color = (nextByte & 0x02 ? machine->pens[fgcolor] |
| 253 | | : machine->pens[bgcolor]); |
| 248 | color = (nextByte & 0x02 ? fgcolor : bgcolor); |
| 254 | 249 | intv_plot_pixel(bitmap, x+12, y, color); |
| 255 | 250 | intv_plot_pixel(bitmap, x+13, y, color); |
| 256 | 251 | intv_plot_pixel(bitmap, x+12, y+1, color); |
| 257 | 252 | intv_plot_pixel(bitmap, x+13, y+1, color); |
| 258 | 253 | |
| 259 | | color = (nextByte & 0x01 ? machine->pens[fgcolor] |
| 260 | | : machine->pens[bgcolor]); |
| 254 | color = (nextByte & 0x01 ? fgcolor : bgcolor); |
| 261 | 255 | intv_plot_pixel(bitmap, x+14, y, color); |
| 262 | 256 | intv_plot_pixel(bitmap, x+15, y, color); |
| 263 | 257 | intv_plot_pixel(bitmap, x+14, y+1, color); |
| r2042 | r2043 | |
| 267 | 261 | static void render_colored_squares(running_machine *machine, bitmap_t *bitmap, |
| 268 | 262 | UINT16 x, UINT16 y, UINT8 color0, UINT8 color1, UINT8 color2, UINT8 color3) |
| 269 | 263 | { |
| 270 | | plot_box(bitmap, x, y, 8, 8, machine->pens[color0]); |
| 271 | | plot_box(bitmap, x+8, y, 8, 8, machine->pens[color1]); |
| 272 | | plot_box(bitmap, x, y+8, 8, 8, machine->pens[color2]); |
| 273 | | plot_box(bitmap, x+8, y+8, 8, 8, machine->pens[color3]); |
| 264 | plot_box(bitmap, x, y, 8, 8, color0); |
| 265 | plot_box(bitmap, x+8, y, 8, 8, color1); |
| 266 | plot_box(bitmap, x, y+8, 8, 8, color2); |
| 267 | plot_box(bitmap, x+8, y+8, 8, 8, color3); |
| 274 | 268 | } |
| 275 | 269 | |
| 276 | 270 | static void render_color_stack_mode(running_machine *machine, bitmap_t *bitmap) |
| r2042 | r2043 | |
| 418 | 412 | } |
| 419 | 413 | |
| 420 | 414 | if (s->visible) { |
| 421 | | intv_plot_pixel(bitmap, nextX, nextY, machine->pens[s->color] | |
| 422 | | (currentPixel & FOREGROUND_BIT)); |
| 423 | | intv_plot_pixel(bitmap, nextX+1, nextY, machine->pens[s->color] | |
| 424 | | (currentPixel & FOREGROUND_BIT)); |
| 415 | intv_plot_pixel(bitmap, nextX, nextY, s->color | (currentPixel & FOREGROUND_BIT)); |
| 416 | intv_plot_pixel(bitmap, nextX+1, nextY, s->color | (currentPixel & FOREGROUND_BIT)); |
| 425 | 417 | } |
| 426 | 418 | } |
| 427 | 419 | nextY++; |
| r2042 | r2043 | |
| 487 | 479 | if (colorb == 7) colorb = intv_color_stack[3]; |
| 488 | 480 | if (colorc == 7) colorc = intv_color_stack[3]; |
| 489 | 481 | if (colord == 7) colord = intv_color_stack[3]; |
| 490 | | plot_box(bitmap,col*16,row*16,8,8,machine->pens[colora]); |
| 491 | | plot_box(bitmap,col*16+8,row*16,8,8,machine->pens[colorb]); |
| 492 | | plot_box(bitmap,col*16,row*16+8,8,8,machine->pens[colorc]); |
| 493 | | plot_box(bitmap,col*16+8,row*16+8,8,8,machine->pens[colord]); |
| 482 | plot_box(bitmap,col*16,row*16,8,8,colora); |
| 483 | plot_box(bitmap,col*16+8,row*16,8,8,colorb); |
| 484 | plot_box(bitmap,col*16,row*16+8,8,8,colorc); |
| 485 | plot_box(bitmap,col*16+8,row*16+8,8,8,colord); |
| 494 | 486 | } |
| 495 | 487 | else // normal color stack mode |
| 496 | 488 | { |
| r2042 | r2043 | |
| 528 | 520 | |
| 529 | 521 | for(j=0;j<8;j++) |
| 530 | 522 | { |
| 531 | | //intv_plot_pixel(bitmap, col*16+j*2, row*16+7*2+1, machine->pens[1]); |
| 532 | | //intv_plot_pixel(bitmap, col*16+j*2+1, row*16+7*2+1, machine->pens[1]); |
| 523 | //intv_plot_pixel(bitmap, col*16+j*2, row*16+7*2+1, 1); |
| 524 | //intv_plot_pixel(bitmap, col*16+j*2+1, row*16+7*2+1, 1); |
| 533 | 525 | } |
| 534 | 526 | |
| 535 | 527 | } |
| r2042 | r2043 | |
| 543 | 535 | |
| 544 | 536 | for(j=0;j<8;j++) |
| 545 | 537 | { |
| 546 | | //intv_plot_pixel(bitmap, col*16+j*2, row*16+7*2+1, machine->pens[2]); |
| 547 | | //intv_plot_pixel(bitmap, col*16+j*2+1, row*16+7*2+1, machine->pens[2]); |
| 538 | //intv_plot_pixel(bitmap, col*16+j*2, row*16+7*2+1, 2); |
| 539 | //intv_plot_pixel(bitmap, col*16+j*2+1, row*16+7*2+1, 2); |
| 548 | 540 | } |
| 549 | 541 | } |
| 550 | 542 | } |
| r2042 | r2043 | |
| 702 | 694 | static void draw_borders(running_machine *machine, bitmap_t *bm) |
| 703 | 695 | { |
| 704 | 696 | if (intv_left_edge_inhibit) |
| 705 | | { |
| 706 | | plot_box(bm, 0, 0, 16-intv_col_delay*2, 16*12, |
| 707 | | machine->pens[intv_border_color]); |
| 708 | | } |
| 697 | plot_box(bm, 0, 0, 16-intv_col_delay*2, 16*12, intv_border_color); |
| 698 | |
| 709 | 699 | if (intv_top_edge_inhibit) |
| 710 | | { |
| 711 | | plot_box(bm, 0, 0, 16*20, 16-intv_row_delay*2, |
| 712 | | machine->pens[intv_border_color]); |
| 713 | | } |
| 700 | plot_box(bm, 0, 0, 16*20, 16-intv_row_delay*2, intv_border_color); |
| 714 | 701 | } |
| 715 | 702 | |
| 716 | 703 | static int col_delay = 0; |
| r2042 | r2043 | |
| 718 | 705 | |
| 719 | 706 | void stic_screenrefresh(running_machine *machine) |
| 720 | 707 | { |
| 721 | | int i; |
| 708 | int i; |
| 722 | 709 | |
| 723 | 710 | if (intv_stic_handshake != 0) |
| 724 | 711 | { |
| r2042 | r2043 | |
| 726 | 713 | // Render the background |
| 727 | 714 | render_background(machine, tmpbitmap); |
| 728 | 715 | // Render the sprites into their buffers |
| 729 | | render_sprites(); |
| 730 | | for (i = 0; i < 8; i++) |
| 731 | | intv_sprite[i].collision = 0; |
| 732 | | // Copy the sprites to the background |
| 733 | | copy_sprites_to_background(machine, tmpbitmap); |
| 734 | | determine_sprite_collisions(); |
| 735 | | for (i = 0; i < 8; i++) |
| 736 | | intv_collision_registers[i] |= intv_sprite[i].collision; |
| 716 | render_sprites(); |
| 717 | for (i = 0; i < 8; i++) intv_sprite[i].collision = 0; |
| 718 | // Copy the sprites to the background |
| 719 | copy_sprites_to_background(machine, tmpbitmap); |
| 720 | determine_sprite_collisions(); |
| 721 | for (i = 0; i < 8; i++) intv_collision_registers[i] |= intv_sprite[i].collision; |
| 737 | 722 | /* draw the screen borders if enabled */ |
| 738 | 723 | draw_borders(machine, tmpbitmap); |
| 739 | 724 | } |
| 740 | 725 | else |
| 741 | 726 | { |
| 742 | 727 | /* STIC disabled, just fill with border color */ |
| 743 | | fillbitmap(tmpbitmap, machine->pens[intv_border_color], NULL); |
| 728 | fillbitmap(tmpbitmap, (intv_border_color<<1)+1, NULL); |
| 744 | 729 | } |
| 745 | 730 | col_delay = intv_col_delay; |
| 746 | 731 | row_delay = intv_row_delay; |
src/mess/drivers/intv.c
| r2042 | r2043 | |
| 33 | 33 | #endif |
| 34 | 34 | #endif |
| 35 | 35 | |
| 36 | | static const unsigned char intv_palette[] = |
| 36 | static const unsigned char intv_colors[] = |
| 37 | 37 | { |
| 38 | 38 | 0x00, 0x00, 0x00, /* BLACK */ |
| 39 | 39 | 0x00, 0x2D, 0xFF, /* BLUE */ |
| r2042 | r2043 | |
| 55 | 55 | |
| 56 | 56 | static PALETTE_INIT( intv ) |
| 57 | 57 | { |
| 58 | | int i; |
| 58 | int k = 0; |
| 59 | 59 | |
| 60 | | /* Two copies of the palette */ |
| 61 | | for ( i = 0; i < sizeof(intv_palette) / 3; i++ ) { |
| 62 | | palette_set_color_rgb(machine, i, intv_palette[i*3], intv_palette[i*3+1], intv_palette[i*3+2]); |
| 63 | | palette_set_color_rgb(machine, i + sizeof(intv_palette) / 3, intv_palette[i*3], intv_palette[i*3+1], intv_palette[i*3+2]); |
| 60 | UINT8 i, j, r, g, b; |
| 61 | /* Two copies of everything (why?) */ |
| 62 | |
| 63 | machine->colortable = colortable_alloc(machine, 32); |
| 64 | |
| 65 | for ( i = 0; i < 16; i++ ) |
| 66 | { |
| 67 | r = intv_colors[i*3]; g = intv_colors[i*3+1]; b = intv_colors[i*3+2]; |
| 68 | colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b)); |
| 69 | colortable_palette_set_color(machine->colortable, i + 16, MAKE_RGB(r, g, b)); |
| 64 | 70 | } |
| 71 | |
| 72 | for(i=0;i<16;i++) |
| 73 | { |
| 74 | for(j=0;j<16;j++) |
| 75 | { |
| 76 | colortable_entry_set_value(machine->colortable, k++, i); |
| 77 | colortable_entry_set_value(machine->colortable, k++, j); |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | for(i=0;i<16;i++) |
| 82 | { |
| 83 | for(j=16;j<32;j++) |
| 84 | { |
| 85 | colortable_entry_set_value(machine->colortable, k++, i); |
| 86 | colortable_entry_set_value(machine->colortable, k++, j); |
| 87 | } |
| 88 | } |
| 65 | 89 | } |
| 66 | 90 | |
| 67 | 91 | static const struct AY8910interface ay8910_interface = |
| r2042 | r2043 | |
| 341 | 365 | MDRV_SCREEN_SIZE(40*8, 24*8) |
| 342 | 366 | MDRV_SCREEN_VISIBLE_AREA(0, 40*8-1, 0, 24*8-1) |
| 343 | 367 | MDRV_GFXDECODE( intv ) |
| 344 | | MDRV_PALETTE_LENGTH(32) |
| 368 | MDRV_PALETTE_LENGTH(0x400) |
| 345 | 369 | MDRV_PALETTE_INIT( intv ) |
| 346 | 370 | |
| 347 | 371 | MDRV_VIDEO_START( intv ) |
| r2042 | r2043 | |
| 477 | 501 | ***************************************************************************/ |
| 478 | 502 | |
| 479 | 503 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME */ |
| 480 | | CONS( 1979, intv, 0, 0, intv, intv, 0, intv, "Mattel", "Intellivision", GAME_NOT_WORKING ) |
| 481 | | CONS( 1981, intvsrs, 0, 0, intv, intv, 0, intv, "Mattel", "Intellivision (Sears)", GAME_NOT_WORKING ) |
| 482 | | COMP( 1981, intvkbd, 0, 0, intvkbd, intvkbd, 0, intvkbd, "Mattel", "Intellivision Keyboard Component (Unreleased)", GAME_NOT_WORKING) |
| 504 | CONS( 1979, intv, 0, 0, intv, intv, 0, intv, "Mattel", "Intellivision", GAME_NOT_WORKING ) |
| 505 | CONS( 1981, intvsrs, 0, 0, intv, intv, 0, intv, "Mattel", "Intellivision (Sears)", GAME_NOT_WORKING ) |
| 506 | COMP( 1981, intvkbd, 0, 0, intvkbd, intvkbd, 0, intvkbd, "Mattel", "Intellivision Keyboard Component (Unreleased)", GAME_NOT_WORKING) |