Shop OBEX P1 Docs P2 Docs Learn Events
Twos-Comp Negative Numbers in Data Statements Compile to Incorrect Values — Parallax Forums

Twos-Comp Negative Numbers in Data Statements Compile to Incorrect Values

ZootZoot Posts: 2,227
edited 2008-02-01 21:39 in General Discussion
In the current SX/B release, the following compiles and programs, but the values compiled to .src are INCORRECT:

DATA -1 ' would think it would compile to $FF, but does not
' etc




This does compile to correct value:

foo CON -1
DATA foo




From SX/B doc...

WDATA/DATA
Creates a table of data values for use with the READ instruction.
• Label is the symbolic name for the table and serves as a pointer to the location of table index zero.
• Const is any constant (byte, ASCII character, or computed value).


...which would lead me to believe the first example should work.

Not a big deal, but this threw some havoc in into some "negative" servo offsets I was using in a data table.

Until I closely examined the .src output, I didn't catch that my code was fine, but the compiled data was not. Have not had a chance to check out in the beta SX/B yet.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST

1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php

Comments

  • BeanBean Posts: 8,129
    edited 2008-02-01 21:39
    Zoot,
    This is fixed in the beta version.
    Thanks for pointing it out, I'll add it to the download thread.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    www.iElectronicDesigns.com

    ·
Sign In or Register to comment.