Category : Files from Magazines
Archive   : DDJ8705.ZIP
Filename : DUNCLST.LST

 
Output of file : DUNCLST.LST contained in archive : DDJ8705.ZIP
þ2« &&&&&
Listing 1
;
; GETDIR.ASM --- set environment variable DIR = current directory path
;
; Copyright (C) 1986 Daniel Briggs
;
; This program illustrates a means of providing string functions
; to batch files. In this case, the program will set the value of
; the environment variable DIR to be the current default directory.
; This value can then be referenced later in a batch file by
; using the phrase %DIR%. The undocumented hook into the current
; copy of the command processor, int 2eh is used to do the set.
;
; To assemble, link, and convert to an executable COM file:
;
; MASM GETDIR;
; LINK GETDIR;
; EXE2BIN GETDIR.EXE GETDIR.COM
;

stk_size equ 1000h ;a good healthy stack

cseg segment para public 'CODE'
assume cs:cseg, ds:cseg, ss:cseg, es:cseg

org 2ch
env_ptr label near ;points to local environment

org 100h ;skip to the end of the PSP
DOS_entry label far
jmp set_str

parameter db 0, 'set ' ;start of command to be passed
var_name db 'DIR=' ;counted string name
var_value db 80 dup (?) ;buffer for variable value

iSP dw offset end_code + stk_size

set_str proc near
cld ;addressing already set by loader
mov sp, iSP ;set stack pointer

mov si, offset var_value
call get_value ;fill value with desired string

mov al, 0
mov cx, -1
mov di, offset parameter+1
repne scasb ; find the null
dec di ; point to it
mov byte ptr ds:[di], 0dh ; ascii CR
not cx ; create count byte
mov parameter, cl

mov bx, iSP ;top of program
mov cl, 4
sar bx, cl
inc bx
mov ah, 4ah ;es already set appropriately
int 21h ;shrink down to memory needed

mov si, offset parameter
int 2eh ;invoke the command processor

push cs ;reset stack
pop ss
mov sp, iSP ;put the stack pointer back

;
; Can you find a means of getting a status back from this technique?
;
mov ah, 4dh
int 21h ;get the returned status <**wrong**>

mov ah, 4ch ;terminate w/status
int 21h
set_str endp

comment /
This is the routine that actually sets the value of the
string. In this example, it sets the buffer pointed to
by DS:SI to the current pathname. What ever string is set
must be terminated by a null. The procedure
assumes that the buffer starts initialized to 0s, so does
not add the final null.
/

get_value proc near
mov byte ptr ds:[si], '\' ;not provided by DOS
inc si
mov ah, 47h
mov dl, 0
mov di, si
int 21h ; get current directory
ret
get_value endp

end_code label near

cseg ends

end DOS_entry
 mov byte ptr ds:[si], '\' ;not provided by DOS
inc si
mov ah, 47h
€w:øÿ€zT`€Æz&.œ€Word RescueQ @6ÿýØ€ €ÿÿ‹ÿÿÿÿÔÿÿÖÿÿùÿÿûÿÿ=ÿÿÿÿÆÿÿÿÿGÿÿˆÿÿŠÿÿÆÿÿÉÿÿÞÿÿóÿÿ!ÿÿ#ÿÿ€ #$ÿÿbÿÿcÿÿŽÿÿÈÿÿÉÿÿåÿÿ*ÿÿ+ÿÿoÿÿ‹ÿÿ«ÿÿ¬ÿÿóÿÿ0ÿÿsÿÿtÿÿ§ÿÿ¨ÿÿÅÿÿ€ ÅÿÿJÿÿKÿÿxÿÿÀÿÿÁÿÿßÿÿþÿÿ-ÿÿmÿÿ«ÿÿæÿÿ*ÿÿPÿÿQÿÿ‰ÿÿ§ÿÿÆÿÿáÿÿ 'ÿÿ€  ' mÿÿ ~ÿÿ «ÿÿ ñÿÿ òÿÿ
'ÿÿ
Bÿÿ
†ÿÿ
‡ÿÿ
‰ÿÿ
Îÿÿ
Ðÿÿ
ðÿÿ >ÿÿ ?ÿÿ {ÿÿ —ÿÿ ¬ÿÿ ­ÿÿ ¿ÿÿ€  ¿ ÿÿ Pÿÿ œÿÿ Ùÿÿ
#ÿÿ
Kÿÿ
]ÿÿ
^ÿÿ
{ÿÿ
Àÿÿ
Ûÿÿ
ûÿÿÿÿ8ÿÿ€ÿÿ”ÿÿ©ÿÿªÿÿÇÿÿÈÿÿ€ ÈÝÿÿÞÿÿÿÿÿÿ
#ÿÿ
Kÿÿ
]ÿÿ
^ÿÿ
{ÿÿ
Àÿÿ
Ûÿÿ
ûÿÿÿÿ8ÿÿ€ÿÿ”ÿÿ©ÿÿªÿÿÇÿÿÈÿÿ€ 

  3 Responses to “Category : Files from Magazines
Archive   : DDJ8705.ZIP
Filename : DUNCLST.LST

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/