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

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

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