diff --git a/src/parser.c b/src/parser.c index 037188f..e9e05cf 100644 --- a/src/parser.c +++ b/src/parser.c @@ -16,14 +16,14 @@ //calculate offsets from string void calcluateAddressFormat(a64inst_instruction *instr, char *operandList[]){ - - if(strcmp(operandList[1][strlen(operandList[1])-1], "!")==0){ + + if(strcmp(operandList[2][strlen(operandList[1])-1], "!")==0){ instr->data.processOpData.addressingMode = a64inst_PRE_INDEXED; - } else if(strcmp(operandList[0][strlen(operandList[0])-1], "]") == 0) { + } else if(strcmp(operandList[1][strlen(operandList[0])-1], "]") == 0) { //post-indexed instr->data.processOpData.addressingMode = a64inst_POST_INDEXED; - } else if( (strcmp(operandList[1][strlen(operandList[1])-1], "x") == 0) - || (strcmp(operandList[1][strlen(operandList[1])-1], "w") == 0)){ + } else if( (strcmp(operandList[2][strlen(operandList[1])-1], "x") == 0) + || (strcmp(operandList[2][strlen(operandList[1])-1], "w") == 0)){ //register instr->data.processOpData.addressingMode = a64inst_REGISTER_OFFSET; } else {