Assemblers

Elements of Assembly Language Programming

An assembly language is a machine dependent, low-level programming language. It provides three basic features.

1. Mnemonic operation codes: Use of mnemonic operation codes eliminates the need of memorizing the numeric operation codes. And also helps in troubleshooting.


2. Symbolic operands: Symbolic names can be associated with data or instructions. which in a simple word means, that you can keep some meaningful names to the variables or an instruction.

3. Data declarations: Data can be declared in variety of notations ( eg:  10, 10.345, 10,00.121, 0.091 etc).


A Simple assembly language statement(stmt):

[label] <opcode>   <operand spec>[,<op spec>...]


Opcodes and their alternative mnemonic code.

instruction                                    assembly
  opcode                                       mnemonic

   00                                               STOP
   01                                               ADD
   02                                               SUB
   03                                               MULT
   04                                               MOVER
   05                                               MOVEM
   06                                               COMP
   07                                               BC
   08                                               DIV
   09                                               READ
   10                                               PRINT


There are 3 types of assembly language statements

1. Imperative statements.
2. Declaration statements.
3. Assembler Directives.

Imperative Statements

Imperative statements indicate an action to be performed during the execution of an assembled program.

Declaration Statements

Syntax

[label]   DS   <constant>
[label]   DC   '<value>'


The DS (declare storage) statement reserves memory and associates name (label) with them.

The DC (declare constant) statement associates a constant with the name(label).

Assembler directives

Assembler directives instruct the assembler to perform certain actions during the assembly of a program. for example:

 START    <constant>
 STOP      [<operand spec>]


Comments

Popular posts from this blog

Managing Output with Manipulators in C++

What is sniffing?

Creating a bootable USB.