如何签署将一组 8 位数字扩展为 16 位并以小端格式存储它们。例如,我的内存位置中有以下数据。
Address = Value
0001 = 03 [counter]
0002 = 05
0003 = 43
0004 = 8C
结果:
Address = Value
0005 = 05 \ 05 => 00 05
0006 = 00 /
0007 = 43 \ 43 => 00 43
0008 = 00 /
0009 = 8C \ 8C => FF 8C
000A = FF /
我目前停留在以下代码上:
LXI D,0005H [memory location to store little endian]
LXI H,0001H
MOV C,M [initialize counter]
INX H [increment 1 and point to first data]
MOV A,M
CALL EXPAND
HLT
Expand: PUSH B
PUSH H
checkMSB: ANI 80H [Check the MSB to determine expand number whether is 00 or FF]
JZ SKIP
..... [still on process]
SKIP: STAX D [stuck at here]
INX H
MOV A,M
DCR C
JNZ checkMSB
POP H
POP B
HLT