How to do this in ASM?


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    >> can i do rrf _my_data,1 and expect the whole word to be rotated?

    No, it only works with 1 byte at a time. But, the rrf rotates through the CARRY flag, so a second rrf on the next byte will rotate the CARRY right into the next byte.

    >> I dont get is how to get the base memory address of the array

    At the ASM level, that's what variables are, pointers(address) to the actual memory location in RAM. So low _array gives you the lowbyte of the address of the variable array.
    <br>
    DT

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Kamikaze,

    Ok, let's try this one more time. I think this is what you're after. And, since you're using it in an interrupt, it save/restores the FSR so it doesn't interfere with normal PBP operations.
    Code:
    fsave var byte
    ASM
        movf    FSR, W       ; save current FSR value
        movwf   _fsave
        movlw   low _array   ; load FSR with address of the array
        movwf   FSR
        movf    _index,W     ; get index value
        addwf   FSR, F       ; add index to FSR
        movf    _my_data, W  ; get my_data.Byte0
        movwf   INDF         ; put it in the array
        movf    _fsave, W    ; restore the original FSR
        movwf   FSR
    ENDASM
    DT

  3. #3
    Join Date
    Nov 2005
    Location
    Perth, Australia
    Posts
    429


    Did you find this post helpful? Yes | No

    Default

    Thanks for that Darrel... Looks like it will do what I want

Similar Threads

  1. PBP, ASM and LST files
    By HenrikOlsson in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 12th January 2010, 13:43
  2. ASM help
    By Charles Linquis in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 21st October 2009, 03:08
  3. ASM or PBP First?
    By mackrackit in forum Off Topic
    Replies: 4
    Last Post: - 10th October 2009, 12:08
  4. Serial Output - for an ASM numb
    By scomi85 in forum Serial
    Replies: 0
    Last Post: - 1st March 2009, 10:13
  5. Problem using ASM instruction
    By ewandeur in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 3rd April 2008, 15:26

Members who have read this thread : 0

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