代码不减1

时间:2016-01-13 23:32:43

标签: assembly hla

我目前正在尝试学习装配,但我有点困难

这是我到目前为止所拥有的

//   File:   squaretable.hla

     program squaretable;
        #include( "stdlib.hhf" );
        static
            zBeginNum: int32; //Create Variable that is 32bits?

     begin squaretable;
       //Ask them for the number
       //Print that number while reducing it by one on each sides
       stdout.put("Gimme a starting value: ");
       //Get the int and put it into ZBeginNum (Lets say 15)
       stdin.get(zBeginNum);
       //Write zBeginNum (15)
       stdout.put(zBeginNum, " ", nl);
       //Move/Copy the value of zBeginNum into EBX (EBX is now 15)
       mov(zBeginNum, EBX);
       //Move/Copy the value of 1 into ECX (ECX is now 1)
       mov(1 , ECX);
       //Subtract ECX from EBX ( EBX - 1 -> 15 - 1 = EBX)
       sub(EBX, ECX);
       //Move/Copy the value of EBX into zBeginNum (zBeginNum = EBX (14))
       mov(EBX, zBeginNum);
       //Print out the new zBeginNum(14)
       stdout.put(zBeginNum,nl);;

     end squaretable;

我的代码应该使用给定的数字并从中减去1。它最后保持打印15。不确定为什么?

0 个答案:

没有答案
相关问题