home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 14 / CDACTUAL.iso / cdactual / demobin / share / program / asm / RTGRAF.ZIP / SOURCE.ZIP / ECLRSCR.ASM < prev    next >
Encoding:
Assembly Source File  |  1990-06-30  |  2.8 KB  |  96 lines

  1. ;========================================================================
  2. ; Clear the screen
  3. ;
  4. ;
  5. ; large model parms
  6. pCOLOR          EQU     [BP+6]
  7.  
  8.         PUBLIC  _clearscreen
  9.  
  10. _clearscreen  Proc far
  11.         push    bp
  12.         mov     bp,sp
  13.         pushf
  14.         cld
  15.         push    es
  16.         push    ax
  17.         push    bx
  18.         push    cx
  19.         push    dx
  20.         push    si
  21.         push    di
  22.         ;
  23.         ; set up the addressing for the screen
  24.         ;
  25.         mov     es,_curr_vid_seg
  26.         mov     di,0
  27.  
  28.         mov     dx,GRAPHIC12
  29.         ;
  30.         ; enable set/reset mode
  31.         ; then load reset register
  32.         ;
  33.         mov     al,SETRESET ;set SET/RESET register
  34.         out     dx,al
  35.         inc     dx          ;now data register
  36.  
  37.         mov     al,pCOLOR   ;what color was requested?
  38.         out     dx,al       ;Set the active (set) bits
  39.                             ; that loaded the color into the SETRESET reg.
  40.         dec     dx          ;now back to control register
  41.  
  42.         mov     al,ENABLERESET ;defines which planes will be modified
  43.                                ; from the SETRESET register
  44.         out     dx,al       ;
  45.         inc     dx          ;and back to data register
  46.  
  47.         mov     al,0fh      ;work with all 4 planes from SETRESET register
  48.         out     dx,al       ;0fh should activate all planes
  49.         dec     dx          ;back to control
  50.         ;
  51.         ; now we are ready to put the color out there
  52.         ;
  53.         ;
  54.         ; loop for the size of the screen
  55.         ;
  56.         mov     ax,_max_scan_deep
  57.         mul     _Bytes_per_line
  58.         mov     cx,ax           ; set loop count to size of visual screen
  59.                                 ;  in bytes
  60.         mov     al,0fh          ; blend in new color bits
  61.         rep     stosb
  62.  
  63.         ;
  64.         ; finally, put everything back into a known state
  65.         ;
  66.         mov     dx,GRAPHIC12
  67.         mov     al,ENABLERESET
  68.         out     dx,al
  69.         inc     dx
  70.         mov     al,00h       ;clear all planes for SETRESET
  71.                              ; this means all data comes from processor
  72.                              ; write, not the SETREST register
  73.         out     dx,al
  74.         dec     dx           ;back at control
  75.  
  76.         mov     al,BIT_MASK_REG ;set all planes as active
  77.         out     dx,al
  78.         inc     dx           ;back to data
  79.         mov     al,0fh       ;all bits in byte active
  80.         out     dx,al
  81.         ;
  82.         ; restore what we saved at the start
  83.         ;
  84.         pop     di
  85.         pop     si
  86.         pop     dx
  87.         pop     cx
  88.         pop     bx
  89.         pop     ax
  90.         pop     es
  91.         popf
  92.         mov     sp,bp
  93.         pop     bp
  94.         ret
  95. _clearscreen  endp
  96.