I am looking for help in turning a decimal integer into hexadecimal. I received user input in ASCII form and use the code:-
LDR R5, = 10
BL getkey
SUB R0, R0, #0x30
MUL R4, R5, R4
ADD R4, R0, R4
After doing calculations using the inputted data I need to convert it back. One way I was thinking is to divide by the constantly and add the modulus together, however, this would print out the integer the wrong way around e.g 1234 would print out 4321 as the 4 would be taken out first and then multiplied by 10. I was also thinking of a way I could divide by the number of digits present and then divide by 10 each time e.g 1234/1000 = 1 then 234/100 = 2 , however, for this to work I must know the length of the integer which I will not as the user could enter 2x2 as easily as 999x999x999. Any ideas would be greatly appreciated.