在x86中区分Ah和10

distinguish between Ah and 10 in x86

如何区分AH作为CPU寄存器和Ah作为数字10?

mov BH, AH

在前面写一个零:

mov BH, 0AH

通常,以字母开头的十六进制数在汇编程序中不会被解释为十六进制数,因为它可能与标识符混淆。这就是为什么许多汇编程序强制您添加前缀“$”、“#”或“0x”或以数字开头的十六进制数(例如“0”,以免更改其值),以避免被解析为标识符。

MOV BH,AH  ;AH is a CPU register. It cannot be a symbol (equate or variable)
MOV BH,0AH ;AH is the hexadecimal value "0A" (10 in decimal)
MOV BH,$A  ;A is the hexadecimal value "0A" in some assemblers
MOV BH,#A  ;A is the hexadecimal value "0A" in some assemblers
MOV BH,0xA ;A is the hexadecimal value "0A" in some assemblers