1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Assembly Code Not Aligned

Discussion in 'Site Issues & Feedback' started by Suraj143, Oct 2, 2015.

  1. Suraj143

    Suraj143 Active Member

    Joined:
    Jan 11, 2007
    Messages:
    1,586
    Likes:
    2
    Location:
    South Mald Isld
    When I insert PIC Assembly code its not align & it is hard to read by the users.

    I used many text editors & tabs align, but when I placed the code here its not allign. :(
     
  2. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,240
    Likes:
    645
    Location:
    Ex Yorks' Hants UK
    hi Suraj,
    Post a sample of the code that is not aligning correctly.
    Are you using these to enclose your code text
    Code (text):
      your text go's here
    E
     
  3. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,310
    Likes:
    914
    Location:
    Rochdale UK
    ONLINE
    Not a lot can be done.. only the first tabs are translated all the rest are spaces..
    Code (c):

    void main(void)       // original tabs seven space
       {
       for(x=0;x<2;x++)   // nest 1 three spaces
         {
         another nest;   // nest 2 three spaces
         }
       }
     
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    6,070
    Likes:
    524
    Location:
    Cleveland, OH, USA
    ONLINE

    A bit more information would help, including a sample of your code. If you will post one copy using the code tags {code=asm} {/code} (replace curly brackets with regular rackets) and another copy as a .txt attachment, that may help more.

    If you are using the MPLab suite, then one possibility is that you are using tabs, but you don't have the replace tabs with spaces box marked (Edit>Properties>"asm" file types):
    upload_2015-10-3_6-49-59.png

    John
     
  6. Suraj143

    Suraj143 Active Member

    Joined:
    Jan 11, 2007
    Messages:
    1,586
    Likes:
    2
    Location:
    South Mald Isld
    Hi thanks for the input.

    Oops sorry.In mplab I use tab sizes 4 or 6.When I going to place a code in this site I first copy the code to a notepad & do the alignment.After copy and paste it here.

    How do you all do?
     
    Last edited: Oct 3, 2015
  7. KeepItSimpleStupid

    KeepItSimpleStupid Well-Known Member Most Helpful Member

    Joined:
    Oct 30, 2010
    Messages:
    9,970
    Likes:
    1,099
    The important part is to use these tags:

    [code]
    mov a,b
    hh (a few beginning spaces exist here and it's not lined up)
    [/code]


    This renders as:

    Code (text):

    mov    a,b
           hh
     


    It will keep leading spaces. HOWEVER... in order to see it lined up as you type you would have to use courier. I set the font to courier between the code tags, but I should not have to.

    In the original text, there are some leading spaces before the hh which were removed. The standard also likes to reduce multiple spaces to one space.

    You can post large code fragments because you can scroll through them.

    To actually see what I wrote in the edit box, quote my post. You don't have to post it.
    More Options.. also provides Preview. I used a tag that won't render what's between the tags.
     
    Last edited: Oct 3, 2015

Share This Page