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

📄 numbers.inc

📁 一个汇编程序 不过什么忘了
💻 INC
字号:
Comment %
	Numbers.inc written by Patriarch/PWA
	modded to windows/console.inc by ACP/UCF
	modded to specific use by Stone/UCF
	%

Hex2Dec Proc
	Test eax,eax
	JNZ	eaxwasnot0
	Write_Console <offset EaxWas0> <8>
	RET
eaxwasnot0:
        Push EDX
        Push ECX
        Push ESI
	
        Mov  ESI,10h
        Xor  ECX,ECX

Not_zero:
        Xor  EDX,EDX
        Div  ESI             
        Inc  ECX
        Push EDX             ;Pushes one digit number into the stack
	cmp ecx,8
	jnz Not_zero




WriteDigit_Loop:
        Pop  EDX                   ; Fetch numbers in reverse order.
        Call Write_ASCII_Number
        LOOP WriteDigit_Loop
	mov first,0
        Pop ESI
        Pop ECX
        Pop EDX
        Ret
Hex2Dec EndP

Write_ASCII_Number PROC
        Cmp  DL,10
        JAE  Hex_Number
        Add  DL,30h              ; yes, converts into ascii (1-9)
        JMP  Short Write_Number  ; writes the character
Hex_Number:
        Add  DL,'A'-10           ;converts into ascii (A-F)

Write_Number:                    ; Write number...
        Call Write_Char
        Ret
Write_ASCII_Number ENDP

Write_Char PROC
        PushA
	cmp dl, 30h
	jnz itsnot0
	cmp first, 1
	jz still0
	sub dl, 10h
	jmp still0
itsnot0:
	mov byte ptr [first],1
still0:
        Mov Byte Ptr [Digit_to_write], DL  
        Write_Console <offset Digit_to_write> <1>            
        PopA
        Ret

Digit_to_write db ?
first	db 0
EaxWas0 db "       0"
Write_Char ENDP

⌨️ 快捷键说明

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