Arrays in assembly code


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2006
    Posts
    2

    Default Arrays in assembly code

    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

  2. #2
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    947


    Did you find this post helpful? Yes | No

    Default First you need the variable size

    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

  3. #3
    Join Date
    Apr 2006
    Posts
    2


    Did you find this post helpful? Yes | No

    Thumbs up

    Thanks Jerson,
    it's a byte sized array and it works!
    Thanks again
    Mario

Similar Threads

  1. Cordic trig assembly code for PIC18f
    By ScaleRobotics in forum mel PIC BASIC Pro
    Replies: 54
    Last Post: - 8th September 2015, 05:36
  2. How much code space do PBP statements use.
    By Darrel Taylor in forum Code Examples
    Replies: 5
    Last Post: - 13th February 2009, 21:31
  3. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  4. 4 Chanel Dmx512 ready assembly code to PBP ?
    By syscoder in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 21st March 2007, 23:55
  5. Your Suggestions: Assembly code material?
    By dw_picbasic in forum General
    Replies: 1
    Last Post: - 2nd February 2007, 17:33

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts