format binary use32 org $1000000 jmp __global_0 ; DECL n -> integer, 0 ; DECL i -> integer, 0 ; DECL nof -> integer, 0 __global_0: ; LET n <- 100 mov eax, 100 push eax pop eax mov [n], eax ; LET i <- 1 mov eax, 1 push eax pop eax mov [i], eax ; LET nof <- 0 mov eax, 0 push eax pop eax mov [nof], eax ; WHILE i n <= __global_1: mov eax, [i] push eax mov eax, [n] push eax pop ebx pop eax cmp eax, ebx jbe __global_5 mov eax, 0 jmp __global_6 __global_5: mov eax, 1 __global_6: push eax pop eax mov ebx, 0 cmp eax, ebx je __global_3 jmp __global_4 __global_3: jmp __global_2 __global_4: ; TEST n i mod 0 = mov eax, [n] push eax mov eax, [i] push eax pop ebx pop eax mov edx, 0 div ebx push edx mov eax, 0 push eax pop ebx pop eax cmp eax, ebx je __global_9 mov eax, 0 jmp __global_10 __global_9: mov eax, 1 __global_10: push eax pop eax mov ebx, 0 cmp eax, ebx je __global_7 ; LET nof <- nof 1 + mov eax, [nof] push eax mov eax, 1 push eax pop ebx pop eax add eax, ebx push eax pop eax mov [nof], eax jmp __global_8 __global_7: __global_8: ; LET i <- i 1 + mov eax, [i] push eax mov eax, 1 push eax pop ebx pop eax add eax, ebx push eax pop eax mov [i], eax jmp __global_1 __global_2: hlt nof: dd $00000000 i: dd $00000000 n: dd $00000000