home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / pc / diskutil / rwp100b.zoo / rwp-swap.inc < prev    next >
Encoding:
Text File  |  1990-02-22  |  1.5 KB  |  30 lines

  1. ; this procedure does an in place swap of the text screen and the buffer.
  2. ; the text and attributes have been seperated into two sections so that the
  3. ; screen can be created, viewed, and edited with very little difficulty.
  4. ; This routine may cause snow on CGA cards but will have no such effect on
  5. ; EGA or VGA cards.
  6.  
  7. SwapBuffer  proc    near
  8.             push    es                      ; store ES
  9.             mov     ax,Disp_buffer          ; location of screen
  10.             mov     es,ax                   ; load new ES
  11.             mov     bx,5*160                ; start on 5th line
  12.             xor     si,si                   ; start at beginning of data
  13. rows:       mov     di,20                   ; start at 10th column
  14. lines:      mov     ax,es:[bx][di]          ; get character from screen
  15.             xchg    vid_buffer_text[si],al  ; exchange buffer char with screen
  16.             xchg    vid_buffer_attr[si],ah  ; exchange buffer attr with screen
  17.             mov     es:[bx][di],ax          ; write character to screen
  18.             inc     si                      ; next byte of buffer
  19.             add     di,2                    ; next char of screen
  20.             cmp     di,140                  ; end at 70th column
  21.             jne     lines                   ; no, keep going
  22.             add     bx,160                  ; next line
  23.             cmp     bx,20*160               ; end on 20th line
  24.             jne     rows                    ; no, keep going
  25.             pop     es                      ; restore ES
  26.             ret
  27. SwapBuffer  endp
  28.  
  29.  
  30.