source: xtideuniversalbios/trunk/BIOS_Drive_Information_Tool/Src/Main.asm@ 618

Last change on this file since 618 was 614, checked in by Krister Nordvall, 3 years ago

Changes:

  • BIOSDRVS should now build again (broke in r613).
  • Removed the NO_ATAID_CORRECTION define from the Tiny build.
  • Added a new configuration option to skip detection of slave drives.
  • Made FLASH_SIGNATURE 2 bytes shorter to free up ROM space.
  • "Auto Configure" in XTIDECFG should now detect if running on an Olivetti M24, AT&T PC6300, Xerox 6060 or Logabax Persona 1600 and automatically select the fastest compatible transfer mode/device type for any IDE controllers found in the system.
  • Cleaned out some duplicate/unused definitions.
File size: 5.9 KB
RevLine 
[327]1; Project name : BIOS Drive Information Tool
2; Description : BIOS Drive Information Tool reads and displays
3; drive information from BIOS.
4
[376]5;
[526]6; XTIDE Universal BIOS and Associated Tools
7; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 by XTIDE Universal BIOS Team.
[376]8;
9; This program is free software; you can redistribute it and/or modify
10; it under the terms of the GNU General Public License as published by
11; the Free Software Foundation; either version 2 of the License, or
12; (at your option) any later version.
[526]13;
[376]14; This program is distributed in the hope that it will be useful,
15; but WITHOUT ANY WARRANTY; without even the implied warranty of
16; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
[526]17; GNU General Public License for more details.
[376]18; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
[526]19;
[376]20
[327]21; Include .inc files
22%define INCLUDE_DISPLAY_LIBRARY
23%define INCLUDE_KEYBOARD_LIBRARY
24%include "AssemblyLibrary.inc" ; Assembly Library. Must be included first!
[359]25%include "Version.inc" ; From XTIDE Universal BIOS
26%include "ATA_ID.inc" ; From XTIDE Universal BIOS
[614]27%include "RamVars.inc" ; From XTIDE Universal BIOS (needed by Int13h.inc)
[359]28%include "Int13h.inc" ; From XTIDE Universal BIOS
29%include "EBIOS.inc" ; From XTIDE Universal BIOS
[558]30%include "IdeRegisters.inc" ; From XTIDE Universal BIOS
[590]31%include "RomVars.inc" ; From XTIDE Universal BIOS
[359]32%include "CustomDPT.inc" ; From XTIDE Universal BIOS
[327]33
34
35; Section containing code
36SECTION .text
37
38; Program first instruction.
39ORG 100h ; Code starts at offset 100h (DOS .COM)
40Start:
41 jmp StartBiosDriveInformationTool
42
43; Include library and other sources
44%include "AssemblyLibrary.asm"
[613]45%include "AtaID.asm" ; From XTIDE Universal BIOS
[424]46%include "AtaGeometry.asm" ; From XTIDE Universal BIOS
[327]47%include "Strings.asm"
[424]48%include "AtaInfo.asm"
[327]49%include "Bios.asm"
50%include "Print.asm"
51
52
53;--------------------------------------------------------------------
54; Program start
55;--------------------------------------------------------------------
56ALIGN JUMP_ALIGN
57StartBiosDriveInformationTool:
58 CALL_DISPLAY_LIBRARY InitializeDisplayContext
[359]59 call Print_SetCharacterOutputToSTDOUT
[327]60
[424]61 ; Display program name and version
[327]62 mov si, g_szProgramName
63 call Print_NullTerminatedStringFromSI
[589]64 ; Fall to ReadAndDisplayAllHardDrives
[327]65
66
[424]67;--------------------------------------------------------------------
68; ReadAndDisplayAllHardDrives
69; Parameters:
70; Nothing
71; Returns:
72; Nothing
73; Corrupts registers:
74; All, except segments
75;--------------------------------------------------------------------
[327]76ReadAndDisplayAllHardDrives:
77 call Bios_GetNumberOfHardDrivesToDX
78 jc SHORT .NoDrivesAvailable
79 mov cx, dx
80 mov dl, 80h ; First hard drive
81 jmp SHORT .DisplayFirstDrive
82
83.DisplayNextDriveFromDL:
84 mov si, g_szPressAnyKey
85 call Print_NullTerminatedStringFromSI
86 call Keyboard_GetKeystrokeToAXandWaitIfNecessary
[359]87
[327]88.DisplayFirstDrive:
[424]89 ; Display drive number
[327]90 mov si, g_szHeaderDrive
91 call Print_DriveNumberFromDLusingFormatStringInSI
92
[424]93 ; Display ATA information read from drive
[327]94 mov si, g_szAtaInfoHeader
95 call Print_NullTerminatedStringFromSI
[424]96 call AtaInfo_DisplayAtaInformationForDriveDL
[327]97
[424]98 ; Display INT 13h AH=08h and AH=15h information
[327]99 mov si, g_szOldInfoHeader
100 call Print_NullTerminatedStringFromSI
101 call DisplayOldInt13hInformationForDriveDL
102
[424]103 ; Display EBIOS information
[327]104 mov si, g_szNewInfoHeader
105 call Print_NullTerminatedStringFromSI
106 call DisplayNewInt13hInformationFromDriveDL
107
108 inc dx
109 loop .DisplayNextDriveFromDL
110.NoDrivesAvailable:
[589]111 ret ; Exit to DOS
[327]112
113
[424]114;--------------------------------------------------------------------
115; DisplayOldInt13hInformationForDriveDL
116; Parameters:
117; DL: Drive Number
118; Returns:
119; Nothing
120; Corrupts registers:
121; All, except CX and DX
122;--------------------------------------------------------------------
[327]123DisplayOldInt13hInformationForDriveDL:
124 push cx
125 push dx
126
[424]127 ; Print L-CHS from AH=08h
[327]128 call Bios_ReadOldInt13hParametersFromDriveDL
129 call Print_ErrorMessageFromAHifError
130 jc SHORT .SkipOldInt13hSinceError
131 call Print_CHSfromCXDXAX
132
[424]133 ; Print total sector count from AH=15h
[327]134 mov si, g_szSectors
135 call Print_NullTerminatedStringFromSI
136 pop dx
[332]137 push dx
[327]138 call Bios_ReadOldInt13hCapacityFromDriveDL
139 call Print_ErrorMessageFromAHifError
140 jc SHORT .SkipOldInt13hSinceError
[424]141
[327]142 xchg ax, dx
143 mov dx, cx
144 xor bx, bx
145 call Print_TotalSectorsFromBXDXAX
146.SkipOldInt13hSinceError:
147 pop dx
148 pop cx
149 ret
150
[332]151
[424]152;--------------------------------------------------------------------
153; DisplayNewInt13hInformationFromDriveDL
154; Parameters:
155; DL: Drive Number
156; Returns:
157; Nothing
158; Corrupts registers:
159; All, except CX and DX
160;--------------------------------------------------------------------
[327]161DisplayNewInt13hInformationFromDriveDL:
162 push cx
163 push dx
164
[424]165 ; Display EBIOS version
[327]166 call Bios_ReadEbiosVersionFromDriveDL
167 call Print_ErrorMessageFromAHifError
168 jc SHORT .SkipNewInt13hSinceError
169 call Print_EbiosVersionFromBXandExtensionsFromCX
170
[424]171 ; Display drive info from AH=48h
[327]172 call Bios_ReadEbiosInfoFromDriveDLtoDSSI
173 call Print_ErrorMessageFromAHifError
174 jc SHORT .SkipNewInt13hSinceError
175
[424]176 ; Display CHS
[327]177 test WORD [si+EDRIVE_INFO.wFlags], FLG_CHS_INFORMATION_IS_VALID
178 jz SHORT .SkipEbiosCHS
[416]179 mov cx, [si+EDRIVE_INFO.dwCylinders]
[327]180 mov dx, [si+EDRIVE_INFO.dwHeads]
[416]181 mov ax, [si+EDRIVE_INFO.dwSectorsPerTrack]
[327]182 call Print_CHSfromCXDXAX
183.SkipEbiosCHS:
184
[424]185 ; Display total sector count
[327]186 push si
187 mov si, g_szSectors
188 call Print_NullTerminatedStringFromSI
189 pop si
190 mov ax, [si+EDRIVE_INFO.qwTotalSectors]
191 mov dx, [si+EDRIVE_INFO.qwTotalSectors+2]
192 mov bx, [si+EDRIVE_INFO.qwTotalSectors+4]
193 call Print_TotalSectorsFromBXDXAX
194
[424]195 ; Display sector size
[327]196 mov ax, [si+EDRIVE_INFO.wSectorSize]
197 mov si, g_szNewSectorSize
[424]198 call Print_FormatStringFromSIwithParameterInAX
[327]199
200.SkipNewInt13hSinceError:
201 pop dx
202 pop cx
203 ret
Note: See TracBrowser for help on using the repository browser.