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

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

Optimized reading a sector from disk using INT13X [v1.1.1-testing]

At this level it is more clear to talk about 'reading' and 'writing'
sectors, where 'disk read' and 'disk write' errors can occur.

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: 35.8 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_ReadSectorLBA
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 ; restlichen Variablen berechnen...
958 mov dl, Menu_TotalParts
959 cmp byte ptr [Menu_TotalParts], 14
960 jbe BMRMV_NotMoreThan14
961 mov dl, 14
962 BMRMV_NotMoreThan14:
963 mov Menu_TotalLines, dl
964
965 ; Now copy the name of the Timed-Booted Partition to TimedBoot-Field
966 mov dl, Menu_EntryDefault
967 test byte ptr [CFG_TimedBootLast], 1
968 jz BMRMV_TimedBootDefault
969 mov dl, Menu_EntryLast
970 BMRMV_TimedBootDefault:
971 call PART_GetPartitionPointer ; Hold SI for Partition DL
972 add si, LocIPT_Name
973 mov cx, 11
974 call GetLenOfName
975 mov di, offset TXT_TimedBootEntryName
976 jz BMRMV_NoName
977 rep movsb
978 BMRMV_NoName:
979 xor al, al
980 stosb ; Ending Zero
981 ret
982BOOTMENU_ResetMenuVars EndP
983
984; Will Set some Vars after user selected entry to boot...
985; ...don't select Straight View !
986BOOTMENU_SetVarsAfterMenu Proc Near
987 ; No Straight View in here...we got filtered view since BootMenu-Startup...
988 mov al, CFG_RememberTimed
989 test byte ptr [TimedBootUsed], 1
990 jnz BMSVAM_TimedBootUsed
991 mov al, CFG_RememberBoot
992 BMSVAM_TimedBootUsed:
993 or al, al
994 jz BMSVAM_DontRememberBoot
995 mov dl, Menu_EntrySelected
996 call PART_ConvertToStraight ; CFG_PartLast is non-filtered
997 ;~ mov di, offset CFG_LinuxLastKernel
998 ;~ mov cx, 11
999 cmp dl, 0FDh ; Dont Remember on Floppy/CD-ROM/etc.
1000 ja BMSVAM_DontRememberBoot
1001 ; je BMSVAM_RememberKernelBoot ; but remember Kernel-Bootings...
1002 mov CFG_PartLast, dl ; Remember partition in CFG_PartLast
1003 ;~ mov al, ' '
1004 ;~ rep stosb ; SPACE out CFG_LinuxLastKernel
1005 BMSVAM_DontRememberBoot:
1006 ret
1007
1008 ;~ BMSVAM_RememberKernelBoot:
1009 ;~ mov dl, Menu_EntrySelected
1010 ;~ call PART_GetPartitionPointer ; SI - Pointer to Kernel Entry...
1011 ;~ add si, LocIPT_Name
1012 ;~ rep movsb ; Copy KernelName 2 CFG_LinuxLastKernel
1013 ;~ ret
1014BOOTMENU_SetVarsAfterMenu EndP
1015
1016
1017
1018
1019; Actually does the Boot-Menu Interaction
1020; Sets Carry-flag, if Setup is to be entered, otherwise system shall get booted
1021; On boot: Fills out some variables (like Menu_EntrySelected), when Booting
1022BOOTMENU_Execute Proc Near Uses es di
1023 ; Finds out, where to place the bar at first...
1024 mov dl, Menu_EntryDefault
1025 test byte ptr [CFG_RememberBoot], 1
1026 jnz BME_RememberMode
1027 test byte ptr [CFG_RememberTimed], 1
1028 jz BME_ForgetMode
1029 BME_RememberMode:
1030 mov dl, Menu_EntryLast
1031 BME_ForgetMode:
1032 ; Got it, so display bar...
1033 mov dh, dl
1034
1035 ;~ call SOUND_Beep
1036
1037 call BOOTMENU_BuildChoiceBar ; DH - Active, DL - Last Active
1038
1039 ;~ call SOUND_Beep
1040
1041 call SOUND_PreBootMenu
1042
1043
1044 BME_MainLoop:
1045
1046 ;call VideoIO_DBG_WriteString2 ; Rousseau
1047
1048 test byte ptr [TimedBootEnable], 1
1049 jz BME_NoTimedBoot
1050 ; ------------------------------------------------ TIMED BOOT
1051 push ax
1052 push dx
1053 call TIMER_GetTicCount
1054 mov dx, word ptr [TimedTimeOut]
1055 sub dx, ax
1056 mov ax, dx
1057 call TIMER_TranslateTicToSec ; DX - Timertics till ByeBye
1058 cmp al, TimedSecondLeft ; -> AL - Seconds till ByeBye
1059 je BME_NoFixSecond
1060 mov TimedSecondLeft, al
1061 call BOOTMENU_BuildTimedBootText ; Display Timed-Boot-Text
1062 BME_NoFixSecond:
1063 cmp al, 0
1064 jne BME_NoTimeOut
1065 pop dx
1066 pop ax
1067 mov dl, Menu_EntryDefault
1068 and byte ptr [CFG_TimedBootLast], 1
1069 jz BME_TimedBootDefault
1070 mov dl, Menu_EntryLast
1071 BME_TimedBootDefault:
1072 mov Menu_EntrySelected, dl ; Just boot default partition
1073 mov byte ptr [TimedBootUsed], 1 ; set flag...
1074 clc ; Boot-Now!
1075 ret
1076
1077 BME_NoTimeOut:
1078 pop dx
1079 pop ax
1080 BME_NoTimedBoot:
1081 ; ------------------------------------------------ FLOPPY-NAME TIMER
1082 test byte ptr [CFG_FloppyBootGetTimer], 1
1083 jz BME_NoFloppyNameTimer
1084 ; Wait 2 Seconds everytime
1085 push ax
1086 push dx
1087 call TIMER_GetTicCount
1088 cmp dx, word ptr [FloppyGetNameTimer+2]
1089 ja BME_ExpiredGetFloppy
1090 cmp ax, word ptr [FloppyGetNameTimer+0]
1091 jb BME_NoFloppyNameExpired
1092 BME_ExpiredGetFloppy:
1093 call BOOTMENU_ResetGetFloppy
1094 pop dx
1095 pop ax
1096 jmp BME_RefreshFloppyName
1097 BME_NoFloppyNameExpired:
1098 pop dx
1099 pop ax
1100 BME_NoFloppyNameTimer:
1101 ; ------------------------------------------------ KEYBOARD
1102 push dx
1103 mov ah, 1
1104 int 16h
1105 pop dx
1106 jnz BME_KeyAvailable
1107 jmp BME_MainLoop
1108
1109 BME_RefreshFloppyName:
1110 test byte ptr [CFG_IncludeFloppy], 1
1111 jz BME_NoRefreshFloppyName
1112 test byte ptr [CFG_FloppyBootGetName], 1
1113 jz BME_NoRefreshFloppyName
1114 call DriveIO_UpdateFloppyName
1115 call BOOTMENU_RefreshPartitionText
1116 call BOOTMENU_BuildChoiceBar ; Redisplay the selection-bar
1117 BME_NoRefreshFloppyName:
1118 jmp BME_MainLoop
1119
1120 BME_KeyAvailable:
1121 push dx
1122 mov ah, 0
1123 int 16h
1124 pop dx
1125
1126 ;!
1127 ;! DEBUG_BLOCK
1128 ;! Handle keys to activate debugging routines.
1129 ;!
1130 IFDEF AUX_DEBUG
1131 call DEBUG_HandleKeypress
1132 ENDIF
1133
1134 cmp ah, Keys_ENTER
1135 je BME_KeyEnter
1136 cmp ah, Keys_F10
1137 je BME_KeyF10
1138 cmp ah, Keys_Delete
1139 je BME_KeyDelete
1140 cmp ah, Keys_ESC
1141 je BME_KeyESC
1142 ; Upper Keys do not fall under Timed Boot Key Handling
1143 test byte ptr [TimedBootEnable], 1
1144 je BME_NoTimedKeyHandling
1145 cmp byte ptr [CFG_TimedKeyHandling], 1
1146 jb BME_NoTimedKeyHandling ; = 0
1147 je BME_ResetTimedBoot ; = 1
1148 mov al, TimedBootEnable ; = 2
1149 xor al, 1 ; Flip Flop Switch :]
1150 mov [TimedBootEnable], al
1151 BME_ResetTimedBoot:
1152 push dx
1153 call BOOTMENU_ResetTimedBoot ; Reset Timer
1154 call BOOTMENU_BuildTimedBootText ; Refresh TimedBootText
1155 pop dx
1156 BME_NoTimedKeyHandling:
1157 cmp ah, Keys_TAB
1158 je BME_KeyTAB
1159 cmp ah, Keys_Up
1160 je BME_KeyUp
1161 cmp ah, Keys_Down
1162 je BME_KeyDown
1163 jmp BME_MainLoop
1164
1165 BME_KeyUp:
1166 dec dh
1167 call BOOTMENU_BuildChoiceBar ; DH - Active, DL - Last Active
1168 jmp BME_MainLoop
1169
1170 BME_KeyDown:
1171 inc dh
1172 call BOOTMENU_BuildChoiceBar ; DH - Active, DL - Last Active
1173 jmp BME_MainLoop
1174
1175 BME_KeyEnter:
1176 mov Menu_EntrySelected, dl
1177 mov byte ptr [TimedBootUsed], 0 ; reset flag...
1178 clc ; Boot-Now!
1179 ret
1180
1181 BME_KeyF10:
1182 mov al, Keys_Flags_EnterSetup
1183 mov byte ptr [SETUP_KeysOnEntry], al ; Simulate user wants to enter setup
1184 stc ; Go Re-Enter Setup
1185 ret
1186
1187 BME_KeyDelete:
1188 call SOUND_ExecuteBoot
1189 call APM_TurnOffComputer
1190 jmp BME_MainLoop
1191
1192 BME_KeyESC:
1193 mov al, [TimedBootEnable]
1194 xor al, 1 ; Flip Flop Switch :]
1195 mov [TimedBootEnable], al
1196 push dx
1197 call BOOTMENU_ResetTimedBoot ; Reset Timer
1198 call BOOTMENU_BuildTimedBootText ; Refresh TimedBootText
1199 pop dx
1200 jmp BME_MainLoop
1201
1202 BME_KeyTAB:
1203 push dx
1204 test byte ptr [CFG_CooperBars], 1
1205 jnz BME_KeyTAB_ShowFX
1206 mov ax, 0501h ; Go To Page 1 -> BIOS POST crap
1207 int 10h
1208 mov ah, 0
1209 int 16h ; Wait for any key
1210 call BOOTMENU_ResetTimedBoot ; Reset Timer
1211 call BOOTMENU_BuildTimedBootText ; Refresh TimedBootText
1212 mov ax, 0500h ; Go Back to Page 0
1213 int 10h
1214 pop dx
1215 jmp BME_MainLoop
1216 BME_KeyTAB_ShowFX:
1217 pusha
1218 mov ax, VideoIO_Page1
1219 mov bx, VideoIO_Page0
1220 mov dx, 160
1221 xor di, di
1222
1223 IFDEF FX_ENABLED
1224 call FX_InterleaveCopy
1225 call FX_ScrollScreenLeft
1226 ENDIF
1227
1228 mov ah, 0
1229 int 16h ; Wait for any key
1230 call BOOTMENU_ResetTimedBoot ; Reset Timer
1231 call BOOTMENU_BuildTimedBootText ; Refresh TimedBootText
1232
1233 IFDEF FX_ENABLED
1234 call FX_ScrollScreenRight
1235 call FX_EndScreenInternalCleanUp
1236 ENDIF
1237
1238 call BOOTMENU_ResetTimedBoot ; Reset Timer again...
1239 popa
1240 pop dx
1241 jmp BME_MainLoop
1242BOOTMENU_Execute EndP
1243
1244; Resettet den TimedBoot Timer...
1245BOOTMENU_ResetTimedBoot Proc Near Uses ax
1246 call TIMER_GetTicCount
1247 add ax, CFG_TimedDelay
1248 adc dx, 0
1249 mov word ptr [TimedTimeOut], ax
1250 mov word ptr [TimedTimeOut+2], dx
1251 ret
1252BOOTMENU_ResetTimedBoot EndP
1253
1254; Resettet den Floppy-Get-Name Timer...
1255BOOTMENU_ResetGetFloppy Proc Near Uses ax
1256 call TIMER_GetTicCount
1257 add ax, 36 ; 18*2 -> 2 seconds
1258 adc dx, 0
1259 mov word ptr [FloppyGetNameTimer], ax
1260 mov word ptr [FloppyGetNameTimer+2], dx
1261 ret
1262BOOTMENU_ResetGetFloppy EndP
Note: See TracBrowser for help on using the repository browser.