home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 September
/
Simtel20_Sept92.cdr
/
msdos
/
sysutl
/
exec.arc
/
SHELL.ASM
next >
Wrap
Assembly Source File
|
1988-09-12
|
4KB
|
88 lines
; Date: Tue, 16 Aug 88 18:11 PDT
; From: <MULTI%TRIUMFCL.BITNET@CORNELLC.CCS.CORNELL.EDU>
; Subject: Correction to previous version...
;MASM SHELL;
;LINK SHELL;
;EXE2BIN SHELL SHELL.COM;
;
; Modifications:
;
; Who When What
; === ==== ====
; Y.N. Miles 15-Aug-88 Tried to figure out EXEC (SHELL)
; from the IBM tech. ref. manual
; Gave up in disgust, wrote my own
;
; Y.N. Miles 16-Aug-88 Char count in COMAND does not
; include itself or trailing <CR>
; Specify path for COMMAND.COM
; Correct docs for 64K space req.
;
;NOTE: This program is in .COM form because I cannot stand .EXE files
;
code segment
assume cs:code,ds:code,es:code
org 100h
start: mov spsave,sp ; Save SP pointer
mov sssave,ss ; Save SS block
;
mov bx,1000h ; ...surrender 64K of space
mov ah,4ah ; ...with this call
int 21h ; ...for sub-process area
;
mov ax,5Ch ; Get input default FCB
mov fcbin+0,ax ; ...and save offset
mov fcbin+2,es ; ...with segment
;
lea si,cs:81h ; Get input default FCB
lea di,es:5Ch ; ...kosher it
mov ax,2901h ; ...by filling it
int 21h ; ...with blanks
;
mov ax,6Ch ; Get output default FCB
mov fcbot+0,ax ; ...and save offset
mov fcbot+2,es ; ...with segment
;
lea si,cs:81h ; Get output default FCB
lea di,es:6Ch ; ...kosher it
mov ax,2901h ; ...by filling it
int 21h ; ...with blanks
;
mov envir,0 ; No environment segment (so static)
;
mov comand+0,80h ; ...setup command line for copy to
mov comand+2,es ; ...parameter area 80h in PSP
;
lea si,order ; Get order count/ascii_string/<CR>
mov cl,order ; Get bytes in ASCII string
add cl,2 ; ...add two non-string bytes
mov ch,0 ; ...convert byte count to word count
lea di,es:80h ; ...copy into DOS parameter area at 80h
rep movsb ; ...the order = count/ascii_string/CR
;
lea dx,daemon ; DS:BX --> Dos transient null terminated
lea bx,envir ; ES:BX --> Start 7 word parameter block
;
mov ax,4B00h ; Do the DOS exec (shell) request
int 21h ; ...with call
;
mov sp,spsave ; Restore SP
mov ss,sssave ; ...and SS
ret ; RET uses 0 on stack to int 20h in PSP
;
order db 5,"/CDIR",13 ; Counted order for DOS, <CR> end
daemon db "C:\COMMAND.COM",0 ; DOS transient executes order
;
envir dw 0 ; Environment segment (static, not used)
comand dw 0,0 ; Command line dword (points to PSP:80h)
fcbin dw 0,0 ; Input FCB dword (points to FCB:5Ch)
fcbot dw 0,0 ; Outpt FCB dword (points to FCB:6Ch)
;
sssave dw 0 ; Supposed to save stack segment
spsave dw 0 ; and stack pointer so RET calls INT 20h
;
code ends
;
end start