Today 20:02
Forum: Proton Users File Server
Starter: Les
Views: 0
Replies: 0
Today 19:58
Forum: Amicus 18
Starter: xelectro
Views: 0
Replies: 21
Go to last post By: Stephen Moss
Today 14:50
Forum: Absolute Beginners Section
Starter: andy roberts
Views: 0
Replies: 1
Go to last post By: andy roberts
Today 14:00
Forum: Proton Plus Compiler v3
Starter: angry_johnny
Views: 2216
Replies: 6
Today 11:58
Forum: Proton Plus Compiler v3
Starter: AlbertoFS
Views: 0
Replies: 19
Today 07:07
Forum: Proton Plus Compiler v3
Starter: Oldhack
Views: 0
Replies: 5
Today 07:07
Forum: WIKI Discussion
Starter: AlbertoFS
Views: 0
Replies: 2
+ Reply to Thread
Results 1 to 4 of 4

Thread: Some help with Asm please89 days old

  1. #1
    Article Author johngb's Avatar
    Join Date
    Oct 2003
    Posts
    2,063
    Thumbs Up
    Received: 53
    Given: 0
    Total Downloaded
    1,018.60 MB

    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
    236
    Thumbs Up
    Received: 28
    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,133
    Thumbs Up
    Received: 205
    Given: 74
    Total Downloaded
    1.49 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,063
    Thumbs Up
    Received: 53
    Given: 0
    Total Downloaded
    1,018.60 MB

    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