home *** CD-ROM | disk | FTP | other *** search
- 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
-