You are on page 1of 21

Name : Divya Prakash

Branch : I.T.
19U03057
Microprocessor and Microcontroller

LAB 1
1. Title – Study of various parts of 8085 Microprocessor

a) Write an ALP to demonstrate data transfer between internal registers of


8086
b) Write an ALP to demonstrate the usage of external memory by reading /
writing a byte from / to memory
c) Write an ALP to demonstrate the usage of stack by writing / reading one
word from / to top of stack. Initialize the stack to some address other than
the default one
d) Write an ALP to demonstrate the working of various flag bits in Flag
Register

2. Practical Significance – We are able to transfer data between internal


registers of 8086.We are able to know the usage of external memory by
reading/writing a byte from/to memory.We are able to use Stack to store
data sequentially in default memory or any other location we want.We are
able understand the working of various flag registers.

3. Practical Outcomes – The experiment resulted in transfer of data


between internal registers,we read and wrote data from external
memory,initialized stack and learned about flag registers.

4. Skills to be developed – After doing this experiment I am well aware


about the transfer of data between registers.I am also aware about reading
and writing data in an external memory.I am also aware about certain
operations of Stack and I now know the significance of flag registers.
5. Theoretical Background –
Microprocessor consists of an accumulator (A 8 bits), BC DE HL register
(8 bit each, 16 combined). Flag register of 8 bits with five 1 bit register useful
and three don’t care registers. Used flag registers - Carry register (C) that
contains carry and borrow, Parity register (P) that maintains the odd parity in
microprocessor, Zero register (Z) which indicates whether an operation result is
zero, Auxiliary Carry (AC) that contains the carry generated by the lower nibble
and last is Sign bit register (S) that indicates subtraction of a number from its
smaller number. We can use the external 64 bits memory M to load and store
bigger data than the register size. HL is pointer register that can use the M
register while BC and DE registers can’t use it because they are not pointer
registers. Stack Pointer that is implemented from the bottom-most memory
location, i.e., FFFF. We can even initialize the stack location using the SPHL
command. Whatever you will put in HL register will be copied to SP register
using this command.

6. Experimental Setup – We need GNUSim 8085 editor.

7. Precautions – No such precaution is necessary.All you need is good


knowledge of the GNUSim 8085 software and Basic commands.

8. Procedure / Instructions – Write the program in GNUSim 8085 editor


and to execute it go to Assembler--> Execute .Or simply press F9.

9. Observations –
10.Calculations – No such calculations needed.

11.Results – No such output result.

12.Interpretation of results –N/A


13.Conclusions –We have a clear understanding of Data transfer between
registers,Read/write operations on memory,Operations on stack and
significance of flag registers.

14.Sample Questions –
1. Why do we say that 8085 is an 8 bit microprocessor?
Ans: We say 8085 is an 8 bit processor because its data
bus size is of 8 bits.
2. What do you mean by little endian format of data
exchange?
Ans:-When least significant bytes are stored before most
significant bytes.

---------------------------------------------------------------------------
---------------------------------------------------------------------------
Name:Divya Prakash
Branch:I.T.
19U03057
Microprocessor and Microcontroller

LAB 2
1. Title – Study of conditional and unconditional jump and call instructions
in 8085 Microprocessor

a) Write an ALP to calculate the first 10 numbers of Fibbonaci Series and


store them in external memory of 8085 by forming loops using
conditional jump instructions
b) Write an ALP to create a subroutine that multiplies two numbers and
gives output as result.
c) Write an ALP to add two 16 bit numbers (with and without using DAD
command)
d) Write an ALP to fill register B with 01H if the contents at external
memory location 3000H & 4000H are equal. Otherwise fill B with 02H

2. Practical Significance –The experiment signifies the use of Loops,if


statements,call statements and return statements which are widely used in
Assembly Language programming.DAD is a double addition command
that performs addition for 16 bit inspite the fact that 8085 is a 8bit
microprocessor.

3. Practical Outcomes – Loops can be used to repeatedly call a set of


instruction till a certain condition is met.DAD commands can be used to
perform 16bit addition.Interrupts can be used both with Hardware and
Software as interrupts.

4. Skills to be developed – The skills I have developed is Understanding of


Loops.Also I got to know about jump,call and return statements.I now
know the use of DAD command.I also learned about interrupt and
subroutines.
5. Theoretical Background – Microprocessor 8085 is instructed to execute
certain set of instructions repeatedly to execute a particular task number
of times by using loops. Counting technique allows programmer to count
how many times the instruction/set of instructions are
executed.Indexing allows programmer to point or refer the data stored
in sequential memory locations one by one.
Interrupt is a signal emitted by hardware or software when a process or an
event needs immediate attention. Interrupts are of two types software and
hardware.
Subroutines are routines made up of a sequence of instructions that can
receive data, process that data, and return a value. The routines can be
internal or external. It helps decomposing a complex program to simpler
programs.
The jump instruction transfers the program sequence to the memory
address given in the operand based on the specified flag. Jump
instructions are 2 types: Unconditional Jump Instructions and Conditional
Jump Instructions.
The call instruction transfers the program sequence to the memory
address given in the operand. They are also of two types conditional and
unconditional.
The 8085 microprocessor 8 bit addition instructions are used like ADD and
ADC and addition is performed using two steps. First lower byte addition
using ADD instruction and then higher byte addition using ADC instruction.
And we can even do 16 bit operation using DAD command that is 16 bit
addition instruction. DAD is mnemonic which stands for Double Add.

6. Experimental Setup –We need a GNUSim 8085 application.

7. Precautions – The reset has five options choose wisely the one which is
required. It may delete even those data which are useful to you. The
gnusim8085 don’t work properly with interrupts so you can use Junín’s
simulator.

8. Procedure / Instructions – Write code in GNUSim 8085 editor.


To execute,Go to Assembler-->Execute.

9. Observations –
10.Calculations –No such Calculations required.

11.Results – No result obtained.

12.Interpretation of results – No result obtained.

13.Conclusions – Loops can be used to repeatedly call a set of instruction


till a certain condition is met.DAD commands can be used to perform
16bit addition.Interrupts can be used both with Hardware and Software as
interrupts.

14.Sample Questions –
1. How do you implement loop in 8085 ALP?
Ans:-Using JMP(jump) command,we can jump to
particular instruction any number of time.
2. How do you implement if-else statement in 8085 ALP?
– explain with an example and code.
Ans:-If Else can be implemented in 8085 microprocessor
using conditional jump statements, conditional call
statements and conditional return statements.
Example- JC that jumps on carry, JNC Jumps on no carry,
etc.
Code-
MVI A,05H
MVI B,08H
SUB B
CZ Yes
CNZ No
HLT

Yes: MVI B,03H


RET
No: MVI B.02H
RET
; This will update B to 03 if subtraction gives zero value
else will update it to 02. CZ means Calls if zero flag is 1.
CNZ means Call if zero flag is 0.
Name:Divya Prakash
IT
19U03057
Microprocessor and Microcontroller

LAB 3
1. Title – Study of interrupts in 8085 Microprocessor

a) Write an ALP to demonstrate the usage of software interrupt RST 4 in


8085 ALP clearly illustrating the code and related concepts.

1. Practical Significance – Software Interrupts are those which are inserted in


between the program which means these are mnemonics of microprocessor.
There are 8 software interrupts in 8085 microprocessor. They are – RST 0,
RST 1, RST 2, RST 3, RST 4, RST 5, RST 6, and RST 7.

2. Practical Outcomes – RST 4 is an example instruction of software


interrupts mentioned above. It is a 1-Byte instruction. It is functionally same as
CALL 0020H (or 0032D). It causes a branch to subroutine starting from
memory address 0020H.

3. Skills to be developed – After performing the lab questions I covered the


software interrupts and its different instructions.

4. Theoretical Background – In 8085 Instruction set, RST n is actually


standing for “Restart n” where n has a value from 0 to 7 only. Thus the eight
possible RST instructions are there, e.g. RST 0, RST 1… RST 7. They are 1-
Byte call instructions. Functionally RST n instruction is similar with RST n =
CALL n*8.

For example, let us consider RST 4 is functionally equivalent to CALL 4*8, i.e.
CALL 32 = CALL 0020H.
This causes a branch to subroutine starting from 0020H to 0027H. So at the
most only 8 locations are available for the subroutine, which is too small to
keep subroutine bodies. So in the program I overcome this by branching to a
subroutine at other memory location, like 6000H. I achieved it by using the
combination of RST 4 and JMP 6000H instruction at the 0020H memory
location.

5. Experimental Setup – GNUsims8085, JUBIN’S simulator

6. Precautions – The reset has five options choose wisely the one which is
required. It may delete even those data which are useful to you. The
gnusim8085 don’t work properly with interrupts so you can use Jubin’s
simulator.

7. Procedure / Instructions –Write the code in the editor and using the
execute option inside the assembler you can run your code all at once. You
can even use step in option inside debug to run your code line by line for
better understanding.
8. Observations –

9. Calculations – N/A

10.Results – N/A

2. Interpretation of results – N/A

11. Conclusions – RST 4 is an example instruction of software interrupts


mentioned above. It is a 1-Byte instruction. It is functionally same as CALL
0020H (or 0032D). It causes a branch to subroutine starting from memory
address 0020H.
3.

4. Sample Questions –
1. What do you do when interrupt service routine is more
than 8 byte ? Is it a problem in first place in 8085?
Ans:- Each interrupt routine is placed at a memory location 8
bytes after the previous interrupt routine. Therefore, if service
routine exceeds 8 bytes then it might interfere with other
interrupt service routine. We use the JMP command to move
to some other memory location to prevent this issue.

2. Explain what is page 0 & why is it not recommended


to write any user defined code there?
Ans:- Page 0 refers to the memory locations starting with 00.
These memory locations are meant for interrupt service
routines, therefore it is advised not write any code there.
Name:Divya Prakash
19U03057
IT
Microprocessor and Microcontroller
LAB 4
1. Title – Study of 8085 Microprocessor Trainer Kit

a) There are 5 bytes of data stored in B,C,D,E & H registers. Add all these
and store the result in acc.
b) 5 byte data is stored in ext memory. WAP to add those 5 bytes and store
the result in ext memory.
c) Calculate and compare the total time above two programs will take to be
fully executed. Justify the reason for this time difference.
d) WAP in 8085 AL to store the following series in ext. memory -
2,3,5,9...by using RAL/RAC/RRC/RLC

2. Practical Significance – This practical helps us understand about the


working of 8085 processor and let’s us know about how much time is
consumed in which operation.

3. Practical Outcomes – This helped us understand that data transfer from


external memory location to registers for same arithmetic operation is more
time consuming.

4. Skills to be developed – After completing this lab work, I am able to


understand how things actually happen inside a processor, about the T-states,
and also I am able to calculate the time taken for execution of various
operations.

5. Theoretical Background – To completely perform the experiment the


theoretical knowledge of rotation left and right shift and time taken by
each cycle for different keyword is compulsory. How they work, what is
their address, what is their nature. Familiarity with Simulator.

6. Experimental Setup – Jubin’s 8085 simulator & GNU 8085 simulator.

7. Precautions – In JUNBIN’S simulator, external interrupt does not change the


program counter and it should be taken care of.

8. Procedure / Instructions –
A. Simply move data to five given register and all those one by one
using loop.

B. Simply load data from external memory and keep them in different
specified register and then add all of them one by one and store in external
memory.

C. Add the time taken by each instruction in each above problem.

D. Initialize the accumulator register with 1 and run loop to add 1 to


each value of A keeping previous data safe and rotating left the previous
value of A register.

See the memory and different resister and note the result or observations.

9. Observations –
A)
B)

C)
D)
10.Conclusions – We can follow the above procedure to calculate the T-states
of every instructions thus calculating time taken for complete execution of the
program.

11.Sample Questions –
1. What do you mean by vectored interrupts? How are
they implemented in JUBIN’s Simulator
Ans:-Ans – Vectored interrupts are those interrupts which
also carry the address of the sub-routine, and the program
goes to this address on execution of the interrupt instruction.
In JUBIN’S Simulator, we define the instructions to be
executed at certain memory address with # ORG addr, and
when we call any instruction with RST the instruction at the
address of subroutine gets executed.
2. Why some instructions can take variable T-states?
Ans:-Some instructions like jump statements are performed
depending upon a condition so they result into variable T-
states, depending on whether condition is true or false.

You might also like