Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Assembly HLA组装中如何正确划分数字_Assembly_Nasm_Hla - Fatal编程技术网

Assembly HLA组装中如何正确划分数字

Assembly HLA组装中如何正确划分数字,assembly,nasm,hla,Assembly,Nasm,Hla,我在HLA-nasm中得到了整数溢出。我想编写一个简单的程序,将提供的距离变量除以15000,并显示对它的求值,但我遇到了这个问题。我根本不明白在HLA中划分的概念。提前感谢您的帮助 program zad2; #include( "stdlib.hhf"); static f : int32 := 15000; s : int32 := 300000; Distance: int32; begin zad2; stdout.

我在
HLA-nasm
中得到了
整数溢出。我想编写一个简单的程序,将提供的
距离
变量除以15000,并显示对它的求值,但我遇到了这个问题。我根本不明白在
HLA
中划分的概念。提前感谢您的帮助

program zad2;
#include( "stdlib.hhf");

static
    f    :  int32   := 15000;
    s    :  int32   := 300000;
    Distance: int32;

begin zad2;

        stdout.put("Give car distance", nl);
        stdin.get(Distance);
        if (Distance<150000) then
            MOV(15000, eax);
            div(Distance, EDX:EAX );
                stdout.put("div evaluation:",eax ,nl);
                    jmp menu0;
            endif
end zad2;
程序zad2;
#包括(“stdlib.hhf”);
静止的
f:int32:=15000;
s:int32:=300000;
距离:int32;
开始zad2;
标准放置(“给出车辆距离”,nl);
stdin.get(距离);

如果(距离我找到了它的分辨率。请看一下。所有带有
hla div
的东西在
Windows
版本的hla编译器上都不能正常工作。它应该是这样的。我希望它能对某人有所帮助;)


您需要将0扩展到edx,因为它是保存余数的寄存器。

您忘记在
edx
中放入有意义的内容。因此,让我们假设距离=15000,得到1作为距离/f,我该怎么做?在这种情况下,将0放入
edx
。请记住,我从来没有在HLA编程,所以我可能只是在说废话。然而,这是我看到这段代码后想到的第一件事。
mov(Distance, eax);
mov(15000, ebx);
div(ebx);
mov(eax, age);
mov(0, edx)
mov(15000, eax);
div(distance, edx:eax);