0% found this document useful (0 votes)
70 views20 pages

Module 10 - Coding Assembly Language

Comment lines begin with a semicolon and are used to improve readability. Keywords like instructions, directives, operators and predefined symbols have special meanings to the assembler and cannot be used as normal identifiers. Identifiers must begin with a letter, can include numbers and underscores, and must not exceed 31 characters. The document discusses various assembly directives like TITLE, DOSSEG, .MODEL, .STACK, .DATA, and .CODE that provide information and instructions to the assembler. It also covers data definition directives like DB, DW, DD, DF and DQ that define memory space for data.

Uploaded by

Giezel Madurar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views20 pages

Module 10 - Coding Assembly Language

Comment lines begin with a semicolon and are used to improve readability. Keywords like instructions, directives, operators and predefined symbols have special meanings to the assembler and cannot be used as normal identifiers. Identifiers must begin with a letter, can include numbers and underscores, and must not exceed 31 characters. The document discusses various assembly directives like TITLE, DOSSEG, .MODEL, .STACK, .DATA, and .CODE that provide information and instructions to the assembler. It also covers data definition directives like DB, DW, DD, DF and DQ that define memory space for data.

Uploaded by

Giezel Madurar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

Optional part of a program that is ignored

by the assembler; it is used throughout a


program to improve the readability and
clarity.
It begins with a (;) semi colon
Any statement whose first non-blank
character is a semi colon]
 Example:
 ; This program displays <message>

At the end of instruction


 Example:
 MOV AX, 8053h ;Initializes the value of AX to 8053h
Words in which the assembler assigns a
special meaning and it cannot be used as
identifiers. Using them for wrong purposes
causes the assembler to generate an error
message.
1. Instructions
These statements that will be
translated into machine language
and executed by the computers.

Example:

MOV ADD SUB


MUL DIV INC
DEC LOOP CMP
2. Directives
➢ Statements that give information to the
assembler.

➢ Example:

TITLE DOSSEG .MODEL


.STACK DATA .CODE
3. Operators
➢ Used at assembly time to affect the value of an
operand. Like directives, the assembler
organizes operators and they do not
correspond to machine instructions
➢ Example:
➢ OFFSET SIZE LENGTH
➢ PTR MOD +,-,*,/
4. Pre-defined Symbols
➢ These are symbols that return information to
your program.
➢ Example:
@data @model
 The user defined name or variable that you apply on it in the
program used as reference.
Type of Identifier
 Name – refers to the address of a data item

 Example

X db 0
Msg db “Aloha!$”
 Label – it refers to address of instruction or procedure

 Example

MOV DL, 41h


A: INT 21H
ADD DL, 20h
INT 21H
SUB DL, 20H
LOOP A
It must use letters (A..Z, a…z), number (0,9) and/
or special characters like underscore (_), question
mark(?) and at sign(@).
It must always starts with a letter

It must not use reserved words

It must not exceed to 31 characters.

Example valid identifier:


 Chan Num_1 c2t2 msg 8
Example invalid identifier:
 4ever num+1
Two types of statement instructions and
directives.
A statement may begin anywhere on the line.

Each line may contain one statement

Example:

ADD AX, BX ; uses 2 operands


DEC CX ; using single operand
RET ; no operand
1. TITLE
It creates a title up to 60 characters of source
listing.

Format: Title <text>


Example: TITLE PROGRAM1,ASM
TITLE This program display ITE, Henyo!
2. DOSSEG

It tells the assembler to ignore all other request


and to adopt the DOS segment sequence –
stack, data and code.

Format: DOSSEG
Example: DOSSEG
3. .MODEL
It specifies and initializes the memory mode
before defining any segment

Format: .MODEL <memory model>


Example: .MODEL TINY
.MODEL SMALL
.MODEL MEDIUM
MEMORY MODEL NO. OF DATA NO. OF CODE
SEGMENT SEGMENT

Tiny 0 0

Small 1 1

Medium 1 More than 1

Compact More than 1 1

Large More than 1 More than 1


4. .STACK
It defines the size of the stack. The default
size is 1,024 bytes which you can overrule.

Format: .STACK <size>


Example: .STACK 0100h
5. .DATA
It defines and marks the beginning of data
segment.

Format: .DATA
Example: .DATA

6. .CODE
It defines and marks the code segment
which consists of a set of instructions

Format: .CODE
Example: .CODE
7. END
It is placed at the last line of the source
code

Format: END
Example: END
8. FOR DEFINING DATA
DIRECTIVE LENGTH (IN BYTES) DESCRIPTION

DB 1 Define Byte

DW 2 Define Word

DD 4 Define Double Word

DF 6 Define Far Word

DQ 8 Define Quad Word

DT 10 Define Ten Bytes


It is used for descriptive data such as
person’s name or simply a message. DB is
the conventional format for defining string of
any length

Example: chan db “Hello”


ted db “Hi”
They are used to define arithmetic values
and memory address. It is defined with a
radix specifier such as d for decimal, b for
binary and h for hexadecimal.

Example
Msg db “ITE DEPARTMENT, COD MEMBER”, 0Ah, 0Dh, “$”
Msg db “ITE Department, COD Member”, 10d, 13d, “$”

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy