0

I'm trying to output the string "you can start typing here" on the console but it displays a big gap before the text as the picture shows. One line down and indented many columns.

screenshot

IDK what the problem is.
i'm using emu8086 assembly

DATA SEGMENT
str1 DB "you can start typing here : $"
ENDS

CODE SEGMENT
MOV ax,DATA
MOV ds,ax
MOV es, ax

start:
;displaying msg
mov dx, offset str1
mov ah, 09H
int 21h

;END of PROG
MOV AH,4CH
INT 21h

ENDS
end start

ret
Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
  • 1
    When you single-step the code in the debugger built-in to emu8086, does execution start at the top of `CODE SEGMENT`? If it starts at `start:`, then DS and ES wouldn't have been initialized correctly. – Peter Cordes Apr 02 '22 at 00:55
  • 1
    Since the last line says `end start` which sets the entry point, that should in fact be the case. – Jester Apr 02 '22 at 12:15
  • thank you @PeterCordes i've changed the place of start: just before code segment starts and now it works – Soraya Forward Apr 03 '22 at 09:39
  • Not an exact duplicate, but [What happens if you don't add start: and end start in EMU8086?](https://stackoverflow.com/q/58902858) is kind of the opposite problem. Tempted to close it anyway since that points out exactly what `end start` does, and single-step debugging likely would have found the problem here (that the init code doesn't execute). – Peter Cordes Apr 03 '22 at 09:52

0 Answers0