-1

I need help changin this program around right now it tellls rather the number is prime but i need to make the program tell rather the user puts in is even or odd heres a lil code let me knw if i need to put all the code on there this is the prime procedure i need to change this to an is even procedure ill put the whole program on after i come from class

;----------------- Is Prime Procedure ---------------------
IsPrime PROC

; Checks the integer in EAX to see if it is prime. If so,
; returns with ZF = 1; otherwise, clears the Zero flag.

pusha
cmp eax,2 ; 1 and 2 are special cases
jbe L3 ; both are prime

mov ecx,eax ; get number for loop count
shr ecx,1 ; divide by 2
mov ebx,2 ; first divisor

L1: call IsDivisible ; EAX divisble by EBX?
jz L4 ; yes: quit
inc ebx ; next divisor
loop L1

L3: test eax,0 ; prime, so set the Zero flag
jmp L5

L4: or eax,0 ; not prime, so clear the Zero flag
jmp L5

L5: popa ;pops ESI in reverse order
Votes + Comments
i think im going to start avoiding any of your questions from now on.
3
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by jephthah
0

What program?
Repost your code and this time put it in
[code=c]//your code here [/code] tags.

[edit] Ahh. I see you always post 'do stuff for me' threads and never reply to any of the questions asked. Wasted another 5 minutes of my life :(

0

i think this is the guy who insisted C++ code was C.

so it just makes sense that he puts his assembly code here as well.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.