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 |
|
---|
22 | IFDEF MODULE_NAMES
|
---|
23 | DB 'VIDEOIO',0
|
---|
24 | ENDIF
|
---|
25 |
|
---|
26 | VideoIO_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
|
---|
37 | VideoIO_WaitRetrace EndP
|
---|
38 |
|
---|
39 |
|
---|
40 |
|
---|
41 | ; Holds the current position. Yeah, I know this is in the code area, but who
|
---|
42 | ; cares :))
|
---|
43 | TextPosY db 0h
|
---|
44 | TextPosX db 0h
|
---|
45 | TextColorFore db 7h
|
---|
46 | TextColorBack db 0h
|
---|
47 |
|
---|
48 | ; In: CH - Cursor Column, CL - Cursor Row (Start at 1,1)
|
---|
49 | ; Destroyed: None
|
---|
50 | VideoIO_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
|
---|
62 | VideoIO_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
|
---|
67 | VideoIO_LocateToCenter Proc Near Uses cx dx
|
---|
68 | shr dl, 1 ; Length / 2
|
---|
69 | sub cl, dl
|
---|
70 | call VideoIO_Locate
|
---|
71 | ret
|
---|
72 | VideoIO_LocateToCenter EndP
|
---|
73 |
|
---|
74 | ; In: CH - Color Fore, CL - Color Back
|
---|
75 | ; Destroyed: None
|
---|
76 | VideoIO_Color Proc Near Uses cx
|
---|
77 | mov TextColorFore, CH
|
---|
78 | mov TextColorBack, CL
|
---|
79 | ret
|
---|
80 | VideoIO_Color EndP
|
---|
81 |
|
---|
82 | VideoIO_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
|
---|
87 | VideoIO_CursorOff EndP
|
---|
88 |
|
---|
89 | VideoIO_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
|
---|
94 | VideoIO_CursorOn EndP
|
---|
95 |
|
---|
96 | VideoIO_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
|
---|
103 | VideoIO_CursorSet EndP
|
---|
104 |
|
---|
105 | ; Sets DI which is used across many video routines !
|
---|
106 | VideoIO_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
|
---|
125 | VideoIO_Internal_SetRegs EndP
|
---|
126 |
|
---|
127 | ; In: SI - String to Print (EOS is 0)
|
---|
128 | ; Destroyed: SI
|
---|
129 | VideoIO_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
|
---|
142 | VideoIO_Print EndP
|
---|
143 |
|
---|
144 | ; In: SI - String to Print (EOS is 0)
|
---|
145 | ; Destroyed: SI
|
---|
146 | VideoIO_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
|
---|
160 | VideoIO_PrintLikeLenOfName EndP
|
---|
161 |
|
---|
162 | ; In: SI - String to Print
|
---|
163 | ; CL - Len Of String
|
---|
164 | ; Destroyed: SI
|
---|
165 | VideoIO_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
|
---|
179 | VideoIO_FixedPrint EndP
|
---|
180 |
|
---|
181 | ; Rousseau:
|
---|
182 | ; Turn off blinking
|
---|
183 | ; http://www.ctyme.com/intr/rb-0088.htm does not mention this
|
---|
184 | VideoIO_NoBlinking Proc Near Uses ax bx
|
---|
185 | mov bx,0
|
---|
186 | mov ax,1003h
|
---|
187 | int 10h
|
---|
188 | ret
|
---|
189 | VideoIO_NoBlinking EndP
|
---|
190 |
|
---|
191 | ; In: AL - Single Char to Print
|
---|
192 | ; Destroyed: None
|
---|
193 | VideoIO_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
|
---|
200 | VideoIO_PrintSingleChar EndP
|
---|
201 |
|
---|
202 |
|
---|
203 |
|
---|
204 | ; Print hex-byte to screen
|
---|
205 | ; This outputs two characters
|
---|
206 | ; In: AL - byte to send
|
---|
207 | ; Out: AL - byte sent
|
---|
208 | ; Destroyed: None
|
---|
209 | VideoIO_PrintHexByte Proc Near Uses ax
|
---|
210 | call CONV_BinToAsc ; Returns high hex-nibble in AH, low hex-nibble in AL
|
---|
211 | xchg al,ah ; High hex-nibble first
|
---|
212 | call VideoIO_PrintSingleChar ; Output to screen
|
---|
213 | xchg al,ah ; Low hex-nibble next
|
---|
214 | call VideoIO_PrintSingleChar ; Output to screen
|
---|
215 | ret
|
---|
216 | VideoIO_PrintHexByte EndP
|
---|
217 |
|
---|
218 |
|
---|
219 | ; Print hex-word to screen
|
---|
220 | ; This outputs four characters
|
---|
221 | ; In: AX - word to send
|
---|
222 | ; Out: AX - word sent
|
---|
223 | ; Destroyed: None
|
---|
224 | VideoIO_PrintHexWord Proc Near
|
---|
225 | xchg al,ah ; High byte first
|
---|
226 | call VideoIO_PrintHexByte ; Output to screen
|
---|
227 | xchg al,ah ; low byte next
|
---|
228 | call VideoIO_PrintHexByte ; Output to screen
|
---|
229 | ret
|
---|
230 | VideoIO_PrintHexWord EndP
|
---|
231 |
|
---|
232 |
|
---|
233 | ; Print hex-dword to screen
|
---|
234 | ; This outputs eight characters
|
---|
235 | ; In: DX:AX - dword to send
|
---|
236 | ; Out: DX:AX - dword sent
|
---|
237 | ; Destroyed: None
|
---|
238 | VideoIO_PrintHexDWord Proc Near
|
---|
239 | xchg ax,dx
|
---|
240 | call VideoIO_PrintHexWord ; High word first
|
---|
241 | xchg ax,dx
|
---|
242 | call VideoIO_PrintHexWord ; Low word next
|
---|
243 | ret
|
---|
244 | VideoIO_PrintHexDWord EndP
|
---|
245 |
|
---|
246 |
|
---|
247 | ; Print hex-qword to screen
|
---|
248 | ; This outputs sixteen characters
|
---|
249 | ; In: BX:CX:DX:AX - qword to send
|
---|
250 | ; Out: BX:CX:DX:AX - qword sent
|
---|
251 | ; Destroyed: None
|
---|
252 | VideoIO_PrintHexQWord Proc Near
|
---|
253 | xchg dx,bx
|
---|
254 | xchg ax,cx
|
---|
255 | call VideoIO_PrintHexDWord ; High dword first
|
---|
256 | xchg dx,bx
|
---|
257 | xchg ax,cx
|
---|
258 | call VideoIO_PrintHexDWord ; Low dword next
|
---|
259 | ret
|
---|
260 | VideoIO_PrintHexQWord EndP
|
---|
261 |
|
---|
262 |
|
---|
263 |
|
---|
264 |
|
---|
265 |
|
---|
266 | ; In: AL - Single Char to Print
|
---|
267 | ; CL - Times to print it
|
---|
268 | ; Destroyed: None
|
---|
269 | VideoIO_PrintSingleMultiChar Proc Near Uses ax bx cx es di
|
---|
270 | or cl, cl
|
---|
271 | jz VIOPSMC_NoChars
|
---|
272 | mov bl, al
|
---|
273 | call VideoIO_Internal_SetRegs
|
---|
274 | VIOPSMC_Loop:
|
---|
275 | mov es:[di], bl
|
---|
276 | mov es:[di+1], ah
|
---|
277 | add di, 2
|
---|
278 | inc TextPosX
|
---|
279 | dec cl
|
---|
280 | jnz VIOPSMC_Loop
|
---|
281 | VIOPSMC_NoChars:
|
---|
282 | ret
|
---|
283 | VideoIO_PrintSingleMultiChar EndP
|
---|
284 |
|
---|
285 | ; Will print a number to screen (2 bytes t.m. 0-99)
|
---|
286 | ; In: AL - Single Byte to Print
|
---|
287 | ; Destroyed: None
|
---|
288 | VideoIO_PrintByteNumber Proc Near Uses ax bx dx es di
|
---|
289 | cmp al, 99
|
---|
290 | ja VIOPBN_DoNotWriteAnything
|
---|
291 | ;movzx bx, al
|
---|
292 | mov bl,al
|
---|
293 | mov bh,0
|
---|
294 |
|
---|
295 | call VideoIO_Internal_SetRegs
|
---|
296 | cmp bl, 10
|
---|
297 | jb VIOPBN_Lower10
|
---|
298 | push ax
|
---|
299 | ;movzx ax, bl
|
---|
300 | mov al,bl
|
---|
301 | mov ah,0
|
---|
302 |
|
---|
303 | mov dl, 10
|
---|
304 | div dl
|
---|
305 | mov bh, al ; BH = Upper Number
|
---|
306 | mov bl, ah ; BL = Rest
|
---|
307 | pop ax
|
---|
308 | VIOPBN_Lower10:
|
---|
309 | add bh, 30h
|
---|
310 | add bl, 30h
|
---|
311 | mov es:[di], bh
|
---|
312 | mov es:[di+1], ah
|
---|
313 | mov es:[di+2], bl
|
---|
314 | mov es:[di+3], ah
|
---|
315 | VIOPBN_DoNotWriteAnything:
|
---|
316 | add TextPosX, 2
|
---|
317 | ret
|
---|
318 | VideoIO_PrintByteNumber EndP
|
---|
319 |
|
---|
320 | ; Will print a number to screen (dynamic bytes from 0 to 255)
|
---|
321 | ; In: AL - Single Byte to Print
|
---|
322 | ; Destroyed: None
|
---|
323 | VideoIO_PrintByteDynamicNumber Proc Near Uses ax bx cx dx es di ; Rousseau: cx was missing from push-list
|
---|
324 | xor cl, cl
|
---|
325 | mov bh, al
|
---|
326 | call VideoIO_Internal_SetRegs
|
---|
327 | xchg bh, ah ; Exchange backgroundcolor with Number
|
---|
328 | cmp ah, 10
|
---|
329 | jb VIOPBDN_Lower10
|
---|
330 | cmp ah, 100
|
---|
331 | jb VIOPBDN_Lower100
|
---|
332 | ;movzx ax, ah
|
---|
333 | mov al,ah
|
---|
334 | mov ah,0
|
---|
335 |
|
---|
336 | mov dl, 100
|
---|
337 | div dl
|
---|
338 | add al, 30h
|
---|
339 | mov es:[di], al
|
---|
340 | mov es:[di+1], bh
|
---|
341 | inc TextPosX
|
---|
342 | add di, 2
|
---|
343 | VIOPBDN_Lower100:
|
---|
344 | ;movzx ax, ah
|
---|
345 | mov al,ah
|
---|
346 | mov ah,0
|
---|
347 |
|
---|
348 | mov dl, 10
|
---|
349 | div dl
|
---|
350 | add al, 30h
|
---|
351 | mov es:[di], al
|
---|
352 | mov es:[di+1], bh
|
---|
353 | inc TextPosX
|
---|
354 | add di, 2
|
---|
355 | VIOPBDN_Lower10:
|
---|
356 | add ah, 30h
|
---|
357 | mov es:[di], ah
|
---|
358 | mov es:[di+1], bh
|
---|
359 | inc TextPosX
|
---|
360 | add di, 2
|
---|
361 | ret
|
---|
362 | VideoIO_PrintByteDynamicNumber EndP
|
---|
363 |
|
---|
364 |
|
---|
365 | ; In: AL - Zeichen zum Zeichnen, CL - Wie oft
|
---|
366 | ; Destroyed: None Important
|
---|
367 | VideoIO_Internal_MakeWinDown Proc Near Uses dx di
|
---|
368 | ;movzx dx, cl
|
---|
369 | mov dl,cl
|
---|
370 | mov dh,0
|
---|
371 |
|
---|
372 | mov bl, al
|
---|
373 | call VideoIO_Internal_SetRegs
|
---|
374 | mov al, bl
|
---|
375 | VIOIMWD_Loop:
|
---|
376 | mov es:[di], al
|
---|
377 | mov es:[di+1], ah
|
---|
378 | add di, 160
|
---|
379 | inc TextPosY
|
---|
380 | dec dx
|
---|
381 | jnz VIOIMWD_Loop
|
---|
382 | ret
|
---|
383 | VideoIO_Internal_MakeWinDown EndP
|
---|
384 |
|
---|
385 | ; In: AL - Zeichen zum Zeichnen, CL - Wie oft
|
---|
386 | ; Destroyed: None Important
|
---|
387 | VideoIO_Internal_MakeWinRight Proc Near Uses dx di
|
---|
388 | ;movzx dx, cl
|
---|
389 | mov dl,cl
|
---|
390 | mov dh,0
|
---|
391 |
|
---|
392 | mov bl, al
|
---|
393 | call VideoIO_Internal_SetRegs
|
---|
394 | mov al, bl
|
---|
395 | VIOIMWR_Loop:
|
---|
396 | mov es:[di], al
|
---|
397 | mov es:[di+1], ah
|
---|
398 | add di, 2
|
---|
399 | inc TextPosX
|
---|
400 | dec dx
|
---|
401 | jnz VIOIMWR_Loop
|
---|
402 | ret
|
---|
403 | VideoIO_Internal_MakeWinRight EndP
|
---|
404 |
|
---|
405 | WinBeginPosY db 0h
|
---|
406 | WinBeginPosX db 0h
|
---|
407 | WinEndPosY db 0h
|
---|
408 | WinEndPosX db 0h
|
---|
409 | WinCharRight db 0CDh
|
---|
410 | WinCharDown db 0B3h
|
---|
411 | WinCharBB db 0D5h
|
---|
412 | WinCharBE db 0B8h
|
---|
413 | WinCharEB db 0D4h
|
---|
414 | WinCharEE db 0BEh
|
---|
415 |
|
---|
416 | ; In: BX - Begin Position, DX - End Position
|
---|
417 | ; Destroyed: BX DX
|
---|
418 | VideoIO_MakeWindow Proc Near Uses ax bx cx es di
|
---|
419 | mov WinBeginPosY, bh
|
---|
420 | mov WinBeginPosX, bl
|
---|
421 | mov WinEndPosY, dh
|
---|
422 | mov WinEndPosX, dl
|
---|
423 | mov cx, bx
|
---|
424 | inc ch
|
---|
425 | call VideoIO_Locate ; StartPos left line
|
---|
426 | mov cl, WinEndPosY
|
---|
427 | sub cl, WinBeginPosY
|
---|
428 | dec cl
|
---|
429 | mov al, WinCharDown
|
---|
430 | push cx
|
---|
431 | call VideoIO_Internal_MakeWinDown
|
---|
432 | mov ch, WinBeginPosY
|
---|
433 | mov cl, WinEndPosX
|
---|
434 | inc ch
|
---|
435 | call VideoIO_Locate ; StartPos right line
|
---|
436 | pop cx
|
---|
437 | mov al, WinCharDown
|
---|
438 | call VideoIO_Internal_MakeWinDown
|
---|
439 | ; Left & Right are already done...
|
---|
440 | mov ch, WinBeginPosY
|
---|
441 | mov cl, WinBeginPosX
|
---|
442 | call VideoIO_Locate ; StartPos upper line
|
---|
443 | mov al, WinCharBB
|
---|
444 | call VideoIO_PrintSingleChar
|
---|
445 | mov cl, WinEndPosX
|
---|
446 | sub cl, WinBeginPosX
|
---|
447 | dec cl
|
---|
448 | mov al, WinCharRight
|
---|
449 | push cx
|
---|
450 | call VideoIO_Internal_MakeWinRight
|
---|
451 | mov al, WinCharBE
|
---|
452 | call VideoIO_PrintSingleChar
|
---|
453 | mov ch, WinEndPosY
|
---|
454 | mov cl, WinBeginPosX
|
---|
455 | call VideoIO_Locate ; StartPos lower line
|
---|
456 | mov al, WinCharEB
|
---|
457 | call VideoIO_PrintSingleChar
|
---|
458 | pop cx
|
---|
459 | mov al, WinCharRight
|
---|
460 | call VideoIO_Internal_MakeWinRight
|
---|
461 | mov al, WinCharEE
|
---|
462 | call VideoIO_PrintSingleChar
|
---|
463 | ; Frame done, now just filling...
|
---|
464 | mov bh, WinEndPosY
|
---|
465 | sub bh, WinBeginPosY
|
---|
466 | dec bh
|
---|
467 | mov bl, WinEndPosX
|
---|
468 | sub bl, WinBeginPosX
|
---|
469 | dec bl
|
---|
470 |
|
---|
471 | VIOIMW_Loop:
|
---|
472 | mov ch, WinBeginPosY
|
---|
473 | add ch, bh
|
---|
474 | mov cl, WinBeginPosX
|
---|
475 | inc cl
|
---|
476 | call VideoIO_Locate
|
---|
477 |
|
---|
478 | mov al, 20h
|
---|
479 | mov cl, bl
|
---|
480 | push bx
|
---|
481 | call VideoIO_Internal_MakeWinRight
|
---|
482 | pop bx
|
---|
483 | dec bh
|
---|
484 | jnz VIOIMW_Loop
|
---|
485 | ret
|
---|
486 | VideoIO_MakeWindow EndP
|
---|
487 |
|
---|
488 | ; In: AX - Segment to copy B800 to...
|
---|
489 | ; Destroyed: BX DX
|
---|
490 | VideoIO_BackUpTo Proc Near Uses cx ds si es di
|
---|
491 | mov es, ax
|
---|
492 | mov ax, 0B800h
|
---|
493 | mov ds, ax
|
---|
494 | xor si, si
|
---|
495 | xor di, di
|
---|
496 | mov cx, 800h ; Copy 1000h bytes
|
---|
497 | rep movsw
|
---|
498 | ret
|
---|
499 | VideoIO_BackUpTo EndP
|
---|
500 |
|
---|
501 | VideoIO_RestoreFrom Proc Near Uses cx ds si es di
|
---|
502 | mov ds, ax
|
---|
503 | mov ax, 0B800h
|
---|
504 | mov es, ax
|
---|
505 | xor si, si
|
---|
506 | xor di, di
|
---|
507 | mov cx, 800h ; Copy 1000h bytes
|
---|
508 | rep movsw
|
---|
509 | ret
|
---|
510 | VideoIO_RestoreFrom EndP
|
---|
511 |
|
---|
512 | ; In: CL - Total Length of String
|
---|
513 | ; DS:SI - Actual String
|
---|
514 | ; Out: Carry Set if String was ENTERd
|
---|
515 | ; Destroyed: *none*
|
---|
516 | VideoIO_LetUserEditString Proc Near Uses ax bx cx dx si es di
|
---|
517 | local StartPosX:byte, LastPosX:byte
|
---|
518 | local StringLen:byte
|
---|
519 |
|
---|
520 | or cl, cl
|
---|
521 | jnz VIOLUES_LenNotNUL
|
---|
522 | clc
|
---|
523 | ret
|
---|
524 |
|
---|
525 | VIOLUES_LenNotNUL:
|
---|
526 | mov al, TextPosX
|
---|
527 | inc al
|
---|
528 | mov StartPosX, al
|
---|
529 | mov StringLen, cl
|
---|
530 |
|
---|
531 | push cx
|
---|
532 | call VideoIO_Internal_SetRegs ; ES:DI - Pos on Screen at Start
|
---|
533 |
|
---|
534 | xor ch, ch
|
---|
535 | call GetLenOfName ; CX - Actual Length of String
|
---|
536 | mov dl, cl
|
---|
537 |
|
---|
538 | ; Set Cursor behind String and turn it on...
|
---|
539 | add cl, StartPosX
|
---|
540 | call VideoIO_Locate
|
---|
541 | call VideoIO_CursorSet
|
---|
542 | call VideoIO_CursorOn ; Set and turn cursor on
|
---|
543 |
|
---|
544 | ; ES:DI - Screen-Position to Start of String
|
---|
545 | ; DL - Position in String (relative to begin, base=0)
|
---|
546 |
|
---|
547 | VIOLUES_Loop:
|
---|
548 | mov ah, 0
|
---|
549 | int 16h
|
---|
550 | cmp ah, Keys_ESC
|
---|
551 | je VIOLUES_KeyESC
|
---|
552 | cmp ah, Keys_ENTER
|
---|
553 | je VIOLUES_KeyENTER
|
---|
554 | cmp ah, Keys_Backspace
|
---|
555 | je VIOLUES_KeyBACKSPACE
|
---|
556 | ; Check for valid char...
|
---|
557 | cmp al, 32
|
---|
558 | jb VIOLUES_Loop
|
---|
559 | cmp al, 166
|
---|
560 | ja VIOLUES_Loop
|
---|
561 | ; Okay, Character to add to string
|
---|
562 | cmp dl, StringLen ; String "full" ?
|
---|
563 | jae VIOLUES_Loop
|
---|
564 | ;movzx bx, dl
|
---|
565 | mov bl,dl
|
---|
566 | mov bh,0
|
---|
567 |
|
---|
568 | shl bx, 1
|
---|
569 | mov es:[di+bx], al
|
---|
570 | inc dl
|
---|
571 | VIOLUES_UpdateCursor:
|
---|
572 | mov cl, dl
|
---|
573 | add cl, StartPosX
|
---|
574 | call VideoIO_Locate
|
---|
575 | call VideoIO_CursorSet
|
---|
576 | jmp VIOLUES_Loop
|
---|
577 |
|
---|
578 | VIOLUES_KeyBACKSPACE:
|
---|
579 | or dl, dl ; String "empty" ?
|
---|
580 | jz VIOLUES_Loop
|
---|
581 | mov al, ' '
|
---|
582 | dec dl
|
---|
583 | ;movzx bx, dl
|
---|
584 | mov bl,dl
|
---|
585 | mov bh,0
|
---|
586 |
|
---|
587 | shl bx, 1
|
---|
588 | mov es:[di+bx], al
|
---|
589 | jmp VIOLUES_UpdateCursor
|
---|
590 |
|
---|
591 | VIOLUES_KeyESC:
|
---|
592 | pop cx
|
---|
593 | call VideoIO_CursorOff ; Bye Bye cursor
|
---|
594 | clc
|
---|
595 | ret
|
---|
596 |
|
---|
597 | VIOLUES_KeyENTER:
|
---|
598 | pop cx
|
---|
599 | ; ENTERd, so copy data to String-Pointer...
|
---|
600 | VIOLUES_CopyLoop:
|
---|
601 | mov al, es:[di]
|
---|
602 | add di, 2
|
---|
603 | mov ds:[si], al
|
---|
604 | inc si
|
---|
605 | dec cl
|
---|
606 | jnz VIOLUES_CopyLoop
|
---|
607 | ; Finally Cursor off-line...
|
---|
608 | call VideoIO_CursorOff
|
---|
609 | stc
|
---|
610 | ret
|
---|
611 | VideoIO_LetUserEditString EndP
|
---|
612 |
|
---|
613 |
|
---|
614 |
|
---|
615 | ;
|
---|
616 | ; Rousseau Additions.
|
---|
617 | ;
|
---|
618 |
|
---|
619 |
|
---|
620 | ; Function Template
|
---|
621 | ;ProcName Proc Near Uses ax bx cx dx si es di
|
---|
622 | ;ProcName EndP
|
---|
623 |
|
---|
624 |
|
---|
625 | ;
|
---|
626 | ; Clear the current page
|
---|
627 | ;
|
---|
628 | VideoIO_ClearScreen Proc Near Uses ax bx cx dx si es di
|
---|
629 | mov al, 0 ; clear entire window
|
---|
630 | mov bh,07h ; Attribute for new lines
|
---|
631 | xor cx,cx ; Row, Column ULC
|
---|
632 | xor dx,dx
|
---|
633 | dec dx ; Row, Column LRC (does this corrupt other pages ?)
|
---|
634 | mov ah, 06h ; Function Code
|
---|
635 | int 10h ; Do It !
|
---|
636 | ret
|
---|
637 | VideoIO_ClearScreen EndP
|
---|
638 |
|
---|
639 | ;
|
---|
640 | ; Set position to teletype cursor
|
---|
641 | ;
|
---|
642 | VideoIO_SyncPos Proc Near Uses ax bx cx dx
|
---|
643 | pushf
|
---|
644 | mov bh, 0
|
---|
645 | mov ah, 03h
|
---|
646 | int 10h
|
---|
647 | mov [TextPosX], dl
|
---|
648 | mov [TextPosY], dh
|
---|
649 | popf
|
---|
650 | ret
|
---|
651 | VideoIO_SyncPos EndP
|
---|
652 |
|
---|
653 | ;
|
---|
654 | ; Put the Build Information at the POST BIOS screen.
|
---|
655 | ;
|
---|
656 | VideoIO_PrintBuildInfo Proc Near Uses ax cx si di
|
---|
657 | ; Print header.
|
---|
658 | mov si, offset build_info
|
---|
659 | call MBR_Teletype
|
---|
660 |
|
---|
661 | ; Prepare info in temorary buffer.
|
---|
662 | mov si,offset bld_level_date_start
|
---|
663 | mov cx,offset bld_level_date_end
|
---|
664 | sub cx,si
|
---|
665 | mov di,offset Scratch
|
---|
666 | cld
|
---|
667 | rep movsb
|
---|
668 |
|
---|
669 | ; Fill spaces until assembler specification.
|
---|
670 | mov al,' '
|
---|
671 | mov cx,37
|
---|
672 | rep stosb
|
---|
673 |
|
---|
674 | ; Copy assembler specification.
|
---|
675 | IFDEF JWASM
|
---|
676 | mov al,'['
|
---|
677 | stosb
|
---|
678 | mov si,offset jwasm_txt
|
---|
679 | ELSEIFDEF TASM
|
---|
680 | mov al,' '
|
---|
681 | stosb
|
---|
682 | mov al,'['
|
---|
683 | stosb
|
---|
684 | mov si,offset tasm_txt
|
---|
685 |
|
---|
686 | ELSEIFDEF WASM
|
---|
687 | mov al,' '
|
---|
688 | stosb
|
---|
689 | mov al,'['
|
---|
690 | stosb
|
---|
691 | mov si,offset wasm_txt
|
---|
692 | ELSEIFDEF MASM
|
---|
693 | mov al,' '
|
---|
694 | stosb
|
---|
695 | mov al,'['
|
---|
696 | stosb
|
---|
697 | mov si,offset masm_txt
|
---|
698 | ELSE
|
---|
699 | mov al,' '
|
---|
700 | stosb
|
---|
701 | mov al,'['
|
---|
702 | stosb
|
---|
703 | mov si,offset unknown_txt
|
---|
704 | ENDIF
|
---|
705 |
|
---|
706 | VideoIO_PrintBuildInfo_a1:
|
---|
707 | lodsb
|
---|
708 | test al,al
|
---|
709 | jz VideoIO_PrintBuildInfo_e1
|
---|
710 | stosb
|
---|
711 | jmp VideoIO_PrintBuildInfo_a1
|
---|
712 | VideoIO_PrintBuildInfo_e1:
|
---|
713 | mov al,']'
|
---|
714 | stosb
|
---|
715 |
|
---|
716 | ; Insert NULL Terminator.
|
---|
717 | xor al,al
|
---|
718 | stosb
|
---|
719 |
|
---|
720 | ; Print Info.
|
---|
721 | mov si, offset Scratch
|
---|
722 | call MBR_TeletypeNL
|
---|
723 | ret
|
---|
724 | VideoIO_PrintBuildInfo EndP
|
---|
725 |
|
---|
726 | ;VideoIO_DBG_WriteString Proc Near Uses ax bx cx dx si es di
|
---|
727 | ; mov ch, [CFG_Partitions] ; y
|
---|
728 | ; add ch, 7
|
---|
729 | ; add ch, [CFG_IncludeFloppy]
|
---|
730 | ; push cx
|
---|
731 | ; mov cl, 1 ; x
|
---|
732 | ; call VideoIO_Locate
|
---|
733 | ; mov ch, 15 ; fgc
|
---|
734 | ; mov cl, 0 ; bgc
|
---|
735 | ; call VideoIO_Color
|
---|
736 | ; mov si, offset ShowBootLog
|
---|
737 | ; call VideoIO_Print
|
---|
738 | ; pop cx
|
---|
739 | ; inc ch
|
---|
740 |
|
---|
741 | ; ;mov ch, 21 ; y
|
---|
742 | ; mov cl, 1 ; x
|
---|
743 | ; call VideoIO_Locate
|
---|
744 | ; mov ch, 15 ; fgc
|
---|
745 | ; mov cl, 0 ; bgc
|
---|
746 | ; call VideoIO_Color
|
---|
747 |
|
---|
748 |
|
---|
749 | ; Rousseau:
|
---|
750 | ; mov al, [NewPartitions]
|
---|
751 | ;call VideoIO_PrintByteDynamicNumber
|
---|
752 | ; mov al, [CFG_Partitions]
|
---|
753 | ;call VideoIO_PrintByteDynamicNumber
|
---|
754 | ; ret
|
---|
755 | ;VideoIO_DBG_WriteString EndP
|
---|
756 |
|
---|
757 |
|
---|
758 | ; Dump the disk-info.
|
---|
759 | ; Disk number is in DL.
|
---|
760 | VideoIO_DumpDiskInfo Proc Near uses ax bx cx dx
|
---|
761 |
|
---|
762 | VideoIO_DumpDiskInfo_next_disk:
|
---|
763 | push dx
|
---|
764 | xor ax,ax
|
---|
765 | mov al,[TextPosY]
|
---|
766 | push ax
|
---|
767 |
|
---|
768 | mov ax,21
|
---|
769 | mov dh,dl
|
---|
770 | and dh,01111111b
|
---|
771 | mul dh
|
---|
772 | mov dh,al
|
---|
773 |
|
---|
774 | mov [TextPosX],dh
|
---|
775 |
|
---|
776 | mov si, offset [Disk]
|
---|
777 | call VideoIO_Print
|
---|
778 | mov al,dl
|
---|
779 |
|
---|
780 | ; NIET GOED, GAAT FOUT > 9, HEX PRINT GEBRUIKEN !!
|
---|
781 | shr al,4
|
---|
782 | add al,'0'
|
---|
783 | call VideoIO_PrintSingleChar
|
---|
784 | mov al,dl
|
---|
785 | and al,01111111b
|
---|
786 | add al,'0'
|
---|
787 | call VideoIO_PrintSingleChar
|
---|
788 | mov al,'h'
|
---|
789 | call VideoIO_PrintSingleChar
|
---|
790 |
|
---|
791 | inc [TextPosY]
|
---|
792 | mov [TextPosX],dh
|
---|
793 |
|
---|
794 | mov al,'-'
|
---|
795 | mov cl,17
|
---|
796 | call VideoIO_PrintSingleMultiChar
|
---|
797 |
|
---|
798 | ;~ inc [TextPosY]
|
---|
799 | ;~ mov [TextPosX],dh
|
---|
800 | ;~ mov si, offset BiosCyls
|
---|
801 | ;~ call VideoIO_Print
|
---|
802 |
|
---|
803 | ;~ push dx
|
---|
804 | ;~ mov bx,offset BIOS_Cyls
|
---|
805 | ;~ xor dh,dh
|
---|
806 | ;~ and dl,01111111b
|
---|
807 | ;~ shl dx,1
|
---|
808 | ;~ shl dx,1
|
---|
809 | ;~ add bx,dx
|
---|
810 | ;~ mov ax,[bx]
|
---|
811 | ;~ mov dx,[bx+02]
|
---|
812 | ;~ call VideoIO_PrintHexDWord
|
---|
813 | ;~ pop dx
|
---|
814 |
|
---|
815 | inc [TextPosY]
|
---|
816 | mov [TextPosX],dh
|
---|
817 | mov si, offset BiosHeads
|
---|
818 | call VideoIO_Print
|
---|
819 |
|
---|
820 | push dx
|
---|
821 | mov bx,offset BIOS_Heads
|
---|
822 | xor dh,dh
|
---|
823 | and dl,01111111b
|
---|
824 | shl dx,1
|
---|
825 | shl dx,1
|
---|
826 | add bx,dx
|
---|
827 | mov ax,[bx]
|
---|
828 | mov dx,[bx+02]
|
---|
829 | call VideoIO_PrintHexDWord
|
---|
830 | pop dx
|
---|
831 |
|
---|
832 | inc [TextPosY]
|
---|
833 | mov [TextPosX],dh
|
---|
834 | mov si, offset BiosSecs
|
---|
835 | call VideoIO_Print
|
---|
836 |
|
---|
837 | push dx
|
---|
838 | mov bx,offset BIOS_Secs
|
---|
839 | xor dh,dh
|
---|
840 | and dl,01111111b
|
---|
841 | shl dx,1
|
---|
842 | shl dx,1
|
---|
843 | add bx,dx
|
---|
844 | mov ax,[bx]
|
---|
845 | mov dx,[bx+02]
|
---|
846 | call VideoIO_PrintHexDWord
|
---|
847 | pop dx
|
---|
848 |
|
---|
849 | inc [TextPosY]
|
---|
850 | mov [TextPosX],dh
|
---|
851 | mov si, offset LvmSecs
|
---|
852 | call VideoIO_Print
|
---|
853 |
|
---|
854 | push dx
|
---|
855 | ; Offset of array containing LVM SPT values for each disk found
|
---|
856 | mov bx,offset TrueSecs
|
---|
857 | ; DX to index
|
---|
858 | xor dh,dh
|
---|
859 | and dl,01111111b
|
---|
860 | shl dx,1
|
---|
861 | shl dx,1
|
---|
862 | add bx,dx
|
---|
863 | ; Get LVM SPT
|
---|
864 | mov ax,[bx]
|
---|
865 | mov dx,[bx+02]
|
---|
866 | call VideoIO_PrintHexDWord
|
---|
867 | pop dx
|
---|
868 |
|
---|
869 | inc [TextPosY]
|
---|
870 | mov [TextPosX],dh
|
---|
871 | mov si, offset BiosLBA
|
---|
872 | call VideoIO_Print
|
---|
873 |
|
---|
874 | push dx
|
---|
875 | mov bx,offset BIOS_TotalSecs
|
---|
876 | xor dh,dh
|
---|
877 | and dl,01111111b
|
---|
878 | shl dx,1
|
---|
879 | shl dx,1
|
---|
880 | shl dx,1
|
---|
881 | add bx,dx
|
---|
882 | mov ax,[bx]
|
---|
883 | mov dx,[bx+02]
|
---|
884 | call VideoIO_PrintHexDWord
|
---|
885 | pop dx
|
---|
886 |
|
---|
887 | inc [TextPosY]
|
---|
888 | mov [TextPosX],dh
|
---|
889 |
|
---|
890 | pop ax
|
---|
891 | mov [TextPosY],al
|
---|
892 | pop dx
|
---|
893 |
|
---|
894 | inc dl
|
---|
895 | mov al,dl
|
---|
896 | and al,01111111b
|
---|
897 | cmp al,[TotalHarddiscs]
|
---|
898 | jae VideoIO_DumpDiskInfo_end
|
---|
899 | jmp VideoIO_DumpDiskInfo_next_disk
|
---|
900 |
|
---|
901 | VideoIO_DumpDiskInfo_end:
|
---|
902 | mov [TextPosX],0
|
---|
903 | add [TextPosY],6
|
---|
904 | ret
|
---|
905 | VideoIO_DumpDiskInfo EndP
|
---|
906 |
|
---|
907 |
|
---|
908 | ;
|
---|
909 | ; Set position to teletype cursor
|
---|
910 | ;
|
---|
911 | VideoIO_ShowWaitDots Proc
|
---|
912 | pusha
|
---|
913 | ; Color white on black
|
---|
914 | mov ch,7
|
---|
915 | mov cl,0
|
---|
916 | call VideoIO_Color
|
---|
917 | ; Locate cursor for output of debug-info
|
---|
918 | mov ch,8
|
---|
919 | mov cl,1
|
---|
920 | call VideoIO_Locate
|
---|
921 |
|
---|
922 | ; Print dots with interval.
|
---|
923 | mov cx,10
|
---|
924 | VideoIO_ShowWaitDots_next_dot:
|
---|
925 | mov al,'.'
|
---|
926 | call VideoIO_PrintSingleChar
|
---|
927 | ; Value 30 is about 1.5 seconds
|
---|
928 | mov al,1
|
---|
929 | call TIMER_WaitTicCount
|
---|
930 | loop VideoIO_ShowWaitDots_next_dot
|
---|
931 | popa
|
---|
932 | ret
|
---|
933 | VideoIO_ShowWaitDots EndP
|
---|
934 |
|
---|
935 |
|
---|
936 |
|
---|
937 | ; Disk Info to Dump to AB LogScreen
|
---|
938 | Disk db "DISK ",0
|
---|
939 | ;BiosCyls db "Cyls :",0
|
---|
940 | BiosHeads db "Heads :",0
|
---|
941 | BiosSecs db "Secs :",0
|
---|
942 | LvmSecs db "SecsLVM :",0
|
---|
943 | BiosLBA db "LBA Secs:",0
|
---|
944 |
|
---|
945 |
|
---|
946 | HugeBootDisk db "Boot Disk is Huge : ",0
|
---|
947 | DisksFound db "Disks Found : ",0
|
---|
948 | PartitionsFound db "Partitions Found : ",0
|
---|
949 | ;AutoStartPart db "Auto Start Partition : ",0
|
---|
950 |
|
---|
951 | Phase1 db "eCS Install Phase 1 : ",0
|
---|
952 |
|
---|
953 |
|
---|
954 | ShowMenu db "Press TAB to return to the AiR-BOOT Menu",0
|
---|
955 | ;ShowBootLog db "Press TAB to see the Boot Log...",0
|
---|
956 |
|
---|
957 | Yes db "YES",0
|
---|
958 | No db "NO",0
|
---|
959 | ;~ On db "ON",0
|
---|
960 | ;~ Off db "OFF",0
|
---|
961 | ;~ None db "NONE",0
|
---|
962 | ;~ Active db "ACTIVE",0
|
---|
963 | NotActive db "NOT ACTIVE",0
|
---|
964 |
|
---|
965 | ; New Line for use by MBR_Teletype
|
---|
966 | NL db 0dh, 0ah, 0
|
---|