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

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

Merged some syntax changes from different local branch [v1.1.1-testing]

Ultimately we want to use '[identifier]' in all instructions that do
memory references, so there is a clear distinction between those and
immediate values.

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.5 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 ; SI now points to the IPT-entry
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
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
733IF 0
734 ; Print values at start of LVM-record
735 pushf
736 pusha
737 mov si, offset [LVMSector]
738 lodsw
739 call VideoIO_PrintHexWord
740 lodsw
741 call VideoIO_PrintHexWord
742 popa
743 popf
744ENDIF
745 jnc skip_show_dl
746
747 test al,al
748 jnz show_dl2
749
750
751
752 mov si, offset [dl_hidden]
753 mov cx, CLR_DL
754 call VideoIO_Color
755 call VideoIO_Print
756
757 mov cx, CLR_DL_HIDDEN
758 call VideoIO_Color
759
760 mov al, dh
761 call VideoIO_PrintSingleChar
762 mov al, ':'
763 call VideoIO_PrintSingleChar
764
765 jmp skip_show_dl
766
767 show_dl2:
768
769 mov si, offset [dl_text]
770
771 call VideoIO_Print
772
773 mov cx, CLR_DL
774 call VideoIO_Color
775
776 call VideoIO_PrintSingleChar
777 mov al,':'
778 call VideoIO_PrintSingleChar
779
780 skip_show_dl:
781 popa
782
783 ENDIF
784
785
786 ret
787BOOTMENU_BuildPartitionText EndP
788
789dl_text db ' on drive ',0
790dl_hidden db ' hidden ',0
791spaces db ' ',0
792
793; In: DL - Active Partition
794; DH - New Active Partition (may not be correct number)
795; Out: DX - will get returned (fixed, if needed)
796BOOTMENU_BuildChoiceBar Proc near Uses ax es di
797
798 ;call SOUND_Beep
799
800 call VideoIO_WaitRetrace
801
802
803 ;call SOUND_Beep
804
805
806
807; SELECTION BAR REDRAW
808CLR_SELECTION_BAR_REDRAW_CLASSIC = 10h
809CLR_SELECTION_BAR_REDRAW_BM = 10h
810CLR_SELECTION_BAR_REDRAW_TB = 80h
811IFDEF TESTBUILD
812CLR_SELECTION_BAR_REDRAW = CLR_SELECTION_BAR_REDRAW_TB
813ELSE
814CLR_SELECTION_BAR_REDRAW = CLR_SELECTION_BAR_REDRAW_BM
815ENDIF
816
817 mov cl, CLR_SELECTION_BAR_REDRAW ; Color BROWN, Partition DL
818 call BOOTMENU_ReColorPart
819
820 ;call SOUND_Beep
821
822 ; Check, if clipping needed...
823 cmp dh, 0ffh
824 jne BMBCB_RightMin
825 xor dh, dh
826 BMBCB_RightMin:
827 cmp dh, Menu_TotalParts ; DH is base 0, TotalParts is counter
828 jb BMBCB_AfterClipping ; That's why JB and not JBE
829 mov dh, Menu_TotalParts
830 dec dh ; Now base 0
831 BMBCB_AfterClipping:
832 ; After Clipping
833 mov dl, dh
834 mov cl, Menu_UpperPart
835 ; Now check, if we need to Scroll
836 cmp dh, cl
837 jae BMBCB_NoScrollUp
838 BMBCB_ScrollingUp:
839 dec byte ptr [Menu_UpperPart] ; Adjusted for Wasm
840 cmp dh, Menu_UpperPart
841 jb BMBCB_ScrollingUp
842 call BOOTMENU_RefreshPartitionText
843 jmp BMBCB_AfterScrolling
844
845 BMBCB_NoScrollUp:
846 add cl, Menu_TotalLines
847 cmp dh, cl
848 jb BMBCB_AfterScrolling
849 BMBCB_ScrollingDown:
850 inc cl
851 inc byte ptr [Menu_UpperPart] ; Adjusted for Wasm
852 cmp dh, cl
853 jae BMBCB_ScrollingDown
854 call BOOTMENU_RefreshPartitionText
855
856
857
858; SELECTION BAR
859CLR_SELECTION_BAR_CLASSIC = 50h
860CLR_SELECTION_BAR_BM = 90h
861CLR_SELECTION_BAR_WARNING = 40h
862CLR_SELECTION_BAR_TB = 60h
863IFDEF TESTBUILD
864CLR_SELECTION_BAR = CLR_SELECTION_BAR_TB
865ELSE
866CLR_SELECTION_BAR = CLR_SELECTION_BAR_BM
867ENDIF
868
869
870 BMBCB_AfterScrolling:
871 mov cl, CLR_SELECTION_BAR
872 test byte ptr [TooManyPartitions],0ffh ; Check for too many partitions.
873 jz BOOTMENU_BuildChoiceBar_normal
874 mov cl, CLR_SELECTION_BAR_WARNING ; Set red bar if so.
875 BOOTMENU_BuildChoiceBar_normal:
876 call BOOTMENU_ReColorPart
877 ret
878BOOTMENU_BuildChoiceBar EndP
879
880; In: CL - Color, DL - Partition
881; Destroyed: None, but Locate-Pointer gets set
882BOOTMENU_ReColorPart Proc Near Uses bx cx es di
883
884 ; call SOUND_Beep
885
886 mov bh, cl ; Color to BH
887 ; First calculate location of bar
888 cmp Menu_UpperPart, dl
889 ja BMRCP_NotInWindowView
890 mov ch, dl
891 sub ch, Menu_UpperPart ; CH - Position relative to UpperPart
892 cmp ch, 14 ; 14 - Maximum Total in Window
893 ja BMRCP_NotInWindowView
894 add ch, 5 ; Y-Position add-on fixed 5
895 mov cl, 2 ; X-Position is always 2
896 call VideoIO_Locate ; geht zu CX
897 call VideoIO_Internal_SetRegs
898 inc di ; DI - Destination+1 -> Color-Byte
899 mov cl, 78 ; Length of Bar is always 78
900 BMRCP_ClearLoop:
901 mov al, es:[di]
902 and al, 0Fh
903 or al, bh ; Adds background color (from BH)
904
905 ;mov al,97h
906
907 mov es:[di], al
908 add di, 2
909 dec cl
910 jnz BMRCP_ClearLoop
911 BMRCP_NotInWindowView:
912 ret
913BOOTMENU_ReColorPart EndP
914
915
916; Calculate Menu-Variables for Boot-Menu, these use the filtered Part-Pointers
917BOOTMENU_ResetMenuVars Proc Near Uses dx
918 xor dl, dl ; Partition at Pos 0 == 1st
919 mov Menu_UpperPart, dl
920
921 ; = TIMED BOOTING =
922 mov dl, CFG_TimedBoot
923 mov TimedBootEnable, dl
924 mov al, CFG_TimedSecs
925 mov TimedSecondLeft, al
926 call TIMER_TranslateSecToTic
927 add ax, 16 ; So that the required ammount will
928 mov CFG_TimedDelay, ax ; be shown and not Timer-1.
929 call BOOTMENU_ResetTimedBoot
930 ; = FLOPPY-GET-NAME TIMER =
931 call BOOTMENU_ResetGetFloppy
932
933 ; Resettet die Base-Variablen...
934 mov dl, PartitionPointerCount
935 mov Menu_TotalParts, dl
936
937 ; Copy device-name to the ContBIOSbootSeq-IPT entry
938 ; Normally this does not need to get done here, but is done for safety
939 ; reasons if e.g. IPT got changed by SETUP, but that setup was discarded.
940 call PART_UpdateResumeBIOSName
941
942 ; Default-Partition -> Filtered View -> Menu_EntryDefault
943 mov dl, CFG_PartDefault
944 call PART_ConvertFromStraight
945 mov Menu_EntryDefault, dl
946
947 ; Last-Booted-Partition -> Filtered View -> Menu_EntryLast
948 mov dl, CFG_PartLast
949 call PART_ConvertFromStraight
950 mov Menu_EntryLast, dl
951
952 ; Automatic-Partition -> Filtered View -> Menu_EntryAutomatic
953 mov dl, CFG_PartAutomatic
954 call PART_ConvertFromStraight
955 mov Menu_EntryAutomatic, dl
956
957 ;~ ; [Linux support removed since v1.02]
958 ;~ ; Okay, now we check if Default/Last Kernel Partition Name is available...
959 ;~ ; if so, simply set Menu_EntryDefault/Menu_EntryLast.
960 ;~ mov si, offset CFG_LinuxDefaultKernel
961 ;~ call LINUX_SearchKernelName ; DL - Filtered Entry No
962 ;~ cmp dl, 0FFh
963 ;~ je BMRMV_DefaultKernelNF
964 ;~ mov Menu_EntryDefault, dl
965 ;~ BMRMV_DefaultKernelNF:
966 ;~ mov si, offset CFG_LinuxLastKernel
967 ;~ call LINUX_SearchKernelName ; DL - Filtered Entry No
968 ;~ cmp dl, 0FFh
969 ;~ je BMRMV_LastKernelNF
970 ;~ mov Menu_EntryLast, dl
971 ;~ BMRMV_LastKernelNF:
972
973 ; restlichen Variablen berechnen...
974 mov dl, Menu_TotalParts
975 cmp byte ptr [Menu_TotalParts], 14
976 jbe BMRMV_NotMoreThan14
977 mov dl, 14
978 BMRMV_NotMoreThan14:
979 mov Menu_TotalLines, dl
980
981 ; Now copy the name of the Timed-Booted Partition to TimedBoot-Field
982 mov dl, Menu_EntryDefault
983 test byte ptr [CFG_TimedBootLast], 1
984 jz BMRMV_TimedBootDefault
985 mov dl, Menu_EntryLast
986 BMRMV_TimedBootDefault:
987 call PART_GetPartitionPointer ; Hold SI for Partition DL
988 add si, LocIPT_Name
989 mov cx, 11
990 call GetLenOfName
991 mov di, offset TXT_TimedBootEntryName
992 jz BMRMV_NoName
993 rep movsb
994 BMRMV_NoName:
995 xor al, al
996 stosb ; Ending Zero
997 ret
998BOOTMENU_ResetMenuVars EndP
999
1000; Will Set some Vars after user selected entry to boot...
1001; ...don't select Straight View !
1002BOOTMENU_SetVarsAfterMenu Proc Near
1003 ; No Straight View in here...we got filtered view since BootMenu-Startup...
1004 mov al, CFG_RememberTimed
1005 test byte ptr [TimedBootUsed], 1
1006 jnz BMSVAM_TimedBootUsed
1007 mov al, CFG_RememberBoot
1008 BMSVAM_TimedBootUsed:
1009 or al, al
1010 jz BMSVAM_DontRememberBoot
1011 mov dl, Menu_EntrySelected
1012 call PART_ConvertToStraight ; CFG_PartLast is non-filtered
1013 ;~ mov di, offset CFG_LinuxLastKernel
1014 ;~ mov cx, 11
1015 cmp dl, 0FDh ; Dont Remember on Floppy/CD-ROM/etc.
1016 ja BMSVAM_DontRememberBoot
1017 ; je BMSVAM_RememberKernelBoot ; but remember Kernel-Bootings...
1018 mov CFG_PartLast, dl ; Remember partition in CFG_PartLast
1019 ;~ mov al, ' '
1020 ;~ rep stosb ; SPACE out CFG_LinuxLastKernel
1021 BMSVAM_DontRememberBoot:
1022 ret
1023
1024 ;~ BMSVAM_RememberKernelBoot:
1025 ;~ mov dl, Menu_EntrySelected
1026 ;~ call PART_GetPartitionPointer ; SI - Pointer to Kernel Entry...
1027 ;~ add si, LocIPT_Name
1028 ;~ rep movsb ; Copy KernelName 2 CFG_LinuxLastKernel
1029 ;~ ret
1030BOOTMENU_SetVarsAfterMenu EndP
1031
1032
1033
1034
1035; Actually does the Boot-Menu Interaction
1036; Sets Carry-flag, if Setup is to be entered, otherwise system shall get booted
1037; On boot: Fills out some variables (like Menu_EntrySelected), when Booting
1038BOOTMENU_Execute Proc Near Uses es di
1039 ; Finds out, where to place the bar at first...
1040 mov dl, Menu_EntryDefault
1041 test byte ptr [CFG_RememberBoot], 1
1042 jnz BME_RememberMode
1043 test byte ptr [CFG_RememberTimed], 1
1044 jz BME_ForgetMode
1045 BME_RememberMode:
1046 mov dl, Menu_EntryLast
1047 BME_ForgetMode:
1048 ; Got it, so display bar...
1049 mov dh, dl
1050
1051 ;~ call SOUND_Beep
1052
1053 call BOOTMENU_BuildChoiceBar ; DH - Active, DL - Last Active
1054
1055 ;~ call SOUND_Beep
1056
1057 call SOUND_PreBootMenu
1058
1059
1060 BME_MainLoop:
1061
1062 ;call VideoIO_DBG_WriteString2 ; Rousseau
1063
1064 test byte ptr [TimedBootEnable], 1
1065 jz BME_NoTimedBoot
1066 ; ------------------------------------------------ TIMED BOOT
1067 push ax
1068 push dx
1069 call TIMER_GetTicCount
1070 mov dx, word ptr [TimedTimeOut]
1071 sub dx, ax
1072 mov ax, dx
1073 call TIMER_TranslateTicToSec ; DX - Timertics till ByeBye
1074 cmp al, TimedSecondLeft ; -> AL - Seconds till ByeBye
1075 je BME_NoFixSecond
1076 mov TimedSecondLeft, al
1077 call BOOTMENU_BuildTimedBootText ; Display Timed-Boot-Text
1078 BME_NoFixSecond:
1079 cmp al, 0
1080 jne BME_NoTimeOut
1081 pop dx
1082 pop ax
1083 mov dl, Menu_EntryDefault
1084 and byte ptr [CFG_TimedBootLast], 1
1085 jz BME_TimedBootDefault
1086 mov dl, Menu_EntryLast
1087 BME_TimedBootDefault:
1088 mov Menu_EntrySelected, dl ; Just boot default partition
1089 mov byte ptr [TimedBootUsed], 1 ; set flag...
1090 clc ; Boot-Now!
1091 ret
1092
1093 BME_NoTimeOut:
1094 pop dx
1095 pop ax
1096 BME_NoTimedBoot:
1097 ; ------------------------------------------------ FLOPPY-NAME TIMER
1098 test byte ptr [CFG_FloppyBootGetTimer], 1
1099 jz BME_NoFloppyNameTimer
1100 ; Wait 2 Seconds everytime
1101 push ax
1102 push dx
1103 call TIMER_GetTicCount
1104 cmp dx, word ptr [FloppyGetNameTimer+2]
1105 ja BME_ExpiredGetFloppy
1106 cmp ax, word ptr [FloppyGetNameTimer+0]
1107 jb BME_NoFloppyNameExpired
1108 BME_ExpiredGetFloppy:
1109 call BOOTMENU_ResetGetFloppy
1110 pop dx
1111 pop ax
1112 jmp BME_RefreshFloppyName
1113 BME_NoFloppyNameExpired:
1114 pop dx
1115 pop ax
1116 BME_NoFloppyNameTimer:
1117 ; ------------------------------------------------ KEYBOARD
1118 push dx
1119 mov ah, 1
1120 int 16h
1121 pop dx
1122 jnz BME_KeyAvailable
1123 jmp BME_MainLoop
1124
1125 BME_RefreshFloppyName:
1126 test byte ptr [CFG_IncludeFloppy], 1
1127 jz BME_NoRefreshFloppyName
1128 test byte ptr [CFG_FloppyBootGetName], 1
1129 jz BME_NoRefreshFloppyName
1130 call DriveIO_UpdateFloppyName
1131 call BOOTMENU_RefreshPartitionText
1132 call BOOTMENU_BuildChoiceBar ; Redisplay the selection-bar
1133 BME_NoRefreshFloppyName:
1134 jmp BME_MainLoop
1135
1136 BME_KeyAvailable:
1137 push dx
1138 mov ah, 0
1139 int 16h
1140 pop dx
1141
1142 ;!
1143 ;! DEBUG_BLOCK
1144 ;! Handle keys to activate debugging routines.
1145 ;!
1146 IFDEF AUX_DEBUG
1147 call DEBUG_HandleKeypress
1148 ENDIF
1149
1150 cmp ah, Keys_ENTER
1151 je BME_KeyEnter
1152 cmp ah, Keys_F10
1153 je BME_KeyF10
1154 cmp ah, Keys_Delete
1155 je BME_KeyDelete
1156 cmp ah, Keys_ESC
1157 je BME_KeyESC
1158 ; Upper Keys do not fall under Timed Boot Key Handling
1159 test byte ptr [TimedBootEnable], 1
1160 je BME_NoTimedKeyHandling
1161 cmp byte ptr [CFG_TimedKeyHandling], 1
1162 jb BME_NoTimedKeyHandling ; = 0
1163 je BME_ResetTimedBoot ; = 1
1164 mov al, TimedBootEnable ; = 2
1165 xor al, 1 ; Flip Flop Switch :]
1166 mov [TimedBootEnable], al
1167 BME_ResetTimedBoot:
1168 push dx
1169 call BOOTMENU_ResetTimedBoot ; Reset Timer
1170 call BOOTMENU_BuildTimedBootText ; Refresh TimedBootText
1171 pop dx
1172 BME_NoTimedKeyHandling:
1173 cmp ah, Keys_TAB
1174 je BME_KeyTAB
1175 cmp ah, Keys_Up
1176 je BME_KeyUp
1177 cmp ah, Keys_Down
1178 je BME_KeyDown
1179 jmp BME_MainLoop
1180
1181 BME_KeyUp:
1182 dec dh
1183 call BOOTMENU_BuildChoiceBar ; DH - Active, DL - Last Active
1184 jmp BME_MainLoop
1185
1186 BME_KeyDown:
1187 inc dh
1188 call BOOTMENU_BuildChoiceBar ; DH - Active, DL - Last Active
1189 jmp BME_MainLoop
1190
1191 BME_KeyEnter:
1192 mov Menu_EntrySelected, dl
1193 mov byte ptr [TimedBootUsed], 0 ; reset flag...
1194 clc ; Boot-Now!
1195 ret
1196
1197 BME_KeyF10:
1198 mov al, Keys_Flags_EnterSetup
1199 mov byte ptr [SETUP_KeysOnEntry], al ; Simulate user wants to enter setup
1200 stc ; Go Re-Enter Setup
1201 ret
1202
1203 BME_KeyDelete:
1204 call SOUND_ExecuteBoot
1205 call APM_TurnOffComputer
1206 jmp BME_MainLoop
1207
1208 BME_KeyESC:
1209 mov al, [TimedBootEnable]
1210 xor al, 1 ; Flip Flop Switch :]
1211 mov [TimedBootEnable], al
1212 push dx
1213 call BOOTMENU_ResetTimedBoot ; Reset Timer
1214 call BOOTMENU_BuildTimedBootText ; Refresh TimedBootText
1215 pop dx
1216 jmp BME_MainLoop
1217
1218 BME_KeyTAB:
1219 push dx
1220 test byte ptr [CFG_CooperBars], 1
1221 jnz BME_KeyTAB_ShowFX
1222 mov ax, 0501h ; Go To Page 1 -> BIOS POST crap
1223 int 10h
1224 mov ah, 0
1225 int 16h ; Wait for any key
1226 call BOOTMENU_ResetTimedBoot ; Reset Timer
1227 call BOOTMENU_BuildTimedBootText ; Refresh TimedBootText
1228 mov ax, 0500h ; Go Back to Page 0
1229 int 10h
1230 pop dx
1231 jmp BME_MainLoop
1232 BME_KeyTAB_ShowFX:
1233 pusha
1234 mov ax, VideoIO_Page1
1235 mov bx, VideoIO_Page0
1236 mov dx, 160
1237 xor di, di
1238
1239 IFDEF FX_ENABLED
1240 call FX_InterleaveCopy
1241 call FX_ScrollScreenLeft
1242 ENDIF
1243
1244 mov ah, 0
1245 int 16h ; Wait for any key
1246 call BOOTMENU_ResetTimedBoot ; Reset Timer
1247 call BOOTMENU_BuildTimedBootText ; Refresh TimedBootText
1248
1249 IFDEF FX_ENABLED
1250 call FX_ScrollScreenRight
1251 call FX_EndScreenInternalCleanUp
1252 ENDIF
1253
1254 call BOOTMENU_ResetTimedBoot ; Reset Timer again...
1255 popa
1256 pop dx
1257 jmp BME_MainLoop
1258BOOTMENU_Execute EndP
1259
1260; Resettet den TimedBoot Timer...
1261BOOTMENU_ResetTimedBoot Proc Near Uses ax
1262 call TIMER_GetTicCount
1263 add ax, CFG_TimedDelay
1264 adc dx, 0
1265 mov word ptr [TimedTimeOut], ax
1266 mov word ptr [TimedTimeOut+2], dx
1267 ret
1268BOOTMENU_ResetTimedBoot EndP
1269
1270; Resettet den Floppy-Get-Name Timer...
1271BOOTMENU_ResetGetFloppy Proc Near Uses ax
1272 call TIMER_GetTicCount
1273 add ax, 36 ; 18*2 -> 2 seconds
1274 adc dx, 0
1275 mov word ptr [FloppyGetNameTimer], ax
1276 mov word ptr [FloppyGetNameTimer+2], dx
1277 ret
1278BOOTMENU_ResetGetFloppy EndP
Note: See TracBrowser for help on using the repository browser.