this Keil uVision program should load a positive whole ASCII number (e.g 1234). The Program should convert it into BCD coded number in Register R1 , and the HEX number in Register 2...
can someone explain me what it does below?
especially :
MOV R4,#10
and
AND R1,R3,#0xF
MLA R2,R4,R2,R3
???
here is the program:
LDR R0, =Wert ; Pointer laden
LDR R1,[R0]
BL KONVERT ; Unterprogramm KONVERT aufrufen
endlos B endlos
KONVERT
LDRB R3,[R0],#1 ; Byte laden
AND R1,R3,#0xF ; ASCII-HEX-Wandlung
MOV R2,R1 ; HEX-Zahl
MOV R4,#10
LDRB R3,[R0],#1 ; nächstes laden
AND R3,R3,#0xF ; ASCII-Hex-Wandlung
ORR R1,R3,R1,LSL #4 ; BCD-Wert bilden
MLA R2,R4,R2,R3 ; HEX-Zahl
LDRB R3,[R0],#1 ; nächstes laden
AND R3,R3,#0xF ; ASCII-Hex-Wandlung
ORR R1,R3,R1,LSL #4 ; BCD-Wert bilden
MLA R2,R4,R2,R3 ; HEX-Zahl
LDRB R3,[R0],#1 ; nächstes laden
AND R3,R3,#0xF ; ASCII-Hex-Wandlung
ORR R1,R3,R1,LSL #4 ; BCD-Wert bilden
MLA R2,R4,R2,R3 ; HEX-Zahl
BX LR ; Rücksprung