Вы находитесь на странице: 1из 7

COMPUTER ENGINEERING DEPARTMENT

Computer Systems Organization and Architecture


Manual

ACTIVITY 3: String Manipulation

3.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

3.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

3.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.

3.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.

ACTIVITY 3: STRING MANIPULATION 1


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.
Service 9 display string of character starting with the first character (address in DS: DX)
output, but not including, the character “$” (ASCII24H)

3.5 Materials/Equipment

1 unit Personal Computer


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

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

Figure 1. Title

3.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

ACTIVITY 3: STRING MANIPULATION 2


mov ax,@data
mov ds,ax
mov ah, 9 lea dx,
y int 21h
call down
mov ah, 9
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

ACTIVITY 3: STRING MANIPULATION 3


3.8 Activity Report

Section: Date Performed:


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

Group Members: Signature:


1.
2.
3.
4.
5.

3.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.exe as the
filename.

2. Encode the program.

3. Ask your instructor to check your work

4. Save the program to your data disk.

ACTIVITY 3: STRING MANIPULATION 4


1. HAIKU ASM FILE AND OUTPUT

expt3.asm

2. RED AND BLUE ASM FILE AND OUTPUT

SAM21.ASM

3. MULTIPLE REDS AND BLUES ASM FILE AND OUTPUT

SAM211.asm

ACTIVITY 3: STRING MANIPULATION 5


5. What are the requirements that must be satisfied before INT 21h service 9 prints the
string?
The data segment must be identified through the string of characters in between
double quotes.
The variable must be declared of type db.
The string must be terminated by a ‘$’

6. What are the advantages of using procedures?


Procedures is a task to do the sets of codes that is also repeated throughout the whole
code.

7. What is the use of RET instruction?


It is paired with the instruction to properly terminate or signal at the end of the
mechanism. It also equivalent of RETURN in other programming languages.

8. Explain how the call and ret instruction works.


By creating a sub-procedure.
down proc
mov ah, 2
mov dl,13
int 21h
mov dl,10
int 21h
ret
down endp

3.8.2 Calculations

3.8.3 Observations (if applicable)

__________________________________________________________________

__________________________________________________________________

__________________________________________________________________

__________________________________________________________________

ACTIVITY 3: STRING MANIPULATION 6


3.8.4 Conclusion/s

__________________________________________________________________

__________________________________________________________________

__________________________________________________________________

__________________________________________________________________

3.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 3: STRING MANIPULATION 7

Вам также может понравиться