This is the past DOS era of the compilation of source code, although has passed, but for the study of the assembly is still helpful, assembly language is just a basic programmer language, most people can grasp, not necessarily in-depth research.
; Cobload. ASM 07/09/84-dkeels
;----------------------------------------------------------------------------
; This program provides COBOL programs with access to the program loader (LOAD)
By passing parameters via the system parameter area (SYSPARM).
;
; Inputs:
; cobload-parms
; File-spec-1 PIC X (80). Contains complete drive, path and filename.
; PARAMETER-1 PIC X (80). Contains command line parameters.
; File-spec-2 PIC X (80). Same as 1.
; PARAMETER-2 PIC X (80). Same as 1.
;
; Outputs:
; None.
;----------------------------------------------------------------------------
cl_code_seg SEGMENT Public ' CODE '
Assume Cs:cl_code_seg,ds:cl_code_seg,es:cl_code_seg
Stack_parm Struc
Pushed_si DW?
Pushed_di DW?
Pushed_ds DW?
Pushed_es DW?
PUSHED_BP DW?
Return_ip DW?
Return_cs DW?
Parm1_offset DW?
Parm1_ds DW?
Stack_parm ENDS
Public cobload make known to COBOL in link time
Cobload PROC FAR
;p Rologue
PUSH BP
PUSH ES
PUSH DS
PUSH DI
PUSH SI
MOV BP,SP set base for stack parm structure
; address caller ' s parameter block
MOV AX,[BP]. Parm1_ds
MOV Ds,ax;D s-> COBOL data seg
MOV SI,[BP]. Parm1_offset SI-> OFFSET to parm block
; address load ' s parameter blocks in Sysparm
MOV DX, ' DK '; verification switch
INT 77H; get seg addr in AX
MOV Es,ax ES-> sysparm
MOV di,0;D i-> offset to LOAD parms
; move COBOL ' s parm blocks to load ' s parm blocks (in Sysparm)
CLD; set direction for moves
MOV cx,80 Length of Move
REP MOVSB Move file spec. 1
Asciiz1:mov BYTE PTR es:[di],0; make Asciiz string
DEC DI
MOV al,byte PTR Es:[di]
CMP AL, '; nullify trailing spaces
JE ASCIIZ1
MOV bx,81;p oint to Parm length byte
MOV BYTE PTR es:[bx],82 init length of parm, + 2
MOV di,82;p oint to 1st parm position
MOV cx,80 Length of Move
REP MOVSB Move Parm
Add_cr_1:mov BYTE PTR es:[di],13; add carriage return
DEC BYTE PTR ES:[BX]; Sub 1 from length of parm
DEC DI
MOV al,byte PTR Es:[di]
CMP AL, ';p ut cr in trailing spaces
JE add_cr_1
MOV di,163
MOV cx,80 Length of Move
REP MOVSB Move file spec. 2
Asciiz2:mov BYTE PTR es:[di],0; make Asciiz string
DEC DI
MOV al,byte PTR Es:[di]
CMP AL, '; nullify trailing spaces
JE ASCIIZ2
MOV bx,244;p oint to Parm length byte
MOV BYTE PTR es:[bx],82 init length of parm, + 2
MOV di,245;p oint to 1st parm position
MOV cx,80 Length of Move
REP MOVSB Move Parm
Add_cr_2:mov BYTE PTR es:[di],13; add carriage return
DEC BYTE PTR ES:[BX]; Sub 1 from length of parm
DEC DI
MOV al,byte PTR Es:[di]
CMP AL, ';p ut cr in trailing spaces
JE add_cr_2
; return to caller
POP SI
POP DI
POP DS
POP ES
POP BP
RET 4
Cobload ENDP
Cl_code_seg ENDS
End