Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Module Module1
- Sub Main()
- Dim x = 0
- Console.WriteLine(PlusEqual1(x))
- Console.WriteLine(Add1(x))
- Console.WriteLine(PlusEqual2(x))
- Console.WriteLine(Add2(x))
- Console.ReadLine()
- End Sub
- Public Function PlusEqual1(ByVal x As Integer) As Integer
- x += 1
- Return x
- End Function
- Public Function Add1(ByVal x As Integer) As Integer
- x = x + 1
- Return x
- End Function
- Public Function PlusEqual2(ByVal x As Integer) As Integer
- x += 2
- Return x
- End Function
- Public Function Add2(ByVal x As Integer) As Integer
- x = x + 2
- Return x
- End Function
- End Module
- .method public static int32 Add1(int32 x) cil managed
- {
- .maxstack 2
- .locals init (
- [0] int32 Add1)
- L_0000: nop
- L_0001: ldarg.0
- L_0002: ldc.i4.1
- L_0003: add.ovf
- L_0004: starg.s x
- L_0006: ldarg.0
- L_0007: stloc.0
- L_0008: br.s L_000a
- L_000a: ldloc.0
- L_000b: ret
- }
- .method public static int32 Add2(int32 x) cil managed
- {
- .maxstack 2
- .locals init (
- [0] int32 Add2)
- L_0000: nop
- L_0001: ldarg.0
- L_0002: ldc.i4.2
- L_0003: add.ovf
- L_0004: starg.s x
- L_0006: ldarg.0
- L_0007: stloc.0
- L_0008: br.s L_000a
- L_000a: ldloc.0
- L_000b: ret
- }
- static void Main(string[] args)
- {
- int i = 0;
- i += 1;
- i = i + 1;
- Console.WriteLine(i);
- }
- private static void Main(string[] args)
- {
- int i = 0;
- i++;
- i++;
- Console.WriteLine(i);
- }
- static void Main(string[] args)
- {
- int x = 2;
- int y = 3;
- x += 1;
- y = y + 1;
- Console.WriteLine(x);
- Console.WriteLine(y);
- }
- x=x+1
- x+=1
- instruction type example cycles
- ADD reg,reg add ax,bx 1
- ADD mem,reg add total, cx 3
- ADD reg,mem add cx,incr 2
- ADD reg,immed add bx,6 1
- ADD mem,immed add pointers[bx][si],6 3
- ADD accum,immed add ax,10 1
- INC reg inc bx 1
- INC mem inc vpage 3
- MOV reg,reg mov bp,sp 1
- MOV mem,reg mov array[di],bx 1
- MOV reg,mem mov bx,pointer 1
- MOV mem,immed mov [bx],15 1
- MOV reg,immed mov cx,256 1
- MOV mem,accum mov total,ax 1
- MOV accum,mem mov al,string 1
- MOV segreg,reg16 mov ds,ax 2, 3
- MOV segreg,mem16 mov es,psp 2, 3
- MOV reg16,segreg mov ax,ds 1
- MOV mem16,segreg mov stack_save,ss 1
- MOV reg32,controlreg mov eax,cr0 22
- mov eax,cr2 12
- mov eax,cr3 21, 46
- mov eax,cr4 14
- MOV controlreg,reg32 mov cr0,eax 4
- MOV reg32,debugreg mov edx,dr0 DR0-DR3,DR6,DR7=11;
- DR4,DR5=12
- MOV debugreg,reg32 mov dr0,ecx DR0-DR3,DR6,DR7=11;
- DR4,DR5=12
- ;for i = i+1 ; cycles
- mov ax, [i] ; 1
- add ax, 1 ; 1
- mov [i], ax ; 1
- ;for i += 1
- ; dunno the syntax of instruction. it should be the pointers one :S
- ;for i++
- inc i ; 3
- ;or
- mov ax, [i] ; 1
- inc ax ; 1
- mov [i], ax ; 1
- ;for ++i
- mov ax, [i] ; 1
- ;do stuff ; matters not
- inc ax ; 1
- mov [i], ax ; 1
- int i = 0;
- i = i + 5.5; // doesn't compile.
- i += 5.5; // compiles.
Add Comment
Please, Sign In to add comment