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
jephthah commented: i think im going to start avoiding any of your questions from now on. +0

Recommended Answers

All 2 Replies

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 :(

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.