Shop OBEX P1 Docs P2 Docs Learn Events
PASM2 Tutorial? — Parallax Forums

PASM2 Tutorial?

Is there a PASM2 tutorial around somewhere?

Comments

  • evanhevanh Posts: 16,029
    edited 2022-01-10 02:23

    There is pieces in forum postings but nothing very coherent. Chip's Spin2 manual has some info on the differences between Spin2/Pasm2 mix and Pasm2 only.

    If it's not inline assembly then it goes in a DAT section. If it is inline then ORG and END contain it.
    Debug is functional in assembly when mixed Spin2/Pasm2. Not sure about pure Pasm2 since it may not have a second stage loading.

  • I'm not looking to write a compete program in PASM2. I just want to write a runtime library function for p2llvm. I suspect I can figure it out. I just thought I'd ask if someone had written up a brief overview. I'm particularly interested in block transfers.

  • evanhevanh Posts: 16,029
    edited 2022-01-10 20:44

    Here's a runnable test case that happens to have inline assembly for using combos of Cordic ops.

    EDIT: Doh! Latest edit had a compile error. I'm still not used to Spin's assignment operator.

  • As with Evan's code, the attached object (I2C) uses inline PASM2 for speed and timing precision. It may also help shed a bit of light on PASM2. Once you've had a bit of time with it, I think you'll find PASM2 is easier to code than PASM1.

  • evanhevanh Posts: 16,029

    Block transfers within hubRAM would be fastest using SETQ prefixing of both RDLONG and WRLONG. But these ops do require a cogRAM or lutRAM buffer since it can only block transfer in one direct at a time.

    If not wanting to wrangle buffer sizing/matching then next best would be use the RDFAST+RFLONG for prefetched rapid reading of hubRAM, along with WRLONG being pretty quick on its own for writing back to hubRAM.

  • evanhevanh Posts: 16,029

    A slightly crazy way of copying hubRAM to hubRAM could be done using two streamers. Disable the relevant pins so the outputs can't be driven, then config the %AAAA pin input selectors to OUT as the source. Then one streamer writing and one reading in concert can silently copy the data via pins.

  • Thanks everyone for the examples. I think I'll take a very simple approach to start and then try to refine it after I get it working.

Sign In or Register to comment.