PSP Coding


 
HomeCalendarFAQSearchMemberlistUsergroupsRegisterLog in

Share | 
 

 Or, Xor, & And Command Tutorial

Go down 
AuthorMessage
-LeetGamer-
Admin


Posts : 247
Points : 397
Reputation : 4
Join date : 2010-09-29
Age : 25

PostSubject: Or, Xor, & And Command Tutorial   Wed Sep 29, 2010 2:43 am

Tutorial by TheEliteOne aka -LeetGamer- aka TH 113 aka xKVQ8x
==========================================================

Commands: Or, Xor, And

First you need to know what Binary is. Binary is another form of counting, like normal numbers (Decimal), and hex numbers (Hexadecimal). But Binary only can use 0 and 1. This is needed to learn these commands, now here is a decimal (Normal number) to Binary converter:

Code:
http://acc6.its.brooklyn.cuny.edu/~gurwitz/core5/nav2tool.html

First what the command does is converts the hex value into Binary. So if we had 8 and 2 in hex here will be are binary values:

1000 (This is Cool
10 (This is 2)

Now we need them to be equal, so we add zeros:

1000 (This is Cool
0010 (This is 2)

Now they are equal size. These two binary numbers are what I will be using for all three commands. When I say each set, I mean that the first set is 1 and 0, the second is 0 and 0, the third is 0 and 1, and the last is 0 and 0. Basically each diget in the Binary number.

Or:
Or

1000
0010

In each set, the result is 1 if the top diget is one OR the bottom diget is one OR both digets are one, if none of those are true the result is zero.

1000
0010
------
1010 (This is are result, in decimal it is 10 and in hex it is A)

So 8 || 2 = 10 and in hex: 0x8 || 0x2 = 0xA. The symbol for Or is two of these: ||

Xor:
Exclusive Or

1000
0010

In each set, the result is 1 if the two digets are different, and the result is 0 if they are the same.

1000
0010
-----
1010 (This is are result, same as last time, but do not think that Or and Xor do the same thing!)

So 8 ^^ 2 = 10 and in hex: 0x8 ^^ 0x2 = 0xA. The symbol for Xor is two of these: ^^

And:
And

1000
0010

In each set, the result is 1 if the first AND the second diget are 1, if that is not true the result is 0.

1000
0010
------
0000 (This is are answer, in dec and hex it is zero)

So 8 && 2 = 0 and in hex: 0x8 && 0x2 = 0x0. The symbol for And is two of these: &&

=====================================================================================
Ori, Xori, & Andi are the same thing, but they take a immediate value that you give and a register, and not two register contents.

Please +Rep / Donate / Give Me a Medal (I would rather have a medal Smile ) if it helped or you thought it was a good guide.
Back to top Go down
View user profile
 
Or, Xor, & And Command Tutorial
Back to top 
Page 1 of 1
 Similar topics
-
» AOE_Fan's RMS Command Tutorial
» Curl Tutorial!
» How to make .abk book ( Arena ) step by step... tutorial...
» i need help ;/
» IvanHoe 999946f x64 vs. IvanHoe B46fB x64, 2.800 games, still running

Permissions in this forum:You cannot reply to topics in this forum
PSP Coding :: PSP Section :: PSP Coding Tutorials :: MIPS-
Jump to: