Here's some code for MASM...(though its set for DOS and you will need the old 16 bit linker to get it to work - that's available at http://spiff.tripnet.se/~iczelion/)
Code:
.286
.model small
MYSTACK SEGMENT STACK
db 512 DUP('?')
MYSTACK ENDS
MYDATA SEGMENT
source db "Hello World",0
string db 50 DUP(0)
MYDATA ENDS
;#####################################################
;#####################################################
.CODE
start:
;
; 1 - Sort out the segemnts
;
mov ax,MYDATA ;get data segment address
mov es,ax ;mov into ES...
mov ds,ax ;...and DS
;
;2 - Get string length
;
lea di, source ;load address of string
xor ax,ax ;ax = 0
mov cx,0FFFFh ;cx = max str len
repnz scasb ;scan for NULL
neg cx ;cx = -len..so make pos
dec cx ;dec for 2s comp
push cx ;save on stack
;
;3 - Copy data
;
cld ;clear direction flag
lea si,source ;load source
lea di,string ;load destination
rep movsb ;copy cx amount of bytes
;
;4 - Print to screen
;
pop cx ;restore cx
lea dx,string ;reload string in dx
mov ah,40h ;print to screen
mov bx,1 ;output handle 1
int 21h ;call dos
;
;5 - Exit prog
;
mov ax,4C00h ;dos exit
int 21h ;call dos
end start
Get used to storing data in segments....the other option you have is building stack frames....and if you dont know what you are doing its difficult....