Código
format PE console include 'win32ax.inc' entry start .data sqrt dd 0 ;raiz msg db "%d primo",13,10,0 count dd 10b; .code start: bucle: stdcall isPrime,[count] .if edx <> 0 | eax= 1 push [count] push msg call [printf] add esp,8 .endif inc [count] cmp [count],1110000100b je _wait jne bucle proc _sqrt,firshValue,secondValue mov edx,0 ;EDX = 0 mov eax,[firshValue] ;valor A mov ebx,[secondValue] ;valor B div ebx ;EAX=A/B ret endp proc isPrime,value stdcall _sqrt,[value],2 ;div mov [sqrt],eax ;sqrt = EAX mov ecx,2 ; index _loop: stdcall _sqrt,[value],ecx ;div inc ecx ;index++ .if edx = 0 ;resto == 0 mov edx,0 ret .endif cmp ecx,[sqrt]; jne _loop ret endp _wait: invoke Sleep,-1 ;pause section ".idata" import data readable writable library msvcrt,"msvcrt.dll",kernel32,"kernel32.dll" import kernel32,Sleep,"Sleep" import msvcrt,printf,"printf"
la pregunta es como se puede mejorar?
un saludo.