Department of Electrical and Electronic Engineering
Bangladesh University of Engineering and Technology
Course No.: EEE 316 Course Name: Microprocessor and Interfacing Lab
Group No.: 05
Experiment No.: 01 Experiment Name: Familiarization with MDA8086 and MTS86C
Microprocessor Trainers.
Date of Performance: 19/11/2013 Date of Submission: 26/11/2013
Name: Md.
Ayaz Masud
Student No.: 0906021 Level: 3 Term: 2 Section:
A1
Objectives: The main objectives of this experiment are Familiarization with MDA8086 trainer Using them for Assembly programming Making absolute program from assembly program Communicating between trainer board and PC
Apparatus:
MDA8086 Trainer Or MTS86C Trainer Computer
Problem-1: ADD
Adding two hexadecimal numbers and checking the sum.
Code:
CODE SEGMENT ASSUME CS:CODE ,DS: code ; ORG 1000H ;
MAIN:MOV AX,CS MOV DS,AX ;
MOV AX,Data1 ADD AX,Data2 MOV Data3,AX ;
MOV AH, 4CH INT 21H ; ORG 1500H Data1 DW 1000H ORG 1600H Data2 DW 1300H ORG 1700H Data3 DW ?
CODE ENDS END MAIN Output:
The inputs in the code were 1000H and 1300H and the output was supposed to be gotten from address 1451:1700 is 2300H. DATA1 at 1451:1500 DATA2 at 1451:1600
DATA3 at 1451:1700
So the addition was performed correctly.
Problem-2: Fibonacci Number Generation
Returning the n-th Fibonnaci number.
Code:
CODE SEGMENT assume CS:CODE,DS:CODE ; ORG 1000H ; main:MOV AX,CS MOV DS,AX ; MOV CX,ind LOOP1: MOV AX,f0 ADD AX,f1 MOV BX,f1 MOV f1,AX MOV f0,BX LOOP LOOP1 ;
MOV AH,4CH int 21H
ORG 1600H f0 DW 0H ORG 1620H f1 DW 1H ORG 1640H ind DW 9H
CODE ENDS END END MAIN
Output:
The above three figures show that our program has returned us the 7th , 8th and 9th Fibonacci number. 1451:1640 holds the index And 1451:1600 holds the corresponding Fibonacci number. And 1451:1620 holds the following Fibonacci number.
Question-Answer:
Why should you need to copy the contents of CS to Ds? - The 8086 has 20-bit addressing, but only 16-bit registers. To generate 20-bit addresses, it combines a segment with an offset. The segment has to be in a segment register (CS, DS, ES, or SS). One then generate an offset (as an immediate value, or the contents of another register or two). So, before one can make any meaningful use of a segment register, one first have to load it with the (top 16 bits of) the address of the data he cares about.
Discussions:
In this experiment we have been introduced with MDA board and Assembly programming. We have solved a problem in the lab and completed the other elsewhere. That is why we could load the 1st program in the MDA board in the lab. We also learnt how to compile these codes in our own computes using Command windows.