Shop OBEX P1 Docs P2 Docs Learn Events
Is there an equivalent p2asm for the P1? — Parallax Forums

Is there an equivalent p2asm for the P1?

I like using @"Dave Hein"'s excellent p2asm for assembling P2 files since I use the m4 preprocessor to manage my include files and then loadp2 to load it onto the P2. p2asm also generates a proper listing.

Now I am looking at standardizing how I compile Tachyon for P1 and TAQOZ for P2 while making Forth source files as compatible as possible since I am redoing EASYFILE and EASYNET and I want to use the same source with conditional compile for P1 and P2.

Is there something like p2asm and even loadp2 for the P1?

Comments

  • RossHRossH Posts: 5,485
    edited 2019-09-26 07:45
    There is spinnaker (a derivative of openspin) and payload in Catalina. Neither one is dependent on Catalina, but the sources and binaries are in the Catalina distribution.

    EDIT: And also spinpp, which is a C-like preprocessor for Spin/PASM programs.
  • Cluso99Cluso99 Posts: 18,069
    There is also bst and homespun, as well as OpenSpin.
    All support conditional assembly. bst and homespun have optional listings, not sure about OpenSpin.
  • RossHRossH Posts: 5,485
    Cluso99 wrote: »
    There is also bst and homespun, as well as OpenSpin.
    All support conditional assembly. bst and homespun have optional listings, not sure about OpenSpin.

    Spinnaker does as well. Here are the changes Spinnaker makes to Openspin:
    1. Added '-a' command line option to specify that alternate "homespun"-like 
       preprocessor behavior be used:
    
       - Encountering a #error statement terminates the compilation.
       - Files included with #include will be found if they exist anywhere 
         in the include directories specified on the command line.
       - Symbols defined with no value (or on the command line) will not be
         used for macro substitution - they can only be used in #ifdef and 
         #ifndef statements. For example:
    
         #define FOO
         #ifndef FOO
         #error FOO is not defined!  <-- FOO is defined under either set of rules
         #endif
         PUB START | FOO,BAR         <-- generates an error if -h is not used
    
    
    2. Added '-M' to specify memory size. The default is 32768, but any size
       up to 16777216 can be specified. This is commonly used to specify an
       EEPROM size. DAT, binary and eeprom files can be generated of any size 
       up to the specified memory size, but if memory sizes larger than 32768 
       are generated then some programs may be able to use the resulting dat 
       files, but only Catalina will be able to use the binary and eeprom 
       files, since it does not depend on the internal file offsets which are 
       limited in these file formats to 16 bits.
     
    3. Added -b and -e to specify whether a binary or eeprom format output file
       should be created. The default is binary. The size of the output file 
       when -e is specified (or the maximum size when -b is specified) defaults 
       to 32k, but this can be overriden by using the '-M' command line switch.
    
    4. Fixed a bug where the preprocessor would lose track of the state of
       complex #if[n]def statements (e.g. if they contain #include statements).
    
    5. Fixed a bug where the name of the file containing the start of a 
       #if[n]def statement was incorrectly reported if the statement was not
       terminated correctly.
    
    6. Fixed a bug that resulted in some source lines being incorrectly detected
       as comment lines.
    
    7. Fixed a bug that resulted in macro substitution within string constants.
    
    8. Added a listing capability, enabled by specifying '-l'. The listing only
       contains DAT sections at present - it may be expanded later to include
       other sections.
    
    
  • I've started breaking up Tachyon into lots of smaller include files and will initially test with m4 and bstc.

    @RossH - You mentioned the preprocessor behavior. Does Spinnaker allow include files and conditional assembly specified in the source file vs command line? Certainly with the ifdef type statements it looks like it can handle conditional assembly.
    This is the main reason I use m4 although it is a lot more powerful than that. However I want to make sure it is just as easy for someone else to compile too although of course there would always be the output file from the preprocessor that could be used.
  • ersmithersmith Posts: 6,068
    edited 2019-09-26 09:51
    Now I am looking at standardizing how I compile Tachyon for P1 and TAQOZ for P2 while making Forth source files as compatible as possible since I am redoing EASYFILE and EASYNET and I want to use the same source with conditional compile for P1 and P2.

    Is there something like p2asm and even loadp2 for the P1?

    fastspin can handle both P1 and P2 assembly and has conditional compilation, so you can use the same source with it to produce both P1 and P2 binaries.

    In place of loadp2 I use the command line propeller-load tool for P1. FlexGUI comes with fastspin, loadp2, and propeller-load all packaged together.
  • RossHRossH Posts: 5,485
    I've started breaking up Tachyon into lots of smaller include files and will initially test with m4 and bstc.

    @RossH - You mentioned the preprocessor behavior. Does Spinnaker allow include files and conditional assembly specified in the source file vs command line? Certainly with the ifdef type statements it looks like it can handle conditional assembly.
    This is the main reason I use m4 although it is a lot more powerful than that. However I want to make sure it is just as easy for someone else to compile too although of course there would always be the output file from the preprocessor that could be used.

    Yes, spinpp is equivalent to cpp, but for Spin programs.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2019-09-26 13:27
    Thanks for the suggestions, I will get around to looking at them although at present I have m4 and bstc working fine.
    The bake and m4 file generate a standard .spin and binary output as well as downloading it to the P1.
    m4 -I includes ./includes/$1 > $2.spin
    ./bstc -l -b -p2 -f $2.spin
    
    '' TACHYON M4 PREPROCESSOR BUILD
    
    include(`version.spin')
    include(`config.spin')
    include(`mem.spin')
    include(`compcons.spin')
    include(`globals.spin')
    include(`taskregs.spin')
    include(`lmm.spin')
    include(`print.spin')
    include(`search.spin')
    include(`comments.spin')
    include(`compile.spin')
    include(`threaded.spin')
    include(`create.spin')
    include(`debug.spin')
    include(`runmods.spin')
    include(`branch.spin')
    include(`startup.spin')
    include(`console.spin')
    include(`loader.spin')
    include(`dictionary.spin')
    include(`roms.spin')
    
    DAT { force console and Tachyon kernel image to top of hub memory }
            byte 0[varram-(@romend+s)]
    
    include(`serial.spin')
    include(`pingpong.spin')
    include(`kernel.spin')
    include(`boot.spin')
    ''( info )
    ''( changelog )
    
  • dusgdusg Posts: 3
    edited 2019-09-27 11:03
    Deleted by dusg :)
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2019-09-26 21:53
    @dusg - have a look at the Tachyon thread for my reply rather than gum up this thread by going OT.
    This thread is simply about a different way to maintain and build the kernel rather than as one big ugly file using the Prop tool or equivalent.
Sign In or Register to comment.