☰
d2jsp
Rules
Help
Forum Gold FAQ
Live Streams
Photo Gallery
Hourly Raffle
Ladder Slasher
Log In
Register
Log In
Register
Account Recovery
Resend Validation Email
d2jsp Forums
>
Off-Topic
>
Computers & IT
>
Programming & Development
> X86 Assembly > Negate A Number Already In Decimal
Add Reply
New Topic
New Poll
Views: 212
Replies: 6
Track Topic
Favre
Member
Posts: 9,759
Joined: Jun 10 2007
Gold
:
42,069.33
#1
Sep 18 2012 11:32am
i have the number in eax
when i neg eax
say eax was 1,
it gives me 15
anyone know what to do?
irimi
Member
Posts: 4,605
Joined: Sep 15 2011
Gold
:
9,464.00
#2
Sep 18 2012 11:59am
so you have a 4 bit register
0001
two's complement negative of that is
1111
which is 15.
Quote (Favre @ Sep 18 2012 10:32am)
anyone know what to do?
you could start by asking better questions.
This post was edited by irimi on Sep 18 2012 12:00pm
Richter
Member
Posts: 16,144
Joined: Mar 27 2008
Gold
:
14,618.00
#3
Sep 18 2012 12:32pm
his question seems to be: "why don't i get '-1' on my screen?"
as Irimi said, its because you interpret the '-1' to be 15.
Favre
Member
Posts: 9,759
Joined: Jun 10 2007
Gold
:
42,069.33
#4
Sep 18 2012 02:30pm
i understand how 2's complement works
but its a signed bit
1111 should read -1
irimi
Member
Posts: 4,605
Joined: Sep 15 2011
Gold
:
9,464.00
#5
Sep 18 2012 04:33pm
registers don't really care about signs. as long as you have the bits correct, it's correct.
how the value in a register is interpreted depends on the program that's reading it.
This post was edited by irimi on Sep 18 2012 04:33pm
Favre
Member
Posts: 9,759
Joined: Jun 10 2007
Gold
:
42,069.33
#6
Sep 18 2012 05:29pm
Quote (irimi @ Sep 18 2012 05:33pm)
registers don't really care about signs. as long as you have the bits correct, it's correct.
how the value in a register is interpreted depends on the program that's reading it.
i emailed my profesor.
it probabably something stupid.
AbDuCt
Member
Posts: 13,425
Joined: Sep 29 2007
Gold
:
0.00
Warn: 20%
#7
Sep 19 2012 07:11am
lolled
Go Back To
Programming & Development
Topic List
Add Reply
New Topic
New Poll
© 2003-2026 d2jsp
Contact