fix halt command encoding

This commit is contained in:
EDiasAlberto 2024-06-12 20:40:38 +01:00
parent c52de918db
commit 6ddf18be96
3 changed files with 5 additions and 3 deletions

View File

@ -19,7 +19,7 @@ int main(int argc, char **argv) {
// Parse the source file
a64inst_instruction *instructions = parse(source, lineCount);
// First Pass: Create the symbol table
st *table = firstPass(instructions, lineCount);

View File

@ -1,6 +1,6 @@
#include "a64instruction/a64instruction.h"
#define OPERAND_DELIMITER ", "
#define HALT_ASM_CMD "and x0, x0, x0"
#define HALT_ASM_CMD "and x0, x0, x0\n"
a64inst_instruction *parse(char **asmLines, int lineCount);

View File

@ -4,6 +4,8 @@
#include <stdlib.h>
#include <limits.h>
#define HALT_BINARY 2315255808
// Generates assembled code based on the two-pass assembly method
word assembleBranch(a64inst_instruction *instr) {
@ -209,7 +211,7 @@ word *secondPass(a64inst_instruction instrs[], int numInstrs, st* table) {
index++;
break;
case a64inst_HALT:
arr[index] = 69U * (1 << 25);
arr[index] = HALT_BINARY;
index++;
break;
case a64inst_LABEL: