[go: up one dir, main page]

0% found this document useful (0 votes)
89 views48 pages

8085 Microprocessor Practical Guide

The document is a practical handbook for Computer Science students, specifically for the XII (S.Y.J.C) curriculum. It includes a detailed index of experiments related to the 8085 microprocessor, covering topics such as addition and subtraction of hexadecimal and BCD numbers, data manipulation, and program execution. Each experiment outlines the aim, program code, and expected results after execution, along with memory and register details.

Uploaded by

Arnav patil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
89 views48 pages

8085 Microprocessor Practical Guide

The document is a practical handbook for Computer Science students, specifically for the XII (S.Y.J.C) curriculum. It includes a detailed index of experiments related to the 8085 microprocessor, covering topics such as addition and subtraction of hexadecimal and BCD numbers, data manipulation, and program execution. Each experiment outlines the aim, program code, and expected results after execution, along with memory and register details.

Uploaded by

Arnav patil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

PRACTICAL HAND-BOOK

FOR
XII (S.Y.J.C)

COMPUTER
SCIENCE

BIFOCAL DEPARTMENT
INDEX
COMPUTER SCIENCE (PAPER-II)
SR. PAGE
TITLE
NO. NO.
01. Introduction to 8085 microprocessor and its kit. 3
02. Addition of two 8-bit hex numbers. 5
03. Addition of two 8-bit BCD numbers. 7
04. Addition of block of data using DAA instruction. 9
05. Addition of block of data using DAD instruction. 11
06. Subtraction of two 8-bit hex numbers. 13
07. Multiplication of two 1-byte hex numbers. 15
08. Division of two 1-byte hex numbers. 17
09. Transfer a block of data in reverse order. 19
10. Exchange contents of two data blocks. 21
11. Searching first occurrence of data in data block. 24
12. Counting the occurrence of data in data block. 26
13. Counting number of Zeros in 1-byte hex number. 28
14. Counting Even and Odd numbers in data block. 30
15. Searching Smallest as well as Greatest in data block. 32
16. Separation of nibbles and multiplication of these nibbles. 34
17. Checking whether a 4-byte hex number is Palindrome or not. 37
18. Conversion of 1-byte decimal number to hex number. 39
19. Conversion of 1-byte hex number to ASCII value. 41
20. Accept two hex numbers using keyboard subroutine. 43
21. Addition using keyboard monitor subroutines. 45
Expt. No. 1: Introduction to 8085 microprocessor and its kit.

Microprocessor is a multipurpose, programmable logic device that accepts digital data as input,
processes it according to instructions stored in its memory, and provides results as output.

Assembly Language
It is a low level programming language for microprocessors, microcontrollers, etc. Each
microprocessor has its own set of instructions. Instructions are in machine language (0 & 1) also
known as binary digits (bits). It is very difficult to write a program in machine language, so
special codes/ symbolic code for each instruction are developed which is known as mnemonics.

Mnemonic / instruction can be 1 byte, 2 bytes or 3 bytes.

8085 Dynalog Kit Keypad


RESET: Provides hardware reset. Display shows “FrIEnd” on pressing this key.

VI: Vector Interrupt key. Activate RST7.5 vectored interrupt.

SET: Allows the user to examine & modify the contents of RAM and only examination of
contents is possible in case of EPROM.

INR: Increments memory address presently displayed in the address field of display.

DCR: Decrements memory address presently displayed in the address field of display.

REG: Allows the user to examine contents of CPU registers & modify them if necessary.

GO: Allows the user to load the program counter by the desired memory address which is the
starting address of the program that is to be executed.

EXEC: Used to start the execution of GO or CODE command.

CODE: Used for selecting one of the coded subroutines in the monitor.

STEP: Allows the user to execute the program in single step mode or breakpoint mode.

SAVE: Used for saving the contents of memory onto an audio cassette.

LOAD: Used for loading the program from audio cassette back to memory in RAM area.
U1..U4: These keys are user definable function keys. The functions of these keys can be defined
by the user, by loading the appropriate memory locations with vectors pointing to user
subroutines.

General instructions to enter data and program, execute the program and
check the output
1. Press SET to enter the starting address of the program.
2. Press INR to enter hex code in the memory location.
3. Press INR again to go to next memory location and enter the hex code.
4. Go on doing step 3 till last hex code is entered.
5. Press INR to save the last hex code and press RESET.
6. Press SET to enter the starting address of the data input.
7. Press INR to enter data contents in the memory location.
8. Press INR again to go to next memory location and enter the data contents.
9. Go on doing step 8 till last data content is entered.
10. Press INR to save the last data content and press RESET.
11. Press GO to enter the starting address of the program.
12. Press EXEC to get “FrIEnd” on the display indicating successful execution.
13. Press REG followed by A, to check reg. A contents after execution.
14. Press INR to check reg. B contents and so on till SPL.
15. Press RESET.
16. Press SET to enter the starting address of the data output.
17. Press INR to check data contents in the memory location.
18. After checking all the output data, press RESET to get display as “FrIEnd”
Expt. No. 2: Addition of two 8-bit hex numbers.

Aim:
a) Write a program that adds two 1-byte hexadecimal numbers stored in consecutive memory
locations starting from D000H. Store the 2-byte result in consecutive memory locations starting
from D002H beginning with lower order byte.
b) Enter the program on the microprocessor kit.
c) Execute the program. Write the contents of data memory locations before and after execution
and also the bit contents of all the five flags individually. Verify the results.

Program:

Address Label Mnemonic Hex Comment


Opcode Operand Code
C000 START: MVI C,00 0E Initialize Reg. C to zero
C001 00
C002 LXI H, D000 21 Load HL reg. pair with immediate
C003 00 address D000H
C004 D0
C005 MOV A, M 7E Move contents pointed by HL reg.
pair to reg. A
C006 INX H 23 Increment HL reg. pair by 1
C007 ADD M 86 Add contents of memory pointed by
HL reg. pair with reg. A
C008 JNC SKIP D2 If carry not generated, jump to SKIP
C009 0C Lower address byte
C00A C0 Upper address byte
C00B INR C 0C Increment Reg. C by 1
C00C SKIP: INX H 23 Increment HL reg. pair by 1
C00D MOV M,A 77 Move result in memory pointed by
HL Reg. pair.
C00E INX H 23 Increment HL reg. pair by 1
C00F MOV M,C Move carry, if any, in memory
pointed by HL Reg. pair.
C010 STOP: RST 1 CF End of the program
DETAILS AFTER PROGRAM EXECUTION

Memory Address Data Before Execution Data after execution


D000 06 06
D001 07 07
D002 00 0D
D003 00 00

GENERAL REGISTERS

A B* C D* E* F H L
0D 00 00 00 00 00 D0 01

(* indicates register not used in program. Data after execution for these registers can change)

FLAG REGISTER

D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 0 0 0 0 0 0 0
Expt. No. 3: Addition of two 8-bit BCD numbers.

Aim:
a) Write a program that adds two 1-byte BCD numbers stored in consecutive memory locations
starting from D000H. Store the 2-byte result in consecutive memory locations starting from
D032H beginning with lower order byte.
b) Enter the program on the microprocessor kit.
c) Execute the program. Write the contents of data memory locations before and after execution
and also the bit contents of all the five flags individually. Verify the results.

Program:

Address Label Mnemonic Hex Comment


Opcode Operand Code
C000 START: MVI C,00 0E Initialize Reg. C to zero
C001 00
C002 LXI H, D000 21 Load HL reg. pair with immediate
C003 00 address D000H
C004 D0
C005 MOV A, M 7E Move contents pointed by HL reg.
pair to reg. A
C006 INX H 23 Increment HL reg. pair
C007 ADD M 86 Add contents of memory pointed by
HL reg. pair with reg. A
C008 DAA 27 Decimal Adjust Accumulator
C009 JNC SKIP D2 If carry not generated, jump to SKIP
C00A 0D SKIP-Lower address byte
C00B C0 SKIP-Upper address byte
C00C INR C 0C Increment Reg. C
C00D SKIP: STA D032 32 Store result in D032H
C00E 32 Lower address byte
C00F D0 Upper address byte
C010 MOV A,C 79 Move Reg. C data to accumulator
C011 STA D033 32 Store carry in D033H
C012 32 Lower address byte
C013 D0 Upper address byte
C014 STOP: RST 1 CF End of the program
DETAILS AFTER PROGRAM EXECUTION

Memory Address Data Before Execution Data after execution


D000 09 09
D001 06 06
D032 00 15
D033 00 00

GENERAL REGISTERS

A B* C D* E* F H L
00 00 00 00 00 10 D0 01

(* indicates register not used in program. Data after execution for these registers can change)

FLAG REGISTER

D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 0 0 1 0 0 0 0
Expt. No. 4: Addition of block of data using DAA instruction.

a) Write a program that add the BCD contents of a block memory. Block length in HEX not
exceeding 63 H=(99)10 is stored at C0FF and starting address of block is C100. Store the BCD
sum as result starting from memory location C060.
b) Enter the program on the microprocessor kit.
c) Execute the program. Write the contents of data memory locations before and after execution
and also the bit contents of all the five flags individually. Verify the results.

Address Label Mnemonic Hex Comment


Opcode Operand Code
C000 START: XRA A AF Clear Accumulator
C001 MOV B,A 47 Initialize Reg. B to zero
C002 LXI H,C0FF 21 Load HL reg. pair with immediate
C003 FF address C0FFH
C004 C0
C005 MOV C,M 4E Move block length in reg. C
C006 LOOP: INX H 23 Increment HL reg. pair
C007 ADD M 86 Add contents of memory pointed by
HL reg. pair with reg. A
C008 DAA 27 Decimal Adjust Accumulator
C009 JNC SKIP D2 If carry not generated, jump to SKIP
C00A 0D SKIP-Lower address byte
C00B C0 SKIP-Upper address byte
C00C INR B 04 Increment Reg. B
C00D SKIP: DCR C 0D Decrement block length counter by 1
C00E JNZ LOOP C2 If block length not zero, jump to LOOP
C00F 06 LOOP-Lower address byte
C010 C0 LOOP-Upper address byte
C011 STA C060 32 Store reg. A contents to C060H
C012 06 Lower address byte
C013 C0 Upper address byte
C014 MOV A,B 78 Move reg. B contents to reg. A
C015 STA C061 32 Store reg. A contents to C061H
C016 61 Lower address byte
C017 C0 Upper address byte
C018 STOP: RST 1 CF End of the program
DETAILS AFTER PROGRAM EXECUTION

Memory Address Data Before Execution Data after execution


COFF 05 05
C100 01 01
C101 02 02
C102 03 03
C103 04 04
C104 05 05
C060 00 15
C061 00 00

GENERAL REGISTERS

A B C D E F H L
00 00 00 00 00 54 C1 05

(* indicates register not used in program. Data after execution for these registers can change)

FLAG REGISTER

D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 1 0 1 0 1 0 0
Expt. No. 5: Addition of block of data using DAD instruction.

Aim:
a) Write a program that adds contents of a block of memory using DAD instruction. Block length
is stored at D000H and block starting address is D001H. Store the 2-byte result below the end
of the block.
b) Enter the program on the microprocessor kit.
c) Execute the program. Write the contents of data memory locations before and after execution
and also the bit contents of all the five flags individually. Verify the results.

Program:

Address Label Mnemonic Hex Comment


Opcode Operand Code
C000 START: LXI H, D000 21 Load HL reg. pair with D000H
C001 00 Lower address byte
C002 D0 Upper address byte
C003 MOV A,M 7E Move block length in Reg. A
C004 LXI B,0000 01 Initialize Reg. B to 0000H
C005 00 Lower data byte
C006 00 Upper data byte
C007 LXI D,0000 11 Initialize Reg. D to 0000H
C008 00 Lower data byte
C009 00 Upper data byte
C00A LOOP: INX H 23 Increment Reg. pair HL by 1
C00B MOV C,M 4E Move contents of memory to Reg. C
C00C XCHG EB Exchange HL contents with DE
C00D DAD B 09 Add BC contents with HL
C00E XCHG EB Exchange HL contents with DE
C00F DCR A 3D Decrement counter block length by 1
C010 JNZ LOOP C2 If block length not zero, jump to LOOP
C011 0A LOOP-Lower address byte
C012 C0 LOOP-Upper address byte
C013 INX H 23 Increment HL reg. pair by 1
C014 MOV M,E 73 Move Resultant’s lower byte in
memory pointed by Reg. pair HL
C015 INX H 23 Increment HL reg. pair by 1
C016 MOV M,D 72 Move Resultant’s higher byte in
memory pointed by Reg. pair HL
C017 STOP: RST 1 CF End of the program

DETAILS AFTER PROGRAM EXECUTION

Memory Address Data Before Execution Data after execution


D000 05 05
D001 01 01
D002 04 04
D003 05 05
D004 06 06
D005 02 02
D006 00 12
D007 00 00

GENERAL REGISTERS

A B C D E F H L
00 00 02 00 12 54 D0 07

(* indicates register not used in program. Data after execution for these registers can change)

FLAG REGISTER

D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 1 0 1 0 1 0 0
Expt. No. 6: Subtraction of two 8-bit hex numbers.

Aim:
a) Write a program that subtracts the number stored in D001H from the number stored in D000H.
Store the absolute difference in memory location D050H as a result.
b) Enter the program on the microprocessor kit.
c) Execute the program for a positive as well as a negative difference. Write the contents of data
memory locations before and after execution and also the bit contents of all the five flags
individually. Verify the results.

Program:

Address Label Mnemonic Hex Comment


Opcode Operand Code
C000 START: LXI H, D000 21 Load HL reg. pair with immediate
C001 00 address D000H
C002 D0
C003 MOV A, M 7E Move contents pointed by HL reg.
pair to reg. A
C004 INX H 23 Increment HL reg. pair
C005 SUB M 96 Add contents of memory pointed by
HL reg. pair with reg. A
C006 JP SKIP F2 If result positive, jump to label SKIP
C007 0C Lower address byte
C008 C0 Upper address byte
C009 CMA 2F 1’s complement of accumulator
C00A ADI 01 C6 Add 1 to Reg. A to get 2’s
C00B 01 complement
C00C SKIP: STA D050 32 Store reg. A contents to D050H
C00D 50 Lower address byte
C00E D0 Upper address byte
C00F STOP: RST 1 CF End of the program
For Positive Result

DETAILS AFTER PROGRAM EXECUTION

Memory Address Data Before Execution Data after execution


D000 0A 0A
D001 06 06
D050 00 04

GENERAL REGISTERS

A B* C* D* E* F H L
04 00 00 00 00 10 D0 01
(* indicates register not used in program. Data after execution for these registers can change)

FLAG REGISTER

D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 0 0 1 0 0 0 0

For Negative Result

DETAILS AFTER PROGRAM EXECUTION

Memory Address Data Before Execution Data after execution


D000 06 06
D001 0A 0A
D050 00 04

GENERAL REGISTERS

A B* C* D* E* F H L
04 00 00 00 00 00 D0 01
(* indicates register not used in program. Data after execution for these registers can change)

FLAG REGISTER
D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 0 0 0 0 0 0 0

Expt. No. 7: Multiplication of two 8-bit hex numbers.

Aim:
a) Write a program that multiplies two 1-byte hexadecimal numbers stored in consecutive
memory locations starting from D000H. Store the 2-byte result in consecutive memory
locations starting from D002H beginning with lower order byte.
b) Enter the program on the microprocessor kit.
c) Execute the program. Write the contents of data memory locations before and after execution
and also the bit contents of all the five flags individually. Verify the results.

Program:

Address Label Mnemonic Hex Comment


Opcode Operand Code
C000 START: XRA A AF Clear Reg. A to zero
C001 MOV B,A 47 Initialize Reg. B to zero
C002 LXI H,D000 21 Load HL reg. pair with immediate
C003 00 address D000H
C004 D0
C005 MOV C, M 4E Move contents pointed by HL reg.
pair to reg. C
C006 INX H 23 Increment HL reg. pair
C007 LOOP: ADD M 86 Add contents of memory pointed by
HL reg. pair with reg. A
C008 JNC SKIP D2 If carry is not generated, jump to
label SKIP
C009 0C Lower address byte
C00A C0 Upper address byte
C00B INR B 04 Increment reg. B by 1
C00C SKIP: DCR C 0D Decrement reg. B by 1
C00D JNZ LOOP C2 If reg. C is not zero, jump to LOOP
C00E 07 LOOP-Lower address byte
C00F C0 LOOP-Upper address byte
C010 INX H 23 Increment HL reg. pair by 1
C011 MOV M,A 77 Move result in memory pointed by
HL Reg. pair.
C012 INX H 23 Increment HL reg. pair by 1
C013 MOV M,B 70 Move carry, if any, in memory
pointed by HL Reg. pair.
C014 STOP: RST 1 CF End of the program

DETAILS AFTER PROGRAM EXECUTION

Memory Address Data Before Execution Data after execution


D000 09 09
D001 05 05
D002 00 2D
D003 00 00

GENERAL REGISTERS

A B C D* E* F H L
2D 00 00 00 00 54 D0 03

(* indicates register not used in program. Data after execution for these registers can change)

FLAG REGISTER

D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 1 0 1 0 1 0 0
Expt. No. 8: Division of two 8-bit hex numbers.

Aim:
a) Write a program that divides two 1-byte hexadecimal numbers where the dividend is stored in
D000H and the divisor is stored in D001H. Store the quotient and the remainder in next
consecutive memory locations respectively.
b) Enter the program on the microprocessor kit.
c) Execute the program. Write the contents of data memory locations before and after execution
and also the bit contents of all the five flags individually. Verify the results.

Program:

Address Label Mnemonic Hex Comment


Opcode Operand Code
C000 START: MVI B,00 06 Initialize Reg. B to zero
C001 00
C002 LXI H,D000 21 Load HL reg. pair with immediate
C003 00 address D000H
C004 D0
C005 MOV A, M 7E Move contents pointed by HL reg.
pair to reg. A
C006 INX H 23 Increment HL reg. pair
C007 LOOP: CMP M BE Compare to check dividend greater
than divisor
C008 JC SKIP DA If reg. A < reg. M, jump to SKIP
C009 10 Lower address byte
C00A C0 Upper address byte
C00B SUB M 96 Subtract divisor from dividend
C00C INR B 04 Increment quotient in reg. B by 1
C00D JMP LOOP C2 Jump unconditionally to label LOOP
C00E 07 LOOP-Lower address byte
C00F C0 LOOP-Upper address byte
C010 SKIP: INX H 23 Increment HL reg. pair by 1
C011 MOV M,B 70 Move quotient in memory pointed by
HL Reg. pair.
C012 INX H 23 Increment HL reg. pair by 1
C013 MOV M,A 77 Move remainder in memory pointed
by HL Reg. pair.
C014 STOP: RST 1 CF End of the program

DETAILS AFTER PROGRAM EXECUTION

Memory Address Data Before Execution Data after execution


D000 0D 0D
D001 03 03
D002 00 04
D003 00 01

GENERAL REGISTERS

A B C* D* E* F H L
01 04 00 00 00 81 D0 03

(* indicates register not used in program. Data after execution for these registers can change)

FLAG REGISTER

D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
1 0 0 0 0 0 0 1
Expt. No. 9: Transfer a block of data in reverse order.

Aim:
a) A block of data is stored from memory locations starting from D001H to D005H. Write a
program to transfer the data in reverse order to memory locations starting from D051H to
D055H.
b) Enter the program on the microprocessor kit.
c) Execute the program. Write the contents of data memory locations before and after execution
and also the bit contents of all the five flags individually. Verify the results.

Program:

Address Label Mnemonic Hex Comment


Opcode Operand Code
C000 START: MVI B,05 06 Initialize Reg. B to block length
C001 05
C002 LXI H,D001 21 Load HL reg. pair with immediate
C003 01 address D001H
C004 D0
C005 LXI D,D055 11 Load DE reg. pair with immediate
C006 55 address D055H
C007 D0
C008 LOOP: MOV A,M 7E Move memory contents to reg. A
C009 STAX D 12 Store reg. A contents to memory
location pointed by reg. pair DE
C00A INX H 23 Increment HL reg. pair by 1
C00B DCX D 1B Decrement DE reg. pair by 1
C00C DCR B 05 Decrement reg. B by 1
C00D JNZ LOOP C2 If block length (reg. B) not zero,
C00E 08 Jump to label LOOP
C00F C0
C010 STOP: RST 1 CF End of the program
DETAILS AFTER PROGRAM EXECUTION

Memory Address Data Before Execution Data after execution


D001 05 05
D002 02 02
D003 01 01
D004 03 03
D005 04 04

Memory Address Data Before Execution Data after execution


D051 00 04
D052 00 03
D053 00 01
D054 00 02
D055 00 05

GENERAL REGISTERS

A B C* D E F H L
04 00 00 D0 51 54 D0 06

(* indicates register not used in program. Data after execution for these registers can change)

FLAG REGISTER

D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 1 0 1 0 1 0 0
Expt. No. 10: Exchange contents of two data blocks.

Aim:
a) A block of data is stored from memory locations starting from D001H to D005H. Another
block of data of same length is stored in memory locations starting from D051H to
[Link] a program to exchange the contents of these two blocks.
b) Enter the program on the microprocessor kit.
c) Execute the program. Write the contents of data memory locations before and after execution
and also the bit contents of all the five flags individually. Verify the results.

Program:

Address Label Mnemonic Hex Comment


Opcode Operand Code
C000 START: MVI C,05 0E Initialize Reg. C to block length
C001 05
C002 LXI H,D001 21 Load HL reg. pair with immediate
C003 01 address D001H
C004 D0
C005 LXI D,D051 11 Load DE reg. pair with immediate
C006 51 address D051H
C007 D0
C008 LOOP: LDAX D 1A Load reg. A with contents pointed by
reg. pair DE
C009 MOV B,M 46 Move contents pointed by HL reg.
pair in reg. B
C00A MOV M,A 77 Move reg. A contents to memory
pointed by HL reg. pair
C00B MOV A,B 78 Move contents of reg. B in reg. A
C00C STAX D 12 Store reg. A contents to memory
pointed by reg. pair DE
C00D INX H 23 Increment HL reg. pair by 1
C00E INX D 13 Increment DE reg. pair by 1
C00F DCR C 0D Decrement reg. C by 1
C010 JNZ LOOP C2 If block length (reg. B) not zero,
C011 08 Jump to label LOOP
C012 C0
C013 STOP: RST 1 CF End of the program
DETAILS AFTER PROGRAM EXECUTION

Memory Address Data Before Execution Data after execution


D001 01 06
D002 02 07
D003 03 08
D004 04 09
D005 05 0A

Memory Address Data Before Execution Data after execution


D051 06 01
D052 07 02
D053 08 03
D054 09 04
D055 0A 05

GENERAL REGISTERS

A B C D E F H L
05 05 00 D0 56 54 D0 06

(* indicates register not used in program. Data after execution for these registers can change)

FLAG REGISTER

D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 1 0 1 0 1 0 0
Expt. No. 11: Searching first occurrence of data in data block.

Aim:
a) A block of data is stored in memory locations from D001H. The length of the block is stored
at D000H. Write a program that searches for the first occurance of data byte ABH in the given
block. Store the address of this occurance in HL pair. If the no. is not found, HL pair must
contain FFFFH.
b) Enter the program on the microprocessor kit.
c) Execute the program. Write the contents of data memory locations before and after execution
and also the bit contents of all the five flags individually. Verify the results.

Program:

Address Label Mnemonic Hex Comment


Opcode Operand Code
C000 START: LXI H,D000 21 Load HL reg. pair with immediate
C001 00 address D000H
C002 D0
C003 MOV B,M 46 Move contents pointed by HL reg.
pair (block length) in reg. B
C004 MVI A,AB 3E Move immediate data(to be
C005 AB searched) in reg. A
C006 LOOP: INX H 23 Increment HL reg. pair by 1
C007 CMP M BE Compare reg. A & memory contents
C008 JZ STOP CA If they match, jump to label STOP
C009 12 Lower address byte
C00A C0 Upper address byte
C00B DCR B 05 Decrement reg. B (block length) by 1
C00C JNZ LOOP C2 If block length (reg. B) not zero,
C00D 06 Jump to label LOOP
C00E C0
C00F LXI H,FFFF 21 Reg. pair HL contains FFFF as
C010 FF required data is not available
C011 FF
C012 STOP: RST 1 CF End of the program
When required data is found

DETAILS AFTER PROGRAM EXECUTION

Memory Address Data Before Execution Data after execution


D000 05 05
D001 01 01
D002 02 02
D003 AB AB
D004 03 03
D005 AB AB

GENERAL REGISTERS

A B C* D* E* F H L
AB 03 00 00 00 54 D0 03

(* indicates register not used in program. Data after execution for these registers can change)

FLAG REGISTER

D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 1 0 1 0 1 0 0
When required data is not found

DETAILS AFTER PROGRAM EXECUTION

Memory Address Data Before Execution Data after execution


D000 05 05
D001 01 01
D002 02 02
D003 03 03
D004 04 04
D005 05 05

GENERAL REGISTERS

A B C* D* E* F H L
AB 00 00 00 00 54 FF FF

(* indicates register not used in program. Data after execution for these registers can change)

FLAG REGISTER

D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 1 0 1 0 1 0 0
Expt. No. 12: Counting the occurrence of data in data block.

Aim:
a) A block of data is stored from memory locations starting from D001H. The length of the
block is stored at D000H. Write a program that counts the occurrence of the number ABH in
the given block. Store the result in D050H.
b) Enter the program on the microprocessor kit.
c) Execute the program. Write the contents of data memory locations before and after execution
and also the bit contents of all the five flags individually. Verify the results.

Program:

Address Label Mnemonic Hex Comment


Opcode Operand Code
C000 START: LXI H,D000 21 Load HL reg. pair with immediate
C001 00 address D000H
C002 D0
C003 MOV B,M 46 Move contents pointed by HL reg.
pair (block length) in reg. B
C004 MVI C,00 0E Move immediate data
C005 00 in reg. C (counter)
C006 MVI A,AB 3E Move immediate data(to be
C007 AB searched) in reg. A
C008 LOOP: INX H 23 Increment HL reg. pair by 1
C009 CMP M BE Compare reg. A & memory contents
C00A JNZ SKIP C2 If they do not match, jump to SKIP
C00B 0E Lower address byte
C00C C0 Upper address byte
C00D INR C 0C Increment reg. C (counter) by 1
C00E SKIP: DCR B 05 Decrement reg. B (block length) by 1
C00F JNZ LOOP C2 If block length (reg. B) not zero,
C010 08 Jump to label LOOP
C011 C0
C012 MOV A,C 79 Move reg. C contents to reg. A
C013 STA D050 32 Store reg. A contents to D050
C014 50 Lower address byte
C015 D0 Upper address byte
C016 STOP: RST 1 CF End of the program
DETAILS AFTER PROGRAM EXECUTION

Memory Address Data Before Execution Data after execution


D000 05 05
D001 01 01
D002 02 02
D003 AB AB
D004 03 03
D005 AB AB
D050 00 02

GENERAL REGISTERS

A B C D* E* F H L
02 00 02 00 00 54 D0 05

(* indicates register not used in program. Data after execution for these registers can change)

FLAG REGISTER

D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 1 0 1 0 1 0 0
Expt. No. 13: Counting number of Zeros in 1-byte hex number.

Aim:
a) An 8-bit number is stored in memory location D000H. Write a program that counts the zeros
in the given number. Store the count in memory location D050H.
b) Enter the program on the microprocessor kit.
c) Execute the program. Write the contents of data memory locations before and after execution
and also the bit contents of all the five flags individually. Verify the results.

Program:

Address Label Mnemonic Hex Comment


Opcode Operand Code
C000 START: MVI C,08 0E Move immediate data (length of no.)
C001 08 in reg. C
C002 MVI B,00 06 Move immediate data
C003 00 in reg. B (counter)
C004 LDA D000 3A Load the no. in reg. A
C005 00 Lower address byte
C006 D0 Upper address byte
C007 LOOP: RRC 0F Rotate Accumulator Right
C008 JC SKIP DA If carry generated (means bit is 1),
C009 0C Jump to label SKIP
C00A C0
C00B INR B 04 Increment reg. B(counter) by 1
C00C SKIP: DCR C 0D Decrement reg. C(length of no.) by 1
C00D JNZ LOOP C2 If reg. C contents not zero, jump
C00E 07 to label LOOP
C00F C0
C010 MOV A,B 78 Move reg. B contents to reg. A
C011 STA D050 32 Store reg. A contents to D050
C012 50 Lower address byte
C013 D0 Upper address byte
C014 STOP: RST 1 CF End of the program
DETAILS AFTER PROGRAM EXECUTION

Memory Address Data Before Execution Data after execution


D000 75 75
D050 00 03

GENERAL REGISTERS

A B C D* E* F H* L*
03 03 00 00 00 54 FF FE

(* indicates register not used in program. Data after execution for these registers can change)

FLAG REGISTER

D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 1 0 1 0 1 0 0
Expt. No. 14: Counting Even and Odd numbers in data block.

Aim:
a) A block of data is stored from memory locations starting from D001H to D00AH. Write a
program to find the number of odd as well as even numbers in the given block. Store the
results immediately after the end of the block.
b) Enter the program on the microprocessor kit.
c) Execute the program. Write the contents of data memory locations before and after execution
and also the bit contents of all the five flags individually. Verify the results.

Program:

Address Label Mnemonic Hex Comment


Opcode Operand Code
C000 START: MVI C,0A 0E Move immediate contents
C001 0A (block length) in reg. C
C002 MVI D,00 16 Move immediate data
C003 00 in reg. D (odd counter)
C004 LXI H,D001 21 Load HL reg. pair with immediate
C005 01 address D001H
C006 D0
C007 LOOP: MOV A,M 7E Move contents pointed by HL reg.
pair in reg. A
C008 RRC 0F Rotate Accumulator Right
C009 JNC SKIP D2 If carry flag is not set (even no.),
C00A 0D jump to label SKIP
C00B C0
C00C INR D 14 Increment reg. D(odd counter) by 1
C00D SKIP: INX H 23 Increment HL reg. pair by 1
C00E DCR C 0D Decrement reg. C (block length) by 1
C00F JNZ LOOP C2 If reg. C (block length) not zero,
C010 07 jump to label LOOP
C011 C0
C012 MOV M,D 72 Move reg. D (odd counter) contents
to memory pointed by HL reg. pair
C013 MVI A,0A 3E Initialize reg. A with block length
C014 0A
C015 SUB D 92 Subtract odd count from block length
C016 INX H 23 Increment HL reg. pair by 1
C017 MOV M,A 77 Move reg. A (even count) to memory
pointed by HL reg. pair
C018 STOP: RST 1 CF End of the program

DETAILS AFTER PROGRAM EXECUTION

Memory Address Data Before Execution Data after execution


D001 01 01
D002 03 03
D003 05 05
D004 02 02
D005 07 07
D006 0A 0A
D007 04 04
D008 09 09
D009 06 06
D00A 08 08
D00B 00 05
D00C 00 05

GENERAL REGISTERS

A B* C D E* F H L
05 01 00 05 00 14 D0 0C

(* indicates register not used in program. Data after execution for these registers can change)

FLAG REGISTER

D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 0 0 1 0 1 0 0
Expt. No. 15: Searching Smallest as well as Greatest in data block.

Aim:
a) A block of data is stored from memory locations starting from D001H to D00AH. Write a
program to find the smallest as well as the greatest number from the block using linear search.
b) Enter the program on the microprocessor kit.
c) Execute the program. Write the contents of data memory locations before and after execution
and also the bit contents of all the five flags individually. Verify the results.

Program:

Address Label Mnemonic Hex Comment


Opcode Operand Code
C000 START: MVI E,0A 1E Move immediate contents
C001 0A (block length) in reg. E
C002 LXI B,00FF 01 Initialize reg. B to 00 & reg. C to FF
C003 FF reg. B will hold greatest no. at last
C004 00 reg. C will hold smallest no. at last
C005 LXI H,D001 21 Load HL reg. pair with immediate
C006 01 address D001H
C007 D0
C008 LOOP: MOV A,M 7E Move contents pointed by HL reg. pair
in reg. A
C009 CMP B B8 Compare no. with reg. B contents
C00A JC SKIP1 DA If carry is generated, no. is smaller,
C00B 0E jump to label SKIP else continue
C00C C0
C00D MOV B,A 47 No. is greater than B, copy in reg. B
C00E SKIP1: CMP C Compare no. with reg. C contents
C00F JNC SKIP2 D2 If carry is not generated, no. is
C010 13 greater, jump to label SKIP
C011 C0 else continue
C012 MOV C,A 4F No. is smaller than C, copy in reg. C
C013 SKIP2: INX H 23 Increment HL reg. pair by 1
C014 DCR E 1D Decrement reg. E (block length) by 1
C015 JNZ LOOP C2 If reg. E (block length) not zero,
C016 08 jump to label LOOP
C017 C0
C018 MOV M,C 71 Move smallest no. on reg C. to memory
pointed by HL reg. pair
C019 INX H 23 Increment HL reg. pair by 1
C01A MOV M,B 70 Move greatest no. on reg B. to memory
pointed by HL reg. pair
C01B STOP: RST 1 CF End of the program

DETAILS AFTER PROGRAM EXECUTION

Memory Address Data Before Execution Data after execution


D001 01 01
D002 03 03
D003 05 05
D004 02 02
D005 07 07
D006 0A 0A
D007 04 04
D008 09 09
D009 06 06
D00A 08 08
D00B 00 01
D00C 00 0A

GENERAL REGISTERS

A B C D* E F H L
08 0A 01 00 00 54 D0 0C

(* indicates register not used in program. Data after execution for these registers can change)

FLAG REGISTER

D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 1 0 1 0 1 0 0
Expt. No. 16: Separation of nibbles and multiplication of these nibbles.

Aim:
a) Write a program that separates two nibbles of a number stored in D000H and stores the same
in memory locations D001H and D002H. The program must also multiply the two nibbles and
store the product in D003H.
b) Enter the program on the microprocessor kit.
c) Execute the program. Write the contents of data memory locations before and after execution
and also the bit contents of all the five flags individually. Verify the results.

Program:

Address Label Mnemonic Hex Comment


Opcode Operand Code
C000 START: LXI H,D000 21 Load HL reg. pair with immediate
C001 00 address D000H
C002 D0
C003 MOV A,M 7E Move contents pointed by HL reg.
pair in reg. A
C004 MOV B,M 46 Move contents pointed by HL reg.
pair in reg. B
C005 ANI F0 E6 AND reg. A contents with F0
C006 F0 to get 4 MSB’s
C007 RRC 0F Rotate Accumulator Right
C008 RRC 0F Rotate Accumulator Right
C009 RRC 0F Rotate Accumulator Right
C00A RRC 0F Rotate Accumulator Right
C00B INX H 23 Increment HL reg. pair by 1
C00C MOV M,A 77 Move contents of reg. A(1st nibble)
in memory pointed by HL reg. pair
C00D MOV C,A 4F Move contents of reg. A(1st nibble)
in reg. C
C00E MOV A,B 78 Move reg. B contents to reg. A
C00F ANI 0F E6 AND reg. A contents with 0F
C010 0F to get 4 LSB’s
C011 INX H 23 Increment HL reg. pair by 1
C012 MOV M,A 77 Move contents of reg. A(2nd nibble)
in memory pointed by HL reg. pair
C013 SUB A 97 Initialize reg. A to 00
C014 LOOP: ADD M 86 Add 2nd nibble with reg. A contents
C015 DCR C 0D Decrement reg. C by 1
C016 JNZ LOOP C2 If reg. C contents are not zero,
C017 14 jump to label LOOP
C018 C0
C019 INX H 23 Increment HL reg. pair by 1
C01A MOV M,A 77 Move contents of reg. A(result) in
memory pointed by HL reg. pair
C01B STOP: RST 1 CF End of the program

DETAILS AFTER PROGRAM EXECUTION

Memory Address Data Before Execution Data after execution


D000 24 24
D001 00 02
D002 00 04
D003 00 08

GENERAL REGISTERS

A B C D* E* F H L
08 24 00 00 00 54 D0 03

(* indicates register not used in program. Data after execution for these registers can change)

FLAG REGISTER

D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 1 0 1 0 1 0 0
Expt. No. 17: Checking whether a 4-byte hex number is Palindrome or not.

Aim:
a) A 4-byte Hex number beginning with lower order byte is stored in memory locationsD000H.
Write a program that checks whether the given number considered in hex, is palindrome or
not. If the number is palindrome then memory location D050H must contain 00H or else FFH.
b) Enter the program on the microprocessor kit.
c) Execute the program. Write the contents of data memory locations before and after execution
and also the bit contents of all the five flags individually. Verify the results.

Program:

Address Label Mnemonic Hex Comment


Opcode Operand Code
C000 START: LXI H,D000 21 Load HL reg. pair with immediate
C001 00 address D000H
C002 D0
C003 MOV C,M 4E Move contents pointed by HL reg.
pair in reg. C
C004 INX H 23 Increment HL reg. pair by 1
C005 MOV B,M 46 Move contents pointed by HL reg.
pair in reg. B
C006 INX H 23 Increment HL reg. pair by 1
C007 MOV E,M 5E Move contents pointed by HL reg.
pair in reg. E
C008 INX H 23 Increment HL reg. pair by 1
C009 MOV D,M 56 Move contents pointed by HL reg.
pair in reg. D
C00A MOV A,D 7A Move contents of reg. D in reg. A
C00B RRC 0F Rotate Accumulator Right
C00C RRC 0F Rotate Accumulator Right
C00D RRC 0F Rotate Accumulator Right
C00E RRC 0F Rotate Accumulator Right
C00F CMP C B9 Compare reg. A with reg. C
C010 JNZ SKIP C2 If not zero, jump to label SKIP
C011 24 No. is not palindrome
C012 C0
C013 MOV A,E 7B Move contents of reg. E in reg. A
C014 RRC 0F Rotate Accumulator Right
C015 RRC 0F Rotate Accumulator Right
C016 RRC 0F Rotate Accumulator Right
C017 RRC 0F Rotate Accumulator Right
C018 CMP B B8 Compare reg. A with reg. B
C019 JNZ SKIP C2 If not zero, jump to label SKIP
C01A 24 No. is not palindrome
C01B C0
C01C MVI A,00 3E No. is palindrome, hence initialize
C01D 00 reg. A to 00
C01E STA D050 32 Store reg. A contents to D050
C01F 50 Lower address byte
C020 D0 Upper address byte
C021 JMP STOP C3 Jump unconditionally to label STOP
C022 29 Lower address byte
C023 C0 Upper address byte
C024 SKIP: MVI A,FF 3E No. is not palindrome, hence
C025 FF initialize reg. A to FF
C026 STA D050 32 Store reg. A contents to D050
C027 50 Lower address byte
C028 D0 Upper address byte
C029 STOP: RST 1 CF End of the program

When no. is palindrome

DETAILS AFTER PROGRAM EXECUTION

Memory Address Data Before Execution Data after execution


D000 0F 0F
D001 BA BA
D002 AB AB
D003 F0 F0
D050 00 00

GENERAL REGISTERS

A B C D E F H L
00 BA 0F F0 AB 54 D0 03
(* indicates register not used in program. Data after execution for these registers can change)

FLAG REGISTER

D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 1 0 1 0 1 0 0

When no. is not palindrome

DETAILS AFTER PROGRAM EXECUTION

Memory Address Data Before Execution Data after execution


D000 0F 0F
D001 0B 0B
D002 AB AB
D003 F0 F0
D050 00 FF

GENERAL REGISTERS

A B C D E F H L
FF 0B 0F F0 AB A4 D0 03

(* indicates register not used in program. Data after execution for these registers can change)

FLAG REGISTER

D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
1 0 0 0 0 1 0 0
Expt. No. 18: Conversion of 1-byte decimal number to hex number.

Aim:
a) A decimal number is stored in memory location [Link] a program to convert this
number to its Hex equivalent, and store the result in memory location D001H.
b) Enter the program on the microprocessor kit.
c) Execute the program. Write the contents of data memory locations before and after execution
and also the bit contents of all the five flags individually. Verify the results.

Program:

Address Label Mnemonic Hex Comment


Opcode Operand Code
C000 START: LXI H,D000 21 Load HL reg. pair with immediate
C001 00 address D000H
C002 D0
C003 MOV A,M 7E Move contents pointed by HL reg.
pair in reg. A
C004 MOV B,M 46 Move contents pointed by HL reg.
pair in reg. B
C005 ANI 0F E6 AND reg. A contents with 0F
C006 0F to get 4 LSB’s
C007 MOV E,A 5F Move contents of reg. A in reg. E
C008 MOV A,B 78 Move contents of reg. B in reg. A
C009 ANI F0 E6 AND reg. A contents with F0
C00A F0 to get 4 MSB’s
C00B RRC 0F Rotate Accumulator Right
C00C RRC 0F Rotate Accumulator Right
C00D RRC 0F Rotate Accumulator Right
C00E RRC 0F Rotate Accumulator Right
C00F MOV D,A 57 Move contents of reg. A in reg. D
C010 SUB A 97 Initialize reg. A to 00
C011 MVI C,0A 0E Initialize reg. C to 0A
C012 0A
C013 LOOP: ADD D 82 Add reg. D (2nd nibble) with reg. A
C014 DCR C 0D Decrement reg. C contents by 1
C015 JNZ LOOP C2 If reg. C is not zero, jump to LOOP
C016 13 Lower address byte
C017 C0 Upper address byte
C018 ADD E 83 Add reg. E (1st nibble) with reg. A
C019 INX H 23 Increment HL reg. pair by 1
C01A MOV M,A 77 Move reg. A contents to memory
pointed by HL reg. pair
C01B STOP: RST 1 CF End of the program

DETAILS AFTER PROGRAM EXECUTION

Memory Address Data Before Execution Data after execution


D000 23 23
D001 00 17

GENERAL REGISTERS

A B C D E F H L
17 23 00 02 03 04 D0 01

(* indicates register not used in program. Data after execution for these registers can change)

FLAG REGISTER

D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 1 0 0 0 1 0 0
Expt. No. 19: Conversion of 1-byte hex number to ASCII value.

Aim:
b) A hexadecimal number is stored in memory location [Link] a program to convert this
number to its ASCII equivalent, and store the result in memory location D001H and D002H.
b) Enter the program on the microprocessor kit.
c) Execute the program. Write the contents of data memory locations before and after execution
and also the bit contents of all the five flags individually. Verify the results.

Program:

Address Label Mnemonic Hex Comment


Opcode Operand Code
C000 START: LXI H,D000 21 Load HL reg. pair with immediate
C001 00 address D000H
C002 D0
C003 MOV A,M 7E Move contents pointed by HL reg.
pair in reg. A
C004 MOV B,M 46 Move contents pointed by HL reg.
pair in reg. B
C005 ANI F0 E6 AND reg. A contents with F0
C006 F0 to get 4 MSB’s
C007 RRC 0F Rotate Accumulator Right
C008 RRC 0F Rotate Accumulator Right
C009 RRC 0F Rotate Accumulator Right
C00A RRC 0F Rotate Accumulator Right
C00B CALL ASCII CD Perform ASCII conversion on 1st
C00C 19 Nibble
C00D C0
C00E INX H 23 Increment HL reg. pair by 1
C00F MOV M,A 77 Move reg. A contents to memory
pointed by HL reg. pair
C010 MOV A,B 78 Move reg. B contents to reg. A
C011 ANI 0F E6 AND reg. A contents with 0F
C012 0F to get 4 LSB’s
C013 CALL ASCII CD Perform ASCII conversion on 2nd
C014 19 Nibble
C015 C0
C016 INX H 23 Increment HL reg. pair by 1
C017 MOV M,A 77 Move reg. A contents to memory
pointed by HL reg. pair
C018 STOP: RST 1 CF End of the program
C019 ASCII: CPI 0A FE Compare accumulator contents with
C01A 0A 0A
C01B JC SKIP DA If carry is generated, jump to SKIP
C01C 20 Lower address byte
C01D C0 Upper address byte
C01E ADI 07 C6 Add 07 to reg. A contents
C01F 07
C020 SKIP: ADI 30 C6 Add 30 to reg. A contents
C021 30
C022 RET C9 Return to main program

DETAILS AFTER PROGRAM EXECUTION

Memory Address Data Before Execution Data after execution


D000 45 45
D001 00 34
D002 00 35

GENERAL REGISTERS

A B C* D* E* F H L
35 45 00 00 38 04 D0 02

(* indicates register not used in program. Data after execution for these registers can change)

FLAG REGISTER

D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 0 0 0 0 1 0 0
Expt. No. 20: Accept two hex numbers using keyboard subroutine.

Aim:
a) Write a program that uses keyboard subroutine having starting address 02E7H to accept two
digits from keyboard. Store them separately in consecutive memory locations D000H &
D001H. Store them as one byte result at memory location D050H and use monitor subroutine
036EH to display the same.
b) Enter the program on the microprocessor kit.
c) Execute the program. Write the contents of data memory locations before and after execution
and also the bit contents of all the five flags individually. Verify the results.

Program:

Address Label Mnemonic Hex Comment


Opcode Operand Code
C000 START: LXI B,D000 01 Load BC reg. pair with immediate
C001 00 address D000H
C002 D0
C003 CALL 02E7 CD Call keypad subroutine to accept
C004 E7 1st digit in reg. A
C005 02
C006 STAX B 02 Store reg. A contents to memory
pointed by BC reg. pair
C007 RRC 0F Rotate Accumulator Right
C008 RRC 0F Rotate Accumulator Right
C009 RRC 0F Rotate Accumulator Right
C00A RRC 0F Rotate Accumulator Right
C00B MOV D,A 57 Move reg. A contents to reg. D
C00C INX B Increment BC reg. pair by 1
C00D CALL 02E7 CD Call keypad subroutine to accept
C00E E7 2nd digit in reg. A
C00F 02
C010 STAX B 02 Store reg. A contents to memory
pointed by BC reg. pair
C011 ADD D 82 Add reg. D contents with reg. A
C012 STA D050 32 Store reg. A contents to D050
C013 50 Lower address byte
C014 D0 Upper address byte
C015 CALL 036E CD Call monitor subroutine to display
C016 6E 2-digit (1 byte) number
C017 03
C018 HLT 76 Halt the program

DETAILS AFTER PROGRAM EXECUTION

Memory Address Data Before Execution Data after execution


D000 00 05
D001 00 06
D050 00 56

GENERAL REGISTERS

A B C D E* F H* L*
56 D0 01 50 00 00 FF FE

(* indicates register not used in program. Data after execution for these registers can change)

FLAG REGISTER

D7 D6 D5 D4 D3 D2 D1 D0
S Z X AC X P X CY
0 0 0 0 0 0 0 0
Expt. No. 21: Addition using keyboard monitor subroutines.

Aim:
b) Write a program for using microprocessor kit as calculator that would accept two digits from
keyboard using keyboard subroutine having starting address 02E7H. Add them and display
one byte result using monitor subroutine 036EH.
b) Enter the program on the microprocessor kit.
c) Execute the program. Write the contents of data memory locations before and after execution
and also the bit contents of all the five flags individually. Verify the results.

Program:

Address Label Mnemonic Hex Comment


Opcode Operand Code
C000 START: CALL 02E7 CD Call keypad subroutine to accept
C001 E7 1st digit in reg. A
C002 02
C003 MOV D,A 57 Move the reg. A contents to reg. D
C004 CALL 02E7 CD Call keypad subroutine to accept
C005 E7 2nd digit in reg. A
C006 02
C007 ADD D 82 Add the 2digits to get hex result
C008 DAA Decimal Adjust Accumulator
C009 CALL 036E CD Call monitor subroutine to display
C00A 6E sum (1 byte) number
C00B 03
C00C HLT 76 Halt the program

DETAILS AFTER PROGRAM EXECUTION

Memory Address Data Before Execution Data after execution


E 07
E 06
OUTPUT ON DISPLAY 13
Hex Code Sheet
Hex Mnemonic Hex Mnemonic Hex Mnemonic
CE ACI 8-bit EC CPE 16-bit EA JPE 16-bit
8F ADC A FE CPI 16-bit E2 JPO 16-bit
88 ADC B E4 CPO 16-bit CA JZ 16-bit
89 ADC C CC CZ 16-bit 3A LDA 16-bit
8A ADC D 27 DAA 0A LDAX B
8B ADC E 09 DAD B 1A LDAX D
8C ADC H 19 DAD D 2A LHLD 16-bit
8D ADC L 29 DAD H 01 LXI B,16-bit
8E ADC M 39 DAD SP 11 LXI D,16-bit
87 ADD A 3D DCR A 21 LXI H,16-bit
80 ADD B 05 DCR B 31 MOV SP,16-bit
81 ADD C 0D DCR C 7F MOV A,A
82 ADD D 15 DCR D 78 MOV A,B
83 ADD E 1D DCR E 79 MOV A,C
84 ADD H 25 DCR H 7A MOV A,D
85 ADD L 2D DCR L 7B MOV A,E
86 ADD M 35 DCR M 7C MOV A,H
C6 ADI 8-bit 0B DCX B 7D MOV A,L
A7 ANA A 1B DCX D 7E MOV A,M
A0 ANA B 2B DCX H 47 MOV B,A
A1 ANA C 3B DCX SP 40 MOV B,B
A2 ANA D F3 DI 41 MOV B,C
A3 ANA E FB EI 42 MOV B,D
A4 ANA H 76 HLT 43 MOV B,E
A5 ANA L DB IN 8-bit 44 MOV B,H
A6 ANA M 3C INR A 45 MOV B,L
E6 ANI 8-bit 04 INR B 46 MOV B,M
CD CALL 16-bit 0C INR C 4F MOV C,A
DC CC 16-bit 14 INR D 48 MOV C,B
FC CM 16-bit 1C INR E 49 MOV C,C
2F CMA 24 INR H 4A MOV C,D
3F CMC 2C INR L 4B MOV C,E
BF CMP A 34 INR M 4C MOV C,H
B8 CMP B 03 INX B 4D MOV C,L
B9 CMP C 13 INX D 4E MOV C,M
BA CMP D 23 INX H 57 MOV D,A
BB CMP E 33 INX SP 50 MOV D,B
BC CMP H DA JC 16-bit 51 MOV D,C
BD CMP L FA JM 16-bit 52 MOV D,D
BE CMP M C3 JMP 16-bit 53 MOV D,E
D4 CNC 16-bit D2 JNC 16-bit 54 MOV D,H
C4 CNZ 16-bit C2 JNZ 16-bit 55 MOV D,L
F4 CP 16-bit F2 JP 16-bit 56 MOV D,M

Hex Mnemonic Hex Mnemonic Hex Mnemonic


5F MOV E,A B2 ORA D 9C SBB H
58 MOV E,B B3 ORA E 9D SBB L
59 MOV E,C B4 ORA H 9E SBB M
5A MOV E,D B5 ORA L DE SBI 8-bit
5B MOV E,E B6 ORA M 22 SHLD 16-bit
5C MOV E,H F6 ORI 8-bit 30 SIM
5D MOV E,L D3 OUT 8-bit F9 SPHL
5E MOV E,M E9 PCHL 32 STA 16-bit
67 MOV H,A C1 POP B 02 STAX B
60 MOV H,B D1 POP D 12 STAX D
61 MOV H,C E1 POP H 37 STC
62 MOV H,D F1 POP PSW 97 SUB A
63 MOV H,E C5 PUSH B 90 SUB B
64 MOV H,H D5 PUSH D 91 SUB C
65 MOV H,L E5 PUSH H 92 SUB D
66 MOV H,M F5 PUSH PSW 93 SUB E
6F MOV L,A 17 RAL 94 SUB H
68 MOV L,B 1F RAR 95 SUB L
69 MOV L,C D8 RC 96 SUB M
6A MOV L,D C9 RET D6 SUB 8-bit
6B MOV L,E 20 RIM EB XCHG
6C MOV L,H 07 RLC AF XRA A
6D MOV L,L F8 RM A8 XRA B
6E MOV L,M D0 RNC A9 XRA C
77 MOV M,A C0 RNZ AA XRA D
70 MOV M,B F0 RP AB XRA E
71 MOV M,C E8 RPE AC XRA H
72 MOV M,D E0 RPO AD XRA L
73 MOV M,E 0F RRC AE XRA M
74 MOV M,H C7 RST 0 EE XRI 8-bit
75 MOV M,L CF RST 1 E3 XTHL
3E MVI A,8-bit D7 RST 2
06 MVI B,8-bit DF RST 3
0E MVI C,8-bit E7 RST 4
16 MVI D,8-bit EF RST 5
1E MVI E,8-bit F7 RST 6
26 MVI H,8-bit FF RST 7
2E MVI L,8-bit C8 RZ
36 MVI M,8-bit 9F SBB A
00 NOP 98 SBB B
B7 ORA A 99 SBB C
B0 ORA B 9A SBB D
B1 ORA C 9B SBB E

You might also like