Professional Documents
Culture Documents
8086 PROGRAMMING
PROGRAM DEVELOPMENT STEPS:
The following are six steps in the Program Development Cycle:
1. Analyze the problem: The computer user must figure out the problem, then decide how to resolve the
problem choose a program.
2. Design the program: A flow chart is important to use during this step of the PDLC. This is a visual diagram
of the flow containing the program. This step will help you break down the problem.
3. Code the program: This is using the language of programming to write the lines of code. The code is called
the listing or the source code. The computer user will run an object code for this step.
4. Debug the program: The computer user must debug. This is the process of finding the "bugs" on the
computer. The bugs are important to find because this is known as errors in a program.
5. Formalize the solution: One must run the program to make sure there are no syntax and logic errors. Syntax
are grammatical errors and logic errors are incorrect results.
6. Document and maintain the program: This step is the final step of gathering everything together. Internal
documentation is involved in this step because it explains the reason one might have made a change in the
program or how to write a program.
1-Byte
2-Byte
3-Byte
4-Byte
3-Byte
4-Byte
6-Byte
ASSEMBLER DIRECTIVES:
• Assembler directives are the instructions used by the assembler at the time of assembling a source program.
More specifically, we can say, assembler directives are the commands or instructions that control the
operation of the assembler.
• Assembler directives are the instructions provided to the assembler, not the processor as the processor has
nothing to do with these instructions. These instructions are also known as pseudo-instructions or pseudo-
opcode.
• The following the some of the assembler directives of the 8086 programming:
1. ASSUME
2. DB → Define Byte (8-bit) Same as DB & DW, but the difference is
3. DW → Define word (16-bit)
4. DD → Define double word (32-bit) • In DD → we are defining variable with 32 bits
5. DQ → Define quad word (64-bit) • In DQ → we are defining variable with 64 bits
6. DT → Define 10 bytes (80-bits) • In DT → we are defining variable with 80 bits
7. END
8. ENDP
9. ENDS
10. EQU
11. EVEN
12. EXTRN
13. GROUP
14. LABLE
15. NAME
16. OFFSET
17. ORG
18. PROC
19. PTR
20. PUBLC
21. SEGMENT 22. SHORT 23. TYPE
8. EVEN -
• This EVEN directive instructs the assembler to increment the location of the counter to the next
even address if it is not already in the even address. If the word is at even address 8086 can read a
memory in 1 bus cycle.
• If the word starts at an odd address, the 8086 will take 2 bus cycles to get the data. A series of words
can be read much more quickly if they are at even address. When EVEN is used the location counter
will simply incremented to next address and NOP instruction is inserted in that incremented location.
9. GROUP - The GROUP directive is used to group the logical segments named after the directive into
one logical group segment.
10. INCLUDE - This INCLUDE directive is used to insert a block of source code from the named file into the
current source module.
11. PROC - The PROC directive is used to identify the start of a procedure. The term near or far is used to
specify the type of the procedure.
Ex:
SMART PROC FAR ; This identifies that the start of a procedure named as SMART and instructs
the assembler that the procedure is far.
SMART ENDP ; This PROC is used with ENDP to indicate the break of the procedure.
14. TYPE - TYPE operator instructs the assembler to determine the type of a variable and determines the number
of bytes specified to that variable
Ex:
Byte type variable – assembler will give a value 1
Word type variable – assembler will give a value 2
Double word type variable – assembler will give a value 4
The fallowing flow chart will give the how the program is developed and executed
JUMPING CALLING
INSTRUCTIONS INSTRUCTIONS
CONDITIONAL
JUMP
INSTRUCTIONS
UN CONDITIONAL
JUMP
INSTRUCTIONS
• CALLING INSTRUCTIONS:
▪ These instructions are used to call a sub program located at some address.
▪ Whenever CALL instructions are execute, the present values of the registers, PSW, PC will saved in
the Stack memory.
▪ And now the Sub program will execute.
▪ After completion of the execution of the Sub program, again the controller return back to main program
by using the instruction RET.
▪ While retuning to the main program, the previously saved values of the registers, PSW, PC will be
retrieved from the stack memory.
▪ The fallowing are comes under the category of call instructions.
o CALL → Call a Subprogram at the specified address.
o RET → Return from the Subprogram to main program.
• JUMPING INSTRUCTIONS:
▪ These instructions are used to jump the execution from one instruction to another instruction.
▪ The Jumping instructions are again divided into two, those are
i. Unconditional Jumping Instructions
ii. Conditional Jumping Instructions.
i. UNCONDITIONAL JUMPING INSTRUCTIONS:
▪ These instructions are used to jump from one location to another location without checking any
condition.
▪ The following instructions will come under the category of unconditional jump instructions, those are
o JMP → Jump to the specified address location.