?? dispatch.asm
字號:
.386
.model flat
PUBLIC Dispatch, Translate
.code
; **********************************************************************
;
; switch-case handler
;
Dispatch PROC
push ebx
push ecx
mov ebx,[esp+8]
mov ecx,dword ptr [ebx]
add ebx,4
dpl:
cmp eax,[ebx]
jz docall
add ebx,8
loop dpl
mov [esp+8],ebx
pop ecx
pop ebx
stc
ret
docall:
pop ecx
push offset finishup
push dword ptr [ebx+4]
mov ebx,[esp+8]
ret
finishup:
add esp,4
push ebx
push eax
mov ebx,[esp+8]
mov eax,[ebx]
lea ebx,[ebx + 8 * eax + 4] ; Get offset to return address
mov [esp+8],ebx ; Xchg with orig value of ebx
pop eax
pop ebx
ret
Dispatch ENDP
; ****************************************************************
;
; translate from one value to another
;
Translate PROC
push ebx
push ecx
mov ebx,[esp+8]
mov ecx,dword ptr [ebx]
add ebx,4
tpl:
cmp eax,[ebx]
jz doxlate
add ebx,8
loop tpl
mov [esp+8],ebx
pop ecx
pop ebx
stc
ret
doxlate:
pop ecx
push dword ptr [ebx + 4]
mov ebx,[esp+8]
mov eax,[ebx]
lea ebx,[ebx + 8 * eax + 4] ; Get offset to return address
mov [esp+8],ebx ; Xchg with orig value of ebx
pop eax
pop ebx
ret
Translate ENDP
END
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -