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

Lab # 01 Introduction To Assembly and Assemble: Programming Languages

The document provides an introduction to assembly language and assemblers. It discusses different types of programming languages including high-level, low-level, and machine languages. It describes various registers in the microprocessor classified by function including data, address, segment, and status registers. General purpose registers like AX, BX, CX, and DX are explained. The MOV instruction for moving data between registers and memory is covered. Sample assembly code is provided to display a string on the screen. Lab tasks include writing programs to display a name and enrollment number. Removing the $ from the string output is tested with no observed change.

Uploaded by

saadat
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
81 views

Lab # 01 Introduction To Assembly and Assemble: Programming Languages

The document provides an introduction to assembly language and assemblers. It discusses different types of programming languages including high-level, low-level, and machine languages. It describes various registers in the microprocessor classified by function including data, address, segment, and status registers. General purpose registers like AX, BX, CX, and DX are explained. The MOV instruction for moving data between registers and memory is covered. Sample assembly code is provided to display a string on the screen. Lab tasks include writing programs to display a name and enrollment number. Removing the $ from the string output is tested with no observed change.

Uploaded by

saadat
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 4

Lab # 01

Introduction To Assembly and Assemble

OBJECTIVE:
Developing basic understanding about Assembly and Assembler (emu8086)

INTRODUCTION:

Programming Languages
A programming language is an artificial language that can be used to control the behavior of a
machine, particularly a computer. Programming languages, like human languages, have syntactic
and semantic rules to define meaning.

Types of Programming Languages


Programming languages can be classified into three basic categories on the basis of understanding
level of users as well as the machine to which instructions has been given:

1. High Level Languages


A programming language that enables a programmer to write programs that are more or less
independent of a particular type of computer and are designed to give a better program efficiency.
Such languages are considered high-level because they are closer to human languages.

2. Low Level Languages


These are designed to have both: a relatively good programming efficiency and relatively good
machine efficiency.

3. Machine Language
Machine language is at the lowest level, because it is the actual binary code of 1s and 0s that the
computer understands. These are designed to give a better machine efficiency.

Registers Classification
The registers inside the microprocessor are classified according to the function they perform In
general, they are classified as
1. Data registers
2. Address registers
3. Segment register
4. Offset registers
5. Status register

Some General Purpose Registers:

AX (Accumulator Register)
· It is the preferred register to use in the arithmetic, logic and data transfer instructions because
its use generates the shortest machine code.
· In multiplication and division operations, one of the numbers involved must be in AX or AL.
· Input and output operation also requires the use of AX and AL.

BX (Base Register)

· It is used to store the data also it serves as an address register.

Page 1
CX (Count Register)
· Program loop instructions are facilitated by the use of CX register, serves as a loop counter.
· Also used as a counter in the string operations.
· CL is used as count in instructions that shift and rotate bits.

DX (Data Register)
· It is used in multiplication and division operations.
· It is used in IO operation like DL in character output and DX in string output functions.

Register Size:
· We have three different sizes of registers:
· 8-bit register: AH, AL, BH, BL, CH, CL, DH, DL
· 16-bit registers: AX, BX, CX, DX, SP, BP, SI, DI, SS, DS, CS, ES, FS, GS, IP, FLAGS
· 32-bit registers: EAX, EXB, ECX, EDX, ESI, EDI, ESP, EBP, EIP, and EFLAGS.

Basic MOV Instruction


· The basic MOV instruction is used to transfer data between registers, between and memory
locations, or to have a number directly to a register or memory location.
Syntax: MOV Destination, Source

Examples:
· MOV AH, BL; 8-bits register to register
· MOV BX, AX; 16-bits register to register
· MOV byte1, BL; 8-bit register to memory.
· MOV AX, word1 ;16-bit memory to register

Code to Display String

TITLE LAB01
.MODEL SMALL
.STACK 100H
.DATA
MESSAGE1 DB 0AH, 0DH, "INDUS UNIVERSITY$"
.CODE
MAIN:
MOV AX, @DATA
MOV DS, AX
MOV DX, OFFSET MESSAGE1
MOV AH, 09H
INT 21H

MOV AH, 4CH


INT 21H
END MAIN

Procedure
· Open a notepad editor and create a new file with any name but with the extension “.asm”,eg
lab1.asm. save it to bin folder of tasm.
· Now copy and paste the following code into that file and save again
· Goto command prompt and type cd c:\tasm\bin
· Now type “tasm filename.asm” and press enter
· Now type “tlink filename.obj” and press enter
· Now type “filename.exe” and hit enter
Page 2
·
· Example :

Lab Tasks

1. Write a program to display your complete name on the screen

CODE:
section .data
msg db "Saadat Irfan", 0ah

section .text
global _start

_start:
mov rax, 1
mov rdi, 1
mov rsi, msg
mov rdx, 13
syscall
mov rax, 60
mov rdi, 0
syscall

2. Write a program to display you complete enrolment number on screen

CODE:
section .data
msg db "4-15/2019/010", 0ah

section .text
global _start

_start:
mov rax, 1
mov rdi, 1
mov rsi, msg
mov rdx, 13

Page 3
syscall
mov rax, 60
mov rdi, 0
syscall

3. Test your code after removing the $ sign from the string

A) As per the observation after removing $ symbol from the code there was no significant
change noticed in output.

Page 4

You might also like