它是如何工作的?我程序中的定界符和扩展寻址

How does it work? Delimiter and the Extended Addressing in my program

图书:IBM PC 汇编语言编程:第五版,作者:Peter Abel

p.143 程序:接受和显示名称

The movzx sets BX with the number of characters that were typed. In the mov,[bx] acts as an index register to facilitate extended addressing. The MOV combines the length in BX with the address of KBNAME and moves the 07H to the calculated address. for a lenth of 11, the instruction inserts 07H at KBNAME+11 (replacing the Enter character) following the name. The instruction in c10center

mov kbname[bx+1],'$'

inserts a $ delimiter following the 07H so that int 21h function 09H can display the name and sound the speaker

1  c10center proc near
2  movzx bx,actulen
3  mov kbname[bx],07
4  mov kbname[bx+1],'$'
5  mov dl,actulen
6  shr dl,1
7  neg dl
8  add dl,40
9  mov dh,12
10 call q20cursor
11 ret
12 c10center endp

我的问题是第 3 行中的 ,07 是做什么的?

我也很困惑第 4 行是如何工作的?分隔符?

第 3 行:将 "bell" 字符(实际上是字符 7;之所以称为 bell,是因为计算机在打印时会发出哔哔声)放在缓冲区 bx 指定的位置 kbname.请注意,它必须先移动(扩展为零,所以我想它是某种 8 位值?)actulen in bx,因为在 16 位 x86 中,它是一个或少数几个寄存器可用于索引寻址模式。

第 4 行做类似的事情,但 $ 字符位于字符串的下一个位置。

在 C 中,这两行就是

kbname[actulen] = 7;
kbname[actulen+1] = '$';

这本书谈到 "delimiter" 因为 int 21h/ah=09h 使用 $ 作为它必须显示的字符串已经结束的标记。在这方面,在 DOS 汇编程序中,以 $ 结尾的 ("ASCII$") 字符串与 C 的以 NUL 结尾的 ("ASCIIZ") 字符串非常相似(实际上,分隔符的选择更愚蠢,因为 $ 是一个字符这确实出现在 "normal" 您想要显示的字符串中)。