Saturday, March 5, 2011

Introduction to IBM Assembly Language

Today, you see computers all around you. Turn the knob on the Washing-Machine to wash and rinse your clothes. And voila, your clothes become spic-and-span. You set the Micro-wave oven on to a high for 5 minutes, and your food gets cooked, ready to eat. Your stereo system plays the music tunes from the Compact Disk(CD) you pop in. A Digital Set-top box receives the Satellite signal,  descrambles it, and you can watch your favourite movies, soaps on the Television. MP3 Music Players, Cellular Phones, Digi-cams, your watch, the air-conditioner system, the Automated Teller Machine(ATM), they are all computers.

Business firms employ computer-systems extensively for batch data-processing, as well as for their online systems. The American Express Bank has Computer-systems to store customer accounts data, generating the statement of accounts etc. Insurance Companies like AXA, AIG maintain your Insurance policy data on Computer-Systems. Telecommunication Companies like Vodafone use computer-systems for Billing. Retail sector giants like Walmart, Tesco employ computer-systems for buying and replenishment of goods. Car-manufacturers like Ford, General Motor(GM) manage their supply-chain – raising a requisition, placing a purchase order, receipt of goods and payment through computer-systems.

Computer – An Idiot Box
A Computer is an idiot-box. It does not have any intelligence of its own. To accomplish any task on the computer, like addition of two numbers, or calculating the Simple Interest, you need to tell the computer-system how to go about it. You must specify and give directions to the computer-system. Given a problem, the computer follows your directions to arrive at the solution.

Computer Program
A set of well-defined instructions given to a computer-system, to accomplish a task is called Computer Program. The computer understands, and interpretes the instructions in the Program, one-by-one in a sequential manner to arrive at a solution.
image

Machine Language
The computer does not understand the natural English language, that we speak. The computer understands only the Bits 0 or 1. This is called the Binary Machine Language.

image

Instructions are patterns of 0’s and 1’s. Every instruction is represented by a Binary Code or Op-code. For example, if you like the computer to ADD the numbers 2 and 3 ; the binary code for addition instruction is 1010 1100, the binary codes for the numeral 2 is 0000 0010 and that of 3 is 0000 0011. You’ll have to code the instruction as shown below.

In plain English    -->   ADD        2         3
In Machine Language --> 1010 1100 0000 0010 0000 0011

Assembly Language
Binary Machine Language suffers from a major drawback. You can tell by the looks of it. For it’s hard to memorize thousands of different binary op-codes for different instructions, while coding a Program. Moreover, a Program coded in Machine Language – patterns of 0’s and 1’s is cryptic.

image
There’s a more dreadful problem that haunts those, who like to write Machine Code. Say you’d like to add up two numbers.