Today 12:07
Forum: The Lounge
Starter: yvesmazzon
Views: 0
Replies: 12
Today 10:21
Forum: Proton 24
Starter: charliecoultas
Views: 0
Replies: 9
Go to last post By: J. Mark Wolf
Today 01:01
Forum: Proton Plus Compiler v3
Starter: SELCUK
Views: 0
Replies: 1
Yesterday 21:34
Forum: Proton Plus Compiler v3
Starter: H-bert
Views: 2350
Replies: 51
+ Reply to Thread
Results 1 to 4 of 4

Thread: Some help with Asm please158 days old

  1. #1
    Article Author johngb's Avatar
    Join Date
    Oct 2003
    Posts
    2,103
    Thumbs Up
    Received: 57
    Given: 0
    Total Downloaded
    1.09 GB

    0 Not allowed!

    Default Some help with Asm please

    I am trying to output some data held in an array

    WREG2 holds the address of the array. This is my code which results in a ASM error Invalid Operands specified

    Code:
          i = 0
          Do
            Mov [W2++], CharIn
            If CharIn = 0 Then Break
            HRSOut CharIn
            Inc i
          Loop Until i = 8
    It would seem I cannot use indirect addressing in this way.

    What should I be doing?
    JohnB

  2. #2
    Member tumbleweed's Avatar
    Join Date
    May 2011
    Posts
    250
    Thumbs Up
    Received: 32
    Given: 0
    Total Downloaded
    76.31 MB

    0 Not allowed!

    Default Re: Some help with Asm please

    I think with MOV when you have one operand as a memory address (CharIn) the other has to be one of the Wn registers.
    so instead of
    Code:
    MOV [W2++], CharIn
    something like
    Code:
    MOV [W2++], W0
    MOV W0, CharIn

  3. #3
    Developer Les's Avatar
    Join Date
    Feb 2002
    Posts
    3,190
    Thumbs Up
    Received: 218
    Given: 78
    Total Downloaded
    1.50 GB

    0 Not allowed!

    Default Re: Some help with Asm please

    Tumbleweed is correct. Also remember, word operations using mnemonics must also be on a 16-bit RAM boundary with the PIC24 and dsPIC devices.

    The mnemonics in your code could be changed to the Ptr8 command, which will create the asm as best it can. For example:

    Charin = Ptr8(WREG2++)

    Will produce:

    mov.b [W2++],W0
    mov.b WREG,Charin

    It doesn't get any tighter than that!

    Also notice the .b extensions to the mnemonics, meaning they can operate on any RAM boundary.

    If the array was a word type, the compiler will create it on a 16-bit RAM boundary, then standard mnemonics will come into play. i.e. Mov.w or simply Mov, which always assumes a .w extension on all mnemonics if missing. The same for a Dword or Float array, all multi-byte variable type arrays are created on 16 or 32-bit boundaries.
    For more example programs for Proton and Proton24 or updates, please visit: Proton WIKI or Proton Files

  4. #4
    Article Author johngb's Avatar
    Join Date
    Oct 2003
    Posts
    2,103
    Thumbs Up
    Received: 57
    Given: 0
    Total Downloaded
    1.09 GB

    0 Not allowed!

    Default Re: Some help with Asm please

    Thanks that's very helpful.
    JohnB

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. asm error
    By pascalv in forum Proton Plus Compiler v3
    Replies: 1
    Last Post: 28th March 2011, 09:19
  2. ASM tooltips
    By cgriffin in forum Mecanique - IDE
    Replies: 3
    Last Post: 10th June 2008, 22:52
  3. How do I recover from ASM?
    By andyb in forum Proton Plus Compiler v3
    Replies: 4
    Last Post: 12th December 2006, 16:58

Tags for this Thread

Posting Permissions

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