⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 convert.asm

📁 用汇编写的win32程序一些例子。
💻 ASM
字号:
	.386
	.model flat,STDCALL

include win32.asi           ; some 32-bit constants and structures
include win32.ase

	.data
numbuf	db	15 dup (0)
	.code

	public IntToString, StringToInt
IntToString PROC
	push	ebx
	push	ecx
	push	edx
	lea 	edi,[numbuf]
	push	edi
	or      eax,eax
	jns	notneg
	mov	byte ptr [edi],'-'
	inc	edi
	neg	eax
notneg:
	mov	ebx,10
	sub	ecx,ecx
lp0:
	inc	ecx
	sub	edx,edx
	div	ebx
	or	dl,'0'
	push	edx
	or	eax,eax
	jnz	lp0
lp1:
	pop	eax
	stosb
	loop	lp1
	sub	al,al
	stosb
	pop	edi
	pop	edx
	pop	ecx
	pop	ebx
	ret
	
IntToString ENDP
StringToInt PROC
	push	ebx
	push	edx
	push	esi
	sub	ebx,ebx
	sub	edx,edx
	sub	eax,eax
	cmp	byte ptr [edi],'-'
	jnz	sinotneg
	inc	edi
	inc	ebx
sinotneg:
	cmp	byte ptr [edi],'+'
	jnz	notplus
	inc	edi
notplus:
	
	lodsb
	or	al,al
	jz	sid
	sub	al,'0'
	imul	edx,edx,10
	sub	al,'0'
	add	edx,eax
	jmp	notplus
sid:
	mov	eax,edx
	pop	esi
	pop	edx
	pop	ebx
	ret
StringToInt ENDP
	end

⌨️ 快捷键说明

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