Unit 2
Unit 2
UNIT 2
PROGRAMMING THE 8085
(DATE: 02-12-21:16-12-2021)
By:
ATIFA AQUEEL
Guest Teacher
Electronics Engg. Section
University Women’s Polytechnic, AMU
INSTRUCTION
• For e.g.
1. MOV A,B : Move the content of reg B to reg A
2. MVI A, 25H : Move 25H to accumulator (Reg A)
3. LDA 2000H : Load the accumulator with the content present in memory
location 2000H.
4. LXI B, 2020H: Load the register pair BC with the content present in
memory location 2020H and 2021H. (X: Reg pair …16 bits)
16‐12‐2021 By: Atifa Aqueel 6
Arithmetic Group
• For e.g.
1. ADD B:
2. SUB C:
3. INR A:
4. DCR C:
• Note: These instructions may seem to be too many. But you can simply
remember them as “The instructions ending with the letter I, which stands
for immediate, are the instructions for immediate addressing mode” with
one exception though: the JMP instruction.
Q.3: Load the content of memory location 4050 directly to the accumulator
and transfer it to register B. The content of memory location 4050H is 25H.
Q.4: Move the content of memory location 2010H in register B indirectly, the
content of memory location 2010H is 1AH.
Q.5: Place 05H in accumulator. Increment it by one and store the result in
memory location 2400H.
ADD B
ADD M
ADC B
ADC M
ADI 20H
16‐12‐2021 By: Atifa Aqueel 33
ADI 20H
ACI 20H
DAD B
SUB B
SUB M
SBB r/SBB M
SBB B
/SBB M
SUI 55H
SBI 25H
INR M
DCR B
DCR M
INX B
DCX B
Q.1: ADD 96D and 69D, 84D and 92D, 98D and 99D
• 96D: 1001 0110 (BCD)
• 69D: 0110 1001 (BCD)
• 165D: 1111 1111 (FF IN HEX)
• DAA : 0110 0110 (+6 correction to LSBs AND +6 correction to MSBs)
01,65: 1, 0110 0101 (BCD)
16‐12‐2021 By: Atifa Aqueel 38
Examples
Q.1: Multiply 1245H by 2 .
Ans: LXI H, 1245H
DAD H
HLT
RLC
RAL
RRC
RAR
• Take a binary number. 0100. That’s 4 in decimal. Shift the ‘1’ towards left
by one position. You get 1000. That’s 8. There you go, you just multiplied
it by 2. Shift the ‘1’ in 0100 towards the right, and you get 2.
• In this instruction, the second and third byte instruction byte give the
address of the label where the program jumps.
• Address of the label is the address of the next instruction to be executed.
The program jumps to that location unconditionally.
2008 LDA 2502H Load the content of 2501H (i.e. other operand) to Accumulator
200B ADD B Add the content of A and B and store the result in A
200D AHEAD: SHLD 2505H Store the value of HL pair (Result) in 2505H and
2506H.
2010 STA 2507H Store the carry (Accumulator content) in 2507H
2013 HLT Stop the program
16‐12‐2021 By: Atifa Aqueel 58
CALL Instruction