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.
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.
So i wanna copy BUFFA to BUFFB:
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
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?
Edit 1:
So the solution is using mov and al register:
mov si,Pos
mov al,[BUFF + si]
mov [di],al
inc di