home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 August (Alt) / CHIP 2005-08.1.iso / program / guvenlik / syslinux-3.07.exe / rawcon.inc < prev    next >
Encoding:
Text File  |  2005-01-04  |  1.3 KB  |  73 lines

  1. ;
  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.
  5. ;
  6. %if IS_ISOLINUX
  7. writechr_full:
  8. %else
  9. writechr:
  10. %endif
  11.         push ds
  12.         push cs
  13.         pop ds
  14.         call write_serial    ; write to serial port if needed
  15.         pushfd
  16.         test byte [DisplayCon],01h    ; Write to screen?
  17.         jz .nothing
  18.  
  19.         pushad
  20.         mov bh,[BIOS_page]
  21.         push ax
  22.                 mov ah,03h              ; Read cursor position
  23.                 int 10h
  24.         pop ax
  25.         cmp al,8
  26.         je .bs
  27.         cmp al,13
  28.         je .cr
  29.         cmp al,10
  30.         je .lf
  31.         push dx
  32.                 mov bh,[BIOS_page]
  33.         mov bl,07h        ; White on black
  34.         mov cx,1        ; One only
  35.         mov ah,09h        ; Write char and attribute
  36.         int 10h
  37.         pop dx
  38.         inc dl
  39.         cmp dl,[VidCols]
  40.         jna .curxyok
  41.         xor dl,dl
  42. .lf:        inc dh
  43.         cmp dh,[VidRows]
  44.         ja .scroll
  45. .curxyok:    mov bh,[BIOS_page]
  46.         mov ah,02h        ; Set cursor position
  47.         int 10h            
  48. .ret:        popad
  49. .nothing:
  50.         popfd
  51.         pop ds
  52.         ret
  53. .scroll:    dec dh
  54.         mov bh,[BIOS_page]
  55.         mov ah,02h
  56.         int 10h
  57.         mov ax,0601h        ; Scroll up one line
  58.         mov bh,[ScrollAttribute]
  59.         xor cx,cx
  60.         mov dx,[ScreenSize]    ; The whole screen
  61.         int 10h
  62.         jmp short .ret
  63. .cr:        xor dl,dl
  64.         jmp short .curxyok
  65. .bs:        sub dl,1
  66.         jnc .curxyok
  67.         mov dl,[VidCols]
  68.         sub dh,1
  69.         jnc .curxyok
  70.         xor dh,dh
  71.         jmp short .curxyok
  72.  
  73.