ustr2dw.asm

来自「工欲善其事」· 汇编 代码 · 共 52 行

ASM
52
字号
; #########################################################################

    .386
    .model flat, stdcall  ; 32 bit memory model
    option casemap :none  ; case sensitive

; String <-> unsigned DWORD

; ---------------------------------------------------
; This algorithm was written by comrade
; <comrade2k@hotmail.com>; http://www.comrade64.com/
; ---------------------------------------------------

    .code

;#########################################################################

; ustr2dw

; Parameters
;     pszString - null-terminated string to be converted
; Result
;     eax = converted number
; Trashed: ecx, edx, esi

.code

;#########################################################################

ustr2dw proc pszString:DWORD

	mov	esi, [pszString]
	xor	eax, eax
	xor	edx, edx
	jmp	@@chkz
@@redo:	sub	dl, "0"
	mov	ecx, eax
	add	eax, eax
	shl	ecx, 3
	inc	esi
	add	eax, ecx
	add	eax, edx
@@chkz:	mov	dl, [esi]
	test	dl, dl
	jnz	@@redo
	ret

ustr2dw endp

;#########################################################################

end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?