I am fairly new to assembly language and I am having a problem with my project. The project is fairly simple, but i am having trouble with input. I am tryint to enter in a number of unknown length 1 digit at a time (eg 16) would be 1 then 6. I am reading the first number and multiplying a register with value 0 inside my loop then adding the newly read number to the total. So enter 1 multiply 0 by 10 then add one gives 1 then enter 6...1x10=10 +6 = 16. I need to exit the loop when enter is pressed and then print the 16 back out by dividing by 10 printing al then ah to print 16...I have looked over my code several times and still am getting incorrect output. Whenever 16 is entered 32 is output. Whenever 8 is intered 56 is output?? can someone please help me with this problem.
.MODEL small
.STACK 100h
.DATA
.CODE ;the next few lines must be present
Main: mov ax,@data
mov ds,ax
mov ch,10
LIN: mov ah,1
int 21h
cmp al,13
je lloop
mov cl,al
mov al,ch
mov ah,0
mul bl
mov bl,al
add bl,cl
jmp lin
lloop: mov ah,0
mov al,bl
div ch
mov dl,al
add dl,30H
mov bh,ah
mov ah,2
int 21h
mov dl,bh
add dl,30H
mov ah,2
int 21h
mov ah,4ch ;must be present to run program
int 21h ;this one too
END Main ;this one too
also i know that the code is sloppy and uncommented but its fairly simple and this is just a quick job for the first part of the project.