fix directive operand parsing
This commit is contained in:
parent
ffa798b266
commit
8bea0d6a6d
11
src/parser.c
11
src/parser.c
@ -212,8 +212,15 @@ void parse_instruction(char asmLine[], a64inst_instruction *instr) {
|
||||
if(strcmp(opcode, ".int") == 0){
|
||||
// Directive
|
||||
instr->type = a64inst_DIRECTIVE;
|
||||
instr->data.DirectiveData.value = getOperandNumber(tokens[1]);
|
||||
|
||||
char *intValue = tokens[1];
|
||||
char *endptr;
|
||||
if(strncmp(intValue, "0x", 2) == 0) {
|
||||
intValue += 2;
|
||||
instr->data.DirectiveData.value = strtol(intValue, &endptr, 16);
|
||||
} else {
|
||||
instr->data.DirectiveData.value = strtol(tokens[1], &endptr, 10);
|
||||
}
|
||||
|
||||
} else if(opcode[strlen(opcode)-1]== ':') {
|
||||
// Label
|
||||
instr->type = a64inst_LABEL;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user