1; 2; (C) Ururi 1999 3; 4 5BITS 32 6 7%ifdef WIN32 8 %define _NAMING 9 %define segment_code segment .text align=32 class=CODE use32 10 %define segment_data segment .data align=32 class=DATA use32 11 %ifdef __BORLANDC__ 12 %define segment_bss segment .data align=32 class=DATA use32 13 %else 14 %define segment_bss segment .bss align=32 class=DATA use32 15 %endif 16 17%elifdef AOUT 18 %define _NAMING 19 %define segment_code segment .text 20 %define segment_data segment .data 21 %define segment_bss segment .bss 22 23%else 24 %define segment_code segment .text align=32 class=CODE use32 25 %define segment_data segment .data align=32 class=DATA use32 26 %define segment_bss segment .bss align=32 class=DATA use32 27%endif 28 29%define pmov movq 30%define pmovd movd 31 32%define pupldq punpckldq 33%define puphdq punpckhdq 34%define puplwd punpcklwd 35%define puphwd punpckhwd 36 37%imacro globaldef 1 38 %ifdef _NAMING 39 %define %1 _%1 40 %endif 41 global %1 42%endmacro 43 44%imacro externdef 1 45 %ifdef _NAMING 46 %define %1 _%1 47 %endif 48 extern %1 49%endmacro 50 51%imacro proc 1 52 %push proc 53 global _%1 54 global %1 55_%1: 56%1: 57 %assign %$STACK 0 58 %assign %$STACKN 0 59 %assign %$ARG 4 60%endmacro 61 62%imacro endproc 0 63 %ifnctx proc 64 %error expected 'proc' before 'endproc'. 65 %else 66 %if %$STACK > 0 67 add esp, %$STACK 68 %endif 69 70 %if %$STACK <> (-%$STACKN) 71 %error STACKLEVEL mismatch check 'local', 'alloc', 'pushd', 'popd' 72 %endif 73 74 ret 75 %pop 76 %endif 77%endmacro 78 79%idefine sp(a) esp+%$STACK+a 80 81%imacro arg 1 82 %00 equ %$ARG 83 %assign %$ARG %$ARG+%1 84%endmacro 85 86%imacro local 1 87 %assign %$STACKN %$STACKN-%1 88 %00 equ %$STACKN 89%endmacro 90 91%imacro alloc 0 92 sub esp, (-%$STACKN)-%$STACK 93 %assign %$STACK (-%$STACKN) 94%endmacro 95 96%imacro pushd 1-* 97 %rep %0 98 push %1 99 %assign %$STACK %$STACK+4 100 %rotate 1 101 %endrep 102%endmacro 103 104%imacro popd 1-* 105 %rep %0 106 %rotate -1 107 pop %1 108 %assign %$STACK %$STACK-4 109 %endrep 110%endmacro 111 112%macro algn 1 113 align 16 114 %rep (65536-%1) & 15 115 nop 116 %endrep 117%endm 118