From 22434d868d259d1c36c15912c21ea213465923cc Mon Sep 17 00:00:00 2001 From: Robert Date: Sat, 28 Jan 2023 02:14:59 +0100 Subject: [PATCH] fix warnings in CPU and Bus modules --- src/Bus.cpp | 6 ++---- src/CPU.cpp | 4 ++-- src/CPU.hpp | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Bus.cpp b/src/Bus.cpp index 0ccd0f0..cc9a5d9 100644 --- a/src/Bus.cpp +++ b/src/Bus.cpp @@ -56,7 +56,7 @@ uint8_t Bus::Tick() else { DMATick(); - result = DMACyclesLeft; + result = (uint8_t)DMACyclesLeft; } @@ -83,7 +83,7 @@ void Bus::DMATick() if (DMALatch != 0) { Byte data = ReadCPU(((Word)DMAPage << 8) | (0x100 - DMACyclesLeft)); - ppu.WriteRegister(0x2004, data); + ppu.WriteRegister(0x04, data); DMACyclesLeft--; } @@ -196,8 +196,6 @@ void Bus::WriteCPU(Word addr, Byte val) { if (0x0000 <= addr && addr < 0x2000) { - if (addr == 0x0348) - volatile int jdfkdf = 3; RAM[addr & 0x7FF] = val; } else if (0x2000 <= addr && addr < 0x4000) diff --git a/src/CPU.cpp b/src/CPU.cpp index 4bd551d..682b4e9 100644 --- a/src/CPU.cpp +++ b/src/CPU.cpp @@ -52,7 +52,7 @@ uint8_t CPU::Tick() currentInstruction = &(InstructionTable[opcode]); // Add this instruction to the past instruction list - pastInstructions.push_back(std::make_pair(pc.Raw - 1, currentInstruction)); + pastInstructions.push_back(std::make_pair((Word)(pc.Raw - 1), currentInstruction)); if (pastInstructions.size() > 50) pastInstructions.pop_front(); @@ -1081,7 +1081,7 @@ void CPU::SBX() CHECK_ZERO(result); status.Flag.Carry = ((acc & idx) >= fetchedVal); - idx = result; + idx = (Byte)(result & 0xFF); } void CPU::SBC() diff --git a/src/CPU.hpp b/src/CPU.hpp index 65c21c4..ad4e7bb 100644 --- a/src/CPU.hpp +++ b/src/CPU.hpp @@ -45,7 +45,7 @@ union StatusFlag Byte Negative : 1; } Flag; - Word Raw; + Byte Raw; }; /**