Shop OBEX P1 Docs P2 Docs Learn Events
Trap for young (spin) players — Parallax Forums

Trap for young (spin) players

BradCBradC Posts: 2,601
edited 2008-06-09 05:44 in Propeller 1
I've just spent an entire day chasing a bug in a bit of spin code.

val := val or $80000000

which should have been

val := val | $80000000

It was in a 32 bit shift register, and I just could not figure out why I always ended up with $FFFFFFFF

<sob sob sob>

....(goes away to read the manual a bit closer)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Pull my finger!

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-06-08 22:40
    There's also the shorthand version:

      val |= $80000000
    
    
    


    -Phil
  • AleAle Posts: 2,363
    edited 2008-06-09 04:55
    I do not know if you resuscitated the "Tricks and Traps" thread, but there are a load of info there with plenty of examples.
  • BradCBradC Posts: 2,601
    edited 2008-06-09 05:44
    Phil Pilgrim (PhiPi) said...
    There's also the shorthand version:

      val |= $80000000
    
    
    


    -Phil

    Which is precisely what I ended up with after eventually getting it working.
    Now the fun part is playing with all the various constructs to minimise the size of the generated spin code.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Pull my finger!
Sign In or Register to comment.