source: trunk/bootcode/regular/debug.asm@ 91

Last change on this file since 91 was 91, checked in by Ben Rietbroek, 8 years ago

Dump Disk Information (debugging) [v1.1.1-testing]

CAUTION:
This is a testbuild !
AirBoot uses the BIOS to access disks and a small coding error can trash
partition tables or other vital disk structures. You are advised to make
backups of TRACK0 and EBRs before using this testbuild. More info at:
https://rousseaux.github.io/netlabs.air-boot/pdf/AirBoot-v1.1.0-manual.pdf

File size: 29.2 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. To compensate for that, the FX code is disabled when debugging
29; is active. Also, most of the debug-routines can selectively be disabled
30; by setting the 'IF' directive to 0 or 1. Setting to 0 does an immediate
31; return, setting to 1 enables the routine.
32
33
34
35IFDEF MODULE_NAMES
36DB 'DEBUG',0
37ENDIF
38
39
40
41;
42; Show help on keys.
43;
44dbh db 10
45 db 'h=HELP, d=DBGSCR-TOGGLE',10
46 db 'l=DRIVE-LETTERS, g=GEO, i=IPT, r=RESTART, v=VOL-LETTERS, x=XREF',10
47 db '0-9=disk 80h-89h info',10
48 db 10,0
49
50DEBUG_ShowHelp Proc
51 pushf
52 pusha
53 mov si, offset dbh
54 call AuxIO_Print
55 popa
56 popf
57 ret
58DEBUG_ShowHelp EndP
59
60
61
62;
63; Dispatch table for debug hot-keys.
64;
65dbg_dispatch:
66 db 't'
67 dw offset DEBUG_Test
68 db 'd'
69 dw offset DEBUG_DebugScreenToggle
70 db 'l'
71 dw offset DEBUG_DumpDriveLetters
72 db 'g'
73 dw offset DEBUG_DumpGeo
74 db 'h'
75 dw offset DEBUG_ShowHelp
76 db 'i'
77 dw offset DEBUG_DumpIPT
78 db 'r'
79 dw offset AirbootRestart
80 db 'v'
81 dw offset DEBUG_DumpVolumeLetters
82 db 'x'
83 dw offset DEBUG_DumpPartitionXref
84 db 'R'
85 dw offset AirbootRestart
86 db 0
87
88
89
90;
91; Show 'not assigned' message.
92;
93dbg_na db 'This key is not assigned, press ''h'' for Help.',10,0
94DEBUG_NotAssigned Proc
95 pushf
96 pusha
97 mov si,offset dbg_na
98 call AuxIO_Print
99 popa
100 popf
101 ret
102DEBUG_NotAssigned Endp
103
104
105; ============================================================== [ dump stuff ]
106
107;
108; Dump the geometry.
109;
110IF 0
111DEBUG_DumpGeo Proc
112 pushf
113 pusha
114
115 ; BIOS cyls
116 mov dx,word ptr [BIOS_Cyls+02]
117 mov ax,word ptr [BIOS_Cyls+00]
118 call AuxIO_TeletypeHexDWord
119 call AuxIO_TeletypeNL
120
121 ; BIOS heads
122 mov dx,word ptr [BIOS_Heads+02]
123 mov ax,word ptr [BIOS_Heads+00]
124 call AuxIO_TeletypeHexDWord
125 call AuxIO_TeletypeNL
126
127 ; BIOS secs
128 mov dx,word ptr [BIOS_Secs+02]
129 mov ax,word ptr [BIOS_Secs+00]
130 call AuxIO_TeletypeHexDWord
131 call AuxIO_TeletypeNL
132
133 ; Bytes per sector
134 mov ax,[BIOS_Bytes]
135 call AuxIO_TeletypeHexWord
136 call AuxIO_TeletypeNL
137
138 ; Total secs
139 mov bx, word ptr [BIOS_TotalSecs+06]
140 mov cx, word ptr [BIOS_TotalSecs+04]
141 mov dx, word ptr [BIOS_TotalSecs+02]
142 mov ax, word ptr [BIOS_TotalSecs+00]
143 call AuxIO_TeletypeHexDWord
144 call AuxIO_TeletypeNL
145
146 ; CHS to LBA
147 mov dx,1
148 mov ax,29e5h
149 mov bx,23h
150 mov cx,9h
151 call CONV_CHS2LBA
152 call AuxIO_TeletypeHexDWord
153 call AuxIO_TeletypeNL
154
155 popa
156 popf
157 ret
158DEBUG_DumpGeo Endp
159ELSE
160DEBUG_DumpGeo Proc
161 ret
162DEBUG_DumpGeo Endp
163ENDIF
164
165
166
167;
168; Dump the internal partition table.
169;
170IF 0
171DEBUG_DumpIPT Proc
172 pushf
173 pusha
174
175 call AuxIO_TeletypeNL
176
177 mov si,offset [BIOScontIPTentry]
178 ;~ mov si,offset [PartitionTable]
179 call AuxIO_DumpSector
180
181 popa
182 popf
183 ret
184DEBUG_DumpIPT EndP
185ELSE
186DEBUG_DumpIPT Proc
187 ret
188DEBUG_DumpIPT EndP
189ENDIF
190
191
192
193;
194; Dump the new partitions table.
195;
196IF 0
197DEBUG_DumpNewPartTable Proc
198 pushf
199 pusha
200
201 call AuxIO_TeletypeNL
202
203 mov si,offset [NewPartTable]
204 call AuxIO_DumpSector
205
206 popa
207 popf
208 ret
209DEBUG_DumpNewPartTable EndP
210DEBUG_DumpNewPartTable Proc
211 ret
212DEBUG_DumpNewPartTable EndP
213ENDIF
214
215
216
217;
218; Dump the partition pointers table.
219;
220IF 0
221DEBUG_DumpPartitionPointers Proc
222 pushf
223 pusha
224
225 call AuxIO_TeletypeNL
226
227 mov si,offset [PartitionPointers]
228 mov cx,7
229
230 DEBUG_DumpPartitionPointers_next:
231 call AuxIO_DumpParagraph
232 add si,16
233 call AuxIO_TeletypeNL
234 loop DEBUG_DumpPartitionPointers_next
235
236 popa
237 popf
238 ret
239DEBUG_DumpPartitionPointers EndP
240ELSE
241DEBUG_DumpPartitionPointers Proc
242 ret
243DEBUG_DumpPartitionPointers EndP
244ENDIF
245
246
247
248;
249; Dump the partition x-ref table.
250;
251IF 0
252xrt db 10,'XrefTable:',10,0
253DEBUG_DumpPartitionXref Proc
254 pushf
255 pusha
256
257 mov si, offset [xrt]
258 call AuxIO_Print
259 ;~ call AuxIO_TeletypeNL
260
261 mov si,offset [PartitionXref]
262 mov cx,3
263
264 DEBUG_DumpPartitionXref_next:
265 call AuxIO_DumpParagraph
266 add si,16
267 call AuxIO_TeletypeNL
268 loop DEBUG_DumpPartitionXref_next
269
270 popa
271 popf
272 ret
273DEBUG_DumpPartitionXref EndP
274ELSE
275DEBUG_DumpPartitionXref Proc
276 ret
277DEBUG_DumpPartitionXref EndP
278ENDIF
279
280
281
282;
283; Dump the dl-feature drive-letters.
284;
285IF 0
286ddl db 10,'Driveletters:',10,0
287DEBUG_DumpDriveLetters Proc
288 pushf
289 pusha
290
291 mov si, offset [ddl]
292 call AuxIO_Print
293
294 ; Dump the old drive-letters as set with the dl-feature.
295 mov si,offset [DriveLetters]
296 mov cx,3
297 DEBUG_DumpDriveLetters_next_1:
298 call AuxIO_DumpParagraph
299 add si,16
300 call AuxIO_TeletypeNL
301 loop DEBUG_DumpDriveLetters_next_1
302
303 ; Dump the new drive-letters as composed when scanning partitions
304 ; and partitions were added or removed.
305 mov si,offset [NewDriveLetters]
306 mov cx,3
307 DEBUG_DumpDriveLetters_next_2:
308 call AuxIO_DumpParagraph
309 add si,16
310 call AuxIO_TeletypeNL
311 loop DEBUG_DumpDriveLetters_next_2
312
313 popa
314 popf
315 ret
316DEBUG_DumpDriveLetters EndP
317ELSE
318DEBUG_DumpDriveLetters Proc
319 ret
320DEBUG_DumpDriveLetters EndP
321ENDIF
322
323
324
325;
326; Dump some disk information.
327;
328IF 1
329ddi db 10,'DumpDiskInfo:',10,0
330DEBUG_DumpDiskInfo Proc
331 pushf
332 pusha
333
334 ; ASCII '0' to BIOS 80h, '1'->81h, etc.
335 add al, 50h
336
337 mov si, offset [ddi]
338 call AuxIO_Print
339
340 ; Print disk-number
341 call AuxIO_TeletypeHexByte
342 call AuxIO_TeletypeNL
343
344 ; Show disk parameters (legacy version)
345 pusha
346 mov dl, al
347 mov ah, 08h
348 int 13h
349 call DEBUG_DumpRegisters
350 popa
351
352 ; Show status of last operation
353 pusha
354 mov dl, al
355 mov ah, 01
356 int 13h
357 mov al, ah
358 call AuxIO_TeletypeHexByte
359 call AuxIO_TeletypeNL
360 popa
361
362 popa
363 popf
364 ret
365DEBUG_DumpDiskInfo EndP
366ELSE
367DEBUG_DumpDiskInfo Proc
368 ret
369DEBUG_DumpDiskInfo EndP
370ENDIF
371
372
373
374;
375; Dump the lvm volume drive-letters.
376;
377IF 0
378dvl db 10,'VolumeLetters:',10,0
379DEBUG_DumpVolumeLetters Proc
380 pushf
381 pusha
382
383 mov si, offset [dvl]
384 call AuxIO_Print
385
386 mov si,offset [PartitionVolumeLetters]
387 mov cx,3
388
389 DEBUG_DumpVolumeLetters_next:
390 call AuxIO_DumpParagraph
391 add si,16
392 call AuxIO_TeletypeNL
393 loop DEBUG_DumpVolumeLetters_next
394
395 popa
396 popf
397 ret
398DEBUG_DumpVolumeLetters EndP
399ELSE
400DEBUG_DumpVolumeLetters Proc
401 ret
402DEBUG_DumpVolumeLetters EndP
403ENDIF
404
405
406
407;
408; Dump the registers and flags.
409;
410IF 1
411regAX db 'AX:',0
412regBX db ' BX:',0
413regCX db ' CX:',0
414regDX db ' DX:',0
415regSI db ' SI:',0
416regDI db ' DI:',0
417
418regBP db 'CS:',0
419regSP db ' DS:',0
420regCS db ' ES:',0
421regSS db ' SS:',0
422regDS db ' SP:',0
423regES db ' BP:',0
424
425regFS db 'FS:',0
426regGS db ' GS:',0
427
428 db ' '
429
430flagsSF db ' SF:',0
431flagsZF db ' ZF:',0
432flagsAF db ' AF:',0
433flagsPF db ' PF:',0
434flagsCF db ' CF:',0
435
436DEBUG_DumpRegisters Proc
437 pushf
438 pusha
439
440 ; Safe flags so they can be printed later
441 pushf
442
443 ; Save value in SI so it can be printed later
444 push si
445
446 ; Base of registers string
447 mov si, offset [regAX]
448
449 ; AX
450 call AuxIO_Print
451 call AuxIO_TeletypeHexWord
452
453 ; BX
454 call AuxIO_Print
455 mov ax,bx
456 call AuxIO_TeletypeHexWord
457
458 ; CX
459 call AuxIO_Print
460 mov ax,cx
461 call AuxIO_TeletypeHexWord
462
463 ; DX
464 call AuxIO_Print
465 mov ax,dx
466 call AuxIO_TeletypeHexWord
467
468 ; SI
469 call AuxIO_Print
470 pop ax
471 call AuxIO_TeletypeHexWord
472
473 ; DI
474 call AuxIO_Print
475 mov ax,di
476 call AuxIO_TeletypeHexWord
477
478 ; 1st row printed
479 call AuxIO_TeletypeNL
480
481 ; CS
482 call AuxIO_Print
483 mov ax,cs
484 call AuxIO_TeletypeHexWord
485
486 ; DS
487 call AuxIO_Print
488 mov ax,ds
489 call AuxIO_TeletypeHexWord
490
491 ; ES
492 call AuxIO_Print
493 mov ax,es
494 call AuxIO_TeletypeHexWord
495
496 ; SS
497 call AuxIO_Print
498 mov ax,ss
499 call AuxIO_TeletypeHexWord
500
501 ; SP
502 call AuxIO_Print
503 mov ax,sp
504 call AuxIO_TeletypeHexWord
505
506 ; BP
507 call AuxIO_Print
508 mov ax,bp
509 call AuxIO_TeletypeHexWord
510
511 ; 2nd row printed
512 call AuxIO_TeletypeNL
513.386
514 ; FS
515 call AuxIO_Print
516 mov ax,fs
517 call AuxIO_TeletypeHexWord
518
519 ; GS
520 call AuxIO_Print
521 mov ax,gs
522 call AuxIO_TeletypeHexWord
523 ;~ call AuxIO_TeletypeNL
524.286
525 ; Restore the flags
526 popf
527
528 ; Load flags into AH
529 lahf
530
531 ; Base of flags string
532 ;~ mov si, offset [flagsSF]
533
534 ; SF
535 call AuxIO_Print
536 mov al, ah
537 shr al, 7
538 and al, 01h
539 add al, '0'
540 call AuxIO_Teletype
541
542 ; ZF
543 call AuxIO_Print
544 mov al, ah
545 shr al, 6
546 and al, 01h
547 add al, '0'
548 call AuxIO_Teletype
549
550 ; AF
551 call AuxIO_Print
552 mov al, ah
553 shr al, 4
554 and al, 01h
555 add al, '0'
556 call AuxIO_Teletype
557
558 ; PF
559 call AuxIO_Print
560 mov al, ah
561 shr al, 2
562 and al, 01h
563 add al, '0'
564 call AuxIO_Teletype
565
566 ; CF
567 call AuxIO_Print
568 mov al, ah
569 and al, 01h
570 add al, '0'
571 call AuxIO_Teletype
572
573 ; 3rd and last row printed
574 call AuxIO_TeletypeNL
575
576 popa
577 popf
578 ret
579DEBUG_DumpRegisters EndP
580ELSE
581DEBUG_DumpRegisters Proc
582 ret
583DEBUG_DumpRegisters EndP
584ENDIF
585
586
587
588;
589; Dump CHS values.
590;
591IF 0
592DEBUG_DumpCHS Proc Near
593 pushf
594 pusha
595 mov al,'C'
596 call AuxIO_Teletype
597 mov al,':'
598 call AuxIO_Teletype
599 mov ah,cl
600 shr ah,6
601 mov al,ch
602 call AuxIO_TeletypeHexWord
603 mov al,' '
604 call AuxIO_Teletype
605 mov al,'H'
606 call AuxIO_Teletype
607 mov al,':'
608 call AuxIO_Teletype
609 mov al,dh
610 call AuxIO_TeletypeHexByte
611 mov al,' '
612 call AuxIO_Teletype
613 mov al,'S'
614 call AuxIO_Teletype
615 mov al,':'
616 call AuxIO_Teletype
617 mov al,cl
618 and al,00111111b
619 call AuxIO_TeletypeHexByte
620 call AuxIO_TeletypeNL
621 popa
622 popf
623 ret
624DEBUG_DumpCHS EndP
625ELSE
626DEBUG_DumpCHS Proc Near
627 ret
628DEBUG_DumpCHS EndP
629ENDIF
630
631
632
633;
634; Dump BSS.
635;
636IF 0
637DEBUG_DumpBSSSectors Proc Near
638 pushf
639 pusha
640
641 mov si, offset [PartitionSector]
642 call AuxIO_DumpSector
643 call AuxIO_TeletypeNL
644
645 mov si, offset [PBRSector]
646 call AuxIO_DumpSector
647 call AuxIO_TeletypeNL
648
649 mov si, offset [LVMSector]
650 call AuxIO_DumpSector
651 call AuxIO_TeletypeNL
652
653 mov si, offset [TmpSector]
654 call AuxIO_DumpSector
655 call AuxIO_TeletypeNL
656
657 mov si, offset [NewPartTable]
658 call AuxIO_DumpSector
659 call AuxIO_TeletypeNL
660 call AuxIO_TeletypeNL
661
662 popa
663 popf
664 ret
665DEBUG_DumpBSSSectors EndP
666ELSE
667DEBUG_DumpBSSSectors Proc Near
668 ret
669DEBUG_DumpBSSSectors EndP
670ENDIF
671
672
673
674;
675; Dump 6-bit packed hide partition table.
676;
677IF 0
678DEBUG_DumpHidePartTables Proc Near
679 pushf
680 pusha
681
682 mov cx,3
683 mov si, offset [HidePartitionTable]
684 again1:
685 call AuxIO_DumpSector
686 add si,512
687 loop again1
688 call AuxIO_TeletypeNL
689
690 mov cx,3
691 mov si, offset [PartitionXref]
692 again2:
693 call AuxIO_DumpParagraph
694 call AuxIO_TeletypeNL
695 add si,16
696 loop again2
697 call AuxIO_TeletypeNL
698
699 mov cx,3
700 mov si, offset [NewHidePartTable]
701 again3:
702 call AuxIO_DumpSector
703 add si,512
704 loop again3
705 call AuxIO_TeletypeNL
706
707 popa
708 popf
709 ret
710DEBUG_DumpHidePartTables EndP
711ELSE
712DEBUG_DumpHidePartTables Proc Near
713 ret
714DEBUG_DumpHidePartTables EndP
715ENDIF
716
717
718
719; ============================================================== [ test stuff ]
720
721;
722; Activate zero or more test functions.
723; When a call is _not_ commented out, the test-function can still be disabled
724; if its 'IF' directive is 0.
725;
726IF 1
727DEBUG_Test Proc
728 pushf
729 pusha
730 ;~ call DEBUG_Test_CONV_BinToPBCD
731 ;~ call DEBUG_Test_MATH_Mul32
732 popa
733 popf
734 ret
735DEBUG_Test EndP
736ELSE
737DEBUG_Test Proc
738 ret
739DEBUG_Test EndP
740ENDIF
741
742
743
744;
745; Test the packed BCD conversion function.
746;
747IF 0
748db_testbin2pbcd db "## TEST BIN2PBCD ##",10,0
749DEBUG_Test_CONV_BinToPBCD Proc
750 pushf
751 pusha
752
753 ; Msg test bin2pbcd
754 mov si,offset [db_testbin2pbcd]
755 call AuxIO_Print
756
757 ; Start with 0
758 xor cx, cx
759
760 ; Print 0 - 255 as BYTE and packed BCD
761 next_value:
762 mov al, cl ; Current value
763 call AuxIO_TeletypeHexByte ; Print as byte
764 mov al, ' '
765 call AuxIO_Teletype
766 mov al, cl ; Current value
767 call CONV_BinToPBCD ; Convert to packed BCD
768 call AuxIO_TeletypeHexWord ; Print as word
769 call AuxIO_TeletypeNL
770
771 inc cx ; Next value
772 cmp cx, 0ffh ; Check for last valid value
773 jbe next_value ; Repeat if still in range
774
775 popa
776 popf
777 ret
778DEBUG_Test_CONV_BinToPBCD EndP
779ELSE
780DEBUG_Test_CONV_BinToPBCD Proc
781 ret
782DEBUG_Test_CONV_BinToPBCD EndP
783ENDIF
784
785
786
787;
788; Test the simple 32-bit math functions.
789;
790IF 0
791db_testmul32 db "## TEST MUL32 ##",10,0
792DEBUG_Test_MATH_Mul32 Proc Near
793 pushf
794 pusha
795
796 ; Msg test math-module
797 mov si,offset [db_testmul32]
798 call AuxIO_Print
799
800 ; Output hex-word
801 mov ax,0BABEh
802 call AuxIO_TeletypeHexWord
803
804 mov al,' '
805 call AuxIO_Teletype
806 mov al,'*'
807 call AuxIO_Teletype
808 mov al,' '
809 call AuxIO_Teletype
810
811 ; Output hex-word
812 mov ax,0BABEh
813 call AuxIO_TeletypeHexWord
814
815 mov al,' '
816 call AuxIO_Teletype
817 mov al,'='
818 call AuxIO_Teletype
819 mov al,' '
820 call AuxIO_Teletype
821
822 mov ax,0BABEh
823 mul ax
824 call AuxIO_TeletypeHexDWord
825
826 ; Start new line
827 call AuxIO_TeletypeNL
828
829 ; Output hex-dword
830 mov dx,0DEADh
831 mov ax,0FACEh
832 call AuxIO_TeletypeHexDWord
833
834 mov al,' '
835 call AuxIO_Teletype
836 mov al,'*'
837 call AuxIO_Teletype
838 mov al,' '
839 call AuxIO_Teletype
840
841 ; Output hex-dword
842 mov dx,0DEADh
843 mov ax,0FACEh
844 call AuxIO_TeletypeHexDWord
845
846 mov al,' '
847 call AuxIO_Teletype
848 mov al,'='
849 call AuxIO_Teletype
850 mov al,' '
851 call AuxIO_Teletype
852
853 mov bx,0DEADh
854 mov cx,0FACEh
855 mov dx,0DEADh
856 mov ax,0FACEh
857 call MATH_Mul32
858 call AuxIO_TeletypeHexQWord
859
860 call AuxIO_TeletypeNL
861 call AuxIO_TeletypeNL
862
863 popa
864 popf
865 ret
866DEBUG_Test_MATH_Mul32 EndP
867ELSE
868DEBUG_Test_MATH_Mul32 Proc Near
869 ret
870DEBUG_Test_MATH_Mul32 EndP
871ENDIF
872
873
874
875;
876; Test the bitfield routines.
877;
878IF 0
879DEBUG_TestBitFieldFunctions Proc
880 pushf
881 pusha
882
883 mov bx,offset [dbg_scratch]
884
885 mov al,0
886 mov dl,0
887 mov dh,6
888 DEBUG_TestBitFieldFunctions_next_write:
889 call CONV_SetBitfieldValue
890 inc al
891 inc dl
892 jnz DEBUG_TestBitFieldFunctions_next_write
893
894 mov dl,0
895 mov dh,6
896 DEBUG_TestBitFieldFunctions_next_read:
897 mov al,dl
898 call AuxIO_TeletypeHexByte
899 mov al,':'
900 call AuxIO_Teletype
901 call CONV_GetBitfieldValue
902 call AuxIO_TeletypeHexWord
903 call AuxIO_TeletypeNL
904 inc dl
905 jnz DEBUG_TestBitFieldFunctions_next_read
906
907 popa
908 popf
909 ret
910DEBUG_TestBitFieldFunctions EndP
911ELSE
912DEBUG_TestBitFieldFunctions Proc
913 ret
914DEBUG_TestBitFieldFunctions EndP
915ENDIF
916
917
918
919;
920; Like the MBR version, but uses video page 3.
921;
922DBG_Teletype Proc Near Uses ax bx cx
923 mov ah, 0Eh
924 mov bh, 03h
925 mov bl, 07h
926 DBGT_Loop:
927 lodsb
928 or al, al
929 jz DBGT_End
930 int 10h
931 jmp DBGT_Loop
932 DBGT_End:
933 ret
934DBG_Teletype EndP
935
936
937
938;
939; Dump information before the menu is displayed.
940;
941DEBUG_Dump1 Proc Near
942 pushf
943 pusha
944
945 ; Hello message
946 mov si, offset AuxIOHello
947 call AuxIO_Print
948
949 ; Build Info
950 ;~ mov si, offset BUILD_DATE
951 ;~ call AuxIO_Print
952 call AuxIO_PrintBuildInfo
953
954 ; Start new line
955 call AuxIO_TeletypeNL
956 ;~ call AuxIO_TeletypeNL
957
958 ;~ call DEBUG_DumpHidePartTables
959 ;~ call DEBUG_CheckMath
960 ;~ call DEBUG_DumpGeo
961 ;~ call DEBUG_CheckBitFields
962
963 popa
964 popf
965 ret
966DEBUG_Dump1 EndP
967
968
969
970;
971; Dump information before the partition is booted.
972;
973IF 0
974DEBUG_Dump2 Proc Near
975 pushf
976 pusha
977
978 call AuxIO_TeletypeNL
979 call AuxIO_TeletypeNL
980
981 mov si,offset db_config
982 call AuxIO_Print
983
984 mov si,offset db_cfgparts
985 call AuxIO_Print
986 mov al,[CFG_Partitions]
987 call AuxIO_TeletypeHexByte
988 call AuxIO_TeletypeNL
989
990 mov si,offset db_cfgpartdef
991 call AuxIO_Print
992 mov al,[CFG_PartDefault]
993 call AuxIO_TeletypeHexByte
994 call AuxIO_TeletypeNL
995
996 mov si,offset db_cfgpartlast
997 call AuxIO_Print
998 mov al,[CFG_PartLast]
999 call AuxIO_TeletypeHexByte
1000 call AuxIO_TeletypeNL
1001 call AuxIO_TeletypeNL
1002
1003 mov si,offset db_vars
1004 call AuxIO_Print
1005
1006 mov si,offset db_newpart
1007 call AuxIO_Print
1008 mov si,offset NewPartTable
1009 call AuxIO_DumpSector
1010 call AuxIO_TeletypeNL
1011 add si,512
1012 call AuxIO_DumpSector
1013 call AuxIO_TeletypeNL
1014 call AuxIO_TeletypeNL
1015
1016 mov si,offset db_newhide
1017 call AuxIO_Print
1018 mov si,offset NewHidePartTable
1019 call AuxIO_DumpSector
1020 call AuxIO_TeletypeNL
1021 add si,512
1022 call AuxIO_DumpSector
1023 call AuxIO_TeletypeNL
1024 call AuxIO_TeletypeNL
1025
1026 mov si,offset db_dletters
1027 call AuxIO_Print
1028 mov si,offset NewDriveLetters
1029 call AuxIO_DumpParagraph
1030 call AuxIO_TeletypeNL
1031 add si,16
1032 call AuxIO_DumpParagraph
1033 call AuxIO_TeletypeNL
1034 call AuxIO_TeletypeNL
1035
1036 mov si,offset db_tmpec
1037 call AuxIO_Print
1038 mov si,offset TmpSector
1039 call AuxIO_DumpSector
1040 call AuxIO_TeletypeNL
1041 call AuxIO_TeletypeNL
1042
1043 mov si,offset db_partsec
1044 call AuxIO_Print
1045 mov si,offset PartitionSector
1046 call AuxIO_DumpSector
1047 call AuxIO_TeletypeNL
1048 call AuxIO_TeletypeNL
1049
1050 popa
1051 popf
1052 ret
1053DEBUG_Dump2 EndP
1054ELSE
1055DEBUG_Dump2 Proc Near
1056 ret
1057DEBUG_Dump2 EndP
1058ENDIF
1059
1060
1061
1062;
1063; Display a number that was put on the stack.
1064; Used to track code-flow.
1065;
1066dbp db '>---------->> DebugProbe: ',0
1067DEBUG_Probe Proc
1068 push bp
1069 mov bp,sp
1070 pushf
1071 pusha
1072
1073 mov si,offset [dbp] ; Default probe-text.
1074 call AuxIO_Print
1075 mov ax,[bp+04] ; Get probe-number from stack.
1076 call AuxIO_TeletypeHexWord
1077 call AuxIO_TeletypeNL
1078
1079 ; Also display registers.
1080 popa
1081 pusha
1082 call DEBUG_DumpRegisters
1083
1084 popa
1085 popf
1086 pop bp
1087 ret 2
1088DEBUG_Probe Endp
1089
1090
1091
1092;
1093; Toggle display of debug video page.
1094;
1095IF 0
1096DEBUG_DebugScreenToggle Proc
1097 pushf
1098 pusha
1099
1100 mov si, offset $+5
1101 jmp @F
1102 db 10,'DebugScreenToggle:',10,0
1103prvpg db 00h
1104hdr db 10,'[Debug Console]',13,10,0
1105@@: call AuxIO_Print
1106
1107 ; Get current page in BH
1108 mov ah, 0fh
1109 int 10h
1110
1111 ; Already debug page ?
1112 cmp bh, 03h
1113 je DEBUG_DebugScreenToggle_back
1114
1115 ; Remember page
1116 mov [prvpg], bh
1117
1118 ; Switch to debug page
1119 mov al, 03h
1120 mov ah, 05h
1121 int 10h
1122
1123 ; Get cursor position in DX (DH=row, DL=column)
1124 ;~ mov ah, 03h
1125 ;~ mov bh, 03h
1126 ;~ int 10h
1127
1128 ;~ mov al, 01h
1129 ;~ mov bh, 03h
1130 ;~ mov bl, 07h
1131 ;~ mov bp, offset [hdr]
1132 ;~ mov cx, sizeof(hdr)
1133 ;~ mov ah, 13h
1134 ;~ int 10h
1135
1136 ;~ mov bh, 03h
1137 ;~ mov dh, 00h
1138 ;~ mov dl, 00h
1139 ;~ mov ah, 02h
1140 ;~ int 10h
1141
1142 mov si, offset [hdr]
1143 call DBG_Teletype
1144
1145 jmp DEBUG_DebugScreenToggle_end
1146
1147 DEBUG_DebugScreenToggle_back:
1148 ; Switch back to previous page
1149 mov al, [prvpg]
1150 mov ah, 05h
1151 int 10h
1152 jmp DEBUG_DebugScreenToggle_end
1153
1154 DEBUG_DebugScreenToggle_end:
1155 popa
1156 popf
1157 ret
1158DEBUG_DebugScreenToggle EndP
1159ELSE
1160DEBUG_DebugScreenToggle Proc
1161 ret
1162DEBUG_DebugScreenToggle EndP
1163ENDIF
1164
1165
1166
1167;
1168; Handle keypresses when the main menu is active.
1169;
1170DEBUG_HandleKeypress Proc
1171 pushf
1172 pusha
1173
1174 ; Save hot-key
1175 mov dl,al
1176
1177 ; Check for digit.
1178 cmp al,'0'
1179 jb DEBUG_HandleKeypress_exit
1180 cmp al,'9'
1181 ja DEBUG_HandleKeypress_try_alpha
1182 ; It was a digit, dump disk info ('0' for 80h, '1' for 81h, etc)
1183 call DEBUG_DumpDiskInfo
1184 ;~ jmp DEBUG_HandleKeypress_check_it
1185 jmp DEBUG_HandleKeypress_exit
1186
1187 ; Check for alpha.
1188 DEBUG_HandleKeypress_try_alpha:
1189 ; Force upper-case.
1190 and al,11011111b
1191 cmp al,'A'
1192 jb DEBUG_HandleKeypress_exit
1193 cmp al,'Z'
1194 ja DEBUG_HandleKeypress_exit
1195 ; It was an alpha.
1196 jmp DEBUG_HandleKeypress_check_it
1197
1198
1199 ; Check if the key is a hot-key.
1200 DEBUG_HandleKeypress_check_it:
1201 cld
1202 mov si,offset dbg_dispatch
1203
1204 ; Loop over jump-list.
1205 DEBUG_HandleKeypress_next_entry:
1206
1207 ; Load the hot-key.
1208 lodsb
1209 ; No hot-key (not implemented) if end-of-list.
1210 test al,al
1211 jz DEBUG_HandleKeypress_ni
1212
1213 ; Compare hot-key and iterate if not the same.
1214 cmp dl,al
1215 lodsw
1216 jne DEBUG_HandleKeypress_next_entry
1217
1218 ; Entry found, call corresponding routine.
1219 mov bx,ax
1220 call bx
1221
1222 ; Done.
1223 jmp DEBUG_HandleKeypress_exit
1224
1225 ; Call not-assigned routine.
1226 DEBUG_HandleKeypress_ni:
1227 call DEBUG_NotAssigned
1228 jmp DEBUG_HandleKeypress_exit
1229
1230 ; Return to caller.
1231 DEBUG_HandleKeypress_exit:
1232 popa
1233 popf
1234 ret
1235DEBUG_HandleKeypress Endp
1236
1237
1238
1239;
1240; These strings can also be referenced outside the debug module when debugging
1241; is enabled.
1242;
1243dlra db 10,'LVM_DoLetterReassignment: ',0
1244ptetb db 10,'Partition Table Entry to boot',10,0
1245bios_reg db 10,'Registers passed by BIOS:',10,0
1246;~ diopmbr db 10,'DriveIO_ProtectMBR',10,0
1247dioss db 10,'DriveIO_SaveSector',10,0
1248
1249
1250;~ db_mbr db "## MBR ##",10,0
1251;~ db_masterlvm db "## MLVMR ##",10,0
1252
1253
1254;~ db_config db '## CFG (DMP2) ##',10,0
1255;~ db_cfgparts db 'CFG_Partitions:',0
1256;~ db_cfgpartdef db 'CFG_PartDefault:',0
1257;~ db_cfgpartlast db 'CFG_PartLast:',0
1258
1259
1260;~ db_vars db '## VARS ##',10,0
1261;~ db_partsec db 'PartitionSector:',10,0
1262;~ db_lvmsec db 'LVMSector :',10,0
1263;~ db_tmpec db 'TmpSector :',10,0
1264
1265;~ db_newpart db 'NewPartTable :',10,0
1266;~ db_newhide db 'NewHideTable:',10,0
1267;~ db_dletters db 'NewDriveLetters:',10,0
1268
1269;~ db_partsize db 'PartitionSizeTable:',10,0
1270;~ db_partpoint db 'PartitionPointers:',10,0
1271;~ db_partpointcnt db 'PartitionPointerCount:',0
1272;~ db_partxref db 'PartitionXref:',10,0
1273;~ db_partvoldl db 'PartitionVolumeLetters:',10,0
1274
1275;~ db_totaldisks db 'TotalHarddiscs:',0
1276;~ db_lbaswitchtab db 'LBASwitchTable:',10,0
1277;~ db_newparts db 'NewPartitions:',0
1278
1279;~ db_exabspos db 'ExtendedAbsPos:',0
1280;~ db_exabsposset db 'ExtendedAbsPosSet:',0
1281
1282;~ db_curpartloc db 'CurPartition_Location:',0
1283;~ db_curiox db 'CurIO_UseExtension:',0
1284
1285;~ db_curlvmsec db 'Current LVM Sector:',0
1286
1287
1288;~ drive db 'drive : ',0
1289;~ before_lvm_adjust db 'before lvm adjust : ',0
1290;~ after_lvm_adjust db 'after lvm adjust : ',0
1291;~ before_lvm_adjust_log db 'before lvm logical adjust: ',0
1292;~ after_lvm_adjust_log db 'after lvm logical adjust : ',0
1293;~ spt_used db 'spt used : ',0
Note: See TracBrowser for help on using the repository browser.