Laboratory Manual
in
By:
Leah Belaya
Maria Cecilia Atienza-Venal
Table of Contents
4 String Manipulation 18
6 Arithmetic Operations 26
7 File Handling 31
8 Case Study 35
EXPT. TITLE DATE TEACHERS
GRADE
NO. PERFORMED SIGNATURE
Debug Commands
1 Familiarization
Assembly Language using Turbo
2
Assembler
Services / Functions with
3
Interrupts
4 String Manipulation
6 Arithmetic Operations
7 File Handling
8 Case Study
OBJECTIVE (S):
At the end of this laboratory activity the students will be able to:
REQUIREMENTS:
Personal Computer with Windows XP, 2000, 2003
Debug.com
DISCUSSION:
DOS_DEBUG.COM
DOS offers a debugging utility as one of its internal commands. The DEBUG program can
be used to:
Provide a controlled testing environment so one can monitor and control the execution
of a program.
Load, alter or display any file
Execute object files. Object files are executable programs in machine language
format.
DEBUG COMMMANDS
PROCEDURES:
1. Open your command prompt at START>Run. Invoke DEBUG from the PCs RAMDRIVE.
C:\WINDOWS>debug /?
Write down the meaning of display usage above when you invoke the PCs RAM Drive
It explains what happens when you type C:\>debug and the specification of the drive, parameters, path
and such.
2. Investigate the Debug.com commands. Write your observation on the 3 rd column of the table below.
-d 2d0 2ff
Move: M range address C:\WINDOWS>debug It copies the
This command should really be called: -m 7c00 7cff 600
memory codes
COPY (not Move) as it actually copies all the -m 100 2ff 70
bytes from within the specified range to a into another
new address. location
C:\WINDOWS>debug
-n c:\temp\doswinok.com
-a 100
cs:0100 jmp 138
cs:0102 db 0d,0a,"It's OK to run
this " It simply load
cs:0118 db "program under files and
DOS or Windows!"
convert it to
Name: N [pathname] [arglist] cs:0135 db 0d,0a,24
This command can be used to load files cs:0138 mov dx,102 debug
into DEBUG's Memory after you have started cs:013B mov ah,9 program`s
the program, but its main function is to create cs:013D int 21 memory. I
a new file under control of the Operating cs:013F mov ax,4c01 guess you can
System which DEBUG can WRITE data to. cs:0142 int 21
edit the
cs:0144
-rcx memory code
CX 0000 of that certain
:44 file.
-w
Writing 00044 bytes [ 68 bytes in
decimal ]
-q
C:\WINDOWS>debug
-r cx
-r
Register: R [register]
Entering ' r ' all by itself will display all of It shows the
the 8086 register's contents and the next
instruction which the IP register points to in
values on the
both machine code and an unassembled register.
(Assembly Language) form.
3. Use the DEBUG R command to display the contents of the registers. What are the contents of the
following registers?
General Purpose
Segment Registers Pointer and Index Register
Registers
AX 0000 CS 0B25 IP 0100
BX 0000 DS 0B25 SI 0000
CX 0000 ES 0B25 DI 0000
DX 0000 SS 0B25 SP FFEE
BP 0000
4. Write down the complete DEBUG command in changing the content of CX register to 3265.
Debug > r cx > 3265. To check if the value successfully changed just r cx and if the cx value is
now 3265 then you did it right!
5. Load DEBUG enter assembly language program using A command. The A ( assembler ) command
lets you enter mnemonic code assembly language instructions.
Address is assumed to be an off set from the address in CS, unless another segment value is
given.
6. To write a file, it must first be initialized with the N command. The N command initialized a file
name in the memory before using the load or write command.
8.. Place the number of bytes to be written in BX and CX ( BX contains the high 16 bits, and CX contains
the low 16 bits. To change the contents of registers BX and CX with the size of the code you enter. The
W ( write ) command writes a block of memory to a file.
-r cx
cx 0000
:10
-w
writing 00010 bytes
-q
a. Is the file sample.com present? b. how many bytes does the file consume?
SUMMARY:
This is quite different from any other program I already used, for me this activity is easy but without the
guide and instructions, I know this will be quite confusing. The most difficult part is you need a lot of effort to
type just to show the output and you need to consider the ASCII for conversion.
CONCLUSION:
I conclude that you need to familiarize yourself with the common debug commands because if you do
not, how about the next activity which will be surely use many complex commands with combination. I also
conclude that constructing an assembly language is not that easy because you need to consider a lot of
things such as the ASCII and the functions of commands especially when you use it because it is not the
simply putting command there and you have the assembly, you need to understand what you are doing.