I have written a small 8086 programme to display a string on the PC screen using MS DOS interrupts....
I would like to have my string "Hello World !" stored in the data segment...
My assembler a86/nasm demands the datasegment to be defined before the code segment...
The code is generated and when I see the .com file, the string is defined before the code.... And in DEBUG Utility, the string is placed at cs:0100 and the dat a is executed before the code.... I guess that the programming is giving the desired output only by fluke...
Please help....
Code:
.DATA SEGMENT
hm:
db 'Hello World'
.DATA ENDS
.CODE SEGMENT
mov ax,SEG hm
mov ds,ax
mov si,OFFSET hm
mov cx,0005h
mov ah,02h
writestring:
mov dl,[si]
int 21h
inc si
loop writestring
int 20h
.CODE ENDS