diff --git a/src/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/HW_Registers.cs b/src/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/HW_Registers.cs index 8371173f91..26f57ba2f0 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/HW_Registers.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/HW_Registers.cs @@ -58,7 +58,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex ret = (byte)((portB_ret & 0x7F) | (PB7 ? 0x80 : 0x0)); } - if (!dir_ctrl.Bit(5)) { ret |= (byte)(!compare ? 0x0 : 0x20); } + if (!dir_ctrl.Bit(5)) { ret |= (byte)(compare ? 0x20 : 0x0); } int_fl &= 0xE7; update_int_fl(); @@ -216,26 +216,26 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex { if (sel1) { - if (portA_ret >= joy2_UD) { compare = true; } - else { compare = false; } + if ((byte)(portA_ret ^ 0x80) >= joy2_UD) { compare = false; } + else { compare = true; } } else { - if (portA_ret >= joy1_UD) { compare = true; } - else { compare = false; } + if ((byte)(portA_ret ^ 0x80) >= joy1_UD) { compare = false; } + else { compare = true; } } } else { if (sel1) { - if (portA_ret >= joy2_LR) { compare = true; } - else { compare = false; } + if ((byte)(portA_ret ^ 0x80) >= joy2_LR) { compare = false; } + else { compare = true; } } else { - if (portA_ret >= joy1_LR) { compare = true; } - else { compare = false; } + if ((byte)(portA_ret ^ 0x80) >= joy1_LR) { compare = false; } + else { compare = true; } } } @@ -295,26 +295,26 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex { if (sel1) { - if (portA_ret >= joy2_UD) { compare = true; } - else { compare = false; } + if ((byte)(portA_ret ^ 0x80) >= joy2_UD) { compare = false; } + else { compare = true; } } else - { - if (portA_ret >= joy1_UD) { compare = true; } - else { compare = false; } + { + if ((byte)(portA_ret ^ 0x80) >= joy1_UD) { compare = false; } + else { compare = true; } } } else { if (sel1) { - if (portA_ret >= joy2_LR) { compare = true; } - else { compare = false; } + if ((byte)(portA_ret ^ 0x80) >= joy2_LR) { compare = false; } + else { compare = true; } } else { - if (portA_ret >= joy1_LR) { compare = true; } - else { compare = false; } + if ((byte)(portA_ret ^ 0x80) >= joy1_LR) { compare = false; } + else { compare = true; } } } @@ -459,6 +459,33 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex ppu.new_draw_line(); } + if (sel0) + { + if (sel1) + { + if ((byte)(portA_ret ^ 0x80) >= joy2_UD) { compare = false; } + else { compare = true; } + } + else + { + if ((byte)(portA_ret ^ 0x80) >= joy1_UD) { compare = false; } + else { compare = true; } + } + } + else + { + if (sel1) + { + if ((byte)(portA_ret ^ 0x80) >= joy2_LR) { compare = false; } + else { compare = true; } + } + else + { + if ((byte)(portA_ret ^ 0x80) >= joy1_LR) { compare = false; } + else { compare = true; } + } + } + int_fl &= 0xFC; update_int_fl(); break; diff --git a/src/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/VectrexHawk.IEmulator.cs b/src/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/VectrexHawk.IEmulator.cs index 438b88e167..eb709dd2f2 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/VectrexHawk.IEmulator.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/VectrexHawk.IEmulator.cs @@ -42,10 +42,10 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex if (ControllerDefinition.Name == "Vectrex Analog Controller") { // joystick position is based on pot reading - joy1_LR = (byte)(255 - (controller.AxisValue("P1 Stick X") + 128)); - joy1_UD = (byte)(controller.AxisValue("P1 Stick Y") + 128); - joy2_LR = (byte)(255 - (controller.AxisValue("P2 Stick X") + 128)); - joy2_UD = (byte)(controller.AxisValue("P2 Stick Y") + 128); + joy1_LR = (byte)(controller.AxisValue("P1 Stick X") + 128); + joy1_UD = (byte)(-(controller.AxisValue("P1 Stick Y") + 1) + 128); + joy2_LR = (byte)(controller.AxisValue("P2 Stick X") + 128); + joy2_UD = (byte)(-(controller.AxisValue("P2 Stick Y") + 1) + 128); } else { @@ -54,15 +54,15 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex // so convention will be up and right dominate joy1_UD = joy1_LR = joy2_UD = joy2_LR = 128; - if (controller.IsPressed("P1 Down")) { joy1_UD = 0xFF; } - if (controller.IsPressed("P1 Up")) { joy1_UD = 0; } - if (controller.IsPressed("P1 Left")) { joy1_LR = 0xFF; } - if (controller.IsPressed("P1 Right")) { joy1_LR = 0; } + if (controller.IsPressed("P1 Down")) { joy1_UD = 0; } + if (controller.IsPressed("P1 Up")) { joy1_UD = 0xFF; } + if (controller.IsPressed("P1 Left")) { joy1_LR = 0; } + if (controller.IsPressed("P1 Right")) { joy1_LR = 0xFF; } - if (controller.IsPressed("P2 Down")) { joy2_UD = 0xFF; } - if (controller.IsPressed("P2 Up")) { joy2_UD = 0; } - if (controller.IsPressed("P2 Left")) { joy2_LR = 0xFF; } - if (controller.IsPressed("P2 Right")) { joy2_LR = 0; } + if (controller.IsPressed("P2 Down")) { joy2_UD = 0; } + if (controller.IsPressed("P2 Up")) { joy2_UD = 0xFF; } + if (controller.IsPressed("P2 Left")) { joy2_LR = 0; } + if (controller.IsPressed("P2 Right")) { joy2_LR = 0xFF; } } frame_end = false;