Hi Again guys ;), i'm newbbie in ASM, so i'm reading actually chapter 11 of the izcelion's tut's, but there isn't any info on the XOR Function, and it uses a lot, i have make a little program, that, would send 1 logic to Data 0 on Parallel Port, and i want that if the button is pressed and the LED is turned on, then turn it off and viceversa, i've learned the xor function in the 14F84 micro, but i used this:

XOR 05h,0 ;IF BIt 0 on PORT A, then 1, if 1, then 0.

But in ASM, for turning the Data 0, (PIN 2, i think ) :) , i have to do this..

MOV DX,0278h
IN AL,DX
XOR AL,1; This is equal to: MOV AL,00000001b
OUT DX,AL

so, i don't understand why is 1 and not zero ?, and when i XOR another bit (like three) it doesn't work.....:notsure: what could be happening ? i would appreciate any comments..... :alright:
Posted on 2004-02-24 06:01:59 by JaiKMw
This explains the what the gate operators do (OR/AND/XOR etc..)

http://www.lib.csubak.edu/infocomp/search/boolean/venn.htm

For your specific example :

XOR AL,1; This is equal to: MOV AL,00000001b

This is a toggle, if the value is 1 it will result in 0 if the value is 0 it will result in 1.
Posted on 2004-02-24 06:35:32 by donkey
thats a very god link from donkey, but i remember having trouble grasping the gate operators aswell. what really helped me out though were the truthtable of xor which looks like this:
0 XOR 0 = 0
1 XOR 0 = 1
0 XOR 1 = 1
1 XOR 1 = 0
to use this in the example above could look like this:
lets say al contain 1bh which is 0001 1011b, and were going to xor this with 1 = 0000 0001b. so here we go with the truthtable:
0001 1011b (= 1bh)
0000 0001b (= 1h)
--------------------------
0001 1010b (= 1ah)
concluding: xoring al, if it contains 1bh, with 1 leaves you with 1ah in al. hopes this clears things up for you havent already got it =)!
Posted on 2004-02-24 06:54:15 by sluggo
jojoj :), wow!. this gettin better, that's why i like asm, is complicated but logic :D, anyway, thanks for the link donkey, but what really helped me ( ? ), :D, was the truth table, thank you very much sluggo :P.. i'll see ya later guys :) .. thanks
Posted on 2004-02-24 08:29:09 by JaiKMw