Shop OBEX P1 Docs P2 Docs Learn Events
Question about Propeller Asm. — Parallax Forums

Question about Propeller Asm.

MacGeek117MacGeek117 Posts: 747
edited 2007-05-04 02:11 in Propeller 1
I'm trying to port a stepper motor driver that uses the L297 from Spin to assembly, but I'm having troubles. In the Spin code there is a conditional loop based on a 'flag' variable:
ifnot go
  repeat until go

How would I do this in assembly?(I'm very new!)
RoboGeek

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"I reject your reality and subsitute my own!"

Adam Savage, Mythbusters
www.parallax.com
www.goldmine-elec.com
www.expresspcb.com
www.startrek.com
·

Comments

  • Paul BakerPaul Baker Posts: 6,351
    edited 2007-05-02 16:21
    The answer depends on where/what go is and what is affecting go so that the loop is finally exited.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • Graham StablerGraham Stabler Posts: 2,510
    edited 2007-05-02 17:04
    have a look at the various compare commands in the manual and the effect of setting the wz or wc, then you can use if_c or if_nc etc to jump past a jump command that is causing the loop when your go variable equals something or is greater than zero or whatever.

    basically rtfm [noparse]:)[/noparse]

    Graham
  • CJCJ Posts: 470
    edited 2007-05-02 19:13
    you can wait for a non-zero by this (note all mentioned registers have to be changed to appropriate labels)

    :loop rdbyte cogregister, flagaddress
    tjz cogregister, #:loop

    not 100% on the syntax, but this would be the simplest way to wait for a non-zero flag, falls through on anything but zero

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Parallax Forums - If you're ready to learn, we're ready to help.
  • MacGeek117MacGeek117 Posts: 747
    edited 2007-05-04 02:11
    Thank you for pointing me in that direction, CJ. I will be using tjnz. I never saw those commands. Thank you for all your help!
    RoboGeek

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "I reject your reality and subsitute my own!"

    Adam Savage, Mythbusters
    www.parallax.com
    www.goldmine-elec.com
    www.expresspcb.com
    www.startrek.com
    ·
Sign In or Register to comment.