I feel like it has been discussed here, or I read about it in a book somewhere... But can anyone explain how the boolean operator NOT works on the VIC?
My mind tells me:
NOT 0 = 1
NOT 1 = 0
But my VIC tells me:
NOT 0 = -1
NOT 1 = -2
I know CBM BASIC returns -1 as TRUE and 0 as FALSE, but it doesn't make clear to me why -2 is here... like on a BIT level.
NOT making sense
Moderator: Moderators
- Mike
- Herr VC
- Posts: 4845
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
Re: NOT making sense
NOT 1 = NOT(%0000 0000 0000 0001) = %1111 1111 1111 1110 = -2 in two's-complement with 16-bit integers.
Re: NOT making sense
Thanks, Mike! I finally get it now.Mike wrote: ↑Tue Sep 29, 2020 1:28 am NOT 1 = NOT(%0000 0000 0000 0001) = %1111 1111 1111 1110 = -2 in two's-complement with 16-bit integers.