Welcome, Guest. Please login or register.

Author Topic: Assembler question2  (Read 4010 times)

Description:

0 Members and 2 Guests are viewing this topic.

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: Assembler question2
« on: April 05, 2003, 08:46:11 PM »
Argh - I just posted and got kicked out before the page refreshed.

I hate it when that happens!!!

Anyway

Quote

N7VQM wrote:
I'm a wimp.  If I need signed math, I use C.  My guess is that the V flag get set if you perform an addition that causes your number to exeed 0111 1111.


Due to the nature of signed 2's complement arithmetic, it doesn't matter. The operation performed is the same for signed and unsigned numbers. Hence the m68k doesn't need to differentiate between the two for addition/subtraction.

Allow me to demonstrate, again using bytes.

unsigned byte : 200 + 20 = 220
signed byte : -56 + 20 = -36

The point is, the bitwise representation of signed byte -56 and unsigned byte 200 are the same, as are signed -36 and 220. The binary representation of 20 is the same in both cases.

This is why there aren't any adds /addu / subs / subu on 68k. Obviously, multiplication and division are different because sign matters (negative x negative = pos etc), so we do have seperate signed and unsigned operations for this.

Hope this helps a bit.

-edit-

Asm not my strong point so don't ask me to explain any further :-D
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show all replies
Re: Assembler question2
« Reply #1 on: April 07, 2003, 04:04:25 PM »
Hi PiR,

Nice to see you joined the fun :-D
int p; // A