BX, si, Di, bp
1, in 8086CPU, only these 4 registers (BX, BP, Si, di) can be used in the "[...]" to address the memory unit.
2. In "[...]", these 4 registers (BX, BP, Si, di) can appear either individually or only in four combinations:
bx and Si, bx and di, BP and Si, BP and di
1 the correct instructions:2 movAX,[BX]3 movAx,[si]4 movAx,[di]5 movAX,[BP]6 movAx,[bx+si]7 movAx,[bx+di]8 movAx,[bp+si]9 movAx,[bp+di]Ten movAx,[bx+si+idata] One movAx,[bx+di+idata] A movAx,[bp+si+idata] - movAx,[bp+di+idata] - the Wrong instruction: - movAX,[BX+BP] - movAX,[SI+DI]
3, as long as in the [...] The register is used in BP, and the instruction does not explicitly give the segment address, the segment address is the default in SS .
The representation of data position in assembly language
Assembly language uses three concepts to express the location of the data.
1, immediate number (idata)
2. Register
3. Segment Address (SA) and offset address (EA)
Thus generating a bit of addressing mode
Addressing method * * *
How long will the data be processed by the instruction? * *
There are several main ways:
(1) Specify the size of the data to be processed by the register name.
In the following instruction, the register indicates that the instruction is a word operation :
1 mov ax,12mov bx,ds:[0]3mov Ds,ax4movds:[0],ax5Inc Ax6add ax,
In the following instruction, the register indicates that the instruction is a byte operation :
1 mov al,12mov al,bl3mov al,ds:[0 ]4movds:[0],al5Inc Al 6 add al,
(2) If no register name exists, use the operator x ptr to indicate the length of the memory unit, X can be word or byte in the assembly instruction.
In the following instruction, word PTR indicates that the memory unit accessed by the instruction is a word unit :
1 mov ds: [0],12inc word ptr [bx]3IncDS:[0 ]4add word ptr [bx],2
In the following instruction, the memory unit that the instruction accesses is indicated by a byte ptr as a byte unit:
1 mov ds: [0],12inc byte ptr [bx]3IncDS:[0 ]4add byte ptr [bx],2
(3) Other ways
Some directives default to whether a word cell or a byte cell is accessed.
For example: Push [1000H] does not indicate whether the access is a word unit or a byte cell,
Because the push instruction only carries out word manipulation . (sp=sp-2per operation)
div instruction
Div is the division instruction, when using DIV for division:
Divisor: 8-bit or 16-bit, in register or memory unit
Divisor: (default) in Ax (16-bit) or DX and ax (32-bit)
Result: Operation 8-bit 16-bit
Business AL AX
Remainder AH DX
div instruction Format:
DIV Reg
div Memory Unit
1 Divbyte ptrds:[0];(AX) divided by (DS) *16+0 Memory Unit byte-type data2 3(AL) = (AX)/((DS) * -+0) of the business;4(AH) = (AX)/((DS) * -+0) The remainder5 6 7 DivWord ptres:[0];(AX) *10000h+ (DX) value divided by (ES) *16+0 memory Unit font Data8 9(AX) =[(DX) *10000h+ (AX)]/((DS) * -+0) of the business;Ten(DX) =[(DX) *10000h+ (AX)]/((DS) * -+0) The remainder One A - Divbyte ptr [bx+si+8] - the(AL) = (AX)/((DS) * -+ (BX) + (SI) +8) of the business; -(AH) = (AX)/((DS) * -+ (BX) + (SI) +8) The remainder - - + DivWord ptr [bx+si+8] - +(AX) =[(DX) *10000h+ (AX)]/((DS) * -+ (BX) + (SI) +8) of the business; A(DX) =[(DX) *10000h+ (AX)]/((DS) * -+ (BX) + (SI) +8) the remainder
Pseudo-directive DD
Example: Data segment
DB 1
DW 1
DD 1
Data ends
There are three data defined in this section:
The first data is 01H, at data:0, accounting for 1 bytes;
The second data is 0001H, at Data:1 Place, accounting for 1 words;
The third data is 00000001H, at the Data:3 Place, accounting for 2 words;
1 Questions:2 A div calculates the result of dividing the first piece of data in a data segment by the second, and the quotient is stored in the storage unit of the 3rd data. 3 Data Segment4Dd100001 ;2 characters, 4 memory units, 32-bit 0-35Dw - ;1 characters, 2 memory units, 16-bit 4-56Dw0 ;1 characters, 2 memory units, 16-bit 6-77 Data Ends8 9 Analysis:TenThe first data segment is the divisor, which is a DWORD (double word) type, 32 bits, so it is stored with DX and AX before doing division.the data should be:The low 16 bits in the 0-word cell are stored in Microsoft Dynamics AX,Data:The high 16 bits in the 2-word unit are stored in the DX. One A Program code: - movAx,data - movDs,ax the movAxds:[0];the low 16 bits in the ds:0 word cell are stored in Microsoft Dynamics AX - movDxds:[2];The high 16 bits in the Ds:2 character cell are stored in DX - DivWord ptrds:[4];Divide the 32-bit data in Dx:ax by the ds:4 word - ;the data in the cell + mov ds:[6],ax;Store the quotient in a ds:6 word cell
Assembly language--two basic questions about data processing (how long does it take to process the data?)