Basics are necessary/essential to remember before start learning assembly language :-
Mnemonics : The word “mnemonics” comes from the Greek mneme (”memory”) and mnemon (”mindful”), and the Greek goddess of Memory and mother of the Muses, , was Mnemosyne (pronounced “ne-mos’-i-ni”).
Each number was represented by an alphabetic code. So instead of entering the number corresponding to addition to add two numbers one can enter “add”.
Although mnemonics differ between different CPU designs some are common, for instance: “sub” (subtract), “div” (divide), “add” (add) and “mul” (multiply).
Assembler : An assembly program is used to transfer assembly language mnemonics to the binary code for each instruction,after the complete program has been written with the help of an editor (ex : notepad) it is then assembled with the help of assembler.
Mnemonic Program->Assembler->Machine Instruction
structure of an assembly language program
- Assembly language programs divide roughly into five sections
- header
- equates
- data
- body
- closing
It is always said that assembly language is difficult than any other high level language ,it is true as you have to remember lots of mnemonics for making your program to execute.but once you run or understand four-five program then it becomes easy to run many program.
To Run an assembly program you may require :
- A Word Processor like notepad.
- MASM,TASM or Emulator.
- LINK.EXE ,it may included in the assembler
- DEBUG.COM for debugging if the need so be.
The Instructions of Assembly language consists of :
- Operands (AX,BX)
- Operators ( MOV ,ADD)
Operands : To which the operation will perform.
- A register
- A memory location
- A constant called literal
- A label
Registers :
| Segment Registers | ||
|---|---|---|
CS |
Code Segment | 16-bit number that points to the active code-segment |
DS |
Data Segment | 16-bit number that points to the active data-segment |
SS |
Stack Segment | 16-bit number that points to the active stack-segment |
ES |
Extra Segment | 16-bit number that points to the active extra-segment |
| Pointer Registers | ||
IP |
Instruction Pointer | 16-bit number that points to the offset of the next instruction |
SP |
Stack Pointer | 16-bit number that points to the offset that the stack is using |
BP |
Base Pointer | used to pass data to and from the stack |
| General-Purpose Registers | ||
AX |
Accumulator Register | mostly used for calculations and for input/output |
BX |
Base Register | Only register that can be used as an index |
CX |
Count Register | register used for the loop instruction |
DX |
Data Register | input/output and used by multiply and divide |
| Index Registers | ||
SI |
Source Index | used by string operations as source |
DI |
Destination Index | used by string operations as destination |
(The general purpose registers can be “split”. You have the AH and the AL register for example. AH contains the high byte of AX and AL contains the lowbyte. You also have: BH, BL, CH, CL, DL, DH So if eg. DX contains the value 1234h DH would be 12h and DL would be 34h).
The FLAGS Register consists of 9 status bits. These bits are also called flags, because they can either be SET (1) or NOT SET (0). All these flags have a name and purpose.
| Abr. | Name | bit nº | Description |
|---|---|---|---|
| OF | Overflow Flag | 11 | indicates an overflow when set |
| DF | Direction Flag | 10 | used for string operations to check direction |
| IF | Interrupt Flag | 9 | if set, interrupt are enabled, else disabled |
| TF | Trap Flag | 8 | if set, CPU can work in single step mode |
| SF | Sign Flag | 7 | if set, resulting number of calculation is negative |
| ZF | Zero Flag | 6 | if set, resulting number of calculation is zero |
| AF | Auxiliary Carry | 4 | some sort of second carry flag |
| PF | Parity Flag | 2 | indicates even or odd parity |
| CF | Carry Flag | 0 | contains the left-most bit after calculations |



Recent Comments