Page 1 of 1

Posted: Sun Jan 06, 2002 3:09 pm
by BackupUser
Restored from previous forum. Originally posted by Shagwana.

Hello,
Could someone please tell me if there is a binary not operator like the | and & operators?
If not, then how could I not to numbers together!

for example;

c=a|b ; or 2 numbers
c=a&b ; and 2 numbers
c=ab ;not 2 numers



http://www.sublimegames.com

Posted: Sun Jan 06, 2002 6:55 pm
by BackupUser
Restored from previous forum. Originally posted by Danilo.

Code: Select all

Procedure NOT(a,b)
MOV EAX,b
NOT EAX
AND a,EAX
ProcedureReturn a
EndProcedure
Something like that ??
(untested)

cya,
...Danilo


Edited by - Danilo on 06 January 2002 18:56:33

Posted: Sun Jan 06, 2002 8:59 pm
by BackupUser
Restored from previous forum. Originally posted by Pupil.

Code: Select all

Procedure NOT(a,b)
MOV EAX,b
NOT EAX
AND a,EAX
ProcedureReturn a
EndProcedure
A NOT operation only takes one argument, what your assembly code seems to do is this logical operation:

(not(b)) and (a)

Posted: Sun Jan 06, 2002 10:19 pm
by BackupUser
Restored from previous forum. Originally posted by Danilo.

> c=a b ;not 2 numers

c = NOT(a,b) ; a NOT b

Thats what Shagwana wanted to do... ?

cya,
...Danilo

(registered PureBasic user)

Posted: Mon Jan 07, 2002 12:03 am
by BackupUser
Restored from previous forum. Originally posted by Shagwana.

Well yes, its a 'not' 'and' i wana do - im trying to turn bits off

So does 'Not(b)' do part of hat i need?

http://www.sublimegames.com

Posted: Mon Jan 07, 2002 2:17 pm
by BackupUser
Restored from previous forum. Originally posted by Pupil.
Well yes, its a 'not' 'and' i wana do - im trying to turn bits off

So does 'Not(b)' do part of hat i need?

http://www.sublimegames.com
Ok.

There's probably an assembly operator that can do just that at least the Motorola 680xx family of processors have that, so most likely the intel x86 family of processors have that operator too. But i don't know what the operator is in x86 assembly. By using the small knowledge of x86 assembly i have i put together the following procedure that is able to turn off one bit in a bitfield:

Procedure.l ClearBit(Dest.l, Bit.l) ; 'Bit' is the bit to turn off i.e Bit=0=>clear bit 0, Bit=8=>clear bit 8.
Mask = 1
Mask = Mask << Bit ; Shift up bit one 'Bit' steps
MOV EAX, Mask
NOT EAX
AND Dest,EAX
ProcedureReturn Dest
EndProcedure