home *** CD-ROM | disk | FTP | other *** search
/ gondwana.ecr.mu.oz.au/pub/ / Graphics.tar / Graphics / VOGLE.ZIP / VOGLE / DRIVERS / IBMPC / MISC.ASM < prev    next >
Assembly Source File  |  2000-02-11  |  1KB  |  81 lines

  1. extrn    __buffer_segment:word
  2. extrn    __buffer_offset:word
  3. extrn    __cur_mode:word
  4. extrn    __cur_color:word
  5.  
  6. MISC_TEXT      SEGMENT byte public 'CODE'
  7.     ASSUME  CS: MISC_TEXT
  8.  
  9. public    _vega_clear, _cga_clear
  10.  
  11. _vega_clear proc far
  12.     push bp
  13.     mov bp, sp
  14.         push es
  15.         push ax
  16.         push cx
  17.         push di
  18.     mov dx, 3ceh
  19.     mov al, 0
  20.     out dx,al
  21.     mov dx, 3cfh
  22.     mov al, byte ptr __cur_color
  23.     out dx,al
  24.     mov dx, 3ceh
  25.     mov al, 8
  26.     out dx,al
  27.     mov dx, 3cfh
  28.     mov al, 0ffh
  29.     out dx, al
  30.         mov ax, __buffer_segment
  31.         mov es, ax
  32.         xor di, di
  33.     mov cx, 14000        ; How many words on an EGA 640x350 mode.
  34.     cmp __cur_mode, 18    ; Is it a VGA ?
  35.     jne not_vga
  36.     mov cx, 19200        ; How many words on a VGA 640x480 mode.
  37. not_vga:
  38.         mov ax, 0
  39.         cld
  40.         rep stosw                     
  41.         pop di
  42.         pop cx
  43.         pop ax
  44.         pop es
  45.     mov sp, bp
  46.     pop bp
  47.         ret
  48. _vega_clear endp
  49.  
  50. _cga_clear proc far
  51.     push bp
  52.     mov bp, sp
  53.         push es
  54.         push ax
  55.         push cx
  56.         push di
  57.     mov ax, __buffer_segment
  58.         mov es, ax
  59.     mov di, __buffer_offset
  60.         mov cx, 2000h
  61.     cmp __cur_color, 0
  62.     jne  white
  63.         xor ax, ax        ; Zero the screen
  64.     jmp next
  65. white:
  66.     mov ax,0ffffh        ; White the screen
  67. next:
  68.         cld
  69.         rep stosw                     
  70.         pop di
  71.         pop cx
  72.         pop ax
  73.         pop es
  74.     mov sp, bp
  75.     pop bp
  76.         ret
  77. _cga_clear endp
  78.  
  79. MISC_TEXT    ENDS
  80. END
  81.