Just a dumb question... How is xor pronounced? Is it like the letter "X" then "OR"??? Another... I see the line 'shr ax,16' a lot in winsock examples. What is the shr function? What does it do? And why do i only see it used with 'ax,16'? Sorry if i'm wasting board space. Just curious about those two things... Thanx, Nok. This message was edited by Nokturnal, on 3/28/2001 11:52:24 AM
Posted on 2001-03-28 10:49:00 by Nokturnal
I say XOR to it, like in XORRO *hehehe*
Posted on 2001-03-28 10:55:00 by JimmyClif
I say "X-OR"... shr ax, 16 is a bit shift, 16 places right. As ax is a 16 bit number, it will either have no effect, or leave ax = 0. shr and shl pack 0's in at the appropriate end eg: shr 0FFFFh, 1 = 07FFFh (0111 1111 1111 1111 in binary) shl 0FFFFh, 1 = 0FFFEh (1111 1111 1111 1110 in binary) I think as ax is 16 bit, you can only shift by upto 15, so only the bottom 4 bits of the value "to shift by" are used. Hence 16 & 0Fh = 0, same as shl 0!. The last bit to "fall off the end" of the shifted variable ends up as the carry flag. so: shl 0FFFFh, 4 = 1111 1111 1111 1111 0000 in binary, where the bold are those lost off the end of the shifted number, the underlined bit sets the carry flag, and the italics are the added padded 0 bits. Similar instructions are the ROL/ROR, and RCR/RCL. ROR is a simple roll, where instead of pads, the bits that fell off the end come back at the start, carry is also set, again by the last bit to "fall off". RCR is like roll, except the carry flag acts like the 33rd (or 17th or 9th bit) of the target of the roll. There is also a description in the OPCODES.HLP file that comes with MASM32. Hope this helps A quick test shows the following: shr XXX, YYY Only the bottom 5 bits of YYY are used, no matter what XXX is, so shr ax, 16 will always = 0. Mirno This message was edited by Mirno, on 3/28/2001 12:29:02 PM
Posted on 2001-03-28 11:14:00 by Mirno
i think you have to say "X-OR" either. because this "x" stands for "exclusive" so there are actually two words. :cool:
Posted on 2001-03-28 11:41:00 by [SaFc0n]
"Eks Or"
Posted on 2001-03-28 21:19:00 by elf+boi
Some useless facts: I just searched my entire \masm32\ folder and subs for "shr" "shr" occures 388 times in 150 files "eax, 16" occures 38 times in these 150 files "ax" occures 15 times, nover with a shift count greater then 12 "shr eax, 16" occures just 3 times. And each time, it includes a comment to the effect of ";eax = HIWORD(lparam)" Many times, two word values are packed into one dword and passed as lParam. One round-about way of getting to this is to load the dword, shift it 16 times (to reverse high and lo words), and just using this new loword protion. However, if you think about it, you're just trying to pull a word value from memory to a word register (or even a dword register with say a movsx instruction), so there are better ways then shifting to getthis piece. ------------------------------------ "Homer Simpson is not the kind of man that apologizes, I'm sorry that's just the way I am."
Posted on 2001-03-28 22:25:00 by Ernie
Wow! Thanks you guys. I got a much better response than i had expected. I understand now. :) Thanks again! Nok.
Posted on 2001-03-29 10:39:00 by Nokturnal
I pronounce it "Exclusive Or". Don't know the answer to the other question. Sorry. _Shawn Update: I was greatly mistaken about his one, have no idea what for... I convused it with not... therefore, to save further corrections, I'm removing it... :D Thanks Ernie for pointing that out... LOL :D This message was edited by _Shawn, on 3/29/2001 11:53:27 PM
Posted on 2001-03-29 14:34:00 by _Shawn
Invert? INVERT? X-OR doesn't invert. It ADDS!!!!
``````
0
+0
----
0

1
+0
----
1

0
+1
----
1

1
+1
----
0 (plus a carry out)
``````
Yes, one very popular application of the X-OR function is to do inversion, since: A X-OR 1 = NOT A However, for those of us who overuse "xor eax, eax" it's a CLEAR function.
Posted on 2001-03-29 22:43:00 by Ernie
Ernie... LOL... what was I smokin'... :D The funny thing, is that I actually knew that... I'm cracking up over here... that's funny... I was confusing it with not... huh? :D :D :D _Shawn
Posted on 2001-03-29 22:47:00 by _Shawn
Well, I have to agree here. I pronounce it x-or or Eks Or or whatever you want to call it =)
Posted on 2001-04-02 17:05:00 by Phrekie
I've always pronounced it Zor(ro), but it's a bad habbit. On Motorola chips, XOR is actually EOR (which I pronounce Eyore like from Winnie the Pooh :)). I say, to each their own. I know a lot of people pronounce GUI as Gooey, but I still say G-U-I. This message was edited by Racso, on 4/2/2001 5:48:24 PM
Posted on 2001-04-02 17:46:00 by Racso