Chapter 4

S (search) searches a range of addresses for a pattern of one or more bytes.

SYNTAX s range list

range - specifies the start and end address of the range you want to search.

list - specifies the pattern of bytes or a string that you want to search for. Separate each byte value with a comma or a space and enclose the string in quotations marks.


To search a block of memory for the pattern of bytes, 41 55 66 located at offset 100 thur 250


s 100 200 41 55 66 (return)

debug will display the address of all locations that contain this pattern of bytes.

To search the same block of memory for the string, Data Institute, Enter

s 100 250 "Data Institute"

debug will return all of the locations that contain that string.

You must have the exact bytes or the proper case letters for the search command. It is case sensitive.

t (trace) Executes one instruction at a time and displays the contents of all of the registers, the condition of the flags and the next instruction to be executed.

SYNTAX t [=address] [number]

address - specifies the start address to start tracing. If you don't specify the start, debug will use the CS:IP registers for the next instruction.

number - specifies the number of instructions to be executed. Default number is one.

t is like the g and p command except it cannot go through a sub-routine or an INT instruction. I Would recommend using the p command for all single stepping and debugging.

However, t can be used to trace through the ROM bios program. If you want to unassemble the ROM bios program use t.

u (unassemble) - disassembles bytes and displays their source code listing in mnemonic form with their addresses and values.

SYNTAX u [range]

u (by itself u will unassemble 20 bytes)

range - specifies the starting and ending addresses or the starting address and the length, of code you want to unassemble.


To unassemble 16 bytes (10hex) starting at 0100

u 0100 L 10

debug displays,

CS:0100 MOV AX,5600
CS:0102 MOV DX,200
CS:0105 INT 21
CS:0107 MOV AH,7
CS:010D JZ 0111
CS:010F JMP 0107

You could have also entered,

u 100 110

and debug would display the same information.

w (write) Writes a file or a specific number of sectors to the specified disk.

SYNTAX w address drive start number (to write sectors to the disk)

w address (to write files to the disk)

address - specifies the beginning memory address of the file you want to write to the disk file. If you don't specify, debug will start at CS:0100.

drive - specifies the drive that will be the destination disk.

0 = A
1 = B
2 = C
3 = D

start - specifies the start sector number in hexadecimal that you want to write to.
number - specifies the total number of sectors you want to write.

Saving a file to the disk

To write a file to the disk you must first, use the name command (n) to name the file. You must specify the path in the name command such as A:\advanced\

After the file is named, you must specify the size of the file in total bytes, by setting the BX:CX registers to the number of bytes. Be careful that you have the BX set to zero before you write a COM file to the disk. Each digit in BX represents 65,000 decimal bytes. For our purposes BX will be always set to 0.

  • Chapter 5
  • Return to Home Page.