Click here to Skip to main content
15,939,960 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
my problem is how to convert from mph to kmh on ARM assembly language
by multiply by 1.6 but you cant put a number with decimal point so i figure out with a solution

since you cant multiply by 1.6, for example if you have 30mph you want to convert it to kmh


for example if you have 30 mph

30 * 16 = 480 so by subtracting 10 for 48 times until 480 became 0

so the answer is 48 mkh because you need to subtract 48 times to 480 to be 0

plz help me with my code the program compile but it does not do what suppose to do

.global _start

 LDR R0, = COUNT	    @ Load pointer to COUNT array 
 LDR R1, = SPEEDMPH         @ Load pointer to SPEEDMPH array
 LDR R2, = MULT		    @ Load pointer to MULT
 LDR R3, = SPEEDKMH	    @ Load pointer to SPEEDKMH
MOV R4, #30		    @ Copy 30 to R4
STRB R4,[R1]		    @ Store the value of R4 to R1 
MOV R6,#16                  @ Copy 16 to R6
CONVERT: 	LDR R1, = SPEEDMPH   @ Load pointer to COUNT array
			LDR R4,[R1]  @ load what R1 have to R4
			MUL R5,R4,R6  @ multiply 
			LDR R2, = MULT  @ load pointer for MULT
			STRH R5,[R2]    @ store what R5 to R2 
LOOP:		LDR R2,= MULT				
			LDRH R4,[R2]
			SUBS R4,R4, #10
			LDR R0, = COUNT
			LDR R4,[R2]
			ADD R4,R4, #1
			STRB R3,[R0]
			STRH R4,[R2]


COUNT: 		.byte 0x0
SPEEDMPH:	.byte 0x0
MULT:    	.hword 0x0
SPEEDKMH:	.byte 0x0

Updated 20-Feb-11 21:11pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900