- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
8085 program to check whether both the nibbles of 8 bit number are equal or not
Here we will see how to check whether two nibbles of a number are same or not.
Problem Statement
Write 8085 Assembly language program to check whether upper nibble and lower nibbles are same or not.
Discussion
To check the nibbles, we have to mask at first. So we need to mask the lower nibble and upper nibble and store them into different registers. The upper nibble will be shifted to the right four bits to make it lower nibble. Then we can check both are same or not. If they are same store 00 at F150 location, otherwise store FF at F150 location.
Input
Address | Data |
---|---|
F050 | FE |
Address | Data |
---|---|
F050 | AA |
Flow Diagram
program
Address | HEX Codes | Labels | Mnemonics | Comments |
---|---|---|---|---|
F000 | 3A, 50 F0 | | LDA F050 | memory element of F050 |
F003 | 47 | | MOV B, A | Load A into B |
F004 | E6, 0F | | ANI 0F | Mask upper nibble |
F006 | 4F | | MOV C, A | Load C with A |
F007 | 78 | | MOV A, B | Load A with B |
F008 | E6, F0 | | ANI F0 | Mask lower nibble |
F00A | 07 | | RLC | Rotate A to the left |
F00B | 07 | | RLC | Rotate A to the left |
F00C | 07 | | RLC | Rotate A to the left |
F00D | 07 | | RLC | Rotate A to the left |
F00E | B9 | | CMP C | Compare C and A |
F00F | CA, 17, F0 | | JZ LABEL | If Z flag is enabled jump to Label |
F012 | 3E, FF | | MVI A, FF | Load A with FF |
F014 | C3, 19, F0 | | JMP STORE | Jump to Store |
F017 | 3E, 00 | LABEL | MVI A, 00 | Load A with 00H |
F019 | 32, 50, F1 | STORE | STA F150 | Store result at memory F150 |
F01C | 76 | | HLT | Terminate the program |
Output
Address | Data |
---|---|
F150 | FF |
Address | Data |
---|---|
F150 | 00 |
- Related Articles
- 8085 program to perform AND operation in nibbles of 8 bit number
- 8085 program to check whether the given 16 bit number is palindrome or not
- 8085 program to show masking of lower and higher nibbles of 8-bit number
- 8085 program to reverse 8 bit number
- Golang Program to Check Whether Two Matrices are Equal or Not
- Swift Program to Check Whether Two Matrices Are Equal or Not
- JavaScript Program to Check whether all the rotations of a given number are greater than or equal to the given number or not
- 8085 program to find square of a 8 bit number
- 8085 Program to Divide a 16-bit number by an 8-bit number
- 8085 program to check whether the given number is even or odd
- 8085 program to count number of once in the given 8-bit number
- 8085 program to find sum of digits of 8 bit number
- 8085 program to convert an 8 bit number into Grey number
- 8085 program to find minimum value of digit in the 8 bit number
- Check whether two schedules are view equal or not(DBMS)

Advertisements