Guest User

Partition table

a guest
Feb 27th, 2012
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;
  2. ; LBA
  3. ;
  4.     ; Find the LBA of the active partition
  5.     mov bx, 0x7dbe      ; Address of partition table in memory
  6.                     ; (0x7c00 + 446).
  7.     .ptable_loop:
  8.         mov ah, [bx]    ; Partition status byte.
  9.         cmp ah, 0x80
  10.         je  .bootable_found ; Found bootable partition.
  11.         add bx, 16  ; Next entry.
  12.         jmp .ptable_loop
  13.     .bootable_found:
  14.         mov ax,     [bx + 0x0c]
  15.         mov [dap.offset],   ax
  16.  
  17. ;
  18. ; CHS
  19. ;
  20.     ; Find the CHS of the active partition.
  21.     mov bx, 0x7dbe      ; Address of partition table in memory
  22.     .ptable_loop:
  23.         mov ah, [bx]    ; Partition status byte.
  24.         cmp ah, 0x80
  25.         je  .bootable_found ; Found bootable partition.
  26.         add bx, 16  ; Next entry.
  27.         jmp .ptable_loop
  28.     .bootable_found:
  29.         mov ax,     [bx + 0x01]
  30.         mov [stage2_chs],   ax
Advertisement
Add Comment
Please, Sign In to add comment