Shop OBEX P1 Docs P2 Docs Learn Events
Long boundaries — Parallax Forums

Long boundaries

Don PomplunDon Pomplun Posts: 116
edited 2011-08-12 15:33 in Propeller 1
in my DAT block I defined:
now long
dayOfWeek byte "Sun","Mon",Tue","Wed" etc
other bytes & longs

Much hairpulling ensued after unsuccessfully trying to deal with the 0th & 1st triads of characters (Sun & Mon). 2-6 were OK.
On a lark I moved the definition to the far end of the DAT block,. and they all worked fine.
I surmised that the problem was that 7 days x 3 letters is 21, which isn't divisible by 4, prompting some kind of boundary issue.
To test it, I added an 8th day, "Xxx", making 24 total characters, and put it back in its original place in the block. The same problem returned.
Was I on the right track about byte vs long (vs word) boundaries? Any idea why 24 bytes didn't fix it?
TIA
Don

Comments

  • Dave HeinDave Hein Posts: 6,347
    edited 2011-08-12 15:28
    "now long" defines the label "now" on a long boundary, but it doesn't allocate any space for it. Did you intend for "now" to hold a long value, or was it intented to be another name for "dayOfWeek". Assuming you wanted "now" to hold a long value, you should do something like this:
    dat
    now long 0
    dayOfWeek byte "Sun","Mon",Tue","Wed","Thu","Fri","Sat"
     long ' Force long alignment
    other bytes & longs
    
  • Don PomplunDon Pomplun Posts: 116
    edited 2011-08-12 15:33
    Ahhhhhhhhhhh! Thanks for that. Yes "now" is intended to hold a value. That should help. Back to the drawing board.
Sign In or Register to comment.