Write an assembly language program to find whether the number is even or odd.
Apparatus:8085 microprocessor kit.
Algorithm
Address | Opcode | Label | Mnemonic | Operand | Comments |
C000 | LDA | C0B0 | Move the number from memory location C0B1 to accumulator | ||
C003 | ANI | 01 | Perform logical ANDING operation of number with 01 | ||
C004 | 88 | ADD | B | Addition of Data1 (A) + Data2 (B). Result is saved in accumulator A. | |
C005 | JN | COOD | Jump to location C00D if ZF = 1 i.e. number is Even | ||
C008 | MVI | A,0D | Move „0D‟ in A | ||
C00A | JNZ | COOF | Jump to location C00F if ZF = 1 i.e. number is ODD | ||
C00D | MVI | A,0E | Move „0E‟ in A | ||
C00F | STA | COB1 | Store the contents of A at location C0B1 | ||
C010 | HLT | RST1 | Store the contents of A at location C0B1 |
Result:Check the contents of accumulator, if A = 0D then the given number is odd and if A=0E it is even.
Viva Questions:
I/O Interfacing with 8085 I/O Structure of a typical microcomputer:
There are three major types of data transfer between the microcomputer and art I/O device. They are,
Get all latest content delivered to your email a few times a month.