I'm writing a program in assembly that is suppose to take the value of a key press, store it in a register and see what the value is.
I have managed to save 0x00000002 after pressing the key 2, into the register I wanted to save it in which is called "r1".
Now this is where I get lost. I'm now trying to compare this to some hexadecimals, so that I then can get know what the value is and use it in an other function. This is how my code looks like:
cmp r1, #0x30
beq savekey
cmp r1, #0x31
beq savekey
cmp r1, #0x32
beq savekey
cmp r1, #0x33
beq savekey
cmp r1, #0x34
beq savekey
cmp r1, #0x35
beq savekey
cmp r1, #0x36
beq savekey
cmp r1, #0x37
beq savekey
cmp r1, #0x38
beq savekey
cmp r1, #0x39
beq savekey
The expected result of this I thought would be that it would go in to the function "savekey" whenever it recognize that it was a number. However this never happens and it just skips all of them.
How could I do the comparison between the register and the hexadecimal different so it will work correctly? And is there any simpler way I can write this so I don't have to write a case for every single digit?