want to change dotmatrix shift direction.

void moveLeft(byte pixels, byte rowstart, byte rowstop) { // routine to move certain rows on the screen "pixels" pixels to the left
  byte row, column; 
  short unsigned int address;
  
  for (column = 0; column < 8; column++) { 
    
    for (row = rowstart; row < rowstop; row++) {
      
      address = (row<<3) + column; /// right here!
      
      if (column==7) 
         buffer[address] = buffer[address]<<pixels; // shuffle pixels left on last column and fill with a blank
         
      else {                // shuffle pixels left and add leftmost pixels from next column
          byte incomingchar = buffer[address+1];
          buffer[address] = buffer[address]<<pixels;
          for (byte x = 0; x < pixels; x++) { buffer[address] += ((incomingchar & (128>>x)) >> (7-x))<<(pixels-x-1); };
      }
      
    }
    
  }
};

this is left shift code.
but i want right shift.
I've tried so many things, but I haven't succeeded in two days.
I want a strong hint or a right shift code. Can you help me? :frowning:

Is this a school assignment?

jihoonkimtech:

void moveLeft(byte pixels, byte rowstart, byte rowstop) { // routine to move certain rows on the screen "pixels" pixels to the left

byte row, column;
  short unsigned int address;
 
  for (column = 0; column < 8; column++) {
   
    for (row = rowstart; row < rowstop; row++) {
     
      address = (row<<3) + column; /// right here!
     
      if (column==7)
        buffer[address] = buffer[address]<<pixels; // shuffle pixels left on last column and fill with a blank
       
      else {                // shuffle pixels left and add leftmost pixels from next column
          byte incomingchar = buffer[address+1];
          buffer[address] = buffer[address]<<pixels;
          for (byte x = 0; x < pixels; x++) { buffer[address] += ((incomingchar & (128>>x)) >> (7-x))<<(pixels-x-1); };
      }
     
    }
   
  }
};




this is left shift code.
but i want right shift.
I've tried so many things, but I haven't succeeded in two days.
I want a strong hint or a right shift code. Can you help me? :(

Which column would you start with if you wanted to shift something to the right? And after that shift, which column would you use for the next shift?

Paul

aarg:
Is this a school assignment?

Nope, is my personal project.

Paul_KD7HB:
Which column would you start with if you wanted to shift something to the right? And after that shift, which column would you use for the next shift?

Paul

byte buffer[256] = { // Display buffer (which is scanned by the interrupt timer) of 8x32 bytes
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};

The current code based on my most we move on to the left of the column beginning with the right.
(left column [127]..(repeat, +8).....[7])
(dotmatrix size is 64x16)
I want it to shift from the left to the right.