Changeset 89
- Timestamp:
- Apr 8, 2017, 12:26:25 AM (8 years ago)
- Location:
- trunk/bootcode
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bootcode/airboot.asm
r82 r89 2404 2404 2405 2405 ; Some debug area. 2406 ottdb 512 dup(?)2406 dbg_scratch db 512 dup(?) 2407 2407 2408 2408 -
trunk/bootcode/regular/debug.asm
r88 r89 40 40 41 41 ; 42 ; Display a number that was put on the stack.43 ; Used to track code-flow.44 ;45 dbp db '>---------->> DebugProbe: ',046 DEBUG_Probe Proc47 push bp48 mov bp,sp49 pushf50 pusha51 52 mov si,offset [dbp] ; Default probe-text.53 call AuxIO_Print54 mov ax,[bp+04] ; Get probe-number from stack.55 call AuxIO_TeletypeHexWord56 call AuxIO_TeletypeNL57 58 ; Also display registers.59 popa60 pusha61 call DEBUG_DumpRegisters62 63 popa64 popf65 pop bp66 ret 267 DEBUG_Probe Endp68 69 70 71 ;72 42 ; Show help on keys. 73 43 ; … … 91 61 92 62 ; 93 ; Call listfor debug hot-keys.94 ; 95 dbg_ call_list:63 ; Dispatch table for debug hot-keys. 64 ; 65 dbg_dispatch: 96 66 db 't' 97 67 dw offset DEBUG_Test … … 119 89 120 90 ; 121 ; Handle keypresses when the main menu is active.122 ;123 DEBUG_HandleKeypress Proc124 pushf125 pusha126 127 ; Save hot-key128 mov dl,al129 130 ; Check for digit.131 cmp al,'0'132 jb DEBUG_HandleKeypress_exit133 cmp al,'9'134 ja DEBUG_HandleKeypress_try_alpha135 ; It was a digit, dump disk info ('0' for 80h, '1' for 81h, etc)136 call DEBUG_DumpDiskInfo137 ;~ jmp DEBUG_HandleKeypress_check_it138 jmp DEBUG_HandleKeypress_exit139 140 ; Check for alpha.141 DEBUG_HandleKeypress_try_alpha:142 ; Force upper-case.143 and al,11011111b144 cmp al,'A'145 jb DEBUG_HandleKeypress_exit146 cmp al,'Z'147 ja DEBUG_HandleKeypress_exit148 ; It was an alpha.149 jmp DEBUG_HandleKeypress_check_it150 151 152 ; Check if the key is a hot-key.153 DEBUG_HandleKeypress_check_it:154 cld155 mov si,offset dbg_call_list156 157 ; Loop over jump-list.158 DEBUG_HandleKeypress_next_entry:159 160 ; Load the hot-key.161 lodsb162 ; No hot-key (not implemented) if end-of-list.163 test al,al164 jz DEBUG_HandleKeypress_ni165 166 ; Compare hot-key and iterate if not the same.167 cmp dl,al168 lodsw169 jne DEBUG_HandleKeypress_next_entry170 171 ; Entry found, call corresponding routine.172 mov bx,ax173 call bx174 175 ; Done.176 jmp DEBUG_HandleKeypress_exit177 178 ; Call not-assigned routine.179 DEBUG_HandleKeypress_ni:180 call DEBUG_NotAssigned181 jmp DEBUG_HandleKeypress_exit182 183 ; Return to caller.184 DEBUG_HandleKeypress_exit:185 popa186 popf187 ret188 DEBUG_HandleKeypress Endp189 190 191 192 ;193 91 ; Show 'not assigned' message. 194 92 ; … … 205 103 206 104 207 208 ; 209 ; Dump information before the menu is displayed. 210 ; 211 DEBUG_Dump1 Proc Near 212 pushf 213 pusha 214 215 ; Hello message 216 mov si, offset AuxIOHello 217 call AuxIO_Print 218 219 ; Build Info 220 ;~ mov si, offset BUILD_DATE 221 ;~ call AuxIO_Print 222 call AuxIO_PrintBuildInfo 223 224 ; Start new line 225 call AuxIO_TeletypeNL 226 ;~ call AuxIO_TeletypeNL 227 228 ;~ call DEBUG_DumpHidePartTables 229 ;~ call DEBUG_CheckMath 230 ;~ call DEBUG_DumpGeo 231 ;~ call DEBUG_CheckBitFields 232 233 popa 234 popf 235 ret 236 DEBUG_Dump1 EndP 237 238 239 240 ; 241 ; Check the simple 32-bit math functions. 242 ; 243 IF 0 244 db_testmul32 db "## CHK MUL32 ##",10,0 245 DEBUG_Test_MATH_Mul32 Proc Near 246 pushf 247 pusha 248 249 ; Msg check math-module 250 mov si,offset [db_testmul32] 251 call AuxIO_Print 252 253 ; Output hex-word 254 mov ax,0BABEh 255 call AuxIO_TeletypeHexWord 256 257 mov al,' ' 258 call AuxIO_Teletype 259 mov al,'*' 260 call AuxIO_Teletype 261 mov al,' ' 262 call AuxIO_Teletype 263 264 ; Output hex-word 265 mov ax,0BABEh 266 call AuxIO_TeletypeHexWord 267 268 mov al,' ' 269 call AuxIO_Teletype 270 mov al,'=' 271 call AuxIO_Teletype 272 mov al,' ' 273 call AuxIO_Teletype 274 275 mov ax,0BABEh 276 mul ax 277 call AuxIO_TeletypeHexDWord 278 279 ; Start new line 280 call AuxIO_TeletypeNL 281 282 ; Output hex-dword 283 mov dx,0DEADh 284 mov ax,0FACEh 285 call AuxIO_TeletypeHexDWord 286 287 mov al,' ' 288 call AuxIO_Teletype 289 mov al,'*' 290 call AuxIO_Teletype 291 mov al,' ' 292 call AuxIO_Teletype 293 294 ; Output hex-dword 295 mov dx,0DEADh 296 mov ax,0FACEh 297 call AuxIO_TeletypeHexDWord 298 299 mov al,' ' 300 call AuxIO_Teletype 301 mov al,'=' 302 call AuxIO_Teletype 303 mov al,' ' 304 call AuxIO_Teletype 305 306 mov bx,0DEADh 307 mov cx,0FACEh 308 mov dx,0DEADh 309 mov ax,0FACEh 310 call MATH_Mul32 311 call AuxIO_TeletypeHexQWord 312 313 call AuxIO_TeletypeNL 314 call AuxIO_TeletypeNL 315 316 popa 317 popf 318 ret 319 DEBUG_Test_MATH_Mul32 EndP 320 ELSE 321 DEBUG_Test_MATH_Mul32 Proc Near 322 ret 323 DEBUG_Test_MATH_Mul32 EndP 324 ENDIF 325 326 327 328 ; 329 ; Toggle display of debug video page. 330 ; 331 IF 0 332 DEBUG_DebugScreenToggle Proc 333 pushf 334 pusha 335 336 mov si, offset $+5 337 jmp @F 338 db 10,'DebugScreenToggle:',10,0 339 prvpg db 00h 340 hdr db 10,'[Debug Console]',13,10,0 341 @@: call AuxIO_Print 342 343 ; Get current page in BH 344 mov ah, 0fh 345 int 10h 346 347 ; Already debug page ? 348 cmp bh, 03h 349 je DEBUG_DebugScreenToggle_back 350 351 ; Remember page 352 mov [prvpg], bh 353 354 ; Switch to debug page 355 mov al, 03h 356 mov ah, 05h 357 int 10h 358 359 ; Get cursor position in DX (DH=row, DL=column) 360 ;~ mov ah, 03h 361 ;~ mov bh, 03h 362 ;~ int 10h 363 364 ;~ mov al, 01h 365 ;~ mov bh, 03h 366 ;~ mov bl, 07h 367 ;~ mov bp, offset [hdr] 368 ;~ mov cx, sizeof(hdr) 369 ;~ mov ah, 13h 370 ;~ int 10h 371 372 ;~ mov bh, 03h 373 ;~ mov dh, 00h 374 ;~ mov dl, 00h 375 ;~ mov ah, 02h 376 ;~ int 10h 377 378 mov si, offset [hdr] 379 call DBG_Teletype 380 381 jmp DEBUG_DebugScreenToggle_end 382 383 DEBUG_DebugScreenToggle_back: 384 ; Switch back to previous page 385 mov al, [prvpg] 386 mov ah, 05h 387 int 10h 388 jmp DEBUG_DebugScreenToggle_end 389 390 DEBUG_DebugScreenToggle_end: 391 popa 392 popf 393 ret 394 DEBUG_DebugScreenToggle EndP 395 ELSE 396 DEBUG_DebugScreenToggle Proc 397 ret 398 DEBUG_DebugScreenToggle EndP 399 ENDIF 400 401 105 ; ============================================================== [ dump stuff ] 402 106 403 107 ; … … 486 190 487 191 192 193 ; 194 ; Dump the new partitions table. 195 ; 196 IF 0 197 DEBUG_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 209 DEBUG_DumpNewPartTable EndP 210 DEBUG_DumpNewPartTable Proc 211 ret 212 DEBUG_DumpNewPartTable EndP 213 ENDIF 214 215 216 217 ; 218 ; Dump the partition pointers table. 219 ; 220 IF 0 221 DEBUG_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 239 DEBUG_DumpPartitionPointers EndP 240 ELSE 241 DEBUG_DumpPartitionPointers Proc 242 ret 243 DEBUG_DumpPartitionPointers EndP 244 ENDIF 245 246 247 248 ; 249 ; Dump the partition x-ref table. 250 ; 251 IF 0 252 xrt db 10,'XrefTable:',10,0 253 DEBUG_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 273 DEBUG_DumpPartitionXref EndP 274 ELSE 275 DEBUG_DumpPartitionXref Proc 276 ret 277 DEBUG_DumpPartitionXref EndP 278 ENDIF 279 280 281 282 ; 283 ; Dump the dl-feature drive-letters. 284 ; 285 IF 0 286 ddl db 10,'Driveletters:',10,0 287 DEBUG_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 316 DEBUG_DumpDriveLetters EndP 317 ELSE 318 DEBUG_DumpDriveLetters Proc 319 ret 320 DEBUG_DumpDriveLetters EndP 321 ENDIF 322 323 324 325 ; 326 ; Dump some disk information. 327 ; 328 IF 0 329 ddi db 10,'DumpDiskInfo:',10,0 330 DEBUG_DumpDiskInfo Proc 331 pushf 332 pusha 333 334 add al, 50h ; ASCII '0' to BIOS 80h, '1'->81h, etc. 335 336 mov si, offset [ddi] 337 call AuxIO_Print 338 339 call AuxIO_TeletypeHexByte 340 call AuxIO_TeletypeNL 341 342 popa 343 popf 344 ret 345 DEBUG_DumpDiskInfo EndP 346 ELSE 347 DEBUG_DumpDiskInfo Proc 348 ret 349 DEBUG_DumpDiskInfo EndP 350 ENDIF 351 352 353 354 ; 355 ; Dump the lvm volume drive-letters. 356 ; 357 IF 0 358 dvl db 10,'VolumeLetters:',10,0 359 DEBUG_DumpVolumeLetters Proc 360 pushf 361 pusha 362 363 mov si, offset [dvl] 364 call AuxIO_Print 365 366 mov si,offset [PartitionVolumeLetters] 367 mov cx,3 368 369 DEBUG_DumpVolumeLetters_next: 370 call AuxIO_DumpParagraph 371 add si,16 372 call AuxIO_TeletypeNL 373 loop DEBUG_DumpVolumeLetters_next 374 375 popa 376 popf 377 ret 378 DEBUG_DumpVolumeLetters EndP 379 ELSE 380 DEBUG_DumpVolumeLetters Proc 381 ret 382 DEBUG_DumpVolumeLetters EndP 383 ENDIF 384 385 386 387 ; 388 ; Dump the registers. 389 ; 390 IF 1 391 regAX db 'AX:',0 392 regBX db ' BX:',0 393 regCX db ' CX:',0 394 regDX db ' DX:',0 395 regSI db ' SI:',0 396 regDI db ' DI:',0 397 398 regBP db 'CS:',0 399 regSP db ' DS:',0 400 regCS db ' ES:',0 401 regSS db ' SS:',0 402 regDS db ' SP:',0 403 regES db ' BP:',0 404 405 ;~ regFS db 'FS:',0 406 ;~ regGS db ' GS:',0 407 DEBUG_DumpRegisters Proc 408 pushf 409 pusha 410 411 push si 412 mov si, offset [regAX] 413 call AuxIO_Print 414 call AuxIO_TeletypeHexWord 415 ;~ call AuxIO_TeletypeNL 416 417 call AuxIO_Print 418 mov ax,bx 419 call AuxIO_TeletypeHexWord 420 ;~ call AuxIO_TeletypeNL 421 422 call AuxIO_Print 423 mov ax,cx 424 call AuxIO_TeletypeHexWord 425 ;~ call AuxIO_TeletypeNL 426 427 call AuxIO_Print 428 mov ax,dx 429 call AuxIO_TeletypeHexWord 430 ;~ call AuxIO_TeletypeNL 431 432 call AuxIO_Print 433 pop ax 434 call AuxIO_TeletypeHexWord 435 ;~ call AuxIO_TeletypeNL 436 437 call AuxIO_Print 438 mov ax,di 439 call AuxIO_TeletypeHexWord 440 call AuxIO_TeletypeNL 441 442 443 444 call AuxIO_Print 445 mov ax,cs 446 call AuxIO_TeletypeHexWord 447 ;~ call AuxIO_TeletypeNL 448 449 call AuxIO_Print 450 mov ax,ds 451 call AuxIO_TeletypeHexWord 452 ;~ call AuxIO_TeletypeNL 453 454 call AuxIO_Print 455 mov ax,es 456 call AuxIO_TeletypeHexWord 457 ;~ call AuxIO_TeletypeNL 458 459 call AuxIO_Print 460 mov ax,ss 461 call AuxIO_TeletypeHexWord 462 ;~ call AuxIO_TeletypeNL 463 464 call AuxIO_Print 465 mov ax,sp 466 call AuxIO_TeletypeHexWord 467 ;~ call AuxIO_TeletypeNL 468 469 call AuxIO_Print 470 mov ax,bp 471 call AuxIO_TeletypeHexWord 472 call AuxIO_TeletypeNL 473 474 ;~ call AuxIO_Print 475 ;~ mov ax,fs 476 ;~ call AuxIO_TeletypeHexWord 477 ;~ call AuxIO_TeletypeNL 478 479 ;~ call AuxIO_Print 480 ;~ mov ax,gs 481 ;~ call AuxIO_TeletypeHexWord 482 ;~ call AuxIO_TeletypeNL 483 484 call AuxIO_TeletypeNL 485 486 popa 487 popf 488 ret 489 DEBUG_DumpRegisters EndP 490 ELSE 491 DEBUG_DumpRegisters Proc 492 ret 493 DEBUG_DumpRegisters EndP 494 ENDIF 495 496 497 498 ; 499 ; Dump CHS values. 500 ; 501 IF 0 502 DEBUG_DumpCHS Proc Near 503 pushf 504 pusha 505 mov al,'C' 506 call AuxIO_Teletype 507 mov al,':' 508 call AuxIO_Teletype 509 mov ah,cl 510 shr ah,6 511 mov al,ch 512 call AuxIO_TeletypeHexWord 513 mov al,' ' 514 call AuxIO_Teletype 515 mov al,'H' 516 call AuxIO_Teletype 517 mov al,':' 518 call AuxIO_Teletype 519 mov al,dh 520 call AuxIO_TeletypeHexByte 521 mov al,' ' 522 call AuxIO_Teletype 523 mov al,'S' 524 call AuxIO_Teletype 525 mov al,':' 526 call AuxIO_Teletype 527 mov al,cl 528 and al,00111111b 529 call AuxIO_TeletypeHexByte 530 call AuxIO_TeletypeNL 531 popa 532 popf 533 ret 534 DEBUG_DumpCHS EndP 535 ELSE 536 DEBUG_DumpCHS Proc Near 537 ret 538 DEBUG_DumpCHS EndP 539 ENDIF 540 541 542 543 ; 544 ; Dump BSS. 545 ; 546 IF 0 547 DEBUG_DumpBSSSectors Proc Near 548 pushf 549 pusha 550 551 mov si, offset [PartitionSector] 552 call AuxIO_DumpSector 553 call AuxIO_TeletypeNL 554 555 mov si, offset [PBRSector] 556 call AuxIO_DumpSector 557 call AuxIO_TeletypeNL 558 559 mov si, offset [LVMSector] 560 call AuxIO_DumpSector 561 call AuxIO_TeletypeNL 562 563 mov si, offset [TmpSector] 564 call AuxIO_DumpSector 565 call AuxIO_TeletypeNL 566 567 mov si, offset [NewPartTable] 568 call AuxIO_DumpSector 569 call AuxIO_TeletypeNL 570 call AuxIO_TeletypeNL 571 572 popa 573 popf 574 ret 575 DEBUG_DumpBSSSectors EndP 576 ELSE 577 DEBUG_DumpBSSSectors Proc Near 578 ret 579 DEBUG_DumpBSSSectors EndP 580 ENDIF 581 582 583 584 ; 585 ; Dump 6-bit packed hide partition table. 586 ; 587 IF 0 588 DEBUG_DumpHidePartTables Proc Near 589 pushf 590 pusha 591 592 mov cx,3 593 mov si, offset [HidePartitionTable] 594 again1: 595 call AuxIO_DumpSector 596 add si,512 597 loop again1 598 call AuxIO_TeletypeNL 599 600 mov cx,3 601 mov si, offset [PartitionXref] 602 again2: 603 call AuxIO_DumpParagraph 604 call AuxIO_TeletypeNL 605 add si,16 606 loop again2 607 call AuxIO_TeletypeNL 608 609 mov cx,3 610 mov si, offset [NewHidePartTable] 611 again3: 612 call AuxIO_DumpSector 613 add si,512 614 loop again3 615 call AuxIO_TeletypeNL 616 617 popa 618 popf 619 ret 620 DEBUG_DumpHidePartTables EndP 621 ELSE 622 DEBUG_DumpHidePartTables Proc Near 623 ret 624 DEBUG_DumpHidePartTables EndP 625 ENDIF 626 627 628 629 ; ============================================================== [ test stuff ] 488 630 489 631 ; … … 514 656 ; 515 657 IF 1 658 db_testbin2pbcd db "## TEST BIN2PBCD ##",10,0 516 659 DEBUG_Test_CONV_BinToPBCD Proc 517 660 pushf 518 661 pusha 662 663 ; Msg test bin2pbcd 664 mov si,offset [db_testbin2pbcd] 665 call AuxIO_Print 666 667 ; Start with 0 519 668 xor cx, cx 669 670 ; Print 0 - 255 as BYTE and packed BCD 520 671 next_value: 521 mov al, cl 522 call AuxIO_TeletypeHexByte 672 mov al, cl ; Current value 673 call AuxIO_TeletypeHexByte ; Print as byte 523 674 mov al, ' ' 524 675 call AuxIO_Teletype 525 mov al, cl 526 call CONV_BinToPBCD 527 call AuxIO_TeletypeHexWord 528 call AuxIO_TeletypeNL 529 530 inc cx 531 cmp cx, 0ffh 532 jbe next_value 676 mov al, cl ; Current value 677 call CONV_BinToPBCD ; Convert to packed BCD 678 call AuxIO_TeletypeHexWord ; Print as word 679 call AuxIO_TeletypeNL 680 681 inc cx ; Next value 682 cmp cx, 0ffh ; Check for last valid value 683 jbe next_value ; Repeat if still in range 684 533 685 popa 534 686 popf … … 544 696 545 697 ; 546 ; Dump the new partitions table. 547 ; 548 IF 0 549 DEBUG_DumpNewPartTable Proc 550 pushf 551 pusha 552 553 call AuxIO_TeletypeNL 554 555 mov si,offset [NewPartTable] 556 call AuxIO_DumpSector 557 558 popa 559 popf 560 ret 561 DEBUG_DumpNewPartTable EndP 562 DEBUG_DumpNewPartTable Proc 563 ret 564 DEBUG_DumpNewPartTable EndP 565 ENDIF 566 567 568 569 ; 570 ; Dump the partition pointers table. 571 ; 572 IF 0 573 DEBUG_DumpPartitionPointers Proc 574 pushf 575 pusha 576 577 call AuxIO_TeletypeNL 578 579 mov si,offset [PartitionPointers] 580 mov cx,7 581 582 DEBUG_DumpPartitionPointers_next: 583 call AuxIO_DumpParagraph 584 add si,16 585 call AuxIO_TeletypeNL 586 loop DEBUG_DumpPartitionPointers_next 587 588 popa 589 popf 590 ret 591 DEBUG_DumpPartitionPointers EndP 592 ELSE 593 DEBUG_DumpPartitionPointers Proc 594 ret 595 DEBUG_DumpPartitionPointers EndP 596 ENDIF 597 598 599 600 ; 601 ; Dump the partition x-ref table. 602 ; 603 IF 0 604 xrt db 10,'XrefTable:',10,0 605 DEBUG_DumpPartitionXref Proc 606 pushf 607 pusha 608 609 mov si, offset [xrt] 610 call AuxIO_Print 611 ;~ call AuxIO_TeletypeNL 612 613 mov si,offset [PartitionXref] 614 mov cx,3 615 616 DEBUG_DumpPartitionXref_next: 617 call AuxIO_DumpParagraph 618 add si,16 619 call AuxIO_TeletypeNL 620 loop DEBUG_DumpPartitionXref_next 621 622 popa 623 popf 624 ret 625 DEBUG_DumpPartitionXref EndP 626 ELSE 627 DEBUG_DumpPartitionXref Proc 628 ret 629 DEBUG_DumpPartitionXref EndP 630 ENDIF 631 632 633 634 ; 635 ; Dump the dl-feature drive-letters. 636 ; 637 IF 0 638 ddl db 10,'Driveletters:',10,0 639 DEBUG_DumpDriveLetters Proc 640 pushf 641 pusha 642 643 mov si, offset [ddl] 644 call AuxIO_Print 645 646 ; Dump the old drive-letters as set with the dl-feature. 647 mov si,offset [DriveLetters] 648 mov cx,3 649 DEBUG_DumpDriveLetters_next_1: 650 call AuxIO_DumpParagraph 651 add si,16 652 call AuxIO_TeletypeNL 653 loop DEBUG_DumpDriveLetters_next_1 654 655 ; Dump the new drive-letters as composed when scanning partitions 656 ; and partitions were added or removed. 657 mov si,offset [NewDriveLetters] 658 mov cx,3 659 DEBUG_DumpDriveLetters_next_2: 660 call AuxIO_DumpParagraph 661 add si,16 662 call AuxIO_TeletypeNL 663 loop DEBUG_DumpDriveLetters_next_2 664 665 popa 666 popf 667 ret 668 DEBUG_DumpDriveLetters EndP 669 ELSE 670 DEBUG_DumpDriveLetters Proc 671 ret 672 DEBUG_DumpDriveLetters EndP 673 ENDIF 674 675 676 677 ; 678 ; Dump some disk information. 679 ; 680 IF 0 681 ddi db 10,'DumpDiskInfo:',10,0 682 DEBUG_DumpDiskInfo Proc 683 pushf 684 pusha 685 686 add al, 50h ; ASCII '0' to BIOS 80h, '1'->81h, etc. 687 688 mov si, offset [ddi] 689 call AuxIO_Print 690 691 call AuxIO_TeletypeHexByte 692 call AuxIO_TeletypeNL 693 694 popa 695 popf 696 ret 697 DEBUG_DumpDiskInfo EndP 698 ELSE 699 DEBUG_DumpDiskInfo Proc 700 ret 701 DEBUG_DumpDiskInfo EndP 702 ENDIF 703 704 705 706 ; 707 ; Dump the lvm volume drive-letters. 708 ; 709 IF 0 710 dvl db 10,'VolumeLetters:',10,0 711 DEBUG_DumpVolumeLetters Proc 712 pushf 713 pusha 714 715 mov si, offset [dvl] 716 call AuxIO_Print 717 718 mov si,offset [PartitionVolumeLetters] 719 mov cx,3 720 721 DEBUG_DumpVolumeLetters_next: 722 call AuxIO_DumpParagraph 723 add si,16 724 call AuxIO_TeletypeNL 725 loop DEBUG_DumpVolumeLetters_next 726 727 popa 728 popf 729 ret 730 DEBUG_DumpVolumeLetters EndP 731 ELSE 732 DEBUG_DumpVolumeLetters Proc 733 ret 734 DEBUG_DumpVolumeLetters EndP 735 ENDIF 736 737 738 739 ; 740 ; Dump the registers. 741 ; 742 IF 1 743 regAX db 'AX:',0 744 regBX db ' BX:',0 745 regCX db ' CX:',0 746 regDX db ' DX:',0 747 regSI db ' SI:',0 748 regDI db ' DI:',0 749 750 regBP db 'CS:',0 751 regSP db ' DS:',0 752 regCS db ' ES:',0 753 regSS db ' SS:',0 754 regDS db ' SP:',0 755 regES db ' BP:',0 756 757 ;~ regFS db 'FS:',0 758 ;~ regGS db ' GS:',0 759 DEBUG_DumpRegisters Proc 760 pushf 761 pusha 762 763 push si 764 mov si, offset [regAX] 765 call AuxIO_Print 766 call AuxIO_TeletypeHexWord 767 ;~ call AuxIO_TeletypeNL 768 769 call AuxIO_Print 770 mov ax,bx 771 call AuxIO_TeletypeHexWord 772 ;~ call AuxIO_TeletypeNL 773 774 call AuxIO_Print 775 mov ax,cx 776 call AuxIO_TeletypeHexWord 777 ;~ call AuxIO_TeletypeNL 778 779 call AuxIO_Print 780 mov ax,dx 781 call AuxIO_TeletypeHexWord 782 ;~ call AuxIO_TeletypeNL 783 784 call AuxIO_Print 785 pop ax 786 call AuxIO_TeletypeHexWord 787 ;~ call AuxIO_TeletypeNL 788 789 call AuxIO_Print 790 mov ax,di 791 call AuxIO_TeletypeHexWord 792 call AuxIO_TeletypeNL 793 794 795 796 call AuxIO_Print 797 mov ax,cs 798 call AuxIO_TeletypeHexWord 799 ;~ call AuxIO_TeletypeNL 800 801 call AuxIO_Print 802 mov ax,ds 803 call AuxIO_TeletypeHexWord 804 ;~ call AuxIO_TeletypeNL 805 806 call AuxIO_Print 807 mov ax,es 808 call AuxIO_TeletypeHexWord 809 ;~ call AuxIO_TeletypeNL 810 811 call AuxIO_Print 812 mov ax,ss 813 call AuxIO_TeletypeHexWord 814 ;~ call AuxIO_TeletypeNL 815 816 call AuxIO_Print 817 mov ax,sp 818 call AuxIO_TeletypeHexWord 819 ;~ call AuxIO_TeletypeNL 820 821 call AuxIO_Print 822 mov ax,bp 823 call AuxIO_TeletypeHexWord 824 call AuxIO_TeletypeNL 825 826 ;~ call AuxIO_Print 827 ;~ mov ax,fs 828 ;~ call AuxIO_TeletypeHexWord 829 ;~ call AuxIO_TeletypeNL 830 831 ;~ call AuxIO_Print 832 ;~ mov ax,gs 833 ;~ call AuxIO_TeletypeHexWord 834 ;~ call AuxIO_TeletypeNL 835 836 call AuxIO_TeletypeNL 837 838 popa 839 popf 840 ret 841 DEBUG_DumpRegisters EndP 842 ELSE 843 DEBUG_DumpRegisters Proc 844 ret 845 DEBUG_DumpRegisters EndP 846 ENDIF 847 848 849 850 ; 851 ; Dump CHS values. 852 ; 853 IF 0 854 DEBUG_DumpCHS Proc Near 855 pushf 856 pusha 857 mov al,'C' 858 call AuxIO_Teletype 859 mov al,':' 860 call AuxIO_Teletype 861 mov ah,cl 862 shr ah,6 863 mov al,ch 864 call AuxIO_TeletypeHexWord 698 ; Test the simple 32-bit math functions. 699 ; 700 IF 0 701 db_testmul32 db "## TEST MUL32 ##",10,0 702 DEBUG_Test_MATH_Mul32 Proc Near 703 pushf 704 pusha 705 706 ; Msg test math-module 707 mov si,offset [db_testmul32] 708 call AuxIO_Print 709 710 ; Output hex-word 711 mov ax,0BABEh 712 call AuxIO_TeletypeHexWord 713 865 714 mov al,' ' 866 715 call AuxIO_Teletype 867 mov al,'H' 868 call AuxIO_Teletype 869 mov al,':' 870 call AuxIO_Teletype 871 mov al,dh 872 call AuxIO_TeletypeHexByte 716 mov al,'*' 717 call AuxIO_Teletype 873 718 mov al,' ' 874 719 call AuxIO_Teletype 875 mov al,'S' 876 call AuxIO_Teletype 877 mov al,':' 878 call AuxIO_Teletype 879 mov al,cl 880 and al,00111111b 881 call AuxIO_TeletypeHexByte 882 call AuxIO_TeletypeNL 883 popa 884 popf 885 ret 886 DEBUG_DumpCHS EndP 887 ELSE 888 DEBUG_DumpCHS Proc Near 889 ret 890 DEBUG_DumpCHS EndP 891 ENDIF 892 893 894 895 ; 896 ; Dump BSS. 897 ; 898 IF 0 899 DEBUG_DumpBSSSectors Proc Near 900 pushf 901 pusha 902 903 mov si, offset [PartitionSector] 904 call AuxIO_DumpSector 905 call AuxIO_TeletypeNL 906 907 mov si, offset [PBRSector] 908 call AuxIO_DumpSector 909 call AuxIO_TeletypeNL 910 911 mov si, offset [LVMSector] 912 call AuxIO_DumpSector 913 call AuxIO_TeletypeNL 914 915 mov si, offset [TmpSector] 916 call AuxIO_DumpSector 917 call AuxIO_TeletypeNL 918 919 mov si, offset [NewPartTable] 920 call AuxIO_DumpSector 921 call AuxIO_TeletypeNL 922 call AuxIO_TeletypeNL 923 924 popa 925 popf 926 ret 927 DEBUG_DumpBSSSectors EndP 928 ELSE 929 DEBUG_DumpBSSSectors Proc Near 930 ret 931 DEBUG_DumpBSSSectors EndP 932 ENDIF 933 934 935 936 ; 937 ; Dump 6-bit packed hide partition table. 938 ; 939 IF 0 940 DEBUG_DumpHidePartTables Proc Near 941 pushf 942 pusha 943 944 mov cx,3 945 mov si, offset [HidePartitionTable] 946 again1: 947 call AuxIO_DumpSector 948 add si,512 949 loop again1 950 call AuxIO_TeletypeNL 951 952 mov cx,3 953 mov si, offset [PartitionXref] 954 again2: 955 call AuxIO_DumpParagraph 956 call AuxIO_TeletypeNL 957 add si,16 958 loop again2 959 call AuxIO_TeletypeNL 960 961 mov cx,3 962 mov si, offset [NewHidePartTable] 963 again3: 964 call AuxIO_DumpSector 965 add si,512 966 loop again3 967 call AuxIO_TeletypeNL 968 969 popa 970 popf 971 ret 972 DEBUG_DumpHidePartTables EndP 973 ELSE 974 DEBUG_DumpHidePartTables Proc Near 975 ret 976 DEBUG_DumpHidePartTables EndP 977 ENDIF 978 979 980 981 ; 982 ; Check the bitfield routines. 983 ; 984 IF 0 985 DEBUG_CheckBitFields Proc 986 pushf 987 pusha 988 989 mov bx,offset [ott] 720 721 ; Output hex-word 722 mov ax,0BABEh 723 call AuxIO_TeletypeHexWord 724 725 mov al,' ' 726 call AuxIO_Teletype 727 mov al,'=' 728 call AuxIO_Teletype 729 mov al,' ' 730 call AuxIO_Teletype 731 732 mov ax,0BABEh 733 mul ax 734 call AuxIO_TeletypeHexDWord 735 736 ; Start new line 737 call AuxIO_TeletypeNL 738 739 ; Output hex-dword 740 mov dx,0DEADh 741 mov ax,0FACEh 742 call AuxIO_TeletypeHexDWord 743 744 mov al,' ' 745 call AuxIO_Teletype 746 mov al,'*' 747 call AuxIO_Teletype 748 mov al,' ' 749 call AuxIO_Teletype 750 751 ; Output hex-dword 752 mov dx,0DEADh 753 mov ax,0FACEh 754 call AuxIO_TeletypeHexDWord 755 756 mov al,' ' 757 call AuxIO_Teletype 758 mov al,'=' 759 call AuxIO_Teletype 760 mov al,' ' 761 call AuxIO_Teletype 762 763 mov bx,0DEADh 764 mov cx,0FACEh 765 mov dx,0DEADh 766 mov ax,0FACEh 767 call MATH_Mul32 768 call AuxIO_TeletypeHexQWord 769 770 call AuxIO_TeletypeNL 771 call AuxIO_TeletypeNL 772 773 popa 774 popf 775 ret 776 DEBUG_Test_MATH_Mul32 EndP 777 ELSE 778 DEBUG_Test_MATH_Mul32 Proc Near 779 ret 780 DEBUG_Test_MATH_Mul32 EndP 781 ENDIF 782 783 784 785 ; 786 ; Test the bitfield routines. 787 ; 788 IF 0 789 DEBUG_TestBitFieldFunctions Proc 790 pushf 791 pusha 792 793 mov bx,offset [dbg_scratch] 990 794 991 795 mov al,0 992 796 mov dl,0 993 797 mov dh,6 994 DEBUG_ CheckBitFields_next_write:798 DEBUG_TestBitFieldFunctions_next_write: 995 799 call CONV_SetBitfieldValue 996 800 inc al 997 801 inc dl 998 jnz DEBUG_ CheckBitFields_next_write802 jnz DEBUG_TestBitFieldFunctions_next_write 999 803 1000 804 mov dl,0 1001 805 mov dh,6 1002 DEBUG_ CheckBitFields_next_read:806 DEBUG_TestBitFieldFunctions_next_read: 1003 807 mov al,dl 1004 808 call AuxIO_TeletypeHexByte … … 1009 813 call AuxIO_TeletypeNL 1010 814 inc dl 1011 jnz DEBUG_CheckBitFields_next_read 1012 1013 popa 1014 popf 1015 ret 1016 DEBUG_CheckBitFields EndP 1017 ELSE 1018 DEBUG_CheckBitFields Proc 1019 ret 1020 DEBUG_CheckBitFields EndP 1021 ENDIF 1022 1023 1024 1025 ; 1026 ; Dump information before the partition is booted. 1027 ; 1028 IF 0 1029 DEBUG_Dump2 Proc Near 1030 pushf 1031 pusha 1032 1033 call AuxIO_TeletypeNL 1034 call AuxIO_TeletypeNL 1035 1036 mov si,offset db_config 1037 call AuxIO_Print 1038 1039 mov si,offset db_cfgparts 1040 call AuxIO_Print 1041 mov al,[CFG_Partitions] 1042 call AuxIO_TeletypeHexByte 1043 call AuxIO_TeletypeNL 1044 1045 mov si,offset db_cfgpartdef 1046 call AuxIO_Print 1047 mov al,[CFG_PartDefault] 1048 call AuxIO_TeletypeHexByte 1049 call AuxIO_TeletypeNL 1050 1051 mov si,offset db_cfgpartlast 1052 call AuxIO_Print 1053 mov al,[CFG_PartLast] 1054 call AuxIO_TeletypeHexByte 1055 call AuxIO_TeletypeNL 1056 call AuxIO_TeletypeNL 1057 1058 mov si,offset db_vars 1059 call AuxIO_Print 1060 1061 mov si,offset db_newpart 1062 call AuxIO_Print 1063 mov si,offset NewPartTable 1064 call AuxIO_DumpSector 1065 call AuxIO_TeletypeNL 1066 add si,512 1067 call AuxIO_DumpSector 1068 call AuxIO_TeletypeNL 1069 call AuxIO_TeletypeNL 1070 1071 mov si,offset db_newhide 1072 call AuxIO_Print 1073 mov si,offset NewHidePartTable 1074 call AuxIO_DumpSector 1075 call AuxIO_TeletypeNL 1076 add si,512 1077 call AuxIO_DumpSector 1078 call AuxIO_TeletypeNL 1079 call AuxIO_TeletypeNL 1080 1081 mov si,offset db_dletters 1082 call AuxIO_Print 1083 mov si,offset NewDriveLetters 1084 call AuxIO_DumpParagraph 1085 call AuxIO_TeletypeNL 1086 add si,16 1087 call AuxIO_DumpParagraph 1088 call AuxIO_TeletypeNL 1089 call AuxIO_TeletypeNL 1090 1091 mov si,offset db_tmpec 1092 call AuxIO_Print 1093 mov si,offset TmpSector 1094 call AuxIO_DumpSector 1095 call AuxIO_TeletypeNL 1096 call AuxIO_TeletypeNL 1097 1098 mov si,offset db_partsec 1099 call AuxIO_Print 1100 mov si,offset PartitionSector 1101 call AuxIO_DumpSector 1102 call AuxIO_TeletypeNL 1103 call AuxIO_TeletypeNL 1104 1105 popa 1106 popf 1107 ret 1108 DEBUG_Dump2 EndP 1109 ELSE 1110 DEBUG_Dump2 Proc Near 1111 ret 1112 DEBUG_Dump2 EndP 1113 ENDIF 1114 1115 1116 1117 ; 1118 ; Like the MBR version, but uses video page 3 815 jnz DEBUG_TestBitFieldFunctions_next_read 816 817 popa 818 popf 819 ret 820 DEBUG_TestBitFieldFunctions EndP 821 ELSE 822 DEBUG_TestBitFieldFunctions Proc 823 ret 824 DEBUG_TestBitFieldFunctions EndP 825 ENDIF 826 827 828 829 ; 830 ; Like the MBR version, but uses video page 3. 1119 831 ; 1120 832 DBG_Teletype Proc Near Uses ax bx cx … … 1135 847 1136 848 ; 849 ; Dump information before the menu is displayed. 850 ; 851 DEBUG_Dump1 Proc Near 852 pushf 853 pusha 854 855 ; Hello message 856 mov si, offset AuxIOHello 857 call AuxIO_Print 858 859 ; Build Info 860 ;~ mov si, offset BUILD_DATE 861 ;~ call AuxIO_Print 862 call AuxIO_PrintBuildInfo 863 864 ; Start new line 865 call AuxIO_TeletypeNL 866 ;~ call AuxIO_TeletypeNL 867 868 ;~ call DEBUG_DumpHidePartTables 869 ;~ call DEBUG_CheckMath 870 ;~ call DEBUG_DumpGeo 871 ;~ call DEBUG_CheckBitFields 872 873 popa 874 popf 875 ret 876 DEBUG_Dump1 EndP 877 878 879 880 ; 881 ; Dump information before the partition is booted. 882 ; 883 IF 0 884 DEBUG_Dump2 Proc Near 885 pushf 886 pusha 887 888 call AuxIO_TeletypeNL 889 call AuxIO_TeletypeNL 890 891 mov si,offset db_config 892 call AuxIO_Print 893 894 mov si,offset db_cfgparts 895 call AuxIO_Print 896 mov al,[CFG_Partitions] 897 call AuxIO_TeletypeHexByte 898 call AuxIO_TeletypeNL 899 900 mov si,offset db_cfgpartdef 901 call AuxIO_Print 902 mov al,[CFG_PartDefault] 903 call AuxIO_TeletypeHexByte 904 call AuxIO_TeletypeNL 905 906 mov si,offset db_cfgpartlast 907 call AuxIO_Print 908 mov al,[CFG_PartLast] 909 call AuxIO_TeletypeHexByte 910 call AuxIO_TeletypeNL 911 call AuxIO_TeletypeNL 912 913 mov si,offset db_vars 914 call AuxIO_Print 915 916 mov si,offset db_newpart 917 call AuxIO_Print 918 mov si,offset NewPartTable 919 call AuxIO_DumpSector 920 call AuxIO_TeletypeNL 921 add si,512 922 call AuxIO_DumpSector 923 call AuxIO_TeletypeNL 924 call AuxIO_TeletypeNL 925 926 mov si,offset db_newhide 927 call AuxIO_Print 928 mov si,offset NewHidePartTable 929 call AuxIO_DumpSector 930 call AuxIO_TeletypeNL 931 add si,512 932 call AuxIO_DumpSector 933 call AuxIO_TeletypeNL 934 call AuxIO_TeletypeNL 935 936 mov si,offset db_dletters 937 call AuxIO_Print 938 mov si,offset NewDriveLetters 939 call AuxIO_DumpParagraph 940 call AuxIO_TeletypeNL 941 add si,16 942 call AuxIO_DumpParagraph 943 call AuxIO_TeletypeNL 944 call AuxIO_TeletypeNL 945 946 mov si,offset db_tmpec 947 call AuxIO_Print 948 mov si,offset TmpSector 949 call AuxIO_DumpSector 950 call AuxIO_TeletypeNL 951 call AuxIO_TeletypeNL 952 953 mov si,offset db_partsec 954 call AuxIO_Print 955 mov si,offset PartitionSector 956 call AuxIO_DumpSector 957 call AuxIO_TeletypeNL 958 call AuxIO_TeletypeNL 959 960 popa 961 popf 962 ret 963 DEBUG_Dump2 EndP 964 ELSE 965 DEBUG_Dump2 Proc Near 966 ret 967 DEBUG_Dump2 EndP 968 ENDIF 969 970 971 972 ; 973 ; Display a number that was put on the stack. 974 ; Used to track code-flow. 975 ; 976 dbp db '>---------->> DebugProbe: ',0 977 DEBUG_Probe Proc 978 push bp 979 mov bp,sp 980 pushf 981 pusha 982 983 mov si,offset [dbp] ; Default probe-text. 984 call AuxIO_Print 985 mov ax,[bp+04] ; Get probe-number from stack. 986 call AuxIO_TeletypeHexWord 987 call AuxIO_TeletypeNL 988 989 ; Also display registers. 990 popa 991 pusha 992 call DEBUG_DumpRegisters 993 994 popa 995 popf 996 pop bp 997 ret 2 998 DEBUG_Probe Endp 999 1000 1001 1002 ; 1003 ; Toggle display of debug video page. 1004 ; 1005 IF 0 1006 DEBUG_DebugScreenToggle Proc 1007 pushf 1008 pusha 1009 1010 mov si, offset $+5 1011 jmp @F 1012 db 10,'DebugScreenToggle:',10,0 1013 prvpg db 00h 1014 hdr db 10,'[Debug Console]',13,10,0 1015 @@: call AuxIO_Print 1016 1017 ; Get current page in BH 1018 mov ah, 0fh 1019 int 10h 1020 1021 ; Already debug page ? 1022 cmp bh, 03h 1023 je DEBUG_DebugScreenToggle_back 1024 1025 ; Remember page 1026 mov [prvpg], bh 1027 1028 ; Switch to debug page 1029 mov al, 03h 1030 mov ah, 05h 1031 int 10h 1032 1033 ; Get cursor position in DX (DH=row, DL=column) 1034 ;~ mov ah, 03h 1035 ;~ mov bh, 03h 1036 ;~ int 10h 1037 1038 ;~ mov al, 01h 1039 ;~ mov bh, 03h 1040 ;~ mov bl, 07h 1041 ;~ mov bp, offset [hdr] 1042 ;~ mov cx, sizeof(hdr) 1043 ;~ mov ah, 13h 1044 ;~ int 10h 1045 1046 ;~ mov bh, 03h 1047 ;~ mov dh, 00h 1048 ;~ mov dl, 00h 1049 ;~ mov ah, 02h 1050 ;~ int 10h 1051 1052 mov si, offset [hdr] 1053 call DBG_Teletype 1054 1055 jmp DEBUG_DebugScreenToggle_end 1056 1057 DEBUG_DebugScreenToggle_back: 1058 ; Switch back to previous page 1059 mov al, [prvpg] 1060 mov ah, 05h 1061 int 10h 1062 jmp DEBUG_DebugScreenToggle_end 1063 1064 DEBUG_DebugScreenToggle_end: 1065 popa 1066 popf 1067 ret 1068 DEBUG_DebugScreenToggle EndP 1069 ELSE 1070 DEBUG_DebugScreenToggle Proc 1071 ret 1072 DEBUG_DebugScreenToggle EndP 1073 ENDIF 1074 1075 1076 1077 ; 1078 ; Handle keypresses when the main menu is active. 1079 ; 1080 DEBUG_HandleKeypress Proc 1081 pushf 1082 pusha 1083 1084 ; Save hot-key 1085 mov dl,al 1086 1087 ; Check for digit. 1088 cmp al,'0' 1089 jb DEBUG_HandleKeypress_exit 1090 cmp al,'9' 1091 ja DEBUG_HandleKeypress_try_alpha 1092 ; It was a digit, dump disk info ('0' for 80h, '1' for 81h, etc) 1093 call DEBUG_DumpDiskInfo 1094 ;~ jmp DEBUG_HandleKeypress_check_it 1095 jmp DEBUG_HandleKeypress_exit 1096 1097 ; Check for alpha. 1098 DEBUG_HandleKeypress_try_alpha: 1099 ; Force upper-case. 1100 and al,11011111b 1101 cmp al,'A' 1102 jb DEBUG_HandleKeypress_exit 1103 cmp al,'Z' 1104 ja DEBUG_HandleKeypress_exit 1105 ; It was an alpha. 1106 jmp DEBUG_HandleKeypress_check_it 1107 1108 1109 ; Check if the key is a hot-key. 1110 DEBUG_HandleKeypress_check_it: 1111 cld 1112 mov si,offset dbg_dispatch 1113 1114 ; Loop over jump-list. 1115 DEBUG_HandleKeypress_next_entry: 1116 1117 ; Load the hot-key. 1118 lodsb 1119 ; No hot-key (not implemented) if end-of-list. 1120 test al,al 1121 jz DEBUG_HandleKeypress_ni 1122 1123 ; Compare hot-key and iterate if not the same. 1124 cmp dl,al 1125 lodsw 1126 jne DEBUG_HandleKeypress_next_entry 1127 1128 ; Entry found, call corresponding routine. 1129 mov bx,ax 1130 call bx 1131 1132 ; Done. 1133 jmp DEBUG_HandleKeypress_exit 1134 1135 ; Call not-assigned routine. 1136 DEBUG_HandleKeypress_ni: 1137 call DEBUG_NotAssigned 1138 jmp DEBUG_HandleKeypress_exit 1139 1140 ; Return to caller. 1141 DEBUG_HandleKeypress_exit: 1142 popa 1143 popf 1144 ret 1145 DEBUG_HandleKeypress Endp 1146 1147 1148 1149 ; 1137 1150 ; These strings can also be referenced outside the debug module when debugging 1138 1151 ; is enabled.
Note:
See TracChangeset
for help on using the changeset viewer.