943,867 Members | Top Members by Rank

Ad:
  • Assembly Discussion Thread
  • Unsolved
  • Views: 311
  • Assembly RSS
Apr 15th, 2009
0

wrong output??

Expand Post »
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.
Assembly Syntax (Toggle Plain Text)
  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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
jrw0267 is offline Offline
7 posts
since Feb 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Assembly Forum Timeline: Memory interface Problem!!!
Next Thread in Assembly Forum Timeline: String input





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC