2017-02-09 3 views
0

現在のクラスタを分割して結果を追加する理由がわかりません。
ここクラスタポインタは12ビットでそれぞれコードFAT12ファイルシステムで新しいクラスタを見つけるためにFATテーブルのインデックスを作成する方法を理解していない

mov  ax, WORD [cluster] ; current cluster 

mov  cx, ax    ; copy current cluster 

mov  dx, ax    ; copy current cluster 

shr  dx, 0x0001   ; divide by two 

add  cx, dx    ; sum for (3/2) 

mov  bx, 0x0200   ; location of FAT in memory 

add  bx, cx    ; index into FAT 

mov dx, WORD [bx]  ; read two bytes from FAT 

test ax, 0x0001 

jnz  .ODD_CLUSTER ; Remember that each entry in the FAT is a 12 but value. If it represents ; a cluster (0x002 through 0xFEF) then we only want to get those 12 bits ; that represent the next cluster  

    .EVEN_CLUSTER:   
and  dx, 0000111111111111b  ; take low twelve bits  
    jmp  .DONE 

    .ODD_CLUSTER:   
    shr  dx, 0x0004     ; take high twelve bits  

.DONE:   
    mov  WORD [cluster], dx   ; store new cluster  
    cmp  dx, 0x0FF0     ; test for end of file   
+0

「JNZ .ODD_CLUSTER」の後にあなた自身のコードでそのコメントを読むことができます。 – tofro

答えて

1

あります。バイトは8ビットなので、FATテーブル内のクラスタポインタのバイトオフセットはcluster * 12/8 == cluster * 1.5です。
整数に1.5を掛けるには、i + (i >> 1)を実行します。これはこのコードの機能です。

+0

ありがとう私はそれを得た –

関連する問題