29 lines
894 B
Plaintext
29 lines
894 B
Plaintext
.model small
|
|
.stack 1024
|
|
|
|
.data
|
|
|
|
myString byte "Hello World!",0 ; a null-terminated string
|
|
|
|
StringRam byte 256 dup (0) ;256 null bytes
|
|
|
|
.code
|
|
|
|
mov ax,@data
|
|
mov ds,ax ;load data segment into DS
|
|
mov es,ax ;also load it into ES
|
|
|
|
mov si,offset myString
|
|
mov di,offset StringRam
|
|
mov cx,12 ;length of myString
|
|
cld ;make MOVSB auto-increment rather than auto-decrement (I'm pretty sure DOS begins with
|
|
;the direction flag cleared but just to be safe)
|
|
|
|
rep movsb ;copies 12 bytes from [ds:si] to [es:di]
|
|
mov al,0 ;create a null terminator
|
|
stosb ;store at the end. (It's already there since we initialized StringRam to zeroes, but you may need to do this depending
|
|
;on what was previously stored in StringRam, if you've copied a string there already.
|
|
|
|
mov ax,4C00h
|
|
int 21h ;quit program and return to DOS
|