Adding upstream version 3.35.
[syslinux-debian/hramrach.git] / rawcon.inc
blob10d7a76435774c78974ac781a4e74e14191e8be6
2 ; writechr:     Write a single character in AL to the console without
3 ;               mangling any registers.  This does raw console writes,
4 ;               since some PXE BIOSes seem to interfere regular console I/O.
6 %if IS_ISOLINUX
7 writechr_full:
8 %else
9 writechr:
10 %endif
11                 push ds
12                 push cs
13                 pop ds
14                 test byte [UsingVGA], 08h
15                 jz .videook
16                 call vgaclearmode
17 .videook:
18                 call write_serial       ; write to serial port if needed
19                 pushfd
20                 test byte [DisplayCon],01h      ; Write to screen?
21                 jz .nothing
23                 pushad
24                 mov bh,[BIOS_page]
25                 push ax
26                 mov ah,03h              ; Read cursor position
27                 int 10h
28                 pop ax
29                 cmp al,8
30                 je .bs
31                 cmp al,13
32                 je .cr
33                 cmp al,10
34                 je .lf
35                 push dx
36                 mov bh,[BIOS_page]
37                 mov bl,07h              ; White on black
38                 mov cx,1                ; One only
39                 mov ah,09h              ; Write char and attribute
40                 int 10h
41                 pop dx
42                 inc dl
43                 cmp dl,[VidCols]
44                 jna .curxyok
45                 xor dl,dl
46 .lf:            inc dh
47                 cmp dh,[VidRows]
48                 ja .scroll
49 .curxyok:       mov bh,[BIOS_page]
50                 mov ah,02h              ; Set cursor position
51                 int 10h
52 .ret:           popad
53 .nothing:
54                 popfd
55                 pop ds
56                 ret
57 .scroll:        dec dh
58                 mov bh,[BIOS_page]
59                 mov ah,02h
60                 int 10h
61                 mov ax,0601h            ; Scroll up one line
62                 mov bh,[ScrollAttribute]
63                 xor cx,cx
64                 mov dx,[ScreenSize]     ; The whole screen
65                 int 10h
66                 jmp short .ret
67 .cr:            xor dl,dl
68                 jmp short .curxyok
69 .bs:            sub dl,1
70                 jnc .curxyok
71                 mov dl,[VidCols]
72                 sub dh,1
73                 jnc .curxyok
74                 xor dh,dh
75                 jmp short .curxyok