Computer and Software Support


Debug: A (Assemble)

Page updated January 21, 2005

Assembles 8086/8087/8088 mnemonics directly into memory. Used without parameters, a starts assembling where it last stopped.
 
Syntax
a [Address]
Parameters
Address
Specifies the location where you type assembly-language mnemonics. Use hexadecimal values for Address and type each value without the trailing h character.
?
Displays a list of debug subcommands.
Remarks
  • Windows XP and the Windows Server 2003 family of products do not use this command. It is included only to preserve compatibility with existing MS-DOS files, but it has no effect at the command line because the functionality is automatic.
  •  

    Specifying valid Address entries

    Address is a two-part designation, containing either an alphabetic segment register or a four-digit segment address with an offset value. You can omit the segment register or segment address. CS is the default segment for the following debug subcommands: a, g, l, t, u, and w. DS is the default segment for all other subcommands. All numeric values are in hexadecimal format. You must include a colon between the segment name and the offset value. The following are valid addresses:

    CS:0100

    04BA:0100

  • Specifying prefix mnemonics

    Specify a prefix mnemonic in front of the operation code (that is, opcode) to which it refers. The a subcommand creates executable machine code from assembly language statements. All numeric values are in hexadecimal format, and you must type them as one to four characters.

  • Using mnemonics

    The segment-override mnemonics are cs:, ds:, es:, and ss:. The mnemonic for the far return is retf. String-manipulation mnemonics must explicitly state the string size. For example, use movsw to move word strings (16 bits), and use movsb to move byte strings (8 bits).

  • Assembling jumps and calls

    The assembler automatically assembles jumps or calls (that is, short, near, or far), depending on byte displacement, to the destination address. You can override jumps or calls by using a near or far prefix. For example:

    -a0100:0500
    0100:0500 jmp 502 ; a 2-byte short jump
    0100:0502 jmp near 505 ; a 3-byte near jump
    0100:0505 jmp far 50a ; a 5-byte far jump

    You can abbreviate the near prefix to ne.

  • Distinguishing word and byte memory locations

    When an operand refers to a word memory location or a byte memory location, you must specify the data type with the prefix word ptr or the prefix byte ptr, which you can abbreviate to wo for word ptr and by to byte ptr. For example:

    dec wo [si]
    neg byte ptr [128]
  • Specifying operands

    Debug.exe uses the common convention that an operand enclosed in brackets ([ ]) refers to a memory location. This the only way that Debug.exe can differentiate between an immediate operand and an operand that is a memory location. For example:

    mov ax,21 ; load AX with 21h
    mov ax,[21] ; load AX with the
    ; contents of
    ; memory location 21h
  • Using pseudoinstructions

    Two popular pseudoinstructions are available with the a subcommand: db opcode, which assembles byte values directly into memory, and dw opcode, which assembles word values directly into memory. For example:

    db 1,2,3,4,"THIS IS AN EXAMPLE"
    db 'THIS IS A QUOTATION MARK: "'
    db "THIS IS A QUOTATION MARK: '"
    dw 1000,2000,3000,"BACH"
  • Entering data into specific bytes

    For information about entering data into specific bytes by using the e (enter) subcommand, see Related Topics.

  • Disassembling bytes

    For information about disassembling bytes by using the u (unassemble) subcommand, see Related Topics.

     

Examples
The a subcommand supports all forms of register-indirect commands. For example:
add bx,34[bp+2].[si-1]
pop [bp+di]
push [si] )

The a subcommand also supports all opcode synonyms. For example:

loopz 100
loope 100
ja 200
jnbe 200

For 8087 opcodes, you must specify the wait or fwait prefix. For example:

fwait fadd st,st(3) ; this line assembles
; an fwait prefix        

Formatting legend


 
Format Meaning
Italic Information that the user must supply
Bold Elements that the user must type exactly as shown
Ellipsis (...) Parameter that can be repeated several times in a command line
Between brackets ([]) Optional items
Between braces ({}); choices separated by pipe (|). Example: {even|odd} Set of choices from which the user must choose only one
Courier font Code or program output

Some of these terms may be the same or similar to DOS commands. For information on DOS Commands, click here