source: trunk/BOOTCODE/REGULAR/DEBUG.ASM@ 45

Last change on this file since 45 was 45, checked in by Ben Rietbroek, 12 years ago

Now using compressed HidePartTable (auxdebug on) [2012-02-24]

WARNING!!

All commits upto and including the commit of [2012-05-13] contain
a severe bug!! Building from these sources and then disabling
the 'force LBA' feature while also using the drive-letter feature or
editing the label can DESTROY THE MBR on ALL ATTACHED DISKS!!
DO NOT DISABLE 'FORCE LBA USAGE' WHEN BUILT FROM THE THESE COMMITS!!

Fixes

o HidePartTabled now uses a 6-bit compressed format

Bitfield functions are used to manipulate the table.
Modifications mostly in PARTSCAN.ASM, PART_SET.ASM and PARTMAIN.ASM.
TODO: Determine impact on upgrading from previous versions.

Changes

o Changed LVM Label behavior

If they are the same, the LVM VolumeName is synced to LVM PartitionName
so they are the same again after the edit.
If they differ, only the LVM VolumeName is updated.

o Implemented stop scanning when partition limit of 45 is exceeded

User is presented with a warning pop-up.
Pressing a key will continue and the partitions that were found
so far are displayed in the menu.
The color of the selection bar is changed to red to indicate this
overflow situation.

o New overlap macro that works correctly with JWasm and Tasm

Now uses DB n DUP (<filler>) to fill space before a new ORG.
When overlap occurs n goes negative causing assembler error.

File size: 11.4 KB
Line 
1; AiR-BOOT (c) Copyright 1998-2008 M. Kiewitz
2;
3; This file is part of AiR-BOOT
4;
5; AiR-BOOT is free software: you can redistribute it and/or modify it under
6; the terms of the GNU General Public License as published by the Free
7; Software Foundation, either version 3 of the License, or (at your option)
8; any later version.
9;
10; AiR-BOOT is distributed in the hope that it will be useful, but WITHOUT ANY
11; WARRANTY: without even the implied warranty of MERCHANTABILITY or FITNESS
12; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13; details.
14;
15; You should have received a copy of the GNU General Public License along with
16; AiR-BOOT. If not, see <http://www.gnu.org/licenses/>.
17;
18;---------------------------------------------------------------------------
19; AiR-BOOT / DEBUG
20;---------------------------------------------------------------------------
21
22
23; -----------------------
24; Rousseau: # DEBUG.ASM #
25; -----------------------
26; This module contains functions for debugging AiR-BOOT.
27; It is only included in debug builds and the codesize of AiR-BOOT increases
28; in that case.
29;
30; Had problems with RU language version because it includes cyrillic charset.
31; Parts disabled for now.
32
33
34IFDEF ModuleNames
35DB 'DEBUG',0
36ENDIF
37
38DEBUG_CheckMath Proc Near
39 ;~ pushf
40 ;~ pusha
41;~
42 ;~ ; Msg check math-module
43 ;~ mov si,offset db_checkmath
44 ;~ call AuxIO_Print
45;~
46 ;~ ; Output hex-word
47 ;~ mov ax,0BABEh
48 ;~ call AuxIO_TeletypeHexWord
49;~
50 ;~ mov al,' '
51 ;~ call AuxIO_Teletype
52 ;~ mov al,'*'
53 ;~ call AuxIO_Teletype
54 ;~ mov al,' '
55 ;~ call AuxIO_Teletype
56;~
57 ;~ ; Output hex-word
58 ;~ mov ax,0BABEh
59 ;~ call AuxIO_TeletypeHexWord
60;~
61 ;~ mov al,' '
62 ;~ call AuxIO_Teletype
63 ;~ mov al,'='
64 ;~ call AuxIO_Teletype
65 ;~ mov al,' '
66 ;~ call AuxIO_Teletype
67;~
68 ;~ mov ax,0BABEh
69 ;~ mul ax
70 ;~ call AuxIO_TeletypeHexDWord
71;~
72 ;~ ; Start new line
73 ;~ call AuxIO_TeletypeNL
74;~
75 ;~ ; Output hex-dword
76 ;~ mov dx,0DEADh
77 ;~ mov ax,0FACEh
78 ;~ call AuxIO_TeletypeHexDWord
79;~
80 ;~ mov al,' '
81 ;~ call AuxIO_Teletype
82 ;~ mov al,'*'
83 ;~ call AuxIO_Teletype
84 ;~ mov al,' '
85 ;~ call AuxIO_Teletype
86;~
87 ;~ ; Output hex-dword
88 ;~ mov dx,0DEADh
89 ;~ mov ax,0FACEh
90 ;~ call AuxIO_TeletypeHexDWord
91;~
92 ;~ mov al,' '
93 ;~ call AuxIO_Teletype
94 ;~ mov al,'='
95 ;~ call AuxIO_Teletype
96 ;~ mov al,' '
97 ;~ call AuxIO_Teletype
98;~
99 ;~ mov bx,0DEADh
100 ;~ mov cx,0FACEh
101 ;~ mov dx,0DEADh
102 ;~ mov ax,0FACEh
103 ;~ call MATH_Mul32
104 ;~ call AuxIO_TeletypeHexQWord
105;~
106 ;~ call AuxIO_TeletypeNL
107 ;~ call AuxIO_TeletypeNL
108;~
109 ;~ popa
110 ;~ popf
111
112 ret
113DEBUG_CheckMath EndP
114
115
116DEBUG_DumpGeo Proc
117 ;~ pushf
118 ;~ pusha
119;~
120 ;~ ; BIOS cyls
121 ;~ mov dx,word ptr [BIOS_Cyls+02]
122 ;~ mov ax,word ptr [BIOS_Cyls+00]
123 ;~ call AuxIO_TeletypeHexDWord
124 ;~ call AuxIO_TeletypeNL
125;~
126 ;~ ; BIOS heads
127 ;~ mov dx,word ptr [BIOS_Heads+02]
128 ;~ mov ax,word ptr [BIOS_Heads+00]
129 ;~ call AuxIO_TeletypeHexDWord
130 ;~ call AuxIO_TeletypeNL
131;~
132 ;~ ; BIOS secs
133 ;~ mov dx,word ptr [BIOS_Secs+02]
134 ;~ mov ax,word ptr [BIOS_Secs+00]
135 ;~ call AuxIO_TeletypeHexDWord
136 ;~ call AuxIO_TeletypeNL
137;~
138 ;~ ; Bytes per sector
139 ;~ mov ax,[BIOS_Bytes]
140 ;~ call AuxIO_TeletypeHexWord
141 ;~ call AuxIO_TeletypeNL
142;~
143 ;~ ; Total secs
144 ;~ mov bx, word ptr [BIOS_TotalSecs+06]
145 ;~ mov cx, word ptr [BIOS_TotalSecs+04]
146 ;~ mov dx, word ptr [BIOS_TotalSecs+02]
147 ;~ mov ax, word ptr [BIOS_TotalSecs+00]
148 ;~ call AuxIO_TeletypeHexDWord
149 ;~ call AuxIO_TeletypeNL
150;~
151 ;~ ; CHS to LBA
152 ;~ mov dx,1
153 ;~ mov ax,29e5h
154 ;~ mov bx,23h
155 ;~ mov cx,9h
156 ;~ call CONV_CHS2LBA
157 ;~ call AuxIO_TeletypeHexDWord
158 ;~ call AuxIO_TeletypeNL
159;~
160 ;~ popa
161 ;~ popf
162
163 ret
164DEBUG_DumpGeo Endp
165
166;
167; Dump information before the menu is displayed.
168;
169DEBUG_Dump1 Proc Near
170 pushf
171 pusha
172
173 ; Hello message
174 mov si, offset AuxIOHello
175 call AuxIO_Print
176
177 ; Build Date
178 mov si, offset BUILD_DATE
179 call AuxIO_Print
180
181 ; Start new line
182 call AuxIO_TeletypeNL
183 call AuxIO_TeletypeNL
184
185 ;~ call DEBUG_DumpHidePartTables
186
187 ;~ call DEBUG_CheckMath
188
189 ;~ call DEBUG_DumpGeo
190
191 ;~ call DEBUG_CheckBitFields
192
193 popa
194 popf
195 ret
196DEBUG_Dump1 EndP
197
198
199DEBUG_DumpBSSSectors Proc Near
200 ;~ pushf
201 ;~ pusha
202;~
203 ;~ mov si, offset [PartitionSector]
204 ;~ call AuxIO_DumpSector
205 ;~ call AuxIO_TeletypeNL
206;~
207 ;~ mov si, offset [JfsPBR]
208 ;~ call AuxIO_DumpSector
209 ;~ call AuxIO_TeletypeNL
210;~
211 ;~ mov si, offset [LVMSector]
212 ;~ call AuxIO_DumpSector
213 ;~ call AuxIO_TeletypeNL
214;~
215 ;~ mov si, offset [TmpSector]
216 ;~ call AuxIO_DumpSector
217 ;~ call AuxIO_TeletypeNL
218;~
219 ;~ mov si, offset [NewPartTable]
220 ;~ call AuxIO_DumpSector
221 ;~ call AuxIO_TeletypeNL
222 ;~ call AuxIO_TeletypeNL
223;~
224 ;~ popa
225 ;~ popf
226 ret
227DEBUG_DumpBSSSectors EndP
228
229
230DEBUG_DumpHidePartTables Proc Near
231 pushf
232 pusha
233
234 mov cx,3
235 mov si, offset [HidePartitionTable]
236 again1:
237 call AuxIO_DumpSector
238 add si,512
239 loop again1
240 call AuxIO_TeletypeNL
241
242 mov cx,3
243 mov si, offset [PartitionXref]
244 again2:
245 call AuxIO_DumpParagraph
246 call AuxIO_TeletypeNL
247 add si,16
248 loop again2
249 call AuxIO_TeletypeNL
250
251 mov cx,3
252 mov si, offset [NewHidePartTable]
253 again3:
254 call AuxIO_DumpSector
255 add si,512
256 loop again3
257 call AuxIO_TeletypeNL
258
259 popa
260 popf
261 ret
262DEBUG_DumpHidePartTables EndP
263
264
265DEBUG_CheckBitFields Proc
266 ;~ pushf
267 ;~ pusha
268;~
269 ;~ mov bx,offset [ott]
270;~
271 ;~ mov al,0
272 ;~ mov dl,0
273 ;~ mov dh,6
274 ;~ DEBUG_CheckBitFields_next_write:
275 ;~ call CONV_SetBitfieldValue
276 ;~ inc al
277 ;~ inc dl
278 ;~ jnz DEBUG_CheckBitFields_next_write
279;~
280 ;~ mov dl,0
281 ;~ mov dh,6
282 ;~ DEBUG_CheckBitFields_next_read:
283 ;~ mov al,dl
284 ;~ call AuxIO_TeletypeHexByte
285 ;~ mov al,':'
286 ;~ call AuxIO_Teletype
287 ;~ call CONV_GetBitfieldValue
288 ;~ call AuxIO_TeletypeHexWord
289 ;~ call AuxIO_TeletypeNL
290 ;~ inc dl
291 ;~ jnz DEBUG_CheckBitFields_next_read
292;~
293 ;~ popa
294 ;~ popf
295 ret
296DEBUG_CheckBitFields EndP
297
298;
299; Dump information before the partition is booted.
300;
301DEBUG_Dump2 Proc Near
302 ;~ pushf
303 ;~ pusha
304;~
305;~
306 ;~ call AuxIO_TeletypeNL
307 ;~ call AuxIO_TeletypeNL
308;~
309;~
310 ;~ mov si,offset db_config
311 ;~ call AuxIO_Print
312;~
313 ;~ mov si,offset db_cfgparts
314 ;~ call AuxIO_Print
315 ;~ mov al,[CFG_Partitions]
316 ;~ call AuxIO_TeletypeHexByte
317 ;~ call AuxIO_TeletypeNL
318;~
319 ;~ mov si,offset db_cfgpartdef
320 ;~ call AuxIO_Print
321 ;~ mov al,[CFG_PartDefault]
322 ;~ call AuxIO_TeletypeHexByte
323 ;~ call AuxIO_TeletypeNL
324;~
325 ;~ mov si,offset db_cfgpartlast
326 ;~ call AuxIO_Print
327 ;~ mov al,[CFG_PartLast]
328 ;~ call AuxIO_TeletypeHexByte
329 ;~ call AuxIO_TeletypeNL
330 ;~ call AuxIO_TeletypeNL
331;~
332;~
333;~
334 ;~ mov si,offset db_vars
335 ;~ call AuxIO_Print
336;~
337 ;~ mov si,offset db_newpart
338 ;~ call AuxIO_Print
339 ;~ mov si,offset NewPartTable
340 ;~ call AuxIO_DumpSector
341 ;~ call AuxIO_TeletypeNL
342 ;~ add si,512
343 ;~ call AuxIO_DumpSector
344 ;~ call AuxIO_TeletypeNL
345 ;~ call AuxIO_TeletypeNL
346;~
347 ;~ mov si,offset db_newhide
348 ;~ call AuxIO_Print
349 ;~ mov si,offset NewHidePartTable
350 ;~ call AuxIO_DumpSector
351 ;~ call AuxIO_TeletypeNL
352 ;~ add si,512
353 ;~ call AuxIO_DumpSector
354 ;~ call AuxIO_TeletypeNL
355 ;~ call AuxIO_TeletypeNL
356;~
357 ;~ mov si,offset db_dletters
358 ;~ call AuxIO_Print
359 ;~ mov si,offset NewDriveLetters
360 ;~ call AuxIO_DumpParagraph
361 ;~ call AuxIO_TeletypeNL
362 ;~ add si,16
363 ;~ call AuxIO_DumpParagraph
364 ;~ call AuxIO_TeletypeNL
365 ;~ call AuxIO_TeletypeNL
366;~
367 ;~ mov si,offset db_tmpec
368 ;~ call AuxIO_Print
369 ;~ mov si,offset TmpSector
370 ;~ call AuxIO_DumpSector
371 ;~ call AuxIO_TeletypeNL
372 ;~ call AuxIO_TeletypeNL
373;~
374 ;~ mov si,offset db_partsec
375 ;~ call AuxIO_Print
376 ;~ mov si,offset PartitionSector
377 ;~ call AuxIO_DumpSector
378 ;~ call AuxIO_TeletypeNL
379 ;~ call AuxIO_TeletypeNL
380;~
381 ;~ popa
382 ;~ popf
383 ret
384DEBUG_Dump2 EndP
385
386
387
388db_mbr db "## MBR ##",10,0
389db_masterlvm db "## MLVMR ##",10,0
390
391db_checkmath db "## CHK MATH ##",10,0
392
393
394db_config db '## CFG (DMP2) ##',10,0
395db_cfgparts db 'CFG_Partitions:',0
396db_cfgpartdef db 'CFG_PartDefault:',0
397db_cfgpartlast db 'CFG_PartLast:',0
398
399
400db_vars db '## VARS ##',10,0
401db_partsec db 'PartitionSector:',10,0
402;db_lvmsec db 'LVMSector :',10,0
403db_tmpec db 'TmpSector :',10,0
404
405db_newpart db 'NewPartTable :',10,0
406db_newhide db 'NewHideTable:',10,0
407db_dletters db 'NewDriveLetters:',10,0
408
409;db_partsize db 'PartitionSizeTable:',10,0
410;db_partpoint db 'PartitionPointers:',10,0
411;db_partpointcnt db 'PartitionPointerCount:',0
412;db_partxref db 'PartitionXref:',10,0
413;db_partvoldl db 'PartitionVolumeLetters:',10,0
414
415;db_totaldisks db 'TotalHarddiscs:',0
416;db_lbaswitchtab db 'LBASwitchTable:',10,0
417;db_newparts db 'NewPartitions:',0
418
419;db_exabspos db 'ExtendedAbsPos:',0
420;db_exabsposset db 'ExtendedAbsPosSet:',0
421
422db_curpartloc db 'CurPartition_Location:',0
423;db_curiox db 'CurIO_UseExtension:',0
424
425db_curlvmsec db 'Current LVM Sector:',0
426
Note: See TracBrowser for help on using the repository browser.