Upload
asslang
View
44
Download
4
Tags:
Embed Size (px)
Citation preview
with ASSEMBLY LANGUAGE
ComputerSystemOrganization
GROUP OF REGISTERS
General Purpose Registers
Data registers
1. AX (accumulator register)
2. BX (base register)
3. CX (count register)
4. DX(data register)
Arithmetic operations: addition, subtraction, multiplication, division
Address in data memory
Loop operations
Data storage
Segment registers
Holds starting addresses of a computer system
1. CS (code segment register)
2. SS (stack segment register)
3. DS (data segment register)
4. ES(extra segment register)
Points to the segment that holds the program currently being executed
Points to the current stack segment
Points to the current data segment, which usually holds variables
Usually used in string operations
Point and index registers
1. SP (stack pointer)
2. BP (base pointer)
3. SI (source index)
4. DI (destination index)
Offset of stack segment
Offset of stack segment
Offset of data segment
Offset of data segment
ASsembly language
Some characteristics
Low level language
Platform dependent: not portable
Works directly with microprocessors
Why assembly language?
Makes you a better programmerSome problems can only be resolved using assembly language
The only programming language that can talk directly to the hardware
The only programming language that can talk directly to the hardware
Each statement in assembly can either be:
1. Assembly Language Instructions
2. Assembler directives
Tells the machine what to do
Tells the assembler what to do(with your instructions and data)
Constants in source statements:
binary Sequence of numbers 0s and 1s followed by B
decimal
hexadecimal
character
Sequence of numbers 0 to 9, with or without letter D
sequence of digits 0 through 9 and letters A to F followed by H (first character must be 0 to 9)
string of letters, numbers or symbols enclosed in single or double quotes
1111B1011B
100D76
1ah41h
‘A’
“I am a programmer”
assembly instructions can have up to 4 fields:
Format: [label]Mnemonic[operand][;comments]
NOTE:only the mnemonic field is always required
Label field:
Assigns name to an assembly instruction
Maximum of 31 characters and must with a colon (:)
Can be A to Z(a to z), digits 0 to 9, and special characters like underscore(_)
Cannot begin with a digitRegisters(AX, BX, CX, DX, etc.) can not be used as labels
mnemonic field:
Contains 2 to characters acronym for assembly language instruction
operand field:
Tells the machine where to find data that it is to operate on
In two-operand operations, the first letter is the destination and the second letter is the source
comment field:
Describes the statements in the source program
Starts with semi colon (;)
Assembler directives can have 4 fields:
Format: [name]directive[operand][;comments]
NOTE:Only the directive field is always required
END