Previous 15994 Revisions Next

r2039 Friday 21st March, 2008 at 09:04:34 UTC by Robbbert
[PDP1] Fixed palette (bug 883).
[src/mess/drivers]pdp1.c
[src/mess/includes]pdp1.h
[src/mess/video]pdp1.c

src/mess/includes/pdp1.h
r2038r2039
231231   pen_crt_max_intensity = pen_crt_num_levels-1,
232232
233233   /* next colors used for control panel and typewriter */
234   pen_black = 0,
235   pen_white = pen_crt_num_levels,
234   pen_black = pen_crt_num_levels,
235   pen_white,
236236   pen_green,
237237   pen_dk_green,
238238   pen_red,
src/mess/video/pdp1.c
r2038r2039
4747
4848INLINE void pdp1_plot_pixel(bitmap_t *bitmap, int x, int y, UINT32 color)
4949{
50   *BITMAP_ADDR16(bitmap, y, x) = (UINT16)color;
50   *BITMAP_ADDR16(bitmap, y, x) = color;
5151}
5252
5353/*
r2038r2039
6262   /* set up out bitmaps */
6363   pdp1_draw_panel_backdrop(machine, panel_bitmap);
6464
65   fillbitmap(typewriter_bitmap, machine->pens[pen_typewriter_bg], &typewriter_bitmap_bounds);
65   fillbitmap(typewriter_bitmap, pen_typewriter_bg, &typewriter_bitmap_bounds);
6666
6767   /* initialize CRT */
6868   video_start_crt(pen_crt_num_levels, crt_window_offset_x, crt_window_offset_y, crt_window_width, crt_window_height);
r2038r2039
154154
155155   for (yy=1; yy<7; yy++)
156156      for (xx=1; xx<7; xx++)
157         pdp1_plot_pixel(bitmap, x+xx, y+yy, machine->pens[state ? pen_lit_lamp : pen_unlit_lamp]);
157         pdp1_plot_pixel(bitmap, x+xx, y+yy, state ? pen_lit_lamp : pen_unlit_lamp);
158158}
159159
160160/* draw nb_bits leds which represent nb_bits bits in value */
r2038r2039
180180   /* erase area */
181181   for (yy=0; yy<8; yy++)
182182      for (xx=0; xx<8; xx++)
183         pdp1_plot_pixel(bitmap, x+xx, y+yy, machine->pens[pen_panel_bg]);
183         pdp1_plot_pixel(bitmap, x+xx, y+yy, pen_panel_bg);
184184
185185
186186   /* draw nut (-> circle) */
187187   for (i=0; i<4;i++)
188188   {
189      pdp1_plot_pixel(bitmap, x+2+i, y+1, machine->pens[pen_switch_nut]);
190      pdp1_plot_pixel(bitmap, x+2+i, y+6, machine->pens[pen_switch_nut]);
191      pdp1_plot_pixel(bitmap, x+1, y+2+i, machine->pens[pen_switch_nut]);
192      pdp1_plot_pixel(bitmap, x+6, y+2+i, machine->pens[pen_switch_nut]);
189      pdp1_plot_pixel(bitmap, x+2+i, y+1, pen_switch_nut);
190      pdp1_plot_pixel(bitmap, x+2+i, y+6, pen_switch_nut);
191      pdp1_plot_pixel(bitmap, x+1, y+2+i, pen_switch_nut);
192      pdp1_plot_pixel(bitmap, x+6, y+2+i, pen_switch_nut);
193193   }
194   pdp1_plot_pixel(bitmap, x+2, y+2, machine->pens[pen_switch_nut]);
195   pdp1_plot_pixel(bitmap, x+5, y+2, machine->pens[pen_switch_nut]);
196   pdp1_plot_pixel(bitmap, x+2, y+5, machine->pens[pen_switch_nut]);
197   pdp1_plot_pixel(bitmap, x+5, y+5, machine->pens[pen_switch_nut]);
194   pdp1_plot_pixel(bitmap, x+2, y+2, pen_switch_nut);
195   pdp1_plot_pixel(bitmap, x+5, y+2, pen_switch_nut);
196   pdp1_plot_pixel(bitmap, x+2, y+5, pen_switch_nut);
197   pdp1_plot_pixel(bitmap, x+5, y+5, pen_switch_nut);
198198
199199   /* draw button (->disc) */
200200   if (! state)
201201      y += 4;
202202   for (i=0; i<2;i++)
203203   {
204      pdp1_plot_pixel(bitmap, x+3+i, y, machine->pens[pen_switch_button]);
205      pdp1_plot_pixel(bitmap, x+3+i, y+3, machine->pens[pen_switch_button]);
204      pdp1_plot_pixel(bitmap, x+3+i, y, pen_switch_button);
205      pdp1_plot_pixel(bitmap, x+3+i, y+3, pen_switch_button);
206206   }
207207   for (i=0; i<4;i++)
208208   {
209      pdp1_plot_pixel(bitmap, x+2+i, y+1, machine->pens[pen_switch_button]);
210      pdp1_plot_pixel(bitmap, x+2+i, y+2, machine->pens[pen_switch_button]);
209      pdp1_plot_pixel(bitmap, x+2+i, y+1, pen_switch_button);
210      pdp1_plot_pixel(bitmap, x+2+i, y+2, pen_switch_button);
211211   }
212212}
213213
r2038r2039
252252static void pdp1_draw_panel_backdrop(running_machine *machine, bitmap_t *bitmap)
253253{
254254   /* fill with black */
255   fillbitmap(panel_bitmap, machine->pens[pen_panel_bg], &panel_bitmap_bounds);
255   fillbitmap(panel_bitmap, pen_panel_bg, &panel_bitmap_bounds);
256256
257257   /* column 1: registers, test word, test address */
258258   pdp1_draw_string(machine, bitmap, "program counter", x_panel_col1_offset, y_panel_pc_offset, color_panel_caption);
r2038r2039
260260   pdp1_draw_string(machine, bitmap, "memory buffer", x_panel_col1_offset, y_panel_mb_offset, color_panel_caption);
261261   pdp1_draw_string(machine, bitmap, "accumulator", x_panel_col1_offset, y_panel_ac_offset, color_panel_caption);
262262   pdp1_draw_string(machine, bitmap, "in-out", x_panel_col1_offset, y_panel_io_offset, color_panel_caption);
263   pdp1_draw_string(machine, bitmap, "extend address", x_panel_col1_offset-8, y_panel_ta_offset, color_panel_caption);
263   pdp1_draw_string(machine, bitmap, "extend address", x_panel_col1_offset, y_panel_ta_offset, color_panel_caption);
264264   pdp1_draw_string(machine, bitmap, "test word", x_panel_col1_offset, y_panel_tw_offset, color_panel_caption);
265265
266266   /* column separator */
r2038r2039
381381      draw_scanline8(typewriter_bitmap, 0, y, typewriter_window_width, buf, machine->pens, -1);
382382   }
383383
384   fillbitmap(typewriter_bitmap, machine->pens[pen_typewriter_bg], &typewriter_scroll_clear_window);
384   fillbitmap(typewriter_bitmap, pen_typewriter_bg, &typewriter_scroll_clear_window);
385385}
386386
387387void pdp1_typewriter_drawchar(running_machine *machine, int character)
src/mess/drivers/pdp1.c
r2038r2039
8181#endif
8282ADDRESS_MAP_END
8383
84static DRIVER_INIT( pdp1 )
85{
86   UINT8 *dst;
8487
88   static const unsigned char fontdata6x8[pdp1_fontdata_size] =
89   {   /* ASCII characters */
90      0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,
91      0x50,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x50,0xf8,0x50,0xf8,0x50,0x00,0x00,
92      0x20,0x70,0xc0,0x70,0x18,0xf0,0x20,0x00,0x40,0xa4,0x48,0x10,0x20,0x48,0x94,0x08,
93      0x60,0x90,0xa0,0x40,0xa8,0x90,0x68,0x00,0x10,0x20,0x40,0x00,0x00,0x00,0x00,0x00,
94      0x20,0x40,0x40,0x40,0x40,0x40,0x20,0x00,0x10,0x08,0x08,0x08,0x08,0x08,0x10,0x00,
95      0x20,0xa8,0x70,0xf8,0x70,0xa8,0x20,0x00,0x00,0x20,0x20,0xf8,0x20,0x20,0x00,0x00,
96      0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x60,0x00,0x00,0x00,0xf8,0x00,0x00,0x00,0x00,
97      0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00,
98      0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x10,0x30,0x10,0x10,0x10,0x10,0x10,0x00,
99      0x70,0x88,0x08,0x10,0x20,0x40,0xf8,0x00,0x70,0x88,0x08,0x30,0x08,0x88,0x70,0x00,
100      0x10,0x30,0x50,0x90,0xf8,0x10,0x10,0x00,0xf8,0x80,0xf0,0x08,0x08,0x88,0x70,0x00,
101      0x70,0x80,0xf0,0x88,0x88,0x88,0x70,0x00,0xf8,0x08,0x08,0x10,0x20,0x20,0x20,0x00,
102      0x70,0x88,0x88,0x70,0x88,0x88,0x70,0x00,0x70,0x88,0x88,0x88,0x78,0x08,0x70,0x00,
103      0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x00,0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x60,
104      0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x00,0x00,0x00,0xf8,0x00,0xf8,0x00,0x00,0x00,
105      0x40,0x20,0x10,0x08,0x10,0x20,0x40,0x00,0x70,0x88,0x08,0x10,0x20,0x00,0x20,0x00,
106      0x70,0x88,0xb8,0xa8,0xb8,0x80,0x70,0x00,0x70,0x88,0x88,0xf8,0x88,0x88,0x88,0x00,
107      0xf0,0x88,0x88,0xf0,0x88,0x88,0xf0,0x00,0x70,0x88,0x80,0x80,0x80,0x88,0x70,0x00,
108      0xf0,0x88,0x88,0x88,0x88,0x88,0xf0,0x00,0xf8,0x80,0x80,0xf0,0x80,0x80,0xf8,0x00,
109      0xf8,0x80,0x80,0xf0,0x80,0x80,0x80,0x00,0x70,0x88,0x80,0x98,0x88,0x88,0x70,0x00,
110      0x88,0x88,0x88,0xf8,0x88,0x88,0x88,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,
111      0x08,0x08,0x08,0x08,0x88,0x88,0x70,0x00,0x88,0x90,0xa0,0xc0,0xa0,0x90,0x88,0x00,
112      0x80,0x80,0x80,0x80,0x80,0x80,0xf8,0x00,0x88,0xd8,0xa8,0x88,0x88,0x88,0x88,0x00,
113      0x88,0xc8,0xa8,0x98,0x88,0x88,0x88,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x00,
114      0xf0,0x88,0x88,0xf0,0x80,0x80,0x80,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x08,
115      0xf0,0x88,0x88,0xf0,0x88,0x88,0x88,0x00,0x70,0x88,0x80,0x70,0x08,0x88,0x70,0x00,
116      0xf8,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00,
117      0x88,0x88,0x88,0x88,0x88,0x50,0x20,0x00,0x88,0x88,0x88,0x88,0xa8,0xd8,0x88,0x00,
118      0x88,0x50,0x20,0x20,0x20,0x50,0x88,0x00,0x88,0x88,0x88,0x50,0x20,0x20,0x20,0x00,
119      0xf8,0x08,0x10,0x20,0x40,0x80,0xf8,0x00,0x30,0x20,0x20,0x20,0x20,0x20,0x30,0x00,
120      0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x30,0x10,0x10,0x10,0x10,0x10,0x30,0x00,
121      0x20,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,
122      0x40,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x08,0x78,0x88,0x78,0x00,
123      0x80,0x80,0xf0,0x88,0x88,0x88,0xf0,0x00,0x00,0x00,0x70,0x88,0x80,0x80,0x78,0x00,
124      0x08,0x08,0x78,0x88,0x88,0x88,0x78,0x00,0x00,0x00,0x70,0x88,0xf8,0x80,0x78,0x00,
125      0x18,0x20,0x70,0x20,0x20,0x20,0x20,0x00,0x00,0x00,0x78,0x88,0x88,0x78,0x08,0x70,
126      0x80,0x80,0xf0,0x88,0x88,0x88,0x88,0x00,0x20,0x00,0x20,0x20,0x20,0x20,0x20,0x00,
127      0x20,0x00,0x20,0x20,0x20,0x20,0x20,0xc0,0x80,0x80,0x90,0xa0,0xe0,0x90,0x88,0x00,
128      0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00,0xf0,0xa8,0xa8,0xa8,0xa8,0x00,
129      0x00,0x00,0xb0,0xc8,0x88,0x88,0x88,0x00,0x00,0x00,0x70,0x88,0x88,0x88,0x70,0x00,
130      0x00,0x00,0xf0,0x88,0x88,0xf0,0x80,0x80,0x00,0x00,0x78,0x88,0x88,0x78,0x08,0x08,
131      0x00,0x00,0xb0,0xc8,0x80,0x80,0x80,0x00,0x00,0x00,0x78,0x80,0x70,0x08,0xf0,0x00,
132      0x20,0x20,0x70,0x20,0x20,0x20,0x18,0x00,0x00,0x00,0x88,0x88,0x88,0x98,0x68,0x00,
133      0x00,0x00,0x88,0x88,0x88,0x50,0x20,0x00,0x00,0x00,0xa8,0xa8,0xa8,0xa8,0x50,0x00,
134      0x00,0x00,0x88,0x50,0x20,0x50,0x88,0x00,0x00,0x00,0x88,0x88,0x88,0x78,0x08,0x70,
135      0x00,0x00,0xf8,0x10,0x20,0x40,0xf8,0x00,0x08,0x10,0x10,0x20,0x10,0x10,0x08,0x00,
136      0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x40,0x20,0x20,0x10,0x20,0x20,0x40,0x00,
137      0x00,0x68,0xb0,0x00,0x00,0x00,0x00,0x00,0x20,0x50,0x20,0x50,0xa8,0x50,0x00,0x00,
138   };
139
140   /* set up memory regions */
141//   pdp1_memory = (UINT32 *) memory_region(REGION_CPU1);
142
143   /* set up our font */
144   dst = memory_region(REGION_GFX1);
145
146   memcpy(dst, fontdata6x8, pdp1_fontdata_size);
147}
148
149
85150static INPUT_PORTS_START( pdp1 )
86151
87152    PORT_START      /* 0: spacewar controllers */
r2038r2039
294359    black.  Grey levels follow an exponential law, so that decrementing the
295360    color index periodically will simulate the remanence of a cathode ray tube.
296361*/
297static const UINT8 palette[] =
362static const UINT8 pdp1_colors[] =
298363{
364   0x00,0x00,0x00,   /* black */
299365   0xFF,0xFF,0xFF,   /* white */
300366   0x00,0xFF,0x00,   /* green */
301367   0x00,0x40,0x00,   /* dark green */
r2038r2039
303369   0x80,0x80,0x80   /* light gray */
304370};
305371
306static const UINT16 pdp1_colortable[] =
372static const UINT8 pdp1_palette[] =
307373{
308374   pen_panel_bg, pen_panel_caption,
309375   pen_typewriter_bg, pen_black,
310376   pen_typewriter_bg, pen_red
311377};
312378
379static UINT8 total_colors_needed = pen_crt_num_levels + sizeof(pdp1_colors) / 3;
380
313381/* Initialise the palette */
314382static PALETTE_INIT( pdp1 )
315383{
r2038r2039
321389   const double update_period = 1./refresh_rate;
322390   double decay_1, decay_2;
323391   double cur_level_1, cur_level_2;
324   int i;
325   int r, g, b;
392   UINT8 i, r, g, b;
326393
394   machine->colortable = colortable_alloc(machine, total_colors_needed);
327395
328396   /* initialize CRT palette */
329397
r2038r2039
340408      g = (int) ((g1*cur_level_1 + g2*cur_level_2) + .5);
341409      b = (int) ((b1*cur_level_1 + b2*cur_level_2) + .5);
342410      /* write color in palette */
343      palette_set_color_rgb(machine, i, r, g, b);
411      colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b));
344412      /* apply decay for next iteration */
345413      cur_level_1 *= decay_1;
346414      cur_level_2 *= decay_2;
347415   }
348416
349   palette_set_color_rgb(machine, 0, 0, 0, 0);
417   colortable_palette_set_color(machine->colortable, 0, MAKE_RGB(0, 0, 0));
350418
351419   /* load static palette */
352   for ( i = 0; i < sizeof(palette) / sizeof(palette[0]) / 3; i++ ) {
353      palette_set_color_rgb(machine, pen_crt_num_levels + i, palette[i*3], palette[i*3+1], palette[i*3+2]);
420   for ( i = 0; i < 6; i++ )
421   {
422      r = pdp1_colors[i*3]; g = pdp1_colors[i*3+1]; b = pdp1_colors[i*3+2];
423      colortable_palette_set_color(machine->colortable, pen_crt_num_levels + i, MAKE_RGB(r, g, b));
354424   }
425
426   /* copy colortable to palette */
427   for( i = 0; i < total_colors_needed; i++ )
428      colortable_entry_set_value(machine->colortable, i, i);
429
430   /* overwrite unneeded lowest palette entries with text values */
431   for( i = 0; i < 6; i++ )
432      colortable_entry_set_value(machine->colortable, i, pdp1_palette[i]);
355433}
356434
357435
r2038r2039
411489   MDRV_SCREEN_VISIBLE_AREA(0, virtual_width-1, 0, virtual_height-1)
412490
413491   MDRV_GFXDECODE(pdp1)
414   MDRV_PALETTE_LENGTH(pen_crt_num_levels + (sizeof(palette) / sizeof(palette[0]) / 3))
492   MDRV_PALETTE_LENGTH(pen_crt_num_levels + sizeof(pdp1_colors) / 3)
415493
416494   MDRV_PALETTE_INIT(pdp1)
417495   MDRV_VIDEO_START(pdp1)
r2038r2039
506584***************************************************************************/
507585
508586/*    YEAR  NAME      PARENT    COMPAT  MACHINE   INPUT     INIT    CONFIG  COMPANY FULLNAME */
509COMP( 1961, pdp1,     0,       0,      pdp1,     pdp1,    0,      pdp1,   "Digital Equipment Corporation",  "PDP-1" , 0)
587COMP( 1961, pdp1,     0,       0,      pdp1,     pdp1,    pdp1,      pdp1,   "Digital Equipment Corporation",  "PDP-1" , 0)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team