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

INTRODUCTION

This presentation will explain how the program "Debug.exe" than MS-DOS. First pr
ovide some concepts of the word "DEBUG", and its functionality. Describe two typ
es of programmers to assembly language. Plus a bit on the CPU registers. After D
ebug.exe we enter the program, starting as you enter it, and some background bef
ore entering. Mention program commands used, and how to use files "scipt. It als
o mentions the input and output data The paper describes briefly the implementat
ion of a small program.
CONCEPTS
To have a broader concept of the program, you must define its name. BUG, it mean
s failure, default program. A concept widely used in video game play.
DEBUG "means debug (scrutinize and eliminate failures). The word has become a ve
rb (Debug), which is derived the word" DEBUGGER "(debugger).
By extension, all programs and utilities that serve to scrutinize the data and l
ow-level code, generically identified with this name.
CONCEPTS
With the debugger we can review step by step implementation of our program, chec
k out how it is changing the content of records to locate where the error and co
rrect it.
Debug.exe is an executable that, until 2001, accompanied all versions of MS-DOS,
from 2.0, and Windows. It is certainly an old program but of enormous education
al potential for the beginner.
The DOS debug allows us, among other things, edit executable files and to serve
as a rough translation of sentences assembler to machine language.
Two types of programs
To understand better, make a distinction between programmers.
• Applications Programmer
It is dedicated to designing user-level applications, so its area is reduced to
knowledge of: • The internal processor registers needed to manipulate data and m
emory addresses • The basic set of instructions the processor • Addressing modes
Two types of programs
• The systems programmer
It has to be another mission, the design of optimal systems as possible to explo
it the hardware resources to support the intended applications. To perform its t
ask, you must know • Registration system to manage essential aspects such as the
operation mode of the processor, etc.
Internal CPU register
The Intel 8086, the first of the x86 series, has several records that can be cla
ssified into three groups: • General purpose registers (8 entries): - The data:
AX: BX Accumulator: Base CX: DX Counter: Data - Pointer SP: Stack pointer BP: ba
se pointer - Index: SI: Source Index DI: Destination Index
Internal CPU register
• registers and instruction pointer register of flags (2 entries) IP: Instructio
n Pointer Markers (Flags) • Segment Registers (3 entries) CS: Code Segment DS: d
ata segment SS: stack segment ES: Extended Segment These records are the level o
f the application programmer. This means they are fully visible to the programme
r. There are other records that are no longer transparent to the application pro
grammer: the system logs.
INITIALIZATION
To use it simply type debug from the MS-DOS or from a DOS window. Although in th
e latter case some of its most interesting features are not available. It is imp
ortant to know that many of these utilities uses low-level, require a stand-alon
e operation, ie outside a multi-user operating system, as they encapsulate and h
ide (virtualize) many aspects of the hardware. Once the program is running, the
indicator ("prompt") is a hyphen "-", indicating that the "Shell" waiting for or
ders. To exit just press a Q. Like many programs of its kind, its commands begin
with a letter or combination of them (can be used either uppercase or lowercase
) and some optional parameters (not essential separating the option letter of th
e optional parameters).
COMMANDS
The simplest command is the question?, Resulting in a summary list of the availa
ble options
CONADOS
The Spanish translation would be: fill assembly go write compare hexadecimal dum
p entry load [number] move out to carry out name [address] C D address range [ra
nge] E address [list of values] F range list G [= address ] [directions] H value
1 value2 I port L [address] [drive] [first sector _] N M range address [name pat
h _] [_ argument list] O port byte P [= address] [number] Q
COMMANDS
look up register disassemble write R [register] S range list T [= address] [valu
e] U [range] W [address] [drive] [first _ sector] [number] XA [# pages] XD [ID]
XM [L page] [P page] [ID] XS
allocate deallocate expanded memory expanded memory expanded memory pages alloca
ted display expanded memory status
Most debug commands perform an action and return to shell prompt, but it is a lo
ng statement, such as showing a large piece of code, you can stop by pressing CT
RL-Break or interrupted with CTRL-C to return to shell .
SCRIPT FILE
A little-known feature is that debug can accept input from a file "Script", whic
h can be a simple ASCII text file in which each command is separated from the pr
evious one INTRO. After the last, to be a "Q" to exit debug, it should leave a b
lank line by pressing ENTER twice. The lines can contain comments. Anything from
a semicolon character (;) to the end of the line will be ignored.
Example:; this is a comment D; here will show something ...
SCRIPT FILE
Assuming we have a file "Script" Ordenes.txt name may be used as input to debug
using a redirect command as follows: DEBUG <Ordenes.txt can also be made that th
e program redirects the output to a file which can be be inspected later. Althou
gh it has the difficulty of having to work "blind" can be useful in certain circ
umstances. For example, when you want a dump in certain areas of memory. In the
above case could be obtained Result.txt file with the following command: DEBUG <
Ordenes.txt> Result.txt
ERRORS
When debug is not capable of interpreting a command, it shows an error message a
nd an indicator "^" under the command where the error.
INPUTS AND OUTPUTS
Debug assumes that the figures given are hexadecimal, and in the case of memory
addresses to be introduced in a segmented way. In turn, the results are also sho
wn in hexadecimal format when referring to memory addresses. When it is simply t
he contents of certain memory locations, the result is displayed in hexadecimal
and ASCII. For example, one output can look like this: 177C: 0180 177C: 0190 177
C: 177C 01A0: 01B0 177C: 177C 01C0: 177C 01D0: 01E0 177C: 01F0 01 21 10 03 41 10
05 61-10 07 81 10 09 A1 10 0B.! .. A.. ....... a. C1 E1 10 0D 10 0F 01 11-11 21
11 13 41 11 15 61 .........!.. A.. To November 17, 1981 November 19 A1 C1 11 11
1B 1D 1F E1 11 January 1912 ................ 21 21 12 23 41 12 25 61-12 27 81 1
2 29 A1 12 2B!. # A.% a.'..)..+ C1 E1 12 2F 12 2D 01 13-31 21 13 33 41 13 35 61
..-../..1! A.5a 3 13 37 81 13 39 A1-C1 13 13 3B 3D 3F E1 13 January 1914 7 .. 9
..;..=..?.. 41 21 14 43 41 14 45 61-14 47 81 14 49 A1 14 4B A!. CA.Ea.G.. I.. K
C1 E1 14 4D 14 4F 01 15-51 21 15 53 41 15 55 61 .. M.. O.. Q!. SA.Ua
INPUTS AND OUTPUTS
Each row shows 16 memory locations from the position shown by the columns of the
left that the show as offset: segment. The central block shows the hexadecimal
content of each byte, while the second column contains the ASCII representation.
For example, the 5th row displays the contents of the positions 177C: 01C0 to 1
77C: 01CF (both inclusive). His last two bytes contain respectively five and cha
racters, which correspond to the numbers 35h and 61h of the central block. Which
as we know, equivalent to decimal 53 and 97 which are precisely the ASCII value
s of the characters mentioned.
INPUTS AND OUTPUTS
For this reason that output type can be listed to the printer, the right block a
ctually contains no ASCII representation of all characters (some not even have a
printable representation). In fact only shows the first set of printable charac
ters (US-ASCII). The rest is represented by a point. Do not forget that, despite
some memory locations may contain ASCII values for which equivalence is a print
able character. This does not mean that such positions effectively represent the
se values for the application that uses them. For example, it might in fact the
two positions mentioned memory (two bytes) instead of five characters and accoun
t for a 16-bit word Little Endian format, which in turn represent a whole number
(a number) .
Implemented in two
There are two formats:. COM and. EXE. • The first,. COM is the original format.
In this format all code and data is put into a single segment whose size should
not exceed 64KB. • In the second case. EXE, reserves a segment for data, one for
code and one for the stack.€To debug programs can be written in. COM, which are
much smaller. The program should begin executing at the address 256 [100h], sin
ce the DOS executable reserve the first 256 bytes to place there a data structur
e known as the PSP, when it is loaded into memory. The PSP (Program Segment Pref
ix: Program Segment Prefix) contains information that will be used by the DOS lo
ader.
You spell PROGRAM
• Taking the above explanation, we start writing to 100 and enter. Followed the
instructions on the screen:
WRITE A PROGRAM
The first statement, "jmp 108", is jumping to the location 108. We need a space
for our string. Since we know the size of the program and we can not determine a
t the beginning where it will put the chain if the end of the program, we put at
the beginning, and to prevent the program to start running in the chain (giving
error) we will above. Jmp instruction 108 has two bytes, reserve 6 bytes for th
e string. We spare a byte, so we write "nop" in D10, a zero operator which means
no operation. We see that the string address is 102, so we put this value in DX
, with the command "mov", which is equivalent to assigning "value = C programmin
g, then call the service 9 (mov ah, 9 ) of the interrupt 21h (int 21) to display
the string. Then run the service interruption 10h 16h (which stops the executio
n of the program) and finally back to DOS interrupt 20h.
WRITE A PROGRAM
• Then press enter 2 times to exit the instruction A • We can test our program w
ith instruction G:
WRITE A PROGRAM
• You must press ENTER to exit the program. Will display: "The program has ended
normally"
WRITE A PROGRAM
• Now we write our program to a file. COM disk. We use the order W [write]. To m
ake this script properly, first choose a name for the program, as saludo.com. Th
e extension must be. COM, because W can not create executable format. EXE; the o
rder is:
WRITE A PROGRAM
We must also specify the size of your executable. W will create a file with the
size indicated on the CX register, so we should put our CX executable size R usi
ng the command:
WRITE A PROGRAM
• Finally we write the file to disk
WRITE A PROGRAM
• Now we can exit the debug with the "Q" and run our program:
CONCLUSION
In general the information gives us a broad concept of using the program Debug.e
xe for user applications as scheduling systems is very complex. We have seen tha
t program in this language must have some prior knowledge of the records, beside
s having a skill with numbers hexadencimales. It is not explained much, but the
intention was to publicize the program and to make a small program, do a tutoria
l, in addition to this type of program is little used because of its complexity,
so they are used but the high level language.

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