PDA

View Full Version : Arrays in assembly code



spasodda
- 10th April 2006, 11:19
Hi,
How can I read an array of bytes inside the ASM/ENDASM code?
I think there's a problem with variables name...

here's my code:

btfss _A8
and _matrice[0],w
btfss _A9
and _matrice[1],w

compiler returns "illegal character '[' "....

hope someone can help me...

Bye

Jerson
- 10th April 2006, 16:31
How have you specified matrice ? If it is a byte sized variable, then your statements should be

btfss _A8
and _matrice+0,w
btfss _A9
and _matrice+1,w

If your variable is a word sized variable, then you need to read/write word sized variables like this

btfss _A8
;; read the word from matrice[0] assuming MSB first (Big endian)
;; movf matrice+0,w
;; movwf TempM ; read the msb
;; movf matrice+1,w
;; movwf TempL ; read the lsb
;; --- now perform the operation you desire here

I hope I have been able to address your query

Jerson

spasodda
- 10th April 2006, 20:44
Thanks Jerson,
it's a byte sized array and it works!
Thanks again
Mario