Logo 
Search:

Assembly Language Articles

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

Program to find the square and cube of a number

Posted By: Raymond Fischer     Category: Assembly Language     Views: 17731

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

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

DATA SEGMENT
A DB 5
DATA ENDS
CODE SEGMENT
      ASSUME DS:DATA,CS:CODE
START:
      MOV AX,DATA
      MOV DS,AX
      MOV AH,00
      MOV AL,A
      MUL A
      MOV BL,AL
      MUL WORD PTR A
      MOV BH,AL
      MOV AX,4CH
      INT 21H
CODE ENDS
END START

;OUTPUT:->
;-R
;AX=0000  BX=0000  CX=002B  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0B98  ES=0B98  SS=0BA8  CS=0BA9  IP=0000   NV UP EI PL NZ NA PO NC
;0BA9:0000 B8A80B        MOV     AX,0BA8
;-T
;
;AX=0BA8  BX=0000  CX=002B  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0B98  ES=0B98  SS=0BA8  CS=0BA9  IP=0003   NV UP EI PL NZ NA PO NC
;0BA9:0003 8ED8          MOV     DS,AX
;-T
;
;AX=0BA8  BX=0000  CX=002B  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BA8  ES=0B98  SS=0BA8  CS=0BA9  IP=0005   NV UP EI PL NZ NA PO NC
;0BA9:0005 B400          MOV     AH,00
;-T
;
;AX=00A8  BX=0000  CX=002B  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BA8  ES=0B98  SS=0BA8  CS=0BA9  IP=0007   NV UP EI PL NZ NA PO NC
;0BA9:0007 A00000        MOV     AL,[0000]                          DS:0000=05
;-T
;
;AX=0005  BX=0000  CX=002B  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BA8  ES=0B98  SS=0BA8  CS=0BA9  IP=000A   NV UP EI PL NZ NA PO NC
;0BA9:000A F6260000      MUL     BYTE PTR [0000]                    DS:0000=05
;-T
;
;AX=0019  BX=0000  CX=002B  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BA8  ES=0B98  SS=0BA8  CS=0BA9  IP=000E   NV UP EI PL NZ NA PO NC
;0BA9:000E 8AD8          MOV     BL,AL
;-T
;
;AX=0019  BX=0019  CX=002B  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BA8  ES=0B98  SS=0BA8  CS=0BA9  IP=0010   NV UP EI PL NZ NA PO NC
;0BA9:0010 F7260000      MUL     WORD PTR [0000]                    DS:0000=0005
;-T
;
;AX=007D  BX=0019  CX=002B  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BA8  ES=0B98  SS=0BA8  CS=0BA9  IP=0014   NV UP EI PL NZ NA PO NC
;0BA9:0014 8AF8          MOV     BH,AL
;-T
;
;AX=007D  BX=7D19  CX=002B  DX=0000  SP=0000  BP=0000  SI=0000  DI=0000
;DS=0BA8  ES=0B98  SS=0BA8  CS=0BA9  IP=0016   NV UP EI PL NZ NA PO NC
;0BA9:0016 B84C00        MOV     AX,004C
;
  
Share: 


Didn't find what you were looking for? Find more on Program to find the square and cube of a number Or get search suggestion and latest updates.

Raymond Fischer
Raymond Fischer author of Program to find the square and cube of a number is from Frankfurt, Germany.
 
View All Articles

 
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!