Skip to content

Instantly share code, notes, and snippets.

@DavidSouther
Created May 26, 2021 00:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DavidSouther/8f5b287f2cc1b0fb931d8c1de152cf2a to your computer and use it in GitHub Desktop.
Save DavidSouther/8f5b287f2cc1b0fb931d8c1de152cf2a to your computer and use it in GitHub Desktop.
.assembly extern mscorlib {}
.assembly addnums {}
.method static void main()
{
.entrypoint
.maxstack 15
.locals init ( int32 )
// a = 10
ldc.i4.s 10
stloc.0
// while a > 0
w: ldloc.0
brfalse.s x
// push a
ldloc.0
// a = a - 1
ldloc.0
ldc.i4.1
sub
stloc.0
ldloc.0
br w
x: // end while a > 0
// a = 9
ldc.i4.s 9
// while a > 0
y:
stloc.0
ldloc.0
brfalse.s z
// add
add
// a = a - 1
ldloc.0
ldc.i4.1
sub
stloc.0
ldloc.0
br y
z: // end while a > 0
call void [mscorlib]System.Console::WriteLine(int32)
ret
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment