Thursday, November 18, 2021

Find Cube | 8086 Microprocessor Assembly Language Program

 This x86 Assembly Language program takes users input in 8086 Microprocessor Assembly Language and prints the cube of it.

To run this x86 Assembly Code you need to Download emu8086 software. Copy the following 8086 microprocessor Assembly Language code and paste this code to emu8086 and hit the play button.

TITLE PUCHTAA
.MODEL SMALL
.STACK 100H
.DATA


    MSG DB 0AH, 0DH, "ENTER A NUMBER TO FIND CUBE OF IT: $"
    OUT1 DB 0AH, 0DH, "CUBE 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
        PUSH AX
       
        SUB AL, 30H
        MOV BL, AL
        MUL BL
        AAM
               
        MOV BX, AX ; BH = 06, BL, 04 ; IF ENTERED 08
       
        POP AX
       
        SUB AL, 30H
       
        MUL BL
       
        AAM
       
        MOV CL, AL ; FIRST RESULT
        MOV CH, AH ;CARRY
        POP AX
       
        SUB AL, 30H
        MOV BL, AL
        MOV AL, BH
        MUL BL
        AAM
       
        ADD AL, CH
        AAA
       
        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
       
       
        MOV DL, CL
        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


OUTPUT 

Find Cube | 8086 Microprocessor Assembly Language Program












TAGS:

  • assembly language
  • emu8086
  • assembly code
  • assembly language programming
  • x86 assembly
  • assembly language example
  • cube of number assembly language

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