Tyler
Tyler

Reputation: 1

Copy string into an array in Assembly

I am attempting to copy a string into an array in the Assembly language. Basically the program asks a user for their name, then adds them to a list of users. I can read in the string just fine, but am unsure how to store string values into an array. I know the eax value stores the length of the string, but I need to store the string itself. Any tips on how to do this?

Thanks in advance.

Upvotes: 0

Views: 3779

Answers (2)

wahyu
wahyu

Reputation: 11

maybe you mean like this :

.model small
.code
org 100h

data:
    kal1 db 'MIKROSKIL$'
    kal2 db 11 dup(?)
code1:
    mov bx,0
ulang1:
    mov dl,kal1[bx]
    mov kal2[bx],dl
    inc bx
    cmp dl,'$'
    jne ulang1
    mov ah,9
    mov dx,offset kal2
    int 21h
    int 20h
end data

Upvotes: 1

Thomas
Thomas

Reputation: 2137

To store the strings in an "array" you store the addresses of the start of the strings.

Upvotes: 2

Related Questions