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

Last change on this file since 65 was 65, checked in by Ben Rietbroek, 9 years ago

Use different colors for testbuilds [v1.1.1-testing]

When the colors for a testbuild are the same as the colors used for a
release, it's easy to forget one is using a testbuild. So, from now on
testbuilds will use a different color-scheme as a reminder.

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.0-manual.pdf

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