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

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

Reordered debug-module a bit [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: 27.6 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 0
329ddi db 10,'DumpDiskInfo:',10,0
330DEBUG_DumpDiskInfo Proc
331 pushf
332 pusha
333
334 add al, 50h ; ASCII '0' to BIOS 80h, '1'->81h, etc.
335
336 mov si, offset [ddi]
337 call AuxIO_Print
338
339 call AuxIO_TeletypeHexByte
340 call AuxIO_TeletypeNL
341
342 popa
343 popf
344 ret
345DEBUG_DumpDiskInfo EndP
346ELSE
347DEBUG_DumpDiskInfo Proc
348 ret
349DEBUG_DumpDiskInfo EndP
350ENDIF
351
352
353
354;
355; Dump the lvm volume drive-letters.
356;
357IF 0
358dvl db 10,'VolumeLetters:',10,0
359DEBUG_DumpVolumeLetters Proc
360 pushf
361 pusha
362
363 mov si, offset [dvl]
364 call AuxIO_Print
365
366 mov si,offset [PartitionVolumeLetters]
367 mov cx,3
368
369 DEBUG_DumpVolumeLetters_next:
370 call AuxIO_DumpParagraph
371 add si,16
372 call AuxIO_TeletypeNL
373 loop DEBUG_DumpVolumeLetters_next
374
375 popa
376 popf
377 ret
378DEBUG_DumpVolumeLetters EndP
379ELSE
380DEBUG_DumpVolumeLetters Proc
381 ret
382DEBUG_DumpVolumeLetters EndP
383ENDIF
384
385
386
387;
388; Dump the registers.
389;
390IF 1
391regAX db 'AX:',0
392regBX db ' BX:',0
393regCX db ' CX:',0
394regDX db ' DX:',0
395regSI db ' SI:',0
396regDI db ' DI:',0
397
398regBP db 'CS:',0
399regSP db ' DS:',0
400regCS db ' ES:',0
401regSS db ' SS:',0
402regDS db ' SP:',0
403regES db ' BP:',0
404
405;~ regFS db 'FS:',0
406;~ regGS db ' GS:',0
407DEBUG_DumpRegisters Proc
408 pushf
409 pusha
410
411 push si
412 mov si, offset [regAX]
413 call AuxIO_Print
414 call AuxIO_TeletypeHexWord
415 ;~ call AuxIO_TeletypeNL
416
417 call AuxIO_Print
418 mov ax,bx
419 call AuxIO_TeletypeHexWord
420 ;~ call AuxIO_TeletypeNL
421
422 call AuxIO_Print
423 mov ax,cx
424 call AuxIO_TeletypeHexWord
425 ;~ call AuxIO_TeletypeNL
426
427 call AuxIO_Print
428 mov ax,dx
429 call AuxIO_TeletypeHexWord
430 ;~ call AuxIO_TeletypeNL
431
432 call AuxIO_Print
433 pop ax
434 call AuxIO_TeletypeHexWord
435 ;~ call AuxIO_TeletypeNL
436
437 call AuxIO_Print
438 mov ax,di
439 call AuxIO_TeletypeHexWord
440 call AuxIO_TeletypeNL
441
442
443
444 call AuxIO_Print
445 mov ax,cs
446 call AuxIO_TeletypeHexWord
447 ;~ call AuxIO_TeletypeNL
448
449 call AuxIO_Print
450 mov ax,ds
451 call AuxIO_TeletypeHexWord
452 ;~ call AuxIO_TeletypeNL
453
454 call AuxIO_Print
455 mov ax,es
456 call AuxIO_TeletypeHexWord
457 ;~ call AuxIO_TeletypeNL
458
459 call AuxIO_Print
460 mov ax,ss
461 call AuxIO_TeletypeHexWord
462 ;~ call AuxIO_TeletypeNL
463
464 call AuxIO_Print
465 mov ax,sp
466 call AuxIO_TeletypeHexWord
467 ;~ call AuxIO_TeletypeNL
468
469 call AuxIO_Print
470 mov ax,bp
471 call AuxIO_TeletypeHexWord
472 call AuxIO_TeletypeNL
473
474 ;~ call AuxIO_Print
475 ;~ mov ax,fs
476 ;~ call AuxIO_TeletypeHexWord
477 ;~ call AuxIO_TeletypeNL
478
479 ;~ call AuxIO_Print
480 ;~ mov ax,gs
481 ;~ call AuxIO_TeletypeHexWord
482 ;~ call AuxIO_TeletypeNL
483
484 call AuxIO_TeletypeNL
485
486 popa
487 popf
488 ret
489DEBUG_DumpRegisters EndP
490ELSE
491DEBUG_DumpRegisters Proc
492 ret
493DEBUG_DumpRegisters EndP
494ENDIF
495
496
497
498;
499; Dump CHS values.
500;
501IF 0
502DEBUG_DumpCHS Proc Near
503 pushf
504 pusha
505 mov al,'C'
506 call AuxIO_Teletype
507 mov al,':'
508 call AuxIO_Teletype
509 mov ah,cl
510 shr ah,6
511 mov al,ch
512 call AuxIO_TeletypeHexWord
513 mov al,' '
514 call AuxIO_Teletype
515 mov al,'H'
516 call AuxIO_Teletype
517 mov al,':'
518 call AuxIO_Teletype
519 mov al,dh
520 call AuxIO_TeletypeHexByte
521 mov al,' '
522 call AuxIO_Teletype
523 mov al,'S'
524 call AuxIO_Teletype
525 mov al,':'
526 call AuxIO_Teletype
527 mov al,cl
528 and al,00111111b
529 call AuxIO_TeletypeHexByte
530 call AuxIO_TeletypeNL
531 popa
532 popf
533 ret
534DEBUG_DumpCHS EndP
535ELSE
536DEBUG_DumpCHS Proc Near
537 ret
538DEBUG_DumpCHS EndP
539ENDIF
540
541
542
543;
544; Dump BSS.
545;
546IF 0
547DEBUG_DumpBSSSectors Proc Near
548 pushf
549 pusha
550
551 mov si, offset [PartitionSector]
552 call AuxIO_DumpSector
553 call AuxIO_TeletypeNL
554
555 mov si, offset [PBRSector]
556 call AuxIO_DumpSector
557 call AuxIO_TeletypeNL
558
559 mov si, offset [LVMSector]
560 call AuxIO_DumpSector
561 call AuxIO_TeletypeNL
562
563 mov si, offset [TmpSector]
564 call AuxIO_DumpSector
565 call AuxIO_TeletypeNL
566
567 mov si, offset [NewPartTable]
568 call AuxIO_DumpSector
569 call AuxIO_TeletypeNL
570 call AuxIO_TeletypeNL
571
572 popa
573 popf
574 ret
575DEBUG_DumpBSSSectors EndP
576ELSE
577DEBUG_DumpBSSSectors Proc Near
578 ret
579DEBUG_DumpBSSSectors EndP
580ENDIF
581
582
583
584;
585; Dump 6-bit packed hide partition table.
586;
587IF 0
588DEBUG_DumpHidePartTables Proc Near
589 pushf
590 pusha
591
592 mov cx,3
593 mov si, offset [HidePartitionTable]
594 again1:
595 call AuxIO_DumpSector
596 add si,512
597 loop again1
598 call AuxIO_TeletypeNL
599
600 mov cx,3
601 mov si, offset [PartitionXref]
602 again2:
603 call AuxIO_DumpParagraph
604 call AuxIO_TeletypeNL
605 add si,16
606 loop again2
607 call AuxIO_TeletypeNL
608
609 mov cx,3
610 mov si, offset [NewHidePartTable]
611 again3:
612 call AuxIO_DumpSector
613 add si,512
614 loop again3
615 call AuxIO_TeletypeNL
616
617 popa
618 popf
619 ret
620DEBUG_DumpHidePartTables EndP
621ELSE
622DEBUG_DumpHidePartTables Proc Near
623 ret
624DEBUG_DumpHidePartTables EndP
625ENDIF
626
627
628
629; ============================================================== [ test stuff ]
630
631;
632; Activate zero or more test functions.
633; When a call is _not_ commented out, the test-function can still be disabled
634; if its 'IF' directive is 0.
635;
636IF 1
637DEBUG_Test Proc
638 pushf
639 pusha
640 call DEBUG_Test_CONV_BinToPBCD
641 ;~ call DEBUG_Test_MATH_Mul32
642 popa
643 popf
644 ret
645DEBUG_Test EndP
646ELSE
647DEBUG_Test Proc
648 ret
649DEBUG_Test EndP
650ENDIF
651
652
653
654;
655; Test the packed BCD conversion function.
656;
657IF 1
658db_testbin2pbcd db "## TEST BIN2PBCD ##",10,0
659DEBUG_Test_CONV_BinToPBCD Proc
660 pushf
661 pusha
662
663 ; Msg test bin2pbcd
664 mov si,offset [db_testbin2pbcd]
665 call AuxIO_Print
666
667 ; Start with 0
668 xor cx, cx
669
670 ; Print 0 - 255 as BYTE and packed BCD
671 next_value:
672 mov al, cl ; Current value
673 call AuxIO_TeletypeHexByte ; Print as byte
674 mov al, ' '
675 call AuxIO_Teletype
676 mov al, cl ; Current value
677 call CONV_BinToPBCD ; Convert to packed BCD
678 call AuxIO_TeletypeHexWord ; Print as word
679 call AuxIO_TeletypeNL
680
681 inc cx ; Next value
682 cmp cx, 0ffh ; Check for last valid value
683 jbe next_value ; Repeat if still in range
684
685 popa
686 popf
687 ret
688DEBUG_Test_CONV_BinToPBCD EndP
689ELSE
690DEBUG_Test_CONV_BinToPBCD Proc
691 ret
692DEBUG_Test_CONV_BinToPBCD EndP
693ENDIF
694
695
696
697;
698; Test the simple 32-bit math functions.
699;
700IF 0
701db_testmul32 db "## TEST MUL32 ##",10,0
702DEBUG_Test_MATH_Mul32 Proc Near
703 pushf
704 pusha
705
706 ; Msg test math-module
707 mov si,offset [db_testmul32]
708 call AuxIO_Print
709
710 ; Output hex-word
711 mov ax,0BABEh
712 call AuxIO_TeletypeHexWord
713
714 mov al,' '
715 call AuxIO_Teletype
716 mov al,'*'
717 call AuxIO_Teletype
718 mov al,' '
719 call AuxIO_Teletype
720
721 ; Output hex-word
722 mov ax,0BABEh
723 call AuxIO_TeletypeHexWord
724
725 mov al,' '
726 call AuxIO_Teletype
727 mov al,'='
728 call AuxIO_Teletype
729 mov al,' '
730 call AuxIO_Teletype
731
732 mov ax,0BABEh
733 mul ax
734 call AuxIO_TeletypeHexDWord
735
736 ; Start new line
737 call AuxIO_TeletypeNL
738
739 ; Output hex-dword
740 mov dx,0DEADh
741 mov ax,0FACEh
742 call AuxIO_TeletypeHexDWord
743
744 mov al,' '
745 call AuxIO_Teletype
746 mov al,'*'
747 call AuxIO_Teletype
748 mov al,' '
749 call AuxIO_Teletype
750
751 ; Output hex-dword
752 mov dx,0DEADh
753 mov ax,0FACEh
754 call AuxIO_TeletypeHexDWord
755
756 mov al,' '
757 call AuxIO_Teletype
758 mov al,'='
759 call AuxIO_Teletype
760 mov al,' '
761 call AuxIO_Teletype
762
763 mov bx,0DEADh
764 mov cx,0FACEh
765 mov dx,0DEADh
766 mov ax,0FACEh
767 call MATH_Mul32
768 call AuxIO_TeletypeHexQWord
769
770 call AuxIO_TeletypeNL
771 call AuxIO_TeletypeNL
772
773 popa
774 popf
775 ret
776DEBUG_Test_MATH_Mul32 EndP
777ELSE
778DEBUG_Test_MATH_Mul32 Proc Near
779 ret
780DEBUG_Test_MATH_Mul32 EndP
781ENDIF
782
783
784
785;
786; Test the bitfield routines.
787;
788IF 0
789DEBUG_TestBitFieldFunctions Proc
790 pushf
791 pusha
792
793 mov bx,offset [dbg_scratch]
794
795 mov al,0
796 mov dl,0
797 mov dh,6
798 DEBUG_TestBitFieldFunctions_next_write:
799 call CONV_SetBitfieldValue
800 inc al
801 inc dl
802 jnz DEBUG_TestBitFieldFunctions_next_write
803
804 mov dl,0
805 mov dh,6
806 DEBUG_TestBitFieldFunctions_next_read:
807 mov al,dl
808 call AuxIO_TeletypeHexByte
809 mov al,':'
810 call AuxIO_Teletype
811 call CONV_GetBitfieldValue
812 call AuxIO_TeletypeHexWord
813 call AuxIO_TeletypeNL
814 inc dl
815 jnz DEBUG_TestBitFieldFunctions_next_read
816
817 popa
818 popf
819 ret
820DEBUG_TestBitFieldFunctions EndP
821ELSE
822DEBUG_TestBitFieldFunctions Proc
823 ret
824DEBUG_TestBitFieldFunctions EndP
825ENDIF
826
827
828
829;
830; Like the MBR version, but uses video page 3.
831;
832DBG_Teletype Proc Near Uses ax bx cx
833 mov ah, 0Eh
834 mov bh, 03h
835 mov bl, 07h
836 DBGT_Loop:
837 lodsb
838 or al, al
839 jz DBGT_End
840 int 10h
841 jmp DBGT_Loop
842 DBGT_End:
843 ret
844DBG_Teletype EndP
845
846
847
848;
849; Dump information before the menu is displayed.
850;
851DEBUG_Dump1 Proc Near
852 pushf
853 pusha
854
855 ; Hello message
856 mov si, offset AuxIOHello
857 call AuxIO_Print
858
859 ; Build Info
860 ;~ mov si, offset BUILD_DATE
861 ;~ call AuxIO_Print
862 call AuxIO_PrintBuildInfo
863
864 ; Start new line
865 call AuxIO_TeletypeNL
866 ;~ call AuxIO_TeletypeNL
867
868 ;~ call DEBUG_DumpHidePartTables
869 ;~ call DEBUG_CheckMath
870 ;~ call DEBUG_DumpGeo
871 ;~ call DEBUG_CheckBitFields
872
873 popa
874 popf
875 ret
876DEBUG_Dump1 EndP
877
878
879
880;
881; Dump information before the partition is booted.
882;
883IF 0
884DEBUG_Dump2 Proc Near
885 pushf
886 pusha
887
888 call AuxIO_TeletypeNL
889 call AuxIO_TeletypeNL
890
891 mov si,offset db_config
892 call AuxIO_Print
893
894 mov si,offset db_cfgparts
895 call AuxIO_Print
896 mov al,[CFG_Partitions]
897 call AuxIO_TeletypeHexByte
898 call AuxIO_TeletypeNL
899
900 mov si,offset db_cfgpartdef
901 call AuxIO_Print
902 mov al,[CFG_PartDefault]
903 call AuxIO_TeletypeHexByte
904 call AuxIO_TeletypeNL
905
906 mov si,offset db_cfgpartlast
907 call AuxIO_Print
908 mov al,[CFG_PartLast]
909 call AuxIO_TeletypeHexByte
910 call AuxIO_TeletypeNL
911 call AuxIO_TeletypeNL
912
913 mov si,offset db_vars
914 call AuxIO_Print
915
916 mov si,offset db_newpart
917 call AuxIO_Print
918 mov si,offset NewPartTable
919 call AuxIO_DumpSector
920 call AuxIO_TeletypeNL
921 add si,512
922 call AuxIO_DumpSector
923 call AuxIO_TeletypeNL
924 call AuxIO_TeletypeNL
925
926 mov si,offset db_newhide
927 call AuxIO_Print
928 mov si,offset NewHidePartTable
929 call AuxIO_DumpSector
930 call AuxIO_TeletypeNL
931 add si,512
932 call AuxIO_DumpSector
933 call AuxIO_TeletypeNL
934 call AuxIO_TeletypeNL
935
936 mov si,offset db_dletters
937 call AuxIO_Print
938 mov si,offset NewDriveLetters
939 call AuxIO_DumpParagraph
940 call AuxIO_TeletypeNL
941 add si,16
942 call AuxIO_DumpParagraph
943 call AuxIO_TeletypeNL
944 call AuxIO_TeletypeNL
945
946 mov si,offset db_tmpec
947 call AuxIO_Print
948 mov si,offset TmpSector
949 call AuxIO_DumpSector
950 call AuxIO_TeletypeNL
951 call AuxIO_TeletypeNL
952
953 mov si,offset db_partsec
954 call AuxIO_Print
955 mov si,offset PartitionSector
956 call AuxIO_DumpSector
957 call AuxIO_TeletypeNL
958 call AuxIO_TeletypeNL
959
960 popa
961 popf
962 ret
963DEBUG_Dump2 EndP
964ELSE
965DEBUG_Dump2 Proc Near
966 ret
967DEBUG_Dump2 EndP
968ENDIF
969
970
971
972;
973; Display a number that was put on the stack.
974; Used to track code-flow.
975;
976dbp db '>---------->> DebugProbe: ',0
977DEBUG_Probe Proc
978 push bp
979 mov bp,sp
980 pushf
981 pusha
982
983 mov si,offset [dbp] ; Default probe-text.
984 call AuxIO_Print
985 mov ax,[bp+04] ; Get probe-number from stack.
986 call AuxIO_TeletypeHexWord
987 call AuxIO_TeletypeNL
988
989 ; Also display registers.
990 popa
991 pusha
992 call DEBUG_DumpRegisters
993
994 popa
995 popf
996 pop bp
997 ret 2
998DEBUG_Probe Endp
999
1000
1001
1002;
1003; Toggle display of debug video page.
1004;
1005IF 0
1006DEBUG_DebugScreenToggle Proc
1007 pushf
1008 pusha
1009
1010 mov si, offset $+5
1011 jmp @F
1012 db 10,'DebugScreenToggle:',10,0
1013prvpg db 00h
1014hdr db 10,'[Debug Console]',13,10,0
1015@@: call AuxIO_Print
1016
1017 ; Get current page in BH
1018 mov ah, 0fh
1019 int 10h
1020
1021 ; Already debug page ?
1022 cmp bh, 03h
1023 je DEBUG_DebugScreenToggle_back
1024
1025 ; Remember page
1026 mov [prvpg], bh
1027
1028 ; Switch to debug page
1029 mov al, 03h
1030 mov ah, 05h
1031 int 10h
1032
1033 ; Get cursor position in DX (DH=row, DL=column)
1034 ;~ mov ah, 03h
1035 ;~ mov bh, 03h
1036 ;~ int 10h
1037
1038 ;~ mov al, 01h
1039 ;~ mov bh, 03h
1040 ;~ mov bl, 07h
1041 ;~ mov bp, offset [hdr]
1042 ;~ mov cx, sizeof(hdr)
1043 ;~ mov ah, 13h
1044 ;~ int 10h
1045
1046 ;~ mov bh, 03h
1047 ;~ mov dh, 00h
1048 ;~ mov dl, 00h
1049 ;~ mov ah, 02h
1050 ;~ int 10h
1051
1052 mov si, offset [hdr]
1053 call DBG_Teletype
1054
1055 jmp DEBUG_DebugScreenToggle_end
1056
1057 DEBUG_DebugScreenToggle_back:
1058 ; Switch back to previous page
1059 mov al, [prvpg]
1060 mov ah, 05h
1061 int 10h
1062 jmp DEBUG_DebugScreenToggle_end
1063
1064 DEBUG_DebugScreenToggle_end:
1065 popa
1066 popf
1067 ret
1068DEBUG_DebugScreenToggle EndP
1069ELSE
1070DEBUG_DebugScreenToggle Proc
1071 ret
1072DEBUG_DebugScreenToggle EndP
1073ENDIF
1074
1075
1076
1077;
1078; Handle keypresses when the main menu is active.
1079;
1080DEBUG_HandleKeypress Proc
1081 pushf
1082 pusha
1083
1084 ; Save hot-key
1085 mov dl,al
1086
1087 ; Check for digit.
1088 cmp al,'0'
1089 jb DEBUG_HandleKeypress_exit
1090 cmp al,'9'
1091 ja DEBUG_HandleKeypress_try_alpha
1092 ; It was a digit, dump disk info ('0' for 80h, '1' for 81h, etc)
1093 call DEBUG_DumpDiskInfo
1094 ;~ jmp DEBUG_HandleKeypress_check_it
1095 jmp DEBUG_HandleKeypress_exit
1096
1097 ; Check for alpha.
1098 DEBUG_HandleKeypress_try_alpha:
1099 ; Force upper-case.
1100 and al,11011111b
1101 cmp al,'A'
1102 jb DEBUG_HandleKeypress_exit
1103 cmp al,'Z'
1104 ja DEBUG_HandleKeypress_exit
1105 ; It was an alpha.
1106 jmp DEBUG_HandleKeypress_check_it
1107
1108
1109 ; Check if the key is a hot-key.
1110 DEBUG_HandleKeypress_check_it:
1111 cld
1112 mov si,offset dbg_dispatch
1113
1114 ; Loop over jump-list.
1115 DEBUG_HandleKeypress_next_entry:
1116
1117 ; Load the hot-key.
1118 lodsb
1119 ; No hot-key (not implemented) if end-of-list.
1120 test al,al
1121 jz DEBUG_HandleKeypress_ni
1122
1123 ; Compare hot-key and iterate if not the same.
1124 cmp dl,al
1125 lodsw
1126 jne DEBUG_HandleKeypress_next_entry
1127
1128 ; Entry found, call corresponding routine.
1129 mov bx,ax
1130 call bx
1131
1132 ; Done.
1133 jmp DEBUG_HandleKeypress_exit
1134
1135 ; Call not-assigned routine.
1136 DEBUG_HandleKeypress_ni:
1137 call DEBUG_NotAssigned
1138 jmp DEBUG_HandleKeypress_exit
1139
1140 ; Return to caller.
1141 DEBUG_HandleKeypress_exit:
1142 popa
1143 popf
1144 ret
1145DEBUG_HandleKeypress Endp
1146
1147
1148
1149;
1150; These strings can also be referenced outside the debug module when debugging
1151; is enabled.
1152;
1153dlra db 10,'LVM_DoLetterReassignment: ',0
1154ptetb db 10,'Partition Table Entry to boot',10,0
1155bios_reg db 10,'Registers passed by BIOS:',10,0
1156;~ diopmbr db 10,'DriveIO_ProtectMBR',10,0
1157dioss db 10,'DriveIO_SaveSector',10,0
1158
1159
1160;~ db_mbr db "## MBR ##",10,0
1161;~ db_masterlvm db "## MLVMR ##",10,0
1162
1163
1164;~ db_config db '## CFG (DMP2) ##',10,0
1165;~ db_cfgparts db 'CFG_Partitions:',0
1166;~ db_cfgpartdef db 'CFG_PartDefault:',0
1167;~ db_cfgpartlast db 'CFG_PartLast:',0
1168
1169
1170;~ db_vars db '## VARS ##',10,0
1171;~ db_partsec db 'PartitionSector:',10,0
1172;~ db_lvmsec db 'LVMSector :',10,0
1173;~ db_tmpec db 'TmpSector :',10,0
1174
1175;~ db_newpart db 'NewPartTable :',10,0
1176;~ db_newhide db 'NewHideTable:',10,0
1177;~ db_dletters db 'NewDriveLetters:',10,0
1178
1179;~ db_partsize db 'PartitionSizeTable:',10,0
1180;~ db_partpoint db 'PartitionPointers:',10,0
1181;~ db_partpointcnt db 'PartitionPointerCount:',0
1182;~ db_partxref db 'PartitionXref:',10,0
1183;~ db_partvoldl db 'PartitionVolumeLetters:',10,0
1184
1185;~ db_totaldisks db 'TotalHarddiscs:',0
1186;~ db_lbaswitchtab db 'LBASwitchTable:',10,0
1187;~ db_newparts db 'NewPartitions:',0
1188
1189;~ db_exabspos db 'ExtendedAbsPos:',0
1190;~ db_exabsposset db 'ExtendedAbsPosSet:',0
1191
1192;~ db_curpartloc db 'CurPartition_Location:',0
1193;~ db_curiox db 'CurIO_UseExtension:',0
1194
1195;~ db_curlvmsec db 'Current LVM Sector:',0
1196
1197
1198;~ drive db 'drive : ',0
1199;~ before_lvm_adjust db 'before lvm adjust : ',0
1200;~ after_lvm_adjust db 'after lvm adjust : ',0
1201;~ before_lvm_adjust_log db 'before lvm logical adjust: ',0
1202;~ after_lvm_adjust_log db 'after lvm logical adjust : ',0
1203;~ spt_used db 'spt used : ',0
Note: See TracBrowser for help on using the repository browser.