Changeset 283 in xtideuniversalbios for trunk


Ignore:
Timestamp:
Feb 29, 2012, 11:42:52 AM (13 years ago)
Author:
gregli@…
google:author:
gregli@hotmail.com
Message:

Fixed bug where total sector count was not being properly calculated from ah08 values, as head value is zero based instead of one based. The calcaultion is more complicated than one would like because the head number is in a single byte and could be 255 and we need to avoid an overflow.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/Handlers/Int13h/AH15h_HSize.asm

    r258 r283  
    7777ConvertAH08hReturnValuesToSectorCount:
    7878    call    Address_ExtractLCHSparametersFromOldInt13hAddress
    79     xchg    ax, cx
    80     inc     ax              ; Max cylinder number to cylinder count
    81 .MultiplyChsInAXBLBHtoBXDXAX:
    82     xchg    bx, ax
    83     mul     ah          ; Multiply heads and sectors
    84     mul     bx          ; Multiply with cylinders
    85     xor     bx, bx
     79
     80    mov     al, bl      ; Get sector value
     81    mul     bh          ; Multiply by heads-1 (since bh is zero based, and could be 255 and overflow)
     82    xor     bh, bh      ; Clear upper byte for following addition...
     83    add     ax, bx      ; Add in one more sector value, since heads was off by one
     84    inc     cx          ; Max cylinder number to cylinder count (again, zero based)
     85    mul     cx          ; Multiply in cylinders
     86    xor     bx, bx      ; Zero upper 16-bits, sector count will not be that large
     87       
    8688    ret
Note: See TracChangeset for help on using the changeset viewer.