- 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 the given number is even or odd
In this program we will see how to check whether a number is odd or even.
Problem Statement
Write 8085 Assembly language program to check whether a number is odd or even.
Discussion
The Odd Even checking is very simple. we can determine one number is odd or even by checking only the LSb. When LSb is 1, the number is odd, otherwise it is even.In this program we are taking a number from memory and then ANDing 01H with it. if the result is nonzero, then the number is odd, otherwise it is even.
Input
first input
Address | Data |
---|---|
. . . | . . . |
8000 | 15 |
. . . | . . . |
second input
Address | Data |
---|---|
. . . | . . . |
8000 | 2C |
. . . | . . . |
Flow Diagram
Program
Address | HEX Codes | Label | Mnemonics | Comments |
---|---|---|---|---|
F000 | 3A, 00, 80 | LDA 8000H | Load the number from memory | |
F003 | E6, 01 | ANI 01H | AND 01H with Acc content | |
F005 | CA, 0D, F0 | JZ EVEN | If Z = 0, it is Even | |
F008 | 3E, 01 | MVI A, 01H | Load 01H to indicate it is Odd | |
F00A | C3, 0F, F0 | JMP STORE | Jump to store | |
F00D | 3E, FF | EVEN | MVI A, FFH | Load FFH to indicate it is Even |
F00F | 32, 50, 80 | STORE | STA 8050H | Store the result into memory |
F012 | 76 | HLT | Terminate the program |
Output
first input
Address | Data |
---|---|
. . . | . . . |
8000 | 01 |
. . . | . . . |
second input
Address | Data |
---|---|
. . . | . . . |
8000 | FF |
. . . | . . . |
- Related Articles
- C++ Program to Check Whether Number is Even or Odd
- Java Program to Check Whether a Number is Even or Odd
- Haskell Program to Check Whether a Number is Even or Odd
- Java program to find whether given number is even or odd
- Check whether given floating point number is even or odd in Python
- Python Program to Determine Whether a Given Number is Even or Odd Recursively
- Golang Program to Determine Recursively Whether a Given Number is Even or Odd
- 8085 program to check whether the given 16 bit number is palindrome or not
- Check whether the length of given linked list is Even or Odd in Python
- Java Menu Driven Program to Check Positive Negative or Odd Even Number
- PHP program to check if the total number of divisors of a number is even or odd
- Program to check whether the given number is Buzz Number or not in C++
- Program to check whether given number is Narcissistic number or not in Python
- How to Check if a Number is Odd or Even using Python?
- C Program to Check if count of divisors is even or odd?

Advertisements