All pastes #39788 Raw Edit

Untitled

public text v1 · immutable
#39788 ·published 2006-02-03 19:18 UTC
rendered paste body
ection .data
fmt db "%u ist prim",0xa,0x0
startzahl equ 3
endzahl equ 100

section .text
global _start
extern printf,_exit
_start:
mov esi,startzahl       ;startzahl
or esi,0x1              ;startzahl = ungerade
finit
       
        .nextnum:

        push esi
        fild dword [esp]
        fsqrt
        fistp dword [esp]
        pop ebx                 ;ebx=sqrt(esi)
        inc ebx                 ;wegen abrunden
       
        mov ecx,2
        .checkprim:
                mov eax,esi
                cdq
                div ecx
                cmp edx,0       ;edx enthält modulo
                je .nex
                inc ecx
                cmp ecx,ebx
                jbe .checkprim
        push esi
        push fmt
        call printf
        .nex:
        add esi,1               ; gerade zahlen nicht testen
        cmp esi,endzahl
        jng .nextnum

push 0
call _exit