Computer Architecture : Instruction Mnemonics and Syntax

When we look at the program written in form of binary bits 0s and 1s, then its very difficult as well as impossible for us to understand it. So, if we write meaningful, easy to understand English words in place of strings of 0 and 1, the program would be more user friendly and easy to understand. The programs written in this category uses familiar English language words that is symbols and not their binary or hexadecimal equivalent. This type of symbolic program is known as assembly language program. Let we want to add two numbers, the binary instruction is 0001000000000101, in assembly language this operation is performed by using the symbols ADD. Whereas in memory, ADD would still be stored as 0001000000000101 only.

A commercial computer may have various more symbolic instructions to give flexibility to the programmer, for writing assembly language programs. In assembly language, every machine language are replaced by useful and easily understandable instructions. The operands of instructions remain in their decimal or hexadecimal forms. Due to the simple one to one relationship between a symbolic instruction and its binary form, as assembly language is treated as a low level language.

Symbols used in writing program in assembly language are known as mnemonics. A program written mnemonics is called assembly language program. Mnemonics and their meaning with details are shown in the below table :

Mnemonics Example Explanation
ANDAND MPerform And logic operation on the value of variable M with value of Accumulator (AC) register
ADDADD MAdd the value of variable M to Accumulator (AC) and the carry bit to E flip flop
LDALDA MLoad the value of M into Accumulator (AC)
STASTA MStore value of AC in M
BUNBUN LocBranch unconditionaly to location Loc
BSABSA LocSave return address in location Loc and Branch to Loc + 1
ISZISZ MIncrement M and skip next instruction if M = 0
CLACLAClear Accumulator Register (AC)
CLECLEClear E
CMACMAComplement (1s complement) AC
CMECMEComplement E
CIRCIRCirculate right E and AC
CILCILCirculate left E and AC
INCINCIncrement AC
SPASPASkip next instruction if AC is positive
SNASNASkip next instruction if AC is negative
SZASZASkip next instruction if AC is zero
SZESZESkip next instruction if E is zero
HLTHLTHalt Computer
INPINPGet information from some input device
OUTOUTPut information to some output device
SKISKISkip next instruction if input flag is on
SKOSKOSkip next instruction if output flag is on
IONIONTurn Interrupt ON
IOFIOFTurn interrupt OFF
CALLCALL SUBCall Subroutine which starts at the location SUB
RETRETReturn to main program
MOVMOV A, BTransfer the value in register B to register A



Syntax of Assembly Language Statements:

Assembly language statements are entered one statement per line. Each statement follows the following format :
   [label]    mnemonic    [operands]    [;comment]
The fields in the square brackets are optional. A basic instruction has two parts, the first one is the name of the instruction (or the mnemonic), which is to be executed, and the second are the operands or the parameters of the command.

Following are some examples of typical assembly language statements :

INC COUNT              ; Increment the memory variable COUNT

ADD MARKS, 10        ; Add 10 to the variable MARKS
MOV AL, 10                ; Transfer the value 10 to the AL register

MOV TOTAL, 48        ; Transfer the value 48 in the memory variable TOTAL

ADD AH, BH               ; Add the content of the BH register into the AH register




Next Topic :

No comments:

Post a Comment