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

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

Added the new disk-info stuff on the pre-MENU screen ! [v1.1.1-testing]

While many parts of the underlying engine have been enhanced,
this will probably be the most visible change for AiR-BOOT users... ;)

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: 32.1 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 ; We like to have these local for now
789 VideoIO_DumpDiskInfo_labels db 'DISK '
790 db 'SECTORS_LBA '
791 db 'SECSIZE '
792 db 'I13_GEO '
793 db 'I13X_GEO '
794 db 'LVM_GEO '
795 db 'BUS '
796 db 'INTERFACE '
797 db 'REMOVABLE'
798 db 0
799
800 ; Display disk information on the pre-MENU screen
801 @@:
802
803 ; Start postition -- allow for AuxIO message when debugging
804IFNDEF AUX_DEBUG
805 mov [TextPosY], 7
806ELSE
807 mov [TextPosY], 8
808ENDIF
809 mov [TextPosX], 0
810
811 ; Normal colors
812 mov [TextColorFore], 07h ; white
813 mov [TextColorBack], 00h ; black
814
815 ; Show the labels
816 mov si, offset [VideoIO_DumpDiskInfo_labels]
817 call VideoIO_Print
818
819 ; Zero based index of first drive to scan
820 xor cl, cl
821
822 ; Reduced brightness
823 mov [TextColorFore], 08h
824
825 ; Loop over all disks found
826 VideoIO_DumpDiskInfo_next_disk:
827
828 ; Compose BIOS disk number (80h, 81h, etc)
829 mov dl, cl
830 add dl, 80h
831
832 ; Position on start of next line
833 inc [TextPosY]
834 mov [TextPosX], 0
835
836 ; Show a bright star if this is the BIOS boot-disk
837 ;~ mov [TextColorBack], 08h
838 mov al, ' '
839 cmp dl, [BIOS_BootDisk]
840 jne @F
841 mov [TextColorFore], 0fh
842 mov al, '*'
843 @@:
844 call VideoIO_PrintSingleChar
845
846 ; Show BIOS disk number in normal white ----------------- [ BIOS DISK ]
847 mov [TextColorFore], 07h
848 mov al, dl
849 call VideoIO_PrintHexByte
850 mov al, 'h'
851 call VideoIO_PrintSingleChar
852 mov [TextColorFore], 08h
853
854 ; Get pointer to DISKINFO structure in BX
855 call DriveIO_CalcDiskInfoPointer
856
857 ; Show disk size in LBA sectors (hex) -------------------- [ LBA SECS ]
858 mov [TextPosX], 5
859 mov [TextColorFore], 06h ; brown for >2TiB
860 mov al, [bx+LocDISKINFO_I13X_SecsLBA+04h]
861 test al, al
862 jnz @F
863 mov ch, 08h ; reduced brightness
864 cmp dl, [BIOS_BootDisk]
865 lahf ; load flags
866 rcl ah, 2 ; move ZF to CF
867 sbb ch, 0 ; change color to white
868 mov [TextColorFore], ch ; white when boot-disk
869 @@:
870 call VideoIO_PrintHexByte
871 mov ax, [bx+LocDISKINFO_I13X_SecsLBA+00h]
872 mov dx, [bx+LocDISKINFO_I13X_SecsLBA+02h]
873 call VideoIO_PrintHexDWord
874 mov al, 'h'
875 call VideoIO_PrintSingleChar
876 mov [TextColorFore], 08h ; reduced brightness
877
878 ; Show sector size (hex) ------------------------------ [ SECTOR SIZE ]
879 mov [TextPosX], 17
880 mov [TextColorFore], 06h ; brown for != 512
881 mov ax, [bx+LocDISKINFO_I13X_SecSize]
882 cmp ax, 0200h
883 jne @F
884 mov [TextColorFore], ch ; white when boot-disk
885 @@:
886 call VideoIO_PrintHexWord
887 mov al, 'h'
888 call VideoIO_PrintSingleChar
889 mov [TextColorFore], 08h ; reduced brightness
890
891 ; Show INT13 geometry (dec) ----------------------------- [ INT13 GEO ]
892 mov [TextPosX], 26
893 mov [TextColorFore], 04h ; red for (0,0)
894 mov dl, [bx+LocDISKINFO_I13_Secs]
895 mov dh, [bx+LocDISKINFO_I13_Heads]
896 test dl, dl
897 jz @F ; no spt !
898 test dh, dh
899 jz @F ; no heads !
900 mov [TextColorFore], 08h ; reduced brightness
901 @@:
902 mov al, '('
903 call VideoIO_PrintSingleChar
904 mov al, dh ; int13 heads
905 call VideoIO_PrintByteDynamicNumber
906 mov al, ','
907 call VideoIO_PrintSingleChar
908 mov al, dl ; int13 secs
909 call VideoIO_PrintByteDynamicNumber
910 mov al, ')'
911 call VideoIO_PrintSingleChar
912 mov [TextColorFore], 08h ; reduced brightness
913
914 ; Show INT13X geometry (dec) --------------------------- [ INT13X GEO ]
915 mov [TextPosX], 36
916 mov [TextColorFore], 04h ; red for (0,0)
917 mov dl, [bx+LocDISKINFO_I13X_Secs]
918 mov dh, [bx+LocDISKINFO_I13X_Heads]
919 test dl, dl
920 jz @F ; no spt !
921 test dh, dh
922 jz @F ; no heads !
923 mov [TextColorFore], 08h ; reduced brightness
924 @@:
925 mov al, '('
926 call VideoIO_PrintSingleChar
927 mov al, dh ; int13x heads
928 call VideoIO_PrintByteDynamicNumber
929 mov al, ','
930 call VideoIO_PrintSingleChar
931 mov al, dl ; int13x secs
932 call VideoIO_PrintByteDynamicNumber
933 mov al, ')'
934 call VideoIO_PrintSingleChar
935 mov [TextColorFore], 08h ; reduced brightness
936
937 ; Show LVM geometery (dec) ------------------------------- [ LVM GEO ]
938 mov [TextPosX], 46
939 mov [TextColorFore], 04h ; red for (0,0)
940 mov dl, [bx+LocDISKINFO_LVM_Secs]
941 mov dh, [bx+LocDISKINFO_LVM_Heads]
942 test dl, dl
943 jz @F ; no spt, thus no lvm !
944 test dh, dh
945 jz @F ; no heads, thus no lvm !
946 mov [TextColorFore], 09h ; marine for LVM_SPT>127
947 cmp dl, 127
948 ja @F ; IBMS506 or DANI on >1TiB
949 mov [TextColorFore], 03h ; cyan for 63>LVM_SPT<=127
950 cmp dl, 63
951 ja @F ; DANI on >502MiB
952 mov [TextColorFore], 07h ; white for normal LVM_SPT
953 @@:
954 mov al, '('
955 call VideoIO_PrintSingleChar
956 mov al, dh ; lvm heads
957 call VideoIO_PrintByteDynamicNumber
958 mov al, ','
959 call VideoIO_PrintSingleChar
960 mov al, dl ; lvm secs
961 call VideoIO_PrintByteDynamicNumber
962 mov al, ')'
963 call VideoIO_PrintSingleChar
964 mov [TextColorFore], 08h ; reduced brightness
965
966 ; Show host bus (4 chars) -------------------------------- [ HOST BUS ]
967 mov [TextPosX], 56
968 mov ax, [bx+LocDISKINFO_I13X_HostBus+00h]
969 mov dx, [bx+LocDISKINFO_I13X_HostBus+02h]
970 call VideoIO_PrintSingleChar
971 mov al, ah
972 call VideoIO_PrintSingleChar
973 mov al, dl
974 call VideoIO_PrintSingleChar
975 mov al, dh
976 call VideoIO_PrintSingleChar
977
978 ; Show interface (8 chars) ------------------------------ [ INTERFACE ]
979 mov [TextPosX], 61
980 mov ax, [bx+LocDISKINFO_I13X_Interface+00h]
981 mov dx, [bx+LocDISKINFO_I13X_Interface+02h]
982 call VideoIO_PrintSingleChar
983 mov al, ah
984 call VideoIO_PrintSingleChar
985 mov al, dl
986 call VideoIO_PrintSingleChar
987 mov al, dh
988 call VideoIO_PrintSingleChar
989 mov ax, [bx+LocDISKINFO_I13X_Interface+04h]
990 mov dx, [bx+LocDISKINFO_I13X_Interface+06h]
991 call VideoIO_PrintSingleChar
992 mov al, ah
993 call VideoIO_PrintSingleChar
994 mov al, dl
995 call VideoIO_PrintSingleChar
996 mov al, dh
997 call VideoIO_PrintSingleChar
998
999 ; Show if disk is removable (YES/NO) -------------------- [ REMOVABLE ]
1000 mov [TextPosX], 71
1001 mov si, offset [No]
1002 mov ax, [bx+LocDISKINFO_I13X_Flags]
1003 test ax, 0004h
1004 jz @F
1005 mov si, offset [Yes]
1006 mov [TextColorFore], 06h ; brown
1007 @@:
1008 call VideoIO_Print
1009 mov [TextColorFore], 08h ; reduced brightness
1010
1011 ; Increment disk index
1012 inc cl
1013
1014 ; Process next disk if still in range
1015 cmp cl, [TotalHarddiscs]
1016 jb VideoIO_DumpDiskInfo_next_disk
1017
1018 ; We're done
1019 VideoIO_DumpDiskInfo_end:
1020
1021 ; Restore video state
1022 pop dx
1023 pop ax
1024 mov [TextPosY], dh
1025 mov [TextPosX], dl
1026 mov [TextColorBack], ah
1027 mov [TextColorFore], al
1028
1029 ; Restore segment registers
1030 pop es
1031 pop ds
1032
1033 ; Restore work registers
1034 popa
1035
1036 ret
1037VideoIO_DisplayDiskInfo EndP
1038
1039
1040;
1041; Set position to teletype cursor
1042;
1043VideoIO_ShowWaitDots Proc
1044 pusha
1045 ; Color white on black
1046 mov ch,7
1047 mov cl,0
1048 call VideoIO_Color
1049 ; Locate cursor for output of debug-info
1050 mov ch,8
1051 mov cl,1
1052 call VideoIO_Locate
1053
1054 ; Print dots with interval.
1055 mov cx,10
1056 VideoIO_ShowWaitDots_next_dot:
1057 mov al,'.'
1058 call VideoIO_PrintSingleChar
1059 ; Value 30 is about 1.5 seconds
1060 mov al,1
1061 call TIMER_WaitTicCount
1062 loop VideoIO_ShowWaitDots_next_dot
1063 popa
1064 ret
1065VideoIO_ShowWaitDots EndP
1066
1067
1068
1069;
1070; Strings used in the pre-MENU screen
1071;
1072NL db 0dh, 0ah, 0
1073DisksFound db "Disks Found : ",0
1074PartitionsFound db "Partitions Found : ",0
1075Phase1 db "OS/2 Install Phase 1 : ",0
1076TABMessage db "Press TAB to return to the AiR-BOOT Menu",0
1077PREPMessage db "Preparing BOOT Menu...",0
1078Yes db "YES",0
1079No db "NO",0
1080;~ On db "ON",0
1081;~ Off db "OFF",0
1082;~ None db "NONE",0
1083;~ Active db "ACTIVE",0
1084;~ NotActive db "NOT ACTIVE",0
1085;~ AutoStartPart db "Auto Start Partition : ",0
Note: See TracBrowser for help on using the repository browser.