Title: MiniCourse CMPE12: Assembly Language
1Mini-CourseCMPE12 Assembly Language
Lecture Material by Prof. Andrea Di Blas and
Alexandra Carey, Slides by Janelle Yong
2An Introduction to Computer Systems and Assembly
Language
- Explains how computers compute in hardware and
software - Basic Topics include
- Number Systems
- Digital Logic
Lecture Material by Prof. A. Di Blas and A.
Carey, Slides by J. Yong
3Number Systems
- Unary each marking represents one digit
- IIIIIIII 8 and IIIIIIIIIII 11
- Alphabet I
- Arabic
- Alphabet 0 1 2 3 4 5 6 7 8 9
- 7 5 (1 10) (2 1) 12
- Also called Decimal or Base 10
Lecture Material by Prof. A. Di Blas and A.
Carey, Slides by J. Yong
4Number Systems
- Binary
- Alphabet 0, 1
- Called binary digits, or bits
- 1 presence of voltage
- 0 absence of voltage
- Bit is the unit of information
Lecture Material by Prof. A. Di Blas and A.
Carey, Slides by J. Yong
5Number Representation
- Each pattern of bits make up a code
- Each code corresponds to a particular value
- Examples
- 11 3
- 1100 12
- 11001 25
Lecture Material by Prof. A. Di Blas and A.
Carey, Slides by J. Yong
6Number Conversion
- Decimal to Binary
- Use successive divisions
- Remember the remainders
- Divide again with the quotient
- ex. Convert 25 to Binary
- 25 2 12 r 1
- 12 2 6 r 0
- 6 2 3 r 0
- 3 2 1 r 1
- 1 2 0 r 1
- Binary 11001
Lecture Material by Prof. A. Di Blas and A.
Carey, Slides by J. Yong
7Number Conversion
- Binary to Decimal
- If you have a binary number with 3 digits
- __ 22 __ 21 __ 20
- __ insert 1 or 0 depending on
- what your binary number is
Lecture Material by Prof. A. Di Blas and A.
Carey, Slides by J. Yong
8Number Conversion
- __ 22 __ 21 __ 20
- 2x exponent indicates which bit you are
looking at - 0th bit is the right-most bit
- Increases as you go left
Lecture Material by Prof. A. Di Blas and A.
Carey, Slides by J. Yong
9Number Conversion
- Example 1
- 101 1 22 0 21 1 20
- 4 0 1
- 5
Lecture Material by Prof. A. Di Blas and A.
Carey, Slides by J. Yong
10Number Conversion
- Example 2
- 11001 124 123 022 021 120
- 16 8 0 0 1
- 25
Lecture Material by Prof. A. Di Blas and A.
Carey, Slides by J. Yong
11Practice Problems
- Convert the following decimal numbers to binary
- a. 13 b. 30 c. 42
- Convert the following binary numbers to decimal
- a. 0111 b. 1111
- c. 10110 d. 01011
Lecture Material by Prof. A. Di Blas and A.
Carey, Slides by J. Yong
12Knowing the Powers of Two
Know them in your sleep!
A few tid-bits Byte - 8 bits Nybble - 4 bits
Lecture Material by Prof. A. Di Blas and A.
Carey, Slides by J. Yong
13Digital Logic
- Electronic representations of Boolean logic
functions - Can be represented in a Truth Table
- Lists the outputs for all the possible inputs
Inputs Outputs
2 inputs
Lecture Material by Prof. A. Di Blas and A.
Carey, Slides by J. Yong
14Basic Logic Gates
Lecture Material by Prof. A. Di Blas and A.
Carey, Slides by J. Yong
15Inverter Gate
- Also called a NOT Gate
- Can be written as A or A
A
A
Lecture Material by Prof. A. Di Blas and A.
Carey, Slides by J. Yong
16AND Gate
- If all the inputs are 1, then the output is 1
- Can be written
- A B
- AB
Lecture Material by Prof. A. Di Blas and A.
Carey, Slides by J. Yong
17OR Gate
- If any of the inputs are 1, then the output is 1
- Written
- A B
Lecture Material by Prof. A. Di Blas and A.
Carey, Slides by J. Yong
18The Little Circle
- Inverts the output
- Acts exactly like the Inverter Gate
- Visually looks like
Lecture Material by Prof. A. Di Blas and A.
Carey, Slides by J. Yong
19NAND and NOR Gates
A B
A B
AB
A B
Lecture Material by Prof. A. Di Blas and A.
Carey, Slides by J. Yong
20The Little Circle
- What if the inverter circle is before the logic
gate? - Invert the input instead!
21More than two inputs?
- Truth table still includes all combinations of
inputs - Works only for AND and OR
- NAND and NOR does not work
- not associative recall CMPE16 Mini-Course
Lecture Material by Prof. A. Di Blas and A.
Carey, Slides by J. Yong
22More than two inputs?
Lecture Material by Prof. A. Di Blas and A.
Carey, Slides by J. Yong
23Practice Problems
- Create a truth table for the following logic
function and diagram - a. Y (AB)(C(AB))
- b.
Lecture Material by Prof. A. Di Blas and A.
Carey, Slides by J. Yong
24Assignment
- Convert the following decimal numbers to binary
- a. 34 b. 28 c. 17 d. 51 e. 90
- Convert the following binary numbers to decimal
- a. 101101 b. 010011 c. 011110
- d. 110111 e. 111111 f. 1010101
Lecture Material by Prof. A. Di Blas and A.
Carey, Slides by J. Yong
25Assignment Continued
- Create a truth table for the following logic
functions - a. F(A, B, C) (A C)(A B)(B C)
- b. F(X, Y, Z) XZ (ZY)((XYZ))
26Assignment Continued
- Create a truth table for the following logic
network shown below - a.
A
Z
B
C
27Assignment Continued
A B
Y
C D