Well, you should be able to understand and follow your code... Apparently, you are unable to do that. That is a shame!
Just kiddin'
Let's see what your code does:
Code: Select all
getcluster:
mov [.byte], ax ; Should ax be 1, .byte contains 1.
mov dx, 0 ; Clear dx for division
div word [.two] ; Divide ax by 2; ax contains 0, dx contains 1.
add [.byte], ax ; .byte remains 1
mov bx, fat ; Put offset of fat table in bx
add bx, [.byte] ; Add 1 to bx, since that's the value of .byte
mov ax, [bx] ; ax gets the value of [fat + 1]
; which means: 00010000b is placed in al, 00000010b is placed in ah.
; AX is equal to 0x0210
cmp dx, 0 ; dx does not equal zero
je .odd ; So this jump does not occur
and ax, 0000111111111111b ; 0x0210 & 0x0fff = 0x0210 (And there you have your answer.)
ret
.odd: shr ax, 4
ret
.byte: dw 0
.two: dw 2
fat: db 00000000b, 00010000b
db 00000010b, 00000000b
db 00110000b, 00000100b
Good luck with figuring out what to do about this problem... I have the feeling that your fat table is incorrectly defined...