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

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

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