Category : BASIC Source Code
Archive   : QBFAQR01.ZIP
Filename : CURDIR.BAS

 
Output of file : CURDIR.BAS contained in archive : QBFAQR01.ZIP
'Date: 05-27-92 (01:13)
'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


  3 Responses to “Category : BASIC Source Code
Archive   : QBFAQR01.ZIP
Filename : CURDIR.BAS

  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/