Question
1. Assume r5 = 100016, r6 = 3, and r2 = 4, what is the effect of LDR r0,[r5,r6, LSL r2]? Assume that r2 contains
1. Assume r5 = 100016, r6 = 3, and r2 = 4, what is the effect of LDR r0,[r5,r6, LSL r2]?
Assume that r2 contains the initial value 0000100016. Explain the effect of each of the following six instructions, and give the value in r2 after each instruction executes
STR r1,[r2]
STR r1,[r2, #8]
STR r1,[r2, #8]!
STR r1,[r2], #8
e. STR r1,[r2, r0, LSL #8]
f. STMFD r2!,{r1,r2}
3. Assume r0 = 0xddddcccc, what is the value in r0 after running the following program.
MOV r1,#0x0000FF00 ;set up mask in r1 in the bbbb position
BIC r0,r0,r1 ;get ddddcccc0000aaaa
MOV r1,0x00FF0000 ;set up mask in r1 in the cccc position
EOR r0,r0,r1 ;toggle cccc bits
Write suitable ARM code to implement if x = y call PQR else call ZXY
What does the following program do? When does it stop? What are the values in memory starting from the location pointed by String2? Use Keil uVision5 to confirm the result, show the simulation screen shots.
AREA scan, CODE, READWRITE
Entry |
|
|
ADR | r0,String1 | ;r0 points to the source string |
ADR | r1,String2 | ;r1 points to the dest string |
Copy LDRB r2,[r0],#1 | ;read a byte and update pointer | |
STRB r2,[r1],#1 | ;copy the byte and update ptr | |
CMP | r2,#0x00 | ;test for terminator |
BNE | Copy | ;repeat until terminator found |
SVC | #0x123456 | ;stop |
String1 DCB "this is a string", 0x00 ;dummy string | ||
String2 SPACE 20 | ;reserve 20 bytes for copy | |
END |
|
|
Consider the following Java constructs. Express each in ARM assembly language. Assume all variables are single-bit Booleans and are in registers r0 = A, r1 = B, r2 = C, r3 = D. Note. The Java operators &, , ! are AND, OR, and NOT, respectively. The operators && and || are AND and OR operators that support short-circuit evaluation; that is, if the expression yields false (AND) or tr ue (OR) further evaluation is halted.
A = (B & C) | (!D);
A = (B && C) || (!D);
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started