Logo 
Search:

Assembly Language Articles

Submit Article
Home » Articles » Assembly Language » Homework HelpRSS Feeds

Program to find the square and cube of a number use subroutine

Posted By: Rose Hughes     Category: Assembly Language     Views: 10510

Write a program to find the square and cube of a number use subroutine.

Code for Program to find the square and cube of a number use subroutine in Assembly Language

DATA SEGMENT
    NO DB 2
DATA ENDS

CODE SEGMENT
         SQUARE PROC NEAR
         ASSUME CS:CODE
         MOV AX,0000
         MOV AL,BL
         MUL BL
         MOV CX,AX
         MUL BL
         MOV BX,AX
         RET
         SQUARE ENDP
         ASSUME DS:DATA,CS:CODE
START:
         MOV AX,DATA
         MOV DS,AX
         MOV BL,NO
         CALL SQUARE
         MOV BL,00H
         MOV AH,4CH
         INT 21H
CODE ENDS
END START

;------
;OUTPUT
;------

        -G CS:001A

        AX=0008  BX=0008  CX=0004  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
        DS=0BAC  ES=0B9C  SS=0BAC  CS=0BAD  IP=001A   NV UP EI PL NZ NA PO NC
        0BAD:001A B300          MOV     BL,00
  
Share: 



Rose Hughes
Rose Hughes author of Program to find the square and cube of a number use subroutine is from London, United Kingdom.
 
View All Articles

 

Other Interesting Articles in Assembly Language:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!