page ,132
            title    putsc.asm - no snow screen update routine

;****************************************************************
;* No-snow screen display routine                               *
;*  This routine moves screen data from a user buffer to the    *
;*  screen buffer during horizontal retrace time, resulting in  *
;*  no screen flicker.                                          *
;*                                                              *
;* definition:                                                  *
;*    void putsc (char *,int,int,int);                          *
;*      char * buffer       /* data, attribute buffer           *
;*      int start_of_buff   /* row*80 + col                     *
;*      int length          /* # of col                         *
;*      int page            /* video page                       *
;*                                                              *
;* note: designed for use with Microsoft 'C' (4.0)              *
;*                                                              *
;* edit date: 07/15/85              by Mike Elkins              *
;****************************************************************

_text       segment    byte public 'code'
        assume    cs:_text

        public    _putsc
_putsc        proc    near        ;far

; buffer = +6    +4 from each if near
; offset = +10   +6 for near
; length = +12   +8 for near
; page = +14     +10 for near

                push    bp            ;save calling environment
                mov    bp,sp
                push    si
                push    di
                push    ds

  		mov	ah,15			;get current mode
   		int	10h			;system video
          	mov	dx,3BAh			;monochrome port address
                mov     di,[bp+6]               ;offset for buffer
                add     di,di                   ;correct for attribute bytes
   		cmp	al,7			;is b/w?
        	je	movmno                  ;skip pages for mono
                mov     dx,3DAh                 ;color port
                mov     ax,0B800h
                mov     bx,[bp+10]              ;get page
                cmp     bx,0
                je      mov001                  ;page 0
                mov     ax,0B900h
                cmp     bx,1
                je      mov001                  ;page 1
                mov     ax,0BA00h
                cmp     bx,2
                je      mov001                  ;page 2
                mov     ax,0BB00h               ;page 3
                jmp     mov001

movmno:         mov     ax,0B000h                ;set for mono address
mov001:         mov     es,ax

;far            lds     si,[bp+6]        ;source buffer pointer
                mov     si,[bp+4]        ;source buffer pointer
                mov     cx,[bp+8]        ;block length

mov002:
                in      al,dx            ;screen status
                test    al,1             ;is 'high'?
                jnz     mov002           ;yes - wait
mov004:         in      al,dx            ;screen status
                test    al,1             ;is 'low'?
                jz      mov004           ;yes - wait
                movsw                    ;mov bytes to screen
                loop    mov002

                pop    ds
                pop    di
                pop    si
                pop    bp
                ret

_putsc          endp

_text           ends

                end

