【发布时间】:2020-11-28 18:00:41
【问题描述】:
这是我目前所拥有的,但我无法让它工作。我需要让它输入一个被除数和一个除数,然后将结果与余数一起输出。示例:如果输入是 33 后跟 6,则输出将是 5 后跟 3,因为 33/6 是 5 余数 3。
00 INP //ask the user
01 BRZ QUIT // halt the execution if input zero
02 STA DIVIDEND // store in dividend variable
03 INP // input dividor
04 BRZ QUIT // halt the execution if input zero
05 STA DIVISOR // store in divider variable
06 LDA DIVIDEND // load into acc
07 LOOP STA RESULT // store the temp result
08 LDA RESULT // load the result
09 SUB DIVISOR // subtract the dividor to acc BRP
10 BRP LOOP //loop if acc is positive or zero
11 LDA RESULT // load the result into acc
12 OUT // display the result
13 QUIT HLT // halt if zero
14 HLT // halt the execution
15 DIVIDEND DAT //declare variable
16 DIVISOR DAT
17 RESULT DAT
【问题讨论】:
-
它只显示剩余部分。但我需要它同时显示
标签: divide little-man-computer