23 lines
332 B
Text
23 lines
332 B
Text
# Simplistic prime-finding algorithm
|
|
|
|
start: mov eax, 2 # EAX is prime candidate
|
|
|
|
checkPrime: mov ebx, 2 # EBX is factor candidate
|
|
|
|
checkFactor: cmp eax, ebx
|
|
je primeFound
|
|
|
|
mod eax, ebx
|
|
rem ecx
|
|
cmp ecx, 0
|
|
je nextPrime
|
|
|
|
inc ebx
|
|
jmp checkFactor
|
|
|
|
primeFound: prn eax
|
|
|
|
nextPrime: inc eax
|
|
cmp eax, 50
|
|
jl checkPrime
|
|
|