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

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

Fixed non-functional TAB-key caused by disabling FX [v1.1.3-testing]

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

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