ACTIVITY NO.1: Displaying String: Objectives

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

ACTIVITY NO.

1: Displaying String

Objectives:
At the end of this activity, the students are expected to:
1. learn how to make a program that display strings,
2. understand the purpose of the dollar sign ($) in the data directives,
3. be able to run a program, and
4. know how to trace and debug program errors in assembly language.

We need to know that:

The codes:
 For displaying string on screen

mov ah,09h
lea dx, <memory_location_name>
int 21h

memory location name is declared under the data directives.

 For ending the process


mov ah,4ch
Int 21h

There are necessary codes when string is to be displayed.

 Codes that get and register the starting memory address of data
segment.

mov ax,@data ; ax=@data


mov ds,ax ; ds=ax

@data is the symbol for the starting address of data segment.

Instruction:

1. Type the following line of codes in the Notepad:


2. Then save under the filename active_1.asm and run your program; follow the
procedure in Steps in Creating Assembly Language Program

The screen output must be

Hello, World

3. Now, remove the dollar sign “$” in the source code, save, and run the program
again.
What happened to the output? Write your observation:
________________________________________________________________
________________________________________________________________

4. Return back the dollar sign ‘$’ into the source code. This time, remove the first
two lines of code under the code directive. These are:
mov ax,@data
mov ds,ax
Save the changes. Run the program again. Write your observation.
________________________________________________________________
________________________________________________________________

5. Return back the removed codes


mov ax,@data
mov ds,ax
into the source code. Replace ds with dx such that the new code is:

mov ax,@data
mov dx,ax
Save the changes then run the program again. Write your observation.
__________________________________________________________________
______________________________________________________________

6. Now, replace dx with the previous code ds so that the code we again the correct
code
mov ax,@data
mov ds,ax

7. Let us go to tracing errors.


Change the reserved word Title with Tittle.
Change the word message with messag (Note: not all words message in the codes
but select only one).
Save the file as exer_1.asm and then run the program. What are the error
messages.
______________________________________________________________
________________________________________________________________

8. Open the file exer_1.asm. Run and list down line numbers that contain error
and the error messages. Debug the program and write the correct source code.

You might also like