Variable Data Types Offset Anf LEA
Variable Data Types Offset Anf LEA
Assembly language
Prof Hashim Javed
Objectives
Variables
Data types
Offset
LEA (load effective Address)
Introduction
Till now we have placed the characters in the Register so today we will
discuss about the Variables that how can we place the characters in the
variables
Question?
Var db ‘1’
Var db ? ; For the user defined Input
Var db ‘A’
If you want to print the couple of characters then you can initialize them as
Var1 db ‘12345$’
Var1 db ‘Hello World$’
Why Dollar sign is used
To terminate the String we have to add the Dollar($) sign Right After
the string to tell the string we want to print out string over there
Note:
Dollar ($) must be used in end of the String
Let start with the program to implement the
Above Discussion
.data
Var1 bd ‘1’
Var2 db ?
Var 3 db ‘12345$’
Understanding the Logic
.code
Main proc
Mov ax,@data .Data
Mov ds,ax
.Code
Mov ax,@data
It moves the memory location of @data into
The AX Register (16 bit register)
Mov ds,ax
Moves data Address to DS so that the data segment gets initialized as
heap memory to Access variable fast
What is load Effective Address (LEA)
Hello
Carriage Return
World
For new line 10
For carriage return 13
Mov dx,10
Mov ah,2
Int 21h
Mov dx,13
Mov ah,2
Int 21h