This code is incorrect:
mov ecx, 1 ;
loop:
cmp ecx, 6
jbe end_loop ; ecx >= bufor
jbe
means jump if below or equal
. So what you're doing here is essentially:
ecx = 1;
do {
if (ecx <= 6) goto end_loop;
Obviously 1 is <= 6, so it will always jump to end_loop
on the first iteration of the loop.
That jump should probably be a jae
instead.
Another problem is that you start with ecx = 1
, since ecx
appears to be your divisor. The first number you should try to divide by if you're checking for primality is 2, not 1.