Assembly Language Learning Notes (10) Call and RET directives work together
Source: Internet
Author: User
1.ret and RETF
RET: The instruction uses the data in the stack, modifies the IP content, thus realizes the near transfer
When the CPU executes the RET instruction, the following two steps are taken:
1) (IP) = ((ss) *16+ (SP))
2) (SP) = (sp) +2
Equivalent to a pop IP
RETF: Using the data in the stack, modify CS and IP content, so as to achieve far transfer
1) (IP) = ((ss) *16+ (SP))
2) (SP) = (sp) +2
3) (CS) = ((ss) *16+ (SP))
4) (SP) = (sp) +2
Equivalent to pop IP pop CS
Call Label: (just save the current location to the stack compared to JMP)
The operation is as follows:
1) (SP) = (sp)-2
((ss) *16+ (sp)) = (IP)
2) (IP) = (IP) + 16-bit displacement
Call far PTR designator: remote transfer
1) (SP) = (sp)-2
((ss) *16+ (sp)) = (CS)
(sp) = (sp)-2
((ss) *16+ (sp)) = (IP)
2) (CS) = Segment address where the label is located
(IP) = offset address where the label is located
The call directives that transfer addresses in memory have two forms:
Call word PTR memory cell address near transfer
Call DWORD PTR memory Unit address far transfer
Mul instruction: Multiplication instruction
Note: Multiplying by two numbers is either 8-bit or 16-bit
8-bit results: in AX
16-bit results: DX High and AX status
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.