Professional Documents
Culture Documents
E-mail :
zuohang@263.net
Phone:
66860994
1. Architecture
2. Programming
3. Interfacing
Memory
CPU
1. Architecture
3. Interfacing
Printer
2. Programming
I/O
Accumulator Base index Count Data Stack pointer Base pointer Destination index Source index
FLAGS CS DS ES SS FS
Segment registers
GS
1. Architecture
2. Programming
3. Interfacing
2. Programming
2.1 Data movement instructions 2.2 Arithmetic and logic instructions 2.3 Program control instructions
program
.DATA NUM DB 34H TABLE DW 0012H,0033H,5687H .CODE .STARTUP MOV BX,OFFSET TABLE MOV AX,[BX+4] MOV CX,88H MUL CX CMP AX,2000H JAE NEXT OUT AX,P8 .EXIT END
Application languages /application program High-level languages /compiler &interpretative program Assembly language/ assembly program
Keyboard command and system primitive / operating system Machine instruction system/ CPU
1. Architecture
2. Programming
3. Interfacing
3. Interfacing
1 8088/8086 hardware specifications 2 Memory interface 3 Basic I/O interface 4 Interrupts 5 Direct memory access and DMA-controlled I/O
Memory interface
request
Familiar with
Addressing mode programming with assembly language interfacing of microprocessor
Reference Books
IBM-PC
The 80x86 IBM PC and Compatible Computers (Volumes I & II): Assembly Language, Design, and Interfacing (4th Edition)
Reference Lessons
Operating system Computer architecture
Chapter 1
Introduction to The Microprocessor and PC
Chapter 1:
1. What mankind has done before the microprocessor finally came out?
ENIAC
ENIAC
ENIAC
4 8 32 64 64
Intel 4004
Intel 8088
Intel Petium
Intel Petium II
Question: If we use a computer to figure out an arithmetic expression, how can it finish this work? 133*33+44*14
133*33+44*14
First input these numbers. Do the calculating work. Store The result Output the result.
133*33+44*14
Input device
memory
Data bus
Bus: P25
Address bus requests a memory location from the memory or an I/O location from the I/O devices. Data bus transfers information between the microprocessor and its memory and I/O address space. Control bus contains lines that select the memory or I/O and cause them to perform a read or write operation.
P25
PC system
Chapter 2
Introduction to Number System & Data Formats
Chapter 2: (-133)*33+44*14.5
How to represent these data? How to calculate them? How about other characters?
2.1.1 Digits ( )
2.1.1 Digits ( )
A. Decimal( ) (09) B. Binary (0----1) C. Octal( ) (07) D. Hexadecimal( ) (09,A,B,C,D,E,F)
2.1.1 Digits ( )
Example: A base 13( 13 13 )number contains 13 digits: 09,A(10),B(11),C(12)
power( ) 102 101 100 weight( )100 10 1 In a base N number system, the radix is N( ) and the exponent (i) ( ) means the position.
2.1.2 Positional Notation ( Example 2: Binary 101 1 0 1 power( ) 22 21 20 weight( )4 2 1 Numeric value 1* 22 + 0* 21 + 1* 20 =5 In a base 2 number system, the radix is 2( ) and the exponent (i) ( ) means the position.
2.1.2 Positional Notation ( Special example Binary 1111 1 1 1 1 power( ) 23 22 21 20 weight( ) 8 4 2 1 Numeric value 8+4+2+1 =15 0-15 It can represent 16 different numbers.
Example 3: Decimal 1.025 1 . 0 2 5 power( ) 100 10-1 10-2 10-3(Ni) weight( )1 0.1 0.01 0.001 In a base N number system, the radix is N and the exponent (i) ( ) means the position. If the position is right to the point( ),the power is negative (N-i).
Xm Xm Xm X0 . Y1Y2Y3Yn -1 -2 -3
Numeric value( ):
-1 -2 Xm * Nm +Xm * Nm + X0 * N0 -1 -2
Summarize
Decimal
From conversion to decimal we can assume that if we can figure out how many Ni are there in a decimal number, we may convert it back to a base N number system.
Principle A: To convert a decimal whole number portion( ) to another number system, divide by the radix N ( ) and save the remainders( ).
Principle A:
quotient( ) is zero.
4 4
14 3 0
(least significant)
2 2 2 2
14 7 3 1 0
(least significant)
Principle B: To convert a decimal fractional portion( ) to another number system, multiply it by the radix ( ) and the whole number portion( ) of the result is saved as a significant digit of the result.
Principle B:
digit is 0
digit is 2
result is 0.02
0.0212
Numeric value: 0*4-1 + 2*4-2 + 1*4-3 + 2*4-4 =0 + 0.125 + 0.015625 + 0.0078125 = 0.1484375 0.15
Decimal
Y1 *N-1 +Y2 *N-2 + Yn * N-n So it means that numerical value wont exist exactly in a base N number system. But we can find one close to it .
hexadecimal digit 0 1 2 3 4 5 6 7 8 9 A B C D E F 9E = 1001 1110 BCH code 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
BCD
BCH is used to represent hexadecimal data in binary code. Each hexadecimal digit is represented by a 4-bit binary number. Each BCH digit is separated by a space.
BCH Hexadecimal B
( )
Radix-1 complements ( ) A. positive Radix-1 complements is the same as sign magnitude . B. negative Represent the data in original form, then invert each bit of the number from 0 to 1 or from 1 to 0. The sign position is always 1.
Radix-1 complements ( ) 105 ---- 0 1101001 -105 ---- 1 0010110 0 ---- 0 0000000 -0 ---- 1 1111111
Radix complements ( ) A. Positive Radix complements is the same as sign magnitude . B. negative If we add 1 to the least significant bit of the radix-1 complements, then we get radix complements. The sign position is always 1.
Example: -8 +8=00001000 1000 (write number to first 1) 1111 (invert the remaining bits) -8= 1111 1000
25
Negative signed numbers are stored in the twos complement form. ( 2 ) A simpler technique for twos implement:
Write the number exactly as it appears from right to left until the first one. Write down the first one, and then invert all the remaining bits.
If we use radix complement to represent a negative data, we can change subtract operation to add operation. Z = X Y equal to Z =X + (Y)
Nature lost
-1
The example shows that our test Z = X Y equal to Z =X + (-Y) is right, but why? The number of hour in a clock is 12. So we say the hour is mode 12. Suppose its 10 oclock, if we turn the hand 8 hour clockwise, we get 6 oclock. If we turn the hand 4 hour anticlockwise , we get 6 oclock too.
If Z = nK + Y (n integer) Then Z and Y has the same mode to K. (the above example K = 12, Z = -4, Y=8) So for a certain mode K, subtracting Y from X (Y<K) equals to adding (-Y+K). , X Y (Y<K) ,
You can turn to the reference book Microcomputer Principle and Application page 9 for details.
Nature lost
8=00001000
result = 135
O = 1( O 1 C=1, C 0 0 1 1 0 0 1 0 0 0 1 1 0 0 1 0 0 1 1 0 0 1 0 0 0
O=1 C=0
O = 1( O 1 C=1, C 0 1 0 1 0 1 0 1 1 1 1 1 1 1 1 1 1 11 0 1 0 1 0 1 0
O=0 C=1
O = 1( O 1 C=1, C 0
0 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0
+0 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 0 O=0 C=0
O=1 O=1 C=1, C=0 1 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0 0 0
O=1 C=0
2.2.2 BCD
Data
2.2.2 BCD
BCD code
decimal digit 0 1 2 3 4 5 6 7 8 9
Data
BCD code 0000 0010 0100 0110 1000
1MB 1M BYTE
8 Bit 8 Bit
2.2.2 BCD
Data
BCD data has two forms. One is packed and the other is unpacked. In all case, store the least-significant data first.( : ) Packed BCD data are stored as two digits per byte 37-----0011 0111-----37H Unpacked BCD data are stored as one digit per byte 37-----0000 0011 0000 0111 -----0307H
Radix complements ( ) -1 -2 -3 -4 -127 -128 1111 1111 1111 1111 1111 1110 1101 1100
Store address
DATA DW 1234H
3002H 3001H 3000H 2FFFH 12H 34H
Unsigned
0000 0003E1C0 0004 87AC1234 0008 00000046 Signed 000C FFEB8058 0010 000000C6 DATA1 DD 254400 DATA2 DD 87AC1234H DATA3 DD 70 DATA4 DD -1343400 DATA5 DD +198
exponent
-12
1100 -1.1*23
Double-precision
0008 405ED9999999999A NUMB3 DQ(REAL8) 123.4
Extended-precision
0010 4005F6CCCCCCCCCCCCCD NUMB4 REAL10 123.4
S 0 S 0
Significant 22-0 (ALL 0) Significant 22-0 (ALL ZEROS) Significant 22-0 (ALL ZEROS)