Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,20 @@
.model small
.stack 1024
.data
myString byte "Hello World!",0 ; a null-terminated string
myStruct word 0
.code
mov ax,@data
mov ds,ax ;load data segment into DS
mov bx,offset myString ;get the pointer to myString
mov word ptr [ds:myStruct],bx
mov ax,4C00h
int 21h ;quit program and return to DOS

View file

@ -0,0 +1,28 @@
.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