0
Expression Evaluation Assembly ( Please help me on this questions) Thank you
L1 : Expression Evaluation Using the Keil tool-set, create a subprogram that implements the evaluation of the following expressions: Expression 1 a - b + c + 32 Expression 2 a + 1 + b * 2 - 10 + c Create a test program that loads the R0, R1, and R2 registers with the values 50, 25, and 12, before executing the code that evaluates each expression. Each chunk of expression evaluation code should leave its result in the R0 register. You don't need to store and load the variables from memory. list or .s file This video shows how to store and load RAM variables. In the assignment described above, you may use MOVS to load the registers with the initial values--you don't need to store and load via RAM.
1 Antwort
0
EXPORT __main
x EQU 0x20000000
y EQU 0x20000004
z EQU 0x20000008
__main
; x = 5
MOVS R0, #5
LDR R7, =x ;first address in SRAM
STR R0, [R7]
;y = 23
MOVS R0, #23
LDR R7, =y
STR R0, [R7]
; z = x + y - 2
LDR R7, =x ; load the value of x
LDR R0, [R7]
LDR R7, =y ; load the value of y
LDR R1, [R7]
ADDS R0, R1 ; x+y
SUBS R0, #2 ; (x+y) - 2
LDR R7, =z ; store result in z
STR R0, [R7]
done
B done
END
This what my professor taught us to follow this template. But I'm not sure where should I change the numbers. What numbers should I plug?