Changeset 44


Ignore:
Timestamp:
Apr 12, 2014, 12:05:10 AM (11 years ago)
Author:
Ben Rietbroek
Message:

Created Bitfield functions (auxdebug on) [2012-02-21]

WARNING!!

All commits upto and including the commit of [2012-05-13] contain
a severe bug!! Building from these sources and then disabling
the 'force LBA' feature while also using the drive-letter feature or
editing the label can DESTROY THE MBR on ALL ATTACHED DISKS!!
DO NOT DISABLE 'FORCE LBA USAGE' WHEN BUILT FROM THE THESE COMMITS!!

New

o Functions to insert/retrieve bitfields

Let's see if we can compress the hideparttable...

Location:
trunk
Files:
1 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/BOOTCODE/AIR-BOOT.ASM

    r43 r44  
    358358
    359359                ; ID String, Date (DD,MM,CC,YY), Version Number, Language ID
    360                 db      'AiRBOOT', 20h, 02h, 20h, 12h, 01h, 08h, TXT_LanguageID
     360                db      'AiRBOOT', 21h, 02h, 20h, 12h, 01h, 08h, TXT_LanguageID
    361361
    362362                ; Total Sectors Count.
     
    17431743PartitionPointers           dw  52 dup (?)  ; Maximum is 52 entries till now
    17441744PartitionPointerCount       db  ?           ; Count of total Partition Pointers
    1745 PartitionXref               db  partition_count dup (?) ; X-Reference Table
     1745PartitionXref               db  partition_count dup (?) ; X-Reference Table (holds new partnr, index is old part nr)
    17461746PartitionVolumeLetters      db  partition_count dup (?) ; Volume-Letters
    17471747                                                ;  0 - no LVM support
     
    18881888                                                ; (excluding the size word at the start).
    18891889
     1890ott         db  512 dup(?)
     1891
    18901892eobss:
    18911893
  • trunk/BOOTCODE/BLDDATE.ASM

    r43 r44  
    11IFDEF   JWASM
    2     BUILD_DATE db 'Build Date: 20 Feb 2012 at 19:30:00                                 [JWasm]',0
     2    BUILD_DATE db 'Build Date: 21 Feb 2012 at 11:30:00                                 [JWasm]',0
    33ENDIF
    44IFDEF   TASM
    5     BUILD_DATE db 'Build Date: 20 Feb 2012 at 19:30:00                                  [Tasm]',0
     5    BUILD_DATE db 'Build Date: 21 Feb 2012 at 11:30:00                                  [Tasm]',0
    66ENDIF
  • trunk/BOOTCODE/REGULAR/AUXIO.ASM

    r43 r44  
    7171
    7272
    73 ; In:          AL - Single Char to send to Com Port
    74 ;              DL - Port number; 0 for com1, etc.
    75 ; Destroyed: None
    76 AuxIO_PrintSingleChar   Proc  Near  Uses ax es di
    77         nop
    78 AuxIO_PrintSingleChar   EndP
    79 
    8073
    8174; Print char to com-port (teletype style)
  • trunk/BOOTCODE/REGULAR/CONV.ASM

    r43 r44  
    168168        ret
    169169CONV_ToUpper   EndP
     170
     171
     172;
     173; The bitfield functions below are used to pack values into arrays.
     174; A buffer needs to be provided, a bitfield width and an index into the array.
     175; These functions are used to pack the hidden partition-table which is
     176; too small in the 45-partition version.
     177;
     178
     179
     180; IN:   DL = Index to store bitfield
     181;       DH = Bitfield width (1-8)
     182;       BX = Pointer to bitfield array
     183; OUT:  AL = Value of requested bitfield
     184;       AH = Mask value
     185CONV_GetBitfieldValue   Proc    Near    Uses bx cx dx
     186        ; Normalize bit-width in DH.
     187        dec     dh          ; Decrement bitfield width to mask invalid values.
     188        and     dh,07h      ; Only 3 bits are significant to determine width.
     189        mov     cl,dh       ; Save for later use to calculate mask.
     190        inc     dh          ; Put back to normalized value.
     191
     192        ; Calculate corresponding AND-mask in CH.
     193        mov     ch,2        ; Were going to shift 2...
     194        shl     ch,cl       ; to obtain the mask corresponding...
     195        dec     ch          ; to the bitfield width.
     196
     197        ; Calculate byte-index.
     198        mov     al,dl       ; Index in AL.
     199        inc     al          ; Increment for calculations.
     200        mul     dh          ; Multiply by bitfield width to get bits.
     201        mov     cl,8        ; Nr. of bits in a byte.
     202        div     cl          ; Divide to get byte index.
     203
     204        ; Advance pointer to byte-index.
     205        add     bl,al       ; Advance pointer...
     206        adc     bh,0        ; to byte index.
     207
     208        ; Determine if we need 1 or 2 byte access to extract the bitfield.
     209        mov     cl,ah       ; Get remainder in CL.
     210        sub     cl,dh       ; Substract bitfield width to get shift-count.
     211        mov     ah,0        ; Prepare upper=0 when field snaps no byte bound.
     212
     213        ; Jump if the bitfield does not span byte boundaries.
     214        ; (Remainder - bitfield width >= 0)
     215        jae     CONV_GetBitfieldValue_nospan
     216
     217        ; Bit-field spans byte boundaries, so adjust shift-count
     218        ; and use AH to get first part of bitfield.
     219        add     cl,8        ; Adjust shift-count.
     220        mov     ah,[bx]     ; Get byte into AH instead.
     221        dec     bx          ; Prepare pointer to load rest of bitfield.
     222    CONV_GetBitfieldValue_nospan:
     223        mov     al,[bx]     ; Load (rest of) bitfield into AL.
     224        shr     ax,cl       ; Shift bitfield to the right.
     225        mov     ah,ch       ; Get mask in AH.
     226        and     al,ah       ; Mask value.
     227        ret
     228CONV_GetBitfieldValue   EndP
     229
     230
     231
     232
     233; IN:   AL = Value to store
     234;       DL = Index to store bitfield
     235;       DH = Bitfield width (1-8)
     236;       BX = Pointer to bitfield array
     237; OUT:  AL = Value of stored bitfield
     238;       AH = Mask value
     239CONV_SetBitfieldValue   Proc    Near    Uses bx cx dx
     240        ; Push value for later use.
     241        push    ax
     242
     243        ; Normalize bit-width in DH.
     244        dec     dh          ; Decrement bitfield width to mask invalid values.
     245        and     dh,07h      ; Only 3 bits are significant to determine width.
     246        mov     cl,dh       ; Save for later use to calculate mask.
     247        inc     dh          ; Put back to normalized value.
     248
     249        ; Calculate corresponding AND-mask in CH.
     250        mov     ch,2        ; Were going to shift 2...
     251        shl     ch,cl       ; to obtain the mask corresponding...
     252        dec     ch          ; to the bitfield width.
     253
     254        ; Calculate byte-index.
     255        mov     al,dl       ; Index in AL.
     256        inc     al          ; Increment for calculations.
     257        mul     dh          ; Multiply by bitfield width to get bits.
     258        mov     cl,8        ; Nr. of bits in a byte.
     259        div     cl          ; Divide to get byte index.
     260
     261        ; Advance pointer to byte-index.
     262        add     bl,al       ; Advance pointer...
     263        adc     bh,0        ; to byte index.
     264
     265        ; Determine if we need 1 or 2 byte access to extract the bitfield.
     266        mov     cl,ah       ; Get remainder in CL.
     267        sub     cl,dh       ; Substract bitfield width to get shift-count.
     268
     269        ; Restore value.
     270        pop     ax
     271
     272
     273        ; Jump if the bitfield does not span byte boundaries.
     274        ; (Remainder - bitfield width >= 0)
     275        jae     CONV_SetBitfieldValue_nospan
     276
     277        ; Bit-field spans byte boundaries, so adjust shift-count
     278        ; and use 16-bit access.
     279        add     cl,8        ; Adjust shift-count.
     280
     281        ; Merge the bitfield to the array.
     282        push    cx          ; Save mask (CH) and shift-count (CL).
     283        push    ax          ; Save value to store.
     284        mov     ah,0        ; Clear upper byte so we can shift in it.
     285        and     al,ch       ; Mask value.
     286        shl     ax,cl       ; Move the bitfield to the proper location.
     287        mov     dh,[bx]     ; Get 1st part of bitfield from array.
     288        dec     bx          ; Adjust pointer.
     289        mov     dl,[bx]     ; Get 2nd part of bitfield from array.
     290        push    bx          ; We need BX so save it.
     291        mov     bh,0        ; Clear upper byte so we can shift in it.
     292        mov     bl,ch       ; Put mask in BL.
     293        shl     bx,cl       ; Shift mask to proper location.
     294        not     bx          ; Complement it to mask-out the required bitfield.
     295        and     dx,bx       ; Mask-out the required bitfield.
     296        pop     bx          ; Restore pointer.
     297        or      ax,dx       ; Merge the bitfields.
     298        mov     [bx],al     ; Store lower byte.
     299        inc     bx          ; Adjust pointer.
     300        mov     [bx],ah     ; Store upper byte.
     301        pop     ax          ; Restore value.
     302        pop     cx          ; Restore mask and shift-count.
     303
     304        ; Done.
     305        jmp     CONV_SetBitfieldValue_end
     306
     307
     308    CONV_SetBitfieldValue_nospan:
     309        ; Merge the bitfield to the array.
     310        push    cx          ; Save mask (CH) and shift-count (CL).
     311        push    ax          ; Save value to store.
     312        and     al,ch       ; Mask value.
     313        shl     al,cl       ; Move the bitfield to the proper location.
     314        mov     dl,[bx]     ; Get byte containing bitfield.
     315        shl     ch,cl       ; Shift mask to proper location.
     316        not     ch          ; Complement it to mask-out the required bitfield.
     317        and     dl,ch       ; Mask-out the required bitfield.
     318        or      al,dl       ; Merge the bitfields.
     319        mov     [bx],al     ; Store byte containing bitfield.
     320        pop     ax          ; Restore value.
     321        pop     cx          ; Restore mask and shift-count.
     322
     323    CONV_SetBitfieldValue_end:
     324        mov     ah,ch       ; Get mask in AH.
     325        and     al,ah       ; Mask value.
     326        ret
     327CONV_SetBitfieldValue   EndP
     328
  • trunk/BOOTCODE/REGULAR/DEBUG.ASM

    r43 r44  
    190190        ;~ call    DEBUG_DumpGeo
    191191
    192 
     192        call    DEBUG_CheckBitFields
    193193
    194194        popa
     
    226226        popf
    227227        ret
    228 
    229 
    230228DEBUG_DumpBSSSectors    EndP
    231229
    232230
    233 
     231DEBUG_CheckBitFields    Proc
     232        pushf
     233        pusha
     234
     235        mov     bx,offset [ott]
     236
     237        mov     al,0
     238        mov     dl,0
     239        mov     dh,6
     240    DEBUG_CheckBitFields_next_write:
     241        call    CONV_SetBitfieldValue
     242        inc     al
     243        inc     dl
     244        ;~ cmp     dl,70
     245        jnz     DEBUG_CheckBitFields_next_write
     246
     247        mov     dl,0
     248        mov     dh,6
     249    DEBUG_CheckBitFields_next_read:
     250        mov     al,dl
     251        call    AuxIO_TeletypeHexByte
     252        mov     al,':'
     253        call    AuxIO_Teletype
     254        call    CONV_GetBitfieldValue
     255        call    AuxIO_TeletypeHexWord
     256        call    AuxIO_TeletypeNL
     257        inc     dl
     258        ;~ cmp     dl,70
     259        jnz     DEBUG_CheckBitFields_next_read
     260
     261        popa
     262        popf
     263        ret
     264DEBUG_CheckBitFields    EndP
    234265
    235266;
     
    237268;
    238269DEBUG_Dump2     Proc  Near
    239         pushf
    240         pusha
    241 
    242 
    243         call    AuxIO_TeletypeNL
    244         call    AuxIO_TeletypeNL
    245 
    246 
    247         mov     si,offset db_config
    248         call    AuxIO_Print
    249 
    250         mov     si,offset db_cfgparts
    251         call    AuxIO_Print
    252         mov     al,[CFG_Partitions]
    253         call    AuxIO_TeletypeHexByte
    254         call    AuxIO_TeletypeNL
    255 
    256         mov     si,offset db_cfgpartdef
    257         call    AuxIO_Print
    258         mov     al,[CFG_PartDefault]
    259         call    AuxIO_TeletypeHexByte
    260         call    AuxIO_TeletypeNL
    261 
    262         mov     si,offset db_cfgpartlast
    263         call    AuxIO_Print
    264         mov     al,[CFG_PartLast]
    265         call    AuxIO_TeletypeHexByte
    266         call    AuxIO_TeletypeNL
    267         call    AuxIO_TeletypeNL
    268 
    269 
    270 
    271         mov     si,offset db_vars
    272         call    AuxIO_Print
    273 
    274         mov     si,offset db_newpart
    275         call    AuxIO_Print
    276         mov     si,offset NewPartTable
    277         call    AuxIO_DumpSector
    278         call    AuxIO_TeletypeNL
    279         add     si,512
    280         call    AuxIO_DumpSector
    281         call    AuxIO_TeletypeNL
    282         call    AuxIO_TeletypeNL
    283 
    284         mov     si,offset db_newhide
    285         call    AuxIO_Print
    286         mov     si,offset NewHidePartTable
    287         call    AuxIO_DumpSector
    288         call    AuxIO_TeletypeNL
    289         add     si,512
    290         call    AuxIO_DumpSector
    291         call    AuxIO_TeletypeNL
    292         call    AuxIO_TeletypeNL
    293 
    294         mov     si,offset db_dletters
    295         call    AuxIO_Print
    296         mov     si,offset NewDriveLetters
    297         call    AuxIO_DumpParagraph
    298         call    AuxIO_TeletypeNL
    299         add     si,16
    300         call    AuxIO_DumpParagraph
    301         call    AuxIO_TeletypeNL
    302         call    AuxIO_TeletypeNL
    303 
    304         mov     si,offset db_tmpec
    305         call    AuxIO_Print
    306         mov     si,offset TmpSector
    307         call    AuxIO_DumpSector
    308         call    AuxIO_TeletypeNL
    309         call    AuxIO_TeletypeNL
    310 
    311         mov     si,offset db_partsec
    312         call    AuxIO_Print
    313         mov     si,offset PartitionSector
    314         call    AuxIO_DumpSector
    315         call    AuxIO_TeletypeNL
    316         call    AuxIO_TeletypeNL
    317 
    318         popa
    319         popf
     270        ;~ pushf
     271        ;~ pusha
     272;~
     273;~
     274        ;~ call    AuxIO_TeletypeNL
     275        ;~ call    AuxIO_TeletypeNL
     276;~
     277;~
     278        ;~ mov     si,offset db_config
     279        ;~ call    AuxIO_Print
     280;~
     281        ;~ mov     si,offset db_cfgparts
     282        ;~ call    AuxIO_Print
     283        ;~ mov     al,[CFG_Partitions]
     284        ;~ call    AuxIO_TeletypeHexByte
     285        ;~ call    AuxIO_TeletypeNL
     286;~
     287        ;~ mov     si,offset db_cfgpartdef
     288        ;~ call    AuxIO_Print
     289        ;~ mov     al,[CFG_PartDefault]
     290        ;~ call    AuxIO_TeletypeHexByte
     291        ;~ call    AuxIO_TeletypeNL
     292;~
     293        ;~ mov     si,offset db_cfgpartlast
     294        ;~ call    AuxIO_Print
     295        ;~ mov     al,[CFG_PartLast]
     296        ;~ call    AuxIO_TeletypeHexByte
     297        ;~ call    AuxIO_TeletypeNL
     298        ;~ call    AuxIO_TeletypeNL
     299;~
     300;~
     301;~
     302        ;~ mov     si,offset db_vars
     303        ;~ call    AuxIO_Print
     304;~
     305        ;~ mov     si,offset db_newpart
     306        ;~ call    AuxIO_Print
     307        ;~ mov     si,offset NewPartTable
     308        ;~ call    AuxIO_DumpSector
     309        ;~ call    AuxIO_TeletypeNL
     310        ;~ add     si,512
     311        ;~ call    AuxIO_DumpSector
     312        ;~ call    AuxIO_TeletypeNL
     313        ;~ call    AuxIO_TeletypeNL
     314;~
     315        ;~ mov     si,offset db_newhide
     316        ;~ call    AuxIO_Print
     317        ;~ mov     si,offset NewHidePartTable
     318        ;~ call    AuxIO_DumpSector
     319        ;~ call    AuxIO_TeletypeNL
     320        ;~ add     si,512
     321        ;~ call    AuxIO_DumpSector
     322        ;~ call    AuxIO_TeletypeNL
     323        ;~ call    AuxIO_TeletypeNL
     324;~
     325        ;~ mov     si,offset db_dletters
     326        ;~ call    AuxIO_Print
     327        ;~ mov     si,offset NewDriveLetters
     328        ;~ call    AuxIO_DumpParagraph
     329        ;~ call    AuxIO_TeletypeNL
     330        ;~ add     si,16
     331        ;~ call    AuxIO_DumpParagraph
     332        ;~ call    AuxIO_TeletypeNL
     333        ;~ call    AuxIO_TeletypeNL
     334;~
     335        ;~ mov     si,offset db_tmpec
     336        ;~ call    AuxIO_Print
     337        ;~ mov     si,offset TmpSector
     338        ;~ call    AuxIO_DumpSector
     339        ;~ call    AuxIO_TeletypeNL
     340        ;~ call    AuxIO_TeletypeNL
     341;~
     342        ;~ mov     si,offset db_partsec
     343        ;~ call    AuxIO_Print
     344        ;~ mov     si,offset PartitionSector
     345        ;~ call    AuxIO_DumpSector
     346        ;~ call    AuxIO_TeletypeNL
     347        ;~ call    AuxIO_TeletypeNL
     348;~
     349        ;~ popa
     350        ;~ popf
    320351        ret
    321352DEBUG_Dump2     EndP
  • trunk/BOOTCODE/REGULAR/PARTMAIN.ASM

    r43 r44  
    16221622IFDEF AUX_DEBUG
    16231623   call     DEBUG_Dump2
    1624    call     DEBUG_DumpBSSSectors
     1624   ;~ call     DEBUG_DumpBSSSectors
    16251625ENDIF
    16261626
  • trunk/BOOTCODE/REGULAR/PARTSCAN.ASM

    r43 r44  
    197197        je      PSSP_IgnorePartition
    198198        ; Ignore these partitions, because there are no real Partitions
    199                 call    DEBUG_DumpBSSSectors
     199                ;~ call    DEBUG_DumpBSSSectors
    200200        call    PARTSCAN_CheckThisPartition
    201                 call    DEBUG_DumpBSSSectors
     201                ;~ call    DEBUG_DumpBSSSectors
    202202    PSSP_IgnorePartition:
    203203        ; L”scht das Boot-Able Flag...
  • trunk/BOOTCODE/REGULAR/STD_TEXT.ASM

    r43 r44  
    4242;Copyright             db ' AiR-BOOT v1.0.8 - (c) 2012 M. Kiewitz  <<Release Candidate 1>> (bld: 20120124)', 0
    4343;Copyright             db ' AiR-BOOT v1.0.8 - (c) 2012 M. Kiewitz  <<Release Candidate 2>> (bld: 20120214)', 0
    44 Copyright             db ' AiR-BOOT v1.0.8 - (c) 2012 M. Kiewitz  <<Internal Release 2f>> (bld: 20120220)', 0
     44Copyright             db ' AiR-BOOT v1.0.8 - (c) 2012 M. Kiewitz  <<Internal Release 2g>> (bld: 20120221)', 0
    4545;Copyright             db ' AiR-BOOT v1.0.8 - (c) 1998-2012 M. Kiewitz, Dedicated to Gerd Kiewitz', 0
    4646
Note: See TracChangeset for help on using the changeset viewer.