首页
社区
课程
招聘
[旧帖] [原创]自写高质量随机数的随机数发生器(改良版) 0.00雪花
发表于: 2010-11-21 22:18 2733

[旧帖] [原创]自写高质量随机数的随机数发生器(改良版) 0.00雪花

2010-11-21 22:18
2733
(看到了大家的支持突然觉得拿个那么次的代码有点对不起大家,早上起来就把代码改了下,新的代码比原来少了200行,精简很多,去除了很多东西,在保证随机数质量的前提下,将速度提升了200%以上,至于为什么没吧X,Y,Z轴的那部分精简,呃,感觉很麻烦,又要用偏移又得加变量,就没动)

最近有个计划要大量用到随机数,对rand不太满意,就自己写了个。网上很多随机数发生器是直接获取几个随机量如时间,键盘,鼠标等进行数学运算得到随机数,但我不想那么做,在混沌电路中得到灵感,通过一个对初始值敏感的物理模型获取随机数,用汇编实现微分积分运算有些疯狂,混沌电路也不是那么容易实现的,所以我用了一个宏观物理模型,粒子运动。
先来两张测试图片




说一下含义,第一个是熵,它的值表明了信息基本是随机的
第二个是压缩比,自然越低越好,可以看到都是0
第三个是卡方分布,卡方检验是随机性的数据最常用的测试,如果该比例大于90%或低于10%,几乎可以肯定的顺序是不是随机的。
第四个是算术平均数,如果数据是随机的,那么应当是127.5
第五项不解释地球人都知道那个数字
第六项是相关系数

英文好的,可以看这个网页
https://calomel.org/entropy_random_number_generators.html
里面有对LINUX内核熵池的测试
结果是
Entropy = 7.999825 bits per byte.

Optimum compression would reduce the size
of this 1036003 byte file by 0 percent.

Chi square distribution for 1036003 samples is 251.25, and randomly
would exceed this value 55.46 percent of the times.

Arithmetic mean value of data bytes is 127.4824 (127.5 = random).
Monte Carlo value for Pi is 3.141283511 (error 0.01 percent).
Serial correlation coefficient is 0.000858 (totally uncorrelated = 0.0)

从图中可以看到我写的随机数发生器生成的随机数质量还是很可以的,(没有用STS测试过,不敢说好)下面说下是怎么算出来的
想象一下,空间中有一个长,宽,高20000米的大盒子里装着7个粒子,粒子间随着距离的变化力也是变化的,可能是引力,也可能是斥力,粒子在盒子里不断的运动,反弹。这样的一个系统即时现在有一个小小的变化,在经过数次运算放大后都会产生翻天覆地的变化。所以这个随机数发生器没有获取任何的随机数据,它的随机完全是靠CPU运行速度差异经放大产生随机数,当CPU运行差异越大数字就越是随机,这也是系统不是很稳定的原因。获取的随机数就是粒子的空间坐标和当前速度的一部分。可以考虑把力也算进去。

粒子的随距离X变化的力的大小
0~40    2^(40-x)
40~70       -(70-x)^2(原来不是两次方,但后来为了提高速度就用了两次方,不连续了)
70~正无穷    -(156.1-x)^2-100

时间参数 t=0.00000001s
粒子质量 m=1

下面是代码,与附件中的不大一样,改了些
		.386p
		.8087
		.model flat,stdcall
		option casemap:none
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
include		windows.inc
include		gdi32.inc
includelib	gdi32.lib
include		user32.inc
includelib	user32.lib
include		kernel32.inc
includelib	kernel32.lib
include		advapi32.inc
includelib	advapi32.lib
include		masm32.inc
includelib 	masm32.lib
includelib      msvcrt.lib
;================================================
		.data?
hInstDLL		dd		?
hHeap			dd		?
lpMemory		dd		?
eventout	dd		?
PARTICLE	struct
	dpx		dq	?
	dpy		dq	?
	dpz		dq	?
	dvx		dq	?
	dvy		dq	?
	dvz		dq	?
PARTICLE		ends	;粒子位置速度受力参数,吸引子的引力不计算
sizeofdtparticle	dd	?
lprand0			dd	?
lprand1			dd	?
dtwhichparticle		dd	?
;=================================================================
		.data
dtparticle0	PARTICLE 	<-20.0,20.0,-20.0,0.0,0.0,0.0>
dtparticle1	PARTICLE 	<-20.0,20.0,20.0,0.0,0.0,0.0> ;-1,1,1
dtparticle2	PARTICLE 	<20.0,20.0,-20.0,0.0,0.0,0.0>
dtparticle3	PARTICLE 	<20.0,20.0,20.0,0.0,0.0,0.0>
dtparticle4	PARTICLE 	<-20.0,-20.0,-20.0,0.0,0.0,0.0>
dtparticle5	PARTICLE 	<-21.0,-21.0,-21.0,0.0,0.0,0.0>
dtparticle6	PARTICLE 	<20.0,-20.0,-20.0,0.0,0.0,0.0>
dtparticle7	PARTICLE	<0.0,0.0,0.0,0.0,0.0,0.0>
dt40		dq		40.0
dt70		dq		70.0
dt100		dq		100.0
dt156		dq		156.1
dtt		dq		0.00000001
dttt2		dq		0.00000000000000005
dtm		dq		1.0
dtlimit		dq		40000.0
dtlimitf	dq		-10000.0
dtlimitz	dq		10000.0
dtaccelarate	dd		0
;==================================================
		.const
;===================================================
		.code
printfnumber	proc middlee:qword 
	local	@test
	pushad
	mov	esi,lpMemory
	mov	eax,dword ptr middlee
	mov	ebx,lprand0
	.if	ebx>38000
		xor	ebx,ebx
		mov	dword ptr [esi],eax
		mov	lprand0,ebx
	.else
		add	esi,lprand0
		mov	dword ptr [esi],eax
		add	lprand0,4
	.endif 
	popad
	ret
printfnumber	endp
;=====================================================
Calc	proc    _which
	local	@thisparticle:PARTICLE	;本次计算的粒子
	local	@calcparticle:PARTICLE	;要计算的粒子
	local	@forceXX:qword	
	local	@forceYY:qword
	local	@forceZZ:qword
	local	@middle:qword		;记录力的大小
	local	@middle1:qword		;记录差值的绝对值
	local	@dta:qword		;记录加速度a
	local	@tmp0:qword
	local	@tmp1:qword
	local	@for
	pushad
	xor	ebx,ebx
	mov	@for,ebx
	.if	dtaccelarate==311
		mov	@for,1
		mov	dtaccelarate,ebx
	.else
		inc	dtaccelarate
	.endif
	fldz
	fst	@forceXX
	fst	@forceYY
	fst	@forceZZ		;初始化力
	mov	eax,_which
	mul	sizeofdtparticle
	mov	esi,offset dtparticle0
	add	esi,eax		;获取要计算粒子相对于粒子0的偏移量
	finit
	assume	esi:ptr	PARTICLE
	fld	[esi].dpx
	fstp	@thisparticle.dpx
	fld	[esi].dpy
	fstp	@thisparticle.dpy
	fld	[esi].dpz
	fstp	@thisparticle.dpz
	fld	[esi].dvx
	fstp	@thisparticle.dvx
	fld	[esi].dvy
	fstp	@thisparticle.dvy
	fld	[esi].dvz
	fstp	@thisparticle.dvz
	assume	esi:nothing		;保存要计算的粒子
	mov	ecx,0	;计算8个粒子
	.while	ecx<8
		.if	_which==ecx
			inc ecx
			.continue
		.endif		;不计算本粒子的	
		push	ecx	;先保存ECX
		mov	eax,ecx
		mul	sizeofdtparticle
		mov	esi,offset dtparticle0
		add	esi,eax		;获取要与计算粒子计算的粒子相对于粒子0的偏移量
		assume	esi:ptr	PARTICLE
		fld	[esi].dpx
		fstp	@calcparticle.dpx
		fld	[esi].dpy
		fstp	@calcparticle.dpy
		fld	[esi].dpz
		fstp	@calcparticle.dpz
		assume	esi:nothing		;获取该粒子的参数			
			fld	@thisparticle.dpx
			fsub	@calcparticle.dpx
			fst	@calcparticle.dpx	;calcparticle里记录的是差值,即X1-X2
			fmul	@calcparticle.dpx
			fst	@forceXX	;x差值平方,下同
			fld	@thisparticle.dpy
			fsub	@calcparticle.dpy
			fst	@calcparticle.dpy
			fmul	@calcparticle.dpy
			fst	@forceYY
			fld	@thisparticle.dpz
			fsub	@calcparticle.dpz
			fst	@calcparticle.dpz
			fmul	@calcparticle.dpz
			fst	@forceZZ
			fld	@forceXX
			fadd	@forceYY
			fadd	@forceZZ	;X^2+Y^2+Z^2
			fsqrt
			fst	@middle		;存储距离大小,因为后面限制了粒子的活动范围,所以现在的距离一定可以正常的运算出来
			.if	@for==1
				invoke	printfnumber,@forceXX
				invoke	printfnumber,@forceYY
				invoke	printfnumber,@forceZZ	;	取距离
			.endif
			finit
			fld	@middle
			fcom	dt40
			fstsw	ax
			sahf
			ja	up40
				finit;小于40时候的代码
				fld	dt40
				fsub	@middle
				fld1
				fscale
				fst	@middle1
				jmp	calcbranch
			up40:
			finit
			fld	@middle
			fcom	dt70
			fstsw	ax
			sahf
			ja	up70
				finit;此处为40_70时候的代码
				fld	dt40
				fsub	@middle
				fst	@middle1
				fmul	@middle1
				fchs
				fst	@middle1	;记录数值,也就是F
				jmp	calcbranch
			up70:
				finit;大于70的代码
				fld	dt156
				fsub	@middle
				fst	@middle1	;暂时保留
				fmul	@middle1
				fchs
				fst	@middle1;记录数值,也就是F
				fsub	dt100
				fst	@middle1;记录数值,也就是F
			calcbranch:
				calcX:					
					finit
					fld	@calcparticle.dpx
					fmul	@middle1
					fld	@middle
					fdiv		
					fst	@forceXX	;记录X轴分力
					fmul	dtm
					fmul	dtt
					fadd	@thisparticle.dvx
					fst	@thisparticle.dvx	;计算速度
					finit
					fld	dtt
					fld	@thisparticle.dvx
					fmul
					fst 	@tmp0
					fld	@forceXX
					fmul	dttt2
					fadd	@tmp0	;得到位移,计算边界
					fst	@tmp0	;暂存位移
					fld	dtlimit
					fld	@tmp0
					fprem
					fst	@tmp0	;暂存余数.
					fadd	@thisparticle.dpx	;得到坐标
					fst	@thisparticle.dpx
					uplimitx:
						finit
						fld	@thisparticle.dpx
						fcom	dtlimitz
						fstsw	ax
						sahf
						ja 	backup0x
						jmp	lowlimit0x
						backup0x:
						fld	@thisparticle.dpx
						fsub	dtlimitz
						fst	@tmp1
						fld	dtlimitz
						fsub	@tmp1
						fst	@thisparticle.dpx
						fld	@thisparticle.dvx
						fchs
						fst	@thisparticle.dvx
					lowlimit0x:
						finit
						fld	@thisparticle.dpx
						fcom	dtlimitf
						fstsw	ax
						sahf
						jb	backlowx
						jmp	uplimit1x
						backlowx:
						fld	@thisparticle.dpx
						fsub	dtlimitf
						fst	@tmp1
						fld	dtlimitf
						fsub	@tmp1
						fst	@thisparticle.dpx
						fld	@thisparticle.dvx
						fchs
						fst	@thisparticle.dvx
					uplimit1x:
						finit
						fld	@thisparticle.dpx
						fcom	dtlimitz
						fstsw	ax
						sahf
						ja 	backup1x
						jmp	calcY
						backup1x:
						fld	@thisparticle.dpx
						fsub	dtlimitz
						fst	@tmp1
						fld	dtlimitz
						fsub	@tmp1
						fst	@thisparticle.dpx
						fld	@thisparticle.dvx
						fchs
						fst	@thisparticle.dvx
				calcY:					
					fld	@calcparticle.dpy
					fmul	@middle1
					fld	@middle
					fdiv		
					fst	@forceYY	;记录Y轴分力
					fmul	dtm
					fmul	dtt
					fadd	@thisparticle.dvy
					fst	@thisparticle.dvy	;计算速度
					finit
					fld	dtt
					fld	@thisparticle.dvy
					fmul
					fst 	@tmp0
					fld	@forceYY
					fmul	dttt2
					fadd	@tmp0	;得到位移,计算边界
					fst	@tmp0	;暂存位移
					fld	dtlimit
					fld	@tmp0
					fprem
					fst	@tmp0	;暂存余数.
					fadd	@thisparticle.dpy	;得到坐标
					fst	@thisparticle.dpy
					uplimity:
						fld	@thisparticle.dpy
						fcom	dtlimitz
						fstsw	ax
						sahf
						ja 	backup0y
						jmp	lowlimit0y
						backup0y:
						fld	@thisparticle.dpy
						fsub	dtlimitz
						fst	@tmp1
						fld	dtlimitz
						fsub	@tmp1
						fst	@thisparticle.dpy
						fld	@thisparticle.dvy
						fchs
						fst	@thisparticle.dvy
					lowlimit0y:
						finit
						fld	@thisparticle.dpy
						fcom	dtlimitf
						fstsw	ax
						sahf
						jb	backlowy
						jmp	uplimit1y
						backlowy:
						fld	@thisparticle.dpy
						fsub	dtlimitf
						fst	@tmp1
						fld	dtlimitf
						fsub	@tmp1
						fst	@thisparticle.dpy

						fld	@thisparticle.dvy
						fchs
						fst	@thisparticle.dvy

					uplimit1y:
						fld	@thisparticle.dpy
						fcom	dtlimitz
						fstsw	ax
						sahf
						ja 	backup1y
						jmp	calcZ
						backup1y:
						fld	@thisparticle.dpy
						fsub	dtlimitz
						fst	@tmp1
						fld	dtlimitz
						fsub	@tmp1
						fst	@thisparticle.dpy
						fld	@thisparticle.dvy
						fchs
						fst	@thisparticle.dvy
				calcZ:					
					fld	@calcparticle.dpz
					fmul	@middle1
					fld	@middle
					fdiv		
					fst	@forceZZ	;记录Z轴分力
					fmul	dtm
					fmul	dtt
					fadd	@thisparticle.dvz
					fst	@thisparticle.dvz	;计算速度
					finit
					fld	dtt
					fmul	@thisparticle.dvz
					fst 	@tmp0
					fld	@forceZZ
					fmul	dttt2
					fadd	@tmp0	;得到位移,计算边界
					fst	@tmp0	;暂存位移
					fld	dtlimit
					fld	@tmp0
					fprem
					fst	@tmp0	;暂存余数.
					fadd	@thisparticle.dpz	;得到坐标
					fst	@thisparticle.dpz
					uplimitz:
						finit
						fld	@thisparticle.dpz
						fcom	dtlimitz
						fstsw	ax
						sahf
						ja 	backup0z
						jmp	lowlimit0z
						backup0z:
						fld	@thisparticle.dpz
						fsub	dtlimitz
						fst	@tmp1
						fld	dtlimitz
						fsub	@tmp1
						fst	@thisparticle.dpz

						fld	@thisparticle.dvz
						fchs
						fst	@thisparticle.dvz
					lowlimit0z:
						finit
						fld	@thisparticle.dpz
						fcom	dtlimitf
						fstsw	ax
						sahf
						jb	backlowz
						jmp	uplimit1z
						backlowz:
						fld	@thisparticle.dpz
						fsub	dtlimitf
						fst	@tmp1
						fld	dtlimitf
						fsub	@tmp1
						fst	@thisparticle.dpz
						fld	@thisparticle.dvz
						fchs
						fst	@thisparticle.dvz
					uplimit1z:
						finit
						fld	@thisparticle.dpz
						fcom	dtlimitz
						fstsw	ax
						sahf
						ja 	backup1z
						jmp	outcalc
						backup1z:
						fld	@thisparticle.dpz
						fsub	dtlimitz
						fst	@tmp1
						fld	dtlimitz
						fsub	@tmp1
						fst	@thisparticle.dpz
						fld	@thisparticle.dvz
						fchs
						fst	@thisparticle.dvz
		outcalc:
			mov	eax,_which
			mul	sizeofdtparticle
			mov	esi,offset dtparticle0
			add	esi,eax		;获取要与计算粒子计算的粒子相对于粒子0的偏移量	
			finit
			assume	esi:ptr	PARTICLE
			fld	@thisparticle.dpx
			fstp	[esi].dpx
			fld	@thisparticle.dpy
			fstp	[esi].dpy
			fld	@thisparticle.dpz
			fstp	[esi].dpz
			fld	@thisparticle.dvx
			fstp	[esi].dvx
			fld	@thisparticle.dvy
			fstp	[esi].dvy
			fld	@thisparticle.dvz
			fstp	[esi].dvz
			assume	esi:nothing		;保存要计算的粒子
		pop	ecx	;恢复
		inc	ecx
	.endw
	popad
	ret
Calc	endp
;====================================================
Calc0	proc	uses ebx eax esi	;线程函数,进行运算的
	local	@which
	local	@middle:qword
	mov	eax,dtwhichparticle
	mov	@which,eax
	mul	sizeofdtparticle
	mov	esi,offset dtparticle0
	add	esi,eax
	assume	esi:ptr PARTICLE
	.while TRUE
		mov	ebx,350
		.while	ebx!=0
			dec	ebx
			push	ebx
			invoke	Calc,@which
			pop	ebx
		.endw 
		invoke	printfnumber,[esi].dpx
		invoke	printfnumber,[esi].dpy
		invoke	printfnumber,[esi].dpz
		invoke	printfnumber,[esi].dvx
		invoke	printfnumber,[esi].dvy
		invoke	printfnumber,[esi].dvz	
		invoke	Sleep,15
		mov	eax,eventout
		.if	eax
			ret
		.endif
	.endw	
Calc0	endp
;=============================================================
starting	proc 
	local	@hThreadID 

	xor	eax,eax
	mov	lprand0,eax
	mov	lprand1,eax
	mov	eventout,eax
	mov	sizeofdtparticle,sizeof dtparticle0	
	invoke	HeapCreate,HEAP_NO_SERIALIZE,38046,0
	mov	hHeap,eax
	invoke	HeapAlloc,hHeap,HEAP_NO_SERIALIZE,38046
	mov	lpMemory,eax
	mov	ecx,0
	.while	ecx<8
		push	ecx
		mov	dtwhichparticle,ecx
		invoke 	CreateThread,NULL,NULL,addr Calc0,NULL,NULL,addr @hThreadID
		invoke	Sleep,1
		pop	ecx
		inc	ecx
	.endw
	ret
starting	endp
;==========================================================
getrand	 	proc	uses ebx ecx esi 
	xor	ecx,ecx
	mov	ebx,lprand1
	mov	esi,lpMemory
	.if	ebx>38000
		xor	ebx,ebx
		mov	lprand1,ebx
	.else
		add	esi,ebx
		add	lprand1,4
	.endif
	mov	eax,dword ptr [esi]
	.while	eax==0
		invoke	Sleep,50
		mov	eax,dword ptr [esi]
	.endw
	mov	dword ptr [esi],ecx
	ret
getrand		endp
;==================================================================
endrand		proc
	mov	eax,1
	mov	eventout,eax
	invoke	HeapDestroy,hHeap
	ret
endrand		endp
;================================================
DLLEntry	proc	_hInstance,_dwReason,_dwReserved
	push	_hInstance
	pop		hInstDLL
	mov	eax,TRUE
	ret
DLLEntry	endp
	End		DLLEntry


至于参数是怎么定的,那是测试测出来的,比如时间,太快或着太慢都会影响生成的随机数的质量,但时间参数不是独立的,它还和力的大小有关,循环计算次数等。外面的盒子的大小也会影响随机数质量。我相信这个随机数发生器可以得到更高的质量,但参数我实在是调不了了,它们之间究竟有什么样的内在联系我也不是很清楚。只能达到现在这样。

好了,说下使用方法,首先调用starting,进行初始化,然后就可以用getrand获取随机数了,如果能在最后想起来用endrand就更好了。

最后说下它的缺点,就是生成的随机数质量不是很稳定,一样的代码生成的随机数要看运气(也算随机吧),我发的两张是不错的,但波动不大。其次是速度,不是很快,全力开动大约一秒可以产生15K随机文件(现在翻翻了),平常也就9K左右,在不是连续疯狂的使用时是足够的,当然程序里用了私有堆,你可以改大点,程序会不断的在空闲时间生成随机数储备在内存中,使用时可以加快速度。

就这些了,暂时没想起来还有什么问题。本人水平有限,欢迎指正,也希望各位走过路过的能告诉我我的努力是否能得到肯定,谢谢。

[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!

上传的附件:
收藏
免费 0
支持
分享
最新回复 (21)
雪    币: 53
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
难道大家都对随机数不感兴趣?
对加密来说随机数很重要啊
我代码太次?
2010-11-21 22:42
0
雪    币: 208
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
3
有点高深哦
2010-11-21 23:09
0
雪    币: 0
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
4
没钱下载代码,先学习学习楼主的思路
2010-11-23 17:10
0
雪    币: 24
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
5
收藏了,谢谢楼主
2010-11-23 17:28
0
雪    币: 15
活跃值: (48)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
6
强帖留名!

如果不给邀请码,就稀罕 这位大哥了!!

在计算机中获取随机数,经常的,不是真正的随机数,但是可以做到非常逼近随机数.
总有一些随机的变量的,比如鼠标 键盘,,或者内存里某一个地址的值 在一定时间内的变化率等等

其实 很高深,,还有什么嫡  这个 非专业 去研究,,真是不懂!!

总之,,厉害啊!
2010-11-23 18:22
0
雪    币: 10
活跃值: (87)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
7
看不懂,但希望楼主申请成功
2010-11-23 18:41
0
雪    币: 53
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
8
我贴出了部分源码,遗憾的不能全贴了。说实话,我的代码可读性不是太高,但效率还是不错的
我最开始写的就是一个仿的熵池,但那个效率,还得放钩子,搞不好就被和谐了。就用了这个。
2010-11-23 18:52
0
雪    币: 306
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
9
对楼主表示深深深深的崇拜如滔滔江水,太高深了
2010-11-23 18:53
0
雪    币: 89
活跃值: (53)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
10
科班出身吧。。楼主强人
2010-11-23 19:59
0
雪    币: 15
活跃值: (48)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
11
花了2钱 下载了你的东西,,不会编译啊~~~~~~~~

masm611 masm32 这里都有..
修改了 macros.asm 的位置 为我电脑里masm32下面的路径..
masm build.asm 显示windows.inc错误  
求 编译方法...
(我使用的算是绿色的masm,我设置了path,是不是需要设置其他变量??)
2010-11-23 20:46
0
雪    币: 53
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
12
呃,不知道你看没看过罗云彬的书,变量有PATH,LIB,INCLUDE,我用的头文件里还有一个得手动写路径,就是那个E:\程序\...那个,但那个是我测试时候用的,可以去掉。
老罗的书很经典,入门必备。。。
我用的是MASM 10
2010-11-23 21:54
0
雪    币: 1708
活跃值: (586)
能力值: ( LV15,RANK:670 )
在线值:
发帖
回帖
粉丝
13
[font=Fixedsys][color=#000000]        [/color][color=#800080].386p
        .8087
        [/color][color=#000000].mmx
        [/color][color=#0A246A].model flat,stdcall
        option casemap:none
[/color][/font][font=Comic Sans MS][color=#008000];>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; Include 文件定义
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >
[/color][/font][font=Fixedsys][color=#0A246A]include        [/color][color=#000000]windows.inc
[/color][color=#0A246A]include        [/color][color=#000000]gdi32.inc
[/color][color=#0A246A]includelib    [/color][color=#000000]gdi32.lib
[/color][color=#0A246A]include        [/color][color=#000000]user32.inc
[/color][color=#0A246A]includelib    [/color][color=#000000]user32.lib
[/color][color=#0A246A]include        [/color][color=#000000]kernel32.inc
[/color][color=#0A246A]includelib    [/color][color=#000000]kernel32.lib
[/color][color=#0A246A]include        [/color][color=#000000]advapi32.inc
[/color][color=#0A246A]includelib    [/color][color=#000000]advapi32.lib
[/color][color=#0A246A]include        [/color][color=#000000]masm32.inc
[/color][color=#0A246A]includelib     [/color][color=#000000]masm32.lib
[/color][color=#0A246A]includelib      [/color][color=#000000]msvcrt.lib
[/color][color=#0A246A]include     [/color][color=#000000]e[/color][color=#0A246A]:[/color][color=#000000]\程[/color][color=#800080]序[/color][color=#000000]\masm32\MACROS\macros.asm
[/color][/font][font=Comic Sans MS][color=#008000];================================================
        [/color][/font][font=Fixedsys][color=#0A246A].data?
[/color][color=#000000]hInstDLL        [/color][color=#0A246A]dd        ?
[/color][color=#000000]hThreadCreate0        [/color][color=#0A246A]dd        ?
[/color][color=#000000]hThreadCreate1        [/color][color=#0A246A]dd        ?
[/color][color=#000000]hThreadCreate2        [/color][color=#0A246A]dd        ?
[/color][color=#000000]hThreadCreate3        [/color][color=#0A246A]dd        ?
[/color][color=#000000]hThreadCreate4        [/color][color=#0A246A]dd        ?
[/color][color=#000000]hThreadCreate5        [/color][color=#0A246A]dd        ?
[/color][color=#000000]hThreadCreate6        [/color][color=#0A246A]dd        ?
[/color][color=#000000]hThreadCreate7        [/color][color=#0A246A]dd        ?
[/color][color=#000000]hEventCreate        [/color][color=#0A246A]dd        ?

[/color][color=#000000]hHeap            [/color][color=#0A246A]dd        ?
[/color][color=#000000]lpMemory        [/color][color=#0A246A]dd        ?
[/color][color=#000000]eventout    [/color][color=#0A246A]dd        ?

[/color][color=#000000]PARTICLE    [/color][color=#0A246A]struct
    [/color][color=#000000]dpx        [/color][color=#0A246A]dq    ?
    [/color][color=#000000]dpy        [/color][color=#0A246A]dq    ?
    [/color][color=#000000]dpz        [/color][color=#0A246A]dq    ?
    [/color][color=#000000]dvx        [/color][color=#0A246A]dq    ?
    [/color][color=#000000]dvy        [/color][color=#0A246A]dq    ?
    [/color][color=#000000]dvz        [/color][color=#0A246A]dq    ?
[/color][color=#000000]PARTICLE        [/color][color=#0A246A]ends    

[/color][color=#000000]sizeofdtparticle    [/color][color=#0A246A]dd    ?

[/color][color=#000000]lprand0            [/color][color=#0A246A]dd    ?
[/color][color=#000000]lprand1            [/color][color=#0A246A]dd    ?

[/color][color=#000000]dttime            [/color][color=#0A246A]dd    ?

[/color][/font][font=Comic Sans MS][color=#008000];=================================================================
        [/color][/font][font=Fixedsys][color=#0A246A].data
[/color][color=#000000]dtparticle0    PARTICLE     [/color][color=#0A246A]<-[/color][color=#800080]20.0[/color][color=#0A246A],[/color][color=#800080]20.0[/color][color=#0A246A],-[/color][color=#800080]20.0[/color][color=#0A246A],[/color][color=#800080]0.0[/color][color=#0A246A],[/color][color=#800080]0.0[/color][color=#0A246A],[/color][color=#800080]0.0[/color][color=#0A246A]>
[/color][color=#000000]dtparticle1    PARTICLE     [/color][color=#0A246A]<-[/color][color=#800080]20.0[/color][color=#0A246A],[/color][color=#800080]20.0[/color][color=#0A246A],[/color][color=#800080]20.0[/color][color=#0A246A],[/color][color=#800080]0.0[/color][color=#0A246A],[/color][color=#800080]0.0[/color][color=#0A246A],[/color][color=#800080]0.0[/color][color=#0A246A]> [/color][/font][font=Comic Sans MS][color=#008000];-1,1,1
[/color][/font][font=Fixedsys][color=#000000]dtparticle2    PARTICLE     [/color][color=#0A246A]<[/color][color=#800080]20.0[/color][color=#0A246A],[/color][color=#800080]20.0[/color][color=#0A246A],-[/color][color=#800080]20.0[/color][color=#0A246A],[/color][color=#800080]0.0[/color][color=#0A246A],[/color][color=#800080]0.0[/color][color=#0A246A],[/color][color=#800080]0.0[/color][color=#0A246A]>
[/color][color=#000000]dtparticle3    PARTICLE     [/color][color=#0A246A]<[/color][color=#800080]20.0[/color][color=#0A246A],[/color][color=#800080]20.0[/color][color=#0A246A],[/color][color=#800080]20.0[/color][color=#0A246A],[/color][color=#800080]0.0[/color][color=#0A246A],[/color][color=#800080]0.0[/color][color=#0A246A],[/color][color=#800080]0.0[/color][color=#0A246A]>
[/color][color=#000000]dtparticle4    PARTICLE     [/color][color=#0A246A]<-[/color][color=#800080]20.0[/color][color=#0A246A],-[/color][color=#800080]20.0[/color][color=#0A246A],-[/color][color=#800080]20.0[/color][color=#0A246A],[/color][color=#800080]0.0[/color][color=#0A246A],[/color][color=#800080]0.0[/color][color=#0A246A],[/color][color=#800080]0.0[/color][color=#0A246A]>
[/color][color=#000000]dtparticle5    PARTICLE     [/color][color=#0A246A]<-[/color][color=#800080]21.0[/color][color=#0A246A],-[/color][color=#800080]21.0[/color][color=#0A246A],-[/color][color=#800080]21.0[/color][color=#0A246A],[/color][color=#800080]0.0[/color][color=#0A246A],[/color][color=#800080]0.0[/color][color=#0A246A],[/color][color=#800080]0.0[/color][color=#0A246A]>
[/color][color=#000000]dtparticle6    PARTICLE     [/color][color=#0A246A]<[/color][color=#800080]20.0[/color][color=#0A246A],-[/color][color=#800080]20.0[/color][color=#0A246A],-[/color][color=#800080]20.0[/color][color=#0A246A],[/color][color=#800080]0.0[/color][color=#0A246A],[/color][color=#800080]0.0[/color][color=#0A246A],[/color][color=#800080]0.0[/color][color=#0A246A]>
[/color][color=#000000]dtparticle7    PARTICLE    [/color][color=#0A246A]<[/color][color=#800080]0.0[/color][color=#0A246A],[/color][color=#800080]0.0[/color][color=#0A246A],[/color][color=#800080]0.0[/color][color=#0A246A],[/color][color=#800080]0.0[/color][color=#0A246A],[/color][color=#800080]0.0[/color][color=#0A246A],[/color][color=#800080]0.0[/color][color=#0A246A]>
[/color][color=#000000]dtparticle8    PARTICLE    [/color][color=#0A246A]<[/color][color=#800080]1.0[/color][color=#0A246A],[/color][color=#800080]1.0[/color][color=#0A246A],[/color][color=#800080]1.0[/color][color=#0A246A],[/color][color=#800080]0.0[/color][color=#0A246A],[/color][color=#800080]0.0[/color][color=#0A246A],[/color][color=#800080]0.0[/color][color=#0A246A]>
[/color][color=#000000]dtparticle9    PARTICLE    [/color][color=#0A246A]<[/color][color=#800080]10.0[/color][color=#0A246A],[/color][color=#800080]10.0[/color][color=#0A246A],[/color][color=#800080]10.0[/color][color=#0A246A],[/color][color=#800080]10.0[/color][color=#0A246A],[/color][color=#800080]1.0[/color][color=#0A246A],[/color][color=#800080]0.9[/color][color=#0A246A]>
[/color][color=#000000]dt40        [/color][color=#0A246A]dq        [/color][color=#800080]40.0
[/color][color=#000000]dt70        [/color][color=#0A246A]dq        [/color][color=#800080]70.0
[/color][color=#000000]dt100        [/color][color=#0A246A]dq        [/color][color=#800080]100.0
[/color][color=#000000]dt156        [/color][color=#0A246A]dq        [/color][color=#800080]156.1
[/color][color=#000000]dtt        [/color][color=#0A246A]dq        [/color][color=#800080]0.00000001
[/color][color=#000000]dttt2        [/color][color=#0A246A]dq        [/color][color=#800080]0.00000000000000005
[/color][color=#000000]dtm        [/color][color=#0A246A]dq        [/color][color=#800080]1.0
[/color][color=#000000]dtlimit        [/color][color=#0A246A]dq        [/color][color=#800080]40000.0
[/color][color=#000000]dtlimitf    [/color][color=#0A246A]dq        -[/color][color=#800080]10000.0
[/color][color=#000000]dtlimitz    [/color][color=#0A246A]dq        [/color][color=#800080]10000.0
[/color][/font][font=Comic Sans MS][color=#008000];==================================================
        [/color][/font][font=Fixedsys][color=#0A246A].const
[/color][color=#000000]szEvent        [/color][color=#0A246A]db    [/color][/font][font=Comic Sans MS][color=#008000]'create'[/color][/font][font=Fixedsys][color=#0A246A],[/color][color=#800080]0
[/color][color=#000000]szEventWhich    [/color][color=#0A246A]db    [/color][/font][font=Comic Sans MS][color=#008000]'which'[/color][/font][font=Fixedsys][color=#0A246A],[/color][color=#800080]0
[/color][/font][font=Comic Sans MS][color=#008000];===================================================
        [/color][/font][font=Fixedsys][color=#0A246A].code
[/color][color=#000000]Calc    [/color][color=#0A246A]proc    uses [/color][color=#FF8000]esi eax ebx ecx  [/color][color=#000000]_which
    [/color][color=#0A246A]local    [/color][color=#000000]@thisparticle[/color][color=#0A246A]:[/color][color=#000000]PARTICLE    [/color][/font][font=Comic Sans MS][color=#008000];本次计算的粒子
    [/color][/font][font=Fixedsys][color=#0A246A]local    [/color][color=#000000]@calcparticle[/color][color=#0A246A]:[/color][color=#000000]PARTICLE    [/color][/font][font=Comic Sans MS][color=#008000];要计算的粒子
    [/color][/font][font=Fixedsys][color=#0A246A]local    [/color][color=#000000]@forceXX[/color][color=#0A246A]:qword    
    local    [/color][color=#000000]@forceYY[/color][color=#0A246A]:qword
    local    [/color][color=#000000]@forceZZ[/color][color=#0A246A]:qword
    local    [/color][color=#000000]@middle[/color][color=#0A246A]:qword        [/color][/font][font=Comic Sans MS][color=#008000];记录力的大小
    [/color][/font][font=Fixedsys][color=#0A246A]local    [/color][color=#000000]@middle1[/color][color=#0A246A]:qword        [/color][/font][font=Comic Sans MS][color=#008000];记录差值的绝对值
    [/color][/font][font=Fixedsys][color=#0A246A]local    [/color][color=#000000]@dta[/color][color=#0A246A]:qword        [/color][/font][font=Comic Sans MS][color=#008000];记录加速度a
    [/color][/font][font=Fixedsys][color=#0A246A]local    [/color][color=#000000]@tmp0[/color][color=#0A246A]:qword
    local    [/color][color=#000000]@tmp1[/color][color=#0A246A]:qword



    
    fldz
    fst    [/color][color=#000000]@forceXX
    [/color][color=#0A246A]fst    [/color][color=#000000]@forceYY
    [/color][color=#0A246A]fst    [/color][color=#000000]@forceZZ        [/color][/font][font=Comic Sans MS][color=#008000];初始化力
    
    [/color][/font][font=Fixedsys][color=#0A246A]mov    [/color][color=#FF8000]eax[/color][color=#0A246A],[/color][color=#000000]_which
    [/color][color=#0A246A]mul    [/color][color=#000000]sizeofdtparticle
    [/color][color=#0A246A]mov    [/color][color=#FF8000]esi[/color][color=#0A246A],offset [/color][color=#000000]dtparticle0
    [/color][color=#0A246A]add    [/color][color=#FF8000]esi[/color][color=#0A246A],[/color][color=#FF8000]eax        [/color][/font][font=Comic Sans MS][color=#008000];获取要计算粒子相对于粒子0的偏移量
    
    [/color][/font][font=Fixedsys][color=#0A246A]finit
    assume    [/color][color=#FF8000]esi[/color][color=#0A246A]:ptr    [/color][color=#000000]PARTICLE
    [/color][color=#0A246A]fld    [[/color][color=#FF8000]esi[/color][color=#0A246A]][/color][color=#000000].dpx
    [/color][color=#0A246A]fstp    [/color][color=#000000]@thisparticle.dpx
    [/color][color=#0A246A]fld    [[/color][color=#FF8000]esi[/color][color=#0A246A]][/color][color=#000000].dpy
    [/color][color=#0A246A]fstp    [/color][color=#000000]@thisparticle.dpy
    [/color][color=#0A246A]fld    [[/color][color=#FF8000]esi[/color][color=#0A246A]][/color][color=#000000].dpz
    [/color][color=#0A246A]fstp    [/color][color=#000000]@thisparticle.dpz
    [/color][color=#0A246A]fld    [[/color][color=#FF8000]esi[/color][color=#0A246A]][/color][color=#000000].dvx
    [/color][color=#0A246A]fstp    [/color][color=#000000]@thisparticle.dvx
    [/color][color=#0A246A]fld    [[/color][color=#FF8000]esi[/color][color=#0A246A]][/color][color=#000000].dvy
    [/color][color=#0A246A]fstp    [/color][color=#000000]@thisparticle.dvy
    [/color][color=#0A246A]fld    [[/color][color=#FF8000]esi[/color][color=#0A246A]][/color][color=#000000].dvz
    [/color][color=#0A246A]fstp    [/color][color=#000000]@thisparticle.dvz
    [/color][color=#0A246A]assume    [/color][color=#FF8000]esi[/color][color=#0A246A]:nothing        [/color][/font][font=Comic Sans MS][color=#008000];保存要计算的粒子
    
    [/color][/font][font=Fixedsys][color=#0A246A]mov    [/color][color=#FF8000]ecx[/color][color=#0A246A],[/color][color=#800080]0    [/color][/font][font=Comic Sans MS][color=#008000];计算8个粒子
    [/color][/font][font=Fixedsys][color=#0A246A].while    [/color][color=#FF8000]ecx[/color][color=#0A246A]<[/color][color=#800080]8
        [/color][color=#0A246A].if    [/color][color=#000000]_which[/color][color=#0A246A]==[/color][color=#FF8000]ecx
            [/color][color=#0A246A]inc [/color][color=#FF8000]ecx
            [/color][color=#0A246A].continue
        .endif        [/color][/font][font=Comic Sans MS][color=#008000];不计算本粒子的    
        [/color][/font][font=Fixedsys][color=#0A246A]push    [/color][color=#FF8000]ecx    [/color][/font][font=Comic Sans MS][color=#008000];先保存ECX

        [/color][/font][font=Fixedsys][color=#0A246A]mov    [/color][color=#FF8000]eax[/color][color=#0A246A],[/color][color=#FF8000]ecx
        [/color][color=#0A246A]mul    [/color][color=#000000]sizeofdtparticle
        [/color][color=#0A246A]mov    [/color][color=#FF8000]esi[/color][color=#0A246A],offset [/color][color=#000000]dtparticle0
        [/color][color=#0A246A]add    [/color][color=#FF8000]esi[/color][color=#0A246A],[/color][color=#FF8000]eax        [/color][/font][font=Comic Sans MS][color=#008000];获取要与计算粒子计算的粒子相对于粒子0的偏移量

        [/color][/font][font=Fixedsys][color=#0A246A]finit
        assume    [/color][color=#FF8000]esi[/color][color=#0A246A]:ptr    [/color][color=#000000]PARTICLE
        [/color][color=#0A246A]fld    [[/color][color=#FF8000]esi[/color][color=#0A246A]][/color][color=#000000].dpx
        [/color][color=#0A246A]fstp    [/color][color=#000000]@calcparticle.dpx
        [/color][color=#0A246A]fld    [[/color][color=#FF8000]esi[/color][color=#0A246A]][/color][color=#000000].dpy
        [/color][color=#0A246A]fstp    [/color][color=#000000]@calcparticle.dpy
        [/color][color=#0A246A]fld    [[/color][color=#FF8000]esi[/color][color=#0A246A]][/color][color=#000000].dpz
        [/color][color=#0A246A]fstp    [/color][color=#000000]@calcparticle.dpz
        [/color][color=#0A246A]assume    [/color][color=#FF8000]esi[/color][color=#0A246A]:nothing        [/color][/font][font=Comic Sans MS][color=#008000];获取该粒子的参数            

        [/color][/font][font=Fixedsys][color=#000000]donext[/color][color=#0A246A]:        [/color][/font][font=Comic Sans MS][color=#008000];不重合的时候计算,现在又calc的X,Y,Z位置
            [/color][/font][font=Fixedsys][color=#0A246A]finit
            fld    [/color][color=#000000]@thisparticle.dpx
            [/color][color=#0A246A]fsub    [/color][color=#000000]@calcparticle.dpx
            [/color][color=#0A246A]fst    [/color][color=#000000]@calcparticle.dpx    [/color][/font][font=Comic Sans MS][color=#008000];calcparticle里记录的是差值,即X1-X2
            [/color][/font][font=Fixedsys][color=#0A246A]fmul    [/color][color=#000000]@calcparticle.dpx
            [/color][color=#0A246A]fst    [/color][color=#000000]@forceXX    [/color][/font][font=Comic Sans MS][color=#008000];x差值平方,下同
            [/color][/font][font=Fixedsys][color=#0A246A]finit
            fld    [/color][color=#000000]@thisparticle.dpy
            [/color][color=#0A246A]fsub    [/color][color=#000000]@calcparticle.dpy
            [/color][color=#0A246A]fst    [/color][color=#000000]@calcparticle.dpy
            [/color][color=#0A246A]fmul    [/color][color=#000000]@calcparticle.dpy
            [/color][color=#0A246A]fst    [/color][color=#000000]@forceYY
            [/color][color=#0A246A]finit
            fld    [/color][color=#000000]@thisparticle.dpz
            [/color][color=#0A246A]fsub    [/color][color=#000000]@calcparticle.dpz
            [/color][color=#0A246A]fst    [/color][color=#000000]@calcparticle.dpz
            [/color][color=#0A246A]fmul    [/color][color=#000000]@calcparticle.dpz
            [/color][color=#0A246A]fst    [/color][color=#000000]@forceZZ

            [/color][color=#0A246A]fld    [/color][color=#000000]@forceXX
            [/color][color=#0A246A]fadd    [/color][color=#000000]@forceYY
            [/color][color=#0A246A]fadd    [/color][color=#000000]@forceZZ    [/color][/font][font=Comic Sans MS][color=#008000];X^2+Y^2+Z^2
            [/color][/font][font=Fixedsys][color=#0A246A]fsqrt
            fst    [/color][color=#000000]@middle        [/color][/font][font=Comic Sans MS][color=#008000];存储距离大小,因为后面限制了粒子的活动范围,所以现在的距离一定可以正常的运算出来
            ;下一步,比较距离,分析
            
            [/color][/font][font=Fixedsys][color=#0A246A]finit
            fld    [/color][color=#000000]@middle
            [/color][color=#0A246A]fcom    [/color][color=#000000]dt40
            [/color][color=#0A246A]fstsw    [/color][color=#FF8000]ax
            [/color][color=#0A246A]sahf
            ja    [/color][color=#000000]up40
                [/color][/font][font=Comic Sans MS][color=#008000];小于40时候的代码
                [/color][/font][font=Fixedsys][color=#0A246A]finit
                fld    [/color][color=#000000]dt40
                [/color][color=#0A246A]fsub    [/color][color=#000000]@middle
                [/color][color=#0A246A]fld1
                fscale
                fst    [/color][color=#000000]@middle1
                [/color][color=#0A246A]jmp    [/color][color=#000000]calcbranch
            up40[/color][color=#0A246A]:
            finit
            fld    [/color][color=#000000]@middle
            [/color][color=#0A246A]fcom    [/color][color=#000000]dt70
            [/color][color=#0A246A]fstsw    [/color][color=#FF8000]ax
            [/color][color=#0A246A]sahf
            ja    [/color][color=#000000]up70
                [/color][/font][font=Comic Sans MS][color=#008000];此处为40_70时候的代码
                [/color][/font][font=Fixedsys][color=#0A246A]finit
                fld    [/color][color=#000000]dt40
                [/color][color=#0A246A]fsub    [/color][color=#000000]@middle
                [/color][color=#0A246A]fst    [/color][color=#000000]@middle1
                [/color][color=#0A246A]fmul    [/color][color=#000000]@middle1
                [/color][color=#0A246A]fchs
                fst    [/color][color=#000000]@middle1    [/color][/font][font=Comic Sans MS][color=#008000];记录数值,也就是F
                [/color][/font][font=Fixedsys][color=#0A246A]jmp    [/color][color=#000000]calcbranch
            up70[/color][color=#0A246A]:
                [/color][/font][font=Comic Sans MS][color=#008000];大于70的代码
                [/color][/font][font=Fixedsys][color=#0A246A]finit
                fld    [/color][color=#000000]dt156
                [/color][color=#0A246A]fsub    [/color][color=#000000]@middle
                [/color][color=#0A246A]fst    [/color][color=#000000]@middle1    [/color][/font][font=Comic Sans MS][color=#008000];暂时保留
                [/color][/font][font=Fixedsys][color=#0A246A]fmul    [/color][color=#000000]@middle1
                [/color][color=#0A246A]fchs
                fst    [/color][color=#000000]@middle1[/color][/font][font=Comic Sans MS][color=#008000];记录数值,也就是F
                [/color][/font][font=Fixedsys][color=#0A246A]fsub    [/color][color=#000000]dt100
                [/color][color=#0A246A]fst    [/color][color=#000000]@middle1[/color][/font][font=Comic Sans MS][color=#008000];记录数值,也就是F

            ;在上面的计算中,没有可以超出计算范围的数字,最大的是2^40,也没有超过浮点表示范围.
            [/color][/font][font=Fixedsys][color=#000000]calcbranch[/color][color=#0A246A]:
                [/color][color=#000000]calcX[/color][color=#0A246A]:                    
                    finit
                    fld    [/color][color=#000000]@calcparticle.dpx
                    [/color][color=#0A246A]fmul    [/color][color=#000000]@middle1
                    [/color][color=#0A246A]fld    [/color][color=#000000]@middle
                    [/color][color=#0A246A]fdiv        
                    fst    [/color][color=#000000]@forceXX    [/color][/font][font=Comic Sans MS][color=#008000];记录X轴分力

                    [/color][/font][font=Fixedsys][color=#0A246A]fmul    [/color][color=#000000]dtm
                    [/color][color=#0A246A]fmul    [/color][color=#000000]dtt
                    [/color][color=#0A246A]fadd    [/color][color=#000000]@thisparticle.dvx
                    [/color][color=#0A246A]fst    [/color][color=#000000]@thisparticle.dvx    [/color][/font][font=Comic Sans MS][color=#008000];计算速度

                    [/color][/font][font=Fixedsys][color=#0A246A]finit
                    fld    [/color][color=#000000]dtt
                    [/color][color=#0A246A]fld    [/color][color=#000000]@thisparticle.dvx
                    [/color][color=#0A246A]fmul
                    fst     [/color][color=#000000]@tmp0
                    [/color][color=#0A246A]fld    [/color][color=#000000]@forceXX
                    [/color][color=#0A246A]fmul    [/color][color=#000000]dttt2
                    [/color][color=#0A246A]fadd    [/color][color=#000000]@tmp0    [/color][/font][font=Comic Sans MS][color=#008000];得到位移,计算边界
                    [/color][/font][font=Fixedsys][color=#0A246A]fst    [/color][color=#000000]@tmp0    [/color][/font][font=Comic Sans MS][color=#008000];暂存位移

                    [/color][/font][font=Fixedsys][color=#0A246A]fld    [/color][color=#000000]dtlimit
                    [/color][color=#0A246A]fld    [/color][color=#000000]@tmp0
                    [/color][color=#0A246A]fprem
                    fst    [/color][color=#000000]@tmp0    [/color][/font][font=Comic Sans MS][color=#008000];暂存余数.
                    [/color][/font][font=Fixedsys][color=#0A246A]fadd    [/color][color=#000000]@thisparticle.dpx    [/color][/font][font=Comic Sans MS][color=#008000];得到坐标
                    [/color][/font][font=Fixedsys][color=#0A246A]fst    [/color][color=#000000]@thisparticle.dpx

                    uplimitx[/color][color=#0A246A]:
                        finit
                        fld    [/color][color=#000000]@thisparticle.dpx
                        [/color][color=#0A246A]fcom    [/color][color=#000000]dtlimitz
                        [/color][color=#0A246A]fstsw    [/color][color=#FF8000]ax
                        [/color][color=#0A246A]sahf
                        ja     [/color][color=#000000]backup0x
                        [/color][color=#0A246A]jmp    [/color][color=#000000]lowlimit0x

                        backup0x[/color][color=#0A246A]:
                        fld    [/color][color=#000000]@thisparticle.dpx
                        [/color][color=#0A246A]fsub    [/color][color=#000000]dtlimitz
                        [/color][color=#0A246A]fst    [/color][color=#000000]@tmp1
                        [/color][color=#0A246A]fld    [/color][color=#000000]dtlimitz
                        [/color][color=#0A246A]fsub    [/color][color=#000000]@tmp1
                        [/color][color=#0A246A]fst    [/color][color=#000000]@thisparticle.dpx

                        [/color][color=#0A246A]fld    [/color][color=#000000]@thisparticle.dvx
                        [/color][color=#0A246A]fchs
                        fst    [/color][color=#000000]@thisparticle.dvx

                    lowlimit0x[/color][color=#0A246A]:
                        finit
                        fld    [/color][color=#000000]@thisparticle.dpx
                        [/color][color=#0A246A]fcom    [/color][color=#000000]dtlimitf
                        [/color][color=#0A246A]fstsw    [/color][color=#FF8000]ax
                        [/color][color=#0A246A]sahf
                        jb    [/color][color=#000000]backlowx
                        [/color][color=#0A246A]jmp    [/color][color=#000000]uplimit1x

                        backlowx[/color][color=#0A246A]:
                        fld    [/color][color=#000000]@thisparticle.dpx
                        [/color][color=#0A246A]fsub    [/color][color=#000000]dtlimitf
                        [/color][color=#0A246A]fst    [/color][color=#000000]@tmp1
                        [/color][color=#0A246A]fld    [/color][color=#000000]dtlimitf
                        [/color][color=#0A246A]fsub    [/color][color=#000000]@tmp1
                        [/color][color=#0A246A]fst    [/color][color=#000000]@thisparticle.dpx

                        [/color][color=#0A246A]fld    [/color][color=#000000]@thisparticle.dvx
                        [/color][color=#0A246A]fchs
                        fst    [/color][color=#000000]@thisparticle.dvx

                    uplimit1x[/color][color=#0A246A]:
                        finit
                        fld    [/color][color=#000000]@thisparticle.dpx
                        [/color][color=#0A246A]fcom    [/color][color=#000000]dtlimitz
                        [/color][color=#0A246A]fstsw    [/color][color=#FF8000]ax
                        [/color][color=#0A246A]sahf
                        ja     [/color][color=#000000]backup1x
                        [/color][color=#0A246A]jmp    [/color][color=#000000]calcY

                        backup1x[/color][color=#0A246A]:
                        fld    [/color][color=#000000]@thisparticle.dpx
                        [/color][color=#0A246A]fsub    [/color][color=#000000]dtlimitz
                        [/color][color=#0A246A]fst    [/color][color=#000000]@tmp1
                        [/color][color=#0A246A]fld    [/color][color=#000000]dtlimitz
                        [/color][color=#0A246A]fsub    [/color][color=#000000]@tmp1
                        [/color][color=#0A246A]fst    [/color][color=#000000]@thisparticle.dpx

                        [/color][color=#0A246A]fld    [/color][color=#000000]@thisparticle.dvx
                        [/color][color=#0A246A]fchs
                        fst    [/color][color=#000000]@thisparticle.dvx
                calcY[/color][color=#0A246A]:                    
                    finit
                    fld    [/color][color=#000000]@calcparticle.dpy
                    [/color][color=#0A246A]fmul    [/color][color=#000000]@middle1
                    [/color][color=#0A246A]fld    [/color][color=#000000]@middle
                    [/color][color=#0A246A]fdiv        
                    fst    [/color][color=#000000]@forceYY    [/color][/font][font=Comic Sans MS][color=#008000];记录Y轴分力

                    [/color][/font][font=Fixedsys][color=#0A246A]fmul    [/color][color=#000000]dtm
                    [/color][color=#0A246A]fmul    [/color][color=#000000]dtt
                    [/color][color=#0A246A]fadd    [/color][color=#000000]@thisparticle.dvy
                    [/color][color=#0A246A]fst    [/color][color=#000000]@thisparticle.dvy    [/color][/font][font=Comic Sans MS][color=#008000];计算速度

                    [/color][/font][font=Fixedsys][color=#0A246A]finit
                    fld    [/color][color=#000000]dtt
                    [/color][color=#0A246A]fld    [/color][color=#000000]@thisparticle.dvy
                    [/color][color=#0A246A]fmul
                    fst     [/color][color=#000000]@tmp0
                    [/color][color=#0A246A]fld    [/color][color=#000000]@forceYY
                    [/color][color=#0A246A]fmul    [/color][color=#000000]dttt2
                    [/color][color=#0A246A]fadd    [/color][color=#000000]@tmp0    [/color][/font][font=Comic Sans MS][color=#008000];得到位移,计算边界
                    [/color][/font][font=Fixedsys][color=#0A246A]fst    [/color][color=#000000]@tmp0    [/color][/font][font=Comic Sans MS][color=#008000];暂存位移

                    [/color][/font][font=Fixedsys][color=#0A246A]fld    [/color][color=#000000]dtlimit
                    [/color][color=#0A246A]fld    [/color][color=#000000]@tmp0
                    [/color][color=#0A246A]fprem
                    fst    [/color][color=#000000]@tmp0    [/color][/font][font=Comic Sans MS][color=#008000];暂存余数.
                    [/color][/font][font=Fixedsys][color=#0A246A]fadd    [/color][color=#000000]@thisparticle.dpy    [/color][/font][font=Comic Sans MS][color=#008000];得到坐标
                    [/color][/font][font=Fixedsys][color=#0A246A]fst    [/color][color=#000000]@thisparticle.dpy

                    uplimity[/color][color=#0A246A]:
                        finit
                        fld    [/color][color=#000000]@thisparticle.dpy
                        [/color][color=#0A246A]fcom    [/color][color=#000000]dtlimitz
                        [/color][color=#0A246A]fstsw    [/color][color=#FF8000]ax
                        [/color][color=#0A246A]sahf
                        ja     [/color][color=#000000]backup0y
                        [/color][color=#0A246A]jmp    [/color][color=#000000]lowlimit0y

                        backup0y[/color][color=#0A246A]:
                        fld    [/color][color=#000000]@thisparticle.dpy
                        [/color][color=#0A246A]fsub    [/color][color=#000000]dtlimitz
                        [/color][color=#0A246A]fst    [/color][color=#000000]@tmp1
                        [/color][color=#0A246A]fld    [/color][color=#000000]dtlimitz
                        [/color][color=#0A246A]fsub    [/color][color=#000000]@tmp1
                        [/color][color=#0A246A]fst    [/color][color=#000000]@thisparticle.dpy

                        [/color][color=#0A246A]fld    [/color][color=#000000]@thisparticle.dvy
                        [/color][color=#0A246A]fchs
                        fst    [/color][color=#000000]@thisparticle.dvy

                    lowlimit0y[/color][color=#0A246A]:
                        finit
                        fld    [/color][color=#000000]@thisparticle.dpy
                        [/color][color=#0A246A]fcom    [/color][color=#000000]dtlimitf
                        [/color][color=#0A246A]fstsw    [/color][color=#FF8000]ax
                        [/color][color=#0A246A]sahf
                        jb    [/color][color=#000000]backlowy
                        [/color][color=#0A246A]jmp    [/color][color=#000000]uplimit1y

                        backlowy[/color][color=#0A246A]:
                        fld    [/color][color=#000000]@thisparticle.dpy
                        [/color][color=#0A246A]fsub    [/color][color=#000000]dtlimitf
                        [/color][color=#0A246A]fst    [/color][color=#000000]@tmp1
                        [/color][color=#0A246A]fld    [/color][color=#000000]dtlimitf
                        [/color][color=#0A246A]fsub    [/color][color=#000000]@tmp1
                        [/color][color=#0A246A]fst    [/color][color=#000000]@thisparticle.dpy

                        [/color][color=#0A246A]fld    [/color][color=#000000]@thisparticle.dvy
                        [/color][color=#0A246A]fchs
                        fst    [/color][color=#000000]@thisparticle.dvy

                    uplimit1y[/color][color=#0A246A]:
                        finit
                        fld    [/color][color=#000000]@thisparticle.dpy
                        [/color][color=#0A246A]fcom    [/color][color=#000000]dtlimitz
                        [/color][color=#0A246A]fstsw    [/color][color=#FF8000]ax
                        [/color][color=#0A246A]sahf
                        ja     [/color][color=#000000]backup1y
                        [/color][color=#0A246A]jmp    [/color][color=#000000]calcZ

                        backup1y[/color][color=#0A246A]:
                        fld    [/color][color=#000000]@thisparticle.dpy
                        [/color][color=#0A246A]fsub    [/color][color=#000000]dtlimitz
                        [/color][color=#0A246A]fst    [/color][color=#000000]@tmp1
                        [/color][color=#0A246A]fld    [/color][color=#000000]dtlimitz
                        [/color][color=#0A246A]fsub    [/color][color=#000000]@tmp1
                        [/color][color=#0A246A]fst    [/color][color=#000000]@thisparticle.dpy

                        [/color][color=#0A246A]fld    [/color][color=#000000]@thisparticle.dvy
                        [/color][color=#0A246A]fchs
                        fst    [/color][color=#000000]@thisparticle.dvy
                calcZ[/color][color=#0A246A]:                    
                    finit
                    fld    [/color][color=#000000]@calcparticle.dpz
                    [/color][color=#0A246A]fmul    [/color][color=#000000]@middle1
                    [/color][color=#0A246A]fld    [/color][color=#000000]@middle
                    [/color][color=#0A246A]fdiv        
                    fst    [/color][color=#000000]@forceZZ    [/color][/font][font=Comic Sans MS][color=#008000];记录Z轴分力

                    [/color][/font][font=Fixedsys][color=#0A246A]fmul    [/color][color=#000000]dtm
                    [/color][color=#0A246A]fmul    [/color][color=#000000]dtt
                    [/color][color=#0A246A]fadd    [/color][color=#000000]@thisparticle.dvz
                    [/color][color=#0A246A]fst    [/color][color=#000000]@thisparticle.dvz    [/color][/font][font=Comic Sans MS][color=#008000];计算速度

                    [/color][/font][font=Fixedsys][color=#0A246A]finit
                    fld    [/color][color=#000000]dtt
                    [/color][color=#0A246A]fmul    [/color][color=#000000]@thisparticle.dvz
                    [/color][color=#0A246A]fst     [/color][color=#000000]@tmp0
                    [/color][color=#0A246A]fld    [/color][color=#000000]@forceZZ
                    [/color][color=#0A246A]fmul    [/color][color=#000000]dttt2
                    [/color][color=#0A246A]fadd    [/color][color=#000000]@tmp0    [/color][/font][font=Comic Sans MS][color=#008000];得到位移,计算边界
                    [/color][/font][font=Fixedsys][color=#0A246A]fst    [/color][color=#000000]@tmp0    [/color][/font][font=Comic Sans MS][color=#008000];暂存位移

                    [/color][/font][font=Fixedsys][color=#0A246A]fld    [/color][color=#000000]dtlimit
                    [/color][color=#0A246A]fld    [/color][color=#000000]@tmp0
                    [/color][color=#0A246A]fprem
                    fst    [/color][color=#000000]@tmp0    [/color][/font][font=Comic Sans MS][color=#008000];暂存余数.
                    [/color][/font][font=Fixedsys][color=#0A246A]fadd    [/color][color=#000000]@thisparticle.dpz    [/color][/font][font=Comic Sans MS][color=#008000];得到坐标
                    [/color][/font][font=Fixedsys][color=#0A246A]fst    [/color][color=#000000]@thisparticle.dpz

                    uplimitz[/color][color=#0A246A]:
                        finit
                        fld    [/color][color=#000000]@thisparticle.dpz
                        [/color][color=#0A246A]fcom    [/color][color=#000000]dtlimitz
                        [/color][color=#0A246A]fstsw    [/color][color=#FF8000]ax
                        [/color][color=#0A246A]sahf
                        ja     [/color][color=#000000]backup0z
                        [/color][color=#0A246A]jmp    [/color][color=#000000]lowlimit0z

                        backup0z[/color][color=#0A246A]:
                        fld    [/color][color=#000000]@thisparticle.dpz
                        [/color][color=#0A246A]fsub    [/color][color=#000000]dtlimitz
                        [/color][color=#0A246A]fst    [/color][color=#000000]@tmp1
                        [/color][color=#0A246A]fld    [/color][color=#000000]dtlimitz
                        [/color][color=#0A246A]fsub    [/color][color=#000000]@tmp1
                        [/color][color=#0A246A]fst    [/color][color=#000000]@thisparticle.dpz

                        [/color][color=#0A246A]fld    [/color][color=#000000]@thisparticle.dvz
                        [/color][color=#0A246A]fchs
                        fst    [/color][color=#000000]@thisparticle.dvz

                    lowlimit0z[/color][color=#0A246A]:
                        finit
                        fld    [/color][color=#000000]@thisparticle.dpz
                        [/color][color=#0A246A]fcom    [/color][color=#000000]dtlimitf
                        [/color][color=#0A246A]fstsw    [/color][color=#FF8000]ax
                        [/color][color=#0A246A]sahf
                        jb    [/color][color=#000000]backlowz
                        [/color][color=#0A246A]jmp    [/color][color=#000000]uplimit1z

                        backlowz[/color][color=#0A246A]:
                        fld    [/color][color=#000000]@thisparticle.dpz
                        [/color][color=#0A246A]fsub    [/color][color=#000000]dtlimitf
                        [/color][color=#0A246A]fst    [/color][color=#000000]@tmp1
                        [/color][color=#0A246A]fld    [/color][color=#000000]dtlimitf
                        [/color][color=#0A246A]fsub    [/color][color=#000000]@tmp1
                        [/color][color=#0A246A]fst    [/color][color=#000000]@thisparticle.dpz

                        [/color][color=#0A246A]fld    [/color][color=#000000]@thisparticle.dvz
                        [/color][color=#0A246A]fchs
                        fst    [/color][color=#000000]@thisparticle.dvz

                    uplimit1z[/color][color=#0A246A]:
                        finit
                        fld    [/color][color=#000000]@thisparticle.dpz
                        [/color][color=#0A246A]fcom    [/color][color=#000000]dtlimitz
                        [/color][color=#0A246A]fstsw    [/color][color=#FF8000]ax
                        [/color][color=#0A246A]sahf
                        ja     [/color][color=#000000]backup1z
                        [/color][color=#0A246A]jmp    [/color][color=#000000]outcalc

                        backup1z[/color][color=#0A246A]:
                        fld    [/color][color=#000000]@thisparticle.dpz
                        [/color][color=#0A246A]fsub    [/color][color=#000000]dtlimitz
                        [/color][color=#0A246A]fst    [/color][color=#000000]@tmp1
                        [/color][color=#0A246A]fld    [/color][color=#000000]dtlimitz
                        [/color][color=#0A246A]fsub    [/color][color=#000000]@tmp1
                        [/color][color=#0A246A]fst    [/color][color=#000000]@thisparticle.dpz

                        [/color][color=#0A246A]fld    [/color][color=#000000]@thisparticle.dvz
                        [/color][color=#0A246A]fchs
                        fst    [/color][color=#000000]@thisparticle.dvz

        
        outcalc[/color][color=#0A246A]:
            mov    [/color][color=#FF8000]eax[/color][color=#0A246A],[/color][color=#000000]_which
            [/color][color=#0A246A]mul    [/color][color=#000000]sizeofdtparticle
            [/color][color=#0A246A]mov    [/color][color=#FF8000]esi[/color][color=#0A246A],offset [/color][color=#000000]dtparticle0
            [/color][color=#0A246A]add    [/color][color=#FF8000]esi[/color][color=#0A246A],[/color][color=#FF8000]eax        [/color][/font][font=Comic Sans MS][color=#008000];获取要与计算粒子计算的粒子相对于粒子0的偏移量
            
            [/color][/font][font=Fixedsys][color=#0A246A]finit
            assume    [/color][color=#FF8000]esi[/color][color=#0A246A]:ptr    [/color][color=#000000]PARTICLE
            [/color][color=#0A246A]fld    [/color][color=#000000]@thisparticle.dpx
            [/color][color=#0A246A]fstp    [[/color][color=#FF8000]esi[/color][color=#0A246A]][/color][color=#000000].dpx
            [/color][color=#0A246A]fld    [/color][color=#000000]@thisparticle.dpy
            [/color][color=#0A246A]fstp    [[/color][color=#FF8000]esi[/color][color=#0A246A]][/color][color=#000000].dpy
            [/color][color=#0A246A]fld    [/color][color=#000000]@thisparticle.dpz
            [/color][color=#0A246A]fstp    [[/color][color=#FF8000]esi[/color][color=#0A246A]][/color][color=#000000].dpz
            [/color][color=#0A246A]fld    [/color][color=#000000]@thisparticle.dvx
            [/color][color=#0A246A]fstp    [[/color][color=#FF8000]esi[/color][color=#0A246A]][/color][color=#000000].dvx
            [/color][color=#0A246A]fld    [/color][color=#000000]@thisparticle.dvy
            [/color][color=#0A246A]fstp    [[/color][color=#FF8000]esi[/color][color=#0A246A]][/color][color=#000000].dvy
            [/color][color=#0A246A]fld    [/color][color=#000000]@thisparticle.dvz
            [/color][color=#0A246A]fstp    [[/color][color=#FF8000]esi[/color][color=#0A246A]][/color][color=#000000].dvz
            [/color][color=#0A246A]assume    [/color][color=#FF8000]esi[/color][color=#0A246A]:nothing        [/color][/font][font=Comic Sans MS][color=#008000];保存要计算的粒子    
        
        [/color][/font][font=Fixedsys][color=#0A246A]pop    [/color][color=#FF8000]ecx    [/color][/font][font=Comic Sans MS][color=#008000];恢复
        [/color][/font][font=Fixedsys][color=#0A246A]inc    [/color][color=#FF8000]ecx
    [/color][color=#0A246A].endw
    ret
[/color][color=#000000]Calc    [/color][color=#0A246A]endp
[/color][/font][font=Comic Sans MS][color=#008000];==================================================
[/color][/font][font=Fixedsys][color=#000000]printfnumber    [/color][color=#0A246A]proc    uses [/color][color=#FF8000]eax ebx [/color][color=#000000]middlee[/color][color=#0A246A]:qword 
    local    [/color][color=#000000]@test
    [/color][color=#0A246A]mov    [/color][color=#FF8000]esi[/color][color=#0A246A],[/color][color=#000000]lpMemory

    [/color][color=#0A246A]mov    [/color][color=#FF8000]eax[/color][color=#0A246A],dword ptr [/color][color=#000000]middlee

    [/color][color=#0A246A]mov    [/color][color=#FF8000]ebx[/color][color=#0A246A],[/color][color=#000000]lprand0
    [/color][color=#0A246A].if    [/color][color=#FF8000]ebx[/color][color=#0A246A]>[/color][color=#800080]38000
        [/color][color=#0A246A]xor    [/color][color=#FF8000]ebx[/color][color=#0A246A],[/color][color=#FF8000]ebx
        [/color][color=#0A246A]mov    dword ptr [[/color][color=#FF8000]esi[/color][color=#0A246A]],[/color][color=#FF8000]eax
        [/color][color=#0A246A]mov    [/color][color=#000000]lprand0[/color][color=#0A246A],[/color][color=#FF8000]ebx
    [/color][color=#0A246A].else
        add    [/color][color=#FF8000]esi[/color][color=#0A246A],[/color][color=#000000]lprand0
        [/color][color=#0A246A]mov    dword ptr [[/color][color=#FF8000]esi[/color][color=#0A246A]],[/color][color=#FF8000]eax
        [/color][color=#0A246A]add    [/color][color=#000000]lprand0[/color][color=#0A246A],[/color][color=#800080]4
    [/color][color=#0A246A].endif 
    ret
[/color][color=#000000]printfnumber    [/color][color=#0A246A]endp
[/color][/font][font=Comic Sans MS][color=#008000];====================================================
[/color][/font][font=Fixedsys][color=#000000]Calc0    [/color][color=#0A246A]proc    uses [/color][color=#FF8000]ebx eax    [/color][/font][font=Comic Sans MS][color=#008000];线程函数,进行运算的
    [/color][/font][font=Fixedsys][color=#0A246A]local [/color][color=#000000]@test
    [/color][color=#0A246A]local [/color][color=#000000]@for
    [/color][color=#0A246A]invoke    [/color][color=#000000]WaitForSingleObject[/color][color=#0A246A],[/color][color=#000000]hEventCreate[/color][color=#0A246A],[/color][color=#000000]INFINITE    [/color][/font][font=Comic Sans MS][color=#008000];等待可以开始事件
    [/color][/font][font=Fixedsys][color=#0A246A].while [/color][color=#000000]TRUE
        [/color][color=#0A246A]mov    [/color][color=#FF8000]ebx[/color][color=#0A246A],[/color][color=#800080]350
        [/color][color=#0A246A].while    [/color][color=#FF8000]ebx[/color][color=#000000]![/color][color=#0A246A]=[/color][color=#800080]0
            [/color][color=#0A246A]dec    [/color][color=#FF8000]ebx
            [/color][color=#0A246A]push    [/color][color=#FF8000]ebx
            [/color][color=#0A246A]invoke    [/color][color=#000000]Calc[/color][color=#0A246A],[/color][color=#800080]0
            [/color][color=#0A246A]pop    [/color][color=#FF8000]ebx
        [/color][color=#0A246A].endw
        invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle0.dpx
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle0.dpy
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle0.dpz
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle0.dvx
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle0.dvy
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle0.dvz 
        [/color][color=#0A246A]invoke    [/color][color=#000000]Sleep[/color][color=#0A246A],[/color][color=#000000]dttime
        [/color][color=#0A246A]mov    [/color][color=#FF8000]eax[/color][color=#0A246A],[/color][color=#000000]eventout
        [/color][color=#0A246A].if    [/color][color=#FF8000]eax
            [/color][color=#0A246A]ret
        .endif
    .endw    
[/color][color=#000000]Calc0    [/color][color=#0A246A]endp
[/color][/font][font=Comic Sans MS][color=#008000];==================================================
[/color][/font][font=Fixedsys][color=#000000]Calc1    [/color][color=#0A246A]proc    uses [/color][color=#FF8000]ebx eax    [/color][/font][font=Comic Sans MS][color=#008000];线程函数,进行运算的
    [/color][/font][font=Fixedsys][color=#0A246A]local [/color][color=#000000]@test
    [/color][color=#0A246A]local [/color][color=#000000]@for
    [/color][color=#0A246A]invoke    [/color][color=#000000]WaitForSingleObject[/color][color=#0A246A],[/color][color=#000000]hEventCreate[/color][color=#0A246A],[/color][color=#000000]INFINITE    [/color][/font][font=Comic Sans MS][color=#008000];等待可以开始事件
    [/color][/font][font=Fixedsys][color=#0A246A].while [/color][color=#000000]TRUE
        [/color][color=#0A246A]mov    [/color][color=#FF8000]ebx[/color][color=#0A246A],[/color][color=#800080]350
        [/color][color=#0A246A].while    [/color][color=#FF8000]ebx[/color][color=#000000]![/color][color=#0A246A]=[/color][color=#800080]0
            [/color][color=#0A246A]dec    [/color][color=#FF8000]ebx
            [/color][color=#0A246A]push    [/color][color=#FF8000]ebx
            [/color][color=#0A246A]invoke    [/color][color=#000000]Calc[/color][color=#0A246A],[/color][color=#800080]1
            [/color][color=#0A246A]pop    [/color][color=#FF8000]ebx
        [/color][color=#0A246A].endw
        invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle1.dpx
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle1.dpy
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle1.dpz
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle1.dvx
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle1.dvy
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle1.dvz 
        [/color][color=#0A246A]invoke [/color][color=#000000]Sleep[/color][color=#0A246A],[/color][color=#000000]dttime
        [/color][color=#0A246A]mov    [/color][color=#FF8000]eax[/color][color=#0A246A],[/color][color=#000000]eventout
        [/color][color=#0A246A].if    [/color][color=#FF8000]eax
            [/color][color=#0A246A]ret
        .endif
    .endw
[/color][color=#000000]Calc1    [/color][color=#0A246A]endp
[/color][/font][font=Comic Sans MS][color=#008000];======================================================
[/color][/font][font=Fixedsys][color=#000000]Calc2    [/color][color=#0A246A]proc    uses [/color][color=#FF8000]ebx eax    [/color][/font][font=Comic Sans MS][color=#008000];线程函数,进行运算的
    [/color][/font][font=Fixedsys][color=#0A246A]local [/color][color=#000000]@test
    [/color][color=#0A246A]local [/color][color=#000000]@for
    [/color][color=#0A246A]invoke    [/color][color=#000000]WaitForSingleObject[/color][color=#0A246A],[/color][color=#000000]hEventCreate[/color][color=#0A246A],[/color][color=#000000]INFINITE    [/color][/font][font=Comic Sans MS][color=#008000];等待可以开始事件
    [/color][/font][font=Fixedsys][color=#0A246A].while [/color][color=#000000]TRUE
        [/color][color=#0A246A]mov    [/color][color=#FF8000]ebx[/color][color=#0A246A],[/color][color=#800080]350
        [/color][color=#0A246A].while    [/color][color=#FF8000]ebx[/color][color=#000000]![/color][color=#0A246A]=[/color][color=#800080]0
            [/color][color=#0A246A]dec    [/color][color=#FF8000]ebx
            [/color][color=#0A246A]push    [/color][color=#FF8000]ebx
            [/color][color=#0A246A]invoke    [/color][color=#000000]Calc[/color][color=#0A246A],[/color][color=#800080]2
            [/color][color=#0A246A]pop    [/color][color=#FF8000]ebx
        [/color][color=#0A246A].endw
        invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle2.dpx
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle2.dpy
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle2.dpz
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle2.dvx
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle2.dvy
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle2.dvz 
        [/color][color=#0A246A]invoke [/color][color=#000000]Sleep[/color][color=#0A246A],[/color][color=#000000]dttime
        [/color][color=#0A246A]mov    [/color][color=#FF8000]eax[/color][color=#0A246A],[/color][color=#000000]eventout
        [/color][color=#0A246A].if    [/color][color=#FF8000]eax
            [/color][color=#0A246A]ret
        .endif
    .endw
[/color][color=#000000]Calc2    [/color][color=#0A246A]endp
[/color][/font][font=Comic Sans MS][color=#008000];=========================================================
[/color][/font][font=Fixedsys][color=#000000]Calc3    [/color][color=#0A246A]proc    uses [/color][color=#FF8000]ebx eax    [/color][/font][font=Comic Sans MS][color=#008000];线程函数,进行运算的
    [/color][/font][font=Fixedsys][color=#0A246A]local [/color][color=#000000]@test
    [/color][color=#0A246A]local [/color][color=#000000]@for
    [/color][color=#0A246A]invoke    [/color][color=#000000]WaitForSingleObject[/color][color=#0A246A],[/color][color=#000000]hEventCreate[/color][color=#0A246A],[/color][color=#000000]INFINITE    [/color][/font][font=Comic Sans MS][color=#008000];等待可以开始事件
    [/color][/font][font=Fixedsys][color=#0A246A].while [/color][color=#000000]TRUE
        [/color][color=#0A246A]mov    [/color][color=#FF8000]ebx[/color][color=#0A246A],[/color][color=#800080]350
        [/color][color=#0A246A].while    [/color][color=#FF8000]ebx[/color][color=#000000]![/color][color=#0A246A]=[/color][color=#800080]0
            [/color][color=#0A246A]dec    [/color][color=#FF8000]ebx
            [/color][color=#0A246A]push    [/color][color=#FF8000]ebx
            [/color][color=#0A246A]invoke    [/color][color=#000000]Calc[/color][color=#0A246A],[/color][color=#800080]3
            [/color][color=#0A246A]pop    [/color][color=#FF8000]ebx
        [/color][color=#0A246A].endw
        invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle3.dpx
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle3.dpy
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle3.dpz
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle3.dvx
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle3.dvy
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle3.dvz 
        [/color][color=#0A246A]invoke [/color][color=#000000]Sleep[/color][color=#0A246A],[/color][color=#000000]dttime
        [/color][color=#0A246A]mov    [/color][color=#FF8000]eax[/color][color=#0A246A],[/color][color=#000000]eventout
        [/color][color=#0A246A].if    [/color][color=#FF8000]eax
            [/color][color=#0A246A]ret
        .endif
    .endw
[/color][color=#000000]Calc3    [/color][color=#0A246A]endp
[/color][/font][font=Comic Sans MS][color=#008000];-----------------------------------------------------
[/color][/font][font=Fixedsys][color=#000000]Calc4    [/color][color=#0A246A]proc    uses [/color][color=#FF8000]ebx eax    [/color][/font][font=Comic Sans MS][color=#008000];线程函数,进行运算的
    [/color][/font][font=Fixedsys][color=#0A246A]local [/color][color=#000000]@test
    [/color][color=#0A246A]local [/color][color=#000000]@for
    [/color][color=#0A246A]invoke    [/color][color=#000000]WaitForSingleObject[/color][color=#0A246A],[/color][color=#000000]hEventCreate[/color][color=#0A246A],[/color][color=#000000]INFINITE    [/color][/font][font=Comic Sans MS][color=#008000];等待可以开始事件
    [/color][/font][font=Fixedsys][color=#0A246A].while [/color][color=#000000]TRUE
        [/color][color=#0A246A]mov    [/color][color=#FF8000]ebx[/color][color=#0A246A],[/color][color=#800080]350
        [/color][color=#0A246A].while    [/color][color=#FF8000]ebx[/color][color=#000000]![/color][color=#0A246A]=[/color][color=#800080]0
            [/color][color=#0A246A]dec    [/color][color=#FF8000]ebx
            [/color][color=#0A246A]push    [/color][color=#FF8000]ebx
            [/color][color=#0A246A]invoke    [/color][color=#000000]Calc[/color][color=#0A246A],[/color][color=#800080]4
            [/color][color=#0A246A]pop    [/color][color=#FF8000]ebx
        [/color][color=#0A246A].endw
        invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle4.dpx
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle4.dpy
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle4.dpz
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle4.dvx
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle4.dvy
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle4.dvz 
        [/color][color=#0A246A]invoke [/color][color=#000000]Sleep[/color][color=#0A246A],[/color][color=#000000]dttime
        [/color][color=#0A246A]mov    [/color][color=#FF8000]eax[/color][color=#0A246A],[/color][color=#000000]eventout
        [/color][color=#0A246A].if    [/color][color=#FF8000]eax
            [/color][color=#0A246A]ret
        .endif
    .endw
[/color][color=#000000]Calc4    [/color][color=#0A246A]endp
[/color][color=#000000]Calc5    [/color][color=#0A246A]proc    uses [/color][color=#FF8000]ebx eax    [/color][/font][font=Comic Sans MS][color=#008000];线程函数,进行运算的
    [/color][/font][font=Fixedsys][color=#0A246A]local [/color][color=#000000]@test
    [/color][color=#0A246A]local [/color][color=#000000]@for
    [/color][color=#0A246A]invoke    [/color][color=#000000]WaitForSingleObject[/color][color=#0A246A],[/color][color=#000000]hEventCreate[/color][color=#0A246A],[/color][color=#000000]INFINITE    [/color][/font][font=Comic Sans MS][color=#008000];等待可以开始事件
    [/color][/font][font=Fixedsys][color=#0A246A].while [/color][color=#000000]TRUE
        [/color][color=#0A246A]mov    [/color][color=#FF8000]ebx[/color][color=#0A246A],[/color][color=#800080]350
        [/color][color=#0A246A].while    [/color][color=#FF8000]ebx[/color][color=#000000]![/color][color=#0A246A]=[/color][color=#800080]0
            [/color][color=#0A246A]dec    [/color][color=#FF8000]ebx
            [/color][color=#0A246A]push    [/color][color=#FF8000]ebx
            [/color][color=#0A246A]invoke    [/color][color=#000000]Calc[/color][color=#0A246A],[/color][color=#800080]5
            [/color][color=#0A246A]pop    [/color][color=#FF8000]ebx
        [/color][color=#0A246A].endw
        invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle5.dpx
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle5.dpy
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle5.dpz
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle5.dvx
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle5.dvy
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle5.dvz 
        [/color][color=#0A246A]invoke [/color][color=#000000]Sleep[/color][color=#0A246A],[/color][color=#000000]dttime
        [/color][color=#0A246A]mov    [/color][color=#FF8000]eax[/color][color=#0A246A],[/color][color=#000000]eventout
        [/color][color=#0A246A].if    [/color][color=#FF8000]eax
            [/color][color=#0A246A]ret
        .endif
    .endw
[/color][color=#000000]Calc5    [/color][color=#0A246A]endp
[/color][color=#000000]Calc6    [/color][color=#0A246A]proc    uses [/color][color=#FF8000]ebx eax    [/color][/font][font=Comic Sans MS][color=#008000];线程函数,进行运算的
    [/color][/font][font=Fixedsys][color=#0A246A]local [/color][color=#000000]@test
    [/color][color=#0A246A]local [/color][color=#000000]@for
    [/color][color=#0A246A]invoke    [/color][color=#000000]WaitForSingleObject[/color][color=#0A246A],[/color][color=#000000]hEventCreate[/color][color=#0A246A],[/color][color=#000000]INFINITE    [/color][/font][font=Comic Sans MS][color=#008000];等待可以开始事件
    [/color][/font][font=Fixedsys][color=#0A246A].while [/color][color=#000000]TRUE
        [/color][color=#0A246A]mov    [/color][color=#FF8000]ebx[/color][color=#0A246A],[/color][color=#800080]350
        [/color][color=#0A246A].while    [/color][color=#FF8000]ebx[/color][color=#000000]![/color][color=#0A246A]=[/color][color=#800080]0
            [/color][color=#0A246A]dec    [/color][color=#FF8000]ebx
            [/color][color=#0A246A]push    [/color][color=#FF8000]ebx
            [/color][color=#0A246A]invoke    [/color][color=#000000]Calc[/color][color=#0A246A],[/color][color=#800080]6
            [/color][color=#0A246A]pop    [/color][color=#FF8000]ebx
        [/color][color=#0A246A].endw
        invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle6.dpx
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle6.dpy
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle6.dpz
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle6.dvx
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle6.dvy
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle6.dvz 
        [/color][color=#0A246A]invoke [/color][color=#000000]Sleep[/color][color=#0A246A],[/color][color=#000000]dttime
        [/color][color=#0A246A]mov    [/color][color=#FF8000]eax[/color][color=#0A246A],[/color][color=#000000]eventout
        [/color][color=#0A246A].if    [/color][color=#FF8000]eax
            [/color][color=#0A246A]ret
        .endif
    .endw
[/color][color=#000000]Calc6    [/color][color=#0A246A]endp
[/color][color=#000000]Calc7    [/color][color=#0A246A]proc    uses [/color][color=#FF8000]ebx eax    [/color][/font][font=Comic Sans MS][color=#008000];线程函数,进行运算的
    [/color][/font][font=Fixedsys][color=#0A246A]local [/color][color=#000000]@test
    [/color][color=#0A246A]local [/color][color=#000000]@for
    [/color][color=#0A246A]invoke    [/color][color=#000000]WaitForSingleObject[/color][color=#0A246A],[/color][color=#000000]hEventCreate[/color][color=#0A246A],[/color][color=#000000]INFINITE    [/color][/font][font=Comic Sans MS][color=#008000];等待可以开始事件
    [/color][/font][font=Fixedsys][color=#0A246A].while [/color][color=#000000]TRUE
        [/color][color=#0A246A]mov    [/color][color=#FF8000]ebx[/color][color=#0A246A],[/color][color=#800080]350
        [/color][color=#0A246A].while    [/color][color=#FF8000]ebx[/color][color=#000000]![/color][color=#0A246A]=[/color][color=#800080]0
            [/color][color=#0A246A]dec    [/color][color=#FF8000]ebx
            [/color][color=#0A246A]push    [/color][color=#FF8000]ebx
            [/color][color=#0A246A]invoke    [/color][color=#000000]Calc[/color][color=#0A246A],[/color][color=#800080]7
            [/color][color=#0A246A]pop    [/color][color=#FF8000]ebx
        [/color][color=#0A246A].endw
        invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle7.dpx
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle7.dpy
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle7.dpz
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle7.dvx
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle7.dvy
        [/color][color=#0A246A]invoke    [/color][color=#000000]printfnumber[/color][color=#0A246A],[/color][color=#000000]dtparticle7.dvz 
        [/color][color=#0A246A]invoke [/color][color=#000000]Sleep[/color][color=#0A246A],[/color][color=#000000]dttime
        [/color][color=#0A246A]mov    [/color][color=#FF8000]eax[/color][color=#0A246A],[/color][color=#000000]eventout
        [/color][color=#0A246A].if    [/color][color=#FF8000]eax
            [/color][color=#0A246A]ret
        .endif
    .endw
[/color][color=#000000]Calc7    [/color][color=#0A246A]endp
[/color][/font][font=Comic Sans MS][color=#008000];=============================================================
[/color][/font][font=Fixedsys][color=#000000]starting    [/color][color=#0A246A]proc 
    local    [/color][color=#000000]@hThreadID 

    [/color][color=#0A246A]xor    [/color][color=#FF8000]eax[/color][color=#0A246A],[/color][color=#FF8000]eax
    [/color][color=#0A246A]mov    [/color][color=#000000]lprand0[/color][color=#0A246A],[/color][color=#FF8000]eax
    [/color][color=#0A246A]mov    [/color][color=#000000]lprand1[/color][color=#0A246A],[/color][color=#FF8000]eax
    [/color][color=#0A246A]mov    [/color][color=#FF8000]eax[/color][color=#0A246A],[/color][color=#800080]15
    [/color][color=#0A246A]mov    [/color][color=#000000]dttime[/color][color=#0A246A],[/color][color=#FF8000]eax

    [/color][color=#0A246A]mov    [/color][color=#000000]sizeofdtparticle[/color][color=#0A246A],sizeof [/color][color=#000000]dtparticle0

    [/color][color=#0A246A]invoke    [/color][color=#000000]CreateEvent[/color][color=#0A246A],[/color][color=#000000]NULL[/color][color=#0A246A],[/color][color=#000000]TRUE[/color][color=#0A246A],[/color][color=#000000]FALSE[/color][color=#0A246A],addr [/color][color=#000000]szEvent
    [/color][color=#0A246A]mov    [/color][color=#000000]hEventCreate[/color][color=#0A246A],[/color][color=#FF8000]eax[/color][/font][font=Comic Sans MS][color=#008000];创建产生事件

    [/color][/font][font=Fixedsys][color=#0A246A]xor    [/color][color=#FF8000]eax[/color][color=#0A246A],[/color][color=#FF8000]eax
    [/color][color=#0A246A]mov    [/color][color=#000000]eventout[/color][color=#0A246A],[/color][color=#FF8000]eax

    [/color][color=#0A246A]invoke     [/color][color=#000000]CreateThread[/color][color=#0A246A],[/color][color=#000000]NULL[/color][color=#0A246A],[/color][color=#000000]NULL[/color][color=#0A246A],addr [/color][color=#000000]Calc0[/color][color=#0A246A],[/color][color=#000000]NULL[/color][color=#0A246A],[/color][color=#000000]NULL[/color][color=#0A246A],addr [/color][color=#000000]@hThreadID
    [/color][color=#0A246A]mov    [/color][color=#000000]hThreadCreate0[/color][color=#0A246A],[/color][color=#FF8000]eax
    [/color][color=#0A246A]invoke     [/color][color=#000000]CreateThread[/color][color=#0A246A],[/color][color=#000000]NULL[/color][color=#0A246A],[/color][color=#000000]NULL[/color][color=#0A246A],addr [/color][color=#000000]Calc1[/color][color=#0A246A],[/color][color=#000000]NULL[/color][color=#0A246A],[/color][color=#000000]NULL[/color][color=#0A246A],addr [/color][color=#000000]@hThreadID
    [/color][color=#0A246A]mov    [/color][color=#000000]hThreadCreate1[/color][color=#0A246A],[/color][color=#FF8000]eax
    [/color][color=#0A246A]invoke     [/color][color=#000000]CreateThread[/color][color=#0A246A],[/color][color=#000000]NULL[/color][color=#0A246A],[/color][color=#000000]NULL[/color][color=#0A246A],addr [/color][color=#000000]Calc2[/color][color=#0A246A],[/color][color=#000000]NULL[/color][color=#0A246A],[/color][color=#000000]NULL[/color][color=#0A246A],addr [/color][color=#000000]@hThreadID
    [/color][color=#0A246A]mov    [/color][color=#000000]hThreadCreate2[/color][color=#0A246A],[/color][color=#FF8000]eax
    [/color][color=#0A246A]invoke     [/color][color=#000000]CreateThread[/color][color=#0A246A],[/color][color=#000000]NULL[/color][color=#0A246A],[/color][color=#000000]NULL[/color][color=#0A246A],addr [/color][color=#000000]Calc3[/color][color=#0A246A],[/color][color=#000000]NULL[/color][color=#0A246A],[/color][color=#000000]NULL[/color][color=#0A246A],addr [/color][color=#000000]@hThreadID
    [/color][color=#0A246A]mov    [/color][color=#000000]hThreadCreate3[/color][color=#0A246A],[/color][color=#FF8000]eax
    [/color][color=#0A246A]invoke     [/color][color=#000000]CreateThread[/color][color=#0A246A],[/color][color=#000000]NULL[/color][color=#0A246A],[/color][color=#000000]NULL[/color][color=#0A246A],addr [/color][color=#000000]Calc4[/color][color=#0A246A],[/color][color=#000000]NULL[/color][color=#0A246A],[/color][color=#000000]NULL[/color][color=#0A246A],addr [/color][color=#000000]@hThreadID
    [/color][color=#0A246A]mov    [/color][color=#000000]hThreadCreate4[/color][color=#0A246A],[/color][color=#FF8000]eax
    [/color][color=#0A246A]invoke     [/color][color=#000000]CreateThread[/color][color=#0A246A],[/color][color=#000000]NULL[/color][color=#0A246A],[/color][color=#000000]NULL[/color][color=#0A246A],addr [/color][color=#000000]Calc5[/color][color=#0A246A],[/color][color=#000000]NULL[/color][color=#0A246A],[/color][color=#000000]NULL[/color][color=#0A246A],addr [/color][color=#000000]@hThreadID
    [/color][color=#0A246A]mov    [/color][color=#000000]hThreadCreate5[/color][color=#0A246A],[/color][color=#FF8000]eax
    [/color][color=#0A246A]invoke     [/color][color=#000000]CreateThread[/color][color=#0A246A],[/color][color=#000000]NULL[/color][color=#0A246A],[/color][color=#000000]NULL[/color][color=#0A246A],addr [/color][color=#000000]Calc6[/color][color=#0A246A],[/color][color=#000000]NULL[/color][color=#0A246A],[/color][color=#000000]NULL[/color][color=#0A246A],addr [/color][color=#000000]@hThreadID
    [/color][color=#0A246A]mov    [/color][color=#000000]hThreadCreate6[/color][color=#0A246A],[/color][color=#FF8000]eax
    [/color][color=#0A246A]invoke     [/color][color=#000000]CreateThread[/color][color=#0A246A],[/color][color=#000000]NULL[/color][color=#0A246A],[/color][color=#000000]NULL[/color][color=#0A246A],addr [/color][color=#000000]Calc7[/color][color=#0A246A],[/color][color=#000000]NULL[/color][color=#0A246A],[/color][color=#000000]NULL[/color][color=#0A246A],addr [/color][color=#000000]@hThreadID
    [/color][color=#0A246A]mov    [/color][color=#000000]hThreadCreate7[/color][color=#0A246A],[/color][color=#FF8000]eax

    [/color][color=#0A246A]invoke    [/color][color=#000000]Sleep[/color][color=#0A246A],[/color][color=#800080]1

    [/color][color=#0A246A]invoke    [/color][color=#000000]HeapCreate[/color][color=#0A246A],[/color][color=#000000]HEAP_NO_SERIALIZE[/color][color=#0A246A],[/color][color=#800080]38046[/color][color=#0A246A],[/color][color=#800080]0
    [/color][color=#0A246A].if    [/color][color=#FF8000]eax
        [/color][color=#0A246A]mov    [/color][color=#000000]hHeap[/color][color=#0A246A],[/color][color=#FF8000]eax
    [/color][color=#0A246A].endif
    invoke    [/color][color=#000000]HeapAlloc[/color][color=#0A246A],[/color][color=#000000]hHeap[/color][color=#0A246A],[/color][color=#000000]HEAP_NO_SERIALIZE[/color][color=#0A246A],[/color][color=#800080]38046
    [/color][color=#0A246A].if    [/color][color=#FF8000]eax
        [/color][color=#0A246A]mov    [/color][color=#000000]lpMemory[/color][color=#0A246A],[/color][color=#FF8000]eax
    [/color][color=#0A246A].endif

    invoke    [/color][color=#000000]SetEvent[/color][color=#0A246A],[/color][color=#000000]hEventCreate
    [/color][color=#0A246A]ret
[/color][color=#000000]starting    [/color][color=#0A246A]endp
[/color][/font][font=Comic Sans MS][color=#008000];==========================================================
[/color][/font][font=Fixedsys][color=#000000]getrand         [/color][color=#0A246A]proc    uses [/color][color=#FF8000]ebx ecx esi 
    [/color][color=#0A246A]xor    [/color][color=#FF8000]ecx[/color][color=#0A246A],[/color][color=#FF8000]ecx
    [/color][color=#0A246A]mov    [/color][color=#FF8000]ebx[/color][color=#0A246A],[/color][color=#000000]lprand1
    [/color][color=#0A246A]mov    [/color][color=#FF8000]esi[/color][color=#0A246A],[/color][color=#000000]lpMemory
    [/color][color=#0A246A].if    [/color][color=#FF8000]ebx[/color][color=#0A246A]>[/color][color=#800080]38000
        [/color][color=#0A246A]xor    [/color][color=#FF8000]ebx[/color][color=#0A246A],[/color][color=#FF8000]ebx
        [/color][color=#0A246A]mov    [/color][color=#000000]lprand1[/color][color=#0A246A],[/color][color=#FF8000]ebx
    [/color][color=#0A246A].else
        add    [/color][color=#FF8000]esi[/color][color=#0A246A],[/color][color=#FF8000]ebx
        [/color][color=#0A246A]add    [/color][color=#000000]lprand1[/color][color=#0A246A],[/color][color=#800080]4
    [/color][color=#0A246A].endif
    mov    [/color][color=#FF8000]eax[/color][color=#0A246A],dword ptr [[/color][color=#FF8000]esi[/color][color=#0A246A]]
    .while    [/color][color=#FF8000]eax[/color][color=#0A246A]==[/color][color=#800080]0
        [/color][color=#0A246A]invoke    [/color][color=#000000]Sleep[/color][color=#0A246A],[/color][color=#800080]50
        [/color][color=#0A246A]mov    [/color][color=#FF8000]eax[/color][color=#0A246A],dword ptr [[/color][color=#FF8000]esi[/color][color=#0A246A]]
    .endw
    mov    dword ptr [[/color][color=#FF8000]esi[/color][color=#0A246A]],[/color][color=#FF8000]ecx
    [/color][color=#0A246A]ret
[/color][color=#000000]getrand        [/color][color=#0A246A]endp
[/color][/font][font=Comic Sans MS][color=#008000];==================================================================
[/color][/font][font=Fixedsys][color=#000000]endrand        [/color][color=#0A246A]proc
    mov    [/color][color=#FF8000]eax[/color][color=#0A246A],[/color][color=#800080]1
    [/color][color=#0A246A]mov    [/color][color=#000000]eventout[/color][color=#0A246A],[/color][color=#FF8000]eax
    [/color][color=#0A246A]invoke    [/color][color=#000000]HeapDestroy[/color][color=#0A246A],[/color][color=#000000]hHeap
    [/color][color=#0A246A]ret
[/color][color=#000000]endrand        [/color][color=#0A246A]endp
[/color][/font][font=Comic Sans MS][color=#008000];================================================
[/color][/font][font=Fixedsys][color=#000000]DLLEntry    [/color][color=#0A246A]proc    [/color][color=#000000]_hInstance[/color][color=#0A246A],[/color][color=#000000]_dwReason[/color][color=#0A246A],[/color][color=#000000]_dwReserved
    [/color][color=#0A246A]push    [/color][color=#000000]_hInstance
    [/color][color=#0A246A]pop        [/color][color=#000000]hInstDLL
    [/color][color=#0A246A]mov    [/color][color=#FF8000]eax[/color][color=#0A246A],[/color][color=#000000]TRUE
    [/color][color=#0A246A]ret
[/color][color=#000000]DLLEntry    [/color][color=#0A246A]endp
    End        [/color][color=#000000]DLLEntry
[/color][/font]

加上颜色阅读比较方便。
2010-11-23 22:08
0
雪    币: 1708
活跃值: (586)
能力值: ( LV15,RANK:670 )
在线值:
发帖
回帖
粉丝
14
用 notepad2 的修改版可以轻松加上高质量的语法高亮。
2010-11-23 22:09
0
雪    币: 53
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
15
发这么长的代码也可以
大家都可以看到了,希望大家多提意见啊。共同进步
2010-11-23 22:33
0
雪    币: 43
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
16
这不是画蛇添足吗?要搞这么复杂,为什么非要自己搞这样的随机数,要用怎样个随机法才能满足要求?
2010-11-24 07:17
0
雪    币: 5
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
17
楼主强人,支持下
2010-11-24 08:07
0
雪    币: 161
活跃值: (31)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
18
呵呵,太高深了!
2010-11-24 08:11
0
雪    币: 53
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
19
有画蛇添足吗?嘿嘿,对于一般的使用来说,确实是,但如果是想加密的话,那么质量就很重要了,即使我知道没有人会花那么大精力去破解,但既然可以做到更好,我们为什么不去做呢?在做的过程中可以学到很多东西,比如我前两天还不知道FPU呢,今天就可以熟练的用汇编做浮点运算了
2010-11-24 10:40
0
雪    币: 1450
活跃值: (95)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
rxb
20
对楼主的敬仰之情如滔滔江水连绵不绝。。楼主的思想。。不能望其项背。。
2010-11-24 10:57
0
雪    币: 14
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
21
  不错嘛 最近 遇到问题需要随机出100w个。。。。不同随机数。。。   参考看看  3q
2010-11-24 12:01
0
雪    币: 1
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
22
有高手润色就是不一样
2010-11-24 12:15
0
游客
登录 | 注册 方可回帖
返回
//