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

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

Added print decimal function to video module [v1.1.1-testing]

We don't need it yet, so it is disabled with 'IF 0'.
TODO: Better integrate Video and Aux output.

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.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. 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 mov al, ' '
770 call AuxIO_Teletype
771 mov al, cl ; Current value
772 call AuxIO_TeletypeDecByte ; Print as decimal
773 call AuxIO_TeletypeNL
774 inc cx ; Next value
775 cmp cx, 0ffh ; Check for last valid value
776 jbe next_value ; Repeat if still in range
777
778 popa
779 popf
780 ret
781DEBUG_Test_CONV_BinToPBCD EndP
782ELSE
783DEBUG_Test_CONV_BinToPBCD Proc
784 ret
785DEBUG_Test_CONV_BinToPBCD EndP
786ENDIF
787
788
789
790;
791; Test the simple 32-bit math functions.
792;
793IF 0
794db_testmul32 db "## TEST MUL32 ##",10,0
795DEBUG_Test_MATH_Mul32 Proc Near
796 pushf
797 pusha
798
799 ; Msg test math-module
800 mov si,offset [db_testmul32]
801 call AuxIO_Print
802
803 ; Output hex-word
804 mov ax,0BABEh
805 call AuxIO_TeletypeHexWord
806
807 mov al,' '
808 call AuxIO_Teletype
809 mov al,'*'
810 call AuxIO_Teletype
811 mov al,' '
812 call AuxIO_Teletype
813
814 ; Output hex-word
815 mov ax,0BABEh
816 call AuxIO_TeletypeHexWord
817
818 mov al,' '
819 call AuxIO_Teletype
820 mov al,'='
821 call AuxIO_Teletype
822 mov al,' '
823 call AuxIO_Teletype
824
825 mov ax,0BABEh
826 mul ax
827 call AuxIO_TeletypeHexDWord
828
829 ; Start new line
830 call AuxIO_TeletypeNL
831
832 ; Output hex-dword
833 mov dx,0DEADh
834 mov ax,0FACEh
835 call AuxIO_TeletypeHexDWord
836
837 mov al,' '
838 call AuxIO_Teletype
839 mov al,'*'
840 call AuxIO_Teletype
841 mov al,' '
842 call AuxIO_Teletype
843
844 ; Output hex-dword
845 mov dx,0DEADh
846 mov ax,0FACEh
847 call AuxIO_TeletypeHexDWord
848
849 mov al,' '
850 call AuxIO_Teletype
851 mov al,'='
852 call AuxIO_Teletype
853 mov al,' '
854 call AuxIO_Teletype
855
856 mov bx,0DEADh
857 mov cx,0FACEh
858 mov dx,0DEADh
859 mov ax,0FACEh
860 call MATH_Mul32
861 call AuxIO_TeletypeHexQWord
862
863 call AuxIO_TeletypeNL
864 call AuxIO_TeletypeNL
865
866 popa
867 popf
868 ret
869DEBUG_Test_MATH_Mul32 EndP
870ELSE
871DEBUG_Test_MATH_Mul32 Proc Near
872 ret
873DEBUG_Test_MATH_Mul32 EndP
874ENDIF
875
876
877
878;
879; Test the bitfield routines.
880;
881IF 0
882DEBUG_TestBitFieldFunctions Proc
883 pushf
884 pusha
885
886 mov bx,offset [dbg_scratch]
887
888 mov al,0
889 mov dl,0
890 mov dh,6
891 DEBUG_TestBitFieldFunctions_next_write:
892 call CONV_SetBitfieldValue
893 inc al
894 inc dl
895 jnz DEBUG_TestBitFieldFunctions_next_write
896
897 mov dl,0
898 mov dh,6
899 DEBUG_TestBitFieldFunctions_next_read:
900 mov al,dl
901 call AuxIO_TeletypeHexByte
902 mov al,':'
903 call AuxIO_Teletype
904 call CONV_GetBitfieldValue
905 call AuxIO_TeletypeHexWord
906 call AuxIO_TeletypeNL
907 inc dl
908 jnz DEBUG_TestBitFieldFunctions_next_read
909
910 popa
911 popf
912 ret
913DEBUG_TestBitFieldFunctions EndP
914ELSE
915DEBUG_TestBitFieldFunctions Proc
916 ret
917DEBUG_TestBitFieldFunctions EndP
918ENDIF
919
920
921
922;
923; Like the MBR version, but uses video page 3.
924;
925DBG_Teletype Proc Near Uses ax bx cx
926 mov ah, 0Eh
927 mov bh, 03h
928 mov bl, 07h
929 DBGT_Loop:
930 lodsb
931 or al, al
932 jz DBGT_End
933 int 10h
934 jmp DBGT_Loop
935 DBGT_End:
936 ret
937DBG_Teletype EndP
938
939
940
941;
942; Dump information before the menu is displayed.
943;
944DEBUG_Dump1 Proc Near
945 pushf
946 pusha
947
948 ; Hello message
949 mov si, offset AuxIOHello
950 call AuxIO_Print
951
952 ; Build Info
953 ;~ mov si, offset BUILD_DATE
954 ;~ call AuxIO_Print
955 call AuxIO_PrintBuildInfo
956
957 ; Start new line
958 call AuxIO_TeletypeNL
959 ;~ call AuxIO_TeletypeNL
960
961 ;~ call DEBUG_DumpHidePartTables
962 ;~ call DEBUG_CheckMath
963 ;~ call DEBUG_DumpGeo
964 ;~ call DEBUG_CheckBitFields
965
966 popa
967 popf
968 ret
969DEBUG_Dump1 EndP
970
971
972
973;
974; Dump information before the partition is booted.
975;
976IF 0
977DEBUG_Dump2 Proc Near
978 pushf
979 pusha
980
981 call AuxIO_TeletypeNL
982 call AuxIO_TeletypeNL
983
984 mov si,offset db_config
985 call AuxIO_Print
986
987 mov si,offset db_cfgparts
988 call AuxIO_Print
989 mov al,[CFG_Partitions]
990 call AuxIO_TeletypeHexByte
991 call AuxIO_TeletypeNL
992
993 mov si,offset db_cfgpartdef
994 call AuxIO_Print
995 mov al,[CFG_PartDefault]
996 call AuxIO_TeletypeHexByte
997 call AuxIO_TeletypeNL
998
999 mov si,offset db_cfgpartlast
1000 call AuxIO_Print
1001 mov al,[CFG_PartLast]
1002 call AuxIO_TeletypeHexByte
1003 call AuxIO_TeletypeNL
1004 call AuxIO_TeletypeNL
1005
1006 mov si,offset db_vars
1007 call AuxIO_Print
1008
1009 mov si,offset db_newpart
1010 call AuxIO_Print
1011 mov si,offset NewPartTable
1012 call AuxIO_DumpSector
1013 call AuxIO_TeletypeNL
1014 add si,512
1015 call AuxIO_DumpSector
1016 call AuxIO_TeletypeNL
1017 call AuxIO_TeletypeNL
1018
1019 mov si,offset db_newhide
1020 call AuxIO_Print
1021 mov si,offset NewHidePartTable
1022 call AuxIO_DumpSector
1023 call AuxIO_TeletypeNL
1024 add si,512
1025 call AuxIO_DumpSector
1026 call AuxIO_TeletypeNL
1027 call AuxIO_TeletypeNL
1028
1029 mov si,offset db_dletters
1030 call AuxIO_Print
1031 mov si,offset NewDriveLetters
1032 call AuxIO_DumpParagraph
1033 call AuxIO_TeletypeNL
1034 add si,16
1035 call AuxIO_DumpParagraph
1036 call AuxIO_TeletypeNL
1037 call AuxIO_TeletypeNL
1038
1039 mov si,offset db_tmpec
1040 call AuxIO_Print
1041 mov si,offset TmpSector
1042 call AuxIO_DumpSector
1043 call AuxIO_TeletypeNL
1044 call AuxIO_TeletypeNL
1045
1046 mov si,offset db_partsec
1047 call AuxIO_Print
1048 mov si,offset PartitionSector
1049 call AuxIO_DumpSector
1050 call AuxIO_TeletypeNL
1051 call AuxIO_TeletypeNL
1052
1053 popa
1054 popf
1055 ret
1056DEBUG_Dump2 EndP
1057ELSE
1058DEBUG_Dump2 Proc Near
1059 ret
1060DEBUG_Dump2 EndP
1061ENDIF
1062
1063
1064
1065;
1066; Display a number that was put on the stack.
1067; Used to track code-flow.
1068;
1069dbp db '>---------->> DebugProbe: ',0
1070DEBUG_Probe Proc
1071IF 0
1072 push bp
1073 mov bp,sp
1074 pushf
1075 pusha
1076
1077 mov si,offset [dbp] ; Default probe-text.
1078 call AuxIO_Print
1079 mov ax,[bp+04] ; Get probe-number from stack.
1080 call AuxIO_TeletypeHexWord
1081 call AuxIO_TeletypeNL
1082
1083 ; Also display registers.
1084 popa
1085 pusha
1086 call DEBUG_DumpRegisters
1087
1088 popa
1089 popf
1090 pop bp
1091ENDIF
1092 ret 2
1093DEBUG_Probe Endp
1094
1095
1096
1097;
1098; Toggle display of debug video page.
1099;
1100IF 0
1101DEBUG_DebugScreenToggle Proc
1102 pushf
1103 pusha
1104
1105 mov si, offset $+5
1106 jmp @F
1107 db 10,'DebugScreenToggle:',10,0
1108prvpg db 00h
1109hdr db 10,'[Debug Console]',13,10,0
1110@@: call AuxIO_Print
1111
1112 ; Get current page in BH
1113 mov ah, 0fh
1114 int 10h
1115
1116 ; Already debug page ?
1117 cmp bh, 03h
1118 je DEBUG_DebugScreenToggle_back
1119
1120 ; Remember page
1121 mov [prvpg], bh
1122
1123 ; Switch to debug page
1124 mov al, 03h
1125 mov ah, 05h
1126 int 10h
1127
1128 ; Get cursor position in DX (DH=row, DL=column)
1129 ;~ mov ah, 03h
1130 ;~ mov bh, 03h
1131 ;~ int 10h
1132
1133 ;~ mov al, 01h
1134 ;~ mov bh, 03h
1135 ;~ mov bl, 07h
1136 ;~ mov bp, offset [hdr]
1137 ;~ mov cx, sizeof(hdr)
1138 ;~ mov ah, 13h
1139 ;~ int 10h
1140
1141 ;~ mov bh, 03h
1142 ;~ mov dh, 00h
1143 ;~ mov dl, 00h
1144 ;~ mov ah, 02h
1145 ;~ int 10h
1146
1147 mov si, offset [hdr]
1148 call DBG_Teletype
1149
1150 jmp DEBUG_DebugScreenToggle_end
1151
1152 DEBUG_DebugScreenToggle_back:
1153 ; Switch back to previous page
1154 mov al, [prvpg]
1155 mov ah, 05h
1156 int 10h
1157 jmp DEBUG_DebugScreenToggle_end
1158
1159 DEBUG_DebugScreenToggle_end:
1160 popa
1161 popf
1162 ret
1163DEBUG_DebugScreenToggle EndP
1164ELSE
1165DEBUG_DebugScreenToggle Proc
1166 ret
1167DEBUG_DebugScreenToggle EndP
1168ENDIF
1169
1170
1171
1172;
1173; Handle keypresses when the main menu is active.
1174;
1175DEBUG_HandleKeypress Proc
1176 pushf
1177 pusha
1178
1179 ; Save hot-key
1180 mov dl,al
1181
1182 ; Check for digit.
1183 cmp al,'0'
1184 jb DEBUG_HandleKeypress_exit
1185 cmp al,'9'
1186 ja DEBUG_HandleKeypress_try_alpha
1187 ; It was a digit, dump disk info ('0' for 80h, '1' for 81h, etc)
1188 call DEBUG_DumpDiskInfo
1189 ;~ jmp DEBUG_HandleKeypress_check_it
1190 jmp DEBUG_HandleKeypress_exit
1191
1192 ; Check for alpha.
1193 DEBUG_HandleKeypress_try_alpha:
1194 ; Force upper-case.
1195 and al,11011111b
1196 cmp al,'A'
1197 jb DEBUG_HandleKeypress_exit
1198 cmp al,'Z'
1199 ja DEBUG_HandleKeypress_exit
1200 ; It was an alpha.
1201 jmp DEBUG_HandleKeypress_check_it
1202
1203
1204 ; Check if the key is a hot-key.
1205 DEBUG_HandleKeypress_check_it:
1206 cld
1207 mov si,offset dbg_dispatch
1208
1209 ; Loop over jump-list.
1210 DEBUG_HandleKeypress_next_entry:
1211
1212 ; Load the hot-key.
1213 lodsb
1214 ; No hot-key (not implemented) if end-of-list.
1215 test al,al
1216 jz DEBUG_HandleKeypress_ni
1217
1218 ; Compare hot-key and iterate if not the same.
1219 cmp dl,al
1220 lodsw
1221 jne DEBUG_HandleKeypress_next_entry
1222
1223 ; Entry found, call corresponding routine.
1224 mov bx,ax
1225 call bx
1226
1227 ; Done.
1228 jmp DEBUG_HandleKeypress_exit
1229
1230 ; Call not-assigned routine.
1231 DEBUG_HandleKeypress_ni:
1232 call DEBUG_NotAssigned
1233 jmp DEBUG_HandleKeypress_exit
1234
1235 ; Return to caller.
1236 DEBUG_HandleKeypress_exit:
1237 popa
1238 popf
1239 ret
1240DEBUG_HandleKeypress Endp
1241
1242
1243
1244;
1245; These strings can also be referenced outside the debug module when debugging
1246; is enabled.
1247;
1248dlra db 10,'LVM_DoLetterReassignment: ',0
1249ptetb db 10,'Partition Table Entry to boot',10,0
1250bios_reg db 10,'Registers passed by BIOS:',10,0
1251;~ diopmbr db 10,'DriveIO_ProtectMBR',10,0
1252dioss db 10,'DriveIO_SaveSector',10,0
1253
1254
1255;~ db_mbr db "## MBR ##",10,0
1256;~ db_masterlvm db "## MLVMR ##",10,0
1257
1258
1259;~ db_config db '## CFG (DMP2) ##',10,0
1260;~ db_cfgparts db 'CFG_Partitions:',0
1261;~ db_cfgpartdef db 'CFG_PartDefault:',0
1262;~ db_cfgpartlast db 'CFG_PartLast:',0
1263
1264
1265;~ db_vars db '## VARS ##',10,0
1266;~ db_partsec db 'PartitionSector:',10,0
1267;~ db_lvmsec db 'LVMSector :',10,0
1268;~ db_tmpec db 'TmpSector :',10,0
1269
1270;~ db_newpart db 'NewPartTable :',10,0
1271;~ db_newhide db 'NewHideTable:',10,0
1272;~ db_dletters db 'NewDriveLetters:',10,0
1273
1274;~ db_partsize db 'PartitionSizeTable:',10,0
1275;~ db_partpoint db 'PartitionPointers:',10,0
1276;~ db_partpointcnt db 'PartitionPointerCount:',0
1277;~ db_partxref db 'PartitionXref:',10,0
1278;~ db_partvoldl db 'PartitionVolumeLetters:',10,0
1279
1280;~ db_totaldisks db 'TotalHarddiscs:',0
1281;~ db_lbaswitchtab db 'LBASwitchTable:',10,0
1282;~ db_newparts db 'NewPartitions:',0
1283
1284;~ db_exabspos db 'ExtendedAbsPos:',0
1285;~ db_exabsposset db 'ExtendedAbsPosSet:',0
1286
1287;~ db_curpartloc db 'CurPartition_Location:',0
1288;~ db_curiox db 'CurIO_UseExtension:',0
1289
1290;~ db_curlvmsec db 'Current LVM Sector:',0
1291
1292
1293;~ drive db 'drive : ',0
1294;~ before_lvm_adjust db 'before lvm adjust : ',0
1295;~ after_lvm_adjust db 'after lvm adjust : ',0
1296;~ before_lvm_adjust_log db 'before lvm logical adjust: ',0
1297;~ after_lvm_adjust_log db 'after lvm logical adjust : ',0
1298;~ spt_used db 'spt used : ',0
Note: See TracBrowser for help on using the repository browser.