You are on page 1of 153

The Intel Microprocessors

--from 8086 to Pentium Architecture, Programming and Interfacing
Teach by Zuohang ( 左航 ) College of Software 2003-8

• E-mail :

•zuohang@263.net
• Phone:

•66860994

• Content • Arrangement • Reference book • Final score

1. Architecture

2. Programming

3. Interfacing

Memory

CPU
1. Architecture

3. Interfacing

Printer

2. Programming

I/O

1. Architecture • 1.1 The architecture of CPU • 1.2 Addressing modes

Internal Microprocessor Architecture AH (AX) AL EAX DR EBX ECX EDX PR IR ESP EBP EDI ESI BH (BX) BL CH (CX) CL DH (DX) DL SP BP DI SI Accumulator Base index Count Data Stack pointer Base pointer Destination index Source index .

Internal Microprocessor Architecture EIP EFLAGS Special purpose registers IP Instruction pointer Flags Code Data Extra Stack FLAGS CS DS ES SS FS Segment registers GS .

Programming 3. Architecture 2.1. Interfacing .

1 Data movement instructions • 2.3 Program control instructions .2 Arithmetic and logic instructions • 2. Programming • 2.2.

DATA NUM DB 34H TABLE DW 0012H.88H MUL CX CMP AX.EXIT END .program • • • • • • • • • • • • • • .STARTUP MOV BX.P8 .OFFSET TABLE MOV AX.[BX+4] MOV CX.0033H.2000H JAE NEXT OUT AX.CODE .5687H .

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 .

Programming 3.1. Interfacing . Architecture 2.

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 .3.

8088 hardware specifications .

Memory interface .

• Content • Arrangement • Reference book • Final score .

request • Familiar with •Addressing mode • programming with assembly language • interfacing of microprocessor .

What we can do after learning this • Programming in assembly language in certain real-time system .memory limited system or embedded system • Design interfacing and writing drivers .

• Content • Arrangement • Reference book • Final score .

Design.Reference Books • 汇编语言 » 王爽主编 • 微型计算机原理及应用 » 周明德 编著 清华大学出版社 • IBM-PC 汇编语言程序设计 » 沈美明主编,清华大学出版社 • The 80x86 IBM PC and Compatible Computers (Volumes I & II): Assembly Language. and Interfacing (4th Edition) »   清华大学出版社 .

Reference Lessons • Operating system 操作系统 • Computer architecture 计算机体系 结构 .

• Content • Arrangement • Reference book • Final score .

.• Final Exam: 70% • Homework & Attendance:30% • This may be revised according to the needs.

Now let’s begin our exploration in microprocessor. .

Chapter 1 Introduction to The Microprocessor and PC .

What mankind has done before the microprocessor finally came out? 2.Chapter 1: 1. How many parts are there in the microprocessor ? .

2 PC Based on Microprocessor .Chapter 1: Introduction to The Microprocessor and PC • 1.1 A Historical Background • 1.

1 A Historical Background .1.

1 A Historical Background • A. The Mechanical Age – Abacus (Babylonians) – Analytical engine (Babbage.1.failure) . 1823. punched cards.

1946) .1 A Historical Background • B. Konrad Zuse. based on mechanical calculator (Hollerith.1942) – The first general-purpose. programmable electronic computer ENIAC (University of Pennsylvania. The Electrical Age – Motor-driven adding machines.1. set up IBMInternational Business Machines Corporation) – First electronic calculating machine Z3 (German.

• ENIAC • Electronic Numerical Integrator And Calculator [Computer] 电子数 字积分计算机 .

ENIAC .

ENIAC .

ENIAC .

1 A Historical Background • C.1. The Microprocessor Age (Intel) Date Part Data Bus Memory Size Width 1979 1989 1993 1997 4004 8088 80486sx Petium Petium II 4 8 32 64 64 1M 4G+16kcache 4G+16kcache 64G+32kl1 cache+512kl2c ache .

Intel 4004 .

Intel 8088 .

Intel Petium .

Intel Petium II .

The Moore’s Law: the number of transistors integrated in a chip will double very 18 or 24 mouths .

1. The Future of Microprocessors – The process speed will get more faster – The memory will get more large – The bulk will get more smaller – The width of data bus will increase – Architecture will get more efficient .1 A Historical Background • D.

1.2 PC Based on Microprocessor .

2 PC Based on Microprocessor .• Question: If we use a computer to figure out an arithmetic expression. how can it finish this work? • 133*33+44*14 1.

. Do the calculating work. • Control this processing. Store The result Output the result.• 133*33+44*14 – – – – 1.2 PC Based on Microprocessor First input these numbers.

2 PC Based on Microprocessor calculator Output device memory data bus Control bus controller .• 133*33+44*14 Input device 1.

2 PC Based on Microprocessor Address bus Microprocessor Memory Interface Control bus External devices BUS definition p25 Data bus .1.

– Control bus contains lines that select the memory or I/O and cause them to perform a read or write operation.2 PC Based on Microprocessor – 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.• Bus: P25 1. .

1.2 PC Based on Microprocessor P25 .

1.2 PC Based on Microprocessor .

1.2 PC Based on Microprocessor A. etc PC system . Relationship Figure microprocessor PC ALU controller register internal memory I/O interface I/O Devices & external memory system software application software power 、 panel 、 pc frame.

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? .

Chapter 2: Introduction to Number System & Data Formats • 2.1 Number System ( 数制 ) • 2.2 Computer Data Formats .

1 Number System ( 数制 ) .2.

1 Number System ( 数制 ) Binary 101 (1) 1 0 1 power( 幂 ) 22 21 20 (2) weight( 权 )4 2 1 Numeric value 1* 22 + 0* 21 + 1* 20 =5 (3) .2.

3 • 2.1 Number System( 数制 ) • 2.1.1.1.2.2 • 2.1.1.6 • 2.1.7 Digits (数) Positional Notation ( 位计数法) Conversion to Decimal Converting From Decimal Binary-Coded Hexadecimal Operation of Binary Three Forms of Binary Data .1.5 • 2.1 • 2.4 • 2.

2.1 Digits ( 数 ) .1.

Octal( 八进制 ) (0—7) • D.C. Binary (0----1) • C.D.1 Digits ( 数 ) • A. Hexadecimal( 十六进制 ) • (0—9.2.A.1.F) .E.B. Decimal( 十进制 ) (0—9) • B.

2.B(11).A(10).1 Digits ( 数 ) • Example: A base 13( 以 13 为基, 13 进 制 )number contains 13 digits: 0—9.C(12) .1.

2 Positional Notation ( 位计数 法) .1.2.

1. the radix is N( 基数 ) and the exponent (i) ( 指数 ) means the position.2 Positional Notation ( 位计数 法) • Example 1: Decimal 132 1( 百位 ) 3( 十位 ) 2( 个位 ) hundreds tens units position position position power( 幂 ) 102 101 100 weight( 权 )100 10 1 In a base N number system.2. .

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.1.2. . the radix is 2( 基数 ) and the exponent (i) ( 指 数 ) means the position.

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.2. .1.

001 In a base N number system.the power is negative (N-i). the radix is N and the exponent (i) ( 指数 ) means the position.01 0.2 Positional Notation ( 位计数 法) • Example 3: Decimal 1.1. .2. 0 2 5 power( 幂 ) 100 10-1 10-2 10-3(Ni) weight( 权 )1 0.1 0.025 1 . If the position is right to the point( 小数点 ).

1.2 Positional Notation ( 位计数 法) • Summarize – A base N number system Xm Xm Xm ……X0 .2. Y1Y2Y3……Yn -1 -2 -3 – Numeric value( 数值 ): -1 -2 Xm * Nm +Xm * Nm + ……X0 * N0 -1 -2 +Y1 *N-1 +Y2 *N-2 + …… Yn * N-n .

3 Conversion to Decimal .1.2.

C2 • Decimal: E*162+6*161+6*160+C*16-1+2*16-2 =14*162+6*161+6*160+12*161 +2*16-2 =3690+0.3 Conversion to Decimal • Example: • Hexadecimal: E6A.75+0.1.2.7578125 .0078125 =3690.

1.2.4 Converting From Decimal .

• Summarize 2.4 Converting From Decimal Xm-1Xm-2Xm-3……X0 .1. Y1Y2Y3……Yn – A base N number system – Decimal Xm-1* Nm-1+Xm-2 * Nm-2+ ……X0 * N0 +Y1 *N-1 +Y2 *N-2 + …… Yn * N-n .

4 Converting From Decimal . we may convert it back to a base N number system.1.• From conversion to decimal we can assume that if we can figure out how many Ni are there in a decimal number. 2.

• Principle A: – To convert a decimal whole number portion( 整数部分 ) to another number system. divide by the radix N ( 基数 ) and save the remainders( 余 数 ). 2.1.4 Converting From Decimal .

1. . • Step 2: Save the remainder (first remainder is the least significant digit --最先得到的余数是最低有效位 ) • Step 3: Repeat steps 1 and 2 until the quotient( 商 ) is zero.• Principle A: 2.4 Converting From Decimal • Step 1: Divide the decimal number by the radix (number base).

2.1.4 Converting From Decimal • Principle A: • Example convert decimal number 14 to a base 4 number system 4 4 14 3 0 remainder = 2 remainder = 3 result = 32 (least significant) .

1.4 Converting From Decimal • Principle A: • Example convert decimal number 14 to a base 2 number system 2 2 2 2 14 7 3 1 0 remainder = 0 remainder = 1 remainder = 1 remainder = 1 result = 1110 (least significant) .2.

4 Converting From Decimal .• 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. 2.1.

1. The first result is written immediately to the right of the radix point ( 得到的第一个整数写在最靠近小数 点左边的位置 ).4 Converting From Decimal • Step 1: Multiply the decimal fraction by the radix (number base) • Step 2: Save the whole number portion of the result (even if zero) as a digit.• Principle B: 2. • Step 3: Repeat 1 and 2 until the fraction part of step 2 is zero .

125 to a base 4 number system .5 4 2.0 digit is 0 * digit is 2 result is 0.125 * 4 0.5 0.4 Converting From • Principle B:Decimal • Example convert decimal number 0.1.2.02 .

2. a zero is never a remainder.4 Converting From Decimal • Principle B: – Note: Some numbers are never-ending . – For example converting 0.15 to a base 4 number system.1. – Why ? . That is.

6 0.6 4 result is digit is 0 * 0.4 Converting From Decimal * 2.1.4 digit is 2 0.6 digit is 1 2.15 * 4 0.• Example: convert 0. .4 4 1.0212…… .15 to a base 4 number system.

15 .• 0.1.015625 + 0.125 + 0.1484375 – ≈ 0.4 Converting From Decimal – Numeric value: – 0*4-1 + 2*4-2 + 1*4-3 + 2*4-4 – =0 + 0.0078125 – = 0.0212…… 2.

4 Converting From Decimal 0 .1. . Y1Y2Y3……Yn – Decimal Y1 *N-1 +Y2 *N-2 + …… Yn * N-n So it means that numerical value won’t exist exactly in a base N number system. But we can find one close to it .When converting to decimal – A base N number system 2.

2.5 Binary-Coded Hexadecimal .1.

2.5 Binary-Coded Hexadecimal • How many different numbers can 4 binary numbers form ? .1.

1.2.5 Binary-Coded Hexadecimal BCH code • 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 .

2. • Each BCH digit is separated by a space.5 Binary-Coded Hexadecimal (BCH) • BCH is used to represent hexadecimal data in binary code. • Each hexadecimal digit is represented by a 4-bit binary number. .1.

5 Binary-Coded Hexadecimal • Principle: • We just use 4-bit binary to replace each hexadecimal digit and write down them in the same sequence.1. Note that there must be a space between each 4-bit binary.2. .

0101 1011 : 2 E .1.5 Binary-Coded Hexadecimal • Example: Hexadecimal :2 A C . 5 . 0101 BCH Hexadecimal B :0010 1110 .2. 5 BCH :0010 1010 1100 .

.1.2.6 Operation of Binary All the numbers are unsigned.

6 Operation of Binary • In the above sliders we have discussed about binary. • Now we will put our focus on the arithmetic operation of binary data. . We take it for granted that all the data is unsigned. At the same time we learned the conversion between them.1.2. hexadecimal and decimal data.

2.6 Operation of Binary • Add Operation Rules: • 0+0 = 0 • 0+1 = 1 • 1+0 = 1 • 1+1 = 0 submit( 进位 ) 1 • 1+1+1 = 1 submit( 进位 ) 1 .1.

2.6 Operation of Binary • Add Operation • 1101 + 1011 1111 1101 + 1011 11000 submit bit add bit added bit result .1.

6 Operation of Binary • Subtract Operation Rules • 0-0 = 0 • 1-1 = 0 • 1-0 = 1 • 0-1 = 1 borrow( 借位 ) 1 • Binary addition and subtraction get the same results on the unit position .1.2.

1.6 Operation of Binary • Subtract Operation • 11000100 – 00100101 111111 • ( 借位 ) 1011101 ( 借位后的被减数 ) 11000100 ( 被减数 ) -00100101 ( 减数 ) 10011111 .2.

6 Operation of Binary • Multiply Operation Rules • 0*0 = 0 • 0*1 = 0 • 1*0 = 0 • 1*1 = 1 .1.2.

2.1.6 Operation of Binary • Multiply Operation 1111 * 1101 1111 * 1101 1111 0000 1111 1111 11000011 .

2.1.6 Operation of Binary • Divide Operation 101 000111 100011 101 01111 101 101 101 0 101 101 100101 101 10001 101 111 101 10 .

6 Operation of Binary • All the numbers are unsigned . so they are positive. • How can we represent negative number in binary in a computer? .1.2.

2.1.7 Three Forms of Binary Data

• Signed data can be represented in three forms.
• Sign magnitude( 原码 ) • Radix-1 complements ( 反码 ) • Radix complements ( 补码 )

2.1.7 Three Forms of Binary Data

• We use byte-sized data in our examples.

2.1.7 Three Forms of Binary Data • Sign magnitude ( 原码 )
•0 0 0 0 0 0 0 0
0 positive 1 negative

Numerical value (-127~+127)

105 ---- 0 1101001 -105 ---- 1 1101001

• Radix-1 complements ( 反码 ) • A. then invert each bit of the number from 0 to 1 or from 1 to 0.1. The sign position is always 1. negative Represent the data in original form. positive Radix-1 complements is the same as sign magnitude . • B. 2.7 Three Forms of Binary Data .

7 Three Forms of Binary Data • Radix-1 complements ( 反码 ) • 105 ---.0 1101001 -105 ---.0 1101001 • -105 ---.• sign magnitude ( 原码 ) 105 ---.1 1101001 2.1 0010110 •0 ---.0 0000000 • -0 ---.1 1111111 .1.

Positive Radix complements is the same as sign magnitude .1.7 Three Forms of Binary Data • Radix complements ( 补码 ) • A. then we get radix complements. . The sign position is always 1.2. negative If we add 1 to the least significant bit of the radix-1 complements. • B.

1.2.7 Three Forms of Binary Data • Radix complements ( 补码 ) 反码 radix-1 complement complement 105 0 1101001 -105 1 0010110 0 0 0000000 -0 1 1111111 补码 radix 0 1101001 1 0010111 0 0000000 0 0000000 .

1.7 Three Forms of Binary Data .• Example: -8 • +8=00001000 • 1000 (write number to first 1) • 1111 (invert the remaining bits) • -8= 1111 1000 2.

1.7 Three Forms of Binary Data • + 25 = 0001 1001 • - 25 (补)= 1110 0111 • - 39 • + 39 = 0010 0111 • - 39 (补)= 1101 1001 .• - 25 2.

1.7 Three Forms of Binary Data . ( 负数以 2 进 制的补码形式存储 ) • A simpler technique for two’s implement: – Write the number exactly as it appears from right to left until the first one. 2.• Negative signed numbers are stored in the two’s complement form. 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.1. Z = X – Y equal to Z 补 =X 补 + (Y) 补 2.7 Three Forms of Binary Data .

1.7 Three Forms of Binary Data 64-10 = 64 补 + (-10) 补 64 补 = 01000000 + 01000000 11110110 100110110 (-10) 补 =11110110 • Z = X – Y equal to Z 补 =X 补 + (-Y) 补 • Example 1: 64 -10 (right) result = 00110110 = 54 Nature lost .2.

1.00100010( 原 ) =-34 -1 .7 Three Forms of Binary Data • Example 2: 34-68 • 34-68 = 34 补 +( -68) 补 ( -68) 补 =10111100 • 34 补 =00100010 + 00100010 10111100 11011110 result = 11011110 = -34(right) 11011110( 补 )= 11011101( 反 ) = .2.

• 10001101( 补 ) • = 10001100( 反 ) = 01110011( 原 ) • =-115 .

7 Three Forms of Binary Data .1. 2. we get 6 o’clock too. but why? • The number of hour in a clock is 12. if we turn the hand 8 hour clockwise. If we turn the hand 4 hour anticlockwise . So we say the hour is mode 12.• The example shows that our test “Z = X – Y equal to Z 补 =X 补 + (-Y) 补 ” is right. we get 6 o’clock. Suppose it’s 10 o’clock.

1.7 Three Forms of Binary Data .• If Z = nK + Y (n integer) • Then Z and Y has the same mode to K. 总可以用加上该数的负 数与其模之和(即补数)来代替。 2. 对于某一固定的模 . (the above example K = 12. Y=8) • So for a certain mode K. subtracting Y from X (Y<K) equals to adding (-Y+K). X 减 Y (Y<K) . Z = -4.

1.• You can turn to the reference book “Microcomputer Principle and Application” 《微机原理和应用》 page 9 for details. 2.7 Three Forms of Binary Data .

7 Three Forms of Binary Data 64-10 = 64 补 + (-10) 补 64 补 = 01000000 + 01000000 11110110 100110110 (-10) 补 =11110110 • Z = X – Y equal to Z 补 =X 补 + (-Y) 补 • Example 1: 64 -10 (right) result = 00110110 = 54 Nature lost .2.1.

2.1.7 Three Forms of Binary Data • Example 3: 127 +8
127= 01111111 01111111 + 00001000 10000111
Overflow Error!

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 .

否则 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 .• 减法运算溢出 – 当次高位不向最高位借位,而最高位向前借位, O=1 – 当次高位向最高位借位,而最高位不向前借位, O=1 – 当最高位向前借位, C=1.

2 Computer Data Formats .2.

2.2 Computer Data Formats • 2.4 • 2.2.5 • 2.1 • 2.2.2.3 • 2.2.2 • 2.2.6 ASCII Data BCD Data Byte-Sized Data Word-Sized Data Doubleword-Sized Data Real Numbers .2.

1 ASCII Data .2.2.

2. • ASCII use 8-bit(00H—FFH) represent alphanumeric characters in computer.1 ASCII Data • ASCII (American Standard Code for Information Interchange) represent alphanumeric characters in the memory of a computer system. .2.

2. • How to represent characters in other countries? . Including what is 8FH—FFH representing.2.1 ASCII Data • Table 1-7 on page 35 shows what is 00H—7FH representing. • Table 1-8 on the same page shows extended ASCII code.

2. • Unicode system use 16-bit data to represent character.2. • 0000H—00FFH is the same as ASCII code • 0100H—FFFFH is used to store other special characters from other countries. .1 ASCII Data • Many Windows-based applications use the Unicode system to store alphanumeric data and thus resolve the problem.

2.2.2 BCD Data .

2 BCD • BCD code decimal digit 0 1 2 3 4 5 6 7 8 9 Data BCD code 0000 0010 0100 0110 1000 0001 0011 0101 0111 1001 .2.2.

• 1MB 1M BYTE 8 Bit 8 Bit .

One is packed and the other is unpacked.2. • In all case.2 BCD Data • BCD data has two forms.( 规则 : 先存储最低有效位 ) • 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 . store the least-significant data first.2.

2.2.3 Byte-Sized Data .

3 Byte-Sized Data • The weights of each binary-bit position • Unsigned byte 128 64 32 16 8 • Signed byte -128 64 32 16 8 4 2 1 4 2 1 .2.2.

Radix complements ( 补码 ) • -1 • -2 • -3 • -4 • …… • -127 • -128 1111 1111 1111 1111 1111 1110 1101 1100 1000 0001 1000 0000 .

• Byte-sized data are stored as unsigned and signed integers. .2. • Unsigned integers range in value from 00H to FFH (0-255) • Signed integers range in value from -128 to +127.3 Byte-Sized Data • One byte contains 8 bits.2.

2.3 Byte-Sized Data • Example of defining a byte-sized data: – unsigned – – – – – – 0000 FE 0001 87 0002 47 Signed 0003 9C 0004 64 All the data DATA1 DB 254 formats are DATA2 DB 87H based on a DATA3 DB 71 8088 microproces sor. whose DATA4 DB -100 data width DATA5 DB +100 is 8 bits.2. Store value Store address .

4 Word-Sized Data .2.2.

2.4 Word-Sized Data • One word contains 16 bits. For unsigned integers it is 32768 while signed is -32768. That is it is formed with two bytes of data. • Word-sized data are stored as unsigned and signed integers. . The difference between them is the weight of the highest position.2.

2.2.4 Word-Sized Data
• In Intel microprocessor, the least significant byte is stored in the lowestnumbered memory location, and the most significant byte is stored in the highest-numbered memory location. Memory width :
8 bit

• DATA DW 1234H
3002H 3001H 3000H 2FFFH 12H 34H

2.2.4 Word-Sized Data
• Example: • Unsigned
• • • • • • 0000 09F0 DATA1 DW 2544 0002 87AC DATA2 DW 87ACH 0004 02C6 DATA3 DW 710 Signed 0006 CBA8 DATA4 DW -13400 0008 00C6 DATA5 DW +198

2.2.5 Doubleword-Sized Data

. The difference between them is the weight of the highest position. That is it is formed with two words or four bytes of data.2.2.5 Doubleword-Sized Data • One doubleword contains 32 bits. • Doubleword-sized data are stored as unsigned and signed integers.

the least significant byte is stored in the lowestnumbered memory location.2. and the most significant byte is stored in the highest-numbered memory location.2.5 Doubleword-Sized Data • In Intel microprocessor. • DATA DD 12345678H 3003H 3002H 3001H 3000H DATA DD 5678H ??? 12H 34H 56H 78H .

5 Doubleword-Sized Data • Example : • 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 .2.2.

• Example : Define 123456H • DB 56H.12H What is the difference? • DD 123456H .34H.2. doubleword-sized data are standard form. We can use DB to define those nonstandard data.5 Doubleword-Sized Data • Note : Byte-sized. word-sized.2.

2.6 Real Numbers .2.

24. • 4-byte real number is called singleprecision and 8-byte double-precision.5. .5 (2.6 Real Numbers • In high-level language we often encounter number like 24.45*101) contained two parts: significand ( 尾数 ) and exponent ( 指数 ). • As we have noticed.2. We call it real number or floating-point number( 浮点数 ).2.

2.6 Real Numbers • Single-precision using a bias of 7FH S Exponent Significant 31 30-23 22-0 • Double-precision using a bias of S Exponent Significant 63 62-52 51-0 3FFH .2.

• For single-precision: bias exponent = exponent + 7FH • For double-precision: bias exponent = exponent + 3FFH .2.2.6 Real Numbers • The exponent is stored as bias exponent.

1*23 0 significant exponent 100 0000 0111.6 Real Numbers • Table 1.2.1 0000 0000 111+11 0000 0000H -12 1100 -1.10 single-precision number(P41) decimal binary normalized sign Biased +12 1100 1.1*23 1 +100 11001 1.1001*26 0 00 100000 10 011111 100 1000 0000 0000 11+110 0000 0000H .2.

2.6 Real Numbers • Define single-precision data(32 bit) • DD / REAL4 • Define double-precision data(64 bit) • DQ / REAL8 • Define extended precision data • REAL10 .2.

4 .4 • Extended-precision 0010 4005F6CCCCCCCCCCCCCD NUMB4 REAL10 123.2.2.234 0004 C1BB3333 NUMB2 REAL4 -23.6 Real Numbers • Examples: • Single-precision 0000 3F9DF3B6 NUMB1 DD 1.4 • Double-precision 0008 405ED9999999999A NUMB3 DQ(REAL8) 123.

2.0 is stored as all zeros.2. • Positive infinity.6 Real Numbers • Two exceptions to the rules for floating-point numbers. • Negative infinity. • 0. S 1 Exponent 30-23 (ALL ONES) S 0 S 0 Exponent 30-23 (ALL 0) Exponent 30-23 (ALL ONES) Significant 22-0 (ALL 0) Significant 22-0 (ALL ZEROS) Significant 22-0 (ALL ZEROS) .