totalspectrum / spin2cpp

Tool to convert Parallax Propeller Spin code to PASM, C++ or C
Other
46 stars 17 forks source link

FIT directive for P1 Spin does not allow Boolean "AND" or "OR" operators #430

Closed Ding-Batty closed 8 months ago

Ding-Batty commented 8 months ago

I use FIT statements as compile-time asserts (the only way I know of to do so for all Spin compilers).

Here is a sample:

DAT
                ORG 1

  ' The COLORS_BASE_PIN must be either 0 or 9, because the code uses a
  ' MOVS or MOVD for the six color bits, for speed.
  ' Error means the COLORS_BASE_PIN was given an unspported value.
  ' For some reason FlexSpin doesn't like the "OR" operator:
  '   "error: syntax error, unexpected instruction"
  fit ||((COLORS_BASE_PIN == 0) OR (COLORS_BASE_PIN == 9))
  fit ||((COLORS_BASE_PIN == 0) + (COLORS_BASE_PIN == 9))

FlexSpin 6.8.0 will generate the failure for the first line, that contains the "OR", and not the second one. Neither PropTool 1.3.2 nor BST have any problem with it.

Full Example attached, for both "AND" and "OR"

Ding-Batty commented 8 months ago

fit_failure_with_or.zip