Write an assembly language program to check the number in memory location C000H is even or odd, if the number is even, store EEH in memory location D000H else store 00H in same location.
Algorithm for Assembly Language programming in Intel 8085 Microprocessor
Step 1: Point HL register pair to memory location C000H
Step 2: Store 05H in memory location C000H.
Step 3: Move content of memory location to the Accumulator.
Step 4: Rotate accumulator right through carry
Step 5: If carry is obtained from Step 4: then jump to Step 8:
Step 6: Load Accumulator with EEH (number is even)
Step 7: Unconditional jump to Step 9:
Step 8: Load Accumulator with 00H (number is odd)
Step 9: Store content of Accumulator to memory location D000H
Step 10: Terminate the program
Assembly language for programming in Intel 8085 Microprocessor
|LXI H, C000H ;||HL register pair points at memory location C000H|
|MVI M, 05 H ;||Stores 05H to memory location|
|MOV A, M ;||Moves content of memory location to accumulator|
|RAR ;||Rotates accumulator right with carry|
|JC jump1;||If carry jumps to jump1:|
|MVI A, EEH ;||Loads accumulator with EEH|
|JMP jump2;||Unconditionally jumps to jump2:|
|jump1:||MVI A, 00H ;||Loads accumulator (A) with 00H|
|jump2:||STA D000H ;||Stores content of A to D000H|
|HLT ;||Terminates the program|