x86汇编程序陷入循环

时间:2016-10-28 18:38:19

标签: assembly x86

我正在编写一个x86汇编程序。由于某种原因,我的循环卡住了。我想知道是否有人可以帮我弄清楚为什么je语句不被执行?如果我将输出放在第二个循环中,它将永远输出直到崩溃。那么为什么je比较没有正常射击?

;;忽略compute_bs MACRO,它与我的问题无关;;

由于



interpolate_proc PROC	NEAR32
	push ebp
	mov ebp, esp
	fldz
	mov cx, degree
	
	START_LOOP:
		mov eax, 0
		cmp cx, 0
		je END_LOOP
		mov dx,0

		fld1
		SECOND_LOOP:
			cmp dx, cx   ;<-- Not executing. even though inc dx
			je SECOND_END

			mov ebx, array
			fld REAL4 PTR x
			mov ax, 8
			mul dx
			add ebx, eax
			fld REAL4 PTR [ebx]
			fsubr
			fmul
			inc dx
			jmp SECOND_LOOP
			
		SECOND_END:
			output prompt
			mov ebx, array
			compute_bs ebx, cx
			mov temp, eax
			fld REAL4 PTR temp
			fmul
			fadd
			
		dec cx
		jmp START_LOOP	
		
	END_LOOP:
	
	compute_bs ebx, cx
	mov temp, eax
	fld REAL4 PTR temp
	fadd
	fstp REAL4 PTR temp
	mov eax, temp
	mov esp, ebp
	pop ebp
interpolate_proc ENDP
END
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:3)

指令

mul dx

axdx相乘,并将32位产品放在dx:ax中,覆盖dx中的操作数。因此循环测试将失败。