Assembly code snippets

Back to the snippets overview

Details

TitleStatic Buffer
AuthorbitRAKE
Submitted by:bitRAKE
Date added:2002-02-17 21:12:55
Date modified:2002-02-17 21:13:09

Comments

Buffer object macro with only a clear method.

Snippet

.BUFFER MACRO thename:REQ, thesize:REQ
    _BSS segment DWORD public 'BSS'
            ALIGN 4
        thename db (thesize + 3) AND -4 dup (?)
    _BSS ends

    thename&Clear MACRO
        mov edi,OFFSET thename
        mov ecx,(SIZEOF thename) / 4
        xor eax,eax
        rep stosd
    ENDM
ENDM