home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast.iso / screen / clear.asm < prev    next >
Assembly Source File  |  1994-03-05  |  867b  |  33 lines

  1. ; This program clears the screen from DOS. To clear the screen,
  2. ; it defines a window the size of the whole screen and then
  3. ; scrolls that window to clear its contents.
  4.  
  5. ; After linking, use EXE2BIN CLEAR.EXE CLEAR.COM
  6. ; to convert it to a .COM file.
  7.  
  8. clear    segment
  9.     assume cs:clear
  10.     mov ah,15        ; get current video state data
  11.     int 10h
  12.     mov bl,bh        ; save video page
  13.     xor cx,cx        ; set upper-left-corner
  14.     mov dl,ah        ; set lower-left-corner
  15.     dec dl            ; (adjust)
  16.     mov dh,24
  17.     mov bh,7        ; normal attr
  18.     cmp al,4        ; graphics screen?
  19.     jb c1            ; no
  20.     cmp al,7
  21.     je c1            ; no
  22.     mov bh,cl        ; yes-use attr 0
  23. c1:    mov al,cl        ; scroll length 0-clear window
  24.     mov ah,6        ; scroll page to clear the screen
  25.     int 10h
  26.     mov ah,2        ; reposition cursor
  27.         mov bh,bl        ; (restore video page)
  28.     mov dx,cx        ; upper-left-corner (CX=0 from scroll)
  29.     int 10h
  30.     int 20h            ; return to DOS
  31. clear    ends
  32.     end
  33.