Author Topic: ! doesn't work, at least for me  (Read 10433 times)

Offline RuudB

  • Jr. Member
  • *
  • Posts: 40
  • Country: nl
    • Ruud's Commodore Site
! doesn't work, at least for me
« 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
« Last Edit: December 05, 2018, 08:51:55 PM by Frank Kotler »
With kind regards / met vriendelijke groet, Ruud Baltissen

Offline dreamCoder

  • Full Member
  • **
  • Posts: 107
Re: ! doesn't work, at least for me
« Reply #1 on: December 05, 2018, 02:02:45 PM »
RuudB,

'!' is Two's complement NEG operator. I think what you probably need is the NOT operator '~' instead to clear the fourth bit.



Offline RuudB

  • Jr. Member
  • *
  • Posts: 40
  • Country: nl
    • Ruud's Commodore Site
Re: ! doesn't work, at least for me
« Reply #2 on: December 06, 2018, 06:57:03 AM »
That worked like a charm. Thank you very much!

Kind regards, Ruud Baltissen
With kind regards / met vriendelijke groet, Ruud Baltissen