0
0
ARM Architectureknowledge~10 mins

If-else implementation in assembly in ARM Architecture - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to compare two registers and branch if equal.

ARM Architecture
CMP R0, R1
BEQ [1]
Drag options to blanks, or click blank then click option'
AADD
BR2
CMOV
Dlabel_equal
Attempts:
3 left
💡 Hint
Common Mistakes
Using a register instead of a label after BEQ.
Confusing BEQ with MOV or ADD instructions.
2fill in blank
medium

Complete the code to load immediate value 1 into R2 if R0 is greater than R1.

ARM Architecture
CMP R0, R1
BGT [1]
MOV R2, #0
B [2]
[1]:
MOV R2, #1
[2]:
Drag options to blanks, or click blank then click option'
Aset_one
Bend_if
Cstart
Dloop
Attempts:
3 left
💡 Hint
Common Mistakes
Using the same label for both branches.
Forgetting to branch after setting R2 to 0.
3fill in blank
hard

Fix the error in the code to correctly implement if-else logic.

ARM Architecture
CMP R3, R4
BLT [1]
MOV R5, #10
B [2]
[1]:
MOV R5, #20
[2]:
Drag options to blanks, or click blank then click option'
Aless_than
Belse_part
Cstart
Dend_if
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect or missing labels.
Not branching after the first MOV instruction.
4fill in blank
hard

Fill both blanks to complete the if-else structure that sets R7 to 5 if R6 equals R8, else sets R7 to 0.

ARM Architecture
CMP R6, R8
BEQ [1]
MOV R7, #0
B [2]
[1]:
MOV R7, #5
[2]:
Drag options to blanks, or click blank then click option'
Aequal_case
Bend_if
Cstart
Delse_case
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up the labels for if and else blocks.
Forgetting the branch after MOV R7, #0.
5fill in blank
hard

Fill all three blanks to implement if-else that sets R9 to 100 if R10 is not zero, else sets R9 to 50.

ARM Architecture
CMP R10, #0
BNE [1]
MOV R9, #50
B [2]
[1]:
MOV R9, [3]
[2]:
Drag options to blanks, or click blank then click option'
Anot_zero
Bend_if
C#100
D#0
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong labels or missing branches.
Forgetting the # before immediate values.