NOT operator overflow sign-extends 1 byte symbol to 2 bytes
When doing a not operation on a symbol, if the operand is a byte value and negative (high bit set), it will cause the operand size to appear to be two bytes, generating Error A2048.
Example:
and al, not 80h
Error A2048: Operands must be the same size: 1 - 2
and al, not 0ffh
Error A2048: Operands must be the same size: 1 - 2
This code syntax works on MASM 5.0, 5.1, 6.1 and TASM 3. Interestingly JWasm works for and al, not 80h but not and al, not 0ffh.
This is using UASM v2.57, Aug 9 2024, uasm64 for Windows.
This is a bit of a strange one, MASM prior to V8 allowed this, but it was changed after V8. I noted that GAS/Defuse etc also allow it - and it does sort of max some sense in the unsigned case, but it's technically wrong.
If you go to Calculate EG, select WORD - and try NOT 0x80 or 0xFF .. the highest bit must sign-extend, resulting in a 16bit canonical value, so this behaviour is technically right - but also non-intuitive. if you did:
mov al, 0x80 not al
you'd get 0x7f as you'd would now. Anyway, I've made this change in V2.58 branch as I'm not a purist that much if it makes sense :) (parser.c 2890)