src/mess/video/tx0.c
| r1922 | r1923 | |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | 7 | #include "driver.h" |
| 8 | | #include "deprecat.h" |
| 9 | 8 | |
| 10 | 9 | #include "cpu/pdp1/tx0.h" |
| 11 | 10 | #include "includes/tx0.h" |
| r1922 | r1923 | |
| 32 | 31 | 0, typewriter_window_height-1, /* min_y, max_y */ |
| 33 | 32 | }; |
| 34 | 33 | |
| 35 | | static void tx0_draw_panel_backdrop(bitmap_t *bitmap); |
| 36 | | static void tx0_draw_panel(bitmap_t *bitmap); |
| 34 | static void tx0_draw_panel_backdrop(running_machine *machine, bitmap_t *bitmap); |
| 35 | static void tx0_draw_panel(running_machine *machine, bitmap_t *bitmap); |
| 37 | 36 | |
| 38 | 37 | |
| 39 | 38 | |
| r1922 | r1923 | |
| 47 | 46 | typewriter_bitmap = auto_bitmap_alloc(typewriter_window_width, typewriter_window_height, BITMAP_FORMAT_INDEXED16); |
| 48 | 47 | |
| 49 | 48 | /* set up out bitmaps */ |
| 50 | | tx0_draw_panel_backdrop(panel_bitmap); |
| 49 | tx0_draw_panel_backdrop(machine, panel_bitmap); |
| 51 | 50 | |
| 52 | 51 | fillbitmap(typewriter_bitmap, machine->pens[pen_typewriter_bg], &typewriter_bitmap_bounds); |
| 53 | 52 | |
| r1922 | r1923 | |
| 75 | 74 | { |
| 76 | 75 | VIDEO_UPDATE_CALL(crt); |
| 77 | 76 | |
| 78 | | tx0_draw_panel(panel_bitmap); |
| 77 | tx0_draw_panel(machine, panel_bitmap); |
| 79 | 78 | copybitmap(bitmap, panel_bitmap, 0, 0, panel_window_offset_x, panel_window_offset_y, cliprect); |
| 80 | 79 | |
| 81 | 80 | copybitmap(bitmap, typewriter_bitmap, 0, 0, typewriter_window_offset_x, typewriter_window_offset_y, cliprect); |
| r1922 | r1923 | |
| 123 | 122 | }; |
| 124 | 123 | |
| 125 | 124 | /* draw a small 8*8 LED (or is this a lamp? ) */ |
| 126 | | static void tx0_draw_led(bitmap_t *bitmap, int x, int y, int state) |
| 125 | static void tx0_draw_led(running_machine *machine, bitmap_t *bitmap, int x, int y, int state) |
| 127 | 126 | { |
| 128 | 127 | int xx, yy; |
| 129 | 128 | |
| 130 | 129 | for (yy=1; yy<7; yy++) |
| 131 | 130 | for (xx=1; xx<7; xx++) |
| 132 | | tx0_plot_pixel(bitmap, x+xx, y+yy, Machine->pens[state ? pen_lit_lamp : pen_unlit_lamp]); |
| 131 | tx0_plot_pixel(bitmap, x+xx, y+yy, machine->pens[state ? pen_lit_lamp : pen_unlit_lamp]); |
| 133 | 132 | } |
| 134 | 133 | |
| 135 | 134 | /* draw nb_bits leds which represent nb_bits bits in value */ |
| 136 | | static void tx0_draw_multipleled(bitmap_t *bitmap, int x, int y, int value, int nb_bits) |
| 135 | static void tx0_draw_multipleled(running_machine *machine, bitmap_t *bitmap, int x, int y, int value, int nb_bits) |
| 137 | 136 | { |
| 138 | 137 | while (nb_bits) |
| 139 | 138 | { |
| 140 | 139 | nb_bits--; |
| 141 | 140 | |
| 142 | | tx0_draw_led(bitmap, x, y, (value >> nb_bits) & 1); |
| 141 | tx0_draw_led(machine, bitmap, x, y, (value >> nb_bits) & 1); |
| 143 | 142 | |
| 144 | 143 | x += 8; |
| 145 | 144 | } |
| r1922 | r1923 | |
| 147 | 146 | |
| 148 | 147 | |
| 149 | 148 | /* draw a small 8*8 switch */ |
| 150 | | static void tx0_draw_switch(bitmap_t *bitmap, int x, int y, int state) |
| 149 | static void tx0_draw_switch(running_machine *machine, bitmap_t *bitmap, int x, int y, int state) |
| 151 | 150 | { |
| 152 | 151 | int xx, yy; |
| 153 | 152 | int i; |
| r1922 | r1923 | |
| 155 | 154 | /* erase area */ |
| 156 | 155 | for (yy=0; yy<8; yy++) |
| 157 | 156 | for (xx=0; xx<8; xx++) |
| 158 | | tx0_plot_pixel(bitmap, x+xx, y+yy, Machine->pens[pen_panel_bg]); |
| 157 | tx0_plot_pixel(bitmap, x+xx, y+yy, machine->pens[pen_panel_bg]); |
| 159 | 158 | |
| 160 | 159 | |
| 161 | 160 | /* draw nut (-> circle) */ |
| 162 | 161 | for (i=0; i<4;i++) |
| 163 | 162 | { |
| 164 | | tx0_plot_pixel(bitmap, x+2+i, y+1, Machine->pens[pen_switch_nut]); |
| 165 | | tx0_plot_pixel(bitmap, x+2+i, y+6, Machine->pens[pen_switch_nut]); |
| 166 | | tx0_plot_pixel(bitmap, x+1, y+2+i, Machine->pens[pen_switch_nut]); |
| 167 | | tx0_plot_pixel(bitmap, x+6, y+2+i, Machine->pens[pen_switch_nut]); |
| 163 | tx0_plot_pixel(bitmap, x+2+i, y+1, machine->pens[pen_switch_nut]); |
| 164 | tx0_plot_pixel(bitmap, x+2+i, y+6, machine->pens[pen_switch_nut]); |
| 165 | tx0_plot_pixel(bitmap, x+1, y+2+i, machine->pens[pen_switch_nut]); |
| 166 | tx0_plot_pixel(bitmap, x+6, y+2+i, machine->pens[pen_switch_nut]); |
| 168 | 167 | } |
| 169 | | tx0_plot_pixel(bitmap, x+2, y+2, Machine->pens[pen_switch_nut]); |
| 170 | | tx0_plot_pixel(bitmap, x+5, y+2, Machine->pens[pen_switch_nut]); |
| 171 | | tx0_plot_pixel(bitmap, x+2, y+5, Machine->pens[pen_switch_nut]); |
| 172 | | tx0_plot_pixel(bitmap, x+5, y+5, Machine->pens[pen_switch_nut]); |
| 168 | tx0_plot_pixel(bitmap, x+2, y+2, machine->pens[pen_switch_nut]); |
| 169 | tx0_plot_pixel(bitmap, x+5, y+2, machine->pens[pen_switch_nut]); |
| 170 | tx0_plot_pixel(bitmap, x+2, y+5, machine->pens[pen_switch_nut]); |
| 171 | tx0_plot_pixel(bitmap, x+5, y+5, machine->pens[pen_switch_nut]); |
| 173 | 172 | |
| 174 | 173 | /* draw button (->disc) */ |
| 175 | 174 | if (! state) |
| 176 | 175 | y += 4; |
| 177 | 176 | for (i=0; i<2;i++) |
| 178 | 177 | { |
| 179 | | tx0_plot_pixel(bitmap, x+3+i, y, Machine->pens[pen_switch_button]); |
| 180 | | tx0_plot_pixel(bitmap, x+3+i, y+3, Machine->pens[pen_switch_button]); |
| 178 | tx0_plot_pixel(bitmap, x+3+i, y, machine->pens[pen_switch_button]); |
| 179 | tx0_plot_pixel(bitmap, x+3+i, y+3, machine->pens[pen_switch_button]); |
| 181 | 180 | } |
| 182 | 181 | for (i=0; i<4;i++) |
| 183 | 182 | { |
| 184 | | tx0_plot_pixel(bitmap, x+2+i, y+1, Machine->pens[pen_switch_button]); |
| 185 | | tx0_plot_pixel(bitmap, x+2+i, y+2, Machine->pens[pen_switch_button]); |
| 183 | tx0_plot_pixel(bitmap, x+2+i, y+1, machine->pens[pen_switch_button]); |
| 184 | tx0_plot_pixel(bitmap, x+2+i, y+2, machine->pens[pen_switch_button]); |
| 186 | 185 | } |
| 187 | 186 | } |
| 188 | 187 | |
| 189 | 188 | |
| 190 | 189 | /* draw nb_bits switches which represent nb_bits bits in value */ |
| 191 | | static void tx0_draw_multipleswitch(bitmap_t *bitmap, int x, int y, int value, int nb_bits) |
| 190 | static void tx0_draw_multipleswitch(running_machine *machine, bitmap_t *bitmap, int x, int y, int value, int nb_bits) |
| 192 | 191 | { |
| 193 | 192 | while (nb_bits) |
| 194 | 193 | { |
| 195 | 194 | nb_bits--; |
| 196 | 195 | |
| 197 | | tx0_draw_switch(bitmap, x, y, (value >> nb_bits) & 1); |
| 196 | tx0_draw_switch(machine, bitmap, x, y, (value >> nb_bits) & 1); |
| 198 | 197 | |
| 199 | 198 | x += 8; |
| 200 | 199 | } |
| r1922 | r1923 | |
| 202 | 201 | |
| 203 | 202 | |
| 204 | 203 | /* write a single char on screen */ |
| 205 | | static void tx0_draw_char(bitmap_t *bitmap, char character, int x, int y, int color) |
| 204 | static void tx0_draw_char(running_machine *machine, bitmap_t *bitmap, char character, int x, int y, int color) |
| 206 | 205 | { |
| 207 | | drawgfx(bitmap, Machine->gfx[0], character-32, color, 0, 0, |
| 208 | | x+1, y, &Machine->screen[0].visarea, TRANSPARENCY_PEN, 0); |
| 206 | drawgfx(bitmap, machine->gfx[0], character-32, color, 0, 0, |
| 207 | x+1, y, &machine->screen[0].visarea, TRANSPARENCY_PEN, 0); |
| 209 | 208 | } |
| 210 | 209 | |
| 211 | 210 | /* write a string on screen */ |
| 212 | | static void tx0_draw_string(bitmap_t *bitmap, const char *buf, int x, int y, int color) |
| 211 | static void tx0_draw_string(running_machine *machine, bitmap_t *bitmap, const char *buf, int x, int y, int color) |
| 213 | 212 | { |
| 214 | 213 | while (* buf) |
| 215 | 214 | { |
| 216 | | tx0_draw_char(bitmap, *buf, x, y, color); |
| 215 | tx0_draw_char(machine, bitmap, *buf, x, y, color); |
| 217 | 216 | |
| 218 | 217 | x += 8; |
| 219 | 218 | buf++; |
| r1922 | r1923 | |
| 240 | 239 | /* |
| 241 | 240 | draw the operator control panel (fixed backdrop) |
| 242 | 241 | */ |
| 243 | | static void tx0_draw_panel_backdrop(bitmap_t *bitmap) |
| 242 | static void tx0_draw_panel_backdrop(running_machine *machine, bitmap_t *bitmap) |
| 244 | 243 | { |
| 245 | 244 | int i; |
| 246 | 245 | char buf[3]; |
| 247 | 246 | |
| 248 | 247 | /* fill with black */ |
| 249 | | fillbitmap(panel_bitmap, Machine->pens[pen_panel_bg], &panel_bitmap_bounds); |
| 248 | fillbitmap(panel_bitmap, machine->pens[pen_panel_bg], &panel_bitmap_bounds); |
| 250 | 249 | |
| 251 | 250 | /* column 1: registers, test accumulator, test buffer, toggle switch storage */ |
| 252 | | tx0_draw_string(bitmap, "program counter", x_panel_col1b_offset, y_panel_pc_offset, color_panel_caption); |
| 253 | | tx0_draw_string(bitmap, "memory address reg.", x_panel_col1b_offset, y_panel_mar_offset, color_panel_caption); |
| 254 | | tx0_draw_string(bitmap, "memory buffer reg.", x_panel_col1b_offset, y_panel_mbr_offset, color_panel_caption); |
| 255 | | tx0_draw_string(bitmap, "accumulator", x_panel_col1b_offset, y_panel_ac_offset, color_panel_caption); |
| 256 | | tx0_draw_string(bitmap, "live register", x_panel_col1b_offset, y_panel_lr_offset, color_panel_caption); |
| 257 | | tx0_draw_string(bitmap, "index register", x_panel_col1b_offset, y_panel_xr_offset, color_panel_caption); |
| 258 | | tx0_draw_string(bitmap, "TBR", x_panel_col1b_offset, y_panel_tbr_offset, color_panel_caption); |
| 259 | | tx0_draw_string(bitmap, "TAC", x_panel_col1b_offset, y_panel_tac_offset, color_panel_caption); |
| 260 | | tx0_draw_string(bitmap, "cm", x_panel_col1a_offset+8, y_panel_tss_offset, color_panel_caption); |
| 261 | | tx0_draw_string(bitmap, "TSS", x_panel_col1a_offset+24, y_panel_tss_offset, color_panel_caption); |
| 262 | | tx0_draw_string(bitmap, "lr", x_panel_col1a_offset+168, y_panel_tss_offset, color_panel_caption); |
| 251 | tx0_draw_string(machine, bitmap, "program counter", x_panel_col1b_offset, y_panel_pc_offset, color_panel_caption); |
| 252 | tx0_draw_string(machine, bitmap, "memory address reg.", x_panel_col1b_offset, y_panel_mar_offset, color_panel_caption); |
| 253 | tx0_draw_string(machine, bitmap, "memory buffer reg.", x_panel_col1b_offset, y_panel_mbr_offset, color_panel_caption); |
| 254 | tx0_draw_string(machine, bitmap, "accumulator", x_panel_col1b_offset, y_panel_ac_offset, color_panel_caption); |
| 255 | tx0_draw_string(machine, bitmap, "live register", x_panel_col1b_offset, y_panel_lr_offset, color_panel_caption); |
| 256 | tx0_draw_string(machine, bitmap, "index register", x_panel_col1b_offset, y_panel_xr_offset, color_panel_caption); |
| 257 | tx0_draw_string(machine, bitmap, "TBR", x_panel_col1b_offset, y_panel_tbr_offset, color_panel_caption); |
| 258 | tx0_draw_string(machine, bitmap, "TAC", x_panel_col1b_offset, y_panel_tac_offset, color_panel_caption); |
| 259 | tx0_draw_string(machine, bitmap, "cm", x_panel_col1a_offset+8, y_panel_tss_offset, color_panel_caption); |
| 260 | tx0_draw_string(machine, bitmap, "TSS", x_panel_col1a_offset+24, y_panel_tss_offset, color_panel_caption); |
| 261 | tx0_draw_string(machine, bitmap, "lr", x_panel_col1a_offset+168, y_panel_tss_offset, color_panel_caption); |
| 263 | 262 | for (i=0; i<16; i++) |
| 264 | 263 | { |
| 265 | 264 | sprintf(buf, "%2o", i); |
| 266 | | tx0_draw_string(bitmap, buf, x_panel_col1a_offset, y_panel_tss_offset+8+i*8, color_panel_caption); |
| 265 | tx0_draw_string(machine, bitmap, buf, x_panel_col1a_offset, y_panel_tss_offset+8+i*8, color_panel_caption); |
| 267 | 266 | } |
| 268 | 267 | |
| 269 | 268 | /* column separator */ |
| 270 | 269 | tx0_draw_vline(bitmap, x_panel_col2_offset-4, 8, 248, pen_panel_caption); |
| 271 | 270 | |
| 272 | 271 | /* column 2: stop c0, stop c1, cm sel, 1-bit indicators, instr, flags */ |
| 273 | | tx0_draw_string(bitmap, "stop c0", x_panel_col2_offset+8, y_panel_stop_c0_offset, color_panel_caption); |
| 274 | | tx0_draw_string(bitmap, "stop c1", x_panel_col2_offset+8, y_panel_stop_c1_offset, color_panel_caption); |
| 275 | | tx0_draw_string(bitmap, "cm select", x_panel_col2_offset+8, y_panel_gbl_cm_sel_offset, color_panel_caption); |
| 276 | | tx0_draw_string(bitmap, "run", x_panel_col2_offset+8, y_panel_run_offset, color_panel_caption); |
| 277 | | tx0_draw_string(bitmap, "cycle1", x_panel_col2_offset+8, y_panel_cycle1_offset, color_panel_caption); |
| 278 | | tx0_draw_string(bitmap, "cycle2", x_panel_col2_offset+8, y_panel_cycle2_offset, color_panel_caption); |
| 279 | | tx0_draw_string(bitmap, "read in", x_panel_col2_offset+8, y_panel_rim_offset, color_panel_caption); |
| 280 | | tx0_draw_string(bitmap, "i-o halt", x_panel_col2_offset+8, y_panel_ioh_offset, color_panel_caption); |
| 281 | | tx0_draw_string(bitmap, "i-o sync", x_panel_col2_offset+8, y_panel_ios_offset, color_panel_caption); |
| 282 | | tx0_draw_string(bitmap, "instr", x_panel_col2_offset+8, y_panel_ir_offset, color_panel_caption); |
| 283 | | tx0_draw_string(bitmap, "pgm flags", x_panel_col2_offset+8, y_panel_pf_offset, color_panel_caption); |
| 272 | tx0_draw_string(machine, bitmap, "stop c0", x_panel_col2_offset+8, y_panel_stop_c0_offset, color_panel_caption); |
| 273 | tx0_draw_string(machine, bitmap, "stop c1", x_panel_col2_offset+8, y_panel_stop_c1_offset, color_panel_caption); |
| 274 | tx0_draw_string(machine, bitmap, "cm select", x_panel_col2_offset+8, y_panel_gbl_cm_sel_offset, color_panel_caption); |
| 275 | tx0_draw_string(machine, bitmap, "run", x_panel_col2_offset+8, y_panel_run_offset, color_panel_caption); |
| 276 | tx0_draw_string(machine, bitmap, "cycle1", x_panel_col2_offset+8, y_panel_cycle1_offset, color_panel_caption); |
| 277 | tx0_draw_string(machine, bitmap, "cycle2", x_panel_col2_offset+8, y_panel_cycle2_offset, color_panel_caption); |
| 278 | tx0_draw_string(machine, bitmap, "read in", x_panel_col2_offset+8, y_panel_rim_offset, color_panel_caption); |
| 279 | tx0_draw_string(machine, bitmap, "i-o halt", x_panel_col2_offset+8, y_panel_ioh_offset, color_panel_caption); |
| 280 | tx0_draw_string(machine, bitmap, "i-o sync", x_panel_col2_offset+8, y_panel_ios_offset, color_panel_caption); |
| 281 | tx0_draw_string(machine, bitmap, "instr", x_panel_col2_offset+8, y_panel_ir_offset, color_panel_caption); |
| 282 | tx0_draw_string(machine, bitmap, "pgm flags", x_panel_col2_offset+8, y_panel_pf_offset, color_panel_caption); |
| 284 | 283 | } |
| 285 | 284 | |
| 286 | 285 | |
| 287 | 286 | /* |
| 288 | 287 | draw the operator control panel (dynamic elements) |
| 289 | 288 | */ |
| 290 | | static void tx0_draw_panel(bitmap_t *bitmap) |
| 289 | static void tx0_draw_panel(running_machine *machine, bitmap_t *bitmap) |
| 291 | 290 | { |
| 292 | 291 | int cm_sel, lr_sel; |
| 293 | 292 | int i; |
| 294 | 293 | |
| 295 | 294 | /* column 1: registers, test accumulator, test buffer, toggle switch storage */ |
| 296 | | tx0_draw_multipleled(bitmap, x_panel_col1b_offset+2*8, y_panel_pc_offset+8, cpunum_get_reg(0, TX0_PC), 16); |
| 297 | | tx0_draw_multipleled(bitmap, x_panel_col1b_offset+2*8, y_panel_mar_offset+8, cpunum_get_reg(0, TX0_MAR), 16); |
| 298 | | tx0_draw_multipleled(bitmap, x_panel_col1b_offset, y_panel_mbr_offset+8, cpunum_get_reg(0, TX0_MBR), 18); |
| 299 | | tx0_draw_multipleled(bitmap, x_panel_col1b_offset, y_panel_ac_offset+8, cpunum_get_reg(0, TX0_AC), 18); |
| 300 | | tx0_draw_multipleled(bitmap, x_panel_col1b_offset, y_panel_lr_offset+8, cpunum_get_reg(0, TX0_LR), 18); |
| 301 | | tx0_draw_multipleled(bitmap, x_panel_col1b_offset+4*8, y_panel_xr_offset+8, cpunum_get_reg(0, TX0_XR), 14); |
| 302 | | tx0_draw_multipleswitch(bitmap, x_panel_col1b_offset, y_panel_tbr_offset+8, cpunum_get_reg(0, TX0_TBR), 18); |
| 303 | | tx0_draw_multipleswitch(bitmap, x_panel_col1b_offset, y_panel_tac_offset+8, cpunum_get_reg(0, TX0_TAC), 18); |
| 295 | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset+2*8, y_panel_pc_offset+8, cpunum_get_reg(0, TX0_PC), 16); |
| 296 | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset+2*8, y_panel_mar_offset+8, cpunum_get_reg(0, TX0_MAR), 16); |
| 297 | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset, y_panel_mbr_offset+8, cpunum_get_reg(0, TX0_MBR), 18); |
| 298 | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset, y_panel_ac_offset+8, cpunum_get_reg(0, TX0_AC), 18); |
| 299 | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset, y_panel_lr_offset+8, cpunum_get_reg(0, TX0_LR), 18); |
| 300 | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset+4*8, y_panel_xr_offset+8, cpunum_get_reg(0, TX0_XR), 14); |
| 301 | tx0_draw_multipleswitch(machine, bitmap, x_panel_col1b_offset, y_panel_tbr_offset+8, cpunum_get_reg(0, TX0_TBR), 18); |
| 302 | tx0_draw_multipleswitch(machine, bitmap, x_panel_col1b_offset, y_panel_tac_offset+8, cpunum_get_reg(0, TX0_TAC), 18); |
| 304 | 303 | cm_sel = cpunum_get_reg(0, TX0_CM_SEL); |
| 305 | 304 | lr_sel = cpunum_get_reg(0, TX0_LR_SEL); |
| 306 | 305 | for (i=0; i<16; i++) |
| 307 | 306 | { |
| 308 | | tx0_draw_switch(bitmap, x_panel_col1a_offset+16, y_panel_tss_offset+8+i*8, (cm_sel >> i) & 1); |
| 309 | | tx0_draw_multipleswitch(bitmap, x_panel_col1a_offset+24, y_panel_tss_offset+8+i*8, cpunum_get_reg(0, TX0_TSS00+i), 18); |
| 310 | | tx0_draw_switch(bitmap, x_panel_col1a_offset+168, y_panel_tss_offset+8+i*8, (lr_sel >> i) & 1); |
| 307 | tx0_draw_switch(machine, bitmap, x_panel_col1a_offset+16, y_panel_tss_offset+8+i*8, (cm_sel >> i) & 1); |
| 308 | tx0_draw_multipleswitch(machine, bitmap, x_panel_col1a_offset+24, y_panel_tss_offset+8+i*8, cpunum_get_reg(0, TX0_TSS00+i), 18); |
| 309 | tx0_draw_switch(machine, bitmap, x_panel_col1a_offset+168, y_panel_tss_offset+8+i*8, (lr_sel >> i) & 1); |
| 311 | 310 | } |
| 312 | 311 | |
| 313 | 312 | /* column 2: stop c0, stop c1, cm sel, 1-bit indicators, instr, flags */ |
| 314 | | tx0_draw_switch(bitmap, x_panel_col2_offset, y_panel_stop_c0_offset, cpunum_get_reg(0, TX0_STOP_CYC0)); |
| 315 | | tx0_draw_switch(bitmap, x_panel_col2_offset, y_panel_stop_c1_offset, cpunum_get_reg(0, TX0_STOP_CYC1)); |
| 316 | | tx0_draw_switch(bitmap, x_panel_col2_offset, y_panel_gbl_cm_sel_offset, cpunum_get_reg(0, TX0_GBL_CM_SEL)); |
| 317 | | tx0_draw_led(bitmap, x_panel_col2_offset, y_panel_run_offset, cpunum_get_reg(0, TX0_RUN)); |
| 318 | | tx0_draw_led(bitmap, x_panel_col2_offset, y_panel_cycle1_offset, cpunum_get_reg(0, TX0_CYCLE) & 1); |
| 319 | | tx0_draw_led(bitmap, x_panel_col2_offset, y_panel_cycle2_offset, cpunum_get_reg(0, TX0_CYCLE) & 2); |
| 320 | | tx0_draw_led(bitmap, x_panel_col2_offset, y_panel_rim_offset, cpunum_get_reg(0, TX0_RIM)); |
| 321 | | tx0_draw_led(bitmap, x_panel_col2_offset, y_panel_ioh_offset, cpunum_get_reg(0, TX0_IOH)); |
| 322 | | tx0_draw_led(bitmap, x_panel_col2_offset, y_panel_ios_offset, cpunum_get_reg(0, TX0_IOS)); |
| 323 | | tx0_draw_multipleled(bitmap, x_panel_col2_offset, y_panel_ir_offset+8, cpunum_get_reg(0, TX0_IR), 5); |
| 324 | | tx0_draw_multipleled(bitmap, x_panel_col2_offset, y_panel_pf_offset+8, cpunum_get_reg(0, TX0_PF), 6); |
| 313 | tx0_draw_switch(machine, bitmap, x_panel_col2_offset, y_panel_stop_c0_offset, cpunum_get_reg(0, TX0_STOP_CYC0)); |
| 314 | tx0_draw_switch(machine, bitmap, x_panel_col2_offset, y_panel_stop_c1_offset, cpunum_get_reg(0, TX0_STOP_CYC1)); |
| 315 | tx0_draw_switch(machine, bitmap, x_panel_col2_offset, y_panel_gbl_cm_sel_offset, cpunum_get_reg(0, TX0_GBL_CM_SEL)); |
| 316 | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_run_offset, cpunum_get_reg(0, TX0_RUN)); |
| 317 | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_cycle1_offset, cpunum_get_reg(0, TX0_CYCLE) & 1); |
| 318 | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_cycle2_offset, cpunum_get_reg(0, TX0_CYCLE) & 2); |
| 319 | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_rim_offset, cpunum_get_reg(0, TX0_RIM)); |
| 320 | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ioh_offset, cpunum_get_reg(0, TX0_IOH)); |
| 321 | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ios_offset, cpunum_get_reg(0, TX0_IOS)); |
| 322 | tx0_draw_multipleled(machine, bitmap, x_panel_col2_offset, y_panel_ir_offset+8, cpunum_get_reg(0, TX0_IR), 5); |
| 323 | tx0_draw_multipleled(machine, bitmap, x_panel_col2_offset, y_panel_pf_offset+8, cpunum_get_reg(0, TX0_PF), 6); |
| 325 | 324 | } |
| 326 | 325 | |
| 327 | 326 | |
| r1922 | r1923 | |
| 355 | 354 | }; |
| 356 | 355 | |
| 357 | 356 | |
| 358 | | static void tx0_typewriter_linefeed(void) |
| 357 | static void tx0_typewriter_linefeed(running_machine *machine) |
| 359 | 358 | { |
| 360 | 359 | UINT8 buf[typewriter_window_width]; |
| 361 | 360 | int y; |
| r1922 | r1923 | |
| 363 | 362 | for (y=0; y<typewriter_window_height-typewriter_scroll_step; y++) |
| 364 | 363 | { |
| 365 | 364 | extract_scanline8(typewriter_bitmap, 0, y+typewriter_scroll_step, typewriter_window_width, buf); |
| 366 | | draw_scanline8(typewriter_bitmap, 0, y, typewriter_window_width, buf, Machine->pens, -1); |
| 365 | draw_scanline8(typewriter_bitmap, 0, y, typewriter_window_width, buf, machine->pens, -1); |
| 367 | 366 | } |
| 368 | 367 | |
| 369 | | fillbitmap(typewriter_bitmap, Machine->pens[pen_typewriter_bg], &typewriter_scroll_clear_window); |
| 368 | fillbitmap(typewriter_bitmap, machine->pens[pen_typewriter_bg], &typewriter_scroll_clear_window); |
| 370 | 369 | } |
| 371 | 370 | |
| 372 | | void tx0_typewriter_drawchar(int character) |
| 371 | void tx0_typewriter_drawchar(running_machine *machine, int character) |
| 373 | 372 | { |
| 374 | 373 | static const char ascii_table[2][64] = |
| 375 | 374 | { |
| r1922 | r1923 | |
| 437 | 436 | case 051: |
| 438 | 437 | /* Carriage Return */ |
| 439 | 438 | pos = 0; |
| 440 | | tx0_typewriter_linefeed(); |
| 439 | tx0_typewriter_linefeed( machine ); |
| 441 | 440 | break; |
| 442 | 441 | |
| 443 | 442 | case 061: |
| r1922 | r1923 | |
| 465 | 464 | |
| 466 | 465 | if (pos >= 80) |
| 467 | 466 | { /* if past right border, wrap around. (Right???) */ |
| 468 | | tx0_typewriter_linefeed(); /* next line */ |
| 467 | tx0_typewriter_linefeed( machine ); /* next line */ |
| 469 | 468 | pos = 0; /* return to start of line */ |
| 470 | 469 | } |
| 471 | 470 | |
| 472 | 471 | /* print character (lookup ASCII equivalent in table) */ |
| 473 | | tx0_draw_char(typewriter_bitmap, ascii_table[case_shift][character], |
| 472 | tx0_draw_char(machine, typewriter_bitmap, ascii_table[case_shift][character], |
| 474 | 473 | 8*pos, typewriter_write_offset_y, |
| 475 | 474 | color); /* print char */ |
| 476 | 475 | |