Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1.
2.
Addressing Modes in 8085In the instruction format in 8085, the first part contains the instruction (opcode) itself. That is for example MOV
A,B. The second part contains the data. That is for example MOV A,B. The manner in which this data is addressed is
given by the addressing Modes. There are 5 different addressing modes that are given as
3.
Loops in programming:
Some instructions need to be repeated again and again for the execution of a program. This is done so
with the help of loops.
Loops are executed by conditional instructions that are repeated until the condition is satisfied.
Eg- JC 16 bit address jumps when there is carry. JNC 16 bit address jumps when there is no carry.
All the flags ie Zero, Sign, Parity, and Carry are used in JMP statements as conditions.
Multiplication can be implemented as a loop of additions. Division can be implemented as a loop of
subtractions.
Loops can be used to execute programs such as arranging=g numbers in ascending or descending order by
repeated CMP (comparison operations.)
Loop 3
A+BA
DD1
that is
that is
8 + 4 12
D is decremented from 1 to 0.
JNC (Jump no zero) flag is checked. It is set. Because D has become 0. Hence the execution comes out of
the loop..
INR D
CMP B
JNC L1
STA 4400
HLT
4.
Stacks:
5.
Subroutines
A group of instructions that will be used repeatedly in different locations of the program
o Hence to avoid using the same lines again and again, they are grouped into a subroutine and
called from different locations
In assembly language, a sub routine can exist anywhere in the code. For ease of use, it is usually placed
separately from the main program.
8085 has 2 instructions that deal with subroutineso CALL is used to direct the execution to the subroutine
When CALL is used, the processor understands that the next 2 memory locations
contain 16 bit address of the subroutine.
o RET is used to return the execution to the main routine
When return is used, the processor pops the return address from the stack and returns
to the main program
Number of push and POP used in the subroutine must be same and used in opposite order, else RET will
pick wrong value of the return address from the stack and the program will fail.