| 1 | ; AiR-BOOT (c) Copyright 1998-2008 M. Kiewitz | 
|---|
| 2 | ; | 
|---|
| 3 | ; This file is part of AiR-BOOT | 
|---|
| 4 | ; | 
|---|
| 5 | ; AiR-BOOT is free software: you can redistribute it and/or modify it under | 
|---|
| 6 | ;  the terms of the GNU General Public License as published by the Free | 
|---|
| 7 | ;  Software Foundation, either version 3 of the License, or (at your option) | 
|---|
| 8 | ;  any later version. | 
|---|
| 9 | ; | 
|---|
| 10 | ; AiR-BOOT is distributed in the hope that it will be useful, but WITHOUT ANY | 
|---|
| 11 | ;  WARRANTY: without even the implied warranty of MERCHANTABILITY or FITNESS | 
|---|
| 12 | ;  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | 
|---|
| 13 | ;  details. | 
|---|
| 14 | ; | 
|---|
| 15 | ; You should have received a copy of the GNU General Public License along with | 
|---|
| 16 | ;  AiR-BOOT. If not, see <http://www.gnu.org/licenses/>. | 
|---|
| 17 | ; | 
|---|
| 18 | ;--------------------------------------------------------------------------- | 
|---|
| 19 | ;                         AiR-BOOT SETUP / GENERIC & GENERAL SETUP ROUTINES | 
|---|
| 20 | ;--------------------------------------------------------------------------- | 
|---|
| 21 |  | 
|---|
| 22 | IFDEF   MODULE_NAMES | 
|---|
| 23 | DB 'MAIN',0 | 
|---|
| 24 | ENDIF | 
|---|
| 25 |  | 
|---|
| 26 | ;~ LocMENU_RoutinePtr           equ          0 | 
|---|
| 27 | ;~ LocMENU_VariablePtr          equ          2 | 
|---|
| 28 | ;~ LocMENU_ItemNamePtr          equ          4 | 
|---|
| 29 | ;~ LocMENU_ItemHelpPtr          equ          6 | 
|---|
| 30 | ;~ LocMENU_ItemPack             equ          8 ; only if VariablePtr>0 | 
|---|
| 31 |  | 
|---|
| 32 | SETUP_UpperFixString          db 'SETUP ',0 ; AddOn for "AiR-BOOT SETUP vX.XX" | 
|---|
| 33 |  | 
|---|
| 34 | include setup/menus.asm                  ; Menu structures | 
|---|
| 35 | include setup/part_set.asm               ; Partition Setup (in extra file) | 
|---|
| 36 |  | 
|---|
| 37 | ;            CH - Current Item Number | 
|---|
| 38 | ;       Out: SI - Pointer to Item Location | 
|---|
| 39 | ; Destroyed: None | 
|---|
| 40 | SETUP_SwitchToSelectedItem      Proc Near   Uses ax cx | 
|---|
| 41 | cmp     ch, 7 | 
|---|
| 42 | jne     SSTSI_ValidSize | 
|---|
| 43 | stc     ; Invalid Item | 
|---|
| 44 | ret | 
|---|
| 45 | SSTSI_ValidSize: | 
|---|
| 46 | test    ch, 1000b | 
|---|
| 47 | jz      SSTSI_NoRightSide | 
|---|
| 48 | and     ch, 111b | 
|---|
| 49 | add     ch, 7                         ; fix Item-number to Real-Location | 
|---|
| 50 | SSTSI_NoRightSide: | 
|---|
| 51 | inc     ch                            ; So we will get a zero at the JZ | 
|---|
| 52 | mov     si, bp | 
|---|
| 53 | add     si, 3                         ; Skip FrontHeader for Menu | 
|---|
| 54 | SSTSI_Loop: | 
|---|
| 55 | dec     ch | 
|---|
| 56 | jz      SSTSI_LoopEnd | 
|---|
| 57 |  | 
|---|
| 58 | mov     ax, word ptr ds:[si+LocMENU_VariablePtr] | 
|---|
| 59 | or      ax, ax | 
|---|
| 60 | jz      SSTSI_NoItemPack | 
|---|
| 61 | add     si, LocMENU_LenOfItemPack  ; Add ItemPack size | 
|---|
| 62 | SSTSI_NoItemPack: | 
|---|
| 63 | add     si, LocMENU_LenOfMenuPtrBlock ; Skip Ptr-Block (+3 deshalb, weil danach INC!) | 
|---|
| 64 | jmp     SSTSI_Loop | 
|---|
| 65 |  | 
|---|
| 66 | SSTSI_LoopEnd: | 
|---|
| 67 | clc | 
|---|
| 68 | ret   ; Exit is here :) | 
|---|
| 69 | SETUP_SwitchToSelectedItem      EndP | 
|---|
| 70 |  | 
|---|
| 71 | SETUP_CheckEnterSETUP           Proc Near | 
|---|
| 72 |  | 
|---|
| 73 | ; Rousseau: added | 
|---|
| 74 | ;mov     SETUP_ExitEvent, 0 | 
|---|
| 75 | ;xor     al, al                        ; -PARTITION SETUP PreDefines- | 
|---|
| 76 | ;mov     PartSetup_UpperPart, al       ; Upper-Partition == 0 | 
|---|
| 77 | ;mov     PartSetup_ActivePart, al      ; Active-Partition == 0 | 
|---|
| 78 |  | 
|---|
| 79 | ; Setup PartitionPointers-Table...again (needed when re-entering setup) | 
|---|
| 80 | ;call    PART_CalculateStraightPartPointers | 
|---|
| 81 | ;call    VideoIO_DBG_WriteString | 
|---|
| 82 | ; Rousseau: end added | 
|---|
| 83 |  | 
|---|
| 84 |  | 
|---|
| 85 |  | 
|---|
| 86 | test    byte ptr [CFG_AutoEnterSetup], 1 | 
|---|
| 87 | jnz     SCES_ForceEnter | 
|---|
| 88 | mov     al, [SETUP_KeysOnEntry] | 
|---|
| 89 | test    al, Keys_Flags_EnterSetup | 
|---|
| 90 | jz      SCES_NoEnterSETUP | 
|---|
| 91 | SCES_ForceEnter: | 
|---|
| 92 | call    SETUP_Main | 
|---|
| 93 | SCES_NoEnterSETUP: | 
|---|
| 94 | ret | 
|---|
| 95 | SETUP_CheckEnterSETUP           EndP | 
|---|
| 96 |  | 
|---|
| 97 | SETUP_Main                      Proc Near   Uses si es bp | 
|---|
| 98 | mov     byte ptr [SETUP_ExitEvent], 0 | 
|---|
| 99 | xor     al, al                        ; -PARTITION SETUP PreDefines- | 
|---|
| 100 | mov     [PartSetup_UpperPart], al       ; Upper-Partition == 0 | 
|---|
| 101 | mov     [PartSetup_ActivePart], al      ; Active-Partition == 0 | 
|---|
| 102 |  | 
|---|
| 103 | ; Setup PartitionPointers-Table...again (needed when re-entering setup) | 
|---|
| 104 | call    PART_CalculateStraightPartPointers | 
|---|
| 105 |  | 
|---|
| 106 | IFDEF   FX_ENABLED | 
|---|
| 107 | call    FX_StartScreen                 ; Start of new screen... | 
|---|
| 108 | ENDIF | 
|---|
| 109 |  | 
|---|
| 110 | call    SETUP_DrawMenuBase | 
|---|
| 111 | mov     bp, offset SETUP_MainMenu | 
|---|
| 112 | call    SETUP_MenuTask                 ; calls Menu! | 
|---|
| 113 | ret | 
|---|
| 114 | SETUP_Main                      EndP | 
|---|
| 115 |  | 
|---|
| 116 | ;        In: BP - Pointer to Menu | 
|---|
| 117 | ;   CurMenu: Left Side 0-6, Right Side 8-14 (Bit 3!) | 
|---|
| 118 | SETUP_MenuTask                  Proc Near   ; the main-menu routine | 
|---|
| 119 | cmp     byte ptr [SETUP_ExitEvent], 1 | 
|---|
| 120 | jne     SMT_NoImmediateExit | 
|---|
| 121 | ret | 
|---|
| 122 |  | 
|---|
| 123 | SMT_NoImmediateExit: | 
|---|
| 124 | call    SETUP_FillUpItemPacks | 
|---|
| 125 | call    SETUP_DrawMenuOnScreen | 
|---|
| 126 | mov     si, ds:[bp+1]     ; Ptr to Help-Text | 
|---|
| 127 | call    SETUP_DrawMenuHelp | 
|---|
| 128 |  | 
|---|
| 129 | mov     ax, ds:[bp+1]   ; Help Pointer | 
|---|
| 130 | cmp     ax, offset TXT_SETUPHELP_Main ; ask only in main-menu... | 
|---|
| 131 | jne     SMT_NotMainMenu | 
|---|
| 132 |  | 
|---|
| 133 | IFDEF   FX_ENABLED | 
|---|
| 134 | call    FX_EndScreenLeft              ; Do FX, if requested... | 
|---|
| 135 | ENDIF | 
|---|
| 136 |  | 
|---|
| 137 | test    byte ptr [CFG_PasswordSetup], 1 | 
|---|
| 138 | jz      SMT_NotMainMenu | 
|---|
| 139 | mov     ax, 0ABABh | 
|---|
| 140 | mov     si, offset TXT_ProtectedSetup ; why bother again ? | 
|---|
| 141 | mov     di, offset CFG_MasterPassword ; Only Access Using MASTER Pwd | 
|---|
| 142 | call    PASSWORD_AskSpecifiedPassword | 
|---|
| 143 | SMT_NotMainMenu: | 
|---|
| 144 |  | 
|---|
| 145 | mov     dl, dh | 
|---|
| 146 | SMT_KeyBored: | 
|---|
| 147 | ; Keyboard-Process Loop | 
|---|
| 148 | push    dx | 
|---|
| 149 | mov     ah, 0 | 
|---|
| 150 | int     16h | 
|---|
| 151 | pop     dx | 
|---|
| 152 |  | 
|---|
| 153 | ;! | 
|---|
| 154 | ;! DEBUG_PROBE | 
|---|
| 155 | ;! | 
|---|
| 156 | IFDEF   AUX_DEBUGx | 
|---|
| 157 | push    1234h | 
|---|
| 158 | call    DEBUG_Probe | 
|---|
| 159 | call    DEBUG_DumpIPT | 
|---|
| 160 | call    DEBUG_DumpRegisters | 
|---|
| 161 | ENDIF | 
|---|
| 162 |  | 
|---|
| 163 |  | 
|---|
| 164 |  | 
|---|
| 165 | cmp     ah, Keys_Up | 
|---|
| 166 | je      SMT_KeyUp | 
|---|
| 167 | cmp     ah, Keys_Down | 
|---|
| 168 | je      SMT_KeyDown | 
|---|
| 169 | cmp     ah, Keys_Left | 
|---|
| 170 | je      SMT_KeyLeftRight | 
|---|
| 171 | cmp     ah, Keys_Right | 
|---|
| 172 | je      SMT_KeyLeftRight | 
|---|
| 173 | cmp     ah, Keys_ENTER | 
|---|
| 174 | je      SMT_KeyENTER | 
|---|
| 175 | cmp     ah, Keys_Plus | 
|---|
| 176 | je      SMT_KeyPlus | 
|---|
| 177 | cmp     ah, Keys_Minus | 
|---|
| 178 | je      SMT_KeyMinus | 
|---|
| 179 | cmp     ah, Keys_GrayPlus | 
|---|
| 180 | je      SMT_KeyPlus | 
|---|
| 181 | cmp     ah, Keys_GrayMinus | 
|---|
| 182 | je      SMT_KeyMinus | 
|---|
| 183 | cmp     ah, Keys_PageDown | 
|---|
| 184 | je      SMT_KeyPlus | 
|---|
| 185 | cmp     ah, Keys_PageUp | 
|---|
| 186 | je      SMT_KeyMinus | 
|---|
| 187 | cmp     ah, Keys_ESC | 
|---|
| 188 | je      SMT_KeyEsc | 
|---|
| 189 | cmp     ah, Keys_F1 | 
|---|
| 190 | jne   skip_xx | 
|---|
| 191 | jmp      SMT_KeyHelp | 
|---|
| 192 | skip_xx: | 
|---|
| 193 | cmp     ah, Keys_F10 | 
|---|
| 194 | jne   skip_yy | 
|---|
| 195 | jmp      SMT_SaveAndExitNOW | 
|---|
| 196 | skip_yy: | 
|---|
| 197 | ; ASCII values... | 
|---|
| 198 | cmp     al, Keys_Space | 
|---|
| 199 | je      SMT_KeyPlus | 
|---|
| 200 | jmp     SMT_KeyBored | 
|---|
| 201 |  | 
|---|
| 202 | SMT_KeyUp: | 
|---|
| 203 | dec     dh                            ; Current Item -1 | 
|---|
| 204 | mov     bx, offset SMT_KeyUp | 
|---|
| 205 | jmp     SMT_FixUpModify | 
|---|
| 206 |  | 
|---|
| 207 | SMT_KeyDown: | 
|---|
| 208 | inc     dh                            ; Current Item +1 | 
|---|
| 209 | mov     bx, offset SMT_KeyDown | 
|---|
| 210 | jmp     SMT_FixUpModify | 
|---|
| 211 |  | 
|---|
| 212 | SMT_KeyLeftRight: | 
|---|
| 213 | xor     dh, 1000b                     ; Little Trick Flip-Flop Left/Right | 
|---|
| 214 | mov     bx, offset SMT_KeyLeftRight | 
|---|
| 215 | jmp     SMT_FixUpModify | 
|---|
| 216 |  | 
|---|
| 217 | SMT_KeyENTER:                          ; Enters Menu, if no ItemPack available | 
|---|
| 218 | mov     ch, dh | 
|---|
| 219 | call    SETUP_SwitchToSelectedItem    ; Calculates SI for Item-No (CH) | 
|---|
| 220 | mov     ax, ds:[si+LocMENU_RoutinePtr] | 
|---|
| 221 | mov     bx, ds:[si+LocMENU_VariablePtr] | 
|---|
| 222 | or      bx, bx                        ; VarPtr ? | 
|---|
| 223 | jnz     SMT_DoNotExecute | 
|---|
| 224 | SMT_DirectExecute: | 
|---|
| 225 | mov     ds:[bp+0], dh              ; Saves current menu | 
|---|
| 226 | call    ax                         ; Call to CodePtr | 
|---|
| 227 | call    SETUP_DrawMenuOnScreen     ; Redraw after return | 
|---|
| 228 | cmp     byte ptr [SETUP_ExitEvent], 1 | 
|---|
| 229 | je      SMT_ExitEvent | 
|---|
| 230 | SMT_DoNotExecute: | 
|---|
| 231 | jmp     SMT_KeyBored | 
|---|
| 232 |  | 
|---|
| 233 | SMT_ExitEvent: | 
|---|
| 234 | ret                                   ; just return, to easy uh ? | 
|---|
| 235 |  | 
|---|
| 236 | SMT_KeyPlus:                           ; Changes ItemPack | 
|---|
| 237 | mov     cl, 1 | 
|---|
| 238 | jmp     SMT_KeyChangeEvent | 
|---|
| 239 | SMT_KeyMinus: | 
|---|
| 240 | xor     cl, cl | 
|---|
| 241 | SMT_KeyChangeEvent: | 
|---|
| 242 | mov     ch, dh | 
|---|
| 243 | call    SETUP_SwitchToSelectedItem    ; Calculates SI for Item-No (CH) | 
|---|
| 244 | mov     ax, ds:[si+LocMENU_RoutinePtr] | 
|---|
| 245 | mov     bx, ds:[si+LocMENU_VariablePtr] | 
|---|
| 246 | or      bx, bx                        ; VarPtr ? =0 No ItemPack | 
|---|
| 247 | jnz     SMT_DoItemPack | 
|---|
| 248 | jmp     SMT_KeyBored | 
|---|
| 249 | SMT_DoItemPack: | 
|---|
| 250 | clc                                ; Modify this Item ! | 
|---|
| 251 | call    ax                         ; Call to Item-Code-Ptr | 
|---|
| 252 | jmp     SMT_OkayReDisplay | 
|---|
| 253 |  | 
|---|
| 254 | SMT_KeyEsc: | 
|---|
| 255 | mov     ax, ds:[bp+1]                 ; Help Pointer | 
|---|
| 256 | cmp     ax, offset TXT_SETUPHELP_Main ; embarassing? ;-) | 
|---|
| 257 | jne     SMT_ReturnPrev | 
|---|
| 258 | jmp     SMT_ExitWithoutSaving | 
|---|
| 259 | SMT_ReturnPrev: | 
|---|
| 260 | mov     ds:[bp+0], dh                 ; Saves current menu | 
|---|
| 261 | ret                                   ; just return to go to prev menu... | 
|---|
| 262 |  | 
|---|
| 263 | SMT_FixUpModify: | 
|---|
| 264 | cmp     dh, 0FFh                      ; = 255 ? | 
|---|
| 265 | jne     SMT_NoAdjustMin | 
|---|
| 266 | mov     dh, 14                        ; Overflow -> 14! | 
|---|
| 267 | SMT_NoAdjustMin: | 
|---|
| 268 | cmp     dh, 14                        ; bigger as 14 ? | 
|---|
| 269 | jbe     SMT_NoAdjustMax | 
|---|
| 270 | xor     dh, dh                        ; Reset to 0 | 
|---|
| 271 | SMT_NoAdjustMax: | 
|---|
| 272 | mov     ch, dh | 
|---|
| 273 | call    SETUP_SwitchToSelectedItem    ; Calculates SI for Item-No (CH) | 
|---|
| 274 | jnc     SMT_ValidItem | 
|---|
| 275 | jmp     bx | 
|---|
| 276 | SMT_ValidItem: | 
|---|
| 277 | mov     ax, word ptr ds:[si] | 
|---|
| 278 | or      ax, ax | 
|---|
| 279 | jnz     SMT_OkayReDisplay | 
|---|
| 280 | jmp     bx                            ; Do it again... :) | 
|---|
| 281 | SMT_OkayReDisplay: | 
|---|
| 282 | call    SETUP_DrawDeSelectItem | 
|---|
| 283 | call    SETUP_DrawSelectItem | 
|---|
| 284 | mov     dl, dh | 
|---|
| 285 | jmp     SMT_KeyBored | 
|---|
| 286 |  | 
|---|
| 287 | SMT_KeyHelp:                           ; Shows help for selected Item... | 
|---|
| 288 | mov     ch, dh | 
|---|
| 289 | call    SETUP_SwitchToSelectedItem    ; Calculates SI for Item-No (CH) | 
|---|
| 290 | mov     bx, ds:[si+LocMENU_ItemHelpPtr] | 
|---|
| 291 | or      bx, bx                        ; Help-Ptr available ? | 
|---|
| 292 | jz      SMT_NoHelpAvailable | 
|---|
| 293 | call    SETUP_ShowHelp                ; Shows help... | 
|---|
| 294 | SMT_NoHelpAvailable: | 
|---|
| 295 | jmp     SMT_KeyBored | 
|---|
| 296 |  | 
|---|
| 297 | SMT_SaveAndExitNOW:                    ; Direct HackIn | 
|---|
| 298 |  | 
|---|
| 299 | ;! | 
|---|
| 300 | ;! DEBUG_PROBE | 
|---|
| 301 | ;! | 
|---|
| 302 | IFDEF   AUX_DEBUGx | 
|---|
| 303 | push    1235h | 
|---|
| 304 | call    DEBUG_Probe | 
|---|
| 305 | ENDIF | 
|---|
| 306 |  | 
|---|
| 307 | mov     ax, offset SETUP_EnterMenu_SaveAndExitSetup | 
|---|
| 308 | jmp     SMT_DirectExecute | 
|---|
| 309 |  | 
|---|
| 310 | SMT_ExitWithoutSaving:                 ; Direct HackIn | 
|---|
| 311 | ;! | 
|---|
| 312 | ;! DEBUG_PROBE | 
|---|
| 313 | ;! | 
|---|
| 314 | IFDEF   AUX_DEBUGx | 
|---|
| 315 | push    1236h | 
|---|
| 316 | call    DEBUG_Probe | 
|---|
| 317 | ENDIF | 
|---|
| 318 |  | 
|---|
| 319 | mov     ax, offset SETUP_EnterMenu_ExitWithoutSaving | 
|---|
| 320 | jmp     SMT_DirectExecute | 
|---|
| 321 | SETUP_MenuTask                  EndP | 
|---|
| 322 |  | 
|---|
| 323 |  | 
|---|
| 324 | ; Initial bg-colors on setup-items -- revert to item-bg when cursor moved | 
|---|
| 325 | CLR_MENU_WINDOW_CLASSIC = 0e01h | 
|---|
| 326 | CLR_MENU_WINDOW_BM      = 0e01h | 
|---|
| 327 | CLR_MENU_WINDOW_TB      = 0e08h | 
|---|
| 328 | IFDEF TESTBUILD | 
|---|
| 329 | CLR_MENU_WINDOW = CLR_MENU_WINDOW_TB | 
|---|
| 330 | ELSE | 
|---|
| 331 | CLR_MENU_WINDOW = CLR_MENU_WINDOW_BM | 
|---|
| 332 | ENDIF | 
|---|
| 333 |  | 
|---|
| 334 | ;        In: BP - Pointer to Menu | 
|---|
| 335 | ;       Out: DH - Active Item on Screen | 
|---|
| 336 | SETUP_DrawMenuOnScreen          Proc Near | 
|---|
| 337 | call    SETUP_DrawMenuWindow | 
|---|
| 338 | mov     cx, CLR_MENU_WINDOW | 
|---|
| 339 | call    VideoIO_Color | 
|---|
| 340 | xor     ch, ch | 
|---|
| 341 | SDMOS_Loop: | 
|---|
| 342 | call    SETUP_DrawItemOnScreen | 
|---|
| 343 | inc     ch                         ; Total of 14 items to display | 
|---|
| 344 | cmp     ch, 14 | 
|---|
| 345 | jbe     SDMOS_Loop | 
|---|
| 346 | mov     dh, ds:[bp+0] | 
|---|
| 347 | mov     dl, dh                        ; Active = Last | 
|---|
| 348 | call    SETUP_DrawSelectItem          ; Marks active Item | 
|---|
| 349 | mov     si, ds:[bp+1]                 ; Ptr to Item-Help-Text | 
|---|
| 350 | call    SETUP_DrawMenuHelp | 
|---|
| 351 | ret | 
|---|
| 352 | SETUP_DrawMenuOnScreen          EndP | 
|---|
| 353 |  | 
|---|
| 354 | SETUP_FillUpItemPacks           Proc Near Uses cx | 
|---|
| 355 | xor     ch, ch | 
|---|
| 356 | SFUIP_Loop: | 
|---|
| 357 | call    SETUP_FillUpItemPack_Now | 
|---|
| 358 | inc     ch                         ; Total of 14 items to display | 
|---|
| 359 | cmp     ch, 14 | 
|---|
| 360 | jbe     SFUIP_Loop | 
|---|
| 361 | ret | 
|---|
| 362 | SETUP_FillUpItemPacks           EndP | 
|---|
| 363 |  | 
|---|
| 364 |  | 
|---|
| 365 | CLR_SELECTED_ITEM_CLASSIC  = 0f04h | 
|---|
| 366 | CLR_SELECTED_ITEM_BM       = 0f04h | 
|---|
| 367 | CLR_SELECTED_ITEM_TB       = 0f04h | 
|---|
| 368 | IFDEF TESTBUILD | 
|---|
| 369 | CLR_SELECTED_ITEM = CLR_SELECTED_ITEM_TB | 
|---|
| 370 | ELSE | 
|---|
| 371 | CLR_SELECTED_ITEM = CLR_SELECTED_ITEM_BM | 
|---|
| 372 | ENDIF | 
|---|
| 373 |  | 
|---|
| 374 | ; Displays selected Item on screen | 
|---|
| 375 | ;        In: DH - Active Item | 
|---|
| 376 | ; Destroyed: None | 
|---|
| 377 | SETUP_DrawSelectItem            Proc Near Uses cx | 
|---|
| 378 | mov     cx, CLR_SELECTED_ITEM | 
|---|
| 379 | call    VideoIO_Color | 
|---|
| 380 | mov     ch, dh | 
|---|
| 381 | call    SETUP_DrawItemOnScreen | 
|---|
| 382 | ret | 
|---|
| 383 | SETUP_DrawSelectItem            EndP | 
|---|
| 384 |  | 
|---|
| 385 |  | 
|---|
| 386 | CLR_DESELECTED_ITEM_CLASSIC   = 0e01h | 
|---|
| 387 | CLR_DESELECTED_ITEM_BM        = 0e01h | 
|---|
| 388 | CLR_DESELECTED_ITEM_TB        = 0e08h | 
|---|
| 389 | IFDEF TESTBUILD | 
|---|
| 390 | CLR_DESELECTED_ITEM = CLR_DESELECTED_ITEM_TB | 
|---|
| 391 | ELSE | 
|---|
| 392 | CLR_DESELECTED_ITEM = CLR_DESELECTED_ITEM_BM | 
|---|
| 393 | ENDIF | 
|---|
| 394 |  | 
|---|
| 395 | ; Display last-selected Item on screen (De-Select) | 
|---|
| 396 | ;        In: DL - Active Item | 
|---|
| 397 | ; Destroyed: None | 
|---|
| 398 | SETUP_DrawDeSelectItem          Proc Near Uses cx | 
|---|
| 399 | mov     cx, CLR_DESELECTED_ITEM | 
|---|
| 400 | call    VideoIO_Color | 
|---|
| 401 | mov     ch, dl | 
|---|
| 402 | call    SETUP_DrawItemOnScreen | 
|---|
| 403 | ret | 
|---|
| 404 | SETUP_DrawDeSelectItem          EndP | 
|---|
| 405 |  | 
|---|
| 406 | ; Actually displays Item on screen, Out of bounce checking included | 
|---|
| 407 | ;        In: CH - CurItemNo | 
|---|
| 408 | ; Destroyed: None | 
|---|
| 409 | SETUP_DrawItemOnScreen          Proc Near   Uses ax cx dx si es | 
|---|
| 410 | call    SETUP_SwitchToSelectedItem    ; Calculates SI for Item-No (CH) | 
|---|
| 411 | jnc     SDIOS_ValidItem | 
|---|
| 412 | ret     ; Ignore all Invalid Items | 
|---|
| 413 |  | 
|---|
| 414 | SDIOS_ValidItem: | 
|---|
| 415 | mov     dx, word ptr TextColorFore    ; BackUps TextColor for later | 
|---|
| 416 | mov     cl, 3                         ; Left side: 3 | 
|---|
| 417 | test    ch, 1000b | 
|---|
| 418 | jz      SDIOS_NoRightSide | 
|---|
| 419 | and     ch, 111b | 
|---|
| 420 | mov     cl, 42                        ; Right side: 42 | 
|---|
| 421 | SDIOS_NoRightSide: | 
|---|
| 422 | mov     ax, ds:[si+LocMENU_VariablePtr] ; if available, we got ItemPack | 
|---|
| 423 | or      ax, ax | 
|---|
| 424 | jnz     SDIOS_ItemPackDraw | 
|---|
| 425 | ; ------------------------------------------------------ Draw NAME | 
|---|
| 426 | mov     ax, ds:[si+LocMENU_RoutinePtr] ; no Item-Code-Ptr? -> no name | 
|---|
| 427 | or      ax, ax | 
|---|
| 428 | jnz     SDIOS_Name_CodePtrAvailable | 
|---|
| 429 | mov     TextColorFore, 0Fh            ; display in white letters | 
|---|
| 430 | sub     cl, 2                         ; not optimized, i know :] | 
|---|
| 431 | SDIOS_Name_CodePtrAvailable: | 
|---|
| 432 | add     cl, 2                         ; Fix X-coordinate (for name) | 
|---|
| 433 | add     ch, 6                         ; Fix Y-coordinate | 
|---|
| 434 | cmp     cl, 40 | 
|---|
| 435 | jb      SDIOS_Name_NoFixUpName | 
|---|
| 436 | inc     cl | 
|---|
| 437 | SDIOS_Name_NoFixUpName: | 
|---|
| 438 | call    VideoIO_Locate | 
|---|
| 439 | mov     si, ds:[si+LocMENU_ItemNamePtr] ; SI - Name of Item | 
|---|
| 440 | or      si, si | 
|---|
| 441 | jz      SDIOS_Name_NoItemName | 
|---|
| 442 | call    VideoIO_Print                 ; ...and print it. | 
|---|
| 443 | SDIOS_Name_NoItemName: | 
|---|
| 444 | mov     word ptr [TextColorFore], dx | 
|---|
| 445 | ret | 
|---|
| 446 |  | 
|---|
| 447 | ; ------------------------------------------------------ Draw ITEMPACK | 
|---|
| 448 | SDIOS_ItemPackDraw: | 
|---|
| 449 | add     ch, 6                         ; Fix coordinate... | 
|---|
| 450 | ; Display the Name and a double-point first | 
|---|
| 451 | ; BackUp Coordinates and ItemPackPtr | 
|---|
| 452 | push    cx | 
|---|
| 453 | push    si | 
|---|
| 454 | push    cx | 
|---|
| 455 | cmp     cl, 40 | 
|---|
| 456 | jb      SDIOS_ItemPack_NoFixUpItemPack | 
|---|
| 457 | inc     cl | 
|---|
| 458 | SDIOS_ItemPack_NoFixUpItemPack: | 
|---|
| 459 | call    VideoIO_Locate | 
|---|
| 460 |  | 
|---|
| 461 |  | 
|---|
| 462 | CLR_ITEM_PACK_CLASSIC   = 0f01h | 
|---|
| 463 | CLR_ITEM_PACK_BM        = 0f01h | 
|---|
| 464 | CLR_ITEM_PACK_TB        = 0f08h | 
|---|
| 465 | IFDEF TESTBUILD | 
|---|
| 466 | CLR_ITEM_PACK = CLR_ITEM_PACK_TB | 
|---|
| 467 | ELSE | 
|---|
| 468 | CLR_ITEM_PACK = CLR_ITEM_PACK_BM | 
|---|
| 469 | ENDIF | 
|---|
| 470 |  | 
|---|
| 471 | mov     cx, CLR_ITEM_PACK | 
|---|
| 472 | call    VideoIO_Color           ; White on blue background | 
|---|
| 473 | mov     si, ds:[si+LocMENU_ItemNamePtr] ; SI - Name of Item | 
|---|
| 474 | or      si, si | 
|---|
| 475 | jz      SDIOS_ItemPack_NoItemName | 
|---|
| 476 | call    VideoIO_Print | 
|---|
| 477 | SDIOS_ItemPack_NoItemName: | 
|---|
| 478 | pop     cx | 
|---|
| 479 | add     cl, 24 | 
|---|
| 480 | call    VideoIO_Locate | 
|---|
| 481 | mov     al, 3Ah | 
|---|
| 482 | call    VideoIO_PrintSingleChar    ; Write double-point | 
|---|
| 483 | mov     word ptr TextColorFore, dx | 
|---|
| 484 | pop     si | 
|---|
| 485 | pop     cx | 
|---|
| 486 | add     cl, 26                        ; Fix X-coordinate (for ItemPack) | 
|---|
| 487 | call    VideoIO_Locate | 
|---|
| 488 |  | 
|---|
| 489 | add     si, LocMENU_ItemPack          ; Where ItemPack is located... | 
|---|
| 490 | ; Filler berechnen | 
|---|
| 491 | SDIOS_ItemPack_RetryGetLen: | 
|---|
| 492 | mov     cx, 11 | 
|---|
| 493 | call    GetLenOfName | 
|---|
| 494 | cmp     cx, 11 | 
|---|
| 495 | je      SDIOS_ItemPack_NoFiller | 
|---|
| 496 | mov     al, cl | 
|---|
| 497 | mov     cl, 11 | 
|---|
| 498 | sub     cl, al | 
|---|
| 499 | mov     al, 20h                       ; Fill up with spaces | 
|---|
| 500 | call    VideoIO_Internal_MakeWinRight ; and write... | 
|---|
| 501 | SDIOS_ItemPack_NoFiller: | 
|---|
| 502 | call    VideoIO_PrintLikeLenOfName    ; Write ItemPack | 
|---|
| 503 | ret | 
|---|
| 504 | SETUP_DrawItemOnScreen          EndP | 
|---|
| 505 |  | 
|---|
| 506 | SETUP_FillUpItemPack_Now        Proc Near Uses ax bx si | 
|---|
| 507 | call    SETUP_SwitchToSelectedItem    ; Calculates SI for Item-No (CH) | 
|---|
| 508 | jnc     SFUIPN_ValidItem | 
|---|
| 509 | SFUIPN_Ignore: | 
|---|
| 510 | ret                                   ; Ignore all Invalid Items | 
|---|
| 511 |  | 
|---|
| 512 | SFUIPN_ValidItem: | 
|---|
| 513 | mov     bx, ds:[si+LocMENU_VariablePtr] | 
|---|
| 514 | or      bx, bx | 
|---|
| 515 | jz      SFUIPN_Ignore | 
|---|
| 516 | mov     ax, ds:[si+LocMENU_RoutinePtr] | 
|---|
| 517 | mov     cl, 1                         ; Add, if anything fails | 
|---|
| 518 | stc                                   ; Just FillUp Call | 
|---|
| 519 | call    ax                            ; CH-ItemNo, CL-Add/Sub, BX-PtrToVar | 
|---|
| 520 | ret | 
|---|
| 521 | SETUP_FillUpItemPack_Now        EndP | 
|---|
| 522 |  | 
|---|
| 523 | CLR_SETUP_WINDOW_CLASSIC   = 0f01h | 
|---|
| 524 | CLR_SETUP_WINDOW_BM        = 0901h | 
|---|
| 525 | CLR_SETUP_WINDOW_TB        = 0908h | 
|---|
| 526 | IFDEF TESTBUILD | 
|---|
| 527 | CLR_SETUP_WINDOW = CLR_SETUP_WINDOW_TB | 
|---|
| 528 | ELSE | 
|---|
| 529 | CLR_SETUP_WINDOW = CLR_SETUP_WINDOW_BM | 
|---|
| 530 | ENDIF | 
|---|
| 531 |  | 
|---|
| 532 | SETUP_DrawMenuWindow            Proc Near   Uses es | 
|---|
| 533 | mov     cx, CLR_SETUP_WINDOW | 
|---|
| 534 | call    VideoIO_Color | 
|---|
| 535 | mov     bx, 0401h | 
|---|
| 536 | mov     dx, 0E50h | 
|---|
| 537 | call    VideoIO_MakeWindow | 
|---|
| 538 | mov     bx, 0E01h | 
|---|
| 539 | mov     dx, 1150h | 
|---|
| 540 | call    VideoIO_MakeWindow | 
|---|
| 541 | mov     cx, 0529h | 
|---|
| 542 | call    VideoIO_Locate | 
|---|
| 543 | mov     al, TextChar_WinLineDown | 
|---|
| 544 | mov     cl, 12 | 
|---|
| 545 | call    VideoIO_Internal_MakeWinDown | 
|---|
| 546 | ; the little fixups for better looking windows... | 
|---|
| 547 | mov     cx, 0429h | 
|---|
| 548 | call    VideoIO_Locate | 
|---|
| 549 | mov     al, TextChar_WinRep1 | 
|---|
| 550 | call    VideoIO_PrintSingleChar | 
|---|
| 551 | mov     cx, 0E29h | 
|---|
| 552 | call    VideoIO_Locate | 
|---|
| 553 | mov     al, TextChar_WinRep6 | 
|---|
| 554 | call    VideoIO_PrintSingleChar | 
|---|
| 555 | mov     cx, 1129h | 
|---|
| 556 | call    VideoIO_Locate | 
|---|
| 557 | mov     al, TextChar_WinRep3 | 
|---|
| 558 | call    VideoIO_PrintSingleChar | 
|---|
| 559 | mov     cx, 0E01h | 
|---|
| 560 | call    VideoIO_Locate | 
|---|
| 561 | mov     al, TextChar_WinRep5 | 
|---|
| 562 | call    VideoIO_PrintSingleChar | 
|---|
| 563 | mov     cx, 0E50h | 
|---|
| 564 | call    VideoIO_Locate | 
|---|
| 565 | mov     al, TextChar_WinRep4 | 
|---|
| 566 | call    VideoIO_PrintSingleChar | 
|---|
| 567 | ret | 
|---|
| 568 | SETUP_DrawMenuWindow            EndP | 
|---|
| 569 |  | 
|---|
| 570 | SETUP_DrawMenuBase              Proc Near | 
|---|
| 571 | call    BOOTMENU_BuildBackground | 
|---|
| 572 | ; -------------------------------------------- Upper Copyright... | 
|---|
| 573 | mov     cx, 0F00h | 
|---|
| 574 | call    VideoIO_Color | 
|---|
| 575 | mov     cx, 011Eh | 
|---|
| 576 | call    VideoIO_Locate | 
|---|
| 577 | mov     si, offset Copyright | 
|---|
| 578 | inc     si | 
|---|
| 579 | mov     cl, 9 | 
|---|
| 580 | call    VideoIO_FixedPrint            ; Put 'AiR-BOOT' to 1st line... | 
|---|
| 581 | push    si | 
|---|
| 582 | mov     si, offset SETUP_UpperFixString | 
|---|
| 583 | call    VideoIO_Print              ; and 'SETUP'... | 
|---|
| 584 | pop     si | 
|---|
| 585 | mov     cl, CopyrightVersionLen | 
|---|
| 586 | call    VideoIO_FixedPrint            ; and 'vX.XX'. | 
|---|
| 587 |  | 
|---|
| 588 | ; Rousseau: | 
|---|
| 589 | ; Strange, had to adjust this value. | 
|---|
| 590 | ; Somewhere some offset changed... | 
|---|
| 591 | ; Possibly happened with the movzx change to 286 instructions because some | 
|---|
| 592 | ; offsets are hard coded. | 
|---|
| 593 | ;add     si, 3 | 
|---|
| 594 | add     si, 2 | 
|---|
| 595 |  | 
|---|
| 596 | call    GetLenOfString                ; CX - Len of "Copyright" string | 
|---|
| 597 | mov     dx, cx | 
|---|
| 598 | mov     cx, 0228h | 
|---|
| 599 | call    VideoIO_LocateToCenter        ; LocateToCenter 2, 40 using TotalLen | 
|---|
| 600 | call    VideoIO_Print                 ; 'Copyright' to 2nd line... | 
|---|
| 601 |  | 
|---|
| 602 | mov     si, offset TXT_TranslationBy | 
|---|
| 603 | call    GetLenOfString                ; CX - Len of "Translated by" string | 
|---|
| 604 | mov     dx, cx | 
|---|
| 605 | mov     cx, 0328h | 
|---|
| 606 | call    VideoIO_LocateToCenter        ; LocateToCenter 3, 40 using TotalLen | 
|---|
| 607 | call    VideoIO_Print                 ; 'Translated By' as well... | 
|---|
| 608 | ; -------------------------------------------- Lower 1st Line | 
|---|
| 609 | mov     si, offset TXT_SETUP_LowerMessage | 
|---|
| 610 | mov     cl, 2 | 
|---|
| 611 | call    GetLenOfStrings               ; CX - Len of 5 Strings at [si] | 
|---|
| 612 | mov     dx, cx | 
|---|
| 613 | mov     cx, 1329h | 
|---|
| 614 | call    VideoIO_LocateToCenter        ; LocateToCenter 21, 40 using TotalLen | 
|---|
| 615 | call    VideoIO_Print                 ; Begin using WHITE again... | 
|---|
| 616 | mov     cx, 0C00h | 
|---|
| 617 | call    VideoIO_Color | 
|---|
| 618 | call    VideoIO_Print                 ; contine red - 'GPLv3+' | 
|---|
| 619 | ; -------------------------------------------- Lower 2nd Line | 
|---|
| 620 | mov     cl, 1 | 
|---|
| 621 | call    GetLenOfStrings               ; CX - Len of 3 Strings at [si] | 
|---|
| 622 | mov     dx, cx | 
|---|
| 623 | mov     cx, 1429h | 
|---|
| 624 | call    VideoIO_LocateToCenter        ; LocateToCenter 19, 40 using TotalLen | 
|---|
| 625 | mov     cx, 0F00h | 
|---|
| 626 | call    VideoIO_Color                 ; White... | 
|---|
| 627 | call    VideoIO_Print                 ; Begin using WHITE... | 
|---|
| 628 | ; -------------------------------------------- Lower 3rd Line | 
|---|
| 629 | mov     cl, 1 | 
|---|
| 630 | call    GetLenOfString                ; CX - Len of String at [si] | 
|---|
| 631 | mov     dx, cx | 
|---|
| 632 | mov     cx, 1629h | 
|---|
| 633 | call    VideoIO_LocateToCenter        ; LocateToCenter 22, 40 using TotalLen | 
|---|
| 634 | mov     cx, 0F00h | 
|---|
| 635 | call    VideoIO_Color                 ; White... | 
|---|
| 636 | call    VideoIO_Print                 ; For more information... | 
|---|
| 637 | ; -------------------------------------------- Lower 4th Line | 
|---|
| 638 | mov     cl, 1 | 
|---|
| 639 | call    GetLenOfStrings               ; CX - Len of 5 Strings at [si] | 
|---|
| 640 | mov     dx, cx | 
|---|
| 641 | mov     cx, 1729h | 
|---|
| 642 | call    VideoIO_LocateToCenter        ; LocateToCenter 24, 40 using TotalLen | 
|---|
| 643 | mov     cx, 0B00h | 
|---|
| 644 | call    VideoIO_Color | 
|---|
| 645 | call    VideoIO_Print                 ; homepage | 
|---|
| 646 | ; -------------------------------------------- Lower 5th Line | 
|---|
| 647 | mov     cl, 2 | 
|---|
| 648 | call    GetLenOfStrings               ; CX - Len of 4 Strings at [si] | 
|---|
| 649 | mov     dx, cx | 
|---|
| 650 | mov     cx, 1929h | 
|---|
| 651 | call    VideoIO_LocateToCenter        ; LocateToCenter 25, 40 using TotalLen | 
|---|
| 652 | mov     cx, 0700h | 
|---|
| 653 | call    VideoIO_Color | 
|---|
| 654 | call    VideoIO_Print                 ; white - 'contact via e-mail'... | 
|---|
| 655 | mov     cx, 0700h | 
|---|
| 656 | call    VideoIO_Color | 
|---|
| 657 | call    VideoIO_Print                 ; and finally the e-mail adress | 
|---|
| 658 | ret | 
|---|
| 659 | SETUP_DrawMenuBase              EndP | 
|---|
| 660 |  | 
|---|
| 661 |  | 
|---|
| 662 | ; F10-SETUP Help Directions | 
|---|
| 663 | CLR_SETUP_HELP_CLASSIC   = 0f01h | 
|---|
| 664 | CLR_SETUP_HELP_BM        = 0f01h | 
|---|
| 665 | CLR_SETUP_HELP_TB        = 0f08h | 
|---|
| 666 | IFDEF TESTBUILD | 
|---|
| 667 | CLR_SETUP_HELP = CLR_SETUP_HELP_TB | 
|---|
| 668 | ELSE | 
|---|
| 669 | CLR_SETUP_HELP = CLR_SETUP_HELP_BM | 
|---|
| 670 | ENDIF | 
|---|
| 671 |  | 
|---|
| 672 | ; Display the Help Menu | 
|---|
| 673 | ;        In: SI - Pointer to 4 HelpStrings... | 
|---|
| 674 | ; Destroyed: None | 
|---|
| 675 | SETUP_DrawMenuHelp              Proc Near   Uses cx si | 
|---|
| 676 | mov     cx, CLR_SETUP_HELP | 
|---|
| 677 | call    VideoIO_Color | 
|---|
| 678 | mov     cx, 0F05h | 
|---|
| 679 | call    VideoIO_Locate | 
|---|
| 680 | call    VideoIO_Print | 
|---|
| 681 | mov     cx, 1005h | 
|---|
| 682 | call    VideoIO_Locate | 
|---|
| 683 | call    VideoIO_Print | 
|---|
| 684 | mov     cx, 0F2Dh | 
|---|
| 685 | call    VideoIO_Locate | 
|---|
| 686 | call    VideoIO_Print | 
|---|
| 687 | mov     cx, 102Dh | 
|---|
| 688 | call    VideoIO_Locate | 
|---|
| 689 | call    VideoIO_Print | 
|---|
| 690 | ret | 
|---|
| 691 | SETUP_DrawMenuHelp              EndP | 
|---|
| 692 |  | 
|---|
| 693 | ;        In: bx - HelpPtr | 
|---|
| 694 | ; Destroyed: None | 
|---|
| 695 | SETUP_ShowHelp                  Proc Near   Uses cx dx ds si es di bp | 
|---|
| 696 | mov     ax, VideoIO_Page2 | 
|---|
| 697 | call    VideoIO_BackUpTo | 
|---|
| 698 |  | 
|---|
| 699 | push    bx                            ; Push HelpPtr | 
|---|
| 700 | mov     cx, 0B03h | 
|---|
| 701 | call    VideoIO_Color | 
|---|
| 702 | mov     bx, 0F33h | 
|---|
| 703 | mov     dx, 174Eh | 
|---|
| 704 | call    VideoIO_MakeWindow | 
|---|
| 705 | ; Print at lower-right frame of window | 
|---|
| 706 | mov     si, offset TXT_SETUPHELP_Enter | 
|---|
| 707 | call    GetLenOfString             ; CX - Len of String | 
|---|
| 708 | mov     dl, cl | 
|---|
| 709 | mov     cx, 174Eh | 
|---|
| 710 | sub     cl, dl | 
|---|
| 711 | call    VideoIO_Locate             ; Locate 23, (78-LenOfString) | 
|---|
| 712 | call    VideoIO_Print | 
|---|
| 713 | mov     cx, 0F03h | 
|---|
| 714 | call    VideoIO_Color | 
|---|
| 715 | ; Center at upper frame of window | 
|---|
| 716 | mov     si, offset TXT_SETUPHELP_Base | 
|---|
| 717 | call    GetLenOfString | 
|---|
| 718 | mov     dx, cx | 
|---|
| 719 | mov     cx, 0F41h | 
|---|
| 720 | call    VideoIO_LocateToCenter     ; LocateToCenter 15, 65 using LenOfStr | 
|---|
| 721 | call    VideoIO_Print | 
|---|
| 722 | ; beim R | 
|---|
| 723 |  | 
|---|
| 724 | mov     cx, 0E03h | 
|---|
| 725 | call    VideoIO_Color | 
|---|
| 726 | pop     si                            ; and restore HelpPtr to SI | 
|---|
| 727 | mov     cx, 1136h | 
|---|
| 728 |  | 
|---|
| 729 | SSH_Loop: | 
|---|
| 730 | call    VideoIO_Locate | 
|---|
| 731 | call    VideoIO_Print | 
|---|
| 732 | inc     ch                         ; TextPosY + 1 | 
|---|
| 733 | cmp     TextPosX, 36h | 
|---|
| 734 | ja      SSH_Loop | 
|---|
| 735 |  | 
|---|
| 736 | SSH_KeyLoop: | 
|---|
| 737 | mov     ah, 0 | 
|---|
| 738 | int     16h | 
|---|
| 739 | cmp     ah, Keys_ENTER | 
|---|
| 740 | je      SSH_EndOfHelp | 
|---|
| 741 | cmp     ah, Keys_ESC | 
|---|
| 742 | je      SSH_EndOfHelp | 
|---|
| 743 | jmp     SSH_KeyLoop | 
|---|
| 744 |  | 
|---|
| 745 | SSH_EndOfHelp: | 
|---|
| 746 | mov     ax, VideoIO_Page2 | 
|---|
| 747 | call    VideoIO_RestoreFrom | 
|---|
| 748 | ret | 
|---|
| 749 | SETUP_ShowHelp                  EndP | 
|---|
| 750 |  | 
|---|
| 751 | SETUP_EnterMenu_PartitionSetup  Proc Near   Uses dx bp | 
|---|
| 752 | ; Extra-Full Featured Partition Setup | 
|---|
| 753 | call    PARTSETUP_Main | 
|---|
| 754 | ret | 
|---|
| 755 | SETUP_EnterMenu_PartitionSetup  EndP | 
|---|
| 756 |  | 
|---|
| 757 | SETUP_EnterMenu_BasicOptions    Proc Near   Uses dx bp | 
|---|
| 758 | mov     bp, offset SETUP_BasicOptions | 
|---|
| 759 | call    SETUP_MenuTask                ; calls Menu! | 
|---|
| 760 | ret | 
|---|
| 761 | SETUP_EnterMenu_BasicOptions    EndP | 
|---|
| 762 |  | 
|---|
| 763 | SETUP_EnterMenu_AdvancedOptions Proc Near   Uses dx bp | 
|---|
| 764 | mov     bp, offset SETUP_AdvancedOptions | 
|---|
| 765 | call    SETUP_MenuTask                ; calls Menu! | 
|---|
| 766 | ret | 
|---|
| 767 | SETUP_EnterMenu_AdvancedOptions EndP | 
|---|
| 768 |  | 
|---|
| 769 | SETUP_EnterMenu_ExtendedOptions Proc Near   Uses dx bp | 
|---|
| 770 | mov     bp, offset SETUP_ExtendedBootOptions | 
|---|
| 771 | call    SETUP_MenuTask                ; calls Menu! | 
|---|
| 772 | ret | 
|---|
| 773 | SETUP_EnterMenu_ExtendedOptions EndP | 
|---|
| 774 |  | 
|---|
| 775 | SETUP_EnterMenu_DefineMasterPassword Proc Near | 
|---|
| 776 | mov     di, offset CFG_MasterPassword | 
|---|
| 777 | call    SETUP_EnterMenu_DefinePassword | 
|---|
| 778 | ret | 
|---|
| 779 | SETUP_EnterMenu_DefineMasterPassword EndP | 
|---|
| 780 |  | 
|---|
| 781 | SETUP_EnterMenu_DefineBootPassword Proc Near | 
|---|
| 782 | mov     di, offset CFG_BootPassword | 
|---|
| 783 | call    SETUP_EnterMenu_DefinePassword | 
|---|
| 784 | ret | 
|---|
| 785 | SETUP_EnterMenu_DefineBootPassword EndP | 
|---|
| 786 |  | 
|---|
| 787 | ; ============================================================================ | 
|---|
| 788 |  | 
|---|
| 789 | ;        In: di - Place for Password to be defined | 
|---|
| 790 | ; Destroyed: None | 
|---|
| 791 | SETUP_EnterMenu_DefinePassword  Proc Near   Uses dx es bp | 
|---|
| 792 | push    di                            ; DI - Place of Password | 
|---|
| 793 | mov     ax, cs | 
|---|
| 794 | mov     es, ax                     ; ES == CS & Magic (AX) destroyed | 
|---|
| 795 | mov     si, offset TXT_SETUP_PasswordOld | 
|---|
| 796 | ;       di - Place of Password to Check (0 to check both passwords) | 
|---|
| 797 | call    PASSWORD_AskSpecifiedPassword | 
|---|
| 798 | mov     si, offset TXT_SETUP_PasswordDefine | 
|---|
| 799 | mov     di, offset SETUP_NewPwd | 
|---|
| 800 | call    SETUP_LetEnterPassword | 
|---|
| 801 | xor     ax, ax                     ; Magic (AX) destroyed | 
|---|
| 802 | mov     si, offset TXT_SETUP_PasswordVerify | 
|---|
| 803 | mov     di, offset SETUP_VerifyPwd | 
|---|
| 804 | call    SETUP_LetEnterPassword | 
|---|
| 805 |  | 
|---|
| 806 | mov     si, offset SETUP_NewPwd | 
|---|
| 807 | mov     di, offset SETUP_VerifyPwd | 
|---|
| 808 | mov     cx, 8 | 
|---|
| 809 | repe    cmpsb | 
|---|
| 810 | jne     SEMDP_NoMatch | 
|---|
| 811 |  | 
|---|
| 812 | mov     si, offset SETUP_NewPwd | 
|---|
| 813 | call    PASSWORD_Encode | 
|---|
| 814 | mov     si, offset PasswordSpace | 
|---|
| 815 | pop     di    ; DI = Place for Password | 
|---|
| 816 | mov     cx, 4 | 
|---|
| 817 | rep     movsw     ; neues Passwort... | 
|---|
| 818 |  | 
|---|
| 819 | mov     di, offset SETUP_NewPwd | 
|---|
| 820 | mov     al, 32 | 
|---|
| 821 | mov     cx, 8 | 
|---|
| 822 | repe    scasb | 
|---|
| 823 | je      SEMDP_Disabled | 
|---|
| 824 | mov     cx, 0A02h | 
|---|
| 825 | mov     si, offset TXT_SETUP_PasswordMatched | 
|---|
| 826 | call    SETUP_ShowErrorBox | 
|---|
| 827 | jmp     SEMDP_ExitSub | 
|---|
| 828 | SEMDP_Disabled: | 
|---|
| 829 | mov     cx, 0A02h | 
|---|
| 830 | mov     si, offset TXT_SETUP_PasswordDisabled | 
|---|
| 831 | call    SETUP_ShowErrorBox | 
|---|
| 832 | jmp     SEMDP_ExitSub | 
|---|
| 833 |  | 
|---|
| 834 | SEMDP_NoMatch: | 
|---|
| 835 | pop     di                            ; DI = Place for Password <BUG> | 
|---|
| 836 | mov     cx, 0C04h | 
|---|
| 837 | mov     si, offset TXT_SETUP_PasswordMismatch | 
|---|
| 838 | call    SETUP_ShowErrorBox | 
|---|
| 839 | jmp     SEMDP_ExitSub | 
|---|
| 840 |  | 
|---|
| 841 | SEMDP_ExitSub: | 
|---|
| 842 | ret | 
|---|
| 843 | SETUP_EnterMenu_DefinePassword  EndP | 
|---|
| 844 |  | 
|---|
| 845 | ;        In: DS:SI - Text-Line for Display | 
|---|
| 846 | ;            ES:DI - Location for new password (must be 17 bytes) | 
|---|
| 847 | ;            AX    - Magic, if set to ABAB, it will use a different layout and | 
|---|
| 848 | ;                     will write 'Please Enter Password:' | 
|---|
| 849 | SETUP_LetEnterPassword          Proc Near   Uses bx cx dx si es di | 
|---|
| 850 | local   EnterPwd_Location:word, EnterPwd_DefinePwd:word | 
|---|
| 851 |  | 
|---|
| 852 | mov     ax, VideoIO_Page2 | 
|---|
| 853 | call    VideoIO_BackUpTo | 
|---|
| 854 | push    ax | 
|---|
| 855 | push    di | 
|---|
| 856 | mov     ax, 20h                    ; Space | 
|---|
| 857 | mov     cx, 16 | 
|---|
| 858 | rep     stosb                      ; Kill new password | 
|---|
| 859 | mov     es:[di], ah                ; ending NUL | 
|---|
| 860 | pop     di | 
|---|
| 861 | pop     ax | 
|---|
| 862 | cmp     ax, 0ABABh                    ; Magic Processing... | 
|---|
| 863 | je      SLEP_MagicLayOut | 
|---|
| 864 | mov     cx, 0D05h                     ; Password Dialog | 
|---|
| 865 | call    VideoIO_Color | 
|---|
| 866 |  | 
|---|
| 867 | call    GetLenOfString                ; CX - Len of Error Message | 
|---|
| 868 | add     cl, 6                         ; Adjust to include 2 Spaces and Frame | 
|---|
| 869 | push    cx | 
|---|
| 870 | mov     bx, 0C28h | 
|---|
| 871 | shr     cl, 1 | 
|---|
| 872 | sub     bl, cl | 
|---|
| 873 | pop     cx | 
|---|
| 874 | mov     dh, 0Fh | 
|---|
| 875 | mov     dl, bl | 
|---|
| 876 | add     dl, cl | 
|---|
| 877 | dec     dl                            ; Size window to match given string... | 
|---|
| 878 | call    VideoIO_MakeWindow | 
|---|
| 879 | mov     cx, 0F05h                     ; Password EntryField Label | 
|---|
| 880 | call    VideoIO_Color | 
|---|
| 881 |  | 
|---|
| 882 | mov     ch, 0Dh | 
|---|
| 883 | mov     cl, bl | 
|---|
| 884 | add     cl, 3 | 
|---|
| 885 | call    VideoIO_Locate | 
|---|
| 886 | call    VideoIO_Print                 ; Uses given string 'Define or Verify' | 
|---|
| 887 | mov     cx, 0E05h                     ; Password EntryField | 
|---|
| 888 | call    VideoIO_Color | 
|---|
| 889 | mov     word ptr [EnterPwd_Location], 0E26h | 
|---|
| 890 | mov     word ptr [EnterPwd_DefinePwd], 1 | 
|---|
| 891 | jmp     SLEP_JumpToInputProcess | 
|---|
| 892 |  | 
|---|
| 893 | SLEP_MagicLayOut: | 
|---|
| 894 | mov     cx, 0C04h                      ; Only used for different (unused) layout (ABAB) | 
|---|
| 895 | call    VideoIO_Color | 
|---|
| 896 |  | 
|---|
| 897 | call    GetLenOfString                 ; CX - Len of Error Message | 
|---|
| 898 | add     cl, 4                          ; Adjust to include Space and Frame | 
|---|
| 899 | push    cx | 
|---|
| 900 | mov     bx, 0C28h | 
|---|
| 901 | shr     cl, 1 | 
|---|
| 902 | sub     bl, cl | 
|---|
| 903 | pop     cx | 
|---|
| 904 | mov     dh, 10h | 
|---|
| 905 | mov     dl, bl | 
|---|
| 906 | add     dl, cl | 
|---|
| 907 | dec     dl                            ; Size window to match given string... | 
|---|
| 908 | call    VideoIO_MakeWindow | 
|---|
| 909 | mov     cx, 0F04h | 
|---|
| 910 | call    VideoIO_Color | 
|---|
| 911 | mov     ch, 0Dh | 
|---|
| 912 | mov     cl, bl | 
|---|
| 913 | add     cl, 2 | 
|---|
| 914 | call    VideoIO_Locate | 
|---|
| 915 | call    VideoIO_Print                 ; Uses given string... | 
|---|
| 916 |  | 
|---|
| 917 | mov     si, offset TXT_PleaseEnterPassword | 
|---|
| 918 | call    GetLenOfString                ; CX - Len of Error Message | 
|---|
| 919 | mov     dx, cx | 
|---|
| 920 | mov     cx, 0E28h | 
|---|
| 921 | call    VideoIO_LocateToCenter        ; LocateToCenter 14, 40 using LenOfStr | 
|---|
| 922 | call    VideoIO_Print                 ; Writes 'Please Enter Password:' | 
|---|
| 923 | mov     cx, 0E04h | 
|---|
| 924 | call    VideoIO_Color | 
|---|
| 925 | mov     EnterPwd_Location, 0F25h | 
|---|
| 926 | mov     EnterPwd_DefinePwd, 0 | 
|---|
| 927 | SLEP_JumpToInputProcess: | 
|---|
| 928 | call    SOUND_PreBootMenu | 
|---|
| 929 | mov     si, di                        ; DS:SI - Current Password | 
|---|
| 930 | xor     dl, dl | 
|---|
| 931 | ; DL - location of cursor (first=0) | 
|---|
| 932 | SLEP_Loop: | 
|---|
| 933 | mov     cx, [EnterPwd_Location] | 
|---|
| 934 | call    VideoIO_Locate | 
|---|
| 935 | push    si | 
|---|
| 936 | add     si, 8 | 
|---|
| 937 | call    VideoIO_Print              ; Prints current Password | 
|---|
| 938 | pop     si | 
|---|
| 939 | mov     ah, 0 | 
|---|
| 940 | int     16h | 
|---|
| 941 | cmp     al, 61h | 
|---|
| 942 | jb      SLEP_SkipFixLower | 
|---|
| 943 | cmp     al, 7Ah | 
|---|
| 944 | ja      SLEP_SkipFixLower | 
|---|
| 945 | xor     al, 20h                       ; Convert to UpperCase (ELiTE) | 
|---|
| 946 | jmp     SLEP_CorrectPwdChar | 
|---|
| 947 | SLEP_SkipFixLower: | 
|---|
| 948 | cmp     al, 41h | 
|---|
| 949 | jb      SLEP_NonChar | 
|---|
| 950 | cmp     al, 5Ah | 
|---|
| 951 | ja      SLEP_NonChar | 
|---|
| 952 | jmp     SLEP_CorrectPwdChar | 
|---|
| 953 | SLEP_NonChar: | 
|---|
| 954 | cmp     al, 30h | 
|---|
| 955 | jb      SLEP_NonNum | 
|---|
| 956 | cmp     al, 39h | 
|---|
| 957 | ja      SLEP_NonNum | 
|---|
| 958 | jmp     SLEP_CorrectPwdChar | 
|---|
| 959 | SLEP_NonNum: | 
|---|
| 960 | cmp     al, 0Dh | 
|---|
| 961 | je      SLEP_Enter | 
|---|
| 962 | cmp     al, 08h | 
|---|
| 963 | je      SLEP_OneBack | 
|---|
| 964 | SLEP_SkipThiz: | 
|---|
| 965 | jmp     SLEP_Loop | 
|---|
| 966 |  | 
|---|
| 967 | SLEP_CorrectPwdChar: | 
|---|
| 968 | cmp     dl, 8 | 
|---|
| 969 | je      SLEP_SkipThiz | 
|---|
| 970 |  | 
|---|
| 971 | ;movzx   bx, dl | 
|---|
| 972 | mov   bl,dl | 
|---|
| 973 | mov   bh,0 | 
|---|
| 974 |  | 
|---|
| 975 | mov     ds:[si+bx], al | 
|---|
| 976 | mov     al, 42                        ; fixed star :] | 
|---|
| 977 | mov     ds:[si+bx+8], al | 
|---|
| 978 | inc     dl | 
|---|
| 979 | jmp     SLEP_Loop | 
|---|
| 980 | SLEP_OneBack: | 
|---|
| 981 | cmp     dl, 0 | 
|---|
| 982 | je      SLEP_SkipThiz | 
|---|
| 983 | dec     dl | 
|---|
| 984 |  | 
|---|
| 985 | ;movzx   bx, dl | 
|---|
| 986 | mov   bl,dl | 
|---|
| 987 | mov   bh,0 | 
|---|
| 988 |  | 
|---|
| 989 | mov     al, 32 | 
|---|
| 990 | mov     ds:[si+bx], al | 
|---|
| 991 | mov     ds:[si+bx+8], al | 
|---|
| 992 | jmp     SLEP_Loop | 
|---|
| 993 | SLEP_Enter: | 
|---|
| 994 | or      dl, dl | 
|---|
| 995 | jnz     SLEP_GotSomePassword | 
|---|
| 996 | cmp     word ptr [EnterPwd_DefinePwd], 1 | 
|---|
| 997 | je      SLEP_GotSomePassword | 
|---|
| 998 | mov     cx, 8 | 
|---|
| 999 | mov     al, 1                         ; Fill empty password with [01] | 
|---|
| 1000 | rep     stosb                         ; ...only when Asking Password. | 
|---|
| 1001 | SLEP_GotSomePassword: | 
|---|
| 1002 | mov     ax, VideoIO_Page2 | 
|---|
| 1003 | call    VideoIO_RestoreFrom | 
|---|
| 1004 | ret | 
|---|
| 1005 | SETUP_LetEnterPassword          EndP | 
|---|
| 1006 |  | 
|---|
| 1007 | ; ============================================================================ | 
|---|
| 1008 |  | 
|---|
| 1009 | ; CX = Color of Box, SI = String in Box | 
|---|
| 1010 | ; If AX = ABABh -> Thingie will not wait... | 
|---|
| 1011 | SETUP_ShowErrorBox              Proc Near   Uses ax bx cx | 
|---|
| 1012 | push    ax | 
|---|
| 1013 | push    cx | 
|---|
| 1014 | call    VideoIO_Color | 
|---|
| 1015 | call    GetLenOfString          ; CX - Len of Error Message | 
|---|
| 1016 | add     cl, 4                   ; Adjust to include Space and Frame | 
|---|
| 1017 | push    cx | 
|---|
| 1018 | mov     bx, 0D28h | 
|---|
| 1019 | shr     cl, 1 | 
|---|
| 1020 | sub     bl, cl | 
|---|
| 1021 | pop     cx | 
|---|
| 1022 | mov     dh, 0Fh | 
|---|
| 1023 | mov     dl, bl | 
|---|
| 1024 | add     dl, cl | 
|---|
| 1025 | dec     dl | 
|---|
| 1026 | call    VideoIO_MakeWindow | 
|---|
| 1027 | pop     cx | 
|---|
| 1028 | mov     ch, 0Fh | 
|---|
| 1029 | call    VideoIO_Color | 
|---|
| 1030 | mov     ch, 0Eh | 
|---|
| 1031 | mov     cl, bl | 
|---|
| 1032 | add     cl, 2 | 
|---|
| 1033 | call    VideoIO_Locate | 
|---|
| 1034 | call    VideoIO_Print | 
|---|
| 1035 | pop     ax | 
|---|
| 1036 | cmp     ax, 0ABABh | 
|---|
| 1037 | je      SSEB_NoWait | 
|---|
| 1038 | mov     ah, 0 | 
|---|
| 1039 | int     16h     ; Waits for key stroke | 
|---|
| 1040 | SSEB_NoWait: | 
|---|
| 1041 | ret | 
|---|
| 1042 | SETUP_ShowErrorBox              EndP | 
|---|
| 1043 |  | 
|---|
| 1044 | SETUP_EnterMenu_SaveAndExitSetup Proc Near   Uses dx bp | 
|---|
| 1045 | mov     si, offset TXT_SETUP_SaveAndExitNow | 
|---|
| 1046 | call    SETUP_Warning_AreYouSure | 
|---|
| 1047 | jnz     SEMSAES_UserAbort | 
|---|
| 1048 | SEMSAES_DoThis: | 
|---|
| 1049 | xor     al, al | 
|---|
| 1050 | mov     byte ptr [CFG_AutoEnterSetup], al | 
|---|
| 1051 | add     word ptr [CFG_LastTimeEditLow], 1 | 
|---|
| 1052 | adc     word ptr [CFG_LastTimeEditHi], 0         ; Update Time-Stamp | 
|---|
| 1053 | call    DriveIO_SaveConfiguration | 
|---|
| 1054 | mov     byte ptr [SETUP_ExitEvent], 1            ; Exit and continue boot process | 
|---|
| 1055 | SEMSAES_UserAbort: | 
|---|
| 1056 | ret | 
|---|
| 1057 | SETUP_EnterMenu_SaveAndExitSetup EndP | 
|---|
| 1058 |  | 
|---|
| 1059 | SETUP_EnterMenu_ExitWithoutSaving Proc Near   Uses dx bp | 
|---|
| 1060 | mov     si, offset TXT_SETUP_QuitWithoutSaveNow | 
|---|
| 1061 | call    SETUP_Warning_AreYouSure | 
|---|
| 1062 | jnz     SEMEWS_UserAbort | 
|---|
| 1063 | ; If we were forced to enter Setup, save configuration anyway... | 
|---|
| 1064 | test    byte ptr [CFG_AutoEnterSetup], 1 | 
|---|
| 1065 | jz      SEMEWS_DoThis | 
|---|
| 1066 | jmp     SEMEWS_DoThis                 ; Cross-Jump to SaveAndExitSetup! | 
|---|
| 1067 |  | 
|---|
| 1068 | SEMEWS_DoThis: | 
|---|
| 1069 | ; Loads basic configuration... | 
|---|
| 1070 | ; This is *NOT* IPT nor HideConfig | 
|---|
| 1071 | call    DriveIO_LoadConfiguration | 
|---|
| 1072 | mov     byte ptr [SETUP_ExitEvent], 1            ; Exit and continue boot process | 
|---|
| 1073 | SEMEWS_UserAbort: | 
|---|
| 1074 | ret | 
|---|
| 1075 | SETUP_EnterMenu_ExitWithoutSaving EndP | 
|---|
| 1076 |  | 
|---|
| 1077 | ; Displays and asks user, if he is sure | 
|---|
| 1078 | ;        In: SI - Sure about what (string, NUL-terminated) | 
|---|
| 1079 | ;       Out: Non-Zero Flag set -> User is sure | 
|---|
| 1080 | ; Destroyed: None | 
|---|
| 1081 | SETUP_Warning_AreYouSure        Proc Near | 
|---|
| 1082 | mov     cx, 0C04h | 
|---|
| 1083 | call    VideoIO_Color | 
|---|
| 1084 | call    GetLenOfString                ; CX - Len of Given String | 
|---|
| 1085 | add     cl, 2+6                       ; Adjust to include Spaces and Frame | 
|---|
| 1086 | push    cx | 
|---|
| 1087 | mov     bx, 0B28h | 
|---|
| 1088 | shr     cl, 1 | 
|---|
| 1089 | sub     bl, cl | 
|---|
| 1090 | pop     cx | 
|---|
| 1091 | mov     dh, 0Fh | 
|---|
| 1092 | mov     dl, bl | 
|---|
| 1093 | add     dl, cl | 
|---|
| 1094 | dec     dl | 
|---|
| 1095 | call    VideoIO_MakeWindow | 
|---|
| 1096 | mov     cx, 0F04h | 
|---|
| 1097 | call    VideoIO_Color | 
|---|
| 1098 |  | 
|---|
| 1099 | ; Display what the user has to be sure at... | 
|---|
| 1100 | call    GetLenOfString                ; CX - Len of Given String | 
|---|
| 1101 | mov     dx, cx | 
|---|
| 1102 | mov     cx, 0C28h | 
|---|
| 1103 | call    VideoIO_LocateToCenter        ; LocateToCenter 12, 40 using LenOfStr | 
|---|
| 1104 | call    VideoIO_Print                 ; Use given string... | 
|---|
| 1105 |  | 
|---|
| 1106 | mov     si, offset TXT_SETUP_AreYouSure2 | 
|---|
| 1107 | call    GetLenOfString | 
|---|
| 1108 | mov     dx, cx | 
|---|
| 1109 | mov     cx, 0E28h | 
|---|
| 1110 | call    VideoIO_LocateToCenter        ; LocateToCenter 14, 40 using LenOfStr | 
|---|
| 1111 | call    VideoIO_Print | 
|---|
| 1112 | ; Now the 1st Warning sentence, because it should get yellow... | 
|---|
| 1113 | mov     cx, 0E04h | 
|---|
| 1114 | call    VideoIO_Color                 ; Yellow on Red | 
|---|
| 1115 | mov     si, offset TXT_SETUP_AreYouSure1 | 
|---|
| 1116 | call    GetLenOfString | 
|---|
| 1117 | mov     dx, cx | 
|---|
| 1118 | mov     cx, 0D28h | 
|---|
| 1119 | call    VideoIO_LocateToCenter        ; LocateToCenter 13, 40 using LenOfStr | 
|---|
| 1120 | call    VideoIO_Print | 
|---|
| 1121 |  | 
|---|
| 1122 | ; Waits for user-response... | 
|---|
| 1123 | SWAYS_Loop: | 
|---|
| 1124 | mov     ah, 0 | 
|---|
| 1125 | int     16h | 
|---|
| 1126 | and     al, 0DFh | 
|---|
| 1127 | cmp     al, TXT_SETUP_LetterYes | 
|---|
| 1128 | je      SWAYS_YES | 
|---|
| 1129 | cmp     al, TXT_SETUP_LetterYes2 | 
|---|
| 1130 | je      SWAYS_YES | 
|---|
| 1131 | cmp     al, TXT_SETUP_LetterNo | 
|---|
| 1132 | je      SWAYS_NO | 
|---|
| 1133 | jmp     SWAYS_Loop | 
|---|
| 1134 |  | 
|---|
| 1135 | SWAYS_YES: | 
|---|
| 1136 | and     al, 0                         ; Sets Zero-Flag | 
|---|
| 1137 | ret | 
|---|
| 1138 |  | 
|---|
| 1139 | SWAYS_NO: | 
|---|
| 1140 | or      al, 1                         ; Resets Zero-Flag | 
|---|
| 1141 | ret | 
|---|
| 1142 | SETUP_Warning_AreYouSure        EndP | 
|---|
| 1143 |  | 
|---|
| 1144 |  | 
|---|
| 1145 | ;Calling Conventions for Magics: | 
|---|
| 1146 | ;================================ | 
|---|
| 1147 | ; BX - VarPtr | 
|---|
| 1148 | ; CH - ItemNo | 
|---|
| 1149 | ; CL - 1, add, 0 means subtract | 
|---|
| 1150 | ; SI - Pointer to current Item | 
|---|
| 1151 | ; Carry Flag - Refresh Item, do not modify | 
|---|
| 1152 |  | 
|---|
| 1153 | SETUPMAGIC_InternalCopyTillNUL  Proc Near Uses ax cx | 
|---|
| 1154 | SMICTN_Loop: | 
|---|
| 1155 |  | 
|---|
| 1156 | ;! | 
|---|
| 1157 | ;! DEBUG_PROBE | 
|---|
| 1158 | ;! | 
|---|
| 1159 | IFDEF   AUX_DEBUGx | 
|---|
| 1160 | push    1239h | 
|---|
| 1161 | call    DEBUG_Probe | 
|---|
| 1162 | call    DEBUG_DumpRegisters | 
|---|
| 1163 | call    DEBUG_DumpIPT | 
|---|
| 1164 | ENDIF | 
|---|
| 1165 |  | 
|---|
| 1166 | lodsb | 
|---|
| 1167 | stosb | 
|---|
| 1168 | inc     cl | 
|---|
| 1169 | or      al, al | 
|---|
| 1170 | jnz     SMICTN_Loop                   ; Copies the string... | 
|---|
| 1171 | mov     al, 13 | 
|---|
| 1172 | sub     al, cl | 
|---|
| 1173 | jz      SMICTN_NoFiller | 
|---|
| 1174 | dec     al | 
|---|
| 1175 |  | 
|---|
| 1176 | ;movzx   cx, al | 
|---|
| 1177 | mov   cl,al | 
|---|
| 1178 | mov   ch,0 | 
|---|
| 1179 |  | 
|---|
| 1180 | xor     al, al | 
|---|
| 1181 | rep     stosb                         ; and fill up with NULs, if required | 
|---|
| 1182 | SMICTN_NoFiller: | 
|---|
| 1183 | ret | 
|---|
| 1184 | SETUPMAGIC_InternalCopyTillNUL  EndP | 
|---|
| 1185 |  | 
|---|
| 1186 | ; Cur Value in DL, Maximum Value in DH. Add/Sub in CL | 
|---|
| 1187 | SETUPMAGIC_InternalCheckUp      Proc Near | 
|---|
| 1188 | ;! | 
|---|
| 1189 | ;! DEBUG_PROBE | 
|---|
| 1190 | ;! | 
|---|
| 1191 | IFDEF   AUX_DEBUGx | 
|---|
| 1192 | push    1238h | 
|---|
| 1193 | call    DEBUG_Probe | 
|---|
| 1194 | call    DEBUG_DumpRegisters | 
|---|
| 1195 | ENDIF | 
|---|
| 1196 |  | 
|---|
| 1197 | or      cl, cl                        ; CL==0?    -> Decrease | 
|---|
| 1198 | jz      SMICU_Substract               ; otherwise -> Increase | 
|---|
| 1199 | inc     dl | 
|---|
| 1200 | jmp     SMICU_CheckNow | 
|---|
| 1201 | SMICU_Substract: | 
|---|
| 1202 | dec     dl | 
|---|
| 1203 | SMICU_CheckNow: | 
|---|
| 1204 | cmp     dl, 0FFh | 
|---|
| 1205 | jne     SMICU_DoNotModifyMin | 
|---|
| 1206 | mov     dl, dh                        ; -1? -> set to maximum | 
|---|
| 1207 | SMICU_DoNotModifyMin: | 
|---|
| 1208 | cmp     dl, dh | 
|---|
| 1209 | jbe     SMICU_DoNotModifyMax | 
|---|
| 1210 | xor     dl, dl                        ; Maximum exceeded? -> set 0 | 
|---|
| 1211 | SMICU_DoNotModifyMax: | 
|---|
| 1212 | ret | 
|---|
| 1213 | SETUPMAGIC_InternalCheckUp      EndP | 
|---|
| 1214 |  | 
|---|
| 1215 | SETUPMAGIC_EnableDisable        Proc Near   Uses ax si es di | 
|---|
| 1216 | mov     al, ds:[bx] | 
|---|
| 1217 | jc      SMED_DoNotModify | 
|---|
| 1218 | xor     al, 1                         ; Do Flip-Flop :) | 
|---|
| 1219 | SMED_DoNotModify: | 
|---|
| 1220 | mov     ds:[bx], al | 
|---|
| 1221 | mov     di, si | 
|---|
| 1222 | mov     si, offset TXT_SETUP_MAGIC_Enabled | 
|---|
| 1223 | or      al, al | 
|---|
| 1224 | jnz     SMED_Enabled | 
|---|
| 1225 | mov     si, offset TXT_SETUP_MAGIC_Disabled | 
|---|
| 1226 | SMED_Enabled: | 
|---|
| 1227 | push    cs | 
|---|
| 1228 | pop     es | 
|---|
| 1229 | add     di, LocMENU_ItemPack          ; DI points to ItemPack... | 
|---|
| 1230 | call    SETUPMAGIC_InternalCopyTillNUL | 
|---|
| 1231 | ret | 
|---|
| 1232 | SETUPMAGIC_EnableDisable        EndP | 
|---|
| 1233 |  | 
|---|
| 1234 | SETUPMAGIC_ChangeBootDelay      Proc Near   Uses ax cx dx ds si es di | 
|---|
| 1235 | mov     dl, ds:[bx]                   ; Current Partition Number | 
|---|
| 1236 | jc      SMCBD_DoNotModify | 
|---|
| 1237 | mov     dh, 0FFh | 
|---|
| 1238 | call    SETUPMAGIC_InternalCheckUp    ; CheckUp DL (max. 255) | 
|---|
| 1239 | SMCBD_DoNotModify: | 
|---|
| 1240 | mov     ds:[bx], dl | 
|---|
| 1241 | mov     cx, 1A01h | 
|---|
| 1242 | call    VideoIO_Locate | 
|---|
| 1243 | mov     ax, VideoIO_Segment | 
|---|
| 1244 | mov     es, ax | 
|---|
| 1245 | mov     di, 4000 | 
|---|
| 1246 | mov     cx, 8 | 
|---|
| 1247 | xor     al, al | 
|---|
| 1248 | rep     stosb                         ; Writes 8x NUL | 
|---|
| 1249 | mov     al, dl | 
|---|
| 1250 | call    VideoIO_PrintByteDynamicNumber | 
|---|
| 1251 | ; Pseudo-(XCHG DS, ES) | 
|---|
| 1252 | push    ds | 
|---|
| 1253 | push    es | 
|---|
| 1254 | pop     ds | 
|---|
| 1255 | pop     es | 
|---|
| 1256 |  | 
|---|
| 1257 | mov     di, si | 
|---|
| 1258 | add     di, LocMENU_ItemPack          ; ES:DI - ItemPack | 
|---|
| 1259 | mov     si, 4000                      ; DS:SI - Screen Page 1 | 
|---|
| 1260 | push    es | 
|---|
| 1261 | push    di | 
|---|
| 1262 | mov     cx, 4 | 
|---|
| 1263 | SMCBD_Loop: | 
|---|
| 1264 | lodsw | 
|---|
| 1265 | stosb | 
|---|
| 1266 | loop    SMCBD_Loop                 ; okay we got it...trick! | 
|---|
| 1267 | ; DS:SI - ItemPack | 
|---|
| 1268 | pop     si | 
|---|
| 1269 | pop     ds | 
|---|
| 1270 | mov     cx, 12 | 
|---|
| 1271 | call    GetLenOfName                  ; Gets the length of the number | 
|---|
| 1272 | add     si, cx | 
|---|
| 1273 | mov     al, 0FFh | 
|---|
| 1274 | mov     ds:[si], al                   ; and a Filler as last char (looks better) | 
|---|
| 1275 | ret | 
|---|
| 1276 | SETUPMAGIC_ChangeBootDelay      EndP | 
|---|
| 1277 |  | 
|---|
| 1278 | ; Used by : Default Selection | 
|---|
| 1279 | ; Value   : Partition Number (Base=0, None=80h, ContinueBIOS=FEh, Floppy=FFh) | 
|---|
| 1280 | ; Method  : Changes to another bootable partition | 
|---|
| 1281 | ; Logic   : if no bootable selections are found -> will set 80h | 
|---|
| 1282 | ;           if already set to 80h -> will search through all selections | 
|---|
| 1283 | SETUPMAGIC_ChangeDefaultSelection Proc Near   Uses ax cx dx si es di | 
|---|
| 1284 | mov     di, si | 
|---|
| 1285 | mov     dl, ds:[bx]                   ; Cur Selection No. | 
|---|
| 1286 | push    bx | 
|---|
| 1287 | pushf | 
|---|
| 1288 | cmp     dl, 080h | 
|---|
| 1289 | jne     SMCP_AlreadyGotSelection | 
|---|
| 1290 | ; Start at partition 0. So Continue-BIOS and Floppy will go last | 
|---|
| 1291 | xor     dl, dl | 
|---|
| 1292 | SMCP_AlreadyGotSelection: | 
|---|
| 1293 | ; We use BL in here for tracking how many selections left | 
|---|
| 1294 | mov     bl, [CFG_Partitions] | 
|---|
| 1295 | cmp     dl, 0FEh | 
|---|
| 1296 | jb      SMCP_DoneAdjust | 
|---|
| 1297 | je      SMCP_AdjustContinueBIOS | 
|---|
| 1298 | cmp     byte ptr [CFG_IncludeFloppy], 0 | 
|---|
| 1299 | jne     SMCP_DoneAdjust | 
|---|
| 1300 | dec     dl                      ; No Floppy? -> Try Resume-BIOS | 
|---|
| 1301 | SMCP_AdjustContinueBIOS: | 
|---|
| 1302 | cmp     byte ptr [CFG_ResumeBIOSbootSeq], 0 | 
|---|
| 1303 | jne     SMCP_DoneAdjust | 
|---|
| 1304 | xor     dl, dl                  ; No Resume-BIOS? -> Start partition 0 | 
|---|
| 1305 | SMCP_DoneAdjust: | 
|---|
| 1306 | mov     dh, bl | 
|---|
| 1307 | inc     bl | 
|---|
| 1308 | dec     dh | 
|---|
| 1309 | or      cl, cl                        ; CL==0?    -> Decrease | 
|---|
| 1310 | jz      SMCP_SubstractSelection       ; otherwise -> Increase | 
|---|
| 1311 | popf | 
|---|
| 1312 | jc      SMCP_Dec_ModifyDone | 
|---|
| 1313 | SMCP_Inc_RejectPartition: | 
|---|
| 1314 | inc     dl                         ; Increase Selection No | 
|---|
| 1315 | cmp     dl, [CFG_Partitions] | 
|---|
| 1316 | jb      SMCP_Inc_ModifyDone | 
|---|
| 1317 | cmp     dl, 0FFh | 
|---|
| 1318 | je      SMCP_Inc_TryFloppy | 
|---|
| 1319 | mov     dl, 0FEh                   ; Try Resume-BIOS | 
|---|
| 1320 | cmp     byte ptr [CFG_ResumeBIOSbootSeq], 0 | 
|---|
| 1321 | jne     SMCP_Inc_ModifyDone | 
|---|
| 1322 | inc     dl                         ; Try Floppy | 
|---|
| 1323 | SMCP_Inc_TryFloppy: | 
|---|
| 1324 | cmp     byte ptr [CFG_IncludeFloppy], 0 | 
|---|
| 1325 | jne     SMCP_Inc_ModifyDone | 
|---|
| 1326 | cmp     byte ptr [CFG_Partitions], 0 | 
|---|
| 1327 | je      SMCP_NoBootable | 
|---|
| 1328 | inc     dl                         ; Now start at partition 0 again | 
|---|
| 1329 | SMCP_Inc_ModifyDone: | 
|---|
| 1330 | dec     bl | 
|---|
| 1331 | jz      SMCP_NoBootable | 
|---|
| 1332 | ; Get Partition-Pointer (SI) from Partition-Number (DL) | 
|---|
| 1333 | call    PART_GetPartitionPointer | 
|---|
| 1334 | mov     ax, ds:[si+LocIPT_Flags] | 
|---|
| 1335 | test    ax, Flags_Bootable | 
|---|
| 1336 | jz      SMCP_Inc_RejectPartition | 
|---|
| 1337 | jmp     SMCP_GotSelection | 
|---|
| 1338 |  | 
|---|
| 1339 | SMCP_SubstractSelection: | 
|---|
| 1340 | popf | 
|---|
| 1341 | jc      SMCP_Dec_ModifyDone | 
|---|
| 1342 | SMCP_Dec_RejectPartition: | 
|---|
| 1343 | dec     dl                         ; Decrease Selection No | 
|---|
| 1344 | cmp     dl, 0FDh | 
|---|
| 1345 | jb      SMCP_Dec_ModifyDone        ; <FDh -> We are done | 
|---|
| 1346 | je      SMCP_Dec_TryPartition | 
|---|
| 1347 | cmp     dl, 0FFh | 
|---|
| 1348 | jb      SMCP_Dec_TryResumeBIOS | 
|---|
| 1349 | cmp     byte ptr [CFG_IncludeFloppy], 0 | 
|---|
| 1350 | jne     SMCP_Dec_ModifyDone | 
|---|
| 1351 | dec     dl | 
|---|
| 1352 | SMCP_Dec_TryResumeBIOS: | 
|---|
| 1353 | cmp     byte ptr [CFG_ResumeBIOSbootSeq], 0 | 
|---|
| 1354 | jne     SMCP_Dec_ModifyDone | 
|---|
| 1355 | SMCP_Dec_TryPartition: | 
|---|
| 1356 | mov     dl, [CFG_Partitions] | 
|---|
| 1357 | or      dl, dl | 
|---|
| 1358 | jz      SMCP_NoBootable | 
|---|
| 1359 | dec     dl                         ; Now start at last partition again | 
|---|
| 1360 | SMCP_Dec_ModifyDone: | 
|---|
| 1361 | dec     bl | 
|---|
| 1362 | jz      SMCP_NoBootable | 
|---|
| 1363 | ; Get Partition-Pointer (SI) from Partition-Number (DL) | 
|---|
| 1364 | call    PART_GetPartitionPointer | 
|---|
| 1365 | mov     ax, ds:[si+LocIPT_Flags] | 
|---|
| 1366 | test    ax, Flags_Bootable | 
|---|
| 1367 | jz      SMCP_Dec_RejectPartition | 
|---|
| 1368 |  | 
|---|
| 1369 | SMCP_GotSelection: | 
|---|
| 1370 | pop     bx | 
|---|
| 1371 | mov     ds:[bx], dl                   ; Set new partition | 
|---|
| 1372 | add     si, LocIPT_Name               ; Location of Name | 
|---|
| 1373 | push    cs | 
|---|
| 1374 | pop     es | 
|---|
| 1375 | add     di, LocMENU_ItemPack          ; DI points to ItemPack... | 
|---|
| 1376 | mov     cx, 11 | 
|---|
| 1377 | rep     movsb                         ; Copy cur PartitionName to ItemPack | 
|---|
| 1378 | xor     al, al | 
|---|
| 1379 | stosb                                 ; Ending Zero :) | 
|---|
| 1380 | ret | 
|---|
| 1381 |  | 
|---|
| 1382 | SMCP_NoBootable: | 
|---|
| 1383 | pop     bx | 
|---|
| 1384 | mov     dl, 080h                      ; "No Bootable" | 
|---|
| 1385 | mov     ds:[bx], dl                   ; set that one | 
|---|
| 1386 | mov     si, offset TXT_SETUP_MAGIC_NoBootable | 
|---|
| 1387 | push    cs | 
|---|
| 1388 | pop     es | 
|---|
| 1389 | add     di, LocMENU_ItemPack | 
|---|
| 1390 | call    SETUPMAGIC_InternalCopyTillNUL | 
|---|
| 1391 | ret | 
|---|
| 1392 | SETUPMAGIC_ChangeDefaultSelection EndP | 
|---|
| 1393 |  | 
|---|
| 1394 |  | 
|---|
| 1395 | SETUPMAGIC_ChangeTimedKeyHandling Proc Near   Uses ax cx dx ds si es di | 
|---|
| 1396 | mov     di, si | 
|---|
| 1397 | mov     dl, ds:[bx]                   ; Cur Timed-Key-Handling | 
|---|
| 1398 | jc      SMCTKH_DoNotModify | 
|---|
| 1399 | mov     dh, 02h | 
|---|
| 1400 | call    SETUPMAGIC_InternalCheckUp    ; CheckUp DL (max. 2) | 
|---|
| 1401 | SMCTKH_DoNotModify: | 
|---|
| 1402 | mov     ds:[bx], dl | 
|---|
| 1403 | cmp     dl, 1 | 
|---|
| 1404 | jb      SMCTKH_Is0 | 
|---|
| 1405 | je      SMCTKH_Is1 | 
|---|
| 1406 | ; ist 2 vermutlich ;) | 
|---|
| 1407 | mov     si, offset TXT_SETUP_MAGIC_StopTime | 
|---|
| 1408 | jmp     SMCTKH_CopyThiz | 
|---|
| 1409 | SMCTKH_Is0: | 
|---|
| 1410 | mov     si, offset TXT_SETUP_MAGIC_DoNothing | 
|---|
| 1411 | jmp     SMCTKH_CopyThiz | 
|---|
| 1412 | SMCTKH_Is1: | 
|---|
| 1413 | mov     si, offset TXT_SETUP_MAGIC_ResetTime | 
|---|
| 1414 | SMCTKH_CopyThiz: | 
|---|
| 1415 | add     di, LocMENU_ItemPack          ; DI points to ItemPack... | 
|---|
| 1416 | push    cs | 
|---|
| 1417 | pop     es | 
|---|
| 1418 | call    SETUPMAGIC_InternalCopyTillNUL | 
|---|
| 1419 | ret | 
|---|
| 1420 | SETUPMAGIC_ChangeTimedKeyHandling EndP | 
|---|
| 1421 |  | 
|---|
| 1422 | SETUPMAGIC_ChangeBootMenu       Proc Near   Uses ax cx dx ds si es di | 
|---|
| 1423 | mov     di, si | 
|---|
| 1424 | mov     dl, ds:[bx]                   ; Cur Boot-Menu state | 
|---|
| 1425 | jc      SMCBM_DoNotModify | 
|---|
| 1426 | mov     dh, 02h | 
|---|
| 1427 | call    SETUPMAGIC_InternalCheckUp    ; CheckUp DL (max. 2) | 
|---|
| 1428 | SMCBM_DoNotModify: | 
|---|
| 1429 | mov     ds:[bx], dl | 
|---|
| 1430 | cmp     dl, 1 | 
|---|
| 1431 | jb      SMCBM_Is0 | 
|---|
| 1432 | je      SMCBM_Is1 | 
|---|
| 1433 | ; ist 2 vermutlich ;) | 
|---|
| 1434 | mov     si, offset TXT_SETUP_MAGIC_Detailed | 
|---|
| 1435 | jmp     SMCBM_CopyThiz | 
|---|
| 1436 | SMCBM_Is0: | 
|---|
| 1437 | mov     si, offset TXT_SETUP_MAGIC_Disabled | 
|---|
| 1438 | jmp     SMCBM_CopyThiz | 
|---|
| 1439 | SMCBM_Is1: | 
|---|
| 1440 | mov     si, offset TXT_SETUP_MAGIC_Enabled | 
|---|
| 1441 | SMCBM_CopyThiz: | 
|---|
| 1442 | add     di, LocMENU_ItemPack          ; DI points to ItemPack... | 
|---|
| 1443 | push    cs | 
|---|
| 1444 | pop     es | 
|---|
| 1445 | call    SETUPMAGIC_InternalCopyTillNUL | 
|---|
| 1446 | ret | 
|---|
| 1447 | SETUPMAGIC_ChangeBootMenu       EndP | 
|---|
| 1448 |  | 
|---|
| 1449 | SETUPMAGIC_ChangeFloppyDisplay  Proc Near   Uses cx dx si es di | 
|---|
| 1450 | call    SETUPMAGIC_EnableDisable      ; forward call | 
|---|
| 1451 | cmp     byte ptr [CFG_PartDefault], 0FFh         ; Default-Selection is us? | 
|---|
| 1452 | jne     SMCFD_Done | 
|---|
| 1453 | xor     ch, ch | 
|---|
| 1454 | mov     CFG_PartDefault, ch           ; Reset Default-Selection to 1st part | 
|---|
| 1455 | ; We need to fill up Item 0 (Default-Selection)... | 
|---|
| 1456 | call    SETUP_FillUpItemPack_Now | 
|---|
| 1457 | ; ...and display it on screen (so the user thinks that we are not dumb) | 
|---|
| 1458 | ; This is hardcoded, but there is no other way. | 
|---|
| 1459 | xor     dl, dl | 
|---|
| 1460 | call    SETUP_DrawDeSelectItem        ; Redraw Item 0 | 
|---|
| 1461 | SMCFD_Done: | 
|---|
| 1462 | ret | 
|---|
| 1463 | SETUPMAGIC_ChangeFloppyDisplay  EndP | 
|---|
| 1464 |  | 
|---|
| 1465 | SETUPMAGIC_ChangeBIOSbootSeq    Proc Near   Uses ax bx cx dx si di | 
|---|
| 1466 | ;! | 
|---|
| 1467 | ;! DEBUG_PROBE | 
|---|
| 1468 | ;! | 
|---|
| 1469 | IFDEF   AUX_DEBUGx | 
|---|
| 1470 | push    1237h | 
|---|
| 1471 | call    DEBUG_Probe | 
|---|
| 1472 | call    DEBUG_DumpRegisters | 
|---|
| 1473 | ENDIF | 
|---|
| 1474 |  | 
|---|
| 1475 | mov     di, si | 
|---|
| 1476 | mov     dl, ds:[bx]                   ; Cur Timed-Key-Handling | 
|---|
| 1477 | jc      SMCBBS_DoNotModify | 
|---|
| 1478 | mov     dh, 3 | 
|---|
| 1479 | call    SETUPMAGIC_InternalCheckUp    ; CheckUp DL (max. 3) | 
|---|
| 1480 | SMCBBS_DoNotModify: | 
|---|
| 1481 | mov     ds:[bx], dl | 
|---|
| 1482 | ; DL - Current value | 
|---|
| 1483 | or      dl, dl | 
|---|
| 1484 | jnz     SMCBBS_Enabled | 
|---|
| 1485 | mov     si, offset TXT_SETUP_MAGIC_Disabled | 
|---|
| 1486 | cmp     byte ptr [CFG_PartDefault], 0FEh         ; Default-Selection is us? | 
|---|
| 1487 | jne     SMCBBS_CopyThiz | 
|---|
| 1488 | mov     CFG_PartDefault, dl           ; Reset Default-Selection to 1st part | 
|---|
| 1489 | jmp     SMCBBS_CopyThiz | 
|---|
| 1490 | SMCBBS_Enabled: | 
|---|
| 1491 | dec     dl | 
|---|
| 1492 |  | 
|---|
| 1493 | ;movzx   bx, dl | 
|---|
| 1494 | mov   bl,dl | 
|---|
| 1495 | mov   bh,0 | 
|---|
| 1496 |  | 
|---|
| 1497 | shl     bx, 1 | 
|---|
| 1498 | mov     si, word ptr [ContinueBIOSbootTable+bx] | 
|---|
| 1499 | SMCBBS_CopyThiz: | 
|---|
| 1500 | add     di, LocMENU_ItemPack          ; DI points to ItemPack... | 
|---|
| 1501 | push    cs | 
|---|
| 1502 | pop     es | 
|---|
| 1503 | call    SETUPMAGIC_InternalCopyTillNUL | 
|---|
| 1504 | ; Copy device-name to the ContBIOSbootSeq-IPT entry | 
|---|
| 1505 | call    PART_UpdateResumeBIOSName | 
|---|
| 1506 | ret | 
|---|
| 1507 | SETUPMAGIC_ChangeBIOSbootSeq    EndP | 
|---|