Hi All,
I am a newbie to ASM. I am looping through a 2D array of data. the trick is that it is of type rgbtriple, which is a 3 byte size per entry. I was able to get the code to work and to get me to the exact memory address of the data, but the problem is getting the rgbtriple value out of that location. I used an 1 element array to DIM...AT the memory location (z) to get the value. I then look at the color components and compare them to the known components and they do not match. any ideas? code below.
I am a newbie to ASM. I am looping through a 2D array of data. the trick is that it is of type rgbtriple, which is a 3 byte size per entry. I was able to get the code to work and to get me to the exact memory address of the data, but the problem is getting the rgbtriple value out of that location. I used an 1 element array to DIM...AT the memory location (z) to get the value. I then look at the color components and compare them to the known components and they do not match. any ideas? code below.
Code:
!mov y,2 yloop: !mov x,2 xloop: LOCAL z AS LONG !mov eax, 640 'get the size of the first array dimension !mov ebx,y !sub ebx,1 !imul eax,ebx 'to get how many items to skip for each member of this dimension !mov ebx,x !add eax,ebx 'add the offset into the next dimension !imul eax,3 'there are 3 bytes per element '!mov ebx,eax '!mov i,ebx 'PRINT#12,"i2:";i '!mov eax,ebx !add eax, arrPtr 'add the start address of the data !sub eax,3 !mov z,eax REDIM y(1) AS rgbtriple AT z PRINT#12,"actual ";inImg(x, y).rgbtred,inImg(1).rgbtblue,inImg(1).rgbtgreen PRINT#12,"bctual ";y(1).rgbtred,y(1).rgbtblue,y(1).rgbtgreen PRINT#12, !add x,1 'add 1 to b& !cmp x,ecx 'has it exceeded the loop limit? !jle xloop 'it's less than or equal so no, loop back. !add y,1 'add 1 to b& !cmp y,edx 'has it exceeded the loop limit? !jle yloop 'it's less than or equal so no, loop back.
Comment