简体   繁体   English

ASM和寄存器

[英]ASM and registers

I just have a question because I'm learning ASM languages at my school and I don't understand something: 我只是有一个问题,因为我在学校学习ASM语言,但我听不懂:

(BX)=0100H
MOV AX,BX

The address of the source (BX) is empty before the mov statement and I don't understand why. mov语句之前的源(BX)地址为空,我不明白为什么。 My idea is, that it's because there is nothing in BX. 我的想法是,这是因为BX中没有任何内容。 Is that true ? 真的吗 ?

It's Intel syntax. 这是Intel语法。

It all depends on the context. 这完全取决于上下文。 Does bx contain a pointer or a value? bx是否包含指针或值? What is the surrounding code? 周围的代码是什么?

lea     bx, somestring  ; abc
mov     ax, bx          ; ax contains pointer to abc
mov     ax, [bx]        ; ax will contain ba

It looks like you are moving the value 0100h directly to the bx register. 看来您正在将值0100h直接移到bx寄存器。

To take what's in the location 0100h you'll need to specify it as a pointer to a value (of size) at address. 要获取0100h位置中的内容,您需要将其指定为指向地址值(大小)的指针。

mov bx,WORD PTR ds:0x100 for word size mov bx,WORD PTR ds:0x100用于字长

mov bl,BYTE PTR ds:0x100 for byte size mov bl,BYTE PTR ds:0x100用于字节大小

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM