Hi, Im trying to write some of my PBP code in ASM. The bit im stuck on is setting values in an array. I know arrays dont really exist in ASM but i know its still possible to do what i want. After reading Mike's example in another thread i can see that i can access the elements of an array by using +1, +2 etc. Thats fine when its being added to a constant value. In Mike's example "Led" appears to be the address of the first element in the array.

The array im working on at the moment uses a variable to decide which element to put data in. Heres the PBP version of the code
Code:
bOutData[bOutDataPos]=cControlCharOut	'Control character (a constant)
bOutDataPos=bOutDataPos+1
bOutData[bOutDataPos]=0			'Data length (always zero here)
bOutDataPos=bOutDataPos+1
bOutData[bOutDataPos]=aAddress		'Chip address (from variable aAddress)
bOutDataPos=bOutDataPos+1
bOutData[bOutDataPos]=cAction		'Action (another constant)
bOutDataPos=bOutDataPos+1
bOutData is an output buffer array. bOutDataPos gets incremented every time a byte is added to the array. The send routine elsewhere in the code then sends a byte, shifts all bytes up 1 place in the array then decrements bOutDataPos.

So, can anyone point me in the right direction here? I just need to know how to access the array elements based on the value in bOutDataPos