For Context I am working on an unfinished space invaders emulator and I want to draw to the screen but my double stacked for loop is sad and slow and I (currently) do not know how to convert a 256*2401d array to a 320*240 1d array so im basically wondering is there a way to speed up my for loops

the code in question


for(int pxlx = 0; pxlx < 256; pxlx++)
      for(int pxly = 0; pxly < 28; pxly++)
         gfx_SetColor(255*(state->memory[0x2400+(256 * pxlx + pxly) & 0b00000001] == 0b00000001));
         gfx_SetColor(255*(state->memory[0x2400+(256 * pxlx + pxly) & 0b00000010] == 0b00000010));
         gfx_SetColor(255*(state->memory[0x2400+(256 * pxlx + pxly) & 0b00000100] == 0b00000100));
         gfx_SetColor(255*(state->memory[0x2400+(256 * pxlx + pxly) & 0b00001000] == 0b00001000));
         gfx_SetColor(255*(state->memory[0x2400+(256 * pxlx + pxly) & 0b00010000] == 0b00010000));
         gfx_SetColor(255*(state->memory[0x2400+(256 * pxlx + pxly) & 0b00100000] == 0b00100000));
         gfx_SetColor(255*(state->memory[0x2400+(256 * pxlx + pxly) & 0b01000000] == 0b01000000));
         gfx_SetColor(255*(state->memory[0x2400+(256 * pxlx + pxly) & 0b10000000] == 0b10000000));
This is supported natively by the hardware (but not by graphx), depending on what you want the lcd to display outside the 256x240 region.
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum