fixed up controller
This commit is contained in:
parent
024e439c24
commit
3e6619a730
|
@ -16,7 +16,7 @@ Bus::Bus(Screen* screen) :
|
|||
palettes = std::vector<Byte>(0x20, 0);
|
||||
|
||||
LOG_CORE_INFO("Inserting cartridge");
|
||||
cartridge.Load("roms/donkeykong.nes");
|
||||
cartridge.Load("roms/mario.nes");
|
||||
|
||||
LOG_CORE_INFO("Powering up CPU");
|
||||
cpu.Powerup();
|
||||
|
|
|
@ -27,7 +27,7 @@ Byte ControllerPort::Write(Word addr, Byte val)
|
|||
Byte ControllerPort::Read(Word addr)
|
||||
{
|
||||
if (connectedDevices[addr & 1] == nullptr)
|
||||
return 0xFF;
|
||||
return 0x00;
|
||||
|
||||
return connectedDevices[addr & 1]->CLK();
|
||||
}
|
||||
|
|
|
@ -518,7 +518,7 @@ void PPU::EvaluateSprites()
|
|||
secondaryOAM[freeSecondaryOAMSlot + 2] = ReadOAM(oamaddr + 4 * n + 2);
|
||||
secondaryOAM[freeSecondaryOAMSlot + 3] = ReadOAM(oamaddr + 4 * n + 3);
|
||||
|
||||
sprites[freeSecondaryOAMSlot >> 2].OAMPosition = n >> 4;
|
||||
sprites[freeSecondaryOAMSlot >> 2].OAMPosition = n >> 2;
|
||||
|
||||
freeSecondaryOAMSlot += 4;
|
||||
}
|
||||
|
|
|
@ -25,10 +25,10 @@ public:
|
|||
|
||||
inline Byte CLK()
|
||||
{
|
||||
Byte output = outRegister & 1;
|
||||
outRegister >>= 1;
|
||||
Byte output = (outRegister & 0x80) >> 7;
|
||||
outRegister <<= 1;
|
||||
|
||||
return (output << outPin);
|
||||
return 0x40 | (output << outPin);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
|
|
@ -14,14 +14,14 @@ void StandardController::OUT(PortLatch latch)
|
|||
|
||||
StandardButtons pressed;
|
||||
|
||||
pressed.Buttons.A = Input::IsKeyDown(GLFW_KEY_S);
|
||||
pressed.Buttons.B = Input::IsKeyDown(GLFW_KEY_A);
|
||||
pressed.Buttons.A = Input::IsKeyDown(GLFW_KEY_L);
|
||||
pressed.Buttons.B = Input::IsKeyDown(GLFW_KEY_K);
|
||||
pressed.Buttons.Select = Input::IsKeyDown(GLFW_KEY_RIGHT_SHIFT);
|
||||
pressed.Buttons.Start = Input::IsKeyDown(GLFW_KEY_ENTER);
|
||||
pressed.Buttons.Up = Input::IsKeyDown(GLFW_KEY_UP);
|
||||
pressed.Buttons.Down = Input::IsKeyDown(GLFW_KEY_DOWN);
|
||||
pressed.Buttons.Left = Input::IsKeyDown(GLFW_KEY_LEFT);
|
||||
pressed.Buttons.Right = Input::IsKeyDown(GLFW_KEY_RIGHT);
|
||||
pressed.Buttons.Up = Input::IsKeyDown(GLFW_KEY_W);
|
||||
pressed.Buttons.Down = Input::IsKeyDown(GLFW_KEY_S);
|
||||
pressed.Buttons.Left = Input::IsKeyDown(GLFW_KEY_A);
|
||||
pressed.Buttons.Right = Input::IsKeyDown(GLFW_KEY_D);
|
||||
|
||||
if (pressed.Raw == 0xFF)
|
||||
volatile int dkjf = 3;
|
||||
|
|
|
@ -6,14 +6,14 @@ union StandardButtons
|
|||
{
|
||||
struct
|
||||
{
|
||||
Byte A : 1;
|
||||
Byte B : 1;
|
||||
Byte Select : 1;
|
||||
Byte Start : 1;
|
||||
Byte Up : 1;
|
||||
Byte Down : 1;
|
||||
Byte Left : 1;
|
||||
Byte Right : 1;
|
||||
Byte Left : 1;
|
||||
Byte Down : 1;
|
||||
Byte Up : 1;
|
||||
Byte Start : 1;
|
||||
Byte Select : 1;
|
||||
Byte B : 1;
|
||||
Byte A : 1;
|
||||
} Buttons;
|
||||
|
||||
Byte Raw;
|
||||
|
|
Loading…
Reference in a new issue