Skip to content
Snippets Groups Projects
Commit 5cafeb61 authored by Geo Ster's avatar Geo Ster
Browse files

Remove dependency on int128

* This is only supported on GCC/Clang making compilation fail on
MSVC. In addition we don't really need this since accessing the
entire 128bit register is very rare and can be emulated by setting
each of 64bit parts seperately.
parent 2daed618
No related branches found
No related tags found
No related merge requests found
build/
.vscode/
*.iso
\ No newline at end of file
*.iso
out/
.vs
\ No newline at end of file
......@@ -30,7 +30,7 @@ struct Range {
return (addr >= start && addr < start + length);
}
inline uint offset(uint32_t addr) const
inline uint32_t offset(uint32_t addr) const
{
return addr - start;
}
......
......@@ -35,9 +35,7 @@ union Instruction {
}
};
using uint128_t = unsigned __int128;
union Register {
uint128_t quadword;
uint64_t doubleword[2];
uint32_t word[4];
};
......
......@@ -25,7 +25,7 @@ void ComponentManager::read_bios()
{
/* Yes it's hardcoded for now, don't bite me, I'll change it eventually */
std::ifstream reader;
reader.open("/home/emufan/Desktop/gcnemu/build/bin/bios30004.bin", std::ios::in | std::ios::binary);
reader.open("SCPH-30003.BIN", std::ios::in | std::ios::binary);
if (!reader.is_open())
exit(1);
......@@ -60,6 +60,6 @@ void ComponentManager::write(uint32_t addr, T data)
/* Template definitions. */
template uint32_t ComponentManager::read<uint32_t>(uint32_t);
template uint128_t ComponentManager::read<uint128_t>(uint32_t);
template uint64_t ComponentManager::read<uint64_t>(uint32_t);
template void ComponentManager::write<uint32_t>(uint32_t, uint32_t);
template void ComponentManager::write<uint64_t>(uint32_t, uint64_t);
\ No newline at end of file
......@@ -27,7 +27,7 @@ void EmotionEngine::reset_state()
next_instr.value = 0;
/* Set this to zero */
gpr[0].quadword = 0;
gpr[0].doubleword[0] = gpr[0].doubleword[1] = 0;
/* Set EE pRId */
cop0.prid = 0x00002E20;
......@@ -123,7 +123,7 @@ void EmotionEngine::op_mfc0()
uint16_t rd = (instr.value >> 11) & 0x1F;
uint16_t rt = (instr.value >> 16) & 0x1F;
gpr[rt].quadword = cop0.regs[rd];
gpr[rt].doubleword[0] = cop0.regs[rd];
std::cout << "MFC0: GPR[" << rt << "] = COP0_REG[" << rd << "] (" << cop0.regs[rd] << ")\n";
}
......@@ -241,7 +241,8 @@ void EmotionEngine::op_lq()
int16_t imm = (int16_t)instr.i_type.immediate;
uint32_t vaddr = (gpr[base].doubleword[0] + imm) | 0b0000;
gpr[rt].quadword = read<uint128_t>(vaddr);
gpr[rt].doubleword[0] = read<uint64_t>(vaddr);
gpr[rt].doubleword[1] = read<uint64_t>(vaddr + 8);
std::cout << "LQ: GPR[" << rt << "] = 0x" << std::hex << gpr[rt].doubleword[0] << " from address 0x" << vaddr << '\n';
}
......@@ -395,6 +396,6 @@ void EmotionEngine::op_addu()
/* Template definitions. */
template uint32_t EmotionEngine::read<uint32_t>(uint32_t);
template uint128_t EmotionEngine::read<uint128_t>(uint32_t);
template uint64_t EmotionEngine::read<uint64_t>(uint32_t);
template void EmotionEngine::write<uint32_t>(uint32_t, uint32_t);
template void EmotionEngine::write<uint64_t>(uint32_t, uint64_t);
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment