Shop OBEX P1 Docs P2 Docs Learn Events
Assembly help — Parallax Forums

Assembly help

Zap-oZap-o Posts: 452
edited 2009-05-01 13:35 in Propeller 1
Assembly, hum! - Learned it in college, but have not used it since then. Propeller has a type of assembly and before I ask please note that I have read all the material that I could find on this topic. My questions are:

Say I want to make part of this in assembly.
Obj

  Serial        : "FullDuplexSerial"  
                                                               
Pub  Start
  
  REPEAT   
        If (serial.rxcheck == $30)
            serial.str(string("OK"))




I want to know if I can use Assembly and other objects interchangeably. In the example I provided how would I attack the If statement in assembly and yet jump back in to spin and send the string "OK". I hope this makes since.

Maybe some one can kick start my exploration in assembly.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-05-01 03:47
    The Propeller is different from most processors in that normally it's programmed in Spin which is compiled into an interpretive code which then gets interpreted by a small program (the Spin interpreter) which gets copied from ROM to a cog's memory for execution. This Spin interpreter takes up the entire memory of the cog and it interprets the interpretive code that's stored in the shared (hub) memory.

    If you want to execute assembly, it has to be copied into its own cog and executed on its own. It takes over 100us to copy an assembly program to a cog for execution no matter how big or small the program is, so it's mostly impractical to try and mix Spin and assembly. One of the forum members has been experimenting with special versions of the Spin interpreter that have a small area for copying small subroutines from hub memory to cog memory and executing them. In order to do this, some of the normal, but infrequently used Spin interpreter routines have been moved to hub memory where they are treated as overlays for this small area and the user can also have overlays. It takes a little time to copy these overlays from hub to cog memory, but less time than it takes to fill up the whole cog.
  • James LongJames Long Posts: 1,181
    edited 2009-05-01 05:39
    Zap-o said...
    Assembly, hum! - Learned it in college, but have not used it since then. Propeller has a type of assembly and before I ask please note that I have read all the material that I could find on this topic. My questions are:

    Say I want to make part of this in assembly.
    Obj
    
      Serial        : "FullDuplexSerial"  
                                                                   
    Pub  Start
      
      REPEAT   
            If (serial.rxcheck == $30)
                serial.str(string("OK"))
    
    



    I want to know if I can use Assembly and other objects interchangeably. In the example I provided how would I attack the If statement in assembly and yet jump back in to spin and send the string "OK". I hope this makes since.

    Maybe some one can kick start my exploration in assembly.

    MagIO2, and I just got through (well not really totally done) on some assembly that deals with the problem you ask, so I'll take the part of the question Mike didn't address.

    PASM (or Propeller Assembly) has a compare command "cmp". You can compare any two numbers and set "flags" if the numbers match. With the flag(s), you can decide what to do next.

    I found learning to get the information in and out of assembly confusing, but there are members here who can help straighten you out on the details. I was real reluctant to learn PASM, but I find it is pretty easy to write the code itself. I actually find PASM to be easier than Spin, although it does take more commands (typically) to do the same task. It does take a little different method of thought with PASM.

    I'm not sure about others, but I find writing everything in PASM to be somewhat of beyond necessary. I think I/O and some communication is needed in PASM, but I don't ever see myself writing any project in total PASM.

    I don't know if I helped or not, but keep kicking it around. You will eventually program in PASM. I waited as long as possible, and came to a point it was necessary. I should have started way before I did.

    James L

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    James L
    Partner/Designer

    Lil Brother SMT Assembly Services
  • Zap-oZap-o Posts: 452
    edited 2009-05-01 13:35
    Thanks fellas for the reply's. Its making some since now. I don't need to code in PASM per say its just that I want to learn it, so look forward to my stupid questions in the future [noparse]:)[/noparse]
Sign In or Register to comment.