Quote
>I did figure that out, but I wasn't sure how to access them? As in how
>would I move them to another destination? I have an array that I move to
>the screen memory, and am at the moment moving strings to the array with an
>asm method (so it converts the string to a [char][attr] format.)
Well, take a closer look at the array stuff1
stuff1: array[1..10] of PChar ...
This could be depicted as follows
stuff1:
1 | address of 1. string | -----> 'fsakdfaljf'
2 | address of 2. string | -----> 'lkdflkdadksjf'
...
10 | address of 3. string | -----> 'dsklfjasl'
Suppose you want to access the ith (i being integer ) string, in particular you want to load the
address of the first char of that string into registers of the cpu, suppose ds:si, since you will
very likely use es:di for the destination.
I propose the following
var
i: integer
{...}
asm
mov si,OFFSET stuff1 { load the base address of array stuff1}
mov ax,i { load ax with the index i}
dec ax { the array starts with index 1}
shl ax,1 { multiply by 4 ...
shl ax,1 { which is the element size, SizeOf(PChar)=4 }
add si,ax { add it to si, now you can access the ith element in stuff1
via ds:si. I assumed that the strings are embedded in the code
segment, but they are in the data segment, which makes things easier }
mov si,word ptr [si] { load the offset of the first char of the ith string into ds:si }
end;
Now you can access each character of the ith string via ds:si. Just increment si to point to the
next character, but thats clear to you, I suppose. Don't forget that the first byte is not the
string length and that the strings are null terminated, since we change from pascal strings to
C-strings.
Good luck