Previous 15994 Revisions Next

r2043 Friday 21st March, 2008 at 13:00:08 UTC by Robbbert
[INTV] Fixed palette, but needs more work.
[src/mess/drivers]intv.c
[src/mess/video]intv.c

src/mess/video/intv.c
r2042r2043
22#include "includes/intv.h"
33#include "video/stic.h"
44
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. */
57
68#define FOREGROUND_BIT 0x0010
79
810INLINE void intv_plot_pixel(bitmap_t *bitmap, int x, int y, UINT32 color)
911{
10   *BITMAP_ADDR16(bitmap, y, x) = (UINT16)color;
12   *BITMAP_ADDR16(bitmap, y, x) = color;
1113}
1214
1315VIDEO_START( intv )
r2042r2043
207209static void render_line(running_machine *machine, bitmap_t *bitmap,
208210   UINT8 nextByte, UINT16 x, UINT16 y, UINT8 fgcolor, UINT8 bgcolor)
209211{
210    UINT32 color = (nextByte & 0x80 ? machine->pens[fgcolor]
211            : machine->pens[bgcolor]);
212    UINT32 color = (nextByte & 0x80 ? fgcolor : bgcolor);
212213    intv_plot_pixel(bitmap, x, y, color);
213214    intv_plot_pixel(bitmap, x+1, y, color);
214215    intv_plot_pixel(bitmap, x, y+1, color);
215216    intv_plot_pixel(bitmap, x+1, y+1, color);
216217
217    color = (nextByte & 0x40 ? machine->pens[fgcolor]
218            : machine->pens[bgcolor]);
218    color = (nextByte & 0x40 ? fgcolor : bgcolor);
219219    intv_plot_pixel(bitmap, x+2, y, color);
220220    intv_plot_pixel(bitmap, x+3, y, color);
221221    intv_plot_pixel(bitmap, x+2, y+1, color);
222222    intv_plot_pixel(bitmap, x+3, y+1, color);
223223
224    color = (nextByte & 0x20 ? machine->pens[fgcolor]
225            : machine->pens[bgcolor]);
224    color = (nextByte & 0x20 ? fgcolor : bgcolor);
226225    intv_plot_pixel(bitmap, x+4, y, color);
227226    intv_plot_pixel(bitmap, x+5, y, color);
228227    intv_plot_pixel(bitmap, x+4, y+1, color);
229228    intv_plot_pixel(bitmap, x+5, y+1, color);
230229
231    color = (nextByte & 0x10 ? machine->pens[fgcolor]
232            : machine->pens[bgcolor]);
230    color = (nextByte & 0x10 ? fgcolor : bgcolor);
233231    intv_plot_pixel(bitmap, x+6, y, color);
234232    intv_plot_pixel(bitmap, x+7, y, color);
235233    intv_plot_pixel(bitmap, x+6, y+1, color);
236234    intv_plot_pixel(bitmap, x+7, y+1, color);
237235
238    color = (nextByte & 0x08 ? machine->pens[fgcolor]
239            : machine->pens[bgcolor]);
236    color = (nextByte & 0x08 ? fgcolor : bgcolor);
240237    intv_plot_pixel(bitmap, x+8, y, color);
241238    intv_plot_pixel(bitmap, x+9, y, color);
242239    intv_plot_pixel(bitmap, x+8, y+1, color);
243240    intv_plot_pixel(bitmap, x+9, y+1, color);
244241
245    color = (nextByte & 0x04 ? machine->pens[fgcolor]
246            : machine->pens[bgcolor]);
242    color = (nextByte & 0x04 ? fgcolor : bgcolor);
247243    intv_plot_pixel(bitmap, x+10, y, color);
248244    intv_plot_pixel(bitmap, x+11, y, color);
249245    intv_plot_pixel(bitmap, x+10, y+1, color);
250246    intv_plot_pixel(bitmap, x+11, y+1, color);
251247
252    color = (nextByte & 0x02 ? machine->pens[fgcolor]
253            : machine->pens[bgcolor]);
248    color = (nextByte & 0x02 ? fgcolor : bgcolor);
254249    intv_plot_pixel(bitmap, x+12, y, color);
255250    intv_plot_pixel(bitmap, x+13, y, color);
256251    intv_plot_pixel(bitmap, x+12, y+1, color);
257252    intv_plot_pixel(bitmap, x+13, y+1, color);
258253
259    color = (nextByte & 0x01 ? machine->pens[fgcolor]
260            : machine->pens[bgcolor]);
254    color = (nextByte & 0x01 ? fgcolor : bgcolor);
261255    intv_plot_pixel(bitmap, x+14, y, color);
262256    intv_plot_pixel(bitmap, x+15, y, color);
263257    intv_plot_pixel(bitmap, x+14, y+1, color);
r2042r2043
267261static void render_colored_squares(running_machine *machine, bitmap_t *bitmap,
268262   UINT16 x, UINT16 y, UINT8 color0, UINT8 color1, UINT8 color2, UINT8 color3)
269263{
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);
274268}
275269
276270static void render_color_stack_mode(running_machine *machine, bitmap_t *bitmap)
r2042r2043
418412                }
419413
420414                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));
425417                }
426418            }
427419            nextY++;
r2042r2043
487479               if (colorb == 7) colorb = intv_color_stack[3];
488480               if (colorc == 7) colorc = intv_color_stack[3];
489481               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);
494486            }
495487            else // normal color stack mode
496488            {
r2042r2043
528520
529521                  for(j=0;j<8;j++)
530522                  {
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);
533525                  }
534526
535527               }
r2042r2043
543535
544536                  for(j=0;j<8;j++)
545537                  {
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);
548540                  }
549541               }
550542            }
r2042r2043
702694static void draw_borders(running_machine *machine, bitmap_t *bm)
703695{
704696   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
709699   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);
714701}
715702
716703static int col_delay = 0;
r2042r2043
718705
719706void stic_screenrefresh(running_machine *machine)
720707{
721    int i;
708   int i;
722709
723710   if (intv_stic_handshake != 0)
724711   {
r2042r2043
726713      // Render the background
727714      render_background(machine, tmpbitmap);
728715      // 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;
737722      /* draw the screen borders if enabled */
738723      draw_borders(machine, tmpbitmap);
739724   }
740725   else
741726   {
742727      /* 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);
744729   }
745730   col_delay = intv_col_delay;
746731   row_delay = intv_row_delay;
src/mess/drivers/intv.c
r2042r2043
3333#endif
3434#endif
3535
36static const unsigned char intv_palette[] =
36static const unsigned char intv_colors[] =
3737{
3838   0x00, 0x00, 0x00, /* BLACK */
3939   0x00, 0x2D, 0xFF, /* BLUE */
r2042r2043
5555
5656static PALETTE_INIT( intv )
5757{
58   int i;
58   int k = 0;
5959
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));
6470   }
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   }
6589}
6690
6791static const struct AY8910interface ay8910_interface =
r2042r2043
341365   MDRV_SCREEN_SIZE(40*8, 24*8)
342366   MDRV_SCREEN_VISIBLE_AREA(0, 40*8-1, 0, 24*8-1)
343367   MDRV_GFXDECODE( intv )
344   MDRV_PALETTE_LENGTH(32)
368   MDRV_PALETTE_LENGTH(0x400)
345369   MDRV_PALETTE_INIT( intv )
346370
347371   MDRV_VIDEO_START( intv )
r2042r2043
477501***************************************************************************/
478502
479503/*    YEAR  NAME        PARENT  COMPAT  MACHINE   INPUT     INIT        CONFIG      COMPANY      FULLNAME */
480CONS( 1979, intv,      0,      0,      intv,     intv,    0,         intv,      "Mattel",    "Intellivision", GAME_NOT_WORKING )
481CONS( 1981, intvsrs,   0,      0,      intv,     intv,    0,         intv,      "Mattel",    "Intellivision (Sears)", GAME_NOT_WORKING )
482COMP( 1981, intvkbd,   0,      0,      intvkbd,  intvkbd,    0,         intvkbd,   "Mattel",    "Intellivision Keyboard Component (Unreleased)", GAME_NOT_WORKING)
504CONS( 1979, intv,   0,   0,   intv,     intv,    0,   intv,      "Mattel",    "Intellivision", GAME_NOT_WORKING )
505CONS( 1981, intvsrs,   0,   0,   intv,     intv,    0,   intv,      "Mattel",    "Intellivision (Sears)", GAME_NOT_WORKING )
506COMP( 1981, intvkbd,   0,   0,   intvkbd,  intvkbd,    0,   intvkbd,   "Mattel",    "Intellivision Keyboard Component (Unreleased)", GAME_NOT_WORKING)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team