0

I'm currently trying to learn assembly but I'm having a bit of a hard time

This is what I have so far

//   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;

My code should take the number that was given and subtract 1 from it. It keeps printing 15 at the end. Not sure why?

0 Answers0