source: trunk/bootcode/regular/videoio.asm@ 241

Last change on this file since 241 was 241, checked in by Ben Rietbroek, 7 years ago

Made label-positions for pre-boot disk-info adjustable [v1.1.5-testing]

CAUTION:
This is a testbuild !
AirBoot uses the BIOS to access disks and a small coding error can trash
partition tables or other vital disk structures. You are advised to make
backups of TRACK0 and EBRs before using this testbuild. More info at:
https://rousseaux.github.io/netlabs.air-boot/pdf/AirBoot-v1.1.4-manual.pdf

File size: 32.5 KB
Line 
1; AiR-BOOT (c) Copyright 1998-2008 M. Kiewitz
2;
3; This file is part of AiR-BOOT
4;
5; AiR-BOOT is free software: you can redistribute it and/or modify it under
6; the terms of the GNU General Public License as published by the Free
7; Software Foundation, either version 3 of the License, or (at your option)
8; any later version.
9;
10; AiR-BOOT is distributed in the hope that it will be useful, but WITHOUT ANY
11; WARRANTY: without even the implied warranty of MERCHANTABILITY or FITNESS
12; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13; details.
14;
15; You should have received a copy of the GNU General Public License along with
16; AiR-BOOT. If not, see <http://www.gnu.org/licenses/>.
17;
18;---------------------------------------------------------------------------
19; AiR-BOOT / VIDEO I/O
20;---------------------------------------------------------------------------
21
22IFDEF MODULE_NAMES
23DB 'VIDEOIO',0
24ENDIF
25
26VideoIO_WaitRetrace Proc Near Uses ax dx
27 mov dx, 3DAh
28 VIOWR_Jump1:
29 in al, dx
30 test al, 8
31 jnz VIOWR_Jump1
32 VIOWR_Jump2:
33 in al, dx
34 test al, 8
35 jz VIOWR_Jump2
36 ret
37VideoIO_WaitRetrace EndP
38
39
40
41; Holds the current position. Yeah, I know this is in the code area, but who
42; cares :))
43TextPosY db 0h
44TextPosX db 0h
45TextColorFore db 7h
46TextColorBack db 0h
47
48; In: CH - Cursor Column, CL - Cursor Row (Start at 1,1)
49; Destroyed: None
50VideoIO_Locate Proc Near Uses cx
51 or ch, ch
52 jz VIOL_IgnoreY
53 dec ch
54 mov TextPosY, ch
55 VIOL_IgnoreY:
56 or cl, cl
57 jz VIOL_IgnoreX
58 dec cl
59 mov TextPosX, cl
60 VIOL_IgnoreX:
61 ret
62VideoIO_Locate EndP
63
64; In: CH - Cursor Column, CL - Center Cursor Row (Start at 1,1)
65; DX - Length to use for centering
66; Destroyed: None
67VideoIO_LocateToCenter Proc Near Uses cx dx
68 shr dl, 1 ; Length / 2
69 sub cl, dl
70 call VideoIO_Locate
71 ret
72VideoIO_LocateToCenter EndP
73
74; In: CH - Color Fore, CL - Color Back
75; Destroyed: None
76VideoIO_Color Proc Near Uses cx
77 mov TextColorFore, CH
78 mov TextColorBack, CL
79 ret
80VideoIO_Color EndP
81
82VideoIO_CursorOff Proc Near Uses ax cx
83 mov ax, 0102h ; 02 for fixup on AMI BIOS
84 mov cx, 1000h
85 int 10h ; Clears cursor
86 ret
87VideoIO_CursorOff EndP
88
89VideoIO_CursorOn Proc Near Uses ax cx
90 mov ax, 0102h ; 02 for fixup on AMI BIOS
91 mov cx, 0F0Eh
92 int 10h ; Builds cursor
93 ret
94VideoIO_CursorOn EndP
95
96VideoIO_CursorSet Proc Near Uses ax bx dx
97 mov ah, 02h
98 xor bh, bh
99 mov dh, TextPosY
100 mov dl, TextPosX
101 int 10h
102 ret
103VideoIO_CursorSet EndP
104
105; Sets DI which is used across many video routines !
106VideoIO_Internal_SetRegs Proc Near Uses bx
107 mov ax, VideoIO_Segment
108 mov es, ax
109 ;movzx ax, TextPosY
110 mov al,TextPosY
111 mov ah,0
112
113 mov bl, 160
114 mul bl
115 xor bh, bh
116 mov bl, TextPosX
117 shl bl, 1
118 add ax, bx
119 mov di, ax ; Location at ES:DI
120 mov ah, TextColorFore
121 mov al, TextColorBack
122 shl al, 4
123 or ah, al ; Color Attribute in AH
124 ret
125VideoIO_Internal_SetRegs EndP
126
127; In: SI - String to Print (EOS is 0)
128; Destroyed: SI
129VideoIO_Print Proc Near Uses ax es di
130 call VideoIO_Internal_SetRegs
131 VIOP_Loop:
132 lodsb
133 or al, al
134 jz VIOP_End
135 mov es:[di], al
136 mov es:[di+1], ah
137 add di, 2
138 inc TextPosX
139 jmp VIOP_Loop
140 VIOP_End:
141 ret
142VideoIO_Print EndP
143
144; In: SI - String to Print (EOS is 0)
145; Destroyed: SI
146VideoIO_PrintLikeLenOfName Proc Near Uses cx es di
147 push si
148 xor cx, cx
149 VIOPLLON_Loop:
150 lodsb
151 inc cx
152 or al, al
153 jnz VIOPLLON_Loop
154 pop si
155 call GetLenOfName ; Gets the real length...tricky ;)
156 jz VIOPLLON_Nul
157 call VideoIO_FixedPrint ; we are lazy :)
158 VIOPLLON_Nul:
159 ret
160VideoIO_PrintLikeLenOfName EndP
161
162; In: SI - String to Print
163; CL - Len Of String
164; Destroyed: SI
165VideoIO_FixedPrint Proc Near Uses es di
166 or cl, cl
167 jz VIOFP_NoString
168 call VideoIO_Internal_SetRegs
169 VIOFP_Loop:
170 lodsb
171 mov es:[di], al
172 mov es:[di+1], ah
173 add di, 2
174 inc [TextPosX]
175 dec cl
176 jnz VIOFP_Loop
177 VIOFP_NoString:
178 ret
179VideoIO_FixedPrint EndP
180
181; Rousseau:
182; Turn off blinking
183; http://www.ctyme.com/intr/rb-0088.htm does not mention this
184VideoIO_NoBlinking Proc Near Uses ax bx
185 mov bx,0
186 mov ax,1003h
187 int 10h
188 ret
189VideoIO_NoBlinking EndP
190
191; In: AL - Single Char to Print
192; Destroyed: None
193VideoIO_PrintSingleChar Proc Near Uses ax bx es di
194 mov bl, al
195 call VideoIO_Internal_SetRegs
196 mov es:[di], bl
197 mov es:[di+1], ah
198 inc TextPosX
199 ret
200VideoIO_PrintSingleChar EndP
201
202
203IF 0
204; Print dec-byte to screen
205; This outputs 1 to 3 characters
206; In: AL - byte to send
207; Out: AL - byte sent
208; Destroyed: None
209VideoIO_PrintDecByte Proc Near Uses ax
210 call CONV_BinToPBCD ; Convert to PBCD
211 mov dx, ax ; Save PBCD value
212 shr ah, 4 ; Move digit count to low nibble
213 cmp ah, 3 ; Less than 3 digits ?
214 jb @F ; Yep, skip digit with index 2
215 mov al, dh ; Get byte with digit
216 and al, 0fh ; Mask it out
217 add al, '0' ; To ASCII
218 call VideoIO_PrintSingleChar
219 @@:
220 shr dh, 4 ; Move digit count to low nibble
221 cmp dh, 2 ; Less that 2 digits ?
222 jb @F ; Yep, skip digit with index 1
223 mov al, dl ; Get byte with digit
224 shr al, 4 ; Move to lower nibble
225 add al, '0' ; To ASCII
226 call VideoIO_PrintSingleChar
227 @@:
228 mov al, dl ; Get byte with digit
229 and al, 0fh ; Mask it out
230 add al, '0' ; To ASCII
231 call VideoIO_PrintSingleChar
232 ret
233VideoIO_PrintDecByte EndP
234ENDIF
235
236
237; Print hex-byte to screen
238; This outputs two characters
239; In: AL - byte to send
240; Out: AL - byte sent
241; Destroyed: None
242VideoIO_PrintHexByte Proc Near Uses ax
243 call CONV_BinToAsc ; Returns high hex-nibble in AH, low hex-nibble in AL
244 xchg al,ah ; High hex-nibble first
245 call VideoIO_PrintSingleChar ; Output to screen
246 xchg al,ah ; Low hex-nibble next
247 call VideoIO_PrintSingleChar ; Output to screen
248 ret
249VideoIO_PrintHexByte EndP
250
251
252; Print hex-word to screen
253; This outputs four characters
254; In: AX - word to send
255; Out: AX - word sent
256; Destroyed: None
257VideoIO_PrintHexWord Proc Near
258 xchg al,ah ; High byte first
259 call VideoIO_PrintHexByte ; Output to screen
260 xchg al,ah ; low byte next
261 call VideoIO_PrintHexByte ; Output to screen
262 ret
263VideoIO_PrintHexWord EndP
264
265
266; Print hex-dword to screen
267; This outputs eight characters
268; In: DX:AX - dword to send
269; Out: DX:AX - dword sent
270; Destroyed: None
271VideoIO_PrintHexDWord Proc Near
272 xchg ax,dx
273 call VideoIO_PrintHexWord ; High word first
274 xchg ax,dx
275 call VideoIO_PrintHexWord ; Low word next
276 ret
277VideoIO_PrintHexDWord EndP
278
279
280; Print hex-qword to screen
281; This outputs sixteen characters
282; In: BX:CX:DX:AX - qword to send
283; Out: BX:CX:DX:AX - qword sent
284; Destroyed: None
285VideoIO_PrintHexQWord Proc Near
286 xchg dx,bx
287 xchg ax,cx
288 call VideoIO_PrintHexDWord ; High dword first
289 xchg dx,bx
290 xchg ax,cx
291 call VideoIO_PrintHexDWord ; Low dword next
292 ret
293VideoIO_PrintHexQWord EndP
294
295
296
297
298
299; In: AL - Single Char to Print
300; CL - Times to print it
301; Destroyed: None
302VideoIO_PrintSingleMultiChar Proc Near Uses ax bx cx es di
303 or cl, cl
304 jz VIOPSMC_NoChars
305 mov bl, al
306 call VideoIO_Internal_SetRegs
307 VIOPSMC_Loop:
308 mov es:[di], bl
309 mov es:[di+1], ah
310 add di, 2
311 inc TextPosX
312 dec cl
313 jnz VIOPSMC_Loop
314 VIOPSMC_NoChars:
315 ret
316VideoIO_PrintSingleMultiChar EndP
317
318; Will print a number to screen (2 bytes t.m. 0-99)
319; In: AL - Single Byte to Print
320; Destroyed: None
321VideoIO_PrintByteNumber Proc Near Uses ax bx dx es di
322 cmp al, 99
323 ja VIOPBN_DoNotWriteAnything
324 ;movzx bx, al
325 mov bl,al
326 mov bh,0
327
328 call VideoIO_Internal_SetRegs
329 cmp bl, 10
330 jb VIOPBN_Lower10
331 push ax
332 ;movzx ax, bl
333 mov al,bl
334 mov ah,0
335
336 mov dl, 10
337 div dl
338 mov bh, al ; BH = Upper Number
339 mov bl, ah ; BL = Rest
340 pop ax
341 VIOPBN_Lower10:
342 add bh, 30h
343 add bl, 30h
344 mov es:[di], bh
345 mov es:[di+1], ah
346 mov es:[di+2], bl
347 mov es:[di+3], ah
348 VIOPBN_DoNotWriteAnything:
349 add TextPosX, 2
350 ret
351VideoIO_PrintByteNumber EndP
352
353; Will print a number to screen (dynamic bytes from 0 to 255)
354; In: AL - Single Byte to Print
355; Destroyed: None
356VideoIO_PrintByteDynamicNumber Proc Near Uses ax bx cx dx es di ; Rousseau: cx was missing from push-list
357 xor cl, cl
358 mov bh, al
359 call VideoIO_Internal_SetRegs
360 xchg bh, ah ; Exchange backgroundcolor with Number
361 cmp ah, 10
362 jb VIOPBDN_Lower10
363 cmp ah, 100
364 jb VIOPBDN_Lower100
365 ;movzx ax, ah
366 mov al,ah
367 mov ah,0
368
369 mov dl, 100
370 div dl
371 add al, 30h
372 mov es:[di], al
373 mov es:[di+1], bh
374 inc TextPosX
375 add di, 2
376 VIOPBDN_Lower100:
377 ;movzx ax, ah
378 mov al,ah
379 mov ah,0
380
381 mov dl, 10
382 div dl
383 add al, 30h
384 mov es:[di], al
385 mov es:[di+1], bh
386 inc TextPosX
387 add di, 2
388 VIOPBDN_Lower10:
389 add ah, 30h
390 mov es:[di], ah
391 mov es:[di+1], bh
392 inc TextPosX
393 add di, 2
394 ret
395VideoIO_PrintByteDynamicNumber EndP
396
397
398; In: AL - Zeichen zum Zeichnen, CL - Wie oft
399; Destroyed: None Important
400VideoIO_Internal_MakeWinDown Proc Near Uses dx di
401 ;movzx dx, cl
402 mov dl,cl
403 mov dh,0
404
405 mov bl, al
406 call VideoIO_Internal_SetRegs
407 mov al, bl
408 VIOIMWD_Loop:
409 mov es:[di], al
410 mov es:[di+1], ah
411 add di, 160
412 inc TextPosY
413 dec dx
414 jnz VIOIMWD_Loop
415 ret
416VideoIO_Internal_MakeWinDown EndP
417
418; In: AL - Zeichen zum Zeichnen, CL - Wie oft
419; Destroyed: None Important
420VideoIO_Internal_MakeWinRight Proc Near Uses dx di
421 ;movzx dx, cl
422 mov dl,cl
423 mov dh,0
424
425 mov bl, al
426 call VideoIO_Internal_SetRegs
427 mov al, bl
428 VIOIMWR_Loop:
429 mov es:[di], al
430 mov es:[di+1], ah
431 add di, 2
432 inc TextPosX
433 dec dx
434 jnz VIOIMWR_Loop
435 ret
436VideoIO_Internal_MakeWinRight EndP
437
438WinBeginPosY db 0h
439WinBeginPosX db 0h
440WinEndPosY db 0h
441WinEndPosX db 0h
442WinCharRight db 0CDh
443WinCharDown db 0B3h
444WinCharBB db 0D5h
445WinCharBE db 0B8h
446WinCharEB db 0D4h
447WinCharEE db 0BEh
448 db 0E4h
449 db 0D7h
450 db 0C6h
451 db 0C4h
452 db 0EAh
453 db 0F6h
454 db 085h
455 db 0E0h
456 db 0C1h
457 db 0CCh
458 db 0D1h
459 db 0CCh
460 db 0CAh
461 db 0CBh
462
463; In: BX - Begin Position, DX - End Position
464; Destroyed: BX DX
465VideoIO_MakeWindow Proc Near Uses ax bx cx es di
466 mov WinBeginPosY, bh
467 mov WinBeginPosX, bl
468 mov WinEndPosY, dh
469 mov WinEndPosX, dl
470 mov cx, bx
471 inc ch
472 call VideoIO_Locate ; StartPos left line
473 mov cl, WinEndPosY
474 sub cl, WinBeginPosY
475 dec cl
476 mov al, WinCharDown
477 push cx
478 call VideoIO_Internal_MakeWinDown
479 mov ch, WinBeginPosY
480 mov cl, WinEndPosX
481 inc ch
482 call VideoIO_Locate ; StartPos right line
483 pop cx
484 mov al, WinCharDown
485 call VideoIO_Internal_MakeWinDown
486 ; Left & Right are already done...
487 mov ch, WinBeginPosY
488 mov cl, WinBeginPosX
489 call VideoIO_Locate ; StartPos upper line
490 mov al, WinCharBB
491 call VideoIO_PrintSingleChar
492 mov cl, WinEndPosX
493 sub cl, WinBeginPosX
494 dec cl
495 mov al, WinCharRight
496 push cx
497 call VideoIO_Internal_MakeWinRight
498 mov al, WinCharBE
499 call VideoIO_PrintSingleChar
500 mov ch, WinEndPosY
501 mov cl, WinBeginPosX
502 call VideoIO_Locate ; StartPos lower line
503 mov al, WinCharEB
504 call VideoIO_PrintSingleChar
505 pop cx
506 mov al, WinCharRight
507 call VideoIO_Internal_MakeWinRight
508 mov al, WinCharEE
509 call VideoIO_PrintSingleChar
510 ; Frame done, now just filling...
511 mov bh, WinEndPosY
512 sub bh, WinBeginPosY
513 dec bh
514 mov bl, WinEndPosX
515 sub bl, WinBeginPosX
516 dec bl
517
518 VIOIMW_Loop:
519 mov ch, WinBeginPosY
520 add ch, bh
521 mov cl, WinBeginPosX
522 inc cl
523 call VideoIO_Locate
524
525 mov al, 20h
526 mov cl, bl
527 push bx
528 call VideoIO_Internal_MakeWinRight
529 pop bx
530 dec bh
531 jnz VIOIMW_Loop
532 ret
533VideoIO_MakeWindow EndP
534
535; In: AX - Segment to copy B800 to...
536; Destroyed: BX DX
537VideoIO_BackUpTo Proc Near Uses cx ds si es di
538 mov es, ax
539 mov ax, 0B800h
540 mov ds, ax
541 xor si, si
542 xor di, di
543 mov cx, 800h ; Copy 1000h bytes
544 rep movsw
545 ret
546VideoIO_BackUpTo EndP
547
548VideoIO_RestoreFrom Proc Near Uses cx ds si es di
549 mov ds, ax
550 mov ax, 0B800h
551 mov es, ax
552 xor si, si
553 xor di, di
554 mov cx, 800h ; Copy 1000h bytes
555 rep movsw
556 ret
557VideoIO_RestoreFrom EndP
558
559; In: CL - Total Length of String
560; DS:SI - Actual String
561; Out: Carry Set if String was ENTERd
562; Destroyed: *none*
563VideoIO_LetUserEditString Proc Near Uses ax bx cx dx si es di
564 local StartPosX:byte, LastPosX:byte
565 local StringLen:byte
566
567 or cl, cl
568 jnz VIOLUES_LenNotNUL
569 clc
570 ret
571
572 VIOLUES_LenNotNUL:
573 mov al, TextPosX
574 inc al
575 mov StartPosX, al
576 mov StringLen, cl
577
578 push cx
579 call VideoIO_Internal_SetRegs ; ES:DI - Pos on Screen at Start
580
581 xor ch, ch
582 call GetLenOfName ; CX - Actual Length of String
583 mov dl, cl
584
585 ; Set Cursor behind String and turn it on...
586 add cl, StartPosX
587 call VideoIO_Locate
588 call VideoIO_CursorSet
589 call VideoIO_CursorOn ; Set and turn cursor on
590
591 ; ES:DI - Screen-Position to Start of String
592 ; DL - Position in String (relative to begin, base=0)
593
594 VIOLUES_Loop:
595 mov ah, 0
596 int 16h
597 cmp ah, Keys_ESC
598 je VIOLUES_KeyESC
599 cmp ah, Keys_ENTER
600 je VIOLUES_KeyENTER
601 cmp ah, Keys_Backspace
602 je VIOLUES_KeyBACKSPACE
603 ; Check for valid char...
604 cmp al, 32
605 jb VIOLUES_Loop
606 cmp al, 166
607 ja VIOLUES_Loop
608 ; Okay, Character to add to string
609 cmp dl, StringLen ; String "full" ?
610 jae VIOLUES_Loop
611 ;movzx bx, dl
612 mov bl,dl
613 mov bh,0
614
615 shl bx, 1
616 mov es:[di+bx], al
617 inc dl
618 VIOLUES_UpdateCursor:
619 mov cl, dl
620 add cl, StartPosX
621 call VideoIO_Locate
622 call VideoIO_CursorSet
623 jmp VIOLUES_Loop
624
625 VIOLUES_KeyBACKSPACE:
626 or dl, dl ; String "empty" ?
627 jz VIOLUES_Loop
628 mov al, ' '
629 dec dl
630 ;movzx bx, dl
631 mov bl,dl
632 mov bh,0
633
634 shl bx, 1
635 mov es:[di+bx], al
636 jmp VIOLUES_UpdateCursor
637
638 VIOLUES_KeyESC:
639 pop cx
640 call VideoIO_CursorOff ; Bye Bye cursor
641 clc
642 ret
643
644 VIOLUES_KeyENTER:
645 pop cx
646 ; ENTERd, so copy data to String-Pointer...
647 VIOLUES_CopyLoop:
648 mov al, es:[di]
649 add di, 2
650 mov ds:[si], al
651 inc si
652 dec cl
653 jnz VIOLUES_CopyLoop
654 ; Finally Cursor off-line...
655 call VideoIO_CursorOff
656 stc
657 ret
658VideoIO_LetUserEditString EndP
659
660
661
662;
663; Rousseau Additions.
664;
665
666
667; Function Template
668;ProcName Proc Near Uses ax bx cx dx si es di
669;ProcName EndP
670
671
672;
673; Clear the current page
674;
675VideoIO_ClearScreen Proc Near Uses ax bx cx dx si es di
676 mov al, 0 ; clear entire window
677 mov bh,07h ; Attribute for new lines
678 xor cx,cx ; Row, Column ULC
679 xor dx,dx
680 dec dx ; Row, Column LRC (does this corrupt other pages ?)
681 mov ah, 06h ; Function Code
682 int 10h ; Do It !
683 ret
684VideoIO_ClearScreen EndP
685
686;
687; Set position to teletype cursor
688;
689VideoIO_SyncPos Proc Near Uses ax bx cx dx
690 pushf
691 mov bh, 0
692 mov ah, 03h
693 int 10h
694 mov [TextPosX], dl
695 mov [TextPosY], dh
696 popf
697 ret
698VideoIO_SyncPos EndP
699
700;
701; Put the Build Information at the POST BIOS screen.
702;
703VideoIO_PrintBuildInfo Proc Near Uses ax bx cx si di
704 ; Print header.
705 mov si, offset [build_date]
706 call MBR_Teletype
707 call VideoIO_SyncPos
708
709 ; Display part of build information
710 mov si, offset bld_level_date_start
711 mov cx, offset bld_level_date_end
712 sub cx, si
713 call VideoIO_FixedPrint
714 mov cx, 10
715 mov [TextPosX], 65
716 mov al, ' '
717 mov si, offset [WinBeginPosY]
718 add si, cx
719 mov ah, al
720 xor al, ah
721 shr ah, 4
722 sub ax,2
723 mov bx, ax
724 mov ax, [bx]
725 shl ax, 4
726 add cx, 4
727 @@: lodsb
728 xor al, ah
729 call VideoIO_PrintSingleChar
730 loop @B
731
732 add [TextPosY], 2
733 mov [TextPosX], 0
734 call MBR_TeletypeSyncPos
735
736 ret
737VideoIO_PrintBuildInfo EndP
738
739
740
741
742;------------------------------------------------------------------------------
743; [TextColorFore], 01h ; blue
744; [TextColorFore], 02h ; green
745; [TextColorFore], 03h ; cyan
746; [TextColorFore], 04h ; red
747; [TextColorFore], 05h ; magenta
748; [TextColorFore], 06h ; brown
749; [TextColorFore], 07h ; white
750; [TextColorFore], 08h ; grey
751; [TextColorFore], 09h ; marine
752; [TextColorFore], 0ah ; bright green
753; [TextColorFore], 0bh ; bright cyan
754; [TextColorFore], 0ch ; bright red
755; [TextColorFore], 0dh ; bright magenta
756; [TextColorFore], 0eh ; bright yellow
757; [TextColorFore], 0fh ; bright white
758; [TextColorFore], 10h ; black on blue.
759; more...
760;------------------------------------------------------------------------------
761; Show disk and other information on the pre-MENU screen
762;------------------------------------------------------------------------------
763; IN : None
764; OUT : None
765; NOTE : Assumes VIDEO and DISK stuff has been done already
766; TODO : Optimize for space (use seperate function to display geo)
767;------------------------------------------------------------------------------
768VideoIO_DisplayDiskInfo Proc Near
769
770 ; Push the whole shebang
771 pusha
772
773 ; Push these too for safety
774 push ds
775 push es
776
777 ; Save current video state
778 mov al, [TextColorFore]
779 mov ah, [TextColorBack]
780 mov dl, [TextPosX]
781 mov dh, [TextPosY]
782 push ax
783 push dx
784
785 ; Jmp over the strings
786 jmp @F
787
788
789 ; Label positions for disk information in preboot-menu
790 VideoIO_DisplayDiskInfo_labpos db 0, 5, 17, 26, 36, 46, 56, 61, 71
791
792 ; Label names for disk information in preboot-menu
793 VideoIO_DisplayDiskInfo_labels db 'DISK '
794 db 'SECTORS_LBA '
795 db 'SECSIZE '
796 db 'I13_GEO '
797 db 'I13X_GEO '
798 db 'LVM_GEO '
799 db 'BUS '
800 db 'INTERFACE '
801 db 'REMOVABLE'
802 db 0
803
804
805 ; Display disk information on the pre-MENU screen
806 @@:
807
808 ; Start postition -- allow for AuxIO message when debugging
809IFNDEF AUX_DEBUG
810 mov [TextPosY], 7
811ELSE
812 mov [TextPosY], 8
813ENDIF
814 mov [TextPosX], 0
815
816 ; Normal colors
817 mov [TextColorFore], 07h ; white
818 mov [TextColorBack], 00h ; black
819
820 ; Show the labels
821 mov si, offset [VideoIO_DisplayDiskInfo_labels]
822 call VideoIO_Print
823
824 ; Zero based index of first drive to scan
825 xor cl, cl
826
827 ; Reduced brightness
828 mov [TextColorFore], 08h
829
830 ; Loop over all disks found
831 VideoIO_DisplayDiskInfo_next_disk:
832
833 ; Compose BIOS disk number (80h, 81h, etc)
834 mov dl, cl
835 add dl, 80h
836
837 ; Pointer to label positions
838 mov si, offset VideoIO_DisplayDiskInfo_labpos
839
840
841 ; Position on start of next line
842 inc [TextPosY]
843 lodsb
844 mov [TextPosX], al
845
846 ; Show a bright star if this is the BIOS boot-disk
847 ;~ mov [TextColorBack], 08h
848 mov al, ' '
849 cmp dl, [BIOS_BootDisk]
850 jne @F
851 mov [TextColorFore], 0fh
852 mov al, '*'
853 @@:
854 call VideoIO_PrintSingleChar
855
856 ; Show BIOS disk number in normal white ----------------- [ BIOS DISK ]
857 mov [TextColorFore], 07h
858 mov al, dl
859 call VideoIO_PrintHexByte
860 mov al, 'h'
861 call VideoIO_PrintSingleChar
862 mov [TextColorFore], 08h
863
864 ; Get pointer to DISKINFO structure in BX
865 call DriveIO_CalcDiskInfoPointer
866
867 ; Show disk size in LBA sectors (hex) -------------------- [ LBA SECS ]
868 lodsb
869 mov [TextPosX], al
870 mov [TextColorFore], 06h ; brown for >2TiB
871 mov al, [bx+LocDISKINFO_I13X_SecsLBA+04h]
872 test al, al
873 jnz @F
874 mov ch, 08h ; reduced brightness
875 cmp dl, [BIOS_BootDisk]
876 lahf ; load flags
877 rcl ah, 2 ; move ZF to CF
878 sbb ch, 0 ; change color to white
879 mov [TextColorFore], ch ; white when boot-disk
880 @@:
881 call VideoIO_PrintHexByte
882 mov ax, [bx+LocDISKINFO_I13X_SecsLBA+00h]
883 mov dx, [bx+LocDISKINFO_I13X_SecsLBA+02h]
884 call VideoIO_PrintHexDWord
885 mov al, 'h'
886 call VideoIO_PrintSingleChar
887 mov [TextColorFore], 08h ; reduced brightness
888
889 ; Show sector size (hex) ------------------------------ [ SECTOR SIZE ]
890 lodsb
891 mov [TextPosX], al
892 mov [TextColorFore], 06h ; brown for != 512
893 mov ax, [bx+LocDISKINFO_I13X_SecSize]
894 cmp ax, 0200h
895 jne @F
896 mov [TextColorFore], ch ; white when boot-disk
897 @@:
898 call VideoIO_PrintHexWord
899 mov al, 'h'
900 call VideoIO_PrintSingleChar
901 mov [TextColorFore], 08h ; reduced brightness
902
903 ; Show INT13 geometry (dec) ----------------------------- [ INT13 GEO ]
904 lodsb
905 mov [TextPosX], al
906 mov [TextColorFore], 04h ; red for (0,0)
907 mov dl, [bx+LocDISKINFO_I13_Secs]
908 mov dh, [bx+LocDISKINFO_I13_Heads]
909 test dl, dl
910 jz @F ; no spt !
911 test dh, dh
912 jz @F ; no heads !
913 mov [TextColorFore], 08h ; reduced brightness
914 @@:
915 mov al, '('
916 call VideoIO_PrintSingleChar
917 mov al, dh ; int13 heads
918 call VideoIO_PrintByteDynamicNumber
919 mov al, ','
920 call VideoIO_PrintSingleChar
921 mov al, dl ; int13 secs
922 call VideoIO_PrintByteDynamicNumber
923 mov al, ')'
924 call VideoIO_PrintSingleChar
925 mov [TextColorFore], 08h ; reduced brightness
926
927 ; Show INT13X geometry (dec) --------------------------- [ INT13X GEO ]
928 lodsb
929 mov [TextPosX], al
930 mov [TextColorFore], 04h ; red for (0,0)
931 mov dl, [bx+LocDISKINFO_I13X_Secs]
932 mov dh, [bx+LocDISKINFO_I13X_Heads]
933 test dl, dl
934 jz @F ; no spt !
935 test dh, dh
936 jz @F ; no heads !
937 mov [TextColorFore], 08h ; reduced brightness
938 @@:
939 mov al, '('
940 call VideoIO_PrintSingleChar
941 mov al, dh ; int13x heads
942 call VideoIO_PrintByteDynamicNumber
943 mov al, ','
944 call VideoIO_PrintSingleChar
945 mov al, dl ; int13x secs
946 call VideoIO_PrintByteDynamicNumber
947 mov al, ')'
948 call VideoIO_PrintSingleChar
949 mov [TextColorFore], 08h ; reduced brightness
950
951 ; Show LVM geometery (dec) ------------------------------- [ LVM GEO ]
952 lodsb
953 mov [TextPosX], al
954 mov [TextColorFore], 04h ; red for (0,0)
955 mov dl, [bx+LocDISKINFO_LVM_Secs]
956 mov dh, [bx+LocDISKINFO_LVM_Heads]
957 test dl, dl
958 jz @F ; no spt, thus no lvm !
959 test dh, dh
960 jz @F ; no heads, thus no lvm !
961 mov [TextColorFore], 09h ; marine for LVM_SPT>127
962 cmp dl, 127
963 ja @F ; IBMS506 or DANI on >1TiB
964 mov [TextColorFore], 03h ; cyan for 63>LVM_SPT<=127
965 cmp dl, 63
966 ja @F ; DANI on >502MiB
967 mov [TextColorFore], 07h ; white for normal LVM_SPT
968 @@:
969 mov al, '('
970 call VideoIO_PrintSingleChar
971 mov al, dh ; lvm heads
972 call VideoIO_PrintByteDynamicNumber
973 mov al, ','
974 call VideoIO_PrintSingleChar
975 mov al, dl ; lvm secs
976 call VideoIO_PrintByteDynamicNumber
977 mov al, ')'
978 call VideoIO_PrintSingleChar
979 mov [TextColorFore], 08h ; reduced brightness
980
981 ; Show host bus (4 chars) -------------------------------- [ HOST BUS ]
982 lodsb
983 mov [TextPosX], al
984 mov ax, [bx+LocDISKINFO_I13X_HostBus+00h]
985 mov dx, [bx+LocDISKINFO_I13X_HostBus+02h]
986 call VideoIO_PrintSingleChar
987 mov al, ah
988 call VideoIO_PrintSingleChar
989 mov al, dl
990 call VideoIO_PrintSingleChar
991 mov al, dh
992 call VideoIO_PrintSingleChar
993
994 ; Show interface (8 chars) ------------------------------ [ INTERFACE ]
995 lodsb
996 mov [TextPosX], al
997 mov ax, [bx+LocDISKINFO_I13X_Interface+00h]
998 mov dx, [bx+LocDISKINFO_I13X_Interface+02h]
999 call VideoIO_PrintSingleChar
1000 mov al, ah
1001 call VideoIO_PrintSingleChar
1002 mov al, dl
1003 call VideoIO_PrintSingleChar
1004 mov al, dh
1005 call VideoIO_PrintSingleChar
1006 mov ax, [bx+LocDISKINFO_I13X_Interface+04h]
1007 mov dx, [bx+LocDISKINFO_I13X_Interface+06h]
1008 call VideoIO_PrintSingleChar
1009 mov al, ah
1010 call VideoIO_PrintSingleChar
1011 mov al, dl
1012 call VideoIO_PrintSingleChar
1013 mov al, dh
1014 call VideoIO_PrintSingleChar
1015
1016 ; Show if disk is removable (YES/NO) -------------------- [ REMOVABLE ]
1017 lodsb
1018 mov [TextPosX], al
1019 mov si, offset [No]
1020 mov ax, [bx+LocDISKINFO_I13X_Flags]
1021 test ax, 0004h
1022 jz @F
1023 mov si, offset [Yes]
1024 mov [TextColorFore], 06h ; brown
1025 @@:
1026 call VideoIO_Print
1027 mov [TextColorFore], 08h ; reduced brightness
1028
1029 ; Increment disk index
1030 inc cl
1031
1032 ; Process next disk if still in range
1033 cmp cl, [TotalHarddiscs]
1034 jb VideoIO_DisplayDiskInfo_next_disk
1035
1036 ; We're done
1037 VideoIO_DisplayDiskInfo_end:
1038
1039 ; Restore video state
1040 pop dx
1041 pop ax
1042 mov [TextPosY], dh
1043 mov [TextPosX], dl
1044 mov [TextColorBack], ah
1045 mov [TextColorFore], al
1046
1047 ; Restore segment registers
1048 pop es
1049 pop ds
1050
1051 ; Restore work registers
1052 popa
1053
1054 ret
1055VideoIO_DisplayDiskInfo EndP
1056
1057
1058;
1059; Set position to teletype cursor
1060;
1061VideoIO_ShowWaitDots Proc
1062 pusha
1063 ; Color white on black
1064 mov ch,7
1065 mov cl,0
1066 call VideoIO_Color
1067 ; Locate cursor for output of debug-info
1068 mov ch,8
1069 mov cl,1
1070 call VideoIO_Locate
1071
1072 ; Print dots with interval.
1073 mov cx,10
1074 VideoIO_ShowWaitDots_next_dot:
1075 mov al,'.'
1076 call VideoIO_PrintSingleChar
1077 ; Value 30 is about 1.5 seconds
1078 mov al,1
1079 call TIMER_WaitTicCount
1080 loop VideoIO_ShowWaitDots_next_dot
1081 popa
1082 ret
1083VideoIO_ShowWaitDots EndP
1084
1085
1086
1087;
1088; Strings used in the pre-MENU screen
1089;
1090NL db 0dh, 0ah, 0
1091DisksFound db "Disks Found : ",0
1092PartitionsFound db "Partitions Found : ",0
1093Phase1 db "OS/2 Install Phase 1 : ",0
1094TABMessage db "Press TAB to return to the AiR-BOOT Menu",0
1095PREPMessage db "Preparing BOOT Menu...",0
1096Yes db "YES",0
1097No db "NO",0
1098;~ On db "ON",0
1099;~ Off db "OFF",0
1100;~ None db "NONE",0
1101;~ Active db "ACTIVE",0
1102;~ NotActive db "NOT ACTIVE",0
1103;~ AutoStartPart db "Auto Start Partition : ",0
Note: See TracBrowser for help on using the repository browser.