Category : BASIC Source Code
Archive   : QBFAQR01.ZIP
Filename : CURDIR.BAS
'From: JOE NEGRON
'------------------------------------------------------------------------
DEFINT A-Z
'$INCLUDE: 'QB.BI'
DECLARE FUNCTION GetDir$ (Drive$)
DECLARE FUNCTION GetDrv$ ()
CurDrv$ = GetDrv$
CurDir$ = GetDir$("")
PRINT "Current drive is " + CurDrv$
PRINT "Current directory is " + CurDir$
END
'***********************************************************************
'* FUNCTION GetDir$
'*
'* PURPOSE
'* Uses DOS ISR 21H, Function 47H (Get Current Directory) to retrieve
'* the current directory for the specified drive. Drive$ may be null
'* to indicate the default drive.
'*
'* PARAMETER(S)
'* Drive$
'***********************************************************************
FUNCTION GetDir$ (Drive$) STATIC
DIM Temp AS STRING * 64
InRegsX.ax = &H4700
'must convert drive to integer
'current = 0, A: = 1, B: = 2, C: = 3, etc.
IF Drive$ > "" THEN
InRegsX.dx = ASC(UCASE$(Drive$)) - 64
ELSE
InRegsX.dx = 0
END IF
InRegsX.ds = VARSEG(Temp$)
InRegsX.si = VARPTR(Temp$)
InterruptX &H21, InRegsX, OutRegsX
GetDir$ = "\" + LEFT$(Temp$, INSTR(Temp$, CHR$(0)) - 1)
END FUNCTION
'***********************************************************************
'* FUNCTION GetDrv$
'*
'* PURPOSE
'* Uses DOS ISR 21H, Function 19H (Get Current Disk) to return the
'* currently logged disk drive.
'***********************************************************************
FUNCTION GetDrv$ STATIC
InRegs.ax = &H1900
Interrupt &H21, InRegs, OutRegs
GetDrv$ = CHR$((OutRegs.ax AND &HFF) + 65) + ":"
END FUNCTION
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
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/