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

Last change on this file since 60 was 60, checked in by Ben Rietbroek, 10 years ago

Fixed building on Linux [v1.1.1-testing]

Of course the lowercasing broke building on Linux.
This commit fixes that.

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