Why are we storing SECONDRELOCATION value in AX and then why are we pushing AX in stack?
I am going through basic understanding of MSDOS programming. I am unable to understand how and why control is being transferred between three OFFSETS (at line4, line43, and line53). These lines are explicitly indicated by me as comments.
CLI
MOV AX,CS
MOV SS,AX
MOV SP,OFFSET LOCSTACK ;line4
ASSUME SS:SYSINITSEG
IF NOT ALTVECT
STI ; Leave INTs disabled
;for ALTVECT
ENDIF
LOCSTACK LABEL BYTE
CALL MSDOS
MOV WORD PTR [DOSINFO+2],ES ; SAVE POINTER TO DOS
;INFO
MOV WORD PTR [DOSINFO],DI
IF NOT IBM
IF NOT IBMJAPVER
CALL RE_INIT ; Re-call the BIOS
ENDIF
ENDIF
STI
CLD
IF HIGHMEM
PUSH DS
MOV BX,DS
ADD BX,10H
MOV ES,BX
PUSH CS
POP DS
XOR SI,SI
MOV DI,SI
MOV CX,OFFSET SYSSIZE + 1
SHR CX,1 ; Divide by 2 to get
;words
REP MOVSW
POP DS
PUSH ES
MOV AX,OFFSET SECONDRELOC ;line43 (why we are storing offset value
;of SECONDRELOC in AX, if we are moving
;there already ofter RE_INIT PROC one more
;point is that why we are PUSHing AX value
;in stack)
PUSH AX ;<-------
RE_INIT PROC FAR
....some code here.....
RET
RE_INIT ENDP
SECONDRELOC:
MOV AX,CS
CLI
MOV SS,AX
MOV SP,OFFSET LOCSTACK ;line53
STI