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/BOOTMENU.ASM

    r40 r43  
    598598;        In: CL - Color, DL - Partition
    599599; Destroyed: None, but Locate-Pointer gets set
    600 BOOTMENU_ReColorPart            Proc Near   Uses bx cx es di
    601 
    602   ; call  SOUND_Beep
    603 
    604    mov     bh, cl     ; Color to BH
    605    ; First calculate location of bar
    606    cmp     Menu_UpperPart, dl
    607    ja      BMRCP_NotInWindowView
    608    mov     ch, dl
    609    sub     ch, Menu_UpperPart            ; CH - Position relative to UpperPart
    610    cmp     ch, 14                        ; 14 - Maximum Total in Window
    611    ja      BMRCP_NotInWindowView
    612    add     ch, 5                         ; Y-Position add-on fixed 5
    613    mov     cl, 2                         ; X-Position is always 2
    614    call    VideoIO_Locate                ; geht zu CX
    615    call    VideoIO_Internal_SetRegs
    616    inc     di                            ; DI - Destination+1 -> Color-Byte
    617    mov     cl, 78                        ; Length of Bar is always 78
    618   BMRCP_ClearLoop:
    619       mov     al, es:[di]
    620       and     al, 0Fh
    621       or      al, bh                     ; Adds background color (from BH)
    622 
    623       ;mov      al,97h
    624 
    625       mov     es:[di], al
    626       add     di, 2
    627    dec     cl
    628    jnz     BMRCP_ClearLoop
    629   BMRCP_NotInWindowView:
    630    ret
    631 BOOTMENU_ReColorPart            EndP
     600BOOTMENU_ReColorPart    Proc Near   Uses bx cx es di
     601
     602        ; call  SOUND_Beep
     603
     604        mov     bh, cl     ; Color to BH
     605        ; First calculate location of bar
     606        cmp     Menu_UpperPart, dl
     607        ja      BMRCP_NotInWindowView
     608        mov     ch, dl
     609        sub     ch, Menu_UpperPart          ; CH - Position relative to UpperPart
     610        cmp     ch, 14                      ; 14 - Maximum Total in Window
     611        ja      BMRCP_NotInWindowView
     612        add     ch, 5                       ; Y-Position add-on fixed 5
     613        mov     cl, 2                       ; X-Position is always 2
     614        call    VideoIO_Locate              ; geht zu CX
     615        call    VideoIO_Internal_SetRegs
     616        inc     di                          ; DI - Destination+1 -> Color-Byte
     617        mov     cl, 78                      ; Length of Bar is always 78
     618    BMRCP_ClearLoop:
     619        mov     al, es:[di]
     620        and     al, 0Fh
     621        or      al, bh                      ; Adds background color (from BH)
     622
     623        ;mov      al,97h
     624
     625        mov     es:[di], al
     626        add     di, 2
     627        dec     cl
     628        jnz     BMRCP_ClearLoop
     629    BMRCP_NotInWindowView:
     630        ret
     631BOOTMENU_ReColorPart    EndP
    632632
    633633
    634634; Calculate Menu-Variables for Boot-Menu, these use the filtered Part-Pointers
    635 BOOTMENU_ResetMenuVars          Proc Near   Uses dx
    636    xor     dl, dl                        ; Partition at Pos 0 == 1st
    637    mov     Menu_UpperPart, dl
    638 
    639    ; = TIMED BOOTING =
    640    mov     dl, CFG_TimedBoot
    641    mov     TimedBootEnable, dl
    642    mov     al, CFG_TimedSecs
    643    mov     TimedSecondLeft, al
    644    call    TIMER_TranslateSecToTic
    645    add     ax, 16                        ; So that the required ammount will
    646    mov     CFG_TimedDelay, ax            ; be shown and not Timer-1.
    647    call    BOOTMENU_ResetTimedBoot
    648    ; = FLOPPY-GET-NAME TIMER =
    649    call    BOOTMENU_ResetGetFloppy
    650 
    651    ; Resettet die Base-Variablen...
    652    mov     dl, PartitionPointerCount
    653    mov     Menu_TotalParts, dl
    654 
    655    ; Copy device-name to the ContBIOSbootSeq-IPT entry
    656    ;  Normally this does not need to get done here, but is done for safety
    657    ;  reasons if e.g. IPT got changed by SETUP, but that setup was discarded.
    658    call    PART_UpdateResumeBIOSName
    659 
    660    ; Default-Partition -> Filtered View -> Menu_EntryDefault
    661    mov     dl, CFG_PartDefault
    662    call    PART_ConvertFromStraight
    663    mov     Menu_EntryDefault, dl
    664 
    665    ; Last-Booted-Partition -> Filtered View -> Menu_EntryLast
    666    mov     dl, CFG_PartLast
    667    call    PART_ConvertFromStraight
    668    mov     Menu_EntryLast, dl
    669 
    670    ; Automatic-Partition -> Filtered View -> Menu_EntryAutomatic
    671    mov     dl, CFG_PartAutomatic
    672    call    PART_ConvertFromStraight
    673    mov     Menu_EntryAutomatic, dl
    674 
    675 ; [Linux support removed since v1.02]
    676  ; Okay, now we check if Default/Last Kernel Partition Name is available...
    677  ;  if so, simply set Menu_EntryDefault/Menu_EntryLast.
    678  mov     si, offset CFG_LinuxDefaultKernel
    679  call    LINUX_SearchKernelName        ; DL - Filtered Entry No
    680  cmp     dl, 0FFh
    681  je      BMRMV_DefaultKernelNF
    682  mov     Menu_EntryDefault, dl
    683 ; BMRMV_DefaultKernelNF:
    684  mov     si, offset CFG_LinuxLastKernel
    685  call    LINUX_SearchKernelName        ; DL - Filtered Entry No
    686  cmp     dl, 0FFh
    687  je      BMRMV_LastKernelNF
    688  mov     Menu_EntryLast, dl
    689 ; BMRMV_LastKernelNF:
    690 
    691    ; restlichen Variablen berechnen...
    692    mov     dl, Menu_TotalParts
    693    cmp     Menu_TotalParts, 14
    694    jbe     BMRMV_NotMoreThan14
    695    mov     dl, 14
    696   BMRMV_NotMoreThan14:
    697    mov     Menu_TotalLines, dl
    698 
    699    ; Now copy the name of the Timed-Booted Partition to TimedBoot-Field
    700    mov     dl, Menu_EntryDefault
    701    test    CFG_TimedBootLast, 1
    702    jz      BMRMV_TimedBootDefault
    703    mov     dl, Menu_EntryLast
    704   BMRMV_TimedBootDefault:
    705    call    PART_GetPartitionPointer      ; Holt SI fr Partition DL
    706    add     si, LocIPT_Name
    707    mov     cx, 11
    708    call    GetLenOfName
    709    mov     di, offset TXT_TimedBootEntryName
    710    jz      BMRMV_NoName
    711    rep     movsb
    712   BMRMV_NoName:
    713    xor     al, al
    714    stosb              ; Ending Zero
    715    ret
    716 BOOTMENU_ResetMenuVars          EndP
     635BOOTMENU_ResetMenuVars      Proc Near   Uses dx
     636        xor     dl, dl                        ; Partition at Pos 0 == 1st
     637        mov     Menu_UpperPart, dl
     638
     639        ; = TIMED BOOTING =
     640        mov     dl, CFG_TimedBoot
     641        mov     TimedBootEnable, dl
     642        mov     al, CFG_TimedSecs
     643        mov     TimedSecondLeft, al
     644        call    TIMER_TranslateSecToTic
     645        add     ax, 16                        ; So that the required ammount will
     646        mov     CFG_TimedDelay, ax            ; be shown and not Timer-1.
     647        call    BOOTMENU_ResetTimedBoot
     648        ; = FLOPPY-GET-NAME TIMER =
     649        call    BOOTMENU_ResetGetFloppy
     650
     651        ; Resettet die Base-Variablen...
     652        mov     dl, PartitionPointerCount
     653        mov     Menu_TotalParts, dl
     654
     655        ; Copy device-name to the ContBIOSbootSeq-IPT entry
     656        ;  Normally this does not need to get done here, but is done for safety
     657        ;  reasons if e.g. IPT got changed by SETUP, but that setup was discarded.
     658        call    PART_UpdateResumeBIOSName
     659
     660        ; Default-Partition -> Filtered View -> Menu_EntryDefault
     661        mov     dl, CFG_PartDefault
     662        call    PART_ConvertFromStraight
     663        mov     Menu_EntryDefault, dl
     664
     665        ; Last-Booted-Partition -> Filtered View -> Menu_EntryLast
     666        mov     dl, CFG_PartLast
     667        call    PART_ConvertFromStraight
     668        mov     Menu_EntryLast, dl
     669
     670        ; Automatic-Partition -> Filtered View -> Menu_EntryAutomatic
     671        mov     dl, CFG_PartAutomatic
     672        call    PART_ConvertFromStraight
     673        mov     Menu_EntryAutomatic, dl
     674
     675        ;~ ; [Linux support removed since v1.02]
     676        ;~ ; Okay, now we check if Default/Last Kernel Partition Name is available...
     677        ;~ ;  if so, simply set Menu_EntryDefault/Menu_EntryLast.
     678        ;~ mov     si, offset CFG_LinuxDefaultKernel
     679        ;~ call    LINUX_SearchKernelName        ; DL - Filtered Entry No
     680        ;~ cmp     dl, 0FFh
     681        ;~ je      BMRMV_DefaultKernelNF
     682        ;~ mov     Menu_EntryDefault, dl
     683    ;~ BMRMV_DefaultKernelNF:
     684        ;~ mov     si, offset CFG_LinuxLastKernel
     685        ;~ call    LINUX_SearchKernelName        ; DL - Filtered Entry No
     686        ;~ cmp     dl, 0FFh
     687        ;~ je      BMRMV_LastKernelNF
     688        ;~ mov     Menu_EntryLast, dl
     689    ;~ BMRMV_LastKernelNF:
     690
     691        ; restlichen Variablen berechnen...
     692        mov     dl, Menu_TotalParts
     693        cmp     Menu_TotalParts, 14
     694        jbe     BMRMV_NotMoreThan14
     695        mov     dl, 14
     696    BMRMV_NotMoreThan14:
     697        mov     Menu_TotalLines, dl
     698
     699        ; Now copy the name of the Timed-Booted Partition to TimedBoot-Field
     700        mov     dl, Menu_EntryDefault
     701        test    CFG_TimedBootLast, 1
     702        jz      BMRMV_TimedBootDefault
     703        mov     dl, Menu_EntryLast
     704    BMRMV_TimedBootDefault:
     705        call    PART_GetPartitionPointer      ; Holt SI fr Partition DL
     706        add     si, LocIPT_Name
     707        mov     cx, 11
     708        call    GetLenOfName
     709        mov     di, offset TXT_TimedBootEntryName
     710        jz      BMRMV_NoName
     711        rep     movsb
     712    BMRMV_NoName:
     713        xor     al, al
     714        stosb              ; Ending Zero
     715        ret
     716BOOTMENU_ResetMenuVars      EndP
    717717
    718718; Will Set some Vars after user selected entry to boot...
    719719;  ...don't select Straight View !
    720 BOOTMENU_SetVarsAfterMenu Proc Near
    721    ; No Straight View in here...we got filtered view since BootMenu-Startup...
    722    mov     al, CFG_RememberTimed
    723    test    TimedBootUsed, 1
    724    jnz     BMSVAM_TimedBootUsed
    725    mov     al, CFG_RememberBoot
    726   BMSVAM_TimedBootUsed:
    727    or      al, al
    728    jz      BMSVAM_DontRememberBoot
    729    mov     dl, Menu_EntrySelected
    730    call    PART_ConvertToStraight        ; CFG_PartLast is non-filtered
    731 ;   mov     di, offset CFG_LinuxLastKernel
    732 ;   mov     cx, 11
    733    cmp     dl, 0FDh                      ; Dont Remember on Floppy/CD-ROM/etc.
    734    ja      BMSVAM_DontRememberBoot
    735 ;   je      BMSVAM_RememberKernelBoot     ; but remember Kernel-Bootings...
    736    mov     CFG_PartLast, dl              ; Remember partition in CFG_PartLast
    737 ;   mov     al, ' '
    738 ;   rep     stosb                         ; SPACE out CFG_LinuxLastKernel
    739   BMSVAM_DontRememberBoot:
    740    ret
    741 ;
    742 ;  BMSVAM_RememberKernelBoot:
    743 ;   mov     dl, Menu_EntrySelected
    744 ;   call    PART_GetPartitionPointer      ; SI - Pointer to Kernel Entry...
    745 ;   add     si, LocIPT_Name
    746 ;   rep     movsb                         ; Copy KernelName 2 CFG_LinuxLastKernel
    747 ;   ret
    748 BOOTMENU_SetVarsAfterMenu       EndP
     720BOOTMENU_SetVarsAfterMenu   Proc Near
     721        ; No Straight View in here...we got filtered view since BootMenu-Startup...
     722        mov     al, CFG_RememberTimed
     723        test    TimedBootUsed, 1
     724        jnz     BMSVAM_TimedBootUsed
     725        mov     al, CFG_RememberBoot
     726    BMSVAM_TimedBootUsed:
     727        or      al, al
     728        jz      BMSVAM_DontRememberBoot
     729        mov     dl, Menu_EntrySelected
     730        call    PART_ConvertToStraight        ; CFG_PartLast is non-filtered
     731        ;~ mov     di, offset CFG_LinuxLastKernel
     732        ;~ mov     cx, 11
     733        cmp     dl, 0FDh                      ; Dont Remember on Floppy/CD-ROM/etc.
     734        ja      BMSVAM_DontRememberBoot
     735        ;   je      BMSVAM_RememberKernelBoot     ; but remember Kernel-Bootings...
     736        mov     CFG_PartLast, dl              ; Remember partition in CFG_PartLast
     737        ;~ mov     al, ' '
     738        ;~ rep     stosb                         ; SPACE out CFG_LinuxLastKernel
     739    BMSVAM_DontRememberBoot:
     740        ret
     741
     742    ;~ BMSVAM_RememberKernelBoot:
     743        ;~ mov     dl, Menu_EntrySelected
     744        ;~ call    PART_GetPartitionPointer      ; SI - Pointer to Kernel Entry...
     745        ;~ add     si, LocIPT_Name
     746        ;~ rep     movsb                         ; Copy KernelName 2 CFG_LinuxLastKernel
     747        ;~ ret
     748BOOTMENU_SetVarsAfterMenu   EndP
     749
     750
     751
    749752
    750753; Actually does the Boot-Menu Interaction
    751754; Sets Carry-flag, if Setup is to be entered, otherwise system shall get booted
    752755; On boot: Fills out some variables (like Menu_EntrySelected), when Booting
    753 BOOTMENU_Execute                Proc Near   Uses es di
    754    ; Finds out, where to place the bar at first...
    755    mov     dl, Menu_EntryDefault
    756    test    CFG_RememberBoot, 1
    757    jnz     BME_RememberMode
    758    test    CFG_RememberTimed, 1
    759    jz      BME_ForgetMode
    760   BME_RememberMode:
    761    mov     dl, Menu_EntryLast
    762   BME_ForgetMode:
    763    ; Got it, so display bar...
    764    mov     dh, dl
    765 
    766    ;call  SOUND_Beep
    767 
    768    call    BOOTMENU_BuildChoiceBar       ; DH - Active, DL - Last Active
    769 
    770    ;call  SOUND_Beep
    771 
    772    call    SOUND_PreBootMenu
    773 
    774 
    775   BME_MainLoop:
    776 
    777      ;call    VideoIO_DBG_WriteString2    ; Rousseau
    778 
    779    test    TimedBootEnable, 1
    780    jz      BME_NoTimedBoot
    781       ; ------------------------------------------------ TIMED BOOT
    782       push    ax
    783       push    dx
    784          call    TIMER_GetTicCount
    785          mov     dx, word ptr [TimedTimeOut]
    786          sub     dx, ax
    787          mov     ax, dx
    788          call    TIMER_TranslateTicToSec ; DX - Timertics till ByeBye
    789          cmp     al, TimedSecondLeft     ; -> AL - Seconds till ByeBye
    790          je      BME_NoFixSecond
    791          mov     TimedSecondLeft, al
    792          call    BOOTMENU_BuildTimedBootText ; Display Timed-Boot-Text
    793         BME_NoFixSecond:
    794          cmp     al, 0
    795          jne     BME_NoTimeOut
    796       pop     dx
    797       pop     ax
    798       mov     dl, Menu_EntryDefault
    799       and     CFG_TimedBootLast, 1
    800       jz      BME_TimedBootDefault
    801       mov     dl, Menu_EntryLast
    802      BME_TimedBootDefault:
    803       mov     Menu_EntrySelected, dl        ; Just boot default partition
    804       mov     TimedBootUsed, 1           ; set flag...
    805       clc                                ; Boot-Now!
    806       ret
    807 
    808      BME_NoTimeOut:
    809       pop     dx
    810       pop     ax
    811   BME_NoTimedBoot:
    812    ; ------------------------------------------------ FLOPPY-NAME TIMER
    813    test    CFG_FloppyBootGetTimer, 1
    814    jz      BME_NoFloppyNameTimer
    815       ; Wait 2 Seconds everytime
    816       push    ax
    817       push    dx
    818          call    TIMER_GetTicCount
    819          cmp     dx, wptr [FloppyGetNameTimer+2]
    820          ja      BME_ExpiredGetFloppy
    821          cmp     ax, wptr [FloppyGetNameTimer+0]
    822          jb      BME_NoFloppyNameExpired
    823         BME_ExpiredGetFloppy:
    824          call    BOOTMENU_ResetGetFloppy
    825       pop     dx
    826       pop     ax
    827       jmp     BME_RefreshFloppyName
    828         BME_NoFloppyNameExpired:
    829       pop     dx
    830       pop     ax
    831   BME_NoFloppyNameTimer:
    832    ; ------------------------------------------------ KEYBOARD
    833    push    dx
    834       mov     ah, 1
    835       int     16h
    836    pop     dx
    837    jnz     BME_KeyAvailable
    838    jmp     BME_MainLoop
    839 
    840   BME_RefreshFloppyName:
    841    test    CFG_IncludeFloppy, 1
    842    jz      BME_NoRefreshFloppyName
    843       test    CFG_FloppyBootGetName, 1
    844       jz      BME_NoRefreshFloppyName
    845          call    DriveIO_UpdateFloppyName
    846          call    BOOTMENU_RefreshPartitionText
    847          call    BOOTMENU_BuildChoiceBar ; Redisplay the selection-bar
    848   BME_NoRefreshFloppyName:
    849    jmp     BME_MainLoop
    850 
    851   BME_KeyAvailable:
    852    push    dx
    853       mov     ah, 0
    854       int     16h
    855    pop     dx
    856    cmp     ah, Keys_ENTER
    857    je      BME_KeyEnter
    858    cmp     ah, Keys_F10
    859    je      BME_KeyF10
    860    cmp     ah, Keys_Delete
    861    je      BME_KeyDelete
    862    cmp     ah, Keys_ESC
    863    je      BME_KeyESC
    864    ; Upper Keys do not fall under Timed Boot Key Handling
    865    test    TimedBootEnable, 1
    866    je      BME_NoTimedKeyHandling
    867       cmp     CFG_TimedKeyHandling, 1
    868       jb      BME_NoTimedKeyHandling     ; = 0
    869       je      BME_ResetTimedBoot         ; = 1
    870       mov     al, TimedBootEnable        ; = 2
    871       xor     al, 1                      ; Flip Flop Switch :]
    872       mov     TimedBootEnable, al
    873      BME_ResetTimedBoot:
    874       push    dx
    875          call    BOOTMENU_ResetTimedBoot     ; Reset Timer
    876          call    BOOTMENU_BuildTimedBootText ; Refresh TimedBootText
    877       pop     dx
    878   BME_NoTimedKeyHandling:
    879    cmp     ah, Keys_TAB
    880    je      BME_KeyTAB
    881    cmp     ah, Keys_Up
    882    je      BME_KeyUp
    883    cmp     ah, Keys_Down
    884    je      BME_KeyDown
    885    jmp     BME_MainLoop
    886 
    887   BME_KeyUp:
    888    dec     dh
    889    call    BOOTMENU_BuildChoiceBar       ; DH - Active, DL - Last Active
    890    jmp     BME_MainLoop
    891 
    892   BME_KeyDown:
    893    inc     dh
    894    call    BOOTMENU_BuildChoiceBar       ; DH - Active, DL - Last Active
    895    jmp     BME_MainLoop
    896 
    897   BME_KeyEnter:
    898    mov     Menu_EntrySelected, dl
    899    mov     TimedBootUsed, 0              ; reset flag...
    900    clc                                   ; Boot-Now!
    901    ret
    902 
    903   BME_KeyF10:
    904    mov     al, Keys_Flags_EnterSetup
    905    mov     SETUP_KeysOnEntry, al         ; Simulate user wants to enter setup
    906    stc                                   ; Go Re-Enter Setup
    907    ret
    908 
    909   BME_KeyDelete:
    910    call    SOUND_ExecuteBoot
    911    call    APM_TurnOffComputer
    912    jmp     BME_MainLoop
    913 
    914   BME_KeyESC:
    915    mov     al, TimedBootEnable
    916    xor     al, 1                         ; Flip Flop Switch :]
    917    mov     TimedBootEnable, al
    918    push    dx
    919       call    BOOTMENU_ResetTimedBoot     ; Reset Timer
    920       call    BOOTMENU_BuildTimedBootText ; Refresh TimedBootText
    921    pop     dx
    922    jmp     BME_MainLoop
    923 
    924   BME_KeyTAB:
    925    push    dx
    926       test    CFG_CooperBars, 1
    927       jnz     BME_KeyTAB_ShowFX
    928       mov     ax, 0501h                  ; Go To Page 1 -> BIOS POST crap
    929       int     10h
    930       mov     ah, 0
    931       int     16h                        ; Wait for any key
    932       call    BOOTMENU_ResetTimedBoot     ; Reset Timer
    933       call    BOOTMENU_BuildTimedBootText ; Refresh TimedBootText
    934       mov     ax, 0500h                  ; Go Back to Page 0
    935       int     10h
    936    pop     dx
    937    jmp     BME_MainLoop
    938      BME_KeyTAB_ShowFX:
    939       pusha
    940          mov     ax, VideoIO_Page1
    941          mov     bx, VideoIO_Page0
    942          mov     dx, 160
    943          xor     di, di
    944          call    FX_InterleaveCopy
    945          call    FX_ScrollScreenLeft
    946          mov     ah, 0
    947          int     16h                        ; Wait for any key
    948          call    BOOTMENU_ResetTimedBoot     ; Reset Timer
    949          call    BOOTMENU_BuildTimedBootText ; Refresh TimedBootText
    950          call    FX_ScrollScreenRight
    951          call    FX_EndScreenInternalCleanUp
    952          call    BOOTMENU_ResetTimedBoot    ; Reset Timer again...
    953       popa
    954    pop     dx
    955    jmp     BME_MainLoop
     756BOOTMENU_Execute    Proc Near   Uses es di
     757        ; Finds out, where to place the bar at first...
     758        mov     dl, Menu_EntryDefault
     759        test    CFG_RememberBoot, 1
     760        jnz     BME_RememberMode
     761        test    CFG_RememberTimed, 1
     762        jz      BME_ForgetMode
     763    BME_RememberMode:
     764        mov     dl, Menu_EntryLast
     765    BME_ForgetMode:
     766        ; Got it, so display bar...
     767        mov     dh, dl
     768
     769        ;~ call    SOUND_Beep
     770
     771        call    BOOTMENU_BuildChoiceBar       ; DH - Active, DL - Last Active
     772
     773        ;~ call    SOUND_Beep
     774
     775        call    SOUND_PreBootMenu
     776
     777
     778    BME_MainLoop:
     779
     780        ;call    VideoIO_DBG_WriteString2    ; Rousseau
     781
     782        test    TimedBootEnable, 1
     783        jz      BME_NoTimedBoot
     784        ; ------------------------------------------------ TIMED BOOT
     785        push    ax
     786        push    dx
     787        call    TIMER_GetTicCount
     788        mov     dx, word ptr [TimedTimeOut]
     789        sub     dx, ax
     790        mov     ax, dx
     791        call    TIMER_TranslateTicToSec ; DX - Timertics till ByeBye
     792        cmp     al, TimedSecondLeft     ; -> AL - Seconds till ByeBye
     793        je      BME_NoFixSecond
     794        mov     TimedSecondLeft, al
     795        call    BOOTMENU_BuildTimedBootText ; Display Timed-Boot-Text
     796    BME_NoFixSecond:
     797        cmp     al, 0
     798        jne     BME_NoTimeOut
     799        pop     dx
     800        pop     ax
     801        mov     dl, Menu_EntryDefault
     802        and     CFG_TimedBootLast, 1
     803        jz      BME_TimedBootDefault
     804        mov     dl, Menu_EntryLast
     805    BME_TimedBootDefault:
     806        mov     Menu_EntrySelected, dl        ; Just boot default partition
     807        mov     TimedBootUsed, 1           ; set flag...
     808        clc                                ; Boot-Now!
     809        ret
     810
     811    BME_NoTimeOut:
     812        pop     dx
     813        pop     ax
     814    BME_NoTimedBoot:
     815        ; ------------------------------------------------ FLOPPY-NAME TIMER
     816        test    CFG_FloppyBootGetTimer, 1
     817        jz      BME_NoFloppyNameTimer
     818        ; Wait 2 Seconds everytime
     819        push    ax
     820        push    dx
     821        call    TIMER_GetTicCount
     822        cmp     dx, wptr [FloppyGetNameTimer+2]
     823        ja      BME_ExpiredGetFloppy
     824        cmp     ax, wptr [FloppyGetNameTimer+0]
     825        jb      BME_NoFloppyNameExpired
     826    BME_ExpiredGetFloppy:
     827        call    BOOTMENU_ResetGetFloppy
     828        pop     dx
     829        pop     ax
     830        jmp     BME_RefreshFloppyName
     831    BME_NoFloppyNameExpired:
     832        pop     dx
     833        pop     ax
     834    BME_NoFloppyNameTimer:
     835        ; ------------------------------------------------ KEYBOARD
     836        push    dx
     837        mov     ah, 1
     838        int     16h
     839        pop     dx
     840        jnz     BME_KeyAvailable
     841        jmp     BME_MainLoop
     842
     843    BME_RefreshFloppyName:
     844        test    CFG_IncludeFloppy, 1
     845        jz      BME_NoRefreshFloppyName
     846        test    CFG_FloppyBootGetName, 1
     847        jz      BME_NoRefreshFloppyName
     848        call    DriveIO_UpdateFloppyName
     849        call    BOOTMENU_RefreshPartitionText
     850        call    BOOTMENU_BuildChoiceBar ; Redisplay the selection-bar
     851    BME_NoRefreshFloppyName:
     852        jmp     BME_MainLoop
     853
     854        BME_KeyAvailable:
     855        push    dx
     856        mov     ah, 0
     857        int     16h
     858        pop     dx
     859        cmp     ah, Keys_ENTER
     860        je      BME_KeyEnter
     861        cmp     ah, Keys_F10
     862        je      BME_KeyF10
     863        cmp     ah, Keys_Delete
     864        je      BME_KeyDelete
     865        cmp     ah, Keys_ESC
     866        je      BME_KeyESC
     867        ; Upper Keys do not fall under Timed Boot Key Handling
     868        test    TimedBootEnable, 1
     869        je      BME_NoTimedKeyHandling
     870        cmp     CFG_TimedKeyHandling, 1
     871        jb      BME_NoTimedKeyHandling     ; = 0
     872        je      BME_ResetTimedBoot         ; = 1
     873        mov     al, TimedBootEnable        ; = 2
     874        xor     al, 1                      ; Flip Flop Switch :]
     875        mov     TimedBootEnable, al
     876    BME_ResetTimedBoot:
     877        push    dx
     878        call    BOOTMENU_ResetTimedBoot     ; Reset Timer
     879        call    BOOTMENU_BuildTimedBootText ; Refresh TimedBootText
     880        pop     dx
     881    BME_NoTimedKeyHandling:
     882        cmp     ah, Keys_TAB
     883        je      BME_KeyTAB
     884        cmp     ah, Keys_Up
     885        je      BME_KeyUp
     886        cmp     ah, Keys_Down
     887        je      BME_KeyDown
     888        jmp     BME_MainLoop
     889
     890    BME_KeyUp:
     891        dec     dh
     892        call    BOOTMENU_BuildChoiceBar       ; DH - Active, DL - Last Active
     893        jmp     BME_MainLoop
     894
     895    BME_KeyDown:
     896        inc     dh
     897        call    BOOTMENU_BuildChoiceBar       ; DH - Active, DL - Last Active
     898        jmp     BME_MainLoop
     899
     900    BME_KeyEnter:
     901        mov     Menu_EntrySelected, dl
     902        mov     TimedBootUsed, 0              ; reset flag...
     903        clc                                   ; Boot-Now!
     904        ret
     905
     906    BME_KeyF10:
     907        mov     al, Keys_Flags_EnterSetup
     908        mov     SETUP_KeysOnEntry, al         ; Simulate user wants to enter setup
     909        stc                                   ; Go Re-Enter Setup
     910        ret
     911
     912    BME_KeyDelete:
     913        call    SOUND_ExecuteBoot
     914        call    APM_TurnOffComputer
     915        jmp     BME_MainLoop
     916
     917    BME_KeyESC:
     918        mov     al, TimedBootEnable
     919        xor     al, 1                         ; Flip Flop Switch :]
     920        mov     TimedBootEnable, al
     921        push    dx
     922        call    BOOTMENU_ResetTimedBoot     ; Reset Timer
     923        call    BOOTMENU_BuildTimedBootText ; Refresh TimedBootText
     924        pop     dx
     925        jmp     BME_MainLoop
     926
     927    BME_KeyTAB:
     928        push    dx
     929        test    CFG_CooperBars, 1
     930        jnz     BME_KeyTAB_ShowFX
     931        mov     ax, 0501h                  ; Go To Page 1 -> BIOS POST crap
     932        int     10h
     933        mov     ah, 0
     934        int     16h                        ; Wait for any key
     935        call    BOOTMENU_ResetTimedBoot     ; Reset Timer
     936        call    BOOTMENU_BuildTimedBootText ; Refresh TimedBootText
     937        mov     ax, 0500h                  ; Go Back to Page 0
     938        int     10h
     939        pop     dx
     940        jmp     BME_MainLoop
     941    BME_KeyTAB_ShowFX:
     942        pusha
     943        mov     ax, VideoIO_Page1
     944        mov     bx, VideoIO_Page0
     945        mov     dx, 160
     946        xor     di, di
     947        call    FX_InterleaveCopy
     948        call    FX_ScrollScreenLeft
     949        mov     ah, 0
     950        int     16h                        ; Wait for any key
     951        call    BOOTMENU_ResetTimedBoot     ; Reset Timer
     952        call    BOOTMENU_BuildTimedBootText ; Refresh TimedBootText
     953        call    FX_ScrollScreenRight
     954        call    FX_EndScreenInternalCleanUp
     955        call    BOOTMENU_ResetTimedBoot    ; Reset Timer again...
     956        popa
     957        pop     dx
     958        jmp     BME_MainLoop
    956959BOOTMENU_Execute                EndP
    957960
    958961; Resettet den TimedBoot Timer...
    959 BOOTMENU_ResetTimedBoot         Proc Near   Uses ax
    960    call    TIMER_GetTicCount
    961    add     ax, CFG_TimedDelay
    962    adc     dx, 0
    963    mov     wptr [TimedTimeOut], ax
    964    mov     wptr [TimedTimeOut+2], dx
    965    ret
    966 BOOTMENU_ResetTimedBoot         EndP
     962BOOTMENU_ResetTimedBoot     Proc Near   Uses ax
     963        call    TIMER_GetTicCount
     964        add     ax, CFG_TimedDelay
     965        adc     dx, 0
     966        mov     wptr [TimedTimeOut], ax
     967        mov     wptr [TimedTimeOut+2], dx
     968        ret
     969BOOTMENU_ResetTimedBoot     EndP
    967970
    968971; Resettet den Floppy-Get-Name Timer...
    969 BOOTMENU_ResetGetFloppy         Proc Near   Uses ax
    970    call    TIMER_GetTicCount
    971    add     ax, 36                      ; 18*2 -> 2 seconds
    972    adc     dx, 0
    973    mov     word ptr [FloppyGetNameTimer], ax
    974    mov     word ptr [FloppyGetNameTimer+2], dx
    975    ret
    976 BOOTMENU_ResetGetFloppy         EndP
     972BOOTMENU_ResetGetFloppy     Proc Near   Uses ax
     973        call    TIMER_GetTicCount
     974        add     ax, 36                      ; 18*2 -> 2 seconds
     975        adc     dx, 0
     976        mov     word ptr [FloppyGetNameTimer], ax
     977        mov     word ptr [FloppyGetNameTimer+2], dx
     978        ret
     979BOOTMENU_ResetGetFloppy     EndP
Note: See TracChangeset for help on using the changeset viewer.