Assembly Source series of Basload

Source: Internet
Author: User
Tags command line

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.

; Basload. ASM 07/09/84-dkeels
;----------------------------------------------------------------------------
; This program provides BASIC programs with access to the program loader (LOAD)
By passing parameters via the system parameter area (SYSPARM).
;
; Inputs:
; The FILE SPEC 1-a string (len <=) with the complete name, including
; Path, the file to is loaded and executed.
; Example: ' MAINMENU. EXE ' or ' C:format. COM '
; PARAMETER 1-a string (len <=) with the command line parameters
; To is passed to the program specified in FILE SPEC 1.
; Example: ' or ' A: '
; FILE SPEC 2-same as 1.
; PARAMETER 2-same as 1.
;
; Outputs:
; This program is gives control to LOAD.
;----------------------------------------------------------------------------
Code SEGMENT ' Code '
Assume Cs:code
Public basload make known to BASIC at link time
Basload PROC FAR
;p Rologue
PUSH BP; Save BP
MOV BP,SP set base for Parm list
PUSH DS;D s-> basic work area
PUSH es; es-> basic Work area
MOV DX, ' DK '; interrupt verification switch
INT 77H/SEG Address of sysparm area in AX
MOV es,ax ES-> sysparm Area
CLD; set direction for all moves
; move file spec. 1 to Sysparm
MOV bx,ss:[bp+12]; get addr of String descriptor
MOV CX,DS:[BX]; get length of string into CX
MOV si,ds:[bx+2]; get addr's string into SI
MOV di,0; offset into sysparm
REP MOVSB; Move string
MOV BYTE PTR es:[di],0 make it Asciiz string
; move parameter 1 to Sysparm
MOV bx,ss:[bp+10]; get addr of String descriptor
MOV CX,DS:[BX]; get length of string into CX
MOV si,ds:[bx+2]; get addr's string into SI
MOV di,81; offset into sysparm
INC CL Adjust for CR to is added at end
MOV byte PTR es:[di],cl 1st byte is length of string
DEC CL; re-adjust for move operation
INC DI
REP MOVSB; Move string
MOV BYTE PTR es:[di],13 add CR to end
; move file spec. 2 to Sysparm
MOV bx,ss:[bp+8]; get addr of String descriptor
MOV CX,DS:[BX]; get length of string into CX
MOV si,ds:[bx+2]; get addr's string into SI
MOV di,163; offset into sysparm
REP MOVSB; Move string
MOV BYTE PTR es:[di],0 make it Asciiz string
; move parameter 2 to Sysparm
MOV bx,ss:[bp+6]; get addr of String descriptor
MOV CX,DS:[BX]; get length of string into CX
MOV si,ds:[bx+2]; get addr's string into SI
MOV di,244; offset into sysparm
INC CL Adjust for CR to is added at end
MOV byte PTR es:[di],cl 1st byte is length of string
DEC CL; re-adjust for move operation
INC DI
REP MOVSB; Move string
MOV BYTE PTR es:[di],13 add CR to end
; Exit to BASIC
POP ES
POP DS
POP BP
RET 8
Basload ENDP
CODE ENDS
End Basload

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.