Skip to content

Instantly share code, notes, and snippets.

@AlexArchive
Created July 17, 2013 14:52
Show Gist options
  • Save AlexArchive/6021293 to your computer and use it in GitHub Desktop.
Save AlexArchive/6021293 to your computer and use it in GitHub Desktop.
Demo: Basic Branching in MSIL
.assembly extern mscorlib {}
.assembly Test
{
.ver 1:0:1:0
}
.module test.exe
.method static void main() cil managed
{
.maxstack 2
.entrypoint
ldstr "Enter First Number"
call void [mscorlib]System.Console::WriteLine (string)
call string [mscorlib]System.Console::ReadLine()
call int32 [mscorlib]System.Int32::Parse(string)
ldstr "Enter Second Number"
call void [mscorlib]System.Console::WriteLine(string)
call string [mscorlib]System.Console::ReadLine()
call int32 [mscorlib]System.Int32::Parse(string)
ble Smaller
ldstr "Second Number is smaller than first."
call void [mscorlib]System.Console::WriteLine (string)
br Exit
Smaller:
ldstr "First number is smaller than second"
call void [mscorlib]System.Console::WriteLine (string)
Exit:
ret
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment