0

I'm new to assembly language

can number -123,456 can be stored in one word?

-123, 456 is in range for a Dword but I'm confuse if a Dword is stil a word or is it two words because Dword is use for 32 bits word

  • 1
    You didn't say which assembly language you are using. Different processors have different meanings for the term "dword". – Raymond Chen Apr 14 '13 at 17:49
  • As others have said, it means whatever the processor and language architects say it means. In some cases a dword and word are the same size, in other cases not. – Hot Licks Apr 14 '13 at 18:48

2 Answers2

3

The trouble with the word "word" is that it is very ambiguous. It used to mean "native word size" of a computer. Which was all over the place in the early years. Weird sizes too, multiples of 6 were popular, like 18 and 36 bits. Back then everybody understood that "word" didn't say anything about the number of bits. The term "byte" didn't get a meaning until much later.

That changed when micro-processors came around, first in 8 and 16-bit flavors. Where "word" got to be synonymous with "16-bits". That lasted a long time, until 32-bit processors became common. Processors like the 386 whose native word size is 32-bits but could still address 16-bit quantities as well. So to avoid breaking tons of assumptions, and keeping at least some of the existing assembly code compatible, they had to come up with a new word for the quantity of 32-bits. That became "dword", double word or 2 x 16-bits. And "word" stayed 16-bits, even though it now has nothing to do anymore with the native word size.

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
1

The size of a word is architecture specific. They usually refer to a unit that the ISA handles natively. In case of a Doubleword or DWORD, it's merely a unit which its size is twice the size of a word.

So if you are talking about an architecture where the size of a word is 16bit (e.g. Intel 8086), then DWORDs can hold 32bits of information. Since -123456 is FFFE1DC0 (w/ sign extension to 32bit), it can indeed be stored in one DWORD.

JosephH
  • 8,465
  • 4
  • 34
  • 62