source: trunk/bootcode/regular/bootmenu.asm@ 57

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

All source-files lowercased [v1.1.1-testing]

Some standard files like 'COPYING', 'LICENSE', etc. have not been
converted to lower case because they are usually distributed uppercased.

File size: 33.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 / BOOT-MENU
20;---------------------------------------------------------------------------
21
22IFDEF MODULE_NAMES
23DB 'BOOTMENU',0
24ENDIF
25
26BOOTMENU_BuildBackground Proc Near Uses es di
27 call VideoIO_CursorOff
28 ; -------------------------------------------
29 mov ax, VideoIO_Segment
30 mov es, ax
31 xor di, di
32 mov cx, 2000
33 mov ax, 0720h
34 rep stosw ; Clear Screen
35 ret
36BOOTMENU_BuildBackground EndP
37
38CLR_COPYRIGHT_CLASSIC = 0f00h
39CLR_COPYRIGHT_BM = 0700h
40
41BOOTMENU_BuildMain Proc Near Uses es di
42 ; 1st line with Copyright information...
43 mov cx, 0101h
44 call VideoIO_Locate
45 mov cx, CLR_COPYRIGHT_BM
46 call VideoIO_Color
47 mov si, offset Copyright
48 call VideoIO_Print ; Print Copyright Line...
49
50 ; Boot-Window...
51CLR_BOOT_WINDOW_CLASSIC = 0901h
52CLR_BOOT_WINDOW_BM = 0701h
53
54 mov cx, CLR_BOOT_WINDOW_BM
55 call VideoIO_Color
56 mov bx, 0201h
57 mov dx, 0550h
58 add dh, Menu_TotalLines
59 call VideoIO_MakeWindow
60 ; The little separator line...
61 mov cx, 0402h
62 call VideoIO_Locate
63 mov al, TextChar_WinLineRight
64 mov cl, 78
65 call VideoIO_Internal_MakeWinRight
66
67 mov dl, 18h
68 cmp byte ptr [CFG_BootMenuActive], 2
69 jne BMBM_NoDetailed1
70 mov dl, 15h
71 BMBM_NoDetailed1:
72 mov Menu_AbsoluteX, dl
73
74 ; Display Top-Infos (labels) in Boot-Window
75
76CLR_TOP_INFOS_CLASSIC = 0b01h
77CLR_TOP_INFOS_BM = 0301h
78
79 mov cx, CLR_TOP_INFOS_BM
80 call VideoIO_Color
81 mov ch, 03h
82 mov cl, dl
83 call VideoIO_Locate
84 mov si, offset TXT_TopInfos_No
85 call VideoIO_Print
86 add cl, 5
87 call VideoIO_Locate
88 ; Dynamic change, if detailed view...
89 mov si, offset TXT_TopInfos_Hd
90 add cl, 5
91 cmp byte ptr [CFG_BootMenuActive], 2
92 jne BMBM_NoDetailed2
93 mov si, offset TXT_TopInfos_HdSize
94 add cl, 8
95 BMBM_NoDetailed2:
96 call VideoIO_Print
97 ; End of dynamic change
98 call VideoIO_Locate
99 mov si, offset TXT_TopInfos_Label
100 call VideoIO_Print
101 add cl, 14
102 call VideoIO_Locate
103 mov si, offset TXT_TopInfos_Type
104 call VideoIO_Print
105
106 ; Now make the separating vertical lines...
107CLR_SEP_VERT_LINES_CLASSIC = 0901h
108CLR_SEP_VERT_LINES_BM = 0701h
109
110 mov cx, CLR_SEP_VERT_LINES_BM
111 call VideoIO_Color
112 mov ch, 03h
113 mov cl, Menu_AbsoluteX
114 add cl, 3
115 mov dx, cx
116 call VideoIO_Locate
117 mov cl, 2
118 add cl, Menu_TotalLines
119 mov al, TextChar_WinLineDown
120 call VideoIO_Internal_MakeWinDown ; Line between "No" and "Hd"
121 push cx
122 add dl, 5
123 cmp byte ptr [CFG_BootMenuActive], 2
124 jne BMBM_NoDetailed3
125 add dl, 8
126 BMBM_NoDetailed3:
127 mov cx, dx
128 call VideoIO_Locate
129 pop cx
130 call VideoIO_Internal_MakeWinDown ; Line between "Hd" and "Label"
131 push cx
132 add dl, 14
133 mov cx, dx
134 call VideoIO_Locate
135 pop cx
136 call VideoIO_Internal_MakeWinDown ; Line between "Label" and "Type"
137
138 ; Finally the little tweaks to make it look good...
139 mov cl, Menu_AbsoluteX
140 add cl, 3
141 mov dl, 3 ; 3 Steps in Total
142 BMBM_BootWinTweakLoop:
143 mov ch, 02h
144 call VideoIO_Locate
145 mov al, TextChar_WinRep1
146 call VideoIO_PrintSingleChar
147 mov ch, 04h
148 call VideoIO_Locate
149 mov al, TextChar_WinRep2
150 call VideoIO_PrintSingleChar
151 mov ch, 05h
152 add ch, Menu_TotalLines
153 call VideoIO_Locate
154 mov al, TextChar_WinRep3
155 call VideoIO_PrintSingleChar
156 dec dl
157 jz BMBM_EndBootWinTweakLoop
158 cmp dl, 2
159 jb BMBM_3rdTweak
160 add cl, 5
161 cmp byte ptr [CFG_BootMenuActive], 2
162 jne BMBM_BootWinTweakLoop
163 add cl, 8
164 jmp BMBM_BootWinTweakLoop
165 BMBM_3rdTweak:
166 add cl, 14
167 jmp BMBM_BootWinTweakLoop
168 BMBM_EndBootWinTweakLoop:
169
170 ; Display Boot-Information...
171 xor al, al
172 mov Menu_UpperPart, al
173 call BOOTMENU_RefreshPartitionText
174 ; Boot-Window is DONE
175
176; Rousseau: = Colors =
177; FG
178; BG
179; 7 = grey
180; 6 = brown
181; 5 = magenta
182; 4 = red
183; 3 = cyan
184; 2 = green
185; 1 = blue
186
187CLR_INFO_WINDOW_CLASSIC = 0c04h
188CLR_INFO_WINDOW_BM = 0701h
189
190 mov cx, CLR_INFO_WINDOW_BM
191 ;mov cx, 0C06h ; brown, main background
192 call VideoIO_Color ; Color info window
193
194 mov bx, 1401h
195 mov dx, 1950h
196 call VideoIO_MakeWindow ; Information-Window
197 ; den kleinen Strich...
198 mov cx, 1602h
199 call VideoIO_Locate
200 mov al, TextChar_WinLineRight
201 mov cl, 78
202 call VideoIO_Internal_MakeWinRight
203
204 call BOOTMENU_BuildTimedBootText
205
206 mov cx, 1703h
207 call VideoIO_Locate
208
209CLR_INFO_TEXT_CLASSIC = 0f04h
210CLR_INFO_TEXT_BM = 0701h
211
212 mov cx, CLR_INFO_TEXT_BM ; Info text
213 call VideoIO_Color ; Color info text
214
215 mov si, offset TXT_BootMenuHelpText1
216 call VideoIO_Print
217 mov cx, 1803h
218 call VideoIO_Locate
219 mov si, offset TXT_BootMenuHelpText2
220 call VideoIO_Print
221
222
223CLR_F10_SETUP_CLASSIC = 0c04h
224CLR_F10_SETUP_BM = 0901h
225
226 mov cx, CLR_F10_SETUP_BM ; background F10 enter Setup
227 call VideoIO_Color
228
229 ; Additional message how to power off system
230 mov si, offset TXT_BootMenuPowerOff
231 call GetLenOfString
232 mov dx, 1902h
233 ;~ sub dl, cl
234 mov cx, dx
235 call VideoIO_Locate
236 mov al, TextChar_WinRep4
237 call VideoIO_PrintSingleChar
238 call VideoIO_Print
239 mov al, TextChar_WinRep5
240 call VideoIO_PrintSingleChar
241
242
243 ; Additional message how to enter setup
244 mov si, offset TXT_BootMenuEnterSetup
245 call GetLenOfString
246 mov dx, 194Eh
247 sub dl, cl
248 mov cx, dx
249 call VideoIO_Locate
250 mov al, TextChar_WinRep4
251 call VideoIO_PrintSingleChar
252 call VideoIO_Print
253 mov al, TextChar_WinRep5
254 call VideoIO_PrintSingleChar
255 ; HelpWindow done...
256
257
258 ; Rousseau: Debug Stuff, put here after building Main Menu
259 ;call VideoIO_DBG_WriteString
260 ;call VideoIO_DBG_WriteString2
261
262 ret
263BOOTMENU_BuildMain EndP
264
265
266
267BOOTMENU_BuildGoodBye Proc Near Uses es di
268 mov ax, VideoIO_Segment
269 mov es, ax
270 xor di, di
271 mov cx, 2000
272 mov ax, 0720h
273 rep stosw
274 ; -------------------------------------------
275
276CLR_GOODBYE_WINDOW_CLASSIC = 0d05h
277CLR_GOODBYE_WINDOW_BM = 0f01h
278
279 mov cx, CLR_GOODBYE_WINDOW_BM
280 call VideoIO_Color
281 mov bx, 0101h
282 mov dx, 0550h
283 call VideoIO_MakeWindow ; Information-Window
284 xor di, di
285 mov cx, 10
286 mov ax, 0720h
287 rep stosw
288 mov di, 162
289 mov cx, 9
290 mov al, WinCharRight
291
292 ; Little part before version in goodbye-window
293 ; Does not use color-function
294 ;mov ah, 05Dh
295 mov ah, 01fh
296 rep stosw
297
298 mov cx, 010Bh
299 call VideoIO_Locate
300 mov al, WinCharBB
301 call VideoIO_PrintSingleChar
302 mov cx, 0201h
303 call VideoIO_Locate
304 mov al, WinCharBB
305 call VideoIO_PrintSingleChar
306 mov cx, 000Bh
307 call VideoIO_Locate
308 mov al, WinCharEE
309 call VideoIO_PrintSingleChar
310 ; --------------------------------------- Window done
311 mov cx, 010Ch
312 call VideoIO_Locate
313 mov al, TextChar_WinRep4
314 call VideoIO_PrintSingleChar
315
316CLR_GOODBYE_AB_VERSION_CLASSIC = 0e01h
317CLR_GOODBYE_AB_VERSION_BM = 0e03h
318
319 mov cx, CLR_GOODBYE_AB_VERSION_BM
320 call VideoIO_Color
321 mov si, offset Copyright
322 mov cl, 11+CopyrightVersionLen
323 call VideoIO_FixedPrint
324
325 mov cx, CLR_GOODBYE_WINDOW_BM
326
327 call VideoIO_Color
328 mov al, TextChar_WinRep5
329 call VideoIO_PrintSingleChar
330 mov cx, 020Dh
331 call VideoIO_Locate
332
333 CLR_GOODBYE_WINDOW_CLASSIC_2 = 0f05h
334 CLR_GOODBYE_WINDOW_BM_2 = 0701h
335
336 mov cx, CLR_GOODBYE_WINDOW_BM_2
337 call VideoIO_Color
338 inc si
339 call VideoIO_Print ; Print Copyright to the end...
340 mov cx, 0303h
341 call VideoIO_Locate
342 mov si, offset BootEndMsg ; Print End-Message...
343 call VideoIO_Print
344 mov cx, 0403h
345 call VideoIO_Locate
346 mov si, offset BootEndMsg2 ; Print GPL-Message...
347 call VideoIO_Print
348 ; -------------------------------------------
349 mov ah, 02h
350 mov bh, 00h
351 mov dx, 0600h ; Sets cursor location to 7, 1
352 int 10h
353 call VideoIO_CursorOn
354 ret
355BOOTMENU_BuildGoodBye EndP
356
357
358
359; Must preserve AX!
360BOOTMENU_BuildTimedBootText Proc Near Uses ax cx si es di
361 mov cx, 1503h ;
362 call VideoIO_Locate
363
364CLR_NON_TIMED_BAR_CLASSIC = 0e04h
365CLR_NON_TIMED_BAR_BM = 0701h
366
367 mov cx, CLR_NON_TIMED_BAR_BM ; non-timed time bar
368 call VideoIO_Color
369 call VideoIO_Internal_SetRegs
370 mov cx, 76
371 mov al, 20h ; Space
372 rep stosw ; delete all at first
373 mov al, TimedBootEnable
374 or al, al
375 jz BMBTBT_NoTimed
376 jmp BMBTBT_TimedBoot
377 BMBTBT_NoTimed:
378 mov si, offset TXT_TimedBootDisabled
379 call VideoIO_Print
380 ret
381
382 BMBTBT_TimedBoot:
383 mov cx, 1503h
384 call VideoIO_Locate
385
386CLR_TIMED_BAR_CLASSIC = 0e04h
387CLR_TIMED_BAR_BM = 0e04h
388
389 mov cx, CLR_TIMED_BAR_BM ; timed time bar, yellow on red
390 call VideoIO_Color
391 mov si, offset TXT_TimedBootLine ; will print TimedBootEntryName too
392 call VideoIO_Print
393 mov si, offset TXT_TimedBootLine2
394 call VideoIO_Print
395 mov al, TimedSecondLeft
396 call VideoIO_PrintByteDynamicNumber
397 mov si, offset TXT_TimedBootSecond ; 'Second.'
398 cmp al, 1
399 je BMBTBT_JustOneLeft
400 mov si, offset TXT_TimedBootSeconds ; 'Seconds.'
401 BMBTBT_JustOneLeft:
402 call VideoIO_Print
403 ret
404BOOTMENU_BuildTimedBootText EndP
405
406BOOTMENU_RefreshPartitionText Proc Near Uses cx dx
407 mov dl, Menu_UpperPart ; Current Partition to Display
408 mov ch, 5 ; Line On Screen
409 mov cl, Menu_TotalLines ; Total Lines to Display
410 BMRPT_Loop:
411 ; Write Partition-Info (partition DL) to Screen at CH
412 call BOOTMENU_BuildPartitionText
413 inc ch
414 inc dl
415 dec cl
416 jnz BMRPT_Loop
417 ret
418BOOTMENU_RefreshPartitionText EndP
419
420
421CLR_VOLUME_INDEX_CLASSIC = 0f01h
422CLR_VOLUME_INDEX_BM = 0f01h
423
424; Writes Partition-Information to Screen (Boot-Menu)
425; In: CH - Line to print info
426; DL - Number of Partition (Base=0)
427; Destroyed: None
428BOOTMENU_BuildPartitionText Proc Near Uses ax cx dx si
429 local PartPointer:word
430
431 call PART_GetPartitionPointer ; Gets pointer to partition (DL) -> SI
432 mov PartPointer, si
433
434 ; === Display Boot-Number ===
435 mov cl, Menu_AbsoluteX
436 mov dh, cl
437 call VideoIO_Locate
438 mov cx, CLR_VOLUME_INDEX_BM ; Bwhite, blue
439 call VideoIO_Color
440 mov al, dl
441 inc al
442 call VideoIO_PrintByteNumber
443
444 ; === Display Drive-Number and Size (Size only in detailed view) ===
445 add dh, 5
446 ;movzx cx, dh
447 mov cl,dh
448 mov ch,0
449
450 call VideoIO_Locate
451
452CLR_HD_INDEX_CLASSIC = 0d01h
453CLR_HD_INDEX_BM = 0701h
454
455 mov cx, CLR_HD_INDEX_BM
456 call VideoIO_Color ; Violet, blue
457 mov si, PartPointer
458 mov al, [si+LocIPT_Drive]
459 sub al, 7Fh ; Will only display numbers up to 99,
460 call VideoIO_PrintByteNumber ; so only showing harddrives...
461 add dh, 5
462 cmp byte ptr [CFG_BootMenuActive], 2
463 jne BMBPT_NoDetailed
464 add dh, 8
465 cmp al, 99
466 jbe BMBPT_IsHarddrive
467 mov al, ' '
468 mov cl, 7
469 call VideoIO_PrintSingleMultiChar ; Fill up Size-Space with spaces
470 jmp BMBPT_NoDetailed
471 BMBPT_IsHarddrive:
472 ; Now display Size-Element...
473
474CLR_HD_SIZE_CLASSIC = 0501h
475CLR_HD_SIZE_BM = 0701h
476
477 mov cx, CLR_HD_SIZE_BM
478 call VideoIO_Color ; Dark-Violet, Blue
479 mov al, '/'
480 call VideoIO_PrintSingleChar
481 mov cx, CLR_HD_SIZE_BM
482 call VideoIO_Color ; Violet, Blue
483 mov ax, PartPointer ; Get Size-Element from PartPtr (AX)
484 call PART_GetSizeElementPointer ; DS:SI -> Size-Element...
485 mov cl, 4
486 call VideoIO_FixedPrint ; Display 4 chars from DS:SI
487 inc TextPosX ; Manual-Hackin to adjust TextPos
488 mov cl, 2
489 call VideoIO_FixedPrint ; Display 2 chars from DS:SI
490 BMBPT_NoDetailed:
491
492 ; === Display Label ===
493 ;movzx cx, dh
494 mov cl,dh
495 mov ch,0
496
497 call VideoIO_Locate
498
499CLR_LABEL_CLASSIC = 0e01h
500CLR_LABEL_BM = 0f01h
501
502 mov cx, CLR_LABEL_BM
503 call VideoIO_Color ; Yellow, blue
504 mov si, PartPointer
505 add si, LocIPT_Name
506 mov cl, 11
507 call VideoIO_FixedPrint
508
509 ; === Display Type ===
510 add dh, 14
511 ;movzx cx, dh
512 mov cl,dh
513 mov ch,0
514
515 call VideoIO_Locate
516 mov si, PartPointer
517 mov al, [si+LocIPT_SystemID]
518 call PART_SearchFileSysName
519
520CLR_FS_NAME_CLASSIC = 0c01h
521CLR_FS_NAME_BM = 0701h
522
523; Color for drive-letter
524CLR_DL_BM = 0f01h
525
526 mov cx, CLR_FS_NAME_BM
527 call VideoIO_Color ; Hrot, Blau
528 mov cl, 8
529 call VideoIO_FixedPrint
530
531
532
533DRIVELETTERS_ENABLE EQU
534
535 IFDEF DRIVELETTERS_ENABLE
536
537 ;
538 ; THIS IS WHERE WE CAN SHOW DRIVE-LETTERS !
539 ;
540
541 pusha
542
543 mov al,[CFG_MiscFlags]
544 and al,00000001b
545 jz skip_show_dl
546
547
548 ; Dirty hack to clear remaining line when menu is scrolled.
549 ; Padd with spaces.
550 ; Should be implemented in scrolling routine.
551 push word ptr [TextPosX]
552 mov si, offset spaces
553 mov cl,24
554 call VideoIO_FixedPrint
555 pop word ptr [TextPosX]
556
557 mov si, [PartPointer]
558 mov ah, [si+LocIPT_SystemID]
559
560 IFDEF AUX_DEBUG
561 mov al, ' '
562 call VideoIO_PrintSingleChar
563 mov al, ah
564 call VideoIO_PrintHexByte
565 mov al, ' '
566 call VideoIO_PrintSingleChar
567 ENDIF
568
569 mov al, ah
570
571 cmp al, 07h
572 je show_dl
573 cmp al, 0fch
574 je show_dl
575
576 jmp skip_show_dl
577
578 show_dl:
579
580 ;~ mov al, ' '
581 ;~ call VideoIO_PrintSingleChar
582
583 mov dl, byte ptr [si+LocIPT_Drive]
584 mov cx, [si+LocIPT_AbsoluteBegin+00h]
585 mov bx, [si+LocIPT_AbsoluteBegin+02h]
586
587 mov si, offset [TmpSector]
588 mov di,ds
589 call DriveIO_LoadSectorLBA
590 mov al, [si+25h]
591
592 IFDEF AUX_DEBUG
593 call VideoIO_PrintHexByte
594 ENDIF
595
596 mov dh,al
597 sub dh,3dh
598
599 call LVM_GetDriveLetter
600
601 test al,al
602 jnz show_dl2
603
604
605
606 mov si, offset [dl_hidden]
607 mov cx, CLR_DL_BM
608 call VideoIO_Color
609 call VideoIO_Print
610
611 mov cx, 0701h
612 call VideoIO_Color
613
614 mov al, dh
615 call VideoIO_PrintSingleChar
616 mov al, ':'
617 call VideoIO_PrintSingleChar
618
619 jmp skip_show_dl
620
621 show_dl2:
622
623 mov si, offset [dl_text]
624
625 call VideoIO_Print
626
627 mov cx, CLR_DL_BM
628 call VideoIO_Color
629
630 call VideoIO_PrintSingleChar
631 mov al,':'
632 call VideoIO_PrintSingleChar
633
634 skip_show_dl:
635 popa
636
637 ENDIF
638
639
640 ret
641BOOTMENU_BuildPartitionText EndP
642
643dl_text db ' on drive ',0
644dl_hidden db ' hidden ',0
645spaces db ' ',0
646
647; In: DL - Active Partition
648; DH - New Active Partition (may not be correct number)
649; Out: DX - will get returned (fixed, if needed)
650BOOTMENU_BuildChoiceBar Proc near Uses ax es di
651
652 ;call SOUND_Beep
653
654 call VideoIO_WaitRetrace
655
656
657 ;call SOUND_Beep
658
659 mov cl, 10h ; Color BLUE, Partition DL
660 call BOOTMENU_ReColorPart
661
662 ;call SOUND_Beep
663
664 ; Check, if clipping needed...
665 cmp dh, 0ffh
666 jne BMBCB_RightMin
667 xor dh, dh
668 BMBCB_RightMin:
669 cmp dh, Menu_TotalParts ; DH is base 0, TotalParts is counter
670 jb BMBCB_AfterClipping ; That's why JB and not JBE
671 mov dh, Menu_TotalParts
672 dec dh ; Now base 0
673 BMBCB_AfterClipping:
674 ; After Clipping
675 mov dl, dh
676 mov cl, Menu_UpperPart
677 ; Now check, if we need to Scroll
678 cmp dh, cl
679 jae BMBCB_NoScrollUp
680 BMBCB_ScrollingUp:
681 dec byte ptr [Menu_UpperPart] ; Adjusted for Wasm
682 cmp dh, Menu_UpperPart
683 jb BMBCB_ScrollingUp
684 call BOOTMENU_RefreshPartitionText
685 jmp BMBCB_AfterScrolling
686
687 BMBCB_NoScrollUp:
688 add cl, Menu_TotalLines
689 cmp dh, cl
690 jb BMBCB_AfterScrolling
691 BMBCB_ScrollingDown:
692 inc cl
693 inc byte ptr [Menu_UpperPart] ; Adjusted for Wasm
694 cmp dh, cl
695 jae BMBCB_ScrollingDown
696 call BOOTMENU_RefreshPartitionText
697
698
699; Keuze bar
700; 00h black
701; 10h blue
702; 20h green (also nice)
703; 30h cyan (also nice)
704; 40h red
705; 50h magenta
706; 60h brown (nice)
707; 70h white
708; 80h grey
709; 90h light blue (nice)
710; 0a0h bright green
711; 0b0h bright cyan
712; 0c0h bright red
713; 0d0h bright magenta
714; 0e0h bright yellow
715; 0f0h bright white
716
717
718CLR_SELECTION_BAR_CLASSIC = 50h
719CLR_SELECTION_BAR_BM = 090h
720CLR_SELECTION_BAR_WARNING = 040h
721
722
723
724 BMBCB_AfterScrolling:
725 mov cl, CLR_SELECTION_BAR_BM
726 test byte ptr [TooManyPartitions],0ffh ; Check for too many partitions.
727 jz BOOTMENU_BuildChoiceBar_normal
728 mov cl, CLR_SELECTION_BAR_WARNING ; Set red bar if so.
729 BOOTMENU_BuildChoiceBar_normal:
730 call BOOTMENU_ReColorPart
731 ret
732BOOTMENU_BuildChoiceBar EndP
733
734; In: CL - Color, DL - Partition
735; Destroyed: None, but Locate-Pointer gets set
736BOOTMENU_ReColorPart Proc Near Uses bx cx es di
737
738 ; call SOUND_Beep
739
740 mov bh, cl ; Color to BH
741 ; First calculate location of bar
742 cmp Menu_UpperPart, dl
743 ja BMRCP_NotInWindowView
744 mov ch, dl
745 sub ch, Menu_UpperPart ; CH - Position relative to UpperPart
746 cmp ch, 14 ; 14 - Maximum Total in Window
747 ja BMRCP_NotInWindowView
748 add ch, 5 ; Y-Position add-on fixed 5
749 mov cl, 2 ; X-Position is always 2
750 call VideoIO_Locate ; geht zu CX
751 call VideoIO_Internal_SetRegs
752 inc di ; DI - Destination+1 -> Color-Byte
753 mov cl, 78 ; Length of Bar is always 78
754 BMRCP_ClearLoop:
755 mov al, es:[di]
756 and al, 0Fh
757 or al, bh ; Adds background color (from BH)
758
759 ;mov al,97h
760
761 mov es:[di], al
762 add di, 2
763 dec cl
764 jnz BMRCP_ClearLoop
765 BMRCP_NotInWindowView:
766 ret
767BOOTMENU_ReColorPart EndP
768
769
770; Calculate Menu-Variables for Boot-Menu, these use the filtered Part-Pointers
771BOOTMENU_ResetMenuVars Proc Near Uses dx
772 xor dl, dl ; Partition at Pos 0 == 1st
773 mov Menu_UpperPart, dl
774
775 ; = TIMED BOOTING =
776 mov dl, CFG_TimedBoot
777 mov TimedBootEnable, dl
778 mov al, CFG_TimedSecs
779 mov TimedSecondLeft, al
780 call TIMER_TranslateSecToTic
781 add ax, 16 ; So that the required ammount will
782 mov CFG_TimedDelay, ax ; be shown and not Timer-1.
783 call BOOTMENU_ResetTimedBoot
784 ; = FLOPPY-GET-NAME TIMER =
785 call BOOTMENU_ResetGetFloppy
786
787 ; Resettet die Base-Variablen...
788 mov dl, PartitionPointerCount
789 mov Menu_TotalParts, dl
790
791 ; Copy device-name to the ContBIOSbootSeq-IPT entry
792 ; Normally this does not need to get done here, but is done for safety
793 ; reasons if e.g. IPT got changed by SETUP, but that setup was discarded.
794 call PART_UpdateResumeBIOSName
795
796 ; Default-Partition -> Filtered View -> Menu_EntryDefault
797 mov dl, CFG_PartDefault
798 call PART_ConvertFromStraight
799 mov Menu_EntryDefault, dl
800
801 ; Last-Booted-Partition -> Filtered View -> Menu_EntryLast
802 mov dl, CFG_PartLast
803 call PART_ConvertFromStraight
804 mov Menu_EntryLast, dl
805
806 ; Automatic-Partition -> Filtered View -> Menu_EntryAutomatic
807 mov dl, CFG_PartAutomatic
808 call PART_ConvertFromStraight
809 mov Menu_EntryAutomatic, dl
810
811 ;~ ; [Linux support removed since v1.02]
812 ;~ ; Okay, now we check if Default/Last Kernel Partition Name is available...
813 ;~ ; if so, simply set Menu_EntryDefault/Menu_EntryLast.
814 ;~ mov si, offset CFG_LinuxDefaultKernel
815 ;~ call LINUX_SearchKernelName ; DL - Filtered Entry No
816 ;~ cmp dl, 0FFh
817 ;~ je BMRMV_DefaultKernelNF
818 ;~ mov Menu_EntryDefault, dl
819 ;~ BMRMV_DefaultKernelNF:
820 ;~ mov si, offset CFG_LinuxLastKernel
821 ;~ call LINUX_SearchKernelName ; DL - Filtered Entry No
822 ;~ cmp dl, 0FFh
823 ;~ je BMRMV_LastKernelNF
824 ;~ mov Menu_EntryLast, dl
825 ;~ BMRMV_LastKernelNF:
826
827 ; restlichen Variablen berechnen...
828 mov dl, Menu_TotalParts
829 cmp byte ptr [Menu_TotalParts], 14
830 jbe BMRMV_NotMoreThan14
831 mov dl, 14
832 BMRMV_NotMoreThan14:
833 mov Menu_TotalLines, dl
834
835 ; Now copy the name of the Timed-Booted Partition to TimedBoot-Field
836 mov dl, Menu_EntryDefault
837 test byte ptr [CFG_TimedBootLast], 1
838 jz BMRMV_TimedBootDefault
839 mov dl, Menu_EntryLast
840 BMRMV_TimedBootDefault:
841 call PART_GetPartitionPointer ; Holt SI fr Partition DL
842 add si, LocIPT_Name
843 mov cx, 11
844 call GetLenOfName
845 mov di, offset TXT_TimedBootEntryName
846 jz BMRMV_NoName
847 rep movsb
848 BMRMV_NoName:
849 xor al, al
850 stosb ; Ending Zero
851 ret
852BOOTMENU_ResetMenuVars EndP
853
854; Will Set some Vars after user selected entry to boot...
855; ...don't select Straight View !
856BOOTMENU_SetVarsAfterMenu Proc Near
857 ; No Straight View in here...we got filtered view since BootMenu-Startup...
858 mov al, CFG_RememberTimed
859 test byte ptr [TimedBootUsed], 1
860 jnz BMSVAM_TimedBootUsed
861 mov al, CFG_RememberBoot
862 BMSVAM_TimedBootUsed:
863 or al, al
864 jz BMSVAM_DontRememberBoot
865 mov dl, Menu_EntrySelected
866 call PART_ConvertToStraight ; CFG_PartLast is non-filtered
867 ;~ mov di, offset CFG_LinuxLastKernel
868 ;~ mov cx, 11
869 cmp dl, 0FDh ; Dont Remember on Floppy/CD-ROM/etc.
870 ja BMSVAM_DontRememberBoot
871 ; je BMSVAM_RememberKernelBoot ; but remember Kernel-Bootings...
872 mov CFG_PartLast, dl ; Remember partition in CFG_PartLast
873 ;~ mov al, ' '
874 ;~ rep stosb ; SPACE out CFG_LinuxLastKernel
875 BMSVAM_DontRememberBoot:
876 ret
877
878 ;~ BMSVAM_RememberKernelBoot:
879 ;~ mov dl, Menu_EntrySelected
880 ;~ call PART_GetPartitionPointer ; SI - Pointer to Kernel Entry...
881 ;~ add si, LocIPT_Name
882 ;~ rep movsb ; Copy KernelName 2 CFG_LinuxLastKernel
883 ;~ ret
884BOOTMENU_SetVarsAfterMenu EndP
885
886
887
888
889; Actually does the Boot-Menu Interaction
890; Sets Carry-flag, if Setup is to be entered, otherwise system shall get booted
891; On boot: Fills out some variables (like Menu_EntrySelected), when Booting
892BOOTMENU_Execute Proc Near Uses es di
893 ; Finds out, where to place the bar at first...
894 mov dl, Menu_EntryDefault
895 test byte ptr [CFG_RememberBoot], 1
896 jnz BME_RememberMode
897 test byte ptr [CFG_RememberTimed], 1
898 jz BME_ForgetMode
899 BME_RememberMode:
900 mov dl, Menu_EntryLast
901 BME_ForgetMode:
902 ; Got it, so display bar...
903 mov dh, dl
904
905 ;~ call SOUND_Beep
906
907 call BOOTMENU_BuildChoiceBar ; DH - Active, DL - Last Active
908
909 ;~ call SOUND_Beep
910
911 call SOUND_PreBootMenu
912
913
914 BME_MainLoop:
915
916 ;call VideoIO_DBG_WriteString2 ; Rousseau
917
918 test byte ptr [TimedBootEnable], 1
919 jz BME_NoTimedBoot
920 ; ------------------------------------------------ TIMED BOOT
921 push ax
922 push dx
923 call TIMER_GetTicCount
924 mov dx, word ptr [TimedTimeOut]
925 sub dx, ax
926 mov ax, dx
927 call TIMER_TranslateTicToSec ; DX - Timertics till ByeBye
928 cmp al, TimedSecondLeft ; -> AL - Seconds till ByeBye
929 je BME_NoFixSecond
930 mov TimedSecondLeft, al
931 call BOOTMENU_BuildTimedBootText ; Display Timed-Boot-Text
932 BME_NoFixSecond:
933 cmp al, 0
934 jne BME_NoTimeOut
935 pop dx
936 pop ax
937 mov dl, Menu_EntryDefault
938 and byte ptr [CFG_TimedBootLast], 1
939 jz BME_TimedBootDefault
940 mov dl, Menu_EntryLast
941 BME_TimedBootDefault:
942 mov Menu_EntrySelected, dl ; Just boot default partition
943 mov byte ptr [TimedBootUsed], 1 ; set flag...
944 clc ; Boot-Now!
945 ret
946
947 BME_NoTimeOut:
948 pop dx
949 pop ax
950 BME_NoTimedBoot:
951 ; ------------------------------------------------ FLOPPY-NAME TIMER
952 test byte ptr [CFG_FloppyBootGetTimer], 1
953 jz BME_NoFloppyNameTimer
954 ; Wait 2 Seconds everytime
955 push ax
956 push dx
957 call TIMER_GetTicCount
958 cmp dx, word ptr [FloppyGetNameTimer+2]
959 ja BME_ExpiredGetFloppy
960 cmp ax, word ptr [FloppyGetNameTimer+0]
961 jb BME_NoFloppyNameExpired
962 BME_ExpiredGetFloppy:
963 call BOOTMENU_ResetGetFloppy
964 pop dx
965 pop ax
966 jmp BME_RefreshFloppyName
967 BME_NoFloppyNameExpired:
968 pop dx
969 pop ax
970 BME_NoFloppyNameTimer:
971 ; ------------------------------------------------ KEYBOARD
972 push dx
973 mov ah, 1
974 int 16h
975 pop dx
976 jnz BME_KeyAvailable
977 jmp BME_MainLoop
978
979 BME_RefreshFloppyName:
980 test byte ptr [CFG_IncludeFloppy], 1
981 jz BME_NoRefreshFloppyName
982 test byte ptr [CFG_FloppyBootGetName], 1
983 jz BME_NoRefreshFloppyName
984 call DriveIO_UpdateFloppyName
985 call BOOTMENU_RefreshPartitionText
986 call BOOTMENU_BuildChoiceBar ; Redisplay the selection-bar
987 BME_NoRefreshFloppyName:
988 jmp BME_MainLoop
989
990 BME_KeyAvailable:
991 push dx
992 mov ah, 0
993 int 16h
994 pop dx
995
996 ;!
997 ;! DEBUG_BLOCK
998 ;! Handle keys to activate debugging routines.
999 ;!
1000 IFDEF AUX_DEBUG
1001 call DEBUG_HandleKeypress
1002 ENDIF
1003
1004 cmp ah, Keys_ENTER
1005 je BME_KeyEnter
1006 cmp ah, Keys_F10
1007 je BME_KeyF10
1008 cmp ah, Keys_Delete
1009 je BME_KeyDelete
1010 cmp ah, Keys_ESC
1011 je BME_KeyESC
1012 ; Upper Keys do not fall under Timed Boot Key Handling
1013 test byte ptr [TimedBootEnable], 1
1014 je BME_NoTimedKeyHandling
1015 cmp byte ptr [CFG_TimedKeyHandling], 1
1016 jb BME_NoTimedKeyHandling ; = 0
1017 je BME_ResetTimedBoot ; = 1
1018 mov al, TimedBootEnable ; = 2
1019 xor al, 1 ; Flip Flop Switch :]
1020 mov [TimedBootEnable], al
1021 BME_ResetTimedBoot:
1022 push dx
1023 call BOOTMENU_ResetTimedBoot ; Reset Timer
1024 call BOOTMENU_BuildTimedBootText ; Refresh TimedBootText
1025 pop dx
1026 BME_NoTimedKeyHandling:
1027 cmp ah, Keys_TAB
1028 je BME_KeyTAB
1029 cmp ah, Keys_Up
1030 je BME_KeyUp
1031 cmp ah, Keys_Down
1032 je BME_KeyDown
1033 jmp BME_MainLoop
1034
1035 BME_KeyUp:
1036 dec dh
1037 call BOOTMENU_BuildChoiceBar ; DH - Active, DL - Last Active
1038 jmp BME_MainLoop
1039
1040 BME_KeyDown:
1041 inc dh
1042 call BOOTMENU_BuildChoiceBar ; DH - Active, DL - Last Active
1043 jmp BME_MainLoop
1044
1045 BME_KeyEnter:
1046 mov Menu_EntrySelected, dl
1047 mov byte ptr [TimedBootUsed], 0 ; reset flag...
1048 clc ; Boot-Now!
1049 ret
1050
1051 BME_KeyF10:
1052 mov al, Keys_Flags_EnterSetup
1053 mov byte ptr [SETUP_KeysOnEntry], al ; Simulate user wants to enter setup
1054 stc ; Go Re-Enter Setup
1055 ret
1056
1057 BME_KeyDelete:
1058 call SOUND_ExecuteBoot
1059 call APM_TurnOffComputer
1060 jmp BME_MainLoop
1061
1062 BME_KeyESC:
1063 mov al, [TimedBootEnable]
1064 xor al, 1 ; Flip Flop Switch :]
1065 mov [TimedBootEnable], al
1066 push dx
1067 call BOOTMENU_ResetTimedBoot ; Reset Timer
1068 call BOOTMENU_BuildTimedBootText ; Refresh TimedBootText
1069 pop dx
1070 jmp BME_MainLoop
1071
1072 BME_KeyTAB:
1073 push dx
1074 test byte ptr [CFG_CooperBars], 1
1075 jnz BME_KeyTAB_ShowFX
1076 mov ax, 0501h ; Go To Page 1 -> BIOS POST crap
1077 int 10h
1078 mov ah, 0
1079 int 16h ; Wait for any key
1080 call BOOTMENU_ResetTimedBoot ; Reset Timer
1081 call BOOTMENU_BuildTimedBootText ; Refresh TimedBootText
1082 mov ax, 0500h ; Go Back to Page 0
1083 int 10h
1084 pop dx
1085 jmp BME_MainLoop
1086 BME_KeyTAB_ShowFX:
1087 pusha
1088 mov ax, VideoIO_Page1
1089 mov bx, VideoIO_Page0
1090 mov dx, 160
1091 xor di, di
1092
1093 IFDEF FX_ENABLED
1094 call FX_InterleaveCopy
1095 call FX_ScrollScreenLeft
1096 ENDIF
1097
1098 mov ah, 0
1099 int 16h ; Wait for any key
1100 call BOOTMENU_ResetTimedBoot ; Reset Timer
1101 call BOOTMENU_BuildTimedBootText ; Refresh TimedBootText
1102
1103 IFDEF FX_ENABLED
1104 call FX_ScrollScreenRight
1105 call FX_EndScreenInternalCleanUp
1106 ENDIF
1107
1108 call BOOTMENU_ResetTimedBoot ; Reset Timer again...
1109 popa
1110 pop dx
1111 jmp BME_MainLoop
1112BOOTMENU_Execute EndP
1113
1114; Resettet den TimedBoot Timer...
1115BOOTMENU_ResetTimedBoot Proc Near Uses ax
1116 call TIMER_GetTicCount
1117 add ax, CFG_TimedDelay
1118 adc dx, 0
1119 mov word ptr [TimedTimeOut], ax
1120 mov word ptr [TimedTimeOut+2], dx
1121 ret
1122BOOTMENU_ResetTimedBoot EndP
1123
1124; Resettet den Floppy-Get-Name Timer...
1125BOOTMENU_ResetGetFloppy Proc Near Uses ax
1126 call TIMER_GetTicCount
1127 add ax, 36 ; 18*2 -> 2 seconds
1128 adc dx, 0
1129 mov word ptr [FloppyGetNameTimer], ax
1130 mov word ptr [FloppyGetNameTimer+2], dx
1131 ret
1132BOOTMENU_ResetGetFloppy EndP
1133
1134
1135
Note: See TracBrowser for help on using the repository browser.