Find out if you can declare a variable of type dword and assign it a negative value. what does this tell you about the assembler's type checking?

Answers

Answer 1
Answer:

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 ;-).

 


Related Questions

COLLEGE

Which option might indicate legal intrusion by a computer professional?

Answers

'Once, while preparing for a client presentation, he accessed client records for which he did not have authorisation' is going to be the correct answer! =)
Once, while preparing for a client presentation, he accessed client records for which he did not have authorization. - Quizlet
HIGH SCHOOL

What is the correct sequence of the phases in the systems development life cycle?

Answers

1. Requirements gathering/analysis.
2. Design.
3. Development.
4. Testing.
5. Maintenance.
MIDDLE SCHOOL

does someone know of a website where I can find free essays or assignments already answered (right or wrong, ain't matter), kinda like a simulator​

Answers

Answer:

Your

Explanation:

Taking answers from online is plagiarism. If you get caught, you could get in trouble. If you don't know the subject well enough that doesn't matter because apparently you don't care your grade.

COLLEGE

The value of a default argument must be a(n) _________.

Answers

Answer:

Constant

Explanation:

A default argument is a value provided in a function declaration that the compiler automatically assigns if the function caller does not provide a default value for the argument.

The value of a default argument must be constant.

The default value parameter must be a  constant for compiling. Compiler does not accept dynamically calculated value against optional parameter. The reason behind this it is not certain that the dynamic value you provide would offer some valid value.

Example:

#include  

using namespace std;  

/*A function with default arguments, it can be called upto 4 arguments*/

int sumnum(int x, int y, int z=0, int w=0)  

{  

return (x + y + z + w);  

}  

int main()  //driver function

{  

cout

HIGH SCHOOL

What it tthe top streamed tv show?

Answers

Answer:

The ladies of Litchfield

Explanation:

iiiiiiiiiiiiiiiiiiii

MIDDLE SCHOOL

Which of the following is the type of communication where you send information over a network?

Answers

The type of communication where you send information over a network is digital communication. The correct option is A.

What is digital communication?

Using online technologies like email, social media messaging, and texting to share a message with others or a particular audience is known as digital communication.

Digital communication can include even something as basic as reading the content on a webpage like this.

Using online technologies like email, social media messaging, and texting to share a message with others or a particular audience is known as digital communication.

Digital communication can include even something as basic as reading the content on a webpage like this.

Digital communication is any form of communication that involves sending data via a network.

Thus, the correct option is A.

For more details regarding digital communication, visit:

brainly.com/question/18825060

#SPJ2

Your question seems incomplete, the probable complete question is:

Which of the following is the type of communication where you send Information over a network?

O = digital communication

O = broadband

- telecommunication

O = analog

Answer:

Telephone Network or Text Messages. Also, Internet Lines.

MIDDLE SCHOOL

Which of the following terms refers to the horizontal line of continuous cells in a table? Question 2 options:

An intersection


A worksheet


A column


A row

Answers

Answer:

The correct answer is A row.

Explanation:

A table has rows and columns.

Rows are those lines that we see in the form of continuous cells side by side horizontally. While the columns are the cells that cut the rows vertically.

An example of this can be an excel file. The rows will be horizontal, and the columns will be vertical.

Given this information we can say that the correct answer is row.

I believe it's a Row and A Intersection, though I'm not completely sure.

MIDDLE SCHOOL

Isn't there anyone who knows Assembly programming???

Answers

Answer:

Me but very less as it is kinda useless to learn it these days

HIGH SCHOOL

When nearly all Americans in a recent survey said that they believe executives base decisions primarily on what will advance their careers, the survey respondents were indicating ethics in business management.

Answers

Answer:

serious concerns about.

Explanation:

Since the reports are indicating the almost all the Americans believe executive based decisions and it is a serious concern because the people should be taking their own decisions and the career decisions are the most important ones in a person's life. Depending on other to take decisions for you shows a weak character and lack of self-confidence.

Random Questions