I need help with ARM assembly program : Using the following code as basic : 1 )
ID: 3890744 • Letter: I
Question
I need help with ARM assembly program :
Using the following code as basic :
1 ) Write a program code that is able to calculate the following : Result = A + ( B * C ) - D
Place the result as the return value so you can print it afterwards in the command prompt.
2) This time, use MLA instruction to reduce the number of instructions in question 1.
Place the result as the return value so you can print it afterwards in the command prompt.
- I need to save two questions in separate .s file. ( Please use the given source to complete ).
Thank you very much.
@ File: labe.s global start start: MOV R0, #1 MOV R1, #4 ADD Re, Re, R1 @Moves the constant 1 to the Register Re @ Moves the constant 4 to the Register R1 a The lines below exit the code back to the command line prompt @ Register R7 holds the System call number @ Syscal1 #1 indicates exit @Moves the constant 1 to the Register R7 MOV R7, #1 SWI e Executes Software Interrupt determined by R7Explanation / Answer
1.
A : DB 1
B : DB 2
C : DB 3
D : DB 4
Result : DB ?
.global _start:
_start :
mov r0, B
mul r0,r0,C
sub r0,r0,D
add r0,r0,A
mov Result, r0
mov r7,#1
SWI 0
2.
A : DB 1
B : DB 2
C : DB 3
D : DB 4
Result : DB ?
.global _start :
_start :
mov r0, A
mov r1,B
mov r2,C
mla r0, r1, r2, r10
sub r0,D
mov Result, r0
mov r7,#1
swi 0
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.