public static void setvector_callback() { switch (setvector_param) { case 0: irqvector = 0xff; break; case 1: irqvector &= 0xef; break; case 2: irqvector |= 0x10; break; case 3: irqvector &= 0xdf; break; case 4: irqvector |= 0x20; break; } Cpuint.interrupt_vector[1, 0] = irqvector; if (irqvector == 0xff) { Cpuint.cpunum_set_input_line(1, 0, LineState.CLEAR_LINE); } else { Cpuint.cpunum_set_input_line(1, 0, LineState.ASSERT_LINE); } }
public static void machine_reset_namcos1() { cus117_offset[0, 0] = 0x0180 * 0x2000; cus117_offset[0, 1] = 0x0180 * 0x2000; cus117_offset[0, 7] = 0x03ff * 0x2000; cus117_offset[1, 0] = 0x0180 * 0x2000; cus117_offset[1, 7] = 0x03ff * 0x2000; user1rom_offset[0, 7] = cus117_offset[0, 7] - 0x400000; user1rom_offset[1, 7] = cus117_offset[1, 7] - 0x400000; Cpuint.cpunum_set_input_line(1, (int)LineState.INPUT_LINE_RESET, LineState.ASSERT_LINE); Cpuint.cpunum_set_input_line(2, (int)LineState.INPUT_LINE_RESET, LineState.ASSERT_LINE); Cpuint.cpunum_set_input_line(3, (int)LineState.INPUT_LINE_RESET, LineState.ASSERT_LINE); mcu_patch_data = 0; namcos1_reset = 0; namcos1_init_DACs(); int i, j; for (i = 0; i < 8; i++) { key[i] = 0; } for (i = 0; i < 2; i++) { for (j = 0; j < 8; j++) { cus117_offset[i, j] = 0; } } wdog = 0; }
private static void update_interrupts() { int level = 0; if (vblank_interrupt_pending != 0) { level = 1; } if (display_position_interrupt_pending != 0) { level = 2; } if (irq3_pending != 0) { level = 3; } if (level == 1) { Cpuint.cpunum_set_input_line(0, 1, LineState.ASSERT_LINE); } else if (level == 2) { Cpuint.cpunum_set_input_line(0, 2, LineState.ASSERT_LINE); } else if (level == 3) { Cpuint.cpunum_set_input_line(0, 3, LineState.ASSERT_LINE); } else { Cpuint.cpunum_set_input_line(0, 7, LineState.CLEAR_LINE); } }
public static void cps2_eeprom_port_bl(int data) { Cpuint.cpunum_set_input_line(1, (int)LineState.INPUT_LINE_RESET, ((data & 0x0008) != 0) ? LineState.CLEAR_LINE : LineState.ASSERT_LINE); Generic.coin_counter_w(0, data & 0x0001); Generic.coin_counter_w(1, data & 0x0002); Generic.coin_lockout_w(0, ~data & 0x0010); Generic.coin_lockout_w(1, ~data & 0x0020); Generic.coin_lockout_w(2, ~data & 0x0040); Generic.coin_lockout_w(3, ~data & 0x0080); }
public static void lhb2_interrupt() { if (Cpuexec.iloops == 0) { Cpuint.cpunum_set_input_line(0, 6, LineState.HOLD_LINE); } else { Cpuint.cpunum_set_input_line(0, 5, LineState.HOLD_LINE); } }
public static void namcos1_cpu_control_w(byte data) { if (((data & 1) ^ namcos1_reset) != 0) { mcu_patch_data = 0; namcos1_reset = data & 1; } Cpuint.cpunum_set_input_line(1, (int)LineState.INPUT_LINE_RESET, ((data & 1) != 0) ? LineState.CLEAR_LINE : LineState.ASSERT_LINE); Cpuint.cpunum_set_input_line(2, (int)LineState.INPUT_LINE_RESET, ((data & 1) != 0) ? LineState.CLEAR_LINE : LineState.ASSERT_LINE); Cpuint.cpunum_set_input_line(3, (int)LineState.INPUT_LINE_RESET, ((data & 1) != 0) ? LineState.CLEAR_LINE : LineState.ASSERT_LINE); }
public static void z80_reset_w(ushort data) { if (data == 0x5050) { ICS2115.ics2115_reset(); Cpuint.cpunum_set_input_line(1, (int)LineState.INPUT_LINE_HALT, LineState.CLEAR_LINE); Cpuint.cpunum_set_input_line(1, (int)LineState.INPUT_LINE_RESET, LineState.PULSE_LINE); } else { Cpuint.cpunum_set_input_line(1, (int)LineState.INPUT_LINE_HALT, LineState.ASSERT_LINE); } }
public static void lhb_interrupt() { if (lhb_irq_enable == 0) { return; } if (Cpuexec.iloops == 0) { Cpuint.cpunum_set_input_line(0, 6, LineState.HOLD_LINE); } else { Cpuint.cpunum_set_input_line(0, 5, LineState.HOLD_LINE); } }
public static void cps2_interrupt() { /* 2 is vblank, 4 is some sort of scanline interrupt, 6 is both at the same time. */ if (scancount >= 261) { scancount = -1; cps1_scancalls = 0; } scancount++; if ((cps_b_regs[0x10 / 2] & 0x8000) != 0) { cps_b_regs[0x10 / 2] = (ushort)(cps_b_regs[0x10 / 2] & 0x1ff); } if ((cps_b_regs[0x12 / 2] & 0x8000) != 0) { cps_b_regs[0x12 / 2] = (ushort)(cps_b_regs[0x12 / 2] & 0x1ff); } /*if(cps1_scanline1 == scancount || (cps1_scanline1 < scancount && (cps1_scancalls!=0))) * { * CPS1.cps1_cps_b_regs[0x10 / 2] = 0; * * cpunum_set_input_line(machine, 0, 4, HOLD_LINE); * cps2_set_sprite_priorities(); * video_screen_update_partial(machine->primary_screen, 16 - 10 + scancount); * cps1_scancalls++; * } * if(cps1_scanline2 == scancount || (cps1_scanline2 < scancount && !cps1_scancalls)) * { * cps1_cps_b_regs[0x12/2] = 0; * cpunum_set_input_line(machine, 0, 4, HOLD_LINE); * cps2_set_sprite_priorities(); * video_screen_update_partial(machine->primary_screen, 16 - 10 + scancount); * cps1_scancalls++; * }*/ if (scancount == 256) /* VBlank */ { cps_b_regs[0x10 / 2] = (ushort)cps1_scanline1; cps_b_regs[0x12 / 2] = (ushort)cps1_scanline2; Cpuint.cpunum_set_input_line(0, 2, LineState.HOLD_LINE); if (cps1_scancalls != 0) { cps2_set_sprite_priorities(); //video_screen_update_partial(machine->primary_screen, 256); } cps2_objram_latch(); } }
public static void cps2_eeprom_port_w(int data) { //high 8 bits { /* bit 0 - Unused */ /* bit 1 - Unused */ /* bit 2 - Unused */ /* bit 3 - Unused? */ /* bit 4 - Eeprom data */ /* bit 5 - Eeprom clock */ /* bit 6 - */ /* bit 7 - */ /* EEPROM */ Eeprom.eeprom_write_bit(data & 0x1000); Eeprom.eeprom_set_clock_line(((data & 0x2000) != 0) ? LineState.ASSERT_LINE : LineState.CLEAR_LINE); Eeprom.eeprom_set_cs_line(((data & 0x4000) != 0) ? LineState.CLEAR_LINE : LineState.ASSERT_LINE); } //low 8 bits { /* bit 0 - coin counter 1 */ /* bit 0 - coin counter 2 */ /* bit 2 - Unused */ /* bit 3 - Allows access to Z80 address space (Z80 reset) */ /* bit 4 - lock 1 */ /* bit 5 - lock 2 */ /* bit 6 - */ /* bit 7 - */ /* Z80 Reset */ Cpuint.cpunum_set_input_line(1, (int)LineState.INPUT_LINE_RESET, ((data & 0x0008) != 0) ? LineState.CLEAR_LINE : LineState.ASSERT_LINE); Generic.coin_counter_w(0, data & 0x0001); Generic.coin_counter_w(1, data & 0x0002); Generic.coin_lockout_w(0, ~data & 0x0010); Generic.coin_lockout_w(1, ~data & 0x0020); Generic.coin_lockout_w(2, ~data & 0x0040); Generic.coin_lockout_w(3, ~data & 0x0080); /* * set_led_status(0,data & 0x01); * set_led_status(1,data & 0x10); * set_led_status(2,data & 0x20); */ } }
public static void setvector_callback() { /*StreamWriter sw1 = new StreamWriter("1.txt", false); * sw1.WriteLine(Video.screenstate.frame_number.ToString() + "\t" + setvector_param.ToString()); * sw1.Close();*/ switch (setvector_param) { case 0: irqvector = 0; break; case 1: irqvector |= 0x2; break; case 2: irqvector &= 0xfd; break; case 3: irqvector |= 0x1; break; case 4: irqvector &= 0xfe; break; } if ((irqvector & 0x2) != 0) { Cpuint.interrupt_vector[1, 0] = 0x18; } else if ((irqvector & 0x1) != 0) { Cpuint.interrupt_vector[1, 0] = 0x19; } if (irqvector == 0) { Cpuint.cpunum_set_input_line(1, 0, LineState.CLEAR_LINE); } else { Cpuint.cpunum_set_input_line(1, 0, LineState.ASSERT_LINE); } }
public static void m72_port02_w(ushort data) { //if (ACCESSING_BITS_0_7) { //coin_counter_w(0,data & 0x01); //coin_counter_w(1,data & 0x02); //flip_screen_set(((data & 0x04) >> 2) ^ ((~input_port_read(machine, "DSW") >> 8) & 1)); video_off = data & 0x08; if ((data & 0x10) != 0) { Cpuint.cpunum_set_input_line(1, (int)LineState.INPUT_LINE_RESET, LineState.CLEAR_LINE); } else { Cpuint.cpunum_set_input_line(1, (int)LineState.INPUT_LINE_RESET, LineState.ASSERT_LINE); } } }
public static void sound_irq(int level) { Cpuint.cpunum_set_input_line(1, 0, (LineState)level); }
public static void m68k_l1_w(ushort data) { Sound.soundlatch_w(data); Cpuint.cpunum_set_input_line(1, (int)LineState.INPUT_LINE_NMI, LineState.PULSE_LINE); }
public static void m68k_l1_w(byte data) { //if(ACCESSING_BITS_0_7) Sound.soundlatch_w(data); Cpuint.cpunum_set_input_line(1, (int)LineState.INPUT_LINE_NMI, LineState.PULSE_LINE); }
public static void machine_reset_pgm() { Cpuint.cpunum_set_input_line(1, (int)LineState.INPUT_LINE_HALT, LineState.ASSERT_LINE); device_reset(); }
public static void firq_ack_w(int cpunum) { Cpuint.cpunum_set_input_line(cpunum, 1, LineState.CLEAR_LINE); }
public static void namcos1_sub_firq_w() { Cpuint.cpunum_set_input_line(1, 1, LineState.ASSERT_LINE); }
public static void audio_cpu_check_nmi() { Cpuint.cpunum_set_input_line(1, (int)LineState.INPUT_LINE_NMI, (audio_cpu_nmi_enabled && audio_cpu_nmi_pending) ? LineState.ASSERT_LINE : LineState.CLEAR_LINE); }
public static void cps1_interrupt() { Cpuint.cpunum_set_input_line(0, 5, LineState.HOLD_LINE); }
public static void irq_1_0_line_hold() { Cpuint.cpunum_set_input_line(1, 0, LineState.HOLD_LINE); }
public static void nmi_line_pulse() { Cpuint.cpunum_set_input_line(1, (int)LineState.INPUT_LINE_NMI, LineState.PULSE_LINE); }