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

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

Removed the ancient 'ReleaseCode' conditional [v1.1.1-testing]

This was used in pre v1.07 versions to create a DOS .COM executable
for debugging. It has never been used in v1.07+ versions and debugging
is now done using the serial port from native AirBoot. Time to get rid
of this unused stuff.

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