src/mess/video/pdp1.c
| r2038 | r2039 | |
| 47 | 47 | |
| 48 | 48 | INLINE void pdp1_plot_pixel(bitmap_t *bitmap, int x, int y, UINT32 color) |
| 49 | 49 | { |
| 50 | | *BITMAP_ADDR16(bitmap, y, x) = (UINT16)color; |
| 50 | *BITMAP_ADDR16(bitmap, y, x) = color; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /* |
| r2038 | r2039 | |
| 62 | 62 | /* set up out bitmaps */ |
| 63 | 63 | pdp1_draw_panel_backdrop(machine, panel_bitmap); |
| 64 | 64 | |
| 65 | | fillbitmap(typewriter_bitmap, machine->pens[pen_typewriter_bg], &typewriter_bitmap_bounds); |
| 65 | fillbitmap(typewriter_bitmap, pen_typewriter_bg, &typewriter_bitmap_bounds); |
| 66 | 66 | |
| 67 | 67 | /* initialize CRT */ |
| 68 | 68 | video_start_crt(pen_crt_num_levels, crt_window_offset_x, crt_window_offset_y, crt_window_width, crt_window_height); |
| r2038 | r2039 | |
| 154 | 154 | |
| 155 | 155 | for (yy=1; yy<7; yy++) |
| 156 | 156 | 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); |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | /* draw nb_bits leds which represent nb_bits bits in value */ |
| r2038 | r2039 | |
| 180 | 180 | /* erase area */ |
| 181 | 181 | for (yy=0; yy<8; yy++) |
| 182 | 182 | 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); |
| 184 | 184 | |
| 185 | 185 | |
| 186 | 186 | /* draw nut (-> circle) */ |
| 187 | 187 | for (i=0; i<4;i++) |
| 188 | 188 | { |
| 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); |
| 193 | 193 | } |
| 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); |
| 198 | 198 | |
| 199 | 199 | /* draw button (->disc) */ |
| 200 | 200 | if (! state) |
| 201 | 201 | y += 4; |
| 202 | 202 | for (i=0; i<2;i++) |
| 203 | 203 | { |
| 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); |
| 206 | 206 | } |
| 207 | 207 | for (i=0; i<4;i++) |
| 208 | 208 | { |
| 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); |
| 211 | 211 | } |
| 212 | 212 | } |
| 213 | 213 | |
| r2038 | r2039 | |
| 252 | 252 | static void pdp1_draw_panel_backdrop(running_machine *machine, bitmap_t *bitmap) |
| 253 | 253 | { |
| 254 | 254 | /* 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); |
| 256 | 256 | |
| 257 | 257 | /* column 1: registers, test word, test address */ |
| 258 | 258 | pdp1_draw_string(machine, bitmap, "program counter", x_panel_col1_offset, y_panel_pc_offset, color_panel_caption); |
| r2038 | r2039 | |
| 260 | 260 | pdp1_draw_string(machine, bitmap, "memory buffer", x_panel_col1_offset, y_panel_mb_offset, color_panel_caption); |
| 261 | 261 | pdp1_draw_string(machine, bitmap, "accumulator", x_panel_col1_offset, y_panel_ac_offset, color_panel_caption); |
| 262 | 262 | 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); |
| 264 | 264 | pdp1_draw_string(machine, bitmap, "test word", x_panel_col1_offset, y_panel_tw_offset, color_panel_caption); |
| 265 | 265 | |
| 266 | 266 | /* column separator */ |
| r2038 | r2039 | |
| 381 | 381 | draw_scanline8(typewriter_bitmap, 0, y, typewriter_window_width, buf, machine->pens, -1); |
| 382 | 382 | } |
| 383 | 383 | |
| 384 | | fillbitmap(typewriter_bitmap, machine->pens[pen_typewriter_bg], &typewriter_scroll_clear_window); |
| 384 | fillbitmap(typewriter_bitmap, pen_typewriter_bg, &typewriter_scroll_clear_window); |
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | void pdp1_typewriter_drawchar(running_machine *machine, int character) |
src/mess/drivers/pdp1.c
| r2038 | r2039 | |
| 81 | 81 | #endif |
| 82 | 82 | ADDRESS_MAP_END |
| 83 | 83 | |
| 84 | static DRIVER_INIT( pdp1 ) |
| 85 | { |
| 86 | UINT8 *dst; |
| 84 | 87 | |
| 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 | |
| 85 | 150 | static INPUT_PORTS_START( pdp1 ) |
| 86 | 151 | |
| 87 | 152 | PORT_START /* 0: spacewar controllers */ |
| r2038 | r2039 | |
| 294 | 359 | black. Grey levels follow an exponential law, so that decrementing the |
| 295 | 360 | color index periodically will simulate the remanence of a cathode ray tube. |
| 296 | 361 | */ |
| 297 | | static const UINT8 palette[] = |
| 362 | static const UINT8 pdp1_colors[] = |
| 298 | 363 | { |
| 364 | 0x00,0x00,0x00, /* black */ |
| 299 | 365 | 0xFF,0xFF,0xFF, /* white */ |
| 300 | 366 | 0x00,0xFF,0x00, /* green */ |
| 301 | 367 | 0x00,0x40,0x00, /* dark green */ |
| r2038 | r2039 | |
| 303 | 369 | 0x80,0x80,0x80 /* light gray */ |
| 304 | 370 | }; |
| 305 | 371 | |
| 306 | | static const UINT16 pdp1_colortable[] = |
| 372 | static const UINT8 pdp1_palette[] = |
| 307 | 373 | { |
| 308 | 374 | pen_panel_bg, pen_panel_caption, |
| 309 | 375 | pen_typewriter_bg, pen_black, |
| 310 | 376 | pen_typewriter_bg, pen_red |
| 311 | 377 | }; |
| 312 | 378 | |
| 379 | static UINT8 total_colors_needed = pen_crt_num_levels + sizeof(pdp1_colors) / 3; |
| 380 | |
| 313 | 381 | /* Initialise the palette */ |
| 314 | 382 | static PALETTE_INIT( pdp1 ) |
| 315 | 383 | { |
| r2038 | r2039 | |
| 321 | 389 | const double update_period = 1./refresh_rate; |
| 322 | 390 | double decay_1, decay_2; |
| 323 | 391 | double cur_level_1, cur_level_2; |
| 324 | | int i; |
| 325 | | int r, g, b; |
| 392 | UINT8 i, r, g, b; |
| 326 | 393 | |
| 394 | machine->colortable = colortable_alloc(machine, total_colors_needed); |
| 327 | 395 | |
| 328 | 396 | /* initialize CRT palette */ |
| 329 | 397 | |
| r2038 | r2039 | |
| 340 | 408 | g = (int) ((g1*cur_level_1 + g2*cur_level_2) + .5); |
| 341 | 409 | b = (int) ((b1*cur_level_1 + b2*cur_level_2) + .5); |
| 342 | 410 | /* 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)); |
| 344 | 412 | /* apply decay for next iteration */ |
| 345 | 413 | cur_level_1 *= decay_1; |
| 346 | 414 | cur_level_2 *= decay_2; |
| 347 | 415 | } |
| 348 | 416 | |
| 349 | | palette_set_color_rgb(machine, 0, 0, 0, 0); |
| 417 | colortable_palette_set_color(machine->colortable, 0, MAKE_RGB(0, 0, 0)); |
| 350 | 418 | |
| 351 | 419 | /* 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)); |
| 354 | 424 | } |
| 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]); |
| 355 | 433 | } |
| 356 | 434 | |
| 357 | 435 | |
| r2038 | r2039 | |
| 411 | 489 | MDRV_SCREEN_VISIBLE_AREA(0, virtual_width-1, 0, virtual_height-1) |
| 412 | 490 | |
| 413 | 491 | 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) |
| 415 | 493 | |
| 416 | 494 | MDRV_PALETTE_INIT(pdp1) |
| 417 | 495 | MDRV_VIDEO_START(pdp1) |
| r2038 | r2039 | |
| 506 | 584 | ***************************************************************************/ |
| 507 | 585 | |
| 508 | 586 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME */ |
| 509 | | COMP( 1961, pdp1, 0, 0, pdp1, pdp1, 0, pdp1, "Digital Equipment Corporation", "PDP-1" , 0) |
| 587 | COMP( 1961, pdp1, 0, 0, pdp1, pdp1, pdp1, pdp1, "Digital Equipment Corporation", "PDP-1" , 0) |