Adding upstream version 4.00~pre55+dfsg.
[syslinux-debian/hramrach.git] / core / rawcon.inc
blobf0d434c8ef62554c7d55fb24e9bb3db2c8e9adbf
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                 pushfd
12                 push ds
13                 push cs
14                 pop ds
15                 test byte [UsingVGA], 08h
16                 jz .videook
17                 call vgaclearmode
18 .videook:
19                 call write_serial       ; write to serial port if needed
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                 pop ds
55                 popfd
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