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

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

Test the new MBR-load function (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.5 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 ; Hello message
911 mov si, offset AuxIOHello
912 call AuxIO_Print
913
914 ; Build Info
915 ;~ mov si, offset BUILD_DATE
916 ;~ call AuxIO_Print
917 call AuxIO_PrintBuildInfo
918
919 ; Start new line
920 call AuxIO_TeletypeNL
921 ;~ call AuxIO_TeletypeNL
922
923 ;~ call DEBUG_DumpHidePartTables
924 ;~ call DEBUG_CheckMath
925 ;~ call DEBUG_DumpGeo
926 ;~ call DEBUG_CheckBitFields
927
928 popa
929 popf
930 ret
931DEBUG_Dump1 EndP
932
933
934
935;
936; Dump information before the partition is booted.
937;
938IF 0
939DEBUG_Dump2 Proc Near
940 pushf
941 pusha
942
943 call AuxIO_TeletypeNL
944 call AuxIO_TeletypeNL
945
946 mov si,offset db_config
947 call AuxIO_Print
948
949 mov si,offset db_cfgparts
950 call AuxIO_Print
951 mov al,[CFG_Partitions]
952 call AuxIO_TeletypeHexByte
953 call AuxIO_TeletypeNL
954
955 mov si,offset db_cfgpartdef
956 call AuxIO_Print
957 mov al,[CFG_PartDefault]
958 call AuxIO_TeletypeHexByte
959 call AuxIO_TeletypeNL
960
961 mov si,offset db_cfgpartlast
962 call AuxIO_Print
963 mov al,[CFG_PartLast]
964 call AuxIO_TeletypeHexByte
965 call AuxIO_TeletypeNL
966 call AuxIO_TeletypeNL
967
968 mov si,offset db_vars
969 call AuxIO_Print
970
971 mov si,offset db_newpart
972 call AuxIO_Print
973 mov si,offset NewPartTable
974 call AuxIO_DumpSector
975 call AuxIO_TeletypeNL
976 add si,512
977 call AuxIO_DumpSector
978 call AuxIO_TeletypeNL
979 call AuxIO_TeletypeNL
980
981 mov si,offset db_newhide
982 call AuxIO_Print
983 mov si,offset NewHidePartTable
984 call AuxIO_DumpSector
985 call AuxIO_TeletypeNL
986 add si,512
987 call AuxIO_DumpSector
988 call AuxIO_TeletypeNL
989 call AuxIO_TeletypeNL
990
991 mov si,offset db_dletters
992 call AuxIO_Print
993 mov si,offset NewDriveLetters
994 call AuxIO_DumpParagraph
995 call AuxIO_TeletypeNL
996 add si,16
997 call AuxIO_DumpParagraph
998 call AuxIO_TeletypeNL
999 call AuxIO_TeletypeNL
1000
1001 mov si,offset db_tmpec
1002 call AuxIO_Print
1003 mov si,offset TmpSector
1004 call AuxIO_DumpSector
1005 call AuxIO_TeletypeNL
1006 call AuxIO_TeletypeNL
1007
1008 mov si,offset db_partsec
1009 call AuxIO_Print
1010 mov si,offset PartitionSector
1011 call AuxIO_DumpSector
1012 call AuxIO_TeletypeNL
1013 call AuxIO_TeletypeNL
1014
1015 popa
1016 popf
1017 ret
1018DEBUG_Dump2 EndP
1019ELSE
1020DEBUG_Dump2 Proc Near
1021 ret
1022DEBUG_Dump2 EndP
1023ENDIF
1024
1025
1026
1027;
1028; Display a number that was put on the stack.
1029; Used to track code-flow.
1030;
1031dbp db '>---------->> DebugProbe: ',0
1032DEBUG_Probe Proc
1033IF 0
1034 push bp
1035 mov bp,sp
1036 pushf
1037 pusha
1038
1039 mov si,offset [dbp] ; Default probe-text.
1040 call AuxIO_Print
1041 mov ax,[bp+04] ; Get probe-number from stack.
1042 call AuxIO_TeletypeHexWord
1043 call AuxIO_TeletypeNL
1044
1045 ; Also display registers.
1046 popa
1047 pusha
1048 call DEBUG_DumpRegisters
1049
1050 popa
1051 popf
1052 pop bp
1053ENDIF
1054 ret 2
1055DEBUG_Probe Endp
1056
1057
1058
1059;
1060; Toggle display of debug video page.
1061;
1062IF 0
1063DEBUG_DebugScreenToggle Proc
1064 pushf
1065 pusha
1066
1067 mov si, offset $+5
1068 jmp @F
1069 db 10,'DebugScreenToggle:',10,0
1070prvpg db 00h
1071hdr db 10,'[Debug Console]',13,10,0
1072@@: call AuxIO_Print
1073
1074 ; Get current page in BH
1075 mov ah, 0fh
1076 int 10h
1077
1078 ; Already debug page ?
1079 cmp bh, 03h
1080 je DEBUG_DebugScreenToggle_back
1081
1082 ; Remember page
1083 mov [prvpg], bh
1084
1085 ; Switch to debug page
1086 mov al, 03h
1087 mov ah, 05h
1088 int 10h
1089
1090 ; Get cursor position in DX (DH=row, DL=column)
1091 ;~ mov ah, 03h
1092 ;~ mov bh, 03h
1093 ;~ int 10h
1094
1095 ;~ mov al, 01h
1096 ;~ mov bh, 03h
1097 ;~ mov bl, 07h
1098 ;~ mov bp, offset [hdr]
1099 ;~ mov cx, sizeof(hdr)
1100 ;~ mov ah, 13h
1101 ;~ int 10h
1102
1103 ;~ mov bh, 03h
1104 ;~ mov dh, 00h
1105 ;~ mov dl, 00h
1106 ;~ mov ah, 02h
1107 ;~ int 10h
1108
1109 mov si, offset [hdr]
1110 call DBG_Teletype
1111
1112 jmp DEBUG_DebugScreenToggle_end
1113
1114 DEBUG_DebugScreenToggle_back:
1115 ; Switch back to previous page
1116 mov al, [prvpg]
1117 mov ah, 05h
1118 int 10h
1119 jmp DEBUG_DebugScreenToggle_end
1120
1121 DEBUG_DebugScreenToggle_end:
1122 popa
1123 popf
1124 ret
1125DEBUG_DebugScreenToggle EndP
1126ELSE
1127DEBUG_DebugScreenToggle Proc
1128 ret
1129DEBUG_DebugScreenToggle EndP
1130ENDIF
1131
1132
1133
1134;
1135; Handle keypresses when the main menu is active.
1136;
1137DEBUG_HandleKeypress Proc
1138 pushf
1139 pusha
1140
1141 ; Save hot-key
1142 mov dl,al
1143
1144 ; Check for digit.
1145 cmp al,'0'
1146 jb DEBUG_HandleKeypress_exit
1147 cmp al,'9'
1148 ja DEBUG_HandleKeypress_try_alpha
1149 ; It was a digit, dump disk info ('0' for 80h, '1' for 81h, etc)
1150 call DEBUG_DumpDiskInfo
1151 ;~ jmp DEBUG_HandleKeypress_check_it
1152 jmp DEBUG_HandleKeypress_exit
1153
1154 ; Check for alpha.
1155 DEBUG_HandleKeypress_try_alpha:
1156 ; Force upper-case.
1157 and al,11011111b
1158 cmp al,'A'
1159 jb DEBUG_HandleKeypress_exit
1160 cmp al,'Z'
1161 ja DEBUG_HandleKeypress_exit
1162 ; It was an alpha.
1163 jmp DEBUG_HandleKeypress_check_it
1164
1165
1166 ; Check if the key is a hot-key.
1167 DEBUG_HandleKeypress_check_it:
1168 cld
1169 mov si,offset dbg_dispatch
1170
1171 ; Loop over jump-list.
1172 DEBUG_HandleKeypress_next_entry:
1173
1174 ; Load the hot-key.
1175 lodsb
1176 ; No hot-key (not implemented) if end-of-list.
1177 test al,al
1178 jz DEBUG_HandleKeypress_ni
1179
1180 ; Compare hot-key and iterate if not the same.
1181 cmp dl,al
1182 lodsw
1183 jne DEBUG_HandleKeypress_next_entry
1184
1185 ; Entry found, call corresponding routine.
1186 mov bx,ax
1187 call bx
1188
1189 ; Done.
1190 jmp DEBUG_HandleKeypress_exit
1191
1192 ; Call not-assigned routine.
1193 DEBUG_HandleKeypress_ni:
1194 call DEBUG_NotAssigned
1195 jmp DEBUG_HandleKeypress_exit
1196
1197 ; Return to caller.
1198 DEBUG_HandleKeypress_exit:
1199 popa
1200 popf
1201 ret
1202DEBUG_HandleKeypress Endp
1203
1204
1205
1206;
1207; These strings can also be referenced outside the debug module when debugging
1208; is enabled.
1209;
1210;~ dlra db 10,'LVM_DoLetterReassignment: ',0
1211ptetb db 10,'Partition Table Entry to boot',10,0
1212bios_reg db 10,'Registers passed by BIOS:',10,0
1213;~ diopmbr db 10,'DriveIO_ProtectMBR',10,0
1214
1215
1216;~ db_mbr db "## MBR ##",10,0
1217;~ db_masterlvm db "## MLVMR ##",10,0
1218
1219
1220;~ db_config db '## CFG (DMP2) ##',10,0
1221;~ db_cfgparts db 'CFG_Partitions:',0
1222;~ db_cfgpartdef db 'CFG_PartDefault:',0
1223;~ db_cfgpartlast db 'CFG_PartLast:',0
1224
1225
1226;~ db_vars db '## VARS ##',10,0
1227;~ db_partsec db 'PartitionSector:',10,0
1228;~ db_lvmsec db 'LVMSector :',10,0
1229;~ db_tmpec db 'TmpSector :',10,0
1230
1231;~ db_newpart db 'NewPartTable :',10,0
1232;~ db_newhide db 'NewHideTable:',10,0
1233;~ db_dletters db 'NewDriveLetters:',10,0
1234
1235;~ db_partsize db 'PartitionSizeTable:',10,0
1236;~ db_partpoint db 'PartitionPointers:',10,0
1237;~ db_partpointcnt db 'PartitionPointerCount:',0
1238;~ db_partxref db 'PartitionXref:',10,0
1239;~ db_partvoldl db 'PartitionVolumeLetters:',10,0
1240
1241;~ db_totaldisks db 'TotalHarddiscs:',0
1242;~ db_lbaswitchtab db 'LBASwitchTable:',10,0
1243;~ db_newparts db 'NewPartitions:',0
1244
1245;~ db_exabspos db 'ExtendedAbsPos:',0
1246;~ db_exabsposset db 'ExtendedAbsPosSet:',0
1247
1248;~ db_curpartloc db 'CurPartition_Location:',0
1249;~ db_curiox db 'CurIO_UseExtension:',0
1250
1251;~ db_curlvmsec db 'Current LVM Sector:',0
1252
1253
1254;~ drive db 'drive : ',0
1255;~ before_lvm_adjust db 'before lvm adjust : ',0
1256;~ after_lvm_adjust db 'after lvm adjust : ',0
1257;~ before_lvm_adjust_log db 'before lvm logical adjust: ',0
1258;~ after_lvm_adjust_log db 'after lvm logical adjust : ',0
1259;~ spt_used db 'spt used : ',0
Note: See TracBrowser for help on using the repository browser.