add halt command handling
This commit is contained in:
parent
13e2cc8c9d
commit
ce0f825e1d
10
src/parser.c
10
src/parser.c
@ -14,7 +14,7 @@
|
||||
// - count operands and match type/values
|
||||
// - generate final a64inst and return
|
||||
|
||||
void classifyOpcode(char* opcode, a64inst_instruction *instr){
|
||||
void classifyOpcode(char* opcode, a64inst_instruction *instr, char *operandList[]){
|
||||
if((int isUnconditional = strcmp(opcode, "b")) == 0 ||
|
||||
(int isRegister = strcmp(opcode, "br")) == 0 ||
|
||||
strncmp(opcode, "b.", 2) == 0){
|
||||
@ -29,7 +29,8 @@ void classifyOpcode(char* opcode, a64inst_instruction *instr){
|
||||
}
|
||||
} else if(strcmp(opcode, "ldr") == 0 || strcmp(opcode, "str") == 0){
|
||||
//loading/storing instruction; classify operands
|
||||
instr->type = a64inst_SINGLETRANSFER;
|
||||
char *address = opcode[1];
|
||||
|
||||
} else {
|
||||
//data processing
|
||||
|
||||
@ -57,6 +58,11 @@ a64inst_instruction *parser(char asmLine[]){
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if(strcmp(asmLine, HALT_ASM_CMD) == 0){
|
||||
instr->type = a64inst_HALT;
|
||||
return(instr);
|
||||
}
|
||||
|
||||
//"opcode operand1, {operand2}, ..."
|
||||
char *stringptr = strdup(asmLine);
|
||||
|
||||
|
||||
@ -1 +1,2 @@
|
||||
#define OPERAND_DELIMITER ", "
|
||||
#define HALT_ASM_CMD "and x0, x0, x0"
|
||||
Loading…
Reference in New Issue
Block a user