home *** CD-ROM | disk | FTP | other *** search
- title - filblock - fills a segment/offset block of memory
-
- include model.h
- include prologue.h
-
- public filblock
-
-
- foff equ @ab[bp]
- fseg equ @ab+2[bp]
- fchar equ @ab+4[bp]
- flen equ @ab+6[bp]
-
-
- filblock proc near
-
- push bp
- mov bp,sp
-
- mov cx,word ptr flen ;if there is not anything to
- or cx,cx ; fill then bypass the rest
- jz filend ; of the routine
-
- les di,dword ptr foff ;get starting address
- mov ax,fchar ;get byte value into AL
- mov ah,al ; and AH
-
- mov bx,di ;if not on a word boundary
- and bx,1 ; then fill a byte so that
- jz fil1 ; we are on a full word
- stosb ; boundary (for 16-bit buses)
- dec cx
- fil1:
- push cx ;save counter
- sar cx,1 ;number of word moves
- rep stosw ; fill using word moves
-
- pop cx ;recover counter
- and cx,1 ;an odd byte not filled?
- jz filend ; if so then
- stosb ; fill it
-
- filend:
- pop bp
- ret
-
- filblock endp
-
- include epilogue.h
-
- end
-