Shop OBEX P1 Docs P2 Docs Learn Events
Multiple "DAT" trick for huge assembly section — Parallax Forums

Multiple "DAT" trick for huge assembly section

RaymanRayman Posts: 14,826
edited 2009-03-05 18:17 in Propeller 1
Working on a very large assembly code and it get's hard to navigate when it's big...

Here's a trick to aid navigation:

Insert "DAT" commands in every subsection.· This way, you can use the slight color change to see different sections.
But, more importantly, the summary view lets you instantly jump to the desired section.

Here's a look at my summary:

(I'm not sure Parallax intended DAT to be used this way, but it seems to work just fine....)
382 x 366 - 12K

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-03-04 05:03
    Have you verified that ORG doesn't get reset to zero in each new section? (I guess the answer is "apparently", else the code wouldn't run, right?)

    -Phil
  • RaymanRayman Posts: 14,826
    edited 2009-03-04 14:56
    It does seem to work just fine.· Even the "FIT" works when you try to compile with too many longs...

    I think some other big ones, like TV/VGA drivers and Graphics.SPIN could use this kind of thing, to make it easier to navigate...
  • Jeff MartinJeff Martin Posts: 760
    edited 2009-03-04 16:40
    Rayman said...

    (I'm not sure Parallax intended DAT to be used this way, but it seems to work just fine....)
    Thanks for pointing this out, Rayman.· Yes, in fact, we did intend this to be an optional way to organize source code.··

    (EDITED 3-5-2009)
    Actually, every block (CON,VAR,OBJ,PUB,PRI,DAT) has slight color variations between them·which are intended to·be·simple, automatic, "landmarks" for your eyes to quickly find something you're looking for.· The PUB/PRI blocks will each always be separate public/private methods, rather than parts of the same block, but the other block types may be used the way you suggested.

    To answer Phil's question:

    The cog address (affected by ORG) is not reset at the start of DATs, you'll have to issue a separate ORG every time you want to change the cog address.

    Take care,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --Jeff Martin

    · Sr. Software Engineer
    · Parallax, Inc.

    Post Edited (Jeff Martin (Parallax)) : 3/5/2009 6:22:32 PM GMT
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-03-04 19:11
    Jeff, thanks. That's nice because it also allows the DATs to be punctuated where necessary with assembly-specific CON definitions.

    -Phil
  • AleAle Posts: 2,363
    edited 2009-03-05 11:36
    I have long ASM programs too, but instead of using one DAT per routine I have all of them in just one big file with one DAT per COG. I had also one CON per COG, but later I merged all of them together to be sure I do not repeat any constants.
    It is nice that we have BST with colored sections, because I do all my programming in OS X. (Occasionally in Linux).
  • RaymanRayman Posts: 14,826
    edited 2009-03-05 11:43
    Jeff, I don't think the PUB/PRI blocks can be used this way... I think they tell the compiler that a new procedure is beginning... So, you can't break up a large proceedure by adding a PRI or PUB command in the middle of it...
  • Jeff MartinJeff Martin Posts: 760
    edited 2009-03-05 18:17
    Rayman said...
    Jeff, I don't think the PUB/PRI blocks can be used this way... I think they tell the compiler that a new procedure is beginning... So, you can't break up a large proceedure by adding a PRI or PUB command in the middle of it...
    I'm sorry, you're right about that and I didn't mean to imply otherwise, I was trying to say that every occurence of a new block gets a slightly different color than it's previous and next occurrence to provide visual separation.

    Definitely, multiple PUB/PRI blocks are distinct public/private methods and not part of the same block.

    The CON, VAR, OBJ, and DAT blocks can be used in a contiguous fashion as if they were all one block.

    In fact, you can even do things like this (though it's not recommended for most cases):
    CON _clkmode = xtal1 + pll16x
    CON _xinfreq = 5_000_000
    VAR byte LEDStates[noparse][[/noparse]3]
    OBJ Ser     : "Simple_Serial"
    OBJ Num     : "Numbers"
    OBJ B[noparse][[/noparse]3]    : "Blinkers"
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --Jeff Martin

    · Sr. Software Engineer
    · Parallax, Inc.
Sign In or Register to comment.