Assembly--programming

Source: Internet
Author: User

Assume Cs:code, Ds:data; The nature of the assume pseudo-directive stipulation section

X DW 4; define the first Addend

Assemble and debug assembly language programs with MASM 6.11 and CodeView

In MASM 6.11, Microsoft Corporation provided the programmer's platform PWB. This is an integrated development environment, the programmer can easily complete the assembly language source program editing, assembly, connection debugging and execution work.

1) Processor selection pseudo-directive

The default is. 8086

.8086 Select the 8086 instruction system. 286 Select the 80286 instruction system. 286P Select the 80286 instruction system in protected mode. 386 Select the 80386 instruction system. 386P Select the 80386 command system in protected mode. 486 Select 80486 Command System. 486P Select the 80486 instruction system in protected mode. 586 Select the Pentium instruction system. Pentium command System in 586P Select protection mode

Complete segment definition Pseudo-operation

Variable name

such as: TABLE DB

such as: DB

Mnemonic

DB DW DD DF DQ DT represents the requested main memory space unit db--defines the byte pseudo-directive, each data item occupies a byte storage unit dw--defines a word pseudo-directive dd--defines a double word pseudo-directive df--defines a 6-byte pseudo-directive dq--defines a 8-byte pseudo-directive dt--defines 10-byte pseudo-directives

Operand items

These data-defined pseudo-operations can define initialization data or can define uninitialized data.

To define initialization data:

Allocate storage space for each data and store the data in the specified storage unit

To define uninitialized data:

Allocates a certain amount of storage space and does not deposit the determined value.

The data definition pseudo-operation can also store the offset address (DW) of a variable or label or an entire address consisting of a 16-bit segment address and an offset address into memory (DD).

5) Expression assignment pseudo-directive

B EQU [Bp+8]

ALPHA EQU 9

BETA EQU alpha+18

EQU does not allow duplicate definitions!

"=" pseudo-operation (allows duplicate definitions!) )

......

EMP = 7

......

EMP = emp+1

......

6) Address counter and alignment pseudo-instruction

Address counter $: Saves the address of the instruction currently being assembled

$ used in the pseudo-operation of ORG $+8; Skip 8 bytes of storage

$ is used in the instruction, the address of the first byte of the machine instruction after the assembly of this instruction is denoted by J

NE $+6; The turning address is JNE's first +6.

$ used in pseudo-operation parameter field: Represents the current value of the address counter

ORG Pseudo-operation:

Set the value of the current address counter

Even pseudo operation:

Start the next address from the even address

Align Pseudo-operation

Format: ALIGN boundary

Where boundary is a power of 2. ALIGN 4 ALIGN 2; Even

7) Base control pseudo-operation

Format:. RADIX-expression

Function: Specify the cardinal number of no Mark MOV bx, 0FFH mov bx, 178; untagged number is a decimal number

. RADIX mov bx, 0FF; Unmarked number is hexadecimal number MOV bx, 178D;

Numeric loopback operator

PTR operator: type ptr expression

Short operator

This operator

High and low operators

(4) Save a series of instructions

7.4 Multi-Cycle program design

. Control of internal and external loops

A double loop requires two loop control variable i,j.

When multiple loops are nested, internal and external loops are not allowed to cross.

Assembly--programming

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.