Move 指令寻址方式

1:Moving immediate data to registers and memory

movl $0, %eax                  # moves the value 0 to the EAX register
movl $0x80, %ebx            # moves the hexadecimal value 80 to the EBX register
movl $100, height             # moves the value 100 to the height memory location

2:Moving data between registers

The eight general-purpose registers (EAX, EBX, ECX, EDX, EDI, ESI, EBP, and ESP) are the most common
registers used for holding data.
(1): These registers can be moved to any other type of register available.
(2):the special-purpose registers (the control, debug, and segment registers) can only be moved to or from a general-purpose register.
 (3):Moving data between similarly sized registers

3:Moving data between memory and registers

 (1):Moving data values from memory to a register

       movl value, %eax

 (2):Moving data values from a register to memory

      movl %ecx, value

 (3):Using indexed memory locations

values:
.int 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60
When referencing data in the array, you must use an index system to determine which value you are accessing.
 The way this is done is called indexed memory mode. The memory location is determined by the
following:
❑ A base address
❑ An offset address to add to the base address
❑ The size of the data element
❑ An index to determine which data element to select
The format of the expression is   base_address(offset_address, index, size)
The data value retrieved is located at
base_address + offset_address + index * size
If any of the values are zero, they can be omitted (but the commas are still required as placeholders).
movl values(, %edi, 4), %eax

 (4):Using indirect addressing with registers

When a register holds a memory address, it is referred to as a pointer.
Accessing the data stored in the memory location using the pointer is called indirect addressing.,
movl $output, %edi
movl %edx, 4(%edi)
movl %ebx, (%edi)
A:   it enables you to control memory address locations with a register. 
B:   The real power is realized by incrementing the indirect addressing value contained in the register.



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Farmwang

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值