wrong output??

Reply

Join Date: Feb 2009
Posts: 7
Reputation: jrw0267 is an unknown quantity at this point 
Solved Threads: 0
jrw0267's Avatar
jrw0267 jrw0267 is offline Offline
Newbie Poster

wrong output??

 
0
  #1
Apr 15th, 2009
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.
  1. .MODEL small
  2. .STACK 100h
  3. .DATA
  4.  
  5. .CODE ;the next few lines must be present
  6. Main: mov ax,@data
  7. mov ds,ax
  8.  
  9.  
  10. mov ch,10
  11.  
  12. LIN: mov ah,1
  13. int 21h
  14. cmp al,13
  15. je lloop
  16. mov cl,al
  17. mov al,ch
  18. mov ah,0
  19. mul bl
  20. mov bl,al
  21. add bl,cl
  22. jmp lin
  23.  
  24. lloop: mov ah,0
  25. mov al,bl
  26. div ch
  27. mov dl,al
  28. add dl,30H
  29. mov bh,ah
  30. mov ah,2
  31. int 21h
  32. mov dl,bh
  33. add dl,30H
  34. mov ah,2
  35. int 21h
  36.  
  37. mov ah,4ch ;must be present to run program
  38. int 21h ;this one too
  39. 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.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Assembly Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC