src/mess/video/pdp1.c
| r1932 | r1933 | |
| 18 | 18 | #include <math.h> |
| 19 | 19 | |
| 20 | 20 | #include "driver.h" |
| 21 | | #include "deprecat.h" |
| 22 | | |
| 23 | 21 | #include "cpu/pdp1/pdp1.h" |
| 24 | 22 | #include "includes/pdp1.h" |
| 25 | 23 | #include "video/crt.h" |
| r1932 | r1933 | |
| 40 | 38 | 0, panel_window_height-1, /* min_y, max_y */ |
| 41 | 39 | }; |
| 42 | 40 | |
| 43 | | static void pdp1_draw_panel_backdrop(bitmap_t *bitmap); |
| 44 | | static void pdp1_draw_panel(bitmap_t *bitmap); |
| 41 | static void pdp1_draw_panel_backdrop(running_machine *machine, bitmap_t *bitmap); |
| 42 | static void pdp1_draw_panel(running_machine *machine, bitmap_t *bitmap); |
| 45 | 43 | |
| 46 | 44 | static lightpen_t lightpen_state, previous_lightpen_state; |
| 47 | 45 | static void pdp1_erase_lightpen(bitmap_t *bitmap); |
| r1932 | r1933 | |
| 62 | 60 | typewriter_bitmap = auto_bitmap_alloc(typewriter_window_width, typewriter_window_height, BITMAP_FORMAT_INDEXED16); |
| 63 | 61 | |
| 64 | 62 | /* set up out bitmaps */ |
| 65 | | pdp1_draw_panel_backdrop(panel_bitmap); |
| 63 | pdp1_draw_panel_backdrop(machine, panel_bitmap); |
| 66 | 64 | |
| 67 | 65 | fillbitmap(typewriter_bitmap, machine->pens[pen_typewriter_bg], &typewriter_bitmap_bounds); |
| 68 | 66 | |
| r1932 | r1933 | |
| 92 | 90 | VIDEO_UPDATE_CALL(crt); |
| 93 | 91 | pdp1_draw_lightpen(bitmap); |
| 94 | 92 | |
| 95 | | pdp1_draw_panel(panel_bitmap); |
| 93 | pdp1_draw_panel(machine, panel_bitmap); |
| 96 | 94 | copybitmap(bitmap, panel_bitmap, 0, 0, panel_window_offset_x, panel_window_offset_y, cliprect); |
| 97 | 95 | |
| 98 | 96 | copybitmap(bitmap, typewriter_bitmap, 0, 0, typewriter_window_offset_x, typewriter_window_offset_y, cliprect); |
| r1932 | r1933 | |
| 150 | 148 | }; |
| 151 | 149 | |
| 152 | 150 | /* draw a small 8*8 LED (or is this a lamp? ) */ |
| 153 | | static void pdp1_draw_led(bitmap_t *bitmap, int x, int y, int state) |
| 151 | static void pdp1_draw_led(running_machine *machine, bitmap_t *bitmap, int x, int y, int state) |
| 154 | 152 | { |
| 155 | 153 | int xx, yy; |
| 156 | 154 | |
| 157 | 155 | for (yy=1; yy<7; yy++) |
| 158 | 156 | for (xx=1; xx<7; xx++) |
| 159 | | 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, machine->pens[state ? pen_lit_lamp : pen_unlit_lamp]); |
| 160 | 158 | } |
| 161 | 159 | |
| 162 | 160 | /* draw nb_bits leds which represent nb_bits bits in value */ |
| 163 | | static void pdp1_draw_multipleled(bitmap_t *bitmap, int x, int y, int value, int nb_bits) |
| 161 | static void pdp1_draw_multipleled(running_machine *machine, bitmap_t *bitmap, int x, int y, int value, int nb_bits) |
| 164 | 162 | { |
| 165 | 163 | while (nb_bits) |
| 166 | 164 | { |
| 167 | 165 | nb_bits--; |
| 168 | 166 | |
| 169 | | pdp1_draw_led(bitmap, x, y, (value >> nb_bits) & 1); |
| 167 | pdp1_draw_led(machine, bitmap, x, y, (value >> nb_bits) & 1); |
| 170 | 168 | |
| 171 | 169 | x += 8; |
| 172 | 170 | } |
| r1932 | r1933 | |
| 174 | 172 | |
| 175 | 173 | |
| 176 | 174 | /* draw a small 8*8 switch */ |
| 177 | | static void pdp1_draw_switch(bitmap_t *bitmap, int x, int y, int state) |
| 175 | static void pdp1_draw_switch(running_machine *machine, bitmap_t *bitmap, int x, int y, int state) |
| 178 | 176 | { |
| 179 | 177 | int xx, yy; |
| 180 | 178 | int i; |
| r1932 | r1933 | |
| 182 | 180 | /* erase area */ |
| 183 | 181 | for (yy=0; yy<8; yy++) |
| 184 | 182 | for (xx=0; xx<8; xx++) |
| 185 | | pdp1_plot_pixel(bitmap, x+xx, y+yy, Machine->pens[pen_panel_bg]); |
| 183 | pdp1_plot_pixel(bitmap, x+xx, y+yy, machine->pens[pen_panel_bg]); |
| 186 | 184 | |
| 187 | 185 | |
| 188 | 186 | /* draw nut (-> circle) */ |
| 189 | 187 | for (i=0; i<4;i++) |
| 190 | 188 | { |
| 191 | | pdp1_plot_pixel(bitmap, x+2+i, y+1, Machine->pens[pen_switch_nut]); |
| 192 | | pdp1_plot_pixel(bitmap, x+2+i, y+6, Machine->pens[pen_switch_nut]); |
| 193 | | pdp1_plot_pixel(bitmap, x+1, y+2+i, Machine->pens[pen_switch_nut]); |
| 194 | | pdp1_plot_pixel(bitmap, x+6, y+2+i, Machine->pens[pen_switch_nut]); |
| 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]); |
| 195 | 193 | } |
| 196 | | pdp1_plot_pixel(bitmap, x+2, y+2, Machine->pens[pen_switch_nut]); |
| 197 | | pdp1_plot_pixel(bitmap, x+5, y+2, Machine->pens[pen_switch_nut]); |
| 198 | | pdp1_plot_pixel(bitmap, x+2, y+5, Machine->pens[pen_switch_nut]); |
| 199 | | pdp1_plot_pixel(bitmap, x+5, y+5, Machine->pens[pen_switch_nut]); |
| 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]); |
| 200 | 198 | |
| 201 | 199 | /* draw button (->disc) */ |
| 202 | 200 | if (! state) |
| 203 | 201 | y += 4; |
| 204 | 202 | for (i=0; i<2;i++) |
| 205 | 203 | { |
| 206 | | pdp1_plot_pixel(bitmap, x+3+i, y, Machine->pens[pen_switch_button]); |
| 207 | | pdp1_plot_pixel(bitmap, x+3+i, y+3, Machine->pens[pen_switch_button]); |
| 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]); |
| 208 | 206 | } |
| 209 | 207 | for (i=0; i<4;i++) |
| 210 | 208 | { |
| 211 | | pdp1_plot_pixel(bitmap, x+2+i, y+1, Machine->pens[pen_switch_button]); |
| 212 | | pdp1_plot_pixel(bitmap, x+2+i, y+2, Machine->pens[pen_switch_button]); |
| 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]); |
| 213 | 211 | } |
| 214 | 212 | } |
| 215 | 213 | |
| 216 | 214 | |
| 217 | 215 | /* draw nb_bits switches which represent nb_bits bits in value */ |
| 218 | | static void pdp1_draw_multipleswitch(bitmap_t *bitmap, int x, int y, int value, int nb_bits) |
| 216 | static void pdp1_draw_multipleswitch(running_machine *machine, bitmap_t *bitmap, int x, int y, int value, int nb_bits) |
| 219 | 217 | { |
| 220 | 218 | while (nb_bits) |
| 221 | 219 | { |
| 222 | 220 | nb_bits--; |
| 223 | 221 | |
| 224 | | pdp1_draw_switch(bitmap, x, y, (value >> nb_bits) & 1); |
| 222 | pdp1_draw_switch(machine, bitmap, x, y, (value >> nb_bits) & 1); |
| 225 | 223 | |
| 226 | 224 | x += 8; |
| 227 | 225 | } |
| r1932 | r1933 | |
| 229 | 227 | |
| 230 | 228 | |
| 231 | 229 | /* write a single char on screen */ |
| 232 | | static void pdp1_draw_char(bitmap_t *bitmap, char character, int x, int y, int color) |
| 230 | static void pdp1_draw_char(running_machine *machine, bitmap_t *bitmap, char character, int x, int y, int color) |
| 233 | 231 | { |
| 234 | | drawgfx(bitmap, Machine->gfx[0], character-32, color, 0, 0, |
| 235 | | x+1, y, &Machine->screen[0].visarea, TRANSPARENCY_PEN, 0); |
| 232 | drawgfx(bitmap, machine->gfx[0], character-32, color, 0, 0, |
| 233 | x+1, y, &machine->screen[0].visarea, TRANSPARENCY_PEN, 0); |
| 236 | 234 | } |
| 237 | 235 | |
| 238 | 236 | /* write a string on screen */ |
| 239 | | static void pdp1_draw_string(bitmap_t *bitmap, const char *buf, int x, int y, int color) |
| 237 | static void pdp1_draw_string(running_machine *machine, bitmap_t *bitmap, const char *buf, int x, int y, int color) |
| 240 | 238 | { |
| 241 | 239 | while (* buf) |
| 242 | 240 | { |
| 243 | | pdp1_draw_char(bitmap, *buf, x, y, color); |
| 241 | pdp1_draw_char(machine, bitmap, *buf, x, y, color); |
| 244 | 242 | |
| 245 | 243 | x += 8; |
| 246 | 244 | buf++; |
| r1932 | r1933 | |
| 251 | 249 | /* |
| 252 | 250 | draw the operator control panel (fixed backdrop) |
| 253 | 251 | */ |
| 254 | | static void pdp1_draw_panel_backdrop(bitmap_t *bitmap) |
| 252 | static void pdp1_draw_panel_backdrop(running_machine *machine, bitmap_t *bitmap) |
| 255 | 253 | { |
| 256 | 254 | /* fill with black */ |
| 257 | | fillbitmap(panel_bitmap, Machine->pens[pen_panel_bg], &panel_bitmap_bounds); |
| 255 | fillbitmap(panel_bitmap, machine->pens[pen_panel_bg], &panel_bitmap_bounds); |
| 258 | 256 | |
| 259 | 257 | /* column 1: registers, test word, test address */ |
| 260 | | pdp1_draw_string(bitmap, "program counter", x_panel_col1_offset, y_panel_pc_offset, color_panel_caption); |
| 261 | | pdp1_draw_string(bitmap, "memory address", x_panel_col1_offset, y_panel_ma_offset, color_panel_caption); |
| 262 | | pdp1_draw_string(bitmap, "memory buffer", x_panel_col1_offset, y_panel_mb_offset, color_panel_caption); |
| 263 | | pdp1_draw_string(bitmap, "accumulator", x_panel_col1_offset, y_panel_ac_offset, color_panel_caption); |
| 264 | | pdp1_draw_string(bitmap, "in-out", x_panel_col1_offset, y_panel_io_offset, color_panel_caption); |
| 265 | | pdp1_draw_string(bitmap, "extend address", x_panel_col1_offset-8, y_panel_ta_offset, color_panel_caption); |
| 266 | | pdp1_draw_string(bitmap, "test word", x_panel_col1_offset, y_panel_tw_offset, color_panel_caption); |
| 258 | pdp1_draw_string(machine, bitmap, "program counter", x_panel_col1_offset, y_panel_pc_offset, color_panel_caption); |
| 259 | pdp1_draw_string(machine, bitmap, "memory address", x_panel_col1_offset, y_panel_ma_offset, color_panel_caption); |
| 260 | pdp1_draw_string(machine, bitmap, "memory buffer", x_panel_col1_offset, y_panel_mb_offset, color_panel_caption); |
| 261 | pdp1_draw_string(machine, bitmap, "accumulator", x_panel_col1_offset, y_panel_ac_offset, color_panel_caption); |
| 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); |
| 264 | pdp1_draw_string(machine, bitmap, "test word", x_panel_col1_offset, y_panel_tw_offset, color_panel_caption); |
| 267 | 265 | |
| 268 | 266 | /* column separator */ |
| 269 | 267 | plot_box(bitmap, x_panel_col2_offset-4, panel_window_offset_y+8, 1, 96, pen_panel_caption); |
| 270 | 268 | |
| 271 | 269 | /* column 2: 1-bit indicators */ |
| 272 | | pdp1_draw_string(bitmap, "run", x_panel_col2_offset+8, y_panel_run_offset, color_panel_caption); |
| 273 | | pdp1_draw_string(bitmap, "cycle", x_panel_col2_offset+8, y_panel_cyc_offset, color_panel_caption); |
| 274 | | pdp1_draw_string(bitmap, "defer", x_panel_col2_offset+8, y_panel_defer_offset, color_panel_caption); |
| 275 | | pdp1_draw_string(bitmap, "h. s. cycle", x_panel_col2_offset+8, y_panel_hs_cyc_offset, color_panel_caption); |
| 276 | | pdp1_draw_string(bitmap, "brk. ctr. 1", x_panel_col2_offset+8, y_panel_brk_ctr_1_offset, color_panel_caption); |
| 277 | | pdp1_draw_string(bitmap, "brk. ctr. 2", x_panel_col2_offset+8, y_panel_brk_ctr_2_offset, color_panel_caption); |
| 278 | | pdp1_draw_string(bitmap, "overflow", x_panel_col2_offset+8, y_panel_ov_offset, color_panel_caption); |
| 279 | | pdp1_draw_string(bitmap, "read in", x_panel_col2_offset+8, y_panel_rim_offset, color_panel_caption); |
| 280 | | pdp1_draw_string(bitmap, "seq. break", x_panel_col2_offset+8, y_panel_sbm_offset, color_panel_caption); |
| 281 | | pdp1_draw_string(bitmap, "extend", x_panel_col2_offset+8, y_panel_exd_offset, color_panel_caption); |
| 282 | | pdp1_draw_string(bitmap, "i-o halt", x_panel_col2_offset+8, y_panel_ioh_offset, color_panel_caption); |
| 283 | | pdp1_draw_string(bitmap, "i-o com'ds", x_panel_col2_offset+8, y_panel_ioc_offset, color_panel_caption); |
| 284 | | pdp1_draw_string(bitmap, "i-o sync", x_panel_col2_offset+8, y_panel_ios_offset, color_panel_caption); |
| 270 | pdp1_draw_string(machine, bitmap, "run", x_panel_col2_offset+8, y_panel_run_offset, color_panel_caption); |
| 271 | pdp1_draw_string(machine, bitmap, "cycle", x_panel_col2_offset+8, y_panel_cyc_offset, color_panel_caption); |
| 272 | pdp1_draw_string(machine, bitmap, "defer", x_panel_col2_offset+8, y_panel_defer_offset, color_panel_caption); |
| 273 | pdp1_draw_string(machine, bitmap, "h. s. cycle", x_panel_col2_offset+8, y_panel_hs_cyc_offset, color_panel_caption); |
| 274 | pdp1_draw_string(machine, bitmap, "brk. ctr. 1", x_panel_col2_offset+8, y_panel_brk_ctr_1_offset, color_panel_caption); |
| 275 | pdp1_draw_string(machine, bitmap, "brk. ctr. 2", x_panel_col2_offset+8, y_panel_brk_ctr_2_offset, color_panel_caption); |
| 276 | pdp1_draw_string(machine, bitmap, "overflow", x_panel_col2_offset+8, y_panel_ov_offset, color_panel_caption); |
| 277 | pdp1_draw_string(machine, bitmap, "read in", x_panel_col2_offset+8, y_panel_rim_offset, color_panel_caption); |
| 278 | pdp1_draw_string(machine, bitmap, "seq. break", x_panel_col2_offset+8, y_panel_sbm_offset, color_panel_caption); |
| 279 | pdp1_draw_string(machine, bitmap, "extend", x_panel_col2_offset+8, y_panel_exd_offset, color_panel_caption); |
| 280 | pdp1_draw_string(machine, bitmap, "i-o halt", x_panel_col2_offset+8, y_panel_ioh_offset, color_panel_caption); |
| 281 | pdp1_draw_string(machine, bitmap, "i-o com'ds", x_panel_col2_offset+8, y_panel_ioc_offset, color_panel_caption); |
| 282 | pdp1_draw_string(machine, bitmap, "i-o sync", x_panel_col2_offset+8, y_panel_ios_offset, color_panel_caption); |
| 285 | 283 | |
| 286 | 284 | /* column separator */ |
| 287 | 285 | plot_box(bitmap, x_panel_col3_offset-4, panel_window_offset_y+8, 1, 96, pen_panel_caption); |
| 288 | 286 | |
| 289 | 287 | /* column 3: power, single step, single inst, sense, flags, instr... */ |
| 290 | | pdp1_draw_string(bitmap, "power", x_panel_col3_offset+16, y_panel_power_offset, color_panel_caption); |
| 291 | | pdp1_draw_string(bitmap, "single step", x_panel_col3_offset+16, y_panel_sngl_step_offset, color_panel_caption); |
| 292 | | pdp1_draw_string(bitmap, "single inst.", x_panel_col3_offset+16, y_panel_sngl_inst_offset, color_panel_caption); |
| 288 | pdp1_draw_string(machine, bitmap, "power", x_panel_col3_offset+16, y_panel_power_offset, color_panel_caption); |
| 289 | pdp1_draw_string(machine, bitmap, "single step", x_panel_col3_offset+16, y_panel_sngl_step_offset, color_panel_caption); |
| 290 | pdp1_draw_string(machine, bitmap, "single inst.", x_panel_col3_offset+16, y_panel_sngl_inst_offset, color_panel_caption); |
| 293 | 291 | /* separator */ |
| 294 | 292 | plot_box(bitmap, x_panel_col3_offset+8, y_panel_sep1_offset+4, 96, 1, pen_panel_caption); |
| 295 | | pdp1_draw_string(bitmap, "sense switches", x_panel_col3_offset, y_panel_ss_offset, color_panel_caption); |
| 293 | pdp1_draw_string(machine, bitmap, "sense switches", x_panel_col3_offset, y_panel_ss_offset, color_panel_caption); |
| 296 | 294 | /* separator */ |
| 297 | 295 | plot_box(bitmap, x_panel_col3_offset+8, y_panel_sep2_offset+4, 96, 1, pen_panel_caption); |
| 298 | | pdp1_draw_string(bitmap, "program flags", x_panel_col3_offset, y_panel_pf_offset, color_panel_caption); |
| 299 | | pdp1_draw_string(bitmap, "instruction", x_panel_col3_offset, y_panel_ir_offset, color_panel_caption); |
| 296 | pdp1_draw_string(machine, bitmap, "program flags", x_panel_col3_offset, y_panel_pf_offset, color_panel_caption); |
| 297 | pdp1_draw_string(machine, bitmap, "instruction", x_panel_col3_offset, y_panel_ir_offset, color_panel_caption); |
| 300 | 298 | } |
| 301 | 299 | |
| 302 | 300 | /* |
| 303 | 301 | draw the operator control panel (dynamic elements) |
| 304 | 302 | */ |
| 305 | | static void pdp1_draw_panel(bitmap_t *bitmap) |
| 303 | static void pdp1_draw_panel(running_machine *machine, bitmap_t *bitmap) |
| 306 | 304 | { |
| 307 | 305 | /* column 1: registers, test word, test address */ |
| 308 | | pdp1_draw_multipleled(bitmap, x_panel_col1_offset+2*8, y_panel_pc_offset+8, cpunum_get_reg(0, PDP1_PC), 16); |
| 309 | | pdp1_draw_multipleled(bitmap, x_panel_col1_offset+2*8, y_panel_ma_offset+8, cpunum_get_reg(0, PDP1_MA), 16); |
| 310 | | pdp1_draw_multipleled(bitmap, x_panel_col1_offset, y_panel_mb_offset+8, cpunum_get_reg(0, PDP1_MB), 18); |
| 311 | | pdp1_draw_multipleled(bitmap, x_panel_col1_offset, y_panel_ac_offset+8, cpunum_get_reg(0, PDP1_AC), 18); |
| 312 | | pdp1_draw_multipleled(bitmap, x_panel_col1_offset, y_panel_io_offset+8, cpunum_get_reg(0, PDP1_IO), 18); |
| 313 | | pdp1_draw_switch(bitmap, x_panel_col1_offset, y_panel_ta_offset+8, cpunum_get_reg(0, PDP1_EXTEND_SW)); |
| 314 | | pdp1_draw_multipleswitch(bitmap, x_panel_col1_offset+2*8, y_panel_ta_offset+8, cpunum_get_reg(0, PDP1_TA), 16); |
| 315 | | pdp1_draw_multipleswitch(bitmap, x_panel_col1_offset, y_panel_tw_offset+8, cpunum_get_reg(0, PDP1_TW), 18); |
| 306 | pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset+2*8, y_panel_pc_offset+8, cpunum_get_reg(0, PDP1_PC), 16); |
| 307 | pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset+2*8, y_panel_ma_offset+8, cpunum_get_reg(0, PDP1_MA), 16); |
| 308 | pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset, y_panel_mb_offset+8, cpunum_get_reg(0, PDP1_MB), 18); |
| 309 | pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset, y_panel_ac_offset+8, cpunum_get_reg(0, PDP1_AC), 18); |
| 310 | pdp1_draw_multipleled(machine, bitmap, x_panel_col1_offset, y_panel_io_offset+8, cpunum_get_reg(0, PDP1_IO), 18); |
| 311 | pdp1_draw_switch(machine, bitmap, x_panel_col1_offset, y_panel_ta_offset+8, cpunum_get_reg(0, PDP1_EXTEND_SW)); |
| 312 | pdp1_draw_multipleswitch(machine, bitmap, x_panel_col1_offset+2*8, y_panel_ta_offset+8, cpunum_get_reg(0, PDP1_TA), 16); |
| 313 | pdp1_draw_multipleswitch(machine, bitmap, x_panel_col1_offset, y_panel_tw_offset+8, cpunum_get_reg(0, PDP1_TW), 18); |
| 316 | 314 | |
| 317 | 315 | /* column 2: 1-bit indicators */ |
| 318 | | pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_run_offset, cpunum_get_reg(0, PDP1_RUN)); |
| 319 | | pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_cyc_offset, cpunum_get_reg(0, PDP1_CYC)); |
| 320 | | pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_defer_offset, cpunum_get_reg(0, PDP1_DEFER)); |
| 321 | | pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_hs_cyc_offset, 0); /* not emulated */ |
| 322 | | pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_brk_ctr_1_offset, cpunum_get_reg(0, PDP1_BRK_CTR) & 1); |
| 323 | | pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_brk_ctr_2_offset, cpunum_get_reg(0, PDP1_BRK_CTR) & 2); |
| 324 | | pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_ov_offset, cpunum_get_reg(0, PDP1_OV)); |
| 325 | | pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_rim_offset, cpunum_get_reg(0, PDP1_RIM)); |
| 326 | | pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_sbm_offset, cpunum_get_reg(0, PDP1_SBM)); |
| 327 | | pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_exd_offset, cpunum_get_reg(0, PDP1_EXD)); |
| 328 | | pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_ioh_offset, cpunum_get_reg(0, PDP1_IOH)); |
| 329 | | pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_ioc_offset, cpunum_get_reg(0, PDP1_IOC)); |
| 330 | | pdp1_draw_led(bitmap, x_panel_col2_offset, y_panel_ios_offset, cpunum_get_reg(0, PDP1_IOS)); |
| 316 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_run_offset, cpunum_get_reg(0, PDP1_RUN)); |
| 317 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_cyc_offset, cpunum_get_reg(0, PDP1_CYC)); |
| 318 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_defer_offset, cpunum_get_reg(0, PDP1_DEFER)); |
| 319 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_hs_cyc_offset, 0); /* not emulated */ |
| 320 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_brk_ctr_1_offset, cpunum_get_reg(0, PDP1_BRK_CTR) & 1); |
| 321 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_brk_ctr_2_offset, cpunum_get_reg(0, PDP1_BRK_CTR) & 2); |
| 322 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ov_offset, cpunum_get_reg(0, PDP1_OV)); |
| 323 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_rim_offset, cpunum_get_reg(0, PDP1_RIM)); |
| 324 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_sbm_offset, cpunum_get_reg(0, PDP1_SBM)); |
| 325 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_exd_offset, cpunum_get_reg(0, PDP1_EXD)); |
| 326 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ioh_offset, cpunum_get_reg(0, PDP1_IOH)); |
| 327 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ioc_offset, cpunum_get_reg(0, PDP1_IOC)); |
| 328 | pdp1_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ios_offset, cpunum_get_reg(0, PDP1_IOS)); |
| 331 | 329 | |
| 332 | 330 | /* column 3: power, single step, single inst, sense, flags, instr... */ |
| 333 | | pdp1_draw_led(bitmap, x_panel_col3_offset, y_panel_power_offset, 1); /* always on */ |
| 334 | | pdp1_draw_switch(bitmap, x_panel_col3_offset+8, y_panel_power_offset, 1); /* always on */ |
| 335 | | pdp1_draw_led(bitmap, x_panel_col3_offset, y_panel_sngl_step_offset, cpunum_get_reg(0, PDP1_SNGL_STEP)); |
| 336 | | pdp1_draw_switch(bitmap, x_panel_col3_offset+8, y_panel_sngl_step_offset, cpunum_get_reg(0, PDP1_SNGL_STEP)); |
| 337 | | pdp1_draw_led(bitmap, x_panel_col3_offset, y_panel_sngl_inst_offset, cpunum_get_reg(0, PDP1_SNGL_INST)); |
| 338 | | pdp1_draw_switch(bitmap, x_panel_col3_offset+8, y_panel_sngl_inst_offset, cpunum_get_reg(0, PDP1_SNGL_INST)); |
| 339 | | pdp1_draw_multipleled(bitmap, x_panel_col3_offset, y_panel_ss_offset+8, cpunum_get_reg(0, PDP1_SS), 6); |
| 340 | | pdp1_draw_multipleswitch(bitmap, x_panel_col3_offset, y_panel_ss_offset+2*8, cpunum_get_reg(0, PDP1_SS), 6); |
| 341 | | pdp1_draw_multipleled(bitmap, x_panel_col3_offset, y_panel_pf_offset+8, cpunum_get_reg(0, PDP1_PF), 6); |
| 342 | | pdp1_draw_multipleled(bitmap, x_panel_col3_offset, y_panel_ir_offset+8, cpunum_get_reg(0, PDP1_IR), 5); |
| 331 | pdp1_draw_led(machine, bitmap, x_panel_col3_offset, y_panel_power_offset, 1); /* always on */ |
| 332 | pdp1_draw_switch(machine, bitmap, x_panel_col3_offset+8, y_panel_power_offset, 1); /* always on */ |
| 333 | pdp1_draw_led(machine, bitmap, x_panel_col3_offset, y_panel_sngl_step_offset, cpunum_get_reg(0, PDP1_SNGL_STEP)); |
| 334 | pdp1_draw_switch(machine, bitmap, x_panel_col3_offset+8, y_panel_sngl_step_offset, cpunum_get_reg(0, PDP1_SNGL_STEP)); |
| 335 | pdp1_draw_led(machine, bitmap, x_panel_col3_offset, y_panel_sngl_inst_offset, cpunum_get_reg(0, PDP1_SNGL_INST)); |
| 336 | pdp1_draw_switch(machine, bitmap, x_panel_col3_offset+8, y_panel_sngl_inst_offset, cpunum_get_reg(0, PDP1_SNGL_INST)); |
| 337 | pdp1_draw_multipleled(machine, bitmap, x_panel_col3_offset, y_panel_ss_offset+8, cpunum_get_reg(0, PDP1_SS), 6); |
| 338 | pdp1_draw_multipleswitch(machine, bitmap, x_panel_col3_offset, y_panel_ss_offset+2*8, cpunum_get_reg(0, PDP1_SS), 6); |
| 339 | pdp1_draw_multipleled(machine, bitmap, x_panel_col3_offset, y_panel_pf_offset+8, cpunum_get_reg(0, PDP1_PF), 6); |
| 340 | pdp1_draw_multipleled(machine, bitmap, x_panel_col3_offset, y_panel_ir_offset+8, cpunum_get_reg(0, PDP1_IR), 5); |
| 343 | 341 | } |
| 344 | 342 | |
| 345 | 343 | |
| r1932 | r1933 | |
| 372 | 370 | }; |
| 373 | 371 | |
| 374 | 372 | |
| 375 | | static void pdp1_typewriter_linefeed(void) |
| 373 | static void pdp1_typewriter_linefeed(running_machine *machine) |
| 376 | 374 | { |
| 377 | 375 | UINT8 buf[typewriter_window_width]; |
| 378 | 376 | int y; |
| r1932 | r1933 | |
| 380 | 378 | for (y=0; y<typewriter_window_height-typewriter_scroll_step; y++) |
| 381 | 379 | { |
| 382 | 380 | extract_scanline8(typewriter_bitmap, 0, y+typewriter_scroll_step, typewriter_window_width, buf); |
| 383 | | draw_scanline8(typewriter_bitmap, 0, y, typewriter_window_width, buf, Machine->pens, -1); |
| 381 | draw_scanline8(typewriter_bitmap, 0, y, typewriter_window_width, buf, machine->pens, -1); |
| 384 | 382 | } |
| 385 | 383 | |
| 386 | | fillbitmap(typewriter_bitmap, Machine->pens[pen_typewriter_bg], &typewriter_scroll_clear_window); |
| 384 | fillbitmap(typewriter_bitmap, machine->pens[pen_typewriter_bg], &typewriter_scroll_clear_window); |
| 387 | 385 | } |
| 388 | 386 | |
| 389 | | void pdp1_typewriter_drawchar(int character) |
| 387 | void pdp1_typewriter_drawchar(running_machine *machine, int character) |
| 390 | 388 | { |
| 391 | 389 | static const char ascii_table[2][64] = |
| 392 | 390 | { /* n-s = non-spacing */ |
| r1932 | r1933 | |
| 468 | 466 | case 077: |
| 469 | 467 | /* Carriage Return */ |
| 470 | 468 | pos = 0; |
| 471 | | pdp1_typewriter_linefeed(); |
| 469 | pdp1_typewriter_linefeed(machine); |
| 472 | 470 | break; |
| 473 | 471 | |
| 474 | 472 | default: |
| r1932 | r1933 | |
| 476 | 474 | |
| 477 | 475 | if (pos >= 80) |
| 478 | 476 | { /* if past right border, wrap around. (Right???) */ |
| 479 | | pdp1_typewriter_linefeed(); /* next line */ |
| 477 | pdp1_typewriter_linefeed(machine); /* next line */ |
| 480 | 478 | pos = 0; /* return to start of line */ |
| 481 | 479 | } |
| 482 | 480 | |
| 483 | 481 | /* print character (lookup ASCII equivalent in table) */ |
| 484 | | pdp1_draw_char(typewriter_bitmap, ascii_table[case_shift][character], |
| 482 | pdp1_draw_char(machine, typewriter_bitmap, ascii_table[case_shift][character], |
| 485 | 483 | 8*pos, typewriter_write_offset_y, |
| 486 | 484 | color); /* print char */ |
| 487 | 485 | |