Download presentation
Presentation is loading. Please wait.
1
The 8085 Assembly Language Chapter 3
2
The 8085 – Programming Languages
Computer program is a group of instructions that controls and direct the computer to do a specific task. These instruction are represented and processed inside the computer as binary data (Ones and Zeros). The user must write a program using one of the many programming languages. These languages can be grouped in three levels of programming, and they are: Machine Language. Assembly Language. High Level Language.
3
The 8085 – Machine Language Usually called Machine Instruction.
In this level the program instructions are written in binary form that the computer can understand and execute directly. At this level it is very difficult for the user to write or read a program.
4
The 8085 – Assembly Language
More convenient way for writing or reading a program by the user. Each machine instruction is given a simple short character string (name) called mnemonic on a one to one basis. These mnemonic instructions known as assembly language. Table 3.1 below shows a simple program written in assembly language and its equivalent machine instructions:
5
The 8085 – Assembly Language
In an assembly language the first term in the instruction such as MVI, MOV, … is known as "operation mnemonic" (Opcode). It details the operation to be performed by the processor. The second term specify a data, a register, or a memory location, is called Operand
6
The 8085 – High Level Language
Program instructions are written in a much closer to the English language. Languages such as C, BASIC, FORTRAN, PASCAL, Are examples of high- level languages.
7
The 8085 – Assembly Language
Each processor has its own assembly language. For example, the assembly language of the 8085 processor is different than that of Z80 or Motorola 6800 or any other processor of different structure. Throughout this course we will use the 8085 assembly language instructions. Its format is:
8
The 8085 – Instructions Types
Each instruction can generally be classified as being a member of one of the five groups, these are: 1. Data Transfer Instructions. 2. Data Manipulation Instructions. 3. Transfer of control Instructions. 4. Input/Output Instructions. 5. Machine control Instructions.
9
The 8085 – Instructions Types
1. Data Transfer instructions: This type of instructions move data between various processor registers or between registers and memory locations. Example MOV A, B Causes the contents of the source register B to be transferred to the destination register A.
10
The 8085 – Instructions Types
2. Data Manipulation instructions: This type of instruction perform arithmetic and logical operations on data that are either in a specified processor register or in a memory location. Example ADD B The above instruction finds the sum of the contents of register B and register A, then stores the result in register A the accumulator. All instructions in this group will normally modify processor flags.
11
The 8085 – Instructions Types
3. Transfer of control instructions: This type of instructions provides the computer with the ability to transfer from one sequence of operations to another, based on a variety of conditions. This operation is performed by changing the contents of the PC register to the address of the location of the new sequence. Some of these transfer of control instructions always force a jump to a new sequence, it is called an Unconditional branch or jump. Example JMP address Other jump is based on testing a specific condition in the flag status. This type is called Conditional branch or jump. Example JC address This instruction performs jump operation to the address shown if carry bit is equal to one.
12
The 8085 – Instructions Types
3. Transfer of control instructions: Another form of control transfer is a Subroutine call in which the control is transferred from a main program to a group of instructions elsewhere in memory, then after it is executed and ends, the control is returned to the original routine program. Example CALL SUB1 Causes control to transfer from main program to another subroutine called SUB1.
13
The 8085 – Instructions Types
4. Input/Output Instructions: This type of instructions move data between various processor registers or between registers and memory locations. Example OUT Address Causes the contents of register A to be transferred to output port whose address is specified in the instruction..
14
The 8085 – Instructions Types
5. Machine control Instructions: This type of instructions affects the state or mode of operation of the processor itself. Example NOP It causes the machine to wait through an instruction cycle.
15
The 8085 – Addressing Mode A data manipulation instruction requires three locations: two locations to specify the location of the values to be manipulated, which are the source addresses. The third to specify the location of the result which is the destination address. To simplify the CPU and the source code, the result of an operation is made to reside in one of the sources. Most microprocessors require only two addresses to be specified instead of three. As a result the type of addressing in a microprocessor is divided into four main addressing modes, these types of addressing modes are: Immediate Addressing. Register Addressing. Direct Addressing. Indirect Addressing.
16
The 8085 – Addressing Mode Immediate Addressing:
In this mode the data appears in the instruction itself. The data word is the source. Example MVI A,0F ;Loads the immediate data 0F in reg. A Example LXI H, ;Load the immediate data 2850hex in register pair HL ;The high byte 28 in reg. H, and the low byte 50 in reg. L Example ADI ;Adds the data 30 hex to the contents of reg. A
17
The 8085 – Addressing Mode Register Addressing:
In this mode the data moves between the internal processor registers. The data itself does not show in the instruction Example MOV A,B ;Copies the contents of register B into register A Example MOV C,A ;Copies the contents of register A into register C Example XCHG ;Exchange contents of HL registers with contents of DE registers
18
The 8085 – Addressing Mode Direct Addressing:
In this mode a word can be read from or written to a memory location. The address of the memory location is always specified in the instruction. Example STA ;Store contents of reg. A in memory location 2300 hex. Example LDA ;Load register A from memory location 2470. Example SHLD 16A3 ;store contents of register L in memory location 16A3 ;and contents of register H in memory location 16A4
19
The 8085 – Addressing Mode Indirect Addressing:
In this mode a register pair holds the address of a memory location. The contents of register pair indirectly address a memory location. Indirect addressing either reads the data from or writes the data to the memory location whose address is currently stored in the register pair HL. Whenever the letter M appears in the instruction, the HL register pair indirectly addresses the memory. The HL register pair acts as a pointer. Example LXI H, ;Point to memory location 1000 hex.. MVI M, ;Move data 22 into memory location 1000 hex. Example LDA H, ;Point to memory location 1000 hex MOV M, C ;Move data in register C to memory location 1850 hex. Example LXI H, ;Point to memory location 2280 hex.. MOV A, M ;Move data from memory location to register A.
20
The 8085 – Data Transfer Instructions Group:
Instructions are categorized into groups based on the types of data transfer between different registers or between registers and memory locations. This can be done using different types of addressing modes as: Transferring Data Using Immediate Addressing. Transferring Data Using Register Addressing. Transferring Data Using Direct Addressing. Transferring Data Using Indirect Addressing.
21
The 8085 – Data Transfer Instructions Group:
Transferring Data Using Immediate Addressing: Example: MVI A, 02 ;move immediate data 02 hex to register A Running the above instruction will result in moving the data 02 into register A. A B C D E H L SP PC
22
The 8085 – Data Transfer Instructions Group:
Transferring Data Using Immediate Addressing: Example: MVI A, 03 ;move immediate data 03 hex to register A MVI B, A1 ;move immediate data A1 hex to register B MVI L, 99 ;move immediate data 99 hex to register L Results in A, B, L, registers are: A B A1 C D E H L SP PC
23
The 8085 – Data Transfer Instructions Group:
Transferring Data Using Immediate Addressing: We can join two 8-bit registers to/from a register pair which can carry two bytes (16-bits). The registers which can be joined together are BC, DE, HL. We can load these register pairs with 2-bytes data or address such as: Example: LXI H, 2800 ;Load register pair HL with immediate data 2800. (HL) 2800 OR (L) 00 ;Loads register L with immediate data 00 hex, and (H) 28 ;Loads register H with immediate data 28 hex Results in registers HL are: A B C D E H L SP PC
24
The 8085 – Data Transfer Instructions Group:
Transferring Data Using Immediate Addressing: Example: LXI B, 2211 ;Load register pair BC with immediate data 2211. LXI D, F944 ;Load register pair DE with immediate data F944. Results in registers BC and DE are: A B C D F9 E H L SP PC
25
The 8085 – Data Transfer Instructions Group:
Transferring Data Using Immediate Addressing: Example: LXI H, 2211 ;Load register pair BC with immediate data 2211. LXI D, F944 ;Load register pair DE with immediate data F944. XCHG ;Exchange contents of register pair DE with contents of register pair HL. Results in registers HL and DE are: A B C D E H F9 L SP PC
26
The 8085 – Data Transfer Instructions Group:
Transferring Data Using Register Addressing: Example: MOV C, B ;move contents of register B to register C. (C) (B) MVI A, 04 ;move immediate data 04 hex to register A. MOV B, A ;move contents of register A to register B. MOV C, A ;move contents of register A to register C. MOV D, C ;move contents of register C to register D. Result in registers A, B, C, D are: A B C D E H L SP PC
27
The 8085 – Data Transfer Instructions Group:
Transferring Data Using Direct Addressing: This type involves transferring data between various registers and memory.
28
The 8085 – Data Transfer Instructions Group:
Transferring Data Using Direct Addressing: This type involves transferring data between various registers and memory.
29
The 8085 – Data Transfer Instructions Group:
Transferring Data Using Direct Addressing: This type involves transferring data between various registers and memory.
30
The 8085 – Data Transfer Instructions Group:
Transferring Data Using Direct Addressing: This type involves transferring data between various registers and memory.
31
The 8085 – Data Transfer Instructions Group:
Transferring Data Using Indirect Addressing: In this mode the instruction does not contain the actual memory address itself. It implies that the address is currently stored in the HL, BC, or DE registers pair. The high order byte of the address are stored in H, B, D registers. The low order byte are stored in L, C, E registers. The actual address is therefore obtained indirectly through the HL, BC, DE registers. These register pairs are called pointers. There are two types of indirect addressing: A. Register Indirect Addressing Mode. B. Immediate Register Indirect Memory Addressing Mode.
32
The 8085 – Data Transfer Instructions Group:
Transferring Data Using Indirect Addressing: A. Register Indirect Addressing Mode. When a data moved between any of the internal registers and a memory location and with the address stored in register pair HL. When the HL register pair is used, the letter M is used to refer to the memory.
33
The 8085 – Data Transfer Instructions Group:
Transferring Data Using Indirect Addressing: A. Register Indirect Addressing Mode. Other registers B, C, D, E, H, L can also be used with M
34
The 8085 – Data Transfer Instructions Group:
Transferring Data Using Indirect Addressing: A. Register Indirect Addressing Mode. Other registers B, C, D, E, H, L can also be used with M
35
The 8085 – Data Transfer Instructions Group:
Transferring Data Using Indirect Addressing: A. Register Indirect Addressing Mode. NOTE: If register pairs BC or DE are used as a pointer, then data is transferred from or to memory only through register A
36
The 8085 – Data Transfer Instructions Group:
Transferring Data Using Indirect Addressing: A. Register Indirect Addressing Mode. NOTE: If register pairs BC or DE are used as a pointer, then data is transferred from or to memory only through register A
37
The 8085 – Data Transfer Instructions Group:
Transferring Data Using Indirect Addressing: B. Immediate Register Indirect Memory Addressing Mode. The 8085 processor allows the immediate data to be moved into system memory location. The operation is done indirectly through HL register pair.
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.