fix makefile error, fix valgrind error.

This code was developed as per the detailed specifications provided.
It's important to ensure that all work adheres to academic integrity policies.
If there are any concerns about the ethical use of this code, please reach out to dis
cuss at feng-arch@outlook.com or fengqi1004@gmail.com.
This commit is contained in:
feng-arch 2024-11-14 10:39:45 +08:00
parent 0f81528418
commit abd86e3da7

View File

@ -115,19 +115,13 @@ void print_list_f(row_of_memory *head, FILE *output) {
if (head == NULL) { if (head == NULL) {
return; return;
} }
fprintf(output, "%-20s %-20s %-20s %s\n", "<label>", "<address>", "<contents>", "<assembly>");
row_of_memory *current = head; row_of_memory *current = head;
while (current != NULL) { while (current != NULL) {
char address_str[20]; char address_str[20];
char contents_str[20]; char contents_str[20];
sprintf(address_str, "%04X", current->address); sprintf(address_str, "%04X", current->address);
sprintf(contents_str, "%04X", current->contents); sprintf(contents_str, "%04X", current->contents);
fprintf(output, "%-20s %-20s %-20s %s\n", fprintf(output, "%s\n",current->assembly ? current->assembly : "");
current->label ? current->label : "",
address_str,
contents_str,
current->assembly ? current->assembly : "");
current = current->next; current = current->next;
} }