fix directive operand parsing
This commit is contained in:
parent
ffa798b266
commit
8bea0d6a6d
@ -212,7 +212,14 @@ void parse_instruction(char asmLine[], a64inst_instruction *instr) {
|
|||||||
if(strcmp(opcode, ".int") == 0){
|
if(strcmp(opcode, ".int") == 0){
|
||||||
// Directive
|
// Directive
|
||||||
instr->type = a64inst_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]== ':') {
|
} else if(opcode[strlen(opcode)-1]== ':') {
|
||||||
// Label
|
// Label
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user