source: trunk/bootcode/setup/main.asm@ 231

Last change on this file since 231 was 214, checked in by Ben Rietbroek, 8 years ago

Preserve background color when displaying error-box [v1.1.3-testing]

CAUTION:
This is a testbuild !
AirBoot uses the BIOS to access disks and a small coding error can trash
partition tables or other vital disk structures. You are advised to make
backups of TRACK0 and EBRs before using this testbuild. More info at:
https://rousseaux.github.io/netlabs.air-boot/pdf/AirBoot-v1.1.2-manual.pdf

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