Hey guys,
I'm new to assembler and my first assignment is to write code that ask from the user number between 00 to 99 and multiply by himself, for example the user enter 77, so 77*77=5929
i believe i'm having trouble to print back the result, This is my code so far :
**Update - i fixed my code and now its working
.MODEL SMALL
.STACK 100h .DATA
Var1 DW ?
Res DD ?
Ten DW 10
PromptStr DB 'Please Enter Number (from 00 up to 99):',13,10,'$'
ResultStr DB 13,10,'Sqr(xx) = xxxx',13,10,'$'
.CODE
MOV AX,@DATA
MOV DS,AX
MOV AH,9
MOV DX,OFFSET PromptStr
INT 21h
MOV AH,1
INT 21h
MOV ResultStr[6],AL
SUB AL,'0'
MOV AH,0
MUL Ten
MOV Var1,AX
MOV AX,0
MOV AH,1
INT 21h
MOV ResultStr[7],AL
SUB AL,'0'
MOV AH,0
ADD AX,Var1
MOV Var1,AX
MUL VAR1
MOV WORD PTR Res,AX
MOV WORD PTR Res+2,DX
DIV Ten
ADD DX,'0'
MOV ResultStr[16],DL
MOV DX,0
DIV Ten
ADD DX,'0'
MOV ResultStr[15],DL
MOV DX,0
DIV Ten
ADD DX,'0'
MOV ResultStr[14],DL
MOV DX,0
DIV Ten
ADD DX,'0'
MOV ResultStr[13],DL
MOV DX,0
MOV AH,9
MOV DX,OFFSET ResultStr
INT 21h
MOV AH,4Ch
INT 21h
END