【发布时间】:2013-06-25 22:19:39
【问题描述】:
我正在尝试创建一个小型 nasm 程序,它在浮点中执行此操作
while(input <= 10^5) do
begin
input = input * 10
i = i - 1
end
nasm 中的等价程序如下
section .data
input: resd 1
n10: dd 0x41200000 ; 10
_start:
mov eax, 0x43480000 ; eax = 200
mov dword [input], eax ; input = eax = 200
mov edx, 0x49742400 ; 10^5
; %begin
mov ecx, 0 ; i = 0
jmp alpha
alpha:
cmp [input], edx ; input <= 10^5
jle _while
jmp log2
_while:
fld dword [input] ; input
fmul dword [n10] ; input * 10
fst dword [input] ; input = input
dec ecx ; i = i - 1
jmp alpha
_while 循环无限迭代
ecx / i gards 总是相同的value = 0(它被设置为 0)并且不会递减
【问题讨论】: