Here's the question you clicked on:
annas
hello guys can anyone help me with assembly language: i've to make a squaring and cubing function i.e x^2 , x^3 for the given number. what should i use IMUL or MUL function ?
IMUL is integer multiplication.....
IMUL is signed multiplication MUL is unsigned multiplication
so how would you make square function ?
here's the code.... DATA SEGMENT X DW 04H SQUARE DW ? CUBE DW ? DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX MOV AX,X MOV BX,X MUL BX MOV SQUARE,AX MUL BX MOV CUBE,AX MOV AH,4CH INT 21H CODE ENDS END START Input: x ----------- 4h Output: Square ---------10h Cube -----------40h ;Load the Data to AX. ;Move the Data AX to DS. ;Move the X number Data to AX. ;Move the X number Data to BX. ;Perform the multiplication by BX. ;Store value in SQUARE. ;Perform the multiplication by BX. ;Store value in CUBE. - 25