Fix print format bug, it used to only print lower 32 bits, w/ T

This commit is contained in:
sBubshait 2024-06-03 22:13:46 +01:00
parent 900091f798
commit d9562521ca

View File

@ -17,9 +17,9 @@ void printState(Machine *state, FILE *stream) {
void printRegisters(Machine *state, FILE *stream) { void printRegisters(Machine *state, FILE *stream) {
fprintf(stream, "Registers:\n"); fprintf(stream, "Registers:\n");
for (int i = 0; i < REGISTER_COUNT; i++) { for (int i = 0; i < REGISTER_COUNT; i++) {
fprintf(stream, "X%02d\t= %016x\n", i, (unsigned int)state->registers[i]); fprintf(stream, "X%02d\t= %016llx\n", i, state->registers[i]);
} }
fprintf(stream, "PC\t= %016x\n", (unsigned int)state->pc); fprintf(stream, "PC\t= %016llx\n", state->pc);
fprintf(stream, "PSTATE\t: %c%c%c%c", state->conditionCodes.Negative ? 'N' : UNSET_CONDITION_CODE_CHAR, fprintf(stream, "PSTATE\t: %c%c%c%c", state->conditionCodes.Negative ? 'N' : UNSET_CONDITION_CODE_CHAR,
state->conditionCodes.Zero ? 'Z' : UNSET_CONDITION_CODE_CHAR, state->conditionCodes.Zero ? 'Z' : UNSET_CONDITION_CODE_CHAR,
state->conditionCodes.Carry ? 'C' : UNSET_CONDITION_CODE_CHAR, state->conditionCodes.Carry ? 'C' : UNSET_CONDITION_CODE_CHAR,
@ -52,7 +52,7 @@ void printMemory(Machine *state, FILE *stream) {
for (int addr = 0; addr < MEMORY_SIZE; addr+= 4) { for (int addr = 0; addr < MEMORY_SIZE; addr+= 4) {
word data = readWord(state->memory, addr); word data = readWord(state->memory, addr);
if (data != 0) { if (data != 0) {
fprintf(stream, "0x%08x: 0x%08x\n", addr, data); fprintf(stream, "0x%08x: %08x\n", addr, data);
} }
} }
} }