Sie sind auf Seite 1von 9

Session 8

Programming 8086 with


Arithmetic Co-processor - I





Page 82 Programming 8086 with Arithmetic Co-processor - I
Session Objectives

At the end of this session, the learner will be able to:

Recall the instructions of 8086 and 8087 processor
Create an application program using 8086 instruction set


Teaching Learning Material

Presentations
Data Sheets Of Intel 8086 And 8087 Co-Processors
PC With 8086 Simulator and Compiler (TASM And MASM)



























Programming 8086 with Arithmetic Co-processor - I Page 83
Session Plan

Time
(in min)
Content
Learning Aid /
Methodology
Faculty
Approach
Typical Student
Activity
Skill/Competency
Developed
20
Recap: Instruction
Set of 8086 & 8087
Co-processor
Do and Explain
Activity
Facilitates
Prepares
Presents
Knowledge
Comprehension
Analysis
Application
35

Programming 8086
with 8087 Co-
processor

Case study
PC with
Compiler

Facilitates

Participates
Presents
Knowledge
Comprehension
Application
Analysis
Synthesis
Logical
Mathematical
Intrapersonal
5
Conclusion and
Summary
Presentation
Facilitates
Explains
Presents
Listens
Analysis
Synthesis
Intrapersonal



Note :

This session should be conducted in a laboratory which has Personal
Computers with 8086 simulator and compiler (examples: TASM and MASM
simulators) and LCD projector.












Page 84 Programming 8086 with Arithmetic Co-processor - I

Session Inputs

Recap: Instruction Set of 8086 and 8087 Co-processor


Our learners are familiar with 8086 and 8087 architecture and
instruction set; to recap we could conduct an activity.

Suggested Activity: Do and Explain

Form 5 teams of learners and assign the titles given:
A. Architecture and programming model of 8086 processor
B. Data transfer instructions of 8086
C. Arithmetic and logic instructions of 8086
D. Program control instructions of 8086
E. 8087 co-processor functional block diagram and Instructions

Team A will be provided with a Computer Motherboard, the team members
have to identify the processor, memory, other chips and interfaces in the
board and draw a block diagram for the same.

Team B shall open the TASM or MASM simulator and list the data transfer
instructions of 8086 along with their explanations by searching the help
document.

Team C shall open the TASM or MASM simulator and list the arithmetic and
logic instructions of 8086 along with their explanations by searching the help
document.

Team D shall open the TASM or MASM simulator and list the program control
instructions of 8086 along with their explanations by searching the help
document.

Team E shall draw the functional blocks of 8087 and identify the block
functionalities.

Now each team shall present their findings.



Programming 8086 with Arithmetic Co-processor - I Page 85


Now we could understand the programming concepts in 8086 and 8087
processors.

Programming 8086 Processor with 8087 Co-processor

In view of improving the programming skills of learners, we could
lead them to build application code for specific case studies.
We can prepare a design document for a case study that includes:
A problem statement
Necessary specifications
Diagrams
Data sheets

The 5 teams will be provided with the design document. The teams shall:
Prepare a flow chart for the logic to be implemented
Write an algorithm
Develop an assembly language code using 8086 and 8087 instruction sets
Compile and show the output

A typical case study is presented for reference.

Problem statement
Write an Assembly language program using Intel 8087 co-processor to
calculate the square root of an integer stored in a memory location.
Algorithm
Step 1: Take the square root of an integer stored in memory at address [210]
Step 2: A 16-bit integer stored in memory at address 210 is read using the
"Integer Load" (FILD) instruction.
Step 3: This number is stored internally in the 8087 as an 80-bit floating point
value. After taking the square root (FSQRT), the floating point result is stored
at address 200 for inspection.




Page 86 Programming 8086 with Arithmetic Co-processor - I
Assembly Language Program
- a 100
FI LD wor d [ 210]
FSQRT
FSTP qwor d [ 200]
I NT 20

- e 210 ; Ent er t he val ue 0005 as a 16- bi t i nt eger
3AAO: 0210 00. 05 00. 00 ; ent er t he val ue 05 at addr ess 210
; and t he val ue 00 at addr ess 211

- g ; go! r un t he pr ogr am

- d 200
3AA0: 0200 A8 F4 97 9B 77 E3 01 40
3AA0: 0210 05 00

The 64- bi t val ue of squar e r oot 5 r eads 4001E3779B97F4A8
The 16- bi t val ue of t he i nt eger 5 r eads 0005

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CHECK: 400 = exponent = 3FF + 1, meani ng 2^1
1E. . . = mant i ssa = . 00011110. . .
( i mpl i ed l eadi ng 1) = 1. 00011110 x 2^1
= 10. 0011110
= 2 + 1/ 8 + 1/ 16 + 1/ 32 + 1/ 64 = 2. 234375
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

We could validate the correctness of the code and verify the output of the
program. Using the same program also find the square roots of 9 (0009H)
and 169 (00A9H).

Conclusion


To conclude this session, we can project (using LCD projector) the
program developed by the teams and display it to the other teams
and also execute the respective codes to check the correctness.





Programming 8086 with Arithmetic Co-processor - I Page 87
Summary

In this session, we learnt to:

Utilize the instruction set of 8086 processor and 8087 co-processor for
specific applications.
Build a flow chart for the application.
Write an Assembly language code for 8086 processor.
Implement and execute the code in 8086 simulator.
Analyze, explain and present the program developed.


























Page 88 Programming 8086 with Arithmetic Co-processor - I
Assignments

Develop a procedure that takes as input a single precision number
and stores it in EBX register. Now multiply its contents n number of times
and store the result in register EBX as a singleprecision floating-point
number. You must use memory to accomplish this task.



















Programming 8086 with Arithmetic Co-processor - I Page 89
Notes

Das könnte Ihnen auch gefallen