Now I've written a new shifting procedure that uses less code and hopyfully will work for any given array but if it will run with similar speed that's the next question. At first I copied element by element inside two loops. Now I copy the whole array to another array with ArrCop[] = Arr[] and then paste the copy to the original with the given x and y offset. Still clearing the remaining elements with a new loop would be stupid. The following code is untested, please take a look on it and tell me what do you think it's the best way to do the task by using basic only. To remember, I need to shift the contents of any array with a single procedure to any extension - using basic code only, as less as possible and fast.

`FUNCTION ShiftArray: Arr%[], XExt%, YExt%`

LOCAL ArrCop%[]

LOCAL ACX%, ACY%

LOCAL AX%, AY%

LOCAL W%, H%

IF XExt < 0

ACX = ABS(XExt)

ELSE

AX = XExt

ENDIF

IF YExt < 0

ACY = ABS(YExt)

ELSE

AY = YExt

ENDIF

W = BOUNDS(Arr[], 0)

H = BOUNDS(Arr[], 1)

ArrCop[] = Arr[]

FOR i = AX TO H - AY - 1

FOR j = AY TO W - AX - 1

Arr[AX + j][AY + i] = ArrCop[ACX + j][ACY + i]

NEXT

NEXT

ENDFUNCTION

Zeroization is still not in there. XExt and YExt are the given movements, positive values shift right, negative ones left. ACX and ACY are the start coordinates where the copy will read, AX and AY the coordinates to start writing on the origin array. Would like to replace the first two IF-ENDIF's by formulas to set the right values but can't figure out how. Finally want to build the zeroization inside the double loop not using another one for that.