Monday, September 22, 2008

Assembly Language Programming

Assembly language is consider one of the most powerful programming languages ever developed and is consider the only low level language. Low-level languages are representation of machine language in a form that is easy to understand by human.

Assembly Language is an example of low-level language. It has a direct control to the processor which makes it more powerful than other languages.

Assembly Language Coding Format

An assembler reads a program in low-level language format and generates codes of equivalent program in machine language. To understand Assembly language programming you must be familiar with the instruction and how to use it. Basic knowledge in the machine architecture is also important in creating the source code for a certain task. When you create a program in Assembly language you must do more than describe a formal solution to your program code. Programmers must break their codes into small basic steps. These steps tell the processor what to do, one instruction at a time.

Assembly Language has four field, namely

(Label)
A name defined with specific attribute maximum length is 31 characters and end with;
Characters such as A – Z / 0-9/?, @, _, and $

Mnemonic
Abbreviated spellings of instructions
Contains 2 –to -7 letter acronym for the instruction

[Operand]
Part of instruction that represents a value on which the instruction or directive acts.
Contain either 1 or 2 operands, separated from the mnemonic by 1 space or tab.

[;comment]
All or part of a statement that is ignored by the Assembler, preceded by a semicolon ;

SAMPLE

MOV dl, 0ah ; Move one line down

Assembly Language Program Part

.model
- specifies the memory model that you want to use

.stack - defines the beginning and end of stacks

.data - allows the user to create a data segment, data destination

.code - defines program instruction

start - tells the compiler the beginning of the program body

end - finish the assembler program

How to construct an Assembly Language Program
  1. Create a source code using a text editor program (MS-DOS Edit, MS Windows Note Pad). The extension name is .ASM
  2. Using the TASM compiler, create an Object File with an extension name of .OBJ
  3. Linking the Object File (.OBJ) will produce an Executable File

No comments: