$include (compStch.ext)

/*
 *============================================================================
 *  This program is distributed in the hope that it will be useful, but
 *  WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
 *
 *  Permission to use for any purpose, modify, copy, and make enhancements
 *  and derivative works of the software is granted if attribution is given to
 *  R.M. Gillmore, dba the ACME Software Deli, as the author
 *
 *  While the ACME Software Deli does not work for money, there is nonetheless
 *  a significant amount of work involved.  The ACME Software Deli maintains the
 *  rights to all code written, though it may be used and distributed as long as
 *  the following conditions are maintained.
 *
 *  1.  The copyright statement at the top of each code block is maintained in
 *      your distribution.
 *  2.  You do not identify yourself as the ACME Software Deli
 *  3.  Any changes made to the software are sent to the ACME Software Deli
 *  4.  You distribute your code and any modifications to my code freely.
 *  5.  There is no charge for your work which uses this library
 *============================================================================
 */

driveParameterBlockModule:
do;

$include (comnDefs.ext)

$if not noID
declare IDString	(*) byte data
	( '@(#)$Id: dParmBlk.p86 823 2022-10-16 22:40:28Z rmgillmore $', 0 );
$endif

$set (driveParameterSource)
$include (sysCalls.ext)
$include (diskIO.ext)

getCurrentDriveParamBlock:
procedure pointer;
	/*
	 *	this function should read the BIOS parameter block for the current drive
	 *	and provide the information to the caller
	 */

	return ( NULL );
end getCurrentDriveParamBlock;

getDriveParamBlock:
procedure ( driveLetter ) pointer public;
	declare driveLetter			char,
			parameterBlockPtr	pointer,

			currentDisk			char,
			errorCode			word,
			cpuRegisters;


	/*
	 *	we need to:
	 *		get current disk (and save for later)
	 *		set current disk as indicated by drive letter
	 *		get the address of the designated drive parameter block
	 *		restore the current disk
	 */

	currentDisk = getCurrentDisk;
	errorCode = setCurrentDisk( driveLetter - 'A' + 1 );
	if ( errorCode = 0 ) then
	do;
		parameterBlockPtr = getCurrentDriveParamBlock;
	end;
	else
	do;
		parameterBlockPtr = NULL;
	end;

	errorCode = setCurrentDisk ( currentDisk );

	return ( parameterBlockPtr );
end getDriveParamBlock;

end driveParameterBlockModule;