Ignore:
Timestamp:
Apr 11, 2014, 11:48:01 PM (11 years ago)
Author:
Ben Rietbroek
Message:

BSS Corruption Problem located (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!!

Problem

o Function with Xrefs goes out-of-bounds because hideparttable is too small

Has only 30 entries and should be 45.
Lost partition checker initializes out-of-bounds.

Info

o About the hideparttable

For each partition it can be specified which other partitions need to
be hidden when that partition is booted. This is useful for legacy DOS
but also braindead Windows that presents HPFS/JFS partitions as
unformatted and tries to persuade the user to format them.
With v1.07 the numer of partitions that can be handled was expanded from
30 to 45, but the size of the hideparttable was overseen.

o The need to compress the hideparttable

The old size was 30x30=900 bytes while the required size is 45x45=2045 bytes.
This amount of space is not available in the image.
Since 6 bits are enough to identify the partition number to be hidden,
the solution is to devide the table into bitfields. This will result
in a table of (45*45*6)/8=1519 bytes, which can be fitted.

Changes

Revamped the sources quite a bit and moved the history to a separate
file. (AIR-BOOT.HIS)

New

o FIXCODE script for Linux

Just until the C version is ready...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BOOTCODE/REGULAR/OTHER.ASM

    r40 r43  
    2929;            Zero Flag set if nul string
    3030; Destroyed: None
    31 GetLenOfName                    Proc Near   Uses ax si
    32    add     si, cx
    33    dec     si
    34   GLON_NameLoop:
    35       mov     al, ds:[si]
    36       dec     si
    37       cmp     al, 32
    38       ja      GLON_EndLoop
    39       dec     cx
    40       jnz     GLON_NameLoop
    41   GLON_EndLoop:
    42    or      cx, cx
    43    ret                                   ; return supposed len
    44 GetLenOfName                    EndP
     31GetLenOfName        Proc Near   Uses ax si
     32        add     si, cx
     33        dec     si
     34    GLON_NameLoop:
     35        mov     al, ds:[si]
     36        dec     si
     37        cmp     al, 32
     38        ja      GLON_EndLoop
     39        dec     cx
     40        jnz     GLON_NameLoop
     41    GLON_EndLoop:
     42        or      cx, cx
     43        ret                                   ; return supposed len
     44GetLenOfName        EndP
    4545
    4646;        In: DS:SI - Pointer to NUL-terminated string
     
    4848;            Zero Flag set if nul string
    4949; Destroyed: None
    50 GetLenOfString                 Proc Near   Uses ax si
    51    xor     cx, cx
    52   GLOS_StringLoop:
    53       lodsb
    54       or      al, al
    55       jz      GLOS_EndOfString
    56       inc     cx
    57       jmp     GLOS_StringLoop
    58 
    59   GLOS_EndOfString:
    60    or      cx, cx
    61    ret
    62 GetLenOfString                 EndP
     50GetLenOfString      Proc Near   Uses ax si
     51        xor     cx, cx
     52    GLOS_StringLoop:
     53        lodsb
     54        or      al, al
     55        jz      GLOS_EndOfString
     56        inc     cx
     57        jmp     GLOS_StringLoop
     58
     59    GLOS_EndOfString:
     60        or      cx, cx
     61        ret
     62GetLenOfString      EndP
    6363
    6464;        In: DS:SI - Pointer to NUL-terminated strings
     
    6666;       Out: CX - Length of strings
    6767; Destroyed: None
    68 GetLenOfStrings                Proc Near   Uses bx dx si
    69    mov     dh, cl
    70    xor     dl, dl
    71   GLOSS_StringsLoop:
    72       call    GetLenOfString
    73       add     dl, cl
    74       add     si, cx
    75       inc     si
    76    dec     dh
    77    jnz     GLOSS_StringsLoop
    78    ;movzx   cx, dl
    79    mov   cl,dl
    80    mov   ch,0
    81 
    82    ret
    83 GetLenOfStrings                EndP
    84 
    85 PRECRAP_Main                    Proc Near
    86    ; First initialize Variable-Area (everything with NUL)
    87    mov     di, offset BeginOfVariables
    88    mov     cx, offset EndOfVariables-offset BeginOfVariables
    89    xor     ax, ax
    90    shr     cx, 1
    91    inc     cx
    92    rep     stosw
    93 
    94    mov     VideoIO_Segment, VideoIO_Page0
    95 
    96    ; Don't use blinking attribute
    97    call     VideoIO_NoBlinking
    98 
    99    ; Get HardDriveCount
    100    call    DriveIO_GetHardDriveCount
    101 
    102 
    103                ; Rousseau: added
    104                call    VideoIO_ClearScreen
    105 
    106                ; Cursor to upper-left
    107                mov     TextPosX, 0
    108                mov     TextPosY, 0
    109                call    VideoIO_CursorSet
    110 
    111                ;mov     ax, VideoIO_Page1
    112                ;call    VideoIO_BackUpTo   ; Copy BIOS POST to Second Page
    113 
    114                ; Copyright
    115                mov     si, offset Copyright
    116                call    MBR_Teletype
    117                xor     si,si
    118                call    MBR_TeletypeNL
    119 
    120 
    121                ;call    SOUND_Beep
    122 
    123                ; Build Date
    124                mov     si, offset BUILD_DATE
    125                call    MBR_TeletypeNL
    126 
    127                ; Initialize the com-port for debugging
    128 ;               call     AuxIO_Init
    129 
    130                xor     si,si
    131                call    MBR_TeletypeNL
    132 
    133                xor      cx,cx
    134             PRECRAP_Main_next_disk:
    135 
    136                mov      dl,cl
    137                or       dl,80h
    138 
    139                call     DriveIO_GatherDiskInfo              ; Also used to fill the geo, should be separate function
    140 
    141                mov      bx,offset HugeDisk
    142                add      bx,cx
    143                mov      [bx], al
    144 
    145                call     DriveIO_LoadMasterLVMSector         ; returns NC if no valid LVM record found
    146 
    147                pushf
    148 
    149 ;                mov     al,'#'
    150 ;                pushf
    151 ;                call    VideoIO_PrintSingleChar
    152 ;                popf
    153 ;                mov     al,0
    154 ;                rcl     al,1
    155 ;                call    VideoIO_PrintHexByte
    156 ;                mov     al,'#'
    157 ;                call    VideoIO_PrintSingleChar
    158 
    159                mov      bx, offset TrueSecs
    160                add      bx,cx
    161                add      bx,cx
    162                add      bx,cx
    163                add      bx,cx
    164                popf
    165 
    166                ; bx now contains pointer to truesecs for this drive
    167 
    168                jnc      NoValidMasterLVM
    169 
    170                 ; ?? 3f bij disk 80h maar 0 bij disk 81h
    171                mov      si,offset LVMSector
    172                mov      ax,[si+LocLVM_Secs]
    173 
    174 ;                pusha
    175 ;                mov     dx,ax
    176 ;                mov     al,'%'
    177 ;                call    VideoIO_PrintSingleChar
    178 ;                mov     ax,dx
    179 ;                call    VideoIO_PrintHexWord
    180 ;                mov     al,'%'
    181 ;                call    VideoIO_PrintSingleChar
    182 ;                popa
    183 
    184                mov      word ptr [bx],ax
    185                jmp      SkipUseBiosSecs
    186 
    187 
    188             NoValidMasterLVM:
    189                push     bx                   ; push truesecs pointer
    190                mov      bx, offset BIOS_Secs
    191                add      bx,cx
    192                add      bx,cx
    193                add      bx,cx
    194                add      bx,cx
    195 
    196                mov      ax,[bx]              ; get biossecs
    197                pop      bx
    198                mov      word ptr [bx],ax     ; store bios secs in truesecs
    199 
    200 
    201             SkipUseBiosSecs:
    202                inc      cx
    203                cmp      cl,[TotalHarddiscs]
    204                jb       PRECRAP_Main_next_disk
    205 
    206 
    207 
    208 IFDEF AuxDebug
    209                ; Write some debug-info to the com-port
    210                call     DEBUG_Dump1
    211 ENDIF
    212 
    213               ; jz       NoValidMasterLVM
    214 
    215 
    216                ; A valid Master LVM has been found.
    217                ; We use the values in here to determine the number of sectors per track,
    218                ; since this could be OS/2 extended geometry.
    219 
    220               ; jmp      Continue1
    221 
    222 
    223                ;mov      word ptr [LOG_Secs],63
     68GetLenOfStrings     Proc Near   Uses bx dx si
     69        mov     dh, cl
     70        xor     dl, dl
     71    GLOSS_StringsLoop:
     72        call    GetLenOfString
     73        add     dl, cl
     74        add     si, cx
     75        inc     si
     76        dec     dh
     77        jnz     GLOSS_StringsLoop
     78        ;movzx   cx, dl
     79        mov   cl,dl
     80        mov   ch,0
     81        ret
     82GetLenOfStrings     EndP
     83
     84PRECRAP_Main    Proc Near
     85        ; First initialize Variable-Area (everything with NUL)
     86        ; We use the start instead of the variables because they could be 'orged'
     87        ; to an offset. We want everything after the code to be nullified.
     88        mov     di, offset sobss
     89        mov     cx, offset EndOfVariables-offset BeginOfVariables
     90        xor     ax, ax
     91        shr     cx, 1
     92        inc     cx
     93        rep     stosw
     94
     95        mov     VideoIO_Segment, VideoIO_Page0
     96
     97        ; Don't use blinking attribute
     98        call    VideoIO_NoBlinking
     99
     100        ; Get HardDriveCount
     101        call    DriveIO_GetHardDriveCount
     102
     103
     104        ; Rousseau: added
     105        call    VideoIO_ClearScreen
     106
     107        ; Cursor to upper-left
     108        mov     TextPosX, 0
     109        mov     TextPosY, 0
     110        call    VideoIO_CursorSet
     111
     112        ;~ mov     ax, VideoIO_Page1
     113        ;~ call    VideoIO_BackUpTo   ; Copy BIOS POST to Second Page
     114
     115        ; Copyright
     116        mov     si, offset Copyright
     117        call    MBR_Teletype
     118        xor     si,si
     119        call    MBR_TeletypeNL
     120
     121
     122        ;call    SOUND_Beep
     123
     124        ; Build Date
     125        mov     si, offset BUILD_DATE
     126        call    MBR_TeletypeNL
     127
     128    IFDEF   AUX_DEBUG
     129        ; Initialize the com-port for debugging
     130        call     AuxIO_Init
     131    ENDIF
     132
     133        xor     si,si
     134        call    MBR_TeletypeNL
     135
     136        xor     cx,cx
     137    PRECRAP_Main_next_disk:
     138
     139        mov     dl,cl
     140        or      dl,80h
     141
     142        ;
     143        ; This also setup the size of the i13xbuf.
     144        ;
     145        call     DriveIO_GatherDiskInfo              ; Also used to fill the geo, should be separate function
     146
     147        mov      bx,offset HugeDisk
     148        add      bx,cx
     149        mov      [bx], al
     150
     151        call     DriveIO_LoadMasterLVMSector         ; returns NC if no valid LVM record found
     152
     153        pushf
     154
     155        ;~ mov     al,'#'
     156        ;~ pushf
     157        ;~ call    VideoIO_PrintSingleChar
     158        ;~ popf
     159        ;~ mov     al,0
     160        ;~ rcl     al,1
     161        ;~ call    VideoIO_PrintHexByte
     162        ;~ mov     al,'#'
     163        ;~ call    VideoIO_PrintSingleChar
     164
     165        mov      bx, offset TrueSecs
     166        add      bx,cx
     167        add      bx,cx
     168        add      bx,cx
     169        add      bx,cx
     170        popf
     171
     172        ; bx now contains pointer to truesecs for this drive
     173
     174        jnc      NoValidMasterLVM
     175
     176        ; ?? 3f bij disk 80h maar 0 bij disk 81h
     177        mov     si,offset LVMSector
     178        mov     ax,[si+LocLVM_Secs]
     179
     180        ;~ pusha
     181        ;~ mov     dx,ax
     182        ;~ mov     al,'%'
     183        ;~ call    VideoIO_PrintSingleChar
     184        ;~ mov     ax,dx
     185        ;~ call    VideoIO_PrintHexWord
     186        ;~ mov     al,'%'
     187        ;~ call    VideoIO_PrintSingleChar
     188        ;~ popa
     189
     190        mov      word ptr [bx],ax
     191        jmp      SkipUseBiosSecs
     192
     193
     194    NoValidMasterLVM:
     195        push    bx                   ; push truesecs pointer
     196        mov     bx, offset BIOS_Secs
     197        add     bx,cx
     198        add     bx,cx
     199        add     bx,cx
     200        add     bx,cx
     201
     202        mov     ax,[bx]              ; get biossecs
     203        pop     bx
     204        mov     word ptr [bx],ax     ; store bios secs in truesecs
     205
     206
     207    SkipUseBiosSecs:
     208        inc     cx
     209        cmp     cl,[TotalHarddiscs]
     210        jb      PRECRAP_Main_next_disk
     211
     212
     213
     214    IFDEF AUX_DEBUG
     215        ; Write some debug-info to the com-port
     216        call     DEBUG_Dump1
     217    ENDIF
     218
     219        ;~ jz      NoValidMasterLVM
     220;~
     221        ;~ ; A valid Master LVM has been found.
     222        ;~ ; We use the values in here to determine the number of sectors per track,
     223        ;~ ; since this could be OS/2 extended geometry.
     224;~
     225        ;~ jmp     Continue1
     226        ;~
     227        ;~ mov     word ptr [LOG_Secs],63
    224228
    225229;               mov      al,[HugeDisk]           ;; fout, moet nog index bij
     
    233237
    234238
    235                  ; Huge Disk indicator
    236                  mov     si, offset HugeBootDisk
    237                  call    MBR_Teletype
    238                  mov     al,[HugeDisk]
    239                  mov     si, offset No
    240                  test    al,al
    241                  jz      MBR_HugeDriveIndicator
    242                  mov     si, offset Yes
    243 
    244                MBR_HugeDriveIndicator:
    245                  call    MBR_Teletype
    246                  xor     si,si
    247                  call    MBR_TeletypeNL
    248 
    249 
    250 
    251 
    252 
    253                  ;
    254                  ; Phase 1 Indicator
    255                  ;
    256                  mov     si, offset Phase1
    257                  call    MBR_Teletype
    258 
    259                  mov     si, offset eCS_InstallVolume
    260                  mov     al, [si]
    261                  test    al,al                                 ; See if phase 1 is active
    262                  jnz     MBR_Main_BootThrough
    263                  mov     si, offset NotActive
    264 
    265                MBR_Main_BootThrough:
    266                  call    MBR_Teletype
    267                  xor     si,si
    268                  call    MBR_TeletypeNL
    269 
    270 
    271    ; Calculate Cooper-Bar Tables
    272    call    FX_CalculateTables
    273 
    274    ; Calculate LVM-CRC-Table
    275    call    LVM_InitCRCTable
    276 
    277    ; Get HardDriveCount
    278    call    DriveIO_GetHardDriveCount
    279 
    280    ; Calculate CHS/LBA Switch Table
    281    call    DriveIO_InitLBASwitchTable
    282 
    283    ; Setup PartitionPointers-Table
    284    call    PART_CalculateStraightPartPointers
    285 
    286    ; Setup Cyrillic Charset, if needed
    287    ifdef TXT_IncludeCyrillic
    288       call    CHARSET_IncludeCyrillic
    289    endif
    290 
    291 
    292     ; This sets [CurIO_UseExtension] flag.
    293     call    PRECRAP_CheckFor13extensions
    294 
    295 
    296 
    297    IFNDEF ReleaseCode
    298       ret
    299    ENDIF
    300 
    301 
    302    call    PRECRAP_CheckConfiguration
    303 
    304 
    305    ; =======================================
    306    ; Checks for MBR Virii :) I love that job
    307    ; =======================================
    308    test    CFG_DetectStealth, 1
    309    jz      PCM_NoStealthDetection
    310       call    VIRUS_CheckForStealth
    311   PCM_NoStealthDetection:
    312    test    CFG_DetectVirus, 1
    313    jz      PCM_NoVirusDetection
    314       call    VIRUS_CheckForVirus
    315   PCM_NoVirusDetection:
    316 
    317 
    318    ; ============================================
    319    ;  Delay for some time and get Strg/Alt State
    320    ; ============================================
    321    test    CFG_CooperBars, 1
    322    jnz     PCM_ShortDelay
    323    mov     al, 27                        ; About 1.5 seconds
    324    test    CFG_FloppyBootGetName, 1
    325    jz      PCM_LongDelay
    326   PCM_ShortDelay:
    327 
    328    mov     al, 13                        ; shorten delay,if floppy gets accessed
    329   PCM_LongDelay:
    330 
    331    call    TIMER_WaitTicCount
    332 
    333    ; First check, if any normal key got pressed...
    334    mov     ah, 1
    335    int     16h
    336    jz      PCM_NoNormalKeyPressed
    337    ; User doesn't know what to do...or he is crazy <g> so display message
    338    mov     si, offset TXT_HowEnterSetup
    339    call    MBR_Teletype
    340    mov     al, 54                        ; about 3 seconds, delay again
    341 
    342    call    TIMER_WaitTicCount
    343 
    344   PCM_NoNormalKeyPressed:
    345    ; Now get keyboard Strg/Alt State
    346    mov     ah, 02h
    347    int     16h
    348    mov     SETUP_KeysOnEntry, al
    349 
    350    ; Copy device-name to the ContBIOSbootSeq-IPT entry
    351    ;  We may not do this before PRECRAP_CheckConfiguration, because otherwise
    352    ;  this check will fail.
    353    call    PART_UpdateResumeBIOSName
    354    ret
    355 PRECRAP_Main                    EndP
    356 
    357 
    358 
    359 AFTERCRAP_Main                  Proc Near
    360    ; ===================================================
    361    ;  Now get volume label of FloppyDrive, if wanted...
    362    ; ===================================================
    363    test    CFG_FloppyBootGetName, 1
    364    jz      ACM_NoFloppyGetName
    365       call    DriveIO_UpdateFloppyName
    366       or      ax, ax
    367       jnz     ACM_NoFloppyGetName
    368       ; Try a second time, if it failed to detect the Floppy
    369       call    DriveIO_UpdateFloppyName
    370   ACM_NoFloppyGetName:
    371    ret
    372 AFTERCRAP_Main                  EndP
     239        ; Huge Disk indicator
     240        mov     si, offset HugeBootDisk
     241        call    MBR_Teletype
     242        mov     al,[HugeDisk]
     243        mov     si, offset No
     244        test    al,al
     245        jz      MBR_HugeDriveIndicator
     246        mov     si, offset Yes
     247
     248    MBR_HugeDriveIndicator:
     249        call    MBR_Teletype
     250        xor     si,si
     251        call    MBR_TeletypeNL
     252
     253
     254        ;
     255        ; Phase 1 Indicator
     256        ;
     257        mov     si, offset Phase1
     258        call    MBR_Teletype
     259
     260        mov     si, offset eCS_InstallVolume
     261        mov     al, [si]
     262        test    al,al                                 ; See if phase 1 is active
     263        jnz     MBR_Main_BootThrough
     264        mov     si, offset NotActive
     265
     266    MBR_Main_BootThrough:
     267        call    MBR_Teletype
     268        xor     si,si
     269        call    MBR_TeletypeNL
     270
     271
     272        ; Calculate Cooper-Bar Tables
     273        call    FX_CalculateTables
     274
     275        ; Calculate LVM-CRC-Table
     276        call    LVM_InitCRCTable
     277
     278        ; Get HardDriveCount
     279        call    DriveIO_GetHardDriveCount
     280
     281        ; Calculate CHS/LBA Switch Table
     282        call    DriveIO_InitLBASwitchTable
     283
     284        ; Setup PartitionPointers-Table
     285        call    PART_CalculateStraightPartPointers
     286
     287        ; Setup Cyrillic Charset, if needed
     288    IFDEF TXT_IncludeCyrillic
     289        call    CHARSET_IncludeCyrillic
     290    ENDIF
     291
     292
     293        ; This sets [CurIO_UseExtension] flag.
     294        call    PRECRAP_CheckFor13extensions
     295
     296    IFNDEF ReleaseCode
     297        ret
     298    ENDIF
     299
     300
     301    call    PRECRAP_CheckConfiguration
     302
     303
     304        ; =======================================
     305        ; Checks for MBR Virii :) I love that job
     306        ; =======================================
     307        test    CFG_DetectStealth, 1
     308        jz      PCM_NoStealthDetection
     309        call    VIRUS_CheckForStealth
     310    PCM_NoStealthDetection:
     311        test    CFG_DetectVirus, 1
     312        jz      PCM_NoVirusDetection
     313        call    VIRUS_CheckForVirus
     314    PCM_NoVirusDetection:
     315
     316
     317        ; ============================================
     318        ;  Delay for some time and get Strg/Alt State
     319        ; ============================================
     320        test    CFG_CooperBars, 1
     321        jnz     PCM_ShortDelay
     322        mov     al, 27                        ; About 1.5 seconds
     323        test    CFG_FloppyBootGetName, 1
     324        jz      PCM_LongDelay
     325    PCM_ShortDelay:
     326
     327        mov     al, 13                        ; shorten delay,if floppy gets accessed
     328    PCM_LongDelay:
     329
     330        call    TIMER_WaitTicCount
     331
     332        ; First check, if any normal key got pressed...
     333        mov     ah, 1
     334        int     16h
     335        jz      PCM_NoNormalKeyPressed
     336        ; User doesn't know what to do...or he is crazy <g> so display message
     337        mov     si, offset TXT_HowEnterSetup
     338        call    MBR_Teletype
     339        mov     al, 54                        ; about 3 seconds, delay again
     340
     341        call    TIMER_WaitTicCount
     342
     343    PCM_NoNormalKeyPressed:
     344        ; Now get keyboard Strg/Alt State
     345        mov     ah, 02h
     346        int     16h
     347        mov     SETUP_KeysOnEntry, al
     348
     349        ; Copy device-name to the ContBIOSbootSeq-IPT entry
     350        ; We may not do this before PRECRAP_CheckConfiguration, because otherwise
     351        ; this check will fail.
     352        call    PART_UpdateResumeBIOSName
     353        ret
     354PRECRAP_Main    EndP
     355
     356AFTERCRAP_Main  Proc Near
     357        ; ===================================================
     358        ;  Now get volume label of FloppyDrive, if wanted...
     359        ; ===================================================
     360        test    CFG_FloppyBootGetName, 1
     361        jz      ACM_NoFloppyGetName
     362        call    DriveIO_UpdateFloppyName
     363        or      ax, ax
     364        jnz     ACM_NoFloppyGetName
     365        ; Try a second time, if it failed to detect the Floppy
     366        call    DriveIO_UpdateFloppyName
     367    ACM_NoFloppyGetName:
     368        ret
     369AFTERCRAP_Main  EndP
    373370
    374371PRECRAP_CheckFor13extensions    Proc Near
    375    mov     ah, 41h
    376    mov     bx, 55AAh
    377    mov     dl, 80h
    378    int     13h
    379    cmp     bx, 0AA55h
    380    je      PCCF13E_Found
    381   PCCF13E_NotFound:
    382    ret
    383   PCCF13E_Found:
    384    and     cx, 1
    385    jz      PCCF13E_NotFound
    386    mov     CurIO_UseExtension, 1
    387    ret
     372        mov     ah, 41h
     373        mov     bx, 55AAh
     374        mov     dl, 80h
     375        int     13h
     376        cmp     bx, 0AA55h
     377        je      PCCF13E_Found
     378    PCCF13E_NotFound:
     379        ret
     380    PCCF13E_Found:
     381        and     cx, 1
     382        jz      PCCF13E_NotFound
     383        mov     CurIO_UseExtension, 1
     384        ret
    388385PRECRAP_CheckFor13extensions    EndP
     386
    389387
    390388; Checks Configuration CheckSum...Displays message, if failed.
    391389PRECRAP_CheckConfiguration      Proc Near  Uses ds si es di
    392    mov     si, offset Configuration
    393    xor     bx, bx
    394 
    395    ; Changed from 5 to calculated value (not here, see compat. issue below)
    396    ; Fixes issue: #2987 -- "air-boot doesn't remember drive letter"
    397    ; Size of the ab-configuration in 512 byte sectors
    398    ;mov     cx, (MBR_BackUpMBR - Configuration) / 200h
    399 
    400    ; AB v1.07 stores a 5 sector configuration with a 5 sector checksum.
    401    ; AB v1.0.8 *should* stores a 7 sector configuration with a
    402    ; 7 sector checksum.
    403    ; Because 5 was hardcoded here, SET(A)BOOT v1.07 will see see an AB v1.0.8
    404    ; config as corrupted, while this is not the case.
    405    ; So, for compatibility reasons, in v1.0.8, the checksum stored is over
    406    ; 5 sectors, to be compatible with v1.07.
    407    ; This may change (be corrected) in future versions !
    408    mov      cx,5
    409 
    410    mov     dx, CFG_CheckConfig
    411    mov     CFG_CheckConfig, bx
    412   PCCC_Loop:
    413       call    MBR_GetCheckOfSector
    414    loop    PCCC_Loop
    415    cmp     bx, dx
    416    jne     PCCC_Failed
    417    mov     CFG_CheckConfig, dx
    418    ret
    419   PCCC_Failed:
    420    mov     si, offset TXT_ERROR_CheckConfig
    421    call    MBR_Teletype
    422    mov     si, offset TXT_ERROR_CheckFailed
    423    call    MBR_Teletype
    424    jmp     MBR_HaltSystem
     390        mov     si, offset Configuration
     391        xor     bx, bx
     392
     393        ; Changed from 5 to calculated value (not here, see compat. issue below)
     394        ; Fixes issue: #2987 -- "air-boot doesn't remember drive letter"
     395        ; Size of the ab-configuration in 512 byte sectors
     396        ; mov     cx, (MBR_BackUpMBR - Configuration) / 200h
     397
     398        ; AB v1.07 stores a 5 sector configuration with a 5 sector checksum.
     399        ; AB v1.0.8 *should* stores a 7 sector configuration with a
     400        ; 7 sector checksum.
     401        ; Because 5 was hardcoded here, SET(A)BOOT v1.07 will see see an AB v1.0.8
     402        ; config as corrupted, while this is not the case.
     403        ; So, for compatibility reasons, in v1.0.8, the checksum stored is over
     404        ; 5 sectors, to be compatible with v1.07.
     405        ; This may change (be corrected) in future versions !
     406        mov      cx,5
     407
     408        mov     dx, CFG_CheckConfig
     409        mov     CFG_CheckConfig, bx
     410    PCCC_Loop:
     411        call    MBR_GetCheckOfSector
     412        loop    PCCC_Loop
     413        cmp     bx, dx
     414        jne     PCCC_Failed
     415        mov     CFG_CheckConfig, dx
     416        ret
     417    PCCC_Failed:
     418        mov     si, offset TXT_ERROR_CheckConfig
     419        call    MBR_Teletype
     420        mov     si, offset TXT_ERROR_CheckFailed
     421        call    MBR_Teletype
     422        jmp     MBR_HaltSystem
    425423PRECRAP_CheckConfiguration      EndP
    426424
     
    430428; Destroyed: SI
    431429; Fixme: Uses double writes to use attribute with teletype-function.
    432 MBR_TeletypeBold                Proc Near   Uses ax bx cx
    433   MBRT_LoopBold:
    434    lodsb
    435    or      al, al
    436    jz      MBRT_EndBold
    437    push    ax
    438    mov     ah,09h
    439    mov     bx,15
    440    mov     cx,1
    441    int     10h
    442    pop     ax
    443    mov     ah,0eh
    444    mov     bx,7            ; Does not do anything in text-modus
    445    mov     cx,1
    446    int     10h
    447    jmp     MBRT_LoopBold
    448   MBRT_EndBold:
    449    ret
    450 MBR_TeletypeBold                EndP
     430MBR_TeletypeBold    Proc Near   Uses ax bx cx
     431    MBRT_LoopBold:
     432        lodsb
     433        or      al, al
     434        jz      MBRT_EndBold
     435        push    ax
     436        mov     ah,09h
     437        mov     bx,15
     438        mov     cx,1
     439        int     10h
     440        pop     ax
     441        mov     ah,0eh
     442        mov     bx,7            ; Does not do anything in text-modus
     443        mov     cx,1
     444        int     10h
     445        jmp     MBRT_LoopBold
     446    MBRT_EndBold:
     447        ret
     448MBR_TeletypeBold    EndP
     449
    451450
    452451;        In: SI - Pointer to begin of string (EOS is 0)
    453452; Destroyed: SI
    454453; Fixme: Uses double writes to use attribute with teletype-function.
    455 MBR_TeletypeVolName             Proc Near   Uses ax bx cx
    456    mov     cx, 11
    457   MBRT_LoopVolName:
    458    mov     dx,cx           ; Backup counter
    459    lodsb
    460    or      al, al
    461    jz      MBRT_EndVolName
    462    push    ax
    463    mov     ah,09h
    464    mov     bx,15
    465    mov     cx,1
    466    int     10h             ; DX is preserved
    467    pop     ax
    468    mov     ah,0eh
    469    mov     bx,7            ; Does not do anything in text-modus
    470    mov     cx,1
    471    int     10h             ; DX is preserved
    472    mov     cx,dx           ; Restore counter
    473    loop    MBRT_LoopVolName
    474   MBRT_EndVolName:
    475    ret
    476 MBR_TeletypeVolName             EndP
     454MBR_TeletypeVolName     Proc Near   Uses ax bx cx
     455        mov     cx, 11
     456    MBRT_LoopVolName:
     457        mov     dx,cx           ; Backup counter
     458        lodsb
     459        or      al, al
     460        jz      MBRT_EndVolName
     461        push    ax
     462        mov     ah,09h
     463        mov     bx,15
     464        mov     cx,1
     465        int     10h             ; DX is preserved
     466        pop     ax
     467        mov     ah,0eh
     468        mov     bx,7            ; Does not do anything in text-modus
     469        mov     cx,1
     470        int     10h             ; DX is preserved
     471        mov     cx,dx           ; Restore counter
     472        loop    MBRT_LoopVolName
     473    MBRT_EndVolName:
     474        ret
     475MBR_TeletypeVolName     EndP
    477476
    478477; Rousseau: added
    479478; Move cursor to next line
    480479; Just do a new-line if SI==0
    481 MBR_TeletypeNL                  Proc Near   Uses ax bx cx
    482    test    si,si
    483    jz      MBR_TeletypeNL_NL
    484    call    MBR_Teletype
    485   MBR_TeletypeNL_NL:
    486    push    si
    487    mov     si, offset NL
    488    call    MBR_Teletype
    489    pop     si
    490    ret
    491 MBR_TeletypeNL                  EndP
     480MBR_TeletypeNL      Proc Near   Uses ax bx cx
     481        test    si,si
     482        jz      MBR_TeletypeNL_NL
     483        call    MBR_Teletype
     484    MBR_TeletypeNL_NL:
     485        push    si
     486        mov     si, offset NL
     487        call    MBR_Teletype
     488        pop     si
     489        ret
     490MBR_TeletypeNL      EndP
    492491
    493492; Sync teletype position to VideoIO
    494493MBR_TeletypeSyncPos     Proc Near   Uses ax bx cx dx
    495    pushf
    496    mov   bh, 0
    497    mov   ah, 02h
    498    mov   dh,[TextPosY]
    499    mov   dl,[TextPosX]
    500    int   10h
    501    popf
    502    ret
     494        pushf
     495        mov     bh, 0
     496        mov     ah, 02h
     497        mov     dh,[TextPosY]
     498        mov     dl,[TextPosX]
     499        int     10h
     500        popf
     501        ret
    503502MBR_TeletypeSyncPos     EndP
Note: See TracChangeset for help on using the changeset viewer.