comment getOperandNumber

This commit is contained in:
EDiasAlberto 2024-06-12 16:29:29 +01:00
parent f32304afb7
commit c6ff7e1c4e

View File

@ -18,6 +18,8 @@
// - ASK ABOUT OFFSET CALCULATION
// - CREATE FUNC TO TIDY UP OPERANDS IN DP
//takes inputted char array and returns the integer of the operand, skipping the first character
//e.g. for a passed "R32", it skips the 'R' and returns 32
int getOperandNumber(char *operand){
char *operandCpy = strcpy(operandCpy, operand);
operandCpy++;
@ -159,11 +161,7 @@ void classifyOpcode(char* opcode, a64inst_instruction *instr, char *operandList[
instr->type = a64inst_LOADLITERAL;
if(operandList[0][0] =='#'){
//offset is immediate
char *immOffset = NULL;
immOffset = strcpy(immOffset, operandList[0]);
immOffset++;
char *endptr = NULL;
int offset = strtol(immOffset, &endptr, 10);
int offset = getOperandNumber(operandList[0]);
instr->data.SingleTransferData.processOpData.loadLiteralData.offset = offset;
} else {
//offset is literal, use symbol table and calculate difference