home *** CD-ROM | disk | FTP | other *** search
/ The Elite Hackers Toolkit / TheEliteHackersToolkitVolume1_1998.rar / HACKERS.BIN / appcraks / UCFPE113.ZIP / NUMBERS.INC < prev    next >
Text File  |  1997-12-21  |  2KB  |  75 lines

  1. Comment %
  2.     Numbers.inc written by Patriarch/PWA
  3.     modded to windows/console.inc by ACP/UCF
  4.     modded to specific use by Stone/UCF
  5.     %
  6.  
  7. Hex2Dec Proc
  8.     Test eax,eax
  9.     JNZ    eaxwasnot0
  10.     Write_Console <offset EaxWas0> <8>
  11.     RET
  12. eaxwasnot0:
  13.         Push EDX
  14.         Push ECX
  15.         Push ESI
  16.     
  17.         Mov  ESI,10h
  18.         Xor  ECX,ECX
  19.  
  20. Not_zero:
  21.         Xor  EDX,EDX
  22.         Div  ESI             
  23.         Inc  ECX
  24.         Push EDX             ;Pushes one digit number into the stack
  25.     cmp ecx,8
  26.     jnz Not_zero
  27.  
  28.  
  29.  
  30.  
  31. WriteDigit_Loop:
  32.         Pop  EDX                   ; Fetch numbers in reverse order.
  33.         Call Write_ASCII_Number
  34.         LOOP WriteDigit_Loop
  35.     mov first,0
  36.         Pop ESI
  37.         Pop ECX
  38.         Pop EDX
  39.         Ret
  40. Hex2Dec EndP
  41.  
  42. Write_ASCII_Number PROC
  43.         Cmp  DL,10
  44.         JAE  Hex_Number
  45.         Add  DL,30h              ; yes, converts into ascii (1-9)
  46.         JMP  Short Write_Number  ; writes the character
  47. Hex_Number:
  48.         Add  DL,'A'-10           ;converts into ascii (A-F)
  49.  
  50. Write_Number:                    ; Write number...
  51.         Call Write_Char
  52.         Ret
  53. Write_ASCII_Number ENDP
  54.  
  55. Write_Char PROC
  56.         PushA
  57.     cmp dl, 30h
  58.     jnz itsnot0
  59.     cmp first, 1
  60.     jz still0
  61.     sub dl, 10h
  62.     jmp still0
  63. itsnot0:
  64.     mov byte ptr [first],1
  65. still0:
  66.         Mov Byte Ptr [Digit_to_write], DL  
  67.         Write_Console <offset Digit_to_write> <1>            
  68.         PopA
  69.         Ret
  70.  
  71. Digit_to_write db ?
  72. first    db 0
  73. EaxWas0 db "       0"
  74. Write_Char ENDP
  75.