Category : C Source Code
Archive   : CEXPRESS.ZIP
Filename : GETVOLUM.ASM

 
Output of file : GETVOLUM.ASM contained in archive : CEXPRESS.ZIP
;void get_volume(spec,work_area,return_string);
; unsigned short spec;
; char *work_area,*return_string;

EXTRN _memory_model:byte

_TEXT SEGMENT BYTE PUBLIC 'CODE'
ASSUME CS:_TEXT
PUBLIC _get_volume
_get_volume proc near
push bp ;
mov bp,sp ;
push di ;
push si ;
cmp _memory_model,0 ;near or far?
jle begin ;jump if near
inc bp ;else add 2 to BP
inc bp ;
begin: push ds ;
mov ah,2fh ;save current DTA
int 21h ;
push es ;
push bx ;
cld ;set direction flag
mov al,[bp+4] ;get drive specifier
push ax ;save for later
cmp _memory_model,2 ;data near or far?
jb L0 ;jump if near
lds dx,dword ptr[bp+6] ;DS:DX pts to WorkArea
les di,dword ptr[bp+10] ;point to return string
jmp short L00 ;
L0: mov dx,[bp+6] ;NEAR case
mov ax,ds ;ES = DS
mov es,ax ;
mov di,[bp+8] ;
L00: mov ah,1ah ;function to set DTA
int 21H ;set DTA
mov si,dx ;point SI to DTA
pop ax ;get back drive spec
or al,al ;0 = current drive
jnz L1 ;jump if not current
mov ah,19H ;DOS func to get drv num
int 21H ;get current drive
inc al ;count drives from 1
L1: add al,64 ;convert to A:, B: etc.
mov [si],al ;write it
inc si ;forward ptr
mov al,':' ;color to follow drv spec
mov [si],al ;write it
inc si ;forward ptr
mov al,'*' ;global character
mov [si],al ;write it
inc si ;forward ptr
mov al,'.' ;global character
mov [si],al ;write it
inc si ;forward ptr
mov al,'*' ;global character
mov [si],al ;write it
inc si ;forward ptr
mov al,0 ;terminate with 0
mov [si],al ;write it
mov cx,8 ;attribute for vol label
mov ah,4eh ;function to seek file
int 21H ;seek vol label
jnc L2 ;jump if found
mov byte ptr es:[di],0 ;set null string
jmp L5 ;go quit
L2: mov si,dx ;SI to start of WorkArea
add si,30 ;offset to vol label
L3: lodsb ;get a byte
or al,al ;test for terminating 0
jz L4 ;jump when finished
cmp al,'.' ;period?
je L3 ;skip it if so
stosb ;transfer char
jmp short L3 ;go get next
L4: mov byte ptr es:[di],0 ;set string terminator
L5: pop dx ;restore prior DTA
pop ds ;
mov ah,1ah ;
int 21h ;
pop ds ;
pop si ;
pop di ;
pop bp ;
cmp _memory_model,0 ;quit
jle quit ;
db 0CBh ;RET far
quit: ret ;RET near
_get_volume endp
_TEXT ENDS
END


  3 Responses to “Category : C Source Code
Archive   : CEXPRESS.ZIP
Filename : GETVOLUM.ASM

  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/