BBS: Inland Empire Archive Date: 02-22-94 (19:39) Number: 390 From: LESTER DODDS Refer#: 91 To: JEFF ROOT Recvd: NO Subj: A New q for u Conf: (2) Quik_Bas
These are two files i found but they need QB 4.5 or DEBUG to use machine code. hope this will help now or later. >chgdrv2.bas '=================================================================== ' Quick Basic Forum ' Date : 25-Apr-91 18:39 ' From : David Ellsworth 'Subject : Setting Default Drive. ' ' DOS Interrupt 21h (33 decimal) Function 0Eh (14) is the ticket. ' Run QB with the /L option. ' Provide a TYPE'd variable to pass data and declare the needed ' subroutine (or use '$INCLUDE: 'QB.BI') for a call to INTERRUPT. '=================================================================== ' Eg. TYPE RegType ax AS INTEGER bx AS INTEGER cx AS INTEGER dx AS INTEGER bp AS INTEGER si AS INTEGER di AS INTEGER flags AS INTEGER END TYPE DECLARE SUB INTERRUPT (Intnum AS INTEGER, InReg AS RegType, OutReg AS RegType) DIM InReg AS RegType, OutReg AS RegType ' When you want to set a new default drive call the interrupt with the proper ' register settings. ' Eg. DriveNumber = 2: 'Set C: InReg.ax = &HE00: 'Call function 0Eh InReg.dx = DriveNumber: 'Zero based (A: = 0 through Z: = 25). INTERRUPT &H21, InReg, OutReg ' As a point of interest the last drive number is returned in the AL register. LastDrive$ = CHR$((OutReg.ax AND 31) + 64) + ":" ' The last drive number in AL is 1 based (1 = A: through 26 = Z:). ' To find the default drive you can use Function 19h. InReg.ax = &H1900; (OutReg.ax and 31) = Current drive; 0 = A: - 25 = Z: ' You can also find the default directory with Function 47h. >end chgdrv2.bas >chdrv.bas $$58 '==================================================================== ' Quick Basic Forum ' Date : 23-Apr-91 ' From : Robert Lee 'Subject : CHDRV IN QB45 ' 'Although PDS 7.X includes the CHDRV command, QB 4.5 does not. The 'easiest way to do a change drive is to call the 0Eh function of the 'DOS services interrupt (21h). To do this, load QB with the QB.QLB 'quick library and include the following routines in your program. 'The FUNCTION GetDrive$ returns the current drive letter, and the 'SUB ChgDrive() sets the current to drive to the calling argument. '==================================================================== '$INCLUDE: 'QB.BI' DECLARE FUNCTION GetDrive$ () DECLARE SUB ChgDrive (drive AS STRING) SUB ChgDrive (drive AS STRING) ' Set the current drive letter DIM REGS AS RegType ' Type declared in QB.BI AH = &HE ' Function number set in AH AL = &H0 ' AL is not set to anything REGS.ax = AH * &H100 + AL ' AH is high 8 bits, AL is low 8 DH = &H0 ' DH is not set to anything DL = ASC(UCASE$(drive)) - 65 ' DL is set to the drive number ' A=0, B=1, C=2, etc. REGS.dx = DH * &H100 + DL CALL INTERRUPT(&H21, REGS, REGS) ' Call the DOS services int AL = REGS.ax MOD &H100 ' Set AL to low 8 bits of AX ' AL returns the max number of ' drives available 25=Z, etc END SUB FUNCTION GetDrive$ ' Get the current drive letter DIM REGS AS RegType ' Type declared in QB.BI AH = &H19 ' Function number AL = &H0 ' AL is not set to anything REGS.ax = AH * &H100 + AL ' AL is 16 bit CALL INTERRUPT(&H21, REGS, REGS) ' Call the DOS services int AL = REGS.ax MOD &H100 ' AL is low 8 bits of AX GetDrive$ = CHR$(AL + 65) ' AL returns the drive number ' convert to ASCII with 0=A END FUNCTION $$59 ... " JESUS IS OUR KING IN TEXAS AND WE LOVE HIM " --- Blue Wave/QBBS v2.12 [NR] * Origin: -=Hyper Access BBS=- San Angelo TX, (915) 651-5487 (1:383/33.0)
Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET