[30] | 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
|
---|
[51] | 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
|
---|
[84] | 30 | ; by setting the 'IF' directive to 0 or 1. Setting to 0 does an immediate
|
---|
| 31 | ; return, setting to 1 enables the routine.
|
---|
[30] | 32 |
|
---|
| 33 |
|
---|
[51] | 34 |
|
---|
| 35 | IFDEF MODULE_NAMES
|
---|
[30] | 36 | DB 'DEBUG',0
|
---|
| 37 | ENDIF
|
---|
| 38 |
|
---|
[84] | 39 |
|
---|
| 40 |
|
---|
[51] | 41 | ;
|
---|
| 42 | ; Show help on keys.
|
---|
| 43 | ;
|
---|
[75] | 44 | dbh db 10
|
---|
[84] | 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
|
---|
[75] | 47 | db '0-9=disk 80h-89h info',10
|
---|
| 48 | db 10,0
|
---|
| 49 |
|
---|
[51] | 50 | DEBUG_ShowHelp Proc
|
---|
| 51 | pushf
|
---|
| 52 | pusha
|
---|
| 53 | mov si, offset dbh
|
---|
| 54 | call AuxIO_Print
|
---|
| 55 | popa
|
---|
| 56 | popf
|
---|
| 57 | ret
|
---|
| 58 | DEBUG_ShowHelp EndP
|
---|
| 59 |
|
---|
| 60 |
|
---|
[84] | 61 |
|
---|
[51] | 62 | ;
|
---|
[89] | 63 | ; Dispatch table for debug hot-keys.
|
---|
[51] | 64 | ;
|
---|
[89] | 65 | dbg_dispatch:
|
---|
[85] | 66 | db 't'
|
---|
| 67 | dw offset DEBUG_Test
|
---|
[86] | 68 | db 'd'
|
---|
| 69 | dw offset DEBUG_DebugScreenToggle
|
---|
[84] | 70 | db 'l'
|
---|
[51] | 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 |
|
---|
[84] | 88 |
|
---|
| 89 |
|
---|
[51] | 90 | ;
|
---|
[84] | 91 | ; Show 'not assigned' message.
|
---|
[51] | 92 | ;
|
---|
| 93 | dbg_na db 'This key is not assigned, press ''h'' for Help.',10,0
|
---|
| 94 | DEBUG_NotAssigned Proc
|
---|
| 95 | pushf
|
---|
| 96 | pusha
|
---|
| 97 | mov si,offset dbg_na
|
---|
| 98 | call AuxIO_Print
|
---|
| 99 | popa
|
---|
| 100 | popf
|
---|
| 101 | ret
|
---|
| 102 | DEBUG_NotAssigned Endp
|
---|
| 103 |
|
---|
| 104 |
|
---|
[89] | 105 | ; ============================================================== [ dump stuff ]
|
---|
[51] | 106 |
|
---|
| 107 | ;
|
---|
| 108 | ; Dump the geometry.
|
---|
| 109 | ;
|
---|
[111] | 110 | IF 0
|
---|
[43] | 111 | DEBUG_DumpGeo Proc
|
---|
[51] | 112 | pushf
|
---|
| 113 | pusha
|
---|
[30] | 114 |
|
---|
[51] | 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
|
---|
[43] | 157 | ret
|
---|
| 158 | DEBUG_DumpGeo Endp
|
---|
[84] | 159 | ELSE
|
---|
| 160 | DEBUG_DumpGeo Proc
|
---|
| 161 | ret
|
---|
| 162 | DEBUG_DumpGeo Endp
|
---|
| 163 | ENDIF
|
---|
[30] | 164 |
|
---|
[49] | 165 |
|
---|
[84] | 166 |
|
---|
[51] | 167 | ;
|
---|
| 168 | ; Dump the internal partition table.
|
---|
| 169 | ;
|
---|
[111] | 170 | IF 0
|
---|
[49] | 171 | DEBUG_DumpIPT Proc
|
---|
| 172 | pushf
|
---|
| 173 | pusha
|
---|
| 174 |
|
---|
| 175 | call AuxIO_TeletypeNL
|
---|
| 176 |
|
---|
[51] | 177 | mov si,offset [BIOScontIPTentry]
|
---|
| 178 | ;~ mov si,offset [PartitionTable]
|
---|
[49] | 179 | call AuxIO_DumpSector
|
---|
| 180 |
|
---|
| 181 | popa
|
---|
| 182 | popf
|
---|
| 183 | ret
|
---|
| 184 | DEBUG_DumpIPT EndP
|
---|
[84] | 185 | ELSE
|
---|
| 186 | DEBUG_DumpIPT Proc
|
---|
| 187 | ret
|
---|
| 188 | DEBUG_DumpIPT EndP
|
---|
| 189 | ENDIF
|
---|
[49] | 190 |
|
---|
[51] | 191 |
|
---|
[84] | 192 |
|
---|
[51] | 193 | ;
|
---|
| 194 | ; Dump the new partitions table.
|
---|
| 195 | ;
|
---|
[111] | 196 | IF 0
|
---|
[49] | 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
|
---|
[84] | 210 | DEBUG_DumpNewPartTable Proc
|
---|
| 211 | ret
|
---|
| 212 | DEBUG_DumpNewPartTable EndP
|
---|
| 213 | ENDIF
|
---|
[49] | 214 |
|
---|
[51] | 215 |
|
---|
[84] | 216 |
|
---|
[51] | 217 | ;
|
---|
| 218 | ; Dump the partition pointers table.
|
---|
| 219 | ;
|
---|
[111] | 220 | IF 0
|
---|
[49] | 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
|
---|
[84] | 240 | ELSE
|
---|
| 241 | DEBUG_DumpPartitionPointers Proc
|
---|
| 242 | ret
|
---|
| 243 | DEBUG_DumpPartitionPointers EndP
|
---|
| 244 | ENDIF
|
---|
[49] | 245 |
|
---|
| 246 |
|
---|
[84] | 247 |
|
---|
[51] | 248 | ;
|
---|
| 249 | ; Dump the partition x-ref table.
|
---|
| 250 | ;
|
---|
[111] | 251 | IF 0
|
---|
[84] | 252 | xrt db 10,'XrefTable:',10,0
|
---|
[49] | 253 | DEBUG_DumpPartitionXref Proc
|
---|
| 254 | pushf
|
---|
| 255 | pusha
|
---|
| 256 |
|
---|
[51] | 257 | mov si, offset [xrt]
|
---|
| 258 | call AuxIO_Print
|
---|
| 259 | ;~ call AuxIO_TeletypeNL
|
---|
[49] | 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
|
---|
[84] | 274 | ELSE
|
---|
| 275 | DEBUG_DumpPartitionXref Proc
|
---|
| 276 | ret
|
---|
| 277 | DEBUG_DumpPartitionXref EndP
|
---|
| 278 | ENDIF
|
---|
[49] | 279 |
|
---|
[50] | 280 |
|
---|
[84] | 281 |
|
---|
[51] | 282 | ;
|
---|
| 283 | ; Dump the dl-feature drive-letters.
|
---|
| 284 | ;
|
---|
[111] | 285 | IF 0
|
---|
[84] | 286 | ddl db 10,'Driveletters:',10,0
|
---|
[50] | 287 | DEBUG_DumpDriveLetters Proc
|
---|
| 288 | pushf
|
---|
| 289 | pusha
|
---|
| 290 |
|
---|
[51] | 291 | mov si, offset [ddl]
|
---|
| 292 | call AuxIO_Print
|
---|
[50] | 293 |
|
---|
[51] | 294 | ; Dump the old drive-letters as set with the dl-feature.
|
---|
[50] | 295 | mov si,offset [DriveLetters]
|
---|
[51] | 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
|
---|
[50] | 302 |
|
---|
[51] | 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:
|
---|
[50] | 308 | call AuxIO_DumpParagraph
|
---|
| 309 | add si,16
|
---|
| 310 | call AuxIO_TeletypeNL
|
---|
[51] | 311 | loop DEBUG_DumpDriveLetters_next_2
|
---|
[50] | 312 |
|
---|
| 313 | popa
|
---|
| 314 | popf
|
---|
| 315 | ret
|
---|
| 316 | DEBUG_DumpDriveLetters EndP
|
---|
[84] | 317 | ELSE
|
---|
| 318 | DEBUG_DumpDriveLetters Proc
|
---|
| 319 | ret
|
---|
| 320 | DEBUG_DumpDriveLetters EndP
|
---|
| 321 | ENDIF
|
---|
[50] | 322 |
|
---|
[84] | 323 |
|
---|
| 324 |
|
---|
[75] | 325 | ;
|
---|
| 326 | ; Dump some disk information.
|
---|
| 327 | ;
|
---|
[127] | 328 | IF 1
|
---|
[84] | 329 | ddi db 10,'DumpDiskInfo:',10,0
|
---|
[75] | 330 | DEBUG_DumpDiskInfo Proc
|
---|
| 331 | pushf
|
---|
| 332 | pusha
|
---|
[50] | 333 |
|
---|
[91] | 334 | ; ASCII '0' to BIOS 80h, '1'->81h, etc.
|
---|
| 335 | add al, 50h
|
---|
[75] | 336 |
|
---|
| 337 | mov si, offset [ddi]
|
---|
| 338 | call AuxIO_Print
|
---|
| 339 |
|
---|
[91] | 340 | ; Print disk-number
|
---|
[75] | 341 | call AuxIO_TeletypeHexByte
|
---|
| 342 | call AuxIO_TeletypeNL
|
---|
| 343 |
|
---|
[127] | 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
|
---|
[91] | 350 |
|
---|
| 351 | popa
|
---|
[75] | 352 | popf
|
---|
| 353 | ret
|
---|
| 354 | DEBUG_DumpDiskInfo EndP
|
---|
[84] | 355 | ELSE
|
---|
| 356 | DEBUG_DumpDiskInfo Proc
|
---|
| 357 | ret
|
---|
| 358 | DEBUG_DumpDiskInfo EndP
|
---|
| 359 | ENDIF
|
---|
[75] | 360 |
|
---|
[84] | 361 |
|
---|
| 362 |
|
---|
[51] | 363 | ;
|
---|
| 364 | ; Dump the lvm volume drive-letters.
|
---|
| 365 | ;
|
---|
[111] | 366 | IF 0
|
---|
[84] | 367 | dvl db 10,'VolumeLetters:',10,0
|
---|
[51] | 368 | DEBUG_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
|
---|
| 387 | DEBUG_DumpVolumeLetters EndP
|
---|
[84] | 388 | ELSE
|
---|
| 389 | DEBUG_DumpVolumeLetters Proc
|
---|
| 390 | ret
|
---|
| 391 | DEBUG_DumpVolumeLetters EndP
|
---|
| 392 | ENDIF
|
---|
[51] | 393 |
|
---|
| 394 |
|
---|
| 395 |
|
---|
| 396 | ;
|
---|
[90] | 397 | ; Dump the registers and flags.
|
---|
[51] | 398 | ;
|
---|
[111] | 399 | IF 1
|
---|
[51] | 400 | regAX db 'AX:',0
|
---|
| 401 | regBX db ' BX:',0
|
---|
| 402 | regCX db ' CX:',0
|
---|
| 403 | regDX db ' DX:',0
|
---|
| 404 | regSI db ' SI:',0
|
---|
| 405 | regDI db ' DI:',0
|
---|
| 406 |
|
---|
| 407 | regBP db 'CS:',0
|
---|
| 408 | regSP db ' DS:',0
|
---|
| 409 | regCS db ' ES:',0
|
---|
| 410 | regSS db ' SS:',0
|
---|
| 411 | regDS db ' SP:',0
|
---|
| 412 | regES db ' BP:',0
|
---|
| 413 |
|
---|
[90] | 414 | regFS db 'FS:',0
|
---|
| 415 | regGS db ' GS:',0
|
---|
| 416 |
|
---|
| 417 | db ' '
|
---|
| 418 |
|
---|
| 419 | flagsSF db ' SF:',0
|
---|
| 420 | flagsZF db ' ZF:',0
|
---|
| 421 | flagsAF db ' AF:',0
|
---|
| 422 | flagsPF db ' PF:',0
|
---|
| 423 | flagsCF db ' CF:',0
|
---|
| 424 |
|
---|
[50] | 425 | DEBUG_DumpRegisters Proc
|
---|
[107] | 426 |
|
---|
| 427 | ; Save state of caller
|
---|
[50] | 428 | pushf
|
---|
| 429 | pusha
|
---|
| 430 |
|
---|
[107] | 431 | ; Save flags so they can be printed later
|
---|
[90] | 432 | pushf
|
---|
| 433 |
|
---|
[107] | 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
|
---|
[51] | 446 | push si
|
---|
[107] | 447 | push dx
|
---|
| 448 | push cx
|
---|
| 449 | push bx
|
---|
| 450 | push ax
|
---|
[90] | 451 |
|
---|
| 452 | ; Base of registers string
|
---|
[84] | 453 | mov si, offset [regAX]
|
---|
[90] | 454 |
|
---|
[107] | 455 | ; Print AX BX CX DX SI DI
|
---|
| 456 | mov cx, 6
|
---|
| 457 | @@:
|
---|
[51] | 458 | pop ax
|
---|
| 459 | call AuxIO_Print
|
---|
[50] | 460 | call AuxIO_TeletypeHexWord
|
---|
[107] | 461 | loop @B
|
---|
[90] | 462 |
|
---|
| 463 | ; 1st row printed
|
---|
[50] | 464 | call AuxIO_TeletypeNL
|
---|
| 465 |
|
---|
[107] | 466 | ; Print CS DS ES SS SP BP
|
---|
| 467 | mov cx, 6
|
---|
| 468 | @@:
|
---|
| 469 | pop ax
|
---|
[51] | 470 | call AuxIO_Print
|
---|
| 471 | call AuxIO_TeletypeHexWord
|
---|
[107] | 472 | loop @B
|
---|
[51] | 473 |
|
---|
[90] | 474 | ; 2nd row printed
|
---|
[50] | 475 | call AuxIO_TeletypeNL
|
---|
[107] | 476 |
|
---|
| 477 | ; Print FS GS
|
---|
| 478 | mov cx, 2
|
---|
| 479 | @@:
|
---|
| 480 | pop ax
|
---|
[90] | 481 | call AuxIO_Print
|
---|
| 482 | call AuxIO_TeletypeHexWord
|
---|
[107] | 483 | loop @B
|
---|
[50] | 484 |
|
---|
[90] | 485 | ; Restore the flags
|
---|
| 486 | popf
|
---|
[51] | 487 |
|
---|
[90] | 488 | ; Load flags into AH
|
---|
| 489 | lahf
|
---|
[51] | 490 |
|
---|
[90] | 491 | ; Base of flags string
|
---|
| 492 | ;~ mov si, offset [flagsSF]
|
---|
| 493 |
|
---|
[107] | 494 | ; Print SF
|
---|
[90] | 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 |
|
---|
[107] | 502 | ; Print ZF
|
---|
[90] | 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 |
|
---|
[107] | 510 | ; Print AF
|
---|
[90] | 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 |
|
---|
[107] | 518 | ; Print PF
|
---|
[90] | 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 |
|
---|
[107] | 526 | ; Print CF
|
---|
[90] | 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
|
---|
[50] | 534 | call AuxIO_TeletypeNL
|
---|
| 535 |
|
---|
[107] | 536 | ; Restore caller state
|
---|
[50] | 537 | popa
|
---|
| 538 | popf
|
---|
[107] | 539 |
|
---|
[50] | 540 | ret
|
---|
| 541 | DEBUG_DumpRegisters EndP
|
---|
[84] | 542 | ELSE
|
---|
| 543 | DEBUG_DumpRegisters Proc
|
---|
| 544 | ret
|
---|
| 545 | DEBUG_DumpRegisters EndP
|
---|
| 546 | ENDIF
|
---|
[50] | 547 |
|
---|
[51] | 548 |
|
---|
[84] | 549 |
|
---|
[43] | 550 | ;
|
---|
[51] | 551 | ; Dump CHS values.
|
---|
[43] | 552 | ;
|
---|
[111] | 553 | IF 0
|
---|
[51] | 554 | DEBUG_DumpCHS Proc Near
|
---|
[43] | 555 | pushf
|
---|
| 556 | pusha
|
---|
[51] | 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
|
---|
| 586 | DEBUG_DumpCHS EndP
|
---|
[84] | 587 | ELSE
|
---|
| 588 | DEBUG_DumpCHS Proc Near
|
---|
| 589 | ret
|
---|
| 590 | DEBUG_DumpCHS EndP
|
---|
| 591 | ENDIF
|
---|
[30] | 592 |
|
---|
| 593 |
|
---|
[84] | 594 |
|
---|
[51] | 595 | ;
|
---|
| 596 | ; Dump BSS.
|
---|
| 597 | ;
|
---|
[111] | 598 | IF 0
|
---|
[51] | 599 | DEBUG_DumpBSSSectors Proc Near
|
---|
| 600 | pushf
|
---|
| 601 | pusha
|
---|
[30] | 602 |
|
---|
[51] | 603 | mov si, offset [PartitionSector]
|
---|
| 604 | call AuxIO_DumpSector
|
---|
[43] | 605 | call AuxIO_TeletypeNL
|
---|
[51] | 606 |
|
---|
| 607 | mov si, offset [PBRSector]
|
---|
| 608 | call AuxIO_DumpSector
|
---|
[43] | 609 | call AuxIO_TeletypeNL
|
---|
[30] | 610 |
|
---|
[51] | 611 | mov si, offset [LVMSector]
|
---|
| 612 | call AuxIO_DumpSector
|
---|
| 613 | call AuxIO_TeletypeNL
|
---|
[45] | 614 |
|
---|
[51] | 615 | mov si, offset [TmpSector]
|
---|
| 616 | call AuxIO_DumpSector
|
---|
| 617 | call AuxIO_TeletypeNL
|
---|
[30] | 618 |
|
---|
[51] | 619 | mov si, offset [NewPartTable]
|
---|
| 620 | call AuxIO_DumpSector
|
---|
| 621 | call AuxIO_TeletypeNL
|
---|
| 622 | call AuxIO_TeletypeNL
|
---|
[30] | 623 |
|
---|
[43] | 624 | popa
|
---|
| 625 | popf
|
---|
| 626 | ret
|
---|
[51] | 627 | DEBUG_DumpBSSSectors EndP
|
---|
[84] | 628 | ELSE
|
---|
| 629 | DEBUG_DumpBSSSectors Proc Near
|
---|
| 630 | ret
|
---|
| 631 | DEBUG_DumpBSSSectors EndP
|
---|
| 632 | ENDIF
|
---|
[30] | 633 |
|
---|
| 634 |
|
---|
[84] | 635 |
|
---|
[51] | 636 | ;
|
---|
| 637 | ; Dump 6-bit packed hide partition table.
|
---|
| 638 | ;
|
---|
[111] | 639 | IF 0
|
---|
[51] | 640 | DEBUG_DumpHidePartTables Proc Near
|
---|
| 641 | pushf
|
---|
| 642 | pusha
|
---|
[45] | 643 |
|
---|
[51] | 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
|
---|
[45] | 651 |
|
---|
[51] | 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
|
---|
[43] | 671 | ret
|
---|
[45] | 672 | DEBUG_DumpHidePartTables EndP
|
---|
[84] | 673 | ELSE
|
---|
| 674 | DEBUG_DumpHidePartTables Proc Near
|
---|
| 675 | ret
|
---|
| 676 | DEBUG_DumpHidePartTables EndP
|
---|
| 677 | ENDIF
|
---|
[30] | 678 |
|
---|
| 679 |
|
---|
[84] | 680 |
|
---|
[89] | 681 | ; ============================================================== [ test stuff ]
|
---|
| 682 |
|
---|
[51] | 683 | ;
|
---|
[89] | 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.
|
---|
[51] | 687 | ;
|
---|
[111] | 688 | IF 1
|
---|
[89] | 689 | DEBUG_Test Proc
|
---|
| 690 | pushf
|
---|
| 691 | pusha
|
---|
[94] | 692 | ;~ call DEBUG_Test_CONV_BinToPBCD
|
---|
[89] | 693 | ;~ call DEBUG_Test_MATH_Mul32
|
---|
| 694 | popa
|
---|
| 695 | popf
|
---|
| 696 | ret
|
---|
| 697 | DEBUG_Test EndP
|
---|
| 698 | ELSE
|
---|
| 699 | DEBUG_Test Proc
|
---|
| 700 | ret
|
---|
| 701 | DEBUG_Test EndP
|
---|
| 702 | ENDIF
|
---|
| 703 |
|
---|
| 704 |
|
---|
| 705 |
|
---|
| 706 | ;
|
---|
| 707 | ; Test the packed BCD conversion function.
|
---|
| 708 | ;
|
---|
[94] | 709 | IF 0
|
---|
[89] | 710 | db_testbin2pbcd db "## TEST BIN2PBCD ##",10,0
|
---|
| 711 | DEBUG_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
|
---|
[93] | 731 | mov al, ' '
|
---|
| 732 | call AuxIO_Teletype
|
---|
| 733 | mov al, cl ; Current value
|
---|
| 734 | call AuxIO_TeletypeDecByte ; Print as decimal
|
---|
[89] | 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
|
---|
| 743 | DEBUG_Test_CONV_BinToPBCD EndP
|
---|
| 744 | ELSE
|
---|
| 745 | DEBUG_Test_CONV_BinToPBCD Proc
|
---|
| 746 | ret
|
---|
| 747 | DEBUG_Test_CONV_BinToPBCD EndP
|
---|
| 748 | ENDIF
|
---|
| 749 |
|
---|
| 750 |
|
---|
| 751 |
|
---|
| 752 | ;
|
---|
| 753 | ; Test the simple 32-bit math functions.
|
---|
| 754 | ;
|
---|
[111] | 755 | IF 0
|
---|
[89] | 756 | db_testmul32 db "## TEST MUL32 ##",10,0
|
---|
| 757 | DEBUG_Test_MATH_Mul32 Proc Near
|
---|
[51] | 758 | pushf
|
---|
| 759 | pusha
|
---|
| 760 |
|
---|
[89] | 761 | ; Msg test math-module
|
---|
| 762 | mov si,offset [db_testmul32]
|
---|
| 763 | call AuxIO_Print
|
---|
[51] | 764 |
|
---|
[89] | 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
|
---|
| 831 | DEBUG_Test_MATH_Mul32 EndP
|
---|
| 832 | ELSE
|
---|
| 833 | DEBUG_Test_MATH_Mul32 Proc Near
|
---|
| 834 | ret
|
---|
| 835 | DEBUG_Test_MATH_Mul32 EndP
|
---|
| 836 | ENDIF
|
---|
| 837 |
|
---|
| 838 |
|
---|
| 839 |
|
---|
| 840 | ;
|
---|
| 841 | ; Test the bitfield routines.
|
---|
| 842 | ;
|
---|
[111] | 843 | IF 0
|
---|
[89] | 844 | DEBUG_TestBitFieldFunctions Proc
|
---|
| 845 | pushf
|
---|
| 846 | pusha
|
---|
| 847 |
|
---|
| 848 | mov bx,offset [dbg_scratch]
|
---|
| 849 |
|
---|
[51] | 850 | mov al,0
|
---|
| 851 | mov dl,0
|
---|
| 852 | mov dh,6
|
---|
[89] | 853 | DEBUG_TestBitFieldFunctions_next_write:
|
---|
[51] | 854 | call CONV_SetBitfieldValue
|
---|
| 855 | inc al
|
---|
| 856 | inc dl
|
---|
[89] | 857 | jnz DEBUG_TestBitFieldFunctions_next_write
|
---|
[51] | 858 |
|
---|
| 859 | mov dl,0
|
---|
| 860 | mov dh,6
|
---|
[89] | 861 | DEBUG_TestBitFieldFunctions_next_read:
|
---|
[51] | 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
|
---|
[89] | 870 | jnz DEBUG_TestBitFieldFunctions_next_read
|
---|
[51] | 871 |
|
---|
| 872 | popa
|
---|
| 873 | popf
|
---|
[43] | 874 | ret
|
---|
[89] | 875 | DEBUG_TestBitFieldFunctions EndP
|
---|
[84] | 876 | ELSE
|
---|
[89] | 877 | DEBUG_TestBitFieldFunctions Proc
|
---|
[84] | 878 | ret
|
---|
[89] | 879 | DEBUG_TestBitFieldFunctions EndP
|
---|
[84] | 880 | ENDIF
|
---|
[44] | 881 |
|
---|
[51] | 882 |
|
---|
| 883 |
|
---|
[44] | 884 | ;
|
---|
[89] | 885 | ; Like the MBR version, but uses video page 3.
|
---|
| 886 | ;
|
---|
| 887 | DBG_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
|
---|
| 899 | DBG_Teletype EndP
|
---|
| 900 |
|
---|
| 901 |
|
---|
| 902 |
|
---|
| 903 | ;
|
---|
| 904 | ; Dump information before the menu is displayed.
|
---|
| 905 | ;
|
---|
| 906 | DEBUG_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
|
---|
| 918 | DEBUG_Dump1 EndP
|
---|
| 919 |
|
---|
| 920 |
|
---|
| 921 |
|
---|
| 922 | ;
|
---|
[44] | 923 | ; Dump information before the partition is booted.
|
---|
| 924 | ;
|
---|
[111] | 925 | IF 0
|
---|
[44] | 926 | DEBUG_Dump2 Proc Near
|
---|
[51] | 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
|
---|
[44] | 1004 | ret
|
---|
[43] | 1005 | DEBUG_Dump2 EndP
|
---|
[84] | 1006 | ELSE
|
---|
| 1007 | DEBUG_Dump2 Proc Near
|
---|
| 1008 | ret
|
---|
| 1009 | DEBUG_Dump2 EndP
|
---|
| 1010 | ENDIF
|
---|
[30] | 1011 |
|
---|
[43] | 1012 |
|
---|
| 1013 |
|
---|
[84] | 1014 | ;
|
---|
[89] | 1015 | ; Display a number that was put on the stack.
|
---|
| 1016 | ; Used to track code-flow.
|
---|
[86] | 1017 | ;
|
---|
[89] | 1018 | dbp db '>---------->> DebugProbe: ',0
|
---|
| 1019 | DEBUG_Probe Proc
|
---|
[111] | 1020 | IF 0
|
---|
[89] | 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
|
---|
[94] | 1040 | ENDIF
|
---|
[89] | 1041 | ret 2
|
---|
| 1042 | DEBUG_Probe Endp
|
---|
| 1043 |
|
---|
| 1044 |
|
---|
| 1045 |
|
---|
| 1046 | ;
|
---|
| 1047 | ; Toggle display of debug video page.
|
---|
| 1048 | ;
|
---|
[111] | 1049 | IF 0
|
---|
[89] | 1050 | DEBUG_DebugScreenToggle Proc
|
---|
| 1051 | pushf
|
---|
| 1052 | pusha
|
---|
| 1053 |
|
---|
| 1054 | mov si, offset $+5
|
---|
| 1055 | jmp @F
|
---|
| 1056 | db 10,'DebugScreenToggle:',10,0
|
---|
| 1057 | prvpg db 00h
|
---|
| 1058 | hdr db 10,'[Debug Console]',13,10,0
|
---|
| 1059 | @@: call AuxIO_Print
|
---|
| 1060 |
|
---|
| 1061 | ; Get current page in BH
|
---|
| 1062 | mov ah, 0fh
|
---|
[86] | 1063 | int 10h
|
---|
[89] | 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
|
---|
[86] | 1111 | ret
|
---|
[89] | 1112 | DEBUG_DebugScreenToggle EndP
|
---|
| 1113 | ELSE
|
---|
| 1114 | DEBUG_DebugScreenToggle Proc
|
---|
| 1115 | ret
|
---|
| 1116 | DEBUG_DebugScreenToggle EndP
|
---|
| 1117 | ENDIF
|
---|
[86] | 1118 |
|
---|
| 1119 |
|
---|
| 1120 |
|
---|
| 1121 | ;
|
---|
[89] | 1122 | ; Handle keypresses when the main menu is active.
|
---|
| 1123 | ;
|
---|
| 1124 | DEBUG_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
|
---|
| 1189 | DEBUG_HandleKeypress Endp
|
---|
| 1190 |
|
---|
| 1191 |
|
---|
| 1192 |
|
---|
| 1193 | ;
|
---|
[84] | 1194 | ; These strings can also be referenced outside the debug module when debugging
|
---|
| 1195 | ; is enabled.
|
---|
| 1196 | ;
|
---|
[111] | 1197 | ;~ dlra db 10,'LVM_DoLetterReassignment: ',0
|
---|
[51] | 1198 | ptetb db 10,'Partition Table Entry to boot',10,0
|
---|
| 1199 | bios_reg db 10,'Registers passed by BIOS:',10,0
|
---|
| 1200 | ;~ diopmbr db 10,'DriveIO_ProtectMBR',10,0
|
---|
[43] | 1201 |
|
---|
| 1202 |
|
---|
[51] | 1203 | ;~ db_mbr db "## MBR ##",10,0
|
---|
| 1204 | ;~ db_masterlvm db "## MLVMR ##",10,0
|
---|
[43] | 1205 |
|
---|
| 1206 |
|
---|
[51] | 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
|
---|
[43] | 1211 |
|
---|
| 1212 |
|
---|
[51] | 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
|
---|
[43] | 1217 |
|
---|
[51] | 1218 | ;~ db_newpart db 'NewPartTable :',10,0
|
---|
| 1219 | ;~ db_newhide db 'NewHideTable:',10,0
|
---|
| 1220 | ;~ db_dletters db 'NewDriveLetters:',10,0
|
---|
[43] | 1221 |
|
---|
[51] | 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
|
---|
[43] | 1227 |
|
---|
[51] | 1228 | ;~ db_totaldisks db 'TotalHarddiscs:',0
|
---|
| 1229 | ;~ db_lbaswitchtab db 'LBASwitchTable:',10,0
|
---|
| 1230 | ;~ db_newparts db 'NewPartitions:',0
|
---|
[43] | 1231 |
|
---|
[51] | 1232 | ;~ db_exabspos db 'ExtendedAbsPos:',0
|
---|
| 1233 | ;~ db_exabsposset db 'ExtendedAbsPosSet:',0
|
---|
[43] | 1234 |
|
---|
[51] | 1235 | ;~ db_curpartloc db 'CurPartition_Location:',0
|
---|
| 1236 | ;~ db_curiox db 'CurIO_UseExtension:',0
|
---|
[47] | 1237 |
|
---|
[51] | 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
|
---|