Experiment 5
Experiment 5
Experiment: - 5
Name: Sarvesh Patil Roll No. : A173
Sap ID: 70022200488
Date of Performance: Date of Submission:
Operation of FAR CALL: When 8086 executes a far call, it decrements the stack pointer by 2 and
copies the contents of CS register to the stack. It the decrements the stack pointer by 2 again and
copies the content of IP register to the stack. Finally, it loads cs register with base address of segment
having procedure and IP with address of first instruction in procedure.
SP <- SP-2
CS contents -> stored on stack
SP <- SP-2
IP contents -> stored on stack
CS <- Base address of segment having procedure
IP <- address of first instruction in procedure.
RET instruction : The RET instruction will return execution from a procedure to the next instruction
after call in the main program. At the end of every procedure RET instruction must be executed.
Operation for Near Procedure : For NEAR procedure ,the return is done by replacing the IP register
with a address popped off from stack and then SP will be incremented by 2.
IP <- Address from top of stack
SP <- SP+2
Operation for FAR procedure : IP register is replaced by address popped off from top of stack,then SP
will be incremented by 2.The CS register is replaced with a address popped off from top of stack.
Again SP will be incremented by 2.
IP <-Address from top of stack
SP <-SP+2
CS <-Address from top of stack
SP <-SP+2
Disadvantages :
1) CALL and RET instructions are always required to integrate with procedures.
2) Requires the extra time to link procedure and return from it.
STME, NMIMS Navi Mumbai Campus
Computer Engineering Class: - B Tech (CE) Sem IV
Subject: - Microprocessor and Academic Year: - 2023-24
Microcontroller
3) For small group of instructions, linking and returning back time more than the execution time,
hence for small group of instructions procedures cannot be preferred.
STME, NMIMS Navi Mumbai Campus
Computer Engineering Class: - B Tech (CE) Sem IV
Subject: - Microprocessor and Academic Year: - 2023-24
Microcontroller
STME, NMIMS Navi Mumbai Campus
Computer Engineering Class: - B Tech (CE) Sem IV
Subject: - Microprocessor and Academic Year: - 2023-24
Microcontroller