source: trunk/bootcode/regular/videoio.asm

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

Merged "menus-es-20180708.asm" provided by Alfredo [v1.1.5-testing]

Translator-build 'AiR-BOOT-v1.1.5-ES-TESTBUILD-20180710' 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.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 db 085h
463 db 0D5h
464 db 0C4h
465 db 0D7h
466 db 0C4h
467 db 085h
468
469; In: BX - Begin Position, DX - End Position
470; Destroyed: BX DX
471VideoIO_MakeWindow Proc Near Uses ax bx cx es di
472 mov WinBeginPosY, bh
473 mov WinBeginPosX, bl
474 mov WinEndPosY, dh
475 mov WinEndPosX, dl
476 mov cx, bx
477 inc ch
478 call VideoIO_Locate ; StartPos left line
479 mov cl, WinEndPosY
480 sub cl, WinBeginPosY
481 dec cl
482 mov al, WinCharDown
483 push cx
484 call VideoIO_Internal_MakeWinDown
485 mov ch, WinBeginPosY
486 mov cl, WinEndPosX
487 inc ch
488 call VideoIO_Locate ; StartPos right line
489 pop cx
490 mov al, WinCharDown
491 call VideoIO_Internal_MakeWinDown
492 ; Left & Right are already done...
493 mov ch, WinBeginPosY
494 mov cl, WinBeginPosX
495 call VideoIO_Locate ; StartPos upper line
496 mov al, WinCharBB
497 call VideoIO_PrintSingleChar
498 mov cl, WinEndPosX
499 sub cl, WinBeginPosX
500 dec cl
501 mov al, WinCharRight
502 push cx
503 call VideoIO_Internal_MakeWinRight
504 mov al, WinCharBE
505 call VideoIO_PrintSingleChar
506 mov ch, WinEndPosY
507 mov cl, WinBeginPosX
508 call VideoIO_Locate ; StartPos lower line
509 mov al, WinCharEB
510 call VideoIO_PrintSingleChar
511 pop cx
512 mov al, WinCharRight
513 call VideoIO_Internal_MakeWinRight
514 mov al, WinCharEE
515 call VideoIO_PrintSingleChar
516 ; Frame done, now just filling...
517 mov bh, WinEndPosY
518 sub bh, WinBeginPosY
519 dec bh
520 mov bl, WinEndPosX
521 sub bl, WinBeginPosX
522 dec bl
523
524 VIOIMW_Loop:
525 mov ch, WinBeginPosY
526 add ch, bh
527 mov cl, WinBeginPosX
528 inc cl
529 call VideoIO_Locate
530
531 mov al, 20h
532 mov cl, bl
533 push bx
534 call VideoIO_Internal_MakeWinRight
535 pop bx
536 dec bh
537 jnz VIOIMW_Loop
538 ret
539VideoIO_MakeWindow EndP
540
541; In: AX - Segment to copy B800 to...
542; Destroyed: BX DX
543VideoIO_BackUpTo Proc Near Uses cx ds si es di
544 mov es, ax
545 mov ax, 0B800h
546 mov ds, ax
547 xor si, si
548 xor di, di
549 mov cx, 800h ; Copy 1000h bytes
550 rep movsw
551 ret
552VideoIO_BackUpTo EndP
553
554VideoIO_RestoreFrom Proc Near Uses cx ds si es di
555 mov ds, ax
556 mov ax, 0B800h
557 mov es, ax
558 xor si, si
559 xor di, di
560 mov cx, 800h ; Copy 1000h bytes
561 rep movsw
562 ret
563VideoIO_RestoreFrom EndP
564
565; In: CL - Total Length of String
566; DS:SI - Actual String
567; Out: Carry Set if String was ENTERd
568; Destroyed: *none*
569VideoIO_LetUserEditString Proc Near Uses ax bx cx dx si es di
570 local StartPosX:byte, LastPosX:byte
571 local StringLen:byte
572
573 or cl, cl
574 jnz VIOLUES_LenNotNUL
575 clc
576 ret
577
578 VIOLUES_LenNotNUL:
579 mov al, TextPosX
580 inc al
581 mov StartPosX, al
582 mov StringLen, cl
583
584 push cx
585 call VideoIO_Internal_SetRegs ; ES:DI - Pos on Screen at Start
586
587 xor ch, ch
588 call GetLenOfName ; CX - Actual Length of String
589 mov dl, cl
590
591 ; Set Cursor behind String and turn it on...
592 add cl, StartPosX
593 call VideoIO_Locate
594 call VideoIO_CursorSet
595 call VideoIO_CursorOn ; Set and turn cursor on
596
597 ; ES:DI - Screen-Position to Start of String
598 ; DL - Position in String (relative to begin, base=0)
599
600 VIOLUES_Loop:
601 mov ah, 0
602 int 16h
603 cmp ah, Keys_ESC
604 je VIOLUES_KeyESC
605 cmp ah, Keys_ENTER
606 je VIOLUES_KeyENTER
607 cmp ah, Keys_Backspace
608 je VIOLUES_KeyBACKSPACE
609 ; Check for valid char...
610 cmp al, 32
611 jb VIOLUES_Loop
612 cmp al, 166
613 ja VIOLUES_Loop
614 ; Okay, Character to add to string
615 cmp dl, StringLen ; String "full" ?
616 jae VIOLUES_Loop
617 ;movzx bx, dl
618 mov bl,dl
619 mov bh,0
620
621 shl bx, 1
622 mov es:[di+bx], al
623 inc dl
624 VIOLUES_UpdateCursor:
625 mov cl, dl
626 add cl, StartPosX
627 call VideoIO_Locate
628 call VideoIO_CursorSet
629 jmp VIOLUES_Loop
630
631 VIOLUES_KeyBACKSPACE:
632 or dl, dl ; String "empty" ?
633 jz VIOLUES_Loop
634 mov al, ' '
635 dec dl
636 ;movzx bx, dl
637 mov bl,dl
638 mov bh,0
639
640 shl bx, 1
641 mov es:[di+bx], al
642 jmp VIOLUES_UpdateCursor
643
644 VIOLUES_KeyESC:
645 pop cx
646 call VideoIO_CursorOff ; Bye Bye cursor
647 clc
648 ret
649
650 VIOLUES_KeyENTER:
651 pop cx
652 ; ENTERd, so copy data to String-Pointer...
653 VIOLUES_CopyLoop:
654 mov al, es:[di]
655 add di, 2
656 mov ds:[si], al
657 inc si
658 dec cl
659 jnz VIOLUES_CopyLoop
660 ; Finally Cursor off-line...
661 call VideoIO_CursorOff
662 stc
663 ret
664VideoIO_LetUserEditString EndP
665
666
667
668;
669; Rousseau Additions.
670;
671
672
673; Function Template
674;ProcName Proc Near Uses ax bx cx dx si es di
675;ProcName EndP
676
677
678;
679; Clear the current page
680;
681VideoIO_ClearScreen Proc Near Uses ax bx cx dx si es di
682 mov al, 0 ; clear entire window
683 mov bh,07h ; Attribute for new lines
684 xor cx,cx ; Row, Column ULC
685 xor dx,dx
686 dec dx ; Row, Column LRC (does this corrupt other pages ?)
687 mov ah, 06h ; Function Code
688 int 10h ; Do It !
689 ret
690VideoIO_ClearScreen EndP
691
692;
693; Set position to teletype cursor
694;
695VideoIO_SyncPos Proc Near Uses ax bx cx dx
696 pushf
697 mov bh, 0
698 mov ah, 03h
699 int 10h
700 mov [TextPosX], dl
701 mov [TextPosY], dh
702 popf
703 ret
704VideoIO_SyncPos EndP
705
706;
707; Put the Build Information at the POST BIOS screen.
708;
709VideoIO_PrintBuildInfo Proc Near Uses ax bx dx cx si di
710 ; Print header.
711 mov si, offset [build_date]
712 call MBR_Teletype
713 call VideoIO_SyncPos
714
715 ; Display part of build information
716 mov si, offset bld_level_date_start
717 mov cx, offset bld_level_date_end
718 sub cx, si
719 call VideoIO_FixedPrint
720 mov cx, 10
721 xor dx, dx
722 mov [TextPosX], 65
723 mov al, ' '
724 mov si, offset [WinBeginPosY]
725
726 ; Adjust positions for language
727 mov bx, BLD_LANG_TXT
728 cmp bx, 06573h
729 jne @F
730 xchg ah, al
731 mov byte ptr [si+20], 0c6h
732 mov byte ptr [si+22], 007h
733 mov bx, cx
734 push si
735 push [si+bx+00]
736 push [si+bx+02]
737 push [si+bx+04]
738 mov dx, 5
739 mov di, si
740 add di, bx
741 add si, 17
742 mov cx, 7
743 add cx, dx
744 inc cx
745 cld
746 rep movsb
747 xchg bx, cx
748 pop [di+bx+04]
749 pop [di+bx+02]
750 pop [di+bx+00]
751 pop si
752 sub [TextPosX], dl
753 xchg ah, al
754 @@:
755 add si, cx
756 mov ah, al
757 xor al, ah
758 shr ah, 4
759 sub ax,2
760 mov bx, ax
761 mov ax, [bx]
762 shl ax, 4
763 add cx, 4
764 add cx, dx
765 @@: lodsb
766 xor al, ah
767 call VideoIO_PrintSingleChar
768 loop @B
769 add [TextPosY], 2
770 mov [TextPosX], 0
771 call MBR_TeletypeSyncPos
772 ret
773VideoIO_PrintBuildInfo EndP
774
775
776
777
778;------------------------------------------------------------------------------
779; [TextColorFore], 01h ; blue
780; [TextColorFore], 02h ; green
781; [TextColorFore], 03h ; cyan
782; [TextColorFore], 04h ; red
783; [TextColorFore], 05h ; magenta
784; [TextColorFore], 06h ; brown
785; [TextColorFore], 07h ; white
786; [TextColorFore], 08h ; grey
787; [TextColorFore], 09h ; marine
788; [TextColorFore], 0ah ; bright green
789; [TextColorFore], 0bh ; bright cyan
790; [TextColorFore], 0ch ; bright red
791; [TextColorFore], 0dh ; bright magenta
792; [TextColorFore], 0eh ; bright yellow
793; [TextColorFore], 0fh ; bright white
794; [TextColorFore], 10h ; black on blue.
795; more...
796;------------------------------------------------------------------------------
797; Show disk and other information on the pre-MENU screen
798;------------------------------------------------------------------------------
799; IN : None
800; OUT : None
801; NOTE : Assumes VIDEO and DISK stuff has been done already
802; TODO : Optimize for space (use seperate function to display geo)
803;------------------------------------------------------------------------------
804VideoIO_DisplayDiskInfo Proc Near
805
806 ; Push the whole shebang
807 pusha
808
809 ; Push these too for safety
810 push ds
811 push es
812
813 ; Save current video state
814 mov al, [TextColorFore]
815 mov ah, [TextColorBack]
816 mov dl, [TextPosX]
817 mov dh, [TextPosY]
818 push ax
819 push dx
820
821
822 ;
823 ; Display disk information on the pre-MENU screen
824 ;
825
826
827 ; Start postition -- allow for AuxIO message when debugging
828IFNDEF AUX_DEBUG
829 mov [TextPosY], 7
830ELSE
831 mov [TextPosY], 8
832ENDIF
833 mov [TextPosX], 0
834
835 ; Normal colors
836 mov [TextColorFore], 07h ; white
837 mov [TextColorBack], 00h ; black
838
839 ; Show the labels
840 mov si, offset [VideoIO_DisplayDiskInfo_labels]
841 call VideoIO_Print
842
843 ; Zero based index of first drive to scan
844 xor cl, cl
845
846 ; Reduced brightness
847 mov [TextColorFore], 08h
848
849 ; Loop over all disks found
850 VideoIO_DisplayDiskInfo_next_disk:
851
852 ; Compose BIOS disk number (80h, 81h, etc)
853 mov dl, cl
854 add dl, 80h
855
856 ; Pointer to label positions
857 mov si, offset VideoIO_DisplayDiskInfo_labpos
858
859
860 ; Position on start of next line
861 inc [TextPosY]
862 lodsb
863 mov [TextPosX], al
864
865 ; Show a bright star if this is the BIOS boot-disk
866 ;~ mov [TextColorBack], 08h
867 mov al, ' '
868 cmp dl, [BIOS_BootDisk]
869 jne @F
870 mov [TextColorFore], 0fh
871 mov al, '*'
872 @@:
873 call VideoIO_PrintSingleChar
874
875 ; Show BIOS disk number in normal white ----------------- [ BIOS DISK ]
876 mov [TextColorFore], 07h
877 mov al, dl
878 call VideoIO_PrintHexByte
879 mov al, 'h'
880 call VideoIO_PrintSingleChar
881 mov [TextColorFore], 08h
882
883 ; Get pointer to DISKINFO structure in BX
884 call DriveIO_CalcDiskInfoPointer
885
886 ; Show disk size in LBA sectors (hex) -------------------- [ LBA SECS ]
887 lodsb
888 mov [TextPosX], al
889 mov [TextColorFore], 06h ; brown for >2TiB
890 mov al, [bx+LocDISKINFO_I13X_SecsLBA+04h]
891 test al, al
892 jnz @F
893 mov ch, 08h ; reduced brightness
894 cmp dl, [BIOS_BootDisk]
895 lahf ; load flags
896 rcl ah, 2 ; move ZF to CF
897 sbb ch, 0 ; change color to white
898 mov [TextColorFore], ch ; white when boot-disk
899 @@:
900 call VideoIO_PrintHexByte
901 mov ax, [bx+LocDISKINFO_I13X_SecsLBA+00h]
902 mov dx, [bx+LocDISKINFO_I13X_SecsLBA+02h]
903 call VideoIO_PrintHexDWord
904 mov al, 'h'
905 call VideoIO_PrintSingleChar
906 mov [TextColorFore], 08h ; reduced brightness
907
908 ; Show sector size (hex) ------------------------------ [ SECTOR SIZE ]
909 lodsb
910 mov [TextPosX], al
911 mov [TextColorFore], 06h ; brown for != 512
912 mov ax, [bx+LocDISKINFO_I13X_SecSize]
913 cmp ax, 0200h
914 jne @F
915 mov [TextColorFore], ch ; white when boot-disk
916 @@:
917 call VideoIO_PrintHexWord
918 mov al, 'h'
919 call VideoIO_PrintSingleChar
920 mov [TextColorFore], 08h ; reduced brightness
921
922 ; Show INT13 geometry (dec) ----------------------------- [ INT13 GEO ]
923 lodsb
924 mov [TextPosX], al
925 mov [TextColorFore], 04h ; red for (0,0)
926 mov dl, [bx+LocDISKINFO_I13_Secs]
927 mov dh, [bx+LocDISKINFO_I13_Heads]
928 test dl, dl
929 jz @F ; no spt !
930 test dh, dh
931 jz @F ; no heads !
932 mov [TextColorFore], 08h ; reduced brightness
933 @@:
934 mov al, '('
935 call VideoIO_PrintSingleChar
936 mov al, dh ; int13 heads
937 call VideoIO_PrintByteDynamicNumber
938 mov al, ','
939 call VideoIO_PrintSingleChar
940 mov al, dl ; int13 secs
941 call VideoIO_PrintByteDynamicNumber
942 mov al, ')'
943 call VideoIO_PrintSingleChar
944 mov [TextColorFore], 08h ; reduced brightness
945
946 ; Show INT13X geometry (dec) --------------------------- [ INT13X GEO ]
947 lodsb
948 mov [TextPosX], al
949 mov [TextColorFore], 04h ; red for (0,0)
950 mov dl, [bx+LocDISKINFO_I13X_Secs]
951 mov dh, [bx+LocDISKINFO_I13X_Heads]
952 test dl, dl
953 jz @F ; no spt !
954 test dh, dh
955 jz @F ; no heads !
956 mov [TextColorFore], 08h ; reduced brightness
957 @@:
958 mov al, '('
959 call VideoIO_PrintSingleChar
960 mov al, dh ; int13x heads
961 call VideoIO_PrintByteDynamicNumber
962 mov al, ','
963 call VideoIO_PrintSingleChar
964 mov al, dl ; int13x secs
965 call VideoIO_PrintByteDynamicNumber
966 mov al, ')'
967 call VideoIO_PrintSingleChar
968 mov [TextColorFore], 08h ; reduced brightness
969
970 ; Show LVM geometery (dec) ------------------------------- [ LVM GEO ]
971 lodsb
972 mov [TextPosX], al
973 mov [TextColorFore], 04h ; red for (0,0)
974 mov dl, [bx+LocDISKINFO_LVM_Secs]
975 mov dh, [bx+LocDISKINFO_LVM_Heads]
976 test dl, dl
977 jz @F ; no spt, thus no lvm !
978 test dh, dh
979 jz @F ; no heads, thus no lvm !
980 mov [TextColorFore], 09h ; marine for LVM_SPT>127
981 cmp dl, 127
982 ja @F ; IBMS506 or DANI on >1TiB
983 mov [TextColorFore], 03h ; cyan for 63>LVM_SPT<=127
984 cmp dl, 63
985 ja @F ; DANI on >502MiB
986 mov [TextColorFore], 07h ; white for normal LVM_SPT
987 @@:
988 mov al, '('
989 call VideoIO_PrintSingleChar
990 mov al, dh ; lvm heads
991 call VideoIO_PrintByteDynamicNumber
992 mov al, ','
993 call VideoIO_PrintSingleChar
994 mov al, dl ; lvm secs
995 call VideoIO_PrintByteDynamicNumber
996 mov al, ')'
997 call VideoIO_PrintSingleChar
998 mov [TextColorFore], 08h ; reduced brightness
999
1000 ; Show host bus (4 chars) -------------------------------- [ HOST BUS ]
1001 lodsb
1002 mov [TextPosX], al
1003 mov ax, [bx+LocDISKINFO_I13X_HostBus+00h]
1004 mov dx, [bx+LocDISKINFO_I13X_HostBus+02h]
1005 call VideoIO_PrintSingleChar
1006 mov al, ah
1007 call VideoIO_PrintSingleChar
1008 mov al, dl
1009 call VideoIO_PrintSingleChar
1010 mov al, dh
1011 call VideoIO_PrintSingleChar
1012
1013 ; Show interface (8 chars) ------------------------------ [ INTERFACE ]
1014 lodsb
1015 mov [TextPosX], al
1016 mov ax, [bx+LocDISKINFO_I13X_Interface+00h]
1017 mov dx, [bx+LocDISKINFO_I13X_Interface+02h]
1018 call VideoIO_PrintSingleChar
1019 mov al, ah
1020 call VideoIO_PrintSingleChar
1021 mov al, dl
1022 call VideoIO_PrintSingleChar
1023 mov al, dh
1024 call VideoIO_PrintSingleChar
1025 mov ax, [bx+LocDISKINFO_I13X_Interface+04h]
1026 mov dx, [bx+LocDISKINFO_I13X_Interface+06h]
1027 call VideoIO_PrintSingleChar
1028 mov al, ah
1029 call VideoIO_PrintSingleChar
1030 mov al, dl
1031 call VideoIO_PrintSingleChar
1032 mov al, dh
1033 call VideoIO_PrintSingleChar
1034
1035 ; Show if disk is removable (YES/NO) -------------------- [ REMOVABLE ]
1036 lodsb
1037 mov [TextPosX], al
1038 mov si, offset [No]
1039 mov ax, [bx+LocDISKINFO_I13X_Flags]
1040 test ax, 0004h
1041 jz @F
1042 mov si, offset [Yes]
1043 mov [TextColorFore], 06h ; brown
1044 @@:
1045 call VideoIO_Print
1046 mov [TextColorFore], 08h ; reduced brightness
1047
1048 ; Increment disk index
1049 inc cl
1050
1051 ; Process next disk if still in range
1052 cmp cl, [TotalHarddiscs]
1053 jb VideoIO_DisplayDiskInfo_next_disk
1054
1055 ; We're done
1056 VideoIO_DisplayDiskInfo_end:
1057
1058 ; Restore video state
1059 pop dx
1060 pop ax
1061 mov [TextPosY], dh
1062 mov [TextPosX], dl
1063 mov [TextColorBack], ah
1064 mov [TextColorFore], al
1065
1066 ; Restore segment registers
1067 pop es
1068 pop ds
1069
1070 ; Restore work registers
1071 popa
1072
1073 ret
1074VideoIO_DisplayDiskInfo EndP
1075
1076
1077;
1078; Set position to teletype cursor
1079;
1080VideoIO_ShowWaitDots Proc
1081 pusha
1082 ; Color white on black
1083 mov ch,7
1084 mov cl,0
1085 call VideoIO_Color
1086 ; Locate cursor for output of debug-info
1087 mov ch,8
1088 mov cl,1
1089 call VideoIO_Locate
1090
1091 ; Print dots with interval.
1092 mov cx,10
1093 VideoIO_ShowWaitDots_next_dot:
1094 mov al,'.'
1095 call VideoIO_PrintSingleChar
1096 ; Value 30 is about 1.5 seconds
1097 mov al,1
1098 call TIMER_WaitTicCount
1099 loop VideoIO_ShowWaitDots_next_dot
1100 popa
1101 ret
1102VideoIO_ShowWaitDots EndP
1103
1104
1105; DOS CR/LF
1106NL db 0dh, 0ah, 0
1107
1108IF NOT BLD_LANG_TXT EQ 'es'
1109;
1110; Strings used in the pre-MENU screen
1111;
1112DisksFound db "Disks Found : ",0
1113PartitionsFound db "Partitions Found : ",0
1114Phase1 db "OS/2 Install Phase 1 : ",0
1115TABMessage db "Press TAB to return to the AiR-BOOT Menu",0
1116PREPMessage db "Preparing BOOT Menu...",0
1117Yes db "YES",0
1118No db "NO",0
1119;~ On db "ON",0
1120;~ Off db "OFF",0
1121;~ None db "NONE",0
1122;~ Active db "ACTIVE",0
1123;~ NotActive db "NOT ACTIVE",0
1124;~ AutoStartPart db "Auto Start Partition : ",0
1125
1126 ; Label positions for disk information in preboot-menu
1127 VideoIO_DisplayDiskInfo_labpos db 0, 5, 17, 26, 36, 46, 56, 61, 71
1128
1129 ; Label names for disk information in preboot-menu
1130 VideoIO_DisplayDiskInfo_labels db 'DISK '
1131 db 'SECTORS_LBA '
1132 db 'SECSIZE '
1133 db 'I13_GEO '
1134 db 'I13X_GEO '
1135 db 'LVM_GEO '
1136 db 'BUS '
1137 db 'INTERFACE '
1138 db 'REMOVABLE'
1139 db 0
1140ENDIF
Note: See TracBrowser for help on using the repository browser.