Professional Documents
Culture Documents
com
ASSEMBLY LANGUAGE
PROGRAMMING
Data Transfer Instruction, Logic Instruction, Arithmetic Instruction
tulisnota.blogspot.com
provide to move data either between its internal register or between an internal register and a storage location in memory
tulisnota.blogspot.com
2.
3.
Move byte / word (MOV) Example: MOV DX, CS move the contents of CS into DX Exchange byte / word (XCHG) Example: XCHG AX, DX exchange the contents of the AX and DX Translate byte (XLAT)
tulisnota.blogspot.com
5.
6.
Load effective address (LEA) Example: LEA SI, EA load SI register with an offset address value Load data segment (LDS) Example: LDS SI, [200H] Load extra segment (LES)
tulisnota.blogspot.com
LOGIC INSTRUCTION
operation AND, OR, Exclusive-OR and NOT Example: AND AX, BX causes the contents of BX to be ANDed with the contents of AX. The result is reflected by new content of AX
tulisnota.blogspot.com
instant, if AX contains 1234H and BX contains 000FH, the results is 1234H 000FH = 0004H The result is stored in destination operand AX = 0004H
tulisnota.blogspot.com
of logic instruction
Meaning Logical AND Logical OR Logical NOT Format AND D, S OR D, S NOT D Operation (S) (D) = (D) (S) + (D) = (D) (S) (D) = (D) (D) = (D)
tulisnota.blogspot.com
MOV AL, 0101 0101 B AND AL, 0001 1111 B OR AL, 1100 0000 B XOR AL, 0000 1111 B NOT AL
tulisnota.blogspot.com
ARITHMETIC INSTRUCTION
1.
Immediate addition
Comment BL become sum of BL + 44H
tulisnota.blogspot.com
Addition (cont.)
Comment The data segment memory byte addressed by BX becomes the sum of the data segment memory byte addressed by BX + AL CL becomes the sum of the stack segment byte addressed by BP + CL
ADD BX, [SI + 2] BX becomes the sum of the data segment word addressed by SI + 2, plus contents of BX
tulisnota.blogspot.com
Addition (cont.)
Comment CL becomes the sum of CL plus the data segment byte TEMP BX becomes the sum of BX plus the contents of the data segment array TEMP plus offset DI The data segment memory byte addressed by BX + DI becomes the sum of that byte plus DL
tulisnota.blogspot.com
tulisnota.blogspot.com
Immediate subtraction
Comment
Instruction
tulisnota.blogspot.com
SBB DI, [BP + 2] DI becomes the difference of the stack segment word addressed by BP + 2 and the contents of both the DI register and carry
tulisnota.blogspot.com
tulisnota.blogspot.com
tulisnota.blogspot.com
tulisnota.blogspot.com
tulisnota.blogspot.com
MUL WORD The unsigned number in AX multiplied by the 16 PTR [SI] bit number in data segment at the address pointed to by SI; the product is found in DX and AX
tulisnota.blogspot.com
Multiplication (cont.) Example 8 bit: MOV BL, 5 MOV CL, 10 MOV AL, CL MUL BL MOV DX, AX
tulisnota.blogspot.com
Multiplication (cont.) Example 16 bit: MOV BX, 0805 MOV AX, BX MOV CX, 0604 MUL CX
tulisnota.blogspot.com
tulisnota.blogspot.com
tulisnota.blogspot.com
Division Example 8 bit: MOV AL, 12 MOV CL, 3 MOV AH, 0 DIV CL
tulisnota.blogspot.com
Division Example 16 bit: MOV AX, 3E14 MOV DX, 0030 MOV BX, 0805 DIV BX