Some assembly instructions (based on 8086)

Source: Internet
Author: User

Look back to the next assembly, a brief summary of some of the memo, most of the content in the "Wang Shuang assembly language second Edition" has more detailed introduction, the proposed download, compared to some professors transcription published content, Mr. Wang Shuang's article is more than excellent hundred

mov

(1) Data sending register;

(2) Register to send registers;

(3) The deposit of the internal storage element;

Attention:

1. Memory cannot be sent to memory

2. Memory can not send segment register;

Cases:

Send data from Al to internal deposit cell 10003H

Analysis: The default data register is DS, so as long as we set the DS value, make ds*16+[data index] = 10003.

Program:

MOV bx,1000h

MOV ds,bx

mov [3],al

Another answer:

MOV BX,FFFH

MOV ds,bx

mov [13],al

Push (into the stack)

POP (out of the stack)

Push AX: The data in the register ax is fed into the stack;

Pop ax: Pulls data from the top of the stack into ax.

8086CPU into the stack and the stack operation is in Word units

JMP Short Label

(IP) = (IP) + 8-bit displacement.

JMP near PTR label

It achieves a near-shift within a paragraph.

The function of the instruction "jmp near PTR designator" is:

(IP) = (IP) + 16-bit displacement.

JMP far PTR designator

The realization of the transition between segments, also known as the far transfer

(IP) = (IP) + 32-bit displacement.

MOV ax,0123h

MOV Ds:[0],ax

JMP word ptr ds:[0]

After execution, (IP) =0123h

MOV ax,0123h

mov [Bx],ax

JMP word ptr [bx]

After execution, (IP) =0123h

RET and RETF

Ret

Take the data pop from the stack to the IP in the following:

(IP) = ((ss) *16+ (SP))

(sp) = (sp) +2

The value of the SP pointer in the stack is placed in the IP, and the stack pointer moves to the bottom of the stack by two bytes (the stack is allocated from the high to the position, so take out a data to increase by 2)

RETF: (Return FAR)

(IP) = ((ss) *16+ (SP))

(sp) = (sp) +2

(CS) = ((ss) *16+ (SP))

(sp) = (sp) +2

Call instruction (used in conjunction with RET)

Call label (after the current IP stack, go to the label to execute the instructions)

When the CPU executes the call instruction in this format, the following actions are performed:

(sp) = (sp) –2

((ss) *16+ (sp)) = (IP)

(IP) = (IP) + 16-bit displacement

16-bit displacement = The address of the first byte after the address-call instruction at the "label";

The range of 16-bit displacement is -32768~32767, which is indicated by complement;

16-bit displacement is calculated by the compiler at compile time

Call is equivalent to:

Push IP

JMP near PTR label

Call far PTR designator:

(1) (sp) = (sp) –2

((ss) x16+ (sp)) = (CS)

(sp) = (sp) –2

((ss) x16+ (sp)) = (IP)

(2) (CS) = segment address where the label is located

(IP) = offset address where the label is located

Equivalent to:

Push CS

Push IP

JMP far PTR designator

Some assembly instructions (based on 8086)

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.