1337codez™
Would you like to react to this message? Create an account in a few clicks or log in to continue.



 
HomeHome  PortalPortal  Latest imagesLatest images  RegisterRegister  Log inLog in  

 

 Binary Code: The Language That Started It All

Go down 
AuthorMessage
Wander
C++ Expert
Wander


Posts : 72
Join date : 2010-08-10
Location : Florida

Binary Code: The Language That Started It All Empty
PostSubject: Binary Code: The Language That Started It All   Binary Code: The Language That Started It All EmptyWed Sep 08, 2010 9:51 pm

As you already know, binary code was the first programming language and it was/and still is the only language that a computer can TRULY read. Before I get into the advanced stuff let me explain the simple stuff.

Binary Code is simply written in strands of 1s and 0s. You may hear the words 'bit' and 'byte' quite often. The meaning of those words may be clouded to you however. A bit is equal to one binary digit (1 or 0). So, for every 1 or 0 in a string of binary digits is equal to one bit. A byte on the other hand is a string of multiple bits (also referred to as a bit-string). Typically, a byte is 5, 6, 7, 8, or 16 binary digits long. One byte forms a single character. For example:

If I opened up Microsoft Word and typed in the word 'Hello' the computer would see:

Code:
01001000 01100101 01101100 01101100 01101111
    H      E        L        L        O

Now, let's analyze what we know about this bunch of ones and zeros.
  • Each byte is 8 bits long
  • Each byte is separated by a space
  • The word is 5 bytes and 5 bit-strings
  • The word is 40 bits


That was the simple stuff. If you are confused at this point: Go back and reread, ask questions, etc. Just don't read on. It gets much more complicated from here.

How Does Binary Code Work?
Binary code works in a very simple manner. It's pretty much programming only with boolean values. Booleans are true and false. In terms of the programming: 1 = true and 0 = false. In terms of interacting with the hardware: 1 = closed and 0 = open. What is this referring to? Well, open and closed refer to electrical currents flowing through a wire. An open current is incomplete and therefore NO electricity is allowed to pass through the open circuit. A closed circuit is completed and electricity flows freely throughout the wire.

Let's take the first letter above as an example: H. The bit-string for H is as follows: 01001000.

As you know a computer is made up of wires and different forms of switches and hardware all glued onto a collection of computer chips. Well, the bit-string for H will code for 8 different flows of electricity (because it is an 8 bit-string).
Opened Closed Opened Opened Closed Opened Opened Opened

Logic Gates
Logic gates are anything (LITERALLY anything; electric circuit, marble contraption, etc) that outputs a single value that can be taken as a boolean value. For example: If I slow down time a lot to where you can see each logic gate going off as electricity hits it, you will see be able to see each character being coded. You will see a switch flip to open the circuit on the first gate, the second switch will be closed, the third opened, and so on and so forth. Logic gates work in a sort of mathematical logic called boolean logic.

Boolean Logic
Boolean Logic is a complete system for logical operations, used in many systems. Boolean Logic was named after a man named George Boole. This is where C++ gets its data-type, bool. A bool is a boolean value. Boolean Logic is best shown with a Venn Diagram.
Binary Code: The Language That Started It All A12
The "universe" is represented by all the area within the rectangular frame. Sets A AND B would be the middle section. Sets A OR B would be each of the outside sections.

AND - This operator operates the intersection of two or more sets. In programming speak: if a AND b equal 2 : do this
OR - This operator operates the union of two or more sets. In programming speak: if a OR b equal 2 : do this The best way to state this is: "one or the other or both"
NOT - This operator handles exclusions. if a NOT equal 2 : do this
XOR - This operator is perhaps the most difficult to understand. It is known as exclusive or. A simple way to state this is "one or the other but not both."

The easiest way to tell the difference between OR and XOR is with these two sentences:
The waitress asked, "Would you like cream or sugar with your coffee?" (Logical OR.)
The waitress asked, "Would you like soup or salad with your meal?" (Logical XOR.)

Applying Boolean Logic to Binary Code
In Boolean Logic binary numbers are used. The universe, for example, could contain just two elements, "0" and "1" (or "true" and "false", "yes" and "no", "on" or "off", etc.).

<Still in progress>
Back to top Go down
http://letslearncpp.forumstech.com/
 
Binary Code: The Language That Started It All
Back to top 
Page 1 of 1
 Similar topics
-
» Binary chat
» here ar sum codes i usto use wen i jst started playin mohh2
» How to Un-DMA a code.
» My bar code
» Source Code

Permissions in this forum:You cannot reply to topics in this forum
1337codez™ :: Programing :: Binary Programing-
Jump to: