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