0

I am a beginner in 8086 assembly language and am having trouble with the code. My code does work, i.e, it does print the string inputted, but shows two extra characters before displaying the actual string. I have no idea where those extra characters are coming from. Any help would be beneficial. Thanks!

        lea dx, var1 
        mov ah, 0ah ;getting buffered input and storing it in var1
        int 21h

        mov dl, 10 ;line feed character being displayed
        mov ah, 2h
        int 21h

        mov dx, 0 ;clearing the registers
        mov ah, 0
        mov dl, 0

         lea dx, var1 ;print the string var1 to the screen
          mov ah, 9h
         int 21h
Michael Petch
  • 46,082
  • 8
  • 107
  • 198
RdKu
  • 11
  • 6
  • 2
    You may wish to look at the documentation for `Int 21h/ah-0ah`. http://www.ctyme.com/intr/rb-2563.htm . At the bottom you should note that the first 2 bytes contain data (needed for both calling and what is returned). As well the input buffer isn't `$` terminated. You'd have to `$` terminate it yourself to properly use `int 21h/ah=9h` – Michael Petch Mar 19 '20 at 00:18
  • 1
    Thanks so much, it did help. I was stuck at it from a while. Thanks again @MichaelPetch – RdKu Mar 19 '20 at 00:24

0 Answers0