Shop OBEX P1 Docs P2 Docs Learn Events
a Program completely in PASM. — Parallax Forums

a Program completely in PASM.

Hello,

Is it possible to write a program completely in PASM, all code, variables, data, directives in the DAT section, nothing in CON, PUB, or PRIZ?

Or, Is some spin required.

Thank you

Comments

  • yetiyeti Posts: 818
    edited 2019-02-09 16:44
    Is it possible to write a program completely in PASM
    No.
    The bytecode interpreter in the P1's ROM gets started and expects a Spin program' bytecode. This may consist of only starting a PASM cog, but at least this action has to be done in Spin.
  • JonnyMacJonnyMac Posts: 9,102
    edited 2019-02-09 16:55
    I've not done this, but you should be able to get away with a single-line pub method that overwrites cog 0 with your PASM code.
    pub main
    
      coginit(0, @entry, 0)
    
    This assumes that you only need one cog hence are not passing a "mailbox" address in the third parameter. If that doesn't work you could always try:
    pub main
    
      cognew(@entry, 0)
      cogstop(0)
    

  • bteddy wrote: »
    Hello,

    Is it possible to write a program completely in PASM, all code, variables, data, directives in the DAT section, nothing in CON, PUB, or PRIZ?

    Or, Is some spin required.

    Thank you

    I think you need a little spin progam to initialization variables for each PASM cog but after that you can have all eight cogs running PASM code. Use the coginit method to start each cog and remember to start cog 0 last or the code you're running to start the cogs will be clobbered. I have tested this technique and it works.

    Sandy



  • You need one line of Spin to execute a COGINIT or COGNEW to start a PASM cog. The Spin cog will shut down if there is no other code, and the PASM cog can start other cogs as desired. This is apparently how the Turbulence demo worked.
Sign In or Register to comment.