source: trunk/bootcode/setup/part_set.asm@ 57

Last change on this file since 57 was 57, checked in by Ben Rietbroek, 10 years ago

All source-files lowercased [v1.1.1-testing]

Some standard files like 'COPYING', 'LICENSE', etc. have not been
converted to lower case because they are usually distributed uppercased.

File size: 55.4 KB
Line 
1; AiR-BOOT (c) Copyright 1998-2008 M. Kiewitz
2;
3; This file is part of AiR-BOOT
4;
5; AiR-BOOT is free software: you can redistribute it and/or modify it under
6; the terms of the GNU General Public License as published by the Free
7; Software Foundation, either version 3 of the License, or (at your option)
8; any later version.
9;
10; AiR-BOOT is distributed in the hope that it will be useful, but WITHOUT ANY
11; WARRANTY: without even the implied warranty of MERCHANTABILITY or FITNESS
12; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13; details.
14;
15; You should have received a copy of the GNU General Public License along with
16; AiR-BOOT. If not, see <http://www.gnu.org/licenses/>.
17;
18;---------------------------------------------------------------------------
19; AiR-BOOT SETUP / PARTITION SETUP
20;---------------------------------------------------------------------------
21
22IFDEF MODULE_NAMES
23DB 'PART_SET',0
24ENDIF
25
26; This here is called from Menu in AIR-BSET.asm
27PARTSETUP_Main Proc Near
28 ; Build Fixed Content...
29 call PARTSETUP_DrawMenuBase
30 ; Build Dynamic Content...
31 mov dl, PartSetup_ActivePart
32 mov dh, dl ; DL - Current Active, DH - New Active
33 call PARTSETUP_RefreshPartitions
34 ; Show Choice-Bar at DH...
35 call PARTSETUP_BuildChoiceBar
36
37 ; Now we got everything on-the-screen
38 PSM_MainLoop:
39 push dx
40 mov ah, 0
41 int 16h
42 pop dx
43
44 ;
45 ; INSERT DEBUG KEYHANDLER HERE ?
46 ;
47
48 cmp ah, Keys_Up
49 je PSM_KeyUp
50 cmp ah, Keys_Down
51 je PSM_KeyDown
52 cmp ah, Keys_Left
53 je PSM_KeyLeft
54 cmp ah, Keys_Right
55 je PSM_KeyRight
56 cmp ah, Keys_ESC
57 je PSM_KeyESC
58 cmp ah, Keys_F1
59 je PSM_KeyF1
60 cmp ah, Keys_ENTER
61 je PSM_KeyENTER
62 ; Flags-Change
63 and al, 0DFh ; Upper-Case Input
64 cmp al, TXT_SETUP_FlagLetterBootable
65 je PSM_KeyBootAble
66 cmp al, TXT_SETUP_FlagLetterVIBR
67 je PSM_KeyVIBRdetection
68 cmp al, TXT_SETUP_FlagLetterHide
69
70 jne skip_x
71 jmp PSM_KeyHiddenSetup
72 skip_x:
73 cmp al, TXT_SETUP_FlagLetterDrvLetter
74
75 jne skip_y
76 jmp PSM_KeyDriveLetterForceSetup
77 skip_y:
78
79 cmp al, TXT_SETUP_FlagLetterExtMShack
80 jne skip_z
81 jmp PSM_KeyDriveLetterExtMShack
82 skip_z:
83 jmp PSM_MainLoop
84
85 PSM_KeyESC:
86 ; Simpy exit this menu...
87 mov PartSetup_ActivePart, dl
88 ret
89
90 PSM_KeyUp:
91 cmp dh, 1
92 jbe PSM_MainLoop
93 sub dh, 2
94 call PARTSETUP_BuildChoiceBar
95 jmp PSM_MainLoop
96
97 PSM_KeyDown:
98 add dh, 2
99 call PARTSETUP_BuildChoiceBar
100 jmp PSM_MainLoop
101
102 PSM_KeyLeft:
103 xor dh, 1
104 call PARTSETUP_BuildChoiceBar
105 jmp PSM_MainLoop
106
107 PSM_KeyRight:
108 xor dh, 1
109 call PARTSETUP_BuildChoiceBar
110 jmp PSM_MainLoop
111
112 PSM_KeyF1:
113 mov bx, offset TXT_SETUPHELP_InPartitionSetup
114 call SETUP_ShowHelp ; Shows help
115 jmp PSM_MainLoop
116
117 ; Disabling editing for type 0x35 is currently implemented
118 ; in PARTSETUP_ChangePartitionName.
119 PSM_KeyENTER:
120 call PARTSETUP_ChangePartitionName
121 ; Rebuild Menu...
122 call PARTSETUP_DrawMenuBase
123 call PARTSETUP_RefreshPartitions
124 call PARTSETUP_BuildChoiceBar
125 jmp PSM_MainLoop
126
127 PSM_KeyBootAble:
128 call PART_GetPartitionPointer ; Gets Partition (DL) Pointer -> SI
129 ; See if this is an eCS LVM Volume.
130 ; In that case, we don't allow it to be made bootable.
131 ; We also show a popup to inform the user.
132 call PARTSETUP_IsType35
133 je PSM_KeyBootAble_istype35
134
135 PSM_KeyBootAble_notype35:
136 mov al, [si+LocIPT_Flags]
137 xor al, Flags_Bootable
138 mov [si+LocIPT_Flags], al
139 call PARTSETUP_DrawPartitionInfo
140 call PARTSETUP_BuildChoiceBar
141 PSM_KeyBootAble_istype35:
142 jmp PSM_MainLoop
143
144 PSM_KeyVIBRdetection:
145 call PART_GetPartitionPointer ; Gets Partition (DL) Pointer -> SI
146 mov al, [si+LocIPT_Flags]
147 xor al, Flags_VIBR_Detection
148 mov [si+LocIPT_Flags], al
149 xor ax, ax
150 mov word ptr [si+LocIPT_BootRecordCRC], ax
151 call PARTSETUP_DrawPartitionInfo
152 call PARTSETUP_BuildChoiceBar
153 jmp PSM_MainLoop
154
155 PSM_KeyHiddenSetup:
156 call PARTHIDESETUP_Main
157 ; Rebuild Menu...
158 call PARTSETUP_DrawMenuBase
159 call PARTSETUP_RefreshPartitions
160 call PARTSETUP_BuildChoiceBar
161 jmp PSM_MainLoop
162
163 PSM_KeyDriveLetterForceSetup:
164 call PARTSETUP_DriveLetterSetup
165 ; Rebuild Menu...
166 call PARTSETUP_DrawMenuBase
167 call PARTSETUP_RefreshPartitions
168 call PARTSETUP_BuildChoiceBar
169 jmp PSM_MainLoop
170
171 PSM_KeyDriveLetterExtMShack:
172 call PART_GetPartitionPointer ; Gets Partition (DL) Pointer -> SI
173 mov al, [si+LocIPT_Flags]
174 xor al, Flags_ExtPartMShack
175 mov [si+LocIPT_Flags], al
176 call PARTSETUP_DrawPartitionInfo
177 call PARTSETUP_BuildChoiceBar
178 jmp PSM_MainLoop
179PARTSETUP_Main EndP
180
181
182; See if this is a partition of type 0x35 and display error
183; when user tries to set it as bootable.
184; IN: SI = Pointer to partition
185; OUT: ZF = Set if 0x35, clear otherwise
186PARTSETUP_IsType35 Proc Near
187 mov al, [si+LocIPT_SystemID]
188 cmp al, 35h
189 jne PARTSETUP_IsType35_end
190 pushf
191 pusha
192 ; Cannot boot LVM-Data partitions
193 mov cx, 0C04h
194 mov si, offset TXT_SETUP_NoBootType35
195 call SETUP_ShowErrorBox
196 popa
197 call PARTSETUP_DrawMenuBase
198 call PARTSETUP_RefreshPartitions
199 call PARTSETUP_BuildChoiceBar
200 popf
201 PARTSETUP_IsType35_end:
202 ret
203PARTSETUP_IsType35 EndP
204
205
206; Draw all standard-things for Partition Setup, dynamic content not included.
207PARTSETUP_DrawMenuBase Proc Near Uses dx
208 call SETUP_DrawMenuWindow ; Standard Windows
209
210 ; 1st No Hd [09] Name [15] Flags [1D] Type
211 ; 2nd No Hd [31] Name [3D] Flags [45] Type
212
213 mov cx, 0508h
214 call VideoIO_Locate
215 inc TextPosX
216 mov al, TextChar_WinLineDown
217 mov cl, 9
218 call VideoIO_Internal_MakeWinDown ; Line between 1st No Hd and Name
219 mov cx, 0515h
220 call VideoIO_Locate
221 mov al, TextChar_WinLineDown
222 mov cl, 9
223 call VideoIO_Internal_MakeWinDown ; Line between 1st Name and Flags
224 mov cx, 051Dh
225 call VideoIO_Locate
226 mov al, TextChar_WinLineDown
227 mov cl, 9
228 call VideoIO_Internal_MakeWinDown ; Line between 1st Flags and Type
229
230 mov cx, 0531h ; Line between 2nd No Hd and Name
231 call VideoIO_Locate
232 mov al, TextChar_WinLineDown
233 mov cl, 9
234 call VideoIO_Internal_MakeWinDown
235 mov cx, 053Dh ; Line between 2nd Name and Flags
236 call VideoIO_Locate
237 mov al, TextChar_WinLineDown
238 mov cl, 9
239 call VideoIO_Internal_MakeWinDown
240 mov cx, 0545h ; Line between 2nd Flags and Type
241 call VideoIO_Locate
242 mov al, TextChar_WinLineDown
243 mov cl, 9
244 call VideoIO_Internal_MakeWinDown
245
246 mov cx, 0B01h
247 call VideoIO_Color
248
249 ; ------------------------------------- 1st Part
250 mov cx, 0503h
251 call VideoIO_Locate
252 mov si, offset TXT_TopInfos_No ; "No Hd"
253 mov cl, 5
254 call VideoIO_FixedPrint
255 mov cx, 050Bh
256 call VideoIO_Locate
257 mov si, offset TXT_TopInfos_Label ; "Label"
258 mov cl, 5
259 call VideoIO_FixedPrint
260 mov cx, 0517h
261 call VideoIO_Locate
262 mov si, offset TXT_TopInfos_Flags ; "Flags"
263 mov cl, 5
264 call VideoIO_FixedPrint
265 mov cx, 051Fh
266 call VideoIO_Locate
267 mov si, offset TXT_TopInfos_Type ; "Type"
268 mov cl, 4
269 call VideoIO_FixedPrint
270
271 ; ------------------------------------- 2nd Part
272 mov cx, 052Bh
273 call VideoIO_Locate
274 mov si, offset TXT_TopInfos_No ; "No Hd"
275 mov cl, 5
276 call VideoIO_FixedPrint
277 mov cx, 0533h
278 call VideoIO_Locate
279 mov si, offset TXT_TopInfos_Label ; "Label"
280 mov cl, 5
281 call VideoIO_FixedPrint
282 mov cx, 053Fh
283 call VideoIO_Locate
284 mov si, offset TXT_TopInfos_Flags ; "Flags"
285 mov cl, 5
286 call VideoIO_FixedPrint
287 mov cx, 0547h
288 call VideoIO_Locate
289 mov si, offset TXT_TopInfos_Type ; "Type"
290 mov cl, 4
291 call VideoIO_FixedPrint
292
293 mov si, offset TXT_SETUPHELP_PartSetup
294 call SETUP_DrawMenuHelp
295 ret
296PARTSETUP_DrawMenuBase EndP
297
298; Displays all partitions into Partition Setup Menu
299; aka displays dynamic content.
300PARTSETUP_RefreshPartitions Proc Near Uses cx dx
301 mov dl, PartSetup_UpperPart
302 mov dh, 12
303 PSRP_Loop:
304 call PARTSETUP_DrawPartitionInfo
305 inc dl
306 dec dh
307 jnz PSRP_Loop
308 ; At last calculate Scroll-Markers
309 mov cx, 0901h
310 call VideoIO_Color
311 mov cx, 0603h ; 6, 3
312 mov dl, PartSetup_UpperPart
313 call PARTSETUP_UpperScrollMarker
314 mov cl, 37 ; 6, 37
315 call PARTSETUP_UpperScrollMarker
316 mov cl, 43 ; 6, 43
317 call PARTSETUP_UpperScrollMarker
318 mov cl, 76 ; 6, 76
319 call PARTSETUP_UpperScrollMarker
320 mov cx, 0D03h ; 13, 3
321 add dl, 12 ; add 12 -> points to last partition
322 mov dh, CFG_Partitions ; Limit
323 call PARTSETUP_LowerScrollMarker
324 mov cl, 37 ; 6, 37
325 call PARTSETUP_LowerScrollMarker
326 inc dl ; add 1 -> cool way ;-)
327 mov cl, 43 ; 6, 43
328 call PARTSETUP_LowerScrollMarker
329 mov cl, 76 ; 6, 76
330 call PARTSETUP_LowerScrollMarker
331 ret
332PARTSETUP_RefreshPartitions EndP
333
334; Writes Partition-Information to Screen (Partition-Setup)
335; In: DL - Number of Partition (Base=0)
336; Destroyed: None
337PARTSETUP_DrawPartitionInfo Proc Near Uses ax bx cx dx si
338 local NoOfPart :byte
339 mov ch, dl
340 sub ch, PartSetup_UpperPart
341 mov cl, 3 ; 3 - first Position
342 shr ch, 1
343 jnc PSDPI_LeftPos
344 mov cl, 43 ; 43 - second Position
345 PSDPI_LeftPos:
346 add ch, 7 ; CH - Line Location for PartInfo
347 ; We got location
348 mov NoOfPart, dl
349 call VideoIO_Locate
350
351 cmp dl, CFG_Partitions
352 jb PSDPI_GotPartitionData
353 push cx
354 mov al, ' '
355 mov cl, 5
356 call VideoIO_PrintSingleMultiChar
357 pop cx
358 add cl, 7
359 call VideoIO_Locate
360 push cx
361 mov al, ' '
362 mov cl, 11
363 call VideoIO_PrintSingleMultiChar
364 pop cx
365 add cl, 13
366 call VideoIO_Locate
367 push cx
368 mov al, ' '
369 mov cl, 5
370 call VideoIO_PrintSingleMultiChar
371 pop cx
372 add cl, 7
373 call VideoIO_Locate
374 push cx
375 mov al, ' '
376 mov cl, 8
377 call VideoIO_PrintSingleMultiChar
378 pop cx
379 ret
380
381 PSDPI_GotPartitionData:
382 call PART_GetPartitionPointer ; Gets Pointer to Partition (DL) -> SI
383 mov al, NoOfPart
384 inc al
385 call VideoIO_PrintByteNumber
386
387 ; Display "No Hd" field aka "01/01"
388 call VideoIO_Locate
389 push cx
390 mov cx, 0F01h
391 call VideoIO_Color ; Bright White, Blue
392 pop cx
393 mov al, NoOfPart
394 inc al
395 call VideoIO_PrintByteNumber
396 mov al, '/'
397 call VideoIO_PrintSingleChar
398 mov al, [si+LocIPT_Drive]
399 sub al, 7Fh
400 call VideoIO_PrintByteNumber
401
402 ; Display "Label" field e.g. "OS2 " (fixed 11 bytes)
403 add cl, 7
404 call VideoIO_Locate
405 push cx
406 mov cx, 0E01h
407 call VideoIO_Color ; Yellow, Blue
408 push si
409 add si, LocIPT_Name
410 mov cl, 11
411 call VideoIO_FixedPrint
412 pop si
413 pop cx
414
415 ; Display "Flags" field aka "BVHL"
416 add cl, 13
417 call VideoIO_Locate
418 ; This is using a sub-routine for each flag. Is better that way.
419 mov bl, [si+LocIPT_Flags]
420 mov bh, bl
421 mov al, TXT_SETUP_FlagLetterBootable
422 and bl, Flags_Bootable
423 call PARTSETUP_DrawOneFlag
424 mov bl, bh
425 mov al, TXT_SETUP_FlagLetterVIBR
426 and bl, Flags_VIBR_Detection
427 call PARTSETUP_DrawOneFlag
428 mov bl, bh
429 mov al, TXT_SETUP_FlagLetterHide
430 and bl, Flags_HideFeature
431 call PARTSETUP_DrawOneFlag
432 mov bl, bh
433 mov al, TXT_SETUP_FlagLetterDrvLetter
434 and bl, Flags_DriveLetter
435 call PARTSETUP_DrawOneFlag
436 mov bl, bh
437 mov al, TXT_SETUP_FlagLetterExtMShack
438 and bl, Flags_ExtPartMShack
439 call PARTSETUP_DrawOneFlag
440
441 ; Display "Type" field aka "FAT16Big"
442 add cl, 7
443 call VideoIO_Locate
444 push cx
445 mov cx, 0C01h
446 call VideoIO_Color ; Bright Red, Blue
447 pop cx
448 mov al, [si+LocIPT_SystemID]
449 call PART_SearchFileSysName
450 mov cl, 8
451 call VideoIO_FixedPrint
452 ret
453PARTSETUP_DrawPartitionInfo EndP
454
455; In: AL - Flag-Letter
456; BL - ==0 -> Flag not set, =!0 -> Flag set
457; Destroyed: None
458PARTSETUP_DrawOneFlag Proc Near Uses cx
459 mov cx, 0A01h ; Bright Green
460 or bl, bl
461 jnz PSDOF_FlagSet
462 mov ch, 09h ; Bright Blue
463 PSDOF_FlagSet:
464 call VideoIO_Color
465 call VideoIO_PrintSingleChar
466 ret
467PARTSETUP_DrawOneFlag EndP
468
469; In: DL - Current Active (to be inactivated)
470; DH - New Active (to be activated)
471; Destroyed: None
472PARTSETUP_BuildChoiceBar Proc Near
473 cmp dl, dh
474 je PSBCB_SkipRetrace
475 call VideoIO_WaitRetrace
476 PSBCB_SkipRetrace:
477
478 ; Deactivate current active bar
479 mov cl, 10h
480 call PARTSETUP_ReColorPart
481
482 ; Running Fixing
483 cmp dh, 0FFh
484 jne PSBCB_NoUnderflow
485 xor dh, dh
486 PSBCB_NoUnderflow:
487 cmp dh, CFG_Partitions
488 jb PSBCB_NoOverflow
489 mov dh, CFG_Partitions
490 dec dh
491 PSBCB_NoOverflow:
492 mov dl, dh
493
494 ; Do we need to scroll ?
495 mov al, PartSetup_UpperPart
496 cmp dl, al
497 jb PSBCB_YesScrolling
498 add al, 12
499 cmp dl, al
500 jb PSBCB_NoScrolling
501 mov al, dl
502 and al, 0FEh ; UpperPart is never 1/3/5/7/etc.
503 sub al, 10
504 mov PartSetup_UpperPart, al
505 call PARTSETUP_RefreshPartitions
506 jmp PSBCB_NoScrolling
507 PSBCB_YesScrolling:
508 mov al, dl
509 and al, 0FEh ; UpperPart is never 1/3/5/7/etc.
510 mov PartSetup_UpperPart, al
511 call PARTSETUP_RefreshPartitions
512 PSBCB_NoScrolling:
513
514 ; Activate fresh active bar
515 mov cl, 40h
516 call PARTSETUP_ReColorPart
517 ; Now DL==DH
518 ret
519PARTSETUP_BuildChoiceBar EndP
520
521; In: CL - Color, DL - Partition
522; Destroyed: None, but Locate-Pointer
523PARTSETUP_ReColorPart Proc Near Uses bx cx es di
524 mov bh, cl ; Color to BH
525 ; First calculate location of bar
526 cmp dl, PartSetup_UpperPart
527 jb PSRCP_NotInWindowView
528 mov ch, dl
529 sub ch, PartSetup_UpperPart ; CH - Position relative to UpperPart
530 cmp ch, 12 ; 12 - Maximum Total in Window
531 jae PSRCP_NotInWindowView
532 mov cl, 2 ; 2 - first Position
533 mov bl, 39 ; Length of Bar is 39
534 shr ch, 1
535 jnc PSRCP_LeftPos
536 mov cl, 42 ; 42 - second Position
537 dec bl ; Length of Bar is 38
538 PSRCP_LeftPos:
539 add ch, 7 ; Y-Position add-on fixed 7
540 call VideoIO_Locate ; geht zu CX
541 call VideoIO_Internal_SetRegs
542 inc di ; DI - Destination+1 -> Color-Byte
543 mov cl, bl ; Length of Bar is always 39
544 PSRCP_ClearLoop:
545 mov al, es:[di]
546 and al, 0Fh
547 or al, bh ; setzt den Hintergrund (BH)
548 mov es:[di], al
549 add di, 2
550 dec cl
551 jnz PSRCP_ClearLoop
552 PSRCP_NotInWindowView:
553 ret
554PARTSETUP_ReColorPart EndP
555
556; In: CX - Location, DL - UpperPartNo
557; Destroyed: None, but Locate-Pointer
558PARTSETUP_UpperScrollMarker Proc Near Uses ax cx
559 call VideoIO_Locate
560 mov al, ' '
561 or dl, dl
562 jz PSUSM_NoMarker
563 mov al, 1Eh
564 PSUSM_NoMarker:
565 mov cl, 3
566 call VideoIO_PrintSingleMultiChar
567 ret
568PARTSETUP_UpperScrollMarker EndP
569
570; In: CX - Location, DL - UpperPartNo, DH - Limit
571; Destroyed: None, cx dx
572PARTSETUP_LowerScrollMarker Proc Near Uses ax cx
573 call VideoIO_Locate
574 mov al, ' '
575 cmp dl, dh
576 jae PSLSM_NoMarker
577 mov al, 1Fh
578 PSLSM_NoMarker:
579 mov cl, 3
580 call VideoIO_PrintSingleMultiChar
581 ret
582PARTSETUP_LowerScrollMarker EndP
583
584; =============================================================================
585
586; This is called from MBRS_Routines_PartitionSetup
587; In: DL - Partition to ChangeName
588; Destroyed: ax bx cx
589PARTSETUP_ChangePartitionName Proc Near Uses dx ds si di
590 push ds
591 pop es ; we need DS==ES in here for MOVSB etc.
592 call PART_GetPartitionPointer ; Gets the PartitionPointer for DL in SI
593
594 ; First deactivate current active bar
595 mov cl, 10h
596 call PARTSETUP_ReColorPart
597
598 ; Calculate where the Partition-Name is located...
599 mov ch, dl
600 sub ch, PartSetup_UpperPart ; CH - Position relative to UpperPart
601 mov cl, 10 ; 10 - first Position
602 shr ch, 1
603 jnc PSCPN_LeftPos
604 mov cl, 50 ; 50 - second Position
605 PSCPN_LeftPos:
606 add ch, 7 ; Y-Position add-on fixed 7
607 call VideoIO_Locate ; Goes to CX
608
609 mov byte ptr [ChangePartNameSave], 0 ; Don't save to BR / LVM Sector
610
611 ; We compare, if our IPT contains the same partition name as in BR or LVM
612 ; This is done for security purposes, because if they match, we will update
613 ; the name in both - IPT and BR/LVM.
614
615 ;movzx bx, dl
616 mov bl,dl
617 mov bh,0
618
619 cmp byte ptr [PartitionVolumeLetters+bx], 0 ; ==0 means not supported by LVM
620 je PSCPN_NotLVMSupported
621
622 ;
623 ; BOOKMARK: LVM Label Manipulations
624 ;
625
626 ; ------------------------------------------------------------[LVM CHECK]---
627 ; Load LVM-Sector here and seek to PartitionName
628 ; Set CurPartition_Location information of destination partition
629 mov ax, [si+LocIPT_AbsolutePartTable]
630 mov [CurPartition_Location+0], ax
631 mov ax, [si+LocIPT_AbsolutePartTable+2]
632 mov [CurPartition_Location+2], ax
633 mov ah, byte ptr [si+LocIPT_LocationPartTable+0]
634 mov al, byte ptr [si+LocIPT_Drive]
635 mov [CurPartition_Location+4], ax
636 mov ax, [si+LocIPT_LocationPartTable+1]
637 mov [CurPartition_Location+6], ax
638 mov di, si ; Put SI into DI
639 call DriveIO_LoadLVMSector
640 jnc PSCPN_LVMGotError ; Security again, if problem -> halt
641 push dx
642 mov ax, [di+LocIPT_AbsoluteBegin]
643 mov dx, [di+LocIPT_AbsoluteBegin+2]
644 call LVM_SearchForPartition
645 pop dx
646 jnc PSCPN_LVMGotError ; Not Found? -> display error and halt
647
648
649 ; Point to LVM VolumeName
650 add si, LocLVM_VolumeName
651
652
653 xchg si, di ; SI-IPTEntry, DI-LVM PartName
654 jmp PSCPN_CheckPartName ; Check, if match...
655
656
657
658 PSCPN_LVMGotError:
659 jmp MBR_LoadError
660
661
662
663 ; mov si, di ; Restore SI and bootrecord fall-back
664 PSCPN_NotLVMSupported:
665 ; ----------------------------------------------------[BOOT-RECORD CHECK]---
666 ; Load Boot-Record...
667 ; BOOKMARK: Load Boot Record
668 push dx
669 mov ax, [si+LocIPT_AbsoluteBegin+0]
670 mov bx, [si+LocIPT_AbsoluteBegin+2]
671 mov cx, [si+LocIPT_LocationBegin+1]
672 mov dh, [si+LocIPT_LocationBegin+0]
673 mov dl, [si+LocIPT_Drive]
674 call DriveIO_LoadPartition
675 pop dx
676
677 ; We seek to Partition Label within boot-record here
678 mov di, offset PartitionSector
679
680 push si
681 mov al, [si+LocIPT_SystemID]
682 call PART_SearchFileSysName
683 ; Replies AH - FileSysFlags, AL - UnhiddenID, SI - FileSysNamePtr
684 pop si
685
686 test ah, FileSysFlags_NoName ; If NoName by FileSysFlag
687 jnz PSCPN_LetUserEditPartName ; -> don't put it into BR at anytime
688 test ah, FileSysFlags_FAT32 ; FAT32 specific name getting
689 jz PSCPN_ResumeNormal
690 add di, 1Ch ; Fix for FAT 32, shit
691 PSCPN_ResumeNormal:
692 add di, 2Bh ; ES:DI - Name of Partition
693
694
695
696
697
698 ; This code is used for BR and LVM checking
699 ; Rousseau: Because AiR-BOOT v1.0.8+ uses the LVM_VolumeName, which is copied
700 ; to the IPT, this compare fails when the LVM_PartitionName is not
701 ; the same as the LVM_VolumeName. In that case, only the LVM_VolumeName
702 ; is updated. If they are the same, both are upated so they are the same
703 ; again after the edit.
704
705 PSCPN_CheckPartName:
706
707 ; Do no synchronization initially.
708 mov byte ptr [SyncLvmLabels],0
709
710 ; SI = IPT_Enty, DI points to LVM VolumeName.
711
712 ; If the partition is an LVM partition then disable editing completely.
713 cmp byte ptr [si+LocIPT_SystemID], 035h
714 jnz no_type_35h
715
716 ; Cannot boot LVM-Data partitions
717 pusha
718 mov cx, 0C04h
719 mov si, offset TXT_SETUP_NoEditType35
720 call SETUP_ShowErrorBox
721 popa
722
723
724 jmp PSCPN_AllDone
725
726 ; SI = IPT_Enty, DI points to LVM VolumeName.
727 no_type_35h:
728
729 ;
730 ; Compare LVM VolumeName and PartitionName and
731 ; set flag if they are the same and need to be synced after user edit.
732 ;
733 push si
734 push di
735 mov si,di ; Pointer to LVM V-name in SI
736 add di,LocLVM_LabelLen ; Pointer to LVM P-name in DI
737 mov cx,LocLVM_LabelLen ; Length of LVM label
738 cld
739 repe cmpsb ; Compare V and P labels
740 jnz LVM_Labels_not_equal
741 mov byte ptr [SyncLvmLabels],1 ; Same so set flag for later
742 LVM_Labels_not_equal:
743 pop di
744 pop si
745
746
747 mov cx, 11 ; Partition-Name-Length = 11 Bytes
748 push si
749 push di
750 add si, LocIPT_Name ; DS:SI -> Partition-Name
751 repz cmpsb
752 pop di
753 pop si
754 jne PSCPN_LetUserEditPartName ; -> No BR/LVM Changing/Saving
755
756 mov byte ptr [ChangePartNameSave], 1 ; Remember, so we will save to BR
757
758 ; SI = IPT_Enty, DI points to LVM PartitionName.
759 PSCPN_LetUserEditPartName:
760 ; User will now edit the volume label...
761 mov cx, 11
762 add si, LocIPT_Name ; DS:SI -> Partition-Name
763 call VideoIO_LetUserEditString ; -> does actual editing
764 jnc PSCPN_AllDone ; Did user abort ?
765
766 test byte ptr [ChangePartNameSave], 1
767 jz PSCPN_AllDone ; Actually we just skip BR/LVM-Save
768
769 ; Check, where to save 2nd destination to...
770
771 ;movzx bx, dl
772 mov bl,dl
773 mov bh,0
774
775 cmp byte ptr [PartitionVolumeLetters+bx], 0 ; ==0 means not supported by LVM
776 je PSCPN_SaveBootRecord
777
778
779 ; Make DI point to LVM VolumeName in LVM-entry
780 ;~ sub di,20
781
782 ; Points to LVM VolumeName.
783 push di
784
785 ; -------------------------------------------------[LVM SAVE VOLUME NAME]---
786 ; Copy 11 bytes from IPT into LVM VolumeName, back-padd with zero's
787 mov cx, 11
788 push si
789 rep movsb
790 pop si
791
792 ; Padd with zero's, but the editor still might have left spaces
793 ; at the end of the 11-byte part. We correct that below.
794 xor al, al
795 mov cx, 9
796 rep stosb
797
798
799 ;
800 ; The AiR-BOOT Label Editor inserts spaces when a label is edited
801 ; and characters are backspaced.
802 ; This is fine for filesystem labels, which are space padded,
803 ; but the LVM VolumeName and PartitionName need to be zero padded.
804 ; So, below we replace all trailing spaces with zero's.
805 ;
806 ; Correct LVM VolumeName
807 ;
808 mov cx,20
809 vn_padd_next:
810 jcxz vn_padded
811 dec di
812 dec cx
813 mov al,[di]
814 test al,al
815 jz vn_padd_next
816 cmp al,' '
817 jnz vn_padded
818 mov byte ptr [di],0
819 jmp vn_padd_next
820 vn_padded:
821
822 ; Points to LVM VolumeName
823 pop di
824
825 ; See if LVM-labels need to be synced.
826 test byte ptr [SyncLvmLabels],1
827 jz LVM_no_sync_labels
828
829 ; Sync LVM-labels.
830 mov si,di
831 add di,LocLVM_LabelLen
832 mov cx,LocLVM_LabelLen
833 cld
834 rep movsb
835
836
837 LVM_no_sync_labels:
838 ; Update LVM-CRC now...
839 mov si, offset LVMSector
840 call LVM_UpdateSectorCRC
841 IFDEF ReleaseCode
842 call DriveIO_SaveLVMSector ; Save sector
843 ENDIF
844 jmp PSCPN_AllDone
845
846 ; -----------------------------------------------------[BOOT-RECORD SAVE]---
847 ; BOOKMARK: Save Boot Record (After change from Setup Menu)
848 PSCPN_SaveBootRecord:
849 ; Copy 11 bytes from IPT to Boot-Record
850 mov cx, 11
851 push si
852 rep movsb ; Copy IPT-name to Boot-Record
853 pop si
854 IFDEF ReleaseCode
855 call DriveIO_SavePartition ; Saves Boot-Record
856 ENDIF
857
858 ; And reset VIBR-CRC, otherwise virus-warning and system-halt
859 ; BOOKMARK: Update CRC on Partition Sector
860 sub si, LocIPT_Name ; Now pointer points to base again...
861 mov bx, offset [PartitionSector]
862 call PART_UpdateBootRecordCRC
863
864 PSCPN_AllDone:
865 ; This here is done for safety, because we misused CurPartition_Location
866 xor ax, ax
867 mov di, offset CurPartition_Location
868 mov cx, 4
869 rep stosw ; NUL out CurPartition_Location
870 ret
871PARTSETUP_ChangePartitionName EndP
872
873; =============================================================================
874; This is called from MBRS_Routines_PartitionSetup
875; In: DL - Partition to HiddenSetup
876; Destroyed: ax
877PARTHIDESETUP_Main Proc Near Uses dx
878 ; Spread Special-Marker from Hide-Config
879 call PARTHIDESETUP_GetHideConfigAndSpread
880 ; Calculate Position of Window.
881 ; If Partition Selected Left-Side -> go Right-Sided Window
882 ; otherwise Left-Sided.
883 mov [PartSetup_ActivePart], dl
884 mov ax, 0102h
885 and dl, 1
886 jnz PHSM_FirstStep
887 mov ax, 002Ah
888 PHSM_FirstStep:
889 mov [PartSetup_HiddenX], al
890 mov [PartSetup_HiddenAdd], ah
891
892 ; Draw Menu...
893 xor dx, dx
894 mov [PartSetup_HiddenUpper], dl
895 call PARTHIDESETUP_DrawMenuBase
896 call PARTHIDESETUP_RefreshPartitions
897 ; Show Choice-Bar at DH...
898 call PARTHIDESETUP_BuildChoiceBar
899
900 ; Now we got everything on-the-screen
901 PHSM_MainLoop:
902 mov ah, 0
903 int 16h
904 cmp ah, Keys_Up
905 je PHSM_KeyUp
906 cmp ah, Keys_Down
907 je PHSM_KeyDown
908 cmp ah, Keys_ESC
909 je PHSM_KeyESC
910 cmp ah, Keys_F1
911 je PHSM_KeyF1
912 cmp ah, Keys_ENTER
913 je PHSM_KeyToogle
914 cmp ah, Keys_Plus
915 je PHSM_KeyToogle
916 cmp ah, Keys_Minus
917 je PHSM_KeyToogle
918 cmp ah, Keys_GrayPlus
919 je PHSM_KeyToogle
920 cmp ah, Keys_GrayMinus
921 je PHSM_KeyToogle
922 cmp ah, Keys_PageDown
923 je PHSM_KeyToogle
924 cmp ah, Keys_PageUp
925 je PHSM_KeyToogle
926 ; ASCII values...
927 cmp al, Keys_Space
928 je PHSM_KeyToogle
929 jmp PHSM_MainLoop
930
931 PHSM_KeyESC:
932 ; Collect Hide-Partition-Config and put it into Hide-Table
933 mov dl, [PartSetup_ActivePart]
934
935IFDEF AUX_DEBUG
936 ;~ pusha
937 ;~ mov al,dl ; Partition the hiding is set for.
938 ;~ call AuxIO_TeletypeHexByte
939 ;~ call AuxIO_TeletypeNL
940 ;~ popa
941ENDIF
942
943 call PARTHIDESETUP_CollectHideConfigAndPutToTable
944 ; Simply return to Partition Setup
945 ret
946
947 PHSM_KeyUp:
948 dec dh
949 call PARTHIDESETUP_BuildChoiceBar
950 jmp PHSM_MainLoop
951
952 PHSM_KeyDown:
953 inc dh
954 call PARTHIDESETUP_BuildChoiceBar
955 jmp PHSM_MainLoop
956
957 PHSM_KeyToogle:
958
959IFDEF AUX_DEBUG
960 ;~ pusha
961 ;~ mov al,dl ; Index of partition to set Special Marker on.
962 ;~ call AuxIO_TeletypeHexByte
963 ;~ call AuxIO_TeletypeNL
964 ;~ popa
965ENDIF
966
967 call PART_GetPartitionPointer ; Holt den Pointer der Partition (DL) nach SI
968 mov al, [si+LocIPT_Flags]
969 xor al, Flags_SpecialMarker
970 mov [si+LocIPT_Flags], al
971 call PARTHIDESETUP_DrawPartitionInfo
972 call PARTHIDESETUP_BuildChoiceBar
973 jmp PHSM_MainLoop
974
975 PHSM_KeyF1:
976 mov bx, offset TXT_SETUPHELP_HideSetup
977 call SETUP_ShowHelp ; Shows help
978 jmp PHSM_MainLoop
979PARTHIDESETUP_Main EndP
980
981; Draw all standard-things for HiddenSetup, dynamic content not included.
982PARTHIDESETUP_DrawMenuBase Proc Near Uses dx
983 ; PartSetup_HiddenX1
984
985CLR_PART_HIDE_WINDOW_BASE_CLASSIC = 0d05h
986CLR_PART_HIDE_WINDOW_BASE_BM = 0a02h
987
988 mov cx, CLR_PART_HIDE_WINDOW_BASE_BM ; Lila on lila
989 call VideoIO_Color
990 mov bh, 05h
991 mov bl, [PartSetup_HiddenX]
992 mov dh, 10h
993 mov dl, bl
994 add dl, 25h
995 add dl, [PartSetup_HiddenAdd]
996 push bx
997 call VideoIO_MakeWindow
998 pop bx
999 ; --- Make Window-Header - "Hide Feature" at top frame-line
1000 inc bl
1001 mov cx, bx
1002 call VideoIO_Locate
1003 mov al, 'µ'
1004 call VideoIO_PrintSingleChar
1005
1006CLR_PART_HIDE_WINDOW_LABEL_CLASSIC = 0e05h
1007CLR_PART_HIDE_WINDOW_LABEL_BM = 0e02h
1008
1009 mov cx, CLR_PART_HIDE_WINDOW_LABEL_BM ; Yellow on Lila
1010 call VideoIO_Color
1011 mov si, offset TXT_SETUP_HideFeature
1012 call VideoIO_Print
1013
1014CLR_PART_HIDE_WINDOW_BORDER_CLASSIC = 0d05h
1015CLR_PART_HIDE_WINDOW_BORDER_BM = 0d02h
1016
1017
1018 mov cx, CLR_PART_HIDE_WINDOW_BORDER_BM ; Lila on lila
1019 call VideoIO_Color
1020 mov al, 'Æ'
1021 call VideoIO_PrintSingleChar
1022 ; --- Make Window-Footer - "State when booting..." at bottom right frame-line
1023 mov dh, 10h
1024 mov dl, [PartSetup_HiddenX]
1025 add dl, 25h
1026 add dl, [PartSetup_HiddenAdd] ; Location 16, HiddenX->right aligned
1027 mov si, offset TXT_SETUP_HideFeature2
1028 call GetLenOfString ; CX - Length of HideFeature2
1029 sub dl, cl ; Adjust Position
1030 push dx
1031 mov dl, [PartSetup_ActivePart]
1032 call PART_GetPartitionPointer ; Holt den Pointer der Partition (DL) nach SI
1033 pop dx
1034 ; Display "Label" field without ending NULs/Spaces
1035 add si, LocIPT_Name
1036 mov cx, 11
1037 call GetLenOfName
1038 sub dl, cl ; Adjust position
1039 sub dl, 2
1040 push cx
1041 push si ; SI == Label Field
1042 mov cx, dx
1043 call VideoIO_Locate
1044 mov al, '<'
1045 call VideoIO_PrintSingleChar
1046 mov si, offset TXT_SETUP_HideFeature2
1047 call VideoIO_Print
1048 pop si
1049 pop cx
1050 call VideoIO_FixedPrint
1051 mov al, '>'
1052 call VideoIO_PrintSingleChar
1053
1054; inc cl
1055; call MBR_Locate ; Location 16, HiddenX
1056; mov al, 'µ'
1057; call MBR_PrintSingleChar
1058; mov cx, 0E05h ; Yellow on Lila
1059; call MBR_Color
1060; mov si, offset TXT_SETUP_HideFeature2
1061; call MBR_Print
1062; mov dl, PartSetup_ActivePart
1063; call MBR_Part_GetPartitionPointer ; Holt den Pointer der Partition (DL) nach SI
1064; ; Display "Label" field without ending NULs/Spaces
1065; add si, LocIPT_Name
1066; mov cx, 11
1067; call MBR_GetLenOfName
1068; call MBR_FixedPrint
1069; mov cx, 0D05h ; Lila on lila
1070; call MBR_Color
1071; mov al, 'Æ'
1072; call MBR_PrintSingleChar
1073
1074 ; --- Make ':' Line down
1075
1076CLR_PART_HIDE_MENU_BASE_CLASSIC = 0f05h
1077CLR_PART_HIDE_MENU_BASE_BM = 0f02h
1078
1079 mov cx, CLR_PART_HIDE_MENU_BASE_BM ; Yellow on Lila
1080 call VideoIO_Color
1081 mov ch, 07h
1082 mov cl, PartSetup_HiddenX
1083 add cl, 24
1084 add cl, PartSetup_HiddenAdd
1085 call VideoIO_Locate
1086 mov al, ':'
1087 mov cl, 8
1088 call VideoIO_Internal_MakeWinDown
1089 ret
1090PARTHIDESETUP_DrawMenuBase EndP
1091
1092; Draw all partitions to Hidden-Setup aka Dynamic Content-Draw
1093PARTHIDESETUP_RefreshPartitions Proc Near Uses dx
1094 mov dl, [PartSetup_HiddenUpper]
1095 mov dh, 8
1096 PHSRP_Loop:
1097 call PARTHIDESETUP_DrawPartitionInfo
1098 inc dl
1099 dec dh
1100 jnz PHSRP_Loop
1101
1102CLR_PART_HIDE_MENU_MARKERS_CLASSIC = 0d05h
1103CLR_PART_HIDE_MENU_MARKERS_BM = 0a02h
1104
1105 ; At last calculate Scroll-Markers
1106 mov cx, CLR_PART_HIDE_MENU_MARKERS_BM ; Lila on lila ; Hide Feature Markers
1107 call VideoIO_Color
1108 mov cx, 0603h ; 6, +3
1109 add cl, [PartSetup_HiddenX]
1110 mov dl, [PartSetup_HiddenUpper]
1111 call PARTSETUP_UpperScrollMarker
1112 add cl, 29
1113 add cl, [PartSetup_HiddenAdd] ; 6, +29
1114 call PARTSETUP_UpperScrollMarker
1115 mov cx, 0F03h ; 15, +3
1116 add cl, [PartSetup_HiddenX]
1117 add dl, 8 ; add 8 -> points to last partition
1118 mov dh, [CFG_Partitions] ; Limit
1119 call PARTSETUP_LowerScrollMarker
1120 add cl, 29
1121 add cl, [PartSetup_HiddenAdd] ; 6, +29
1122 call PARTSETUP_LowerScrollMarker
1123 ret
1124PARTHIDESETUP_RefreshPartitions EndP
1125
1126PARTHIDESETUP_DrawPartitionInfo Proc Near Uses dx
1127 local NoOfPart :byte
1128 mov ch, dl
1129 sub ch, [PartSetup_HiddenUpper]
1130 add ch, 7
1131 mov cl, 2
1132 add cl, [PartSetup_HiddenX]
1133 ; We got location
1134 mov NoOfPart, dl
1135 call VideoIO_Locate
1136
1137 ; Clean data-area...
1138 push cx
1139 mov al, ' '
1140 mov cl, 22
1141 call VideoIO_PrintSingleMultiChar
1142 pop cx
1143
1144 cmp dl, [CFG_Partitions]
1145 jae PHSDPI_NoData
1146
1147 call PART_GetPartitionPointer ; Holt den Pointer der Partition (DL) nach SI
1148 call VideoIO_Locate
1149 push cx
1150 ; Display "Label" field aka "OS2" without ending NULs/Spaces
1151
1152CLR_PART_HIDE_LABEL_CLASSIC = 0f05h
1153CLR_PART_HIDE_LABEL_BM = 0f02h
1154
1155 mov cx, CLR_PART_HIDE_LABEL_BM
1156 call VideoIO_Color ; Bright White on Lila
1157 push si
1158 add si, LocIPT_Name
1159 mov cx, 11
1160 call GetLenOfName
1161 call VideoIO_FixedPrint
1162 pop si
1163
1164CLR_PART_HIDE_WINDOW_FS_CLASSIC = 0d05h
1165CLR_PART_HIDE_WINDOW_FS_BM = 0a02h
1166
1167 mov cx, CLR_PART_HIDE_WINDOW_FS_BM
1168 call VideoIO_Color ; Bright Lila on Lila
1169 mov al, ' '
1170 call VideoIO_PrintSingleChar
1171 mov al, '['
1172 call VideoIO_PrintSingleChar
1173 ; Display "Type" field aka "HPFS" without ending NULs/Spaces
1174 push si
1175 mov al, [si+LocIPT_SystemID]
1176 call PART_SearchFileSysName
1177 mov cx, 8
1178 call GetLenOfName
1179 call VideoIO_FixedPrint
1180 pop si
1181 mov al, ']'
1182 call VideoIO_PrintSingleChar
1183 pop cx
1184 add cl, 24
1185 add cl, PartSetup_HiddenAdd
1186 call VideoIO_Locate
1187 push cx
1188
1189CLR_PART_HIDE_WINDOW_CHOISES_CLASSIC = 0e05h
1190CLR_PART_HIDE_WINDOW_CHOISES_BM = 0e02h
1191
1192 mov cx, CLR_PART_HIDE_WINDOW_CHOISES_BM
1193 call VideoIO_Color ; Yellow on Lila
1194 mov al, ' '
1195 mov cl, 10
1196 call VideoIO_PrintSingleMultiChar ; Fill up area with spaces
1197 ; Finally draw Hidden/Unhidden
1198 mov bl, [si+LocIPT_Flags]
1199 mov si, offset TXT_SETUP_MAGIC_Unhidden
1200 and bl, Flags_SpecialMarker
1201 jz PHSDPI_IsNotHidden
1202 mov si, offset TXT_SETUP_MAGIC_Hidden
1203 PHSDPI_IsNotHidden:
1204 call GetLenOfString
1205 mov dx, cx
1206 pop cx
1207 add cx, 10
1208 sub cx, dx
1209 call VideoIO_Locate
1210 call VideoIO_Print
1211 PHSDPI_NoData:
1212 ret
1213PARTHIDESETUP_DrawPartitionInfo EndP
1214
1215; In: DL - Current Active (to be inactivated)
1216; DH - New Active (to be activated)
1217; Destroyed: None
1218PARTHIDESETUP_BuildChoiceBar Proc Near
1219 cmp dl, dh
1220 je PHSBCB_SkipRetrace
1221 call VideoIO_WaitRetrace
1222 PHSBCB_SkipRetrace:
1223
1224CLR_PART_HIDE_WINDOW_MENU_BAR_CLASSIC = 5eh
1225CLR_PART_HIDE_WINDOW_MENU_BAR_BM = 2eh
1226
1227 ; Deactivate current active bar
1228 mov cl, CLR_PART_HIDE_WINDOW_MENU_BAR_BM ; Yellow on Lila
1229 call PARTHIDESETUP_ReColorPart
1230
1231 ; Running Fixing
1232 cmp dh, 0FFh
1233 jne PHSBCB_NoUnderflow
1234 xor dh, dh
1235 PHSBCB_NoUnderflow:
1236 cmp dh, [CFG_Partitions]
1237 jb PHSBCB_NoOverflow
1238 mov dh, [CFG_Partitions]
1239 dec dh
1240 PHSBCB_NoOverflow:
1241 mov dl, dh
1242
1243 ; Do we need to scroll ?
1244 mov al, [PartSetup_HiddenUpper]
1245 cmp dl, al
1246 jb PHSBCB_YesScrolling
1247 add al, 8
1248 cmp dl, al
1249 jb PHSBCB_NoScrolling
1250 mov al, dl
1251 sub al, 7
1252 mov [PartSetup_HiddenUpper], al
1253 call PARTHIDESETUP_RefreshPartitions
1254 jmp PHSBCB_NoScrolling
1255 PHSBCB_YesScrolling:
1256 mov al, dl
1257 mov [PartSetup_HiddenUpper], al
1258 call PARTHIDESETUP_RefreshPartitions
1259 PHSBCB_NoScrolling:
1260
1261 ; Activate fresh active bar
1262
1263CLR_PART_HIDE_WINDOW_MENU_ACTIVE_BAR_CLASSIC = 1fh
1264CLR_PART_HIDE_WINDOW_MENU_ACTIVE_BAR_BM = 1fh
1265
1266 mov cl, CLR_PART_HIDE_WINDOW_MENU_ACTIVE_BAR_BM ; Bright White on Blue
1267 call PARTHIDESETUP_ReColorPart
1268 ; Now DL==DH
1269 ret
1270PARTHIDESETUP_BuildChoiceBar EndP
1271
1272; In: CL - Color, DL - Partition
1273; Destroyed: None, but Locate-Pointer
1274PARTHIDESETUP_ReColorPart Proc Near Uses bx cx es di
1275 mov bh, cl ; Color to BH
1276 ; First calculate location of bar
1277 cmp dl, [PartSetup_HiddenUpper]
1278 jb PHSRCP_NotInWindowView
1279 mov ch, dl
1280 sub ch, [PartSetup_HiddenUpper] ; CH - Position relative to HiddenUpper
1281 cmp ch, 8 ; 8 - Maximum Total in Window
1282 jae PHSRCP_NotInWindowView
1283 add ch, 7
1284 mov cl, 26
1285 add cl, [PartSetup_HiddenX]
1286 add cl, [PartSetup_HiddenAdd]
1287
1288 mov bl, 10 ; Length of Bar is 10
1289 call VideoIO_Locate ; geht zu CX
1290 call VideoIO_Internal_SetRegs
1291 inc di ; DI - Destination+1 -> Color-Byte
1292 mov cl, bl ; Length of Bar is always 39
1293 PHSRCP_ClearLoop:
1294 mov es:[di], bh
1295 add di, 2
1296 dec cl
1297 jnz PHSRCP_ClearLoop
1298 PHSRCP_NotInWindowView:
1299 ret
1300PARTHIDESETUP_ReColorPart EndP
1301
1302; =============================================================================
1303
1304
1305;
1306; Rousseau: Adjusted for packed hidden-part-table !
1307; Needs to be re-written.
1308;
1309; This is called by MBRS_PS_HiddenSetup
1310; In: DL - Partition, where to save Hide-Config
1311; Destroyed: None, but Locate-Pointer
1312PARTHIDESETUP_GetHideConfigAndSpread Proc Near Uses ax bx dx si di
1313 ; First check HideFeature-Flag on selected partition.
1314 ; if it's not set, don't do anything...
1315 call PART_GetPartitionPointer ; Holt den Pointer der Partition (DL) nach SI
1316 mov al, [si+LocIPT_Flags]
1317 test al, Flags_HideFeature
1318 jz PHSGHCAS_EndOfEntries
1319 PHSGHCAS_SomethingHidden:
1320 ; Calculate, where to get Hide-Config
1321 mov ax, LocHPT_LenOfHPT ; Size of a hidden-part-table entry.
1322 mul dl ; Multiply by partition-index.
1323 mov di, offset HidePartitionTable
1324 add di, ax ; We got the pointer
1325
1326 ; So process Hide-Config. Read out Bitfield-Entries,
1327 ; each points to a partition.
1328 ; 3Fh is end-marker / maximum entries = CFG_Partitions
1329 mov cl, [CFG_Partitions]
1330 mov bx,di ; Pointer to hidden-parts entry for this partition.
1331 mov ch,0 ; Start index in hidden-parts entry for this partition.
1332 mov dh,6 ; Bitfields are 6 bits wide.
1333 PHSGHCAS_SpreadLoop:
1334 mov dl,ch ; Load bitfield index from CH.
1335 call CONV_GetBitfieldValue ; Get value of bitfield.
1336 mov dl,al ; Partition index in DL.
1337 ;~ mov dl, [di]
1338 ;~ inc di
1339 ;~ cmp dl, 0FFh
1340 cmp dl,3fh ; Max value for 6-bits field.
1341 je PHSGHCAS_EndOfEntries
1342 call PART_GetPartitionPointer ; Pointer for partition DL to SI
1343 mov al, [si+LocIPT_Flags]
1344 or al, Flags_SpecialMarker ; Set marker
1345 mov [si+LocIPT_Flags], al
1346 inc ch ; Next bitfield.
1347 dec cl
1348 jnz PHSGHCAS_SpreadLoop
1349 PHSGHCAS_EndOfEntries:
1350 ret
1351PARTHIDESETUP_GetHideConfigAndSpread EndP
1352
1353
1354;
1355; Rousseau: Adjusted for packed hidden-part-table !
1356; Needs to be re-written.
1357;
1358; This is called by MBRS_PS_HiddenSetup
1359; In: DL - Partition, where to save Hide-Config
1360; Destroyed: None, but Locate-Pointer
1361PARTHIDESETUP_CollectHideConfigAndPutToTable Proc Near Uses ax si es di
1362 ; First calculate, where to put Hide-Config
1363 ;~ mov ax, LocIPT_MaxPartitions
1364 mov ax, LocHPT_LenOfHPT ; Length of an HPT-entry.
1365 mul dl ; Partition to store info for.
1366 push cs
1367 pop es
1368 mov di, offset HidePartitionTable ; Packed hideparttable.
1369 add di, ax ; We got the pointer in DI.
1370
1371 ;~ push di
1372
1373 ; Fill hide-part-table entry with 'unused' marker.
1374 ; Note that the entry is actually an array of 45 6-bit bitfields.
1375 ; Below fills 34 bytes = 45 6-bit bitfields.
1376 push di
1377 mov cx, LocHPT_LenOfHPT
1378 mov al, 0FFh
1379 rep stosb ; Fill up with FFh
1380 pop di
1381
1382 ;~ mov bp,di
1383
1384 ; Now walk through the IPT collecting all SpecialMarkers.
1385 ; For each do a bitfield-entry containing the number of the partition.
1386 mov si, offset PartitionTable
1387 xor ch, ch ; Partition index
1388 mov cl, [CFG_Partitions] ; Nr. of partitions in IPT
1389 mov ah,0 ; Next hide-index to write.
1390
1391 ;
1392 ; Collect all partitions that have the special marker set.
1393 ; This marker was set by toggling the hide/unhide option in the setup menu.
1394 ;
1395 PHSCHCAPTT_CollectLoop:
1396
1397 ; Get marker and test it.
1398 mov bl, [si+LocIPT_Flags]
1399 test bl, Flags_SpecialMarker
1400
1401 ; No marker.
1402 jz PHSCHCAPTT_NoMarker
1403
1404 ; Setup stuff for bitfield operation.
1405 push dx ; Save partition pointer.
1406 push bx ; Save marker.
1407 mov bx,di ; Get pointer to HPT-entry.
1408 mov dl,ah ; Index in entry.
1409 mov dh,6 ; Bitfield width.
1410 push ax ; Save index.
1411 mov al,ch ; Partition index to store.
1412
1413
1414 IFDEF AUX_DEBUG
1415 ;~ pushf
1416 ;~ pusha
1417 ;~ push ax
1418 ;~ mov al,dl
1419 ;~ call AuxIO_TeletypeHexByte
1420 ;~ mov al,':'
1421 ;~ call AuxIO_Teletype
1422 ;~ mov ax,bx
1423 ;~ call AuxIO_TeletypeHexWord
1424 ;~ mov al,':'
1425 ;~ call AuxIO_Teletype
1426 ;~ mov ax,bp
1427 ;~ call AuxIO_TeletypeHexWord
1428 ;~ mov al,':'
1429 ;~ call AuxIO_Teletype
1430 ;~ mov ax,sp
1431 ;~ call AuxIO_TeletypeHexWord
1432 ;~ mov al,':'
1433 ;~ call AuxIO_Teletype
1434 ;~ pop ax
1435 ;~ call AuxIO_TeletypeHexByte
1436 ;~ call AuxIO_TeletypeNL
1437 ;~ popa
1438 ;~ popf
1439 ENDIF
1440
1441 call CONV_SetBitfieldValue ; Store bitfield.
1442 pop ax ; Restore index.
1443 pop bx ; Restore marker.
1444 pop dx ; Restore partition pointer.
1445
1446 inc ah ; Advance to next index.
1447
1448 ;~ mov ds:[di], ch ; Write byte-Entry
1449 ;~ inc di
1450 xor bl, Flags_SpecialMarker ; Reset Flag
1451 mov [si+LocIPT_Flags], bl ; Store it in IPT
1452
1453
1454 PHSCHCAPTT_NoMarker:
1455 add si, LocIPT_LenOfIPT ; Advance to next partition in IPT.
1456 inc ch ; Next partition-index.
1457 dec cl ; Decrement partitions to process.
1458 jnz PHSCHCAPTT_CollectLoop ; Are we done yet ?
1459
1460 ;~ pop si ; Original Hide-Config Pointer -> SI
1461 ; Now check, if we have written anything
1462 ;~ cmp si, di
1463 test ah,ah ; See if we had to store anything.
1464 jne PHSCHCAPTT_SomethingToHide ; Yep, go to write end-marker.
1465
1466 ; Nothing to hide...so UNSET the Hidden-Feature Flag
1467 call PART_GetPartitionPointer ; Use DL to get part-pointer in SI.
1468 mov al, [si+LocIPT_Flags] ; Get flags.
1469 mov ah, Flags_HideFeature ; Hide mask.
1470 not ah ; Complement.
1471 and al, ah ; Clear hide-flag.
1472 mov [si+LocIPT_Flags], al ; Store it.
1473 ;~ pop bp
1474 ret ; Return to caller.
1475
1476 PHSCHCAPTT_SomethingToHide:
1477 cmp ah, LocIPT_MaxPartitions ; See if index is at end.
1478 jae PHSCHCAPTT_AllUsed ; Yep, no need to store end-marker.
1479
1480 ; Write end-marker.
1481 push dx ; Save partition pointer.
1482 mov al,3fh ; End marker (6-bit)
1483 mov dl,ah ; Index in HPT-entry.
1484 mov dh,6 ; Bitfield width.
1485 mov bx,di ; Get pointer to HPT-entry.
1486 call CONV_SetBitfieldValue ; Store end-marker.
1487 pop dx ; Restore partition pointer.
1488
1489 ;~ mov ax, si
1490 ;~ add ax, LocIPT_MaxPartitions
1491 ;~ cmp di, ax
1492 ;~ jae PHSCHCAPTT_AllUsed
1493 ; Set END-marker
1494 ;~ mov al, 0FFh
1495 ;~ stosb ; Write byte-Entry
1496 PHSCHCAPTT_AllUsed:
1497
1498 ; Something to hide...so SET the Hidden-Feature Flag
1499 call PART_GetPartitionPointer ; Use DL to get part-pointer in SI.
1500 mov al, [si+LocIPT_Flags] ; Get flags.
1501 or al, Flags_HideFeature ; Set hide-flag.
1502 mov [si+LocIPT_Flags], al ; Store it.
1503 ;~ pop bp
1504 ret ; Return to caller.
1505PARTHIDESETUP_CollectHideConfigAndPutToTable EndP
1506
1507; =============================================================================
1508
1509; This is called from MBRS_Routines_PartitionSetup
1510; In: DL - Partition to LogicalDriveLetter-Setup
1511; Destroyed: ax
1512PARTSETUP_DriveLetterSetup Proc Near Uses dx si es di
1513 call PART_GetPartitionPointer ; Gets the PartitionPointer for DL in SI
1514 ; SystemID must support DriveLetter feature (FAT16, HPFS, JFS)
1515 mov al, bptr [si+LocIPT_SystemID]
1516 push si
1517 call PART_SearchFileSysName
1518 pop si
1519 test ah, FileSysFlags_DriveLetter
1520 jnz PSDLS_GotLDLP
1521
1522 ; Drive-Letter feature only possible on HPFS/FAT16 (OS/2) systems
1523 mov cx, 0C04h
1524 mov si, offset TXT_SETUP_NoLDLpartition
1525 call SETUP_ShowErrorBox
1526 ret
1527
1528 PSDLS_GotLDLP:
1529 ; First build up menu and display current setting...
1530 call PARTSETUPDL_DrawMenuBase ; DL - partition-no
1531
1532 ; Now get the Logical-Drive-Letter for that partition...
1533 ;movzx bx, dl
1534 mov bl,dl
1535 mov bh,0
1536
1537 mov dl, byte ptr [DriveLetters+bx]
1538
1539 push bx
1540 ; DS:SI - IPT Entry of Partition, DL - LogicalDriveLetter
1541 call PARTSETUPDL_DrawDriveLetter
1542
1543 ; Now we got everything on-the-screen
1544 PSDLS_MainLoop:
1545 mov ah, 0
1546 int 16h
1547 cmp ah, Keys_Backspace
1548 je PSDLS_BackSpace
1549 cmp ah, Keys_Up
1550 je PSDLS_KeyUp
1551 cmp ah, Keys_Down
1552 je PSDLS_KeyDown
1553 cmp ah, Keys_ESC
1554 je PSDLS_KeyDONE
1555 cmp ah, Keys_ENTER
1556 je PSDLS_KeyDONE
1557 ; Direct-Letter-Input
1558 or al, 20h ; Lower-Case Input
1559 cmp al, 'c'
1560 jb PSDLS_MainLoop
1561 cmp al, 'z'
1562 ja PSDLS_MainLoop
1563 mov dl, al
1564 add dl, 1Dh ; -> Convert to used logic
1565 call PARTSETUPDL_DrawDriveLetter
1566 jmp PSDLS_MainLoop
1567
1568
1569 ; Clear drive-letter with backspace
1570 PSDLS_BackSpace:
1571 xor dl,dl
1572 call PARTSETUPDL_DrawDriveLetter
1573 jmp PSDLS_MainLoop
1574
1575 PSDLS_KeyUp:
1576 dec dl
1577 cmp dl, 7Fh
1578 jne PSDLS_KeyUpFix1
1579 xor dl, dl
1580 PSDLS_KeyUpFix1:
1581 cmp dl, 97h
1582 jbe PSDLS_KeyUpFix2
1583 mov dl, 97h
1584 PSDLS_KeyUpFix2:
1585 call PARTSETUPDL_DrawDriveLetter
1586 jmp PSDLS_MainLoop
1587
1588 PSDLS_KeyDown:
1589 inc dl
1590 cmp dl, 97h
1591 jbe PSDLS_KeyDownFix1
1592 xor dl, dl
1593 PSDLS_KeyDownFix1:
1594 cmp dl, 01h
1595 jne PSDLS_KeyDownFix2
1596 mov dl, 80h
1597 PSDLS_KeyDownFix2:
1598 call PARTSETUPDL_DrawDriveLetter
1599 jmp PSDLS_MainLoop
1600
1601
1602 PSDLS_KeyDONE:
1603 ; Write Drive-Letter into DriveLetter-Table
1604 pop bx
1605 mov bptr [DriveLetters+bx], dl
1606 mov al, ds:[si+LocIPT_Flags]
1607 mov ah, Flags_DriveLetter
1608 not ah
1609 and al, ah
1610 or dl, dl
1611 jz PSDLS_NoFlag
1612 or al, Flags_DriveLetter
1613 PSDLS_NoFlag:
1614 mov ds:[si+LocIPT_Flags], al
1615 ret
1616PARTSETUP_DriveLetterSetup EndP
1617
1618; Draw all standard-things for DriveLetterSetup, dynamic content not included.
1619PARTSETUPDL_DrawMenuBase Proc Near Uses dx si
1620 ; Calculate Position of Window.
1621 ; If Partition Selected Left-Side -> go Right-Sided Window
1622 ; otherwise Left-Sided.
1623 mov PartSetup_ActivePart, dl
1624 mov al, 8 ; X-Pos = 8
1625 and dl, 1
1626 jnz PSDLDMB_FirstStep
1627 mov al, 30h ; X-Pos = 48
1628 PSDLDMB_FirstStep:
1629 mov PartSetup_HiddenX, al
1630
1631 ; Draw base-window
1632
1633CLR_PART_DL_XX_CLASSIC = 0d05h
1634CLR_PART_DL_XX_BM = 0a02h
1635
1636 mov cx, CLR_PART_DL_XX_BM ; Lila on lila
1637 call VideoIO_Color
1638 mov bh, 06h
1639 mov bl, [PartSetup_HiddenX]
1640 mov dh, 0Ah
1641 mov dl, bl
1642 add dl, 16h
1643 push bx
1644 call VideoIO_MakeWindow
1645 pop bx
1646 ; Make Window-Header
1647 inc bl
1648 push bx
1649 mov cx, bx
1650 call VideoIO_Locate
1651 mov al, 'µ'
1652 call VideoIO_PrintSingleChar
1653
1654CLR_PART_DL_WINDOW_TITLE_CLASSIC = 0e05h
1655CLR_PART_DL_WINDOW_TITLE_BM = 0e02h
1656
1657 mov cx, CLR_PART_DL_WINDOW_TITLE_BM ; Yellow on Lila
1658 call VideoIO_Color
1659 mov si, offset TXT_SETUP_DriveLetter
1660 call VideoIO_Print
1661
1662CLR_PART_DL_WINDOW_BORDER2_CLASSIC = 0d05h
1663CLR_PART_DL_WINDOW_BORDER2_BM = 0a02h
1664
1665 mov cx, CLR_PART_DL_WINDOW_BORDER2_BM ; Lila on lila
1666 call VideoIO_Color
1667 mov al, 'Æ'
1668 call VideoIO_PrintSingleChar
1669 pop bx
1670 ; Display help-information
1671 mov si, offset TXT_SETUPHELP_DriveLetter
1672
1673CLR_PART_DL_SETUP_HELP_CLASSIC = 0d05h
1674CLR_PART_DL_SETUP_HELP_BM = 0a02h
1675
1676
1677 mov cx, CLR_PART_DL_SETUP_HELP_BM ; Lila on lila
1678 call VideoIO_Color
1679
1680 call GetLenOfString ; CX - Len of string
1681 mov dx, cx
1682 mov cx, bx
1683 add cx, 0413h
1684 sub cl, dl
1685 call VideoIO_Locate
1686 mov al, '<'
1687 call VideoIO_PrintSingleChar
1688 call VideoIO_Print
1689 mov al, '>'
1690 call VideoIO_PrintSingleChar
1691 ;
1692 mov cx, 0F01h ; Bright White on Blue
1693 call VideoIO_Color
1694 mov cx, 0805h ; Position 8, 5
1695 add cl, PartSetup_HiddenX
1696 call VideoIO_Locate
1697 mov al, ' '
1698 mov cl, 12
1699 call VideoIO_PrintSingleMultiChar
1700 ret
1701PARTSETUPDL_DrawMenuBase EndP
1702
1703; Writes Logical Drive-Letter to Screen (Logical-Drive-Letter-Setup)
1704; In: DL - Logical Drive-Letter Byte
1705; Destroyed: None
1706PARTSETUPDL_DrawDriveLetter Proc Near Uses si
1707 ; 00h -> standard drive letter
1708 ; 80h -> use C: as drive letter
1709 ; 97h -> use Z: as drive letter
1710 push dx
1711 mov cx, 0805h ; Position 8, 5
1712 add cl, [PartSetup_HiddenX]
1713 call VideoIO_Locate
1714 add cl, 6 ; Everything centered (12/2)
1715 push cx
1716 mov al, ' '
1717 mov cl, 12
1718 call VideoIO_PrintSingleMultiChar ; Fill up area with spaces
1719
1720 or dl, dl
1721 jnz PSDLDDL_Letter
1722 mov si, offset TXT_SETUP_MAGIC_Disabled
1723 call GetLenOfString
1724 mov dx, cx
1725 pop cx
1726 call VideoIO_LocateToCenter ; LocateToCenter using TotalLen
1727 call VideoIO_Print
1728 pop dx
1729 ret
1730
1731 PSDLDDL_Letter:
1732 mov si, offset TXT_SETUP_MAGIC_Set
1733 call GetLenOfString
1734 mov dx, cx
1735 add dx, 2
1736 pop cx
1737 call VideoIO_LocateToCenter ; LocateToCenter using TotalLen
1738 call VideoIO_Print
1739 pop dx
1740 mov al, dl
1741 sub al, 3Dh
1742 call VideoIO_PrintSingleChar
1743 mov al, ':'
1744 call VideoIO_PrintSingleChar
1745 ret
1746PARTSETUPDL_DrawDriveLetter EndP
Note: See TracBrowser for help on using the repository browser.