Skip to content

Instantly share code, notes, and snippets.

@AlexArchive
Created July 17, 2013 15:03
Show Gist options
  • Save AlexArchive/6021379 to your computer and use it in GitHub Desktop.
Save AlexArchive/6021379 to your computer and use it in GitHub Desktop.
Demo: Basic For Loop in MSIL
.assembly extern mscorlib {}
.assembly Test
{
.ver 1:0:1:0
}
.module test.exe
.method static void main() cil managed
{
.locals init (int32, int32)
.maxstack 2
.entrypoint
ldc.i4 4
stloc.0
ldc.i4 0
stloc.1
Start:
ldloc.1
ldloc.0
bgt Exit
ldloc.1
call void [mscorlib]System.Console::WriteLine(int32)
ldc.i4 1
ldloc.1
add
stloc.1
br Start
Exit:
ret
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment