Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Cherrytree56567 committed Oct 19, 2023
1 parent 933c294 commit 86e674b
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 17 deletions.
30 changes: 16 additions & 14 deletions PSEMU/CPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,31 @@ void CPU::tick() {
fetch();
}

void CPU::fetch() {
void CPU::fetch() {
current_pc = pc;

if (current_pc % 4 != 0) {
// PC is not correctly aligned!
exception(Exception::LoadAddressError);
return;
}

Instruction instr;
instr.instruction = bus->load32(pc);

delay_slot = brancha;
brancha = false;

current_pc = pc;

decode_execute(instr);

// Increment next PC to point to the next instruction.
pc = next_pc;
next_pc += 4;
next_pc = next_pc + 4;

set_reg(std::get<0>(load), std::get<1>(load));

load = std::make_tuple(0, 0);

if (current_pc % 4 != 0) {
// PC is not correctly aligned!
exception(Exception::LoadAddressError);
return;
}

decode_execute(instr);
just_started = false;
for (int i = 0; i < 32; i++) {
regs[i] = out_regs[i];
}
Expand Down Expand Up @@ -181,7 +183,7 @@ void CPU::decode_execute(Instruction instruction) {
break;

default:
std::cout << "[CPU] ERROR: Unhandled Function Instruction \n" << pc;
std::cout << "[CPU] ERROR: Unhandled Function Instruction \n" << instruction.function();
exit(0);
break;
}
Expand Down
Binary file modified PSEMU/x64/Debug/CPU.obj
Binary file not shown.
Binary file modified PSEMU/x64/Debug/PSEMU.ilk
Binary file not shown.
4 changes: 1 addition & 3 deletions PSEMU/x64/Debug/PSEMU.log
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
 CPU.cpp
C:\Users\ronit\Desktop\PSEMU\PSEMU\CPU.cpp(758,55): warning C4554: '&': check operator precedence for possible error; use parentheses to clarify precedence
PSEMU.cpp
Generating Code...
C:\Users\ronit\Desktop\PSEMU\PSEMU\CPU.cpp(757,55): warning C4554: '&': check operator precedence for possible error; use parentheses to clarify precedence
PSEMU.vcxproj -> C:\Users\ronit\Desktop\PSEMU\x64\Debug\PSEMU.exe
Binary file modified PSEMU/x64/Debug/PSEMU.obj
Binary file not shown.
Binary file modified PSEMU/x64/Debug/PSEMU.tlog/CL.command.1.tlog
Binary file not shown.
Binary file modified PSEMU/x64/Debug/PSEMU.tlog/CL.read.1.tlog
Binary file not shown.
Binary file modified PSEMU/x64/Debug/PSEMU.tlog/CL.write.1.tlog
Binary file not shown.
Binary file modified PSEMU/x64/Debug/vc143.idb
Binary file not shown.
Binary file modified PSEMU/x64/Debug/vc143.pdb
Binary file not shown.
Binary file modified x64/Debug/PSEMU.exe
Binary file not shown.
Binary file modified x64/Debug/PSEMU.pdb
Binary file not shown.

0 comments on commit 86e674b

Please sign in to comment.