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

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

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

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

CAUTION:
This is a testbuild !
AirBoot uses the BIOS to access disks and a small coding error can trash
partition tables or other vital disk structures. You are advised to make
backups of TRACK0 and EBRs before using this testbuild. More info at:
https://rousseaux.github.io/netlabs.air-boot/pdf/AirBoot-v1.1.0-manual.pdf

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