Difference between revisions of "Assembly Language IF"

From TRCCompSci - AQA Computer Science
Jump to: navigation, search
(Created page with "==C#== <syntaxhighlight lang=csharp> int a = 0; do { a++ } while ( A != 99); </syntaxhighlight>")
 
Line 1: Line 1:
==C#==
+
==C# example==
 
<syntaxhighlight lang=csharp>
 
<syntaxhighlight lang=csharp>
 
int a = 0;
 
int a = 0;
Line 8: Line 8:
 
while ( A != 99);
 
while ( A != 99);
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
==Assembly Version==
 +
 +
    LDR R0, #0
 +
.loop
 +
    ADD R0, R0, #1
 +
    CMP R0, #99
 +
    BNE .loop

Revision as of 10:37, 16 June 2017

C# example

int a = 0;
do
{
    a++
}
while ( A != 99);

Assembly Version

   LDR R0, #0
.loop
   ADD R0, R0, #1
   CMP R0, #99
   BNE .loop