shinebeach.com
  Home Page :> About Us :> Add Url :> Privacy of Info :> ToS :> Add Your Article
Search:   
Get Free Links
 

Tour & Travel

Technology & Science

Children

Academics & Learning

Self Healing

Sports

Property & Agents

Employment & Careers

Law & Politics

Food & Recipe

Entertainment

Business & Companies

Indoor Games

Shopping Online

Lifestyle & Fashion

Healthcare & Treatment

Creative Arts

Computers & Software

Banking & Finance

People & Society

Vehicles & Automotive

Issues & News

Health & Hygiene

Home Family & Garden


 

Home Page › Computers & Software › Computer Technology Studies
 

History of the Computer - Machine Code Programs Part 2 of 3

 

Author: Tony Stockill

What components will we be using? We have mentioned Registers as being where data being worked on is stored. One of these is the Program or P register. This is essentially a set of flip-flops, one for each 'bit' of the instruction. Various bits of this register are then decoded to see what the instruction has to do, for example an add or a test for 0.

Other registers would be used to store data to be added, and for the result, they could also be for data to be sent to a disk or tape drive.

We will look at a simple program to calculate the area of a rectangle. We can use any dimensions using this program, we will use 3x4 for illustration purposes. For this example we only have 5 instructions we can use, an ADD, a SUBTRACT, a STORE, a BRANCH and a STOP. The stop isn't strictly a normal instruction, but serves the purpose here.

The program is in memory from location zero onwards and looks like this:-

(0)000 - 000 011 000 STORE
(1)001 - 000 100 001 STORE
(2)010 - 001 000 010 ADD
(3)011 - 010 001 001 SUBTRACT
(4)100 - 011 001 010 BRANCH
(5)101 - 100 000 000 STOP

The format for these instructions, or the way the bits are laid out, determines what the instruction does, and what data it uses. We are using a format devised for this illustration. For example here is an ADD instruction

001 001 010

The first three bits are the 'command', or what the instruction does. 001 is decoded as an ADD. The rest of the instruction tells us what to add. The next three bits are the address of the register to be added. The last three bits are the register to be added to. This instruction will take the contents of register 000 and add them to the contents of register 010. The result will be placed in register 010.

How do we get data into those registers 000 and 001? We have a STORE instruction. This time the format is:-

000 011 000

Once again the first 3 bits are the command - STORE. The next 3 bits are the data, decimal 3 in this case, the last three are where to store it - in register 0. We will put decimal 3 in register 0.

The SUBTRACT instruction is telling us to subtract a value, in this case 1, from the contents of register 1. The result goes in register 1. (An extra bit not shown here would tell the logic to decode the literal, or actual, value of 1 rather than the address of a register).

The BRANCH instruction is what makes programs capable of powerful things, it is a decision maker. The format is

011 001 010

The first 3 bits are interpreted as a BRANCH instruction and enable logic to decode the rest of the instruction. the next 3 bits are the address of a register to test, and the last 3 bits an address in memory to be used to get the next instruction if the test is not met. Various tests are possible, in this case we are testing for 'not 0'.

The STOP is used here for this illustration only, normally the program would continue.

Author Bio:

Tony is Webmaster of and a contributer to www.what-why-wisdom.com/ . For diagrams to go with this series of articles check out "historyofthecomputer.html" on that site.

You can also reach this article by using: online computer science degree, computer science degrees, online computer science degrees
 
 
 

Related Articles

 
Formatting, And/or Re-installing Windows on a Dell PC
 
Uninstall Windows Media Player 10 and Start Enjoying Your Media Again
 
How To Choose A Bluetooth Headset
 
A Quick And Easy Guide To Using Online Forums And User Groups
 
Discover Why You Should Shop Online
 
Targeted Traffic: How to Increase? By Authoring and Publishing eZines
 
How To Start An Email Newsletter
 
Compact Flash Memory and Data Recovery
 
Instant Messaging - A Powerful Communication Tool for Your Business
 
How to Speed Up your Network Performance in Windows XP - For Real
 
 
 
Home Page :> Privacy of Info :> ToS  
© 2006-2008 www.shinebeach.com All Rights Reserved Worldwide.