0% found this document useful (0 votes)
36 views

Organization of The IBM PC Assembly Language

This document provides an overview of assembly language syntax and program structure. It explains that assembly language programs are translated to machine code by an assembler according to its specifications. Programs consist of statements with up to four fields: name, operation, operand, and comment. It describes common instructions and directives like MOV, ADD, SUB, and .MODEL, .DATA, .STACK, and .CODE. The data segment contains variables, the stack segment reserves memory for the stack, and the code segment holds instructions and procedures.

Uploaded by

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

Organization of The IBM PC Assembly Language

This document provides an overview of assembly language syntax and program structure. It explains that assembly language programs are translated to machine code by an assembler according to its specifications. Programs consist of statements with up to four fields: name, operation, operand, and comment. It describes common instructions and directives like MOV, ADD, SUB, and .MODEL, .DATA, .STACK, and .CODE. The data segment contains variables, the stack segment reserves memory for the stack, and the code segment holds instructions and procedures.

Uploaded by

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

Organization Of The IBM PC

Assembly Language

Lecture#08
Assembly Language Syntax
Assembly Language programs are translated
into machine language instruction by an
assembler, so they must be written to confirm
to assembler’s specifications.
Statements
Programs consist of statements, one per line. Each
statement is either an instruction, which the
assembler translates into machine code, or an
assembler directives which instructs the assembler
to perform some specific tasks. Both instructions
& directives have up to four fields.

Name operation operand comments


Example of an instruction
START: MOV, CX,5 ;initialize counter

Example of assembler directive


MAIN PROC
Name Field
The name field is used for instruction labels,
procedure names, & variables names. The assembler
translates names into memory address.

Example
COUNTER1
@character
SUM_OF_DIGITS
$1000
Operation Field

For an instruction, the operation field contains a


symbolic operation code (opcode). The assembler
translates a symbolic opcode into a machine
language opcode. Opcod symbols often describe
the operation’s function

Example:
MOV ADD SUB
Operand Field
For an instruction the operand field specifies the data
that are to be acted on by the operation. An
instruction may have zero, one or two operands.

For Example:
NOP no operand; does nothing
INC AX 1 operand; adds 1 to the
contents of AX
ADD WORD1, 2 2 operands; add 2 to the
contents of memory word
WORD1
Comment Field
A comment field of a statement is used by the
programmer to say something about what the
statement does. A semicolon marks the
beginning of the field, & the assembler ignores
anything typed after the semicolon.

For Example:
MOV CX, 0 ;CX counts terms, initially 0.
Assembly Program Structure
The most important parts of an assembly
language program are memory models, data
segment, stack segment & code segment.
Memory Models
The size of code & data program can have is
determined by specifying a memory model using
the .MODEL directive. The syntax is

.MODEL memory_model
Data Segment
A program’s data segment contains all the variable
definitions. To declare a data segment, we use the
directive .DATA, followed by variable & constant
declarations.

For Example:
.DATA
MSG DB ‘This is an message’
WORD1DW 2
WORD2DW 5
Stack Segment
The purpose of the stack segment declaration is to
set aside a block of memory to store the stack. The
syntax is
.STACK size

.STACK 100H
Code Segment
The code segment contains a program’s
instructions. The syntax is
.CODE name

For Example:

.CODE
MAIN PROC ; main procedure instructions
MAIN ENDP ; other procedure go here

You might also like