port from perforce
This commit is contained in:
200
hgplus/obliterator/inc/macros.inc
Normal file
200
hgplus/obliterator/inc/macros.inc
Normal file
@@ -0,0 +1,200 @@
|
||||
; macros.inc - las/mercury
|
||||
|
||||
%macro TEXT_SECTION 1
|
||||
section %1 text align=1
|
||||
%endmacro
|
||||
|
||||
%macro DATA_SECTION 1
|
||||
section %1 data align=1
|
||||
%endmacro
|
||||
|
||||
%macro BSS_SECTION 1
|
||||
section %1 bss align=1
|
||||
%endmacro
|
||||
|
||||
%define REVERSEBITS(b) (\
|
||||
(b & 128) >> 7 |\
|
||||
(b & 64) >> 5 |\
|
||||
(b & 32) >> 3 |\
|
||||
(b & 16) >> 1 |\
|
||||
(b & 8) << 1 |\
|
||||
(b & 4) << 3 |\
|
||||
(b & 2) << 5 |\
|
||||
(b & 1) << 7)
|
||||
|
||||
%macro com 2
|
||||
push dword [%1]
|
||||
push dword [%1]
|
||||
pop eax
|
||||
mov eax, [eax]
|
||||
call [eax + %2]
|
||||
%endmacro
|
||||
|
||||
%macro com 1
|
||||
pop eax
|
||||
mov eax, [eax]
|
||||
call [eax + %2]
|
||||
%endmacro
|
||||
|
||||
%ifdef IBH
|
||||
%macro glext 1
|
||||
call dword [%1]
|
||||
%endmacro
|
||||
%endif
|
||||
|
||||
%ifndef IBH
|
||||
%macro glext 1
|
||||
push dword %1
|
||||
call _wglGetProcAddress@4
|
||||
call eax
|
||||
%endmacro
|
||||
%endif
|
||||
|
||||
%macro DBG 1
|
||||
%ifdef DEBUG
|
||||
%define msg %1
|
||||
%strlen msgLength msg
|
||||
pushad
|
||||
xor eax, eax
|
||||
push eax
|
||||
push eax
|
||||
push dword STD_ERROR_HANDLE
|
||||
call _GetStdHandle@4
|
||||
push dword msgLength+2
|
||||
call %%endOfMsg
|
||||
db msg, 13, 10
|
||||
%%endOfMsg:
|
||||
push eax
|
||||
call _WriteFile@20
|
||||
popad
|
||||
%undef msg
|
||||
%undef msgLength
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
%macro DBG_BOX 2
|
||||
%ifdef DEBUG
|
||||
%define caption %2
|
||||
%define text %1
|
||||
pushad
|
||||
xor eax, eax
|
||||
push eax
|
||||
call %%endCaption
|
||||
db caption, 0
|
||||
%%endCaption:
|
||||
call %%endText
|
||||
db text, 0
|
||||
%%endText:
|
||||
push eax
|
||||
call _MessageBoxA@16
|
||||
popad
|
||||
%undef msg
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
%macro DBG_NO_NL 1
|
||||
%ifdef DEBUG
|
||||
%define msg %1
|
||||
%strlen msgLength msg
|
||||
pushad
|
||||
xor eax, eax
|
||||
push eax
|
||||
push eax
|
||||
push dword STD_ERROR_HANDLE
|
||||
call _GetStdHandle@4
|
||||
push dword msgLength
|
||||
call %%endOfMsg
|
||||
db msg
|
||||
%%endOfMsg:
|
||||
push eax
|
||||
call _WriteFile@20
|
||||
popad
|
||||
%undef msg
|
||||
%undef msgLength
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
%macro DBG_STR 0
|
||||
pop eax
|
||||
pushad
|
||||
xchg eax, edx
|
||||
mov edi, edx
|
||||
xor eax, eax
|
||||
xor ecx, ecx
|
||||
not ecx
|
||||
cld
|
||||
repne scasb
|
||||
not ecx
|
||||
dec ecx
|
||||
|
||||
push eax
|
||||
push eax
|
||||
push ecx
|
||||
push edx
|
||||
|
||||
push dword STD_ERROR_HANDLE
|
||||
call _GetStdHandle@4
|
||||
|
||||
push eax
|
||||
call _WriteFile@20
|
||||
popad
|
||||
%endmacro
|
||||
|
||||
%macro DBG_CHAR 0
|
||||
mov eax, esp
|
||||
pushad
|
||||
mov ebx, eax
|
||||
xor ecx, ecx
|
||||
push ecx
|
||||
push ecx
|
||||
push dword STD_ERROR_HANDLE
|
||||
call _GetStdHandle@4
|
||||
push byte 1
|
||||
push ebx
|
||||
push eax
|
||||
call _WriteFile@20
|
||||
popad
|
||||
pop eax
|
||||
%endmacro
|
||||
|
||||
%macro DBG_NUM 0
|
||||
pop eax
|
||||
pushad
|
||||
xor ebx, ebx
|
||||
%%pushDigitLoop:
|
||||
inc ebx
|
||||
xor edx, edx
|
||||
mov ecx, dword 10
|
||||
div ecx
|
||||
add edx, byte '0'
|
||||
push edx
|
||||
test eax, eax
|
||||
jnz %%pushDigitLoop
|
||||
mov ecx, ebx
|
||||
%%printDigitLoop:
|
||||
DBG_CHAR
|
||||
loop %%printDigitLoop
|
||||
popad
|
||||
%endmacro
|
||||
|
||||
%macro DBG_EXIT_EAX_0 1
|
||||
%ifdef DEBUG
|
||||
test eax, eax
|
||||
jnz short %%isNotZero
|
||||
DBG %1
|
||||
push byte 0
|
||||
call _ExitProcess@4
|
||||
%%isNotZero:
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
%macro DBG_EXIT_EAX_NOT_0 1
|
||||
%ifdef DEBUG
|
||||
test eax, eax
|
||||
jz short %%isZero
|
||||
DBG %1
|
||||
push byte 0
|
||||
call _ExitProcess@4
|
||||
%%isZero:
|
||||
%endif
|
||||
%endmacro
|
||||
Reference in New Issue
Block a user