NASM - The Netwide Assembler
NASM Forum => Programming with NASM => Topic started by: RuudB on December 05, 2018, 12:39:28 PM
-
Hello,
If possible I try to use original sources when disassembling old IBM BIOS-es. In this case I ran into NOT, used here as the logical negation operator. The documentation states that NASM uses "!" so I substituted the various NOTs with a "!". And that went wrong for one or another reason. I give you two examples:
; AND byte [KB_FLAG_1],NOT HOLD_STATE ; TURN OFF THE HOLD STATE BIT
00000A59 8026180000 AND byte [KB_FLAG_1],!HOLD_STATE ; TURN OFF THE HOLD STATE BIT
00000A5E 80261800F7 AND byte [KB_FLAG_1],-HOLD_STATE-1 ; TURN OFF THE HOLD STATE BIT
; AND AL,NOT 08H ; CLEAR BIT TO TURN ON MOTOR
00000A63 2400 AND AL,!08H ; CLEAR BIT TO TURN ON MOTOR
00000A65 24F7 AND AL,-08H-1 ; CLEAR BIT TO TURN ON MOTOR
As you can see I found a work around but I still would like to know what I'm doing or misunderstood.
Thank you in advance for any help!
Kind regards, Ruud Baltissen
-
RuudB,
'!' is Two's complement NEG operator. I think what you probably need is the NOT operator '~' instead to clear the fourth bit.
-
That worked like a charm. Thank you very much!
Kind regards, Ruud Baltissen