17
with ASSEMBLY LANGUAGE Computer System Organizati on

Cso lesson intro

  • Upload
    asslang

  • View
    44

  • Download
    4

Embed Size (px)

Citation preview

Page 1: Cso lesson intro

with ASSEMBLY LANGUAGE

ComputerSystemOrganization

Page 2: Cso lesson intro

GROUP OF REGISTERS

Page 3: Cso lesson intro

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

Page 4: Cso lesson intro

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

Page 5: Cso lesson intro

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

Page 6: Cso lesson intro

ASsembly language

Page 7: Cso lesson intro

Some characteristics

Low level language

Platform dependent: not portable

Works directly with microprocessors

Page 8: Cso lesson intro

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

Page 9: Cso lesson intro

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)

Page 10: Cso lesson intro

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”

Page 11: Cso lesson intro

assembly instructions can have up to 4 fields:

Format: [label]Mnemonic[operand][;comments]

NOTE:only the mnemonic field is always required

Page 12: Cso lesson intro

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

Page 13: Cso lesson intro

mnemonic field:

Contains 2 to characters acronym for assembly language instruction

Page 14: Cso lesson intro

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

Page 15: Cso lesson intro

comment field:

Describes the statements in the source program

Starts with semi colon (;)

Page 16: Cso lesson intro

Assembler directives can have 4 fields:

Format: [name]directive[operand][;comments]

NOTE:Only the directive field is always required

Page 17: Cso lesson intro

END