oemboot: optimise FAT12 entry loading (picked from lDOS boot)

This way of clearing the upper 4 bits of even FAT entries
saves a byte compared to the prior way. (The next commit
needs one more byte than was previously left over.)

Reference: https://hg.pushbx.org/ecm/ldosboot/file/410b870c0222/boot.asm#l1629
This commit is contained in:
C. Masloch 2021-07-29 13:16:16 +02:00 committed by Kenneth J Davis
parent 4c2bda46b2
commit f267341281
1 changed files with 5 additions and 4 deletions

View File

@ -412,11 +412,12 @@ fat_12: add si, si ; multiply cluster number by 3...
; value is in bits 4-15, and must be shifted right 4 bits. If
; the number was odd, CF was set in the last shift instruction.
jnc fat_even
mov cl, 4
mov cl, 4 ; always initialise shift counter
jc fat_odd ; is odd, only shift down -->
shl ax, cl ; shift up (effectively masks off
; the highest 4 bits)
fat_odd:
shr ax, cl
fat_even: and ah, 0x0f ; mask off the highest 4 bits
cmp ax, 0x0ff8 ; check for EOF
jb next_clust ; continue if not EOF