src/mess/video/tx0.c
| r4593 | r4594 | |
| 292 | 292 | int i; |
| 293 | 293 | |
| 294 | 294 | /* column 1: registers, test accumulator, test buffer, toggle switch storage */ |
| 295 | | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset+2*8, y_panel_pc_offset+8, cpu_get_reg(machine->cpu[0], TX0_PC), 16); |
| 296 | | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset+2*8, y_panel_mar_offset+8, cpu_get_reg(machine->cpu[0], TX0_MAR), 16); |
| 297 | | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset, y_panel_mbr_offset+8, cpu_get_reg(machine->cpu[0], TX0_MBR), 18); |
| 298 | | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset, y_panel_ac_offset+8, cpu_get_reg(machine->cpu[0], TX0_AC), 18); |
| 299 | | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset, y_panel_lr_offset+8, cpu_get_reg(machine->cpu[0], TX0_LR), 18); |
| 300 | | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset+4*8, y_panel_xr_offset+8, cpu_get_reg(machine->cpu[0], TX0_XR), 14); |
| 301 | | tx0_draw_multipleswitch(machine, bitmap, x_panel_col1b_offset, y_panel_tbr_offset+8, cpu_get_reg(machine->cpu[0], TX0_TBR), 18); |
| 302 | | tx0_draw_multipleswitch(machine, bitmap, x_panel_col1b_offset, y_panel_tac_offset+8, cpu_get_reg(machine->cpu[0], TX0_TAC), 18); |
| 303 | | cm_sel = cpu_get_reg(machine->cpu[0], TX0_CM_SEL); |
| 304 | | lr_sel = cpu_get_reg(machine->cpu[0], TX0_LR_SEL); |
| 295 | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset+2*8, y_panel_pc_offset+8, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_PC), 16); |
| 296 | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset+2*8, y_panel_mar_offset+8, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_MAR), 16); |
| 297 | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset, y_panel_mbr_offset+8, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_MBR), 18); |
| 298 | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset, y_panel_ac_offset+8, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_AC), 18); |
| 299 | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset, y_panel_lr_offset+8, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_LR), 18); |
| 300 | tx0_draw_multipleled(machine, bitmap, x_panel_col1b_offset+4*8, y_panel_xr_offset+8, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_XR), 14); |
| 301 | tx0_draw_multipleswitch(machine, bitmap, x_panel_col1b_offset, y_panel_tbr_offset+8, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_TBR), 18); |
| 302 | tx0_draw_multipleswitch(machine, bitmap, x_panel_col1b_offset, y_panel_tac_offset+8, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_TAC), 18); |
| 303 | cm_sel = cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_CM_SEL); |
| 304 | lr_sel = cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_LR_SEL); |
| 305 | 305 | for (i=0; i<16; i++) |
| 306 | 306 | { |
| 307 | 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, cpu_get_reg(machine->cpu[0], TX0_TSS00+i), 18); |
| 308 | tx0_draw_multipleswitch(machine, bitmap, x_panel_col1a_offset+24, y_panel_tss_offset+8+i*8, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_TSS00+i), 18); |
| 309 | 309 | tx0_draw_switch(machine, bitmap, x_panel_col1a_offset+168, y_panel_tss_offset+8+i*8, (lr_sel >> i) & 1); |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | /* column 2: stop c0, stop c1, cm sel, 1-bit indicators, instr, flags */ |
| 313 | | tx0_draw_switch(machine, bitmap, x_panel_col2_offset, y_panel_stop_c0_offset, cpu_get_reg(machine->cpu[0], TX0_STOP_CYC0)); |
| 314 | | tx0_draw_switch(machine, bitmap, x_panel_col2_offset, y_panel_stop_c1_offset, cpu_get_reg(machine->cpu[0], TX0_STOP_CYC1)); |
| 315 | | tx0_draw_switch(machine, bitmap, x_panel_col2_offset, y_panel_gbl_cm_sel_offset, cpu_get_reg(machine->cpu[0], TX0_GBL_CM_SEL)); |
| 316 | | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_run_offset, cpu_get_reg(machine->cpu[0], TX0_RUN)); |
| 317 | | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_cycle1_offset, cpu_get_reg(machine->cpu[0], TX0_CYCLE) & 1); |
| 318 | | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_cycle2_offset, cpu_get_reg(machine->cpu[0], TX0_CYCLE) & 2); |
| 319 | | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_rim_offset, cpu_get_reg(machine->cpu[0], TX0_RIM)); |
| 320 | | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ioh_offset, cpu_get_reg(machine->cpu[0], TX0_IOH)); |
| 321 | | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ios_offset, cpu_get_reg(machine->cpu[0], TX0_IOS)); |
| 322 | | tx0_draw_multipleled(machine, bitmap, x_panel_col2_offset, y_panel_ir_offset+8, cpu_get_reg(machine->cpu[0], TX0_IR), 5); |
| 323 | | tx0_draw_multipleled(machine, bitmap, x_panel_col2_offset, y_panel_pf_offset+8, cpu_get_reg(machine->cpu[0], TX0_PF), 6); |
| 313 | tx0_draw_switch(machine, bitmap, x_panel_col2_offset, y_panel_stop_c0_offset, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_STOP_CYC0)); |
| 314 | tx0_draw_switch(machine, bitmap, x_panel_col2_offset, y_panel_stop_c1_offset, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_STOP_CYC1)); |
| 315 | tx0_draw_switch(machine, bitmap, x_panel_col2_offset, y_panel_gbl_cm_sel_offset, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_GBL_CM_SEL)); |
| 316 | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_run_offset, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_RUN)); |
| 317 | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_cycle1_offset, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_CYCLE) & 1); |
| 318 | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_cycle2_offset, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_CYCLE) & 2); |
| 319 | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_rim_offset, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_RIM)); |
| 320 | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ioh_offset, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_IOH)); |
| 321 | tx0_draw_led(machine, bitmap, x_panel_col2_offset, y_panel_ios_offset, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_IOS)); |
| 322 | tx0_draw_multipleled(machine, bitmap, x_panel_col2_offset, y_panel_ir_offset+8, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_IR), 5); |
| 323 | tx0_draw_multipleled(machine, bitmap, x_panel_col2_offset, y_panel_pf_offset+8, cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_PF), 6); |
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | |
src/mess/machine/coco.c
| r4593 | r4594 | |
| 600 | 600 | { |
| 601 | 601 | coco_state *state = machine->driver_data; |
| 602 | 602 | |
| 603 | | cpu_set_reg(machine->cpu[0], M6809_PC, trailer->reg_pc); |
| 604 | | cpu_set_reg(machine->cpu[0], M6809_X, trailer->reg_x); |
| 605 | | cpu_set_reg(machine->cpu[0], M6809_Y, trailer->reg_y); |
| 606 | | cpu_set_reg(machine->cpu[0], M6809_U, trailer->reg_u); |
| 607 | | cpu_set_reg(machine->cpu[0], M6809_S, trailer->reg_s); |
| 608 | | cpu_set_reg(machine->cpu[0], M6809_DP, trailer->reg_dp); |
| 609 | | cpu_set_reg(machine->cpu[0], M6809_B, trailer->reg_b); |
| 610 | | cpu_set_reg(machine->cpu[0], M6809_A, trailer->reg_a); |
| 611 | | cpu_set_reg(machine->cpu[0], M6809_CC, trailer->reg_cc); |
| 603 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), M6809_PC, trailer->reg_pc); |
| 604 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), M6809_X, trailer->reg_x); |
| 605 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), M6809_Y, trailer->reg_y); |
| 606 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), M6809_U, trailer->reg_u); |
| 607 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), M6809_S, trailer->reg_s); |
| 608 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), M6809_DP, trailer->reg_dp); |
| 609 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), M6809_B, trailer->reg_b); |
| 610 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), M6809_A, trailer->reg_a); |
| 611 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), M6809_CC, trailer->reg_cc); |
| 612 | 612 | |
| 613 | 613 | /* I seem to only be able to get a small amount of the PIA state from the |
| 614 | 614 | * snapshot trailers. Thus I am going to configure the PIA myself. The |
| r4593 | r4594 | |
| 773 | 773 | if (preamble != 0) |
| 774 | 774 | { |
| 775 | 775 | /* start address - just set the address and return */ |
| 776 | | cpu_set_reg(image->machine->cpu[0], REG_GENPC, block_address); |
| 776 | cpu_set_reg(cputag_get_cpu(image->machine, "maincpu"), REG_GENPC, block_address); |
| 777 | 777 | done = TRUE; |
| 778 | 778 | } |
| 779 | 779 | else |
| 780 | 780 | { |
| 781 | | const address_space *space = cpu_get_address_space( image->machine->cpu[0], ADDRESS_SPACE_PROGRAM ); |
| 781 | const address_space *space = cputag_get_address_space( image->machine, "maincpu", ADDRESS_SPACE_PROGRAM ); |
| 782 | 782 | |
| 783 | 783 | /* data block - need to cap the maximum length of the block */ |
| 784 | 784 | block_length = MIN(block_length, length - position); |
| r4593 | r4594 | |
| 912 | 912 | UINT8 pia0_irq_b = pia6821_get_irq_b(state->pia_0); |
| 913 | 913 | |
| 914 | 914 | if (pia0_irq_a || pia0_irq_b) |
| 915 | | cpu_set_input_line(machine->cpu[0], M6809_IRQ_LINE, ASSERT_LINE); |
| 915 | cputag_set_input_line(machine, "maincpu", M6809_IRQ_LINE, ASSERT_LINE); |
| 916 | 916 | else |
| 917 | | cpu_set_input_line(machine->cpu[0], M6809_IRQ_LINE, CLEAR_LINE); |
| 917 | cputag_set_input_line(machine, "maincpu", M6809_IRQ_LINE, CLEAR_LINE); |
| 918 | 918 | } |
| 919 | 919 | |
| 920 | 920 | static void d_recalc_firq(running_machine *machine) |
| r4593 | r4594 | |
| 926 | 926 | UINT8 pia2_firq_b = (state->pia_2 != NULL) ? pia6821_get_irq_b(state->pia_2) : 0x00; |
| 927 | 927 | |
| 928 | 928 | if (pia1_firq_a || pia1_firq_b || pia2_firq_a || pia2_firq_b) |
| 929 | | cpu_set_input_line(machine->cpu[0], M6809_FIRQ_LINE, ASSERT_LINE); |
| 929 | cputag_set_input_line(machine, "maincpu", M6809_FIRQ_LINE, ASSERT_LINE); |
| 930 | 930 | else |
| 931 | | cpu_set_input_line(machine->cpu[0], M6809_FIRQ_LINE, CLEAR_LINE); |
| 931 | cputag_set_input_line(machine, "maincpu", M6809_FIRQ_LINE, CLEAR_LINE); |
| 932 | 932 | } |
| 933 | 933 | |
| 934 | 934 | static void coco3_recalc_irq(running_machine *machine) |
| 935 | 935 | { |
| 936 | 936 | if ((coco3_gimereg[0] & 0x20) && gime_irq) |
| 937 | | cpu_set_input_line(machine->cpu[0], M6809_IRQ_LINE, ASSERT_LINE); |
| 937 | cputag_set_input_line(machine, "maincpu", M6809_IRQ_LINE, ASSERT_LINE); |
| 938 | 938 | else |
| 939 | 939 | d_recalc_irq(machine); |
| 940 | 940 | } |
| r4593 | r4594 | |
| 942 | 942 | static void coco3_recalc_firq(running_machine *machine) |
| 943 | 943 | { |
| 944 | 944 | if ((coco3_gimereg[0] & 0x10) && gime_firq) |
| 945 | | cpu_set_input_line(machine->cpu[0], M6809_FIRQ_LINE, ASSERT_LINE); |
| 945 | cputag_set_input_line(machine, "maincpu", M6809_FIRQ_LINE, ASSERT_LINE); |
| 946 | 946 | else |
| 947 | 947 | d_recalc_firq(machine); |
| 948 | 948 | } |
| r4593 | r4594 | |
| 1079 | 1079 | { |
| 1080 | 1080 | cpunum_set_input_line(machine, 0, INPUT_LINE_HALT, halt_line); |
| 1081 | 1081 | if (halt_line == CLEAR_LINE) |
| 1082 | | timer_set(machine, cpu_clocks_to_attotime(machine->cpu[0], 1), NULL, 0, recalc_interrupts); |
| 1082 | timer_set(machine, cputag_clocks_to_attotime(machine, "maincpu", 1), NULL, 0, recalc_interrupts); |
| 1083 | 1083 | } |
| 1084 | 1084 | #endif |
| 1085 | 1085 | |
| r4593 | r4594 | |
| 1806 | 1806 | switch(state) |
| 1807 | 1807 | { |
| 1808 | 1808 | case WD17XX_IRQ_CLR: |
| 1809 | | cpu_set_input_line(device->machine->cpu[0], INPUT_LINE_NMI, CLEAR_LINE); |
| 1809 | cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_NMI, CLEAR_LINE); |
| 1810 | 1810 | break; |
| 1811 | 1811 | case WD17XX_IRQ_SET: |
| 1812 | 1812 | if(dgnalpha_just_reset) |
| r4593 | r4594 | |
| 1816 | 1816 | else |
| 1817 | 1817 | { |
| 1818 | 1818 | if (pia6821_get_output_ca2_z(cstate->pia_2)) |
| 1819 | | cpu_set_input_line(device->machine->cpu[0], INPUT_LINE_NMI, ASSERT_LINE); |
| 1819 | cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_NMI, ASSERT_LINE); |
| 1820 | 1820 | } |
| 1821 | 1821 | break; |
| 1822 | 1822 | case WD17XX_DRQ_CLR: |
| r4593 | r4594 | |
| 2040 | 2040 | * TODO: Make the overclock more accurate. In dual speed, ROM was a fast |
| 2041 | 2041 | * access but RAM was not. I don't know how to simulate this. |
| 2042 | 2042 | */ |
| 2043 | | cpu_set_clockscale(device->machine->cpu[0], val ? 2 : 1); |
| 2043 | cpu_set_clockscale(cputag_get_cpu(device->machine, "maincpu"), val ? 2 : 1); |
| 2044 | 2044 | } |
| 2045 | 2045 | |
| 2046 | 2046 | READ8_HANDLER(dragon_alpha_mapped_irq_r) |
| r4593 | r4594 | |
| 2100 | 2100 | }; |
| 2101 | 2101 | |
| 2102 | 2102 | /* We need to init these vars from the sam, as this may be called from outside the sam callbacks */ |
| 2103 | | const address_space *space = cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_PROGRAM ); |
| 2103 | const address_space *space = cputag_get_address_space( machine, "maincpu", ADDRESS_SPACE_PROGRAM ); |
| 2104 | 2104 | coco_state *state = machine->driver_data; |
| 2105 | 2105 | UINT8 memsize = get_sam_memorysize(state->sam); |
| 2106 | 2106 | UINT8 maptype = get_sam_maptype(state->sam); |
| r4593 | r4594 | |
| 2443 | 2443 | { 0xfe00, 0xfeff } |
| 2444 | 2444 | }; |
| 2445 | 2445 | |
| 2446 | | const address_space *space = cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_PROGRAM ); |
| 2446 | const address_space *space = cputag_get_address_space( machine, "maincpu", ADDRESS_SPACE_PROGRAM ); |
| 2447 | 2447 | int i, offset, writebank; |
| 2448 | 2448 | UINT8 *readbank; |
| 2449 | 2449 | UINT8 *cart_rom = memory_region(machine, "cart"); |
| r4593 | r4594 | |
| 2804 | 2804 | |
| 2805 | 2805 | void coco_halt_w(const device_config *device, int data) |
| 2806 | 2806 | { |
| 2807 | | cpu_set_input_line(device->machine->cpu[0], INPUT_LINE_HALT, data ? ASSERT_LINE : CLEAR_LINE); |
| 2807 | cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_HALT, data ? ASSERT_LINE : CLEAR_LINE); |
| 2808 | 2808 | } |
| 2809 | 2809 | |
| 2810 | 2810 | |
| r4593 | r4594 | |
| 2815 | 2815 | |
| 2816 | 2816 | void coco_nmi_w(const device_config *device, int data) |
| 2817 | 2817 | { |
| 2818 | | cpu_set_input_line(device->machine->cpu[0], INPUT_LINE_NMI, data ? ASSERT_LINE : CLEAR_LINE); |
| 2818 | cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_NMI, data ? ASSERT_LINE : CLEAR_LINE); |
| 2819 | 2819 | } |
| 2820 | 2820 | |
| 2821 | 2821 | |
| r4593 | r4594 | |
| 2893 | 2893 | /* setup printer output callback */ |
| 2894 | 2894 | printer_out = init->printer_out_; |
| 2895 | 2895 | |
| 2896 | | debug_cpu_set_dasm_override(machine->cpu[0], coco_dasm_override); |
| 2896 | debug_cpu_set_dasm_override(cputag_get_cpu(machine, "maincpu"), coco_dasm_override); |
| 2897 | 2897 | |
| 2898 | 2898 | state_save_register_global(machine, mux_sel1); |
| 2899 | 2899 | state_save_register_global(machine, mux_sel2); |
src/mess/machine/thomson.c
| r4593 | r4594 | |
| 95 | 95 | if ( bitpos >= to7_k7_bitsize ) |
| 96 | 96 | bitpos = to7_k7_bitsize -1; |
| 97 | 97 | VLOG (( "$%04x %f to7_get_cassette: state=$%X pos=%f samppos=%i bit=%i\n", |
| 98 | | cpu_get_previouspc( machine->cpu[0] ), attotime_to_double(timer_get_time(machine)), state, pos, bitpos, |
| 98 | cpu_get_previouspc(cputag_get_cpu(machine, "maincpu")), attotime_to_double(timer_get_time(machine)), state, pos, bitpos, |
| 99 | 99 | to7_k7_bits[ bitpos ] )); |
| 100 | 100 | return to7_k7_bits[ bitpos ]; |
| 101 | 101 | } |
| r4593 | r4594 | |
| 116 | 116 | } |
| 117 | 117 | k = ( chg >= 13 ) ? 1 : 0; |
| 118 | 118 | VLOG (( "$%04x %f to7_get_cassette: state=$%X pos=%f samppos=%i bit=%i (%i)\n", |
| 119 | | cpu_get_previouspc( machine->cpu[0] ), attotime_to_double(timer_get_time(machine)), state, pos, bitpos, |
| 119 | cpu_get_previouspc(cputag_get_cpu(machine, "maincpu")), attotime_to_double(timer_get_time(machine)), state, pos, bitpos, |
| 120 | 120 | k, chg )); |
| 121 | 121 | return k; |
| 122 | 122 | } |
| r4593 | r4594 | |
| 144 | 144 | double pos = cassette_get_position(img); |
| 145 | 145 | |
| 146 | 146 | LOG (( "$%04x %f to7_set_cassette_motor: cassette motor %s bitpos=%i\n", |
| 147 | | cpu_get_previouspc( device->machine->cpu[0] ), attotime_to_double(timer_get_time(img->machine)), data ? "off" : "on", |
| 147 | cpu_get_previouspc(cputag_get_cpu(device->machine, "maincpu")), attotime_to_double(timer_get_time(img->machine)), data ? "off" : "on", |
| 148 | 148 | (int) (pos / TO7_BIT_LENGTH) )); |
| 149 | 149 | |
| 150 | 150 | if ( (state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED && !data && pos > 0.3 ) |
| r4593 | r4594 | |
| 194 | 194 | hbit = hbit >= 0; |
| 195 | 195 | |
| 196 | 196 | VLOG (( "$%04x %f mo5_get_cassette: state=$%X pos=%f hbitpos=%i hbit=%i\n", |
| 197 | | cpu_get_previouspc( machine->cpu[0] ), attotime_to_double(timer_get_time(machine)), state, pos, |
| 197 | cpu_get_previouspc(cputag_get_cpu(machine, "maincpu")), attotime_to_double(timer_get_time(machine)), state, pos, |
| 198 | 198 | (int) (pos / MO5_HBIT_LENGTH), hbit )); |
| 199 | 199 | return hbit; |
| 200 | 200 | } |
| r4593 | r4594 | |
| 219 | 219 | double pos = cassette_get_position(img); |
| 220 | 220 | |
| 221 | 221 | LOG (( "$%04x %f mo5_set_cassette_motor: cassette motor %s hbitpos=%i\n", |
| 222 | | cpu_get_previouspc( device->machine->cpu[0] ), attotime_to_double(timer_get_time(device->machine)), data ? "off" : "on", |
| 222 | cpu_get_previouspc(cputag_get_cpu(device->machine, "maincpu")), attotime_to_double(timer_get_time(device->machine)), data ? "off" : "on", |
| 223 | 223 | (int) (pos / MO5_HBIT_LENGTH) )); |
| 224 | 224 | |
| 225 | 225 | if ( (state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_DISABLED && !data && pos > 0.3 ) |
| r4593 | r4594 | |
| 263 | 263 | if ( old && !thom_irq ) |
| 264 | 264 | LOG_IRQ(( "%f thom_set_irq: irq line down %i\n", attotime_to_double(timer_get_time(machine)), line )); |
| 265 | 265 | |
| 266 | | cpu_set_input_line(machine->cpu[0], M6809_IRQ_LINE, thom_irq ? ASSERT_LINE : CLEAR_LINE ); |
| 266 | cputag_set_input_line(machine, "maincpu", M6809_IRQ_LINE, thom_irq ? ASSERT_LINE : CLEAR_LINE); |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | |
| r4593 | r4594 | |
| 282 | 282 | if ( old && !thom_firq ) |
| 283 | 283 | LOG_IRQ(( "%f thom_set_firq: firq line down %i\n", attotime_to_double(timer_get_time(machine)), line )); |
| 284 | 284 | |
| 285 | | cpu_set_input_line( machine->cpu[0], M6809_FIRQ_LINE, thom_firq ? ASSERT_LINE : CLEAR_LINE ); |
| 285 | cputag_set_input_line(machine, "maincpu", M6809_FIRQ_LINE, thom_firq ? ASSERT_LINE : CLEAR_LINE); |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | |
| r4593 | r4594 | |
| 291 | 291 | { |
| 292 | 292 | thom_irq = 0; |
| 293 | 293 | thom_firq = 0; |
| 294 | | cpu_set_input_line( machine->cpu[0], M6809_IRQ_LINE, CLEAR_LINE ); |
| 295 | | cpu_set_input_line( machine->cpu[0], M6809_FIRQ_LINE, CLEAR_LINE ); |
| 294 | cputag_set_input_line( machine, "maincpu", M6809_IRQ_LINE, CLEAR_LINE ); |
| 295 | cputag_set_input_line( machine, "maincpu", M6809_FIRQ_LINE, CLEAR_LINE ); |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | |
| r4593 | r4594 | |
| 505 | 505 | |
| 506 | 506 | static void to7_update_cart_bank(running_machine *machine) |
| 507 | 507 | { |
| 508 | | const address_space* space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 508 | const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 509 | 509 | static int old_bank = -1; |
| 510 | 510 | int bank = 0; |
| 511 | 511 | if ( thom_cart_nb_banks ) |
| r4593 | r4594 | |
| 770 | 770 | int tx = data & 1; |
| 771 | 771 | int dtr = ( data & 2 ) ? 1 : 0; |
| 772 | 772 | |
| 773 | | LOG_IO(( "$%04x %f to7_io_porta_out: tx=%i, dtr=%i\n", cpu_get_previouspc( device->machine->cpu[0] ), attotime_to_double(timer_get_time(device->machine)), tx, dtr )); |
| 773 | LOG_IO(( "$%04x %f to7_io_porta_out: tx=%i, dtr=%i\n", cpu_get_previouspc(cputag_get_cpu(device->machine, "maincpu")), attotime_to_double(timer_get_time(device->machine)), tx, dtr )); |
| 774 | 774 | if ( dtr ) |
| 775 | 775 | to7_io_line.State |= SERIAL_STATE_DTR; |
| 776 | 776 | else |
| r4593 | r4594 | |
| 794 | 794 | else |
| 795 | 795 | cts = !centronics_busy_r(printer); |
| 796 | 796 | |
| 797 | | LOG_IO(( "$%04x %f to7_io_porta_in: mode=%i cts=%i, dsr=%i, rd=%i\n", cpu_get_previouspc( device->machine->cpu[0] ), attotime_to_double(timer_get_time(device->machine)), to7_io_mode(device->machine), cts, dsr, rd )); |
| 797 | LOG_IO(( "$%04x %f to7_io_porta_in: mode=%i cts=%i, dsr=%i, rd=%i\n", cpu_get_previouspc(cputag_get_cpu(device->machine, "maincpu")), attotime_to_double(timer_get_time(device->machine)), to7_io_mode(device->machine), cts, dsr, rd )); |
| 798 | 798 | |
| 799 | 799 | return (dsr ? 0x20 : 0) | (cts ? 0x40 : 0) | (rd ? 0x80: 0); |
| 800 | 800 | } |
| r4593 | r4594 | |
| 805 | 805 | { |
| 806 | 806 | const device_config *printer = devtag_get_device(device->machine, "centronics"); |
| 807 | 807 | |
| 808 | | LOG_IO(( "$%04x %f to7_io_portb_out: CENTRONICS set data=$%02X\n", cpu_get_previouspc( device->machine->cpu[0] ), attotime_to_double(timer_get_time(device->machine)), data )); |
| 808 | LOG_IO(( "$%04x %f to7_io_portb_out: CENTRONICS set data=$%02X\n", cpu_get_previouspc(cputag_get_cpu(device->machine, "maincpu")), attotime_to_double(timer_get_time(device->machine)), data )); |
| 809 | 809 | |
| 810 | 810 | /* set 8-bit data */ |
| 811 | 811 | centronics_data_w(printer, 0, data); |
| r4593 | r4594 | |
| 817 | 817 | { |
| 818 | 818 | const device_config *printer = devtag_get_device(device->machine, "centronics"); |
| 819 | 819 | |
| 820 | | LOG_IO(( "$%04x %f to7_io_cb2_out: CENTRONICS set strobe=%i\n", cpu_get_previouspc( device->machine->cpu[0] ), attotime_to_double(timer_get_time(device->machine)), data )); |
| 820 | LOG_IO(( "$%04x %f to7_io_cb2_out: CENTRONICS set strobe=%i\n", cpu_get_previouspc(cputag_get_cpu(device->machine, "maincpu")), attotime_to_double(timer_get_time(device->machine)), data )); |
| 821 | 821 | |
| 822 | 822 | /* send STROBE to printer */ |
| 823 | 823 | centronics_strobe_w(printer, data); |
| r4593 | r4594 | |
| 1328 | 1328 | /* bit 6: parity error (ignored) */ |
| 1329 | 1329 | /* bit 7: interrupt */ |
| 1330 | 1330 | LOG_MIDI(( "$%04x %f to7_midi_r: status $%02X (rdrf=%i, tdre=%i, ovrn=%i, irq=%i)\n", |
| 1331 | | cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), to7_midi_status, |
| 1331 | cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)), to7_midi_status, |
| 1332 | 1332 | (to7_midi_status & ACIA_6850_RDRF) ? 1 : 0, |
| 1333 | 1333 | (to7_midi_status & ACIA_6850_TDRE) ? 1 : 0, |
| 1334 | 1334 | (to7_midi_status & ACIA_6850_OVRN) ? 1 : 0, |
| r4593 | r4594 | |
| 1346 | 1346 | to7_midi_status &= ~ACIA_6850_OVRN; |
| 1347 | 1347 | to7_midi_overrun = 0; |
| 1348 | 1348 | LOG_MIDI(( "$%04x %f to7_midi_r: read data $%02X\n", |
| 1349 | | cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), data )); |
| 1349 | cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)), data )); |
| 1350 | 1350 | to7_midi_update_irq( space->machine ); |
| 1351 | 1351 | return data; |
| 1352 | 1352 | } |
| r4593 | r4594 | |
| 1354 | 1354 | |
| 1355 | 1355 | default: |
| 1356 | 1356 | logerror( "$%04x to7_midi_r: invalid offset %i\n", |
| 1357 | | cpu_get_previouspc( space->machine->cpu[0] ), offset ); |
| 1357 | cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset ); |
| 1358 | 1358 | return 0; |
| 1359 | 1359 | } |
| 1360 | 1360 | } |
| r4593 | r4594 | |
| 1373 | 1373 | if ( (data & 3) == 3 ) |
| 1374 | 1374 | { |
| 1375 | 1375 | /* reset */ |
| 1376 | | LOG_MIDI(( "$%04x %f to7_midi_w: reset (data=$%02X)\n", cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), data )); |
| 1376 | LOG_MIDI(( "$%04x %f to7_midi_w: reset (data=$%02X)\n", cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)), data )); |
| 1377 | 1377 | to7_midi_overrun = 0; |
| 1378 | 1378 | to7_midi_status = 2; |
| 1379 | 1379 | to7_midi_intr = 0; |
| r4593 | r4594 | |
| 1390 | 1390 | static const int stop[8] = { 2,2,1,1,2,1,1,1 }; |
| 1391 | 1391 | static const char parity[8] = { 'e','o','e','o','-','-','e','o' }; |
| 1392 | 1392 | LOG_MIDI(( "$%04x %f to7_midi_w: set control to $%02X (bits=%i, stop=%i, parity=%c, intr in=%i out=%i)\n", |
| 1393 | | cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), |
| 1393 | cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)), |
| 1394 | 1394 | data, |
| 1395 | 1395 | bits[ (data >> 2) & 7 ], |
| 1396 | 1396 | stop[ (data >> 2) & 7 ], |
| r4593 | r4594 | |
| 1404 | 1404 | |
| 1405 | 1405 | |
| 1406 | 1406 | case 1: /* output data */ |
| 1407 | | LOG_MIDI(( "$%04x %f to7_midi_w: write data $%02X\n", cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), data )); |
| 1407 | LOG_MIDI(( "$%04x %f to7_midi_w: write data $%02X\n", cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)), data )); |
| 1408 | 1408 | if ( data == 0x55 ) |
| 1409 | 1409 | /* cable-detect: shortcut */ |
| 1410 | 1410 | chardev_fake_in( to7_midi_chardev, 0x55 ); |
| r4593 | r4594 | |
| 1418 | 1418 | |
| 1419 | 1419 | |
| 1420 | 1420 | default: |
| 1421 | | logerror( "$%04x to7_midi_w: invalid offset %i (data=$%02X) \n", cpu_get_previouspc( space->machine->cpu[0] ), offset, data ); |
| 1421 | logerror( "$%04x to7_midi_w: invalid offset %i (data=$%02X) \n", cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset, data ); |
| 1422 | 1422 | } |
| 1423 | 1423 | } |
| 1424 | 1424 | |
| r4593 | r4594 | |
| 1529 | 1529 | |
| 1530 | 1530 | MACHINE_START ( to7 ) |
| 1531 | 1531 | { |
| 1532 | | const address_space* space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 1532 | const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 1533 | 1533 | UINT8* mem = memory_region(machine, "maincpu"); |
| 1534 | 1534 | |
| 1535 | 1535 | LOG (( "to7: machine start called\n" )); |
| r4593 | r4594 | |
| 1588 | 1588 | static WRITE8_DEVICE_HANDLER ( to770_sys_cb2_out ) |
| 1589 | 1589 | { |
| 1590 | 1590 | /* video overlay: black pixels are transparent and show TV image underneath */ |
| 1591 | | LOG(( "$%04x to770_sys_cb2_out: video overlay %i\n", cpu_get_previouspc( device->machine->cpu[0] ), data )); |
| 1591 | LOG(( "$%04x to770_sys_cb2_out: video overlay %i\n", cpu_get_previouspc(cputag_get_cpu(device->machine, "maincpu")), data )); |
| 1592 | 1592 | } |
| 1593 | 1593 | |
| 1594 | 1594 | |
| r4593 | r4594 | |
| 1608 | 1608 | static void to770_update_ram_bank(running_machine *machine) |
| 1609 | 1609 | { |
| 1610 | 1610 | const device_config *sys_pia = devtag_get_device( machine, THOM_PIA_SYS ); |
| 1611 | | const address_space* space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 1611 | const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 1612 | 1612 | UINT8 portb = pia6821_get_port_b_z_mask( sys_pia ); |
| 1613 | 1613 | static int old_bank = -1; |
| 1614 | 1614 | int bank; |
| r4593 | r4594 | |
| 1730 | 1730 | case 2: return (lt3 << 7) | (inil << 6); |
| 1731 | 1731 | case 3: return (init << 7); |
| 1732 | 1732 | default: |
| 1733 | | logerror( "$%04x to770_gatearray_r: invalid offset %i\n", cpu_get_previouspc( space->machine->cpu[0] ), offset ); |
| 1733 | logerror( "$%04x to770_gatearray_r: invalid offset %i\n", cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset ); |
| 1734 | 1734 | return 0; |
| 1735 | 1735 | } |
| 1736 | 1736 | } |
| r4593 | r4594 | |
| 1958 | 1958 | case 2: return (lt3 << 7) | (inil << 6); |
| 1959 | 1959 | case 3: return (init << 7); |
| 1960 | 1960 | default: |
| 1961 | | logerror( "$%04x mo5_gatearray_r: invalid offset %i\n", cpu_get_previouspc( space->machine->cpu[0] ), offset ); |
| 1961 | logerror( "$%04x mo5_gatearray_r: invalid offset %i\n", cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset ); |
| 1962 | 1962 | return 0; |
| 1963 | 1963 | } |
| 1964 | 1964 | } |
| r4593 | r4594 | |
| 2029 | 2029 | |
| 2030 | 2030 | static void mo5_update_cart_bank(running_machine *machine) |
| 2031 | 2031 | { |
| 2032 | | const address_space* space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 2032 | const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 2033 | 2033 | static int old_bank = -1; |
| 2034 | 2034 | int rom_is_ram = mo5_reg_cart & 4; |
| 2035 | 2035 | int bank = 0; |
| r4593 | r4594 | |
| 2202 | 2202 | |
| 2203 | 2203 | WRITE8_HANDLER ( to9_ieee_w ) |
| 2204 | 2204 | { |
| 2205 | | logerror( "$%04x %f to9_ieee_w: unhandled write $%02X to register %i\n", cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), data, offset ); |
| 2205 | logerror( "$%04x %f to9_ieee_w: unhandled write $%02X to register %i\n", cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)), data, offset ); |
| 2206 | 2206 | } |
| 2207 | 2207 | |
| 2208 | 2208 | |
| 2209 | 2209 | |
| 2210 | 2210 | READ8_HANDLER ( to9_ieee_r ) |
| 2211 | 2211 | { |
| 2212 | | logerror( "$%04x %f to9_ieee_r: unhandled read from register %i\n", cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), offset ); |
| 2212 | logerror( "$%04x %f to9_ieee_r: unhandled read from register %i\n", cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)), offset ); |
| 2213 | 2213 | return 0; |
| 2214 | 2214 | } |
| 2215 | 2215 | |
| r4593 | r4594 | |
| 2240 | 2240 | case 2: return (lt3 << 7) | (inil << 6); |
| 2241 | 2241 | case 3: return (v.init << 7) | (init << 6); /* != TO7/70 */ |
| 2242 | 2242 | default: |
| 2243 | | logerror( "$%04x to9_gatearray_r: invalid offset %i\n", cpu_get_previouspc( space->machine->cpu[0] ), offset ); |
| 2243 | logerror( "$%04x to9_gatearray_r: invalid offset %i\n", cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset ); |
| 2244 | 2244 | return 0; |
| 2245 | 2245 | } |
| 2246 | 2246 | } |
| r4593 | r4594 | |
| 2335 | 2335 | |
| 2336 | 2336 | WRITE8_HANDLER ( to9_vreg_w ) |
| 2337 | 2337 | { |
| 2338 | | LOG_VIDEO(( "$%04x %f to9_vreg_w: off=%i ($%04X) data=$%02X\n", cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), offset, 0xe7da + offset, data )); |
| 2338 | LOG_VIDEO(( "$%04x %f to9_vreg_w: off=%i ($%04X) data=$%02X\n", cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)), offset, 0xe7da + offset, data )); |
| 2339 | 2339 | |
| 2340 | 2340 | switch ( offset ) |
| 2341 | 2341 | { |
| r4593 | r4594 | |
| 2390 | 2390 | |
| 2391 | 2391 | static void to9_update_cart_bank(running_machine *machine) |
| 2392 | 2392 | { |
| 2393 | | const address_space* space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 2393 | const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 2394 | 2394 | static int old_bank = -1; |
| 2395 | 2395 | int bank = 0; |
| 2396 | 2396 | int slot = ( mc6846_get_output_port(devtag_get_device(machine, "mc6846")) >> 4 ) & 3; /* bits 4-5: ROM bank */ |
| r4593 | r4594 | |
| 2475 | 2475 | static void to9_update_ram_bank (running_machine *machine) |
| 2476 | 2476 | { |
| 2477 | 2477 | const device_config *sys_pia = devtag_get_device( machine, THOM_PIA_SYS ); |
| 2478 | | const address_space* space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 2478 | const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 2479 | 2479 | static int old_bank = -1; |
| 2480 | 2480 | UINT8 port = mc6846_get_output_port(devtag_get_device(machine, "mc6846")); |
| 2481 | 2481 | UINT8 portb = pia6821_get_port_b_z_mask( sys_pia ); |
| r4593 | r4594 | |
| 2633 | 2633 | /* bit 7: interrupt */ |
| 2634 | 2634 | |
| 2635 | 2635 | LOG_KBD(( "$%04x %f to9_kbd_r: status $%02X (rdrf=%i, tdre=%i, ovrn=%i, pe=%i, irq=%i)\n", |
| 2636 | | cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), to9_kbd_status, |
| 2636 | cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)), to9_kbd_status, |
| 2637 | 2637 | (to9_kbd_status & ACIA_6850_RDRF) ? 1 : 0, |
| 2638 | 2638 | (to9_kbd_status & ACIA_6850_TDRE) ? 1 : 0, |
| 2639 | 2639 | (to9_kbd_status & ACIA_6850_OVRN) ? 1 : 0, |
| r4593 | r4594 | |
| 2648 | 2648 | else |
| 2649 | 2649 | to9_kbd_status &= ~(ACIA_6850_OVRN | ACIA_6850_RDRF); |
| 2650 | 2650 | to9_kbd_overrun = 0; |
| 2651 | | LOG_KBD(( "$%04x %f to9_kbd_r: read data $%02X\n", cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), to9_kbd_in )); |
| 2651 | LOG_KBD(( "$%04x %f to9_kbd_r: read data $%02X\n", cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)), to9_kbd_in )); |
| 2652 | 2652 | to9_kbd_update_irq(space->machine); |
| 2653 | 2653 | return to9_kbd_in; |
| 2654 | 2654 | |
| 2655 | 2655 | default: |
| 2656 | | logerror( "$%04x to9_kbd_r: invalid offset %i\n", cpu_get_previouspc( space->machine->cpu[0] ), offset ); |
| 2656 | logerror( "$%04x to9_kbd_r: invalid offset %i\n", cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset ); |
| 2657 | 2657 | return 0; |
| 2658 | 2658 | } |
| 2659 | 2659 | } |
| r4593 | r4594 | |
| 2675 | 2675 | to9_kbd_overrun = 0; |
| 2676 | 2676 | to9_kbd_status = ACIA_6850_TDRE; |
| 2677 | 2677 | to9_kbd_intr = 0; |
| 2678 | | LOG_KBD(( "$%04x %f to9_kbd_w: reset (data=$%02X)\n", cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), data )); |
| 2678 | LOG_KBD(( "$%04x %f to9_kbd_w: reset (data=$%02X)\n", cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)), data )); |
| 2679 | 2679 | } |
| 2680 | 2680 | else |
| 2681 | 2681 | { |
| r4593 | r4594 | |
| 2689 | 2689 | to9_kbd_intr = data >> 5; |
| 2690 | 2690 | |
| 2691 | 2691 | LOG_KBD(( "$%04x %f to9_kbd_w: set control to $%02X (parity=%i, intr in=%i out=%i)\n", |
| 2692 | | cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), |
| 2692 | cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)), |
| 2693 | 2693 | data, to9_kbd_parity, to9_kbd_intr >> 2, |
| 2694 | 2694 | (to9_kbd_intr & 3) ? 1 : 0 )); |
| 2695 | 2695 | } |
| r4593 | r4594 | |
| 2720 | 2720 | case 0xFE: to9_kbd_periph = 0; break; |
| 2721 | 2721 | |
| 2722 | 2722 | default: |
| 2723 | | logerror( "$%04x %f to9_kbd_w: unknown kbd command %02X\n", cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), data ); |
| 2723 | logerror( "$%04x %f to9_kbd_w: unknown kbd command %02X\n", cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)), data ); |
| 2724 | 2724 | } |
| 2725 | 2725 | |
| 2726 | 2726 | thom_set_caps_led( space->machine, !to9_kbd_caps ); |
| 2727 | 2727 | |
| 2728 | 2728 | LOG(( "$%04x %f to9_kbd_w: kbd command %02X (caps=%i, pad=%i, periph=%i)\n", |
| 2729 | | cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), data, |
| 2729 | cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)), data, |
| 2730 | 2730 | to9_kbd_caps, to9_kbd_pad, to9_kbd_periph )); |
| 2731 | 2731 | |
| 2732 | 2732 | break; |
| 2733 | 2733 | |
| 2734 | 2734 | default: |
| 2735 | | logerror( "$%04x to9_kbd_w: invalid offset %i (data=$%02X) \n", cpu_get_previouspc( space->machine->cpu[0] ), offset, data ); |
| 2735 | logerror( "$%04x to9_kbd_w: invalid offset %i (data=$%02X) \n", cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset, data ); |
| 2736 | 2736 | } |
| 2737 | 2737 | } |
| 2738 | 2738 | |
| r4593 | r4594 | |
| 3525 | 3525 | static void to8_update_ram_bank (running_machine *machine) |
| 3526 | 3526 | { |
| 3527 | 3527 | const device_config *sys_pia = devtag_get_device( machine, THOM_PIA_SYS ); |
| 3528 | | const address_space* space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 3528 | const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 3529 | 3529 | UINT8 bank = 0; |
| 3530 | 3530 | |
| 3531 | 3531 | if ( to8_reg_sys1 & 0x10 ) |
| r4593 | r4594 | |
| 3589 | 3589 | |
| 3590 | 3590 | static void to8_update_cart_bank (running_machine *machine) |
| 3591 | 3591 | { |
| 3592 | | const address_space* space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 3592 | const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 3593 | 3593 | static int old_bank = -1; |
| 3594 | 3594 | int bank = 0; |
| 3595 | 3595 | |
| r4593 | r4594 | |
| 3781 | 3781 | break; |
| 3782 | 3782 | |
| 3783 | 3783 | default: |
| 3784 | | logerror( "$%04x to8_gatearray_r: invalid offset %i\n", cpu_get_previouspc( space->machine->cpu[0] ), offset ); |
| 3784 | logerror( "$%04x to8_gatearray_r: invalid offset %i\n", cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset ); |
| 3785 | 3785 | res = 0; |
| 3786 | 3786 | } |
| 3787 | 3787 | |
| 3788 | 3788 | LOG_VIDEO(( "$%04x %f to8_gatearray_r: off=%i ($%04X) res=$%02X lightpen=%i\n", |
| 3789 | | cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), |
| 3789 | cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)), |
| 3790 | 3790 | offset, 0xe7e4 + offset, res, to7_lightpen )); |
| 3791 | 3791 | |
| 3792 | 3792 | return res; |
| r4593 | r4594 | |
| 3797 | 3797 | WRITE8_HANDLER ( to8_gatearray_w ) |
| 3798 | 3798 | { |
| 3799 | 3799 | LOG_VIDEO(( "$%04x %f to8_gatearray_w: off=%i ($%04X) data=$%02X\n", |
| 3800 | | cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), |
| 3800 | cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)), |
| 3801 | 3801 | offset, 0xe7e4 + offset, data )); |
| 3802 | 3802 | |
| 3803 | 3803 | switch ( offset ) |
| r4593 | r4594 | |
| 3829 | 3829 | |
| 3830 | 3830 | default: |
| 3831 | 3831 | logerror( "$%04x to8_gatearray_w: invalid offset %i (data=$%02X)\n", |
| 3832 | | cpu_get_previouspc( space->machine->cpu[0] ), offset, data ); |
| 3832 | cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset, data ); |
| 3833 | 3833 | } |
| 3834 | 3834 | } |
| 3835 | 3835 | |
| r4593 | r4594 | |
| 3878 | 3878 | WRITE8_HANDLER ( to8_vreg_w ) |
| 3879 | 3879 | { |
| 3880 | 3880 | LOG_VIDEO(( "$%04x %f to8_vreg_w: off=%i ($%04X) data=$%02X\n", |
| 3881 | | cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), |
| 3881 | cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)), |
| 3882 | 3882 | offset, 0xe7da + offset, data )); |
| 3883 | 3883 | |
| 3884 | 3884 | switch ( offset ) |
| r4593 | r4594 | |
| 3934 | 3934 | { |
| 3935 | 3935 | int ktest = to8_kbd_ktest (device->machine); |
| 3936 | 3936 | |
| 3937 | | LOG_KBD(( "$%04x %f: to8_sys_porta_in ktest=%i\n", cpu_get_previouspc( device->machine->cpu[0] ), attotime_to_double(timer_get_time(device->machine)), ktest )); |
| 3937 | LOG_KBD(( "$%04x %f: to8_sys_porta_in ktest=%i\n", cpu_get_previouspc(cputag_get_cpu(device->machine, "maincpu")), attotime_to_double(timer_get_time(device->machine)), ktest )); |
| 3938 | 3938 | |
| 3939 | 3939 | return ktest; |
| 3940 | 3940 | } |
| r4593 | r4594 | |
| 4346 | 4346 | static void mo6_update_cart_bank (running_machine *machine) |
| 4347 | 4347 | { |
| 4348 | 4348 | const device_config *sys_pia = devtag_get_device( machine, THOM_PIA_SYS ); |
| 4349 | | const address_space* space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 4349 | const address_space* space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 4350 | 4350 | int b = (pia6821_get_output_a( sys_pia ) >> 5) & 1; |
| 4351 | 4351 | static int old_bank = -1; |
| 4352 | 4352 | int bank = 0; |
| r4593 | r4594 | |
| 4487 | 4487 | { |
| 4488 | 4488 | const device_config *printer = devtag_get_device(device->machine, "centronics"); |
| 4489 | 4489 | |
| 4490 | | LOG (( "$%04x %f mo6_game_porta_out: CENTRONICS set data=$%02X\n", cpu_get_previouspc( device->machine->cpu[0] ), attotime_to_double(timer_get_time(device->machine)), data )); |
| 4490 | LOG (( "$%04x %f mo6_game_porta_out: CENTRONICS set data=$%02X\n", cpu_get_previouspc(cputag_get_cpu(device->machine, "maincpu")), attotime_to_double(timer_get_time(device->machine)), data )); |
| 4491 | 4491 | |
| 4492 | 4492 | /* centronics data */ |
| 4493 | 4493 | centronics_data_w(printer, 0, data); |
| r4593 | r4594 | |
| 4499 | 4499 | { |
| 4500 | 4500 | const device_config *printer = devtag_get_device(device->machine, "centronics"); |
| 4501 | 4501 | |
| 4502 | | LOG (( "$%04x %f mo6_game_cb2_out: CENTRONICS set strobe=%i\n", cpu_get_previouspc( device->machine->cpu[0] ), attotime_to_double(timer_get_time(device->machine)), data )); |
| 4502 | LOG (( "$%04x %f mo6_game_cb2_out: CENTRONICS set strobe=%i\n", cpu_get_previouspc(cputag_get_cpu(device->machine, "maincpu")), attotime_to_double(timer_get_time(device->machine)), data )); |
| 4503 | 4503 | |
| 4504 | 4504 | /* centronics strobe */ |
| 4505 | 4505 | centronics_strobe_w(printer, data); |
| r4593 | r4594 | |
| 4700 | 4700 | break; |
| 4701 | 4701 | |
| 4702 | 4702 | default: |
| 4703 | | logerror( "$%04x mo6_gatearray_r: invalid offset %i\n", cpu_get_previouspc( space->machine->cpu[0] ), offset ); |
| 4703 | logerror( "$%04x mo6_gatearray_r: invalid offset %i\n", cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset ); |
| 4704 | 4704 | res = 0; |
| 4705 | 4705 | } |
| 4706 | 4706 | |
| 4707 | 4707 | LOG_VIDEO(( "$%04x %f mo6_gatearray_r: off=%i ($%04X) res=$%02X lightpen=%i\n", |
| 4708 | | cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), |
| 4708 | cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)), |
| 4709 | 4709 | offset, 0xa7e4 + offset, res, to7_lightpen )); |
| 4710 | 4710 | |
| 4711 | 4711 | return res; |
| r4593 | r4594 | |
| 4716 | 4716 | WRITE8_HANDLER ( mo6_gatearray_w ) |
| 4717 | 4717 | { |
| 4718 | 4718 | LOG_VIDEO(( "$%04x %f mo6_gatearray_w: off=%i ($%04X) data=$%02X\n", |
| 4719 | | cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), |
| 4719 | cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)), |
| 4720 | 4720 | offset, 0xa7e4 + offset, data )); |
| 4721 | 4721 | |
| 4722 | 4722 | switch ( offset ) |
| r4593 | r4594 | |
| 4746 | 4746 | break; |
| 4747 | 4747 | |
| 4748 | 4748 | default: |
| 4749 | | logerror( "$%04x mo6_gatearray_w: invalid offset %i (data=$%02X)\n", cpu_get_previouspc( space->machine->cpu[0] ), offset, data ); |
| 4749 | logerror( "$%04x mo6_gatearray_w: invalid offset %i (data=$%02X)\n", cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset, data ); |
| 4750 | 4750 | } |
| 4751 | 4751 | } |
| 4752 | 4752 | |
| r4593 | r4594 | |
| 4783 | 4783 | WRITE8_HANDLER ( mo6_vreg_w ) |
| 4784 | 4784 | { |
| 4785 | 4785 | LOG_VIDEO(( "$%04x %f mo6_vreg_w: off=%i ($%04X) data=$%02X\n", |
| 4786 | | cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), |
| 4786 | cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)), |
| 4787 | 4787 | offset, 0xa7da + offset, data )); |
| 4788 | 4788 | |
| 4789 | 4789 | switch ( offset ) |
| r4593 | r4594 | |
| 4935 | 4935 | if ( to7_controller_type ) |
| 4936 | 4936 | return to7_floppy_r ( space, offset ); |
| 4937 | 4937 | |
| 4938 | | logerror( "$%04x %f mo5nr_net_r: read from reg %i\n", cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), offset ); |
| 4938 | logerror( "$%04x %f mo5nr_net_r: read from reg %i\n", cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)), offset ); |
| 4939 | 4939 | |
| 4940 | 4940 | return 0; |
| 4941 | 4941 | } |
| r4593 | r4594 | |
| 4948 | 4948 | to7_floppy_w ( space, offset, data ); |
| 4949 | 4949 | else |
| 4950 | 4950 | logerror( "$%04x %f mo5nr_net_w: write $%02X to reg %i\n", |
| 4951 | | cpu_get_previouspc( space->machine->cpu[0] ), attotime_to_double(timer_get_time(space->machine)), data, offset ); |
| 4951 | cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), attotime_to_double(timer_get_time(space->machine)), data, offset ); |
| 4952 | 4952 | } |
| 4953 | 4953 | |
| 4954 | 4954 | |
src/mess/machine/tx0.c
| r4593 | r4594 | |
| 323 | 323 | if (data & 0100) |
| 324 | 324 | { |
| 325 | 325 | /* read current AC */ |
| 326 | | ac = cpu_get_reg(machine->cpu[0], TX0_AC); |
| 326 | ac = cpu_get_reg(cputag_get_cpu(machine, "maincpu"), TX0_AC); |
| 327 | 327 | /* cycle right */ |
| 328 | 328 | ac = (ac >> 1) | ((ac & 1) << 17); |
| 329 | 329 | /* shuffle and insert data into AC */ |
| 330 | 330 | ac = (ac /*& 0333333*/) | ((data & 001) << 17) | ((data & 002) << 13) | ((data & 004) << 9) | ((data & 010) << 5) | ((data & 020) << 1) | ((data & 040) >> 3); |
| 331 | 331 | /* write modified AC */ |
| 332 | | cpu_set_reg(machine->cpu[0], TX0_AC, ac); |
| 332 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), TX0_AC, ac); |
| 333 | 333 | |
| 334 | 334 | tape_reader.rc = (tape_reader.rc+1) & 3; |
| 335 | 335 | |
| 336 | 336 | if (tape_reader.rc == 0) |
| 337 | 337 | { /* IO complete */ |
| 338 | 338 | tape_reader.rcl = 0; |
| 339 | | cpu_set_reg(machine->cpu[0], TX0_IO_COMPLETE, 0); |
| 339 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), TX0_IO_COMPLETE, 0); |
| 340 | 340 | } |
| 341 | 341 | } |
| 342 | 342 | } |
| r4593 | r4594 | |
| 354 | 354 | */ |
| 355 | 355 | static TIMER_CALLBACK(puncher_callback) |
| 356 | 356 | { |
| 357 | | cpu_set_reg(machine->cpu[0], TX0_IO_COMPLETE, 0); |
| 357 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), TX0_IO_COMPLETE, 0); |
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | /* |
| r4593 | r4594 | |
| 442 | 442 | */ |
| 443 | 443 | static TIMER_CALLBACK(prt_callback) |
| 444 | 444 | { |
| 445 | | cpu_set_reg(machine->cpu[0], TX0_IO_COMPLETE, 0); |
| 445 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), TX0_IO_COMPLETE, 0); |
| 446 | 446 | } |
| 447 | 447 | |
| 448 | 448 | /* |
| r4593 | r4594 | |
| 468 | 468 | */ |
| 469 | 469 | static TIMER_CALLBACK(dis_callback) |
| 470 | 470 | { |
| 471 | | cpu_set_reg(machine->cpu[0], TX0_IO_COMPLETE, 0); |
| 471 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), TX0_IO_COMPLETE, 0); |
| 472 | 472 | } |
| 473 | 473 | |
| 474 | 474 | /* |
| r4593 | r4594 | |
| 582 | 582 | if ((magtape.state == MTS_SELECTED) || ((magtape.state == MTS_SELECTING) && (magtape.command == 2))) |
| 583 | 583 | { /* unit has become unavailable */ |
| 584 | 584 | magtape.state = MTS_UNSELECTING; |
| 585 | | cpu_set_reg(image->machine->cpu[0], TX0_PF, cpu_get_reg(image->machine->cpu[0], TX0_PF) | PF_RWC); |
| 585 | cpu_set_reg(cputag_get_cpu(image->machine, "maincpu"), TX0_PF, cpu_get_reg(cputag_get_cpu(image->machine, "maincpu"), TX0_PF) | PF_RWC); |
| 586 | 586 | schedule_unselect(); |
| 587 | 587 | } |
| 588 | 588 | } |
| r4593 | r4594 | |
| 1124 | 1124 | previous LR */ |
| 1125 | 1125 | lr = (1 << 17) | ((charcode & 040) << 10) | ((charcode & 020) << 8) | ((charcode & 010) << 6) | ((charcode & 004) << 4) | ((charcode & 002) << 2) | ((charcode & 001) << 1); |
| 1126 | 1126 | /* write modified LR */ |
| 1127 | | cpu_set_reg(machine->cpu[0], TX0_LR, lr); |
| 1127 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), TX0_LR, lr); |
| 1128 | 1128 | tx0_typewriter_drawchar(machine, charcode); /* we want to echo input */ |
| 1129 | 1129 | break; |
| 1130 | 1130 | } |
| r4593 | r4594 | |
| 1160 | 1160 | |
| 1161 | 1161 | if (control_transitions & tx0_stop_cyc0) |
| 1162 | 1162 | { |
| 1163 | | cpu_set_reg(device->machine->cpu[0], TX0_STOP_CYC0, !cpu_get_reg(device->machine->cpu[0], TX0_STOP_CYC0)); |
| 1163 | cpu_set_reg(cputag_get_cpu(device->machine, "maincpu"), TX0_STOP_CYC0, !cpu_get_reg(cputag_get_cpu(device->machine, "maincpu"), TX0_STOP_CYC0)); |
| 1164 | 1164 | } |
| 1165 | 1165 | if (control_transitions & tx0_stop_cyc1) |
| 1166 | 1166 | { |
| 1167 | | cpu_set_reg(device->machine->cpu[0], TX0_STOP_CYC1, !cpu_get_reg(device->machine->cpu[0], TX0_STOP_CYC1)); |
| 1167 | cpu_set_reg(cputag_get_cpu(device->machine, "maincpu"), TX0_STOP_CYC1, !cpu_get_reg(cputag_get_cpu(device->machine, "maincpu"), TX0_STOP_CYC1)); |
| 1168 | 1168 | } |
| 1169 | 1169 | if (control_transitions & tx0_gbl_cm_sel) |
| 1170 | 1170 | { |
| 1171 | | cpu_set_reg(device->machine->cpu[0], TX0_GBL_CM_SEL, !cpu_get_reg(device->machine->cpu[0], TX0_GBL_CM_SEL)); |
| 1171 | cpu_set_reg(cputag_get_cpu(device->machine, "maincpu"), TX0_GBL_CM_SEL, !cpu_get_reg(cputag_get_cpu(device->machine, "maincpu"), TX0_GBL_CM_SEL)); |
| 1172 | 1172 | } |
| 1173 | 1173 | if (control_transitions & tx0_stop) |
| 1174 | 1174 | { |
| 1175 | | cpu_set_reg(device->machine->cpu[0], TX0_RUN, 0); |
| 1176 | | cpu_set_reg(device->machine->cpu[0], TX0_RIM, 0); |
| 1175 | cpu_set_reg(cputag_get_cpu(device->machine, "maincpu"), TX0_RUN, 0); |
| 1176 | cpu_set_reg(cputag_get_cpu(device->machine, "maincpu"), TX0_RIM, 0); |
| 1177 | 1177 | } |
| 1178 | 1178 | if (control_transitions & tx0_restart) |
| 1179 | 1179 | { |
| 1180 | | cpu_set_reg(device->machine->cpu[0], TX0_RUN, 1); |
| 1181 | | cpu_set_reg(device->machine->cpu[0], TX0_RIM, 0); |
| 1180 | cpu_set_reg(cputag_get_cpu(device->machine, "maincpu"), TX0_RUN, 1); |
| 1181 | cpu_set_reg(cputag_get_cpu(device->machine, "maincpu"), TX0_RIM, 0); |
| 1182 | 1182 | } |
| 1183 | 1183 | if (control_transitions & tx0_read_in) |
| 1184 | 1184 | { /* set cpu to read instructions from perforated tape */ |
| 1185 | | cpu_set_reg(device->machine->cpu[0], TX0_RESET, 0); |
| 1186 | | cpu_set_reg(device->machine->cpu[0], TX0_RUN, 0); |
| 1187 | | cpu_set_reg(device->machine->cpu[0], TX0_RIM, 1); |
| 1185 | cpu_set_reg(cputag_get_cpu(device->machine, "maincpu"), TX0_RESET, 0); |
| 1186 | cpu_set_reg(cputag_get_cpu(device->machine, "maincpu"), TX0_RUN, 0); |
| 1187 | cpu_set_reg(cputag_get_cpu(device->machine, "maincpu"), TX0_RIM, 1); |
| 1188 | 1188 | } |
| 1189 | 1189 | if (control_transitions & tx0_toggle_dn) |
| 1190 | 1190 | { |
| r4593 | r4594 | |
| 1202 | 1202 | { |
| 1203 | 1203 | if (tsr_index >= 2) |
| 1204 | 1204 | { |
| 1205 | | UINT32 cm_sel = (UINT32) cpu_get_reg(device->machine->cpu[0], TX0_CM_SEL); |
| 1206 | | cpu_set_reg(device->machine->cpu[0], TX0_CM_SEL, cm_sel ^ (1 << (tsr_index - 2))); |
| 1205 | UINT32 cm_sel = (UINT32) cpu_get_reg(cputag_get_cpu(device->machine, "maincpu"), TX0_CM_SEL); |
| 1206 | cpu_set_reg(cputag_get_cpu(device->machine, "maincpu"), TX0_CM_SEL, cm_sel ^ (1 << (tsr_index - 2))); |
| 1207 | 1207 | } |
| 1208 | 1208 | } |
| 1209 | 1209 | if (control_transitions & tx0_lr_sel) |
| 1210 | 1210 | { |
| 1211 | 1211 | if (tsr_index >= 2) |
| 1212 | 1212 | { |
| 1213 | | UINT32 lr_sel = (UINT32) cpu_get_reg(device->machine->cpu[0], TX0_LR_SEL); |
| 1214 | | cpu_set_reg(device->machine->cpu[0], TX0_LR_SEL, (lr_sel ^ (1 << (tsr_index - 2)))); |
| 1213 | UINT32 lr_sel = (UINT32) cpu_get_reg(cputag_get_cpu(device->machine, "maincpu"), TX0_LR_SEL); |
| 1214 | cpu_set_reg(cputag_get_cpu(device->machine, "maincpu"), TX0_LR_SEL, (lr_sel ^ (1 << (tsr_index - 2)))); |
| 1215 | 1215 | } |
| 1216 | 1216 | } |
| 1217 | 1217 | |
| r4593 | r4594 | |
| 1227 | 1227 | |
| 1228 | 1228 | /* update toggle switch register */ |
| 1229 | 1229 | if (tsr_transitions) |
| 1230 | | cpu_set_reg(device->machine->cpu[0], TX0_TBR+tsr_index, cpu_get_reg(device->machine->cpu[0], TX0_TBR+tsr_index) ^ tsr_transitions); |
| 1230 | cpu_set_reg(cputag_get_cpu(device->machine, "maincpu"), TX0_TBR+tsr_index, cpu_get_reg(cputag_get_cpu(device->machine, "maincpu"), TX0_TBR+tsr_index) ^ tsr_transitions); |
| 1231 | 1231 | |
| 1232 | 1232 | /* remember new state of toggle switch register keys */ |
| 1233 | 1233 | old_tsr_keys = tsr_keys; |
src/mess/machine/amigacrt.c
| r4593 | r4594 | |
| 83 | 83 | static TIMER_CALLBACK( amiga_ar1_delayed_nmi ) |
| 84 | 84 | { |
| 85 | 85 | (void)param; |
| 86 | | cpu_set_input_line(machine->cpu[0], 7, PULSE_LINE); |
| 86 | cputag_set_input_line(machine, "maincpu", 7, PULSE_LINE); |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | static void amiga_ar1_nmi( running_machine *machine ) |
| 90 | 90 | { |
| 91 | 91 | /* get the cart's built-in ram */ |
| 92 | | UINT16 *ar_ram = (UINT16 *)memory_get_write_ptr(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x9fc000); |
| 92 | UINT16 *ar_ram = (UINT16 *)memory_get_write_ptr(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x9fc000); |
| 93 | 93 | |
| 94 | 94 | if ( ar_ram != NULL ) |
| 95 | 95 | { |
| r4593 | r4594 | |
| 101 | 101 | |
| 102 | 102 | /* trigger NMI irq */ |
| 103 | 103 | amiga_ar1_spurious = 0; |
| 104 | | timer_set(machine, cpu_clocks_to_attotime(machine->cpu[0], 28), NULL, 0, amiga_ar1_delayed_nmi ); |
| 104 | timer_set(machine, cputag_clocks_to_attotime(machine, "maincpu", 28), NULL, 0, amiga_ar1_delayed_nmi ); |
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | |
| r4593 | r4594 | |
| 118 | 118 | { |
| 119 | 119 | /* trigger an NMI or spurious irq */ |
| 120 | 120 | amiga_ar1_spurious = (offset == 0x60/2) ? 0 : 1; |
| 121 | | timer_set(space->machine, cpu_clocks_to_attotime(space->machine->cpu[0], 28), NULL, 0, amiga_ar1_delayed_nmi ); |
| 121 | timer_set(space->machine, cputag_clocks_to_attotime(space->machine, "maincpu", 28), NULL, 0, amiga_ar1_delayed_nmi ); |
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | 124 | |
| r4593 | r4594 | |
| 127 | 127 | |
| 128 | 128 | static void amiga_ar1_check_overlay( running_machine *machine ) |
| 129 | 129 | { |
| 130 | | memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x00007f, 0, 0, amiga_ar1_chipmem_w); |
| 130 | memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x000000, 0x00007f, 0, 0, amiga_ar1_chipmem_w); |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | static void amiga_ar1_init( running_machine *machine ) |
| r4593 | r4594 | |
| 146 | 146 | memset(ar_ram, 0, 0x4000); |
| 147 | 147 | |
| 148 | 148 | /* Install ROM */ |
| 149 | | memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf00000, 0xf7ffff, 0, 0, SMH_BANK2); |
| 150 | | memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xf00000, 0xf7ffff, 0, 0, SMH_ROM); |
| 149 | memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xf00000, 0xf7ffff, 0, 0, SMH_BANK2); |
| 150 | memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xf00000, 0xf7ffff, 0, 0, SMH_ROM); |
| 151 | 151 | |
| 152 | 152 | /* Install RAM */ |
| 153 | | memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x9fc000, 0x9fffff, 0, 0, SMH_BANK3); |
| 154 | | memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x9fc000, 0x9fffff, 0, 0, SMH_BANK3); |
| 153 | memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x9fc000, 0x9fffff, 0, 0, SMH_BANK3); |
| 154 | memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x9fc000, 0x9fffff, 0, 0, SMH_BANK3); |
| 155 | 155 | |
| 156 | 156 | /* Configure Banks */ |
| 157 | 157 | memory_set_bankptr(machine, 2, memory_region(machine, "user2")); |
| r4593 | r4594 | |
| 160 | 160 | amiga_ar1_spurious = 0; |
| 161 | 161 | |
| 162 | 162 | /* Install IRQ ACK callback */ |
| 163 | | cpu_set_irq_callback(machine->cpu[0],amiga_ar1_irqack); |
| 163 | cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), amiga_ar1_irqack); |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | /*************************************************************************** |
| r4593 | r4594 | |
| 256 | 256 | |
| 257 | 257 | static void amiga_ar23_freeze( running_machine *machine ) |
| 258 | 258 | { |
| 259 | | int pc = cpu_get_pc(machine->cpu[0]); |
| 259 | int pc = cpu_get_pc(cputag_get_cpu(machine, "maincpu")); |
| 260 | 260 | |
| 261 | 261 | /* only freeze if we're not inside the cart's ROM */ |
| 262 | 262 | if ( ((pc >> 16) & 0xfe ) != 0x40 ) |
| 263 | 263 | { |
| 264 | 264 | /* get the cart's built-in ram */ |
| 265 | | UINT16 *ar_ram = (UINT16 *)memory_get_write_ptr(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x440000); |
| 265 | UINT16 *ar_ram = (UINT16 *)memory_get_write_ptr(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x440000); |
| 266 | 266 | |
| 267 | 267 | if ( ar_ram != NULL ) |
| 268 | 268 | { |
| r4593 | r4594 | |
| 276 | 276 | memory_set_bank(machine, 1, 2); |
| 277 | 277 | |
| 278 | 278 | /* writes go to chipram */ |
| 279 | | memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, amiga_chip_ram_size - 1, 0, 0, amiga_ar23_chipmem_w); |
| 279 | memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x000000, amiga_chip_ram_size - 1, 0, 0, amiga_ar23_chipmem_w); |
| 280 | 280 | |
| 281 | 281 | /* trigger NMI irq */ |
| 282 | | cpu_set_input_line(machine->cpu[0], 7, PULSE_LINE); |
| 282 | cputag_set_input_line(machine, "maincpu", 7, PULSE_LINE); |
| 283 | 283 | } |
| 284 | 284 | } |
| 285 | 285 | |
| r4593 | r4594 | |
| 334 | 334 | static void amiga_ar23_check_overlay( running_machine *machine ) |
| 335 | 335 | { |
| 336 | 336 | amiga_ar23_mode = 3; |
| 337 | | memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x000000, 0x00000f, 0, 0, amiga_ar23_chipmem_w); |
| 337 | memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x000000, 0x00000f, 0, 0, amiga_ar23_chipmem_w); |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | static void amiga_ar23_init( running_machine *machine, int ar3 ) |
| r4593 | r4594 | |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | /* Install ROM */ |
| 364 | | memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x400000, 0x400000+size, 0, mirror, SMH_BANK2); |
| 365 | | memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x400000, 0x400000+size, 0, mirror, SMH_ROM); |
| 364 | memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x400000, 0x400000+size, 0, mirror, SMH_BANK2); |
| 365 | memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x400000, 0x400000+size, 0, mirror, SMH_ROM); |
| 366 | 366 | |
| 367 | 367 | /* Install RAM */ |
| 368 | | memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x440000, 0x44ffff, 0, 0, SMH_BANK3); |
| 369 | | memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x440000, 0x44ffff, 0, 0, SMH_BANK3); |
| 368 | memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x440000, 0x44ffff, 0, 0, SMH_BANK3); |
| 369 | memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x440000, 0x44ffff, 0, 0, SMH_BANK3); |
| 370 | 370 | |
| 371 | 371 | /* Install Custom chip monitor */ |
| 372 | | // memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xdff000, 0xdff1ff, 0, 0, amiga_ar23_custom_r); |
| 373 | | // memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xdff000, 0xdff1ff, 0, 0, amiga_ar23_custom_w); |
| 372 | // memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xdff000, 0xdff1ff, 0, 0, amiga_ar23_custom_r); |
| 373 | // memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xdff000, 0xdff1ff, 0, 0, amiga_ar23_custom_w); |
| 374 | 374 | |
| 375 | 375 | /* Install status/mode handlers */ |
| 376 | | memory_install_read16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x400000, 0x400007, 0, mirror, amiga_ar23_mode_r); |
| 377 | | memory_install_write16_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x400000, 0x400003, 0, mirror, amiga_ar23_mode_w); |
| 376 | memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x400000, 0x400007, 0, mirror, amiga_ar23_mode_r); |
| 377 | memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x400000, 0x400003, 0, mirror, amiga_ar23_mode_w); |
| 378 | 378 | |
| 379 | 379 | /* Configure Banks */ |
| 380 | 380 | memory_set_bankptr(machine, 2, memory_region(machine, "user2")); |
src/mess/machine/vtech1.c
| r4593 | r4594 | |
| 93 | 93 | case 22 * 1024: |
| 94 | 94 | case 32 * 1024: |
| 95 | 95 | /* install 16KB memory expansion */ |
| 96 | | memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), base, base + 0x3fff, 0, 0, SMH_BANK2); |
| 97 | | memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), base, base + 0x3fff, 0, 0, SMH_BANK2); |
| 96 | memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), base, base + 0x3fff, 0, 0, SMH_BANK2); |
| 97 | memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), base, base + 0x3fff, 0, 0, SMH_BANK2); |
| 98 | 98 | memory_configure_bank(machine, 2, 0, 1, mess_ram + base - 0x7800, 0); |
| 99 | 99 | memory_set_bank(machine, 2, 0); |
| 100 | 100 | |
| 101 | | memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), base + 0x4000, 0xffff, 0, 0, SMH_NOP); |
| 102 | | memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), base + 0x4000, 0xffff, 0, 0, SMH_NOP); |
| 101 | memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), base + 0x4000, 0xffff, 0, 0, SMH_NOP); |
| 102 | memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), base + 0x4000, 0xffff, 0, 0, SMH_NOP); |
| 103 | 103 | break; |
| 104 | 104 | |
| 105 | 105 | case 66 * 1024: |
| r4593 | r4594 | |
| 107 | 107 | /* 64KB/4MB memory expansion */ |
| 108 | 108 | |
| 109 | 109 | /* install fixed first bank */ |
| 110 | | memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0xbfff, 0, 0, SMH_BANK2); |
| 111 | | memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0xbfff, 0, 0, SMH_BANK2); |
| 110 | memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x8000, 0xbfff, 0, 0, SMH_BANK2); |
| 111 | memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x8000, 0xbfff, 0, 0, SMH_BANK2); |
| 112 | 112 | memory_configure_bank(machine, 2, 0, 1, mess_ram + 0x800, 0); |
| 113 | 113 | memory_set_bank(machine, 2, 0); |
| 114 | 114 | |
| 115 | 115 | /* install the others, dynamically banked in */ |
| 116 | | memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc000, 0xffff, 0, 0, SMH_BANK3); |
| 117 | | memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0xc000, 0xffff, 0, 0, SMH_BANK3); |
| 116 | memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xc000, 0xffff, 0, 0, SMH_BANK3); |
| 117 | memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xc000, 0xffff, 0, 0, SMH_BANK3); |
| 118 | 118 | memory_configure_bank(machine, 3, 0, (mess_ram_size - 0x4800) / 0x4000, mess_ram + 0x4800, 0x4000); |
| 119 | 119 | memory_set_bank(machine, 3, 0); |
| 120 | 120 | break; |
| 121 | 121 | |
| 122 | 122 | default: |
| 123 | 123 | /* no memory expansion */ |
| 124 | | memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), base, 0xffff, 0, 0, SMH_NOP); |
| 125 | | memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), base, 0xffff, 0, 0, SMH_NOP); |
| 124 | memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), base, 0xffff, 0, 0, SMH_NOP); |
| 125 | memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), base, 0xffff, 0, 0, SMH_NOP); |
| 126 | 126 | break; |
| 127 | 127 | } |
| 128 | 128 | } |
src/mess/machine/ti85.c
| r4593 | r4594 | |
| 114 | 114 | { |
| 115 | 115 | if (ti85_ON_interrupt_mask && !ti85_ON_pressed) |
| 116 | 116 | { |
| 117 | | cpu_set_input_line(machine->cpu[0], 0, HOLD_LINE); |
| 117 | cputag_set_input_line(machine, "maincpu", 0, HOLD_LINE); |
| 118 | 118 | ti85_ON_interrupt_status = 1; |
| 119 | 119 | if (!ti85_timer_interrupt_mask) ti85_timer_interrupt_mask = 1; |
| 120 | 120 | } |
| r4593 | r4594 | |
| 125 | 125 | ti85_ON_pressed = 0; |
| 126 | 126 | if (ti85_timer_interrupt_mask) |
| 127 | 127 | { |
| 128 | | cpu_set_input_line(machine->cpu[0], 0, HOLD_LINE); |
| 128 | cputag_set_input_line(machine, "maincpu", 0, HOLD_LINE); |
| 129 | 129 | ti85_timer_interrupt_status = 1; |
| 130 | 130 | } |
| 131 | 131 | } |
| r4593 | r4594 | |
| 137 | 137 | |
| 138 | 138 | static void update_ti86_memory (running_machine *machine) |
| 139 | 139 | { |
| 140 | | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 140 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 141 | 141 | write8_space_func wh; |
| 142 | 142 | |
| 143 | 143 | if (ti85_memory_page_0x4000 & 0x40) |
| r4593 | r4594 | |
| 173 | 173 | |
| 174 | 174 | MACHINE_START( ti81 ) |
| 175 | 175 | { |
| 176 | | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 176 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 177 | 177 | UINT8 *mem = memory_region(machine, "maincpu"); |
| 178 | 178 | |
| 179 | 179 | ti85_timer_interrupt_mask = 0; |
| r4593 | r4594 | |
| 207 | 207 | |
| 208 | 208 | MACHINE_START( ti85 ) |
| 209 | 209 | { |
| 210 | | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 210 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 211 | 211 | UINT8 *mem = memory_region(machine, "maincpu"); |
| 212 | 212 | |
| 213 | 213 | ti85_timer_interrupt_mask = 0; |
| r4593 | r4594 | |
| 243 | 243 | |
| 244 | 244 | MACHINE_START( ti86 ) |
| 245 | 245 | { |
| 246 | | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 246 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 247 | 247 | UINT8 *mem = memory_region(machine, "maincpu"); |
| 248 | 248 | |
| 249 | 249 | ti85_timer_interrupt_mask = 0; |
| r4593 | r4594 | |
| 452 | 452 | if (file) |
| 453 | 453 | { |
| 454 | 454 | mame_fread(file, mem+0x8000, sizeof(unsigned char)*0x8000); |
| 455 | | cpu_set_reg(machine->cpu[0], Z80_PC,0x0239); |
| 455 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_PC,0x0239); |
| 456 | 456 | } |
| 457 | 457 | else |
| 458 | 458 | memset(mem+0x8000, 0, sizeof(unsigned char)*0x8000); |
| r4593 | r4594 | |
| 470 | 470 | if (file) |
| 471 | 471 | { |
| 472 | 472 | mame_fread(file, mem+0x8000, sizeof(unsigned char)*0x8000); |
| 473 | | cpu_set_reg(machine->cpu[0], Z80_PC,0x0b5f); |
| 473 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_PC,0x0b5f); |
| 474 | 474 | } |
| 475 | 475 | else |
| 476 | 476 | memset(mem+0x8000, 0, sizeof(unsigned char)*0x8000); |
| r4593 | r4594 | |
| 488 | 488 | if (file) |
| 489 | 489 | { |
| 490 | 490 | mame_fread(file, ti86_ram, sizeof(unsigned char)*128*1024); |
| 491 | | cpu_set_reg(machine->cpu[0], Z80_PC,0x0c59); |
| 491 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_PC,0x0c59); |
| 492 | 492 | } |
| 493 | 493 | else |
| 494 | 494 | memset(ti86_ram, 0, sizeof(unsigned char)*128*1024); |
| r4593 | r4594 | |
| 507 | 507 | /* Set registers */ |
| 508 | 508 | lo = reg[0x00] & 0x0ff; |
| 509 | 509 | hi = reg[0x01] & 0x0ff; |
| 510 | | cpu_set_reg(machine->cpu[0], Z80_AF, (hi << 8) | lo); |
| 510 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_AF, (hi << 8) | lo); |
| 511 | 511 | lo = reg[0x04] & 0x0ff; |
| 512 | 512 | hi = reg[0x05] & 0x0ff; |
| 513 | | cpu_set_reg(machine->cpu[0], Z80_BC, (hi << 8) | lo); |
| 513 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_BC, (hi << 8) | lo); |
| 514 | 514 | lo = reg[0x08] & 0x0ff; |
| 515 | 515 | hi = reg[0x09] & 0x0ff; |
| 516 | | cpu_set_reg(machine->cpu[0], Z80_DE, (hi << 8) | lo); |
| 516 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_DE, (hi << 8) | lo); |
| 517 | 517 | lo = reg[0x0c] & 0x0ff; |
| 518 | 518 | hi = reg[0x0d] & 0x0ff; |
| 519 | | cpu_set_reg(machine->cpu[0], Z80_HL, (hi << 8) | lo); |
| 519 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_HL, (hi << 8) | lo); |
| 520 | 520 | lo = reg[0x10] & 0x0ff; |
| 521 | 521 | hi = reg[0x11] & 0x0ff; |
| 522 | | cpu_set_reg(machine->cpu[0], Z80_IX, (hi << 8) | lo); |
| 522 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IX, (hi << 8) | lo); |
| 523 | 523 | lo = reg[0x14] & 0x0ff; |
| 524 | 524 | hi = reg[0x15] & 0x0ff; |
| 525 | | cpu_set_reg(machine->cpu[0], Z80_IY, (hi << 8) | lo); |
| 525 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IY, (hi << 8) | lo); |
| 526 | 526 | lo = reg[0x18] & 0x0ff; |
| 527 | 527 | hi = reg[0x19] & 0x0ff; |
| 528 | | cpu_set_reg(machine->cpu[0], Z80_PC, (hi << 8) | lo); |
| 528 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_PC, (hi << 8) | lo); |
| 529 | 529 | lo = reg[0x1c] & 0x0ff; |
| 530 | 530 | hi = reg[0x1d] & 0x0ff; |
| 531 | | cpu_set_reg(machine->cpu[0], Z80_SP, (hi << 8) | lo); |
| 531 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_SP, (hi << 8) | lo); |
| 532 | 532 | lo = reg[0x20] & 0x0ff; |
| 533 | 533 | hi = reg[0x21] & 0x0ff; |
| 534 | | cpu_set_reg(machine->cpu[0], Z80_AF2, (hi << 8) | lo); |
| 534 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_AF2, (hi << 8) | lo); |
| 535 | 535 | lo = reg[0x24] & 0x0ff; |
| 536 | 536 | hi = reg[0x25] & 0x0ff; |
| 537 | | cpu_set_reg(machine->cpu[0], Z80_BC2, (hi << 8) | lo); |
| 537 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_BC2, (hi << 8) | lo); |
| 538 | 538 | lo = reg[0x28] & 0x0ff; |
| 539 | 539 | hi = reg[0x29] & 0x0ff; |
| 540 | | cpu_set_reg(machine->cpu[0], Z80_DE2, (hi << 8) | lo); |
| 540 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_DE2, (hi << 8) | lo); |
| 541 | 541 | lo = reg[0x2c] & 0x0ff; |
| 542 | 542 | hi = reg[0x2d] & 0x0ff; |
| 543 | | cpu_set_reg(machine->cpu[0], Z80_HL2, (hi << 8) | lo); |
| 544 | | cpu_set_reg(machine->cpu[0], Z80_IFF1, reg[0x30]&0x0ff); |
| 545 | | cpu_set_reg(machine->cpu[0], Z80_IFF2, reg[0x34]&0x0ff); |
| 546 | | cpu_set_reg(machine->cpu[0], Z80_HALT, reg[0x38]&0x0ff); |
| 547 | | cpu_set_reg(machine->cpu[0], Z80_IM, reg[0x3c]&0x0ff); |
| 548 | | cpu_set_reg(machine->cpu[0], Z80_I, reg[0x40]&0x0ff); |
| 543 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_HL2, (hi << 8) | lo); |
| 544 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IFF1, reg[0x30]&0x0ff); |
| 545 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IFF2, reg[0x34]&0x0ff); |
| 546 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_HALT, reg[0x38]&0x0ff); |
| 547 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_IM, reg[0x3c]&0x0ff); |
| 548 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_I, reg[0x40]&0x0ff); |
| 549 | 549 | |
| 550 | | cpu_set_reg(machine->cpu[0], Z80_R, (reg[0x44]&0x7f) | (reg[0x48]&0x80)); |
| 550 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), Z80_R, (reg[0x44]&0x7f) | (reg[0x48]&0x80)); |
| 551 | 551 | |
| 552 | | cpu_set_input_line(machine->cpu[0], 0, 0); |
| 553 | | cpu_set_input_line(machine->cpu[0], INPUT_LINE_NMI, 0); |
| 554 | | cpu_set_input_line(machine->cpu[0], INPUT_LINE_HALT, 0); |
| 552 | cputag_set_input_line(machine, "maincpu", 0, 0); |
| 553 | cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, 0); |
| 554 | cputag_set_input_line(machine, "maincpu", INPUT_LINE_HALT, 0); |
| 555 | 555 | } |
| 556 | 556 | |
| 557 | 557 | static void ti85_setup_snapshot (running_machine *machine, UINT8 * data) |
| 558 | 558 | { |
| 559 | | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 559 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 560 | 560 | int i; |
| 561 | 561 | unsigned char lo,hi; |
| 562 | 562 | unsigned char * hdw = data + 0x8000 + 0x94; |
src/mess/machine/wswan.c
| r4593 | r4594 | |
| 128 | 128 | 0xea, 0xc0, 0xff, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 |
| 129 | 129 | }; |
| 130 | 130 | |
| 131 | | static void wswan_handle_irqs( running_machine *machine ) { |
| 131 | static void wswan_handle_irqs( running_machine *machine ) |
| 132 | { |
| 132 | 133 | if ( ws_portram[0xb2] & ws_portram[0xb6] & WSWAN_IFLAG_HBLTMR ) { |
| 133 | | cpu_set_input_line_and_vector( machine->cpu[0], 0, HOLD_LINE, ws_portram[0xb0] + WSWAN_INT_HBLTMR ); |
| 134 | cputag_set_input_line_and_vector( machine, "maincpu", 0, HOLD_LINE, ws_portram[0xb0] + WSWAN_INT_HBLTMR ); |
| 134 | 135 | } else if ( ws_portram[0xb2] & ws_portram[0xb6] & WSWAN_IFLAG_VBL ) { |
| 135 | | cpu_set_input_line_and_vector( machine->cpu[0], 0, HOLD_LINE, ws_portram[0xb0] + WSWAN_INT_VBL ); |
| 136 | cputag_set_input_line_and_vector( machine, "maincpu", 0, HOLD_LINE, ws_portram[0xb0] + WSWAN_INT_VBL ); |
| 136 | 137 | } else if ( ws_portram[0xb2] & ws_portram[0xb6] & WSWAN_IFLAG_VBLTMR ) { |
| 137 | | cpu_set_input_line_and_vector( machine->cpu[0], 0, HOLD_LINE, ws_portram[0xb0] + WSWAN_INT_VBLTMR ); |
| 138 | cputag_set_input_line_and_vector( machine, "maincpu", 0, HOLD_LINE, ws_portram[0xb0] + WSWAN_INT_VBLTMR ); |
| 138 | 139 | } else if ( ws_portram[0xb2] & ws_portram[0xb6] & WSWAN_IFLAG_LCMP ) { |
| 139 | | cpu_set_input_line_and_vector( machine->cpu[0], 0, HOLD_LINE, ws_portram[0xb0] + WSWAN_INT_LCMP ); |
| 140 | cputag_set_input_line_and_vector( machine, "maincpu", 0, HOLD_LINE, ws_portram[0xb0] + WSWAN_INT_LCMP ); |
| 140 | 141 | } else if ( ws_portram[0xb2] & ws_portram[0xb6] & WSWAN_IFLAG_SRX ) { |
| 141 | | cpu_set_input_line_and_vector( machine->cpu[0], 0, HOLD_LINE, ws_portram[0xb0] + WSWAN_INT_SRX ); |
| 142 | cputag_set_input_line_and_vector( machine, "maincpu", 0, HOLD_LINE, ws_portram[0xb0] + WSWAN_INT_SRX ); |
| 142 | 143 | } else if ( ws_portram[0xb2] & ws_portram[0xb6] & WSWAN_IFLAG_RTC ) { |
| 143 | | cpu_set_input_line_and_vector( machine->cpu[0], 0, HOLD_LINE, ws_portram[0xb0] + WSWAN_INT_RTC ); |
| 144 | cputag_set_input_line_and_vector( machine, "maincpu", 0, HOLD_LINE, ws_portram[0xb0] + WSWAN_INT_RTC ); |
| 144 | 145 | } else if ( ws_portram[0xb2] & ws_portram[0xb6] & WSWAN_IFLAG_KEY ) { |
| 145 | | cpu_set_input_line_and_vector( machine->cpu[0], 0, HOLD_LINE, ws_portram[0xb0] + WSWAN_INT_KEY ); |
| 146 | cputag_set_input_line_and_vector( machine, "maincpu", 0, HOLD_LINE, ws_portram[0xb0] + WSWAN_INT_KEY ); |
| 146 | 147 | } else if ( ws_portram[0xb2] & ws_portram[0xb6] & WSWAN_IFLAG_STX ) { |
| 147 | | cpu_set_input_line_and_vector( machine->cpu[0], 0, HOLD_LINE, ws_portram[0xb0] + WSWAN_INT_STX ); |
| 148 | cputag_set_input_line_and_vector( machine, "maincpu", 0, HOLD_LINE, ws_portram[0xb0] + WSWAN_INT_STX ); |
| 148 | 149 | } else { |
| 149 | | cpu_set_input_line(machine->cpu[0], 0, CLEAR_LINE ); |
| 150 | cputag_set_input_line(machine, "maincpu", 0, CLEAR_LINE ); |
| 150 | 151 | } |
| 151 | 152 | } |
| 152 | 153 | |
| 153 | | static void wswan_set_irq_line( running_machine *machine, int irq) { |
| 154 | | if ( ws_portram[0xb2] & irq ) { |
| 154 | static void wswan_set_irq_line( running_machine *machine, int irq) |
| 155 | { |
| 156 | if ( ws_portram[0xb2] & irq ) |
| 157 | { |
| 155 | 158 | ws_portram[0xb6] |= irq; |
| 156 | 159 | wswan_handle_irqs( machine ); |
| 157 | 160 | } |
| 158 | 161 | } |
| 159 | 162 | |
| 160 | | static void wswan_clear_irq_line( running_machine *machine, int irq) { |
| 163 | static void wswan_clear_irq_line( running_machine *machine, int irq) |
| 164 | { |
| 161 | 165 | ws_portram[0xb6] &= ~irq; |
| 162 | 166 | wswan_handle_irqs( machine ); |
| 163 | 167 | } |
| r4593 | r4594 | |
| 166 | 170 | { |
| 167 | 171 | /* A second passed */ |
| 168 | 172 | rtc.second = rtc.second + 1; |
| 169 | | if ( ( rtc.second & 0x0F ) > 9 ) { |
| 173 | if ( ( rtc.second & 0x0F ) > 9 ) |
| 174 | { |
| 170 | 175 | rtc.second = ( rtc.second & 0xF0 ) + 0x10; |
| 171 | 176 | } |
| 172 | 177 | |
| 173 | 178 | /* Check for minute passed */ |
| 174 | | if ( rtc.second >= 0x60 ) { |
| 179 | if ( rtc.second >= 0x60 ) |
| 180 | { |
| 175 | 181 | rtc.second = 0; |
| 176 | 182 | rtc.minute = rtc.minute + 1; |
| 177 | | if ( ( rtc.minute & 0x0F ) > 9 ) { |
| 183 | if ( ( rtc.minute & 0x0F ) > 9 ) |
| 184 | { |
| 178 | 185 | rtc.minute = ( rtc.minute & 0xF0 ) + 0x10; |
| 179 | 186 | } |
| 180 | 187 | } |
| 181 | 188 | |
| 182 | 189 | /* Check for hour passed */ |
| 183 | | if ( rtc.minute >= 0x60 ) { |
| 190 | if ( rtc.minute >= 0x60 ) |
| 191 | { |
| 184 | 192 | rtc.minute = 0; |
| 185 | 193 | rtc.hour = rtc.hour + 1; |
| 186 | | if ( ( rtc.hour & 0x0F ) > 9 ) { |
| 194 | if ( ( rtc.hour & 0x0F ) > 9 ) |
| 195 | { |
| 187 | 196 | rtc.hour = ( rtc.hour & 0xF0 ) + 0x10; |
| 188 | 197 | } |
| 189 | | if ( rtc.hour == 0x12 ) { |
| 198 | if ( rtc.hour == 0x12 ) |
| 199 | { |
| 190 | 200 | rtc.hour |= 0x80; |
| 191 | 201 | } |
| 192 | 202 | } |
| 193 | 203 | |
| 194 | 204 | /* Check for day passed */ |
| 195 | | if ( rtc.hour >= 0x24 ) { |
| 205 | if ( rtc.hour >= 0x24 ) |
| 206 | { |
| 196 | 207 | rtc.hour = 0; |
| 197 | 208 | rtc.day = rtc.day + 1; |
| 198 | 209 | } |
| 199 | 210 | } |
| 200 | 211 | |
| 201 | | static void wswan_machine_stop( running_machine *machine ) { |
| 202 | | if ( eeprom.size ) { |
| 212 | static void wswan_machine_stop( running_machine *machine ) |
| 213 | { |
| 214 | if ( eeprom.size ) |
| 215 | { |
| 203 | 216 | image_battery_save( devtag_get_device(machine, "cart"), eeprom.data, eeprom.size ); |
| 204 | 217 | } |
| 205 | 218 | } |
| 206 | 219 | |
| 207 | | static void wswan_setup_bios( void ) { |
| 208 | | if ( ws_bios_bank == NULL ) { |
| 220 | static void wswan_setup_bios( void ) |
| 221 | { |
| 222 | if ( ws_bios_bank == NULL ) |
| 223 | { |
| 209 | 224 | ws_bios_bank = auto_malloc( 0x10000 ); |
| 210 | 225 | memcpy( ws_bios_bank + 0xffc0, ws_fake_bios_code, 0x40 ); |
| 211 | 226 | } |
| 212 | 227 | } |
| 213 | 228 | |
| 214 | | MACHINE_START( wswan ) { |
| 229 | MACHINE_START( wswan ) |
| 230 | { |
| 215 | 231 | ws_bios_bank = NULL; |
| 216 | 232 | system_type = WSWAN; |
| 217 | 233 | add_exit_callback( machine, wswan_machine_stop ); |
| 218 | 234 | } |
| 219 | 235 | |
| 220 | | MACHINE_START( wscolor ) { |
| 236 | MACHINE_START( wscolor ) |
| 237 | { |
| 221 | 238 | ws_bios_bank = NULL; |
| 222 | 239 | system_type = WSC; |
| 223 | 240 | add_exit_callback( machine, wswan_machine_stop ); |
| r4593 | r4594 | |
| 225 | 242 | |
| 226 | 243 | MACHINE_RESET( wswan ) |
| 227 | 244 | { |
| 228 | | const address_space *space = cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_PROGRAM ); |
| 245 | const address_space *space = cputag_get_address_space( machine, "maincpu", ADDRESS_SPACE_PROGRAM ); |
| 229 | 246 | |
| 230 | 247 | wswan_setup_bios(); |
| 231 | 248 | |
| r4593 | r4594 | |
| 268 | 285 | // memory_set_bankptr( machine, 15, ROMMap[(ROMBanks - 1) & (ROMBanks - 1)] ); |
| 269 | 286 | |
| 270 | 287 | /* Set up RTC timer */ |
| 271 | | if ( rtc.present ) { |
| 288 | if ( rtc.present ) |
| 289 | { |
| 272 | 290 | timer_pulse(machine, ATTOTIME_IN_SEC(1), NULL, 0, wswan_rtc_callback ); |
| 273 | 291 | } |
| 274 | 292 | |
| 275 | 293 | } |
| 276 | 294 | |
| 277 | | NVRAM_HANDLER( wswan ) { |
| 278 | | if ( read_or_write ) { |
| 295 | NVRAM_HANDLER( wswan ) |
| 296 | { |
| 297 | if ( read_or_write ) |
| 298 | { |
| 279 | 299 | /* Save the EEPROM data */ |
| 280 | 300 | mame_fwrite( file, internal_eeprom, INTERNAL_EEPROM_SIZE ); |
| 281 | | } else { |
| 301 | } |
| 302 | else |
| 303 | { |
| 282 | 304 | /* Load the EEPROM data */ |
| 283 | | if ( file ) { |
| 305 | if ( file ) |
| 306 | { |
| 284 | 307 | mame_fread( file, internal_eeprom, INTERNAL_EEPROM_SIZE ); |
| 285 | | } else { |
| 308 | } |
| 309 | else |
| 310 | { |
| 286 | 311 | /* Initialize the EEPROM data */ |
| 287 | 312 | memset( internal_eeprom, 0xFF, sizeof( internal_eeprom ) ); |
| 288 | 313 | } |
| r4593 | r4594 | |
| 291 | 316 | |
| 292 | 317 | READ8_HANDLER( wswan_sram_r ) |
| 293 | 318 | { |
| 294 | | if ( eeprom.data == NULL ) { |
| 319 | if ( eeprom.data == NULL ) |
| 320 | { |
| 295 | 321 | return 0xFF; |
| 296 | 322 | } |
| 297 | 323 | return eeprom.page[ offset & ( eeprom.size - 1 ) ]; |
| r4593 | r4594 | |
| 299 | 325 | |
| 300 | 326 | WRITE8_HANDLER( wswan_sram_w ) |
| 301 | 327 | { |
| 302 | | if ( eeprom.data == NULL ) { |
| 328 | if ( eeprom.data == NULL ) |
| 329 | { |
| 303 | 330 | return; |
| 304 | 331 | } |
| 305 | 332 | eeprom.page[ offset & ( eeprom.size - 1 ) ] = data; |
| r4593 | r4594 | |
| 339 | 366 | /* Bit 1 - Determine mono/color */ |
| 340 | 367 | /* Bit 2 - Determine color/crystal */ |
| 341 | 368 | value = value & ~ 0x02; |
| 342 | | if ( system_type == WSC ) { |
| 369 | if ( system_type == WSC ) |
| 370 | { |
| 343 | 371 | value |= 2; |
| 344 | 372 | } |
| 345 | 373 | break; |
| r4593 | r4594 | |
| 356 | 384 | value = wswan_vdp.timer_vblank_count >> 8; |
| 357 | 385 | break; |
| 358 | 386 | case 0xCB: /* RTC data */ |
| 359 | | if ( ws_portram[0xca] == 0x95 && ( rtc.index < 7 ) ) { |
| 360 | | switch( rtc.index ) { |
| 387 | if ( ws_portram[0xca] == 0x95 && ( rtc.index < 7 ) ) |
| 388 | { |
| 389 | switch( rtc.index ) |
| 390 | { |
| 361 | 391 | case 0: value = rtc.year; break; |
| 362 | 392 | case 1: value = rtc.month; break; |
| 363 | 393 | case 2: value = rtc.day; break; |
| r4593 | r4594 | |
| 523 | 553 | Bit 0-3 - Gray tone setting for main palette index 0 |
| 524 | 554 | Bit 4-7 - Gray tone setting for main palette index 1 |
| 525 | 555 | */ |
| 526 | | if ( system_type == WSC ) { |
| 556 | if ( system_type == WSC ) |
| 557 | { |
| 527 | 558 | int i = 15 - ( data & 0x0F ); |
| 528 | 559 | int j = 15 - ( ( data & 0xF0 ) >> 4 ); |
| 529 | 560 | wswan_vdp.main_palette[0] = ( i << 8 ) | ( i << 4 ) | i; |
| 530 | 561 | wswan_vdp.main_palette[1] = ( j << 8 ) | ( j << 4 ) | j; |
| 531 | | } else { |
| 562 | } |
| 563 | else |
| 564 | { |
| 532 | 565 | wswan_vdp.main_palette[0] = data & 0x0F; |
| 533 | 566 | wswan_vdp.main_palette[1] = ( data & 0xF0 ) >> 4; |
| 534 | 567 | } |
| r4593 | r4594 | |
| 537 | 570 | Bit 0-3 - Gray tone setting for main palette index 2 |
| 538 | 571 | Bit 4-7 - Gray tone setting for main palette index 3 |
| 539 | 572 | */ |
| 540 | | if ( system_type == WSC ) { |
| 573 | if ( system_type == WSC ) |
| 574 | { |
| 541 | 575 | int i = 15 - ( data & 0x0F ); |
| 542 | 576 | int j = 15 - ( ( data & 0xF0 ) >> 4 ); |
| 543 | 577 | wswan_vdp.main_palette[2] = ( i << 8 ) | ( i << 4 ) | i; |
| 544 | 578 | wswan_vdp.main_palette[3] = ( j << 8 ) | ( j << 4 ) | j; |
| 545 | | } else { |
| 579 | } |
| 580 | else |
| 581 | { |
| 546 | 582 | wswan_vdp.main_palette[2] = data & 0x0F; |
| 547 | 583 | wswan_vdp.main_palette[3] = ( data & 0xF0 ) >> 4; |
| 548 | 584 | } |
| r4593 | r4594 | |
| 551 | 587 | Bit 0-3 - Gray tone setting for main palette index 4 |
| 552 | 588 | Bit 4-7 - Gray tone setting for main paeltte index 5 |
| 553 | 589 | */ |
| 554 | | if ( system_type == WSC ) { |
| 590 | if ( system_type == WSC ) |
| 591 | { |
| 555 | 592 | int i = 15 - ( data & 0x0F ); |
| 556 | 593 | int j = 15 - ( ( data & 0xF0 ) >> 4 ); |
| 557 | 594 | wswan_vdp.main_palette[4] = ( i << 8 ) | ( i << 4 ) | i; |
| 558 | 595 | wswan_vdp.main_palette[5] = ( j << 8 ) | ( j << 4 ) | j; |
| 559 | | } else { |
| 596 | } |
| 597 | else |
| 598 | { |
| 560 | 599 | wswan_vdp.main_palette[4] = data & 0x0F; |
| 561 | 600 | wswan_vdp.main_palette[5] = ( data & 0xF0 ) >> 4; |
| 562 | 601 | } |
| r4593 | r4594 | |
| 565 | 604 | Bit 0-3 - Gray tone setting for main palette index 6 |
| 566 | 605 | Bit 4-7 - Gray tone setting for main palette index 7 |
| 567 | 606 | */ |
| 568 | | if ( system_type == WSC ) { |
| 607 | if ( system_type == WSC ) |
| 608 | { |
| 569 | 609 | int i = 15 - ( data & 0x0F ); |
| 570 | 610 | int j = 15 - ( ( data & 0xF0 ) >> 4 ); |
| 571 | 611 | wswan_vdp.main_palette[6] = ( i << 8 ) | ( i << 4 ) | i; |
| 572 | 612 | wswan_vdp.main_palette[7] = ( j << 8 ) | ( j << 4 ) | j; |
| 573 | | } else { |
| 613 | } |
| 614 | else |
| 615 | { |
| 574 | 616 | wswan_vdp.main_palette[6] = data & 0x0F; |
| 575 | 617 | wswan_vdp.main_palette[7] = ( data & 0xF0 ) >> 4; |
| 576 | 618 | } |
| r4593 | r4594 | |
| 678 | 720 | src = ws_portram[0x40] + (ws_portram[0x41] << 8) + (ws_portram[0x42] << 16); |
| 679 | 721 | dst = ws_portram[0x44] + (ws_portram[0x45] << 8) + (ws_portram[0x43] << 16); |
| 680 | 722 | length = ws_portram[0x46] + (ws_portram[0x47] << 8); |
| 681 | | for( ; length > 0; length-- ) { |
| 723 | for( ; length > 0; length-- ) |
| 724 | { |
| 682 | 725 | memory_write_byte(space, dst, memory_read_byte(space, src ) ); |
| 683 | 726 | src++; |
| 684 | 727 | dst++; |
| r4593 | r4594 | |
| 748 | 791 | * 001 - packed, 4 color, use 2000, monochrome |
| 749 | 792 | * 000 - not packed, 4 color, use 2000, monochrome - Regular WS monochrome |
| 750 | 793 | */ |
| 751 | | if ( system_type == WSC ) { |
| 794 | if ( system_type == WSC ) |
| 795 | { |
| 752 | 796 | wswan_vdp.color_mode = data & 0x80; |
| 753 | 797 | wswan_vdp.colors_16 = data & 0x40; |
| 754 | 798 | wswan_vdp.tile_packed = data & 0x20; |
| r4593 | r4594 | |
| 844 | 888 | Bit 1 - Hardware type: 0 = WS, 1 = WSC |
| 845 | 889 | Bit 2-7 - Unknown |
| 846 | 890 | */ |
| 847 | | if ( ( data & 0x01 ) && !wswan_bios_disabled ) { |
| 891 | if ( ( data & 0x01 ) && !wswan_bios_disabled ) |
| 892 | { |
| 848 | 893 | wswan_bios_disabled = 1; |
| 849 | 894 | memory_set_bankptr( space->machine, 15, ROMMap[ ( ( ( ws_portram[0xc0] & 0x0F ) << 4 ) | 15 ) & ( ROMBanks - 1 ) ] ); |
| 850 | 895 | } |
| r4593 | r4594 | |
| 933 | 978 | */ |
| 934 | 979 | // data |= 0x02; |
| 935 | 980 | ws_portram[0xb1] = 0xFF; |
| 936 | | if ( data & 0x80 ) { |
| 981 | if ( data & 0x80 ) |
| 982 | { |
| 937 | 983 | // ws_portram[0xb1] = 0x00; |
| 938 | 984 | data |= 0x04; |
| 939 | 985 | } |
| 940 | | if (data & 0x20 ) { |
| 986 | if (data & 0x20 ) |
| 987 | { |
| 941 | 988 | // data |= 0x01; |
| 942 | 989 | } |
| 943 | 990 | break; |
| r4593 | r4594 | |
| 1001 | 1048 | Bit 6 - Protect |
| 1002 | 1049 | Bit 7 - Initialize |
| 1003 | 1050 | */ |
| 1004 | | if ( data & 0x20 ) { |
| 1051 | if ( data & 0x20 ) |
| 1052 | { |
| 1005 | 1053 | UINT16 addr = ( ( ( ws_portram[0xbd] << 8 ) | ws_portram[0xbc] ) << 1 ) & 0x1FF; |
| 1006 | 1054 | internal_eeprom[ addr ] = ws_portram[0xba]; |
| 1007 | 1055 | internal_eeprom[ addr + 1 ] = ws_portram[0xbb]; |
| 1008 | 1056 | data |= 0x02; |
| 1009 | | } else if ( data & 0x10 ) { |
| 1057 | } |
| 1058 | else if ( data & 0x10 ) |
| 1059 | { |
| 1010 | 1060 | UINT16 addr = ( ( ( ws_portram[0xbd] << 8 ) | ws_portram[0xbc] ) << 1 ) & 0x1FF; |
| 1011 | 1061 | ws_portram[0xba] = internal_eeprom[ addr ]; |
| 1012 | 1062 | ws_portram[0xbb] = internal_eeprom[ addr + 1]; |
| 1013 | 1063 | data |= 0x01; |
| 1014 | | } else { |
| 1064 | } |
| 1065 | else |
| 1066 | { |
| 1015 | 1067 | logerror( "Unsupported internal EEPROM command: %X\n", data ); |
| 1016 | 1068 | } |
| 1017 | 1069 | break; |
| r4593 | r4594 | |
| 1030 | 1082 | memory_set_bankptr( space->machine, 12, ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 12 ) & ( ROMBanks - 1 ) ] ); |
| 1031 | 1083 | memory_set_bankptr( space->machine, 13, ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 13 ) & ( ROMBanks - 1 ) ] ); |
| 1032 | 1084 | memory_set_bankptr( space->machine, 14, ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 14 ) & ( ROMBanks - 1 ) ] ); |
| 1033 | | if ( wswan_bios_disabled ) { |
| 1085 | if ( wswan_bios_disabled ) |
| 1086 | { |
| 1034 | 1087 | memory_set_bankptr( space->machine, 15, ROMMap[ ( ( ( data & 0x0F ) << 4 ) | 15 ) & ( ROMBanks - 1 ) ] ); |
| 1035 | 1088 | } |
| 1036 | 1089 | break; |
| 1037 | 1090 | case 0xc1: /* SRAM bank select |
| 1038 | 1091 | Bit 0-7 - SRAM bank to select |
| 1039 | 1092 | */ |
| 1040 | | if ( eeprom.mode == SRAM_64K || eeprom.mode == SRAM_256K || eeprom.mode == SRAM_512K || eeprom.mode == SRAM_1M || eeprom.mode == SRAM_2M ) { |
| 1093 | if ( eeprom.mode == SRAM_64K || eeprom.mode == SRAM_256K || eeprom.mode == SRAM_512K || eeprom.mode == SRAM_1M || eeprom.mode == SRAM_2M ) |
| 1094 | { |
| 1041 | 1095 | eeprom.page = &eeprom.data[ ( data * 64 * 1024 ) & ( eeprom.size - 1 ) ]; |
| 1042 | 1096 | } |
| 1043 | 1097 | break; |
| r4593 | r4594 | |
| 1066 | 1120 | 16KBit EEPROM: |
| 1067 | 1121 | Bit 0-7 - EEPROM address bit 1-8 |
| 1068 | 1122 | */ |
| 1069 | | switch( eeprom.mode ) { |
| 1123 | switch( eeprom.mode ) |
| 1124 | { |
| 1070 | 1125 | case EEPROM_1K: |
| 1071 | 1126 | eeprom.address = data & 0x3F; |
| 1072 | 1127 | eeprom.command = data >> 4; |
| 1073 | | if ( ( eeprom.command & 0x0C ) != 0x00 ) { |
| 1128 | if ( ( eeprom.command & 0x0C ) != 0x00 ) |
| 1129 | { |
| 1074 | 1130 | eeprom.command = eeprom.command & 0x0C; |
| 1075 | 1131 | } |
| 1076 | 1132 | break; |
| r4593 | r4594 | |
| 1100 | 1156 | Bit 4 - Start |
| 1101 | 1157 | Bit 5-7 - Unknown |
| 1102 | 1158 | */ |
| 1103 | | switch( eeprom.mode ) { |
| 1159 | switch( eeprom.mode ) |
| 1160 | { |
| 1104 | 1161 | case EEPROM_1K: |
| 1105 | 1162 | eeprom.start = data & 0x01; |
| 1106 | 1163 | break; |
| 1107 | 1164 | case EEPROM_16K: |
| 1108 | 1165 | eeprom.address = ( ( data & 0x03 ) << 8 ) | ( eeprom.address & 0xFF ); |
| 1109 | 1166 | eeprom.command = data & 0x0F; |
| 1110 | | if ( ( eeprom.command & 0x0C ) != 0x00 ) { |
| 1167 | if ( ( eeprom.command & 0x0C ) != 0x00 ) |
| 1168 | { |
| 1111 | 1169 | eeprom.command = eeprom.command & 0x0C; |
| 1112 | 1170 | } |
| 1113 | 1171 | eeprom.start = ( data >> 4 ) & 0x01; |
| r4593 | r4594 | |
| 1126 | 1184 | Bit 6 - Protect |
| 1127 | 1185 | Bit 7 - Initialize |
| 1128 | 1186 | */ |
| 1129 | | if ( eeprom.mode == EEPROM_1K || eeprom.mode == EEPROM_16K ) { |
| 1130 | | if ( data & 0x80 ) { /* Initialize */ |
| 1187 | if ( eeprom.mode == EEPROM_1K || eeprom.mode == EEPROM_16K ) |
| 1188 | { |
| 1189 | if ( data & 0x80 ) |
| 1190 | { /* Initialize */ |
| 1131 | 1191 | logerror( "Unsupported EEPROM command 'Initialize'\n" ); |
| 1132 | 1192 | } |
| 1133 | | if ( data & 0x40 ) { /* Protect */ |
| 1134 | | switch( eeprom.command ) { |
| 1193 | if ( data & 0x40 ) |
| 1194 | { /* Protect */ |
| 1195 | switch( eeprom.command ) |
| 1196 | { |
| 1135 | 1197 | case 0x00: |
| 1136 | 1198 | eeprom.write_enabled = 0; |
| 1137 | 1199 | data |= 0x02; |
| r4593 | r4594 | |
| 1144 | 1206 | logerror( "Unsupported 'Protect' command %X\n", eeprom.command ); |
| 1145 | 1207 | } |
| 1146 | 1208 | } |
| 1147 | | if ( data & 0x20 ) { /* Write */ |
| 1148 | | if ( eeprom.write_enabled ) { |
| 1149 | | switch( eeprom.command ) { |
| 1209 | if ( data & 0x20 ) |
| 1210 | { /* Write */ |
| 1211 | if ( eeprom.write_enabled ) |
| 1212 | { |
| 1213 | switch( eeprom.command ) |
| 1214 | { |
| 1150 | 1215 | case 0x04: |
| 1151 | 1216 | eeprom.data[ ( eeprom.address << 1 ) + 1 ] = ws_portram[0xc4]; |
| 1152 | 1217 | eeprom.data[ eeprom.address << 1 ] = ws_portram[0xc5]; |
| r4593 | r4594 | |
| 1157 | 1222 | } |
| 1158 | 1223 | } |
| 1159 | 1224 | } |
| 1160 | | if ( data & 0x10 ) { /* Read */ |
| 1225 | if ( data & 0x10 ) |
| 1226 | { /* Read */ |
| 1161 | 1227 | ws_portram[0xc4] = eeprom.data[ ( eeprom.address << 1 ) + 1 ]; |
| 1162 | 1228 | ws_portram[0xc5] = eeprom.data[ eeprom.address << 1 ]; |
| 1163 | 1229 | data |= 0x01; |
| 1164 | 1230 | } |
| 1165 | | } else { |
| 1231 | } |
| 1232 | else |
| 1233 | { |
| 1166 | 1234 | logerror( "EEPROM command for unknown EEPROM type\n" ); |
| 1167 | 1235 | } |
| 1168 | 1236 | break; |
| r4593 | r4594 | |
| 1176 | 1244 | Bit 5-6 - Unknown |
| 1177 | 1245 | Bit 7 - Command done (read only) |
| 1178 | 1246 | */ |
| 1179 | | switch( data ) { |
| 1247 | switch( data ) |
| 1248 | { |
| 1180 | 1249 | case 0x10: /* Reset */ |
| 1181 | 1250 | rtc.index = 8; |
| 1182 | 1251 | rtc.year = 0; |
| r4593 | r4594 | |
| 1214 | 1283 | } |
| 1215 | 1284 | break; |
| 1216 | 1285 | case 0xcb: /* RTC Data */ |
| 1217 | | if ( ws_portram[0xca] == 0x94 && rtc.index < 7 ) { |
| 1218 | | switch( rtc.index ) { |
| 1286 | if ( ws_portram[0xca] == 0x94 && rtc.index < 7 ) |
| 1287 | { |
| 1288 | switch( rtc.index ) |
| 1289 | { |
| 1219 | 1290 | case 0: rtc.year = data; break; |
| 1220 | 1291 | case 1: rtc.month = data; break; |
| 1221 | 1292 | case 2: rtc.day = data; break; |
| r4593 | r4594 | |
| 1236 | 1307 | ws_portram[offset] = data; |
| 1237 | 1308 | } |
| 1238 | 1309 | |
| 1239 | | static const char* wswan_determine_sram( UINT8 data ) { |
| 1310 | static const char* wswan_determine_sram( UINT8 data ) |
| 1311 | { |
| 1240 | 1312 | eeprom.write_enabled = 0; |
| 1241 | 1313 | eeprom.mode = SRAM_UNKNOWN; |
| 1242 | | switch( data ) { |
| 1314 | switch( data ) |
| 1315 | { |
| 1243 | 1316 | case 0x00: eeprom.mode = SRAM_NONE; break; |
| 1244 | 1317 | case 0x01: eeprom.mode = SRAM_64K; break; |
| 1245 | 1318 | case 0x02: eeprom.mode = SRAM_256K; break; |
| r4593 | r4594 | |
| 1260 | 1333 | "4Mbit", "8Mbit", "16Mbit", "32Mbit", "64Mbit", "128Mbit", "Unknown" |
| 1261 | 1334 | }; |
| 1262 | 1335 | |
| 1263 | | static const char* wswan_determine_romsize( UINT8 data ) { |
| 1264 | | switch( data ) { |
| 1336 | static const char* wswan_determine_romsize( UINT8 data ) |
| 1337 | { |
| 1338 | switch( data ) |
| 1339 | { |
| 1265 | 1340 | case 0x02: return wswan_romsize_str[ ROM_4M ]; |
| 1266 | 1341 | case 0x03: return wswan_romsize_str[ ROM_8M ]; |
| 1267 | 1342 | case 0x04: return wswan_romsize_str[ ROM_16M ]; |
| r4593 | r4594 | |
| 1298 | 1373 | UINT32 ii; |
| 1299 | 1374 | const char *sram_str; |
| 1300 | 1375 | |
| 1301 | | ws_ram = memory_get_read_ptr( cpu_get_address_space( image->machine->cpu[0], ADDRESS_SPACE_PROGRAM ), 0 ); |
| 1376 | ws_ram = memory_get_read_ptr( cputag_get_address_space( image->machine, "maincpu", ADDRESS_SPACE_PROGRAM ), 0 ); |
| 1302 | 1377 | memset( ws_ram, 0, 0xFFFF ); |
| 1303 | 1378 | ROMBanks = image_length( image ) / 65536; |
| 1304 | 1379 | |
| r4593 | r4594 | |
| 1335 | 1410 | mame_printf_debug( "\tSRAM size: %s\n", sram_str ); |
| 1336 | 1411 | mame_printf_debug( "\tFeatures: %X\n", ROMMap[ROMBanks-1][0xfffc] ); |
| 1337 | 1412 | mame_printf_debug( "\tRTC: %s\n", ( ROMMap[ROMBanks-1][0xfffd] ? "yes" : "no" ) ); |
| 1338 | | for( ii = 0; ii < ROMBanks; ii++ ) { |
| 1413 | for( ii = 0; ii < ROMBanks; ii++ ) |
| 1414 | { |
| 1339 | 1415 | int count; |
| 1340 | | for( count = 0; count < 0x10000; count++ ) { |
| 1416 | for( count = 0; count < 0x10000; count++ ) |
| 1417 | { |
| 1341 | 1418 | sum += ROMMap[ii][count]; |
| 1342 | 1419 | } |
| 1343 | 1420 | } |
| r4593 | r4594 | |
| 1348 | 1425 | } |
| 1349 | 1426 | #endif |
| 1350 | 1427 | |
| 1351 | | if ( eeprom.size != 0 ) { |
| 1428 | if ( eeprom.size != 0 ) |
| 1429 | { |
| 1352 | 1430 | eeprom.data = auto_malloc( eeprom.size ); |
| 1353 | 1431 | image_battery_load( image, eeprom.data, eeprom.size ); |
| 1354 | 1432 | eeprom.page = eeprom.data; |
| r4593 | r4594 | |
| 1364 | 1442 | |
| 1365 | 1443 | static TIMER_CALLBACK(wswan_scanline_interrupt) |
| 1366 | 1444 | { |
| 1367 | | if( wswan_vdp.current_line < 144 ) { |
| 1445 | if( wswan_vdp.current_line < 144 ) |
| 1446 | { |
| 1368 | 1447 | wswan_refresh_scanline(); |
| 1369 | 1448 | } |
| 1370 | 1449 | |
| 1371 | 1450 | /* Decrement 12kHz (HBlank) counter */ |
| 1372 | | if ( wswan_vdp.timer_hblank_enable && wswan_vdp.timer_hblank_reload != 0 ) { |
| 1451 | if ( wswan_vdp.timer_hblank_enable && wswan_vdp.timer_hblank_reload != 0 ) |
| 1452 | { |
| 1373 | 1453 | wswan_vdp.timer_hblank_count--; |
| 1374 | 1454 | logerror( "timer_hblank_count: %X\n", wswan_vdp.timer_hblank_count ); |
| 1375 | | if ( wswan_vdp.timer_hblank_count == 0 ) { |
| 1376 | | if ( wswan_vdp.timer_hblank_mode ) { |
| 1455 | if ( wswan_vdp.timer_hblank_count == 0 ) |
| 1456 | { |
| 1457 | if ( wswan_vdp.timer_hblank_mode ) |
| 1458 | { |
| 1377 | 1459 | wswan_vdp.timer_hblank_count = wswan_vdp.timer_hblank_reload; |
| 1378 | | } else { |
| 1460 | } |
| 1461 | else |
| 1462 | { |
| 1379 | 1463 | wswan_vdp.timer_hblank_reload = 0; |
| 1380 | 1464 | } |
| 1381 | 1465 | logerror( "trigerring hbltmr interrupt\n" ); |
| r4593 | r4594 | |
| 1384 | 1468 | } |
| 1385 | 1469 | |
| 1386 | 1470 | /* Handle Sound DMA */ |
| 1387 | | if ( ( sound_dma.enable & 0x88 ) == 0x80 ) { |
| 1388 | | const address_space *space = cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_PROGRAM ); |
| 1471 | if ( ( sound_dma.enable & 0x88 ) == 0x80 ) |
| 1472 | { |
| 1473 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM ); |
| 1389 | 1474 | /* TODO: Output sound DMA byte */ |
| 1390 | 1475 | wswan_port_w( space, 0x89, memory_read_byte(space, sound_dma.source ) ); |
| 1391 | 1476 | sound_dma.size--; |
| 1392 | 1477 | sound_dma.source = ( sound_dma.source + 1 ) & 0x0FFFFF; |
| 1393 | | if ( sound_dma.size == 0 ) { |
| 1478 | if ( sound_dma.size == 0 ) |
| 1479 | { |
| 1394 | 1480 | sound_dma.enable &= 0x7F; |
| 1395 | 1481 | } |
| 1396 | 1482 | } |
| 1397 | 1483 | |
| 1398 | 1484 | // wswan_vdp.current_line = (wswan_vdp.current_line + 1) % 159; |
| 1399 | 1485 | |
| 1400 | | if( wswan_vdp.current_line == 144 ) { |
| 1486 | if( wswan_vdp.current_line == 144 ) |
| 1487 | { |
| 1401 | 1488 | wswan_set_irq_line( machine, WSWAN_IFLAG_VBL ); |
| 1402 | 1489 | /* Decrement 75Hz (VBlank) counter */ |
| 1403 | | if ( wswan_vdp.timer_vblank_enable && wswan_vdp.timer_vblank_reload != 0 ) { |
| 1490 | if ( wswan_vdp.timer_vblank_enable && wswan_vdp.timer_vblank_reload != 0 ) |
| 1491 | { |
| 1404 | 1492 | wswan_vdp.timer_vblank_count--; |
| 1405 | 1493 | logerror( "timer_vblank_count: %X\n", wswan_vdp.timer_vblank_count ); |
| 1406 | | if ( wswan_vdp.timer_vblank_count == 0 ) { |
| 1407 | | if ( wswan_vdp.timer_vblank_mode ) { |
| 1494 | if ( wswan_vdp.timer_vblank_count == 0 ) |
| 1495 | { |
| 1496 | if ( wswan_vdp.timer_vblank_mode ) |
| 1497 | { |
| 1408 | 1498 | wswan_vdp.timer_vblank_count = wswan_vdp.timer_vblank_reload; |
| 1409 | | } else { |
| 1499 | } |
| 1500 | else |
| 1501 | { |
| 1410 | 1502 | wswan_vdp.timer_vblank_reload = 0; |
| 1411 | 1503 | } |
| 1412 | 1504 | logerror( "triggering vbltmr interrupt\n" ); |
| r4593 | r4594 | |
| 1417 | 1509 | |
| 1418 | 1510 | // wswan_vdp.current_line = (wswan_vdp.current_line + 1) % 159; |
| 1419 | 1511 | |
| 1420 | | if ( wswan_vdp.current_line == wswan_vdp.line_compare ) { |
| 1512 | if ( wswan_vdp.current_line == wswan_vdp.line_compare ) |
| 1513 | { |
| 1421 | 1514 | wswan_set_irq_line( machine, WSWAN_IFLAG_LCMP ); |
| 1422 | 1515 | } |
| 1423 | 1516 | |
| 1424 | 1517 | wswan_vdp.current_line = (wswan_vdp.current_line + 1) % 159; |
| 1425 | 1518 | |
| 1426 | | if ( wswan_vdp.current_line == 0 ) { |
| 1427 | | if ( wswan_vdp.display_vertical != wswan_vdp.new_display_vertical ) { |
| 1519 | if ( wswan_vdp.current_line == 0 ) |
| 1520 | { |
| 1521 | if ( wswan_vdp.display_vertical != wswan_vdp.new_display_vertical ) |
| 1522 | { |
| 1428 | 1523 | wswan_vdp.display_vertical = wswan_vdp.new_display_vertical; |
| 1429 | | if ( wswan_vdp.display_vertical ) { |
| 1524 | if ( wswan_vdp.display_vertical ) |
| 1525 | { |
| 1430 | 1526 | video_screen_set_visarea( machine->primary_screen, 5*8, 5*8 + WSWAN_Y_PIXELS - 1, 0, WSWAN_X_PIXELS - 1 ); |
| 1431 | | } else { |
| 1527 | } |
| 1528 | else |
| 1529 | { |
| 1432 | 1530 | video_screen_set_visarea( machine->primary_screen, 0, WSWAN_X_PIXELS - 1, 5*8, 5*8 + WSWAN_Y_PIXELS - 1 ); |
| 1433 | 1531 | } |
| 1434 | 1532 | } |
src/mess/machine/ti99_4x.c
| r4593 | r4594 | |
| 290 | 290 | |
| 291 | 291 | /* tms9900_ICount: used to implement memory waitstates (hack) */ |
| 292 | 292 | /* tms9995_ICount: used to implement memory waitstates (hack) */ |
| 293 | | /* NPW 23-Feb-2004 - externs no longer needed because we now use cpu_adjust_icount(space->machine->cpu[0],) */ |
| 293 | /* NPW 23-Feb-2004 - externs no longer needed because we now use cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),) */ |
| 294 | 294 | |
| 295 | 295 | |
| 296 | 296 | |
| r4593 | r4594 | |
| 424 | 424 | /* There is a circuitry in TI99/4(a) that resets the console when a |
| 425 | 425 | cartridge is inserted or removed. We emulate this instead of resetting the |
| 426 | 426 | emulator (which is the default in MESS). */ |
| 427 | | /*cpu_set_input_line(machine->cpu[0], INPUT_LINE_RESET, PULSE_LINE); |
| 427 | /*cputag_set_input_line(machine, "maincpu", INPUT_LINE_RESET, PULSE_LINE); |
| 428 | 428 | tms9901_reset(0); |
| 429 | 429 | if (! has_evpc) |
| 430 | 430 | TMS9928A_reset(); |
| r4593 | r4594 | |
| 551 | 551 | /* There is a circuitry in TI99/4(a) that resets the console when a |
| 552 | 552 | cartridge is inserted or removed. We emulate this instead of resetting the |
| 553 | 553 | emulator (which is the default in MESS). */ |
| 554 | | /*cpu_set_input_line(machine->cpu[0], INPUT_LINE_RESET, PULSE_LINE); |
| 554 | /*cputag_set_input_line(machine, "maincpu", INPUT_LINE_RESET, PULSE_LINE); |
| 555 | 555 | tms9901_reset(0); |
| 556 | 556 | if (! has_evpc) |
| 557 | 557 | TMS9928A_reset(); |
| r4593 | r4594 | |
| 702 | 702 | */ |
| 703 | 703 | MACHINE_RESET( ti99 ) |
| 704 | 704 | { |
| 705 | | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 705 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 706 | 706 | /*console_GROMs.data_ptr = memory_region(machine, region_grom);*/ |
| 707 | 707 | console_GROMs.addr = 0; |
| 708 | 708 | |
| r4593 | r4594 | |
| 952 | 952 | */ |
| 953 | 953 | READ16_HANDLER ( ti99_nop_8_r ) |
| 954 | 954 | { |
| 955 | | cpu_adjust_icount(space->machine->cpu[0],-4); |
| 955 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 956 | 956 | |
| 957 | 957 | return (0); |
| 958 | 958 | } |
| 959 | 959 | |
| 960 | 960 | WRITE16_HANDLER ( ti99_nop_8_w ) |
| 961 | 961 | { |
| 962 | | cpu_adjust_icount(space->machine->cpu[0],-4); |
| 962 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 963 | 963 | } |
| 964 | 964 | |
| 965 | 965 | /* |
| r4593 | r4594 | |
| 977 | 977 | */ |
| 978 | 978 | READ16_HANDLER ( ti99_cart_r ) |
| 979 | 979 | { |
| 980 | | cpu_adjust_icount(space->machine->cpu[0],-4); |
| 980 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 981 | 981 | |
| 982 | 982 | if (hsgpl_crdena) |
| 983 | 983 | /* hsgpl is enabled */ |
| r4593 | r4594 | |
| 991 | 991 | |
| 992 | 992 | WRITE16_HANDLER ( ti99_cart_w ) |
| 993 | 993 | { |
| 994 | | cpu_adjust_icount(space->machine->cpu[0],-4); |
| 994 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 995 | 995 | |
| 996 | 996 | if (hsgpl_crdena) |
| 997 | 997 | /* hsgpl is enabled */ |
| r4593 | r4594 | |
| 1021 | 1021 | if (ti99_4p_internal_rom6_enable) |
| 1022 | 1022 | return ti99_4p_internal_ROM6[offset]; |
| 1023 | 1023 | |
| 1024 | | cpu_adjust_icount(space->machine->cpu[0],-4); |
| 1024 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 1025 | 1025 | |
| 1026 | 1026 | if (hsgpl_crdena) |
| 1027 | 1027 | /* hsgpl is enabled */ |
| r4593 | r4594 | |
| 1038 | 1038 | return; |
| 1039 | 1039 | } |
| 1040 | 1040 | |
| 1041 | | cpu_adjust_icount(space->machine->cpu[0],-4); |
| 1041 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 1042 | 1042 | |
| 1043 | 1043 | if (hsgpl_crdena) |
| 1044 | 1044 | /* hsgpl is enabled */ |
| r4593 | r4594 | |
| 1080 | 1080 | */ |
| 1081 | 1081 | WRITE16_HANDLER ( ti99_wsnd_w ) |
| 1082 | 1082 | { |
| 1083 | | cpu_adjust_icount(space->machine->cpu[0],-4); |
| 1083 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 1084 | 1084 | |
| 1085 | 1085 | sn76496_w(devtag_get_device(space->machine, "sn76496"), offset, (data >> 8) & 0xff); |
| 1086 | 1086 | } |
| r4593 | r4594 | |
| 1090 | 1090 | */ |
| 1091 | 1091 | READ16_HANDLER ( ti99_rvdp_r ) |
| 1092 | 1092 | { |
| 1093 | | cpu_adjust_icount(space->machine->cpu[0],-4); |
| 1093 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 1094 | 1094 | |
| 1095 | 1095 | if (offset & 1) |
| 1096 | 1096 | { /* read VDP status */ |
| r4593 | r4594 | |
| 1107 | 1107 | */ |
| 1108 | 1108 | WRITE16_HANDLER ( ti99_wvdp_w ) |
| 1109 | 1109 | { |
| 1110 | | cpu_adjust_icount(space->machine->cpu[0],-4); |
| 1110 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 1111 | 1111 | |
| 1112 | 1112 | if (offset & 1) |
| 1113 | 1113 | { /* write VDP address */ |
| r4593 | r4594 | |
| 1124 | 1124 | */ |
| 1125 | 1125 | READ16_HANDLER ( ti99_rv38_r ) |
| 1126 | 1126 | { |
| 1127 | | cpu_adjust_icount(space->machine->cpu[0],-4); |
| 1127 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 1128 | 1128 | |
| 1129 | 1129 | if (offset & 1) |
| 1130 | 1130 | { /* read VDP status */ |
| r4593 | r4594 | |
| 1141 | 1141 | */ |
| 1142 | 1142 | WRITE16_HANDLER ( ti99_wv38_w ) |
| 1143 | 1143 | { |
| 1144 | | cpu_adjust_icount(space->machine->cpu[0],-4); |
| 1144 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 1145 | 1145 | |
| 1146 | 1146 | switch (offset & 3) |
| 1147 | 1147 | { |
| r4593 | r4594 | |
| 1169 | 1169 | */ |
| 1170 | 1170 | static READ16_HANDLER ( ti99_rspeech_r ) |
| 1171 | 1171 | { |
| 1172 | | cpu_adjust_icount(space->machine->cpu[0],-(18+3)); /* this is just a minimum, it can be more */ |
| 1172 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-(18+3)); /* this is just a minimum, it can be more */ |
| 1173 | 1173 | |
| 1174 | 1174 | return ((int) tms5220_status_r(devtag_get_device(space->machine, "tms5220"), offset)) << 8; |
| 1175 | 1175 | } |
| r4593 | r4594 | |
| 1195 | 1195 | */ |
| 1196 | 1196 | static WRITE16_HANDLER ( ti99_wspeech_w ) |
| 1197 | 1197 | { |
| 1198 | | cpu_adjust_icount(space->machine->cpu[0],-(54+3)); /* this is just an approx. minimum, it can be much more */ |
| 1198 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-(54+3)); /* this is just an approx. minimum, it can be much more */ |
| 1199 | 1199 | |
| 1200 | 1200 | #if 1 |
| 1201 | 1201 | /* the stupid design of the tms5220 core means that ready is cleared when |
| r4593 | r4594 | |
| 1205 | 1205 | if (! tms5220_ready_r(devtag_get_device(space->machine, "tms5220"))) |
| 1206 | 1206 | { |
| 1207 | 1207 | attotime time_to_ready = double_to_attotime(tms5220_time_to_ready(devtag_get_device(space->machine, "tms5220"))); |
| 1208 | | int cycles_to_ready = cpu_attotime_to_clocks(space->machine->cpu[0], time_to_ready); |
| 1208 | int cycles_to_ready = cputag_attotime_to_clocks(space->machine, "maincpu", time_to_ready); |
| 1209 | 1209 | |
| 1210 | 1210 | logerror("time to ready: %f -> %d\n", attotime_to_double(time_to_ready), (int) cycles_to_ready); |
| 1211 | 1211 | |
| 1212 | | cpu_adjust_icount(space->machine->cpu[0],-cycles_to_ready); |
| 1212 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-cycles_to_ready); |
| 1213 | 1213 | timer_set(space->machine, attotime_zero, NULL, 0, /*speech_kludge_callback*/NULL); |
| 1214 | 1214 | } |
| 1215 | 1215 | #endif |
| r4593 | r4594 | |
| 1225 | 1225 | int reply; |
| 1226 | 1226 | |
| 1227 | 1227 | |
| 1228 | | cpu_adjust_icount(space->machine->cpu[0],-4 /*20+3*/); /* from 4 to 23? */ |
| 1228 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4 /*20+3*/); /* from 4 to 23? */ |
| 1229 | 1229 | |
| 1230 | 1230 | if (offset & 1) |
| 1231 | 1231 | { /* read GPL address */ |
| r4593 | r4594 | |
| 1266 | 1266 | */ |
| 1267 | 1267 | WRITE16_HANDLER ( ti99_wgpl_w ) |
| 1268 | 1268 | { |
| 1269 | | cpu_adjust_icount(space->machine->cpu[0],-4/*20+3*/); /* from 4 to 23? */ |
| 1269 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4/*20+3*/); /* from 4 to 23? */ |
| 1270 | 1270 | |
| 1271 | 1271 | if (offset & 1) |
| 1272 | 1272 | { /* write GPL address */ |
| r4593 | r4594 | |
| 1312 | 1312 | */ |
| 1313 | 1313 | READ16_HANDLER ( ti99_4p_rgpl_r ) |
| 1314 | 1314 | { |
| 1315 | | cpu_adjust_icount(space->machine->cpu[0],-4); /* HSGPL is located on 8-bit bus? */ |
| 1315 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); /* HSGPL is located on 8-bit bus? */ |
| 1316 | 1316 | |
| 1317 | 1317 | return /*hsgpl_crdena ?*/ ti99_hsgpl_gpl_r(space, offset, mem_mask) /*: 0*/; |
| 1318 | 1318 | } |
| r4593 | r4594 | |
| 1322 | 1322 | */ |
| 1323 | 1323 | WRITE16_HANDLER ( ti99_4p_wgpl_w ) |
| 1324 | 1324 | { |
| 1325 | | cpu_adjust_icount(space->machine->cpu[0],-4); /* HSGPL is located on 8-bit bus? */ |
| 1325 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); /* HSGPL is located on 8-bit bus? */ |
| 1326 | 1326 | |
| 1327 | 1327 | /*if (hsgpl_crdena)*/ |
| 1328 | 1328 | ti99_hsgpl_gpl_w(space, offset, data, mem_mask); |
| r4593 | r4594 | |
| 1393 | 1393 | /* speech read */ |
| 1394 | 1394 | if (! (offset & 1)) |
| 1395 | 1395 | { |
| 1396 | | cpu_adjust_icount(space->machine->cpu[0],-16*4); /* this is just a minimum, it can be more */ |
| 1396 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-16*4); /* this is just a minimum, it can be more */ |
| 1397 | 1397 | reply = tms5220_status_r(devtag_get_device(space->machine, "tms5220"), 0); |
| 1398 | 1398 | } |
| 1399 | 1399 | break; |
| r4593 | r4594 | |
| 1557 | 1557 | /* speech write */ |
| 1558 | 1558 | if (! (offset & 1)) |
| 1559 | 1559 | { |
| 1560 | | cpu_adjust_icount(space->machine->cpu[0],-48*4); /* this is just an approx. minimum, it can be much more */ |
| 1560 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-48*4); /* this is just an approx. minimum, it can be much more */ |
| 1561 | 1561 | |
| 1562 | 1562 | /* the stupid design of the tms5220 core means that ready is cleared when |
| 1563 | 1563 | there are 15 bytes in FIFO. It should be 16. Of course, if it were the |
| r4593 | r4594 | |
| 1566 | 1566 | if (! tms5220_ready_r(devtag_get_device(space->machine, "tms5220"))) |
| 1567 | 1567 | { |
| 1568 | 1568 | attotime time_to_ready = double_to_attotime(tms5220_time_to_ready(devtag_get_device(space->machine, "tms5220"))); |
| 1569 | | double d = ceil(cpu_attotime_to_clocks(space->machine->cpu[0], time_to_ready)); |
| 1569 | double d = ceil(cputag_attotime_to_clocks(space->machine, "maincpu", time_to_ready)); |
| 1570 | 1570 | int cycles_to_ready = ((int) (d + 3)) & ~3; |
| 1571 | 1571 | |
| 1572 | 1572 | logerror("time to ready: %f -> %d\n", attotime_to_double(time_to_ready) |
| 1573 | 1573 | , (int) cycles_to_ready); |
| 1574 | 1574 | |
| 1575 | | cpu_adjust_icount(space->machine->cpu[0],-cycles_to_ready); |
| 1575 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-cycles_to_ready); |
| 1576 | 1576 | timer_set(space->machine, attotime_zero, NULL, 0, /*speech_kludge_callback*/NULL); |
| 1577 | 1577 | } |
| 1578 | 1578 | |
| r4593 | r4594 | |
| 2163 | 2163 | { |
| 2164 | 2164 | /* On TI99, TMS9900 IC0-3 lines are not connected to TMS9901, |
| 2165 | 2165 | * but hard-wired to force level 1 interrupts */ |
| 2166 | | cpu_set_input_line_and_vector(device->machine->cpu[0], 0, ASSERT_LINE, 1); /* interrupt it, baby */ |
| 2166 | cputag_set_input_line_and_vector(device->machine, "maincpu", 0, ASSERT_LINE, 1); /* interrupt it, baby */ |
| 2167 | 2167 | } |
| 2168 | 2168 | else |
| 2169 | 2169 | { |
| 2170 | | cpu_set_input_line(device->machine->cpu[0], 0, CLEAR_LINE); |
| 2170 | cputag_set_input_line(device->machine, "maincpu", 0, CLEAR_LINE); |
| 2171 | 2171 | } |
| 2172 | 2172 | } |
| 2173 | 2173 | |
| r4593 | r4594 | |
| 2607 | 2607 | |
| 2608 | 2608 | static void ti99_TIxram_init(running_machine *machine) |
| 2609 | 2609 | { |
| 2610 | | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 2610 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 2611 | 2611 | |
| 2612 | 2612 | memory_install_read16_handler(space, 0x2000, 0x3fff, 0, 0, ti99_TIxramlow_r); |
| 2613 | 2613 | memory_install_write16_handler(space, 0x2000, 0x3fff, 0, 0, ti99_TIxramlow_w); |
| r4593 | r4594 | |
| 2618 | 2618 | /* low 8 kb: 0x2000-0x3fff */ |
| 2619 | 2619 | static READ16_HANDLER ( ti99_TIxramlow_r ) |
| 2620 | 2620 | { |
| 2621 | | cpu_adjust_icount(space->machine->cpu[0],-4); |
| 2621 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 2622 | 2622 | |
| 2623 | 2623 | return xRAM_ptr[offset]; |
| 2624 | 2624 | } |
| 2625 | 2625 | |
| 2626 | 2626 | static WRITE16_HANDLER ( ti99_TIxramlow_w ) |
| 2627 | 2627 | { |
| 2628 | | cpu_adjust_icount(space->machine->cpu[0],-4); |
| 2628 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 2629 | 2629 | |
| 2630 | 2630 | COMBINE_DATA(xRAM_ptr + offset); |
| 2631 | 2631 | } |
| r4593 | r4594 | |
| 2633 | 2633 | /* high 24 kb: 0xa000-0xffff */ |
| 2634 | 2634 | static READ16_HANDLER ( ti99_TIxramhigh_r ) |
| 2635 | 2635 | { |
| 2636 | | cpu_adjust_icount(space->machine->cpu[0],-4); |
| 2636 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 2637 | 2637 | |
| 2638 | 2638 | return xRAM_ptr[offset+0x1000]; |
| 2639 | 2639 | } |
| 2640 | 2640 | |
| 2641 | 2641 | static WRITE16_HANDLER ( ti99_TIxramhigh_w ) |
| 2642 | 2642 | { |
| 2643 | | cpu_adjust_icount(space->machine->cpu[0],-4); |
| 2643 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 2644 | 2644 | |
| 2645 | 2645 | COMBINE_DATA(xRAM_ptr + offset+0x1000); |
| 2646 | 2646 | } |
| r4593 | r4594 | |
| 2683 | 2683 | { |
| 2684 | 2684 | int i; |
| 2685 | 2685 | |
| 2686 | | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 2686 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 2687 | 2687 | |
| 2688 | 2688 | memory_install_read16_handler(space, 0x2000, 0x3fff, 0, 0, ti99_sAMSxramlow_r); |
| 2689 | 2689 | memory_install_write16_handler(space, 0x2000, 0x3fff, 0, 0, ti99_sAMSxramlow_w); |
| r4593 | r4594 | |
| 2722 | 2722 | /* low 8 kb: 0x2000-0x3fff */ |
| 2723 | 2723 | static READ16_HANDLER ( ti99_sAMSxramlow_r ) |
| 2724 | 2724 | { |
| 2725 | | cpu_adjust_icount(space->machine->cpu[0],-4); |
| 2725 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 2726 | 2726 | |
| 2727 | 2727 | if (sAMS_mapper_on) |
| 2728 | 2728 | return xRAM_ptr[(offset&0x7ff)+sAMSlookup[(0x1000+offset)>>11]]; |
| r4593 | r4594 | |
| 2732 | 2732 | |
| 2733 | 2733 | static WRITE16_HANDLER ( ti99_sAMSxramlow_w ) |
| 2734 | 2734 | { |
| 2735 | | cpu_adjust_icount(space->machine->cpu[0],-4); |
| 2735 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 2736 | 2736 | |
| 2737 | 2737 | if (sAMS_mapper_on) |
| 2738 | 2738 | COMBINE_DATA(xRAM_ptr + (offset&0x7ff)+sAMSlookup[(0x1000+offset)>>11]); |
| r4593 | r4594 | |
| 2743 | 2743 | /* high 24 kb: 0xa000-0xffff */ |
| 2744 | 2744 | static READ16_HANDLER ( ti99_sAMSxramhigh_r ) |
| 2745 | 2745 | { |
| 2746 | | cpu_adjust_icount(space->machine->cpu[0],-4); |
| 2746 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 2747 | 2747 | |
| 2748 | 2748 | if (sAMS_mapper_on) |
| 2749 | 2749 | return xRAM_ptr[(offset&0x7ff)+sAMSlookup[(0x5000+offset)>>11]]; |
| r4593 | r4594 | |
| 2753 | 2753 | |
| 2754 | 2754 | static WRITE16_HANDLER ( ti99_sAMSxramhigh_w ) |
| 2755 | 2755 | { |
| 2756 | | cpu_adjust_icount(space->machine->cpu[0],-4); |
| 2756 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 2757 | 2757 | |
| 2758 | 2758 | if (sAMS_mapper_on) |
| 2759 | 2759 | COMBINE_DATA(xRAM_ptr + (offset&0x7ff)+sAMSlookup[(0x5000+offset)>>11]); |
| r4593 | r4594 | |
| 2946 | 2946 | /* set up myarc handlers, and set initial state */ |
| 2947 | 2947 | static void ti99_myarcxram_init(running_machine *machine) |
| 2948 | 2948 | { |
| 2949 | | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 2949 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 2950 | 2950 | |
| 2951 | 2951 | memory_install_read16_handler(space, 0x2000, 0x3fff, 0, 0, ti99_myarcxramlow_r); |
| 2952 | 2952 | memory_install_write16_handler(space, 0x2000, 0x3fff, 0, 0, ti99_myarcxramlow_w); |
| r4593 | r4594 | |
| 3016 | 3016 | /* low 8 kb: 0x2000-0x3fff */ |
| 3017 | 3017 | static READ16_HANDLER ( ti99_myarcxramlow_r ) |
| 3018 | 3018 | { |
| 3019 | | cpu_adjust_icount(space->machine->cpu[0],-4); |
| 3019 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 3020 | 3020 | |
| 3021 | 3021 | return xRAM_ptr[myarc_cur_page_offset + offset]; |
| 3022 | 3022 | } |
| 3023 | 3023 | |
| 3024 | 3024 | static WRITE16_HANDLER ( ti99_myarcxramlow_w ) |
| 3025 | 3025 | { |
| 3026 | | cpu_adjust_icount(space->machine->cpu[0],-4); |
| 3026 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 3027 | 3027 | |
| 3028 | 3028 | COMBINE_DATA(xRAM_ptr + myarc_cur_page_offset + offset); |
| 3029 | 3029 | } |
| r4593 | r4594 | |
| 3031 | 3031 | /* high 24 kb: 0xa000-0xffff */ |
| 3032 | 3032 | static READ16_HANDLER ( ti99_myarcxramhigh_r ) |
| 3033 | 3033 | { |
| 3034 | | cpu_adjust_icount(space->machine->cpu[0],-4); |
| 3034 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 3035 | 3035 | |
| 3036 | 3036 | return xRAM_ptr[myarc_cur_page_offset + offset+0x1000]; |
| 3037 | 3037 | } |
| 3038 | 3038 | |
| 3039 | 3039 | static WRITE16_HANDLER ( ti99_myarcxramhigh_w ) |
| 3040 | 3040 | { |
| 3041 | | cpu_adjust_icount(space->machine->cpu[0],-4); |
| 3041 | cpu_adjust_icount(cputag_get_cpu(space->machine, "maincpu"),-4); |
| 3042 | 3042 | |
| 3043 | 3043 | COMBINE_DATA(xRAM_ptr + myarc_cur_page_offset + offset+0x1000); |
| 3044 | 3044 | } |
src/mess/devices/thomflop.c
| r4593 | r4594 | |
| 277 | 277 | else if ( offset == 8 ) |
| 278 | 278 | return to7_5p14_select; |
| 279 | 279 | else |
| 280 | | logerror ( "%f $%04x to7_5p14_r: invalid read offset %i\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), offset ); |
| 280 | logerror ( "%f $%04x to7_5p14_r: invalid read offset %i\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset ); |
| 281 | 281 | return 0; |
| 282 | 282 | } |
| 283 | 283 | |
| r4593 | r4594 | |
| 302 | 302 | case 4: drive = 2; side = 0; break; |
| 303 | 303 | case 5: drive = 3; side = 1; break; |
| 304 | 304 | default: |
| 305 | | logerror( "%f $%04x to7_5p14_w: invalid drive select pattern $%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data ); |
| 305 | logerror( "%f $%04x to7_5p14_w: invalid drive select pattern $%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), data ); |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | dens = (data & 0x80) ? DEN_FM_LO : DEN_MFM_LO; |
| r4593 | r4594 | |
| 317 | 317 | wd17xx_set_drive( fdc, drive ); |
| 318 | 318 | wd17xx_set_side( fdc, side ); |
| 319 | 319 | LOG(( "%f $%04x to7_5p14_w: $%02X set drive=%i side=%i density=%s\n", |
| 320 | | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), |
| 320 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), |
| 321 | 321 | data, drive, side, (dens == DEN_FM_LO) ? "FM" : "MFM" )); |
| 322 | 322 | } |
| 323 | 323 | } |
| 324 | 324 | else |
| 325 | 325 | logerror ( "%f $%04x to7_5p14_w: invalid write offset %i (data=$%02X)\n", |
| 326 | | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), offset, data ); |
| 326 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset, data ); |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | |
| r4593 | r4594 | |
| 375 | 375 | else if ( offset >= 8 && offset <= 9 ) |
| 376 | 376 | return to7_5p14sd_select; |
| 377 | 377 | else |
| 378 | | logerror ( "%f $%04x to7_5p14sd_r: invalid read offset %i\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), offset ); |
| 378 | logerror ( "%f $%04x to7_5p14sd_r: invalid read offset %i\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset ); |
| 379 | 379 | return 0; |
| 380 | 380 | } |
| 381 | 381 | |
| r4593 | r4594 | |
| 419 | 419 | mc6843_set_drive( devtag_get_device(space->machine, "mc6843"), drive ); |
| 420 | 420 | mc6843_set_side( devtag_get_device(space->machine, "mc6843"), side ); |
| 421 | 421 | LOG(( "%f $%04x to7_5p14sd_w: $%02X set drive=%i side=%i\n", |
| 422 | | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data, drive, side )); |
| 422 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), data, drive, side )); |
| 423 | 423 | } |
| 424 | 424 | } |
| 425 | 425 | else |
| 426 | 426 | logerror ( "%f $%04x to7_5p14sd_w: invalid write offset %i (data=$%02X)\n", |
| 427 | | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), offset, data ); |
| 427 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset, data ); |
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | static void to7_5p14_index_pulse_callback( const device_config *controller,const device_config *image, int state ) |
| r4593 | r4594 | |
| 604 | 604 | data = to7qdd->data[ to7qdd->data_idx ]; |
| 605 | 605 | |
| 606 | 606 | VLOG(( "%f $%04x to7_qdd_read_byte: RDATA off=%i/%i data=$%02X\n", |
| 607 | | attotime_to_double(timer_get_time(machine)), cpu_get_previouspc( machine->cpu[0] ), |
| 607 | attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(cputag_get_cpu(machine, "maincpu")), |
| 608 | 608 | to7qdd->data_idx, to7qdd->data_size, data )); |
| 609 | 609 | |
| 610 | 610 | to7qdd->data_idx++; |
| r4593 | r4594 | |
| 645 | 645 | to7qdd->data_idx++; |
| 646 | 646 | |
| 647 | 647 | VLOG (( "%f $%04x to7_qdd_write_byte: got $%02X offs=%i-%i\n", |
| 648 | | attotime_to_double(timer_get_time(machine)), cpu_get_previouspc( machine->cpu[0] ), data, |
| 648 | attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(cputag_get_cpu(machine, "maincpu")), data, |
| 649 | 649 | to7qdd->start_idx, to7qdd->data_idx )); |
| 650 | 650 | |
| 651 | 651 | /* end of tentative id field */ |
| r4593 | r4594 | |
| 659 | 659 | UINT8 filler = 0xff; |
| 660 | 660 | |
| 661 | 661 | LOG(( "%f $%04x to7_qdd_write_byte: got id field for sector=%i\n", |
| 662 | | attotime_to_double(timer_get_time(machine)), cpu_get_previouspc( machine->cpu[0] ), sector )); |
| 662 | attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(cputag_get_cpu(machine, "maincpu")), sector )); |
| 663 | 663 | |
| 664 | 664 | floppy_drive_format_sector( to7_qdd_image(machine), |
| 665 | 665 | 0, sector, 0, 0, sector, 128, filler ); |
| r4593 | r4594 | |
| 688 | 688 | int sector = (int) to7qdd->data[ i + 1 ] * 256 + (int) to7qdd->data[ i + 2 ]; |
| 689 | 689 | |
| 690 | 690 | LOG(( "%f $%04x to7_qdd_write_byte: goto data field for sector=%i\n", |
| 691 | | attotime_to_double(timer_get_time(machine)), cpu_get_previouspc( machine->cpu[0] ), sector )); |
| 691 | attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(cputag_get_cpu(machine, "maincpu")), sector )); |
| 692 | 692 | |
| 693 | 693 | floppy_drive_write_sector_data( to7_qdd_image(machine), 0, sector, to7qdd->data + to7qdd->start_idx + 1, 128, 0 ); |
| 694 | 694 | } |
| r4593 | r4594 | |
| 710 | 710 | case 0: /* MC6852 status */ |
| 711 | 711 | to7_qdd_stat_update(space->machine); |
| 712 | 712 | VLOG(( "%f $%04x to7_qdd_r: STAT=$%02X irq=%i pe=%i ovr=%i und=%i tr=%i rd=%i ncts=%i\n", |
| 713 | | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), to7qdd->status, |
| 713 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), to7qdd->status, |
| 714 | 714 | to7qdd->status & QDD_S_IRQ ? 1 : 0, |
| 715 | 715 | to7qdd->status & QDD_S_PE ? 1 : 0, |
| 716 | 716 | to7qdd->status & QDD_S_OVR ? 1 : 0, |
| r4593 | r4594 | |
| 733 | 733 | data |= 0x40; /* disk present */ |
| 734 | 734 | if ( to7qdd->index_pulse ) |
| 735 | 735 | data |= 0x80; /* disk start */ |
| 736 | | VLOG(( "%f $%04x to7_qdd_r: STATUS8 $%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data )); |
| 736 | VLOG(( "%f $%04x to7_qdd_r: STATUS8 $%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), data )); |
| 737 | 737 | return data; |
| 738 | 738 | } |
| 739 | 739 | |
| 740 | 740 | default: |
| 741 | | logerror ( "%f $%04x to7_qdd_r: invalid read offset %i\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), offset ); |
| 741 | logerror ( "%f $%04x to7_qdd_r: invalid read offset %i\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset ); |
| 742 | 742 | return 0; |
| 743 | 743 | } |
| 744 | 744 | } |
| r4593 | r4594 | |
| 760 | 760 | to7qdd->ctrl1 = ( data & ~(QDD_C1_RRESET | QDD_C1_TRESET) ) |( data & (QDD_C1_RRESET | QDD_C1_TRESET) & to7qdd->ctrl1 ); |
| 761 | 761 | to7_qdd_stat_update(space->machine); |
| 762 | 762 | VLOG(( "%f $%04x to7_qdd_w: CTRL1=$%02X reset=%c%c %s%sirq=%c%c\n", |
| 763 | | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data, |
| 763 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), data, |
| 764 | 764 | data & QDD_C1_RRESET ? 'r' : '-', data & QDD_C1_TRESET ? 't' : '-', |
| 765 | 765 | data & QDD_C1_STRIPSYNC ? "strip-sync " : "", |
| 766 | 766 | data & QDD_C1_CLRSYNC ? "clear-sync " : "", |
| r4593 | r4594 | |
| 784 | 784 | parity = par[ (data >> 3) & 7 ]; |
| 785 | 785 | to7_qdd_stat_update(space->machine); |
| 786 | 786 | VLOG(( "%f $%04x to7_qdd_w: CTRL2=$%02X bits=%i par=%s blen=%i under=%s%s\n", |
| 787 | | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data, |
| 787 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), data, |
| 788 | 788 | bits, parname[ parity ], data & QDD_C2_BLEN ? 1 : 2, |
| 789 | 789 | data & QDD_C2_TSYNC ? "sync" : "ff", |
| 790 | 790 | data & QDD_C2_EIE ? "irq-err" : "" )); |
| r4593 | r4594 | |
| 802 | 802 | to7qdd->status &= ~QDD_S_NCTS; |
| 803 | 803 | to7_qdd_stat_update(space->machine); |
| 804 | 804 | VLOG(( "%f $%04x to7_qdd_w: CTRL3=$%02X %s%ssync-len=%i sync-mode=%s\n", |
| 805 | | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data, |
| 805 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), data, |
| 806 | 806 | data & QDD_C3_CLRTUF ? "clr-tuf " : "", |
| 807 | 807 | data & QDD_C3_CLRCTS ? "clr-cts " : "", |
| 808 | 808 | data & QDD_C3_SYNCLEN ? 1 : 2, |
| r4593 | r4594 | |
| 814 | 814 | break; |
| 815 | 815 | |
| 816 | 816 | case 3: /* MC6852 data out => does not seem to be used */ |
| 817 | | VLOG(( "%f $%04x to7_qdd_w: ignored WDATA=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data )); |
| 817 | VLOG(( "%f $%04x to7_qdd_w: ignored WDATA=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), data )); |
| 818 | 818 | break; |
| 819 | 819 | |
| 820 | 820 | } |
| r4593 | r4594 | |
| 822 | 822 | |
| 823 | 823 | case 8: /* set drive */ |
| 824 | 824 | to7qdd->drive = data; |
| 825 | | VLOG(( "%f $%04x to7_qdd_w: DRIVE=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data )); |
| 825 | VLOG(( "%f $%04x to7_qdd_w: DRIVE=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), data )); |
| 826 | 826 | break; |
| 827 | 827 | |
| 828 | 828 | case 12: /* motor pulse ? */ |
| 829 | 829 | thom_floppy_active( space->machine, 0 ); |
| 830 | | VLOG(( "%f $%04x to7_qdd_w: MOTOR=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data )); |
| 830 | VLOG(( "%f $%04x to7_qdd_w: MOTOR=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), data )); |
| 831 | 831 | break; |
| 832 | 832 | |
| 833 | 833 | default: |
| 834 | | logerror ( "%f $%04x to7_qdd_w: invalid write offset %i (data=$%02X)\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), offset, data ); |
| 834 | logerror ( "%f $%04x to7_qdd_w: invalid write offset %i (data=$%02X)\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset, data ); |
| 835 | 835 | } |
| 836 | 836 | } |
| 837 | 837 | |
| r4593 | r4594 | |
| 1058 | 1058 | UINT8 data = thmfc1->data[ thmfc1->data_idx ]; |
| 1059 | 1059 | |
| 1060 | 1060 | VLOG(( "%f $%04x thmfc_floppy_read_byte: off=%i/%i/%i data=$%02X\n", |
| 1061 | | attotime_to_double(timer_get_time(machine)), cpu_get_previouspc( machine->cpu[0] ), |
| 1061 | attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(cputag_get_cpu(machine, "maincpu")), |
| 1062 | 1062 | thmfc1->data_idx, thmfc1->data_finish - 1, thmfc1->data_size - 1, |
| 1063 | 1063 | data )); |
| 1064 | 1064 | |
| r4593 | r4594 | |
| 1101 | 1101 | data = thmfc1->data[ thmfc1->data_raw_idx ]; |
| 1102 | 1102 | |
| 1103 | 1103 | VLOG(( "%f $%04x thmfc_floppy_raw_read_byte: off=%i/%i data=$%02X\n", |
| 1104 | | attotime_to_double(timer_get_time(machine)), cpu_get_previouspc( machine->cpu[0] ), |
| 1104 | attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(cputag_get_cpu(machine, "maincpu")), |
| 1105 | 1105 | thmfc1->data_raw_idx, thmfc1->data_raw_size, data )); |
| 1106 | 1106 | |
| 1107 | 1107 | thmfc1->data_raw_idx++; |
| r4593 | r4594 | |
| 1139 | 1139 | } |
| 1140 | 1140 | |
| 1141 | 1141 | VLOG (( "%f $%04x thmfc_floppy_qdd_write_byte: $%02X offs=%i-%i\n", |
| 1142 | | attotime_to_double(timer_get_time(machine)), cpu_get_previouspc( machine->cpu[0] ), data, |
| 1142 | attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(cputag_get_cpu(machine, "maincpu")), data, |
| 1143 | 1143 | thmfc1->data_idx,thmfc1->data_raw_idx )); |
| 1144 | 1144 | |
| 1145 | 1145 | if ( thmfc1->data_raw_idx == thmfc1->data_idx + 3 && |
| r4593 | r4594 | |
| 1151 | 1151 | int sector = (int) thmfc1->data[ thmfc1->data_idx ] * 256 + (int) thmfc1->data[ thmfc1->data_idx + 1 ]; |
| 1152 | 1152 | UINT8 filler = 0xff; |
| 1153 | 1153 | |
| 1154 | | LOG(( "%f $%04x thmfc_floppy_qdd_write_byte: id field, sector=%i\n", attotime_to_double(timer_get_time(machine)), cpu_get_previouspc( machine->cpu[0] ), sector )); |
| 1154 | LOG(( "%f $%04x thmfc_floppy_qdd_write_byte: id field, sector=%i\n", attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(cputag_get_cpu(machine, "maincpu")), sector )); |
| 1155 | 1155 | |
| 1156 | 1156 | floppy_drive_format_sector( thmfc_floppy_image(machine), 0, sector, 0, 0, sector, 128, filler ); |
| 1157 | 1157 | thmfc1->data_idx = 0; |
| r4593 | r4594 | |
| 1180 | 1180 | (int) thmfc1->data[ i + 2 ]; |
| 1181 | 1181 | |
| 1182 | 1182 | LOG(( "%f $%04x thmfc_floppy_qdd_write_byte: data field, sector=%i\n", |
| 1183 | | attotime_to_double(timer_get_time(machine)), cpu_get_previouspc( machine->cpu[0] ), sector )); |
| 1183 | attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(cputag_get_cpu(machine, "maincpu")), sector )); |
| 1184 | 1184 | |
| 1185 | 1185 | floppy_drive_write_sector_data( img, 0, sector, thmfc1->data + thmfc1->data_idx, 128, 0 ); |
| 1186 | 1186 | } |
| r4593 | r4594 | |
| 1194 | 1194 | else |
| 1195 | 1195 | { |
| 1196 | 1196 | thmfc1->data_raw_idx++; |
| 1197 | | VLOG (( "%f $%04x thmfc_floppy_qdd_write_byte: ignored $%02X\n", attotime_to_double(timer_get_time(machine)), cpu_get_previouspc( machine->cpu[0] ), data )); |
| 1197 | VLOG (( "%f $%04x thmfc_floppy_qdd_write_byte: ignored $%02X\n", attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(cputag_get_cpu(machine, "maincpu")), data )); |
| 1198 | 1198 | } |
| 1199 | 1199 | |
| 1200 | 1200 | } |
| r4593 | r4594 | |
| 1205 | 1205 | static void thmfc_floppy_write_byte ( running_machine *machine, UINT8 data ) |
| 1206 | 1206 | { |
| 1207 | 1207 | VLOG (( "%f $%04x thmfc_floppy_write_byte: off=%i/%i data=$%02X\n", |
| 1208 | | attotime_to_double(timer_get_time(machine)), cpu_get_previouspc( machine->cpu[0] ), |
| 1208 | attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(cputag_get_cpu(machine, "maincpu")), |
| 1209 | 1209 | thmfc1->data_idx, thmfc1->data_size - 1, data )); |
| 1210 | 1210 | |
| 1211 | 1211 | thmfc1->data_raw_size = 0; |
| r4593 | r4594 | |
| 1219 | 1219 | /* intelligent formatting */ |
| 1220 | 1220 | static void thmfc_floppy_format_byte ( running_machine *machine, UINT8 data ) |
| 1221 | 1221 | { |
| 1222 | | VLOG (( "%f $%04x thmfc_floppy_format_byte: $%02X\n", attotime_to_double(timer_get_time(machine)), cpu_get_previouspc( machine->cpu[0] ), data )); |
| 1222 | VLOG (( "%f $%04x thmfc_floppy_format_byte: $%02X\n", attotime_to_double(timer_get_time(machine)), cpu_get_previouspc(cputag_get_cpu(machine, "maincpu")), data )); |
| 1223 | 1223 | |
| 1224 | 1224 | thmfc1->data_raw_size = 0; |
| 1225 | 1225 | |
| r4593 | r4594 | |
| 1259 | 1259 | |
| 1260 | 1260 | case 0: /* STAT0 */ |
| 1261 | 1261 | thmfc1->stat0 ^= THMFC1_STAT0_SYNCHRO | THMFC1_STAT0_BYTE_READY_POL; |
| 1262 | | VLOG(( "%f $%04x thmfc_floppy_r: STAT0=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), thmfc1->stat0 )); |
| 1262 | VLOG(( "%f $%04x thmfc_floppy_r: STAT0=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), thmfc1->stat0 )); |
| 1263 | 1263 | return thmfc1->stat0; |
| 1264 | 1264 | |
| 1265 | 1265 | case 1: /* STAT1 */ |
| r4593 | r4594 | |
| 1290 | 1290 | data |= 0x10; |
| 1291 | 1291 | if ( flags & FLOPPY_DRIVE_DISK_WRITE_PROTECTED ) |
| 1292 | 1292 | data |= 0x04; |
| 1293 | | VLOG(( "%f $%04x thmfc_floppy_r: STAT1=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data )); |
| 1293 | VLOG(( "%f $%04x thmfc_floppy_r: STAT1=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), data )); |
| 1294 | 1294 | return data; |
| 1295 | 1295 | } |
| 1296 | 1296 | |
| r4593 | r4594 | |
| 1308 | 1308 | { |
| 1309 | 1309 | /* undocumented => emulate TO7 QDD controller ? */ |
| 1310 | 1310 | UINT8 data = thmfc1->ipl << 7; |
| 1311 | | VLOG(( "%f $%04x thmfc_floppy_r: STAT8=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data )); |
| 1311 | VLOG(( "%f $%04x thmfc_floppy_r: STAT8=$%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), data )); |
| 1312 | 1312 | return data; |
| 1313 | 1313 | } |
| 1314 | 1314 | |
| 1315 | 1315 | default: |
| 1316 | | logerror ( "%f $%04x thmfc_floppy_r: invalid read offset %i\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), offset ); |
| 1316 | logerror ( "%f $%04x thmfc_floppy_r: invalid read offset %i\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset ); |
| 1317 | 1317 | return 0; |
| 1318 | 1318 | } |
| 1319 | 1319 | } |
| r4593 | r4594 | |
| 1333 | 1333 | thom_floppy_set_density( dens ); |
| 1334 | 1334 | thmfc1->formatting = (data >> 2) & 1; |
| 1335 | 1335 | LOG (( "%f $%04x thmfc_floppy_w: CMD0=$%02X dens=%s wsync=%i dsync=%i fmt=%i op=%i\n", |
| 1336 | | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data, |
| 1336 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), data, |
| 1337 | 1337 | (dens == DEN_FM_LO) ? "MF" : "MFM", |
| 1338 | 1338 | wsync, (data >> 3) & 1, |
| 1339 | 1339 | thmfc1->formatting, data & 3 )); |
| r4593 | r4594 | |
| 1418 | 1418 | if ( thmfc1->sector_size > 256 ) |
| 1419 | 1419 | { |
| 1420 | 1420 | logerror( "$%04x thmfc_floppy_w: sector size %i > 256 not handled\n", |
| 1421 | | cpu_get_previouspc( space->machine->cpu[0] ), thmfc1->sector_size ); |
| 1421 | cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), thmfc1->sector_size ); |
| 1422 | 1422 | thmfc1->sector_size = 256; |
| 1423 | 1423 | } |
| 1424 | 1424 | |
| 1425 | 1425 | LOG (( "%f $%04x thmfc_floppy_w: CMD1=$%02X sect-size=%i comp=%i head=%i\n", |
| 1426 | | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data, |
| 1426 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), data, |
| 1427 | 1427 | thmfc1->sector_size, (data >> 1) & 7, thmfc1->side )); |
| 1428 | 1428 | break; |
| 1429 | 1429 | |
| r4593 | r4594 | |
| 1451 | 1451 | thom_floppy_active( space->machine, 0 ); |
| 1452 | 1452 | |
| 1453 | 1453 | LOG (( "%f $%04x thmfc_floppy_w: CMD2=$%02X drv=%i step=%i motor=%i\n", |
| 1454 | | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data, |
| 1454 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), data, |
| 1455 | 1455 | thmfc1->drive, seek, motor )); |
| 1456 | 1456 | |
| 1457 | 1457 | if ( seek ) |
| r4593 | r4594 | |
| 1481 | 1481 | { |
| 1482 | 1482 | /* TODO: implement other forms of raw track writing */ |
| 1483 | 1483 | LOG (( "%f $%04x thmfc_floppy_w: ignored raw WDATA $%02X\n", |
| 1484 | | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data )); |
| 1484 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), data )); |
| 1485 | 1485 | } |
| 1486 | 1486 | break; |
| 1487 | 1487 | |
| r4593 | r4594 | |
| 1489 | 1489 | case 4: /* WCLK (unemulated) */ |
| 1490 | 1490 | /* clock configuration: FF for data, 0A for synchro */ |
| 1491 | 1491 | LOG (( "%f $%04x thmfc_floppy_w: WCLK=$%02X (%s)\n", |
| 1492 | | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data, |
| 1492 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), data, |
| 1493 | 1493 | (data == 0xff) ? "data" : (data == 0x0A) ? "synchro" : "?" )); |
| 1494 | 1494 | break; |
| 1495 | 1495 | |
| 1496 | 1496 | case 5: /* WSECT */ |
| 1497 | 1497 | thmfc1->sector = data; |
| 1498 | 1498 | LOG (( "%f $%04x thmfc_floppy_w: WSECT=%i\n", |
| 1499 | | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data )); |
| 1499 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), data )); |
| 1500 | 1500 | break; |
| 1501 | 1501 | |
| 1502 | 1502 | case 6: /* WTRCK */ |
| 1503 | 1503 | thmfc1->track = data; |
| 1504 | 1504 | LOG (( "%f $%04x thmfc_floppy_w: WTRCK=%i (real=%i)\n", |
| 1505 | | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data, |
| 1505 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), data, |
| 1506 | 1506 | floppy_drive_get_current_track( thmfc_floppy_image(space->machine) ) )); |
| 1507 | 1507 | break; |
| 1508 | 1508 | |
| 1509 | 1509 | case 7: /* WCELL */ |
| 1510 | 1510 | /* precompensation (unemulated) */ |
| 1511 | 1511 | LOG (( "%f $%04x thmfc_floppy_w: WCELL=$%02X\n", |
| 1512 | | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), data )); |
| 1512 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), data )); |
| 1513 | 1513 | break; |
| 1514 | 1514 | |
| 1515 | 1515 | default: |
| 1516 | 1516 | logerror ( "%f $%04x thmfc_floppy_w: invalid write offset %i (data=$%02X)\n", |
| 1517 | | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), offset, data ); |
| 1517 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset, data ); |
| 1518 | 1518 | } |
| 1519 | 1519 | } |
| 1520 | 1520 | |
| r4593 | r4594 | |
| 1715 | 1715 | { |
| 1716 | 1716 | /* network ID of the computer */ |
| 1717 | 1717 | UINT8 id = input_port_read(space->machine, "fconfig") >> 3; |
| 1718 | | VLOG(( "%f $%04x to7_network_r: read id $%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), id )); |
| 1718 | VLOG(( "%f $%04x to7_network_r: read id $%02X\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), id )); |
| 1719 | 1719 | return id; |
| 1720 | 1720 | } |
| 1721 | 1721 | |
| 1722 | | logerror( "%f $%04x to7_network_r: invalid read offset %i\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), offset ); |
| 1722 | logerror( "%f $%04x to7_network_r: invalid read offset %i\n", attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset ); |
| 1723 | 1723 | return 0; |
| 1724 | 1724 | } |
| 1725 | 1725 | |
| r4593 | r4594 | |
| 1732 | 1732 | else |
| 1733 | 1733 | { |
| 1734 | 1734 | logerror( "%f $%04x to7_network_w: invalid write offset %i (data=$%02X)\n", |
| 1735 | | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc( space->machine->cpu[0] ), offset, data ); |
| 1735 | attotime_to_double(timer_get_time(space->machine)), cpu_get_previouspc(cputag_get_cpu(space->machine, "maincpu")), offset, data ); |
| 1736 | 1736 | } |
| 1737 | 1737 | } |
| 1738 | 1738 | |
src/mess/drivers/x68k.c
| r4593 | r4594 | |
| 213 | 213 | // if(x68k_sys.mfp.iera & (1 << x)) |
| 214 | 214 | { |
| 215 | 215 | current_vector[6] = (x68k_sys.mfp.vr & 0xf0) | (x+8); |
| 216 | | cpu_set_input_line_and_vector(machine->cpu[0],x68k_sys.mfp.irqline,ASSERT_LINE,(x68k_sys.mfp.vr & 0xf0) | (x + 8)); |
| 216 | cputag_set_input_line_and_vector(machine, "maincpu",x68k_sys.mfp.irqline,ASSERT_LINE,(x68k_sys.mfp.vr & 0xf0) | (x + 8)); |
| 217 | 217 | // logerror("MFP: Sent IRQ vector 0x%02x (IRQ line %i)\n",(x68k_sys.mfp.vr & 0xf0) | (x+8),x68k_sys.mfp.irqline); |
| 218 | 218 | return; // one at a time only |
| 219 | 219 | } |
| r4593 | r4594 | |
| 232 | 232 | // if(x68k_sys.mfp.ierb & (1 << x)) |
| 233 | 233 | { |
| 234 | 234 | current_vector[6] = (x68k_sys.mfp.vr & 0xf0) | x; |
| 235 | | cpu_set_input_line_and_vector(machine->cpu[0],x68k_sys.mfp.irqline,ASSERT_LINE,(x68k_sys.mfp.vr & 0xf0) | x); |
| 235 | cputag_set_input_line_and_vector(machine, "maincpu",x68k_sys.mfp.irqline,ASSERT_LINE,(x68k_sys.mfp.vr & 0xf0) | x); |
| 236 | 236 | // logerror("MFP: Sent IRQ vector 0x%02x (IRQ line %i)\n",(x68k_sys.mfp.vr & 0xf0) | x,x68k_sys.mfp.irqline); |
| 237 | 237 | return; // one at a time only |
| 238 | 238 | } |
| r4593 | r4594 | |
| 453 | 453 | if(input_port_read(machine,"options") & 0x01) |
| 454 | 454 | { |
| 455 | 455 | current_vector[6] = 0x4c; |
| 456 | | cpu_set_input_line_and_vector(machine->cpu[0],6,ASSERT_LINE,0x4c); |
| 456 | cputag_set_input_line_and_vector(machine, "maincpu",6,ASSERT_LINE,0x4c); |
| 457 | 457 | logerror("MFP: Receive buffer full IRQ sent\n"); |
| 458 | 458 | } |
| 459 | 459 | } |
| r4593 | r4594 | |
| 464 | 464 | x68k_sys.keyboard.headpos = 0; |
| 465 | 465 | // mfp_trigger_irq(MFP_IRQ_RX_ERROR); |
| 466 | 466 | current_vector[6] = 0x4b; |
| 467 | | // cpu_set_input_line_and_vector(machine->cpu[0],6,ASSERT_LINE,0x4b); |
| 467 | // cputag_set_input_line_and_vector(machine, "maincpu",6,ASSERT_LINE,0x4b); |
| 468 | 468 | } |
| 469 | 469 | } |
| 470 | 470 | |
| r4593 | r4594 | |
| 648 | 648 | x68k_sys.mouse.irqactive = 1; |
| 649 | 649 | current_vector[5] = 0x54; |
| 650 | 650 | current_irq_line = 5; |
| 651 | | cpu_set_input_line_and_vector(machine->cpu[0],5,ASSERT_LINE,0x54); |
| 651 | cputag_set_input_line_and_vector(machine, "maincpu",5,ASSERT_LINE,0x54); |
| 652 | 652 | } |
| 653 | 653 | } |
| 654 | 654 | } |
| r4593 | r4594 | |
| 884 | 884 | if((prev1 & 0x10) == 0x00 && (data & 0x10) == 0x10) |
| 885 | 885 | { |
| 886 | 886 | x68k_sys.mdctrl.seq1++; |
| 887 | | timer_adjust_oneshot(x68k_sys.mdctrl.io_timeout1,cpu_clocks_to_attotime(device->machine->cpu[0],8192),0); |
| 887 | timer_adjust_oneshot(x68k_sys.mdctrl.io_timeout1,cputag_clocks_to_attotime(device->machine, "maincpu", 8192),0); |
| 888 | 888 | } |
| 889 | 889 | prev1 = data; |
| 890 | 890 | |
| r4593 | r4594 | |
| 893 | 893 | if((prev2 & 0x20) == 0x00 && (data & 0x20) == 0x20) |
| 894 | 894 | { |
| 895 | 895 | x68k_sys.mdctrl.seq2++; |
| 896 | | timer_adjust_oneshot(x68k_sys.mdctrl.io_timeout2,cpu_clocks_to_attotime(device->machine->cpu[0],8192),0); |
| 896 | timer_adjust_oneshot(x68k_sys.mdctrl.io_timeout2,cputag_clocks_to_attotime(device->machine, "maincpu", 8192),0); |
| 897 | 897 | } |
| 898 | 898 | prev2 = data; |
| 899 | 899 | |
| r4593 | r4594 | |
| 1026 | 1026 | x68k_sys.ioc.irqstatus |= 0x80; |
| 1027 | 1027 | current_irq_line = 1; |
| 1028 | 1028 | logerror("FDC: IRQ triggered\n"); |
| 1029 | | cpu_set_input_line_and_vector(device->machine->cpu[0],1,ASSERT_LINE,current_vector[1]); |
| 1029 | cputag_set_input_line_and_vector(device->machine, "maincpu", 1, ASSERT_LINE, current_vector[1]); |
| 1030 | 1030 | } |
| 1031 | 1031 | } |
| 1032 | 1032 | |
| r4593 | r4594 | |
| 1571 | 1571 | if(mess_ram[0x09] != 0x02) // normal vector for bus errors points to 02FF0540 |
| 1572 | 1572 | { |
| 1573 | 1573 | int addr = (mess_ram[0x09] << 24) | (mess_ram[0x08] << 16) |(mess_ram[0x0b] << 8) | mess_ram[0x0a]; |
| 1574 | | int sp = cpu_get_reg(machine->cpu[0],REG_GENSP); |
| 1575 | | int pc = cpu_get_reg(machine->cpu[0],REG_GENPC); |
| 1576 | | int sr = cpu_get_reg(machine->cpu[0],M68K_SR); |
| 1577 | | //int pda = cpu_get_reg(machine->cpu[0],M68K_PREF_DATA); |
| 1578 | | cpu_set_reg(machine->cpu[0],REG_GENSP,sp-14); |
| 1574 | int sp = cpu_get_reg(cputag_get_cpu(machine, "maincpu"), REG_GENSP); |
| 1575 | int pc = cpu_get_reg(cputag_get_cpu(machine, "maincpu"), REG_GENPC); |
| 1576 | int sr = cpu_get_reg(cputag_get_cpu(machine, "maincpu"), M68K_SR); |
| 1577 | //int pda = cpu_get_reg(cputag_get_cpu(machine, "maincpu"), M68K_PREF_DATA); |
| 1578 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), REG_GENSP, sp - 14); |
| 1579 | 1579 | mess_ram[sp-11] = (val & 0xff000000) >> 24; |
| 1580 | 1580 | mess_ram[sp-12] = (val & 0x00ff0000) >> 16; |
| 1581 | 1581 | mess_ram[sp-9] = (val & 0x0000ff00) >> 8; |
| r4593 | r4594 | |
| 1586 | 1586 | mess_ram[sp-2] = (pc & 0x000000ff); // place PC onto the stack |
| 1587 | 1587 | mess_ram[sp-5] = (sr & 0xff00) >> 8; |
| 1588 | 1588 | mess_ram[sp-6] = (sr & 0x00ff); // place SR onto the stack |
| 1589 | | cpu_set_reg(machine->cpu[0],REG_GENPC,addr); // real exceptions seem to take too long to be acknowledged |
| 1590 | | popmessage("Expansion access [%08x]: PC jump to %08x",val,addr); |
| 1589 | cpu_set_reg(cputag_get_cpu(machine, "maincpu"), REG_GENPC, addr); // real exceptions seem to take too long to be acknowledged |
| 1590 | popmessage("Expansion access [%08x]: PC jump to %08x", val, addr); |
| 1591 | 1591 | } |
| 1592 | 1592 | } |
| 1593 | 1593 | |
| r4593 | r4594 | |
| 1597 | 1597 | then access causes a bus error */ |
| 1598 | 1598 | current_vector[2] = 0x02; // bus error |
| 1599 | 1599 | current_irq_line = 2; |
| 1600 | | // cpu_set_input_line_and_vector(space->machine->cpu[0],2,ASSERT_LINE,current_vector[2]); |
| 1600 | // cputag_set_input_line_and_vector(space->machine, "maincpu",2,ASSERT_LINE,current_vector[2]); |
| 1601 | 1601 | if(input_port_read(space->machine, "options") & 0x02) |
| 1602 | 1602 | { |
| 1603 | 1603 | offset *= 2; |
| 1604 | 1604 | if(ACCESSING_BITS_0_7) |
| 1605 | 1605 | offset++; |
| 1606 | | timer_set(space->machine, cpu_clocks_to_attotime(space->machine->cpu[0], 4), NULL, 0xbffffc+offset,x68k_fake_bus_error); |
| 1606 | timer_set(space->machine, cputag_clocks_to_attotime(space->machine, "maincpu", 4), NULL, 0xbffffc+offset,x68k_fake_bus_error); |
| 1607 | 1607 | } |
| 1608 | 1608 | return 0xff; |
| 1609 | 1609 | } |
| r4593 | r4594 | |
| 1614 | 1614 | then access causes a bus error */ |
| 1615 | 1615 | current_vector[2] = 0x02; // bus error |
| 1616 | 1616 | current_irq_line = 2; |
| 1617 | | // cpu_set_input_line_and_vector(space->machine->cpu[0],2,ASSERT_LINE,current_vector[2]); |
| 1617 | // cputag_set_input_line_and_vector(space->machine, "maincpu",2,ASSERT_LINE,current_vector[2]); |
| 1618 | 1618 | if(input_port_read(space->machine, "options") & 0x02) |
| 1619 | 1619 | { |
| 1620 | 1620 | offset *= 2; |
| 1621 | 1621 | if(ACCESSING_BITS_0_7) |
| 1622 | 1622 | offset++; |
| 1623 | | timer_set(space->machine, cpu_clocks_to_attotime(space->machine->cpu[0], 4), NULL, 0xbffffc+offset,x68k_fake_bus_error); |
| 1623 | timer_set(space->machine, cputag_clocks_to_attotime(space->machine, "maincpu", 4), NULL, 0xbffffc+offset,x68k_fake_bus_error); |
| 1624 | 1624 | } |
| 1625 | 1625 | } |
| 1626 | 1626 | |
| r4593 | r4594 | |
| 1634 | 1634 | offset *= 2; |
| 1635 | 1635 | if(ACCESSING_BITS_0_7) |
| 1636 | 1636 | offset++; |
| 1637 | | timer_set(space->machine, cpu_clocks_to_attotime(space->machine->cpu[0], 16), NULL, 0xeafa00+offset,x68k_fake_bus_error); |
| 1638 | | // cpu_set_input_line_and_vector(machine->cpu[0],2,ASSERT_LINE,current_vector[2]); |
| 1637 | timer_set(space->machine, cputag_clocks_to_attotime(space->machine, "maincpu", 16), NULL, 0xeafa00+offset,x68k_fake_bus_error); |
| 1638 | // cputag_set_input_line_and_vector(machine, "maincpu",2,ASSERT_LINE,current_vector[2]); |
| 1639 | 1639 | } |
| 1640 | 1640 | return 0xffff; |
| 1641 | 1641 | } |
| r4593 | r4594 | |
| 1650 | 1650 | offset *= 2; |
| 1651 | 1651 | if(ACCESSING_BITS_0_7) |
| 1652 | 1652 | offset++; |
| 1653 | | timer_set(space->machine, cpu_clocks_to_attotime(space->machine->cpu[0], 16), NULL, 0xeafa00+offset,x68k_fake_bus_error); |
| 1654 | | // cpu_set_input_line_and_vector(machine->cpu[0],2,ASSERT_LINE,current_vector[2]); |
| 1653 | timer_set(space->machine, cputag_clocks_to_attotime(space->machine, "maincpu", 16), NULL, 0xeafa00+offset,x68k_fake_bus_error); |
| 1654 | // cputag_set_input_line_and_vector(machine, "maincpu",2,ASSERT_LINE,current_vector[2]); |
| 1655 | 1655 | } |
| 1656 | 1656 | } |
| 1657 | 1657 | |
| r4593 | r4594 | |
| 1661 | 1661 | current_vector[3] = hd63450_get_vector(device, channel); |
| 1662 | 1662 | current_irq_line = 3; |
| 1663 | 1663 | logerror("DMA#%i: DMA End (vector 0x%02x)\n",channel,current_vector[3]); |
| 1664 | | cpu_set_input_line_and_vector(machine->cpu[0],3,ASSERT_LINE,current_vector[3]); |
| 1664 | cputag_set_input_line_and_vector(machine, "maincpu",3,ASSERT_LINE,current_vector[3]); |
| 1665 | 1665 | } |
| 1666 | 1666 | |
| 1667 | 1667 | static void x68k_dma_end(running_machine *machine, int channel,int irq) |
| r4593 | r4594 | |
| 1679 | 1679 | { |
| 1680 | 1680 | current_vector[3] = hd63450_get_error_vector(device,channel); |
| 1681 | 1681 | current_irq_line = 3; |
| 1682 | | cpu_set_input_line_and_vector(machine->cpu[0],3,ASSERT_LINE,current_vector[3]); |
| 1682 | cputag_set_input_line_and_vector(machine, "maincpu",3,ASSERT_LINE,current_vector[3]); |
| 1683 | 1683 | } |
| 1684 | 1684 | } |
| 1685 | 1685 | |
| r4593 | r4594 | |
| 1715 | 1715 | return; |
| 1716 | 1716 | // if((x68k_sys.ioc.irqstatus & 0xc0) != 0) // if the FDC is busy, then we don't want to miss that IRQ |
| 1717 | 1717 | // return; |
| 1718 | | cpu_set_input_line(device->machine->cpu[0], 6, state); |
| 1718 | cputag_set_input_line(device->machine, "maincpu", 6, state); |
| 1719 | 1719 | current_vector[6] = 0; |
| 1720 | 1720 | prev = state; |
| 1721 | 1721 | } |
| r4593 | r4594 | |
| 1746 | 1746 | if(current_vector[6] != 0x4b && current_vector[6] != 0x4c) |
| 1747 | 1747 | current_vector[6] = mc68901_get_vector(x68k_mfp); |
| 1748 | 1748 | else |
| 1749 | | cpu_set_input_line_and_vector(device->machine->cpu[0],irqline,CLEAR_LINE,current_vector[irqline]); |
| 1749 | cputag_set_input_line_and_vector(device->machine, "maincpu",irqline,CLEAR_LINE,current_vector[irqline]); |
| 1750 | 1750 | logerror("SYS: IRQ acknowledged (vector=0x%02x, line = %i)\n",current_vector[6],irqline); |
| 1751 | 1751 | return current_vector[6]; |
| 1752 | 1752 | } |
| 1753 | 1753 | |
| 1754 | | cpu_set_input_line_and_vector(device->machine->cpu[0],irqline,CLEAR_LINE,current_vector[irqline]); |
| 1754 | cputag_set_input_line_and_vector(device->machine, "maincpu",irqline,CLEAR_LINE,current_vector[irqline]); |
| 1755 | 1755 | if(irqline == 1) // IOSC |
| 1756 | 1756 | { |
| 1757 | 1757 | x68k_sys.ioc.irqstatus &= ~0xf0; |
| r4593 | r4594 | |
| 2217 | 2217 | current_vector[1] = 0x61; |
| 2218 | 2218 | x68k_sys.ioc.irqstatus |= 0x40; |
| 2219 | 2219 | current_irq_line = 1; |
| 2220 | | cpu_set_input_line_and_vector(image->machine->cpu[0],1,ASSERT_LINE,current_vector[1]); // Disk insert/eject interrupt |
| 2220 | cputag_set_input_line_and_vector(image->machine, "maincpu",1,ASSERT_LINE,current_vector[1]); // Disk insert/eject interrupt |
| 2221 | 2221 | logerror("IOC: Disk image inserted\n"); |
| 2222 | 2222 | } |
| 2223 | 2223 | x68k_sys.fdc.disk_inserted[image_index_in_device(image)] = 1; |
| r4593 | r4594 | |
| 2234 | 2234 | current_vector[1] = 0x61; |
| 2235 | 2235 | x68k_sys.ioc.irqstatus |= 0x40; |
| 2236 | 2236 | current_irq_line = 1; |
| 2237 | | cpu_set_input_line_and_vector(image->machine->cpu[0],1,ASSERT_LINE,current_vector[1]); // Disk insert/eject interrupt |
| 2237 | cputag_set_input_line_and_vector(image->machine, "maincpu",1,ASSERT_LINE,current_vector[1]); // Disk insert/eject interrupt |
| 2238 | 2238 | } |
| 2239 | 2239 | x68k_sys.fdc.disk_inserted[image_index_in_device(image)] = 0; |
| 2240 | 2240 | } |
| r4593 | r4594 | |
| 2337 | 2337 | } |
| 2338 | 2338 | |
| 2339 | 2339 | // reset CPU |
| 2340 | | device_reset(machine->cpu[0]); |
| 2340 | device_reset(cputag_get_cpu(machine, "maincpu")); |
| 2341 | 2341 | } |
| 2342 | 2342 | |
| 2343 | 2343 | static MACHINE_START( x68000 ) |
| 2344 | 2344 | { |
| 2345 | | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 2345 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 2346 | 2346 | /* Install RAM handlers */ |
| 2347 | 2347 | x68k_spriteram = (UINT16*)memory_region(machine, "user1"); |
| 2348 | 2348 | memory_install_read16_handler(space,0x000000,mess_ram_size-1,mess_ram_size-1,0,(read16_space_func)1); |
| r4593 | r4594 | |
| 2397 | 2397 | |
| 2398 | 2398 | mfp_init(); |
| 2399 | 2399 | |
| 2400 | | cpu_set_irq_callback(machine->cpu[0], x68k_int_ack); |
| 2400 | cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"), x68k_int_ack); |
| 2401 | 2401 | |
| 2402 | 2402 | // init keyboard |
| 2403 | 2403 | x68k_sys.keyboard.delay = 500; // 3*100+200 |