Skip to content

Commit

Permalink
code cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
v1bh475u committed Aug 31, 2024
1 parent 777fc01 commit f3179a5
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 19 deletions.
9 changes: 2 additions & 7 deletions src/audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ void APU::test()
void APU::initializeWriteHandler()
{
if (mMap)
mMap->setAudioWriteHandler([this](Word address) { this->onMemoryWrite(address); });
mMap->setAudioWriteHandler([this](Word address)
{ this->onMemoryWrite(address); });
}

void APU::writeByte(Word address, Byte value)
Expand Down Expand Up @@ -288,7 +289,6 @@ void PulseChannel::writeByte(Word address, Byte value)
// Sound length/Wave pattern duty
waveDuty = (value & 0xC0) >> 6;
lengthTimer = maxLengthTimer - (value & 0x3F);
printf("PC: lengthTimer\n");
return;
case 0xFF12:
case 0xFF17:
Expand Down Expand Up @@ -319,7 +319,6 @@ void PulseChannel::writeByte(Word address, Byte value)
}
if (value & 0x80)
{
printf("WC triggered\n");
trigger();
}
return;
Expand Down Expand Up @@ -475,7 +474,6 @@ void WaveChannel::writeByte(Word address, Byte value)
// NR31
// Sound length
lengthTimer = maxLengthTimer - value;
printf("WC: lengthTimer\n");
return;
case 0xFF1C:
// NR32
Expand All @@ -498,7 +496,6 @@ void WaveChannel::writeByte(Word address, Byte value)
}
if (value & 0x80)
{
printf("WC triggered\n");
trigger();
}
return;
Expand Down Expand Up @@ -636,7 +633,6 @@ void NoiseChannel::writeByte(Word address, Byte value)
// NR41
// Sound length
lengthTimer = maxLengthTimer - (value & 0x3F);
printf("NC: lengthtimer\n");
return;
case 0xFF21:
// NR42
Expand Down Expand Up @@ -665,7 +661,6 @@ void NoiseChannel::writeByte(Word address, Byte value)
}
if (value & 0x80)
{
printf("NC Triggered...\n");
trigger();
}
return;
Expand Down
3 changes: 3 additions & 0 deletions src/cpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4114,6 +4114,7 @@ int CPU::RLC_HLp()
mMap->writeMemory(reg_HL.dat, ((*mMap)[reg_HL.dat] << 1) | ((*mMap)[reg_HL.dat] >> 7));

(*mMap)[reg_HL.dat] ? UNSET_ZERO_FLAG : SET_ZERO_FLAG;

reg_PC.dat += 1;
debugPrint("RLC (HL)\n");
return 12;
Expand Down Expand Up @@ -4271,7 +4272,9 @@ int CPU::RRC_HLp()

// Rotate the value at memory address pointed to by HL right by 1
mMap->writeMemory(reg_HL.dat, ((*mMap)[reg_HL.dat] >> 1) | ((*mMap)[reg_HL.dat] << 7));

(*mMap)[reg_HL.dat] ? UNSET_ZERO_FLAG : SET_ZERO_FLAG;

reg_PC.dat += 1;
debugPrint("RRC (HL)\n");
return 12;
Expand Down
2 changes: 0 additions & 2 deletions src/gameBoy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,7 @@ GBE::GBE()
gbe_mMap->debugWriteMemory(0x132, 0x33);
gbe_mMap->debugWriteMemory(0x133, 0x3E);

printf("Loading boot\n");
executeBootROM();
printf("Exited boot\n");
update();
}

Expand Down
4 changes: 0 additions & 4 deletions src/mmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,6 @@ class MemoryMap
std::function<void(Word)> audioWriteHandler;

public:
// Audio Unit
// I know this is not the best way to do it
// But I am not sure how to do it better

Byte* joyPadState;
// Constructor
MemoryMap();
Expand Down
6 changes: 0 additions & 6 deletions src/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,3 @@ typedef char SByte;
typedef unsigned short Word;
typedef signed short SWord;
typedef unsigned int color;

typedef struct
{
Word address;
Byte value;
} audioRegs;

0 comments on commit f3179a5

Please sign in to comment.