8086 compilation pseudo-instruction summary

Source: Internet
Author: User

In the same program, a label or variable can be defined only once.

Labels have three properties: segment, offset, type (near Ptr,word ptr,far Prt,dword PTR)

??

One. Numeric loopback operator: TYPE, Legnth, SIZE, OFFSET, SEG

1.? TYPE???? Expression_r (or label)

If the expression is a variable, echo the type of the variable in bytes: DB is 1, DW is 2, DD is 4 ...

If the expression is a label, the value of the label type is echoed: near is-1, far is-2.

If the expression is constant, echo 0.

Array?? DW a110h,b02ch,c322h???

ADD???? AX, TYPE?? Array?? Equivalent to ADD???? AX, 2

2.? LENGTH???? Variable???? For cases where the variable uses DUP, the number of cells allocated to the variable is echoed; For other cases, the 1 is echoed.

Fees?? DW DUP (?)??????????

MOV?? CX, Legnth?? Fees?? Equivalent to MOV?? CX, 100

3.? SIZE???? Variable???? The number of bytes assigned to the variable is echoed

MOV???? CX, SIZE?? Fees equivalent to MOV CX, 200

4.? OFFSET???? Variable (or lable)???????? The offset address of the loopback variable or label.

MOV???? The Bx,offset Oper_one is equivalent to the LEA bx,oper_one statement, which feeds the Oper_one offset address into BX

5.? SEG???? Variable (or lable)??????? The segment address of the loopback variable or label.

If Oper_one is a variable in the DATA_SEG data segment, the following statement obtains the first address of the DATA_SEG segment

MOV???? DS, SEG oper_one?? Equivalent to

MOV???? AX, data_seg?????? MOV???? DS, AX

Two. Attribute operators: PTR, this, high, low, Highword, Lowword

1.? type???? Ptr???? Expression???????? Used to give an assigned storage address another property, so that the address has another type.

Represents an address by expression, as a specified type.

That is, PTR assigns a new data type or address type to the subsequent expression operand.

MOV???? BYTE PTR[BX], 5???????? Cell in bytes (byte)

MOV???? WORD PTR[BX], 5??????? Deposit Word (word) unit

2.? This ???? Type???? Specifies the type of an address cell that is equal to the current address counter. Type is near, far, PROC, or Bype, WORD ...

First_type???? EQU???? This?? BYTE

Word_table???? Dw???? The DUP (?)???? At this point, the offset address of the First_type is exactly the same as the word_table, but it is a byte type

3.? High (Low)???? Express??? Byte separation operator, high byte, low byte.

Highword (Lowword)???? Express???? Word separating operator, Highword take high word, lowword take low word.

CONST???? EQU???? 0ABCDH??,?????? MOV???? AH, high CONST is equivalent to

MOV???? Ah,0abh

Three. Data definition statement: variable_name???? Mnemonic????? Oper1, Oper2 .....

The commonly used mnemonic mnemonic are:

? DB defines bytes, which means that each operand occupies one byte (1Byte) unit

? A DW definition word that represents a single word (2Byte) unit of each operand after

? DD defines a double word indicating that each operand has a two-word (4Byte) cell

? DQ defines four words, indicating that each operand occupies four characters (8Byte) of cell

? The DT defines 10 bytes, which means that each operand has a 10-word (10Byte) cell behind it, forming a compressed BCD code.

Data_byte????? Db?????? Ten, 4, 10H,????????? A total of 4 bytes are defined, where '? ' is a reserved unit

Data_word???? Dw???? ,?, 100H???????????? A total of 3 words (6Byte) are defined

STR_AA???????????? DB????? ' ABCDEFG '???????????? When you define and initialize a string with more than two cadres characters, you can only use the DB pseudo-directive.

Four. Symbol definition statement (i.e. constant)

Name???? EQU???? Expression???????????????? Defined

PURGE???? Name1,name2 ...??????????????? Lifted

CONSTANT????? EQU???? ??????? Represents a value of 256 for constant

Five. Segment definition statement: SEGMENT ... ENDS, assume, ORG

Segmnet_name???? SEGMENT???? [Align_type] [Combine_type] [Use_type] [Class]

...

Segment_name???? ENDS???? Segment and ends are used in pairs, dividing the assembly statements into segments

For data segments, additional segments, and stack segments, it is common to store cell definitions, initialize data, allocate units, and so on pseudo-directives.

For code snippets, it is primarily instruction sequences and pseudo-directives.

Optional Description: More information?

Anchor type Align_type: Describes how the beginning address of a segment has a boundary value.

???????? PARA???? Default item.?? The starting address of the specified segment must start at the beginning of the small segment, that is, a minimum bit of 0 when the address is 16 in.

???????? BYTE????? can start at any address.

???????? Word???? Must start at the boundary of the word, that is, the segment address must be an even number.

???????? DWORD?? You must start with the boundary of the double word, that is, the lowest bit must be a multiple of 4 when the address is represented as 16.

???????? PAGE????? You must start at the boundary of the page, which means that the minimum two bits must be 00 when the address is 16 o'clock. (Can be divisible by 256)

Combination Type Combine_type: Describes the segment merge method for program connections.

???????? PRIVATE???? Default entry. For private segments, the connection is not merged with the same name in other modules.

???????? Public??????? Merge with other segments of the same name.

???????? COMMON?? Merges with other segments of the same name and produces overrides.

???????? MEMORY??? Same as public.

???????? STACK???????? Specifies that the segment is part of the stack at run time.

Use type Use_type: Only 386 and subsequent models are used to indicate whether the USE16 (16-bit addressing) or USE32 (32-bit addressing) is available.

Class class: The type name that is used to form the segment group when the connection is made in quotation marks.

Assume enables the assembler to know the value of each segment register when assembling instructions.

Assuem???? Segment_registername:segment_name, Segment_registername:segment_name ...

Any instructions for access to the storage memory or stack will use the values of CS, DS, ES, and SS segment registers to form a true physical address.

Assume only specifies that a segment is assigned to a register, and the segment address cannot be loaded into the segment register.

Therefore, the values of DS, ES, SS segment registers must be given by the MOV instruction, and the CS segment registers are automatically completed when the program is initialized.

To set the starting offset address for the storage unit, you can use the Org pseudo-directive.

ORG???? Expression???? The value range of an expression must be 0 to +65535

The pseudo-directive org can be set anywhere in the code snippet, data segment.

MyData???? SEGMENT???????????? Segment definition, segment named MyData

ORG????? 100H????????????????????? The starting offset address for the MyData segment is 100H

? X???? Db???? 12H,? , 30H????? Data definition, X offset address 0100H, x+1=0101h, x+2=0102h

???? Z???? Dd???? 9c56h??????????????? The offset address of Z is 0103H

MyData???? ENDS

Mycode???? SEGMENT

???? Assume???? Cs:mycode,?? Ds:mydata???? Allocating segment registers with assume pseudo-directives

???? Start:????? MOV AX, MyData?? Equivalent to MOV AX, SEG x statement, loading the starting address of the MyData segment into the DS

?????????????????? MOV DS, AX

???? ...

Mycode???? ENDS

???? END????? Start?????? End of source program ending instruction, where start is lable

Six. Procedure definition statement: PROC ... Endp

Procedure_name???? PROC???? [near | Far]?? To describe a near or far process.

...

Ret???????? The RET return instruction must be associated with the [near??|?? FAR] Correspondence

Procedure_name???? ENDP???????? PROC and ENDP must have names, both of which appear in pairs.

Seven. Macro Directive statement: Macros ... Endm

Macro_name???? MACRO???? [Parameter_list]???? Parameter Parameter_list Optional, when there are multiple parameters, the middle is separated by commas.

...

Endm

MULTIPLY???? MACRO???? OPR1, OPR2, RESULT???? Macro definition, Macro name multiply, parameter opr1,opr2 and result

???????? PUSH???? Dx

???????? PUSH???? Ax

???????? MOV???? AX, OPR1

???????? Imul???? OPR2

???????? MOV???? RESULT, AX

???????? POP???? Ax

???????? POP???? Dx

Endm

MULTIPLY???? , BX, SAVE???? Macro call, argument is a, BX, SAVE

The difference between a macro directive and a subroutine:

The subroutine produces less target code, consumes less memory, but executes for a long time and is slow.

The macro command produces a long target code, consumes more memory, but takes a short execution time and is faster.

Eight. Program start and closing sentences: NAME | TITLE, END

Module Name: Name???? Moudle_name

Title Name: Title???? Text

SOURCE program End command: End???? [Lable]

??

From

8086 compilation pseudo-instruction summary

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.