[go: up one dir, main page]

0% found this document useful (0 votes)
156 views6 pages

IT0047 Activity 2 String Manipulation

This document describes an activity on string manipulation in assembly language. The activity aims to teach students how to print strings using service 9 of INT 21h. It discusses the principles and procedures of the activity, which involves encoding a sample program to output the strings "RED" and "BLUE" using loops, calls, and returns. The document provides details on the program outcomes, intended learning outcomes, objectives, materials needed, sample code, and a template for students to document their results.

Uploaded by

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

IT0047 Activity 2 String Manipulation

This document describes an activity on string manipulation in assembly language. The activity aims to teach students how to print strings using service 9 of INT 21h. It discusses the principles and procedures of the activity, which involves encoding a sample program to output the strings "RED" and "BLUE" using loops, calls, and returns. The document provides details on the program outcomes, intended learning outcomes, objectives, materials needed, sample code, and a template for students to document their results.

Uploaded by

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

COMPUTER ENGINEERING DEPARTMENT

IT0047

ACTIVITY 2: String Manipulation

2.1 Program Outcomes (POs) Addressed by the Activity


a. ability to apply knowledge of mathematics and science to solve engineering
problems
b. ability to design and conduct experiments, as well as to analyze and interpret data
c. ability to design a system, component, or process to meet desired needs within
realistic constraints such as economic, environmental, social, political, ethical, health
and safety, manufacturability, and sustainability, in accordance with standards
d. ability to identify, formulate, and solve engineering problems
e. ability to use techniques, skills, and modern engineering tools necessary for
engineering practice.
f. knowledge and understanding of engineering and management principles as a
member and leader in a team, to manage projects and in multidisciplinary
environments

2.2 Activity’s Intended Learning Outcomes (AILOs)


At the end of this activity, the student shall be able to:
a. Discuss the function of a LABEL, LOOP, INC, DEC, CMP and JUMP Instructions
b. Apply and demonstrate the use of the Service Function Call 09H of INT 21H in
assembly language.
c. Execute of an assembly language program using service function call 09H, INT 21H

2.3 Objectives of the Activity


The objectives of this activity are to:
a. To learn how to print strings using service 9 of INT 21h
b. To learn how to process string in assembly language level
c. To apply loop and call & return instruction.
d. To create a program that provides a simple screen output by using the string output
service.

2.4 Principle of the Activity

Strings can’t usually fit in a register, string are then placed in the memory and then pass
the address of the string in memory of two of the registers, the segment address in DS and offset
address in DX.

The string output sends a string of characters to the standard output.


On entry: AH = 09h.
DS = segment address of the first character of the string
DX = offset address of the first character of the string.

ACTIVITY 2: STRING MANIPULATION 1


Service 9 display string of character starting with the first character (address in DS: DX)
output, but not including, the character “$” (ASCII24H)

2.5 Materials/Equipment

1 unit Personal Computer


DOS / Command Prompt
Text Editor (SK, Notrepad, Wordpad)
Assembler (TASM.EXE)
Linker (TLINK.EXE )
Storage unit

2.6 Circuit Diagrams / Figures / Source Codes (if Applicable)

Figure 1. Title

2.7 Procedure/s

1. Encode the given program. Compile and assign a filename sam3.asm

.model small
.stack
.data

x db "RED$"
y db "BLUE$’"

.code org
100h
start:

main proc
mov ax,@data
mov ds,ax
mov ah, 9 lea dx,
y int 21h
call down
mov ah, 9

ACTIVITY 2: STRING MANIPULATION 2


mov dx, offset x
int 21h
mov ah,4ch int 21h
main endp

down proc
mov ah, 2
mov dl,13
int 21h
mov dl,10 int
21h ret
down endp

end start

2. Write down the output of the given


program.

3. Modify sam3.asm. The output should be:


(Note: Use the call/ret instructions)
RED
RED
RED
RED
BLUE
BLUE
BLUE
BLUE

2.8 Activity Report

Section: Date Performed:

ACTIVITY 2: STRING MANIPULATION 3


Course Code: Date Submitted:
Course Title:
Instructor:
Group No.: Activity No.:

Group Members: Signature:


1.
2.
3.
4.
5.

2.8.1 Data and Results

1. Given the sample output coming from your instructor, write down and compile the
required program that will provide the expected sample output using expt3.com as
the filename.

2. Encode the program.

3. Ask your instructor to check your work

4. Save the program to your data disk.

5. What are the requirements that must be satisfied before INT 21h service 9 prints the
string?

_____________________________________________________________________

_____________________________________________________________________

_____________________________________________________________________

6. What are the advantages of using procedures?

_____________________________________________________________________

ACTIVITY 2: STRING MANIPULATION 4


_____________________________________________________________________

_____________________________________________________________________

7. What is the use of RET instruction?

_____________________________________________________________________

_____________________________________________________________________

_____________________________________________________________________

8. Explain how the call and ret instruction works.

_____________________________________________________________________

_____________________________________________________________________

_____________________________________________________________________

2.8.2 Calculations

2.8.3 Observations (if applicable)

__________________________________________________________________

__________________________________________________________________

__________________________________________________________________

__________________________________________________________________

2.8.4 Conclusion/s

__________________________________________________________________

__________________________________________________________________

__________________________________________________________________

__________________________________________________________________

ACTIVITY 2: STRING MANIPULATION 5


2.8.5 Rating (include Rubric)

Criteria Grade

Activity Conduct (1-5)

Correctness of Command(s)/Program(s) (1-5) x 2

Completeness of Tasks (1-5)

Data Analysis and Results Interpretation (1-5)

Total Score

Mean Score = (Total Score / 5)

Percentage Score = (Total Score/25) * 100

Other Comments:

ACTIVITY 2: STRING MANIPULATION 6

You might also like