source: trunk/bootcode/setup/main.asm

Last change on this file was 245, checked in by Ben Rietbroek, 7 years ago

Merged "menus-es-20180708.asm" provided by Alfredo [v1.1.5-testing]

Translator-build 'AiR-BOOT-v1.1.5-ES-TESTBUILD-20180710' was created
from this commit.

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

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