(COMPUTER SYSTEMS AND PLATFORM
TECHNOLOGIES)
EXERCISE
5
String Manipulation using TASM Environment
ROBIN VIDAL Name of Professor
Data Performed Date Submitted
OBJECTIVES:
1. To create a program in assembler using the TASM or Turbo Assembler
2. To learn how to process string in assembly language programming using the data types and
data definition, and the string input and output subroutines
DISCUSSION:
The assembler supports all the various data types of the 80x86microprocessor by providing data
directives that define the data types and set aside memory for them.
Assembler data directives:
ORG (origin)
ORG is used to indicate the beginning of the offset address. The number that c
o
m
e
s
after ORG
can either in hex or in decimal
DB (define byte)
It allows allocation of memory in byte – seized chunks. This is indeed the s
m
a
l
l
e
s
t allocation unit
permitted. DB can be used to define numbers in decimal, binary, hexadecimal, and ASCII. For
decimal, the D after the decimal number is optional, but using B(binary), and H (hexadecimal) for the
others is required. Using ASCII, simply place it in single/double quotation m arks for indication.
DUP (duplicate)
DUPisusedtoduplicateagivennumberofcharacters.Thiscanavoidalotoft
y
p
i
n
g
.
EQU (equate)
This is used to define a constant without occupying a memory location. EQU d
o
e
s
not set
aside storage for data item but associates a constant value with a data label so that when the label
appears inthe program; itsconstant value will be substitutedfor thelabel.
DD (define double-word)
TheDDdirectiveisusedtoallocatememorythatare4bytes(twowords)insize.
DQ (define quad-word)
DQ is used to allocate memory 8 bytes (four words) in size.
DT (define ten bytes)
DT is used for memory allocation of packed BCD numbers.
String Input and Output Routines
Function : String Output
Purpose : Sends a string of characters to the standard output device (monitor). On
Entry : AH = 09H
DS = segment address of the first character of the string DX =
offset address of the first character of the string
On Exit : None
Note: Function 09 displays a string of characters starting with the first character (address in
DS:DX) output, but not including the character “$”.
Function : Buffered Keyboard Input
Purpose : Reads a string of characters from the keyboard and places it in a buffer. On
Entry : AH = 0AH
DS = segment address of the input buffer DX
= offset address of the input buffer
On Exit : String in buffer at DS:DX
PROCEDURE:
1. In the current DOS window for TASM, change to the drive and/or directory where your program is
located.
2. In the current directory, type edit tasm to activate the assembler TASM. Write the following sample
program.
.MODEL SMALL
.STACK
.DATA
var db ’This is a sample program using data types and data definition…’,13,10,’$’
.CODE
START:
MOV AX, @DATA
MOV DS,AX
MOV AH,09
LEA DX, var
INT 21H
MOV AH, 4CH
INT 21H
END START
4. Explain the flow of the program.
- The flow of the program is you have to declare first what is the output and then create new location
for it and just repeat the program you have created until you are down to the last variable
SUPPLEMENTARY PROBLEM:
Develop a program that will produce the given output below. Save your file as
resume[surname].asm, assemble then run the program in the command prompt.
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<name>
<address>
<contact no.>
<e-mail add.>
Birthday:
Birthplace:
Civil Status:
Father:
Mother:
Age:
Citizenship:
Religion:
Occupation:
Occupation:
EDUCATIONAL BACKGROUND:
Primary:
Secondary:
Tertiary:
CHARACTER REFERENCES:
<name>, <position>
<address>,<contact no.>
<name>, <position>
<address>,<contact no.>
<name>, <position>
<address>,<contact no.>
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||