Difference between revisions of "Assembly Language IF"
(→Assembly Version) |
|||
Line 6: | Line 6: | ||
{ | { | ||
x = 9; | x = 9; | ||
− | |||
− | |||
− | |||
− | |||
} | } | ||
Line 19: | Line 15: | ||
LDR R1, #0 | LDR R1, #0 | ||
CMP R0, #10 | CMP R0, #10 | ||
− | BNE . | + | BNE .end |
MOV R1, #9 | MOV R1, #9 | ||
− | + | .end | |
− | |||
− | |||
− | . | ||
Line 31: | Line 24: | ||
Line 2 sets the value of Register 1 to the value 0.<br> | Line 2 sets the value of Register 1 to the value 0.<br> | ||
Line 3 compares the value in Register 0 with the value 10.<br> | Line 3 compares the value in Register 0 with the value 10.<br> | ||
− | Line 4 will branch to the . | + | Line 4 will branch to the .end label if the previous compare was NOT EQUAL.<br> |
Line 5 will move the value 9 into Register 1. <br> | Line 5 will move the value 9 into Register 1. <br> | ||
− | Line 6 | + | Line 6 is the .end label |
− | |||
− |
Revision as of 11:36, 20 December 2018
C# example
int y = 0;
int x = 0;
if (y == 10)
{
x = 9;
}
Assembly Version
LDR R0, #0 LDR R1, #0 CMP R0, #10 BNE .end MOV R1, #9 .end
Line 1 sets the value of Register 0 to the value 0.
Line 2 sets the value of Register 1 to the value 0.
Line 3 compares the value in Register 0 with the value 10.
Line 4 will branch to the .end label if the previous compare was NOT EQUAL.
Line 5 will move the value 9 into Register 1.
Line 6 is the .end label