Jump to content

assembly program to chek a number positive or negative.

- - - - -

  • Please log in to reply
4 replies to this topic

#1
gujjar

gujjar

    Newbie

  • Members
  • Pip
  • 5 posts
Hi All!!
i have to write an assembly prog ,to check a number positive or negatie.can any one help me???

#2
Warrior

Warrior

    Programmer

  • Members
  • PipPipPipPip
  • 130 posts
Negative numbers have their most significant bit set.So you only need to check that if the highest bit is 1,if it is then its negative else it's positive.
mov  al,-1        ;11111111
test  al,0x80 
jz     positive    ;if its zero positve
jmp  negative

Warrior

#3
gujjar

gujjar

    Newbie

  • Members
  • Pip
  • 5 posts
thankss dear

#4
zarazhi

zarazhi

    Newbie

  • Members
  • Pip
  • 1 posts
Thanks also, I also had the same question! :)
http://www.business567.com

#5
gujjar

gujjar

    Newbie

  • Members
  • Pip
  • 5 posts
hi zarazhi!!
have you completed that program?




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users