# mud7 - Lecture C7 Assembly programming Response to'Muddiest...

This preview shows pages 1–4. Sign up to view the full content.

Lecture C7: Assembly programming Response to 'Muddiest Part of the Lecture Cards' (58 respondents, out of 74students) 1) The Assembly commands? (10 students) We can and will review the commands during recitation hours. Please read through the following "Assembly language handout". 2) I don't understand how to keep all number systems straight. It would help if we had one page about (1 student) You now have one page and more, take a look at the following document "number representation". 3) The Boolean operations: NOT, AND, OR, XOR? (7 students) Boolean expressions can be formed much like arithmetic operations, but they contain boolean values (either True/1 or False/0 ), boolean variables (which can be assigned the values True/1 or False/0 ) and boolean operations. We use truth tables to define the boolean/logic operations: The NOT operation is sometimes known as the inverse operation since it simply reverses the state of all bits. A 0 becomes a 1 , and a 1 becomes a 0 . A NOT A 0 1 1 0 Example: if A = NOT B, then B = NOT A The AND operator takes 2 parameters, the result of "A AND B" results in a 1 if and only if both operands are 1 , otherwise it results in a 0 . A B A AND B 0 0 0 0 1 0

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
1 0 0 1 1 1 The OR operator also takes two operators/parameters, the result of "A OR B" results in a 1 if one or both of the operands are 1 , otherwise it results in 0 . A B A OR B 0 0 0 0 1 1 1 0 1 1 1 1 The XOR operator (the Exclusive Or operator) takes two parameters, results in a 1 if and only if one of the operands are 1. " A XOR B" results in a 0 if both operands equal 0 , or if both operands equal 1 . A B A XOR B 0 0 0 0 1 1 1 0 1 1 1 0 There are a number of different equivalences that are good and helpful to know about, for example: "DeMorgan's Rules" stating that: NOT (A AND B) is equivalent to ( NOT A) OR ( NOT B) NOT (A OR B) is equivalent ( NOT A) AND ( NOT B) These equivalences can be verified using the following truth table, where you by comparing column 4 and 7 can verify that NOT (A AND B) is equivalent to ( NOT A) OR ( NOT B). AND B NOT (A AND B) NOT A NOT B ( NOT A ) OR ( NOT B) 0 1 1 1 1 0 1 1 0 1 1 1 0 1 1 A B A 0 0 1 0 0 0
1 0 0 0 0 1 1 As an exercise , use a truth table to verify that the "Distribution rules" shown below are correct: (A AND B) OR C is equivalent to (A OR C) AND (B OR C) (A OR B) AND C is equivalent to (A AND C) OR (B AND C) Boolean variables are useful in computer programs when we have to make decisions. A program can make a decision by evaluating a condition . For example, you want to withdraw \$100 from your account, then your program has to make sure that there is at lease 100 dollars in the account, thus allowing you to withdraw \$100 depends on whether you have enough money in your account or not. Some examples of conditions are: the condition 42 = 17 is FALSE the condition 42 = X depends on the value of the variable X.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 02/20/2012 for the course AERO 16.02 taught by Professor Charlescoleman during the Winter '12 term at MIT.

### Page1 / 8

mud7 - Lecture C7 Assembly programming Response to'Muddiest...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online