Index: /trunk/BIOS_Drive_Information_Tool/Src/Bios.asm
===================================================================
--- /trunk/BIOS_Drive_Information_Tool/Src/Bios.asm	(revision 327)
+++ /trunk/BIOS_Drive_Information_Tool/Src/Bios.asm	(revision 327)
@@ -0,0 +1,193 @@
+; Project name	:	BIOS Drive Information Tool
+; Description	:	Functions to read information from BIOS.
+
+
+; Section containing code
+SECTION .text
+
+;---------------------------------------------------------------------
+; Bios_GetNumberOfHardDrivesToDX
+;	Parameters:
+;		Nothing
+;	Returns: (if no errors)
+;       DX:		Number of hard drives in system
+;		CF:		Set if no hard drives found
+;	Corrupts registers:
+;		AX, BX, CX
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+Bios_GetNumberOfHardDrivesToDX:
+	mov		dl, 80h		; First hard drive
+	mov		ah, GET_DRIVE_PARAMETERS
+	int		BIOS_DISK_INTERRUPT_13h
+	mov		dh, 0		; Preserve CF
+	ret
+
+
+;---------------------------------------------------------------------
+; Bios_ReadOldInt13hParametersFromDriveDL
+;	Parameters:
+;		DL:		BIOS drive number
+;	Returns: (if no errors)
+;       BL:     Drive Type (for floppies only)
+;		AX:		Sectors per track (1...63)
+;		DX:		Number of heads (1...255)
+;		CX:		Number of cylinders (1...1024)
+;		CF:		Cleared = no errors
+;				Set = BIOS error code stored in AH
+;	Corrupts registers:
+;		Nothing
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+Bios_ReadOldInt13hParametersFromDriveDL:
+	mov		ah, GET_DRIVE_PARAMETERS
+	int		BIOS_DISK_INTERRUPT_13h
+	jc		SHORT ReturnWithBiosErrorCodeInAH
+	; Fall to ExtractCHSfromOldInt13hDriveParameters
+
+;---------------------------------------------------------------------
+; ExtractCHSfromOldInt13hDriveParameters
+;	Parameters:
+;		CH:		Maximum cylinder number, bits 7...0
+;		CL:		Bits 7...6: Maximum cylinder number, bits 9 and 8
+;				Bits 5...0:	Maximum sector number (1...63)
+;		DH:		Maximum head number (0...254)
+;	Returns:
+;       BL:     Drive Type (for floppies only)
+;		AX:		Sectors per track (1...63)
+;		DX:		Number of heads (1...255)
+;		CX:		Number of cylinders (1...1024)
+;		CF:		Cleared
+;	Corrupts registers:
+;		Nothing
+;--------------------------------------------------------------------
+ExtractCHSfromOldInt13hDriveParameters:
+	mov		al, cl				; Copy sector number...
+	and		ax, BYTE 3Fh		; ...and limit to 1...63
+	sub		cl, al				; Remove from max cylinder high
+	eROL_IM	cl, 2				; High bits to beginning
+	eMOVZX	dx, dh				; Copy Max head to DX
+	xchg	cl, ch				; Max cylinder now in CX
+	inc		cx					; Max cylinder to number of cylinders
+	inc		dx					; Max head to number of heads
+	clc							; No errors
+	ret
+
+
+;---------------------------------------------------------------------
+; Bios_ReadOldInt13hCapacityFromDriveDL
+;	Parameters:
+;		DL:		BIOS drive number
+;	Returns: (if no errors)
+;       CX:DX:	Total number of sectors
+;       AH:		BIOS Error code
+;		CF:		Cleared = no errors
+;				Set = BIOS error code stored in AH
+;	Corrupts registers:
+;		Nothing
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+Bios_ReadOldInt13hCapacityFromDriveDL:
+	mov		ah, GET_DISK_TYPE
+	int		BIOS_DISK_INTERRUPT_13h
+	jc		SHORT ReturnInvalidErrorCodeInAH
+	xor		ah, ah
+	ret
+
+
+;---------------------------------------------------------------------
+; Bios_ReadAtaInfoFromDriveDLtoBX
+;	Parameters:
+;		DL:		BIOS drive number
+;	Returns: (if no errors)
+;      	DS:BX:	Ptr to ATA information
+;       AH:		BIOS Error code
+;		CF:		Cleared = no errors
+;				Set = BIOS error code stored in AH
+;	Corrupts registers:
+;		ES
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+Bios_ReadAtaInfoFromDriveDLtoBX:
+	mov		bx, g_rgbAtaInfo
+	push	ds
+	pop		es
+	mov		ah, GET_DRIVE_INFORMATION
+	int		BIOS_DISK_INTERRUPT_13h
+	ret
+
+
+;---------------------------------------------------------------------
+; Bios_ReadEbiosVersionFromDriveDL
+;	Parameters:
+;		DL:		BIOS drive number
+;	Returns:
+;		AH:		BIOS error code
+;       BX:		Version of extensions
+;		CX:		Interface support bit map
+;		CF:		Cleared = no errors
+;				Set = BIOS error code stored in AH
+;	Corrupts registers:
+;		Nothing
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+Bios_ReadEbiosVersionFromDriveDL:
+	mov		ah, CHECK_EXTENSIONS_PRESENT
+	mov		bx, 55AAh
+	int		BIOS_DISK_INTERRUPT_13h
+	jc		SHORT .NoEbiosPresent
+	cmp		bx, 0AA55h
+	jne		SHORT .NoEbiosPresent
+	eMOVZX	bx, ah			; Copy version to BX
+	xor		ah, ah
+	ret
+.NoEbiosPresent:
+	mov		ah, RET_HD_INVALID
+	stc
+	ret
+
+
+;---------------------------------------------------------------------
+; Bios_ReadEbiosInfoFromDriveDLtoDSSI
+;	Parameters:
+;		DL:		BIOS drive number
+;	Returns: (if no errors)
+;      	DS:SI:	Ptr to EDRIVE_INFO
+;       AH:		BIOS Error code
+;		CF:		Cleared = no errors
+;				Set = BIOS error code stored in AH
+;	Corrupts registers:
+;		Nothing
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+Bios_ReadEbiosInfoFromDriveDLtoDSSI:
+	mov		si, g_edriveInfo
+	mov		WORD [si+EDRIVE_INFO.wSize], MINIMUM_EDRIVEINFO_SIZE
+	mov		ah, GET_EXTENDED_DRIVE_INFORMATION
+	int		BIOS_DISK_INTERRUPT_13h
+	ret
+
+
+;---------------------------------------------------------------------
+; ReturnInvalidErrorCodeInAH
+; ReturnWithBiosErrorCodeInAH
+;	Parameters:
+;		Nothing
+;	Returns: (if no errors)
+;       AH:		BIOS Error code
+;		CF:		Set
+;	Corrupts registers:
+;		Nothing
+;--------------------------------------------------------------------
+ReturnInvalidErrorCodeInAH:
+	stc
+	mov		ah, RET_HD_INVALID	
+ReturnWithBiosErrorCodeInAH:
+	ret
+
+
+; Section containing uninitialized data
+SECTION .bss
+
+g_edriveInfo:
+g_rgbAtaInfo:		resb	512
Index: /trunk/BIOS_Drive_Information_Tool/Src/Main.asm
===================================================================
--- /trunk/BIOS_Drive_Information_Tool/Src/Main.asm	(revision 327)
+++ /trunk/BIOS_Drive_Information_Tool/Src/Main.asm	(revision 327)
@@ -0,0 +1,204 @@
+; Project name	:	BIOS Drive Information Tool
+; Description	:	BIOS Drive Information Tool reads and displays
+;					drive information from BIOS.
+
+; Include .inc files
+%define INCLUDE_DISPLAY_LIBRARY
+%define INCLUDE_KEYBOARD_LIBRARY
+%include "AssemblyLibrary.inc"	; Assembly Library. Must be included first!
+%include "ATA_ID.inc"
+%include "Int13h.inc"
+%include "EBIOS.inc"
+
+
+; Section containing code
+SECTION .text
+
+; Program first instruction.
+ORG	100h						; Code starts at offset 100h (DOS .COM)
+Start:
+	jmp		StartBiosDriveInformationTool
+
+; Include library and other sources
+%include "AssemblyLibrary.asm"
+%include "Strings.asm"
+%include "Bios.asm"
+%include "Print.asm"
+
+
+;--------------------------------------------------------------------
+; Program start
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+StartBiosDriveInformationTool:
+	CALL_DISPLAY_LIBRARY	InitializeDisplayContext
+	mov		bl, ATTRIBUTES_NOT_USED
+	mov		ax, Print_DosCharOut
+	CALL_DISPLAY_LIBRARY	SetCharOutputFunctionFromAXwithAttribFlagInBL
+
+	mov		si, g_szProgramName
+	call	Print_NullTerminatedStringFromSI
+
+	call	ReadAndDisplayAllHardDrives
+
+	; Exit to DOS
+	mov 	ax, 4C00h			; Exit to DOS
+	int 	21h
+
+
+
+ReadAndDisplayAllHardDrives:
+	call	Bios_GetNumberOfHardDrivesToDX
+	jc		SHORT .NoDrivesAvailable
+	mov		cx, dx
+	mov		dl, 80h				; First hard drive
+	jmp		SHORT .DisplayFirstDrive
+
+ALIGN JUMP_ALIGN
+.DisplayNextDriveFromDL:
+	mov		si, g_szPressAnyKey
+	call	Print_NullTerminatedStringFromSI
+	call	Keyboard_GetKeystrokeToAXandWaitIfNecessary
+.DisplayFirstDrive:
+	mov		si, g_szHeaderDrive
+	call	Print_DriveNumberFromDLusingFormatStringInSI
+
+	mov		si, g_szAtaInfoHeader
+	call	Print_NullTerminatedStringFromSI
+	call	DisplayAtaInformationForDriveDL
+
+	mov		si, g_szOldInfoHeader
+	call	Print_NullTerminatedStringFromSI
+	call	DisplayOldInt13hInformationForDriveDL
+
+	mov		si, g_szNewInfoHeader
+	call	Print_NullTerminatedStringFromSI
+	call	DisplayNewInt13hInformationFromDriveDL
+
+	inc		dx
+	loop	.DisplayNextDriveFromDL
+.NoDrivesAvailable:
+	ret
+
+
+ALIGN JUMP_ALIGN
+DisplayAtaInformationForDriveDL:
+	push	cx
+	push	dx
+
+	call	Bios_ReadAtaInfoFromDriveDLtoBX
+	call	Print_ErrorMessageFromAHifError
+	jc		SHORT .SkipAtaInfoSinceError
+
+	call	Print_NameFromAtaInfoInBX
+
+	mov		cx, [bx+ATA1.wCylCnt]
+	mov		dx, [bx+ATA1.wHeadCnt]
+	mov		ax, [bx+ATA1.wSPT]
+	call	Print_CHSfromCXDXAX
+
+	test	WORD [bx+ATA1.wFields], A1_wFields_54to58
+	jz		SHORT .SkipChsSectors
+	mov		si, g_szChsSectors
+	call	Print_NullTerminatedStringFromSI
+	mov		si, bx
+	mov		ax, [si+ATA1.dwCurSCnt]
+	mov		dx, [si+ATA1.dwCurSCnt+2]
+	xor		bx, bx
+	call	Print_TotalSectorsFromBXDXAX
+	mov		bx, si
+.SkipChsSectors:
+
+	test	WORD [bx+ATA1.wCaps], A1_wCaps_LBA
+	jz		SHORT .SkipLBA28
+	mov		si, g_szLBA28
+	call	Print_NullTerminatedStringFromSI
+	mov		si, bx
+	mov		ax, [si+ATA1.dwLBACnt]
+	mov		dx, [si+ATA1.dwLBACnt+2]
+	xor		bx, bx
+	call	Print_TotalSectorsFromBXDXAX
+	mov		bx, si
+.SkipLBA28:
+
+	test	WORD [bx+ATA6.wSetSup83], A6_wSetSup83_LBA48
+	jz		SHORT .SkipLBA48
+	mov		si, g_szLBA48
+	call	Print_NullTerminatedStringFromSI
+	mov		ax, [bx+ATA6.qwLBACnt]
+	mov		dx, [bx+ATA6.qwLBACnt+2]
+	mov		bx, [bx+ATA6.qwLBACnt+4]
+	call	Print_TotalSectorsFromBXDXAX
+.SkipLBA48:
+.SkipAtaInfoSinceError:
+	pop		dx
+	pop		cx
+	ret
+
+
+ALIGN JUMP_ALIGN
+DisplayOldInt13hInformationForDriveDL:
+	push	cx
+	push	dx
+	push	dx
+
+	call	Bios_ReadOldInt13hParametersFromDriveDL
+	call	Print_ErrorMessageFromAHifError
+	jc		SHORT .SkipOldInt13hSinceError
+	call	Print_CHSfromCXDXAX
+
+	mov		si, g_szSectors
+	call	Print_NullTerminatedStringFromSI
+	pop		dx
+	call	Bios_ReadOldInt13hCapacityFromDriveDL
+	call	Print_ErrorMessageFromAHifError
+	jc		SHORT .SkipOldInt13hSinceError
+	xchg	ax, dx
+	mov		dx, cx
+	xor		bx, bx
+	call	Print_TotalSectorsFromBXDXAX
+.SkipOldInt13hSinceError:
+	pop		dx
+	pop		cx
+	ret
+
+	
+ALIGN JUMP_ALIGN
+DisplayNewInt13hInformationFromDriveDL:
+	push	cx
+	push	dx
+
+	call	Bios_ReadEbiosVersionFromDriveDL
+	call	Print_ErrorMessageFromAHifError
+	jc		SHORT .SkipNewInt13hSinceError
+	call	Print_EbiosVersionFromBXandExtensionsFromCX
+
+	call	Bios_ReadEbiosInfoFromDriveDLtoDSSI
+	call	Print_ErrorMessageFromAHifError
+	jc		SHORT .SkipNewInt13hSinceError
+
+	test	WORD [si+EDRIVE_INFO.wFlags], FLG_CHS_INFORMATION_IS_VALID
+	jz		SHORT .SkipEbiosCHS
+	mov		ax, [si+EDRIVE_INFO.dwCylinders]
+	mov		dx, [si+EDRIVE_INFO.dwHeads]
+	mov		cx, [si+EDRIVE_INFO.dwSectorsPerTrack]
+	call	Print_CHSfromCXDXAX
+.SkipEbiosCHS:
+
+	push	si
+	mov		si, g_szSectors
+	call	Print_NullTerminatedStringFromSI
+	pop		si
+	mov		ax, [si+EDRIVE_INFO.qwTotalSectors]
+	mov		dx, [si+EDRIVE_INFO.qwTotalSectors+2]
+	mov		bx, [si+EDRIVE_INFO.qwTotalSectors+4]
+	call	Print_TotalSectorsFromBXDXAX
+
+	mov		ax, [si+EDRIVE_INFO.wSectorSize]
+	mov		si, g_szNewSectorSize
+	call	Print_SectorSizeFromAXusingFormatStringInSI
+
+.SkipNewInt13hSinceError:
+	pop		dx
+	pop		cx
+	ret
Index: /trunk/BIOS_Drive_Information_Tool/Src/Print.asm
===================================================================
--- /trunk/BIOS_Drive_Information_Tool/Src/Print.asm	(revision 327)
+++ /trunk/BIOS_Drive_Information_Tool/Src/Print.asm	(revision 327)
@@ -0,0 +1,202 @@
+; Project name	:	BIOS Drive Information Tool
+; Description	:	Functions to print information read from BIOS.
+
+
+; Section containing code
+SECTION .text
+
+;--------------------------------------------------------------------
+; Use DOS standard output so strings can be redirected to a file.
+;
+; Print_DosCharOut
+;	Parameters:
+;		AL:		Character to output
+;		DS:		BDA segment (zero)
+;		ES:DI:	Ptr to video memory where to output
+;	Returns:
+;		DI:		Incremented for next character
+;	Corrupts registers:
+;		AX, DX
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+Print_DosCharOut:
+	xchg	dx, ax
+	mov		ah, 02h		; DOS 1+ - WRITE CHARACTER TO STANDARD OUTPUT
+	int		21h			; Call DOS
+	ret
+
+
+;---------------------------------------------------------------------
+; Print_ErrorMessageFromAHifError
+;	Parameters:
+;		AH:		BIOS error code
+;		CF:		Set if error, cleared otherwise
+;	Returns:
+;		Nothing
+;	Corrupts registers:
+;		AX, BP, SI, DI (CF remains unchanged)
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+Print_ErrorMessageFromAHifError:
+	jnc		SHORT .NoErrors
+	eMOVZX	ax, ah
+	mov		si, g_szBiosError
+	call	Print_BiosFunctionNumberFromAXusingFormatStringInSI
+	stc		; Keep the CF set
+ALIGN JUMP_ALIGN
+.NoErrors:
+	ret
+
+
+;---------------------------------------------------------------------
+; Print_DriveNumberFromDLusingFormatStringInSI
+; Print_BiosFunctionNumberFromAXusingFormatStringInSI
+; Print_SectorSizeFromAXusingFormatStringInSI
+;	Parameters:
+;		DL:		Drive Number
+;		AX:		Function number
+;	Returns:
+;		Nothing
+;	Corrupts registers:
+;		AX, BP, DI
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+Print_DriveNumberFromDLusingFormatStringInSI:
+	eMOVZX	ax, dl
+Print_BiosFunctionNumberFromAXusingFormatStringInSI:
+Print_SectorSizeFromAXusingFormatStringInSI:
+	mov		bp, sp
+	push	ax
+	jmp		SHORT JumpToFormatNullTerminatedStringFromSI
+
+
+;---------------------------------------------------------------------
+; Print_CHSfromCXDXAX
+;	Parameters:
+;		CX:		Number of cylinders (1...16383)
+;		DX:		Number of heads (1...255)
+;		AX:		Sectors per track (1...63)
+;	Returns:
+;		Nothing
+;	Corrupts registers:
+;		AX, BP, DI
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+Print_CHSfromCXDXAX:
+	push	si
+
+	mov		bp, sp
+	push	cx
+	push	dx
+	push	ax
+	mov		si, g_szFormatCHS
+	CALL_DISPLAY_LIBRARY	FormatNullTerminatedStringFromCSSI
+
+	pop		si
+	ret
+
+
+;---------------------------------------------------------------------
+; Print_NameFromAtaInfoInBX
+;	Parameters:
+;		DS:BX:	Ptr to ATA information
+;	Returns:
+;		Nothing
+;	Corrupts registers:
+;		AX, CX, BP, SI, DI
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+Print_NameFromAtaInfoInBX:
+	cld
+	lea		si, [bx+ATA1.strModel]
+	mov		di, si
+	mov		cx, A1_MODEL_NUMBER_LENGTH/2
+ALIGN JUMP_ALIGN
+.ReverseNextWord:
+	lodsw
+	xchg	al, ah
+	stosw
+	loop	.ReverseNextWord
+	dec		di
+	xor		ax, ax
+	stosb				; Terminate with NULL
+
+	mov		bp, sp
+	lea		si, [bx+ATA1.strModel]
+	push	si
+	mov		si, g_szFormatDrvName
+	jmp		SHORT JumpToFormatNullTerminatedStringFromSI
+
+
+;---------------------------------------------------------------------
+; Print_TotalSectorsFromBXDXAX
+;	Parameters:
+;		BX:DX:AX:	Total number of sectors
+;	Returns:
+;		Nothing
+;	Corrupts registers:
+;		AX, BX, BP, DI
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+Print_TotalSectorsFromBXDXAX:
+	ePUSH_T	di, 0
+	push	bx
+	push	dx
+	push	ax
+	mov		bp, sp
+	mov		bx, 10
+	CALL_DISPLAY_LIBRARY	PrintQWordFromSSBPwithBaseInBX
+	add		sp, BYTE 8
+
+	CALL_DISPLAY_LIBRARY	PrintNewlineCharacters
+	ret
+
+
+;---------------------------------------------------------------------
+; Print_EbiosVersionFromBXandExtensionsFromCX
+;	Parameters:
+;       BX:		Version of extensions
+;		CX:		Interface support bit map
+;	Returns:
+;		Nothing
+;	Corrupts registers:
+;		AX, BP, SI, DI
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+Print_EbiosVersionFromBXandExtensionsFromCX:
+	mov		bp, sp
+	push	bx
+	push	cx
+	mov		si, g_szNewExtensions
+	jmp		SHORT JumpToFormatNullTerminatedStringFromSI
+
+
+;---------------------------------------------------------------------
+; JumpToFormatNullTerminatedStringFromSI
+;	Parameters:
+;		BP:		SP before pushing parameters
+;		CS:SI:	Ptr to format string
+;	Returns:
+;		Pushed parameters are cleaned from stack
+;	Corrupts registers:
+;		AX, DI
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+JumpToFormatNullTerminatedStringFromSI:	
+	CALL_DISPLAY_LIBRARY 	FormatNullTerminatedStringFromCSSI
+	ret
+
+
+;---------------------------------------------------------------------
+; Print_NullTerminatedStringFromSI
+;	Parameters:
+;		CS:SI:	Ptr to string to display
+;	Returns:
+;		Nothing
+;	Corrupts registers:
+;		AX, DI
+;--------------------------------------------------------------------
+ALIGN JUMP_ALIGN
+Print_NullTerminatedStringFromSI:
+	CALL_DISPLAY_LIBRARY	PrintNullTerminatedStringFromCSSI
+	ret
Index: /trunk/BIOS_Drive_Information_Tool/Src/Strings.asm
===================================================================
--- /trunk/BIOS_Drive_Information_Tool/Src/Strings.asm	(revision 327)
+++ /trunk/BIOS_Drive_Information_Tool/Src/Strings.asm	(revision 327)
@@ -0,0 +1,34 @@
+; Project name	:	BIOS Drive Information Tool
+; Description	:	Strings used in this program.
+
+
+; Section containing initialized data
+SECTION .data
+
+g_szProgramName:	db	"BIOS Drive Information Tool v1.0.0",LF,CR
+					db	"http://code.google.com/p/xtideuniversalbios/",LF,CR,NULL
+					
+g_szPressAnyKey:	db	LF,CR,"Press any key to display next drive.",LF,CR,NULL
+
+g_szHeaderDrive:	db	LF,CR,"-= Drive %2x =-",LF,CR,NULL
+
+g_szAtaInfoHeader:	db	"ATA-information from AH=25h...",LF,CR,NULL
+g_szFormatDrvName:	db	" Name: %s",LF,CR,NULL
+g_szFormatCHS:		db	" Cylinders    : %5-u, Heads: %3-u, Sectors: %2-u",LF,CR,NULL
+g_szChsSectors:		db	" CHS   sectors: ",NULL
+g_szLBA28:			db	" LBA28 sectors: ",NULL
+g_szLBA48:			db	" LBA48 sectors: ",NULL
+
+g_szOldInfoHeader:	db	"Old INT 13h information from AH=08h and AH=15h...",LF,CR,NULL
+					;	Cylinders
+g_szSectors:		db	" Total sectors: ",NULL
+
+
+g_szNewInfoHeader:	db	"EBIOS information from AH=48h...",LF,CR,NULL
+g_szNewExtensions:	db	" Version      : %2-x, Interface bitmap: %2-x",LF,CR,NULL
+					; Cylinders
+					; Total sectors
+g_szNewSectorSize:	db	" Sector size  : %u",LF,CR,NULL
+
+g_szBiosError:		db	" BIOS returned error code %x",LF,CR,NULL
+g_szDashForZero:	db	"- ",NULL		; Required by Assembly Library
Index: /trunk/BIOS_Drive_Information_Tool/makefile
===================================================================
--- /trunk/BIOS_Drive_Information_Tool/makefile	(revision 327)
+++ /trunk/BIOS_Drive_Information_Tool/makefile	(revision 327)
@@ -0,0 +1,130 @@
+###############################################################################
+# Makefile to build BIOS Drive Information Tool.                              #
+#                                                                             #
+# Valid makefile targets are:                                                 #
+# all		Removes existing files and builds binary file in \Build           #
+# clean		Removes all files from \Build                                     #
+#                                                                             #
+# Build directory must be created manually if it does not exist.              #
+#                                                                             #
+###############################################################################
+
+###########################################
+# Source files and destination executable #
+###########################################
+
+# Assembly source code file (*.asm):
+SRC_ASM = Src/Main.asm
+
+# Program executable file name without extension:
+PROG = biosdrvs
+EXTENSION = com
+
+
+#######################################
+# Destination and include directories #
+#######################################
+
+# Directory where binary file will be compiled to
+BUILD_DIR = Build
+
+# Subdirectories where included files are:
+HEADERS = Inc/
+HEADERS += Src/
+
+# Subdirectories where library files are:
+LIBS = ../Assembly_Library/Inc/
+LIBS += ../Assembly_Library/Src/
+LIBS += ../Assembly_Library/Src/Display/
+LIBS += ../Assembly_Library/Src/File/
+LIBS += ../Assembly_Library/Src/Keyboard/
+LIBS += ../Assembly_Library/Src/Menu/
+LIBS += ../Assembly_Library/Src/Menu/Dialog/
+LIBS += ../Assembly_Library/Src/String/
+LIBS += ../Assembly_Library/Src/Time/
+LIBS += ../Assembly_Library/Src/Util/
+LIBS += ../XTIDE_Universal_BIOS/Inc/
+HEADERS += $(LIBS)
+
+
+#################################################################
+# Assembler preprocessor defines.                               #
+#################################################################
+DEFINES = 
+DEFINES_XT = ELIMINATE_CGA_SNOW
+DEFINES_XTPLUS = USE_186 ELIMINATE_CGA_SNOW
+DEFINES_AT = USE_286 USE_AT
+
+
+###################
+# Other variables #
+###################
+
+# Add -D in front of every preprocessor define declaration
+DEFS = $(DEFINES:%=-D%)
+DEFS_XT = $(DEFINES_XT:%=-D%)
+DEFS_XTPLUS = $(DEFINES_XTPLUS:%=-D%)
+DEFS_AT = $(DEFINES_AT:%=-D%)
+
+# Add -I in front of all header directories
+IHEADERS = $(HEADERS:%=-I%)
+
+# Path + target file to be built
+TARGET = $(BUILD_DIR)/$(PROG)
+
+
+#########################
+# Compilers and linkers #
+#########################
+
+# Make
+MAKE = mingw32-make.exe
+
+# Assembler
+AS = nasm.exe
+
+# use this command to erase files.
+RM = -del /Q
+
+
+#############################
+# Compiler and linker flags #
+#############################
+
+# Assembly compiler flags
+ASFLAGS = -f bin				# Produce binary object files
+ASFLAGS += $(DEFS)				# Preprocessor defines
+ASFLAGS += $(IHEADERS)			# Set header file directory paths
+ASFLAGS += -Worphan-labels		# Warn about labels without colon
+ASFLAGS += -O9					# Optimize operands to their shortest forms
+
+
+############################################
+# Build process. Actual work is done here. #
+############################################
+
+.PHONY: all at xtplus xt clean release
+
+all: clean xt
+	@echo All done!
+
+at:
+	@$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_AT) -l"$(TARGET)_at.lst" -o"$(TARGET)_at.$(EXTENSION)"
+	@echo AT version "$(TARGET)_at.$(EXTENSION)" built.
+
+xtplus:
+	@$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XTPLUS) -l"$(TARGET)_xtp.lst" -o"$(TARGET)_xtp.$(EXTENSION)"
+	@echo XT Plus version "$(TARGET)_xtp.$(EXTENSION)" built.
+
+xt:
+	@$(AS) "$(SRC_ASM)" $(ASFLAGS) $(DEFS_XT) -l"$(TARGET)_xt.lst" -o"$(TARGET).$(EXTENSION)"
+	@echo XT version "$(TARGET).$(EXTENSION)" built.
+
+clean:
+	@$(RM) $(BUILD_DIR)\*.*
+	@echo Deleted "(*.*)" from "$(BUILD_DIR)/"
+
+release: xt
+	@echo Compressing with UPX...
+	@upx -qq --8086 --ultra-brute $(TARGET).$(EXTENSION)
+	@echo Done! XT version is ready for release.
