bigwhiteegg 0 Light Poster

here is part of a C++ function that i'm having difficulty translating

void rotate(int ls[], int n)
{ int j;
  int temp;
  temp = is[0];
  for(j=0; j<n-1; j++)
  { ls[j]=ls[j+1]; }
  ls[n-1]=temp;
}

so far this is what i have

;void rotate(int ls[], int n)
j3:      .EQUATE 0
temp:    .EQUATE 4
rotate:  SUBSP   4,i
         LDX     0,i
         LDX     list,x
         STX     temp,s
         LDX     numItems,d
         SUBX    1,i
         STX     numItems,d
         LDX     0,i
         STX     j3,s
for3:    CPX     numItems,d
         BRGE    endFor3
         ASLX

i do not know how to switch ls[j] and ls[j+1]
can some1 help me out??

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.