Wolaita Sodo University School of Informatics Department of
- Slides: 64
Wolaita Sodo University School of Informatics Department of Computer Science Microprocessor and Assembly Language Programming By Arba A. March, 2020 Wolaita sodo, Ethiopia 10/23/2021 1
Chapter -1 Introduction to Microprocessor and Computer What is microcomputer? A Microcomputer is a small, relatively inexpensive digital computer with a microprocessor as its central processing unit (CPU). It includes a microprocessor, memory, and minimal input/output (I/O) circuitry mounted on a single printed circuit board. 10/23/2021 2
Microcomputer block diagram Figure 1: Microcomputer block diagram 10/23/2021 3
Microcomputer block diagram…. 10/23/2021 4
Microcomputer … v. The control unit(CU) coordinates the sequencing of steps involved in executing machine instructions. v. The arithmetic logic unit(ALU) performs arithmetic operations such as addition and subtraction and logical operations such as AND, OR, and NOT. v. The clock synchronizes the internal operations of the CPU with other system components. 10/23/2021 5
Microcomputer … v. The memory storage unit is where instructions and data are held while a computer program is running. v. The storage unit receives requests for data from the CPU, transfers data from random access memory (RAM) to the CPU, and transfers data from the CPU into memory. v. All processing of data takes place within the CPU, so programs residing in memory must be copied into the CPU before they can execute. 10/23/2021 6
Microcomputer … v. A bus is a group of parallel wires that transfer data from one part of the computer to another. v. A computer system usually contains four bus types: data, I/O, control, and address. v. The data bus transfers instructions and data between the CPU and memory. v. The I/O bus transfers data between the CPU and the system input/output devices. 10/23/2021 7
Microcomputer … v. The control bus uses binary signals to synchronize actions of all devices attached to the system bus. v. The address bus holds the addresses of instructions and data when the currently executing instruction transfers data between the CPU and memory. 10/23/2021 8
10/23/2021 9
What is assembly language programming? An assembly language is a low-level programming language for microprocessors and other programmable devices. An assembly language implements a symbolic representation of the machine code needed to program a given CPU architecture. 10/23/2021 10
What is microprocessor? Microprocessor is a central processing unit on a single integrated circuit containing millions of very small components including transistors, registers and diodes which works together. The CPU is attached to the rest of the computer via pins attached to the CPU socket in the computer’s motherboard. Most pins connect to the data bus, the control bus, and the address bus. 10/23/2021 11
Examples of Intel microprocessors Name Word length Maximum memory size Number of pins Number of instructions 4004 4 -bit 640 bytes 16 - 8008 8 -bit 16 KB 18 66 8080 8 -bit 64 KB 40 111 8085 8 -bit 64 KB 40 113 8086 16 -bit 1 MB 40 133 Table 1: Examples of Intel microprocessors 10/23/2021 12
The 8086 CPU is divided into two independent functional units: 1. Bus Interface Unit (BIU) 2. Execution Unit (EU) 10/23/2021 13
Features of 8086 Microprocessor: 1. Intel 8086 was launched in 1978. 2. It was the first 16 -bit microprocessor. 3. This microprocessor had major improvement over the execution speed of 8085. 4. It is available as 40 -pin Dual-Inline-Package (DIP). 5. It is available in three versions: a. 8086 (5 MHz) b. 8086 -2 (8 MHz) c. 8086 -1 (10 MHz) 6. It consists of 29, 000 transistors. 10/23/2021 14
8086…. Bus Interface Unit (BIU) The function of BIU is to: v. Fetch the instruction or data from memory. v. Write the data to the port. v�Read data from the port. 10/23/2021 15
8086… Instruction Queue 1. To increase the execution speed, BIU fetches as many as six instruction bytes ahead to time from memory. 2. All six bytes are then held in first out 6 byte register called instruction queue. 3. Then all bytes have to be given to EU one by one. 4. This pre fetching operation of BIU may be in parallel with execution operation of EU, which improves the speed execution of the instruction. 10/23/2021 16
8086… Execution Unit (EU) The functions of execution unit are: v. To tell BIU where to fetch the instructions or data from. v. To decode the instructions. v. To execute the instructions 10/23/2021 17
8086…. v. EU has 16 -bit ALU, which can perform arithmetic and logical operations on 8 -bit as well as 16 -bit. General Purpose Registers of 8086 v. These registers can be used as 8 -bit registers individually or can be used as 16 -bit in pair to have AX, BX, CX, and DX. • AX Register: AX register is also known as accumulator register that stores operands for arithmetic operation like divided, rotate. 10/23/2021 18
8086… 2. BX Register: This register is mainly used as a base register. It holds the starting base location of a memory region within a data segment. 3. CX Register: It is defined as a counter. It is primarily used in loop instruction to store loop counter. 4. DX Register: DX register is used to contain I/O port address for I/O instruction. 10/23/2021 19
8086… • Additional registers called segment registers generate memory address when combined with other in the microprocessor. • In 8086 microprocessor, memory is divided into 4 segments as follow: • Code Segment (CS): The CS register is used for addressing a memory location in the Code Segment of the memory, where the executable program is stored. 10/23/2021 20
8086 Data Segment (DS): The DS contains most data used by program Stack Segment (SS): SS defined the area of memory used for the stack. Extra Segment (ES): ES is additional data segment that is used by some of the string to hold the destination data. 10/23/2021 21
Special purpose registers • Flags register - determines the current state of the microprocessor. Flags register is modified automatically by CPU after mathematical operations, this allows to determine the type of the result, and to determine conditions to transfer control to other parts of the program. 10/23/2021 22
Addressing modes Addressing mode refers to the specification of the location of data required by an operation Most assembly language instructions require operands to be processed. An operand address provides the location where the data to be processed is stored. Some instructions do not require an operand, whereas some other instructions may require one, two or three operands. 10/23/2021 23
Pentium supports three fundamental addressing modes: Register addressing mode ∗ Operands are located in registers ∗ It is the most efficient addressing mode Immediate addressing mode ∗ Operand is stored as part of the instruction » This mode is used mostly for constants Memory addressing mode 10/23/2021 24
Instructions Instruction is a statement that becomes executable when a program is assembled. Instructions are translated by the assembler into machine language bytes, which are loaded and executed by the CPU at runtime. 10/23/2021 25
An instruction contains four basic parts: Ø Label (optional) Ø Instruction mnemonic (required) Ø Operand(s) (usually required) Ø Comment (optional) 10/23/2021 26
Instruction Mnemonic v. An instruction mnemonic is a short word that identifies an instruction. v. In English, a mnemonic is a device that assists memory. v. Similarly, assembly language instruction mnemonics such as mov, add, and sub provide hints about the type of operation they perform 10/23/2021 27
Following are examples of instruction mnemonics: 10/23/2021 28
Operands Assembly language instructions can have between zero and three operands, each of which can be a register, memory operand, constant expression, or input-output port. 10/23/2021 29
The following table contains several sample operands: 10/23/2021 30
• Following are examples of assembly language instructions having varying numbers of operands. • The STC instruction, for example, has no operands: 10/23/2021 31
ü In a two-operand instruction, the first operand is called the destination. ü The second operand is the source. In general, the contents of the destination operand are modified by the instruction. ü In a MOV instruction, for example, data is copied from the source to the destination. 10/23/2021 32
ü The IMUL(signed multiply) instruction has 3 operands, in which the first operand is the destination, and the following 2 operands are source operands: imul eax, ebx, 5 ü In this case, EBX is multiplied by 5, and the product is stored in the EAX register 10/23/2021 33
Comments • Comments are an important way for the writer of a program to communicate information about the program’s design to a person reading the source code. 10/23/2021 34
Comments can be specified in two ways: Single-line comments, beginning with a semicolon character (; ). All characters following the semicolon on the same line are ignored by the assembler. Block comments, beginning with the COMMENT directive and a user -specified symbol. All subsequent lines of text are ignored by the assembler until the same userspecified symbol appears. 10/23/2021 35
For example: 10/23/2021 36
Data movement instructions • Data movement (transfer) instructions move data from one place, called the source operand, to another place, called the destination operand. • Data movement instructions can be grouped into loads, stores, moves, and immediate loads. 10/23/2021 37
• Load instructions move data from memory to registers. • Store instructions move data from registers to memory. • Move instructions move data from one register to another. 10/23/2021 38
Arithmetic Instructions • These instructions are used to perform arithmetic operations like addition, subtraction, multiplication, division, etc. • Following is the list of instructions under this group – • ADD − Used to add the provided byte to byte/word to word. • ADC − Used to add with carry. 10/23/2021 39
INC − Used to increment the provided byte/word by 1. SUB − Used to subtract the byte from byte/word from word. SBB − Used to perform subtraction with borrow. DEC − Used to decrement the provided byte/word by 1. CMP − Used to compare 2 provided byte/word. MUL − Used to multiply unsigned byte by byte/word by word. IMUL − Used to multiply signed byte by byte/word by word. DIV − Used to divide the unsigned word by byte or unsigned double word by word. IDIV − Used to divide the signed word by byte or signed double word by word. 10/23/2021 40
Program control instructions Ø The program control instructions direct the flow of a program and allow the flow to change. Ø A change in flow often occurs after a decision made with the CMP or TEST instruction is followed by a conditional jump instruction. 10/23/2021 41
• Jump (JMP) instruction allows the programmer to skip sections of a program and branch to any part of the memory for the next instruction. 10/23/2021 42
v. Conditional jump instructions test the following flag bits: sign (S), carry (C), overflow(O), etc. v. If the condition under test is true, a branch to the label associated with the jump instruction occurs. v. If the condition is false, the next sequential step in the program executes 10/23/2021 43
10/23/2021 44
CALL instruction • The CALL instruction transfer the flow of the program to the procedure. 10/23/2021 45
IRET instruction • An interrupt is either a hardware-generated CALL (externally derived from a hardware signal) or a software-generated CALL (internally derived from the execution of an instruction or some other internal event) that allow normal program execution to be interrupted (stopped). 10/23/2021 46
• In response to an interrupt, the microprocessor stops execution its current program and calls a procedure called interrupt service procedure (ISP). • An IRET instruction at end of the interruptservice procedure returns execution to the interrupted program. 10/23/2021 47
HLT (Halt) instruction • HLT instruction stops the execution of the program. There are two ways to exit of HLT state • (1) By an interrupt. • (2) By a hardware reset. 10/23/2021 48
WAIT instruction • Wait instruction monitors the ���� pin of 8086 microprocessor. • If WAIT instruction executes while ������� pin is 1(high), nothing will happen. • If WAIT instruction executes while ������� pin is low microprocessor waits until ���� pin becomes 1(high) 10/23/2021 49
Programming microprocessor • Microprocessors are programmable devices that can take input signals, perform logic operations and provide output signals. • Steps of programming the microprocessor are listed below. 10/23/2021 50
STEPS Step-1 • Purchase a microprocessor, available from many manufacturers and commonly found online or from an electronics store Step-2 • Write the program in the Integrated Development Environment (IDE) software for your microprocessor, which will compile the code into a language the machine can understand 10/23/2021 51
Step-3 v. Test the program using the IDE simulation package. Once you have embedded the program into your microprocessor, you will find it extremely difficult to debug and find errors Step-4 v. Embed your program onto your microprocessor. 10/23/2021 52
ARITHMETIC COPROCESSOR v. A coprocessor is a chip that works side-by-side with the computer's main processor (the chip called the central processing unit, or CPU). v. A coprocessor is installed to reduce the burden on a computer's CPU and thus free it for more general duties such as transferring data and handling multiple tasks 10/23/2021 53
v. The coprocessor handles some of the more specialized tasks, such as doing math calculations or displaying graphics on the screen Example for coprocessor • Intel 8087 The Intel 8087, announced in 1980, was the first x 87 floating-point coprocessor for the 8086 line of microprocessors. 10/23/2021 54
v. The purpose of the 8087 was to speed up computations for floating-point arithmetic, such as addition, subtraction, multiplication, division, and square root. v. It also computed transcendental functions such as exponential, logarithmic or trigonometric calculations. 10/23/2021 55
Functions of coprocessor v. A coprocessor may not be a general-purpose processor in its own right. v Coprocessors cannot fetch instructions from memory, execute program flow control instructions, do input/output operations, manage memory, and so on. v. The coprocessor requires the host (main) processor to fetch the coprocessor instructions and handle all other operations aside from the coprocessor functions. 10/23/2021 56
Memory Interface What is interface? v. Interface is the path for communication between two components. Interfacing is of two types, vmemory interfacing and v. Input/output interfacing. 10/23/2021 57
Memory Interfacing v. When we are executing any instruction, we need the microprocessor to access the memory for reading instruction codes and the data stored in the memory. v. For this, both the memory and the microprocessor requires some signals to read from and write to registers. 10/23/2021 58
I/O Interfacing v. There are various communication devices like the keyboard, mouse, printer, etc. v. So, we need to interface the keyboard and other devices with the microprocessor by using latches and buffers. v. This type of interfacing is known as I/O interfacing. 10/23/2021 59
Block diagram for memory and I/O interfacing. 10/23/2021 60
Ways of Communication − Microprocessor with the Outside World? • There are two ways of communication in which the microprocessor can connect with the outside world. • Serial Communication Interface • Parallel Communication interface 10/23/2021 61
Serial Communication Interface − v. In this type of communication, the interface gets a single byte of data from the microprocessor and sends it by bit to the other system serially and vice-a-versa. 10/23/2021 62
Parallel Communication Interface − q. In this type of communication, the interface gets a byte of data from the microprocessor and sends it by bit to the other systems in simultaneous (or) parallel fashion and vice-aversa. 10/23/2021 63
Reading assignment Computer organization • Memory • CPU • The 80 x 86 family of CPUs • Interrupts • Registers 10/23/2021 64
- Wolaita sodo university departments
- Armida sodo
- Kupé skloňování
- Radis utm
- Department of land surveying and geo-informatics
- Belarusian university of informatics and radioelectronics
- Gmu health informatics
- School of computing and informatics
- School of computing and informatics
- Department of law university of jammu
- Department of geology university of dhaka
- University of padova psychology department
- University of bridgeport it department
- Isabel darcy
- Sputonik
- Texas state majors
- Department of information engineering university of padova
- Information engineering padova
- Manipal university chemistry department
- Syracuse university psychology department
- Jackson state university finance department
- Columbia university department of computer science
- Msu physics and astronomy
- Columbia university cs department
- University of sargodha engineering department
- Claudia arrighi
- Observational health data sciences and informatics
- Nursing informatics and healthcare policy
- Introduction to medical informatics
- Emily navarro uci
- In4matx 43 uci
- Supply chain informatics
- Python for informatics
- Dikw examples in nursing
- Supply chain informatics
- Python for informatics: exploring information
- Python for informatics
- Python for informatics
- Medical informatics definition
- Health informatics
- Poc informatics
- Nursing informatics theories, models and frameworks
- Python for informatics
- Pharmacy informatics definition
- Asc code
- Social informatics definition
- Chapter 26 informatics and documentation
- Career skills in health informatics chapter 2
- History of pharmacy informatics
- History of pharmacy informatics
- Biomedical informatics definition
- Va office of health informatics
- Pitt health informatics
- Olympiad in informatics
- Goals of nursing informatics
- Hong kong olympiad in informatics
- Definition of health management information system
- Health informatics courses uk
- Health informatics career framework
- Financial informatics
- Vtsdb
- Business informatics
- Iwcims
- Journal of american medical informatics association
- What is informatics