fix halt command encoding
This commit is contained in:
parent
c52de918db
commit
6ddf18be96
@ -19,7 +19,7 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
// Parse the source file
|
// Parse the source file
|
||||||
a64inst_instruction *instructions = parse(source, lineCount);
|
a64inst_instruction *instructions = parse(source, lineCount);
|
||||||
|
|
||||||
// First Pass: Create the symbol table
|
// First Pass: Create the symbol table
|
||||||
st *table = firstPass(instructions, lineCount);
|
st *table = firstPass(instructions, lineCount);
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#include "a64instruction/a64instruction.h"
|
#include "a64instruction/a64instruction.h"
|
||||||
|
|
||||||
#define OPERAND_DELIMITER ", "
|
#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);
|
a64inst_instruction *parse(char **asmLines, int lineCount);
|
||||||
|
|||||||
@ -4,6 +4,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
|
#define HALT_BINARY 2315255808
|
||||||
|
|
||||||
// Generates assembled code based on the two-pass assembly method
|
// Generates assembled code based on the two-pass assembly method
|
||||||
|
|
||||||
word assembleBranch(a64inst_instruction *instr) {
|
word assembleBranch(a64inst_instruction *instr) {
|
||||||
@ -209,7 +211,7 @@ word *secondPass(a64inst_instruction instrs[], int numInstrs, st* table) {
|
|||||||
index++;
|
index++;
|
||||||
break;
|
break;
|
||||||
case a64inst_HALT:
|
case a64inst_HALT:
|
||||||
arr[index] = 69U * (1 << 25);
|
arr[index] = HALT_BINARY;
|
||||||
index++;
|
index++;
|
||||||
break;
|
break;
|
||||||
case a64inst_LABEL:
|
case a64inst_LABEL:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user