Variable Limits and Negative Values
How about the limits of those variable types then? See the table below:
db "define byte" 1 byte 0-255
dw "define word" 2 bytes 0-65535
dd "define double" 4 bytes 0-4294967295
"Ah, I see that the db, dw, and dd are for positive values only. How can I define a negative ones?" Well, you can assign the variables as negative values, too. However, assembler will convert them to the corresponding positive value. For example: If you assign -1 to a db variable, assembler will convert them to positive 255 integer. "How can it be? It will certainly confuse my calculation then." Nope. In fact, the converted negative values will behave similarly as if they are not flipped. Trust me. ;-) The only thing you need to beware of is just when you want to print the contents of that variable out to the screen and to distinguish the negative values from the positive ones.
To distinguish negatives from positives, usually programmers likes to divide the variable ranges into two roughly equal parts. For bytes, if the value is between 0 and 127, it is considered as positive, the rest (128-255) are considered negative. This scheme also perpetuates in dividing words and double-words. It's not hard at all, you just remember which variables are considered negative and treat them accordingly. You may find it cumbersome at first, though.
Now, the next question would be on how can we find the corresponding positive values for each negative numbers. Before we start, I just remind you that 1 byte equals to 8 bits. So 2 bytes is 16 bits, 4 bytes is 32 bits. I assume that you are able to convert a decimal number to binary and vice versa. I also assume that you're capable in doing binary digit addition.
To find the corresponding positive value, you first ignore the negative sign, then convert that number into binary. Remember the variable type you are in. If it is a byte, the resulting binary number must be 8 digits. Likewise, a word must be 16 digits and a double must be 32 digits. If the result digit is less than that, pad it with zeroes. Then, flip all digits in the binary number (i.e. from 0 to 1 or from 1 to 0). After that, increase that binary by one. Convert the result back to decimal. Voila! That's the corresponding positive value.
For example, you want to convert -5 byte to its corresponding positive value. Ignore the negative and convert 5 to binary. It's 101, right? Since we're dealing with bytes, we must have 8 digits. The result 101 is just 3 digits, so we must pad it with zeroes. Therefore, we now have 00000101. Then, we flip the digits from 0 to 1 or 1 to 0. So, we now have 11111010. The next step is to increase that number by 1: 11111010 + 1 = 11111011. Then we convert this number back to decimal: 251. Ta da! So, -5 is 251 in positive representation.
Hmm, if you find that this calculation is cumbersome... uh... Well, you have to live with that if you'd like to learn assembly. Moreover, you need to be familiar with hexadecimal numbers too. You would need to learn some converting operations and do some arithmetic between decimal, binary and hexadecimal. If you're kinda awkward, you can always employ calculators. If you do it over and over again, you probably do the calculations by heart quickly (and amaze your friends ;-).