Assembly 8086 - copy one buffer to another
<p>im working on a assembly program that reads the whole text file into a buffer then displays it in the console. It displays 24 lines (each line has a max lenght of 80, because im using a 80 wide * 25 height dossbox ) at once then waits for user input so the user can scroll through the text. </p>

<p>I wanted to add the number of line to the beginning of each line, so figured i could make a second buffer and copy chars 1by1 from the first one and when i find a newline i would call a procedure which would add the line number to the buffer, then continue till i proceed thru the whole buffer. But my way of copying from one buffer to the other is bad.</p>

<p>So i wanna copy 
BUFFA to BUFFB:</p>

<pre><code>mov di,OFFSET BUFFB ;so i set di to the beggining of bufferB




mov si,Pos         ;Pos is my position in the first buffer
lea bx,BUFFA[si]   ;move the content of buffA to bx , i think the problem is here
mov [di],bx        ;move to the addres of di the content of bx
inc di
inc Pos
</code></pre>

<p>the problem is when i print out the content of the second buffer i find out that i copy the value of si(same as Pos) to my buffer and not the content of the bufferA[si]. How can i fix this code?</p>

<p>Edit 1:</p>

<p>So the solution is using mov and al register:</p>

<pre><code>mov si,Pos
mov al,[BUFF + si]
mov [di],al
inc di
</code></pre>