;       Static Name Aliases
;
        TITLE   vputn
;       NAME    vputn.C

        .287
_TEXT   SEGMENT  BYTE PUBLIC 'CODE'
_TEXT   ENDS
_DATA   SEGMENT  WORD PUBLIC 'DATA'
_DATA   ENDS
CONST   SEGMENT  WORD PUBLIC 'CONST'
CONST   ENDS
_BSS    SEGMENT  WORD PUBLIC 'BSS'
_BSS    ENDS
DGROUP  GROUP   CONST,  _BSS,   _DATA
        ASSUME  CS: _TEXT, DS: DGROUP, SS: DGROUP, ES: DGROUP
EXTRN   __chkstk:NEAR
_TEXT      SEGMENT

        PUBLIC  _vputn
_vputn  PROC NEAR
        push    bp
        mov     bp,sp
        mov     ax,2
        call    __chkstk
        push    si
        push    di

        mov     si,[bp+8]       ;c

;       scr_ofs = 4
;       c = 8
;       register si = c
;       times = 10
;       retrace = 12
;       i = -2

        mov     WORD PTR [bp-2],0       ;i
        les     di,[bp+4]       ;scr_ofs
        mov     cx,word ptr [bp+10]

        jcxz    $out
$F15:
        cmp     WORD PTR [bp+12],0      ;retrace
        je      $I19

$WC21:
        mov     dx,3dah
        in      al,dx
        test    al,1
        jne     $WC21
$WB22:

        in      al,dx
        test    al,1
        je      $WB22

$I19:
        mov     ax,si
        stosw

        loop    $F15
$out:

        mov     ax,di           ;scr_ofs
        mov     dx,es
        pop     di
        pop     si
        mov     sp,bp
        pop     bp
        ret

_vputn  ENDP
_TEXT   ENDS
END
