Guest User

Untitled

a guest
Jan 22nd, 2018
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     ;Find kernel
  2.     push dx
  3.     ;Number of fats * sectors per fat
  4.     movzx eax, byte [number_of_fats]
  5.     movzx ebx, word [sectors_per_fat]
  6.     mul ebx
  7.     ;Divide number of root dir entries by 16
  8.     movzx ebx, word [number_of_root_dir_entries]
  9.     shr ebx, 4
  10.    
  11.     add eax, ebx ;Add results
  12.    
  13.     movzx ebx, word [reserved_sectors]
  14.     add eax, ebx  ;Add reserved sectors
  15.    
  16.     ;C = eax / (sectors_per_track * num_heads)
  17.     mov ebx, eax ;put LBA in ebx
  18.     movzx eax, word [sectors_per_track]
  19.     movzx ecx, word [num_heads]
  20.     mul ecx
  21.    
  22.     mov esi, ebx ;Put LBA in esi
  23.     mov edi, eax ;Put C in edi
  24.    
  25.     xchg eax, ebx
  26.     xor edx, edx
  27.     div ebx
  28.     push ax
  29.     ;H = (esi / sectors_per_track) % num_heads
  30.     mov eax, esi
  31.     movzx ebx, word[sectors_per_track]
  32.     xor edx, edx
  33.     div ebx
  34.     push dx
  35.     ;modulo:  a - ((a / b) * b);  ebx - LBA, edi - C
  36.     movzx ebx, word[num_heads]
  37.     xor edx, edx
  38.     div ebx
  39.    
  40.     ;H is in edx
  41.     pop bx
  42.     add bx, 1 ;S
  43.     pop cx ;C
  44.    
  45.     xor ax, ax
  46.     mov es, ax
  47.     mov ah,02h
  48.     mov al,10
  49.     mov ch, cl
  50.     mov cl, bl
  51.     mov dh, dl
  52.     pop bx
  53.     mov dl, bl
  54.     mov bx, 0x8000
  55.     int 13h
Add Comment
Please, Sign In to add comment