Re: A86: cphlde


[Prev][Next][Index][Thread]

Re: A86: cphlde




Thanks.  That's useful information.  I wasn't sure what you meant by
signed and unsigned, or even aware that numbers in assembly could be
unsigned.

> 
> Yes, it DOES matter what kind of numbers you're using.  For example, $FF
> is either -1 or 255, depending on whether or not you're using signed
> math.  Here are some 8-bit examples (I hope I did the math right):
> 
>         hexadecimal     signed decimal  unsigned decimal
>          FE              -2              254
>         -07             - 7             -  7
>         ---             ---             ----
>          F7              -9              247
>         In this case, the sign bit is set and the carry flag is clear.
> 
>         hexadecimal     signed decimal  unsigned decimal
>          07               7                7
>         -FE             --2             -254
>         ---             ---             ----
>          09               9                9
>         In this case, the sign bit is clear and the carry flag is set.
> 
> If your application uses signed numbers, you use the sign bit to determine
> which operand is larger.  If your application uses unsigned numbers, you
> use the carry flag to determine which operand is larger.
> 
> --------
> Dan Eble (mailto:eble@cis.ohio-state.edu)
>          (http://www.cis.ohio-state.edu/~eble)
> 
> "Behold, how great a matter a little fire kindleth!" -- James 3:5


References: