Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

CGameProgrammer

ASM: Copying array data

This topic is 6924 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to write a routine to load a bitmap from a file, in Assembly. (I'm insane.) An error occurs when I try copying the BGR information from the bitmap to a temporary RGB array.

Here's the situation: Both have been successfully allocated, with EDX pointing to the source of BGR (blue,green,red) byte triplets, and EBX pointing to an array that I need to fill with R,G,B byte triplets. ECX holds the size (width*height) of the bitmap.

Code:


BeginLoop:

.If g_wBitsPerPixel == 24

Add EDX, 2 ; Position src ptr so we're at the red value.
Mov AL, Byte Ptr [EDX]
Mov Byte Ptr [EBX], AL
Inc EBX
Dec EDX ; Position src ptr so we're at the green value.
Mov AL, Byte Ptr [EDX]
Mov Byte Ptr [EBX], AL
Inc EBX
Dec EDX ; Position src ptr so we're at the blue value.
Mov AL, Byte Ptr [EDX]
Mov Byte Ptr [EBX], AL
Inc EBX
Add EDX, 3 ; Position src ptr for next loop.

.EndIf

Dec ECX
Cmp ECX, 0
JNE BeginLoop ; If ECX != 0 goto BeginLoop

Somewhere in there, an error is occuring. Any ideas?

------------------
~CGameProgrammer( );

[This message has been edited by CGameProgrammer (edited October 05, 1999).]

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!