×

Embedded Systems Tutorial

AVR Microcontroller

8051 Microcontroller

8085 Microprocessor

8086 Microprocessor

8255 Microprocessor

Embedded Systems Practice

Find Square of an 8-bit Number in 8085 Microprocessor

In this tutorial, we will learn how to find square of an 8-bit number in 8085 Microprocessor? By Akash Kumar Last updated : May 14, 2023

8085 program to find square of an 8-bit number

Given an 8-bit number, we have to write 8085 program to find its square.

Algorithm

  1. Load the register H with value 20H and the register L with value 50H and the value of accumulator with 00H.
  2. Load the content of register B with the value taken from memory.
  3. Add the content of M in accumulator A and decrement the value of register B by one.
  4. Check if value of register B is 00 if yes then store result at memory location otherwise goto step 3.
  5. Terminate the program.

Program

MVI     L 50
MVI     H 20
MVI     A 00
MOV     B, M
**ADD   M
DCR     B
JNZ **
STA     3050
HLT

Observation

INPUT:
2050 : 03

OUTPUT:
3050 : 09

Hence, we successfully find the square of an 8-bit number using 8085 Microprocessor.




Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.