home *** CD-ROM | disk | FTP | other *** search
- TITLE EPATH 4-7-87 [9-5-88]
- ;from SIMTEL20's pd:<msdos.sysutl>EPATH.ARC
- ;- disassembled via ASMGEN
- ;- slightly tweaked.
- ;David Kirschbaum
- ;Toad Hall
- ;kirsch@braggvax.ARPA
-
- LF EQU 0AH
- CR EQU 0DH
- ;
- CSeg SEGMENT
- ASSUME DS:CSeg, SS:CSeg ,CS:CSeg ,ES:CSeg
-
- ;Define some labels in our PSP
- org 2CH
- envseg label word ;PSP environment strings pointer
- org 80H
- pspcmd label byte ;PSP cmd buffer
-
- ORG 100H
-
- Epath: MOV BX,0368H ;new stack pointer
- MOV SP,BX
- ADD BX,0FH ;donno why he's doing all this
- MOV CL,4
- SHR BX,CL ;convert required memory to paras
- MOV AH,4AH ;modify allocated memory block
- INT 21H
-
- ; MOV AL,DS:80H ;snarf PSP cmd length byte
- mov al,pspcmd ;snarf PSP cmd length byte
- OR AL,AL ;anything there?
- JNZ Move_Path_173 ;yep, go move into our buffer, finish
-
- PUSH ES
- ; MOV ES,DS:2CH ;PSP Environment strings pointer
- mov ES,envseg ;PSP environment strings pointer
- SUB DI,DI ;0 offset in environment strings
- xor ax,ax ;get a handy 0 v1.1
- mov dx,5 ;handy constant v1.1
- Lp11E: MOV SI,OFFSET pathbuff ;seek for a 'PATH='
- CLD ;insure fwd
- ; CMP BYTE PTR ES:[DI],0
- cmp ES:[di],al ;end of environment strings?
- JZ Show_Path_14D ;yep, we're done
- MOV CX,dx ;5 ;5 chars in 'PATH='
- REPZ CMPSB ;found it?
- JZ Skp138 ;yep
- ; SUB AL,AL
- MOV CX,80H ;skip over another 80H chars
- REPNZ SCASB ;(bumping DI, I guess)
- JMP SHORT Lp11E ;and try again
-
- Skp138: MOV BX,OFFSET pathbuffend
- MOV CX,dx ;5 ;assume 'PATH=' 5 chars
- Lup13E: MOV AL,ES:[DI] ;snarf environment string char
- INC DI ;bump ptr
- OR AL,AL ;terminating 0?
- JZ Show_Path_14D ;yep, done
- INC CL ;bump path length
- MOV [BX],AL ;stuff char in our local buffer
- INC BX ;bump local buffer ptr
- JMP SHORT Lup13E
-
- ;L014D L0126 CJ L0144 CJ
- Show_Path_14D:
- MOV pathlen_188,CL ;save path length
- MOV WORD PTR [BX],0A0DH ;terminate with CR/LF
- INC BX ;bump past the CR/LF
- INC BX
- MOV BYTE PTR [BX],'$' ;terminate DOS string
- POP ES
- MOV DX,OFFSET pathbuff ;'PATH=', whatever
- MOV AH,9 ;display str
- INT 21H
- MOV DX,OFFSET kbdbuf_187 ;kbd buffer
- MOV AH,0AH ;buffered kbd input
- INT 21H ;(permit user to edit path)
- ;L0169 L0185 CJ
- Endit_169:
- MOV SI,OFFSET pathlen_188 ;DS:SI = vector to length byte
- ; preceding new path
- INT 2EH ;??? unknown int .. change path?
- MOV AX,4C00H ;terminate process
- INT 21H
-
- ;L0173 L0115 CJ
- Move_Path_173:
- MOV CL,AL ;path bytes to move
- ADD pathlen_188,AL
- ; MOV SI,81H ;from PSP cmd buffer
- mov si,offset pspcmd+1 ;from PSP cmd buffer
- MOV DI,OFFSET pathbuffend ;to our path buffer
- REPZ MOVSB ;append path to 'PATH='
- MOV BYTE PTR ES:[DI],CR ;terminate w/CR
- JMP SHORT Endit_169 ;and terminate
-
- kbdbuf_187 DB 50H ;up to 50 chars in a path
- pathlen_188 DB 5 ;existing or new path
- pathbuff DB 'PATH=' ;constant
- pathbuffend DB CR,'$'
-
- CSeg ENDS
- END Epath