Basic Assembly Instructions Used in DEBUG: Julius Bancud

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 15

Basic Assembly Instructions

used in DEBUG

JULIUS
BANCUD
Basic Assembly Instructions
used in DEBUG
• BUG – It is the computer terminology for error or mistake in a
program or computer system and the term debugging is a methodical
process of finding and reducing the number of bugs or defects in a
computer program. These terms stemmed from the early days of
computing.
• DEBUGGER – is a program tool that provides an environment for
testing load modules. Load modules are executable files that can have
extensions of .COM or .EXE . It also allows us to run machine code
programs in such a way that we can observe the changes a program
makes to registers and memory. Using a debugger you can display the
program, execute one instruction at a time, see the results of each
instruction, display area of memory, and so on.
DEBUG

DEBUG – is a software that classified as debugger


which is used for testing and debugging executable
programs. A feature of DEBUG is that it displays all
program code and data in hexadecimal format and
any data that you enter into memory must also be in
hex form. It also provides a single-step mode which
allows you to execute a program one instruction at a
time so that you can view the effect of each
instruction on memory locations and registers.
DEBUG
Advantages of DEBUG
•It is free
•It is universally available
•It is simple to use
•It requires relatively little memory
Rules of DEBUG COMMAND
•It is not case sensitive
•It assumes that all numbers given are in hexadecimal format
•You can enter a space only when it is needed to separate parameters of a
particular command
•You should specify segments and offsets with a colon, in the form of
<segment>: <offset>
DEBUG COMMAND
1. Q (Quit) – finishes the debug session and exits back to DOS environment.
Example: -Q
2. H (Hexarithmetic) – shows the sum and difference of two 4-digit hexadecimal
numbers coded as H<hex value> <hex value>
Example: -H 000C 0008
3. R (Register)- allows you to display all registers and their values. It also shows
the next instruction and permits you to change the value of a particular register.
Example: - R
- R CX
DEBUG COMMAND
4. E (Enter) – enables you to key in data or machine instructions in to memory
beginning at a specific location address.
Example: -E 0200

5. D ( Display or Dump)- displays the contents of a portion memory in hex and ASCII
forms starting with the given address.
Example: -D 0200

6. A (Assemble) – allows you to create program in mnemonic or symbolic code. It also


translates this assembly source statements that you create into machine code.
Example: -A 0100
DEBUG COMMAND
7. T (Trace) – runs the program in single-step mode. It also displays the new
values of the registers and the next instruction to be executed.
Example: -T

8. G (Go) – runs the program as a whole in memory and displays the output.
Example: -G

9. U (Unassemble) – lists all the instructions contained in the program beginning at


the given address. You can also specify the last address location.
Example: -U 0100
- U 0100 0109
DEBUG COMMAND
1. MOV (Move Data)
• It copies and transfer data between two registers, or between an
intermediate data to a register.
• Format: MOV<register>, <register>
MOV< register>, <immediate data>
Example: MOV AX, BX
MOV CX, 5083
BH BL
MOV CL, DL
00 33
MOV BL, 33
DEBUG COMMAND
2. ADD (Add Data)
It is used to get the sum of two integers or a register and an
immediate data and stores the result to the left most register.
format: ADD<register>,<register>
ADD<register>,<immediate data>
Example:
ADD CX, BX
ADD AX, 0308
ADD AL, BL
DEBUG COMMAND
3. SUB (Subtract Data)
It is used to get the difference of two registers or a register and an
immediate data, and stores the result to the left most register.
Format: SUB <register>, <register>
SUB <register>, <immediate Data>
Example: SUB CX, BX
SUB AX, 0308
SUB AL, BL
SUB CL, 85
DEBUG COMMAND

4.MUL (Multiply Data)


It is used to get the product of a given register and AX
register, and stores the result to AX register. If the
product is greater than 16bits, the overflow is stored in
the DX register.
Format: MUL <register>
Example: MUL CX
DEBUG COMMAND

5. DIV (Divide Data)


It is used to divide the value of a given register and
AX register, and stores the quotient to AX and the
remainder to DX register respectively.
Format: DIV <register>
Example: DIV BX
DEBUG COMMAND

6. INC ( Increment by one)


It is used to increase the value of the register by
one(1).
Format: INC <register>
Example: INC AX
INC CH
DEBUG COMMAND

7. DEC (Decrement by one)


The opposite of INC, instead of increasing, it
decreases the value of the register by one (1).
format : DEC < register>
example: DEC AX
DEC CH
DEBUG COMMAND
8. LOOP (Loop Until complete)
It controls the execution of a program segment in a specified
number of times. The CX register should contain a count value
before starting the loop and automatically decrements by one (1).
If CX register is not equal to zero (0), it transfer to its operand
address which points to the start of the loop; otherwise it drops
through to the next instruction.
Format: LOOP <offset address>
Example: LOOP 0108

You might also like