[英]HLA program is an infinite loop?
So the program I'm trying to write in HLA should do the dollowing: I enter a digit, and it gives a pattern of numbers.所以我试图用 HLA 编写的程序应该执行以下操作:我输入一个数字,它会给出一个数字模式。 The pattern should show all the odd numbers from 1 up to that number followed by all the even numbers from 2 up to that number.
该模式应显示从 1 到该数字的所有奇数,然后是从 2 到该数字的所有偶数。 Here is my code:
这是我的代码:
program boxit;
#include ("stdlib.hhf");
static iDatavalue : int8 := 0 ;
Begin boxit;
stdout.put("Gimme a decimal value to use as n: ");
stdin.get(iDatavalue);
mov(iDatavalue, BH);
DoWhileLp:
DoWhileLpBody:
ForLp:
InitializeForLp:
mov(BH, CH);
ForLpTerminationTest:
cmp(CH, 0);
jnl ForLpDone;
ForLpBody:
stdout.put("I = ", CH, nl);
ForLpIncrement:
dec(CH);
jmp ForLpTerminationTest;
ForLpDone:
dec(CH);
DoWhileLpTermination:
cmp(CH, 0);
jbe DoWhileLpDone;
jmp DoWhileLpBody;
DoWhileLpDone:
stdout.puti8(BH);
end boxit;
However, it is a infinite loop and I'm not sure how to solve this issue.但是,这是一个无限循环,我不确定如何解决这个问题。
I Highly appreciate any and all help!我非常感谢所有帮助!
ENVIRONMENT环境
NOTE笔记
EXAMPLE例子
program Boxit;
#include ("stdlib.hhf");
begin Boxit;
stdout.put("Gimme a decimal value to use as n: ");
stdin.geti32();
for ( xor(EBX, EBX); EBX <= EAX; add(2, EBX) ) do
stdout.puti32(EBX);
stdout.put(", ");
endfor;
stdout.newln();
for ( mov(1, EBX); EBX <= EAX; add(2, EBX) ) do
stdout.puti32(EBX);
stdout.put(", ");
endfor;
end Boxit;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.