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

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

Changed register interface for LBA read/write sector [v1.1.1-testing]

Changed passing the LBA address from BX:CX to BX:AX, so it corresponds
to the load/save sector functions, which do more checking.

This loses the return-status in AH for reading sectors and specifying
write-verify for writing sectors, but that does not really matter.
Status of the last operation should be available using INT13 function
01h and verification of sectors can be done with function 44h if wanted.
CF indicates success or not, which is enough.

This register combination makes it possible to hold both CHS and LBA
sector addresses in registers if needed:
BX:AX ; LBA32
DX:CX ; CHS10

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