I'm attempting to load the first letter of a string into the register W2, then compare the value inside that register to the value inside of another register (W5). In the program below, the code refuses to branch even though both characters in each registers are equal. How can I get the code to branch.
.data
string: .asciz "Hello" // Loads string the ascii character "Hello"
charH: .asciz "H" // Initializes charH with 'H'
.global _start // Provide program with starting address to linker
.text
_start:
LDR X0,=string // Loads the string "Hello" into X0
LDR W5,=charH // Loads the character "H" into W5
// Should Load the first letter of string into the W2 register and then post-increments the pointer to the next byte of the string
LDRB W2, [X0], #1
CMP W2, W5 // Compares W2 with W5
B.EQ equalsH // Branches if both equal
end:
MOV X0, #0 // Use 0 return code
MOV X8, #93 // Service command code 93 to terminate the program
SVC 0 // Call linux to terminate
.end
// The Goal is to get the condition to branch here! "equalsH"
equalsH:
// ...