hilleanne
March 2nd, 2009, 10:39 AM
im new here and im a student. will anyone help me in displaying the proper output in my code?
my program must calculate the cube of a number and display their product.
i have problem in displaying the product of the cube it displays random results.
here is my code please help me.
.model small
.stack 100h
.data
msg1 db 0Dh,0Ah,"Enter number between 1-9: $"
msg2 db 0Dh,0Ah,"The cube of the number is: $"
.code
start:
mov ax,@data
mov ds,ax
mov dx,offset msg1
mov ah,09h
int 21h
mov ah,1h
int 21h
cube:
mov bx,ax
mul bx
mul bx
mov cx,ax
mov bx,ax
shr bl,4
add bl,30h
shl cl,4
shr cl,4
mov cl,30h
shr bh,4
add bh,30h
mov ch,30h
mov ax,@data
mov ds,ax
mov dx,offset msg2
mov ah,09h
int 21h
mov ah,2d
mov dl,ch
mov ah,02h
int 21h
mov ah,2d
mov dl,bh
mov ah,02h
int 21h
mov ah,2d
mov dl,cl
mov ah,02h
int 21h
mov ah,2d
mov dl,bl
mov ah,02h
int 21h
quit:
mov ax,4c00h
int 21h
end
please help me im begging you.
reply in my yahoo account.
krazi_krayne@yahoo.com
thank you to the one who may help me im very grateful.
my program must calculate the cube of a number and display their product.
i have problem in displaying the product of the cube it displays random results.
here is my code please help me.
.model small
.stack 100h
.data
msg1 db 0Dh,0Ah,"Enter number between 1-9: $"
msg2 db 0Dh,0Ah,"The cube of the number is: $"
.code
start:
mov ax,@data
mov ds,ax
mov dx,offset msg1
mov ah,09h
int 21h
mov ah,1h
int 21h
cube:
mov bx,ax
mul bx
mul bx
mov cx,ax
mov bx,ax
shr bl,4
add bl,30h
shl cl,4
shr cl,4
mov cl,30h
shr bh,4
add bh,30h
mov ch,30h
mov ax,@data
mov ds,ax
mov dx,offset msg2
mov ah,09h
int 21h
mov ah,2d
mov dl,ch
mov ah,02h
int 21h
mov ah,2d
mov dl,bh
mov ah,02h
int 21h
mov ah,2d
mov dl,cl
mov ah,02h
int 21h
mov ah,2d
mov dl,bl
mov ah,02h
int 21h
quit:
mov ax,4c00h
int 21h
end
please help me im begging you.
reply in my yahoo account.
krazi_krayne@yahoo.com
thank you to the one who may help me im very grateful.