home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
MSJV5-3.ZIP
/
VLB.ZIP
/
LMEMSET.ASM
< prev
next >
Wrap
Assembly Source File
|
1990-05-01
|
2KB
|
56 lines
;
; lmemset far version of memset
;
INCLUDE SETUP.H
CLIB SEGMENT WORD PUBLIC 'CODE'
CLIB ENDS
CLIB SEGMENT
ASSUME CS: CLIB
PUBLIC lmemset
lmemset PROC FAR
Destination EQU DWORD PTR [bp] + 10
FillChar EQU BYTE PTR [bp] + 8
Count EQU WORD PTR [bp] + 6
ENTRY 0
les di, Destination ; ES:DI = Destination
mov bx, di ; save a copy of DST
mov cx, Count
jcxz toend ; if no work to do
mov al, FillChar ; the byte FillChar to store
mov ah, al ; store it as a word
test di, 1 ; is Destination address odd?
jz dowords ; yes: proceed
stosb ; store byte for word align
dec cx
dowords:
shr cx, 1
rep stosw ; store word at a time
adc cx, cx
rep stosb ; store final ("odd") byte
toend:
mov di, dx ; Restore DI
xchg ax, bx ; AX = Destination
mov dx, es ; segment part of addr
EXIT 8
lmemset ENDP
CLIB ENDS
END