试图在HLA中找到阶乘

时间:2018-08-07 03:58:29

标签: hla

我正在尝试在HLA中查找数字的阶乘,但是,我的代码只是在计算输入的值。我正在递增两个要相乘的数字,但是它以某种方式使其中一个保持不变。请告知。

mov( 1, BL );           //move factorial to CL
mov( 0, DX );                   //Init total (DX) to 0

LpA:

InitLpA:
mov( 1, AL );                   //move to AL
mov( 1, AH );

LpATerminationTest:
cmp( AL, value );               //compare 1 to value entered
jle LpABody;                    //if less than or equal jump to loop body
jmp LpAExit;                    //otherwise jump to exit

LpABody:
mul( AH );                      //multiply i (AL) by factorial (CL)
mov( AX, DX );                  //add the result (AX) to total (DX)
stdout.put( "DX is now: " )
stdout.puti16( DX );
stdout.put( nl );

LpAIncrement:
inc( AL );
inc( AH );

jmp LpATerminationTest;

0 个答案:

没有答案