Assembly Source series of Cobload

Source: Internet
Author: User
Tags command line contains

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

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.