Stone KeyMaker Maker's Include Functions v0.6


Bugreports, greetings, suggestions ETC. mail to: stone@one.se
Newer versions etc. check: http://www.one.se/~stone

Whats new:
	0.7 -	Not released.
		DISCOTINIUED due to lack of interest. I had only ONE
		email concerning kmmi and this triggered 0.6. I take it
		that you guys don't use it and thus I have no reason
		to spend time updating it or embarrasing myself by releaseing
		my crap code! Generally though I still write these kinda
		routines as I need them so if you need something email me
		I might have what you need on stock.... And who knows.. maybe
		one day I'll release this again!

	0.6 -	Str2Num replaced by
	      	Dstr2num - decimal string => number (now 64 bit)  and
		Hstr2num - Hexadecimal String => number 64 bit

		Comments changed on chk386 & convert_num

	0.5 -	First public release



** DISCLAIMER: This might not work - Any damage done is not my fault...
		I'M NOT A FREAKING CODER!!! Don't bitch that my code is
		suboptimal or stupid! :).. if you don't like it - don't use it

Background:
I've found that many times some functions especially string-functions is 
needed when you're doing keymakers. Routines such as upcasing a string is no
problem to program - but it's just much easier to copy a ready made one...
Infact quite a few times I've seen keymakers that in the text said that you 
should enter the string in uppercase. And I've even seen that some people 
downloaded my keymakers and used the includes I did... 
This is the background for this....I've tried to always made the functions 
well-documented so they'll be useful for you. It's NOT a shame to lazy!

I could have released this in .OBJ form - but what you really need is the 
source-codes so you can modify them for your own needs.


*** You are allowed to USE the code found here as you see fit without 
crediting me. However incase you do use it please drop me a line. Bugreports,
suggestions and stuff like that also appreciated!

If I get no respons about these include files - well ... then you can be pretty
darn sure that no other versions will be released!


I'm known to be a SMALL model (two segment exe) fan and all these functions 
are fitted to the SMALL model and tested within the SMALL model. However I do 
believe that they'll all work in the TINY (.COM) as well.
And to ACP: yeah.. they might even work with the FLAT model :) (conv_num does ;) )
Also I'm a TASM fan. So this was tested with TASM 5.0..it'll probably work 
NP with newer versions and most likely with MASM or other assemblers as well



General assumptions: DS=ES=DATA. Minimum 386'er!!! (.386, .486 etc.) (Except check 386)

Standards 	  : Input string at ESI
		  : Output string at EDI
		  : Length's in ECX



	Non-Specific functions
1.	Check386        - Check if this is a 386'er or better
2.	StrLngth	- Find the length of string (Any termination)
3.	Convert_Num     - Convert a number to a string (HEX/DEC/OCT/BIN) 64bit
4.	Str2dNum	- Convert a string to a number (DEC only) 64bit
5.      Str2hNum	- Convert a string to a number (HEX only) 64bit
6.	Upcase		- Upcases a string with known length
7.	Lowcase 	- Lowcases a string with known length

	0-terminated string functions
1.	Upcase0		- Upcases a 0 terminated string
2.	Lowcase0	- Lowercases a 0 terminated string

	0d-terminated string functions
1.	Upcase0d	- Upcases a 0d terminated string
2.	Lowcase0d	- Lowercases a 0d terminated string


(Comming soon: Random, CleanIllegalChars, Real2String...)


*************
FUNCTIONS
*************
DStr2Num      - Reads a decimal number from a string and returns it in EDX:EAX
		So you can calculate on it
		Input		 : DS:ESI = Decimal Number String
				 : ECX = Length of string
		Output		 : EDX:EAX = This number
		Registers changed: EAX
		Flags		 : NONE

		Use this if your user has entered '12' and you want to do a
		calculation on it. Run this function and EAX will be 0ch
		This function is limited to 64 bit e.g. the largest input it
		can convert is: large ;)
		See also: HStr2Num, Convert_num, StrLngth


HStr2Num      - Reads a hexadecimal number from a string and returns it in 
		EDX:EAX	so you can calculate on it
		Input		 : DS:ESI = Hexadecimal Number String
				 : ECX = Length of string
		Output		 : EDX:EAX = This number
		Registers changed: EDX:EAX
		Flags		 : NONE

		Use this if your user has entered '1E' and you want to do a
		calculation on it. Run this function and EAX will be 1Eh
		This function is limited to 64 bit e.g. the largest input it
		can convert is: 0FFFFFFFFh
		See also: DStr2Num, Convert_num, StrLngth


	
StrLngth      - Returns the length of a string in DS:ESI
		Input		 : DS:ESI = String
				 : AL = termination char
		Output		 : ECX= length of string
		Registers changed: ECX
		Flags            : NONE
		See also	 : Upcase, Lowcase


Check386      - Checks if the computer is a 386'er or better
		Input		: none
		Output		: none
		Flags		: Carry set if NOT a 386'er or better

Convert_Num   -	Number to string
		Converts the 64bit number in EDX:EAX to a writeable string
		This can write EDX:EAX as HEX, OCTAL, DECIMAL.. Anything 
		with a "number base" less than 16. ECX is used for number base.
		E.g.
			mov edx, upperpart
			mov eax, lowerpart
			lea edi, output
			mov ecx,16d
			call convert_num
		This will give you EDX:EAX as HEX string
		
			mov edx, upperpart
			mov eax, lowerpart
			lea edi, output
			mov ecx,10d
			call convert_num
		This will give you EDX:EAX as DECIMAL string
		Input		 : EDX:EAX - number to convert
				 : ECX - Number base
		Output		 : String at EDI
		Registers changed: MANY :)
		Flags            : ALL? ;>
		See also	 : DStr2Num, HStr2Num

Upcase	     -	Upcases a string
		input 		 : ESI = string to be upcased
		       		   ECX = length of string
		output	   	 : string in ESI is now in upcase
		registers changed: NONE
		Flags: NONE
		See also: StrLenght, Upcase0, upcase0d, lowcase & cleanstring

Upcase0      -	Upcases a 0-terminated string
	      	Input            : ESI = string to be upcased
	      	Output		 : String at ESI now upcase
	      	Registers changed: NONE
              	Flags            : NONE
		See also	 : Upcase, Upcase0d, Lowcase0

Upcase0d     - 	Upcases a 0dh-terminated string
	       	Input            : ESI = string to be upcased
	       	Output           : String at ESI now upcase
               	Registers changed: NONE
	       	Flags            : NONE
		See also	 : Upcase0, Upcase, Lowcase0d

Lowcase	     - Lowercases a string
	       	Input            : ESI = string to be lowcased
                                : ECX = Length of string
               	Output           : String at ESI now lowcase
               	Registers changed: NONE
	       	Flags            : NONE
		See also	 : Strlength, lowcase0, Lowcase0d, Upcase

Lowcased     -	Lowercases a string
	      	Input            : ESI = string to be lowcased
               	Output           : String at ESI now lowcase
               	Registers changed: NONE
	       	Flags            : NONE
		See also	: Lowcase, lowcase0, upcased

Lowcase0     -	Lowercases a string
	      	Input            : ESI = string to be lowcased
              	Output           : String at ESI now lowcase
              	Registers changed: NONE
	      	Flags            : NONE
		See also	 : Lowcased, lowcase, upcase0


Code all written by Stone or *modified* by Stone. All documentation written
by me! :)

Other places where code originated from:
Borland Turbo Assembler - examples
Things To Do 2.2d
AxMan keymaker by Killa/Core


Much thanks must go to the authors of all the above and ofcause:
Patriarch, Acp, Random, Nelapsi, Darkstalker, MegaDoc, UCF, Jammer...

Btw: SOMEBODY GIMME SOME FUCKING REAL HTML FOR MY WEBPAGE ;)
2nd&MI