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

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

Merged "strings-to-es-20180707.txt" provided by Alfredo [v1.1.5-testing]

Translator-build 'AiR-BOOT-v1.1.5-ES-TESTBUILD-20180708' was created
from this commit.

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: 33.2 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
719 ; Adjust positions for language
720 mov bx, BLD_LANG_TXT
721 cmp bx, 06573h
722 jne @F
723 xchg ah, al
724 mov byte ptr [si+20], 0c6h
725 mov byte ptr [si+22], 007h
726 mov bx, cx
727 push si
728 push [si+bx+00]
729 push [si+bx+02]
730 push [si+bx+04]
731 mov di, si
732 add di, bx
733 add si, 17
734 mov cx, 7
735 cld
736 rep movsb
737 xchg bx, cx
738 mov al, 085h
739 stosb
740 pop [di+bx+04]
741 pop [di+bx+02]
742 pop [di+bx+00]
743 pop si
744 xchg ah, al
745 @@:
746 add si, cx
747 mov ah, al
748 xor al, ah
749 shr ah, 4
750 sub ax,2
751 mov bx, ax
752 mov ax, [bx]
753 shl ax, 4
754 add cx, 4
755 @@: lodsb
756 xor al, ah
757 call VideoIO_PrintSingleChar
758 loop @B
759
760 add [TextPosY], 2
761 mov [TextPosX], 0
762 call MBR_TeletypeSyncPos
763
764 ret
765VideoIO_PrintBuildInfo EndP
766
767
768
769
770;------------------------------------------------------------------------------
771; [TextColorFore], 01h ; blue
772; [TextColorFore], 02h ; green
773; [TextColorFore], 03h ; cyan
774; [TextColorFore], 04h ; red
775; [TextColorFore], 05h ; magenta
776; [TextColorFore], 06h ; brown
777; [TextColorFore], 07h ; white
778; [TextColorFore], 08h ; grey
779; [TextColorFore], 09h ; marine
780; [TextColorFore], 0ah ; bright green
781; [TextColorFore], 0bh ; bright cyan
782; [TextColorFore], 0ch ; bright red
783; [TextColorFore], 0dh ; bright magenta
784; [TextColorFore], 0eh ; bright yellow
785; [TextColorFore], 0fh ; bright white
786; [TextColorFore], 10h ; black on blue.
787; more...
788;------------------------------------------------------------------------------
789; Show disk and other information on the pre-MENU screen
790;------------------------------------------------------------------------------
791; IN : None
792; OUT : None
793; NOTE : Assumes VIDEO and DISK stuff has been done already
794; TODO : Optimize for space (use seperate function to display geo)
795;------------------------------------------------------------------------------
796VideoIO_DisplayDiskInfo Proc Near
797
798 ; Push the whole shebang
799 pusha
800
801 ; Push these too for safety
802 push ds
803 push es
804
805 ; Save current video state
806 mov al, [TextColorFore]
807 mov ah, [TextColorBack]
808 mov dl, [TextPosX]
809 mov dh, [TextPosY]
810 push ax
811 push dx
812
813
814 ;
815 ; Display disk information on the pre-MENU screen
816 ;
817
818
819 ; Start postition -- allow for AuxIO message when debugging
820IFNDEF AUX_DEBUG
821 mov [TextPosY], 7
822ELSE
823 mov [TextPosY], 8
824ENDIF
825 mov [TextPosX], 0
826
827 ; Normal colors
828 mov [TextColorFore], 07h ; white
829 mov [TextColorBack], 00h ; black
830
831 ; Show the labels
832 mov si, offset [VideoIO_DisplayDiskInfo_labels]
833 call VideoIO_Print
834
835 ; Zero based index of first drive to scan
836 xor cl, cl
837
838 ; Reduced brightness
839 mov [TextColorFore], 08h
840
841 ; Loop over all disks found
842 VideoIO_DisplayDiskInfo_next_disk:
843
844 ; Compose BIOS disk number (80h, 81h, etc)
845 mov dl, cl
846 add dl, 80h
847
848 ; Pointer to label positions
849 mov si, offset VideoIO_DisplayDiskInfo_labpos
850
851
852 ; Position on start of next line
853 inc [TextPosY]
854 lodsb
855 mov [TextPosX], al
856
857 ; Show a bright star if this is the BIOS boot-disk
858 ;~ mov [TextColorBack], 08h
859 mov al, ' '
860 cmp dl, [BIOS_BootDisk]
861 jne @F
862 mov [TextColorFore], 0fh
863 mov al, '*'
864 @@:
865 call VideoIO_PrintSingleChar
866
867 ; Show BIOS disk number in normal white ----------------- [ BIOS DISK ]
868 mov [TextColorFore], 07h
869 mov al, dl
870 call VideoIO_PrintHexByte
871 mov al, 'h'
872 call VideoIO_PrintSingleChar
873 mov [TextColorFore], 08h
874
875 ; Get pointer to DISKINFO structure in BX
876 call DriveIO_CalcDiskInfoPointer
877
878 ; Show disk size in LBA sectors (hex) -------------------- [ LBA SECS ]
879 lodsb
880 mov [TextPosX], al
881 mov [TextColorFore], 06h ; brown for >2TiB
882 mov al, [bx+LocDISKINFO_I13X_SecsLBA+04h]
883 test al, al
884 jnz @F
885 mov ch, 08h ; reduced brightness
886 cmp dl, [BIOS_BootDisk]
887 lahf ; load flags
888 rcl ah, 2 ; move ZF to CF
889 sbb ch, 0 ; change color to white
890 mov [TextColorFore], ch ; white when boot-disk
891 @@:
892 call VideoIO_PrintHexByte
893 mov ax, [bx+LocDISKINFO_I13X_SecsLBA+00h]
894 mov dx, [bx+LocDISKINFO_I13X_SecsLBA+02h]
895 call VideoIO_PrintHexDWord
896 mov al, 'h'
897 call VideoIO_PrintSingleChar
898 mov [TextColorFore], 08h ; reduced brightness
899
900 ; Show sector size (hex) ------------------------------ [ SECTOR SIZE ]
901 lodsb
902 mov [TextPosX], al
903 mov [TextColorFore], 06h ; brown for != 512
904 mov ax, [bx+LocDISKINFO_I13X_SecSize]
905 cmp ax, 0200h
906 jne @F
907 mov [TextColorFore], ch ; white when boot-disk
908 @@:
909 call VideoIO_PrintHexWord
910 mov al, 'h'
911 call VideoIO_PrintSingleChar
912 mov [TextColorFore], 08h ; reduced brightness
913
914 ; Show INT13 geometry (dec) ----------------------------- [ INT13 GEO ]
915 lodsb
916 mov [TextPosX], al
917 mov [TextColorFore], 04h ; red for (0,0)
918 mov dl, [bx+LocDISKINFO_I13_Secs]
919 mov dh, [bx+LocDISKINFO_I13_Heads]
920 test dl, dl
921 jz @F ; no spt !
922 test dh, dh
923 jz @F ; no heads !
924 mov [TextColorFore], 08h ; reduced brightness
925 @@:
926 mov al, '('
927 call VideoIO_PrintSingleChar
928 mov al, dh ; int13 heads
929 call VideoIO_PrintByteDynamicNumber
930 mov al, ','
931 call VideoIO_PrintSingleChar
932 mov al, dl ; int13 secs
933 call VideoIO_PrintByteDynamicNumber
934 mov al, ')'
935 call VideoIO_PrintSingleChar
936 mov [TextColorFore], 08h ; reduced brightness
937
938 ; Show INT13X geometry (dec) --------------------------- [ INT13X GEO ]
939 lodsb
940 mov [TextPosX], al
941 mov [TextColorFore], 04h ; red for (0,0)
942 mov dl, [bx+LocDISKINFO_I13X_Secs]
943 mov dh, [bx+LocDISKINFO_I13X_Heads]
944 test dl, dl
945 jz @F ; no spt !
946 test dh, dh
947 jz @F ; no heads !
948 mov [TextColorFore], 08h ; reduced brightness
949 @@:
950 mov al, '('
951 call VideoIO_PrintSingleChar
952 mov al, dh ; int13x heads
953 call VideoIO_PrintByteDynamicNumber
954 mov al, ','
955 call VideoIO_PrintSingleChar
956 mov al, dl ; int13x secs
957 call VideoIO_PrintByteDynamicNumber
958 mov al, ')'
959 call VideoIO_PrintSingleChar
960 mov [TextColorFore], 08h ; reduced brightness
961
962 ; Show LVM geometery (dec) ------------------------------- [ LVM GEO ]
963 lodsb
964 mov [TextPosX], al
965 mov [TextColorFore], 04h ; red for (0,0)
966 mov dl, [bx+LocDISKINFO_LVM_Secs]
967 mov dh, [bx+LocDISKINFO_LVM_Heads]
968 test dl, dl
969 jz @F ; no spt, thus no lvm !
970 test dh, dh
971 jz @F ; no heads, thus no lvm !
972 mov [TextColorFore], 09h ; marine for LVM_SPT>127
973 cmp dl, 127
974 ja @F ; IBMS506 or DANI on >1TiB
975 mov [TextColorFore], 03h ; cyan for 63>LVM_SPT<=127
976 cmp dl, 63
977 ja @F ; DANI on >502MiB
978 mov [TextColorFore], 07h ; white for normal LVM_SPT
979 @@:
980 mov al, '('
981 call VideoIO_PrintSingleChar
982 mov al, dh ; lvm heads
983 call VideoIO_PrintByteDynamicNumber
984 mov al, ','
985 call VideoIO_PrintSingleChar
986 mov al, dl ; lvm secs
987 call VideoIO_PrintByteDynamicNumber
988 mov al, ')'
989 call VideoIO_PrintSingleChar
990 mov [TextColorFore], 08h ; reduced brightness
991
992 ; Show host bus (4 chars) -------------------------------- [ HOST BUS ]
993 lodsb
994 mov [TextPosX], al
995 mov ax, [bx+LocDISKINFO_I13X_HostBus+00h]
996 mov dx, [bx+LocDISKINFO_I13X_HostBus+02h]
997 call VideoIO_PrintSingleChar
998 mov al, ah
999 call VideoIO_PrintSingleChar
1000 mov al, dl
1001 call VideoIO_PrintSingleChar
1002 mov al, dh
1003 call VideoIO_PrintSingleChar
1004
1005 ; Show interface (8 chars) ------------------------------ [ INTERFACE ]
1006 lodsb
1007 mov [TextPosX], al
1008 mov ax, [bx+LocDISKINFO_I13X_Interface+00h]
1009 mov dx, [bx+LocDISKINFO_I13X_Interface+02h]
1010 call VideoIO_PrintSingleChar
1011 mov al, ah
1012 call VideoIO_PrintSingleChar
1013 mov al, dl
1014 call VideoIO_PrintSingleChar
1015 mov al, dh
1016 call VideoIO_PrintSingleChar
1017 mov ax, [bx+LocDISKINFO_I13X_Interface+04h]
1018 mov dx, [bx+LocDISKINFO_I13X_Interface+06h]
1019 call VideoIO_PrintSingleChar
1020 mov al, ah
1021 call VideoIO_PrintSingleChar
1022 mov al, dl
1023 call VideoIO_PrintSingleChar
1024 mov al, dh
1025 call VideoIO_PrintSingleChar
1026
1027 ; Show if disk is removable (YES/NO) -------------------- [ REMOVABLE ]
1028 lodsb
1029 mov [TextPosX], al
1030 mov si, offset [No]
1031 mov ax, [bx+LocDISKINFO_I13X_Flags]
1032 test ax, 0004h
1033 jz @F
1034 mov si, offset [Yes]
1035 mov [TextColorFore], 06h ; brown
1036 @@:
1037 call VideoIO_Print
1038 mov [TextColorFore], 08h ; reduced brightness
1039
1040 ; Increment disk index
1041 inc cl
1042
1043 ; Process next disk if still in range
1044 cmp cl, [TotalHarddiscs]
1045 jb VideoIO_DisplayDiskInfo_next_disk
1046
1047 ; We're done
1048 VideoIO_DisplayDiskInfo_end:
1049
1050 ; Restore video state
1051 pop dx
1052 pop ax
1053 mov [TextPosY], dh
1054 mov [TextPosX], dl
1055 mov [TextColorBack], ah
1056 mov [TextColorFore], al
1057
1058 ; Restore segment registers
1059 pop es
1060 pop ds
1061
1062 ; Restore work registers
1063 popa
1064
1065 ret
1066VideoIO_DisplayDiskInfo EndP
1067
1068
1069;
1070; Set position to teletype cursor
1071;
1072VideoIO_ShowWaitDots Proc
1073 pusha
1074 ; Color white on black
1075 mov ch,7
1076 mov cl,0
1077 call VideoIO_Color
1078 ; Locate cursor for output of debug-info
1079 mov ch,8
1080 mov cl,1
1081 call VideoIO_Locate
1082
1083 ; Print dots with interval.
1084 mov cx,10
1085 VideoIO_ShowWaitDots_next_dot:
1086 mov al,'.'
1087 call VideoIO_PrintSingleChar
1088 ; Value 30 is about 1.5 seconds
1089 mov al,1
1090 call TIMER_WaitTicCount
1091 loop VideoIO_ShowWaitDots_next_dot
1092 popa
1093 ret
1094VideoIO_ShowWaitDots EndP
1095
1096
1097; DOS CR/LF
1098NL db 0dh, 0ah, 0
1099
1100IF NOT BLD_LANG_TXT EQ 'es'
1101;
1102; Strings used in the pre-MENU screen
1103;
1104DisksFound db "Disks Found : ",0
1105PartitionsFound db "Partitions Found : ",0
1106Phase1 db "OS/2 Install Phase 1 : ",0
1107TABMessage db "Press TAB to return to the AiR-BOOT Menu",0
1108PREPMessage db "Preparing BOOT Menu...",0
1109Yes db "YES",0
1110No db "NO",0
1111;~ On db "ON",0
1112;~ Off db "OFF",0
1113;~ None db "NONE",0
1114;~ Active db "ACTIVE",0
1115;~ NotActive db "NOT ACTIVE",0
1116;~ AutoStartPart db "Auto Start Partition : ",0
1117
1118 ; Label positions for disk information in preboot-menu
1119 VideoIO_DisplayDiskInfo_labpos db 0, 5, 17, 26, 36, 46, 56, 61, 71
1120
1121 ; Label names for disk information in preboot-menu
1122 VideoIO_DisplayDiskInfo_labels db 'DISK '
1123 db 'SECTORS_LBA '
1124 db 'SECSIZE '
1125 db 'I13_GEO '
1126 db 'I13X_GEO '
1127 db 'LVM_GEO '
1128 db 'BUS '
1129 db 'INTERFACE '
1130 db 'REMOVABLE'
1131 db 0
1132ENDIF
Note: See TracBrowser for help on using the repository browser.