Chapter One-- Introduction of Microcomputer System Principles of Microcomputers 2015年8月30日...

26
2022年6年10年 年年年 Chapter One-- Introduction of Microcomputer System Principles of Microcompu ters 年年 年年年 年年年年年年年年年 Principles of Microcomputer & Interfac e Techniques Bilingual Course(50%)

Transcript of Chapter One-- Introduction of Microcomputer System Principles of Microcomputers 2015年8月30日...

Page 1: Chapter One-- Introduction of Microcomputer System Principles of Microcomputers 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日

2023年4月19日 星期三 1

Chapter One-- Introduction of Microcomputer System Principles of Microcomputers

主讲:王忠民

微机原理与接口技术Principles of Microcomputer & Interface Techniques

Bilingual Course(50%)

Page 2: Chapter One-- Introduction of Microcomputer System Principles of Microcomputers 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日

2023年4月19日 星期三 2

Chapter One-- Introduction of Microcomputer System Principles of Microcomputers

Principles of MicrocomputersWang Zhongmin

Page 3: Chapter One-- Introduction of Microcomputer System Principles of Microcomputers 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日

2023年4月19日 星期三 3

Chapter One-- Introduction of Microcomputer System Principles of Microcomputers

Chapter One

Introduction of Microcomputer system

(1)

Page 4: Chapter One-- Introduction of Microcomputer System Principles of Microcomputers 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日

2023年4月19日 星期三 4

Chapter One-- Introduction of Microcomputer System Principles of Microcomputers

Suggested Textbooks and other course materials

• Randy Hyde , The Art of Assembly Language Programming ,Sep. 2003

• Wang Zhongmin, Principles of Microcomputers, XIPT,2005

• Wang Zhongmin, Wang Yu, Wang Xiaojie, Principles of Micro

computers, XIDIAN press House,2003( 中文教材 )

• Wang YU, Wang Jinsong, Xing Gaofeng, Guidelines for the study

and experiment to the Principles of Microcomputer. XIDIAN Pre

ss House,2004( 中文实验指导书 )

• Website: http://webster.cs.ucr.eduhttp://webster.cs.ucr.edu

Page 5: Chapter One-- Introduction of Microcomputer System Principles of Microcomputers 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日

2023年4月19日 星期三 5

Chapter One-- Introduction of Microcomputer System Principles of Microcomputers

原版教材情况• The Art of Assembly Language Programming

Published 32-bit edition both for Windows and Linux 32-bit electronic edition for Windows 32-bit electronic edition for Linux 16-bit electronic edition for DOS 清华大学出版社有该书的影印本,取名:汇编语言艺术, 2005 年 3 月出版, 888 页,定价 88 元

• Authour:

Randy Hyde

Department of Computer Science

University of California

• Homepage:http://www.cs.ucr.edu/~rhyde/

Page 6: Chapter One-- Introduction of Microcomputer System Principles of Microcomputers 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日

2023年4月19日 星期三 6

Chapter One-- Introduction of Microcomputer System Principles of Microcomputers

Department of Computer Science at the University of California

http://webster.cs.ucr.edu/---Website for assembly language studyhttp://webster.cs.ucr.edu/---Website for assembly language study

Page 7: Chapter One-- Introduction of Microcomputer System Principles of Microcomputers 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日

2023年4月19日 星期三 7

Chapter One-- Introduction of Microcomputer System Principles of Microcomputers

Page 8: Chapter One-- Introduction of Microcomputer System Principles of Microcomputers 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日

2023年4月19日 星期三 8

Chapter One-- Introduction of Microcomputer System Principles of Microcomputers

Page 9: Chapter One-- Introduction of Microcomputer System Principles of Microcomputers 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日

2023年4月19日 星期三 9

Chapter One-- Introduction of Microcomputer System Principles of Microcomputers

Which Edition is for Me? The Art of Assembly Language Programming is available in four e

ditions: a published edition that handles both Windows and Linux, a 32-bit electronic edition for Windows, a 32-bit electronic edition for Linux, and a 16-bit electronic edition for DOS.

Most PC owners will want to read the published edition as it covers both OSes in a generic fashion. The Windows and Linux on-line electronic editions are great for quick reference when the book is not available.

Most readers should avoid the DOS edition since DOS is essentially obsolete at this point. Unless you're taking a course or have a special need to write some DOS software, there is little reason to waste time learning about various DOS calls, segmentation, and other features that you'll never use under Windows or Linux.

The published edition has been professionally proofread and edited. Those wanting an edition with the fewest mistakes in an easy to read format should grab a copy of "The Art of Assembly" from their local bookstore.

Page 10: Chapter One-- Introduction of Microcomputer System Principles of Microcomputers 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日

2023年4月19日 星期三 10

Chapter One-- Introduction of Microcomputer System Principles of Microcomputers

Page 11: Chapter One-- Introduction of Microcomputer System Principles of Microcomputers 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日

2023年4月19日 星期三 11

Chapter One-- Introduction of Microcomputer System Principles of Microcomputers

Page 12: Chapter One-- Introduction of Microcomputer System Principles of Microcomputers 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日

2023年4月19日 星期三 12

Chapter One-- Introduction of Microcomputer System Principles of Microcomputers

王忠民 主编王忠民 王钰 王晓婕 编著

面 向 21 世 纪 高等学校计算机类专业系列教材

西安电子科技大学出版社

微型计算机原理 Principles of Microcomputers

Page 13: Chapter One-- Introduction of Microcomputer System Principles of Microcomputers 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日

2023年4月19日 星期三 13

Chapter One-- Introduction of Microcomputer System Principles of Microcomputers

胶印英文教

材“Principle of Microcomputer”

自编英文教材,西安邮电学院印制 2005 年

Page 14: Chapter One-- Introduction of Microcomputer System Principles of Microcomputers 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日

2023年4月19日 星期三 14

Chapter One-- Introduction of Microcomputer System Principles of Microcomputers

“ 《微型计算机原理》学习与实验指导” 王钰等编写西安电子科技大学出版社, 2004实

验指导

本课程教学辅助网站提供的“ 实验 CAI 课件”

Page 15: Chapter One-- Introduction of Microcomputer System Principles of Microcomputers 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日

2023年4月19日 星期三 15

Chapter One-- Introduction of Microcomputer System Principles of Microcomputers

why you want to learn this course? Maybe there are some reasons as

following• Your major requires a course in assembly language; i.e., y

ou’re here against your will.• A programmer where you work quit. Most of the source code

left behind was written in assembly language and you were elected to maintain it.

• Your boss has the audacity to insist that you write your code in assembly against your strongest wishes.

• Your programs run just a little too slow, or are a little too large and you think assembly language might help you get your project under control.

• You want to understand how computers actually work.• You’re interested in learning how to write efficient code.• You want to try something new.

Page 16: Chapter One-- Introduction of Microcomputer System Principles of Microcomputers 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日

2023年4月19日 星期三 16

Chapter One-- Introduction of Microcomputer System Principles of Microcomputers

What’s Wrong With Assembly Language Assembly language has a pretty bad reputation. The common impression about

assembly language programmers today is that they are all hackers or misguided individuals who need enlightenment. Here are the reasons people give for not using assembly language

• Assembly is hard to learn.• Assembly is hard to read and understand.• Assembly is hard to debug.• Assembly is hard to maintain.• Assembly is hard to write.• Assembly language programming is time consuming.• Improved compiler technology has eliminated the need for assembly

language.• Today, machines are so fast that we no longer need to use assembly. If

you need more speed, you should use a better algorithm rather than switch to assembly language.

• Machines have so much memory today, saving space using assembly is not important.

• Assembly language is not portable.

Page 17: Chapter One-- Introduction of Microcomputer System Principles of Microcomputers 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日

2023年4月19日 星期三 17

Chapter One-- Introduction of Microcomputer System Principles of Microcomputers

What’s Right With Assembly Language? An old joke goes something like this: “There are three reason

s for using assembly language: speed, speed, and more speed.” Even those who absolutely hate assembly language will admit that if speed is your primary concern, assembly language is the way to go. Assembly language has several benefits:

• Speed. Assembly language programs are generally the fastest programs around.

• Space. Assembly language programs are often the smallest.

• Capability. You can do things in assembly which are difficult or impossible in HLLs.

• Knowledge. Your knowledge of assembly language will help you write better programs, even when using HLLs.

Page 18: Chapter One-- Introduction of Microcomputer System Principles of Microcomputers 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日

2023年4月19日 星期三 18

Chapter One-- Introduction of Microcomputer System Principles of Microcomputers

Speed Assembly language is the uncontested speed champion among pr

ogramming languages. An expert assembly language programmer will almost always produce a faster program than an expert C programmer. While certain programs may not benefit much from implementation in assembly, you can speed up many programs by a factor of five or ten over their HLL counterparts by careful coding in assembly language; even greater improvement is possible if you’re not using an optimizing compiler. Alas, speedups on the order of five to ten times are generally not achieved by beginning assembly language programmers. However, if you spend the time to learn assembly language really well, you too can achieve these impressive performance gains.

Page 19: Chapter One-- Introduction of Microcomputer System Principles of Microcomputers 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日

2023年4月19日 星期三 19

Chapter One-- Introduction of Microcomputer System Principles of Microcomputers

space• Despite some people’s claims that programmers no longer hav

e to worry about memory constraints, there are many programmers who need to write smaller programs.

• Assembly language programs are often less than one-half the size of comparable HLL programs.

• Saving space saves money. Pure and simple. If a program requires 1.5 megabytes, it will not fit on a 1.44 Mbyte floppy.

• Most users put more large memory in their machines so they can run multiple programs at one time. The bigger a program is, the fewer applications will be able to coexist in memory with it. Virtual memory isn’t a particularly attractive solution either. With virtual memory, the bigger an application is, the slower the system will run as a result of that program’s size.

Page 20: Chapter One-- Introduction of Microcomputer System Principles of Microcomputers 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日

2023年4月19日 星期三 20

Chapter One-- Introduction of Microcomputer System Principles of Microcomputers

Capability• Capability is another reason people resort to assembly languag

e. • HLLs are an abstraction of a typical machine architecture. The

y are designed to be independent of the particular machine architecture. As a result, they rarely take into account any special features of the machine. If you want to use such features, you will need to use assembly language. A really good example is the input/output instructions available on the 80x86 microprocessors. These instructions let you directly access certain I/O devices on the computer. In general, such access is not part of any high level language. In assembly language you have no such restrictions.

• Anything you can do on the machine you can do in assembly language. This is definitely not the case with most HLLs.

Page 21: Chapter One-- Introduction of Microcomputer System Principles of Microcomputers 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日

2023年4月19日 星期三 21

Chapter One-- Introduction of Microcomputer System Principles of Microcomputers

knowledge• Now some of you may be thinking, “Gee, that would be wonder

ful, but I’ve got lots to do. My time would be better spent writing code than learning assembly language.” There are some practical reasons for learning assembly, even if you never intend to write a single line of assembly code.

• If you know assembly language well, you’ll have an appreciation for the compiler, and you’ll know exactly what the compiler is doing with all those HLL statements.

• Good assembly language programmers make better HLL programmers because they understand the limitations of the compiler and they know what it’s doing with their code. Those who don’t know assembly language will accept the poor performance their compiler produces and simply shrug it off.

Page 22: Chapter One-- Introduction of Microcomputer System Principles of Microcomputers 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日

2023年4月19日 星期三 22

Chapter One-- Introduction of Microcomputer System Principles of Microcomputers

Work hard on the assembly studying—you will get as much as you can imagine from it

• Yes, assembly language is definitely worth the effort.

• The only scary thing is that once you learn it really well, you’ll probably start using it far more than you ever dreamed you would. That is a common malady among assembly language programmers. Seems they can’t stand what the compilers are doing with their programs.

Page 23: Chapter One-- Introduction of Microcomputer System Principles of Microcomputers 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日

2023年4月19日 星期三 23

Chapter One-- Introduction of Microcomputer System Principles of Microcomputers

Table of the contentsSection One: Machine Organization• Chapter One Data Representation. • Chapter Two Boolean Algebra • Chapter Three System Organization• Chapter Four Memory Layout and Access Section Two: Basic Assembly Language• Chapter Five Variables and Data Structures • Chapter Six The 80x86 Instruction Set• Chapter Seven The UCR Standard Library• Chapter Eight MASM: Directives & Pseudo-Opcodes• Chapter Nine Arithmetic and Logical Operations• Chapter 10 Control Structures Chapter 11 Procedures and Functio

ns

Page 24: Chapter One-- Introduction of Microcomputer System Principles of Microcomputers 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日

2023年4月19日 星期三 24

Chapter One-- Introduction of Microcomputer System Principles of Microcomputers

Table of the contentsSection Three: Intermediate Level Assembly Language Programming

• Chapter 12 Procedures: Advanced Topics

• Chapter 13 MS-DOS, PC-BIOS, and File I/O

• Chapter 14 Floating Point Arithmetic

• Chapter 15 Strings and Character Sets

• Chapter 16 Pattern Matching

Section Four: Advanced Assembly Language Programming

Chapter 17 Interrupts, Traps, and Exceptions

• Chapter 18 Resident Programs

• Chapter 19 Processes, Coroutines, and Concurrency

Page 25: Chapter One-- Introduction of Microcomputer System Principles of Microcomputers 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日

2023年4月19日 星期三 25

Chapter One-- Introduction of Microcomputer System Principles of Microcomputers

Table of the contentsSection Five: The PC’s I/O Ports

• Chapter 20 The PC Keyboard

• Chapter 21 The PC Parallel Ports

• Chapter 22 The PC Serial Ports

• Chapter 23 The PC Video Display

• Chapter 24 The PC Game Adapter

Section Six: Optimization

• Chapter 25 Optimizing Your Programs

Section Seven: Appendixes

Page 26: Chapter One-- Introduction of Microcomputer System Principles of Microcomputers 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日 2015年8月30日

2023年4月19日 星期三 26

Chapter One-- Introduction of Microcomputer System Principles of Microcomputers

本章应补充内容• 冯 . 诺依曼计算机体系结构的基本思想• 计算机五大组成部分• 总线的概念• 计算机的基本工作过程

详见“中文 2”