.686

.model flat, stdcall

option casemap:none



	include windows.inc
	include user32.inc
	include kernel32.inc
	include gdi32.inc
	include winmm.inc
	includelib user32.lib
	includelib kernel32.lib
	includelib gdi32.lib
	includelib winmm.lib
	includelib ntdll.lib



	NtQuerySystemInformation				PROTO :DWORD, :DWORD, :DWORD, :DWORD
	WinMain							PROTO :DWORD, :DWORD, :DWORD, :DWORD
	WndProc							PROTO :DWORD, :DWORD, :DWORD, :DWORD
	FilterInput							PROTO :DWORD, :DWORD, :DWORD, :DWORD
	IsWordInAnotherFile					PROTO :DWORD, :DWORD
	WriteToFile							PROTO :DWORD, :DWORD
	ZeroBuffer							PROTO :DWORD, :DWORD
	CompareWordInFile						PROTO :DWORD, :DWORD
	Real10ToAscii						PROTO q_val:REAL10
	UnScramble							PROTO :DWORD
	GetFactorial						PROTO :DWORD
	LookAtGlobalMemory					PROTO :DWORD
	ThreadProc							PROTO
	GetCpuUsage							PROTO
	wsprintfA							PROTO C :DWORD, :VARARG
	wsprintf 							EQU <wsprintfA>
	SystemBasicInformation					EQU 0
	SystemProcessorInformation				EQU 1
	SystemPerformanceInformation				EQU 2
	SystemTimeOfDayInformation				EQU 3
	SystemPathInformation					EQU 4
	SystemProcessThreadInformation			EQU 5
	SystemServiceDescriptorTableInformation		EQU 6
	SystemIoConfigInformation				EQU 7
	SystemProcessorTimeInformation			EQU 8
	SystemGlobalFlagInformation				EQU 9
	SystemNotImplemented2					EQU 10
	SystemModuleInformation					EQU 11
	SystemResourceLockInformation				EQU 12
	SystemNotImplemented3					EQU 13
	SystemNotImplemented4					EQU 14
	SystemNotImplemented5					EQU 15
	SystemHandleInformation					EQU 16
	SystemObjectInformation					EQU 17
	SystemPagefileInformation				EQU 18
	SystemInstructionEmulationCounts			EQU 19
	SystemInvalidInformationClass1			EQU 20
	SystemCacheInformation					EQU 21
	SystemPoolTagInformation				EQU 22
	SystemProcessorScheduleInformation			EQU 23
	SystemDpcInformation					EQU 24
	SystemNotImplemented6					EQU 25
	SystemLoadImage						EQU 26
	SystemUnloadImage						EQU 27
	SystemTimeAdjustment					EQU 28
	SystemNotImplemented7					EQU 29
	SystemNotImplemented8					EQU 30
	SystemNotImplemented9					EQU 31
	SystemCrashDumpInformation				EQU 32
	SystemExceptionInformation				EQU 33
	SystemCrashDumpStateInformation			EQU 34
	SystemKernelDebuggerInformation			EQU 35
	SystemContextSwitchInformation			EQU 36
	SystemRegistryQuotaInformation			EQU 37
	SystemLoadAndCallImage					EQU 38
	SystemPrioritySeparation				EQU 39
	SystemNotImplemented10					EQU 40
	SystemNotImplemented11					EQU 41
	SystemInvalidInformationClass2			EQU 42
	SystemInvalidInformationClass3			EQU 43
	SystemTimeZoneInormation				EQU 44
	SystemLookasideInformation				EQU 45
	SystemSetTimeSlipEvent					EQU 46
	SystemCreateSession					EQU 47
	SystemDeleteSession					EQU 48
	SystemInvalidInformationClass4			EQU 49
	SystemRangeStartInformation				EQU 50
	SystemVerifierInformation				EQU 51
	SystemAddVerifier						EQU 52
	SystemSessionProcessesInformation			EQU 53
	SystemInformationClassMax				EQU 54



.data
; variables in more than one proc
	hInstance				DD 0
	last_input				DD 0
	len_msg				DB 'You must enter a lower case string from 4 to 6 characters in length.', 0
	write_file_name			DB 'output.nog', 0
	edit_msg				DB 100 dup(0)
; WinMain
	hWnd					DD 0
	class_name				DB 'RÖÄKNOG', 0
	display_name			DB 'UNSCRAMBLER', 0
; WndProc
	general_counter			DD 0
	edit_1_handle			DD 0
	edit_2_handle			DD 0
	edit_3_handle			DD 0
	word_item				DD 0, 0	; dummy data to prevent overrun of about_msg
	about_msg				DB 'WORDS.DIC CONTAINS ABOUT 33000 WORDS.', 10, 'COPYRIGHT 2006  RÖÄK NOG!', 10, 'INNIEA PUBLISHING CO.', 0
	word_msg				DB 'scabua', 100 dup(0)
	unscram_msg				DB 'UNSCRAMBLE', 0
	out_msg				DB 'PERMUTATIONS IN FILE OUTPUT.NOG.  ', 0
	two_msg				DB 'ENTER 4 TO 6 LETTER SCRAMBLE ABOVE.', 0
	button_class			DB 'BUTTON', 0
	edit_class				DB 'EDIT', 0
	exit_msg				DB 'EXIT', 0
; CompareWordInFile
	err_read_file_msg			DB 'FAILURE TO READ FROM FILE!', 0
	not_msg				DB 'YOUR WORD IS NOT IN MY LIST.', 0
	err_set_file_pointer		DB 'CANNNOT SET FILE POINTER!', 0
; GetCpuUsage
	testor				DWORD 0
	number_processors			DWORD 0
	ten_million				REAL10 10000000.0
	time_ratio				REAL10 0.0
	old_idle_time			REAL10 0.0
	new_idle_time			REAL10 0.0
	old_kernel_time			REAL10 0.0
	new_kernel_time			REAL10 0.0
	delta_idle				REAL10 0.0
	delta_kernel			REAL10 0.0
	zero_point_five			REAL10 0.5
	SYSTEM_PROCESSOR_TIMES		STRUC						; size = 48 bytes
	IdleTime				QWORD 0
	KernelTime				QWORD 0
	UserTime				QWORD 0
	DpcTime				QWORD 0
	InterruptTime			QWORD 0
	InterruptCount			DWORD 0
	Junk					DWORD 0
	SYSTEM_PROCESSOR_TIMES		ENDS
	PSYSTEM_PROCESSOR_TIMES		TYPEDEF PTR SYSTEM_PROCESSOR_TIMES	; size = 44 bytes
	SYSTEM_BASIC_INFORMATION	STRUC
	dwUnknown1				DWORD 0
	uKeMaximumIncrement		DWORD 0
	uPageSize				DWORD 0
	uMmNumberOfPhysicalPages	DWORD 0
	uMmLowestPhysicalPage		DWORD 0
	uMmHighestPhysicalPage		DWORD 0
	uAllocationGranularity		DWORD 0
	pLowestUserAddress		PDWORD 0
	pMmHighestUserAddress		PDWORD 0
	uKeActiveProcessors		DWORD 0
	bKeNumberProcessors		BYTE 0
	bUnknown2				BYTE 0
	wUnknown3				WORD 0
	SYSTEM_BASIC_INFORMATION	ENDS
	PSYSTEM_BASIC_INFORMATION	TYPEDEF PTR SYSTEM_BASIC_INFORMATION
; IsWordInAnotherFile
	success_msg				DB 'SUCCESS!', 0
; LookAtGlobalMemory
	final_gms_buf			DB 2000 dup (0)	
	interim_gms_buf			DB 2000 dup (0)
	gms_msg				DB 100 dup ('*'), 'MEMORY LOAD = %d%%', 83 dup ('*')
						DB 'TOTAL PHYSICAL MEMORY = %d BYTES.', 60 dup ('*')
						DB 'AVAILABLE PHYSICAL MEMORY = %d BYTES.', 56 dup('*')
						DB 'TOTAL PAGEFILE = %d BYTES.', 66 dup('*')
						DB 'AVAILABLE PAGEFILE = %d BYTES.', 62 dup ('*')
						DB 'TOTAL VIRTUAL MEMORY = %d BYTES.', 60 dup ('*')
						DB 'AVAILABLE VIRTUAL MEMORY = %d BYTES.', 56 dup ('*')
						DB 'CPU USAGE = %s%%', 83 dup ('*'), 0
; ThreadProc
	err_handle_msg			DB 'INVALID FILE HANDLE!', 0
	dictionary_file_name		DB 'words.dic', 0
; UnScramble
	thread_id				DD 0
	zbuffer				DB 40320 dup(0)
	xbuffer				DB 40320 dup(0)



.code

start:
	invoke GetModuleHandle, 0
	mov hInstance, EAX
	invoke GetCommandLine
	invoke WinMain,hInstance, 0, EAX, SW_SHOWDEFAULT
	invoke ExitProcess, EAX


;_____________________________________________________________________________________



WinMain proc		hInst:DWORD, hPrevInst:DWORD, CmdLine:DWORD, CmdShow:DWORD
	LOCAL wc:WNDCLASSEX
	LOCAL msg:MSG
	mov wc.cbSize, sizeof WNDCLASSEX
	mov wc.style, CS_HREDRAW or CS_VREDRAW or CS_BYTEALIGNWINDOW
	mov wc.lpfnWndProc, offset WndProc
	mov wc.cbClsExtra, 0
	mov wc.cbWndExtra, 0     
	push hInst
	pop wc.hInstance
	mov wc.hbrBackground, 3					; background color
	mov wc.lpszMenuName, 0
	mov wc.lpszClassName, offset class_name
	invoke LoadIcon, hInst, 500				; ID resource icon
	mov wc.hIcon, EAX
	invoke LoadCursor, 0, IDC_ARROW
	mov wc.hCursor, EAX
	mov wc.hIconSm, 0
	invoke RegisterClassEx, ADDR wc
	invoke CreateWindowEx,WS_EX_OVERLAPPEDWINDOW, ADDR class_name, ADDR display_name, WS_OVERLAPPEDWINDOW, 50, 100, 450, 450, 0, 0, hInst, 0
	mov hWnd, EAX
	invoke LoadMenu,hInst, 600				; load resource menu
	invoke SetMenu, hWnd, EAX
	invoke ShowWindow, hWnd, SW_SHOWNORMAL
	invoke UpdateWindow, hWnd
StartLoop:
	invoke GetMessage, ADDR msg, 0, 0, 0
	cmp EAX, 0
	je ExitLoop
	invoke TranslateMessage, ADDR msg
	invoke DispatchMessage,  ADDR msg
	jmp StartLoop
ExitLoop:
	mov EAX, msg.wParam
	ret
WinMain endp



;_____________________________________________________________________________________



WndProc proc		hWin:DWORD, uMsg:DWORD, wParam:DWORD, lParam:DWORD
	LOCAL hdc:HDC
	LOCAL ps:PAINTSTRUCT
	.if uMsg == WM_COMMAND
		.if wParam == 1000
		invoke SendMessage, hWin, WM_SYSCOMMAND, SC_CLOSE, 0
	.elseif wParam == 1500
		invoke PlaySound, 1001, hInstance, SND_RESOURCE or SND_ASYNC
	.elseif wParam == 1700
		invoke PlaySound, 1002, hInstance, SND_RESOURCE or SND_ASYNC
	.elseif wParam == 1900
		invoke MessageBox, hWin, ADDR about_msg, ADDR unscram_msg, 0
	.elseif wParam == 2000
		invoke SendMessage, edit_1_handle, WM_GETTEXT, 32, ADDR word_item
		invoke UnScramble, ADDR word_item
		invoke SendMessage, edit_2_handle, WM_SETTEXT, 32, ADDR out_msg
	.endif
	.elseif uMsg == WM_CREATE
		invoke SetTimer, hWin, 1, 1000, 0	
		invoke CreateWindowEx, 0, ADDR button_class, ADDR exit_msg, WS_CHILD or WS_VISIBLE, 50, 50, 170, 25, hWin, 1000, hInstance, 0
		invoke CreateWindowEx, 0, ADDR button_class, ADDR unscram_msg, WS_CHILD or WS_VISIBLE, 50, 75, 170, 25, hWin, 2000, hInstance, 0
		invoke CreateWindowEx, WS_EX_CLIENTEDGE, ADDR edit_class, ADDR word_msg, WS_VISIBLE or WS_CHILDWINDOW or ES_AUTOHSCROLL or ES_NOHIDESEL, 50, 150, 330, 25, hWin, 1100, hInstance, 0
		mov edit_1_handle, EAX
		invoke SetWindowLong, edit_1_handle, GWL_WNDPROC, FilterInput
		mov last_input, EAX
		invoke CreateWindowEx, WS_EX_CLIENTEDGE, ADDR edit_class, ADDR two_msg, WS_VISIBLE or WS_CHILDWINDOW or ES_AUTOHSCROLL or ES_NOHIDESEL, 50, 175, 330, 25, hWin, 1300, hInstance, 0
		mov edit_2_handle, EAX
		invoke CreateWindowEx, WS_EX_CLIENTEDGE, ADDR edit_class, 0, WS_VISIBLE or WS_CHILDWINDOW or ES_AUTOHSCROLL or ES_NOHIDESEL, 50, 200, 330, 25, hWin, 1700, hInstance, 0
		mov edit_3_handle, EAX
	.elseif uMsg == WM_CLOSE
		invoke PostQuitMessage, 0
		mov EAX, 0
		ret
	.elseif uMsg == WM_DESTROY
		invoke PostQuitMessage, 0
		mov EAX, 0
		ret
	.elseif uMsg == WM_PAINT
		invoke BeginPaint, hWin, ADDR ps
		mov hdc, EAX
		invoke SetTextColor, hdc, White
		invoke SetBkColor, hdc, Red
		mov general_counter, 8
text_loop:
		invoke LookAtGlobalMemory, general_counter
		invoke TextOut, hdc, 0, EDX, EAX, EBX
		dec general_counter
		.if general_counter > 0
			jmp text_loop
		.endif
		mov EAX, 0
		ret
	.elseif uMsg == WM_TIMER
		invoke InvalidateRect, hWin, 0, 0
		invoke UpdateWindow, hWin
		invoke SendMessage, edit_3_handle, WM_SETTEXT, 32, ADDR edit_msg
		mov EAX, 0
		ret
	.endif
	invoke DefWindowProc, hWin, uMsg, wParam, lParam
	ret
WndProc endp


;_________________________________________________________________________________



CompareWordInFile proc	USES ECX EDX ESI EDI	file_handle_one:DWORD, file_handle_two:DWORD
	LOCAL gfs_li:LARGE_INTEGER
	LOCAL my_qword:QWORD
	LOCAL low_part:DWORD
	LOCAL high_part:DWORD
	LOCAL my_counter:DWORD
	LOCAL file_position:DWORD
	LOCAL read_buffer:DWORD
	LOCAL dd_junk:DWORD
	LOCAL read_amount:DWORD
	LOCAL word_buf[100]:BYTE
	invoke LocalAlloc, LMEM_ZEROINIT, 512
	mov read_buffer, EAX
	mov file_position, 0
word_loop:
	invoke GetFileSizeEx, file_handle_one, ADDR gfs_li	; INSERT FILE SIZE TEST SO WE DON'T READ PAST END OF FILE
	finit
	fclex
	fild file_position
	fild gfs_li.QuadPart
	fsub st(0), st(1)
	fldz				; st(0) = 0 st(1) = file size - file position
	fcom st(1)			; compare st(0) of 0 to st(1) remaining bytes in file
	fnstsw AX			; AH == 1 if st(0) and st(1) are =
	sahf				; copy AH into condition code bits
	ja exit_gone_too_far	; if st(0) > st(1) ja = true or file position is negative
	finit				; SET FILE POSITION AND READ FROM FIRST FILE
	fclex
	fild file_position
	fistp my_qword
	mov read_amount, 512
	mov EAX, DWORD PTR[my_qword + 4]
	mov high_part, EAX
	mov EAX, DWORD PTR[my_qword]
	mov low_part, EAX
	invoke SetFilePointerEx, file_handle_one, low_part, high_part, 0, 0 	; handle, low, high, pointer to new file location or null, FILE_BEGIN = 0
	.if EAX == 0FFFFFFFFh
		invoke MessageBox, hWnd, ADDR err_set_file_pointer, 0, 0
	.endif
	invoke ReadFile, file_handle_one, read_buffer, read_amount, ADDR dd_junk, 0
	.if EAX == 0
		invoke MessageBox, hWnd, ADDR err_read_file_msg, 0, 0
	.endif
	mov ESI, read_buffer		; LOOK AT BUFFER READ FROM FILE
	lea EAX, word_buf
	mov EDI, EAX
	mov EBX, 0
	mov my_counter, 0
	mov ECX, 50
copy_loop:
	mov AL, BYTE PTR [ESI+EBX]
	inc my_counter
	.if (AL >= 97 && AL <= 122)
		mov BYTE PTR [EDI], AL
		mov BYTE PTR [EDI+1], 0
		inc EDI
	.endif
	.if (AL == 10 && my_counter > 3) || (AL == 10 && my_counter <= 6)
		.if (word_buf[0] != 0)
			.if read_buffer == 0
				invoke LocalFree, read_buffer
			.endif
			invoke lstrcpy, ADDR edit_msg, ADDR word_buf			; for display in third edit box
			invoke IsWordInAnotherFile, ADDR word_buf, file_handle_two	; COMPARE WORD FROM FIRST FILE TO WORD FROM SECOND FILE
			.if EAX == 13
				ret
			.endif
		.endif
		mov EAX, my_counter
		add file_position, EAX
		jmp word_loop
	.endif
	inc EBX
	loop copy_loop
exit_gone_too_far:
	invoke LocalFree, read_buffer
	invoke MessageBox, hWnd, ADDR not_msg, 0, 0
	ret
CompareWordInFile endp



;_____________________________________________________________________________________



FilterInput proc			hCtl:DWORD, uMsg:DWORD, wParam :DWORD, lParam :DWORD	
	.if uMsg == WM_CHAR							; filter input
		.if wParam == 8 || (wParam >= 97 && wParam <= 122)	; accept backspace and lower case letters
			jmp accept_input
		.endif
		invoke MessageBox, hWnd, ADDR len_msg, 0, 0
		mov EAX, 0
		ret
	.endif
accept_input:
	invoke CallWindowProc, last_input, hCtl, uMsg, wParam, lParam

	ret
FilterInput endp



;_____________________________________________________________________________________



GetCpuUsage proc				USES EBX ECX EDX ESI EDI	
	LOCAL	spt:SYSTEM_PROCESSOR_TIMES
	LOCAL sbi:SYSTEM_BASIC_INFORMATION
	LOCAL xyz_rt:REAL10
	LOCAL buffer_size:DWORD
	LOCAL one_hundred:DWORD
	mov one_hundred, 100
	mov buffer_size, 44
	invoke NtQuerySystemInformation, SystemBasicInformation,  ADDR sbi, sizeof SYSTEM_BASIC_INFORMATION, ADDR buffer_size
	.if EAX != 0
		ret
	.endif
	mov buffer_size, 48
	mov AL, sbi.bKeNumberProcessors			; = # cpu's
	mov number_processors, EAX
	invoke NtQuerySystemInformation, SystemProcessorTimeInformation, ADDR spt, sizeof SYSTEM_PROCESSOR_TIMES, ADDR buffer_size
	.if EAX != 0
		ret
	.endif
	inc testor
	.if (testor == 2)
		mov testor, 0
	.endif
	.if (testor == 1)
		finit						; old idle and kernel
		fclex
		fild spt.IdleTime
		fld ten_million
		fdiv
		fstp old_idle_time
		fild spt.KernelTime
		fld ten_million
		fdiv
		fstp old_kernel_time
	.endif
	.if (testor == 0)
		finit						; new idle and kernel
		fclex
		fild spt.IdleTime
		fld ten_million
		fdiv
		fstp new_idle_time
		fild spt.KernelTime
		fld ten_million
		fdiv
		fstp new_kernel_time
	.endif						; CPU USAGE = 100 - ((delta_idle/delta_kernel) * 100)/(# cpu's + 0.05)
	finit							; delta idle
	fclex
	fld old_idle_time
	fld new_idle_time
	fsub st(0), st(1)
	fstp delta_idle
	finit							; delta kernel
	fclex
	fld old_kernel_time
	fld new_kernel_time
	fsub st(0), st(1)					; = new - old
	fstp delta_kernel
	finit							; ratio delta idle to delta kernel
	fclex
	fld delta_idle					; numerator
	fld delta_kernel					; denominator
	fdiv
	fild one_hundred					; ratio
	fmul							; ((delta_idle/delta_kernel) * 100)
	fstp xyz_rt						; storage of ((delta_idle/delta_kernel) * 100 . . . 
	finit
	fclex
	fld zero_point_five				; . . . )/(# cpu's + 0.05)
	fild number_processors
	fadd st(0), st(1)
	fld1
	fxch
	fdiv							; st(0) = 1/1.5
	fld xyz_rt
	fmul							; st(0) = ((delta_idle/delta_kernel) * 100)* (1 / 1.5)
	fild one_hundred
	fsub st(0), st(1)
	fstp xyz_rt
	invoke Real10ToAscii, xyz_rt
	ret
GetCpuUsage endp



;_____________________________________________________________________________________



GetFactorial proc		USES EBX ECX EDX ESI EDI		factor:DWORD
	LOCAL ret_val:DWORD
	.if factor == 0
		mov EAX, 0
		ret
	.endif
	mov ret_val, 1
factor_loop:
	mov EAX, factor
	sub EAX, 1
	mov ECX, factor
	mov factor, EAX
	mul ECX
	mov EAX, ret_val
	mul ECX
	.if factor > 0
		mov ret_val, EAX
		jmp factor_loop
	.endif
	ret
GetFactorial endp



;______________________________________________________________________________________



IsWordInAnotherFile proc	USES ECX EDX ESI EDI	word_to_compare:DWORD, handle_file_to_search:DWORD
	LOCAL file_position:DWORD
	LOCAL read_buffer:DWORD
	LOCAL dd_junk:DWORD
	LOCAL read_amount:DWORD
	LOCAL file_size_high:DWORD
	LOCAL file_size_low:DWORD
	LOCAL word_buf[100]:BYTE
	invoke LocalAlloc, LMEM_ZEROINIT, 512
	mov read_buffer, EAX
	mov read_amount, 512
	invoke GetFileSize, handle_file_to_search, ADDR file_size_high
	mov file_size_low, EAX
	mov file_position, 0
search_loop:
	mov EDX, file_size_low
	sub EDX, file_position
	.if EDX <= 0					; gone too far in read
		invoke LocalFree, read_buffer
		ret
	.endif 
	invoke SetFilePointer, handle_file_to_search, file_position, 0, FILE_BEGIN
	invoke ReadFile, handle_file_to_search, read_buffer, read_amount, ADDR dd_junk, 0
	lea EAX, word_buf
	mov EDI, EAX
	mov ESI, read_buffer
	mov ECX, 50
	mov EBX, 0
.REPEAT
	mov AL, BYTE PTR [ESI+EBX]
	.if (AL >= 97 && AL <= 122)
		mov BYTE PTR [EDI], AL
		inc EDI
		add file_position, 1
	.endif
	.if (AL == 10)
		mov BYTE PTR [EDI], 0
		add file_position, 1
		invoke lstrcmp, ADDR word_buf, word_to_compare
		.if EAX == 0
			invoke LocalFree, read_buffer
			invoke MessageBox, hWnd, ADDR word_buf, ADDR success_msg, 0 ; ************
			mov word_buf[0], 0
			mov EAX, 13
			ret
		.endif
		jmp search_loop
	.endif
	inc EBX
	.UNTILCXZ
	invoke LocalFree, read_buffer
	ret
IsWordInAnotherFile endp



;______________________________________________________________________________________



LookAtGlobalMemory proc			USES ESI EDI ECX		position:DWORD
	LOCAL mst:MEMORYSTATUS				; return EAX pointer to string, EBX its length, and EDX position for TextOut
	LOCAL local_position:DWORD
	invoke GlobalMemoryStatus, ADDR mst
	invoke GetCpuUsage				; add CPU USAGE
	invoke wsprintf, ADDR interim_gms_buf, ADDR gms_msg, mst.dwMemoryLoad, mst.dwTotalPhys, mst.dwAvailPhys, mst.dwTotalPageFile, mst.dwAvailPageFile, mst.dwTotalVirtual, mst.dwAvailVirtual, EAX
	lea EAX, interim_gms_buf
	mov ESI, EAX
	lea EAX, final_gms_buf
	mov EDI, EAX
	mov EAX, position
	mov ECX, 100					; length of sub string
	mul ECX
	mov EBX, EAX
	mov ECX, 100
gms_copy_loop:
	mov AL, BYTE PTR [ESI + EBX]
	mov BYTE PTR [EDI], AL
	inc EDI
	inc EBX
	loop gms_copy_loop
	mov BYTE PTR [EDI], 0
	mov EAX, 15
	mov ECX, position
	mul ECX
	add EAX, 250
	mov EDX, EAX
	push EDX
	invoke lstrlen, ADDR final_gms_buf
	mov EBX, EAX
	pop EDX
	lea EAX, final_gms_buf
	ret
LookAtGlobalMemory endp



;_________________________________________________________________________________



Real10ToAscii proc		USES EDI ESI ECX EDX	q_val:REAL10
	LOCAL zero_tester:DWORD				; accurate on REAL10 not REAL8, REAL4, or QWORD
	LOCAL decimal_test:DWORD			; string returned in EAX, length returned in EBX
	LOCAL char_tester:DWORD				; works only on 16 digit +/- numbers
	LOCAL neg_adjuster:DWORD			; not the max +/- 18446744073709551615
	LOCAL ten_constant:DWORD			; control needed in addition to REAL10 for accuracy
	LOCAL forty_eight:DWORD
	LOCAL dummy_real10:REAL10
	LOCAL control_word:WORD
	LOCAL control_truncate:WORD
.data
	buf_1							DB		50 dup(?)
	buf_2							DB		50 dup(?)
.code
	mov ten_constant, 10
	mov forty_eight, 48
	mov control_truncate, 0FFFFh			; or 0F4FFh or 0F7FFh
	mov decimal_test, 0
	mov char_tester, 0
	mov zero_tester, 0
	invoke RtlZeroMemory, ADDR buf_1, 50
	invoke RtlZeroMemory, ADDR buf_2, 50
	finit 
	fldz
	fstp dummy_real10					; zero out qword_dummy
	mov ESI, offset buf_1				; read digit one at a time
	mov EDI, offset buf_2
	mov ECX, 25
	mov neg_adjuster, 1
	finit
	fld q_val
	fldz							; st(0) = 0
	fcom st(1)						; compare st(1) = q_val with st(0) = 0
	fxch							; to see if
	fistp zero_tester					; it is -0
	fstsw AX
	sahf
	jb not_negative					; q_val > 0		jb where CF=1
	finit
	fld q_val
	fabs
	fstp q_val
	mov neg_adjuster, 0				; zero if negative
	.if (zero_tester != 0)
		mov AL, 45					; '-' = 45
	.else
		mov AL, 48					; but not -0
	.endif
	mov BYTE PTR [EDI], AL
	inc EDI
not_negative:
	finit
	fld q_val
	fidiv ten_constant
	fstcw control_word 
	fldcw control_truncate
	frndint
	fldcw control_word 
	fstp dummy_real10
	finit
	fld dummy_real10
	fimul ten_constant
	fstp dummy_real10
	finit
	fld dummy_real10
	fld q_val
	fsub st(0), st(1)
	fiadd forty_eight
	fistp DWORD PTR [ESI]
	inc ESI
	finit
	fld q_val
	fidiv ten_constant
	fstcw control_word 
	fldcw control_truncate
	frndint
	fldcw control_word 
	fstp q_val
	loop not_negative
outta_hear:
	mov AL, 0
	mov BYTE PTR [ESI], AL
	mov ECX, 26
	mov EBX, 0
z_reverse_loop:							; reverse string
	dec ESI
	mov AL, BYTE PTR [ESI]
	.if (AL != 48 && char_tester != 1)
		mov char_tester, 1
	.endif
	.if (char_tester == 1)
		.if AL == 58					; avoid round up error on right to ':'
			mov AL, 57					; side of decimal point at end of #
		.endif
		mov BYTE PTR [EDI], AL
		inc EDI
		inc EBX
	.endif
	loop z_reverse_loop
	sub EBX, neg_adjuster
	mov AL, 0
	dec EDI
	mov BYTE PTR [EDI], AL
	mov EAX, offset buf_2
	ret
Real10ToAscii endp



;_____________________________________________________________________________________



ThreadProc proc			USES ECX EDX ESI EDI
	LOCAL file_handle_1:DWORD
	LOCAL file_handle_2:DWORD
	invoke CreateFile, ADDR dictionary_file_name, GENERIC_READ or GENERIC_WRITE, FILE_SHARE_READ or FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0
	mov file_handle_1, EAX
	.if EAX == INVALID_HANDLE_VALUE
		invoke MessageBox, hWnd, ADDR err_handle_msg, 0, 0
	.endif
	invoke CreateFile, ADDR write_file_name, GENERIC_READ or GENERIC_WRITE, FILE_SHARE_READ or FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0
	mov file_handle_2, EAX
	.if EAX == INVALID_HANDLE_VALUE
		invoke MessageBox, hWnd, ADDR err_handle_msg, 0, 0
	.endif
	invoke CompareWordInFile, file_handle_1, file_handle_2
	invoke CloseHandle, file_handle_1
	invoke CloseHandle, file_handle_2
	ret
ThreadProc endp



;_____________________________________________________________________________________



UnScramble proc		USES ECX EDX ESI EDI		word_it:DWORD
	LOCAL string_len:DWORD
	LOCAL scram_len:DWORD
	LOCAL scram_buf[100]:BYTE
	LOCAL byte_buffy[100]:BYTE
	LOCAL my_counter:DWORD
	LOCAL zz_counter:DWORD
	LOCAL sub_adder:DWORD
	LOCAL test_length:DWORD
;_____________________________________________________________________________________________
;				PUT SCRAMBLED WORD IN BUFFER
;_____________________________________________________________________________________________
	invoke ZeroBuffer, ADDR zbuffer, 40320
	invoke ZeroBuffer, ADDR xbuffer, 40320
	invoke lstrcpy, ADDR scram_buf, word_it
	invoke lstrlen, ADDR scram_buf
	mov scram_len, EAX
	invoke GetFactorial, scram_len
	mov test_length, EAX		; factorial 1,2,6,24,120,720 # possible variations
	mov EAX, test_length
	mov sub_adder, 0
	lea EAX, scram_buf
	mov EDI, EAX
	mov EBX, 0
	mov EAX, scram_len
	.if(scram_len < 4 || scram_len > 6)
		invoke MessageBox, hWnd, ADDR len_msg, 0, 0
		ret
	.endif
	mov my_counter, EAX
	mov ECX, scram_len
loop01:
	push EBX
	sub EBX, sub_adder
	mov AL, BYTE PTR [EDI + EBX]
	pop EBX
	mov BYTE PTR byte_buffy[EBX], AL
	inc EBX
	loop loop01
	mov BYTE PTR byte_buffy[EBX], 10
	inc EBX
	add sub_adder, EBX
	mov EBX, 0
	lea EAX, byte_buffy
	mov ESI, EAX 
	dec my_counter
	mov EAX, my_counter
;_____________________________________________________________________________________________
;				UNSCRAMBLE SIX LETTER MIX
;_____________________________________________________________________________________________
	.if my_counter == 5
		lea EAX, xbuffer
		mov EDI, EAX
		mov EBX, 0
		mov zz_counter, 0
six_loop:
		mov AL, byte_buffy[0]						; ONE = 0
		mov BYTE PTR [EDI], AL
		.if (zz_counter < 24)						; TWO = 1
			mov AL, 	byte_buffy[1]
			mov BYTE PTR [EDI+1], AL
			.if (zz_counter < 6)					; THREE = 2
				mov AL, byte_buffy[2]
				mov BYTE PTR [EDI+2], AL
				.if (zz_counter < 2)				; FOUR = 3
					mov AL, byte_buffy[3]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 0)			; FIVE = 4
						mov AL, byte_buffy[4]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 1)			; FIVE = 4
						mov AL, byte_buffy[4]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 2 && zz_counter < 4)		; FOUR = 4
					mov AL, byte_buffy[4]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 2)			; FIVE = 3
						mov AL, byte_buffy[3]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 3)			; FIVE = 3
						mov AL, byte_buffy[3]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 4 && zz_counter < 6)		; FOUR = 5
					mov AL, byte_buffy[5]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 4)			; FIVE = 4
						mov AL, byte_buffy[4]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[3]		; SIX = 3
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 5)
						mov AL, byte_buffy[4]		; FIVE = 4
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[3]		; SIX = 3
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
			.endif
			.if (zz_counter >= 6 && zz_counter < 12)		; THREE = 3
				mov AL, byte_buffy[3]
				mov BYTE PTR [EDI+2], AL
				.if (zz_counter >= 6 && zz_counter < 8)		; FOUR = 2
					mov AL, byte_buffy[2]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 6)			; FIVE = 4
						mov AL, byte_buffy[4]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 7)			; FIVE = 4
						mov AL, byte_buffy[4]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 8 && zz_counter < 10)	; FOUR = 4
					mov AL, byte_buffy[4]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 8)			; FIVE = 2
						mov AL, byte_buffy[2]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 9)			; FIVE = 2
						mov AL, byte_buffy[2]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 10 && zz_counter < 12)	; FOUR = 5
					mov AL, byte_buffy[5]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 10)			; FIVE = 2
						mov AL, byte_buffy[2]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[4]		; SIX = 4
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 11)			; FIVE = 2
						mov AL, byte_buffy[2]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[4]		; SIX = 4
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
			.endif
			.if (zz_counter >= 12 && zz_counter< 18)		; THREE = 4
				mov AL, byte_buffy[4]
				mov BYTE PTR [EDI+2], AL
				.if (zz_counter >= 12 && zz_counter < 14)	; FOUR = 2
					mov AL, byte_buffy[2]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 12)			; FIVE = 3
						mov AL, byte_buffy[3]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 13)			; FIVE = 3
						mov AL, byte_buffy[3]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 14 && zz_counter < 16)	; FOUR = 3
					mov AL, byte_buffy[3]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 14)			; FIVE = 2
						mov AL, byte_buffy[2]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 15)			; FIVE = 2
						mov AL, byte_buffy[2]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 16 && zz_counter < 18)	; FOUR = 5
					mov AL, byte_buffy[5]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 16)			; FIVE = 2
						mov AL, byte_buffy[2]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[3]		; SIX = 3
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 17)			; FIVE = 2
						mov AL, byte_buffy[2]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[3]		; SIX = 3
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
			.endif
			.if (zz_counter >= 18 && zz_counter < 24)		; THREE = 5
				mov AL, byte_buffy[5]
				mov BYTE PTR [EDI+2], AL
				.if (zz_counter >= 18 && zz_counter < 20)	; FOUR = 2
					mov AL, byte_buffy[2]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 18)			; FIVE = 3
						mov AL, byte_buffy[3]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[4]		; SIX = 4
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 19)			; FIVE = 3
						mov AL, byte_buffy[3]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[4]		; SIX = 4
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 20 && zz_counter < 22)	; FOUR = 3
					mov AL, byte_buffy[3]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 20)			; FIVE = 2
						mov AL, byte_buffy[2]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[4]		; SIX = 4
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 21)			; FIVE = 2
						mov AL, byte_buffy[2]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[4]		; SIX = 4
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 22 && zz_counter < 24)	; FOUR = 4
					mov AL, byte_buffy[4]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 22)			; FIVE = 2
						mov AL, byte_buffy[2]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[3]		; SIX = 3
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 23)			; FIVE = 2
						mov AL, byte_buffy[2]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[3]		; SIX = 3
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
			.endif
		.endif
		.if (zz_counter >= 24 && zz_counter < 48)			; TWO = 2
			mov AL, 	byte_buffy[2]
			mov BYTE PTR [EDI+1], AL
			.if (zz_counter >= 24 && zz_counter < 30)		; THREE = 1
				mov AL, byte_buffy[1]
				mov BYTE PTR [EDI+2], AL
				.if (zz_counter >= 24 && zz_counter < 26)	; FOUR = 3
					mov AL, byte_buffy[3]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 24)			; FIVE = 4
						mov AL, byte_buffy[4]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 25)			; FIVE = 4
						mov AL, byte_buffy[4]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 26 && zz_counter < 28)	; FOUR = 4
					mov AL, byte_buffy[4]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 26)			; FIVE = 3
						mov AL, byte_buffy[3]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 27)			; FIVE = 3
						mov AL, byte_buffy[3]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 28 && zz_counter < 30)	; FOUR = 5
					mov AL, byte_buffy[5]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 28)			; FIVE = 3
						mov AL, byte_buffy[3]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[4]		; SIX = 4
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 29)			; FIVE = 3
						mov AL, byte_buffy[3]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[4]		; SIX = 4
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
			.endif
			.if (zz_counter >= 30 && zz_counter < 36)		; THREE = 3
				mov AL, byte_buffy[3]
				mov BYTE PTR [EDI+2], AL
				.if (zz_counter >= 30 && zz_counter < 32)	; FOUR = 1
					mov AL, byte_buffy[1]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 30)			; FIVE = 4
						mov AL, byte_buffy[4]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 31)			; FIVE = 4
						mov AL, byte_buffy[4]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 32 && zz_counter < 34)	; FOUR = 4
					mov AL, byte_buffy[4]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 32)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 33)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 34 && zz_counter < 36)	; FOUR = 5
					mov AL, byte_buffy[5]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 34)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[4]		; SIX = 4
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 35)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[4]		; SIX = 4
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
			.endif
			.if (zz_counter >= 36 && zz_counter< 42)		; THREE = 4
				mov AL, byte_buffy[4]
				mov BYTE PTR [EDI+2], AL
				.if (zz_counter >= 36 && zz_counter < 38)	; FOUR = 1
					mov AL, byte_buffy[1]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 36)			; FIVE = 3
						mov AL, byte_buffy[3]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 37)			; FIVE = 3
						mov AL, byte_buffy[3]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 38 && zz_counter < 40)	; FOUR = 3
					mov AL, byte_buffy[3]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 38)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 39)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 40 && zz_counter < 42)	; FOUR = 5
					mov AL, byte_buffy[5]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 40)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[3]		; SIX = 3
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 41)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[3]		; SIX = 3
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
			.endif
			.if (zz_counter >= 42 && zz_counter < 48)		; THREE = 5
				mov AL, byte_buffy[5]
				mov BYTE PTR [EDI+2], AL
				.if (zz_counter >= 42 && zz_counter < 44)	; FOUR = 1
					mov AL, byte_buffy[1]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 42)			; FIVE = 3
						mov AL, byte_buffy[3]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[4]		; SIX = 4
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 43)			; FIVE = 3
						mov AL, byte_buffy[3]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[4]		; SIX = 4
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 44 && zz_counter < 46)	; FOUR = 3
					mov AL, byte_buffy[3]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 44)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[4]		; SIX = 4
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 45)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[4]		; SIX = 4
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 46 && zz_counter < 48)	; FOUR = 4
					mov AL, byte_buffy[4]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 46)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[3]		; SIX = 3
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 47)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[3]		; SIX = 3
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
			.endif
		.endif
		.if (zz_counter >= 48 && zz_counter < 72)			; TWO = 3
			mov AL, 	byte_buffy[3]
			mov BYTE PTR [EDI+1], AL
			.if (zz_counter >= 48 && zz_counter < 54)		; THREE = 1
				mov AL, byte_buffy[1]
				mov BYTE PTR [EDI+2], AL
				.if (zz_counter >= 48 && zz_counter < 50)	; FOUR = 2
					mov AL, byte_buffy[2]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 48)			; FIVE = 4
						mov AL, byte_buffy[4]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 49)			; FIVE = 4
						mov AL, byte_buffy[4]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 50 && zz_counter < 52)	; FOUR = 4
					mov AL, byte_buffy[4]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 50)			; FIVE = 2
						mov AL, byte_buffy[2]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 51)			; FIVE = 2
						mov AL, byte_buffy[2]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 52 && zz_counter < 54)	; FOUR = 5
					mov AL, byte_buffy[5]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 52)			; FIVE = 2
						mov AL, byte_buffy[2]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[4]		; SIX = 4
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 53)			; FIVE = 2
						mov AL, byte_buffy[2]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[4]		; SIX = 4
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
			.endif
			.if (zz_counter >= 54 && zz_counter < 60)		; THREE = 2
				mov AL, byte_buffy[2]
				mov BYTE PTR [EDI+2], AL
				.if (zz_counter >= 54 && zz_counter < 56)	; FOUR = 1
					mov AL, byte_buffy[1]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 54)			; FIVE = 4
						mov AL, byte_buffy[4]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 55)			; FIVE = 4
						mov AL, byte_buffy[4]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 56 && zz_counter < 58)	; FOUR = 4
					mov AL, byte_buffy[4]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 56)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 57)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 58 && zz_counter < 60)	; FOUR = 5
					mov AL, byte_buffy[5]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 58)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[4]		; SIX = 4
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 59)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[4]		; SIX = 4
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
			.endif
			.if (zz_counter >= 60 && zz_counter< 66)		; THREE = 4
				mov AL, byte_buffy[4]
				mov BYTE PTR [EDI+2], AL
				.if (zz_counter >= 60 && zz_counter < 62)	; FOUR = 1
					mov AL, byte_buffy[1]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 60)			; FIVE = 2
						mov AL, byte_buffy[2]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 61)			; FIVE = 2
						mov AL, byte_buffy[2]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 62 && zz_counter < 64)	; FOUR = 2
					mov AL, byte_buffy[2]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 62)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 63)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 64 && zz_counter < 66)	; FOUR = 5
					mov AL, byte_buffy[5]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 64)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[2]		; SIX = 2
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 65)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[2]		; SIX = 2
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
			.endif
			.if (zz_counter >= 66 && zz_counter < 72)		; THREE = 5
				mov AL, byte_buffy[5]
				mov BYTE PTR [EDI+2], AL
				.if (zz_counter >= 66 && zz_counter < 68)	; FOUR = 1
					mov AL, byte_buffy[1]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 66)			; FIVE = 2
						mov AL, byte_buffy[2]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[4]		; SIX = 4
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 67)			; FIVE = 2
						mov AL, byte_buffy[2]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[4]		; SIX = 4
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 68 && zz_counter < 70)	; FOUR = 2
					mov AL, byte_buffy[2]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 68)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[4]		; SIX = 4
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 69)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[4]		; SIX = 4
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 70 && zz_counter < 72)	; FOUR = 4
					mov AL, byte_buffy[4]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 70)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[2]		; SIX = 2
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 71)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[2]		; SIX = 2
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
			.endif
		.endif
		.if (zz_counter >= 72 && zz_counter < 96)			; TWO = 4
			mov AL, 	byte_buffy[4]
			mov BYTE PTR [EDI+1], AL
			.if (zz_counter >= 72 && zz_counter < 78)		; THREE = 1
				mov AL, byte_buffy[1]
				mov BYTE PTR [EDI+2], AL
				.if (zz_counter >= 72 && zz_counter < 74)	; FOUR = 2
					mov AL, byte_buffy[2]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 72)			; FIVE = 3
						mov AL, byte_buffy[3]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 73)			; FIVE = 3
						mov AL, byte_buffy[3]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 74 && zz_counter < 76)	; FOUR = 3
					mov AL, byte_buffy[3]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 74)			; FIVE = 2
						mov AL, byte_buffy[2]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 75)			; FIVE = 2
						mov AL, byte_buffy[2]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 76 && zz_counter < 78)	; FOUR = 5
					mov AL, byte_buffy[5]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 76)			; FIVE = 2
						mov AL, byte_buffy[2]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[3]		; SIX = 3
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 77)			; FIVE = 2
						mov AL, byte_buffy[2]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[3]		; SIX = 3
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
			.endif
			.if (zz_counter >= 78 && zz_counter < 84)		; THREE = 2
				mov AL, byte_buffy[2]
				mov BYTE PTR [EDI+2], AL
				.if (zz_counter >= 78 && zz_counter < 80)	; FOUR = 1
					mov AL, byte_buffy[1]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 78)			; FIVE = 3
						mov AL, byte_buffy[3]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 79)			; FIVE = 3
						mov AL, byte_buffy[3]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 80 && zz_counter < 82)	; FOUR = 3
					mov AL, byte_buffy[3]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 80)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 81)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 82 && zz_counter < 84)	; FOUR = 5
					mov AL, byte_buffy[5]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 82)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[3]		; SIX = 3
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 83)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[3]		; SIX = 3
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
			.endif
			.if (zz_counter >= 84 && zz_counter < 90)		; THREE = 3
				mov AL, byte_buffy[3]
				mov BYTE PTR [EDI+2], AL
				.if (zz_counter >= 84 && zz_counter < 86)	; FOUR = 1
					mov AL, byte_buffy[1]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 84)			; FIVE = 2
						mov AL, byte_buffy[2]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 85)			; FIVE = 2
						mov AL, byte_buffy[2]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 86 && zz_counter < 88)	; FOUR = 2
					mov AL, byte_buffy[2]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 86)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 87)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[5]		; SIX = 5
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 88 && zz_counter < 90)	; FOUR = 5
					mov AL, byte_buffy[5]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 88)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[2]		; SIX = 2
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 89)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[2]		; SIX = 2
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
			.endif
			.if (zz_counter >= 90 && zz_counter < 96)		; THREE = 5
				mov AL, byte_buffy[5]
				mov BYTE PTR [EDI+2], AL
				.if (zz_counter >= 90 && zz_counter < 92)	; FOUR = 1
					mov AL, byte_buffy[1]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 90)			; FIVE = 2
						mov AL, byte_buffy[2]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[3]		; SIX = 3
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 91)			; FIVE = 2
						mov AL, byte_buffy[2]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[3]		; SIX = 3
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 92 && zz_counter < 94)	; FOUR = 2
					mov AL, byte_buffy[2]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 92)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[3]		; SIX = 3
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 93)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[3]		; SIX = 3
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 94 && zz_counter < 96)	; FOUR = 3
					mov AL, byte_buffy[3]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 94)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[2]		; SIX = 2
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 95)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[2]		; SIX = 2
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
			.endif
		.endif
		.if (zz_counter >= 96 && zz_counter < 120)			; TWO = 5
			mov AL, 	byte_buffy[5]
			mov BYTE PTR [EDI+1], AL
			.if (zz_counter >= 96 && zz_counter < 102)		; THREE = 1
				mov AL, byte_buffy[1]
				mov BYTE PTR [EDI+2], AL
				.if (zz_counter >= 96 && zz_counter < 98)	; FOUR = 2
					mov AL, byte_buffy[2]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 96)			; FIVE = 3
						mov AL, byte_buffy[3]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[4]		; SIX = 4
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 97)			; FIVE = 3
						mov AL, byte_buffy[3]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[4]		; SIX = 4
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 98 && zz_counter < 100)	; FOUR = 3
					mov AL, byte_buffy[3]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 98)			; FIVE = 2
						mov AL, byte_buffy[2]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[4]		; SIX = 4
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 99)			; FIVE = 2
						mov AL, byte_buffy[2]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[4]		; SIX = 4
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 100 && zz_counter < 102)	; FOUR = 4
					mov AL, byte_buffy[4]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 100)			; FIVE = 2
						mov AL, byte_buffy[2]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[3]		; SIX = 3
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 101)			; FIVE = 2
						mov AL, byte_buffy[2]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[3]		; SIX = 3
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
			.endif
			.if (zz_counter >= 102 && zz_counter < 108)		; THREE = 2
				mov AL, byte_buffy[2]
				mov BYTE PTR [EDI+2], AL
				.if (zz_counter >= 102 && zz_counter < 104)	; FOUR = 1
					mov AL, byte_buffy[1]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 102)			; FIVE = 3
						mov AL, byte_buffy[3]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[4]		; SIX = 4
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 103)			; FIVE = 3
						mov AL, byte_buffy[3]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[4]		; SIX = 4
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 104 && zz_counter < 106)	; FOUR = 3
					mov AL, byte_buffy[3]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 104)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[4]		; SIX = 4
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 105)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[4]		; SIX = 4
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 106 && zz_counter < 108)	; FOUR = 4
					mov AL, byte_buffy[4]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 106)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[3]		; SIX = 3
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 107)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[3]		; SIX = 3
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
			.endif
			.if (zz_counter >= 108 && zz_counter< 114)		; THREE = 3
				mov AL, byte_buffy[3]
				mov BYTE PTR [EDI+2], AL
				.if (zz_counter >= 108 && zz_counter < 110)	; FOUR = 1
					mov AL, byte_buffy[1]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 108)			; FIVE = 2
						mov AL, byte_buffy[2]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[4]		; SIX = 4
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 109)			; FIVE = 2
						mov AL, byte_buffy[2]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[4]		; SIX = 4
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 110 && zz_counter < 112)	; FOUR = 2
					mov AL, byte_buffy[2]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 110)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[4]		; SIX = 4
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 111)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[4]		; SIX = 4
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 112 && zz_counter < 114)	; FOUR = 4
					mov AL, byte_buffy[4]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 112)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[2]		; SIX = 2
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 113)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[2]		; SIX = 2
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
			.endif
			.if (zz_counter >= 114 && zz_counter < 120)		; THREE = 4
				mov AL, byte_buffy[4]
				mov BYTE PTR [EDI+2], AL
				.if (zz_counter >= 114 && zz_counter < 116)	; FOUR = 1
					mov AL, byte_buffy[1]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 114)			; FIVE = 2
						mov AL, byte_buffy[2]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[3]		; SIX = 3
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 115)			; FIVE = 2
						mov AL, byte_buffy[2]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[3]		; SIX = 3
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 116 && zz_counter < 118)	; FOUR = 2
					mov AL, byte_buffy[2]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 116)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[3]		; SIX = 3
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 117)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[3]		; SIX = 3
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
				.if (zz_counter >= 118 && zz_counter < 120)	; FOUR = 3
					mov AL, byte_buffy[3]
					mov BYTE PTR [EDI+3], AL
					.if (zz_counter == 118)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+4], AL
						mov AL, byte_buffy[2]		; SIX = 2
						mov BYTE PTR [EDI+5], AL
					.endif
					.if (zz_counter == 119)			; FIVE = 1
						mov AL, byte_buffy[1]
						mov BYTE PTR [EDI+5], AL
						mov AL, byte_buffy[2]		; SIX = 2
						mov BYTE PTR [EDI+4], AL
					.endif
				.endif
			.endif
		.endif
		mov AL, BYTE PTR byte_buffy[6]
		mov BYTE PTR [EDI+6], AL
		add EDI, 7
		inc zz_counter
		.if zz_counter < 144			; 120 + line feed
			jmp six_loop
		.endif
	invoke lstrcpy, ADDR zbuffer, ADDR xbuffer	; START SHIFTS
	lea EAX, xbuffer
	mov EDI, EAX
	add EDI, 840
	mov zz_counter, 0
	mov EBX, 0
xbig_loop:
	.if zz_counter == 0				; shift first row to second
sfrts1:
		mov AL, BYTE PTR zbuffer[EBX]
		mov BYTE PTR [EDI+1], AL
		mov AL, BYTE PTR zbuffer[EBX+1]
		mov BYTE PTR [EDI], AL
		mov AL, BYTE PTR zbuffer[EBX+2]
		mov BYTE PTR [EDI+2], AL
		mov AL, BYTE PTR zbuffer[EBX+3]
		mov BYTE PTR [EDI+3], AL
		mov AL, BYTE PTR zbuffer[EBX+4]
		mov BYTE PTR [EDI+4], AL
		mov AL, BYTE PTR zbuffer[EBX+5]
		mov BYTE PTR [EDI+5], AL
		mov AL, BYTE PTR zbuffer[EBX+6]
		mov BYTE PTR [EDI+6], AL
		add EBX, 7
		add EDI, 7
		.if EBX < 840
			jmp sfrts1
		.endif
		mov EBX, 0
		sub EDI, 840
	.endif
	.if zz_counter == 1				; shift first row to third
sfrts2:
		mov AL, BYTE PTR zbuffer[EBX]
		mov BYTE PTR [EDI+2], AL
		mov AL, BYTE PTR zbuffer[EBX+1]
		mov BYTE PTR [EDI+1], AL
		mov AL, BYTE PTR zbuffer[EBX+2]
		mov BYTE PTR [EDI], AL
		mov AL, BYTE PTR zbuffer[EBX+3]
		mov BYTE PTR [EDI+3], AL
		mov AL, BYTE PTR zbuffer[EBX+4]
		mov BYTE PTR [EDI+4], AL
		mov AL, BYTE PTR zbuffer[EBX+5]
		mov BYTE PTR [EDI+5], AL
		mov AL, BYTE PTR zbuffer[EBX+6]
		mov BYTE PTR [EDI+6], AL
		add EBX, 7
		add EDI, 7
		.if EBX < 840
			jmp sfrts2
		.endif
		mov EBX, 0
		sub EDI, 840
	.endif
	.if zz_counter == 2				; shift first row to fourth
sfrts3:
		mov AL, BYTE PTR zbuffer[EBX]
		mov BYTE PTR [EDI+3], AL
		mov AL, BYTE PTR zbuffer[EBX+1]
		mov BYTE PTR [EDI+1], AL
		mov AL, BYTE PTR zbuffer[EBX+2]
		mov BYTE PTR [EDI+2], AL
		mov AL, BYTE PTR zbuffer[EBX+3]
		mov BYTE PTR [EDI], AL
		mov AL, BYTE PTR zbuffer[EBX+4]
		mov BYTE PTR [EDI+4], AL
		mov AL, BYTE PTR zbuffer[EBX+5]
		mov BYTE PTR [EDI+5], AL
		mov AL, BYTE PTR zbuffer[EBX+6]
		mov BYTE PTR [EDI+6], AL
		add EBX, 7
		add EDI, 7
		.if EBX < 840
			jmp sfrts3
		.endif
		mov EBX, 0
		sub EDI, 840
	.endif
	.if zz_counter == 3				; shift first row to fifth
sfrts4:
		mov AL, BYTE PTR zbuffer[EBX]
		mov BYTE PTR [EDI+4], AL
		mov AL, BYTE PTR zbuffer[EBX+1]
		mov BYTE PTR [EDI+1], AL
		mov AL, BYTE PTR zbuffer[EBX+2]
		mov BYTE PTR [EDI+2], AL
		mov AL, BYTE PTR zbuffer[EBX+3]
		mov BYTE PTR [EDI+3], AL
		mov AL, BYTE PTR zbuffer[EBX+4]
		mov BYTE PTR [EDI], AL
		mov AL, BYTE PTR zbuffer[EBX+5]
		mov BYTE PTR [EDI+5], AL
		mov AL, BYTE PTR zbuffer[EBX+6]
		mov BYTE PTR [EDI+6], AL
		add EBX, 7
		add EDI, 7
		.if EBX < 840
			jmp sfrts4
		.endif
		mov EBX, 0
		sub EDI, 840
	.endif
	.if zz_counter == 4				; shift first row to sixth
sfrts5:
		mov AL, BYTE PTR zbuffer[EBX]
		mov BYTE PTR [EDI+5], AL
		mov AL, BYTE PTR zbuffer[EBX+1]
		mov BYTE PTR [EDI+1], AL
		mov AL, BYTE PTR zbuffer[EBX+2]
		mov BYTE PTR [EDI+2], AL
		mov AL, BYTE PTR zbuffer[EBX+3]
		mov BYTE PTR [EDI+3], AL
		mov AL, BYTE PTR zbuffer[EBX+4]
		mov BYTE PTR [EDI+4], AL
		mov AL, BYTE PTR zbuffer[EBX+5]
		mov BYTE PTR [EDI], AL
		mov AL, BYTE PTR zbuffer[EBX+6]
		mov BYTE PTR [EDI+6], AL
		add EBX, 7
		add EDI, 7
		.if EBX < 840
			jmp sfrts5
		.endif
		mov EBX, 0
		sub EDI, 840
	.endif
	mov AL, BYTE PTR zbuffer[EBX+6]
	mov BYTE PTR [EDI+6], AL
	add EDI, 840
	inc zz_counter
	.if zz_counter < 5
		jmp xbig_loop
	.endif
	invoke lstrcpy, ADDR zbuffer, ADDR xbuffer
;_____________________________________________________________________________________________
;				UNSCRAMBLE FIVE LETTER MIX
;_____________________________________________________________________________________________
	.elseif my_counter == 4
		mov EBX, 0
		mov AL, BYTE PTR [ESI+5]
		mov BYTE PTR zbuffer[EBX+5], AL		; 12345
		mov AL, BYTE PTR [ESI+4]
		mov BYTE PTR zbuffer[EBX+4], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+3], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+2], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+1], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+0], AL
		mov AL, BYTE PTR [ESI+5]		; 12354
		mov BYTE PTR zbuffer[EBX+11], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+10], AL
		mov AL, BYTE PTR [ESI+4]
		mov BYTE PTR zbuffer[EBX+9], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+8], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+7], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+6], AL
		mov AL, BYTE PTR [ESI+5]		; 12435
		mov BYTE PTR zbuffer[EBX+17], AL
		mov AL, BYTE PTR [ESI+4]
		mov BYTE PTR zbuffer[EBX+16], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+15], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+14], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+13], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+12], AL
		mov AL, BYTE PTR [ESI+5]		; 12453
		mov BYTE PTR zbuffer[EBX+23], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+22], AL
		mov AL, BYTE PTR [ESI+4]
		mov BYTE PTR zbuffer[EBX+21], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+20], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+19], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+18], AL
		mov AL, BYTE PTR [ESI+5]		; 12534
		mov BYTE PTR zbuffer[EBX+29], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+28], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+27], AL
		mov AL, BYTE PTR [ESI+4]
		mov BYTE PTR zbuffer[EBX+26], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+25], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+24], AL
		mov AL, BYTE PTR [ESI+5]		; 12543
		mov BYTE PTR zbuffer[EBX+35], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+34], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+33], AL
		mov AL, BYTE PTR [ESI+4]
		mov BYTE PTR zbuffer[EBX+32], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+31], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+30], AL
		mov AL, BYTE PTR [ESI+5]		; 13245
		mov BYTE PTR zbuffer[EBX+41], AL
		mov AL, BYTE PTR [ESI+4]
		mov BYTE PTR zbuffer[EBX+40], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+39], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+38], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+37], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+36], AL
		mov AL, BYTE PTR [ESI+5]		; 13254
		mov BYTE PTR zbuffer[EBX+47], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+46], AL
		mov AL, BYTE PTR [ESI+4]
		mov BYTE PTR zbuffer[EBX+45], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+44], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+43], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+42], AL
		mov AL, BYTE PTR [ESI+5]		; 13425
		mov BYTE PTR zbuffer[EBX+53], AL
		mov AL, BYTE PTR [ESI+4]
		mov BYTE PTR zbuffer[EBX+52], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+51], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+50], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+49], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+48], AL
		mov AL, BYTE PTR [ESI+5]		; 13452
		mov BYTE PTR zbuffer[EBX+59], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+58], AL
		mov AL, BYTE PTR [ESI+4]
		mov BYTE PTR zbuffer[EBX+57], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+56], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+55], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+54], AL
		mov AL, BYTE PTR [ESI+5]		; 13524
		mov BYTE PTR zbuffer[EBX+65], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+64], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+63], AL
		mov AL, BYTE PTR [ESI+4]
		mov BYTE PTR zbuffer[EBX+62], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+61], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+60], AL
		mov AL, BYTE PTR [ESI+5]		; 13542
		mov BYTE PTR zbuffer[EBX+71], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+70], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+69], AL
		mov AL, BYTE PTR [ESI+4]
		mov BYTE PTR zbuffer[EBX+68], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+67], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+66], AL
		mov AL, BYTE PTR [ESI+5]		; 14235
		mov BYTE PTR zbuffer[EBX+77], AL
		mov AL, BYTE PTR [ESI+4]
		mov BYTE PTR zbuffer[EBX+76], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+75], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+74], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+73], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+72], AL
		mov AL, BYTE PTR [ESI+5]		; 14253
		mov BYTE PTR zbuffer[EBX+83], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+82], AL
		mov AL, BYTE PTR [ESI+4]
		mov BYTE PTR zbuffer[EBX+81], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+80], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+79], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+78], AL
		mov AL, BYTE PTR [ESI+5]		; 14325
		mov BYTE PTR zbuffer[EBX+89], AL
		mov AL, BYTE PTR [ESI+4]
		mov BYTE PTR zbuffer[EBX+88], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+87], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+86], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+85], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+84], AL
		mov AL, BYTE PTR [ESI+5]		; 14352
		mov BYTE PTR zbuffer[EBX+95], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+94], AL
		mov AL, BYTE PTR [ESI+4]
		mov BYTE PTR zbuffer[EBX+93], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+92], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+91], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+90], AL
		mov AL, BYTE PTR [ESI+5]		; 14523
		mov BYTE PTR zbuffer[EBX+101], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+100], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+99], AL
		mov AL, BYTE PTR [ESI+4]
		mov BYTE PTR zbuffer[EBX+98], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+97], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+96], AL
		mov AL, BYTE PTR [ESI+5]		; 14532
		mov BYTE PTR zbuffer[EBX+107], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+106], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+105], AL
		mov AL, BYTE PTR [ESI+4]
		mov BYTE PTR zbuffer[EBX+104], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+103], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+102], AL
		mov AL, BYTE PTR [ESI+5]		; 15234
		mov BYTE PTR zbuffer[EBX+113], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+112], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+111], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+110], AL
		mov AL, BYTE PTR [ESI+4]
		mov BYTE PTR zbuffer[EBX+109], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+108], AL
		mov AL, BYTE PTR [ESI+5]		; 15243
		mov BYTE PTR zbuffer[EBX+119], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+118], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+117], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+116], AL
		mov AL, BYTE PTR [ESI+4]
		mov BYTE PTR zbuffer[EBX+115], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+114], AL
		mov AL, BYTE PTR [ESI+5]		; 15324
		mov BYTE PTR zbuffer[EBX+125], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+124], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+123], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+122], AL
		mov AL, BYTE PTR [ESI+4]
		mov BYTE PTR zbuffer[EBX+121], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+120], AL
		mov AL, BYTE PTR [ESI+5]		; 15342
		mov BYTE PTR zbuffer[EBX+131], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+130], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+129], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+128], AL
		mov AL, BYTE PTR [ESI+4]
		mov BYTE PTR zbuffer[EBX+127], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+126], AL
		mov AL, BYTE PTR [ESI+5]		; 15423
		mov BYTE PTR zbuffer[EBX+137], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+136], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+135], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+134], AL
		mov AL, BYTE PTR [ESI+4]
		mov BYTE PTR zbuffer[EBX+133], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+132], AL
		mov AL, BYTE PTR [ESI+5]		; 15432
		mov BYTE PTR zbuffer[EBX+143], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+142], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+141], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+140], AL
		mov AL, BYTE PTR [ESI+4]
		mov BYTE PTR zbuffer[EBX+139], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+138], AL
	lea EAX, xbuffer
	mov EDI, EAX
	mov my_counter, 0
big_loop:
	mov EBX, 0
inner_loop:
	.if my_counter == 0				; shift first row to second
		mov AL, BYTE PTR zbuffer[EBX]
		mov BYTE PTR [EDI+1], AL
		mov AL, BYTE PTR zbuffer[EBX+1]
		mov BYTE PTR[EDI], AL
		mov AL, BYTE PTR zbuffer[EBX+2]
		mov BYTE PTR [EDI+2], AL
		mov AL, BYTE PTR zbuffer[EBX+3]
		mov BYTE PTR [EDI+3], AL
		mov AL, BYTE PTR zbuffer[EBX+4]
		mov BYTE PTR [EDI+4], AL
	.endif
	.if my_counter == 1				; shift first row to third
		mov AL, BYTE PTR zbuffer[EBX]
		mov BYTE PTR [EDI+2], AL
		mov AL, BYTE PTR zbuffer[EBX+1]
		mov BYTE PTR [EDI+1], AL
		mov AL, BYTE PTR zbuffer[EBX+2]
		mov BYTE PTR [EDI], AL
		mov AL, BYTE PTR zbuffer[EBX+3]
		mov BYTE PTR [EDI+3], AL
		mov AL, BYTE PTR zbuffer[EBX+4]
		mov BYTE PTR [EDI+4], AL
	.endif
	.if my_counter == 2				; shift first row to fourth
		mov AL, BYTE PTR zbuffer[EBX]
		mov BYTE PTR [EDI+3], AL
		mov AL, BYTE PTR zbuffer[EBX+1]
		mov BYTE PTR [EDI+2], AL
		mov AL, BYTE PTR zbuffer[EBX+2]
		mov BYTE PTR [EDI+1], AL
		mov AL, BYTE PTR zbuffer[EBX+3]
		mov BYTE PTR [EDI], AL
		mov AL, BYTE PTR zbuffer[EBX+4]
		mov BYTE PTR [EDI+4], AL
	.endif
	.if my_counter == 3				; shift first row to fifth
		mov AL, BYTE PTR zbuffer[EBX]
		mov BYTE PTR [EDI+4], AL
		mov AL, BYTE PTR zbuffer[EBX+1]
		mov BYTE PTR [EDI+3], AL
		mov AL, BYTE PTR zbuffer[EBX+2]
		mov BYTE PTR [EDI+2], AL
		mov AL, BYTE PTR zbuffer[EBX+3]
		mov BYTE PTR [EDI+1], AL
		mov AL, BYTE PTR zbuffer[EBX+4]
		mov BYTE PTR [EDI], AL
	.endif
		mov AL, BYTE PTR zbuffer[EBX+5]
		mov BYTE PTR [EDI+5], AL
		add EDI, 6
		add EBX, 6
	.if EBX < 144
		jmp inner_loop
	.endif
	inc my_counter
	.if my_counter < 4
		jmp big_loop
	.endif
	invoke lstrcat, ADDR zbuffer, ADDR xbuffer
;_________________________________________________________________________________________
;				UNSCRAMBLE FOUR LETTER MIX
;_________________________________________________________________________________________
	.elseif my_counter == 3
		mov EBX, 0
		mov AL, BYTE PTR [ESI+4]		; 1234
		mov BYTE PTR zbuffer[EBX+4], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+3], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+2], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+1], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+0], AL
		mov AL, BYTE PTR [ESI+4]		; 1243
		mov BYTE PTR zbuffer[EBX+9], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+8], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+7], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+6], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+5], AL
		mov AL, BYTE PTR [ESI+4]		; 1324
		mov BYTE PTR zbuffer[EBX+14], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+13], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+12], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+11], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+10], AL
		mov AL, BYTE PTR [ESI+4]		; 1342
		mov BYTE PTR zbuffer[EBX+19], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+18], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+17], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+16], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+15], AL
		mov AL, BYTE PTR [ESI+4]		; 1423
		mov BYTE PTR zbuffer[EBX+24], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+23], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+22], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+21], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+20], AL
		mov AL, BYTE PTR [ESI+4]		; 1432
		mov BYTE PTR zbuffer[EBX+29], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+28], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+27], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+26], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+25], AL
		mov AL, BYTE PTR [ESI+4]		; 2134
		mov BYTE PTR zbuffer[EBX+34], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+33], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+32], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+31], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+30], AL
		mov AL, BYTE PTR [ESI+4]		; 2143
		mov BYTE PTR zbuffer[EBX+39], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+38], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+37], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+36], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+35], AL
		mov AL, BYTE PTR [ESI+4]		; 2314
		mov BYTE PTR zbuffer[EBX+44], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+43], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+42], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+41], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+40], AL
		mov AL, BYTE PTR [ESI+4]		; 2341
		mov BYTE PTR zbuffer[EBX+49], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+48], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+47], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+46], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+45], AL
		mov AL, BYTE PTR [ESI+4]		; 2413
		mov BYTE PTR zbuffer[EBX+54], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+53], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+52], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+51], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+50], AL
		mov AL, BYTE PTR [ESI+4]		; 2431
		mov BYTE PTR zbuffer[EBX+59], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+58], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+57], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+56], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+55], AL
		mov AL, BYTE PTR [ESI+4]		; 3124
		mov BYTE PTR zbuffer[EBX+64], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+63], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+62], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+61], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+60], AL
		mov AL, BYTE PTR [ESI+4]		; 3142
		mov BYTE PTR zbuffer[EBX+69], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+68], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+67], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+66], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+65], AL
		mov AL, BYTE PTR [ESI+4]		; 3214
		mov BYTE PTR zbuffer[EBX+74], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+73], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+72], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+71], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+70], AL
		mov AL, BYTE PTR [ESI+4]		; 2341
		mov BYTE PTR zbuffer[EBX+79], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+78], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+77], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+76], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+75], AL
		mov AL, BYTE PTR [ESI+4]		; 2412
		mov BYTE PTR zbuffer[EBX+84], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+83], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+82], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+81], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+80], AL
		mov AL, BYTE PTR [ESI+4]		; 2421
		mov BYTE PTR zbuffer[EBX+89], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+88], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+87], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+86], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+85], AL
		mov AL, BYTE PTR [ESI+4]		; 4123
		mov BYTE PTR zbuffer[EBX+94], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+93], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+92], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+91], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+90], AL
		mov AL, BYTE PTR [ESI+4]		; 4132
		mov BYTE PTR zbuffer[EBX+99], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+98], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+97], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+96], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+95], AL
		mov AL, BYTE PTR [ESI+4]		; 4213
		mov BYTE PTR zbuffer[EBX+104], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+103], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+102], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+101], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+100], AL
		mov AL, BYTE PTR [ESI+4]		; 4231
		mov BYTE PTR zbuffer[EBX+109], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+108], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+107], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+106], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+105], AL
		mov AL, BYTE PTR [ESI+4]		; 4312
		mov BYTE PTR zbuffer[EBX+114], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+113], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+112], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+111], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+110], AL
		mov AL, BYTE PTR [ESI+4]		; 4321
		mov BYTE PTR zbuffer[EBX+119], AL
		mov AL, BYTE PTR [ESI+0]
		mov BYTE PTR zbuffer[EBX+118], AL
		mov AL, BYTE PTR [ESI+1]
		mov BYTE PTR zbuffer[EBX+117], AL
		mov AL, BYTE PTR [ESI+2]
		mov BYTE PTR zbuffer[EBX+116], AL
		mov AL, BYTE PTR [ESI+3]
		mov BYTE PTR zbuffer[EBX+115], AL
	.endif
	invoke lstrlen, ADDR zbuffer
	invoke WriteToFile, ADDR zbuffer, EAX
	mov EAX, OFFSET ThreadProc
	invoke CreateThread, 0, 0, EAX, 0, NORMAL_PRIORITY_CLASS, ADDR thread_id
	invoke CloseHandle, EAX
	ret
UnScramble endp



;_____________________________________________________________________________________



WriteToFile proc		USES ECX EDX ESI EDI		buffy:DWORD, write_amount:DWORD
	LOCAL file_handle:DWORD
	LOCAL dd_junk:DWORD
	invoke CreateFile, ADDR write_file_name, GENERIC_WRITE, FILE_SHARE_WRITE, 0, CREATE_ALWAYS, 0, 0
	mov file_handle, EAX
	invoke WriteFile, file_handle, buffy, write_amount, ADDR dd_junk, 0
	invoke CloseHandle, file_handle
	ret
WriteToFile endp



;_____________________________________________________________________________________



ZeroBuffer proc			USES ECX EDX ESI EDI	the_buffer:DWORD, buffer_length:DWORD
	mov EAX, the_buffer
	mov ESI, EAX
	mov ECX, buffer_length
	mov EBX, 0
zero_loop:
	mov BYTE PTR [ESI+EBX], 0
	inc EBX
	loop zero_loop
	ret
ZeroBuffer endp



;_____________________________________________________________________________________



end start



