Call Real Mode Procedure With Far Return Frame [0.9]

Simulates a FAR CALL to a real mode procedure. The called procedure must return by executing a RETF (far return) instruction.

Call With

AX = 0301H
BH = flags

BitSignificance
0reserved for historical reason, must be zero
1-7reserved, must be zero
CX = number of words to copy from protected mode to real mode stack
ES:(E)DI = selector:offset of real mode register data structure in the following format:
OffsetLengthContents
00H4DI or EDI
04H4SI or ESI
08H4BP or EBP
0CH4reserved, ignored
10H4BX or EBX
14H4DX or EDX
18H4CX or ECX
1CH4AX or EAX
20H2CPU status flags
22H2ES
24H2DS
26H2FS
28H2GS
2AH2IP
2CH2CS
2EH2SP
30H2SS
Returns

if function successful
Carry flag = clear
ES:(E)DI = selector:offset of modified real mode register data structure

if function unsuccessful
Carry flag = set
AX = error code
8012Hlinear memory unavailable (stack)
8013Hphysical memory unavailable (stack)
8014Hbacking store unavailable (stack)
8021Hinvalid value (CX too large)

Notes