我刚刚编写了将整数分十进制为oct或hex或bin整数的程序。
BR MAIN
J: .BLOCK 2
H: .BLOCK 2
X: .WORD 0
Y: .WORD 0
msg1: .ascii "Enter a decimal number to be converted\x00"
msg2: .ascii "Enter a new base\x00"
msg3: .ascii "The answer is\x00"
MAIN: STRO msg1,d
CHARO '\n',i
DECI J,d
STRO msg2,d
CHARO '\n',i
DECI H,d
STRO msg3,d
CHARO '\n',i
LOOP: LDA J,d
SUBA H,d
STA J,d
LDA J,d
BRLT finish2
LDA X,d
ADDA 1,i
STA X,d
LDA J,d
CPA H,d
BRLT finish1
BR LOOP
finish1: LDA J,d
CPA 10,i
BREQ A
CPA 11,i
BREQ B
CPA 12,i
BREQ C
CPA 13,i
BREQ D
CPA 14,i
BREQ E
CPA 15,i
BREQ F
DECO J,d
LDA X,d
STA J,d
LDA X,d
BREQ final
LDA 0,i
STA X,d
BR LOOP
finish2: LDA J,d
ADDA H,d
STA J,d
BR finish1
BR LOOP
A: CHARO "A",i
Z: LDA X,d
STA J,d
LDA X,d
BREQ final
LDA 0,i
STA X,d
BR LOOP
B: CHARO "B",i
BR Z
C: CHARO "C",i
BR Z
D: CHARO "D",i
BR Z
E: CHARO "E",i
BR Z
F: CHARO "F",i
BR Z
final: STOP
.END
我希望1234的输出为4D2,但实际输出为2D4。
如何在pep8程序集中正确打印字符串输出?