I came across something working on a new (to me) assembler program. The
program was written many years ago and the programmer used C'Y' and C'N' as
flags. Sometime later, another programmer added:
YES EQU X'FF'
NO EQU X'00'
For some "new" flags that were added (there are external flags that still
require Y/N characters). What I was trying to do was to add:
TRUE EQU -1
FALSE EQU 0
To add some consistency with the C code I also support. However:
MVI FLAG,TRUE
Causes an ASMA320W message (which I understood after thinking about it). I
know I can turn off magnitude checking (I've run into this before trying to
play loose with "halfwords"), but would rather keep it on.
I guess I could define TRUE as X'FF' (or 1 for that matter) which would
take care of the 99% (the reason not to use x'01' would be to make it
easier to read in a dump). However, in another nod to C, there may be a
case somewhere that a fullword is being used a bool. MVHI (and MVHHI for a
halfword bool) doesn't sign extend x'FF' to x'FFFFFFFF' (or x'FFFF").
Yes, it's a very minor thing which I've already resolved but it would be
nice if the assembler "understood" that x'FF' and -1 are "equivalent" in a
1 byte immediate instruction (like -1 and x'FFFF" are equivalent in a
halfword immediate instruction). And yes, I realize that bytes are
unsigned whereas anything bigger is signed.
Thanks!
*Mark*