Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6130485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:51:50+00:00 2026-05-23T16:51:50+00:00

Im new to C. I have a const unsigned short array of 1024 hex

  • 0

Im new to C. I have a const unsigned short array of 1024 hex numbers. each hex number represents is 8 bits and represents bits to be turned on and off when displaying an image to a GBA screen. But nevermind all that and the DMA syntax I have below just for reference!!

My main question is…how can I iterate through elements in an array BY ADDRESS, grab those contents, then continue incrementing through addresses? Also, if you could give a stare to the below code and maybe see why Im getting:

"Program.c:(.text+0xe8): undefined reference to `myimg'" 

on the line that calls “drawImage3” and that would be rad.

(in the main of program.C):

const unsigned short *pt;  
pt = &myimg[0]; 
int size = 5;
drawImage3(15,15,img_WIDTH,img_HEIGHT, pt);

(defined elsewhere):

void drawImage3(int x, int y, int width, int height, const u16* image)
{
    int r;
    for (r=0; r<height; r++)
    {   
        DMA[3].src = &image;
        DMA[3].dst = &videoBuffer[OFFSET(x+width, y, 240)];
        DMA[3].cnt = width | DMA_SOURCE_FIXED | DMA_ON |   DMA_DESTINATION_INCREMENT;  
        image++;    
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T16:51:50+00:00Added an answer on May 23, 2026 at 4:51 pm

    You’re setting DMA[3].src to the address of a pointer, which is probably not what you want to do. For clarity’s sake, here’s what these references mean:

    *image    -- the value of the thing which image points to
     image[0] -- same as *image
     image    -- the location in memory of your thing
    &image    -- the location in memory that is storing your pointer
    &image[0] -- same as image
    &image[n] -- the location of the nth element in your thing
    

    So instead of DMA[3].src = &image;, you probably want one of these two:

    DMA[3].src = &image[r];    # If you do this do NOT increment image
    

    or

    DMA[3].src = image;        # And continue to increment image
    

    If you choose the latter, then

    DMA[3].src = image;
    image++;
    

    Can be better written as:

    DMA[3].src = image++;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an array of a few million numbers. double* const data = new
I have binary data in a byte sequence described by const unsigned char *p
Looks like operator new and operator new[] have exactly the same signature: void* operator
When we have new in C#, that personally I see only as a workaround
I made a similar question a few days ago, but now I have new
I have a new 1 TB drive coming in tomorrow. What is the best
I have a new object with a collection of new objects within it on
I have a new VPS server, and I'm trying to get it to connect
I have a new app I'll be working on where I have to generate
I have a new project which simply put, is an attempt to formalize the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.