;**************************************************************
;***    MEMSET.ASM                                          ***
;***                                                        ***
;***    procedure memset(p: Pointer;                        ***
;***                     val: Word;                         ***
;***                     len: Word);                        ***
;***                                                        ***
;***    Sets a block of memory to a value.                  ***
;***                                                        ***
;**************************************************************

        .model  large,pascal 

;
;   Define entry point
;
        public  memset

        .code

memset  proc    p:Far Ptr Byte, val:Word, len: Word

        push    di                      ; Save DI

        mov     ax,val                  ; Get the value
        les     di,p                    ; Get the address
        mov     cx,len                  ; Get the length

        cld                             ; Clear direction flag (forward)
        rep stosb                       ; Clear the area ! Clear the area !        

        pop     di                      ; Restore DI
        ret

memset  endp                            ; End of procedure

        end
                                        ; End of source file
