diff --git a/src/parser.c b/src/parser.c index 793bb68..74ac067 100644 --- a/src/parser.c +++ b/src/parser.c @@ -21,6 +21,7 @@ static const char *SINGLE_TRANSFER_OPCODES[] = {"ldr", "str"}; static const char *WIDE_MOV_OPCODES[] = {"movn", "movz", "movz", "movk"}; static const char *ARITHMETIC_OPCODES[] = {"add", "adds", "sub", "subs"}; static const char *MULTIPLY_OPCODES[] = {"mul", "madd", "msub", "mneg"}; +static const char *SHIFT_TYPE_OPCODES[] = {"lsl", "lsr", "asr", "ror"}; a64inst_instruction *parse(char **asmLines, int lineCount) { a64inst_instruction *instructions = malloc(sizeof(a64inst_instruction) * lineCount); @@ -165,7 +166,14 @@ int getOperandNumber(char *operand){ char operandCpy[strlen(operand)]; strcpy(operandCpy, operand+1); char **endptr = NULL; - int number = strtol(operandCpy, endptr, 10); + int number; + if(strncmp(operandCpy, "0x", 2)==0){ + //hex value + strcpy(operandCpy, operand+3); + number = strtol(operandCpy, endptr, 16); + } else { + number = strtol(operandCpy, endptr, 10); + } return number; }