Showing posts with label how to find square of program. Show all posts
Showing posts with label how to find square of program. Show all posts

Friday, November 12, 2021

8085/8086 Microprocessor Assembly Language Program to Find Square of a Number

This 8085/8086 microprocessor assembly language program asks users to input a number and finds out the square of a number and then prints it. This 8085/8086 microprocessor assembly language program has one more feature by which it doesn't accept any value other than decimal numbers and asks users if they want to quit the program or not 

TITLE PUCHTAA
.MODEL SMALL
.STACK 100H
.DATA


    MSG DB 0AH, 0DH, "ENTER A NUMBER TO SQUARE IT: $"
    OUT1 DB 0AH, 0DH, "SQUARE OF $"
    OUT2 DB " IS $"
    QUIT DB 0AH, 0DH, "CONTINUE? Y FOR YES ELSE FOR NO: $"
   
.CODE
   
    MAIN:
        MOV AX, @DATA
        MOV DS, AX
    AGAIN:
        LEA DX, MSG
        MOV AH, 09H
        INT 21H
               
        MOV AH, 01H
        INT 21H
       
        PUSH AX
       
        CMP AL, 39H
        JG AGAIN
        CMP AL, 30H
        JL AGAIN
       
        PUSH AX
       
        SUB AL, 30H
        MOV BL, AL
        MUL BL
        AAM
               
        MOV BX, AX
       
        LEA DX, OUT1
        MOV AH, 09H
        INT 21H
       
        POP DX
        MOV AH, 02H
        INT 21H
       
        LEA DX, OUT2
        MOV AH, 09H
        INT 21H
       
        MOV DL, BH
        ADD DL, 30H
        MOV AH, 02H
        INT 21H
       
        MOV DL, BL
        ADD DL, 30H
        MOV AH, 02H
        INT 21H
       
        LEA DX, QUIT
        MOV AH, 09H
        INT 21H
       
        MOV AH, 01H
        INT 21H
        OR AL, 20H
        CMP AL, 'y'
        JE AGAIN
       
        MOV AH, 04CH
        INT 21H
    END MAIN

Complete Video Tutorials